/* =====================================================================
   Word Fall — UI styles
   Clean "glass over 3D" look: frosted panels floating over the live
   Three.js city (bg3d.js), Sora for display type, Inter for UI, VT323
   only for typed game text. Neon is an accent, not a coat of paint.
   ===================================================================== */

/* ---------- Fonts (bundled, SIL OFL — see assets/fonts/LICENSE-OFL.txt) ---------- */
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 300; font-display: swap; src: url('assets/fonts/sora-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 400; font-display: swap; src: url('assets/fonts/sora-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 600; font-display: swap; src: url('assets/fonts/sora-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 700; font-display: swap; src: url('assets/fonts/sora-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 800; font-display: swap; src: url('assets/fonts/sora-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('assets/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('assets/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('assets/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('assets/fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'VT323'; font-style: normal; font-weight: 400; font-display: swap; src: url('assets/fonts/vt323-latin-400-normal.woff2') format('woff2'); }

/* ---------- Tokens ---------- */
:root {
    --font-display: 'Sora', 'Inter', system-ui, sans-serif;
    --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-game: 'VT323', 'Courier New', monospace;

    --bg-deep: #05070F;
    --ink: #F4F7FF;          /* primary text */
    --ink-2: #A8B2D1;        /* secondary text */
    --ink-3: #6B7499;        /* tertiary / labels */
    --line: rgba(255, 255, 255, 0.08);
    --line-2: rgba(255, 255, 255, 0.14);
    --glass: rgba(11, 15, 30, 0.64);
    --glass-hi: rgba(255, 255, 255, 0.06);

    --cyan: #00F0FF;
    --magenta: #FF2E97;
    --gold: #FFD93D;
    --green: #00FF9F;
    --orange: #FF8A00;
    --red: #FF3B5C;

    --r-lg: 22px;
    --r-md: 14px;
    --r-sm: 10px;
    --shadow-panel: 0 40px 100px -30px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

    /* Legacy names still referenced from game.js inline styles. */
    --neon-cyan: var(--cyan);
    --neon-magenta: var(--magenta);
    --neon-orange: var(--orange);
    --bomb-red: var(--red);
    --bonus-gold: var(--gold);
    --success-green: var(--green);
    --text-bright: var(--ink);
    --text-dim: var(--ink-3);
    --accent: var(--cyan);
    --accent-2: var(--magenta);
    --good: var(--green);
    --warn: var(--orange);
    --bad: var(--red);
    --muted: var(--ink-3);
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0; height: 100%;
    background: var(--bg-deep);
    background-image: radial-gradient(ellipse at 50% 0%, #121a36 0%, var(--bg-deep) 65%);
    color: var(--ink);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- Canvases ---------- */
#game-container {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
}
canvas {
    display: block;
    width: 100%; height: 100%;
    image-rendering: pixelated;
}
/* 3D city layer sits behind the 2D game canvas and fades in once ready. */
#bg3d {
    position: absolute; inset: 0;
    image-rendering: auto;
    opacity: 0;
    transition: opacity 1.2s ease;
    pointer-events: none;
}
#bg3d.on { opacity: 1; }
#game { position: relative; z-index: 1; }

/* ---------- Shared type ---------- */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--cyan);
}
.eyebrow::before {
    content: "";
    width: 18px; height: 1px;
    background: currentColor;
    opacity: 0.7;
}
kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    margin: 0 2px;
    border-radius: 6px;
    border: 1px solid var(--line-2);
    border-bottom-width: 2px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink-2);
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 600;
}

/* ---------- Overlays & panels ---------- */
.overlay {
    position: fixed; inset: 0;
    display: none;
    flex-direction: column;
    align-items: center; justify-content: center;
    padding: max(16px, 3vh) 16px;
    background: radial-gradient(ellipse at center, rgba(3, 5, 12, 0.45) 0%, rgba(3, 5, 12, 0.78) 100%);
    z-index: 20;
    animation: fade-in 0.3s ease-out;
    overflow: hidden;
}
.overlay.show { display: flex; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.panel {
    position: relative;
    width: 100%;
    max-width: min(520px, 100%);
    max-height: 100%;
    overflow-y: auto;
    padding: clamp(22px, 3.2vh, 34px) clamp(20px, 4vw, 36px);
    text-align: center;
    background: var(--glass);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    animation: panel-in 0.42s var(--ease-out);
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
}
@keyframes panel-in {
    from { transform: translateY(14px) scale(0.985); opacity: 0; }
    to   { transform: translateY(0) scale(1);        opacity: 1; }
}
.panel h1, .panel h2 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.05;
    color: var(--ink);
    margin: 10px 0 10px;
}
.panel h2 { font-size: clamp(24px, 3.4vw, 32px); }
.panel p {
    color: var(--ink-2);
    font-size: 15px;
    line-height: 1.55;
    margin: 0 0 16px;
}
.panel .tag { color: var(--cyan); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Close button */
.close-x {
    position: absolute;
    top: 14px; right: 14px;
    width: 36px; height: 36px;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink-2);
    font-family: var(--font-ui);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.close-x:hover { background: rgba(255, 255, 255, 0.1); color: var(--ink); border-color: rgba(255, 255, 255, 0.24); }
.close-x:active { transform: scale(0.94); }
@media (pointer: coarse) { .close-x { width: 44px; height: 44px; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 26px;
    margin: 0;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(180deg, #FFFFFF 0%, #DCE4F7 100%);
    color: #05070F;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 12px 32px -12px rgba(0, 240, 255, 0.55), inset 0 1px 0 #fff;
    transition: transform 0.15s var(--ease-out), box-shadow 0.15s, background 0.15s, filter 0.15s;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 40px -12px rgba(0, 240, 255, 0.75), inset 0 1px 0 #fff;
}
.btn:active { transform: translateY(0) scale(0.99); }
.btn.ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line-2);
}
.btn.ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}
.btn.small { min-height: 38px; padding: 0 16px; font-size: 13px; border-radius: 10px; }
.btn.danger {
    background: rgba(255, 59, 92, 0.12);
    color: #FF7590;
    box-shadow: inset 0 0 0 1px rgba(255, 59, 92, 0.45);
}
.btn.danger:hover { background: rgba(255, 59, 92, 0.2); box-shadow: inset 0 0 0 1px rgba(255, 59, 92, 0.7); }
.btn-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
}
.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 8px 4px;
    background: transparent;
    border: 0;
    color: var(--ink-3);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s;
}
.link-btn:hover { color: var(--ink); }

