html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #000;
    color: #ff4081;
    height: 100%;
}

:root {
    --bg: #050505;
    --surface: #0a0a0a;
    --accent: #00e5ff;
    --danger: #ff0055;
    --text: #c8d6df;
    --dim: #4a5a62;
    --border: #1a1a1a;
    /* canvas theme tokens — read by JS */
    --canvas-bg:        #000000;
    --canvas-fog-rgb:   0,0,0;
    --canvas-grid:      rgba(0,229,255,0.05);
    --canvas-boundary:  rgba(0,229,255,0.22);
    --minimap-bg:       rgba(5,5,5,0.65);
    /* complementary hue — set by JS on load, 180° opposite of --accent */
    --hue-inv: 5;
    /* raw player hue (number) — set by JS; 190 (cyan) is the pre-JS fallback */
    --hue: 190;
}

/* ── Light theme ─────────────────────────────────────────────────── */
body.theme-light {
    --bg:       #f0f0f0;
    --surface:  #e4e4e4;
    --accent:   #0077aa;
    --danger:   #cc0033;
    --text:     #1a1a1a;
    --dim:      #777777;
    --border:   #cccccc;
    --canvas-bg:        #e8ecf0;
    --canvas-fog-rgb:   220,225,230;
    --canvas-grid:      rgba(0,100,160,0.08);
    --canvas-boundary:  rgba(0,100,160,0.30);
    --minimap-bg:       rgba(220,225,230,0.80);
    color-scheme: light;
}

body.theme-light {
    background: var(--bg);
    background-image: radial-gradient(circle at center, #e0e8f0 0%, #d8dfe8 100%);
    color: var(--text);
}

body.theme-light::before {
    background: linear-gradient(to right, rgba(200,210,220,0.75) 0%, rgba(200,210,220,0.15) 100%);
    border-right: 1px solid #b0bcc8;
}

body.theme-light::after {
    background: linear-gradient(to left, rgba(200,210,220,0.75) 0%, rgba(200,210,220,0.15) 100%);
    border-left: 1px solid #b0bcc8;
}

/* ══════════════════════════════════════════════════════════════════
   LIGHT MODE — hue-inv tinted overrides
   All dark hardcoded backgrounds are replaced with a left-to-right
   faded gradient of the inverted player hue.
   ══════════════════════════════════════════════════════════════════ */

/* ── Username input / login status ──────────────────────────────── */
body.theme-light input {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 65%, 84%, 0.30) 0%,
        hsla(var(--hue-inv), 35%, 96%, 0.06) 100%);
    color: var(--text);
    border-color: hsla(var(--hue-inv), 35%, 60%, 0.25);
}

body.theme-light input:focus {
    border-color: hsla(var(--hue-inv), 60%, 48%, 0.55);
    box-shadow: 0 0 15px hsla(var(--hue-inv), 60%, 55%, 0.08);
}

body.theme-light input:-webkit-autofill,
body.theme-light input:-webkit-autofill:hover,
body.theme-light input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px hsl(var(--hue-inv), 55%, 92%) inset;
    -webkit-text-fill-color: var(--text);
}

body.theme-light #loginStatus {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 55%, 84%, 0.35) 0%,
        hsla(var(--hue-inv), 30%, 95%, 0.08) 100%);
    border-color: hsla(var(--hue-inv), 35%, 58%, 0.28);
    color: hsl(var(--hue-inv), 35%, 30%);
}

body.theme-light #loggedInUsername {
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 65%, 82%, 0.35) 0%,
        hsla(var(--hue-inv), 35%, 96%, 0.07) 100%);
    border-color: hsla(var(--hue-inv), 50%, 50%, 0.40);
    color: hsl(var(--hue-inv), 45%, 28%);
}

/* ── Lobby buttons ───────────────────────────────────────────────── */
body.theme-light button#joinBtn {
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 60%, 78%, 0.45) 0%,
        hsla(var(--hue-inv), 35%, 96%, 0.10) 100%);
    color: hsl(var(--hue-inv), 55%, 28%);
}

body.theme-light .edge-btn-cyan:hover button#joinBtn {
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 60%, 78%, 0.45) 0%,
        hsla(var(--hue-inv), 35%, 96%, 0.10) 100%);
    color: hsl(var(--hue-inv), 65%, 32%);
}

body.theme-light button#customizeBtn {
    background: linear-gradient(to right,
        rgba(255, 180, 200, 0.22) 0%,
        rgba(255, 220, 230, 0.05) 100%);
    color: #c0224a;
}

body.theme-light .edge-btn-pink:hover button#customizeBtn {
    background: linear-gradient(to right,
        rgba(255, 180, 200, 0.22) 0%,
        rgba(255, 220, 230, 0.05) 100%);
    color: #c0224a;
}

/* ── Tool panel tabs bar ─────────────────────────────────────────── */
body.theme-light #toolTabs {
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 60%, 82%, 0.35) 0%,
        hsla(var(--hue-inv), 30%, 94%, 0.10) 100%);
    border-bottom: 1px solid hsla(var(--hue-inv), 30%, 65%, 0.18);
}

body.theme-light .dtab {
    background: transparent;
    color: hsl(var(--hue-inv), 25%, 40%);
}

body.theme-light .dtab:hover:not(.active) {
    background: hsla(var(--hue-inv), 45%, 80%, 0.25);
    color: hsl(var(--hue-inv), 35%, 28%);
}

body.theme-light .dtab.active {
    background: hsla(var(--hue-inv), 50%, 92%, 0.70);
    color: hsl(var(--hue-inv), 65%, 28%);
}

body.theme-light .dtab-wrap.active {
    background: hsl(var(--hue-inv), 62%, 46%);
}

body.theme-light #toolToggle,
body.theme-light #expandBtn {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 55%, 84%, 0.38) 0%,
        hsla(var(--hue-inv), 30%, 96%, 0.10) 100%);
    border-color: hsla(var(--hue-inv), 30%, 60%, 0.22);
    color: hsl(var(--hue-inv), 30%, 38%);
}

/* ── Login tab inputs (inside tool panel) ─────────────────────────── */
body.theme-light #tabLogin input {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 60%, 85%, 0.28) 0%,
        hsla(var(--hue-inv), 30%, 97%, 0.05) 100%);
    border-color: hsla(var(--hue-inv), 30%, 60%, 0.25);
    color: var(--text);
}

/* Player options buttons (right-click popup) */
body.theme-light .popt-btn {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 55%, 85%, 0.28) 0%,
        hsla(var(--hue-inv), 30%, 97%, 0.05) 100%);
    border-color: hsla(var(--hue-inv), 30%, 60%, 0.22);
    color: hsl(var(--hue-inv), 35%, 30%);
}

body.theme-light .popt-btn:hover {
    border-color: hsla(var(--hue-inv), 50%, 45%, 0.55);
    color: hsl(var(--hue-inv), 55%, 25%);
}

/* Edit profile button */
body.theme-light #editProfileBtn {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 55%, 84%, 0.28) 0%,
        hsla(var(--hue-inv), 30%, 97%, 0.05) 100%);
    border-color: hsla(var(--hue-inv), 45%, 50%, 0.30);
    color: hsl(var(--hue-inv), 50%, 28%);
}

body.theme-light #editProfileBtn:hover {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 60%, 80%, 0.40) 0%,
        hsla(var(--hue-inv), 35%, 93%, 0.12) 100%);
    border-color: hsla(var(--hue-inv), 50%, 45%, 0.50);
}

/* ── Profile modal ────────────────────────────────────────────────── */
body.theme-light #profileModal {
    background: rgba(180, 190, 200, 0.80);
}

body.theme-light .pm-card {
    background: hsl(0, 0%, 97%);
    border-color: hsla(var(--hue-inv), 30%, 62%, 0.28);
    box-shadow: 0 0 0 1px hsla(var(--hue-inv), 40%, 60%, 0.12),
                0 20px 50px rgba(0,0,0,0.14);
}

/* Light theme for the chamfer layers (.pm-card border/fill now ride pseudos). */
body.theme-light .pm-card::before { background: hsla(var(--hue-inv), 30%, 62%, 0.28); }
body.theme-light .pm-card::after  { background: hsl(0, 0%, 97%); }

body.theme-light .pm-header {
    background: hsl(var(--hue-inv), 30%, 94%);
    border-bottom-color: hsla(var(--hue-inv), 28%, 62%, 0.22);
}

body.theme-light .pm-eyebrow  { color: hsl(var(--hue-inv), 20%, 50%); }
body.theme-light .pm-title    { color: hsl(var(--hue-inv), 30%, 18%); }
body.theme-light .pm-close    { color: hsl(var(--hue-inv), 20%, 48%); }
body.theme-light .pm-close:hover { color: hsl(var(--hue-inv), 35%, 22%); }
body.theme-light .pm-section-label { color: hsl(var(--hue-inv), 25%, 48%); }
body.theme-light .pm-field-value { color: hsl(var(--hue-inv), 25%, 22%); }
body.theme-light .pm-hint { color: hsl(var(--hue-inv), 20%, 50%); }

body.theme-light .pm-nav {
    border-right-color: hsla(var(--hue-inv), 28%, 62%, 0.18);
}

body.theme-light .pm-tab { color: hsl(var(--hue-inv), 20%, 48%); }

body.theme-light .pm-tab:hover {
    background: hsla(var(--hue-inv), 50%, 84%, 0.22);
    color: hsl(var(--hue-inv), 40%, 28%);
}

body.theme-light .pm-tab.active {
    background: hsla(var(--hue-inv), 55%, 80%, 0.32);
    color: hsl(var(--hue-inv), 55%, 28%);
    border-left-color: hsl(var(--hue-inv), 55%, 42%);
}

body.theme-light .pm-currency-chip {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 55%, 85%, 0.30) 0%,
        hsla(var(--hue-inv), 30%, 97%, 0.07) 100%);
    border-color: hsla(var(--hue-inv), 28%, 62%, 0.20);
}

body.theme-light .pm-currency-chip .pcc-val { color: hsl(var(--hue-inv), 30%, 18%); }
body.theme-light .pm-currency-chip .pcc-lbl { color: hsl(var(--hue-inv), 20%, 48%); }

body.theme-light .pm-action-btn {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 52%, 86%, 0.28) 0%,
        hsla(var(--hue-inv), 28%, 97%, 0.06) 100%);
    border-color: hsla(var(--hue-inv), 28%, 60%, 0.25);
    color: hsl(var(--hue-inv), 30%, 32%);
}

body.theme-light .pm-action-btn:hover {
    border-color: hsla(var(--hue-inv), 40%, 50%, 0.45);
    color: hsl(var(--hue-inv), 40%, 22%);
}

body.theme-light .pm-input {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 55%, 86%, 0.25) 0%,
        hsla(var(--hue-inv), 28%, 98%, 0.04) 100%);
    border-color: hsla(var(--hue-inv), 28%, 60%, 0.22);
    color: var(--text);
}

body.theme-light .pm-input:focus {
    border-color: hsla(var(--hue-inv), 55%, 45%, 0.50);
}

body.theme-light .pm-toggle-row {
    border-bottom-color: hsla(var(--hue-inv), 25%, 65%, 0.14);
}

body.theme-light .pm-toggle-label { color: hsl(var(--hue-inv), 20%, 28%); }
body.theme-light .pm-toggle-sub   { color: hsl(var(--hue-inv), 18%, 50%); }

body.theme-light .pm-slider { background: hsla(var(--hue-inv), 30%, 72%, 0.40); }
body.theme-light .pm-slider:before { background: hsl(var(--hue-inv), 20%, 58%); }

body.theme-light .pm-block-row {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 50%, 86%, 0.26) 0%,
        hsla(var(--hue-inv), 26%, 97%, 0.05) 100%);
    border-color: hsla(var(--hue-inv), 26%, 64%, 0.18);
    color: hsl(var(--hue-inv), 20%, 35%);
}

body.theme-light .pm-empty-hint { color: hsl(var(--hue-inv), 20%, 58%); }

/* ── Store content right column — needs explicit bg so it doesn't inherit dark ── */
body.theme-light .store-content-col,
body.theme-light .store-item-grid,
body.theme-light .store-layout {
    background: transparent;
}

/* ── Store category sidebar ──────────────────────────────────────── */
body.theme-light .store-cat-col {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 60%, 83%, 0.32) 0%,
        hsla(var(--hue-inv), 32%, 96%, 0.08) 100%);
    border-right-color: hsla(var(--hue-inv), 28%, 62%, 0.18);
}

body.theme-light .store-cat-box {
    background:
        linear-gradient(
            hsla(var(--hue-inv), 52%, 86%, 0.25),
            hsla(var(--hue-inv), 52%, 86%, 0.25)) content-box content-box,
        hsla(var(--hue-inv), 28%, 62%, 0.28) padding-box;
    border: none;
    color: hsl(var(--hue-inv), 22%, 40%);
}

body.theme-light .store-cat-box:hover:not(.active) {
    background:
        linear-gradient(
            hsla(var(--hue-inv), 58%, 82%, 0.36),
            hsla(var(--hue-inv), 58%, 82%, 0.36)) content-box content-box,
        hsla(var(--hue-inv), 38%, 55%, 0.42) padding-box;
    border: none;
    color: hsl(var(--hue-inv), 35%, 28%);
}

body.theme-light .store-cat-box.active {
    background:
        linear-gradient(
            hsla(var(--hue-inv), 58%, 80%, 0.35),
            hsla(var(--hue-inv), 58%, 80%, 0.35)) content-box content-box,
        hsla(var(--hue-inv), 55%, 48%, 0.55) padding-box;
    border: none;
}

/* Light theme keeps its own background-clip border trick; hide the dark-theme
   chamfer pseudos so they don't tint the translucent light fill. */
body.theme-light .store-cat-box::before,
body.theme-light .store-cat-box::after { display: none; }

body.theme-light .store-cat-divider {
    background: hsla(var(--hue-inv), 28%, 62%, 0.18);
}

/* ── Store cards / item grid ─────────────────────────────────────── */
/* Bold, dimensional cards in light mode. The base card is chamfered with
   clip-path (which clips box-shadow), and draws its "border" via the
   padding-box trick — so we thicken the border by widening `padding`, fill
   with a bottom→top gradient, and use filter: drop-shadow (respects
   clip-path) for the lift. */
body.theme-light .store-card {
    background: transparent !important;
    filter: drop-shadow(0 3px 6px hsla(var(--hue-inv), 40%, 40%, 0.22)) !important;
}
/* Light theme uses a 2px border → fill inset 2px, chamfer M = N - 2*0.586 = 10 - 1.17 = 8.83. */
body.theme-light .store-card::before {
    background: hsla(var(--hue-inv), 50%, 45%, 0.65) !important;
}
body.theme-light .store-card::after {
    inset: 2px !important;
    clip-path: polygon(0 0, calc(100% - 8.83px) 0, 100% 8.83px, 100% 100%, 8.83px 100%, 0 calc(100% - 8.83px)) !important;
    background:
        linear-gradient(to top,
            hsla(var(--hue-inv), 52%, 80%, 0.55) 0%,
            hsla(var(--hue-inv), 40%, 96%, 0.22) 100%) !important;
}

body.theme-light .store-card:hover::before {
    background: hsla(var(--hue-inv), 58%, 42%, 0.85) !important;
}
body.theme-light .store-card:hover::after {
    background:
        linear-gradient(to top,
            hsla(var(--hue-inv), 55%, 78%, 0.65) 0%,
            hsla(var(--hue-inv), 42%, 94%, 0.30) 100%) !important;
}
body.theme-light .store-card:hover {
    filter: drop-shadow(0 5px 9px hsla(var(--hue-inv), 50%, 42%, 0.30)) !important;
}

body.theme-light .store-preview-box {
    background: hsla(var(--hue-inv), 45%, 88%, 0.22);
}

body.theme-light .si-name { color: hsl(var(--hue-inv), 22%, 28%); }

body.theme-light .si-buy {
    border-color: hsla(var(--hue-inv), 28%, 60%, 0.22);
    color: hsl(var(--hue-inv), 22%, 40%);
}

body.theme-light .si-buy:hover {
    border-color: hsla(var(--hue-inv), 55%, 42%, 0.55);
    color: hsl(var(--hue-inv), 55%, 28%);
}

body.theme-light .store-empty {
    color: hsl(var(--hue-inv), 22%, 62%);
}

body.theme-light .store-rarity-row {
    border-bottom-color: hsla(var(--hue-inv), 26%, 62%, 0.16);
}

body.theme-light .sf-arrow {
    border-color: hsla(var(--hue-inv), 28%, 60%, 0.30);
    color: hsl(var(--hue-inv), 22%, 40%);
}

body.theme-light .sf-arrow:hover:not(:disabled) {
    border-color: hsla(var(--hue-inv), 55%, 42%, 0.55);
    color: hsl(var(--hue-inv), 55%, 28%);
}

/* ── Tool panel + loadout — solid opaque light backgrounds ──────── */
body.theme-light #toolTab {
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 50%, 88%, 0.96) 0%,
        hsl(0, 0%, 96%) 100%);
    border-color: hsla(var(--hue-inv), 28%, 62%, 0.22);
}

body.theme-light #toolBody {
    background: transparent;
}

/* ── Loadout panel ───────────────────────────────────────────────── */
body.theme-light #loadoutPanel {
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 52%, 87%, 0.97) 0%,
        hsl(0, 0%, 96%) 100%);
    border-color: hsla(var(--hue-inv), 28%, 62%, 0.22);
}

body.theme-light .lp-title {
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 62%, 80%, 0.42) 0%,
        hsla(var(--hue-inv), 32%, 95%, 0.12) 100%);
    border-bottom-color: hsla(var(--hue-inv), 28%, 62%, 0.18);
}

body.theme-light .lp-row {
    border-bottom-color: hsla(var(--hue-inv), 26%, 65%, 0.14);
}

body.theme-light .lp-row:hover {
    background: hsla(var(--hue-inv), 50%, 84%, 0.22);
}

body.theme-light .lp-svg {
    background: hsla(var(--hue-inv), 45%, 88%, 0.22);
    border-color: hsla(var(--hue-inv), 26%, 65%, 0.18);
}

body.theme-light .lp-slot  { color: hsl(var(--hue-inv), 22%, 52%); }
body.theme-light .lp-name  { color: hsl(var(--hue-inv), 22%, 32%); }

/* ── Loadout mini rows (items tab) ───────────────────────────────── */
body.theme-light .loadout-mini-row {
    border-color: hsla(var(--hue-inv), 26%, 65%, 0.18);
}

body.theme-light .loadout-mini-row:hover {
    background: hsla(var(--hue-inv), 50%, 84%, 0.22);
    border-color: hsla(var(--hue-inv), 35%, 58%, 0.30);
}

body.theme-light .loadout-mini-svg {
    background: hsla(var(--hue-inv), 45%, 88%, 0.22);
    border-color: hsla(var(--hue-inv), 26%, 65%, 0.18);
}

body.theme-light .loadout-mini-slot { color: hsl(var(--hue-inv), 22%, 52%); }
body.theme-light .loadout-mini-name { color: hsl(var(--hue-inv), 22%, 35%); }
body.theme-light .loadout-section-label { color: hsl(var(--hue-inv), 22%, 52%); }

/* ── Scrollbar tracks (store / loadout) ──────────────────────────── */
body.theme-light .store-cat-col::-webkit-scrollbar-track,
body.theme-light .store-item-grid::-webkit-scrollbar-track,
body.theme-light .store-content-col::-webkit-scrollbar-track,
body.theme-light .loadout-mini-list::-webkit-scrollbar-track,
body.theme-light .lp-list::-webkit-scrollbar-track {
    background: hsla(var(--hue-inv), 35%, 88%, 0.20);
}

body.theme-light .store-cat-col::-webkit-scrollbar-thumb,
body.theme-light .store-item-grid::-webkit-scrollbar-thumb,
body.theme-light .store-content-col::-webkit-scrollbar-thumb,
body.theme-light .loadout-mini-list::-webkit-scrollbar-thumb,
body.theme-light .lp-list::-webkit-scrollbar-thumb {
    background: hsla(var(--hue-inv), 38%, 70%, 0.38);
}

/* ── Friends / network tab ───────────────────────────────────────── */
body.theme-light .net-add-row input {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 55%, 86%, 0.25) 0%,
        hsla(var(--hue-inv), 28%, 97%, 0.05) 100%);
    border-color: hsla(var(--hue-inv), 28%, 60%, 0.25);
    color: var(--text);
}

body.theme-light .friend-row {
    border-bottom-color: hsla(var(--hue-inv), 26%, 65%, 0.14);
    color: hsl(var(--hue-inv), 20%, 30%);
}

/* ── Sign-up modal ───────────────────────────────────────────────── */
body.theme-light .su-card {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 58%, 86%, 0.40) 0%,
        hsla(var(--hue-inv), 30%, 97%, 0.14) 100%);
    border-color: hsla(var(--hue-inv), 40%, 55%, 0.30);
    border-top-color: hsl(var(--hue-inv), 55%, 48%);
    box-shadow: 0 0 0 1px hsla(var(--hue-inv), 35%, 60%, 0.10),
                0 0 40px hsla(var(--hue-inv), 50%, 55%, 0.06),
                0 32px 80px rgba(0,0,0,0.10);
}

body.theme-light .su-title { color: hsl(var(--hue-inv), 30%, 18%); }
body.theme-light .su-sub   { color: hsl(var(--hue-inv), 22%, 48%); }
body.theme-light .su-hint  { color: hsl(var(--hue-inv), 22%, 48%); }
body.theme-light .su-footer { color: hsl(var(--hue-inv), 20%, 52%); }

body.theme-light .su-close {
    border-color: hsla(var(--hue-inv), 26%, 62%, 0.25);
    color: hsl(var(--hue-inv), 22%, 48%);
}

body.theme-light .su-input {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 55%, 87%, 0.24) 0%,
        hsla(var(--hue-inv), 28%, 98%, 0.04) 100%);
    border-color: hsla(var(--hue-inv), 28%, 58%, 0.25);
    color: var(--text);
}

body.theme-light .su-input::placeholder {
    color: hsl(var(--hue-inv), 22%, 58%);
}

body.theme-light .su-input:focus {
    border-color: hsla(var(--hue-inv), 55%, 45%, 0.50);
    box-shadow: 0 0 0 3px hsla(var(--hue-inv), 55%, 55%, 0.10);
}

body.theme-light .su-premium-box {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 45%, 86%, 0.24) 0%,
        hsla(var(--hue-inv), 25%, 97%, 0.06) 100%);
    border-color: hsla(var(--hue-inv), 25%, 65%, 0.18);
}

body.theme-light .su-divider {
    border-top-color: hsla(var(--hue-inv), 26%, 65%, 0.15);
}

body.theme-light .su-btn-secondary {
    border-color: hsla(var(--hue-inv), 28%, 64%, 0.22);
}

body.theme-light .su-perks { color: hsl(var(--hue-inv), 20%, 38%); }
body.theme-light .su-perks li { border-bottom-color: hsla(var(--hue-inv), 25%, 65%, 0.14); }

/* ── Credits popup ───────────────────────────────────────────────── */
body.theme-light .cpop-card {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 55%, 87%, 0.42) 0%,
        hsla(var(--hue-inv), 28%, 97%, 0.14) 100%);
    border-color: hsla(var(--hue-inv), 28%, 64%, 0.18);
}

body.theme-light .cpop-header {
    border-bottom-color: hsla(var(--hue-inv), 26%, 65%, 0.14);
}

body.theme-light .cpop-title  { color: hsl(var(--hue-inv), 30%, 16%); }
body.theme-light .cpop-close  { color: hsl(var(--hue-inv), 22%, 48%); }
body.theme-light .cpop-close:hover { color: hsl(var(--hue-inv), 32%, 22%); }

body.theme-light .cpop-panel-right {
    border-left-color: hsla(var(--hue-inv), 26%, 64%, 0.15);
    background: hsla(var(--hue-inv), 40%, 84%, 0.06);
}

body.theme-light .cpop-panel-title { color: hsl(var(--hue-inv), 22%, 48%); }
body.theme-light .cpop-desc        { color: hsl(var(--hue-inv), 20%, 28%); }
body.theme-light .cpop-note        { color: hsl(var(--hue-inv), 20%, 50%); }

body.theme-light .cpop-table {
    border-color: hsla(var(--hue-inv), 26%, 65%, 0.14);
}

body.theme-light .ct-row {
    border-bottom-color: hsla(var(--hue-inv), 24%, 68%, 0.10);
    color: hsl(var(--hue-inv), 20%, 35%);
}

body.theme-light .ct-head {
    background: hsla(var(--hue-inv), 38%, 84%, 0.20);
    color: hsl(var(--hue-inv), 22%, 48%);
}

body.theme-light .cpop-earn-card {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 50%, 86%, 0.22) 0%,
        hsla(var(--hue-inv), 26%, 97%, 0.05) 100%);
    border-color: hsla(var(--hue-inv), 26%, 65%, 0.16);
}

body.theme-light .cec-title { color: hsl(var(--hue-inv), 22%, 28%); }
body.theme-light .cec-desc  { color: hsl(var(--hue-inv), 20%, 48%); }

/* Remaining popup gaps in light mode: default card text + buy/earn sections */
body.theme-light .cpop-card     { color: hsl(var(--hue-inv), 20%, 28%); }
body.theme-light .cpop-body     { color: hsl(var(--hue-inv), 20%, 30%); }
body.theme-light .cbuy-amount   { color: hsl(var(--hue-inv), 55%, 30%); }
body.theme-light .cbuy-price    { color: hsl(var(--hue-inv), 18%, 45%); }
body.theme-light .ct-highlight  { color: hsl(40, 80%, 30%); background: hsla(40, 90%, 60%, 0.18); }
body.theme-light .cec-icon      { color: hsl(var(--hue-inv), 18%, 45%); }
body.theme-light .cpop-panel-title { color: hsl(var(--hue-inv), 22%, 45%); }
body.theme-light .cpop-divider  { color: hsl(var(--hue-inv), 15%, 55%); }

body.theme-light .cbuy-card {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 50%, 87%, 0.22) 0%,
        hsla(var(--hue-inv), 26%, 97%, 0.05) 100%);
    border-color: hsla(var(--hue-inv), 26%, 65%, 0.16);
}

body.theme-light .cbuy-price { color: hsl(var(--hue-inv), 22%, 42%); }

/* ── Mobile items loadout topbar ─────────────────────────────────── */
body.theme-light .items-loadout-topbar {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 58%, 83%, 0.35) 0%,
        hsla(var(--hue-inv), 30%, 96%, 0.10) 100%);
    border-bottom-color: hsla(var(--hue-inv), 26%, 64%, 0.18);
}

body.theme-light .ilt-slot {
    background: linear-gradient(to right,
        hsla(var(--hue-inv), 52%, 86%, 0.24) 0%,
        hsla(var(--hue-inv), 28%, 97%, 0.04) 100%);
    border-color: hsla(var(--hue-inv), 26%, 65%, 0.18);
}

body.theme-light .ilt-slot:hover:not(.active) {
    border-color: hsla(var(--hue-inv), 35%, 58%, 0.32);
}

body.theme-light .ilt-label { color: hsl(var(--hue-inv), 22%, 48%); }

/* ── Debug log text ──────────────────────────────────────────────── */
body.theme-light .dbg-row { color: hsl(var(--hue-inv), 18%, 32%); }
body.theme-light .dbg-row .k { color: hsl(var(--hue-inv), 20%, 50%); }

* {
    box-sizing: border-box;
    outline: none;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Share Tech Mono', monospace;
    margin: 0;
    overflow: hidden;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: radial-gradient(circle at center, #111 0%, #050505 100%);
}

    /* SIDE GUTTER PANELS — appear and darken as viewport widens past the lobby */
    body::before,
    body::after {
        content: '';
        position: fixed;
        top: 0;
        bottom: 0;
        width: max(0px, calc((100vw - 1240px) / 2));
        z-index: 1;
        pointer-events: none;
        transition: width 0.3s ease;
    }

    body::before {
        left: 0;
        background: linear-gradient(to right, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.15) 100%);
        border-right: 1px solid #2a2a2a;
    }

    body::after {
        right: 0;
        background: linear-gradient(to left, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.15) 100%);
        border-left: 1px solid #2a2a2a;
    }

    /* Interior gutter lines — a second 1px line 12px INSIDE each side-gutter
       border, for a double-rail framed edge (matches the gutter line colour). */
    html::before,
    html::after {
        content: '';
        position: fixed;
        top: 0;
        bottom: 0;
        width: 2.4px;
        background: linear-gradient(to top, #2a2a2a 0%, #404040 100%);
        z-index: 1;
        pointer-events: none;
    }
    /* Distance from centre is FROZEN at the content-box value: the base term uses the
       content half-width (1240/2) instead of the live 50vw, so as the window narrows past
       the content box the line holds its distance from centre and never creeps any closer
       to the centred content. From that innermost spot it only ever drifts OUTWARD toward
       the edge by clamp(0,G,30px) — 1px per 1px of side gutter up to a 30px cap, then locks.
       Lower the 0.42 factor to pull the frozen spot closer to centre. */
    html::before { left:  calc(50vw - 0.42 * (1240px / 2) - 16px - clamp(0px, max(0px, (100vw - 1240px) / 2), 30px)); }
    html::after  { right: calc(50vw - 0.42 * (1240px / 2) - 16px - clamp(0px, max(0px, (100vw - 1240px) / 2), 30px)); }
    /* These interior gutter lines are part of the Rogue frame — hide them on the
       classic default. The theme class is mirrored onto <html> (see applyTheme)
       so these <html> pseudo-elements can gate on it. */
    html:not(.theme-rogue)::before,
    html:not(.theme-rogue)::after { display: none; }

/* ===========================================================================
   BOOT DOOR — futuristic two-panel intro that seals the whole site on load,
   then a central lock spins + glows, "unlocks", and the panels part. ~2s total.
   Markup + the self-removing timer live at the top of <body> in index.html.
   Tweakables: change the 2s in every animation (and the removal timeout in
   index.html) to retime; the 52% hold split is where the doors start opening.
   =========================================================================== */
#bootDoor {
    position: fixed;
    inset: 0;
    z-index: 100000;        /* above all app UI; below the dev draw overlay */
    overflow: hidden;
    pointer-events: all;
    --bd-h: var(--hue-inv, 10); /* hardcoded to the inverted HUE SHIFT (--hue-inv), the complement of the player hue — not the live --hue */
    /* transparent: the panels themselves seal the site while closed (they
       overlap at the seam), so parting them reveals the live page, not black */
}
/* At rest the doors aren't removed — they drop behind the UI (z-index 1) and
   stay as the permanent futuristic side frame (replacing the old grey gutters). */
#bootDoor.bd-done { pointer-events: none; z-index: 1; }

/* "TAP TO ACTIVATE" gate button — shown only while the doors are held SHUT on
   mobile browsers (#bootDoor.bd-gate, set by the boot script). Restyled as the
   signature EDGE chamfered-octagon button (cut corners echo the blast-door
   plates) lettered in Chakra Petch — the angular, chamfer-cornered typeface that
   matches the Edge art language. Dark glass fill, a thin accent frame, a soft
   accent under-glow; no neon. Sits below the reticule so the two never collide.
   The #bootDoor container (pointer-events:all) captures the tap; the button
   itself stays click-through. The accent frame is ::before, the glass fill is
   ::after (inset 1.5px → a 1.5px frame shows), the caps ride on top. */
