:root {
    --bg1: #071124;
    --bg2: #0d1e3f;
    --panel: rgba(8, 15, 30, .84);
    --line: rgba(255, 255, 255, .08);
    --text: #f7fbff;
    --muted: #97a9c9;
    --accent: #5ac8ff;
    --accent2: #ffd24d;
    --good: #7bf2a7;
    --bad: #ff6b7a;
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, system-ui, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 20% 10%, rgba(90, 200, 255, .16), transparent 26%),
    radial-gradient(circle at 80% 20%, rgba(255, 210, 77, .12), transparent 20%),
    radial-gradient(circle at 50% 120%, rgba(123, 242, 167, .08), transparent 35%),
    linear-gradient(180deg, #132750 0%, #091329 56%, #060c18 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.shell {
    width: min(1120px, 100%);
    padding: 12px;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .35);
}

.stage {
    position: relative
}

canvas {
    width: 100%;
    display: block;
    aspect-ratio: 16/9;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, .08);
    background: linear-gradient(180deg, #172d56 0%, #0b1730 58%, #08101d 100%);
    touch-action: manipulation;
}

.hud {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    pointer-events: none
}

.hudGroup {
    display: flex;
    gap: 10px;
    flex-wrap: wrap
}

.pill {
    min-width: 82px;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: blur(8px);
    text-align: center;
    font-weight: 800;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18)
}

.pill small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .2px
}

.missionBar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 16px;
    width: min(460px, calc(100% - 420px));
    padding: 12px 14px;
    border-radius: 22px;
    background: var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    pointer-events: none
}

.missionTop, .missionBottom {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center
}

.missionTop strong {
    font-size: 16px
}

.missionTop span, .missionBottom span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800
}

.missionBottom {
    margin-top: 8px
}

.missionTrack {
    margin-top: 10px
}

.bottomBar {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between
}

.inputBar, .chargeBarWrap {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18)
}

.inputBar {
    padding: 10px 14px;
    min-width: 240px;
    max-width: 58%;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: .5px;
    cursor: text;
    user-select: none
}

.typed {
    color: var(--good)
}

.pending {
    color: #d8e6ff
}

.cursor {
    display: inline-block;
    width: 10px;
    color: var(--accent2)
}

.chargeBarWrap {
    padding: 12px 14px;
    min-width: 220px
}

.chargeTop {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 8px
}

.track {
    height: 10px;
    border-radius: 999px;
    background: #122543;
    overflow: hidden
}

.fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transition: width .12s
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 12px 0 2px
}

.btn {
    appearance: none;
    border: none;
    cursor: pointer;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 900;
    color: var(--text);
    background: #0f1d39;
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .18)
}

.btn.active {
    background: linear-gradient(180deg, #219cff, #1267c0)
}

.btn.play {
    background: linear-gradient(180deg, #28c56f, #149e52)
}

.btn:hover {
    filter: brightness(1.05)
}

.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(180deg, rgba(4, 8, 16, .18), rgba(4, 8, 16, .78));
    border-radius: 22px
}

.overlay.hidden {
    display: none
}

.card {
    width: min(520px, 100%);
    padding: 24px;
    border-radius: 28px;
    background: rgba(7, 13, 25, .92);
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .34);
    text-align: center
}

.logoRocket {
    width: 108px;
    height: 108px;
    margin: 0 auto 12px;
    display: block;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .28))
}

.title {
    font-size: 38px;
    line-height: 1.02;
    font-weight: 1000;
    margin: 0
}

.subtitle {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px
}

.menuRow {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 18px
}

.mini {
    font-size: 12px;
    color: var(--muted);
    margin-top: 14px
}

.statsRow {
    display: grid;
    grid-template-columns:repeat(3, 1fr);
    gap: 10px;
    margin-top: 18px
}

.box {
    padding: 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08)
}

.box strong {
    display: block;
    font-size: 22px;
    margin-top: 3px
}

.dangerLine {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 116px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 107, 122, .65), transparent);
    opacity: .75;
    pointer-events: none
}

.dangerText {
    position: absolute;
    right: 28px;
    bottom: 122px;
    color: rgba(255, 166, 176, .9);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .2em;
    text-transform: uppercase;
    pointer-events: none
}

.focusHint {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 122px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(8, 15, 30, .74);
    border: 1px solid rgba(255, 255, 255, .08);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    backdrop-filter: blur(8px);
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s
}

.focusHint.show {
    opacity: 1
}

.kbInput {
    position: fixed;
    left: -9999px;
    top: 0;
    opacity: 0;
    pointer-events: none
}

@media (max-width: 900px) {
    .missionBar {
        width: min(400px, calc(100% - 360px))
    }
}

@media (max-width: 720px) {
    body {
        padding: 8px
    }

    .shell {
        padding: 8px
    }

    .pill {
        min-width: 70px;
        padding: 8px 10px
    }

    .hud {
        top: 10px;
        left: 10px;
        right: 10px
    }

    .missionBar {
        top: 68px;
        left: 10px;
        right: 10px;
        transform: none;
        width: auto;
        padding: 10px 12px
    }

    .missionTop strong {
        font-size: 14px
    }

    .missionTop span, .missionBottom span {
        font-size: 11px
    }

    .inputBar {
        max-width: none;
        flex: 1;
        font-size: 16px;
        min-width: 0
    }

    .bottomBar {
        left: 10px;
        right: 10px;
        bottom: 10px;
        flex-direction: column;
        align-items: stretch
    }

    .chargeBarWrap {
        min-width: 0
    }

    .title {
        font-size: 30px
    }

    .dangerLine {
        left: 14px;
        right: 14px;
        bottom: 164px
    }

    .dangerText {
        bottom: 170px;
        right: 16px
    }

    .focusHint {
        bottom: 170px
    }

    .controls {
        gap: 8px
    }

    .btn {
        padding: 10px 14px
    }
}

body.embed-mode {
    padding: 0;
    min-height: 100vh;
    overflow: hidden
}

body.embed-mode .shell {
    width: 100%;
    height: 100vh;
    max-width: none;
    padding: 10px;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02))
}

body.embed-mode .stage {
    flex: 1;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden
}

body.embed-mode canvas {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: contain;
    border-radius: 16px
}

body.embed-mode .controls {
    flex: 0 0 auto;
    margin: 8px 0 0;
    gap: 8px
}

body.embed-mode .btn {
    padding: 9px 14px
}

@media (max-width: 720px) {
    body.embed-mode .shell {
        padding: 6px
    }

    body.embed-mode canvas {
        border-radius: 12px
    }

    body.embed-mode .controls {
        margin-top: 6px;
        gap: 6px
    }

    body.embed-mode .btn {
        padding: 8px 12px;
        font-size: 13px
    }
}