/* ---------- Icon buttons ---------- */
.icon-btn {
    width: 40px; height: 40px;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    background: rgba(11, 15, 30, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--ink-2);
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s;
}
.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.24); }
.icon-btn img { width: 20px; height: 20px; pointer-events: none; }
.icon-btn .fallback { line-height: 1; font-size: 18px; }

/* =====================================================================
   Home menu — content column on the left, the 3D city on the right
   ===================================================================== */
#menu {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    background:
        linear-gradient(90deg, rgba(4, 6, 14, 0.88) 0%, rgba(4, 6, 14, 0.66) 30%, rgba(4, 6, 14, 0.12) 58%, rgba(4, 6, 14, 0) 72%),
        linear-gradient(0deg, rgba(4, 6, 14, 0.55) 0%, rgba(4, 6, 14, 0) 22%);
}
#menu.show { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }

.menu-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: clamp(14px, 3vh, 28px) clamp(20px, 5vw, 64px) 0;
}
.menu-nav .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
}
.menu-nav .brand-mark {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--cyan), var(--magenta));
    color: #05070F;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 15px;
    box-shadow: 0 6px 20px -6px rgba(0, 240, 255, 0.6);
}
.menu-nav .brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.32em;
    color: var(--ink-2);
}
.menu-nav .nav-actions { display: flex; gap: 8px; }

