/* BLACKHORN · "Terminal Arcade" v2. A night-time trading floor with arcade energy: chamfered panels,
   chunky 3D pixel buttons, neon bars, and the Jersey 10 display face. Tokens match hq/hq.css. */

@font-face {
    font-family: 'Jersey 10';
    src: url('./assets/fonts/jersey-10.woff2') format('woff2');
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('./assets/fonts/jetbrains-mono-400.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('./assets/fonts/jetbrains-mono-700.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
    --ink: #06080b;
    --ink-2: #0a0e13;
    --panel: rgba(11, 15, 21, 0.9);
    --panel-solid: #0d1219;
    --panel-2: #121923;
    --line: #1e2833;
    --line-2: #2c3846;
    --bull: #b59aff;
    --bull-2: #d9caff;
    --bull-deep: #7450bd;
    --bull-dark: #26153d;
    --bear: #ff3b5c;
    --bear-2: #ff7e86;
    --bear-deep: #9e1537;
    --gold: #ffcb7a;
    --gold-2: #ffe3b8;
    --gold-deep: #9a6400;
    --info: #46b8f0;
    --info-deep: #1467a0;
    --text: #eaf0f5;
    --text-2: #a9b4c0;
    --muted: #6f7c8a;
    --display: 'Jersey 10', 'Courier New', monospace;
    --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
    --cut: 10px;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left, 0px);
    --safe-r: env(safe-area-inset-right, 0px);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    background: var(--ink);
    color: var(--text);
    font: 400 14px/1.45 var(--mono);
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

#app {
    position: fixed;
    inset: 0;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

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

.touch-surface {
    position: absolute;
    inset: 0;
    touch-action: none;
    z-index: 1;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* --- Shared: chamfered panels ------------------------------------------------ */
.panel,
.daily-card,
.receipt,
.card {
    position: relative;
    isolation: isolate;
    clip-path: polygon(
        var(--cut) 0,
        100% 0,
        100% calc(100% - var(--cut)),
        calc(100% - var(--cut)) 100%,
        0 100%,
        0 var(--cut)
    );
    background: var(--line-2);
}
.panel::before,
.daily-card::before,
.receipt::before,
.card::before {
    content: '';
    position: absolute;
    inset: 2px;
    z-index: -1;
    clip-path: polygon(
        calc(var(--cut) - 1px) 0,
        100% 0,
        100% calc(100% - var(--cut) + 1px),
        calc(100% - var(--cut) + 1px) 100%,
        0 100%,
        0 calc(var(--cut) - 1px)
    );
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 40%),
        var(--panel-solid);
}

/* --- Buttons: chunky pixel 3D ---------------------------------------------- */
.btn {
    --face: var(--panel-2);
    --edge: #05070a;
    --fg: var(--text);
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    padding: 8px 22px 12px;
    border: 0;
    color: var(--fg);
    background: var(--face);
    font: 400 26px/1 var(--display);
    letter-spacing: 0.04em;
    cursor: pointer;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.14),
        inset 0 -5px 0 var(--edge),
        inset 2px 0 0 rgba(255, 255, 255, 0.05),
        inset -2px 0 0 rgba(0, 0, 0, 0.25);
    transition:
        transform 60ms ease,
        filter 120ms ease;
    touch-action: manipulation;
}
.btn:hover {
    filter: brightness(1.12);
}
.btn:active {
    transform: translateY(3px);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.1),
        inset 0 -2px 0 var(--edge);
}
.btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}
.btn-primary {
    --face: var(--bull);
    --edge: var(--bull-deep);
    --fg: #04130d;
}
.btn-ghost {
    --face: rgba(18, 25, 35, 0.72);
    --edge: rgba(0, 0, 0, 0.55);
    --fg: var(--text-2);
    box-shadow:
        inset 0 0 0 2px var(--line-2),
        inset 0 -5px 0 rgba(0, 0, 0, 0.55);
}
.btn-ghost:hover {
    --fg: var(--text);
}
.btn-big {
    width: 100%;
    min-height: 74px;
    padding: 10px 18px 16px;
    font-size: clamp(30px, 8.5vw, 40px);
    animation: cta 2.4s ease-in-out infinite;
}
.btn-big small {
    font: 700 10px/1.2 var(--mono);
    letter-spacing: 0.08em;
    opacity: 0.8;
    text-transform: uppercase;
}
@keyframes cta {
    0%,
    100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.14) drop-shadow(0 0 14px rgba(181, 154, 255, 0.35));
    }
}
.btn-sq {
    min-width: 48px;
    padding: 8px 12px 12px;
    font-size: 20px;
}
.btn-sq svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    shape-rendering: crispEdges;
}

