:root {
    --starcade-cyan: #4cecff;
    --starcade-mint: #63f2bb;
    --starcade-pink: #ff54aa;
    --starcade-violet: #9d78ff;
    --starcade-gold: #ffe96f;
    color-scheme: dark;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

html,
body {
    width: 100%;
    min-width: 320px;
    min-height: 100%;
    margin: 0;
    overflow: hidden;
    color: #f8fbff;
    background: #010207;
}

button,
a {
    color: inherit;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

.starcade-shell {
    display: flex;
    justify-content: center;
    width: 100%;
    min-height: 100dvh;
    background:
        radial-gradient(ellipse at center, rgba(36, 44, 104, .22), transparent 55%),
        #010207;
}

.starcade-stage {
    position: relative;
    width: min(100%, calc(100dvh * .5625));
    height: 100dvh;
    min-height: 540px;
    overflow: hidden;
    background: #030511;
    box-shadow: 0 0 0 1px rgba(131, 173, 255, .1), 0 0 80px rgba(64, 86, 214, .14);
    isolation: isolate;
    touch-action: none;
}

.starcade-stage:fullscreen,
.starcade-stage:-webkit-full-screen {
    width: min(100vw, calc(100dvh * .5625));
    height: 100dvh;
    margin: auto;
}

#starcadeCanvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.starcade-scanlines {
    position: absolute;
    z-index: 2;
    inset: 0;
    opacity: .13;
    background: repeating-linear-gradient(180deg, rgba(255,255,255,.18) 0 1px, transparent 1px 4px);
    pointer-events: none;
    mix-blend-mode: overlay;
}

.starcade-header,
.starcade-scoreboard,
.starcade-mission,
.starcade-enemy-card,
.starcade-combat-card,
.starcade-feed,
.starcade-controls,
.starcade-fullscreen-prompt {
    position: absolute;
    z-index: 5;
}

.starcade-header {
    top: max(12px, env(safe-area-inset-top));
    right: 13px;
    left: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 7px 9px;
    border: 1px solid rgba(129, 178, 255, .18);
    border-bottom-color: rgba(76, 236, 255, .3);
    border-radius: 5px 5px 1px 1px;
    background: linear-gradient(90deg, rgba(7, 11, 30, .92), rgba(10, 9, 36, .9));
    box-shadow: 0 6px 0 rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.04);
    backdrop-filter: blur(9px);
}

.starcade-brand,
.starcade-live {
    display: flex;
    align-items: center;
}

.starcade-brand { gap: 8px; }
.starcade-brand > span:last-child { display: grid; }
.starcade-brand strong { font-size: clamp(10px, 3vw, 14px); letter-spacing: .14em; }
.starcade-brand small { margin-top: 2px; color: #657398; font-size: 5px; font-weight: 900; letter-spacing: .18em; }

.starcade-brand__mark {
    position: relative;
    width: 34px;
    height: 27px;
    border: 2px solid var(--starcade-cyan);
    background: rgba(76, 236, 255, .08);
    clip-path: polygon(39% 0, 61% 0, 68% 30%, 85% 38%, 85% 58%, 100% 58%, 100% 100%, 0 100%, 0 58%, 15% 58%, 15% 38%, 32% 30%);
    box-shadow: 0 0 13px rgba(76, 236, 255, .5);
}

.starcade-brand__mark i {
    position: absolute;
    right: 7px;
    bottom: 4px;
    left: 7px;
    height: 3px;
    background: var(--starcade-cyan);
}

.starcade-live {
    display: grid;
    grid-template-columns: auto auto;
    gap: 1px 5px;
    text-align: right;
}

.starcade-live i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--starcade-mint);
    box-shadow: 0 0 8px var(--starcade-mint);
    animation: starcade-pulse .75s ease-in-out infinite alternate;
}

.starcade-live span { color: var(--starcade-mint); font-size: 5px; font-weight: 950; letter-spacing: .12em; }
.starcade-live strong { grid-column: 1 / 3; font-size: 10px; letter-spacing: .08em; }