.menu-main {
    align-self: center;
    width: min(480px, calc(100% - 40px));
    margin-left: clamp(20px, 7vw, 120px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(12px, 2.1vh, 20px);
    max-height: 100%;
    overflow-y: auto;
    padding: 12px 2px;
    scrollbar-width: none;
}
.menu-main::-webkit-scrollbar { display: none; }
.hero { text-align: left; animation: rise-in 0.7s var(--ease-out) both; }
#menu-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(44px, min(5.4vw, 10vh), 80px);
    letter-spacing: -0.035em;
    line-height: 0.9;
    margin: 12px 0 10px;
    color: var(--ink);
}
#menu-title .accent {
    background: linear-gradient(100deg, var(--cyan) 0%, #7A8CFF 45%, var(--magenta) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 22px rgba(0, 240, 255, 0.25));
}
.tagline {
    margin: 0;
    color: var(--ink-2);
    font-size: clamp(14px, 1.2vw, 16px);
    line-height: 1.5;
    max-width: 34ch;
}
@keyframes rise-in {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* Mode list */
#mode-select {
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: rise-in 0.7s 0.08s var(--ease-out) both;
}
.mode {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 12px;
    width: 100%;
    min-height: 50px;
    padding: 8px 16px 8px 20px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ink-2);
    text-align: left;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}
.mode::before {
    content: "";
    position: absolute;
    left: 6px; top: 50%;
    width: 3px; height: 0;
    border-radius: 3px;
    background: var(--cyan);
    box-shadow: 0 0 12px var(--cyan);
    transform: translateY(-50%);
    transition: height 0.22s var(--ease-out);
}
.mode:hover { background: rgba(255, 255, 255, 0.04); color: var(--ink); }
.mode.selected {
    background: rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 0 0 1px var(--line-2);
    color: var(--ink);
}
.mode.selected::before { height: 22px; }
.mode .name {
    flex: 1 1 auto;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.mode .desc {
    margin-left: auto;
    font-size: 13px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}
.mode.selected .desc { color: var(--ink-2); }
.mode.daily::before, .mode.versus::before { background: var(--magenta); box-shadow: 0 0 12px var(--magenta); }
/* Daily extras sit on a second line under the name. */
.mode.daily::after { content: ""; order: 2; flex-basis: 100%; height: 0; display: none; }
.mode.daily:has(.daily-state:not(:empty), .daily-streak:not(:empty), .daily-countdown:not(:empty))::after { display: block; }
.mode.daily .name, .mode.daily .desc { order: 1; }
.daily-state, .daily-streak, .daily-countdown, #daily-spark { order: 3; }
.daily-state {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--magenta);
}
.daily-state:empty, .daily-streak:empty, .daily-countdown:empty { display: none; }
.daily-streak {
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
}
.daily-streak.big {
    display: block;
    font-family: var(--font-display);
    font-size: 15px;
    margin: 4px 0 10px;
}
.daily-countdown {
    font-size: 11px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}
#daily-spark { display: none; width: 60px; height: 20px; }
#daily-spark.has-data { display: inline-block; }