/* --- Floating joystick -------------------------------------------------- */
.joy {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    transition: opacity 90ms linear;
}
.joy::before,
.joy-knob {
    content: '';
    position: absolute;
    border-radius: 50%;
}
.joy::before {
    width: 120px;
    height: 120px;
    left: -60px;
    top: -60px;
    background: radial-gradient(circle, rgba(181, 154, 255, 0.08) 0 55%, rgba(181, 154, 255, 0) 72%);
    box-shadow:
        inset 0 0 0 2px rgba(123, 245, 166, 0.35),
        0 0 0 6px rgba(12, 9, 20, 0.25);
}
.joy-knob {
    width: 46px;
    height: 46px;
    left: -23px;
    top: -23px;
    background: radial-gradient(circle at 35% 30%, #b8ffd9, var(--bull) 45%, var(--bull-deep));
    box-shadow:
        0 0 18px rgba(181, 154, 255, 0.55),
        inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

/* --- HUD ----------------------------------------------------------------- */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 10px;
    padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
    pointer-events: none;
    background: linear-gradient(180deg, rgba(6, 8, 11, 0.72), rgba(6, 8, 11, 0));
    padding-bottom: 22px;
}
.hud-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.lvl-badge {
    flex: none;
    width: 46px;
    height: 50px;
    display: grid;
    place-content: center;
    text-align: center;
    color: #1e1300;
    background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, #e0a31a);
    clip-path: polygon(50% 0, 100% 24%, 100% 76%, 50% 100%, 0 76%, 0 24%);
    filter: drop-shadow(0 0 8px rgba(255, 203, 122, 0.35));
}
.lvl-badge small {
    font: 700 8px/1 var(--mono);
    letter-spacing: 0.14em;
    margin-bottom: -2px;
}
.lvl-badge b {
    font: 400 28px/0.9 var(--display);
}
.lvl-badge.pop {
    animation: pop 420ms cubic-bezier(0.2, 1.8, 0.4, 1);
}
@keyframes pop {
    0% {
        transform: scale(1.5);
    }
    100% {
        transform: scale(1);
    }
}
.hud-bars {
    flex: 1;
    min-width: 0;
    max-width: 240px;
    display: grid;
    gap: 4px;
}
.bar-row {
    display: flex;
    justify-content: space-between;
    font: 700 9px/1 var(--mono);
    letter-spacing: 0.14em;
    color: var(--text-2);
}
.bar-val {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.bar {
    position: relative;
    height: 12px;
    background: rgba(0, 0, 0, 0.55);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}
.bar::after {
    /* segment ticks + top gloss */
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 45%),
        repeating-linear-gradient(90deg, transparent 0 9px, rgba(0, 0, 0, 0.35) 9px 10px);
    pointer-events: none;
}
.bar i,
.bar em {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    transition: width 120ms linear;
}
.bar em {
    background: #fff;
    opacity: 0.55;
    transition: width 600ms cubic-bezier(0.4, 0, 0.8, 0.4) 180ms;
}
.bar-hp i {
    background: linear-gradient(180deg, var(--bull-2), var(--bull) 50%, var(--bull-deep));
    box-shadow: 0 0 10px rgba(181, 154, 255, 0.55);
}
.bar-hp.low i {
    background: linear-gradient(180deg, var(--bear-2), var(--bear) 50%, var(--bear-deep));
    box-shadow: 0 0 12px rgba(255, 59, 92, 0.7);
    animation: low 0.6s steps(2) infinite;
}
@keyframes low {
    50% {
        opacity: 0.6;
    }
}
.bar-xp {
    height: 6px;
}
.bar-xp::after {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 60%);
}
.bar-xp i {
    background: linear-gradient(90deg, var(--gold-deep), var(--gold) 60%, var(--gold-2));
    box-shadow: 0 0 8px rgba(255, 203, 122, 0.6);
}
.hud-mid {
    text-align: center;
    padding-top: 2px;
}
.hud-time {
    font: 400 44px/0.85 var(--display);
    letter-spacing: 0.02em;
    color: var(--text);
    text-shadow:
        0 3px 0 rgba(0, 0, 0, 0.6),
        0 0 18px rgba(234, 240, 245, 0.2);
    font-variant-numeric: tabular-nums;
}
.hud-wave {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 8px 2px;
    font: 700 9px/1 var(--mono);
    letter-spacing: 0.18em;
    color: var(--gold);
    background: rgba(255, 203, 122, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 203, 122, 0.28);
    text-transform: uppercase;
}
.hud-wave:empty {
    display: none;
}
.hud-right {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 10px;
}
.hud-score {
    text-align: right;
}
.hud-score small {
    display: block;
    font: 700 9px/1 var(--mono);
    letter-spacing: 0.18em;
    color: var(--muted);
    margin-bottom: 3px;
}
.hud-score b {
    font: 400 32px/0.85 var(--display);
    color: var(--gold);
    text-shadow:
        0 3px 0 rgba(0, 0, 0, 0.6),
        0 0 14px rgba(255, 203, 122, 0.35);
    font-variant-numeric: tabular-nums;
}
.icon-btn {
    pointer-events: auto;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 0;
    color: var(--text);
    background: rgba(13, 18, 25, 0.8);
    box-shadow:
        inset 0 0 0 2px var(--line-2),
        inset 0 -4px 0 rgba(0, 0, 0, 0.5);
    clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
    cursor: pointer;
}
.icon-btn:active {
    transform: translateY(2px);
}
.icon-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    shape-rendering: crispEdges;
}