.starcade-scoreboard {
    top: calc(max(12px, env(safe-area-inset-top)) + 59px);
    right: 13px;
    left: 13px;
    display: grid;
    grid-template-columns: 1.45fr 1fr .5fr;
    min-height: 53px;
    border: 1px solid rgba(136, 165, 230, .16);
    background: rgba(4, 7, 22, .82);
    backdrop-filter: blur(8px);
}

.starcade-scoreboard > div {
    display: grid;
    align-content: center;
    padding: 7px 9px;
    border-right: 1px solid rgba(136, 165, 230, .13);
}

.starcade-scoreboard > div:last-child { border-right: 0; text-align: right; }
.starcade-scoreboard span { color: #627096; font-size: 5px; font-weight: 900; letter-spacing: .14em; }
.starcade-scoreboard strong { margin-top: 2px; font-size: clamp(11px, 3.4vw, 17px); letter-spacing: .08em; }
.starcade-scoreboard > div:first-child strong { color: var(--starcade-gold); text-shadow: 0 0 12px rgba(255, 233, 111, .35); }
.starcade-scoreboard > div:nth-child(2) strong { color: #aeb9d8; font-size: clamp(9px, 2.8vw, 14px); }
.starcade-scoreboard > div:last-child strong { color: var(--starcade-cyan); }

.starcade-mission {
    top: calc(max(12px, env(safe-area-inset-top)) + 119px);
    right: 13px;
    left: 13px;
    display: grid;
    grid-template-columns: 1fr 5px;
    gap: 9px;
    min-height: 48px;
    padding: 7px 9px;
    border-left: 3px solid var(--level-accent, var(--starcade-pink));
    background: linear-gradient(90deg, rgba(13, 12, 38, .88), rgba(6, 9, 25, .63));
    backdrop-filter: blur(6px);
}

.starcade-mission > div:first-child { display: grid; }
.starcade-mission span { color: var(--level-accent, var(--starcade-pink)); font-size: 5px; font-weight: 950; letter-spacing: .14em; }
.starcade-mission strong { margin: 2px 0; overflow: hidden; font-size: clamp(8px, 2.5vw, 12px); letter-spacing: .1em; text-overflow: ellipsis; white-space: nowrap; }
.starcade-mission small { overflow: hidden; color: #707c9e; font-size: 5px; font-weight: 800; letter-spacing: .06em; text-overflow: ellipsis; white-space: nowrap; }

.starcade-progress {
    position: relative;
    overflow: hidden;
    background: rgba(255,255,255,.08);
}

.starcade-progress i {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 100%;
    background: var(--level-accent, var(--starcade-pink));
    box-shadow: 0 0 8px var(--level-accent, var(--starcade-pink));
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform .25s linear;
}

.starcade-enemy-card,
.starcade-combat-card {
    top: calc(max(12px, env(safe-area-inset-top)) + 176px);
    min-height: 54px;
    padding: 7px 8px;
    border: 1px solid rgba(125, 151, 215, .14);
    background: rgba(4, 7, 20, .69);
    backdrop-filter: blur(6px);
}

.starcade-enemy-card { left: 13px; width: 42%; }
.starcade-combat-card { right: 13px; width: 51%; }
.starcade-enemy-card > span,
.starcade-combat-card > span { display: block; margin-bottom: 5px; color: #606d91; font-size: 5px; font-weight: 950; letter-spacing: .12em; }

#starcadeEnemyRoster {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 23px;
}

#starcadeEnemyRoster i {
    position: relative;
    display: block;
    width: 18px;
    height: 13px;
    color: var(--enemy-color);
    background: currentColor;
    clip-path: polygon(18% 0, 82% 0, 82% 20%, 100% 20%, 100% 78%, 78% 78%, 78% 100%, 58% 100%, 58% 78%, 42% 78%, 42% 100%, 22% 100%, 22% 78%, 0 78%, 0 20%, 18% 20%);
    filter: drop-shadow(0 0 4px currentColor);
}

#starcadeEnemyRoster b { color: #7c88a8; font-size: 6px; }

.starcade-combat-card > strong {
    display: block;
    overflow: hidden;
    color: var(--starcade-mint);
    font-size: 7px;
    letter-spacing: .06em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.starcade-combat-card > div {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    margin-top: 6px;
}

.starcade-combat-card small { display: grid; color: #5f6b8e; font-size: 4px; font-weight: 900; letter-spacing: .08em; }
.starcade-combat-card b { margin-top: 2px; color: #eef5ff; font-size: 6px; letter-spacing: 0; }
#starcadeLives { color: var(--starcade-cyan); }
#starcadeShield { color: var(--starcade-mint); }

.starcade-combo {
    position: absolute;
    z-index: 7;
    top: 30%;
    right: -100px;
    display: grid;
    padding: 8px 17px 8px 11px;
    border: 1px solid rgba(255, 233, 111, .38);
    border-right: 0;
    background: rgba(13, 11, 35, .9);
    box-shadow: 0 0 24px rgba(255, 233, 111, .13);
    opacity: 0;
    transition: .25s ease;
}

.starcade-combo.is-visible { right: 0; opacity: 1; }
.starcade-combo span { color: #8b789c; font-size: 5px; font-weight: 950; letter-spacing: .15em; }
.starcade-combo strong { color: var(--starcade-gold); font-size: 24px; line-height: 1; text-shadow: 0 0 10px rgba(255, 233, 111, .5); }
.starcade-combo em { font-style: normal; }

.starcade-feed {
    right: 13px;
    bottom: calc(max(85px, env(safe-area-inset-bottom) + 77px));
    left: 13px;
    min-height: 39px;
    padding: 7px 9px;
    border: 1px solid rgba(127, 154, 222, .15);
    border-left: 3px solid var(--starcade-cyan);
    background: rgba(4, 7, 20, .79);
    backdrop-filter: blur(8px);
}

.starcade-feed span { display: block; color: #667397; font-size: 5px; font-weight: 950; letter-spacing: .12em; }
.starcade-feed span i { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--starcade-cyan); box-shadow: 0 0 6px var(--starcade-cyan); }
.starcade-feed strong { display: block; margin-top: 3px; overflow: hidden; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }

.starcade-level-callout {
    position: absolute;
    z-index: 8;
    top: 47%;
    left: 50%;
    display: grid;
    width: 78%;
    padding: 13px;
    border: 1px solid rgba(255,255,255,.14);
    border-right: 3px solid var(--level-accent, var(--starcade-pink));
    border-left: 3px solid var(--level-accent, var(--starcade-pink));
    background: linear-gradient(90deg, transparent, rgba(4, 6, 22, .93) 17% 83%, transparent);
    text-align: center;
    transform: translate(-50%, -50%) scale(.92);
    opacity: 0;
    pointer-events: none;
    transition: .25s ease;
}

.starcade-level-callout.is-visible { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.starcade-level-callout span { color: var(--level-accent, var(--starcade-pink)); font-size: 6px; font-weight: 950; letter-spacing: .24em; }
.starcade-level-callout strong { margin: 5px 0; font-size: clamp(19px, 6vw, 30px); letter-spacing: .08em; }
.starcade-level-callout small { color: #9ca7c3; font-size: 7px; font-weight: 900; letter-spacing: .14em; }

.starcade-pause,
.starcade-audio-gate {
    position: absolute;
    z-index: 20;
    inset: 0;
    align-content: center;
    justify-items: center;
    padding: 32px;
    text-align: center;
    background: rgba(2, 3, 12, .88);
    backdrop-filter: blur(12px);
}

.starcade-pause:not([hidden]) { display: grid; }
.starcade-pause span { color: var(--starcade-cyan); font-size: 8px; font-weight: 950; letter-spacing: .22em; }
.starcade-pause strong { margin: 9px 0 18px; font-size: 15px; }
.starcade-pause button,
.starcade-audio-gate button {
    min-width: 190px;
    min-height: 39px;
    border: 1px solid rgba(76, 236, 255, .4);
    border-radius: 3px;
    color: #06121b;
    background: linear-gradient(135deg, var(--starcade-mint), var(--starcade-cyan));
    font-size: 7px;
    font-weight: 950;
    letter-spacing: .08em;
    cursor: pointer;
}

.starcade-audio-gate { display: grid; background: radial-gradient(circle at center, rgba(30, 29, 86, .92), rgba(2, 3, 12, .97) 64%); }
.starcade-audio-gate.is-dismissed { display: none; }
.starcade-audio-gate__icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 13px; border: 1px solid rgba(76,236,255,.28); border-radius: 50%; color: var(--starcade-cyan); background: rgba(76,236,255,.07); box-shadow: 0 0 28px rgba(76,236,255,.12); }
.starcade-audio-gate__icon svg { width: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.starcade-audio-gate > span:nth-child(2) { color: var(--starcade-mint); font-size: 6px; font-weight: 950; letter-spacing: .16em; text-transform: uppercase; }
.starcade-audio-gate strong { margin-top: 8px; font-size: 19px; }
.starcade-audio-gate p { max-width: 275px; margin: 8px 0 18px; color: #8490ad; font-size: 7px; line-height: 1.6; }
.starcade-audio-gate button + button { margin-top: 8px; border-color: rgba(151,168,218,.2); color: #b7c0da; background: rgba(255,255,255,.04); }

.starcade-controls {
    right: 13px;
    bottom: max(13px, env(safe-area-inset-bottom));
    left: 13px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 5px;
    border: 1px solid rgba(127, 154, 222, .17);
    border-radius: 4px;
    background: rgba(4, 7, 19, .9);
    box-shadow: 0 -10px 30px rgba(0,0,0,.3);
    backdrop-filter: blur(10px);
}

.starcade-controls a,
.starcade-controls button {
    display: grid;
    place-items: center;
    min-width: 0;
    height: 35px;
    padding: 0;
    border: 1px solid rgba(130, 155, 220, .15);
    border-radius: 2px;
    color: #9aa7c7;
    background: rgba(255,255,255,.035);
    text-decoration: none;
    cursor: pointer;
}

.starcade-controls button:hover,
.starcade-controls a:hover { border-color: rgba(76, 236, 255, .35); color: var(--starcade-cyan); }
.starcade-controls svg { width: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.starcade-controls span { font-size: 7px; font-weight: 950; }
.starcade-controls .icon-play,
.starcade-controls .icon-muted,
.starcade-controls .icon-exit-fullscreen { display: none; }
.starcade-stage.is-paused .starcade-controls .icon-pause { display: none; }
.starcade-stage.is-paused .starcade-controls .icon-play,
.starcade-controls .is-muted .icon-muted { display: block; }
.starcade-controls .is-muted .icon-sound { display: none; }
.starcade-stage.is-fullscreen .icon-enter-fullscreen { display: none; }
.starcade-stage.is-fullscreen .icon-exit-fullscreen { display: block; }
.starcade-controls button.is-manual { color: var(--starcade-gold); }

.starcade-fullscreen-prompt {
    right: 18px;
    bottom: calc(max(13px, env(safe-area-inset-bottom)) + 52px);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid rgba(76, 236, 255, .22);
    border-radius: 3px;
    color: var(--starcade-cyan);
    background: rgba(5, 10, 28, .83);
    box-shadow: 0 0 20px rgba(76,236,255,.08);
    cursor: pointer;
    transition: opacity .2s ease;
}

.starcade-fullscreen-prompt svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.starcade-fullscreen-prompt span { display: grid; color: #7784a4; font-size: 5px; text-align: left; }
.starcade-fullscreen-prompt strong { color: #dbeeff; font-size: 7px; }
.starcade-stage.is-fullscreen .starcade-fullscreen-prompt { opacity: 0; pointer-events: none; }

@keyframes starcade-pulse {
    to { opacity: .35; transform: scale(.75); }
}

@media (max-height: 700px) {
    .starcade-enemy-card,
    .starcade-combat-card { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .starcade-live i { animation: none; }
    .starcade-level-callout,
    .starcade-combo { transition: none; }
}