/* Play CTA */
.btn-primary {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 16px;
    width: 100%;
    padding: 14px 14px 14px 22px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(180deg, #FFFFFF 0%, #DCE4F7 100%);
    color: #05070F;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 20px 50px -18px rgba(0, 240, 255, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.4), inset 0 1px 0 #fff;
    transition: transform 0.18s var(--ease-out), box-shadow 0.18s;
    animation: rise-in 0.7s 0.16s var(--ease-out) both;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 26px 60px -18px rgba(0, 240, 255, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.5), inset 0 1px 0 #fff;
}
.btn-primary:active { transform: translateY(0) scale(0.995); }
.btn-primary .label {
    grid-column: 1; grid-row: 1;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: 0.02em;
    line-height: 1.1;
}
.btn-primary .sub {
    grid-column: 1; grid-row: 2;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 500;
    color: #4A5372;
    letter-spacing: 0.02em;
}
.btn-primary .play-icon {
    grid-column: 2; grid-row: 1 / span 2;
    width: 46px; height: 46px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: #05070F;
    color: var(--cyan);
    transition: transform 0.18s var(--ease-out);
}
.btn-primary:hover .play-icon { transform: translateX(2px); }

.kbd-hint {
    margin-top: -6px;
    font-size: 11px;
    color: var(--ink-3);
    letter-spacing: 0.02em;
}
@media (hover: none) and (pointer: coarse) { .kbd-hint { display: none; } }

/* Personal bests — a quiet inline strip, not boxes */
.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    margin: 0;
}
.stat {
    min-width: 0;
    padding: 12px 10px;
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.035);
    box-shadow: inset 0 0 0 1px var(--line);
}
.stat .k {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat .v {
    margin-top: 4px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(20px, 2.6vw, 28px);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#menu .bests {
    gap: 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    animation: rise-in 0.7s 0.24s var(--ease-out) both;
}
#menu .bests .stat {
    padding: 0 12px;
    background: none;
    box-shadow: none;
    border-left: 1px solid var(--line);
    border-radius: 0;
}
#menu .bests .stat:first-child { padding-left: 0; border-left: 0; }
#menu .bests .stat .v { font-size: 20px; font-weight: 600; }
#menu .link-btn { align-self: flex-start; margin-top: -6px; }

.menu-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 clamp(20px, 5vw, 64px) clamp(12px, 2.5vh, 22px);
    color: var(--ink-3);
    font-size: 11px;
    letter-spacing: 0.04em;
}
.menu-footer a {
    display: inline-flex; align-items: center; gap: 6px;
    color: inherit; text-decoration: none;
    transition: color 0.15s;
}
.menu-footer a:hover { color: var(--ink); }

/* Narrow / portrait: centred column, scrim from the bottom */
@media (max-width: 900px) {
    #menu {
        background:
            linear-gradient(0deg, rgba(4, 6, 14, 0.94) 0%, rgba(4, 6, 14, 0.8) 55%, rgba(4, 6, 14, 0.45) 100%);
    }
    .menu-main { margin: 0 auto; width: min(460px, calc(100% - 32px)); }
    .hero { text-align: center; }
    .hero .eyebrow { justify-content: center; }
    .tagline { margin: 0 auto; }
    #menu .link-btn { align-self: center; }
    .kbd-hint { text-align: center; }
}
/* The nav already has a stats button; drop the text link when height is tight. */
@media (max-height: 820px) {
    #menu .link-btn { display: none; }
    .mode { min-height: 44px; }
}
@media (max-height: 640px) {
    .tagline, .kbd-hint, #menu .link-btn { display: none; }
    .mode { min-height: 42px; }
    #menu-title { margin: 6px 0 4px; }
}

/* =====================================================================
   End screen
   ===================================================================== */
.go-panel { max-width: min(520px, 100%); text-align: left; }
.go-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.go-headtext { min-width: 0; }
.go-headtext h2 {
    margin: 10px 0 6px;
    font-size: clamp(26px, 4vw, 36px);
    letter-spacing: 0.02em;
}
.go-headtext p { margin: 0; font-size: 14px; }
.go-grade {
    --grade-col: var(--cyan);
    flex-shrink: 0;
    width: 76px; height: 76px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--grade-col) 22%, transparent), transparent 70%);
    box-shadow: inset 0 0 0 2px var(--grade-col), 0 0 32px -6px var(--grade-col);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 36px;
    color: var(--grade-col);
    animation: grade-pop 0.6s 0.35s var(--ease-out) both;
}
@keyframes grade-pop {
    from { transform: scale(1.5); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.go-grade.g-S { --grade-col: var(--gold); }
.go-grade.g-A { --grade-col: var(--green); }
.go-grade.g-B { --grade-col: var(--cyan); }
.go-grade.g-C { --grade-col: var(--orange); }
.go-grade.g-D { --grade-col: var(--red); }

.go-score {
    margin: 18px 0 14px;
    padding: 16px 18px;
    border-radius: var(--r-md);
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.08), rgba(255, 46, 151, 0.06));
    box-shadow: inset 0 0 0 1px var(--line);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 14px;
}
.go-score .k {
    flex-basis: 100%;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.go-score .v {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(40px, 7vw, 60px);
    letter-spacing: -0.02em;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    min-width: 0;
}
.go-new {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 255, 159, 0.12);
    box-shadow: inset 0 0 0 1px rgba(0, 255, 159, 0.4);
    color: var(--green);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.go-stats .stat { text-align: left; }
.go-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 20px;
}
.go-pill {
    font-size: 12px;
    color: var(--ink-3);
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px var(--line);
}
.go-pill b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.go-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.share-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 8px;
    margin-top: 10px;
}
.share-sep { color: var(--ink-3); opacity: 0.6; }
/* The share card is still generated for Share/Download, just not previewed. */
#share-preview, #share-preview.ready { display: none; }
@media (prefers-reduced-motion: reduce) {
    .panel, .go-grade, .hero, #mode-select, .btn-primary, #menu .bests { animation: none; }
}