.bd-gate-label {
    position: absolute;
    left: 50%; top: 64%;
    transform: translate(-50%, -50%);
    z-index: 4;                 /* above panels (-), seam (3), lock (2) */
    display: none;
    padding: 16px 30px 15px;
    text-align: center;
    background: transparent;     /* frame → ::before, fill → ::after */
    pointer-events: none;
    -webkit-user-select: none; user-select: none;
    transition: transform 0.13s ease, filter 0.13s ease;
    /* EDGE octagon — 10px chamfered corners */
    clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px),
        calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}
.bd-gate-label::before {        /* accent frame layer */
    content: '';
    position: absolute;
    inset: 0;
    z-index: -2;
    background: hsla(var(--bd-h), 78%, 58%, 0.6);
    clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px),
        calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}
.bd-gate-label::after {         /* dark glass fill, inset 1.5px → 1.5px accent frame shows */
    content: '';
    position: absolute;
    inset: 1.5px;
    z-index: -1;
    background: linear-gradient(158deg, rgba(17, 21, 29, 0.94), rgba(6, 8, 12, 0.97));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06),
                inset 0 0 24px hsla(var(--bd-h), 80%, 55%, 0.12);
    /* fill chamfer N−0.59·p = 10 − 0.59·1.5 = 9.12 (true 1.5px perpendicular frame) */
    clip-path: polygon(9.12px 0, calc(100% - 9.12px) 0, 100% 9.12px, 100% calc(100% - 9.12px),
        calc(100% - 9.12px) 100%, 9.12px 100%, 0 calc(100% - 9.12px), 0 9.12px);
}
.bd-gate-text {
    font-family: 'Chakra Petch', 'Share Tech Mono', sans-serif;
    font-weight: 600;
    font-size: clamp(12px, 3.2vw, 17px);
    line-height: 1.5;
    letter-spacing: 4px;
    color: #eaf1fb;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9),
                 0 0 16px hsla(var(--bd-h), 80%, 60%, 0.4);
}
#bootDoor.bd-gate { cursor: pointer; -webkit-tap-highlight-color: transparent; }
#bootDoor.bd-gate .bd-gate-label { display: block; animation: bdGateBreath 3s ease-in-out infinite; }
/* Elegant idle breathe — a gentle swell with a soft accent halo, no opacity flicker. */
@keyframes bdGateBreath {
    0%, 100% { transform: translate(-50%, -50%) scale(1);
               filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.6))
                       drop-shadow(0 0 6px hsla(var(--bd-h), 85%, 60%, 0.22)); }
    50%      { transform: translate(-50%, -50%) scale(1.03);
               filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.6))
                       drop-shadow(0 0 15px hsla(var(--bd-h), 85%, 60%, 0.5)); }
}
/* Tactile press: the button sinks + flares the instant it's tapped (140ms before
   the doors begin to part). Same specificity as the breathe rule but declared
   later, so it wins while .bd-press is on. */
#bootDoor.bd-press .bd-gate-label {
    display: block;
    animation: none;
    transform: translate(-50%, -50%) scale(0.93);
    filter: brightness(1.4) drop-shadow(0 0 20px hsla(var(--bd-h), 90%, 62%, 0.85));
}

/* the two sliding halves — each exactly half the viewport, so their inner edges
   meet precisely at centre and form the middle line themselves (no seam element).
   OBSIDIAN REVAMP: monolithic alien black-glass composite — near-black body with
   a cold blue cast, one sharp diagonal SPECULAR sheet (gloss, not glow) and a
   second fainter echo, plus smoky internal depth. No plates, no rivets, no grain:
   the material is seamless. The only colored elements are the thin energy seams —
   the 1px line where the doors meet, and a hairline tracer inset on each jamb. */
.bd-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50vw;
    background: #060608;         /* flat fallback; per-side tone gradient below */
    pointer-events: none;        /* never capture clicks; the container gates input */
    transform: translateX(0);    /* closed; opened via the .bd-open transition below */
    transition: transform 0.7s cubic-bezier(.7, 0, .25, 1);
    will-change: transform;
}
/* polished bevel at each door's inner edge — the glass darkens into the seam then
   catches a 1px gloss line right at the lip (the part that stays visible as the
   permanent 30px side frame at rest) */
.bd-panel::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 26px;
}
.bd-panel.bd-left::before {
    right: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.62) 46%,
        rgba(255, 255, 255, 0.05) 90%, rgba(255, 255, 255, 0.11) 100%);
}
.bd-panel.bd-right::before {
    left: 0;
    background: linear-gradient(270deg, transparent 0%, rgba(0, 0, 0, 0.62) 46%,
        rgba(255, 255, 255, 0.05) 90%, rgba(255, 255, 255, 0.11) 100%);
}
/* hairline energy tracer — a thin accent seam etched into the glass, parallel to
   the centre line; inset 24px so it keeps riding the resting 30px frame strip */
.bd-panel::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent,
        hsla(var(--bd-h), 80%, 60%, 0.30) 28%,
        hsla(var(--bd-h), 80%, 60%, 0.30) 72%, transparent);
}
.bd-panel.bd-left::after  { right: 24px; }
.bd-panel.bd-right::after { left: 24px; }
/* the inner edges (these borders) are the centre line — 1px from each door meet
   at exactly 50vw; the main thin energy seam, the one bright colored element */
/* Simple background, no gloss: a subtle tone shift — slightly lighter toward the
   centre seam, fading to near-black at the outer edge — echoing the main-menu
   radial (#111 centre → #050505 edge). */
.bd-panel.bd-left  { left: 0;  border-right: 1px solid hsla(var(--bd-h), 75%, 58%, 0.40);
    background: linear-gradient(to right, #050506 0%, #0d0d10 100%); }
.bd-panel.bd-right { right: 0; border-left:  1px solid hsla(var(--bd-h), 75%, 58%, 0.40);
    background: linear-gradient(to left,  #050506 0%, #0d0d10 100%); }

/* armored plate — milled into each obsidian door. The full chamfered frame (top /
   bottom / exterior edges + recess) is dropped per owner spec; only a single thin
   accent line on the INTERIOR (seam-facing) edge remains, so the door reads as
   clean obsidian with one inner crease. Inset clear of the inner jamb so it rides
   behind the resting 30px frame when the doors part. */
.bd-plates {
    position: absolute;
    top: 3vh; bottom: 3vh;
    display: flex;
    flex-direction: column;
}
.bd-left  .bd-plates { left: 5%;  right: 30px; }   /* 30px = clear the inner jamb */
.bd-right .bd-plates { right: 5%; left: 30px; }
.bd-plates i {
    flex: 1;
    display: block;
    background: transparent;
}
.bd-left  .bd-plates i { border-right: 1px solid rgba(255, 255, 255, 0.06); }
.bd-right .bd-plates i { border-left:  1px solid rgba(255, 255, 255, 0.06); }

/* glowing centre line — the static line is the door edges above; this energy seam
   sits on top and only flares as the doors unlock and part (invisible while closed) */
.bd-seam {
    position: absolute;
    left: 50%; top: 0; bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(to bottom, transparent,
                hsl(var(--bd-h), 85%, 60%) 45%, hsl(var(--bd-h), 85%, 60%) 55%, transparent);
    opacity: 0;
    z-index: 3;
    animation: bdSeam 1.3s ease forwards;
}
@keyframes bdSeam {
    /* 1.3s == the door-slide window (parts at 600ms, open at 1300ms): the beam
       FLARES at 46% (~600ms) exactly as the doors split, then rides the opening
       and fades out at 100% as they finish. */
    0%, 30% { opacity: 0; box-shadow: none; }
    46%     { opacity: 1; box-shadow: 0 0 22px 4px hsla(var(--bd-h), 85%, 60%, 0.9); }
    70%     { opacity: 0.5; }
    100%    { opacity: 0; }
}

/* The open: doors retract until a gutter-width strip remains at each edge — that
   strip is the permanent futuristic frame. The rest transform is set INLINE from
   the script (the engine drops calc(max()) inside CSS rules/keyframes, but honours
   it as an inline value), and the .bd-panel transition animates the slide. */

/* central lock mechanism */
.bd-lock {
    position: absolute;
    left: 50%; top: 50%;
    width: 150px; height: 150px;
    transform: translate(-50%, -50%);
    z-index: 2;
    animation: bdLockOut 1.3s ease forwards;
}
/* 1.3s clock shared with bdSeam/bdCore/bdPulse: the unlock pop lands at 46%
   (~600ms) — the exact moment the boot script parts the doors — so the pop
   reads as the CAUSE of the opening instead of trailing it. */
@keyframes bdLockOut {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    18%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    37%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    46%  { opacity: 1; transform: translate(-50%, -50%) scale(1.18); }  /* unlock pop */
    61%  { opacity: 0; transform: translate(-50%, -50%) scale(1.35); }
    100% { opacity: 0; }
}
.bd-ring { position: absolute; inset: 0; border-radius: 50%; }
.bd-ring.r1 {                       /* obsidian bezel — black-glass annulus with two sharp glints */
    background: conic-gradient(#0a0b0e, #2c313c 9%, #0c0e12 17%, #07080b 46%,
        #242936 57%, #0a0b0e 66%, #07080b 100%);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}
.bd-ring.r2 {                       /* glint arc — thin energy seam element */
    inset: 9px;
    border: 2px solid transparent;
    border-top-color: hsla(var(--bd-h), 80%, 64%, 0.85);
    border-right-color: hsla(var(--bd-h), 80%, 64%, 0.35);
    filter: drop-shadow(0 0 4px hsla(var(--bd-h), 80%, 60%, 0.6));
    animation: bdSpin 1.15s cubic-bezier(.35,0,.2,1) forwards;
}
.bd-ring.r3 {                       /* counter-spinning etched facet ring — light catching cut glass */
    inset: 22px;
    border: 2px dashed rgba(255, 255, 255, 0.13);
    animation: bdSpinRev 1.15s cubic-bezier(.35,0,.2,1) forwards;
}
@keyframes bdSpin    { to { transform: rotate(900deg); } }
@keyframes bdSpinRev { to { transform: rotate(-720deg); } }
.bd-core {                          /* polished obsidian orb + accent pilot light */
    position: absolute;
    inset: 44px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.16), transparent 26%),
        radial-gradient(circle at 36% 28%, #272b35, #0d0f14 58%, #040507);
    box-shadow: inset 0 -3px 8px rgba(0, 0, 0, 0.75),
                inset 0 1px 1px rgba(255, 255, 255, 0.10),
                0 3px 10px rgba(0, 0, 0, 0.65);
    animation: bdCore 1.3s ease forwards;
}
.bd-core::before {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    width: 12px; height: 12px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: hsl(var(--bd-h), 85%, 60%);
    box-shadow: 0 0 9px 2px hsla(var(--bd-h), 85%, 60%, 0.8);
    animation: bdPulse 1.3s ease forwards;
}

/* ── GATE IDLE — the ASMR wait state (#bootDoor.bd-gate, mobile browser) ──────
   The reticule holds in slow motion: the glint arc WANDERS around the bezel
   (irregular drift — forward, a lazy backtrack, forward again), the tick ring
   counter-rotates glacially, and the pilot light breathes. Everything quiet,
   nothing flashes; it waits peacefully for the tap. These override the one-shot
   load animations above while .bd-gate is on. */
#bootDoor.bd-gate .bd-lock { animation: bdGateLockIn 0.8s ease-out forwards; }
@keyframes bdGateLockIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
#bootDoor.bd-gate .bd-ring.r2 { animation: bdGlintDrift 7.5s ease-in-out infinite; }
@keyframes bdGlintDrift {
    0%   { transform: rotate(0deg); }
    30%  { transform: rotate(168deg); }
    46%  { transform: rotate(126deg); }   /* lazy backtrack — the "shuffle" */
    74%  { transform: rotate(305deg); }
    86%  { transform: rotate(281deg); }   /* second hesitation */
    100% { transform: rotate(360deg); }
}
#bootDoor.bd-gate .bd-ring.r3 { animation: bdTickDrift 16s linear infinite; }
@keyframes bdTickDrift { to { transform: rotate(-360deg); } }
#bootDoor.bd-gate .bd-core { animation: none; }
#bootDoor.bd-gate .bd-core::before { animation: bdPilotBreath 3.4s ease-in-out infinite; }
@keyframes bdPilotBreath {
    0%, 100% { opacity: 0.45; box-shadow: 0 0 6px 1px hsla(var(--bd-h), 85%, 60%, 0.5); }
    50%      { opacity: 0.95; box-shadow: 0 0 14px 3px hsla(var(--bd-h), 85%, 60%, 0.8); }
}
/* While gated the doors are still SHUT — the seam flare belongs to the opening,
   so hold it dark until the tap. */
#bootDoor.bd-gate .bd-seam { animation: none; opacity: 0; }

/* ── ACTIVATION (#bootDoor.bd-go, set by the tap) ─────────────────────────────
   Removing .bd-gate lets the base one-shot names re-apply, which RESTARTS the
   good old spin choreography (r2/r3 whirl, seam flares, core surges). Only the
   lock needs a dedicated replay that starts VISIBLE (bdLockOut begins at
   opacity 0 — replaying it would blink the reticule off for a frame). */
#bootDoor.bd-go .bd-lock { animation: bdLockGo 1.3s ease forwards; }
@keyframes bdLockGo {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    37%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    46%  { opacity: 1; transform: translate(-50%, -50%) scale(1.18); }  /* unlock pop */
    61%  { opacity: 0; transform: translate(-50%, -50%) scale(1.35); }
    100% { opacity: 0; }
}
/* Core surge + pilot blast peak at 46% (~600ms) — in step with the unlock pop,
   seam flare, and the door split — then relax while the panels slide. */
@keyframes bdCore {
    0%   { box-shadow: inset 0 0 16px hsla(var(--bd-h), 85%, 60%, 0.2); }
    37%  { box-shadow: inset 0 0 26px hsla(var(--bd-h), 85%, 60%, 0.6),
                       0 0 42px hsla(var(--bd-h), 85%, 60%, 0.5); }
    46%  { box-shadow: inset 0 0 44px hsl(var(--bd-h), 85%, 60%),
                       0 0 80px hsl(var(--bd-h), 85%, 60%); }
}
@keyframes bdPulse {
    0%, 30% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.8); }
    40%     { opacity: 1;   transform: translate(-50%, -50%) scale(1.1); }
    46%     { opacity: 1;   transform: translate(-50%, -50%) scale(2.2);
              box-shadow: 0 0 34px 9px #00e5ff; }
    58%     { opacity: 0; }
    100%    { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    #bootDoor { display: none; }
}

/* LOBBY UI */
#lobby {
    text-align: center;
    z-index: 10;
    transition: opacity 0.4s ease;
    width: 100%;
    max-width: 400px;
    padding: 20px;
    position: relative; /* anchor the central spine */
}

/* Central vertical metallic spine — a thin metal line down the middle of the
   lobby, BEHIND every UI element (z-index -1), so the stacked controls read as
   mounted on it. */
.metal-spine {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    transform: translateX(-50%);
    z-index: -1;
    background: linear-gradient(90deg, #20232a 0%, #565c66 44%, #6b717b 50%, #474c54 56%, #1e2027 100%);
    box-shadow: 0 0 7px rgba(0, 0, 0, 0.55);
}
/* The spine now spans only this cluster (name plate → bottom rung), so it stops at
   the top/bottom horizontal lines instead of running the full lobby height. */
.lobby-core { position: relative; }

/* ── ROGUE theme vs the classic default lobby ────────────────────────────────
   The metallic "control-panel" frame — central spine + connector rungs + diamond
   nodes + button cross-rail + notched metal name plate + store-shortcut spine
   segment — is the new "Rogue" UI theme (added across V0.7.40–V0.7.52). The
   default (Dark) and Light themes get the classic pre-V0.7.40 lobby: a plain
   centred input + button stack. The decorations only render under
   body.theme-rogue; otherwise they're hidden and the name plate reverts to its
   original hue-tinted style. (The boot-door intro is deliberately kept on every
   theme.) */
body:not(.theme-rogue) .metal-spine,
body:not(.theme-rogue) .lobby-core .rung,
body:not(.theme-rogue) .metal-rail--cross { display: none; }
body:not(.theme-rogue) #creditsShortcut::before { display: none; }
body:not(.theme-rogue) #loggedInUsername {
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 60%, 20%, 0.30) 0%,
        hsla(var(--hue-inv), 30%, 10%, 0.04) 100%);
    color: hsl(var(--hue-inv), 85%, 65%);
    text-shadow: 0 0 18px hsla(var(--hue-inv), 85%, 60%, 0.45);
    padding: 10px 0 6px;
    clip-path: none;
    box-shadow: none;
    filter: none;
}

    #lobby.hidden {
        display: none;
    }

h1 {
    font-family: 'Press Start 2P', monospace;
    color: var(--accent);
    font-size: 3.5rem;
    margin: 0;
    letter-spacing: -2px;
    text-shadow: 0 0 25px var(--accent-border);
    animation: flicker 3s infinite;
}

@keyframes flicker {
    0%, 19.999%, 22%, 62.999%, 64%, 64.999%, 70%, 100% {
        opacity: 1;
    }

    20%, 21.999%, 63%, 63.999%, 65%, 69.999% {
        opacity: 0.4;
    }
}

#versionLabel {
    color: var(--dim);
    font-size: 0.7rem;
    margin-top: -2px;      /* hug the logo */
    margin-bottom: 16px;   /* pad away from the username box → sits closer to the logo */
    letter-spacing: 2px;
}

#loginStatus {
    display: inline-block;
    background: #111;
    border: 1px solid #333;
    color: #888;
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

    #loginStatus.signed-in {
        border-color: var(--accent);
        color: var(--accent);
    }

.input-group {
    position: relative;
    margin-bottom: 15px;
}

/* ── Metallic HUD rail ─────────────────────────────────────────────────────
   A decorative divider that echoes the Edge chamfer bevel (notched ends via
   clip-path) with a brushed-metal sheen + a faint accent-hue seam down the
   middle. Reusable: drop <div class="metal-rail"></div> into any centred
   column; add .metal-rail--wide / --thin to vary it. */
.metal-rail {
    width: 72%;
    height: 4px;
    margin: 14px auto;
    position: relative;
    background: linear-gradient(180deg, #5e636b 0%, #41454c 18%, #292c31 50%, #34373d 64%, #4a4e55 100%);
    clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.20),
                inset 0 -1px 0 rgba(0, 0, 0, 0.55),
                0 1px 5px rgba(0, 0, 0, 0.5);
}
.metal-rail::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 4px),
        linear-gradient(90deg, transparent 16%, var(--accent, #00e5ff) 50%, transparent 84%);
    opacity: 0.6;
}
.metal-rail--wide { width: 88%; }
.metal-rail--thin { height: 3px; }
/* Rung: a short horizontal connector between stacked elements, with a diamond
   junction node where it crosses the central spine — builds the "assembled bus"
   look instead of stray lines. */
.rung { position: relative; margin: 9px 0; }
.rung .metal-rail { width: 46%; margin: 0 auto; }
.metal-node {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 9px;
    height: 9px;
    z-index: 1;
    background: linear-gradient(135deg, #7a808a 0%, #2a2d33 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 4px rgba(0, 0, 0, 0.55);
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
/* Cross-rail: runs BEHIND the button stack so the buttons sit on it and the
   chamfered ends poke out past their sides. */
.lobby-btns { position: relative; }
.lobby-btns .edge-btn-wrap { position: relative; z-index: 1; }
.metal-rail--cross {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 96%;
    margin: 0;
    z-index: 0;
}

input {
    background: var(--surface);
    border: 1px solid var(--border);
    color: #fff;
    padding: 15px;
    width: 100%;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.2rem;
    text-align: center;
    transition: all 0.2s ease;
}

    input:focus {
        border-color: var(--accent);
        box-shadow: 0 0 15px var(--accent-border);
    }

    input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus {
        -webkit-box-shadow: 0 0 0px 1000px var(--surface) inset;
        -webkit-text-fill-color: #fff;
        transition: background-color 5000s ease-in-out 0s;
    }

#loggedInUsername {
    display: none;
    /* Metallic name plate with stepped/notched (shouldered) ends — the JN[DEV]
       bar from the mockup. Gray brushed gradient + metal sheen; name glow on top. */
    background: linear-gradient(180deg, #3c4149 0%, #262a31 46%, #1b1e24 54%, #30343c 100%);
    border: none;
    color: hsl(var(--hue-inv), 85%, 68%);
    text-shadow: 0 0 18px hsla(var(--hue-inv), 85%, 60%, 0.5);
    padding: 11px 14px 9px;
    text-align: center;
    font-size: 22px;
    font-family: 'Share Tech Mono', monospace;
    font-weight: bold;
    letter-spacing: 2px;
    transition: color 0.3s, text-shadow 0.3s;
    clip-path: polygon(0 30%, 5% 30%, 7% 0, 93% 0, 95% 30%, 100% 30%, 100% 70%, 95% 70%, 93% 100%, 7% 100%, 5% 70%, 0 70%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -1px 0 rgba(0, 0, 0, 0.5);
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

    #loggedInUsername.show {
        display: block;
    }

/* Edge wrappers for lobby buttons */
.edge-btn-wrap {
    width: 65%;
    margin: 10px auto 0;
    padding: 2px;
    clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
    line-height: 0;
    display: block;
    transition: background 0.2s ease;
}

.edge-btn-cyan {
    background: hsla(var(--hue-inv), 100%, 62%, 0.30);
    transition: background 0.5s ease;
}

    .edge-btn-cyan:hover {
        background: hsl(var(--hue-inv), 100%, 62%);
    }

.edge-btn-pink {
    background: rgba(255,64,129,0.30);
    transition: background 0.5s ease;
}

    .edge-btn-pink:hover {
        background: rgba(255,64,129,1);
    }

button#joinBtn {
    font-family: 'Press Start 2P', monospace;
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 100%, 62%, 0.12) 0%,
        rgba(5, 5, 10, 0.95) 60%);
    border: none;
    color: var(--accent);
    padding: 15px;
    width: 100%;
    display: block;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease;
    /* wrapper trick: .edge-btn-wrap O=9, padding p=2 → inner I = O - p(2+√2) = 9 - 6.83 = 2.17
       so the diagonal band == the 2px straight padding-border (was 7 → negative band, no diagonal edge) */
    clip-path: polygon(0 0, calc(100% - 7.83px) 0, 100% 7.83px, 100% 100%, 7.83px 100%, 0 calc(100% - 7.83px));
}

/* Hover lights the wrapper border only — the inner fill stays dark, just the
   label brightens. (Was: solid flood + black text.) */
.edge-btn-cyan:hover button#joinBtn {
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 100%, 62%, 0.12) 0%,
        rgba(5, 5, 10, 0.95) 60%);
    color: hsl(var(--hue-inv), 100%, 72%);
}

button#joinBtn:active {
    transform: scale(0.98);
}

button#joinBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button#customizeBtn {
    background: rgba(5, 5, 10, 0.95);
    border: none;
    color: #ff4081;
    padding: 12px;
    width: 100%;
    display: block;
    font-family: 'Share Tech Mono', monospace;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    /* wrapper trick: .edge-btn-wrap O=9, padding p=2 → inner I = O - p(2+√2) = 9 - 6.83 = 2.17
       so the diagonal band == the 2px straight padding-border (was 7 → negative band, no diagonal edge) */
    clip-path: polygon(0 0, calc(100% - 7.83px) 0, 100% 7.83px, 100% 100%, 7.83px 100%, 0 calc(100% - 7.83px));
}

/* Hover lights the wrapper border only — fill stays dark, label brightens. */
.edge-btn-pink:hover button#customizeBtn {
    background: rgba(5, 5, 10, 0.95);
    color: #ff4081;
}

#statusMsg {
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ═══════════════════════════════════════════════════════════════════
   BANKED — MAIN MENU HUD BAR (not currently active)
   To reactivate: uncomment the HTML block in index.html and
   remove the opening/closing comment wrappers below.
   ─────────────────────────────────────────────────────────────────
   MAIN MENU HUD BAR — 5-panel PNG assembly at bottom of screen
   Panel order  (left → right):
     HUDL (stretches) | HUDeL (stretches) | HUDM (fixed 213px) |
     HUDeR (stretches) | HUDR (fixed 600px)
   All panels share the same natural height: 156px.
   Visible on LOBBY only — hidden during active gameplay.
══════════════════════════════════════════════════════════════════ */

#mainHudBar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 156px;
    display: flex;
    align-items: flex-start;
    z-index: 50;
    pointer-events: none;
}

/* hide during active gameplay */
body.playing #mainHudBar,
body.in-game #mainHudBar { display: none; }

/* In a session the tool tab drops shopping: the STORE tab is relabelled
   LEADERBOARD (syncTabLabels in app.js) and the ITEMS tab is hidden, so the
   in-game side tab is the full player list instead of the cosmetics store. */
body.in-game #toolTabs .dtab-wrap:has(.dtab[data-tab="items"]),
body.in-game #toolTabs .dtab-wrap:has(.dtab[data-tab="login"]) { display: none; }

/* ── Shared segment base ─────────────────────────────────────── */
.hud-seg {
    position: relative;
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
}

.hud-seg > img {
    display: block;
    height: 156px;
    pointer-events: none;
    user-select: none;
}

/* ── ① Left cap — stretches on X ──────────────────────────── */
.hud-seg-left {
    flex: 2 1 0;
    min-width: 0;
}

.hud-seg-left > img {
    width: 100%;
    object-fit: fill;
}

/* ── ② Left extender — stretches on X ─────────────────────── */
.hud-seg-ext-l {
    flex: 1 1 0;
    min-width: 0;
}

.hud-seg-ext-l > img {
    width: 100%;
    object-fit: fill;
}

/* ── ③ Centre panel — fixed natural width (decorative) ────── */
.hud-seg-mid {
    flex: 0 0 213px;
    width: 213px;
}

/* ── ④ Right extender — stretches on X ────────────────────── */
.hud-seg-ext-r {
    flex: 1 1 0;
    min-width: 0;
}

.hud-seg-ext-r > img {
    width: 100%;
    object-fit: fill;
}

/* ── ⑤ Right cap — fixed 600px, holds slots + circle ──────── */
.hud-seg-right {
    flex: 0 0 600px;
    width: 600px;
}

/* ── Right overlay sits on top of HUDR.png ──────────────────── */
.hud-right-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/*
 * HUDR artwork reference (600 × 156 px) — pixel-measured:
 *   Left slot  — Credits  ≈ x:45–195,  y:1–78   (center x≈120)
 *   Right slot — Shards   ≈ x:205–355, y:1–78   (center x≈280)
 *   Circle     — Avatar   ≈ x:438–596, y:2–145  (center x≈517, y≈74)
 */

/* Slot buttons — transparent over the raised artwork slots */
.hud-slot-btn {
    position: absolute;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    pointer-events: auto;
    transition: color 0.15s, filter 0.15s;
}

.hud-slot-btn:hover {
    color: #fff;
    filter: drop-shadow(0 0 6px var(--accent));
}

.hud-slot-btn:active { transform: scale(0.96); }

/* Credits slot — left tab x:45–195, y:1–78 */
.hud-slot-btn-1 {
    top: 2px;
    left: 45px;
    width: 150px;
    height: 76px;
}

/* Shards slot — right tab x:205–355, y:1–78 */
.hud-slot-btn-2 {
    top: 2px;
    left: 205px;
    width: 150px;
    height: 76px;
}

.hud-slot-icon-img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    pointer-events: none;
}

.hud-slot-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hud-slot-label {
    font-size: 7px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.45);
}

.hud-slot-val {
    font-size: 14px;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.90);
}

/* Profile circle button — circle x:438–596, y:2–145 */
.hud-circle-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 480px;
    height: 432px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.18s;
    overflow: hidden;
}

.hud-circle-btn:hover {
    filter: brightness(1.18) drop-shadow(0 0 10px var(--accent));
}

.hud-circle-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}


/* ── Light mode ──────────────────────────────────────────────── */
body.theme-light .hud-slot-btn { color: rgba(30,30,30,0.80); }
body.theme-light .hud-slot-btn:hover { color: rgba(0,0,0,1); }
body.theme-light .hud-slot-label { color: rgba(30,30,30,0.50); }
body.theme-light .hud-slot-val   { color: rgba(30,30,30,0.90); }

/* ── Responsive: shrink right cap on narrow viewports ──────── */
/* At 900px the right cap scales to 400px (× 0.667 of 600px).
   Slot positions scale proportionally: x *= 0.667, y *= 0.667 */
@media (max-width: 900px) {
    .hud-seg-right { flex: 0 0 400px; width: 400px; }
    .hud-seg-right > img { width: 400px; }
    /* Credits slot: left:30, top:1, width:100, height:51 */
    .hud-slot-btn-1 { top:1px; left:30px;  width:100px; height:51px; }
    /* Shards slot:  left:137, top:1, width:100, height:51 */
    .hud-slot-btn-2 { top:1px; left:137px; width:100px; height:51px; }
    .hud-slot-icon-img { width: 16px; height: 16px; }
    .hud-slot-val   { font-size: 11px; }
    .hud-slot-label { font-size: 6px; }
    /* Circle: right:1, top:1, width:107, height:96 */
    .hud-circle-btn { top:1px; right:1px; width:321px; height:288px; }
}

/* LOADING CANVAS — full-screen, sits on top of everything */
#loadingCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    display: none;
}

/* GAME CANVAS — Crisp pixelated rendering at fixed 1960x1960 internal */
#gameCanvas {
    display: none;
    background: #000;
    width: 1960px;
    height: 1960px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    border: none;
    image-rendering: pixelated;
    cursor: crosshair;
    transform: perspective(1400px) rotateX(22deg);
    transform-origin: center center;
    filter: brightness(0.95) contrast(1.05);
    /* P3: suppress the browser's own pan/pinch-zoom over the game surface so the
       multitouch joystick/camera/pinch handlers own the gesture. Menus/modals
       are separate elements and keep native scrolling. */
    touch-action: none;
}

    #gameCanvas.show {
        display: block;
    }

/* MINIMAP */
#minimapCanvas {
    position: fixed;
    /* Bottom-left, flush against the inner edge of the left gutter panel so the
       corner lines up with #currencyHud's right-gutter inset at any width. */
    bottom: 16px;
    left: max(8px, calc((100vw - 1240px) / 2));
    top: auto;
    right: auto;
    width: 180px;
    height: 180px;
    border: none;
    border-radius: 50%;
    box-shadow: none;
    background: transparent;
    z-index: 100;
    pointer-events: none;
    display: none;
}

    #minimapCanvas.show {
        display: block;
    }