.loadout {
    position: absolute;
    z-index: 4;
    top: calc(72px + var(--safe-t));
    left: calc(12px + var(--safe-l));
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: min(320px, 70vw);
    pointer-events: none;
}
.slot {
    position: relative;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    background: rgba(8, 12, 17, 0.8);
    box-shadow:
        inset 0 0 0 1px rgba(181, 154, 255, 0.35),
        inset 0 -3px 0 rgba(0, 0, 0, 0.4);
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}
.slot canvas {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}
.slot b {
    position: absolute;
    right: 2px;
    bottom: 0;
    font: 400 14px/1 var(--display);
    color: var(--gold);
    text-shadow:
        0 1px 0 #000,
        1px 0 0 #000,
        -1px 0 0 #000,
        0 -1px 0 #000;
}
.slot.passive {
    width: 30px;
    height: 30px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 203, 122, 0.3),
        inset 0 -3px 0 rgba(0, 0, 0, 0.4);
}
.slot.passive canvas {
    width: 24px;
    height: 24px;
}
.slot.maxed {
    box-shadow:
        inset 0 0 0 1px var(--gold),
        0 0 10px rgba(255, 203, 122, 0.4);
}
.slot-break {
    flex-basis: 100%;
    height: 0;
}

/* --- Boss bar --------------------------------------------------------------- */
.bossbar {
    position: absolute;
    z-index: 4;
    /* below the wave label and the Daily's bounty chip */
    top: calc(96px + var(--safe-t));
    left: 50%;
    transform: translateX(-50%);
    width: min(520px, 62vw);
    pointer-events: none;
    animation: slide-down 400ms cubic-bezier(0.2, 1.4, 0.4, 1);
}
.bossbar-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.bossbar-skull {
    width: 12px;
    height: 12px;
    background: var(--bear);
    clip-path: polygon(
        15% 0,
        85% 0,
        100% 20%,
        100% 60%,
        80% 75%,
        80% 100%,
        20% 100%,
        20% 75%,
        0 60%,
        0 20%
    );
    box-shadow: 0 0 8px var(--bear);
}
.bossbar-name {
    font: 400 22px/1 var(--display);
    letter-spacing: 0.06em;
    color: var(--bear);
    text-shadow:
        0 2px 0 #000,
        0 0 14px rgba(255, 59, 92, 0.6);
}
.bar-boss {
    height: 14px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 59, 92, 0.45),
        0 0 0 1px rgba(0, 0, 0, 0.7),
        0 0 16px rgba(255, 59, 92, 0.25);
}
.bar-boss i {
    background: linear-gradient(180deg, var(--bear-2), var(--bear) 50%, var(--bear-deep));
}
.bar-boss::after {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0) 45%),
        repeating-linear-gradient(90deg, transparent 0 10%, rgba(0, 0, 0, 0.5) 10% calc(10% + 2px));
}
@keyframes slide-down {
    from {
        transform: translate(-50%, -20px);
        opacity: 0;
    }
}

/* --- Toast: centre banner ----------------------------------------------------- */
.toast {
    position: absolute;
    z-index: 5;
    left: 50%;
    top: 30%;
    transform: translate(-50%, -8px) scale(0.92);
    opacity: 0;
    padding: 6px 18px 4px;
    font: 400 clamp(30px, 8vw, 46px) / 1 var(--display);
    letter-spacing: 0.04em;
    white-space: nowrap;
    color: var(--gold);
    text-shadow:
        0 3px 0 rgba(0, 0, 0, 0.7),
        0 0 22px currentColor;
    pointer-events: none;
    transition:
        opacity 160ms ease,
        transform 220ms cubic-bezier(0.2, 1.6, 0.4, 1);
}
.toast::before,
.toast::after {
    content: '▸▸';
    font-size: 0.55em;
    vertical-align: 0.25em;
    margin: 0 10px;
    opacity: 0.7;
}
.toast::after {
    content: '◂◂';
}
.toast.show {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}
.toast.gold {
    color: var(--gold);
}
.toast.bull {
    color: var(--bull);
}
.toast.bear {
    color: var(--bear);
}
.toast.whale {
    color: #9be2ff;
}

.hint-move {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: calc(18% + var(--safe-b));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 6px;
    font: 400 20px/1 var(--display);
    letter-spacing: 0.06em;
    color: var(--text);
    background: rgba(8, 12, 17, 0.7);
    box-shadow: inset 0 0 0 1px var(--line-2);
    white-space: nowrap;
    pointer-events: none;
    animation: hint-pulse 1.6s ease-in-out infinite;
}
.hint-hand {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bull);
    box-shadow: 0 0 10px var(--bull);
    animation: hint-drag 1.6s ease-in-out infinite;
}
.hint-keys {
    color: var(--muted);
}
@media (pointer: coarse) {
    .hint-keys {
        display: none;
    }
}
@keyframes hint-pulse {
    50% {
        opacity: 0.6;
    }
}
@keyframes hint-drag {
    0%,
    100% {
        transform: translateX(-4px);
    }
    50% {
        transform: translateX(6px);
    }
}