/* =====================================================================
   Pause
   ===================================================================== */
#pause-hint {
    position: fixed; inset: 0;
    display: none;
    align-items: center; justify-content: center;
    padding: 16px;
    background: radial-gradient(ellipse at center, rgba(3, 5, 12, 0.35), rgba(3, 5, 12, 0.75));
    z-index: 18;
}
#pause-hint.show { display: flex; }
.pause-panel {
    max-width: 340px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}
.pause-panel .eyebrow { align-self: center; }
.pause-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 40px;
    letter-spacing: 0.08em;
    margin: 6px 0 12px;
}
.pause-hint-line { margin-top: 6px; font-size: 12px; color: var(--ink-3); }

/* =====================================================================
   Settings
   ===================================================================== */
#tutorial { z-index: 26; }
#settings-modal, #confirm-reset, #daily-played, #stats-modal { z-index: 22; }

.settings-panel { max-width: min(460px, 100%); text-align: left; }
.settings-panel h2 { margin: 0 0 18px; font-size: 22px; }
.setting-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.setting-row.toggle { flex-direction: row; justify-content: space-between; align-items: center; }
.setting-row label, .setting-row > label {
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
}
.slider-line { display: flex; align-items: center; gap: 14px; }
.slider-line .num {
    width: 32px;
    text-align: right;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}
input[type="range"].js-slider, .slider-line input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    border-radius: 999px;
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    background-image: linear-gradient(to right, var(--cyan), var(--cyan));
    background-repeat: no-repeat;
    background-size: 40% 100%;
}
.slider-line input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(0, 240, 255, 0.18);
    cursor: pointer;
}
.slider-line input[type="range"]::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(0, 240, 255, 0.18);
    cursor: pointer;
}
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slot {
    position: absolute; inset: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    transition: background 0.2s;
}
.switch .slot::before {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: transform 0.22s var(--ease-out);
}
.switch input:checked + .slot { background: var(--cyan); }
.switch input:checked + .slot::before { transform: translateX(18px); }
.switch input:focus-visible + .slot { outline: 2px solid var(--cyan); outline-offset: 2px; }

.seg {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}
.seg button {
    min-height: 30px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}
.seg button.on { background: #fff; color: #05070F; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); }
.gfx-note { margin: 8px 0 0; font-size: 12px; color: var(--ink-3); }

.settings-divider { border: 0; height: 0; margin: 10px 0; }
.opt-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 217, 61, 0.12);
    color: var(--gold);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    vertical-align: 2px;
}
.api-line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.api-line input[type="password"] {
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: inset 0 0 0 1px var(--line-2);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 13px;
    outline: none;
}
.api-line input[type="password"]:focus { box-shadow: inset 0 0 0 1px var(--cyan), 0 0 0 3px rgba(0, 240, 255, 0.15); }
.setting-help { font-size: 12px; color: var(--ink-3); line-height: 1.55; margin-top: 2px; }
.setting-help a { color: var(--cyan); text-decoration: none; }
.setting-help a:hover { text-decoration: underline; }
.settings-panel #reset-stats-btn { margin-top: 6px; }
.settings-footer { text-align: center; font-size: 11px; color: var(--ink-3); margin-top: 4px; }