/* ── AUTO-BUILD power-up — shape selector + charge bar (P1) ── */
.ab-ui { position: fixed; left: 12px; bottom: 64px; z-index: 106; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
/* The `hidden` attr (set by updateAutoBuild when the perk isn't owned / not in play)
   must win over the display:flex above — otherwise the 🤖 toggle leaks onto the
   lobby/main screen. Author rule beats the UA [hidden] sheet, so restate it here. */
.ab-ui[hidden] { display: none; }

/* Collapse/expand toggle — when collapsed only this button shows; tapping it grows the
   editor panel out from the TOP-LEFT toward the bottom-right. */
.ab-toggle {
    width: 32px; height: 32px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; line-height: 1;
    background: rgba(10, 12, 18, 0.82);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 6px; color: #aee8ff; cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.18);
    -webkit-tap-highlight-color: transparent;
}
.ab-toggle:hover { border-color: #00e5ff; color: #00e5ff; }
.ab-panel {
    transform-origin: top left;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.16s ease;
}
.ab-ui.ab-collapsed .ab-panel {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}
.ab-shapes {
    display: flex; gap: 6px; padding: 6px;
    background: rgba(10, 12, 18, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 6px;
}
.ab-shape {
    width: 34px; height: 34px; padding: 5px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(20, 24, 34, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: #6b7a90;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.ab-shape svg { width: 100%; height: 100%; display: block; }
.ab-shape:hover { color: #aee8ff; border-color: rgba(0, 229, 255, 0.45); }
.ab-shape.sel {
    color: #00e5ff; border-color: #00e5ff;
    background: rgba(0, 229, 255, 0.12);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.25);
}
.ab-size {
    display: flex; align-items: center; gap: 8px;
    margin-top: 6px; padding: 7px 9px;
    background: rgba(10, 12, 18, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 6px;
}
.ab-size-label { font: 9px/1 monospace; letter-spacing: 0.08em; color: #6b7a90; }
.ab-size-slider {
    flex: 1; min-width: 90px; height: 4px; border-radius: 2px;
    -webkit-appearance: none; appearance: none;
    background: rgba(0, 229, 255, 0.25); cursor: pointer;
}
.ab-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 14px; height: 14px; border-radius: 50%;
    background: #00e5ff; box-shadow: 0 0 6px rgba(0, 229, 255, 0.5); cursor: pointer;
}
.ab-size-slider::-moz-range-thumb {
    width: 14px; height: 14px; border: none; border-radius: 50%;
    background: #00e5ff; box-shadow: 0 0 6px rgba(0, 229, 255, 0.5); cursor: pointer;
}
.ab-bar {
    position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%);
    width: 260px; height: 10px; z-index: 106;
    background: rgba(10, 12, 18, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 5px;
    overflow: hidden; pointer-events: none;
}
.ab-bar-fill {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, #00b8d4, #00e5ff 60%, #7af9ff);
    border-radius: 5px;
    transition: width 0.1s linear;
}

/* SLIM LEADERBOARD — top-left in-game */
#slimLeaderboard {
    position: fixed;
    top: 8px;
    /* Match the minimap/currencyHud gutter inset so both left HUD corners align. */
    left: max(8px, calc((100vw - 1240px) / 2));
    width: 240px;
    display: none;
    z-index: 105;
    pointer-events: none;
    font-size: 12px;
    line-height: 1.5;
}

/* ── RUN XP BAR — per-life roguelite progression ──────────────────────
   Server-authoritative xp/level/xp_needed straight from the game snapshot
   (NOT the account-XP chip). Centered along the top edge, in the gap between
   the slim leaderboard (top-left) and the minimap (top-right). */
#runXpBar {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(240px, 38vw, 460px);
    display: none;            /* shown via .show once in a live run */
    align-items: center;
    gap: 8px;
    z-index: 108;
    pointer-events: none;
}
#runXpBar.show { display: flex; }
#runLevel {
    flex: 0 0 auto;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #ffe14d;
    text-shadow: 0 0 6px rgba(255,205,40,0.55), 0 1px 2px #000;
    letter-spacing: 1px;
    white-space: nowrap;
}
#runXpTrack {
    position: relative;
    flex: 1 1 auto;
    height: 12px;
    background: rgba(6,9,15,0.78);
    border: 1px solid rgba(255,225,80,0.32);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.6);
}
#runXpFill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffd23c, #ff9a3c);
    box-shadow: 0 0 8px rgba(255,180,40,0.7);
    transition: width 0.12s linear;
}
/* Brief flash on level-up (toggled by updateRunXpBar via the .levelup class). */
#runXpBar.levelup #runXpTrack { animation: runXpFlash 0.45s ease; }
@keyframes runXpFlash {
    0%, 100% { border-color: rgba(255,225,80,0.32);
               box-shadow: inset 0 1px 3px rgba(0,0,0,0.6); }
    35%      { border-color: #fff;
               box-shadow: inset 0 1px 3px rgba(0,0,0,0.6), 0 0 18px 3px rgba(255,255,255,0.8); }
}

    #slimLeaderboard.show {
        display: block;
    }

.lb-row {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    background: rgba(5, 5, 5, 0.5);
    border-left: 2px solid var(--dim);
    margin-bottom: 2px;
}

    .lb-row.me {
        border-left-color: var(--accent);
        color: var(--accent);
    }

    /* Slim HUD leaderboard columns — shared by the header (.slb-header) and the
       data rows (.lb-row) so they stay aligned: rank · name(flex) · kills · %. */
    #slimLeaderboard .lb-rank { flex: 0 0 15px; }

    #slimLeaderboard .lb-name {
        flex: 1 1 auto;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #slimLeaderboard .lb-kills { flex: 0 0 22px; text-align: right; }
    #slimLeaderboard .lb-pct { flex: 0 0 46px; text-align: right; }

    /* Row-only dimming; the header keeps its uniform accent colour. */
    #slimLeaderboard .lb-row .lb-rank,
    #slimLeaderboard .lb-row .lb-pct { color: var(--dim); }

/* DEATH SCREEN */
#deathScreen {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.97);
    z-index: 200;
    pointer-events: auto;
}

    #deathScreen.show {
        display: block;
    }

    #deathScreen .death-content {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        text-align: center;
        pointer-events: auto;
    }

#wastedText {
    font-family: 'Share Tech Mono', monospace;
    font-size: 62px;
    color: #ff0055;
    margin-bottom: 30px;
    letter-spacing: 6px;
    text-shadow: 0 0 20px #ff0055;
}

#deathStats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 28px;
    min-width: 300px;
}

.ds-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
    border-radius: 4px;
    transition: transform .25s ease, background .25s ease,
                border-color .25s ease, box-shadow .25s ease;
}

.ds-label {
    color: var(--dim);
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.ds-val {
    color: var(--accent);
    font-size: 15px;
    font-weight: normal;
    font-family: 'Share Tech Mono', monospace;
}

.ds-shards-row {
    background: rgba(168, 85, 247, 0.07);
    border: 1px solid rgba(168, 85, 247, 0.18);
}

.ds-shards-val {
    color: #a855f7 !important;
    font-size: 17px !important;
}

/* Active row in the staged death tally — highlight while its value counts up. */
.ds-row.counting {
    background: rgba(0, 255, 255, 0.09);
    border-color: rgba(0, 255, 255, 0.45);
    transform: scale(1.045);
    box-shadow: 0 0 22px rgba(0, 255, 255, 0.22);
}

    .ds-row.counting .ds-val {
        text-shadow: 0 0 12px var(--accent);
    }

/* Shards row glows purple to match its themed value. */
.ds-shards-row.counting {
    background: rgba(168, 85, 247, 0.14);
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow: 0 0 22px rgba(168, 85, 247, 0.3);
}

    .ds-shards-row.counting .ds-val {
        text-shadow: 0 0 14px #a855f7;
    }

/* RESPAWN-CHOICE: the tally settles on the Shards row, which stays lit as the
   resting state so the player reads their earned shards + new balance before
   choosing. A slow breath keeps it alive without pulling focus. */
.ds-shards-row.ds-final {
    background: rgba(168, 85, 247, 0.16);
    border-color: rgba(168, 85, 247, 0.65);
    animation: dsFinalBreath 2.2s ease-in-out infinite;
}

    .ds-shards-row.ds-final .ds-val {
        text-shadow: 0 0 16px #a855f7;
    }

@keyframes dsFinalBreath {
    0%, 100% { box-shadow: 0 0 22px rgba(168, 85, 247, 0.26); }
    50%      { box-shadow: 0 0 34px rgba(168, 85, 247, 0.44); }
}

/* Running shard balance under the tally — shards landing into the cumulative
   total, so accumulation is visible. Hidden until the server award resolves. */
.ds-shards-total {
    margin: 10px auto 0;
    text-align: center;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #c9a8f7;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .4s ease, transform .4s ease;
}

    .ds-shards-total.show {
        opacity: 1;
        transform: translateY(0);
    }

/* INVITE FRIENDS — secondary viral action, magenta-accented */
#deathScreen #deathInviteBtn {
    width: 200px;
    padding: 11px 28px;
    font-size: 15px;
    border-width: 2px;
    border-color: #7a0a60;
    color: #f020c0;
    margin-top: 2px;
}

    #deathScreen #deathInviteBtn:hover,
    #deathScreen #deathInviteBtn:focus {
        border-color: #f020c0;
        color: #fff;
        box-shadow: 0 0 20px rgba(240, 32, 192, 0.4);
    }

/* SHARE RUN — viral action, cyan-accented (sibling of INVITE) */
#deathScreen #deathShareBtn {
    width: 200px;
    padding: 11px 28px;
    font-size: 15px;
    border-width: 2px;
    border-color: #0a607a;
    color: #20c0f0;
    margin-top: 2px;
}

    #deathScreen #deathShareBtn:hover,
    #deathScreen #deathShareBtn:focus {
        border-color: #20c0f0;
        color: #fff;
        box-shadow: 0 0 20px rgba(32, 192, 240, 0.4);
    }

/* LEAVE is the secondary action — smaller and dimmer than RESPAWN (two ids beat
   the generic `#deathScreen button`). */
#deathScreen #deathLeaveBtn {
    width: 200px;
    padding: 11px 28px;
    font-size: 15px;
    border-width: 2px;
    border-color: #444;
    color: #888;
    margin-top: 2px;
}

    #deathScreen #deathLeaveBtn:hover,
    #deathScreen #deathLeaveBtn:focus {
        border-color: #888;
        color: #ccc;
    }

/* AD SLOT — unavoidable overlay on death screen */
#adSlot {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.96);
    z-index: 10;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

    #adSlot.show {
        display: flex;
    }

.ad-label {
    font-size: 9px;
    letter-spacing: 3px;
    color: #444;
    text-transform: uppercase;
}

.ad-placeholder {
    width: 320px;
    height: 180px;
    background: #0a0a0a;
    border: 1px dashed #333;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 24px;
    letter-spacing: 4px;
    font-family: 'Share Tech Mono', monospace;
}

.ad-timer-row {
    font-size: 11px;
    color: #555;
    letter-spacing: 1px;
}

.ad-timer {
    color: #a855f7;
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    margin: 0 3px;
}

#deathScreen button {
    display: block;
    margin: 18px auto;
    padding: 18px 40px;
    width: 280px;
    font-size: 21px;
    background: transparent;
    border: 3px solid #666;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Share Tech Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
}

    #deathScreen button:hover:not(:disabled),
    #deathScreen button:focus:not(:disabled) {
        border-color: #00ffff;
        color: #00ffff;
        box-shadow: 0 0 30px rgba(0, 255, 255, 0.42);
    }

    #deathScreen button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* GUEST UPSELL — shown to signed-out players once the tally finishes. */
#deathGuestUpsell {
    display: none;
    max-width: 360px;
    margin: -6px auto 6px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .4s ease, transform .4s ease;
}

    #deathGuestUpsell.show {
        display: block;
        opacity: 1;
        transform: translateY(0);
    }

.dgu-text {
    margin: 0 0 12px;
    color: var(--dim);
    font-size: 12px;
    line-height: 1.5;
    letter-spacing: 0.5px;
}

    .dgu-text strong {
        color: #a855f7;
        font-weight: 600;
    }

/* Compact, purple-accented CTA. Two ids beat the generic `#deathScreen button`. */
#deathScreen #deathGuestCta {
    display: inline-block;
    width: auto;
    margin: 0 auto;
    padding: 11px 26px;
    font-size: 14px;
    background: rgba(168, 85, 247, 0.08);
    border: 2px solid #a855f7;
    color: #d8b4fe;
}

    #deathScreen #deathGuestCta:hover,
    #deathScreen #deathGuestCta:focus {
        background: rgba(168, 85, 247, 0.2);
        border-color: #a855f7;
        color: #fff;
        box-shadow: 0 0 26px rgba(168, 85, 247, 0.45);
    }

/* TOOL TAB — bottom-right, slides up, aligned with gutter boundary */
/* ── TOOL TAB — bottom-docked. The header (toggle + subtab strip) is ALWAYS
   visible so a subtab can be picked before opening; only #toolBody collapses.
   NB: #toolTab must NOT be transformed — a transformed ancestor would trap any
   position:fixed descendant (this previously hid the toggle on phones). ── */
#toolTab {
    position: fixed;
    bottom: 0;
    right: max(0px, calc((100vw - 1260px) / 2));
    width: 320px;
    background: rgba(5, 5, 5, 0.9);
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
    border-bottom: 3px solid var(--border);
    font-size: 0.7rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease, right 0.3s ease;
}

/* ── Tool-tab chamfer (desktop) ──────────────────────────────────────────────
   The Edge corner-bevel for the floating tool panel. A clip-path on #toolTab
   itself would clip the toggle row (#toolBtnRow, top:-30px) and #loadoutPanel
   (right:100%), so the bevel rides two nested wrappers around the panel body:
   #toolChamfer = 1px border-colour layer, #toolPanel = the fill (same pattern as
   .cur-btn-wrap > .cur-btn). They're display:contents by default, so the mobile
   full-width sheet renders exactly as before; the bevel is desktop-only. */
#toolChamfer,
#toolPanel { display: contents; }

@media (min-width: 601px) {
    /* Hand the fill + border to the wrappers so the corners can be cut. The
       theme-light copy overrides the light-theme #toolTab rule above. */
    #toolTab,
    body.theme-light #toolTab {
        background: transparent;
        border: none;
    }

    #toolChamfer {
        display: flex;
        flex-direction: column;
        padding: 1px;                /* the 1px shows through the diagonal as the border */
        background: var(--border);
        clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    }

    #toolPanel {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        background: rgba(5, 5, 5, 0.9);
        /* fill chamfer N-0.59 (not N-1, N=10 on #toolChamfer) so the diagonal stroke is a true 1px perpendicular, matching the 1px-padding straight border */
        clip-path: polygon(0 0, calc(100% - 9.41px) 0, 100% 9.41px, 100% 100%, 9.41px 100%, 0 calc(100% - 9.41px));
    }

    body.theme-light #toolChamfer { background: hsla(var(--hue-inv), 28%, 62%, 0.5); }
    body.theme-light #toolPanel {
        background: linear-gradient(to top,
            hsla(var(--hue-inv), 50%, 88%, 0.96) 0%,
            hsl(0, 0%, 96%) 100%);
    }
}

#toolTabs {
    display: flex;
    flex-shrink: 0;
    background: #111;
    gap: 1px;
    padding: 1px 1px 0;
}

/* ── Chamfer wrapper: 1px padding + clip-path shows border on diagonal edge ── */
.dtab-wrap {
    flex: 1;
    padding: 1px 1px 0;
    background: transparent;
    line-height: 0;
    transition: background 0.15s;
}

    .dtab-wrap.active {
        background: hsl(var(--hue-inv), 78%, 52%);
    }

.dtab {
    width: 100%;
    padding: 8px;
    border: none;
    background: #111;
    color: var(--dim);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.65rem;
    transition: color 0.15s, background 0.15s;
    display: block;
}

    .dtab.active {
        color: hsl(var(--hue-inv), 85%, 62%);
        background: var(--surface);
    }

#toolBody {
    min-height: 0;
    overflow-y: auto;
    padding: 12px 12px 80px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.4;
    max-height: calc(100vh - var(--hud-bottom, 102px) - 100px);
}

/* Collapsed when closed (header + subtab strip stay visible); shown when open */
#toolTab:not(.open) #toolBody {
    display: none;
}

/* Desktop: every subtab opens to the same height as STORE/ITEMS (540px), so the
   panel doesn't jump heights between tabs. Content taller than this scrolls inside. */
@media (min-width: 601px) and (min-height: 501px) {
    #toolTab.open #toolBody {
        height: 540px;
    }
}

.dtab-pane {
    display: none;
}

    .dtab-pane.active {
        display: block;
    }

.dblog {
    margin-bottom: 4px;
    line-height: 1.2;
}

    .dblog.error {
        color: var(--danger);
    }

    .dblog.ok {
        color: #00ff88;
    }

    .dblog.info {
        color: var(--accent);
    }

.dbg-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    color: #ccc;
}

    .dbg-row .k {
        color: var(--dim);
    }

    .dbg-row .v {
        color: var(--accent);
    }

/* ── toolBtnRow: the toggle tab floats on TOP of the panel's top-right corner
   (original look). Absolute, so it doesn't take a full-width row inside. ── */
#toolBtnRow {
    position: absolute;
    top: -30px;
    right: -1px;
    display: flex;
    align-items: stretch;
}

/* Edge-chamfered toggle tab (G2): a bigger hit target plus the signature
   top-right / bottom-left notch with a CONTINUOUS border. The border + fill ride
   two pseudo layers because a clip-path on the button alone shears its own border
   off the diagonal; the button box stays transparent so #toolBtnRow's layout and
   the theme-light tint below keep working. (A clip-path on #toolTab itself is the
   trap here — it would clip away #toolBtnRow at top:-30px.) */
#toolToggle {
    position: relative;
    z-index: 0;
    background: transparent;
    border: none;
    color: var(--dim);
    padding: 7px 22px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    white-space: nowrap;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

    #toolToggle::before {  /* border layer (chamfered) */
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        pointer-events: none;
        background: var(--border);
        clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    }

    #toolToggle::after {   /* fill layer, inset 1px → 1px chamfered frame shows */
        content: "";
        position: absolute;
        inset: 1px;
        z-index: -1;
        pointer-events: none;
        background: rgba(5, 5, 5, 0.9);
        /* fill chamfer N-0.59 (not N-1) so the diagonal stroke is a true 1px perpendicular, matching the straight edges */
        clip-path: polygon(0 0, calc(100% - 7.41px) 0, 100% 7.41px, 100% 100%, 7.41px 100%, 0 calc(100% - 7.41px));
    }

    #toolToggle:hover::after {
        background: rgba(12, 12, 14, 0.92);
    }

    #toolToggle:hover {
        color: var(--accent);
    }

    /* Light theme: the gradient/border above now ride the pseudo layers
       (#expandBtn keeps using the shared body.theme-light rule near the top). */
    body.theme-light #toolToggle::before {
        background: hsla(var(--hue-inv), 30%, 60%, 0.22);
    }

    body.theme-light #toolToggle::after {
        background: linear-gradient(to right,
            hsla(var(--hue-inv), 55%, 84%, 0.38) 0%,
            hsla(var(--hue-inv), 30%, 96%, 0.10) 100%);
    }

/* Orientation toggle (⟳) — MOBILE ONLY, sits to the LEFT of #toolToggle in the row.
   Mirrors the toolToggle chamfered tab look. Desktop never shows it. */
#orientToggle, #fsToggle { display: none; }
/* Shared mobile chamfer styling for both the fullscreen + orientation toggles. Display
   itself is gated below: the ⛶ fullscreen prompt shows until the app is fullscreen,
   then the ⟳ orientation toggle takes its place (html[data-fs] driven by JS). */
html:not([data-brand="desktop"]) #orientToggle,
html:not([data-brand="desktop"]) #fsToggle {
    position: relative;
    z-index: 0;
    background: transparent;
    border: none;
    color: var(--dim);
    padding: 7px 15px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1;
    white-space: nowrap;
    margin-right: -1px; /* overlap the toolToggle's left chamfer so they read as one row */
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
/* Not fullscreen → prompt for fullscreen first. Fullscreen → reveal orientation toggle. */
html:not([data-brand="desktop"]):not([data-fs="on"]) #fsToggle { display: block; }
html:not([data-brand="desktop"])[data-fs="on"] #orientToggle { display: block; }
    html:not([data-brand="desktop"]) #orientToggle::before,
    html:not([data-brand="desktop"]) #fsToggle::before {  /* border layer */
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: var(--border);
        clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    }
    html:not([data-brand="desktop"]) #orientToggle::after,
    html:not([data-brand="desktop"]) #fsToggle::after {   /* fill layer, inset 1px */
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: rgba(5, 5, 5, 0.9);
        clip-path: polygon(0 0, calc(100% - 7.41px) 0, 100% 7.41px, 100% 100%, 7.41px 100%, 0 calc(100% - 7.41px));
    }
    html:not([data-brand="desktop"]) #orientToggle:hover,
    html:not([data-brand="desktop"]) #fsToggle:hover { color: var(--accent); }
    html:not([data-brand="desktop"]) #orientToggle.landscape-on { color: var(--accent); }

#expandBtn {
    background: rgba(5, 5, 5, 0.9);
    border: 1px solid var(--border);
    border-right: none;
    border-bottom: none;
    color: var(--dim);
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.65rem;
    white-space: nowrap;
    display: none;
    letter-spacing: 0.5px;
}

    #expandBtn.visible { display: block; }

    #expandBtn:hover { color: var(--accent); }

/* LOGIN tab styling */
.acc-title {
    margin-bottom: 12px;
    text-align: center;
    color: var(--accent);
    font-weight: bold;
}

#tabLogin input {
    width: 100%;
    margin-bottom: 8px;
    padding: 8px;
    background: #111;
    border: 1px solid #333;
    color: white;
    font-size: 13px;
}

#tabLogin .acc-signup {
    width: 55%;
    padding: 10px;
    border: none;
    margin: 0 auto 8px;
    display: block;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    background: #ff4081;
    color: #fff;
}

#tabLogin .acc-login {
    display: block;
    width: 55%;
    padding: 10px;
    border: none;
    margin: 0 auto 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    background: #2a2a2a;
    color: #00e5ff;
}

#tabLogin button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#tabLogin input:-webkit-autofill,
#tabLogin input:-webkit-autofill:hover,
#tabLogin input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px #111 inset;
    -webkit-text-fill-color: #fff;
    border: 1px solid #333;
    transition: background-color 5000s ease-in-out 0s;
}

.oauth-divider {
    margin: 12px 0;
    text-align: center;
    color: #666;
    font-size: 11px;
}

.oauth-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.oauth-btn {
    flex: 1;
    padding: 9px 8px;
    background: #222;
    color: white;
    border: 1px solid #333;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    transition: background 0.15s, border-color 0.15s;
}

    .oauth-btn svg { display: block; }

    .oauth-btn.google {
        background: #1a1a2e;
        border-color: #4285F4;
    }

    .oauth-btn.discord {
        background: #1a1a2e;
        border-color: #5865F2;
        color: #7289da;
    }

    .oauth-btn.facebook {
        background: #1a1a2e;
        border-color: #1877f233;
        color: #1877f2;
        opacity: 0.4;
        cursor: not-allowed;
    }

    .oauth-btn:hover:not(:disabled) {
        filter: brightness(1.25);
    }

/* ── Light theme: login + OAuth buttons ── */
body.theme-light #tabLogin .acc-login {
    background: hsl(var(--hue-inv), 30%, 88%);
    color: hsl(var(--hue-inv), 55%, 30%);
}
body.theme-light .oauth-btn {
    background: #fff;
    border-color: hsla(var(--hue-inv), 25%, 55%, 0.35);
    color: hsl(var(--hue-inv), 25%, 25%);
}
body.theme-light .oauth-btn.google  { border-color: #4285F4; }
body.theme-light .oauth-btn.discord { border-color: #5865F2; color: #5865F2; }
body.theme-light .oauth-btn.facebook{ border-color: #1877f2; color: #1877f2; }
body.theme-light .oauth-divider,
body.theme-light .forgot a { color: hsl(var(--hue-inv), 18%, 45%); }

/* ── About modal: tech highlight chips + AI cards ───────────────────
   Class-based (not inline) so the light-mode overrides below can take
   effect. The old inline #111 + JS hover handlers broke in light mode
   because the JS rewrote the style attribute and the [style*="#111"]
   selector stopped matching. ── */
.about-hl {
    background: linear-gradient(to top,
        rgba(0, 229, 255, 0.22) 0%,
        rgba(0, 229, 255, 0.04) 100%);
    color: #dff7ff;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

/* About modal is inline-styled dark — flip its surfaces + text in light mode.
   Attribute selectors catch the nested dark surfaces wherever they sit. */
body.theme-light #aboutModal > div     { background: #f1f1f1 !important; border-color: #ccc !important; }
body.theme-light #aboutModal [style*="#111"]    { background: #e6e6e6 !important; }
body.theme-light #aboutModal [style*="#080808"] { background: #ececec !important; }
body.theme-light #aboutModal h3,
body.theme-light #aboutModal p,
body.theme-light #aboutModal div,
body.theme-light #aboutModal span { color: hsl(var(--hue-inv), 22%, 30%) !important; }

/* About highlight chips — light mode (bottom→top gradient for dimension) */
body.theme-light #aboutModal .about-hl {
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 60%, 60%, 0.30) 0%,
        hsla(var(--hue-inv), 55%, 80%, 0.06) 100%) !important;
    color: hsl(var(--hue-inv), 45%, 24%) !important;
}

.forgot {
    text-align: center;
    margin: 10px 0;
}

    .forgot a {
        color: #888;
        font-size: 11px;
        text-decoration: none;
    }

.premium-block {
    border-top: 1px solid #333;
    margin: 12px 0;
    padding-top: 12px;
}

.premium-title {
    color: #ffea00;
    font-size: 12px;
    margin-bottom: 6px;
}

.premium-btn {
    width: 100%;
    padding: 10px;
    background: #ffd700;
    color: #000;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
}

.premium-note {
    font-size: 10px;
    color: #666;
    margin-top: 4px;
}

.premium-options {
    display: none;
    gap: 6px;
    margin-top: 8px;
}

    .premium-options.show {
        display: flex;
    }

.popt-btn {
    flex: 1;
    padding: 8px 4px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    cursor: pointer;
    border: 1px solid #444;
    background: #111;
    color: #aaa;
    transition: all 0.15s;
}

    .popt-btn:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

    .popt-btn.popt-sub {
        border-color: #ffd70066;
        color: #ffd700;
        background: #ffd70008;
    }

        .popt-btn.popt-sub:hover {
            border-color: #ffd700;
            background: #ffd70015;
        }

#userInfo {
    display: none;
    text-align: center;
}

    #userInfo.show {
        display: block;
    }

.ui-label {
    color: #00ff88;
    margin-bottom: 8px;
}

#userEmail {
    color: white;
    margin-bottom: 12px;
}

#logoutBtn {
    padding: 8px 20px;
    background: #ff5555;
    color: white;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

#editProfileBtn {
    display: block;
    width: 100%;
    padding: 8px 20px;
    margin-bottom: 8px;
    background: #111;
    color: var(--accent);
    border: 1px solid var(--accent-border);
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    letter-spacing: 1px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

    #editProfileBtn:hover {
        background: var(--accent-glow);
        border-color: var(--accent);
    }

/* ── TITLE SCREEN ANIMATION ─────────────────────────────────────── */
.title-screen {
    position: relative;
    width: min(410px, 90vw);
    aspect-ratio: 820 / 340;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 12px;
}

.logo-base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('./img/EDGE2.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.shine-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    -webkit-mask-image: url('./img/EDGE2mask.png');
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-image: url('./img/EDGE2mask.png');
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    background: linear-gradient( 105deg, transparent 0%, transparent 30%, rgba(255,255,255,0.0) 38%, rgba(180,240,255,0.55) 44%, rgba(255,255,255,0.97) 50%, rgba(180,240,255,0.55) 56%, rgba(255,255,255,0.0) 62%, transparent 70%, transparent 100% );
    background-size: 300% 100%;
    background-position: 200% 0;
    mix-blend-mode: screen;
    opacity: 0;
}

.gradient-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    -webkit-mask-image: url('./img/EDGE2mask.png');
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-image: url('./img/EDGE2mask.png');
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    background: linear-gradient( 105deg, rgba(0,180,255,0.05) 0%, rgba(80,210,255,0.14) 20%, rgba(160,235,255,0.30) 45%, rgba(220,248,255,0.58) 65%, rgba(255,255,255,0.82) 82%, rgba(255,255,255,0.92) 100% );
    mix-blend-mode: screen;
    opacity: 0;
}

.glow-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image: url('./img/EDGE2.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 6px #00f0ff) drop-shadow(0 0 18px #00f0ff) drop-shadow(0 0 40px #ff00aa44);
    opacity: 0;
}

.noise-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    -webkit-mask-image: url('./img/EDGE2mask.png');
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-image: url('./img/EDGE2mask.png');
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E") repeat;
    background-size: 160px 160px;
    mix-blend-mode: screen;
    opacity: 0;
    animation: noise-scroll 1.4s linear infinite;
}

@keyframes noise-scroll {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 160px 160px;
    }
}

/* ── PROFILE MODAL ──────────────────────────────────────────────── */
#profileModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 99998;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

    #profileModal.show {
        display: flex;
    }

/* ════════════════ PROFILE OVERVIEW (PROFILE-OVERVIEW) ════════════════ */
/* Overlay stays in layout (visibility, not display:none) so the card's
   transform/opacity transition actually runs. backdrop-filter blurs the game
   behind it; the solid rgba background is the fallback where blur isn't
   supported. Sits just under the edit modal (99998). */
#profileOverview {
    position: fixed;
    inset: 0;
    z-index: 99997;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0);
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, background 0.2s ease,
        -webkit-backdrop-filter 0.2s ease, backdrop-filter 0.2s ease,
        visibility 0s linear 0.2s;
}
    #profileOverview.show {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        background: rgba(0, 0, 0, 0.6);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
        transition: opacity 0.2s ease, background 0.2s ease,
            -webkit-backdrop-filter 0.2s ease, backdrop-filter 0.2s ease,
            visibility 0s;
    }

/* Grows from the top-right corner (where the profile chip lives). Animate ONLY
   transform + opacity (compositor-only — smooth on mobile + desktop). */
.po-card {
    position: relative;
    z-index: 0;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px 22px 20px;
    background: transparent;
    box-shadow: 0 0 0 1px var(--accent-glow, rgba(0, 229, 255, 0.25)),
        0 24px 60px rgba(0, 0, 0, 0.75);
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
    transform-origin: top right;
    transform: translate(40px, -40px) scale(0.4);
    opacity: 0;
    will-change: transform, opacity;
    transition: transform 0.2s cubic-bezier(0.2, 0.85, 0.3, 1), opacity 0.18s ease;
}
    /* Border + fill ride two pseudos so the diagonal stroke == the 1px straight border
       (a clip-path on the box shears its real border off the diagonal). */
    .po-card::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: #1f1f1f;
        clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
    }
    .po-card::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: #0a0a0a;
        clip-path: polygon(0 0, calc(100% - 15.41px) 0, 100% 15.41px, 100% 100%, 15.41px 100%, 0 calc(100% - 15.41px));
    }
    #profileOverview.show .po-card {
        transform: none;
        opacity: 1;
    }

.po-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: #777;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s;
}
    .po-close:hover { color: #fff; }

/* Identity + account level */
.po-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}
.po-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient(circle at 50% 35%, #1c1c1c, #0c0c0c);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: hsl(var(--hue, 190), 70%, 62%);
    font-size: 24px;
    font-weight: 700;
}
    .po-avatar img { width: 100%; height: 100%; object-fit: cover; }
.po-id { min-width: 0; flex: 1; }
.po-name {
    font-size: 19px;
    font-weight: 700;
    color: #f3f3f3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.po-level-row { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.po-level {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: hsl(var(--hue, 190), 85%, 62%);
    flex-shrink: 0;
}
.po-xp-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.po-xp-fill {
    height: 100%;
    border-radius: 3px;
    background: hsl(var(--hue, 190), 85%, 58%);
    transition: width 0.3s ease;
}

/* Currency readout — bigger than the edit form's chips */
.po-currency {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
}
.po-cur {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
}
.po-cur-icon { width: 30px; height: 30px; flex-shrink: 0; }
.po-cur-val {
    font-family: 'Share Tech Mono', monospace;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
}
.po-cur-lbl { font-size: 9px; letter-spacing: 2px; color: #777; margin-top: 1px; }

/* Pawn plateau + territory platform */
.po-stage {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 16px;
}
.po-stage-col { display: flex; flex-direction: column; align-items: center; gap: 7px; }
/* Round "plateau" override of the shared sim clip (a 240px rounded box).
   Compound selector so it outranks `.sim-canvas-clip`, which is defined later. */
.sim-canvas-clip.po-plateau {
    width: 184px;
    height: 184px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6);
}
    .po-plateau .pawn-demo-canvas { width: 184px; height: 184px; }