/* --- Boss intro: cinematic ---------------------------------------------------- */
.boss-card {
    position: absolute;
    z-index: 6;
    inset: 0;
    pointer-events: none;
    display: grid;
    place-items: center;
    animation: boss-fade 2.4s ease forwards;
}
.boss-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(120, 10, 30, 0.35), rgba(6, 8, 11, 0.7));
}
.bars-top,
.bars-bot {
    position: absolute;
    left: 0;
    right: 0;
    height: 12vh;
    background: #000;
    animation: bars-in 360ms cubic-bezier(0.2, 1, 0.3, 1);
}
.bars-top {
    top: 0;
}
.bars-bot {
    bottom: 0;
    --dir: 1;
}
.bars-top {
    --dir: -1;
}
@keyframes bars-in {
    from {
        transform: translateY(calc(var(--dir) * 100%));
    }
}
.boss-band {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(12vh + 6px);
    height: 26px;
    overflow: hidden;
    background: repeating-linear-gradient(-45deg, #ff3b5c 0 14px, #1a040c 14px 28px);
    box-shadow: 0 0 22px rgba(255, 59, 92, 0.5);
}
.boss-ticker {
    position: absolute;
    inset: 3px 0;
    background: #1a040c;
    display: flex;
    align-items: center;
    overflow: hidden;
}
.boss-ticker span {
    white-space: nowrap;
    font: 700 11px/1 var(--mono);
    letter-spacing: 0.2em;
    color: var(--bear-2);
    animation: ticker 6s linear infinite;
    padding-left: 100%;
}
@keyframes ticker {
    to {
        transform: translateX(-100%);
    }
}
.boss-center {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 20px;
    animation: boss-slam 520ms cubic-bezier(0.2, 1.6, 0.3, 1);
}
.boss-portrait {
    width: auto;
    height: min(34vh, 220px);
    image-rendering: pixelated;
    filter: drop-shadow(0 0 24px rgba(255, 59, 92, 0.55));
}
.boss-text {
    max-width: 22ch;
}
.boss-warn {
    font: 700 11px/1.2 var(--mono);
    letter-spacing: 0.2em;
    color: var(--bear-2);
    animation: blink 0.5s steps(2) 4;
}
.boss-title {
    text-transform: uppercase;
    font: 400 clamp(52px, 13vw, 104px) / 0.85 var(--display);
    color: var(--bear);
    text-shadow:
        0 5px 0 var(--bear-deep),
        0 0 30px rgba(255, 59, 92, 0.6);
    margin: 6px 0 8px;
}
.boss-tag {
    font: 400 14px/1.35 var(--mono);
    color: var(--text);
}
@keyframes boss-slam {
    0% {
        transform: scale(1.8);
        opacity: 0;
    }
    60% {
        transform: scale(0.96);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}
@keyframes boss-fade {
    0%,
    82% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}
@media (max-width: 560px) {
    .boss-center {
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }
    .boss-portrait {
        height: min(26vh, 170px);
    }
}

/* --- Screens -------------------------------------------------------------------- */
.screen {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* centred by the auto margins below, so a tall screen scrolls instead of clipping its top */
    gap: 14px;
    padding: calc(20px + var(--safe-t)) calc(16px + var(--safe-r)) calc(20px + var(--safe-b))
        calc(16px + var(--safe-l));
    text-align: center;
    overflow-y: auto;
    background: rgba(6, 8, 11, 0.7);
}
.screen > :first-child {
    margin-top: auto;
}
.screen > :last-child {
    margin-bottom: auto;
}
.screen-h {
    margin: 0;
    font: 400 44px/0.9 var(--display);
    letter-spacing: 0.04em;
    color: var(--text);
}
.panel {
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(420px, 100%);
}

/* Title: the live build plays behind a veil */
.title-veil {
    position: absolute;
    inset: 0;
    z-index: 7;
    pointer-events: none;
    background:
        radial-gradient(ellipse 75% 60% at 50% 40%, rgba(6, 8, 11, 0.18), rgba(6, 8, 11, 0.82)),
        linear-gradient(180deg, rgba(6, 8, 11, 0.1), rgba(6, 8, 11, 0.72));
    opacity: 0;
    transition: opacity 300ms ease;
}
body.on-title .title-veil {
    opacity: 1;
}
.screen-title {
    background: transparent;
    justify-content: space-between;
    gap: 10px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 6px;
    font: 700 11px/1 var(--mono);
    letter-spacing: 0.16em;
    color: var(--text);
    text-decoration: none;
    background: rgba(8, 12, 17, 0.8);
    box-shadow: inset 0 0 0 1px var(--line-2);
}
.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--bull);
    box-shadow: 0 0 8px var(--bull);
    animation: blink 1.2s steps(2) infinite;
}
@keyframes blink {
    50% {
        opacity: 0.25;
    }
}
.title-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: auto;
}
.title-bull {
    width: 228px;
    height: 168px;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 30px rgba(181, 154, 255, 0.3));
    margin-bottom: -18px;
}
.logo {
    position: relative;
    margin: 0;
    font: 400 clamp(64px, 19.5vw, 156px) / 0.8 var(--display);
    letter-spacing: 0.01em;
    color: var(--bull);
    text-shadow:
        0 6px 0 var(--bull-deep),
        0 12px 0 var(--bull-dark),
        0 0 44px rgba(181, 154, 255, 0.35);
}
.logo::after {
    /* a shine sweep across the wordmark */
    content: attr(data-text);
    position: absolute;
    inset: 0;
    color: transparent;
    background: linear-gradient(
            100deg,
            transparent 40%,
            rgba(255, 255, 255, 0.85) 50%,
            transparent 60%
        )
        no-repeat;
    background-size: 250% 100%;
    background-position: 150% 0;
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: none;
    animation: shine 4.5s ease-in-out infinite 1s;
}
@keyframes shine {
    0%,
    60% {
        background-position: 150% 0;
    }
    100% {
        background-position: -50% 0;
    }
}
.tagline {
    margin: 16px 0 0;
    color: var(--text-2);
    font-size: 14px;
}
/* Character select: one tap, remembered */
.char-pick {
    width: min(440px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.char-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 54px;
    padding: 6px 8px;
    border: 0;
    text-align: left;
    color: var(--text-2);
    background: rgba(18, 25, 35, 0.72);
    box-shadow: inset 0 0 0 2px var(--line-2);
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    cursor: pointer;
    touch-action: manipulation;
}
.char-btn[aria-checked='true'] {
    color: var(--text);
    background: rgba(181, 154, 255, 0.14);
    box-shadow:
        inset 0 0 0 2px var(--bull),
        0 0 18px rgba(181, 154, 255, 0.25);
}
.char-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}
.char-face {
    flex: none;
    width: 48px;
    height: auto;
    image-rendering: pixelated;
}
.char-text {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.char-text b {
    font: 400 24px/0.9 var(--display);
    letter-spacing: 0.04em;
}
.char-text small {
    font: 700 9px/1.25 var(--mono);
    letter-spacing: 0.04em;
    opacity: 0.8;
}
.daily-card {
    width: min(440px, 100%);
    padding: 14px 14px 16px;
    display: grid;
    gap: 10px;
    --cut: 12px;
}
.daily-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 6px 10px;
    font: 700 10px/1 var(--mono);
    letter-spacing: 0.16em;
}
.daily-lab {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--bull);
}
.today-top {
    margin: 0;
    color: var(--gold);
    letter-spacing: 0.04em;
    font-size: 11px;
    text-align: right;
}
.daily-twist {
    margin: 0;
    padding: 8px 10px 7px;
    text-align: left;
    font-size: 12px;
    line-height: 1.35;
    color: var(--gold-2);
    background: rgba(255, 203, 122, 0.07);
    box-shadow: inset 3px 0 0 var(--gold);
}
.daily-bounty {
    padding: 7px 10px 6px;
    text-align: left;
    background: rgba(70, 184, 240, 0.08);
    box-shadow: inset 3px 0 0 var(--info);
}
.daily-bounty p {
    margin: 0;
}
.bounty-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
    font-size: 12px;
    line-height: 1.35;
}
.bounty-lab {
    font: 700 9px/1 var(--mono);
    letter-spacing: 0.16em;
    color: var(--info);
}
.bounty-head b {
    font: 400 20px/0.9 var(--display);
    letter-spacing: 0.02em;
    color: var(--text);
}
.bounty-cond {
    color: #9be2ff;
}
.bounty-money {
    margin-top: 3px !important;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-2);
}
.bounty-only {
    color: var(--muted);
}
.hud-bounty {
    width: max-content;
    margin: 4px auto 0;
    padding: 3px 8px 2px;
    font: 700 9px/1 var(--mono);
    letter-spacing: 0.14em;
    color: #9be2ff;
    background: rgba(70, 184, 240, 0.1);
    box-shadow: inset 0 0 0 1px rgba(70, 184, 240, 0.35);
}
.hud-bounty.done {
    color: var(--bull);
    background: rgba(181, 154, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(181, 154, 255, 0.45);
}
.hud-bounty.pop {
    animation: bounty-pop 0.5s ease-out;
}
@keyframes bounty-pop {
    0% {
        transform: scale(1.5);
    }
    100% {
        transform: scale(1);
    }
}
.receipt-rows .bounty-row dd {
    color: #9be2ff;
}
.receipt-rows .bounty-row.done dd {
    color: var(--bull);
}
.bounty-note {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-2);
}
.bounty-note.good {
    color: var(--bull);
}
.title-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.title-row .btn {
    font-size: 22px;
    min-height: 46px;
    padding: 8px 16px 12px;
}
@media (max-width: 350px) {
    .title-row {
        gap: 6px;
    }
    .title-row .btn {
        font-size: 19px;
        padding: 8px 10px 12px;
    }
}
.title-foot {
    max-width: 38ch;
    margin: 0;
    font-size: 11px;
    color: var(--muted);
}
.title-foot a {
    color: var(--bull);
}