/* Confirm reset */
.confirm-panel { max-width: min(400px, 100%); }
.confirm-panel h2 { color: #FF7590; }

/* =====================================================================
   Stats & achievements
   ===================================================================== */
.stats-panel { max-width: min(640px, 100%); text-align: left; }
.stats-panel h2 { margin: 0 0 14px; font-size: 22px; }
.stats-panel .section-h {
    margin: 22px 0 10px;
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.lifetime-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.lifetime-stats .row {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}
.lifetime-stats .row .k { color: var(--ink-3); }
.lifetime-stats .row .v { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.ach-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ach-cell {
    position: relative;
    min-width: 0;
    padding: 14px 8px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    box-shadow: inset 0 0 0 1px var(--line);
    text-align: center;
}
.ach-cell .icon { font-size: 26px; line-height: 1.1; }
.ach-cell .name { margin-top: 6px; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.ach-cell.locked { opacity: 0.38; filter: grayscale(1); }
.ach-cell.unlocked { background: rgba(0, 240, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.35); }
.ach-cell.unlocked .name { color: var(--ink); }

/* =====================================================================
   Versus
   ===================================================================== */
.versus-setup-panel, .versus-over-panel { max-width: min(620px, 100%); }
.vs-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--magenta);
}
.versus-setup-panel h2, .versus-over-panel h2 { margin: 8px 0 20px; }
.vs-tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.vs-tier {
    min-width: 0;
    padding: 18px 12px;
    border: 0;
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px var(--line);
    color: var(--ink);
    text-align: center;
    cursor: pointer;
    transition: transform 0.18s var(--ease-out), background 0.18s, box-shadow 0.18s;
}
.vs-tier:hover {
    transform: translateY(-2px);
    background: rgba(255, 46, 151, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 46, 151, 0.55), 0 16px 40px -18px rgba(255, 46, 151, 0.7);
}
.vs-tier-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: 0.06em; }
.vs-tier-stat { margin: 6px 0; font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--gold); }
.vs-tier-desc { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
@media (max-width: 560px) { .vs-tiers { grid-template-columns: 1fr; } }

/* =====================================================================
   Act break, daily done, tutorial
   ===================================================================== */
#act-break {
    --act-accent: var(--cyan);
    background: radial-gradient(ellipse at center, rgba(3, 5, 12, 0.2), rgba(3, 5, 12, 0.6));
}
.act-panel {
    max-width: min(460px, 100%);
    box-shadow: var(--shadow-panel), inset 0 2px 0 var(--act-accent);
}
.act-cleared {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--green);
    margin-bottom: 16px;
}
.act-entering { font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--ink-3); }
.act-num { margin-top: 4px; font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: 0.14em; color: var(--act-accent); }
.act-panel h2 {
    margin: 6px 0 14px;
    font-size: clamp(30px, 5vw, 44px);
    color: var(--ink);
    text-shadow: 0 0 40px color-mix(in srgb, var(--act-accent) 55%, transparent);
}
.act-reward { margin-bottom: 20px; font-size: 13px; font-weight: 600; color: var(--gold); letter-spacing: 0.04em; }
.act-begin-btn { min-width: 200px; }
.act-autostart { margin-top: 12px; font-size: 12px; color: var(--ink-3); }
.act-autostart span { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

.next-daily { margin: 6px 0 16px; font-size: 13px; color: var(--ink-3); }
.next-daily span { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.tutorial-panel { max-width: min(540px, 100%); }
.tutorial-panel h2 { margin: 4px 0 16px; font-size: 22px; }
.tutorial-panel p { color: var(--ink-2); margin: 16px 0 18px; }
#tut-canvas {
    display: block;
    width: 100%;
    max-width: 460px;
    height: auto;
    aspect-ratio: 12 / 5;
    margin: 0 auto;
    border-radius: var(--r-md);
    background: #070A16;
    box-shadow: inset 0 0 0 1px var(--line);
}
.skip-link { position: absolute; top: 14px; right: 18px; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 0 0 16px; }
.dots .dot {
    width: 6px; height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    transition: width 0.25s var(--ease-out), background 0.2s;
}
.dots .dot.active { width: 20px; background: var(--cyan); }

/* =====================================================================
   In-game DOM bits, toasts, boot bar
   ===================================================================== */
#input-buffer {
    position: fixed;
    bottom: 110px; left: 50%;
    transform: translateX(-50%);
    min-height: 40px;
    font-family: var(--font-game);
    font-size: 36px;
    letter-spacing: 4px;
    color: var(--cyan);
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
    pointer-events: none;
    z-index: 10;
}
#input-buffer .cursor {
    display: inline-block;
    width: 2px; height: 26px;
    margin-left: 2px;
    vertical-align: middle;
    background: var(--cyan);
    animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