.po-platform {
    width: 104px;
    height: 104px;
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.55);
}
.po-stage-label {
    font-size: 8px;
    letter-spacing: 2px;
    color: #666;
    max-width: 110px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Lifetime stats — small text */
.po-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 12px 4px;
    margin-bottom: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.po-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.po-stat-val {
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    color: #e6e6e6;
}
.po-stat-lbl { font-size: 8px; letter-spacing: 1px; color: #6c6c6c; text-align: center; }

/* Weekly cards */
.po-weekly { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.po-week-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
}
.po-week-icon { font-size: 20px; flex-shrink: 0; }
.po-week-body { flex: 1; min-width: 0; }
.po-week-title { font-size: 12px; font-weight: 700; color: #ddd; }
.po-week-sub {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.po-week-bar {
    height: 5px;
    border-radius: 3px;
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.po-week-fill {
    height: 100%;
    border-radius: 3px;
    background: hsl(var(--hue, 190), 85%, 55%);
    transition: width 0.3s ease;
}
.po-week-claim {
    flex-shrink: 0;
    border: none;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #06210f;
    background: linear-gradient(180deg, #38e08a, #16b86a);
    cursor: pointer;
}
    .po-week-claim:hover { filter: brightness(1.1); }

/* Actions */
.po-actions { display: flex; flex-direction: column; gap: 8px; }
.po-btn {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #ddd;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
    .po-btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.22); }
    .po-btn-primary {
        color: #021018;
        border-color: transparent;
        background: linear-gradient(180deg, hsl(var(--hue, 190), 90%, 62%), hsl(var(--hue, 190), 90%, 50%));
    }
    .po-btn-primary:hover { filter: brightness(1.08); }

/* Narrow screens: keep the card + stage inside the viewport */
@media (max-width: 430px) {
    .po-card { max-width: 92vw; padding: 20px 16px 16px; }
    .po-stage { gap: 12px; }
    .sim-canvas-clip.po-plateau { width: 150px; height: 150px; }
    .po-plateau .pawn-demo-canvas { width: 150px; height: 150px; }
    .po-platform { width: 90px; height: 90px; }
    .po-cur-val { font-size: 17px; }
}

.pm-card {
    position: relative;
    z-index: 0;
    background: transparent;     /* fill → ::after; keeps the 16px chamfer's border continuous (S1) */
    border: none;                /* border → ::before */
    width: 100%;
    max-width: 640px;
    min-height: 440px;
    max-height: 86vh;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--accent-glow), 0 20px 50px rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}

    .pm-card::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        pointer-events: none;
        background: #1f1f1f;
        clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
    }

    .pm-card::after {
        content: "";
        position: absolute;
        inset: 1px;
        z-index: -1;
        pointer-events: none;
        background: #0a0a0a;
        /* fill chamfer N-0.59 (not N-1) so the diagonal stroke is a true 1px perpendicular, matching the straight edges */
        clip-path: polygon(0 0, calc(100% - 15.41px) 0, 100% 15.41px, 100% 100%, 15.41px 100%, 0 calc(100% - 15.41px));
    }

.pm-header {
    padding: 20px 28px;
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to bottom, #111, #0a0a0a);
    flex-shrink: 0;
}

.pm-eyebrow {
    font-size: 9px;
    color: #444;
    letter-spacing: 4px;
    margin-bottom: 2px;
}

.pm-title {
    font-size: 20px;
    font-weight: 600;
    color: #ddd;
    letter-spacing: 1px;
}

.pm-close {
    background: none;
    border: none;
    color: #555;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 10px;
    transition: color 0.15s;
}

    .pm-close:hover {
        color: #aaa;
    }

.pm-body {
    display: flex;
    overflow: hidden;
    flex: 1;
}

.pm-nav {
    display: flex;
    flex-direction: column;
    width: 130px;
    flex-shrink: 0;
    border-right: 1px solid #1a1a1a;
    padding: 16px 0;
    gap: 2px;
}

.pm-tab {
    background: none;
    border: none;
    color: #555;
    font-family: inherit;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 10px 18px;
    text-align: left;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

    .pm-tab:hover {
        color: #aaa;
        background: #0d0d0d;
    }

    .pm-tab.active {
        color: hsl(var(--hue-inv), 85%, 62%);
        border-left-color: hsl(var(--hue-inv), 85%, 62%);
        background: hsla(var(--hue-inv), 60%, 12%, 0.35);
    }

.pm-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

.pm-pane {
    display: none;
}

    .pm-pane.active {
        display: block;
    }

.pm-section-label {
    font-size: 9px;
    letter-spacing: 2px;
    color: #444;
    margin-bottom: 6px;
}

.pm-field-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.pm-field-value {
    color: #ccc;
    font-size: 13px;
    margin-bottom: 4px;
}

.pm-hint {
    font-size: 10px;
    color: #444;
    line-height: 1.5;
}

.pm-currency-row {
    display: flex;
    gap: 16px;
    margin-top: 6px;
}

.pm-currency-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #111;
    border: 1px solid #222;
    border-radius: 4px;
    padding: 8px 14px;
    flex: 1;
}

    .pm-currency-chip .pcc-icon {
        font-size: 15px;
    }

    .pm-currency-chip .pcc-val {
        font-size: 14px;
        color: #eee;
        font-weight: 600;
    }

    .pm-currency-chip .pcc-lbl {
        font-size: 9px;
        color: #555;
        letter-spacing: 1px;
        margin-top: 1px;
    }

.pm-action-btn {
    background: #111;
    border: 1px solid #333;
    color: #aaa;
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 1px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

    .pm-action-btn:hover {
        border-color: #555;
        color: #ddd;
    }

    .pm-action-btn.confirm {
        border-color: var(--accent-border);
        color: var(--accent);
    }

        .pm-action-btn.confirm:hover {
            border-color: var(--accent);
            background: var(--accent-glow);
        }

    .pm-action-btn.danger {
        border-color: #ff555533;
        color: #ff7070;
    }

        .pm-action-btn.danger:hover {
            border-color: #ff5555;
            background: #ff555511;
        }

.pm-input {
    width: 100%;
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    color: #ddd;
    font-family: inherit;
    font-size: 12px;
    padding: 9px 12px;
    margin-bottom: 10px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

    .pm-input:focus {
        border-color: var(--accent-border);
    }

.pm-rename-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pm-err {
    font-size: 10px;
    color: #ff5555;
    margin-top: 6px;
    min-height: 14px;
}

/* Toggle rows (preferences) */
/* ── Segmented MANUAL / AUTOMATIC switch ──────────────────────── */
.pm-color-mode-switch {
    display: flex;
    gap: 3px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 5px;
    padding: 3px;
    margin-bottom: 10px;
}
.pm-seg-btn {
    flex: 1;
    padding: 6px 10px;
    font-size: 9px;
    letter-spacing: 1.8px;
    font-family: 'Share Tech Mono', monospace;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.32);
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
}
.pm-seg-btn.pm-seg-active {
    background: var(--accent);
    color: #000;
}
.pm-seg-btn:hover:not(.pm-seg-active) {
    color: rgba(255,255,255,0.65);
}
body.theme-light .pm-color-mode-switch {
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.12);
}
body.theme-light .pm-seg-btn {
    color: rgba(0,0,0,0.32);
}
body.theme-light .pm-seg-btn.pm-seg-active {
    color: #fff;
}

/* Inline 3D toggle below the pawn demo canvas */
.pm-3d-toggle-inline {
    margin-top: 6px;
    width: 240px;
    align-items: center;
    gap: 8px;
}

.pm-toggle-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #141414;
}

.pm-toggle-label {
    font-size: 12px;
    color: #bbb;
    margin-bottom: 3px;
}

.pm-toggle-sub {
    font-size: 10px;
    color: #444;
    line-height: 1.4;
}

.pm-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}

    .pm-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.pm-slider {
    position: absolute;
    inset: 0;
    background: #222;
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.2s;
}

    .pm-slider:before {
        content: "";
        position: absolute;
        height: 16px;
        width: 16px;
        left: 3px;
        bottom: 3px;
        background: #555;
        border-radius: 50%;
        transition: transform 0.2s, background 0.2s;
    }

.pm-switch input:checked + .pm-slider {
    background: var(--accent-glow);
    border-color: var(--accent-border);
}

    .pm-switch input:checked + .pm-slider:before {
        transform: translateX(16px);
        background: var(--accent);
    }

/* Block list */
.pm-block-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 140px;
    overflow-y: auto;
}

.pm-block-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #111;
    border: 1px solid #1e1e1e;
    font-size: 11px;
    color: #aaa;
}

    .pm-block-row button {
        background: none;
        border: none;
        color: #ff5555;
        cursor: pointer;
        font-family: inherit;
        font-size: 10px;
        letter-spacing: 1px;
        padding: 2px 6px;
    }

        .pm-block-row button:hover {
            color: #ff8888;
        }

.pm-empty-hint {
    font-size: 10px;
    color: #333;
    padding: 8px 0;
}

/* CUSTOMIZE POPUP */
#customizePopup {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 300;
    align-items: center;
    justify-content: center;
}

    #customizePopup.show {
        display: flex;
    }

.cp-card {
    position: relative;
    z-index: 0;
    background: transparent;     /* fill → ::after so the 14px chamfer keeps a continuous border (S1) */
    border: none;                /* border → ::before (a clip-path shears a real border off the diagonal) */
    padding: 24px;
    width: min(420px, 92vw);
    text-align: center;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

    .cp-card::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        pointer-events: none;
        background: #ff4081;
        clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
    }

    .cp-card::after {
        content: "";
        position: absolute;
        inset: 1px;
        z-index: -1;
        pointer-events: none;
        background: var(--surface);   /* adapts per theme — no light-mode override needed */
        /* fill chamfer N-0.59 (not N-1) so the diagonal stroke is a true 1px perpendicular, matching the straight edges */
        clip-path: polygon(0 0, calc(100% - 13.41px) 0, 100% 13.41px, 100% 100%, 13.41px 100%, 0 calc(100% - 13.41px));
    }

    .cp-card h3 {
        font-family: 'Press Start 2P', monospace;
        color: #ff4081;
        font-size: 14px;
        letter-spacing: 0.15em;
        margin: 0 0 14px;
    }

    .cp-card p {
        color: var(--text);
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 18px;
    }

    .cp-card button {
        background: transparent;
        border: 2px solid #ff4081;
        color: #ff4081;
        padding: 10px 40px;
        font-family: 'Share Tech Mono', monospace;
        cursor: pointer;
        letter-spacing: 2px;
    }

/* ── LEVEL-UP CARD POPUP (P2) — 3 perk cards over the live, dimmed world. The
   pawn is frozen + invulnerable server-side while this is open, so there is no
   danger window; the arena keeps running underneath. ───────────────────────── */
/* Non-blocking: the backdrop ignores pointer events so the player can keep
   steering underneath; only the panel itself is interactive. */
#levelupModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 600;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: levelupFadeIn 0.18s ease;
}
#levelupModal.show { display: flex; }
@keyframes levelupFadeIn { from { opacity: 0; } to { opacity: 1; } }

.levelup-panel {
    position: relative;
    text-align: center;
    pointer-events: auto;
    padding: 22px 26px 18px;
    background: radial-gradient(ellipse at center, rgba(6,10,18,0.92), rgba(2,4,8,0.96));
    border: 1px solid rgba(255,225,80,0.35);
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
/* (X) close — stores the pick without consuming it. */
.levelup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--text, #cfeefb);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    transition: border-color 0.12s ease, color 0.12s ease;
}
.levelup-close:hover { border-color: #00e5ff; color: #00e5ff; }
/* Force-field countdown bar — drains over the protection window. */
#levelupFfBar {
    width: min(420px, 80vw);
    height: 5px;
    background: rgba(255,255,255,0.10);
    border-radius: 3px;
    overflow: hidden;
}
#levelupFfFill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00e5ff, #cfefff);
    box-shadow: 0 0 8px rgba(0,229,255,0.6);
    transition: width 0.1s linear;
}
.levelup-shuffle {
    margin-top: 4px;
    padding: 7px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.18);
    color: var(--text, #cfeefb);
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    letter-spacing: 1px;
    border-radius: 4px;
    cursor: not-allowed;
    opacity: 0.5;
}
/* Reopen icon next to the run-XP bar — shows stored-pick count. */
#levelupReopen {
    display: none;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
    padding: 2px 8px;
    background: rgba(255,225,80,0.12);
    border: 1px solid rgba(255,225,80,0.55);
    color: #ffe14d;
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    pointer-events: auto;
    animation: levelupTitlePulse 1.1s ease-in-out infinite;
}
#levelupReopen.show { display: inline-flex; }
#levelupReopen:hover { border-color: #fff; color: #fff; }
/* Trail-mode safety lock: opening the panel freezes the pawn, so the reopen
   shortcut greys out while you're exposed on a trail — review cards only from the
   safety of your own territory. */
#levelupReopen.locked {
    background: rgba(150,150,150,0.10);
    border-color: rgba(150,150,150,0.40);
    color: #8a8a8a;
    cursor: not-allowed;
}
    #levelupReopen.locked:hover { border-color: rgba(150,150,150,0.40); color: #8a8a8a; }
.levelup-title {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(16px, 3vw, 26px);
    color: #ffe14d;
    letter-spacing: 0.18em;
    margin: 0;
    text-shadow: 0 0 14px rgba(255,205,40,0.7), 0 2px 3px #000;
    animation: levelupTitlePulse 1.1s ease-in-out infinite;
}
@keyframes levelupTitlePulse {
    0%, 100% { text-shadow: 0 0 14px rgba(255,205,40,0.70), 0 2px 3px #000; }
    50%      { text-shadow: 0 0 24px rgba(255,225,80,0.95), 0 2px 3px #000; }
}
.levelup-sub {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    letter-spacing: 2px;
    color: var(--text, #cfeefb);
    margin: 8px 0 0;
    opacity: 0.85;
    text-transform: uppercase;
}
#levelupCards {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: min(760px, 94vw);
}
.levelup-card {
    position: relative;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: clamp(150px, 22vw, 200px);
    min-height: 196px;
    padding: 22px 16px;
    background: transparent;
    color: var(--text, #e8f6ff);
    cursor: pointer;
    font-family: 'Share Tech Mono', monospace;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .levelup-card::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: rgba(255,225,80,0.45);
        clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
        transition: background 0.12s ease;
    }
    .levelup-card::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: rgba(8,12,20,0.92);
        clip-path: polygon(0 0, calc(100% - 13.41px) 0, 100% 13.41px, 100% 100%, 13.41px 100%, 0 calc(100% - 13.41px));
    }
.levelup-card:hover::before { background: #00e5ff; }
.levelup-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 0 22px rgba(0,229,255,0.45), inset 0 0 18px rgba(0,229,255,0.12);
}
.lc-icon { font-size: 40px; line-height: 1; filter: drop-shadow(0 0 8px rgba(255,225,80,0.6)); }
.lc-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    letter-spacing: 0.05em;
    color: #ffe14d;
    text-align: center;
    line-height: 1.5;
}
.lc-desc {
    font-size: 12px;
    line-height: 1.45;
    text-align: center;
    opacity: 0.82;
}
/* While a pick is in flight (sent, awaiting the server) gray + block the cards. */
#levelupCards.picking { pointer-events: none; opacity: 0.5; }
.levelup-card:disabled { cursor: default; }

/* FRIEND POPUP — floats above the debug panel */
#friendPopup {
    position: fixed;
    bottom: 610px; /* above panel (540) + tabs (~30) + toggle (~30) + gap */
    right: 0;
    width: 240px;
    background: rgba(5, 5, 5, 0.97);
    border: 1px solid var(--accent);
    border-right: none;
    padding: 12px 14px;
    z-index: 200;
    display: none;
}

    #friendPopup.show {
        display: block;
    }

.fp-name {
    color: var(--accent);
    font-size: 13px;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.fp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.fp-btn {
    padding: 5px 9px;
    border: 1px solid #444;
    background: none;
    color: #ccc;
    cursor: pointer;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.15s;
}

    .fp-btn:hover:not(:disabled) {
        border-color: var(--accent);
        color: var(--accent);
    }

    .fp-btn:disabled {
        opacity: 0.38;
        cursor: not-allowed;
    }

.fp-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: var(--dim);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
}

    .fp-close:hover {
        color: var(--danger);
    }

/* ── Network tab new layout ── */
.net-section {
    margin-bottom: 4px;
}

.net-divider {
    color: var(--dim);
    font-size: 10px;
    letter-spacing: 2px;
    margin: 10px 0 5px;
    padding-top: 7px;
    border-top: 1px solid #1a1a1a;
}

.net-player-list {
    max-height: 180px;
    overflow-y: auto;
}

.net-player-row {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 3px 0;
    font-size: 11px;
    color: #aaa;
    border-bottom: 1px solid #111;
}

    .net-player-row.me {
        color: var(--accent);
    }

.np-rank {
    width: 18px;
    color: var(--dim);
    flex-shrink: 0;
}

.np-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-pct {
    color: var(--dim);
    font-size: 10px;
    flex-shrink: 0;
}

/* Protocol / platform / server-ping readouts: neutral grey, not accent cyan.
   Light grey in the dark theme, dark grey in the light theme. Quality warnings
   (slow ping, perf tier) still override these via their own inline colors. */
.net-proto,
.net-plat, .net-plat span,
.net-ping,
.net-status {
    color: #cfcfcf !important;
}

body.theme-light .net-proto,
body.theme-light .net-plat, body.theme-light .net-plat span,
body.theme-light .net-ping,
body.theme-light .net-status {
    color: hsl(var(--hue-inv), 18%, 30%) !important;
}

/* ── Friend list new layout ── */
.f-dot {
    font-size: 10px;
    color: #333;
    margin-right: 5px;
    flex-shrink: 0;
}

    .f-dot.online {
        color: #00c853;
    }

.f-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friends-scroll {
    max-height: 130px;
    overflow-y: auto;
}

.friend-row {
    cursor: pointer;
    border-radius: 2px;
    padding: 3px 2px;
}

    .friend-row.selected {
        background: #0a1a1a;
    }

/* ── Leaderboard full format ── */
.lb-header {
    display: flex;
    font-size: 10px;
    color: var(--dim);
    letter-spacing: 1px;
    padding: 4px 0 6px;
    border-bottom: 1px solid #222;
    margin-bottom: 4px;
}

.lb-full-row {
    display: flex;
    align-items: center;
    padding: 3px 0;
    font-size: 11px;
    color: #aaa;
    border-bottom: 1px solid #111;
}

    .lb-full-row.me {
        color: var(--accent);
    }

.lbh-rank {
    width: 20px;
    flex-shrink: 0;
}

.lbh-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lbh-kills {
    width: 36px;
    text-align: right;
    flex-shrink: 0;
    color: var(--dim);
}

.lbh-pct {
    width: 46px;
    text-align: right;
    flex-shrink: 0;
}

.store-empty {
    grid-column: 1/-1;
    text-align: center;
    color: #2a2a2a;
    font-size: 13px;
    padding: 60px 0;
    letter-spacing: 1px;
    line-height: 2;
}

/* Guest stand-in for the STORE / ITEMS tool-tab panes — register prompt. */
.guest-tab-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 18px;
    text-align: center;
}
.guest-tab-gate .gtg-msg {
    color: var(--dim);
    font-size: 12px;
    letter-spacing: 1px;
    line-height: 1.7;
    max-width: 240px;
}
.guest-tab-gate .gtg-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 12px 18px;
    color: #ff4081;
    background: transparent;
    border: 1px solid #ff4081;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.guest-tab-gate .gtg-btn:hover {
    color: #fff;
    box-shadow: inset 0 0 0 1px #ff4081, 0 0 12px rgba(255, 64, 129, 0.45);
}

/* ── Store item cards ── */
/* Converted from the background-origin (content-box) trick to layered pseudos so the
   diagonal stroke == the 1px straight border (the single-clip content-box variant sheared
   the diagonal wider than 1px). ::before = border colour (chamfer N=10), ::after = fill
   (inset 1px, chamfer M = N-0.59 = 9.41). Both sit behind the in-flow card content. */
.store-card {
    position: relative;
    z-index: 0;
    background: transparent;
    border: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    min-height: 160px;
    transition: box-shadow 0.15s;
    cursor: pointer;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

    .store-card::before {  /* border layer (chamfered) */
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        pointer-events: none;
        background: #1e2430;
        clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
        transition: background 0.15s;
    }

    .store-card::after {   /* fill layer, inset 1px → 1px chamfered frame shows */
        content: "";
        position: absolute;
        inset: 1px;
        z-index: -1;
        pointer-events: none;
        background: #0d1117;
        clip-path: polygon(0 0, calc(100% - 9.41px) 0, 100% 9.41px, 100% 100%, 9.41px 100%, 0 calc(100% - 9.41px));
    }

    .store-card:hover::before {
        background: var(--accent-border);
    }
    .store-card:hover {
        box-shadow: 0 0 14px var(--accent-glow);
    }

    .store-card.owned::before {
        background: color-mix(in srgb, var(--accent) 18%, transparent);
    }

.store-preview-box {
    background: #060a0f;
    width: 100%;
    height: 90px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    box-sizing: border-box;
    overflow: hidden;
}

    .store-preview-box svg {
        width: 100%;
        height: 100%;
    }

.si-name {
    font-size: 11px;
    color: #ccc;
    letter-spacing: 1px;
    padding: 7px 8px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.si-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 8px;
    gap: 4px;
    margin-top: auto;
}

.si-price {
    font-size: 10px;
    letter-spacing: 0.5px;
}

    .si-price.shards {
        color: #a78bfa;   /* purple */
    }

    .si-price.credits {
        color: #00e5ff;   /* cyan */
    }

    .si-price.free {
        color: #00c853;
    }

    .si-price.usd {
        color: #00c853;
        font-size: 12px;
        font-weight: bold;
    }

    .si-price.daily {
        color: #ff9900;
        font-size: 9px;
    }

.si-buy {
    background: none;
    border: 1px solid #2a2a2a;
    color: #888;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    padding: 3px 8px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.15s;
    flex-shrink: 0;
}

    .si-buy:hover {
        border-color: #00e5ff;
        color: #00e5ff;
    }

.si-tag-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.si-tag {
    font-size: 8px;
    letter-spacing: 1px;
    color: #ffd700;
    background: #ffd70015;
    border: 1px solid #ffd70033;
    padding: 1px 5px;
    display: block;
    text-align: center;
}

/* ── In-panel store / items layout ── */
#toolTab.store-mode {
    width: 680px;
}

#toolTab.items-mode {
    width: 600px;
}

/* ── MY LOADOUT panel — separate panel glued to the left of the items-mode tool tab ── */
#loadoutPanel {
    /* Child of #toolTab — right: 100% glues it to toolTab's left edge, zero drift */
    position: absolute;
    top: 0;
    right: 100%;
    width: 190px;
    background: rgba(5, 5, 5, 0.9);
    border: 1px solid var(--border);
    border-right: none;
    z-index: 98;
    display: none;
    flex-direction: column;
}

    #loadoutPanel.show {
        display: flex;
    }

.lp-title {
    padding: 9px 10px 8px;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: #888;
    letter-spacing: 2px;
    text-align: center;
    background: #080808;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.lp-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

    .lp-list::-webkit-scrollbar {
        width: 4px;
    }

    .lp-list::-webkit-scrollbar-track {
        background: #060606;
    }

    .lp-list::-webkit-scrollbar-thumb {
        background: #222;
        border-radius: 2px;
    }

.lp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    cursor: pointer;
    border-bottom: 1px solid #111;
    transition: background 0.12s;
}

    .lp-row:hover {
        background: #0f0f0f;
    }

    .lp-row.active {
        background: var(--accent-glow);
    }

        .lp-row.active .lp-slot {
            color: var(--accent);
        }

        .lp-row.active .lp-name {
            color: #e0e0e0;
        }

.lp-svg {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    background: #0a0f14;
    border: 1px solid #1a1a1a;
}

    .lp-svg svg {
        width: 100%;
        height: 100%;
        display: block;
    }

.lp-info {
    flex: 1;
    min-width: 0;
}

.lp-slot {
    font-size: 7px;
    color: #444;
    letter-spacing: 1.5px;
}

.lp-name {
    font-size: 11px;
    color: #aaa;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#toolTab:is(.store-mode,.items-mode) #toolBody {
    padding: 0;
    overflow: hidden;
}

#toolTab:is(.store-mode,.items-mode) .dtab-pane.active {
    height: 540px;
    display: flex;
    flex-direction: column;
}

.store-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* Left column: category boxes */
.store-cat-col {
    width: 120px;
    flex-shrink: 0;
    border-right: 1px solid #1a1a1a;
    overflow-y: auto;
    padding: 8px 8px 80px;
    background: #060606;
}

.store-cat-box {
    display: block;
    position: relative;
    z-index: 0;
    width: 100%;
    background: transparent;
    border: none;
    color: #555;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 10px 10px;
    cursor: pointer;
    text-align: center;
    transition: color 0.15s;
    clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .store-cat-box::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: #222;
        clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
        transition: background 0.15s;
    }
    .store-cat-box::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: #0d0d0d;
        clip-path: polygon(0 0, calc(100% - 5.41px) 0, 100% 5.41px, 100% 100%, 5.41px 100%, 0 calc(100% - 5.41px));
        transition: background 0.15s;
    }

    .store-cat-box:hover:not(.active) { color: #aaa; }
    .store-cat-box:hover:not(.active)::before { background: #333; }
    .store-cat-box:hover:not(.active)::after { background: #141414; }

    .store-cat-box.active { color: var(--accent); }
    .store-cat-box.active::before { background: var(--accent-border); }
    .store-cat-box.active::after { background: var(--accent-glow); }

.store-cat-divider {
    height: 1px;
    background: #1a1a1a;
    margin: 4px 0;
}

/* Labeled section separator in the category sidebar (COSMETICS / PERKS).
   Centered caption with a hairline rule on each side. */
.store-cat-section {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 2px 6px;
    color: #5a5a5a;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    letter-spacing: 1px;
    white-space: nowrap;
}
.store-cat-section::before,
.store-cat-section::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #222;
}
body.theme-light .store-cat-section {
    color: hsl(var(--hue-inv), 30%, 42%);
}
body.theme-light .store-cat-section::before,
body.theme-light .store-cat-section::after {
    background: hsla(var(--hue-inv), 28%, 55%, 0.32);
}

/* Right column */
.store-content-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.store-rarity-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px 10px;
    border-bottom: 1px solid #1a1a1a;
    flex-shrink: 0;
}

.srarity-btn {
    background: none;
    border: 1px solid transparent;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    padding: 4px 9px;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--dim);
}

    .srarity-btn:hover {
        border-color: currentColor;
        opacity: 0.8;
    }

    .srarity-btn.active {
        border-color: currentColor;
    }

/* Single scroll container owning both the featured hero and the grid below it. */
.store-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;   /* clip the ring's spilling side cards (no h-scrollbar) */
    padding-bottom: 80px;
    /* The carousel↔grid snap is driven by a JS wheel/scroll handler now
       (_attachStoreSnap): one tick decisively crosses the whole carousel gap,
       while the grid scrolls freely below its head. CSS scroll-snap was too soft
       to cross the tall gap in a single tick, so it is intentionally not used. */
}

.store-item-grid {
    padding: 12px 12px 4px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    align-content: start;
}

/* ── Featured carousel hero ── */
.store-featured {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 22px 26px 8px;   /* tight gap from GET to the separator below */
}

/* Stage = the swipe arena: a centered viewport flanked by the two edge arrows. */
.sf-stage {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Viewport clips the strip so neighbors only show as they're dragged in. */
.sf-viewport {
    position: relative;
    flex: 0 0 auto;
    width: 230px;
    max-width: 60%;
    overflow: hidden;
    /* Let vertical drags scroll the store; we own the horizontal axis. */
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

/* The strip carries the current card (in flow) with prev/next flanking it. */
.sf-strip {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    will-change: transform;
    transition: transform 0.2s ease-out;
}

/* While a finger/mouse is down the strip tracks 1:1 with no easing. */
.store-featured.sf-dragging .sf-strip {
    transition: none;
}

.store-featured.sf-dragging .sf-viewport {
    cursor: grabbing;
}

.sf-slot {
    width: 100%;
}

/* Current card sits above the neighbors and defines the strip's height. */
.sf-slot-cur {
    position: relative;
    z-index: 1;
}

/* Neighbors flank the current card, hidden until a drag reveals them. */
.sf-slot-prev,
.sf-slot-next {
    position: absolute;
    top: 0;
    z-index: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sf-slot-prev { right: 100%; margin-right: 16px; }
.sf-slot-next { left: 100%; margin-left: 16px; }

.store-featured.sf-dragging .sf-slot-prev,
.store-featured.sf-dragging .sf-slot-next,
.store-featured.sf-snapping .sf-slot-prev,
.store-featured.sf-snapping .sf-slot-next {
    opacity: 0.4;
}

/* Both arrows: dropped below centre (just above the card's base), stage edges. */
.sf-arrow {
    position: absolute;
    top: 80%;
    transform: translateY(-50%);
    z-index: 3;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    color: #888;
    font-family: 'Share Tech Mono', monospace;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s, box-shadow 0.15s;
    clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}
    /* hollow chamfer outline via pseudos so the diagonal stroke == the 1px straight edge */
    .sf-arrow::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: #1e2430;
        clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
        transition: background 0.15s;
    }
    .sf-arrow::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: #050505;
        clip-path: polygon(0 0, calc(100% - 5.41px) 0, 100% 5.41px, 100% 100%, 5.41px 100%, 0 calc(100% - 5.41px));
    }

.sf-prev { left: 0; }
.sf-next { right: 0; }

    .sf-arrow:hover:not(:disabled) {
        color: var(--accent);
        box-shadow: 0 0 10px var(--accent-glow);
    }
    .sf-arrow:hover:not(:disabled)::before { background: var(--accent-border); }

    .sf-arrow:disabled {
        opacity: 0.2;
        cursor: default;
    }

/* UA default <button> borders shear on the chamfer; the visible border rides the
   ::before/::after pseudos, so kill the UA border on converted chamfer buttons. */
.cfeat, .cpop-store-btn, .cpop-gcta-btn, .region-trigger, .ilt-slot { border: none; }

/* ── TR2-style turntable ring (browse mode) ─────────────────────────────────
   All featured cards live on a horizontal ring seen from ~35° above. JS places
   each card by its angle around the ring (translate3d + scale), so the active
   card is front/large and the ring recedes back where the far card is small. */
.sf-ring-viewport {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    height: 410px;              /* room for the front→back vertical spread */
    /* The ring is lifted up, so its content ends above the box bottom — pull the
       counter/GET up into that empty space instead of leaving a big gap. */
    margin-bottom: -40px;
    perspective: 1500px;
    overflow: visible;
    /* Vertical drags scroll the store; we own the horizontal (spin) axis. */
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.sf-ring {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;   /* per-card translateZ scales via perspective */
    cursor: grab;
}

    .sf-ring.sf-spinning { cursor: grabbing; }

/* Each card is centred at the ring's origin; JS layers on the turntable transform. */
.sf-ring-card {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 190px;
    backface-visibility: hidden;
    transition: transform 0.7s cubic-bezier(0.33, 1, 0.68, 1),
                opacity 0.7s ease, filter 0.42s ease;
}

    /* Shorter preview on the ring so the whole front→back circle fits the stage.
       Three classes to outrank the later `.sf-card .sf-preview` (220px) rule. */
    .sf-ring-card .sf-card .sf-preview { min-height: 150px; }

    /* During a drag-spin the ring tracks 1:1 with no easing. */
    .sf-ring.sf-spinning .sf-ring-card { transition: none; }

    /* Side cards invite a click-to-front; the active one is the "selected" one. */
    .sf-ring-card .sf-card { cursor: pointer; }

    .sf-ring-card.sf-ring-active .sf-card {
        cursor: default;
        box-shadow: 0 0 22px var(--accent-glow);
    }

    /* Unselected cards are fully greyscale; only the active one shows colour.
       The rarity band is the card's border-top, so desaturating the card's
       *children* (not the card itself) leaves that band coloured on every card. */
    .sf-ring-card .sf-card > * { filter: saturate(0); transition: filter 0.42s ease; }
    .sf-ring-card.sf-ring-active .sf-card > * { filter: none; }
    /* …but the rarity tag stays in colour on every card (it's the persistent
       rarity cue now, like the old border band). */
    .sf-ring-card .sf-card > .sf-rar-tag { filter: none !important; }

/* Rarity header — a coloured banner at the top-left of a featured card with a 45°
   cut on its right end, labelling the rarity class. --rar is the rarity colour. */
.sf-rar-tag {
    align-self: flex-start;
    width: fit-content;
    margin: 0 0 2px;
    padding: 4px 18px 4px 11px;          /* extra right padding for the diagonal */
    background: var(--rar, #888);
    color: #07080c;
    font-family: 'Share Tech Mono', monospace;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 2px;
    line-height: 1;
    clip-path: polygon(0 0, 100% 0, calc(100% - 13px) 100%, 0 100%);   /* 45° cut, right edge */
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);
    position: relative;
    z-index: 2;
}

/* ALL-view grid rarity band divider — the same angled colour tag as the carousel
   card header (.sf-rar-tag), spanning the grid row with a fading hairline. */
.store-rar-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 2px 2px;
}
.store-rar-divider:first-child { margin-top: 2px; }
.store-rar-tag {
    flex-shrink: 0;
    background: var(--rar, #888);
    color: #07080c;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    line-height: 1;
    padding: 4px 18px 4px 11px;
    clip-path: polygon(0 0, 100% 0, calc(100% - 13px) 100%, 0 100%);   /* 45° cut, right edge */
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);
}
.store-rar-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--rar, #888), transparent);
    opacity: 0.45;
}