/* Level-up */
.screen-level {
    background:
        radial-gradient(ellipse at 50% 30%, rgba(255, 203, 122, 0.14), rgba(6, 8, 11, 0) 60%),
        rgba(6, 8, 11, 0.82);
    gap: 12px;
}
.level-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    animation: rise 380ms cubic-bezier(0.2, 1.5, 0.4, 1);
}
.ath {
    position: relative;
    font: 400 clamp(56px, 15vw, 92px) / 0.85 var(--display);
    color: var(--gold);
    text-shadow:
        0 5px 0 var(--gold-deep),
        0 0 36px rgba(255, 203, 122, 0.5);
}
.lv {
    font: 400 26px/1 var(--display);
    color: var(--text-2);
}
.lv b {
    color: var(--text);
}
.cards {
    display: grid;
    gap: 10px;
    width: min(460px, 100%);
}
@media (min-width: 900px) and (min-height: 560px) {
    .cards {
        grid-template-columns: repeat(3, 240px);
        width: auto;
    }
    .card {
        flex-direction: column;
        justify-content: center;
        text-align: center;
        align-items: center;
        min-height: 260px;
        padding: 22px 16px 20px;
    }
    .card .card-top {
        justify-content: center;
    }
    .card .pips {
        justify-content: center;
    }
    .card-icon-wrap {
        width: 96px;
        height: 96px;
    }
}
.card {
    --accent: var(--bull);
    --cut: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 14px 14px 12px;
    text-align: left;
    color: var(--text);
    border: 0;
    font: inherit;
    cursor: pointer;
    background: color-mix(in srgb, var(--accent) 55%, var(--line-2));
    animation: card-in 420ms cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
    transition:
        transform 120ms ease,
        filter 120ms ease;
}
.card:nth-child(2) {
    animation-delay: 70ms;
}
.card:nth-child(3) {
    animation-delay: 140ms;
}
.card:hover,
.card:focus-visible {
    transform: translateY(-3px);
    filter: brightness(1.12);
    outline: none;
    background: var(--accent);
}
.card:active {
    transform: translateY(1px);
}
.card.kind-passive {
    --accent: var(--gold);
}
.card.evo {
    --accent: var(--info);
}
.card.heal {
    --accent: var(--bear);
}
@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(26px) scale(0.96);
    }
}
@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.9);
    }
}
.card-icon-wrap {
    flex: none;
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(
            circle,
            color-mix(in srgb, var(--accent) 28%, transparent),
            transparent 70%
        ),
        rgba(0, 0, 0, 0.35);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.card-icon {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.5));
}
.card-body {
    min-width: 0;
    flex: 1;
}
.card-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}
.card-kind {
    font: 700 9px/1 var(--mono);
    letter-spacing: 0.16em;
    color: var(--accent);
}
.card-tag {
    padding: 2px 5px 1px;
    font: 700 9px/1 var(--mono);
    letter-spacing: 0.1em;
    color: var(--ink);
    background: var(--text-2);
}
.card-tag.new {
    background: var(--bull);
}
.card-tag.evo {
    background: var(--info);
    animation: blink 0.8s steps(2) infinite;
}
.card-name {
    display: block;
    font: 400 30px/0.95 var(--display);
    color: var(--text);
}
.card-desc {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-2);
}
.card-evo {
    margin: 6px 0 0;
    font-size: 11px;
    color: var(--info);
}
.pips {
    display: flex;
    gap: 3px;
    margin-top: 8px;
}
.pips i {
    width: 10px;
    height: 5px;
    background: rgba(255, 255, 255, 0.12);
}
.pips i.on {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}
.pips i.next {
    background: var(--text);
    animation: blink 0.7s steps(2) infinite;
}
.card kbd {
    position: absolute;
    top: 8px;
    right: 12px;
    font: 700 10px/1 var(--mono);
    color: var(--muted);
}
@media (pointer: coarse) {
    .card kbd,
    .level-hint {
        display: none;
    }
}
.level-hint {
    margin: 0;
    font-size: 11px;
    color: var(--muted);
}
.cards.locked .card {
    pointer-events: none;
}