#toast {
    position: fixed;
    top: 28%; left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: clamp(30px, 5vw, 48px);
    font-weight: 800;
    letter-spacing: 0.06em;
    white-space: nowrap;
    pointer-events: none;
    z-index: 12;
    opacity: 0;
    text-shadow: 0 0 30px currentColor;
}

#share-toast, #update-toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translate(-50%, 70px);
    padding: 12px 18px;
    border-radius: 999px;
    background: rgba(11, 15, 30, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-panel);
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    z-index: 30;
    transition: opacity 0.25s, transform 0.3s var(--ease-out);
}
#share-toast.show, #update-toast.show { opacity: 1; transform: translate(-50%, 0); }
#update-toast { z-index: 40; cursor: pointer; pointer-events: auto; }
#update-toast b { color: var(--cyan); }
#update-toast:hover { background: rgba(20, 26, 48, 0.92); }

#ach-toast {
    position: fixed;
    top: 20px; left: 50%;
    transform: translate(-50%, -130px);
    display: flex; align-items: center; gap: 14px;
    min-width: 280px; max-width: 92vw;
    padding: 12px 18px 12px 14px;
    border-radius: 16px;
    background: rgba(11, 15, 30, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-panel), inset 0 0 0 1px rgba(255, 46, 151, 0.35);
    opacity: 0;
    pointer-events: none;
    z-index: 30;
    transition: opacity 0.3s, transform 0.35s var(--ease-out);
}
#ach-toast.show { opacity: 1; transform: translate(-50%, 0); }
#ach-toast .ach-icon {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: rgba(255, 46, 151, 0.14);
    font-size: 24px;
}
#ach-toast .ach-text { text-align: left; }
#ach-toast .ach-meta { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--magenta); }
#ach-toast .ach-name { margin-top: 2px; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--ink); }
#ach-toast .ach-desc { margin-top: 1px; font-size: 12px; color: var(--ink-2); }

#boot-progress {
    position: fixed;
    left: 50%; bottom: 12%;
    transform: translateX(-50%);
    width: min(280px, 60vw);
    height: 2px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
    z-index: 25;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
#boot-progress.show { opacity: 1; }
#boot-progress .fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--cyan), var(--magenta));
    transition: width 0.15s ease-out;
}

/* ---------- Small screens ---------- */
@media (max-width: 600px) {
    .panel { padding: 22px 18px; border-radius: 20px; }
    .go-actions { grid-template-columns: 1fr; }
    .ach-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat .k { letter-spacing: 0.08em; }
    .lifetime-stats { grid-template-columns: 1fr; }
    .btn-row .btn { flex: 1 1 auto; }
}
@media (max-height: 560px) {
    .go-score { margin: 12px 0 10px; padding: 10px 14px; }
    .go-pills { margin: 8px 0 12px; }
}