/* Portrait showcase card — taller than wide. Scoped with .store-card to outrank
   later single-class rules in media queries. */
.store-card.sf-card {
    width: 100%;
    flex-direction: column;
    min-height: 0;
    cursor: default;
}

.sf-card .sf-preview {
    width: 100%;
    height: auto;
    flex: 1 1 auto;
    min-height: 220px;
}

.sf-card .sf-meta {
    display: flex;
    flex-direction: column;
    padding: 12px 14px 6px;
    min-width: 0;
}

.sf-name {
    font-size: 16px;
    padding: 0 0 4px;
    white-space: normal;
}

/* De-emphasised relative to the price (D). */
.sf-rarity {
    font-size: 10px;
    letter-spacing: 2px;
    opacity: 0.8;
}

/* Price = the visual hero, at the bottom of the card. */
.sf-price-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px 14px;
    border-top: 1px solid #ffffff0d;
}

    .sf-price-bar .si-price {
        font-size: 24px;
        font-weight: bold;
        letter-spacing: 0.5px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        text-shadow: 0 0 14px currentColor;
    }

    .sf-price-bar .si-tag {
        font-size: 9px;
        align-self: center;
    }

.sf-cur-icon {
    width: 22px;
    height: 22px;
    vertical-align: middle;
}

/* Actions sit centered below the stage: GET while browsing, PURCHASE in preview. */
.sf-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    /* Reserve the GET button's height even when empty (owned card), so the
       separator stays a constant distance from the counter either way. */
    height: 36px;
}

    .sf-actions .si-buy {
        font-size: 13px;
        padding: 9px 22px;
    }

/* Secondary BACK shown under GET in browse (E) — inert until preview mode. */
.sf-back {
    background: none;
    border: 1px solid #2a2a2a;
    color: #888;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    padding: 8px 18px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.15s;
}

    .sf-back:disabled {
        opacity: 0.3;
        cursor: default;
    }

/* Red cancel-preview BACK, to the left of the card (F). Mirrors the pink/red
   custom-button palette used elsewhere (--accent-pink / #ff4081). */
.sf-back-left {
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(255, 64, 129, 0.3);
    border-color: #ff4081;
    color: #fff;
}

    .sf-back-left:hover {
        background: rgba(255, 64, 129, 0.75);
    }

/* In preview mode the arrows are hidden — you can't navigate mid-preview. */
.store-featured.previewing .sf-arrow {
    visibility: hidden;
}

/* Live sim preview canvas fills the preview box (CSS tilt applied inline by JS). */
.sf-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Centered position counter under the card, before the spacer (B). */
.sf-counter {
    text-align: center;
    font-size: 11px;
    letter-spacing: 2px;
    color: #667;
    padding: 10px 0 4px;   /* clear the active card above */
}

/* Clear divider between the showcase zone and the item grid (C). */
.sf-divider {
    height: 1px;
    margin: 4px 18px 18px;
    background: linear-gradient(90deg, transparent, #ffffff1a, transparent);
}

/* ── Transient toasts (guest denial, etc.) ── */
#toastHost {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    position: relative;
    z-index: 0;
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.5px;
    padding: 10px 18px;
    color: #fff;
    background: transparent;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .toast::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: #2a2a2a;
        clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    }
    .toast::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: rgba(20, 20, 28, 0.95);
        clip-path: polygon(0 0, calc(100% - 7.41px) 0, 100% 7.41px, 100% 100%, 7.41px 100%, 0 calc(100% - 7.41px));
    }

    .toast.show {
        opacity: 1;
        transform: translateY(0);
    }

    .toast.deny::before { background: #ff4081; }
    .toast.deny::after  { background: rgba(255, 64, 129, 0.92); }
    .toast.deny {
        box-shadow: 0 0 16px rgba(255, 64, 129, 0.4);
    }

/* ── Credits premium cards ── (border colour now rides ::before; fill unchanged on ::after) */
.store-card.premium::before {
    background: #ffd70033;
}

    .store-card.premium:hover::before {
        background: #ffd70066;
    }
    .store-card.premium:hover {
        box-shadow: 0 0 12px rgba(255,215,0,0.08);
    }

.store-grid-divider {
    grid-column: 1 / -1;
    border-top: 1px solid #ffd70033;
    color: #ffd700;
    font-size: 9px;
    letter-spacing: 3px;
    padding: 10px 0 4px;
    margin-top: 6px;
}

.store-grid-spacer {
    grid-column: 1 / -1;
    height: 60px;
}

/* ── Dark scrollbars ── */
.store-cat-col::-webkit-scrollbar,
.store-item-grid::-webkit-scrollbar,
.store-scroll::-webkit-scrollbar,
.store-content-col::-webkit-scrollbar,
.loadout-mini-list::-webkit-scrollbar {
    width: 4px;
}

.store-cat-col::-webkit-scrollbar-track,
.store-item-grid::-webkit-scrollbar-track,
.store-scroll::-webkit-scrollbar-track,
.store-content-col::-webkit-scrollbar-track,
.loadout-mini-list::-webkit-scrollbar-track {
    background: #060606;
}

.store-cat-col::-webkit-scrollbar-thumb,
.store-item-grid::-webkit-scrollbar-thumb,
.store-scroll::-webkit-scrollbar-thumb,
.store-content-col::-webkit-scrollbar-thumb,
.loadout-mini-list::-webkit-scrollbar-thumb {
    background: #222;
    border-radius: 2px;
}

    .store-cat-col::-webkit-scrollbar-thumb:hover,
    .store-item-grid::-webkit-scrollbar-thumb:hover,
    .store-scroll::-webkit-scrollbar-thumb:hover,
    .store-content-col::-webkit-scrollbar-thumb:hover {
        background: #333;
    }

/* ── Items tab loadout miniatures ── */
.loadout-section-label {
    font-size: 8px;
    color: #444;
    letter-spacing: 2px;
    padding: 2px 4px 6px;
}

.loadout-mini-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.loadout-mini-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px;
    border: 1px solid #1a1a1a;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

    .loadout-mini-row:hover {
        border-color: #333;
        background: #111;
    }

.loadout-mini-svg {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: #060a0f;
    border: 1px solid #111;
}

    .loadout-mini-svg svg {
        width: 100%;
        height: 100%;
    }

.loadout-mini-slot {
    font-size: 7px;
    color: #444;
    letter-spacing: 1px;
    line-height: 1.2;
}

.loadout-mini-name {
    font-size: 9px;
    color: #888;
    line-height: 1.3;
}

.store-card.equipped::before {
    background: var(--accent-border) !important;
}
.store-card.equipped::after {
    background: var(--accent-glow) !important;
}

/* Card selected state — click to highlight & reveal EQUIP */
.store-card.selected::before {
    background: var(--accent) !important;
}
.store-card.selected::after {
    background: color-mix(in srgb, var(--accent) 4%, #0d1117) !important;
}
.store-card.selected {
    box-shadow: 0 0 18px var(--accent-glow);
}

.si-equip-hidden {
    display: none !important;
}

.store-card.selected .si-equip-hidden {
    display: inline-flex !important;
}

.si-equip {
    font-size: 9px !important;
    padding: 2px 6px !important;
}

/* FRIENDS section inside NETWORK tab */
.net-friends-header {
    color: var(--dim);
    font-size: 10px;
    letter-spacing: 2px;
    margin: 12px 0 6px;
    padding-top: 8px;
    border-top: 1px solid #222;
}

.net-add-row {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

    .net-add-row input {
        flex: 1;
        padding: 5px 7px;
        background: #111;
        border: 1px solid #333;
        color: #fff;
        font-family: 'Share Tech Mono', monospace;
        font-size: 11px;
        text-align: left;
        width: auto;
    }

        .net-add-row input:focus {
            border-color: var(--accent);
        }

    .net-add-row button {
        padding: 5px 10px;
        background: none;
        border: 1px solid var(--accent);
        color: var(--accent);
        cursor: pointer;
        font-family: 'Share Tech Mono', monospace;
        font-size: 10px;
        letter-spacing: 1px;
    }

        .net-add-row button:hover {
            background: var(--accent);
            color: #000;
        }

.friend-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    cursor: pointer;
    color: #ccc;
    font-size: 11px;
    border-bottom: 1px solid #111;
}

    .friend-row:hover {
        color: var(--accent);
    }

.friend-status {
    font-size: 9px;
    color: var(--dim);
    letter-spacing: 1px;
}

    .friend-status.online {
        color: #00ff88;
    }

    .friend-status.ingame {
        color: var(--accent);
    }

/* ═══════════════════════════════════════════════════════════════════
   SIGN-UP MODAL
═══════════════════════════════════════════════════════════════════ */

/* ── Sign-up modal overlay ──────────────────────────────────────── */
.su-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 5, 20, 0.92);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.su-card {
    position: relative;
    background: #161b22;
    border: 1px solid var(--accent-border);
    border-top: 2px solid var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow), 0 0 40px var(--accent-glow), 0 32px 80px rgba(0,0,0,0.95);
    width: 420px;
    max-width: 95vw;
    max-height: 92vh;
    overflow-y: auto;
    padding: 48px 40px 36px;
    box-sizing: border-box;
    font-family: 'Share Tech Mono', monospace;
    animation: suFadeIn 0.2s ease;
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}

@keyframes suFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.su-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: 1px solid #222;
    color: #555;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 8px;
    transition: color 0.15s, border-color 0.15s;
}

    .su-close:hover {
        color: #fff;
        border-color: #555;
    }

.su-logo {
    font-family: 'Press Start 2P', monospace;
    font-size: 22px;
    color: var(--accent);
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 0 0 20px var(--accent-border);
}

.su-title {
    text-align: center;
    font-size: 12px;
    color: #fff;
    letter-spacing: 3px;
    margin-bottom: 4px;
}

.su-sub {
    text-align: center;
    font-size: 10px;
    color: #444;
    margin-bottom: 28px;
    letter-spacing: 1px;
}

.su-hint {
    text-align: center;
    font-size: 11px;
    color: #555;
    line-height: 1.7;
    margin: 14px 0 28px;
}

.su-error {
    background: rgba(255,64,129,0.1);
    border-left: 3px solid #ff4081;
    color: #ff4081;
    font-size: 11px;
    padding: 10px 12px;
    margin-bottom: 16px;
}

.su-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #0d1117;
    border: 1px solid #30363d;
    color: #e6edf3;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .su-input:focus {
        border-color: #00e5ff;
        box-shadow: 0 0 0 3px rgba(0,229,255,0.1);
    }

    .su-input::placeholder {
        color: #484f58;
    }

.su-btn-primary {
    display: block;
    width: 100%;
    padding: 14px;
    background: #ff4081;
    color: #fff;
    border: none;
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    letter-spacing: 2px;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s, box-shadow 0.15s;
}

    .su-btn-primary:hover:not(:disabled) {
        background: #ff1a5e;
        box-shadow: 0 0 20px rgba(255,64,129,0.4);
    }

    .su-btn-primary:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

.su-btn-secondary {
    display: block;
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #00e5ff;
    border: 1px solid #1e1e1e;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    letter-spacing: 1px;
    cursor: pointer;
    margin-top: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .su-btn-secondary:hover {
        border-color: #00e5ff;
        box-shadow: 0 0 12px rgba(0,229,255,0.15);
    }

.su-btn-ghost {
    display: block;
    width: 100%;
    padding: 10px;
    background: none;
    color: #444;
    border: none;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    margin-top: 10px;
    transition: color 0.15s;
    text-decoration: underline;
    text-underline-offset: 3px;
}

    .su-btn-ghost:hover {
        color: #777;
    }

.su-footer {
    text-align: center;
    font-size: 11px;
    color: #333;
    margin-top: 20px;
    letter-spacing: 0.5px;
}

    .su-footer a {
        color: #00e5ff;
        text-decoration: none;
    }

        .su-footer a:hover {
            text-decoration: underline;
        }

.su-divider {
    border: none;
    border-top: 1px solid #1a1a1a;
    margin: 24px 0;
}

.su-premium-box {
    position: relative;
    z-index: 0;
    background: transparent;
    box-shadow: inset 0 0 40px rgba(255,215,0,0.03);
    padding: 24px;
    margin: 20px 0 12px;
    text-align: center;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .su-premium-box::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: #2a2000;
        clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    }
    .su-premium-box::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: #080808;
        clip-path: polygon(0 0, calc(100% - 11.41px) 0, 100% 11.41px, 100% 100%, 11.41px 100%, 0 calc(100% - 11.41px));
    }

.su-price {
    font-size: 38px;
    color: #ffd700;
    margin-bottom: 4px;
    text-shadow: 0 0 20px rgba(255,215,0,0.3);
}

    .su-price span {
        font-size: 14px;
        color: #666;
    }

.su-perks {
    list-style: none;
    padding: 0;
    margin: 16px 0 20px;
    text-align: left;
    font-size: 11px;
    color: #888;
    line-height: 1;
}

    .su-perks li {
        padding: 7px 0;
        border-bottom: 1px solid #111;
    }

        .su-perks li:last-child {
            border-bottom: none;
        }

        .su-perks li::before {
            content: "▸  ";
            color: #ffd700;
        }



/* ── Credits shortcut button — image-driven, inverted hue ── */
@keyframes rimSweep {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

#creditsShortcut {
    display: none;
    position: fixed;
    bottom: 42px;
    left: 50%;
    transform: translateX(-50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 90;
    transition: transform 0.15s ease;
    overflow: visible;
}

/* Lower spine segment — runs UP from the credits-shop (store shortcut) emblem
   toward the status, completing the spine below the gap. */
#creditsShortcut::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 100%;
    width: 3px;
    height: var(--store-spine-h, 0px); /* sized live to the status↔emblem gap (JS) */
    transform: translateX(-50%);
    background: linear-gradient(90deg, #20232a 0%, #565c66 44%, #6b717b 50%, #474c54 56%, #1e2027 100%);
    box-shadow: 0 0 7px rgba(0, 0, 0, 0.55);
    z-index: -1;
}

    #creditsShortcut.show {
        display: block;
    }

    /* The logo image — carries the inverted hue shift */
    #creditsShortcut img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        display: block;
        filter: hue-rotate(calc((var(--hue-inv, 5) - 185) * 1deg)) brightness(1.05);
        transition: filter 0.6s ease, transform 0.15s ease;
        pointer-events: none;
    }

    #creditsShortcut:hover {
        transform: translateX(-50%) scale(1.10);
    }

    #creditsShortcut:hover img {
        filter: hue-rotate(calc((var(--hue-inv, 5) - 185) * 1deg)) brightness(1.18);
    }

    #creditsShortcut:active {
        transform: translateX(-50%) scale(0.95);
    }

    /* Metallic rim sweep — rotates a bright glint around the edge on hover */
    #creditsShortcut::after {
        content: '';
        position: absolute;
        inset: -3px;
        border-radius: 50%;
        /* Conic gradient: one sharp bright arc, rest transparent */
        background: conic-gradient(
            from 0deg,
            transparent 0deg,
            transparent 248deg,
            rgba(120, 210, 255, 0.25) 268deg,
            rgba(220, 245, 255, 0.90) 288deg,
            rgba(255, 255, 255, 0.97) 298deg,
            rgba(220, 245, 255, 0.90) 308deg,
            rgba(120, 210, 255, 0.25) 328deg,
            transparent 348deg,
            transparent 360deg
        );
        /* Mask reveals only the outermost rim ring */
        -webkit-mask: radial-gradient(circle at center,
            transparent 88%,
            black       91%,
            black       97%,
            transparent 100%);
        mask: radial-gradient(circle at center,
            transparent 88%,
            black       91%,
            black       97%,
            transparent 100%);
        opacity: 0;
        transition: opacity 0.25s ease;
        animation: rimSweep 1.6s linear infinite;
        animation-play-state: paused;
        pointer-events: none;
        z-index: 1;
    }

    #creditsShortcut:hover::after {
        opacity: 1;
        animation-play-state: running;
    }

/* ── Slim leaderboard header (portrait mobile only) ── */
.slb-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px 4px;
    border-left: 2px solid transparent;   /* match .lb-row's 2px indicator border so columns line up */
    background: rgba(0, 229, 255, 0.07);
    border-bottom: 1px solid rgba(0, 229, 255, 0.2);
    color: var(--accent);
    font-size: 8px;
    letter-spacing: 2px;
}

/* Joystick overlay canvas */
#joyCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 250;
    pointer-events: none;
    display: none;
}

    #joyCanvas.show {
        display: block;
    }

/* ── Perk slots (P3) — activatable abilities, bottom-centre ─────────────────── */
/* Centred horizontally above the toast zone (#toastHost sits at bottom:32px); the
   level-up cards render at screen centre (#levelupModal inset:0), so the dock has
   the bottom band to itself. */
#perkSlots {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 104px;
    z-index: 251;
    display: none;
    flex-direction: row;
    gap: 12px;
}

    #perkSlots.show {
        display: flex;
    }

.perk-slot {
    position: relative;
    width: 58px;
    height: 58px;
    padding: 0;
    background: rgba(6, 10, 14, 0.66);
    border: 1.5px solid var(--accent-border, rgba(0, 229, 255, 0.45));
    color: #e6faff;
    font-family: 'Share Tech Mono', monospace;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
    /* Instant taps, no double-tap page zoom on the button itself. */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

    .perk-slot .ps-icon {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 26px;
        line-height: 1;
    }

    /* Cooldown sweep: a clockwise wedge that shrinks as the ability comes back.
       --cd is the fraction of cooldown remaining (1 → 0), set per frame. */
    .perk-slot .ps-cd {
        position: absolute;
        inset: 0;
        background: conic-gradient(rgba(2, 6, 10, 0.72) calc(var(--cd, 0) * 360deg), transparent 0);
        pointer-events: none;
    }

    /* Precision-mode fuel gauge: a cyan column rising from the slot floor. JS sets
       --fuel (0–1 fill) on the element and toggles [hidden] when the ability is
       locked; the brighter "engaged" tint rides the .boosting class the slot
       already gets while precision is active (see updatePerkSlots). */
    .perk-slot .ps-fuel {
        position: absolute;
        left: 0;
        bottom: 0;
        width: 100%;
        height: calc(var(--fuel, 0) * 100%);
        background: linear-gradient(to top, rgba(0, 229, 255, 0.9), rgba(0, 229, 255, 0.25));
        opacity: 0.45;
        pointer-events: none;
        border-radius: inherit;
        transition: height 0.1s linear;
    }

        .perk-slot.boosting .ps-fuel {
            opacity: 0.8;
        }

    /* Desktop keycap hint (hidden on touch builds — see body.touch-input). */
    .perk-slot .ps-key {
        position: absolute;
        right: 3px;
        bottom: 2px;
        font-size: 10px;
        color: var(--accent, #00e5ff);
        opacity: 0.85;
        pointer-events: none;
    }

    .perk-slot.locked {
        opacity: 0.32;
        border-color: rgba(120, 140, 150, 0.35);
        cursor: default;
    }

        .perk-slot.locked .ps-key {
            color: #889;
        }

    /* Reserved empty slot — a dim placeholder for perks to come. */
    .perk-slot.empty {
        opacity: 0.22;
        border-style: dashed;
    }

    .perk-slot.cooling {
        cursor: default;
    }

    /* Active burst window — brief glow so the player sees the ability fired. */
    .perk-slot.boosting {
        border-color: #ffb347;
        box-shadow: 0 0 14px rgba(255, 160, 60, 0.8), inset 0 0 12px rgba(255, 160, 60, 0.35);
    }

    .perk-slot:not(.locked):not(.cooling):not(.boosting):hover {
        border-color: var(--accent, #00e5ff);
        box-shadow: 0 0 12px var(--accent-glow, rgba(0, 229, 255, 0.5));
    }

/* Touch builds: drop the desktop keycap hints. */
body.touch-input .perk-slot .ps-key {
    display: none;
}

/* Lobby push-up transition (used on mobile panel open) */
#lobby {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Items loadout topbar (mobile only — hidden on desktop) ── */
.items-loadout-topbar {
    display: none; /* shown only in mobile media query */
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding: 6px 8px;
    border-bottom: 1px solid #1a1a1a;
    background: #060606;
    flex-shrink: 0;
}

.ilt-slot {
    position: relative;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 4px 6px;
    background: transparent;
    transition: border-color 0.15s;
    min-width: 52px;
    clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .ilt-slot::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: #1a1a1a;
        clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
    }
    .ilt-slot::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: #0d0d0d;
        clip-path: polygon(0 0, calc(100% - 5.41px) 0, 100% 5.41px, 100% 100%, 5.41px 100%, 0 calc(100% - 5.41px));
    }

    .ilt-slot.active::before { background: var(--accent); }
    .ilt-slot.active::after  { background: var(--accent-glow); }

    .ilt-slot:hover:not(.active)::before { background: #333; }

.ilt-svg {
    width: 36px;
    height: 36px;
}

    .ilt-svg svg {
        width: 100%;
        height: 100%;
    }

.ilt-label {
    font-size: 7px;
    color: #444;
    letter-spacing: 1px;
    text-align: center;
    white-space: nowrap;
}

.ilt-slot.active .ilt-label {
    color: var(--accent);
}

/* ════════════════════════════════════════════════════════════════════
   MOBILE PORTRAIT  ≤ 600px
   Portrait-only — landscape handled separately.
    ════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) and (orientation: portrait) {

    /* ── Minimap: top-right, 2× bigger than before ── */
    #minimapCanvas {
        width: 200px;
        height: 200px;
        top: 8px;
        right: 8px;
        left: auto;
        bottom: auto;
    }
    /* Only resize icons in the CREDITS tab */
    #toolTab.store-mode .store-preview-box {
        height: 120px; /* Smaller preview icons */

        padding: 3px;
    }

    #toolTab.store-mode .store-card {
        min-height: 200px; /* Slightly more compact cards */
        min-width: 50px;
    }


    /* ── Leaderboard: top-left, styled box ── */
    #slimLeaderboard {
        top: 8px;
        left: 8px;
        right: auto;
        width: 148px;
        font-size: 10px;
        line-height: 1.4;
        background: rgba(5, 5, 5, 0.68);
        border: 1px solid rgba(0, 229, 255, 0.18);
        border-radius: 3px;
        overflow: hidden;
    }

    .slb-header {
        display: flex;
    }

    .lb-row {
        padding: 2px 8px;
        font-size: 10px;
        background: rgba(5, 5, 5, 0.35);
    }

        .lb-row .lb-name {
            max-width: 90px;
        }

    /* Subtab strip stays visible (pick a subtab before opening) */

    /* ── Game canvas: use full portrait width ── */
    /* === Mobile override (portrait) === */
    @media (max-width: 600px) {
        #gameCanvas {
            box-shadow: none;
            border: none;
        }
    }

    /* ── Debug panel: full-width bottom sheet (header always docked) ── */
    #toolTab {
        width: 100vw;
        right: 0;
        left: 0;
        border-left: none;
    }

        /* expand modes also full width */
        #toolTab.store-mode,
        #toolTab.items-mode {
            width: 100vw;
        }

    /* body height inside the open sheet */
    #toolTab.open #toolBody {
        max-height: calc(60vh - 8px);
    }

    /* store/items pane height */
    #toolTab:is(.store-mode,.items-mode) .dtab-pane.active {
        height: calc(60vh - 64px);
    }

    @media (max-width: 600px) {

        /* ── Tab bar: bigger tap targets ── */
        .dtab {
            padding: 10px 4px;
            font-size: 0.6rem;
        }

        /* ── Store grid: 2 columns ── */
        .store-item-grid {
            grid-template-columns: repeat(2, 1fr);
            padding: 8px;
            gap: 8px;
        }

        /* ── Cat nav: bigger text + tap area ── */
        .store-cat-col {
            width: 88px;
        }

        .store-cat-box {
            font-size: 11px;
            padding: 12px 6px;
            letter-spacing: 0;
            min-height: 44px;
        }

        /* ── Rarity filter row: horizontal scroll, no wrap ── */
        .store-rarity-row {
            padding: 8px;
            gap: 4px;
            flex-wrap: nowrap;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }

            .store-rarity-row::-webkit-scrollbar {
                display: none;
            }

        .srarity-btn {
            font-size: 11px;
            padding: 8px 10px;
            letter-spacing: 0;
            min-height: 36px;
            flex-shrink: 0;
        }

        /* ── Store card: bigger preview ── */
        .store-preview-box {
            height: 90px;
        }

        .store-card {
            min-height: 180px;
        }

        .si-name {
            font-size: 12px;
            padding: 8px 8px 4px;
        }

        /* ── Items: show mobile topbar, hide PC loadout panel ── */
        .items-loadout-topbar {
            display: flex;
        }

        #loadoutPanel {
            display: none !important;
        }

        #toolTab.items-mode .dtab-pane.active {
            height: calc(60vh - 64px);
        }

        /* ── Credits shortcut: lower in browser mode so it clears UI ── */
        body.web-browser #creditsShortcut {
            bottom: 32px; /* was 136px − 2× own height (104px) */
        }

        /* ── Push lobby up when tool panel opens ── */
        body.panel-open #lobby {
            transform: translateY(-10vh);
        }

        /* ── Death screen: scale down ── */
        #wastedText {
            font-size: 40px;
            letter-spacing: 3px;
        }

        #deathStats {
            gap: 14px;
            font-size: 11px;
        }

        #deathScreen button {
            width: 220px;
            font-size: 16px;
            padding: 14px 20px;
        }

        /* ── Lobby: tighter spacing ── */
        #lobby h1 {
            font-size: 2.2rem;
        }

        #lobby {
            padding: 16px;
        }

        /* ── Sign-up modal fits portrait ── */
        .su-card {
            padding: 32px 20px 24px;
        }
    }

    /* ════════════════════════════════════════════════════════════════════
   MOBILE LANDSCAPE  — phones held sideways (height ≤ 500px)
    ════════════════════════════════════════════════════════════════════ */
    @media (max-height: 500px) and (orientation: landscape) {



        /* ── Minimap: small, top-right ── */
        #minimapCanvas {
            width: 120px;
            height: 120px;
            top: 6px;
            right: 8px;
            left: auto;
            bottom: auto;
        }

        /* ── Leaderboard: below minimap, right side ── */
        #slimLeaderboard {
            top: 134px;
            right: 8px;
            left: auto;
            width: 140px;
            font-size: 10px;
        }

        /* ── Debug panel: narrower, docked at bottom-right ── */
        #toolTab {
            width: 280px;
        }

            #toolTab.store-mode,
            #toolTab.items-mode {
                width: 420px;
            }

        /* Open sheet fits the short landscape height (header stays docked) */
        #toolTab.open #toolBody {
            max-height: calc(100vh - 84px);
        }

        body.web-browser #creditsShortcut {
            bottom: 32px;
        }

        /* ── Hide PC loadout panel ── */
        #loadoutPanel {
            display: none !important;
        }
    }
}


body.in-game {
    background: #000;
    background-image: none;
}

/* ═══════════════════════════════════════════════════════════════════
   CURRENCY HUD — top-right, inside gutter panel
══════════════════════════════════════════════════════════════════ */
#currencyHud {
    position: fixed;
    top: 18px;
    /* overlap the right gutter separator — same positioning as #toolTab */
    right: max(0px, calc((100vw - 1260px) / 2));
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 300;
    pointer-events: auto;
    transition: opacity 0.25s ease;
}

/* Currency HUD is main-menu only — hidden during an active session so the gameplay HUD
   owns the screen (I2). `in-game` is toggled on <body> when a session starts/ends. */
body.in-game #currencyHud { display: none; }

/* Chamfer wrapper — top-left + bottom-right corners cut (45°).
   Outer chamfer 14px, inner 8px, 1px padding: diagonal border ≈ (14-8-2)/√2 ≈ 2.8px — bold edge. */
.cur-btn-wrap {
    display: block;
    padding: 1px;
    clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
    line-height: 0;
    transition: background 0.18s;
}

.cur-wrap-credit {
    background: rgba(0,229,255,0.65);
}

    .cur-wrap-credit:hover {
        background: rgba(0,229,255,1.0);
    }

.cur-wrap-shard {
    background: rgba(255,210,50,0.65);
}

    .cur-wrap-shard:hover {
        background: rgba(255,210,50,1.0);
    }

.cur-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: 128px;
    height: 36px;
    background: rgba(10,10,15,0.92);
    border: none;
    cursor: pointer;
    gap: 8px;
    padding: 0 10px;
    font-family: 'Share Tech Mono', monospace;
    /* inner chamfer I = O - p(2+√2); O=14 (wrap), p=1px → 14-3.41 = 10.59 so the diagonal band == the 1px straight padding-border */
    clip-path: polygon(13.41px 0, 100% 0, 100% calc(100% - 13.41px), calc(100% - 13.41px) 100%, 0 100%, 0 13.41px);
    transition: background 0.18s;
}

.cur-wrap-credit:hover .cur-btn {
    background: rgba(0,229,255,0.08);
}

.cur-wrap-shard:hover .cur-btn {
    background: rgba(255,210,50,0.08);
}