/* Pause */
.pause-panel .btn {
    width: 100%;
}
.pause-sub {
    margin: 0 0 4px;
    color: var(--text-2);
    font-size: 12px;
}

/* Game over: the receipt */
.screen-over {
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 59, 92, 0.2), rgba(6, 8, 11, 0) 55%),
        rgba(6, 8, 11, 0.86);
    gap: 12px;
}
.over-head {
    position: relative;
    display: grid;
    justify-items: center;
}
.crash {
    position: absolute;
    top: -8px;
    width: min(420px, 90vw);
    height: 90px;
    overflow: visible;
}
.crash polyline {
    fill: none;
    stroke: var(--bear);
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    filter: drop-shadow(0 0 6px var(--bear));
    opacity: 0.6;
    animation: crash 900ms ease-in forwards 150ms;
}
@keyframes crash {
    to {
        stroke-dashoffset: 0;
    }
}
.over-title {
    position: relative;
    font: 400 clamp(64px, 18vw, 128px) / 0.85 var(--display);
    color: var(--bear);
    text-shadow:
        0 6px 0 var(--bear-deep),
        0 0 40px rgba(255, 59, 92, 0.5);
    animation: stamp 520ms cubic-bezier(0.2, 1.8, 0.3, 1);
}
.over-title.win {
    color: var(--bull);
    text-shadow:
        0 6px 0 var(--bull-deep),
        0 0 40px rgba(181, 154, 255, 0.5);
}
@keyframes stamp {
    0% {
        transform: scale(2.2) rotate(-6deg);
        opacity: 0;
    }
    70% {
        transform: scale(0.95) rotate(1deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0);
    }
}
.over-sub {
    margin-top: 6px;
    color: var(--text-2);
    max-width: 34ch;
    font-size: 13px;
}
.receipt {
    align-items: stretch;
    width: min(400px, 100%);
    padding: 16px 18px 14px;
    animation: rise 420ms cubic-bezier(0.2, 1.4, 0.4, 1) 200ms backwards;
}
.receipt-score small,
.receipt-rows dt {
    font: 700 10px/1 var(--mono);
    letter-spacing: 0.16em;
    color: var(--muted);
}
.receipt-score b {
    display: block;
    margin: 4px 0 10px;
    font: 400 76px/0.85 var(--display);
    color: var(--gold);
    text-shadow:
        0 4px 0 var(--gold-deep),
        0 0 30px rgba(255, 203, 122, 0.35);
}
.receipt-rows {
    margin: 0;
    display: grid;
    gap: 7px;
    border-top: 2px dashed var(--line-2);
    padding-top: 10px;
}
.receipt-rows div {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.receipt-rows div::after {
    /* dotted leader between label and value */
    content: '';
    order: 1;
    flex: 1;
    border-bottom: 2px dotted var(--line-2);
    transform: translateY(-3px);
}
.receipt-rows dt {
    order: 0;
}
.receipt-rows dd {
    order: 2;
    margin: 0;
    font: 400 26px/1 var(--display);
    color: var(--text);
}
.over-rank {
    min-height: 1.4em;
    margin-top: 10px;
    font-size: 12px;
    color: var(--gold);
}
.over-btns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: min(400px, 100%);
}
.over-btns .btn {
    flex: 1 1 96px;
    text-decoration: none;
    white-space: nowrap;
}
@media (max-width: 440px) {
    .over-btns .btn:not(#btnShare) {
        font-size: 19px;
        padding-left: 8px;
        padding-right: 8px;
    }
}
#btnShare {
    flex-basis: 100%;
    min-height: 58px;
    font-size: 32px;
}
.over-q {
    margin: 2px 0 0;
    font: 400 26px/1 var(--display);
    letter-spacing: 0.06em;
    color: var(--bull);
    text-shadow: 0 0 18px rgba(181, 154, 255, 0.45);
}
.over-build {
    margin: 0;
    font-size: 11px;
    color: var(--muted);
}
.name-form {
    display: grid;
    gap: 6px;
    justify-items: center;
    font-size: 12px;
    color: var(--text-2);
}
.name-row {
    display: flex;
    gap: 6px;
}
.name-row input {
    width: 170px;
    height: 44px;
    padding: 0 12px;
    font: 400 22px/1 var(--display);
    color: var(--text);
    background: rgba(0, 0, 0, 0.45);
    border: 0;
    box-shadow: inset 0 0 0 2px var(--line-2);
    outline: none;
}
.name-row input:focus {
    box-shadow: inset 0 0 0 2px var(--bull);
}
.name-row .btn {
    min-height: 44px;
    font-size: 20px;
    padding: 6px 14px 10px;
}
.name-form small {
    display: block;
    max-width: 52ch;
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.02em;
}
#payoutInput {
    font: 400 16px/1.2 var(--mono); /* 16px: iOS Safari zooms into smaller inputs */
    width: min(300px, 62vw);
}
.turnstile-box:empty {
    display: none;
}
.ts-hint,
.over-note {
    margin: 0;
    max-width: 40ch;
    font-size: 12px;
    color: var(--gold);
}
.over-note:empty {
    display: none;
}
.over-note.good,
.share-note.good {
    color: var(--bull);
}
.over-note.bad,
.share-note.bad,
#payoutNote.bad {
    color: var(--bear);
}
.payout-saved {
    margin: 0;
    font-size: 12px;
    color: var(--text-2);
}
.payout-saved b {
    font: 500 12px/1 var(--mono);
    color: var(--bull);
}
.link-btn {
    padding: 4px 6px;
    font: inherit;
    color: var(--text-2);
    text-decoration: underline;
    background: none;
    border: 0;
    cursor: pointer;
}
.link-btn:hover,
.link-btn:focus-visible {
    color: var(--text);
}