.cur-icon {
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.shard-icon {
    color: #ffd232;
}

.credit-icon {
    color: #00e5ff;
}

.cur-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.cur-label {
    font-size: 6px;
    letter-spacing: 1px;
    color: #555;
    text-transform: uppercase;
    line-height: 1;
}

.cur-value {
    font-size: 12px;
    color: #ccc;
    letter-spacing: 1px;
    margin-left: auto;
}

/* ═══════════════════════════════════════════════════════════════════
   PLAYER HUD CHIP — avatar + name + level + XP
   Sits at the top of #currencyHud, hidden for guests.
══════════════════════════════════════════════════════════════════ */
#playerHudChip {
    display: none; /* shown via JS when signed in */
    align-items: center;
    gap: 8px;
    width: 128px;
    padding: 6px 8px;
    background: rgba(10,10,15,0.92);
    border: none;
    cursor: pointer;
    clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
    /* drop-shadow traces the clip-path edge uniformly — no sheared diagonal border */
    filter: drop-shadow(0 0 0.5px rgba(255,255,255,0.3));
    transition: background 0.18s, filter 0.18s;
    font-family: 'Share Tech Mono', monospace;
    margin-bottom: 2px;
}

#playerHudChip:hover {
    background: rgba(255,255,255,0.05);
    filter: drop-shadow(0 0 0.5px rgba(255,255,255,0.6));
}

#playerHudChip.show {
    display: flex;
}

.phud-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 1.5px solid rgba(255,255,255,0.12);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #555;
    object-fit: cover;
}

.phud-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.phud-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.phud-name {
    font-size: 11px;
    letter-spacing: 0.5px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 95px;
}

.phud-level-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.phud-level {
    font-size: 10px;
    color: hsl(var(--hue-inv), 75%, 60%);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.phud-xp-bar {
    height: 4px;
    background: rgba(255,255,255,0.10);
    border-radius: 3px;
    flex: 1;
    overflow: hidden;
}

.phud-xp-fill {
    height: 100%;
    background: hsl(var(--hue-inv), 75%, 55%);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Light mode */
body.theme-light #playerHudChip {
    background: hsl(0, 0%, 97%);
    border-color: hsla(var(--hue-inv), 28%, 60%, 0.30);
}

body.theme-light #playerHudChip:hover {
    background: hsl(var(--hue-inv), 30%, 93%);
}

body.theme-light .phud-name    { color: hsl(var(--hue-inv), 22%, 25%); }
body.theme-light .phud-level   { color: hsl(var(--hue-inv), 60%, 38%); }
body.theme-light .phud-avatar  { background: hsl(var(--hue-inv), 30%, 90%); border-color: hsla(var(--hue-inv), 30%, 60%, 0.28); }
body.theme-light .phud-xp-bar  { background: hsla(var(--hue-inv), 30%, 60%, 0.20); }
body.theme-light .phud-xp-fill { background: hsl(var(--hue-inv), 60%, 50%); }

/* ═══════════════════════════════════════════════════════════════════
   HUE PICKER — circular wheel in profile preferences
══════════════════════════════════════════════════════════════════ */
.hue-picker-row {
    margin-top: 6px;
}

/* Wheel + demo side by side */
.hue-wheel-layout {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 14px;
    justify-content: center;
}

.hue-wheel-wrap {
    position: relative;
    width: 164px;
    height: 164px;
    flex-shrink: 0;
    cursor: crosshair;
}

#hueWheelCanvas {
    display: block;
    border-radius: 50%;
}

/* Pawn preview lives in center of the wheel */
.pawn-preview-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border-radius: 50%;
}

/* Pawn demo wrapper — sits next to the color wheel */
.pawn-demo-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Info column: swatch + label (legacy, kept for compat) */
.hue-wheel-info {
    display: none;
}

.hue-preview-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.25);
    flex-shrink: 0;
    transition: background 0.1s;
    box-shadow: 0 0 10px rgba(0,0,0,0.4);
}

.hue-value-label {
    font-size: 10px;
    color: #888;
    letter-spacing: 1px;
    text-align: center;
}

body.theme-light .hue-value-label { color: hsl(var(--hue-inv), 22%, 48%); }
body.theme-light .hue-preview-swatch { border-color: rgba(0,0,0,0.18); }

.pm-save-hue-btn {
    margin-top: 14px;
    width: 100%;
    justify-content: center;
}

/* ── Greyed-out picker when manual toggle is off ──────────────────── */
.picker-gated {
    transition: opacity 0.25s, filter 0.25s;
}
.picker-gated.picker-disabled {
    opacity: 0.32;
    pointer-events: none;
    filter: grayscale(0.7);
}

/* ── Preferences tab live preview canvas ─────────────────────────── */
.pref-preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
/* .pref-pawn-canvas sizing handled by .pawn-demo-canvas above */

/* Clip shell — wraps the canvas only, lets the label below breathe.
   The sim now crops itself to a CIRCLE in-canvas (_renderPawnFrame viewport
   disc), so this shell is a transparent sizing box — no border/radius "stamp"
   around the render. overflow:hidden still bounds the perspective-tilted
   canvas; outside the disc the canvas is transparent anyway. */
.sim-canvas-clip {
    width: 240px;
    height: 240px;
    overflow: hidden;
    background: transparent;
    flex-shrink: 0;
}

/* Live pawn simulation demo canvas — square, HiDPI via JS DPR scaling.
   Receives a CSS perspective transform each frame (same as real game canvas). */
.pawn-demo-canvas {
    display: block;
    width: 240px;
    height: 240px;
    transform-origin: center center;
}

/* Small label beneath demo canvas */
.pawn-demo-label {
    font-size: 7px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.30);
    font-family: 'Share Tech Mono', monospace;
}

/* Hue swatch + value row below the wheel/demo pair */
.hue-info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
}

/* ── Profile picture upload section ─────────────────────────────── */
.pm-avatar-section {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.pm-avatar-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 2px solid #2a2a2a;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #333;
    cursor: pointer;
    transition: border-color 0.15s;
}

.pm-avatar-circle:hover {
    border-color: var(--accent);
}

.pm-avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.pm-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pm-avatar-hint {
    font-size: 9px;
    color: #444;
    letter-spacing: 0.5px;
}

body.theme-light .pm-avatar-circle {
    background: hsl(var(--hue-inv), 30%, 90%);
    border-color: hsla(var(--hue-inv), 30%, 60%, 0.30);
    color: hsl(var(--hue-inv), 20%, 58%);
}

body.theme-light .pm-avatar-circle:hover {
    border-color: hsl(var(--hue-inv), 60%, 48%);
}

body.theme-light .pm-avatar-hint { color: hsl(var(--hue-inv), 20%, 52%); }

/* ═══════════════════════════════════════════════════════════════════
   CURRENCY POPUPS — shard + credit info modals
══════════════════════════════════════════════════════════════════ */
.currency-popup {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    z-index: 800;
    align-items: center;
    justify-content: center;
}

    .currency-popup.show {
        display: flex;
    }

.cpop-card {
    position: relative;
    z-index: 0;
    background: transparent;
    width: min(880px, 96vw);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Share Tech Mono', monospace;
    clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .cpop-card::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: rgba(255,255,255,0.10);
        clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
    }
    .cpop-card::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: #0c0c12;
        clip-path: polygon(0 0, calc(100% - 17.41px) 0, 100% 17.41px, 100% 100%, 17.41px 100%, 0 calc(100% - 17.41px));
    }

.cpop-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: #555;
    font-size: 18px;
    cursor: pointer;
    z-index: 2;
    transition: color 0.15s;
}

    .cpop-close:hover {
        color: #fff;
    }

.cpop-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 28px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

/* ── Guest-preview CTA banner — shown only when a guest opens a currency popup (G1).
   Sits between the header and body; signed-in users never see it. Each popup keeps its
   own accent (credits = cyan, shards = gold). ── */
.cpop-guest-cta { display: none; }
.currency-popup.guest-preview .cpop-guest-cta {
    display: flex;
    position: relative;
    z-index: 0;
    align-items: center;
    flex-wrap: wrap;          /* actions drop below the copy on a narrow popup */
    gap: 12px 18px;
    margin: 14px 28px 0;
    padding: 12px 16px;
    background: transparent;
    clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 11px 100%, 0 calc(100% - 11px));
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .currency-popup.guest-preview .cpop-guest-cta::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: rgba(0,229,255,0.30);
        clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 11px 100%, 0 calc(100% - 11px));
    }
    .currency-popup.guest-preview .cpop-guest-cta::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: linear-gradient(90deg, rgba(0,229,255,0.10), rgba(0,229,255,0.02));
        clip-path: polygon(0 0, calc(100% - 10.41px) 0, 100% 10.41px, 100% 100%, 10.41px 100%, 0 calc(100% - 10.41px));
    }
.cpop-gcta-text { flex: 1 1 260px; min-width: 0; }
.cpop-gcta-title { font-size: 10px; letter-spacing: 2px; color: #00e5ff; margin-bottom: 5px; text-transform: uppercase; }
.cpop-gcta-desc { font-size: 10.5px; line-height: 1.55; color: #aeb7bc; margin: 0; }
.cpop-gcta-actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.cpop-gcta-btn {
    display: flex; align-items: center; gap: 9px;
    position: relative; z-index: 0;
    min-width: 132px; padding: 8px 13px;
    background: transparent;
    color: #e6edf0; text-decoration: none;
    font-family: 'Share Tech Mono', monospace; font-size: 11px; letter-spacing: .5px;
    clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .cpop-gcta-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: rgba(255,255,255,0.16);
        clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
        transition: background .15s; }
    .cpop-gcta-btn::after { content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: rgba(255,255,255,0.05);
        clip-path: polygon(0 0, calc(100% - 6.41px) 0, 100% 6.41px, 100% 100%, 6.41px 100%, 0 calc(100% - 6.41px));
        transition: background .15s; }
.cpop-gcta-btn:hover::before { background: rgba(0,229,255,0.55); }
.cpop-gcta-btn:hover::after  { background: rgba(0,229,255,0.12); }
.cpop-gcta-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
/* Shard popup keeps its gold identity in the guest CTA. */
#shardPopup.guest-preview .cpop-guest-cta::after {
    background: linear-gradient(90deg, rgba(255,210,50,0.10), rgba(255,210,50,0.02));
}
#shardPopup.guest-preview .cpop-guest-cta::before {
    background: rgba(255,210,50,0.32);
}
#shardPopup .cpop-gcta-title { color: #ffd232; }
#shardPopup .cpop-gcta-btn:hover::before { background: rgba(255,210,50,0.55); }
#shardPopup .cpop-gcta-btn:hover::after  { background: rgba(255,210,50,0.12); }

/* ── E2C credit icon — replaces ⬡ placeholder everywhere ── */
.credits-min-icon {
    height: 1em;
    width: auto;
    vertical-align: -0.12em;
    display: inline;
    flex-shrink: 0;
    pointer-events: none;
    user-select: none;
}

/* ── Credit-coin metallic shine (HUD button) ─────────────────────────────────
   An SVG layer pinned over the coin and masked to the coin's exact silhouette
   (the same credits-min.png alpha the god-rays use), so it fits the coin
   perfectly. A specular glint tracks the cursor while it's inside the button
   (godrays.js slides the gradient centre); clicking sweeps a horizontal
   brushed-metal streak across. Desktop/pointer effect; degrades cleanly on
   touch (no hover glint, but a tap still fires the sweep). */
.credit-icon { position: relative; }
.coin-shine {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;          /* never intercept the button's own clicks */
    opacity: 0;                    /* hidden until the cursor enters the button */
    transition: opacity 0.16s ease;
    -webkit-mask: url(./img/credits-min.png) center / contain no-repeat;
            mask: url(./img/credits-min.png) center / contain no-repeat;
    mix-blend-mode: screen;        /* specular adds light over the coin */
    z-index: 1;
}
.cur-wrap-credit:hover .coin-shine { opacity: 1; }

/* Horizontal brushed-metal streak — parked off-screen left; the .is-brushing
   class (added on click in godrays.js) sweeps it across once. */
.coin-shine-brush {
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    transform: translateX(-130%);
}
.coin-shine.is-brushing { opacity: 1; }   /* show the sweep even on a touch tap */
.coin-shine.is-brushing .coin-shine-brush {
    animation: coinBrushSweep 0.5s cubic-bezier(0.33, 0, 0.2, 1) 1;
}
@keyframes coinBrushSweep {
    0%   { transform: translateX(-130%); opacity: 0; }
    18%  { opacity: 1; }
    82%  { opacity: 1; }
    100% { transform: translateX(130%); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .coin-shine.is-brushing .coin-shine-brush { animation: none; }
}

/* ── Shard icon — replaces ◆ placeholder everywhere ── */
.shard-min-icon {
    height: 1em;
    width: auto;
    vertical-align: -0.12em;
    display: inline;
    flex-shrink: 0;
    pointer-events: none;
    user-select: none;
}

.shard-popup-icon {
    height: 1em;
    width: auto;
    vertical-align: -0.12em;
    display: inline;
    pointer-events: none;
    user-select: none;
}

.cpop-icon {
    font-size: 28px;
    color: #ffd232;
}

.cpop-header .credit-icon {
    color: #00e5ff;
}

.cpop-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #fff;
    margin: 0;
    letter-spacing: 3px;
}

.cpop-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.cpop-panel {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cpop-panel-right {
    border-left: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.015);
    /* Tighten vertical rhythm + drop the bottom padding so the offers + store button
       fit the card height without an overflow scrollbar. */
    gap: 10px;
    padding-bottom: 0;
    overflow-y: hidden;
}

.cpop-panel-title {
    font-size: 9px;
    letter-spacing: 3px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.cpop-desc {
    color: #aaa;
    font-size: 12px;
    line-height: 1.7;
    margin: 0;
}

.cpop-note {
    color: #555;
    font-size: 10px;
    line-height: 1.6;
    margin: 0;
}

/* Earning table */
.cpop-table {
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 6px;
    overflow: hidden;
}

.ct-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 14px;
    font-size: 11px;
    color: #888;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

    .ct-row:last-child {
        border-bottom: none;
    }

.ct-head {
    background: rgba(255,255,255,0.04);
    color: #555;
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.ct-highlight {
    color: #ffd232;
    background: rgba(255,210,50,0.05);
}

/* Earn-more cards */
.cpop-earn-card {
    position: relative;
    z-index: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    background: transparent;
    padding: 14px 16px;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .cpop-earn-card::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: rgba(255,255,255,0.07);
        clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    }
    .cpop-earn-card::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: rgba(255,255,255,0.03);
        clip-path: polygon(0 0, calc(100% - 9.41px) 0, 100% 9.41px, 100% 100%, 9.41px 100%, 0 calc(100% - 9.41px));
    }

.cec-icon {
    font-size: 22px;
    width: 36px;
    text-align: center;
    color: #888;
    flex-shrink: 0;
}

.cec-body {
    flex: 1;
}

.cec-title {
    font-size: 10px;
    letter-spacing: 2px;
    color: #ccc;
    margin-bottom: 4px;
}

.cec-desc {
    font-size: 10px;
    color: #555;
    line-height: 1.5;
}

.cec-btn {
    background: rgba(255,210,50,0.12);
    border: 1px solid rgba(255,210,50,0.35);
    color: #ffd232;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
}

    .cec-btn:hover {
        background: rgba(255,210,50,0.22);
    }

.cec-btn-soon {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.10);
    color: #444;
    cursor: not-allowed;
}

/* Credit buy grid */
.cpop-buy-grid {
    display: flex;
    gap: 10px;
}

.cbuy-card {
    flex: 1;
    background: transparent;
    padding: 16px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 0;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .cbuy-card::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: rgba(255,255,255,0.08);
        clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    }
    .cbuy-card::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: rgba(255,255,255,0.03);
        clip-path: polygon(0 0, calc(100% - 9.41px) 0, 100% 9.41px, 100% 100%, 9.41px 100%, 0 calc(100% - 9.41px));
    }

.cbuy-best::before { background: rgba(0,229,255,0.35); }
.cbuy-best::after  { background: rgba(0,229,255,0.04); }

.cbuy-badge {
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    background: #00e5ff;
    color: #000;
    font-size: 7px;
    letter-spacing: 1px;
    padding: 2px 7px;
    border-radius: 3px;
    white-space: nowrap;
}

.cbuy-amount {
    color: #00e5ff;
    font-size: 13px;
    letter-spacing: 1px;
}

.cbuy-price {
    color: #666;
    font-size: 11px;
}

.cbuy-btn {
    background: rgba(0,229,255,0.12);
    border: 1px solid rgba(0,229,255,0.3);
    color: #00e5ff;
    border-radius: 5px;
    padding: 6px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
}

    .cbuy-btn:hover {
        background: rgba(0,229,255,0.22);
    }

.cpop-divider {
    text-align: center;
    color: #333;
    font-size: 10px;
    letter-spacing: 2px;
    margin: 4px 0;
}

.cpop-premium-btn {
    width: 100%;
    font-size: 11px !important;
    padding: 12px !important;
}

/* ═══ Credit popup — refreshed ABOUT + DEALS ═══ */
/* Logo wrapper: base CSS glow (all devices) + a canvas behind the coin that renders
   volumetric god rays scattering through the coin's alpha (high-end only). */
.cpop-about-wrap { position: relative; display: block; margin: 2px 0 6px; }
/* Always-on moderate glow UNDER the coin (z below the coin image) so it reads as light
   emanating from behind, not painted over the face. */
.cpop-about-wrap::after {
    content: ""; position: absolute; z-index: 0; pointer-events: none;
    left: 50%; top: 50%; width: 116px; height: 116px;
    transform: translate(-50%, -50%);
    border-radius: 50%; mix-blend-mode: screen;
    background: radial-gradient(circle, rgba(0,229,255,0.4) 0%, rgba(0,229,255,0.16) 48%, rgba(0,229,255,0) 72%);
}
/* God-ray canvas sits behind the coin image. Large + radially masked so the glow always
   fades to nothing before the canvas edge (no visible square boundary). */