/* Share screen */
.share-panel {
    display: grid;
    gap: 12px;
    width: min(520px, 100%);
    padding: 14px;
}
.share-card {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1200 / 630;
    image-rendering: pixelated;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px var(--line-2);
}
.share-text {
    margin: 0;
    padding: 10px 12px;
    font: 400 12px/1.5 var(--mono);
    color: var(--text-2);
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(0, 0, 0, 0.35);
    user-select: text;
    -webkit-user-select: text;
}
.share-btns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: min(520px, 100%);
}
.share-btns .btn {
    flex: 1 1 120px;
    text-decoration: none;
}
#btnShareX {
    flex-basis: 100%;
    min-height: 54px;
    font-size: 28px;
}
.share-note {
    min-height: 1.4em;
    margin: 0;
    font-size: 12px;
    color: var(--text-2);
}

/* Board */
.board-panel {
    width: min(460px, 100%);
}
.board-sub {
    margin: 0;
    font-size: 11px;
    color: var(--muted);
}
.board-list {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    display: grid;
    gap: 3px;
    max-height: 52vh;
    overflow-y: auto;
}
.board-list li {
    display: grid;
    grid-template-columns: 34px 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 12px;
    text-align: left;
}
.board-list li:nth-child(odd) {
    background: rgba(255, 255, 255, 0.05);
}
.board-list li.me {
    box-shadow: inset 3px 0 0 var(--bull);
    background: rgba(181, 154, 255, 0.08);
}
.board-list .r {
    font: 400 22px/1 var(--display);
    color: var(--muted);
}
.board-list li:nth-child(1) .r {
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255, 203, 122, 0.5);
}
.board-list li:nth-child(2) .r {
    color: #dce2ea;
}
.board-list li:nth-child(3) .r {
    color: #d9955f;
}
.board-list .n {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.board-list .v {
    font-size: 10px;
    color: var(--muted);
}
.board-list .v.ok {
    color: var(--bull);
}
.board-list .s {
    font: 400 22px/1 var(--display);
    color: var(--gold);
}
.board-list .empty {
    grid-column: 1 / -1;
    color: var(--muted);
    text-align: center;
}

/* Settings */
.settings-list {
    display: grid;
    gap: 4px;
    width: 100%;
}
.settings-list label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 13px;
    cursor: pointer;
}
.settings-list input[type='checkbox'] {
    appearance: none;
    width: 42px;
    height: 22px;
    margin: 0;
    background: var(--line-2);
    position: relative;
    cursor: pointer;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}