.cpop-ray-canvas {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 420px; height: 420px;
    z-index: 0; pointer-events: none; mix-blend-mode: screen;
    -webkit-mask: radial-gradient(closest-side, #000 66%, transparent 100%);
            mask: radial-gradient(closest-side, #000 66%, transparent 100%);
}
.cpop-about-img {
    position: relative; z-index: 1;
    width: 100%;
    max-height: 110px;
    object-fit: contain;
    display: block;
    cursor: pointer;
    filter: drop-shadow(0 4px 14px rgba(0,0,0,0.5));
}
/* ── ABOUT CREDITS — Edge-signature feature boxes (replaces the old emoji list) ── */
.cpop-panel-about { position: relative; }
.cpop-feat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
/* This element's ::after is the cyan corner accent (can't use it for the fill layer), so the
   border rides the element's OWN background (chamfer N) and the fill rides ::before (chamfer M,
   inset 1px) — giving an equal 1px diagonal stroke while keeping the corner accent on ::after. */
.cfeat {
    position: relative; z-index: 0; display: flex; flex-direction: column; gap: 5px;
    text-align: left; cursor: pointer; overflow: hidden;
    padding: 12px 12px 11px;
    background: rgba(255,255,255,0.10);   /* = border colour (shows on the 1px frame) */
    color: #cfd8dc; font-family: 'Share Tech Mono', monospace;
    clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
    transition: background .15s, transform .1s, box-shadow .15s;
}
.cfeat::before {  /* fill layer, inset 1px → 1px chamfered frame shows the element bg */
    content: ""; position: absolute; inset: 1px; z-index: 0; pointer-events: none;
    background: rgba(255,255,255,0.025);
    clip-path: polygon(0 0, calc(100% - 8.41px) 0, 100% 8.41px, 100% 100%, 8.41px 100%, 0 calc(100% - 8.41px));
    transition: background .15s;
}
.cfeat > * { position: relative; z-index: 1; }  /* content above the fill layer */
.cfeat:hover { background: rgba(0,229,255,0.55); box-shadow: 0 0 14px rgba(0,229,255,0.14); }
.cfeat:hover::before { background: rgba(0,229,255,0.06); }
.cfeat:active { transform: translateY(1px); }
.cfeat:focus-visible { outline: 1px solid rgba(0,229,255,0.7); outline-offset: 2px; }
/* Edge corner accent — sits above the fill layer */
.cfeat::after { content:""; position:absolute; right:0; top:0; z-index:2; width:9px; height:9px; background: linear-gradient(135deg, transparent 50%, rgba(0,229,255,0.55) 50%); }
.cfeat-ico { width: 22px; height: 22px; color: #00e5ff; display: flex; align-items: center; }
.cfeat-ico svg { width: 100%; height: 100%; display: block; }
.cfeat-ico img { width: 18px; height: 18px; object-fit: contain; }
.cfeat-label { font-size: 12px; letter-spacing: .5px; color: #e6edf0; font-weight: 600; }
.cfeat-sub { font-size: 8.5px; letter-spacing: .6px; color: #6b7479; text-transform: uppercase; }

/* Context window — a viewport-level "narration bubble" that pops from the click point,
   unfolding bottom-left → top-right. Portaled to <body> in JS so no ancestor overflow or
   transform can clip it; only the browser viewport bounds it. */
.cfeat-ctx { position: fixed; inset: 0; z-index: 3000; display: none; }
.cfeat-ctx.show { display: block; }
.cfeat-ctx-inner {
    position: fixed; left: 0; top: 0; /* placed at the click point by JS */
    width: min(360px, 92vw); max-height: min(72vh, 560px); box-sizing: border-box;
    background: #0e0e15; /* fully opaque */
    border: 1px solid rgba(0,229,255,0.4); border-top: 2px solid #00e5ff;
    box-shadow: 0 14px 50px rgba(0,0,0,0.6), 0 0 22px rgba(0,229,255,0.12);
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
    display: flex; flex-direction: column; gap: 12px;
    padding: 20px 20px 16px; overflow-y: auto;
    transform-origin: left bottom;
    animation: cfeatCtxIn .26s cubic-bezier(.2,.85,.25,1);
}
@keyframes cfeatCtxIn {
    0%   { opacity: 0; transform: scale(0.05) translate(-12%, 12%); }
    55%  { opacity: 1; }
    100% { opacity: 1; transform: scale(1) translate(0, 0); }
}
.cfeat-ctx-close {
    position: absolute; top: 10px; right: 12px; z-index: 2;
    background: none; border: none; color: #6b7479; font-size: 16px; cursor: pointer;
    font-family: 'Share Tech Mono', monospace; transition: color .15s;
}
.cfeat-ctx-close:hover { color: #fff; }
.cfeat-ctx-head { display: flex; align-items: center; gap: 11px; padding-right: 26px; }
.cfeat-ctx-ico { width: 26px; height: 26px; color: #00e5ff; flex-shrink: 0; display: flex; align-items: center; }
.cfeat-ctx-ico svg { width: 100%; height: 100%; display: block; }
.cfeat-ctx-ico img { width: 22px; height: 22px; object-fit: contain; }
.cfeat-ctx-title { margin: 0; font-size: 14px; letter-spacing: 1.5px; color: #e6edf0; text-transform: uppercase; }
.cfeat-ctx-body { font-size: 11.5px; line-height: 1.6; color: #aab3b8; display: flex; flex-direction: column; gap: 12px; }
.cfeat-ctx-body p { margin: 0; }
.cfeat-ctx-body .cf-em { color: #00e5ff; }
.cfeat-ctx-body .cf-gold { color: #ffd232; }
/* Sub-detail rows inside the context window (e.g. each consumable). */
.cons-row { position: relative; z-index: 0; display: flex; gap: 11px; align-items: flex-start; padding: 10px 11px;
    background: transparent;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); }
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .cons-row::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: rgba(255,255,255,0.08);
        clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); }
    .cons-row::after { content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: rgba(255,255,255,0.025);
        clip-path: polygon(0 0, calc(100% - 7.41px) 0, 100% 7.41px, 100% 100%, 7.41px 100%, 0 calc(100% - 7.41px)); }
.cons-ico { width: 20px; height: 20px; flex-shrink: 0; color: #00e5ff; display: flex; align-items: center; margin-top: 1px; }
.cons-ico svg { width: 100%; height: 100%; display: block; }
.cons-ico img { width: 17px; height: 17px; object-fit: contain; }
.cons-name { font-size: 11px; letter-spacing: .5px; color: #e6edf0; font-weight: 600; margin-bottom: 3px; }
.cons-desc { font-size: 10.5px; line-height: 1.55; color: #97a0a5; }
.cons-tiers { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.cons-tiers span { font-size: 10px; color: #b7c0c4; }
.cons-tiers b { color: #ffd232; font-weight: 600; }

/* Stacking inside the GET CREDITS panel, bottom → top:
   rays (z0) → permanent glow (z1) → coin bg image (z2) → content (z3).
   Glow + rays therefore sit BELOW the coin so light reads as emanating from behind it. */
.cpop-panel-right { position: relative; }
.cpop-panel-right > * { position: relative; z-index: 3; }
.cpop-panel-right::before {
    content: ""; position: absolute; inset: 0;
    /* Anchored to the very bottom of the GET CREDITS side, fully opaque. */
    background: url("./img/Creditsimg2.png") no-repeat center bottom / 100% auto;
    opacity: 1; pointer-events: none; z-index: 2;
}
/* Anchor that exactly overlays the bg coin image (center bottom / 100% auto): full panel
   width, aspect-ratio 2:1 (Creditsimg2 is 2160x1080) → its height == the rendered image
   height, pinned to the panel bottom. So % offsets inside it map straight to image coords. */
.cpop-coin-hotspot {
    position: absolute; z-index: 1; left: 0; bottom: 0; width: 100%;
    aspect-ratio: 2 / 1; pointer-events: none;
}
/* Always-on moderate inner glow, pinned to the standing E-coin emblem (~45% across, 74% down). */
.cpop-coin-hotspot::before {
    content: ""; position: absolute; left: 45%; top: 74%;
    width: 84px; height: 84px; transform: translate(-50%, -50%);
    border-radius: 50%; pointer-events: none; mix-blend-mode: screen;
    background: radial-gradient(circle, rgba(0,229,255,0.34) 0%, rgba(0,229,255,0.12) 48%, rgba(0,229,255,0) 72%);
}
/* God-ray canvas spans the whole GET CREDITS panel and is aligned to the bg coin image by JS.
   Sits BELOW the static bg coins (::before) so the opaque coins occlude the rays and the
   light only shows scattering through the transparent gaps between/around the coins. */
.cpop-panel-rays {
    position: absolute; left: 0; top: 0; width: 100%; height: 100%;
    /* z0: above the panel's own background (so screen-blend has something to lighten) but
       below the coin bg (z2), so the opaque coins occlude the rays and light only scatters
       through the transparent gaps. (Was z-index:-1, which sank it behind the panel.) */
    z-index: 0; pointer-events: none; mix-blend-mode: screen;
}

/* ── Click burst: an extra glow pulse fired when a coin is clicked (both panels). ── */
@keyframes cpopCoinBurst {
    0%   { opacity: 0;    transform: translate(-50%, -50%) scale(0.45); }
    30%  { opacity: 0.95; transform: translate(-50%, -50%) scale(1.12); }
    100% { opacity: 0;    transform: translate(-50%, -50%) scale(1.95); }
}
.cpop-coin-burst {
    position: absolute; pointer-events: none; mix-blend-mode: screen;
    border-radius: 50%; opacity: 0; will-change: transform, opacity;
    background: radial-gradient(circle, rgba(0,229,255,0.8) 0%, rgba(0,229,255,0.32) 45%, rgba(0,229,255,0) 72%);
}
.cpop-coin-burst.is-bursting { animation: cpopCoinBurst 600ms ease-out; }
/* Left coin: burst centred on the logo, behind the image (z0, like the base glow). */
.cpop-about-wrap .cpop-coin-burst {
    left: 50%; top: 50%; width: 150px; height: 150px;
    transform: translate(-50%, -50%); z-index: 0;
}
/* Right coin: burst pinned to the emblem (45%/74% of the 2:1 anchor); inherits hotspot z1. */
.cpop-coin-hotspot .cpop-coin-burst {
    left: 45%; top: 74%; width: 120px; height: 120px;
    transform: translate(-50%, -50%);
}
/* Invisible click target over the standing E-coin emblem. pointer-events:auto re-enables
   hits even though the hotspot itself is pass-through; sits below content so the BUY button
   (which doesn't overlap the emblem) always wins where they'd meet. */
.cpop-coin-click {
    position: absolute; left: 45%; top: 74%;
    width: 96px; height: 96px; transform: translate(-50%, -50%);
    margin: 0; padding: 0; border: none; background: none; border-radius: 50%;
    cursor: pointer; pointer-events: auto; -webkit-tap-highlight-color: transparent;
}
.cpop-coin-click:focus { outline: none; }
.cpop-deals-label { font-size: 9px; letter-spacing: 1.5px; color: #ffd232; margin: -4px 0 2px; }
.cpop-deal-list { display: flex; flex-direction: column; gap: 10px; }

.cdeal-card {
    position: relative; z-index: 0; display: flex; align-items: center; gap: 12px;
    /* Opaque warm-yellow fill (same as Credit Vault) on every one-time offer so they all read
       as premium and the bg coin + god rays never bleed through. */
    background: transparent;
    padding: 12px 14px;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    transition: box-shadow 0.15s;
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .cdeal-card::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: rgba(255,210,50,0.45);
        clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
        transition: background 0.15s; }
    .cdeal-card::after { content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: #181610;
        clip-path: polygon(0 0, calc(100% - 9.41px) 0, 100% 9.41px, 100% 100%, 9.41px 100%, 0 calc(100% - 9.41px)); }
/* Hover highlights the offer in cyan — and lights up its BUY button. */
.cdeal-card:hover:not(.sold)::before { background: rgba(0,229,255,0.55); }
.cdeal-card:hover:not(.sold) { box-shadow: 0 0 14px rgba(0,229,255,0.16); }
.cdeal-card:hover:not(.sold) .cdeal-btn { background: #14454f; border-color: rgba(0,229,255,0.85); box-shadow: 0 0 10px rgba(0,229,255,0.3); }
/* Best value: stronger frame + headroom so the ribbon has its own space inside the clip. */
.cdeal-best::before { background: rgba(255,210,50,0.7); }
.cdeal-best { padding-top: 22px; }
/* Badge pinned flush inside the card's clipped top-left corner (was top:-8px, which the
   card's clip-path sliced in half). Notched to match Edge styling. */
.cdeal-badge {
    position: absolute; top: 0; left: 0;
    background: #ffd232; color: #000; font-size: 7px; font-weight: bold; letter-spacing: 1px;
    padding: 3px 10px 3px 8px; white-space: nowrap;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 9px 100%, 0 calc(100% - 7px));
}
.cdeal-img { width: 46px; height: 46px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5)); }
/* Founder card stacks both pack images, 31 in front on the left. */
.cdeal-img-combo { position: relative; width: 60px; height: 46px; display: inline-block; }
.cdeal-img-combo img { position: absolute; top: 50%; height: 42px; width: auto; object-fit: contain; transform: translateY(-50%); filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5)); }
.cdeal-img-combo img:nth-child(1) { left: 0; z-index: 2; }
.cdeal-img-combo img:nth-child(2) { right: 0; z-index: 1; }
/* Starter pack image scaled down to 80%. */
.cdeal-card[data-deal="starter"] .cdeal-img { transform: scale(0.8); }
/* Founder bundle: img32 (front/left) shrunk a lot and dropped ~18px. */
.cdeal-card[data-deal="founder"] .cdeal-img-combo img:nth-child(1) { height: 26px; transform: translateY(calc(-50% + 18px)); }
.cdeal-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cdeal-name { font-size: 11px; letter-spacing: 1px; color: #e6edf0; }
.cdeal-credits { font-size: 14px; color: #00e5ff; display: flex; align-items: center; gap: 4px; }
.cdeal-tag { font-size: 8px; letter-spacing: 1px; color: #ffd232; text-transform: uppercase; }
.cdeal-buy-col { display: flex; flex-direction: column; align-items: center; gap: 5px; flex-shrink: 0; }
.cdeal-price { font-size: 11px; color: #888; }
.cdeal-btn {
    /* Opaque so god rays / bg coin never wash through the call-to-action. */
    background: #0e2f36; border: 1px solid rgba(0,229,255,0.5); color: #00e5ff;
    border-radius: 5px; padding: 6px 14px; font-family: 'Share Tech Mono', monospace;
    font-size: 11px; cursor: pointer; transition: background 0.15s;
}
.cdeal-btn:hover { background: #14454f; }
.cdeal-card.sold { opacity: 0.45; filter: grayscale(1); }
.cdeal-card.sold .cdeal-btn { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.12); color: #777; cursor: not-allowed; }

.cpop-store-btn {
    margin-top: 14px; align-self: flex-end; width: auto;
    /* Opaque gradient + explicit z so it always sits above the right-tab god rays. */
    position: relative; z-index: 4;
    background: transparent;
    color: #d6c8ff;
    /* Edge signature notched corners instead of rounded. */
    clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
    padding: 13px 20px; font-family: 'Share Tech Mono', monospace;
    font-size: 11px; letter-spacing: 1px; cursor: pointer; transition: filter 0.15s;
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .cpop-store-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: rgba(167,139,250,0.55);
        clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px)); }
    .cpop-store-btn::after { content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: linear-gradient(90deg, #2a2350, #123a45);
        clip-path: polygon(0 0, calc(100% - 8.41px) 0, 100% 8.41px, 100% 100%, 8.41px 100%, 0 calc(100% - 8.41px)); }
.cpop-store-btn:hover { filter: brightness(1.25); }

body.theme-light .cpop-feat-list li { color: hsl(var(--hue-inv), 20%, 32%); }
body.theme-light .cpop-feat-list b  { color: hsl(var(--hue-inv), 30%, 18%); }
body.theme-light .cdeal-card::after  { background: hsla(var(--hue-inv),40%,86%,0.25); }
body.theme-light .cdeal-card::before { background: hsla(var(--hue-inv),26%,60%,0.25); }
body.theme-light .cdeal-name { color: hsl(var(--hue-inv),30%,20%); }
body.theme-light .cdeal-price { color: hsl(var(--hue-inv),18%,45%); }

/* ═══════════════════════════════════════════════════════════════════
   EXPAND MODAL — full-screen store / items popup
══════════════════════════════════════════════════════════════════ */
#expandModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1200;
    align-items: flex-start;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

    #expandModal.show {
        display: flex;
    }

#expandPanel {
    width: 100%;
    max-width: 960px;
    background: rgba(5, 5, 5, 0.98);
    border: 1px solid var(--border);
    border-top: 2px solid var(--accent);
    display: flex;
    flex-direction: column;
    /* Fixed height — always matches the credits tab (largest content) */
    height: calc(100vh - 32px);
    overflow: hidden;
}

#expandHeader {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: #0a0a0a;
    flex-shrink: 0;
}

#expandTabs {
    display: flex;
    gap: 0;
}

.etab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--dim);
    cursor: pointer;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 2px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

    .etab.active {
        color: hsl(var(--hue-inv), 85%, 62%);
        border-bottom-color: hsl(var(--hue-inv), 85%, 62%);
    }

    .etab:hover:not(.active) {
        color: #888;
    }

#expandClose {
    background: none;
    border: none;
    border-left: 1px solid var(--border);
    color: #555;
    font-size: 22px;
    cursor: pointer;
    padding: 0 18px;
    line-height: 1;
    transition: color 0.15s;
}

    #expandClose:hover { color: var(--accent); }

#expandBody {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.epane {
    display: none;
}

    .epane.active {
        display: block;
    }

/* ── CREDITS tab (own top-level tab) — premium-currency packs ─────────────── */
.etab-cred-icon { width: 13px; height: 13px; vertical-align: -2px; margin-right: 5px; }

.credit-tab { padding: 4px 2px 28px; }
.credit-intro { text-align: center; margin: 4px auto 20px; max-width: 460px; }
.credit-intro-title {
    font-family: 'Press Start 2P', monospace; font-size: 15px; color: #00e5ff;
    letter-spacing: 2px; display: flex; align-items: center; justify-content: center; gap: 10px;
    text-shadow: 0 0 18px rgba(0, 229, 255, 0.45);
}
.credit-intro-icon { width: 22px; height: 22px; }
.credit-intro-sub { margin-top: 9px; font-size: 11px; color: #8a8a96; line-height: 1.55; }

.credit-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 14px; align-items: stretch;
}
.credit-section {
    grid-column: 1 / -1; text-align: center; margin: 12px 0 0;
    font-family: 'Share Tech Mono', monospace; font-size: 11px; letter-spacing: 3px;
    color: #ffd700; opacity: 0.9; display: flex; align-items: center; gap: 10px;
}
.credit-section::before, .credit-section::after {
    content: ""; flex: 1; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.4), transparent);
}

.credit-card {
    position: relative; display: flex; flex-direction: column; align-items: center;
    padding: 16px 12px 14px; border-radius: 11px; overflow: hidden;
    background: linear-gradient(160deg, rgba(0, 229, 255, 0.12), rgba(10, 12, 20, 0.55));
    border: 1px solid rgba(0, 229, 255, 0.28);
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.credit-card:hover {
    transform: translateY(-3px); border-color: rgba(0, 229, 255, 0.65);
    box-shadow: 0 10px 26px rgba(0, 229, 255, 0.2);
}
.credit-card.premium {
    background: linear-gradient(160deg, rgba(255, 215, 0, 0.13), rgba(22, 17, 6, 0.6));
    border-color: rgba(255, 215, 0, 0.42);
}
.credit-card.premium:hover { border-color: rgba(255, 215, 0, 0.8); box-shadow: 0 10px 28px rgba(255, 215, 0, 0.24); }
.credit-card.mvp {
    background: linear-gradient(160deg, rgba(0, 229, 255, 0.11), rgba(6, 14, 18, 0.6));
    border-color: rgba(0, 229, 255, 0.4);
}
.credit-card.mvp:hover { border-color: rgba(0, 229, 255, 0.7); box-shadow: 0 10px 26px rgba(0, 229, 255, 0.2); }

/* Corner ribbon for DEAL / BEST VALUE / EXCLUSIVE / MVP tags. */
.credit-ribbon {
    position: absolute; top: 11px; right: -30px; transform: rotate(45deg);
    background: #00e5ff; color: #0a0a12; font-family: 'Share Tech Mono', monospace;
    font-size: 7.5px; font-weight: 700; letter-spacing: 1px; padding: 3px 32px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}
.credit-ribbon.gold { background: #ffd700; }
.credit-ribbon.mvp { background: #00e5ff; }

.credit-visual { width: 82px; height: 82px; margin: 6px 0 10px; filter: drop-shadow(0 2px 7px rgba(0, 0, 0, 0.5)); }
.credit-visual svg { width: 100%; height: 100%; display: block; }
.credit-name { font-family: 'Share Tech Mono', monospace; font-size: 11px; color: #cfcfe0; letter-spacing: 1px; margin-bottom: 9px; text-align: center; }

.credit-buy {
    margin-top: auto; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 8px 6px; cursor: pointer; border-radius: 7px;
    background: rgba(0, 229, 255, 0.18); border: 1px solid #00e5ff; color: #8ef0ff;
    font-family: 'Share Tech Mono', monospace;
    transition: background 0.14s ease, transform 0.1s ease, box-shadow 0.14s ease;
}
.credit-buy:hover { background: rgba(0, 229, 255, 0.32); box-shadow: 0 0 14px rgba(0, 229, 255, 0.3); }
.credit-buy:active { transform: scale(0.97); }
.credit-buy.gold { background: rgba(255, 215, 0, 0.15); border-color: #ffd700; color: #ffe88a; }
.credit-buy.gold:hover { background: rgba(255, 215, 0, 0.28); box-shadow: 0 0 14px rgba(255, 215, 0, 0.3); }
.credit-buy.static { cursor: default; }
.credit-buy.static:hover { background: rgba(0, 229, 255, 0.18); box-shadow: none; }
.credit-buy.static.mvp { background: rgba(0, 229, 255, 0.14); border-color: #00e5ff; color: #8ef0ff; }
.credit-price { font-size: 15px; font-weight: 700; letter-spacing: 0.5px; }
.credit-buy-lbl { font-size: 8px; letter-spacing: 2.5px; opacity: 0.85; }

/* ── HUB — store landing (new/featured, trending, weekly deal) ─────────────── */
.store-cat-box.store-cat-hub {
    color: #00e5ff; font-weight: 700; letter-spacing: 2px;
}
    .store-cat-box.store-cat-hub::before { background: #00e5ff; }
    .store-cat-box.store-cat-hub::after { background: linear-gradient(90deg, rgba(0, 229, 255, 0.14), transparent), #0d0d0d; }
.hub-scroll { padding: 16px 18px 80px; }
.hub-hero { margin: 26px 0 18px; text-align: center; }
.hub-hero-sub { margin-top: 12px; font-size: 11px; color: #8a8a96; }
/* Round pawn-simulation plateau in the HUB — same circular clip as the profile
   overview, with the live forward-walking pawn + scrolling grid inside. Drag to
   rotate/tilt (startSimPreviewOn wires the shared sim camera + grab cursor). */
.sim-canvas-clip.hub-plateau {
    width: 200px; height: 200px; margin: 0 auto; border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.6);
}
.hub-plateau .pawn-demo-canvas { width: 200px; height: 200px; }

/* Extended (expand-modal) HUB: pawn plateau on the LEFT, larger so the scrolling
   grid reads clearly, with copy alongside. Wraps to stacked on narrow widths. */
.hub-hero-ext { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; text-align: left; margin: 8px 0 22px; }
.hub-hero-ext .hub-plateau { width: 260px; height: 260px; margin: 0; }
.hub-hero-ext .hub-plateau .pawn-demo-canvas { width: 260px; height: 260px; }
.hub-hero-side { flex: 1; min-width: 200px; }
.hub-hero-title { font-family: 'Share Tech Mono', monospace; font-size: 15px; letter-spacing: 2px; color: #cfe8ff; margin-bottom: 8px; }
.hub-hero-ext .hub-hero-sub { margin-top: 0; font-size: 12px; line-height: 1.5; }

.hub-deal {
    display: flex; align-items: center; gap: 14px; margin-bottom: 24px; padding: 13px 16px;
    min-height: 62px; border-radius: 12px;
    background: linear-gradient(120deg, rgba(255, 152, 0, 0.14), rgba(10, 12, 20, 0.5));
    border: 1px solid rgba(255, 152, 0, 0.4);
}
.hub-deal-badge {
    flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 58px; height: 58px; border-radius: 10px; background: #ff9800; color: #0a0a12;
    font-family: 'Press Start 2P', monospace; font-size: 17px; line-height: 1;
}
.hub-deal-badge span { font-size: 6.5px; letter-spacing: 1px; margin-top: 4px; }
.hub-deal-body { flex: 1; min-width: 0; }
.hub-deal-title { font-family: 'Share Tech Mono', monospace; font-size: 14px; color: #ffd08a; letter-spacing: 1px; }
.hub-deal-sub { margin-top: 4px; font-size: 11px; color: #9a9aa6; }
.hub-deal-sub b { color: #cfcfe0; }
.hub-deal-cta {
    flex-shrink: 0; padding: 9px 16px; cursor: pointer; border-radius: 7px;
    background: rgba(255, 152, 0, 0.18); border: 1px solid #ff9800; color: #ffb74d;
    font-family: 'Share Tech Mono', monospace; font-size: 11px; letter-spacing: 1px;
    transition: background 0.14s ease;
}
.hub-deal-cta:hover { background: rgba(255, 152, 0, 0.32); }

/* ── V0.8.52 HUB den: greeting + docked viewport disc + exclusive-offer stack ──
   The offer cards reuse the store-card chamfer (10px corner cut): the outer
   .offer-card-wrap paints the 1px diagonal border in the accent colour, the
   inner .offer-card insets 1px and cuts 9.41px (N − 0.59·p) so its fill rides
   flush inside that diagonal stroke. Accent (border/glow/CTA) is themed per card
   via .offer-glow-* setting --og (translucent, for border+glow) and --ogs (solid,
   for the CTA fill). Three cards: Wave promo, the 7-skin drop, the weekly deal. */
.hub-hello {
    font-family: 'Share Tech Mono', monospace; font-size: 12px; letter-spacing: 2px;
    color: #8fa6c0; text-align: center; margin: 4px 0 14px;
}
.hub-hello b { color: #cfe8ff; }

/* Compact HUB: the viewport disc docks LEFT under a top pad; the freed right
   column carries the vertical offer cards. Extended HUB places the card row
   full-width below the hero (no .hub-offer-side wrapper), so it flows wide. */
.hub-hero-dock {
    display: flex; align-items: flex-start; gap: 20px;
    text-align: left; margin: 8px 0 22px; padding-top: 10px;
}
.hub-hero-dock .hub-plateau { margin: 0; flex-shrink: 0; }
.hub-offer-side { flex: 1; min-width: 0; }

.hub-offer-block { margin-bottom: 24px; }
.hub-offer-head {
    font-family: 'Share Tech Mono', monospace; font-size: 12px; letter-spacing: 3px;
    color: #cfe8ff; margin-bottom: 12px;
}
/* Narrow side column → cards wrap to a vertical stack; wide extended row → side
   by side. flex-basis 200px + min-width 0 drives the reflow at the column width. */
.offer-card-row { display: flex; flex-wrap: wrap; gap: 12px; }

.offer-card-wrap {
    --og: rgba(0, 229, 255, 0.5); --ogs: #00e5ff;
    flex: 1 1 200px; min-width: 0; padding: 1px;
    background: var(--og);
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    box-shadow: 0 0 18px -6px var(--og);
}
.offer-glow-violet { --og: rgba(176, 96, 255, 0.55); --ogs: #b060ff; }
.offer-glow-cyan   { --og: rgba(0, 229, 255, 0.5);  --ogs: #00e5ff; }
.offer-glow-amber  { --og: rgba(255, 184, 77, 0.55); --ogs: #ffb84d; }

.offer-card {
    position: relative; display: flex; flex-direction: column; gap: 6px;
    height: 100%; padding: 12px 14px 14px;
    background: linear-gradient(150deg, rgba(20, 22, 34, 0.96), rgba(8, 9, 16, 0.98));
    clip-path: polygon(0 0, calc(100% - 9.41px) 0, 100% 9.41px, 100% 100%, 9.41px 100%, 0 calc(100% - 9.41px));
}
.offer-card.hub-card { cursor: pointer; }
.offer-kicker {
    --ok: #00e5ff;
    font-family: 'Share Tech Mono', monospace; font-size: 9px; letter-spacing: 2px;
    color: var(--ok);
}
.offer-art { display: flex; gap: 6px; align-items: center; }
.offer-art svg { width: 44px; height: 44px; flex-shrink: 0; }
.offer-art-trio svg { width: 38px; height: 38px; }
.offer-title {
    font-family: 'Share Tech Mono', monospace; font-size: 13px; letter-spacing: 1px;
    color: #eaf2ff;
}
.offer-sub { font-size: 10px; line-height: 1.45; color: #9a9aa6; }
.offer-sub b { color: #cfcfe0; }
.offer-cta {
    margin-top: auto; align-self: flex-start; cursor: pointer;
    padding: 8px 14px; border: none; border-radius: 6px;
    background: var(--ogs, #00e5ff); color: #0a0a12;
    font-family: 'Share Tech Mono', monospace; font-size: 10px; letter-spacing: 1px; font-weight: bold;
    transition: filter 0.14s ease;
}
.offer-cta:hover { filter: brightness(1.15); }
.offer-cta:disabled { background: #23304a; color: #7fffd0; cursor: default; filter: none; }
.offer-cta-ghost {
    background: transparent; border: 1px solid var(--ogs, #00e5ff); color: #cfe8ff;
}
.offer-cta-ghost:hover { filter: brightness(1.15); }

.hub-section { margin-bottom: 24px; }
.hub-section-head {
    font-family: 'Share Tech Mono', monospace; font-size: 12px; letter-spacing: 3px;
    color: var(--accent, #00e5ff); margin-bottom: 11px; padding-left: 9px;
    border-left: 3px solid var(--accent, #00e5ff);
}
.hub-row {
    display: grid; grid-auto-flow: column; grid-auto-columns: 122px; gap: 12px;
    overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity;
}
.hub-card {
    scroll-snap-align: start; cursor: pointer; border-radius: 9px; overflow: hidden;
    background: rgba(8, 12, 18, 0.6); border: 1px solid rgba(255, 255, 255, 0.06);
    border-top: 2px solid var(--rar, #888);
    transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.hub-card:hover { transform: translateY(-3px); border-color: var(--rar, #888); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.42); }
.hub-card-preview { width: 100%; height: 92px; display: flex; align-items: center; justify-content: center; }
.hub-card-preview svg { width: 68px; height: 68px; }
.hub-card-name { padding: 0 9px; font-size: 12px; color: #dfe6ef; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-card-rar { padding: 1px 9px 9px; font-family: 'Share Tech Mono', monospace; font-size: 8px; letter-spacing: 1.5px; color: var(--rar, #888); }

/* ── MY LOADOUT view (MY ITEMS tab) ───────────────────────────────────────── */
.store-cat-box.store-cat-loadout { color: #00e5ff; font-weight: 700; letter-spacing: 1.5px; }
.lo-scroll { padding: 18px 18px 80px; }
.lo-head { font-family: 'Press Start 2P', monospace; font-size: 15px; color: #00e5ff; letter-spacing: 2px; text-shadow: 0 0 16px rgba(0, 229, 255, 0.4); }
.lo-sub { margin: 9px 0 18px; font-size: 11px; color: #8a8a96; }
.lo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 14px; }
.lo-card {
    display: flex; flex-direction: column; align-items: center; padding: 14px 10px 12px;
    background: rgba(8, 12, 18, 0.6); border: 1px solid rgba(0, 229, 255, 0.18); border-radius: 10px;
    cursor: pointer; transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.lo-card:hover { transform: translateY(-3px); border-color: rgba(0, 229, 255, 0.6); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.42); }
.lo-card-cat { font-family: 'Share Tech Mono', monospace; font-size: 9px; letter-spacing: 2px; color: #00e5ff; margin-bottom: 6px; }
.lo-card-svg { width: 72px; height: 72px; }
.lo-card-svg svg { width: 100%; height: 100%; }
.lo-card-name { max-width: 100%; margin: 7px 0 11px; font-size: 12px; color: #dfe6ef; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lo-card-btn {
    width: 100%; margin-top: auto; padding: 6px; border-radius: 6px; pointer-events: none;
    background: rgba(0, 229, 255, 0.14); border: 1px solid rgba(0, 229, 255, 0.5); color: #8ef0ff;
    font-family: 'Share Tech Mono', monospace; font-size: 9px; letter-spacing: 1.5px;
}
.lo-card:hover .lo-card-btn { background: rgba(0, 229, 255, 0.26); }

/* ── Expand modal: wider store grid ── */
#expandStore .store-item-grid,
#expandItems .store-item-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

#expandStore .store-layout,
#expandItems .store-layout {
    height: auto;
    max-height: none;
}

#expandStore .store-content-col,
#expandItems .store-content-col {
    overflow-y: visible;
    max-height: none;
}

/* Extended store is much wider than the carousel — pin the arrows just outside
   the ring instead of out at the far panel edges. */
#expandStore .sf-prev { left: calc(50% - 240px); }
#expandStore .sf-next { right: calc(50% - 240px); }

/* ── Mobile: full-screen no padding ── */
@media (max-width: 600px) {
    #expandModal {
        padding: 0;
    }

    #expandPanel {
        max-height: 100vh;
        max-width: 100vw;
    }

    .etab {
        padding: 10px 14px;
        font-size: 0.65rem;
    }
}

/* ── Light mode ── */
body.theme-light #expandModal {
    background: rgba(180, 190, 200, 0.80);
}

body.theme-light #expandPanel {
    background: hsl(0, 0%, 97%);
    border-color: hsla(var(--hue-inv), 28%, 62%, 0.25);
}

body.theme-light #expandHeader {
    background: hsl(var(--hue-inv), 30%, 94%);
    border-bottom-color: hsla(var(--hue-inv), 28%, 62%, 0.22);
}

body.theme-light .etab.active {
    color: hsl(var(--hue-inv), 70%, 38%);
    border-bottom-color: hsl(var(--hue-inv), 70%, 38%);
}

/* ── Currency HUD light mode ─────────────────────────────────────── */
body.theme-light .cur-btn {
    background: linear-gradient(to top,
        hsla(var(--hue-inv), 50%, 86%, 0.92) 0%,
        hsl(0, 0%, 97%) 100%);
    color: hsl(var(--hue-inv), 35%, 28%);
}

body.theme-light .cur-label {
    color: hsl(var(--hue-inv), 25%, 48%);
}

body.theme-light .cur-value {
    color: hsl(var(--hue-inv), 45%, 25%);
}

body.theme-light .cur-wrap-credit {
    background: hsla(var(--hue-inv), 60%, 55%, 0.28);
}

body.theme-light .cur-wrap-credit:hover {
    background: hsla(var(--hue-inv), 60%, 50%, 0.55);
}

body.theme-light .cur-wrap-shard {
    background: hsla(40, 80%, 50%, 0.25);
}

body.theme-light .cur-wrap-shard:hover {
    background: hsla(40, 80%, 45%, 0.55);
}

body.theme-light .credit-icon {
    filter: saturate(0.7) brightness(0.8);
}

/* ── Store-card selected border light mode ──────────────────────── */
body.theme-light .store-card.selected::before {
    background: hsl(var(--hue-inv), 60%, 45%) !important;
}
body.theme-light .store-card.selected::after {
    background: hsla(var(--hue-inv), 55%, 92%, 0.88) !important;
}
body.theme-light .store-card.selected {
    box-shadow: 0 0 12px hsla(var(--hue-inv), 55%, 55%, 0.18);
}

/* ── lp-title light mode: keep grey ────────────────────────────── */
body.theme-light .lp-title {
    color: hsl(var(--hue-inv), 22%, 42%);
}

/* ════════════════════════════════════════════════════════════════════
   PLATFORM ATTRIBUTE SELECTORS  — [data-brand] · [data-perf] · [data-orient]
   ─────────────────────────────────────────────────────────────────
   platform-detect.js sets three composable attributes on <html>:

     [data-brand]   iphone | ipad | samsung | pixel | android | desktop
                    Detected once (UA string) — stored in sessionStorage.

     [data-perf]    desktop | mobile-hi | mobile-mid | mobile-low
                    Detected once (brand + cores + deviceMemory + OS ver).

     [data-orient]  portrait | landscape
                    Updated LIVE on every device rotation — never stored.

   These fire in two scenarios:
   1. Real game — platform-detect.js sets attributes before first paint.
   2. Debug iframes — ui-preview.html postMessages set-brand / set-perf /
      set-orient because viewport @media queries don't see scaled iframes.

   ─── Shorthand used in comments ───────────────────────────────────
   PHONES  = iphone | samsung | pixel | android  (any small-screen brand)
   TOUCH   = PHONES + ipad
   ════════════════════════════════════════════════════════════════════ */

/* ── HUD right segment — all non-desktop ─────────────────────────
   Mirrors @media (max-width: 900px) for touch devices.               */
html:not([data-brand="desktop"]) .hud-seg-right { flex: 0 0 400px; width: 400px; }
html:not([data-brand="desktop"]) .hud-seg-right > img { width: 400px; }
html:not([data-brand="desktop"]) .hud-slot-btn-1  { top:1px; left:30px;  width:100px; height:51px; }
html:not([data-brand="desktop"]) .hud-slot-btn-2  { top:1px; left:137px; width:100px; height:51px; }
html:not([data-brand="desktop"]) .hud-slot-icon-img { width:16px; height:16px; }
html:not([data-brand="desktop"]) .hud-slot-val    { font-size:11px; }
html:not([data-brand="desktop"]) .hud-slot-label  { font-size:6px; }
html:not([data-brand="desktop"]) .hud-circle-btn  { top:1px; right:1px; width:321px; height:288px; }

/* ── Desktop currency HUD ────────────────────────────────────────────────────
   3-row grid. Row 1 = 38px (rect height). Rows 2+3 = credit/shard height.
   Profile chip spans rows 1-3 (col 1). Credit row 2 col 2. Shard row 3 col 2.
   Credit/shard therefore sit BELOW the rect and RIGHT of the circle.

   Profile chip shape (160×148px):
     - Full-width chamfered rect y:0–38
     - Angular step+chamfer on right y:38–46, step to circle right edge x=77.1
     - Large arc from (77.1,46) clockwise through bottom to equator-left (0,88)
       (circle cx=50, cy=88, r=50 — left edge flush at equator, bottom y=138)
     - Straight left side closes path: x=0, y=88→8                           */
/* Desktop uses default flex column from #currencyHud — no overrides needed */

/* ── Currency HUD + account chip — mobile now mirrors the DESKTOP top-right window ──
   Phones use the SAME vertical stack as desktop: the account chip (#playerHudChip,
   signed-in only) on top, then Credits, then Shards — pinned top-RIGHT. Only the
   container is overridden (reposition + scale to fit a phone); every per-element look
   (chamfered colored buttons, avatar chip, label/value readout) inherits from the
   desktop base rules above. This REPLACES the old left-edge grid + circular-avatar
   treatment and its tap-to-expand fold (the fold JS is also disabled on mobile). */
html:not([data-brand="desktop"]) #currencyHud {
  left: auto;
  right: 6px;
  top: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  transform: scale(0.84);
  transform-origin: top right;
}

/* In-game the gameplay HUD owns the screen — hide the lobby currency/account HUD on
   mobile too (the base body.in-game rule ties on specificity & lost on source order). */
html:not([data-brand="desktop"]) body.in-game #currencyHud { display: none; }

/* ── Folding credit/shard chips (re-added V0.8.47) ────────────────────────────
   Collapsed = icon-only square; tap 1 expands to show label+value; tap 2 opens the
   popup (fold JS in index.html). Keeps the top-right window compact until used. */
html:not([data-brand="desktop"]) .cur-btn {
  width: 44px; padding: 0; gap: 0; justify-content: center;
  overflow: hidden; transition: width 0.24s cubic-bezier(0.4,0,0.2,1);
}
html:not([data-brand="desktop"]) .cur-info {
  max-width: 0; opacity: 0; overflow: hidden;
  transition: max-width 0.22s ease, opacity 0.18s ease;
}
html:not([data-brand="desktop"]) .cur-btn-wrap.cur-expanded .cur-btn {
  width: 128px; padding: 0 10px; gap: 8px; justify-content: flex-start;
}
html:not([data-brand="desktop"]) .cur-btn-wrap.cur-expanded .cur-info {
  max-width: 90px; opacity: 1;
}

/* ── Lobby: raise the stack up + shrink the 4 controls 17% (mobile) ───────────
   The phone left a big empty band above the logo, so the centered lobby cluster is
   pulled upward to fill it (tune the translateY to taste). The username bar,
   INITIALIZE, CUSTOMIZE and the Store-shortcut emblem all scale to 83% (−17%);
   transform:scale keeps each chamfer geometry intact (changing width/height/font
   would distort the clip-path bevels). */
/* PORTRAIT ONLY: a transform on #lobby establishes a containing block that would
   TRAP the position:fixed landscape action stack (.lobby-btns) — pinning it mid-
   screen instead of the viewport corner. Landscape needs #lobby untransformed so
   the bottom-left stack can anchor to the true corner (like #toolTab on the right). */
html:not([data-brand="desktop"])[data-orient="portrait"] #lobby {
  transform: translateY(-6vh);
}
html:not([data-brand="desktop"]) .input-group,
html:not([data-brand="desktop"]) .lobby-btns .edge-btn-wrap {
  transform: scale(0.83);
  transform-origin: center center;
}
html:not([data-brand="desktop"]) #creditsShortcut.show {
  transform: translateX(-50%) scale(0.83);
}

/* ── PORTRAIT: lift the Store shortcut + About above the bottom tool-tab bar ──
   The tab bar (LOGIN/NETWORK/ITEMS/STORE) sits at the screen bottom in the menu and
   was covering About (bottom:8px) and crowding the Store emblem. Raise both so About
   clears the bar and the Store emblem sits just above it (tune the offsets on-device). */
html:not([data-brand="desktop"])[data-orient="portrait"] #aboutLink {
  /* !important: #aboutLink carries an inline style="bottom:8px" that would otherwise win */
  bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 95;
}
/* Emblem visible bottom sits ~40px above About's top (owner spec). About: bottom 56 +
   ~17 tall = top 73; target visible bottom = 73 + 40 = 113. The 0.83 scale is centred,
   so the visible box bottom is ~6px above the CSS bottom → CSS bottom 107 puts the
   visible edge at ~113. */
html:not([data-brand="desktop"])[data-orient="portrait"] #creditsShortcut.show {
  bottom: calc(107px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) scale(0.83);
}

/* ── PORTRAIT: tightened lobby column (owner spec V0.8.52) ────────────────────
   1. Version label hugs the "playing as guest" pill (margin removed).
   2. The status line is RELOCATED by JS (app.js boot) into .lobby-core right
      after the username plate — it fills what used to be dead space between
      the input and INITIALIZE. The selector below only bites post-relocation.
   3. INITIALIZE↔CUSTOMIZE stack gap halved (10px → 5px).
   4. CUSTOMIZE slims to 6px inner padding; the whole stack's bottom anchor to
      the store emblem (6px gap) lives in adjustLobbyForShortcut(). */
html:not([data-brand="desktop"])[data-orient="portrait"] #versionLabel {
  margin-bottom: 0;
}
html:not([data-brand="desktop"]) .lobby-core #statusMsg {
  margin: 2px 0 0;
  font-size: 0.65rem;
}
/* Windowed portrait (NOT fullscreen): the status has no spare room to give, so
   it sits flush — kill the input-group's bottom gap and its own margin so
   "Awaiting connection…" hugs tight between the username and INITIALIZE.
   Fullscreen keeps the 2px breathing room above. */
html:not([data-brand="desktop"]):not([data-fs="on"])[data-orient="portrait"] .lobby-core .input-group {
  margin-bottom: 0;
}
html:not([data-brand="desktop"]):not([data-fs="on"])[data-orient="portrait"] .lobby-core #statusMsg {
  margin: 0;
}
html:not([data-brand="desktop"])[data-orient="portrait"] .lobby-btns .edge-btn-pink {
  margin-top: 5px;
}
html:not([data-brand="desktop"])[data-orient="portrait"] button#customizeBtn {
  padding: 6px;
}
/* Scale the Edge title logo +8% on mobile (base width × 1.08; aspect-ratio keeps
   it proportional). Owner spec V0.8.56. */
html:not([data-brand="desktop"]) .title-screen {
  width: min(443px, 97vw);
}

/* ── LANDSCAPE: move INITIALIZE + CUSTOMIZE to the bottom-left (thumb reach) ──
   The centered lobby keeps the logo + username; the action buttons break out to a
   fixed bottom-left stack so they're reachable in landscape. */
html:not([data-brand="desktop"])[data-orient="landscape"] .lobby-btns {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 210px;
  margin: 0;
  padding: 0 0 6px 6px;
  box-sizing: border-box;
  /* Above the bd frame panels + matching #toolTab (z:100) so the stack draws OVER
     the left separator, mirroring the Tool tab on the right. */
  z-index: 101;
}
html:not([data-brand="desktop"])[data-orient="landscape"] .lobby-btns .edge-btn-wrap {
  width: 100%;
  transform-origin: left bottom;
}
/* Store-shortcut emblem rides at the TOP of the bottom-left action stack (directly
   above INITIALIZE), left-aligned over the separator. Its upward connector spine
   (::before) points at the now-absent centered status, so drop it here. */
html:not([data-brand="desktop"])[data-orient="landscape"] #creditsShortcut.show {
  left: 8px;
  bottom: 116px;
  transform: scale(0.83);
  transform-origin: left bottom;
}
html:not([data-brand="desktop"])[data-orient="landscape"] #creditsShortcut::before {
  display: none;
}
/* LANDSCAPE: the action stack is docked bottom-left, so the centered status sits just
   under the username — tighten the gap and shrink the text so the cluster stays compact. */
html:not([data-brand="desktop"])[data-orient="landscape"] #statusMsg {
  margin-top: 4px;
  font-size: 0.6rem;
}

/* ── PORTRAIT: in-game level-up cards become a swipeable carousel ────────────
   One card at a time, horizontal scroll-snap, instead of a wrapped row that
   overflows a narrow portrait screen. Landscape keeps the side-by-side row. */
html:not([data-brand="desktop"])[data-orient="portrait"] #levelupCards {
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  max-width: 92vw;
  padding: 4px 2px 8px;
  scrollbar-width: none;
}
html:not([data-brand="desktop"])[data-orient="portrait"] #levelupCards::-webkit-scrollbar { display: none; }
html:not([data-brand="desktop"])[data-orient="portrait"] .levelup-card {
  flex: 0 0 76%;
  width: auto;
  scroll-snap-align: center;
}

/* ── PORTRAIT: ability buttons flank the bottom joystick ─────────────────────
   The joystick sits bottom-centre (setJoyAnchor, 60px above the tool tab); Q breaks
   to the far LEFT and E to the far RIGHT at the joystick's height. `--joy-cy` is the
   live joystick centre Y (set by setJoyAnchor) so the buttons track it; margin-top
   centres the 58px button on that line. Container is touch-through so the empty
   middle still feeds the joystick; only the buttons themselves take taps. */
html:not([data-brand="desktop"])[data-orient="portrait"] #perkSlots {
  left: 0; right: 0; width: 100%;
  transform: none;
  top: var(--joy-cy, 56%); bottom: auto;
  margin-top: -29px;                 /* half the 58px slot → centre on the joystick */
  justify-content: space-between;
  padding: 0 22px;
  box-sizing: border-box;
  pointer-events: none;
}
html:not([data-brand="desktop"])[data-orient="portrait"] #perkSlots .perk-slot {
  pointer-events: auto;
}

/* ── LANDSCAPE: abilities stack vertically below the (top-right) minimap ────── */
html:not([data-brand="desktop"])[data-orient="landscape"] #perkSlots {
  left: auto; right: 8px; width: auto;
  top: 134px; bottom: auto;           /* minimap is 120px tall at top:6 → clear it */
  transform: none;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  pointer-events: none;
}
html:not([data-brand="desktop"])[data-orient="landscape"] #perkSlots .perk-slot {
  pointer-events: auto;
}

/* ── Auto-Build editor — mobile: smaller; landscape: dock TOP-LEFT ───────────── */
html:not([data-brand="desktop"]) .ab-shape { width: 28px; height: 28px; padding: 4px; }
html:not([data-brand="desktop"]) .ab-shapes { gap: 4px; padding: 5px; }
html:not([data-brand="desktop"]) .ab-size { padding: 5px 7px; margin-top: 5px; gap: 6px; }
html:not([data-brand="desktop"]) .ab-size-slider { min-width: 68px; }
html:not([data-brand="desktop"]) .ab-toggle { width: 28px; height: 28px; font-size: 14px; }
html:not([data-brand="desktop"])[data-orient="landscape"] .ab-ui {
  top: 10px; left: 10px; bottom: auto;
}

/* ── Death screen — LANDSCAPE mobile: shrink so WASTED + stats + buttons all fit ── */
html:not([data-brand="desktop"])[data-orient="landscape"] #deathScreen .death-content {
  max-height: 96vh; overflow-y: auto; padding: 6px 12px;
}
html:not([data-brand="desktop"])[data-orient="landscape"] #wastedText {
  font-size: 30px; margin-bottom: 8px; letter-spacing: 4px;
}
html:not([data-brand="desktop"])[data-orient="landscape"] #deathStats {
  gap: 4px; margin-bottom: 10px; min-width: 220px;
}
html:not([data-brand="desktop"])[data-orient="landscape"] .ds-row { padding: 3px 10px; }
html:not([data-brand="desktop"])[data-orient="landscape"] .ds-label { font-size: 10px; }
html:not([data-brand="desktop"])[data-orient="landscape"] .ds-val { font-size: 13px; }
html:not([data-brand="desktop"])[data-orient="landscape"] .ds-shards-val { font-size: 14px !important; }
html:not([data-brand="desktop"])[data-orient="landscape"] #deathScreen button {
  padding: 8px 22px; font-size: 13px;
}
html:not([data-brand="desktop"])[data-orient="landscape"] #deathScreen #deathShareBtn,
html:not([data-brand="desktop"])[data-orient="landscape"] #deathScreen #deathInviteBtn,
html:not([data-brand="desktop"])[data-orient="landscape"] #deathScreen #deathLeaveBtn {
  width: 170px; padding: 7px 22px; font-size: 13px; margin-top: 0;
}

/* ── Currency popups (Credits / Shards context windows) — mobile responsive ──
   Portrait: stack the two panels vertically and let the card scroll. Landscape:
   keep them side-by-side but tighten padding so the card fits a short viewport. */
html:not([data-brand="desktop"])[data-orient="portrait"] .cpop-card {
  width: 96vw; max-height: 88vh;
}
html:not([data-brand="desktop"])[data-orient="portrait"] .cpop-body {
  flex-direction: column;
  overflow-y: auto;
}
html:not([data-brand="desktop"])[data-orient="portrait"] .cpop-panel-right {
  border-left: none;
  border-top: 1px solid rgba(255,255,255,0.07);
  overflow-y: visible;
}
html:not([data-brand="desktop"])[data-orient="landscape"] .cpop-card {
  width: min(880px, 94vw); max-height: 94vh;
}
html:not([data-brand="desktop"])[data-orient="landscape"] .cpop-panel {
  padding: 14px 18px; gap: 9px;
}

/* ── Minimap — PHONES portrait ───────────────────────────────────
   Maps to @media (max-width: 600px) and (orientation: portrait)     */
html[data-brand="iphone"][data-orient="portrait"]  #minimapCanvas,
html[data-brand="samsung"][data-orient="portrait"] #minimapCanvas,
html[data-brand="pixel"][data-orient="portrait"]   #minimapCanvas,
html[data-brand="android"][data-orient="portrait"] #minimapCanvas {
    width:200px; height:200px; top:8px; right:8px; left:auto; bottom:auto;
}

/* ── Minimap — PHONES landscape ──────────────────────────────────
   Maps to @media (max-height: 500px) and (orientation: landscape)   */
html[data-brand="iphone"][data-orient="landscape"]  #minimapCanvas,
html[data-brand="samsung"][data-orient="landscape"] #minimapCanvas,
html[data-brand="pixel"][data-orient="landscape"]   #minimapCanvas,
html[data-brand="android"][data-orient="landscape"] #minimapCanvas {
    width:120px; height:120px; top:6px; right:8px; left:auto; bottom:auto;
}

/* ── Minimap — iPad portrait ───────────────────────────────────── */
html[data-brand="ipad"][data-orient="portrait"] #minimapCanvas {
    width:220px; height:220px; top:8px; right:8px; left:auto; bottom:auto;
}

/* ── Leaderboard — PHONES portrait ──────────────────────────────  */
html[data-brand="iphone"][data-orient="portrait"]  #slimLeaderboard,
html[data-brand="samsung"][data-orient="portrait"] #slimLeaderboard,
html[data-brand="pixel"][data-orient="portrait"]   #slimLeaderboard,
html[data-brand="android"][data-orient="portrait"] #slimLeaderboard {
    top:8px; left:8px; right:auto; width:148px;
    font-size:10px; line-height:1.4;
    background:rgba(5,5,5,0.68);
    border:1px solid rgba(0,229,255,0.18);
    border-radius:3px; overflow:hidden;
}
html[data-brand="iphone"][data-orient="portrait"]  .lb-row,
html[data-brand="samsung"][data-orient="portrait"] .lb-row,
html[data-brand="pixel"][data-orient="portrait"]   .lb-row,
html[data-brand="android"][data-orient="portrait"] .lb-row {
    padding:2px 8px; font-size:10px; background:rgba(5,5,5,0.35);
}
html[data-brand="iphone"][data-orient="portrait"]  .lb-row .lb-name,
html[data-brand="samsung"][data-orient="portrait"] .lb-row .lb-name,
html[data-brand="pixel"][data-orient="portrait"]   .lb-row .lb-name,
html[data-brand="android"][data-orient="portrait"] .lb-row .lb-name { max-width:90px; }

/* ── Leaderboard — PHONES landscape ─────────────────────────────  */
html[data-brand="iphone"][data-orient="landscape"]  #slimLeaderboard,
html[data-brand="samsung"][data-orient="landscape"] #slimLeaderboard,
html[data-brand="pixel"][data-orient="landscape"]   #slimLeaderboard,
html[data-brand="android"][data-orient="landscape"] #slimLeaderboard {
    top:134px; right:8px; left:auto; width:140px; font-size:10px;
}

/* ════════════════════════════════════════════════════════════════════════════
   HUD LAYOUT PASS (owner spec) — portrait: full-width top XP bar with the
   leaderboard + minimap docked directly below it; landscape: leaderboard hard
   top-left (perks stack below the minimap, see #perkSlots landscape above).
   These ride the generic [data-orient] selectors so they land AFTER (and beat,
   same specificity) the brand-specific phone rules above. ─────────────────── */
/* Run XP bar → spans the whole top edge in portrait. */
html:not([data-brand="desktop"])[data-orient="portrait"] #runXpBar {
  top: 0; left: 0; right: 0; width: auto;
  transform: none;
  padding: 5px 10px;
  box-sizing: border-box;
}
/* Leaderboard + minimap tuck directly under the bar. 28px ≈ the bar height, which
   is also the owner's "+20px" nudge down from the old top:8. */
html:not([data-brand="desktop"])[data-orient="portrait"] #slimLeaderboard {
  top: 28px; left: 8px; right: auto;
}
html:not([data-brand="desktop"])[data-orient="portrait"] #minimapCanvas {
  top: 28px;
}
/* LANDSCAPE: leaderboard hard top-left, no padding. */
html:not([data-brand="desktop"])[data-orient="landscape"] #slimLeaderboard {
  top: 0; left: 0; right: auto;
}