.settings-list input[type='checkbox']::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: var(--text-2);
    transition: transform 120ms ease;
}
.settings-list input[type='checkbox']:checked {
    background: var(--bull-deep);
}
.settings-list input[type='checkbox']:checked::after {
    transform: translateX(20px);
    background: var(--bull);
    box-shadow: 0 0 8px var(--bull);
}

/* Attract (HQ preview) */
.attract-badge {
    position: absolute;
    z-index: 7;
    left: 10px;
    bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: rgba(12, 9, 20, 0.8);
    box-shadow: inset 0 0 0 1px var(--line-2);
    font: 700 10px/1 var(--mono);
    letter-spacing: 0.12em;
}
body.attract .hud-right .icon-btn,
body.attract .touch-surface,
body.attract .hint-move {
    display: none;
}

/* Small phones */
@media (max-width: 420px) {
    .hud {
        gap: 6px;
        padding-left: calc(8px + var(--safe-l));
        padding-right: calc(8px + var(--safe-r));
    }
    .lvl-badge {
        width: 40px;
        height: 44px;
    }
    .lvl-badge b {
        font-size: 24px;
    }
    .hud-time {
        font-size: 36px;
    }
    .hud-score b {
        font-size: 24px;
    }
    .hud-bars {
        max-width: 120px;
    }
    .bar-lab {
        display: none;
    }
    .loadout {
        top: calc(66px + var(--safe-t));
        left: calc(8px + var(--safe-l));
    }
    /* The loadout reaches the middle on a phone: the bounty chip goes under the score instead. */
    .hud-bounty {
        position: absolute;
        top: calc(66px + var(--safe-t));
        right: calc(8px + var(--safe-r));
        margin: 0;
    }
    .slot {
        width: 32px;
        height: 32px;
    }
    .slot canvas {
        width: 28px;
        height: 28px;
    }
    .slot.passive {
        width: 26px;
        height: 26px;
    }
    .slot.passive canvas {
        width: 20px;
        height: 20px;
    }
    .bossbar {
        top: calc(118px + var(--safe-t));
        width: 88vw;
    }
    .title-bull {
        width: 190px;
        height: 140px;
    }
}
@media (max-height: 700px) {
    .title-bull {
        width: 150px;
        height: 110px;
        margin-bottom: -10px;
    }
    .tagline {
        margin-top: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }
    .boss-card {
        animation: boss-fade 2.4s linear forwards !important;
    }
}

#btnSound .mute,
#btnSound.muted .wave {
    display: none;
}
#btnSound.muted .mute {
    display: inline;
    fill: var(--bear);
}
body.no-hud .bossbar,
body.no-hud .loadout,
body.no-hud .hint-move {
    display: none;
}