/* Leave-game button in the NETWORK tab — only during an active run. Sits at the
   top of the pane (the region picker it replaces is lobby-only). Danger styling. */
/* In-run leaderboard inside the tool-tab's 4th pane (renderRunLeaderboard). */
.tt-leaderboard { padding: 8px; font-size: 12px; line-height: 1.5; }
.tt-leaderboard .lb-name { max-width: none; }

#netLeaveBtn { display: none; }
body.in-game #netLeaveBtn {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: rgba(120, 18, 28, 0.5);
  border: 1px solid rgba(255, 70, 90, 0.55);
  color: #ff8a98;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
body.in-game #netLeaveBtn:hover {
  background: rgba(170, 24, 38, 0.6);
  border-color: #ff465a;
  color: #fff;
}

/* ── Tool panel — PHONES portrait (full-width bottom sheet, header docked) ──
   Mirror of @media (max-width:600) and (orientation:portrait). Subtab strip
   stays visible; only #toolBody collapses, so the toggle is always reachable. */
html[data-brand="iphone"][data-orient="portrait"]  #toolTab,
html[data-brand="samsung"][data-orient="portrait"] #toolTab,
html[data-brand="pixel"][data-orient="portrait"]   #toolTab,
html[data-brand="android"][data-orient="portrait"] #toolTab {
    width:100vw; right:0; left:0; border-left:none;
}

html[data-brand="iphone"][data-orient="portrait"]  #toolTab.store-mode,
html[data-brand="iphone"][data-orient="portrait"]  #toolTab.items-mode,
html[data-brand="samsung"][data-orient="portrait"] #toolTab.store-mode,
html[data-brand="samsung"][data-orient="portrait"] #toolTab.items-mode,
html[data-brand="pixel"][data-orient="portrait"]   #toolTab.store-mode,
html[data-brand="pixel"][data-orient="portrait"]   #toolTab.items-mode,
html[data-brand="android"][data-orient="portrait"] #toolTab.store-mode,
html[data-brand="android"][data-orient="portrait"] #toolTab.items-mode { width:100vw; }

html[data-brand="iphone"][data-orient="portrait"]  #toolTab.open #toolBody,
html[data-brand="samsung"][data-orient="portrait"] #toolTab.open #toolBody,
html[data-brand="pixel"][data-orient="portrait"]   #toolTab.open #toolBody,
html[data-brand="android"][data-orient="portrait"] #toolTab.open #toolBody { max-height:calc(60vh - 8px); }
/* Consistent tab height in portrait (owner spec) — LOGIN was taller than NETWORK
   because the sheet sized to each tab's content. Lock the open body to a FIXED
   height (the same no-jump pattern desktop uses at 540px) so LOGIN, NETWORK and the
   in-run leaderboard all open at the same height; taller content scrolls inside.
   STORE/ITEMS keep their own pane sizing. */
html:not([data-brand="desktop"])[data-orient="portrait"] #toolTab.open:not(.store-mode):not(.items-mode) #toolBody {
  height: calc(60vh - 8px);
}
html[data-brand="iphone"][data-orient="portrait"]  #loadoutPanel,
html[data-brand="samsung"][data-orient="portrait"] #loadoutPanel,
html[data-brand="pixel"][data-orient="portrait"]   #loadoutPanel,
html[data-brand="android"][data-orient="portrait"] #loadoutPanel { display:none !important; }

html[data-brand="iphone"][data-orient="portrait"]  .store-item-grid,
html[data-brand="samsung"][data-orient="portrait"] .store-item-grid,
html[data-brand="pixel"][data-orient="portrait"]   .store-item-grid,
html[data-brand="android"][data-orient="portrait"] .store-item-grid {
    grid-template-columns:repeat(2,1fr); padding:8px; gap:8px;
}
html[data-brand="iphone"][data-orient="portrait"]  #wastedText,
html[data-brand="samsung"][data-orient="portrait"] #wastedText,
html[data-brand="pixel"][data-orient="portrait"]   #wastedText,
html[data-brand="android"][data-orient="portrait"] #wastedText { font-size:40px; letter-spacing:3px; }

html[data-brand="iphone"][data-orient="portrait"]  #lobby,
html[data-brand="samsung"][data-orient="portrait"] #lobby,
html[data-brand="pixel"][data-orient="portrait"]   #lobby,
html[data-brand="android"][data-orient="portrait"] #lobby { padding:16px; }

html[data-brand="iphone"][data-orient="portrait"]  .su-card,
html[data-brand="samsung"][data-orient="portrait"] .su-card,
html[data-brand="pixel"][data-orient="portrait"]   .su-card,
html[data-brand="android"][data-orient="portrait"] .su-card { padding:32px 20px 24px; }

html[data-brand="iphone"][data-orient="portrait"]  .dtab,
html[data-brand="samsung"][data-orient="portrait"] .dtab,
html[data-brand="pixel"][data-orient="portrait"]   .dtab,
html[data-brand="android"][data-orient="portrait"] .dtab { padding:10px 4px; font-size:0.6rem; }

/* ── Tool panel — PHONES landscape (narrow docked panel) ────────────
   Mirror of @media (max-height:500) and (orientation:landscape). Subtab strip
   stays visible; only #toolBody collapses. */
html[data-brand="iphone"][data-orient="landscape"]  #toolTab,
html[data-brand="samsung"][data-orient="landscape"] #toolTab,
html[data-brand="pixel"][data-orient="landscape"]   #toolTab,
html[data-brand="android"][data-orient="landscape"] #toolTab { width:280px; }

html[data-brand="iphone"][data-orient="landscape"]  #toolTab.open #toolBody,
html[data-brand="samsung"][data-orient="landscape"] #toolTab.open #toolBody,
html[data-brand="pixel"][data-orient="landscape"]   #toolTab.open #toolBody,
html[data-brand="android"][data-orient="landscape"] #toolTab.open #toolBody { max-height:calc(100vh - 84px); }

html[data-brand="iphone"][data-orient="landscape"]  #toolTab.store-mode,
html[data-brand="iphone"][data-orient="landscape"]  #toolTab.items-mode,
html[data-brand="samsung"][data-orient="landscape"] #toolTab.store-mode,
html[data-brand="samsung"][data-orient="landscape"] #toolTab.items-mode,
html[data-brand="pixel"][data-orient="landscape"]   #toolTab.store-mode,
html[data-brand="pixel"][data-orient="landscape"]   #toolTab.items-mode,
html[data-brand="android"][data-orient="landscape"] #toolTab.store-mode,
html[data-brand="android"][data-orient="landscape"] #toolTab.items-mode { width:420px; }

html[data-brand="iphone"][data-orient="landscape"]  #loadoutPanel,
html[data-brand="samsung"][data-orient="landscape"] #loadoutPanel,
html[data-brand="pixel"][data-orient="landscape"]   #loadoutPanel,
html[data-brand="android"][data-orient="landscape"] #loadoutPanel { display:none !important; }

/* ── Expand modal — all phones (both orientations) ───────────────  */
html[data-brand="iphone"]  #expandModal,
html[data-brand="samsung"] #expandModal,
html[data-brand="pixel"]   #expandModal,
html[data-brand="android"] #expandModal { padding:0; }

html[data-brand="iphone"]  #expandPanel,
html[data-brand="samsung"] #expandPanel,
html[data-brand="pixel"]   #expandPanel,
html[data-brand="android"] #expandPanel { max-height:100vh; max-width:100vw; }

html[data-brand="iphone"]  .etab,
html[data-brand="samsung"] .etab,
html[data-brand="pixel"]   .etab,
html[data-brand="android"] .etab { padding:10px 14px; font-size:0.65rem; }

/* ── Performance profile hooks ───────────────────────────────────
   Baseline rules — game logic (app.js) reads window.EDGE_PLATFORM.perf
   for canvas resolution and effect toggling. CSS handles visual-only
   changes (e.g. removing the 3D perspective tilt on mobile-low).     */
html[data-perf="mobile-low"] #gameCanvas {
    transform: none;          /* disable 3D perspective tilt on low-end */
    filter: none;
}
html[data-perf="mobile-mid"] #gameCanvas {
    transform: perspective(1400px) rotateX(14deg); /* softer tilt */
}

/* ──────────────────────────────────────────────────────────────────────────
   CREDITS ACQUIRED — splash celebration (shown once on login when the server
   reports pending_credits > 0). Built dynamically by showCreditSplash().
   ────────────────────────────────────────────────────────────────────────── */
#creditSplash {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
#creditSplash.cs-show { opacity: 1; pointer-events: auto; }
#creditSplash[hidden] { display: none; }

.cs-backdrop {
    position: absolute; inset: 0;
    background: radial-gradient(circle at 50% 60%, #05151c 0%, #02060a 60%, #000 100%);
}

.cs-stage { position: absolute; inset: 0; }

/* Video padded at the bottom of the screen. */
.cs-videoWrap {
    position: absolute;
    left: 50%; bottom: 4vh;
    transform: translateX(-50%);
    width: min(620px, 84vw);
    aspect-ratio: 16 / 9;
}
.cs-video {
    width: 100%; height: 100%;
    object-fit: contain;
    border-radius: 10px;
    transition: opacity 0.8s ease, filter 0.8s ease;
}
.cs-video.cs-video-glow {
    filter: drop-shadow(0 0 26px rgba(0, 229, 255, 0.85)) brightness(1.15);
    opacity: 0.0;
}

/* Coin spawns at the centre of the video, grows + spins with a glow. */
.cs-coin {
    position: absolute;
    left: 50%; top: 50%;
    width: 38%;
    transform: translate(-50%, -50%) scale(0) rotate(0deg);
    filter: drop-shadow(0 0 0 rgba(0, 229, 255, 0));
    pointer-events: none;
}
.cs-coin img { width: 100%; height: auto; display: block; }
.cs-coin.cs-coin-go {
    animation: csCoinIn 1.25s cubic-bezier(0.18, 0.9, 0.24, 1) forwards;
}
@keyframes csCoinIn {
    0%   { transform: translate(-50%, -50%) scale(0)    rotate(0deg);    filter: drop-shadow(0 0 4px rgba(0,229,255,0.2)); }
    70%  { transform: translate(-50%, -50%) scale(1.18) rotate(680deg); filter: drop-shadow(0 0 34px rgba(0,229,255,0.95)); }
    100% { transform: translate(-50%, -50%) scale(1.0)  rotate(720deg); filter: drop-shadow(0 0 22px rgba(0,229,255,0.8)); }
}

/* God rays — repeating conic spokes, masked to a soft disc, expanding outward. */
.cs-rays {
    position: absolute;
    left: 50%; top: 50%;
    width: 160vmax; height: 160vmax;
    transform: translate(-50%, -50%) scale(0.2) rotate(0deg);
    background: repeating-conic-gradient(from 0deg,
        rgba(0, 229, 255, 0) 0deg 5deg,
        rgba(0, 229, 255, 0.22) 5deg 7deg);
    -webkit-mask-image: radial-gradient(circle, #000 0%, rgba(0,0,0,0.35) 38%, transparent 62%);
            mask-image: radial-gradient(circle, #000 0%, rgba(0,0,0,0.35) 38%, transparent 62%);
    opacity: 0;
    pointer-events: none;
    mix-blend-mode: screen;
}
.cs-rays.cs-rays-go { animation: csRays 2.6s ease-out forwards; }
@keyframes csRays {
    0%   { opacity: 0;    transform: translate(-50%, -50%) scale(0.2) rotate(0deg); }
    40%  { opacity: 0.9;  transform: translate(-50%, -50%) scale(1.0) rotate(40deg); }
    100% { opacity: 0.35; transform: translate(-50%, -50%) scale(1.25) rotate(90deg); }
}

/* Full-screen flash at the climax. */
.cs-flash {
    position: absolute; inset: 0;
    background: #eaffff;
    opacity: 0;
    pointer-events: none;
}
.cs-flash.cs-flash-go { animation: csFlash 0.55s ease-out forwards; }
@keyframes csFlash {
    0% { opacity: 0; } 18% { opacity: 0.95; } 100% { opacity: 0; }
}

/* Content panel with the acquired amount + coin stacks + confirm. */
.cs-panel {
    position: relative;
    z-index: 3;
    width: min(440px, 88vw);
    margin-bottom: 30vh;
    padding: 24px 26px 22px;
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(8, 22, 30, 0.96), rgba(4, 12, 18, 0.96));
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(0, 229, 255, 0.18) inset;
    text-align: center;
    opacity: 0;
    transform: translateY(18px) scale(0.96);
}
.cs-panel.cs-panel-go { animation: csPanelIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes csPanelIn {
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.cs-title {
    font-family: 'Orbitron', 'Share Tech Mono', monospace;
    font-size: 15px; letter-spacing: 3px;
    color: #00e5ff; text-transform: uppercase;
    margin-bottom: 14px;
    text-shadow: 0 0 14px rgba(0, 229, 255, 0.6);
}
.cs-amount {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-bottom: 16px;
}
.cs-amount-icon { width: 34px; height: 34px; }
.cs-count {
    font-family: 'Orbitron', 'Share Tech Mono', monospace;
    font-size: 40px; font-weight: 800;
    color: #fff; text-shadow: 0 0 18px rgba(0, 229, 255, 0.8);
    font-variant-numeric: tabular-nums;
}
.cs-stacks {
    display: flex; flex-wrap: wrap; align-items: flex-end;
    justify-content: center; gap: 3px;
    min-height: 46px; margin-bottom: 20px;
}
.cs-stacks img {
    height: var(--cs-stack-h, 42px);
    width: auto;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
    animation: csStackPop 0.32s ease-out both;
}
@keyframes csStackPop {
    from { opacity: 0; transform: translateY(8px) scale(0.6); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cs-confirm {
    font-family: 'Orbitron', 'Share Tech Mono', monospace;
    font-size: 15px; letter-spacing: 2px;
    padding: 11px 40px;
    color: #021016; background: #00e5ff;
    border: none; border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 22px rgba(0, 229, 255, 0.5);
    transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.3s ease;
    opacity: 0;
}
.cs-confirm.cs-confirm-show { opacity: 1; }
.cs-confirm:hover { transform: translateY(-1px); box-shadow: 0 0 30px rgba(0, 229, 255, 0.8); }
.cs-confirm:active { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
    .cs-coin, .cs-rays, .cs-flash, .cs-panel { animation-duration: 0.01ms !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   REGION SELECTOR — Edge-style custom listbox (theme-aware)
   Append-only block. A native <select>'s option popup is OS-rendered and
   cannot be styled, so it always opens white and ignores the theme; this is
   a custom trigger + absolutely-positioned listbox so every color comes from
   the app's CSS custom properties and reads correctly in dark AND light.
   Mirrors the .edge-btn-wrap chamfer bevel without editing those shared rules.
══════════════════════════════════════════════════════════════════ */
.region-select {
    position: relative;
    width: 65%;
    margin: 10px auto 0;
    font-family: 'Share Tech Mono', monospace;
}

/* Trigger button — chamfered like .edge-btn-wrap, inv-hue themed. */
.region-trigger {
    position: relative;
    z-index: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: hsl(var(--hue-inv), 100%, 62%);
    background: transparent;
    clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
    transition: color 0.2s ease;
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .region-trigger::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: hsla(var(--hue-inv), 100%, 62%, 0.30);
        clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
        transition: background 0.2s ease;
    }
    .region-trigger::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: linear-gradient(to top,
            hsla(var(--hue-inv), 100%, 62%, 0.10) 0%,
            var(--bg) 70%);
        clip-path: polygon(0 0, calc(100% - 8.41px) 0, 100% 8.41px, 100% 100%, 8.41px 100%, 0 calc(100% - 8.41px));
        transition: background 0.2s ease;
    }

    /* Highlight lights ONLY the border (the ::before ring); the ::after fill
       stays at its dark resting value so the button never floods on hover/open. */
    .region-trigger:hover::before,
    .region-trigger[aria-expanded="true"]::before {
        background: hsl(var(--hue-inv), 100%, 62%);
    }
    .region-trigger:hover,
    .region-trigger[aria-expanded="true"] {
        color: hsl(var(--hue-inv), 100%, 72%);
    }

.region-trigger-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.region-trigger-caret {
    font-size: 0.6rem;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.region-trigger[aria-expanded="true"] .region-trigger-caret {
    transform: rotate(180deg);
}

/* Panel — outer shell mirrors .edge-btn-cyan: --hue-inv glow border + bg tint.
   Inner rows mirror button#joinBtn: --hue-inv gradient base, --accent text. */
.region-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 60;
    display: flex;
    flex-direction: column;
    padding: 2px;
    background: transparent;
    clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    max-height: 240px;
    overflow-y: auto;
}
    /* border + fill on pseudos so the diagonal stroke == the 1px straight border */
    .region-panel::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background: hsl(var(--hue-inv), 100%, 62%);
        clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
    }
    .region-panel::after {
        content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
        background: var(--bg);
        clip-path: polygon(0 0, calc(100% - 8.41px) 0, 100% 8.41px, 100% 100%, 8.41px 100%, 0 calc(100% - 8.41px));
    }

    .region-panel[hidden] { display: none; }

/* Option rows — mirror button#joinBtn: inv-hue gradient, accent text. */
.region-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 10px;
    font-family: inherit;
    font-size: 0.68rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--bg);
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

    .region-opt + .region-opt {
        border-top: 1px solid hsla(var(--hue-inv), 100%, 62%, 0.12);
    }

    .region-opt:hover,
    .region-opt.region-opt-active {
        background: var(--bg);
        color: hsl(var(--hue-inv), 100%, 72%);
        box-shadow: inset 0 0 0 1px hsl(var(--hue-inv), 100%, 62%);
    }

    .region-opt[aria-selected="true"] .region-opt-code::after {
        content: " \25CF"; /* ● selected marker */
        font-size: 0.5em;
        vertical-align: middle;
    }

.region-opt-sub {
    opacity: 0.55;
    font-size: 0.62rem;
    letter-spacing: 0;
    text-transform: none;
}

/* Light theme: panel shell same --hue-inv glow; rows use light --bg fill.
   Border + fill ride the base ::before/::after (both use theme-adaptive var() / same hsl),
   so only the lighter drop-shadow needs overriding here. */
body.theme-light .region-panel {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

body.theme-light .region-opt {
    background: var(--bg);
    color: hsl(var(--hue-inv), 60%, 28%);
}

    body.theme-light .region-opt:hover,
    body.theme-light .region-opt.region-opt-active {
        background: var(--bg);
        color: hsl(var(--hue-inv), 60%, 28%);
        box-shadow: inset 0 0 0 1px hsl(var(--hue-inv), 65%, 45%);
    }

/* Region selector — toolTab / NETWORK tab context overrides.
   The picker lives inside #toolBody (overflow-y:auto), so the dropdown
   must be position:static (inline expansion, not absolute float) to avoid
   being clipped. Full-width, no lobby centering. Hidden in-game. */
#tabNetwork .region-select {
    width: 100%;
    margin: 0 0 10px;
}

#tabNetwork .region-panel {
    /* Fixed so it overlays content below rather than pushing it;
       exact top/left/width are set by JS (openRegionPanel) from
       the trigger's getBoundingClientRect, escaping toolBody's
       overflow-y:auto scroll-clipping context. */
    position: fixed;
    z-index: 200;
    width: auto; /* JS sets explicit width */
}

/* Main-menu only — hide while a game session is active */
body.in-game #regionSelect {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════
   CLICKER TOAST — reward popup on the credits-shortcut button tap
   Floats above the button, fades in/out, color-coded by reward type.
══════════════════════════════════════════════════════════════════ */
.clicker-toast {
    position: fixed;
    right: 12px;
    bottom: 130px;   /* above the creditsShortcut button */
    z-index: 500;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 2px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    white-space: nowrap;
    /* default (shard) */
    background: hsla(var(--hue), 90%, 55%, 0.18);
    border: 1px solid hsla(var(--hue), 90%, 55%, 0.45);
    color: hsl(var(--hue), 100%, 72%);
}

.clicker-toast.clicker-toast-show {
    opacity: 1;
    transform: translateY(0);
}

.clicker-toast.clicker-toast-rare {
    background: hsla(var(--hue-inv), 100%, 62%, 0.22);
    border-color: hsla(var(--hue-inv), 100%, 62%, 0.60);
    color: hsl(var(--hue-inv), 100%, 72%);
}

.clicker-toast.clicker-toast-credit {
    background: rgba(255, 215, 0, 0.18);
    border-color: rgba(255, 215, 0, 0.55);
    color: #ffd700;
}

.clicker-toast.clicker-toast-warn {
    background: rgba(255, 64, 81, 0.15);
    border-color: rgba(255, 64, 81, 0.40);
    color: var(--danger);
}
