@font-face {
  font-family: 'Pixel Operator';
  src: url('../../assets/fonts/pixel-operator.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Pixel Operator';
  src: url('../../assets/fonts/pixel-operator-bold.ttf') format('truetype');
  font-weight: 700 900;
  font-display: swap;
}
@font-face {
  font-family: 'Upheaval';
  src: url('../../assets/fonts/upheaval.ttf') format('truetype');
  font-display: swap;
}

:root {
    --accent: #4ecca3;
    --accent-dim: rgba(78,204,163,0.6);
    --accent-glow: rgba(78,204,163,0.25);
    --accent-glow-soft: rgba(78,204,163,0.08);
    --accent-glow-mid: rgba(78,204,163,0.15);
    --food: #ff6b6b;
    --food-glow: rgba(255,107,107,0.5);
    --food-accent: #ffaa44;
    --death: #ff3333;

    --panel: rgba(4, 10, 9, 0.88);

    --panel-strong: rgba(2, 6, 5, 0.97);

    --line: rgba(255,255,255,0.13);

    --text: #f2f5f4;

    --muted: #9aa5a1;

    --pixel-font: ui-monospace, 'SFMono-Regular', 'Cascadia Mono', 'Roboto Mono', 'Courier New', monospace;
    --pixel-display-font: var(--pixel-font);
}

/* Final Moments is an isolated replay cabinet. It never resizes the live board. */
#final-moments-overlay[hidden] { display: none !important; }
#replay-tools-access[hidden], .replay-export-lab[hidden] { display: none !important; }
#replay-tools-unlock { all: unset; cursor: pointer; font: inherit; color: inherit; }
#replay-tools-unlock:focus-visible { outline: 2px solid #ffcf40; outline-offset: 4px; }
#replay-tools-access { border: 1px solid #4ecca3; padding: 8px; color: #4ecca3; background: #03100c; }
#replay-tools-access label { display: flex; gap: 10px; align-items: center; min-height: 44px; font: bold 16px 'Pixel Operator', monospace; }
#replay-tools-access input { font-size: 16px; width: 20px; height: 20px; accent-color: #4ecca3; }
#replay-tools-status { font: 14px 'Pixel Operator', monospace; line-height: 1.3; }
#final-moments-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: max(env(safe-area-inset-top), 10px) 12px max(env(safe-area-inset-bottom), 10px);
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, var(--accent-glow-mid), transparent 46%), rgba(0,0,0,0.96);
  font-family: var(--pixel-font);
}
.final-moments-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(94vw, 430px);
  max-height: calc(100dvh - max(env(safe-area-inset-top), 10px) - max(env(safe-area-inset-bottom), 10px) - 20px);
  padding: 12px;
  border: 1px solid var(--accent-dim);
  background: #010504;
  box-shadow: 0 0 0 4px #000, 0 0 30px var(--accent-glow);
}
.final-moments-heading { position: relative; padding: 2px 4px 10px; text-align: center; text-transform: uppercase; }
.final-moments-heading > span { display: block; color: var(--muted); font-size: 0.48rem; letter-spacing: 0.16em; }
.final-moments-heading > strong { display: block; margin-top: 4px; color: var(--accent); font-size: clamp(0.95rem, 4vw, 1.25rem); letter-spacing: 0.16em; text-shadow: 0 0 14px var(--accent-glow); }
.final-moments-frame { position: relative; justify-self: center; width: fit-content; max-width: 100%; min-height: 0; display: grid; place-items: center; }
.replay-social-preview.replay-safe-guides .final-moments-frame::after { content: 'PREVIEW GUIDES'; position: absolute; inset: 12% 18% 18%; border: 1px dashed #ffcf40; color: #ffcf40; font: 12px monospace; pointer-events: none; }
.replay-export-lab { margin-top: 10px; border-top: 2px solid #4ecca3; padding-top: 8px; font: 14px monospace; color: #4ecca3; }
.replay-export-lab summary { cursor: pointer; }
.replay-export-lab p { margin: 8px 0; color: #bacbc4; }
.replay-export-lab label { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.replay-export-lab input, .replay-export-lab select, .replay-export-lab button { min-width: 0; min-height: 36px; font: 16px monospace; color: #fff; background: #03100c; border: 1px solid #4ecca3; border-radius: 0; padding: 4px; }
.replay-export-lab input:not([type=checkbox]), .replay-export-lab select { flex: 1; width: 100%; }
.replay-export-lab > div { display: flex; gap: 8px; }
.final-moments-shell:has(.replay-export-lab[open]) { overflow-y: auto; display: block; }
.final-moments-shell:has(.replay-export-lab[open]) #final-moments-canvas { height: min(40dvh, 360px); margin: auto; }
#final-moments-canvas {
  display: block;
  width: auto;
  height: min(60dvh, calc(100dvh - 290px));
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 10 / 19;
  border: 2px solid var(--accent-dim);
  image-rendering: pixelated;
  box-shadow: 0 0 18px var(--accent-glow);
}
#final-moments-status { min-height: 1.35em; margin: 9px 0 7px; color: #fff; font-size: 0.58rem; line-height: 1.35; letter-spacing: 0.06em; text-align: center; text-transform: uppercase; }
.final-moments-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.final-moments-actions button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; border: 1px solid var(--accent-dim); border-radius: 0; background: #03100c; color: var(--text); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.final-moments-action-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  background: var(--accent);
  filter: drop-shadow(0 0 4px var(--accent));
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}
#final-moments-watch-again .final-moments-action-icon {
  -webkit-mask-image: url('../../assets/icons/replay/replay-watch-again.svg');
  mask-image: url('../../assets/icons/replay/replay-watch-again.svg');
}
#final-moments-share .final-moments-action-icon {
  -webkit-mask-image: url('../../assets/icons/replay/replay-share.svg');
  mask-image: url('../../assets/icons/replay/replay-share.svg');
}
.final-moments-actions button[hidden] { display: none !important; }
.final-moments-actions .final-moments-primary { background: var(--accent); border-color: var(--accent); color: #010504; }
#final-moments-play-again { grid-column: 1 / -1; min-height: 48px; }
#final-moments-results { grid-column: 1 / -1; }
@media (max-height: 700px) {
  .final-moments-shell { padding: 8px; }
  .final-moments-heading { padding-bottom: 6px; }
  #final-moments-canvas { height: calc(100dvh - 290px); }
  #final-moments-status { margin: 5px 0; }
  .final-moments-actions button { min-height: 38px; }
  #final-moments-play-again { min-height: 42px; }
}
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html, body {
    background: #000;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    color: #e0e0e0;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  /* Installed apps own the full screen. Keep gameplay in document flow below
     the fixed HUD instead of flex-centering it inside the taller PWA viewport. */
  html.installed-pwa,
  html.installed-pwa body {
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
  }
  html.installed-pwa {
    --installed-cabinet-deck-width: min(calc(100vw - 8px), 476px);
    --installed-hud-top-inset: 20px;
  }
  html.installed-pwa body { justify-content: flex-start; }
  html.installed-pwa #game { flex: 0 0 auto; }
  html.installed-pwa #score-bar {
    position: absolute;
    top: var(--installed-hud-top-inset);
    background: #010605;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    grid-template-columns: minmax(52px, 1fr) 78px 50px 44px minmax(52px, 1fr);
    gap: 6px;
    padding: max(env(safe-area-inset-top), 8px) 18px 8px;
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
    box-shadow: 0 5px 0 rgba(0,0,0,0.72);
  }
  html.installed-pwa #score-bar .label {
    font-size: 11px;
    line-height: 12px;
    letter-spacing: 1px;
    text-shadow: none;
  }
  html.installed-pwa #score-bar .val {
    font-family: inherit;
    font-size: 18px;
    line-height: 18px;
    text-shadow: none;
  }
  html.installed-pwa #hud-mode {
    box-sizing: border-box;
    width: 78px;
    height: 24px;
    padding: 4px 6px;
    border-width: 1px;
    border-radius: 0;
    font-family: inherit;
    font-size: 11px;
    line-height: 14px;
    letter-spacing: 1px;
  }
  html.installed-pwa #pause-btn {
    box-sizing: border-box;
    width: 44px;
    min-width: 44px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 0;
  }
  html.installed-pwa #score-bar.vs-advantage-active {
    grid-template-columns: 30px minmax(174px, 760px) 30px;
    gap: 3px;
    padding: max(env(safe-area-inset-top), 5px) 9px 5px;
  }
  html.installed-pwa #score-bar.vs-advantage-active .hud-score .val,
  html.installed-pwa #score-bar.vs-advantage-active .hud-best .val {
    font-size: 18px;
    line-height: 18px;
    text-shadow: none;
  }
  html.installed-pwa #score-bar.vs-advantage-active #timer-block {
    box-sizing: border-box;
    width: 44px;
    min-width: 44px;
    min-height: 24px;
    padding: 0;
  }
  html.installed-pwa #score-bar.vs-advantage-active #timer {
    font-family: inherit;
    font-size: 12px;
    line-height: 12px;
    -webkit-text-stroke: 0;
    text-shadow:
      -1px -1px 0 #010607,
      1px -1px 0 #010607,
      -1px 1px 0 #010607,
      1px 1px 0 #010607;
  }
  html.installed-pwa .menu-cabinet-footer {
    width: var(--installed-cabinet-deck-width);
  }
  #gameplay-cabinet-footer { display: none; }
  html.installed-pwa #overlay.hidden ~ #gameplay-cabinet-footer {
    display: flex;
    flex: 1 1 0;
    align-self: center;
    align-items: flex-start;
    justify-content: center;
    width: var(--installed-cabinet-deck-width);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    pointer-events: none;
  }
  html.installed-pwa #gameplay-cabinet-footer img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    object-position: top center;
    image-rendering: pixelated;
    user-select: none;
  }
  html.installed-pwa #overlay {
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
  }
  #score-bar {
    position: fixed;
    top: 0;
    left: 0; right: 0;
    padding: max(env(safe-area-inset-top), 12px) 20px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10;
    font-size: 1.1rem;
    font-weight: 600;
  }
  #score-bar .label { color: #888; }
  #score-bar .val { color: var(--accent); font-variant-numeric: tabular-nums; }
  #timer-block { display: none; }
  #timer-block.visible { display: block; }
  #timer.urgent {
    color: #ff5a5a;
    animation: timer-pulse 0.6s steps(2, end) infinite;
  }
  @keyframes timer-pulse { 50% { opacity: 0.45; } }

  #record-chase {
    display: none;
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  #record-chase.visible { display: block; }

  #guided-controls[hidden] { display: none !important; }
  #guided-controls {
    position: fixed;
    inset: 0;
    z-index: 18;
    pointer-events: none;
    font-family: var(--pixel-font);
  }
  .guided-controls-card {
    position: fixed;
    z-index: 3;
    top: max(env(safe-area-inset-top), 58px);
    left: 50%;
    width: min(88vw, 390px);
    padding: 10px 12px;
    transform: translateX(-50%);
    border: 1px solid var(--accent);
    background: rgba(0,7,5,0.94);
    box-shadow: 0 0 0 3px #000, 0 0 24px var(--accent-glow);
    text-align: center;
    text-transform: uppercase;
  }
  .guided-controls-meta { display: flex; justify-content: space-between; color: var(--accent); font-size: 0.48rem; letter-spacing: 0.13em; }
  .guided-controls-pips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin: 7px 0 8px; }
  .guided-controls-pips i { height: 3px; background: rgba(255,255,255,0.14); }
  .guided-controls-pips i.complete { background: var(--accent); box-shadow: 0 0 7px var(--accent-glow); }
  .guided-controls-card h2 { color: #fff; font-size: clamp(0.82rem, 4vw, 1.05rem); letter-spacing: 0.08em; }
  .guided-controls-card p { margin: 5px 0; color: #dce4e1; font-size: 0.57rem; line-height: 1.45; }
  .guided-controls-card small { display: block; color: var(--muted); font-size: 0.44rem; line-height: 1.4; }
  #guided-controls-continue {
    min-height: 40px;
    margin-top: 8px;
    padding: 8px 20px;
    pointer-events: auto;
    border: 0;
    background: var(--accent);
    color: #010504;
    font: 800 0.62rem var(--pixel-font);
    letter-spacing: 0.09em;
    text-transform: uppercase;
  }
  .guided-tap-zone {
    position: fixed;
    z-index: 2;
    top: var(--guided-board-top);
    width: calc(var(--guided-board-width) / 2);
    height: var(--guided-board-height);
    opacity: 0;
    border: 3px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    transition: opacity 120ms;
  }
  .guided-tap-zone.active { opacity: 1; animation: guided-zone-pulse 720ms steps(2, end) infinite; }
  .guided-tap-left { left: var(--guided-board-left); border-right-width: 1px; }
  .guided-tap-right { left: calc(var(--guided-board-left) + var(--guided-board-width) / 2); border-left-width: 1px; }
  .guided-tap-zone span { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); padding: 6px; background: #000; color: #fff; font-size: 0.57rem; letter-spacing: 0.09em; text-transform: uppercase; }
  body.guided-controls-active #pause-btn { display: none; }
  body.guided-controls-active #dpad,
  body.guided-controls-active #turn-controls { opacity: 0.42; z-index: 19; }
  body.guided-controls-active #dpad .btn.guided-target,
  body.guided-controls-active #turn-controls .turn-btn.guided-target {
    opacity: 1;
    border-color: #fff;
    background: var(--accent);
    box-shadow: 0 0 0 4px #000, 0 0 28px var(--accent);
    animation: guided-control-pulse 700ms steps(2, end) infinite;
  }
  #guided-controls.wrong .guided-controls-card { border-color: #ff5a5a; animation: guided-wrong 180ms steps(2, end); }
  #guided-controls.briefing .guided-controls-card { top: 50%; transform: translate(-50%,-50%); }
  #guided-controls.independent .guided-controls-card { border-color: #ffd45e; }
  #guided-controls.independent .guided-controls-card h2,
  #guided-controls.independent .guided-controls-meta { color: #ffd45e; }
  #guided-controls.complete .guided-controls-card { top: 50%; transform: translate(-50%,-50%); }
  @keyframes guided-zone-pulse { 50% { opacity: 0.36; } }
  @keyframes guided-control-pulse { 50% { filter: brightness(1.5); } }
  @keyframes guided-wrong { 50% { transform: translateX(calc(-50% + 5px)); } }
  #hud-mode.record-warning {
    color: #fff;
    border-color: #ff3b3b;
    background: rgba(80,0,0,0.92);
    box-shadow: 0 0 16px rgba(255,35,35,0.72), inset 0 -2px #ff5a5a;
    text-shadow: 0 0 7px rgba(255,255,255,0.7);
  }
  #hud-mode.record-pace {
    color: #181000;
    border-color: #ffd700;
    background: #ffd700;
    box-shadow: 0 0 18px rgba(255,215,0,0.72), inset 0 -2px #a86f00;
    text-shadow: none;
  }
  canvas.record-warning {
    animation: record-border-pulse var(--record-pulse-speed, 720ms) ease-in-out infinite;
  }
  canvas.record-pace {
    border-color: #ffd700;
    outline-color: rgba(255,215,0,0.75);
    box-shadow:
      inset 0 0 34px rgba(255,215,0,0.12),
      0 0 0 4px rgba(255,215,0,0.45),
      0 0 32px rgba(255,215,0,0.72);
  }
  @keyframes record-border-pulse {
    0%, 100% {
      border-color: #ff3b3b;
      outline-color: rgba(255,59,59,0.62);
      box-shadow:
        inset 0 0 24px rgba(255,35,35,0.08),
        0 0 0 3px rgba(255,35,35,0.42),
        0 0 18px rgba(255,35,35,0.58);
    }
    50% {
      border-color: #fff0f0;
      outline-color: #ff3333;
      box-shadow:
        inset 0 0 34px rgba(255,35,35,0.18),
        0 0 0 6px rgba(255,35,35,0.82),
        0 0 42px rgba(255,35,35,0.95);
    }
  }

  #record-celebration {
    position: fixed;
    inset: 0;
    z-index: 25;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s;
  }
  #record-celebration.active { opacity: 1; visibility: visible; }
  #record-fireworks { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; outline: 0; box-shadow: none; }
  #record-banner {
    position: absolute;
    top: max(env(safe-area-inset-top), 54px);
    left: 50%;
    transform: translateX(-50%);
    width: min(88vw, 430px);
    padding: 14px 18px 12px;
    border: 2px solid #ffd700;
    background: rgba(0,0,0,0.9);
    color: #fff;
    font-family: var(--pixel-font);
    text-align: center;
    box-shadow: 0 0 30px rgba(255,215,0,0.6), inset 0 0 18px rgba(255,215,0,0.12);
  }
  #record-banner strong { display: block; color: #ffd700; font-size: clamp(1.5rem, 8vw, 2.7rem); letter-spacing: 0.12em; text-shadow: 3px 3px 0 #9b2d30; }
  #record-banner span { display: block; margin-top: 5px; font-size: 0.65rem; letter-spacing: 0.14em; text-transform: uppercase; }
  @media (prefers-reduced-motion: reduce) {
    #timer.urgent, canvas.record-warning { animation: none; }
    canvas.record-warning {
      border-color: #ff3b3b;
      outline-color: rgba(255,59,59,0.9);
      box-shadow: 0 0 0 5px rgba(255,35,35,0.72), 0 0 30px rgba(255,35,35,0.8);
    }
    #record-celebration { transition: none; }
  }
  #pause-btn {
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: var(--accent);
    font-size: 1.1rem;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
  }
  #pause-btn:active { background: var(--accent-glow-mid); transform: scale(0.9); }
  #pause-btn.paused { background: var(--accent-glow-mid); border-color: var(--accent-glow); }
  #pause-btn[hidden] { display: none; }
  canvas {
    display: block;
    image-rendering: pixelated;
    outline: 2px solid var(--accent-glow);
    outline-offset: -1px;
    box-shadow: inset 0 0 30px var(--accent-glow-soft), 0 0 20px var(--accent-glow);
    border-radius: 4px;
  }
  #overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 20;
    transition: opacity 0.2s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: auto;
  }
  #overlay .ov-content {
    margin: auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  #overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  /* A hidden menu must not leave invisible buttons over the game board. */
  #overlay.hidden .ov-content,
  #overlay.hidden .ov-content * { pointer-events: none !important; }
  #overlay h2 { font-size: 2rem; color: var(--accent); margin-bottom: 8px; }
  #overlay .theme-label {
    color: var(--accent-dim);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin: -2px 0 12px;
    text-transform: uppercase;
  }
  #overlay p { font-size: 1.1rem; margin-bottom: 24px; color: #aaa; }
  #overlay button {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.1s;
  }
  #overlay button:active { transform: scale(0.95); }
  .game-mode-toggle {
    display: flex;
    gap: 8px;
    margin: 0 0 14px;
  }
  #overlay .game-mode-btn {
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.14);
    color: #aaa;
    font-family: inherit;
    font-size: 0.78rem;
    padding: 7px 14px;
    border-radius: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: none;
  }
  #overlay .game-mode-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    box-shadow: 0 0 14px var(--accent-glow);
  }
  #dailyChallengeInfo {
    margin: -7px 0 14px;
    color: var(--accent-dim);
    font-family: var(--pixel-font);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    line-height: 1.45;
    text-align: center;
    text-transform: uppercase;
  }
  #dailyChallengeInfo[hidden] { display: none; }

  #dailyRulesDialog {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 70;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    background: rgba(0,0,0,0.96);
  }
  #dailyRulesDialog.visible { display: flex; }
  .daily-rules-card {
    position: relative;
    width: min(100%, 410px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    padding: 31px 25px 24px;
    border: 3px solid #fff;
    background: #000;
    box-shadow: 0 0 0 4px #000, 0 0 0 6px var(--accent), 0 0 30px var(--accent-glow);
    color: #fff;
    font-family: var(--pixel-font);
    text-align: center;
  }
  .daily-rules-card::before,
  .daily-rules-card::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #000;
  }
  .daily-rules-card::before { top: -3px; left: -3px; border-right: 3px solid #fff; border-bottom: 3px solid #fff; }
  .daily-rules-card::after { right: -3px; bottom: -3px; border-top: 3px solid #fff; border-left: 3px solid #fff; }
  .daily-rules-icon {
    display: block;
    width: 54px;
    height: 54px;
    margin: 0 auto 13px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
  }
  .daily-rules-kicker {
    color: var(--accent);
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
  }
  .daily-rules-card h2 {
    margin: 8px 0 9px;
    color: #fff;
    font-size: 1.42rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  .daily-rules-lead {
    margin: 0 0 18px;
    color: var(--accent);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    line-height: 1.55;
    text-transform: uppercase;
  }
  .daily-rule-list { display: grid; gap: 9px; margin: 0 0 18px; text-align: left; }
  .daily-rule {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 9px;
    align-items: start;
    color: #e8ecea;
    font-size: 0.69rem;
    line-height: 1.5;
  }
  .daily-rule-number { color: var(--accent); font-weight: 800; }
  .daily-rules-preview { margin: 0 0 17px; color: var(--muted); font-size: 0.6rem; line-height: 1.5; }
  #dailyRulesBegin,
  #dailyRulesLater {
    width: 100%;
    min-height: 43px;
    border-radius: 0;
    cursor: pointer;
    font-family: var(--pixel-font);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    padding: 10px 12px;
    text-transform: uppercase;
  }
  #dailyRulesBegin { border: 1px solid var(--accent); background: var(--accent); color: #000; }
  #dailyRulesLater { margin-top: 9px; border: 1px solid #777; background: transparent; color: #bbb; }

  /* Shared pre-game countdown and connection states across every mode. */
  #countdownDisplay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 15;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 24px;
    color: var(--accent);
    font-family: 'Upheaval', 'Pixel Operator', monospace;
    font-size: clamp(5rem, 25vw, 9rem);
    font-weight: 400;
    line-height: 1;
    text-align: center;
    text-shadow: 4px 4px 0 #000;
    pointer-events: none;
  }
  #countdownDisplay.status-message { font-size: clamp(24px, 6vw, 40px); }
  #countdownDisplay.visible { display: flex; }
  #shareBtn, #lbBtn {
    display: none;
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    padding: 12px 36px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    margin-top: 12px;
    transition: transform 0.1s, background 0.2s;
  }
  #shareBtn:hover, #lbBtn:hover { background: var(--accent-glow-mid); }
  #shareBtn:active, #lbBtn:active { transform: scale(0.95); }
  #namePrompt {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
  }
  #namePrompt .np-label {
    color: var(--accent-dim);
    font-size: 0.85rem;
    letter-spacing: 2px;
  }
  #scoreMethodLabel {
    color: var(--accent-dim);
    font-size: 0.68rem;
    letter-spacing: 1px;
    text-align: center;
    text-transform: uppercase;
  }
  #scoreMethodLabel.unranked { color: #ff8b8b; }
  #nameInput {
    background: rgba(255,255,255,0.06);
    border: 2px solid var(--accent-dim);
    color: var(--accent);
    font-family: inherit;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    width: 100px;
    padding: 8px;
    border-radius: 8px;
    letter-spacing: 10px;
    outline: none;
  }
  #nameInput::placeholder { color: rgba(78,204,163,0.25); letter-spacing: 10px; }
  #nameInput:focus { border-color: var(--accent); }
  #submitScoreBtn {
    background: var(--accent);
    color: #000;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 8px 24px;
    cursor: pointer;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.1s;
  }
  #submitScoreBtn:active { transform: scale(0.95); }
  #submitScoreBtn:disabled { opacity: 0.3; cursor: default; }
  #leaderboardOverlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 100;
    flex-direction: column;
    align-items: center;
    padding: 50px 16px 30px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #leaderboardOverlay.visible { display: flex; }
  #leaderboardOverlay h2 {
    color: var(--accent);
    font-size: 1.1rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 14px;
  }
  .lb-filter-group {
    width: 100%;
    max-width: 520px;
    margin-bottom: 12px;
  }
  .lb-filter-label {
    display: block;
    color: #aaa;
    font-size: 0.62rem;
    letter-spacing: 2px;
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 6px;
  }
  .lb-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 0;
  }
  .lb-filter {
    background: none;
    border: 1.5px solid rgba(255,255,255,0.1);
    color: #aaa;
    font-family: inherit;
    font-size: 0.75rem;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.15s;
  }
  .lb-filter.active {
    background: var(--accent-glow-mid);
    border-color: var(--accent);
    color: #fff;
  }
  .lb-table {
    width: 100%;
    max-width: 420px;
    border-collapse: collapse;
  }
  .lb-table th {
    color: #aaa;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--accent-glow-mid);
    text-align: left;
  }
  .lb-table td {
    color: #ccc;
    font-size: 0.9rem;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
  }
  .lb-table tr.top1 td { color: #ffd700; font-weight: 700; }
  .lb-table tr.top2 td { color: #c0c0c0; font-weight: 700; }
  .lb-table tr.top3 td { color: #cd7f32; font-weight: 700; }
  .lb-table .lb-rank { width: 32px; text-align: center; color: #aaa; }
  .lb-table .lb-score { text-align: right; font-variant-numeric: tabular-nums; }
  .lb-table .lb-theme-col { color: #999; font-size: 0.7rem; }
  .lb-method-tag {
    display: inline-block;
    margin-left: 7px;
    color: #aaa;
    font-size: 0.58rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    vertical-align: 1px;
  }
  .lb-table tr.you td { background: var(--accent-glow-soft); }

  #dailyArchivePanel {
    width: 100%;
    max-width: 520px;
    margin: 0 0 16px;
    font-family: var(--pixel-font);
  }
  #dailyArchivePanel[hidden] { display: none; }
  .daily-archive-nav {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 7px;
    align-items: stretch;
  }
  .daily-day-btn,
  #dailyTodayBtn {
    border: 1px solid var(--accent-dim);
    border-radius: 2px;
    background: var(--panel);
    color: var(--accent);
    cursor: pointer;
    font-family: var(--pixel-font);
    font-size: 0.72rem;
    font-weight: 800;
    min-height: 38px;
    text-transform: uppercase;
  }
  .daily-day-btn:disabled { cursor: default; opacity: 0.25; }
  #dailyArchiveHeading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.025);
    color: var(--text);
    font-size: clamp(0.55rem, 2.4vw, 0.67rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.35;
    padding: 6px 8px;
    text-align: center;
    text-transform: uppercase;
  }
  #dailyTodayBtn {
    display: block;
    width: 100%;
    margin-top: 7px;
    min-height: 32px;
  }
  #dailyTodayBtn[hidden] { display: none; }
  #dailyArchiveSummary {
    min-height: 1.3em;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.61rem;
    line-height: 1.45;
    text-align: center;
    text-transform: uppercase;
  }
  .daily-legends-title {
    margin: 15px 0 8px;
    color: var(--accent);
    font-size: 0.63rem;
    letter-spacing: 0.16em;
    text-align: center;
    text-transform: uppercase;
  }
  #dailyLegendCards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  #dailyLegendsSection[hidden] { display: none; }
  .daily-legend-card {
    min-width: 0;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.025);
    padding: 8px 5px;
    text-align: center;
  }
  .daily-legend-label {
    display: block;
    color: var(--muted);
    font-size: 0.48rem;
    letter-spacing: 0.05em;
    line-height: 1.35;
    text-transform: uppercase;
  }
  .daily-legend-player {
    display: block;
    overflow: hidden;
    margin-top: 4px;
    color: #fff;
    font-size: 0.64rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .daily-legend-value {
    display: block;
    margin-top: 3px;
    color: var(--accent);
    font-size: 0.58rem;
  }
  #dailyLegendsTable { margin-top: 7px; max-width: none; }
  #dailyLegendsTable th,
  #dailyLegendsTable td { padding-left: 6px; padding-right: 6px; }
  .lb-pagination {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    max-width: 420px;
    margin-top: 16px;
  }
  .lb-page-btn {
    min-width: 76px;
    background: transparent;
    border: 1.5px solid var(--accent-dim);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.72rem;
    padding: 7px 10px;
    text-transform: uppercase;
  }
  .lb-page-btn:disabled { opacity: 0.3; cursor: default; }
  #lbPageInfo {
    color: #aaa;
    font-size: 0.7rem;
    min-width: 100px;
    text-align: center;
  }
  #lbBack { margin-top: 18px; }
  .lb-back {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    padding: 10px 32px;
    cursor: pointer;
    border-radius: 14px;
    transition: transform 0.1s, background 0.2s;
  }
  .lb-back:hover { background: var(--accent-glow-mid); }
  .lb-back:active { transform: scale(0.95); }
  #lbLoading {
    color: #aaa;
    font-size: 0.9rem;
    margin: 30px 0;
  }
  #lbEmpty {
    color: #aaa;
    font-size: 0.9rem;
    margin: 30px 0;
    display: none;
  }
  #mute-btn {
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: var(--accent);
    font-size: 1.1rem;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 8px;
  }
  #mute-btn:active { background: rgba(255,255,255,0.12); }
  #mute-btn.muted { color: #555; border-color: rgba(255,255,255,0.06); }
  #fps-counter {
    display: none;
    position: fixed;
    top: max(env(safe-area-inset-top), 8px);
    left: 12px;
    background: rgba(0,0,0,0.35);
    color: var(--accent-dim);
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    z-index: 25;
    pointer-events: none;
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
  }
  body.debug #fps-counter { display: block; }
  #dpad {
    position: fixed;
    bottom: max(env(safe-area-inset-bottom), 24px);
    right: max(env(safe-area-inset-right), 16px);
    width: 168px;
    height: 168px;
    z-index: 15;
    pointer-events: none;
    opacity: 0.52;
    transition: opacity 0.3s;
  }
  #dpad.active { opacity: 1; }
  #dpad .btn {
    position: absolute;
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.11);
    border: 1.5px solid rgba(255,255,255,0.22);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.08s, transform 0.08s, box-shadow 0.08s;
    user-select: none;
    -webkit-user-select: none;
  }
  #dpad .btn svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: rgba(255,255,255,0.72);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  #dpad .btn:active, #dpad .btn.pressed {
    background: var(--accent-glow-mid);
    border-color: var(--accent-glow);
    box-shadow: 0 0 20px var(--accent-glow), inset 0 0 10px var(--accent-glow-soft);
    transform: scale(0.9);
  }
  #dpad .btn:active svg, #dpad .btn.pressed svg {
    stroke: var(--accent);
  }
  #dpad .btn.up    { top: 0;   left: 56px; }
  #dpad .btn.left  { top: 56px; left: 0; }
  #dpad .btn.right { top: 56px; right: 0; }
  #dpad .btn.down  { top: 112px; left: 56px; }

  /* Options Menu */
  #options-btn {
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: #888;
    font-size: 1.3rem;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 8px;
  }
  #options-btn:active { background: rgba(255,255,255,0.12); }
  #options-panel {
    display: none;
    position: fixed;
    inset: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 30;
    padding: 20px;
  }
  #options-panel.visible { display: flex; }
  #options-panel h2 { font-size: 1.6rem; color: var(--accent); margin-bottom: 24px; }
  .theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 340px;
  }
  .theme-btn {
    background: rgba(255,255,255,0.04);
    border: 2px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
  }
  .theme-btn:active { transform: scale(0.95); }
  .theme-btn.selected {
    border-color: var(--accent);
    background: var(--accent-glow-soft);
    box-shadow: 0 0 20px var(--accent-glow);
  }
  .theme-random-btn {
    width: 100%;
    color: var(--accent);
    font: inherit;
    border-style: dashed;
  }

  .golden-secret-theme {
    position: relative;
    overflow: hidden;
    border-color: #ffd447;
    background:
      radial-gradient(circle at 50% 28%, rgba(255,243,166,0.2), transparent 36%),
      linear-gradient(145deg, rgba(255,112,207,0.12), rgba(119,231,255,0.08)),
      var(--panel);
    box-shadow: inset 0 -3px rgba(255,212,71,0.72), 0 0 18px rgba(255,212,71,0.2);
  }
  .golden-secret-theme[hidden] { display: none; }

  .golden-secret-theme::after {
    content: 'SECRET';
    position: absolute;
    top: 5px;
    right: 4px;
    color: #fff3a6;
    font-family: var(--pixel-font);
    font-size: 0.42rem;
    letter-spacing: 0.08em;
  }

  body.golden-secret #vs-live-btn,
  body.golden-secret #lbBtn,
  body.golden-secret #player-btn,
  body.golden-secret #shareBtn,
  body.golden-secret #whats-new-btn,
  body.golden-secret #how-to-play-btn,
  body.golden-secret #display-name-invite,
  body.golden-secret .ov-content > .menu-kicker,
  body.golden-secret .game-mode-toggle,
  body.golden-secret #dailyChallengeInfo {
    display: none !important;
  }

  body.golden-secret #overlay .ov-content {
    border-color: rgba(255,212,71,0.72);
    background:
      radial-gradient(circle at 50% 10%, rgba(255,243,166,0.15), transparent 30%),
      linear-gradient(135deg, rgba(255,112,207,0.09), rgba(119,231,255,0.05) 55%, transparent),
      var(--panel-strong);
  }

  body.golden-secret #hud-mode {
    color: #fff3a6;
    border-color: rgba(255,212,71,0.62);
    background: rgba(255,212,71,0.09);
  }
  .theme-random-btn[hidden] { display: none; }
  .theme-random-btn .theme-icon { filter: drop-shadow(0 0 8px var(--accent-glow)); }
  .theme-random-btn .theme-name { color: var(--accent); }
  .theme-btn .theme-icon { display:flex; align-items:center; justify-content:center; width:48px; height:48px; }
  .theme-btn .theme-icon svg, .theme-btn .theme-icon canvas { width:100%; height:100%; image-rendering: pixelated; }
  .icon { width:1em; height:1em; vertical-align:middle; display:inline-block; }
  .icon svg { width:100%; height:100%; display:block; }
  .theme-btn .theme-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #aaa;
    text-align: center;
  }
  .theme-btn.selected .theme-name { color: var(--accent); }
  #options-back {
    margin-top: 24px;
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    padding: 12px 36px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
  }
  #options-back:active { transform: scale(0.95); background: var(--accent-glow-mid); }

  /* Persistent Player Identity */
  #player-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 45;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  #player-panel.visible { display: flex; }
  #notifications-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 45;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    background: #010504;
  }
  #notifications-panel.visible { display: flex; }
  .notifications-card {
    width: min(100%, 410px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    padding: 28px 24px 24px;
    background: var(--panel-strong);
    border: 1px solid #ffcf40;
    box-shadow: 4px 4px 0 #000, 0 0 24px rgba(255,207,64,0.14);
    text-align: center;
  }
  .notifications-card h2 {
    margin: 4px 0 10px;
    color: #ffcf40;
    font-family: var(--pixel-font);
    font-size: 1.25rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .notifications-card h2:focus { outline: none; }
  #notifications-panel button {
    min-height: 42px;
    border: 1px solid rgba(255,207,64,0.62);
    border-radius: 0;
    background: transparent;
    color: #ffcf40;
    cursor: pointer;
    font-family: var(--pixel-font);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 10px 12px;
    text-transform: uppercase;
  }
  #notifications-back { width: 100%; margin-top: 16px; }
  .player-card {
    width: min(100%, 390px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    padding: 28px 24px 24px;
    background: var(--panel-strong);
    border: 1px solid var(--accent-dim);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.9), 0 0 28px var(--accent-glow-soft);
    text-align: center;
  }
  .player-card h2 {
    margin: 4px 0 12px;
    color: var(--accent);
    font-family: var(--pixel-font);
    font-size: 1.35rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
  }
  #player-vs-invite-gate {
    margin: 0 0 18px;
    padding: 13px 12px 14px;
    border: 1px solid var(--accent);
    background:
      repeating-linear-gradient(135deg, transparent 0 8px, var(--accent-glow-soft) 8px 10px),
      rgba(0,0,0,0.48);
    box-shadow: inset 0 0 18px var(--accent-glow-soft), 0 0 16px var(--accent-glow-soft);
    font-family: var(--pixel-font);
  }
  #player-vs-invite-gate[hidden] { display: none; }
  .player-vs-invite-kicker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--accent);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    line-height: 1.4;
    text-transform: uppercase;
  }
  .player-vs-invite-kicker svg { width: 16px; height: 16px; fill: currentColor; flex: 0 0 auto; }
  .player-vs-invite-kicker b { color: var(--text); letter-spacing: 0.14em; }
  #player-vs-invite-gate h3 {
    margin: 10px 0 7px;
    color: var(--text);
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  #player-vs-invite-gate p {
    margin: 0;
    color: var(--muted);
    font-size: 0.66rem;
    line-height: 1.6;
  }
  #player-identity-status {
    margin-bottom: 18px;
    color: var(--text);
    font-family: var(--pixel-font);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    line-height: 1.6;
  }
  #player-identity-status .player-tag { color: var(--accent); }
  .player-field-label {
    display: block;
    margin: 14px 0 7px;
    color: var(--muted);
    font-family: var(--pixel-font);
    font-size: 0.58rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  #player-panel input[type="text"],
  #player-panel input[type="email"] {
    width: 100%;
    min-height: 42px;
    box-sizing: border-box;
    border: 1px solid var(--accent-dim);
    border-radius: 0;
    outline: none;
    background: rgba(255,255,255,0.04);
    color: var(--text);
    font-family: var(--pixel-font);
    font-size: 16px;
    padding: 10px 12px;
    text-align: center;
  }
  #player-panel input:focus { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
  #player-initials-input { letter-spacing: 0.35em; text-transform: uppercase; }
  #player-otp-input {
    letter-spacing: 0.35em;
  }
  .player-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
  }
  .player-actions.single-action { grid-template-columns: 1fr; }
  #player-panel button {
    min-height: 42px;
    border: 1px solid var(--accent-dim);
    border-radius: 0;
    cursor: pointer;
    background: transparent;
    color: var(--accent);
    font-family: var(--pixel-font);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 10px 12px;
    text-transform: uppercase;
  }
  #player-panel button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #020504;
  }
  #player-panel button:disabled { cursor: default; opacity: 0.38; }
  #player-profile-setup,
  #player-account-setup,
  #player-otp-group { margin-top: 14px; }
  #player-otp-group { display: none; }
  #player-otp-group.visible { display: block; }
  .player-help {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.45;
  }
  .player-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0 4px;
    padding: 11px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-family: var(--pixel-font);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-align: left;
  }
  .player-toggle + .player-toggle { margin-top: 0; border-top: 0; }
  .player-toggle span { min-width: 0; }
  .player-toggle small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.4;
  }
  .player-toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
  #analytics-consent-status {
    margin-top: 6px;
    color: var(--accent);
    font-family: var(--pixel-font);
    font-size: 0.56rem;
    letter-spacing: 0.05em;
  }
  .player-privacy-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--muted);
    font-family: var(--pixel-font);
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-decoration-color: var(--accent-dim);
    text-underline-offset: 4px;
    text-transform: uppercase;
  }
  .player-privacy-link:hover,
  .player-privacy-link:focus-visible {
    color: var(--accent);
    outline: none;
  }
  #podium-watch-status {
    margin-top: 6px;
    color: var(--accent);
    font-family: var(--pixel-font);
    font-size: 0.56rem;
    letter-spacing: 0.05em;
  }
  .podium-signal-relay {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid rgba(255, 207, 64, 0.62);
    background:
      repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,0.025) 3px 4px),
      linear-gradient(135deg, rgba(255,207,64,0.1), rgba(0,0,0,0.64));
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.65);
    text-align: left;
  }
  .podium-signal-relay[hidden] { display: none; }
  .podium-signal-relay header { display: flex; align-items: center; gap: 10px; }
  .podium-signal-relay header small,
  .podium-signal-relay header strong { display: block; font-family: var(--pixel-font); text-transform: uppercase; }
  .podium-signal-relay header small { color: var(--muted); font-size: 0.48rem; letter-spacing: 0.12em; }
  .podium-signal-relay header strong { margin-top: 4px; color: #ffcf40; font-size: 0.68rem; letter-spacing: 0.12em; }
  .podium-relay-mark {
    position: relative;
    width: 28px;
    height: 28px;
    border: 1px solid #ffcf40;
    background: #120d00;
    box-shadow: 0 0 10px rgba(255,207,64,0.24);
  }
  .podium-relay-mark::before,
  .podium-relay-mark::after,
  .podium-relay-mark i { position: absolute; content: ''; display: block; }
  .podium-relay-mark i { left: 12px; bottom: 5px; width: 4px; height: 4px; background: #ffcf40; }
  .podium-relay-mark::before { left: 8px; bottom: 8px; width: 10px; height: 10px; border: 2px solid #ffcf40; border-left-color: transparent; border-bottom-color: transparent; transform: rotate(-45deg); }
  .podium-relay-mark::after { left: 5px; bottom: 8px; width: 16px; height: 16px; border: 1px solid rgba(255,207,64,0.62); border-left-color: transparent; border-bottom-color: transparent; transform: rotate(-45deg); }
  .podium-signal-relay > p { margin: 10px 0 0; color: var(--muted); font-size: 0.64rem; line-height: 1.45; }
  .podium-signal-relay .podium-push-status { color: #ffcf40; font-family: var(--pixel-font); font-size: 0.5rem; letter-spacing: 0.06em; }
  .podium-relay-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; }
  #notifications-panel .podium-relay-actions button {
    min-height: 38px;
    padding: 8px 10px;
    border-color: rgba(255,207,64,0.62);
    color: #ffcf40;
    font-size: 0.52rem;
  }
  #podium-push-test[hidden] { display: none; }
  .signal-relay-topic { margin-top: 12px; }

  #lbBtn { position: relative; }
  #podium-watch-signal {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    margin-left: auto;
    padding: 0 4px;
    box-sizing: border-box;
    border: 1px solid #ffcf40;
    background: #ffcf40;
    color: #160d00;
    font-family: var(--pixel-font);
    font-size: 0.52rem;
    line-height: 1;
    box-shadow: 0 0 10px rgba(255, 207, 64, 0.55);
  }
  #podium-watch-signal[hidden] { display: none; }

  #podium-watch-invite {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    margin: 14px 0 0;
    padding: 12px;
    border: 1px solid #ffcf40;
    background: linear-gradient(135deg, rgba(255,207,64,0.14), rgba(0,0,0,0.72));
    text-align: left;
  }
  #podium-watch-invite[hidden] { display: none; }
  #podium-watch-invite div { grid-column: 1 / -1; }
  #podium-watch-invite strong,
  #podium-watch-invite span { display: block; }
  #podium-watch-invite strong {
    color: #ffcf40;
    font-family: var(--pixel-font);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  #podium-watch-invite span { margin-top: 6px; color: var(--muted); font-size: 0.68rem; line-height: 1.5; }
  #podium-watch-invite button {
    min-height: 38px;
    border: 1px solid var(--accent-dim);
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-family: var(--pixel-font);
    font-size: 0.58rem;
    text-transform: uppercase;
  }
  #podium-watch-invite-enable { border-color: #ffcf40 !important; color: #ffcf40 !important; }

  #podium-transmission {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 130;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  #podium-transmission.visible { display: flex; }
  .podium-transmission-card {
    width: min(100%, 390px);
    padding: 18px;
    border: 2px solid #ffcf40;
    background:
      repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,0.025) 3px 4px),
      #070b09;
    box-shadow: 6px 6px 0 #1a1000, 0 0 32px rgba(255,207,64,0.24);
  }
  .podium-transmission-card header { display: flex; align-items: center; gap: 12px; text-align: left; }
  .podium-transmission-card header img { width: 62px; height: auto; image-rendering: auto; }
  .podium-transmission-card header span,
  .podium-transmission-card header strong { display: block; font-family: var(--pixel-font); text-transform: uppercase; }
  .podium-transmission-card header span { color: #ffcf40; font-size: 0.5rem; letter-spacing: 0.18em; }
  .podium-transmission-card header strong { margin-top: 5px; color: var(--text); font-size: 0.82rem; line-height: 1.4; }
  .podium-transmission-screen {
    margin: 16px 0;
    padding: 18px 14px;
    border: 1px solid rgba(255,207,64,0.48);
    background: rgba(255,207,64,0.055);
    text-align: center;
  }
  .podium-transmission-screen span { color: var(--muted); font-family: var(--pixel-font); font-size: 0.57rem; letter-spacing: 0.1em; text-transform: uppercase; }
  .podium-transmission-screen strong { display: block; margin: 13px 0 10px; color: #ffcf40; font-family: var(--pixel-font); font-size: clamp(1.65rem, 8vw, 2.35rem); text-shadow: 3px 3px 0 #503b00; }
  .podium-transmission-screen p { margin: 0; color: var(--text); font-size: 0.76rem; line-height: 1.55; }
  .podium-transmission-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .podium-transmission-actions button {
    min-height: 43px;
    border: 1px solid #ffcf40;
    border-radius: 0;
    background: transparent;
    color: #ffcf40;
    font-family: var(--pixel-font);
    font-size: 0.58rem;
    text-transform: uppercase;
  }
  .podium-transmission-actions .primary { grid-column: 1 / -1; background: #ffcf40; color: #160d00; }
  .podium-transmission-actions button[hidden] { display: none; }
  .podium-transmission-card > small { display: block; margin-top: 12px; color: var(--muted); font-size: 0.58rem; line-height: 1.5; text-align: center; }

  #daily-podium-ceremony {
    --podium-primary: #f6ff4b;
    --podium-secondary: #85ff00;
    --podium-accent: #00efff;
    display: none;
    position: fixed;
    inset: 0;
    z-index: 190;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background: #010403;
    color: #f6fff8;
  }
  #daily-podium-ceremony.visible { display: flex; }
  #daily-podium-ceremony[data-place="2"] {
    --podium-primary: #d9f5ff;
    --podium-secondary: #8abaff;
    --podium-accent: #00efff;
  }
  #daily-podium-ceremony[data-place="3"] {
    --podium-primary: #ffb04a;
    --podium-secondary: #ff6b28;
    --podium-accent: #9cff21;
  }
  .daily-podium-cabinet {
    position: relative;
    width: min(100%, 500px);
    min-height: min(760px, calc(100dvh - 20px));
    padding: clamp(12px, 3vw, 20px);
    overflow: hidden;
    border: 3px solid var(--podium-primary);
    outline: 4px solid #071410;
    background: #020807;
    box-shadow: 8px 8px 0 #000, -5px -5px 0 #0b2019;
    text-align: center;
  }
  .daily-podium-cabinet::before {
    content: "";
    position: absolute;
    inset: 7px;
    z-index: 0;
    border: 1px solid color-mix(in srgb, var(--podium-accent) 45%, transparent);
    pointer-events: none;
  }
  .daily-podium-cabinet > * { position: relative; z-index: 2; }
  .daily-podium-boot {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    width: min(230px, 70%);
    height: 5px;
    margin: 0 auto 8px;
  }
  .daily-podium-boot span { background: #15382e; }
  #daily-podium-ceremony[data-phase="boot"] .daily-podium-boot span,
  #daily-podium-ceremony[data-phase="signal"] .daily-podium-boot span,
  #daily-podium-ceremony[data-phase="reveal"] .daily-podium-boot span,
  #daily-podium-ceremony[data-phase="payoff"] .daily-podium-boot span,
  #daily-podium-ceremony[data-phase="final"] .daily-podium-boot span {
    animation: daily-podium-boot 620ms steps(5, end) both;
  }
  .daily-podium-boot span:nth-child(2) { animation-delay: 70ms !important; }
  .daily-podium-boot span:nth-child(3) { animation-delay: 140ms !important; }
  .daily-podium-boot span:nth-child(4) { animation-delay: 210ms !important; }
  .daily-podium-boot span:nth-child(5) { animation-delay: 280ms !important; }
  .daily-podium-boot-label {
    min-height: 16px;
    margin: 0;
    color: var(--podium-accent);
    font-family: var(--pixel-font);
    font-size: clamp(0.48rem, 2.4vw, 0.65rem);
    letter-spacing: 0.16em;
    text-transform: uppercase;
  }
  .daily-podium-stage {
    position: relative;
    display: grid;
    place-items: end center;
    height: clamp(228px, 39vh, 330px);
    margin: 2px auto 0;
    overflow: hidden;
  }
  .daily-podium-stage > img {
    position: relative;
    z-index: 5;
    width: clamp(128px, 43vw, 220px);
    height: auto;
    opacity: 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    transform: translateY(28px);
  }
  #daily-podium-ceremony[data-phase="reveal"] .daily-podium-stage > img,
  #daily-podium-ceremony[data-phase="payoff"] .daily-podium-stage > img,
  #daily-podium-ceremony[data-phase="final"] .daily-podium-stage > img {
    opacity: 1;
    transform: translateY(0);
    animation: daily-podium-rise 680ms steps(8, end) both;
  }
  .daily-podium-beam {
    position: absolute;
    z-index: 1;
    top: 0;
    bottom: 0;
    width: 34%;
    opacity: 0;
    background: var(--podium-accent);
    clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  }
  .daily-podium-beam.beam-left { left: 4%; transform: rotate(-13deg); transform-origin: 50% 0; }
  .daily-podium-beam.beam-center { left: 33%; background: var(--podium-secondary); }
  .daily-podium-beam.beam-right { right: 4%; transform: rotate(13deg); transform-origin: 50% 0; }
  #daily-podium-ceremony[data-phase="signal"] .daily-podium-beam,
  #daily-podium-ceremony[data-phase="reveal"] .daily-podium-beam,
  #daily-podium-ceremony[data-phase="payoff"] .daily-podium-beam,
  #daily-podium-ceremony[data-phase="final"] .daily-podium-beam { opacity: 0.08; }
  .daily-podium-rays { position: absolute; z-index: 2; inset: 44% 50% auto; }
  .daily-podium-rays i {
    position: absolute;
    left: -3px;
    bottom: 0;
    width: 6px;
    height: clamp(95px, 18vh, 150px);
    background: var(--podium-primary);
    opacity: 0;
    transform-origin: 50% 100%;
  }
  .daily-podium-rays i:nth-child(1) { transform: rotate(0deg); }
  .daily-podium-rays i:nth-child(2) { transform: rotate(28deg); }
  .daily-podium-rays i:nth-child(3) { transform: rotate(56deg); }
  .daily-podium-rays i:nth-child(4) { transform: rotate(84deg); }
  .daily-podium-rays i:nth-child(5) { transform: rotate(-28deg); }
  .daily-podium-rays i:nth-child(6) { transform: rotate(-56deg); }
  .daily-podium-rays i:nth-child(7) { transform: rotate(-84deg); }
  .daily-podium-rays i:nth-child(8) { transform: rotate(180deg); }
  #daily-podium-ceremony[data-phase="reveal"] .daily-podium-rays i,
  #daily-podium-ceremony[data-phase="payoff"] .daily-podium-rays i,
  #daily-podium-ceremony[data-phase="final"] .daily-podium-rays i { opacity: 0.32; }
  #daily-podium-ceremony[data-place="2"] .daily-podium-rays i:nth-child(n+7),
  #daily-podium-ceremony[data-place="3"] .daily-podium-rays i:nth-child(n+5) { display: none; }
  .daily-podium-confetti { position: absolute; z-index: 6; inset: 0; pointer-events: none; }
  .daily-podium-confetti i {
    position: absolute;
    top: -12px;
    width: 7px;
    height: 11px;
    opacity: 0;
    background: var(--podium-primary);
  }
  .daily-podium-confetti i:nth-child(3n+2) { background: var(--podium-secondary); }
  .daily-podium-confetti i:nth-child(3n) { background: var(--podium-accent); }
  .daily-podium-confetti i:nth-child(1) { left: 6%; --fall: 190px; --delay: 0ms; }
  .daily-podium-confetti i:nth-child(2) { left: 14%; --fall: 252px; --delay: 210ms; }
  .daily-podium-confetti i:nth-child(3) { left: 23%; --fall: 168px; --delay: 90ms; }
  .daily-podium-confetti i:nth-child(4) { left: 32%; --fall: 228px; --delay: 330ms; }
  .daily-podium-confetti i:nth-child(5) { left: 40%; --fall: 142px; --delay: 150ms; }
  .daily-podium-confetti i:nth-child(6) { left: 47%; --fall: 270px; --delay: 30ms; }
  .daily-podium-confetti i:nth-child(7) { left: 55%; --fall: 202px; --delay: 270ms; }
  .daily-podium-confetti i:nth-child(8) { left: 63%; --fall: 158px; --delay: 120ms; }
  .daily-podium-confetti i:nth-child(9) { left: 71%; --fall: 246px; --delay: 360ms; }
  .daily-podium-confetti i:nth-child(10) { left: 80%; --fall: 176px; --delay: 60ms; }
  .daily-podium-confetti i:nth-child(11) { left: 88%; --fall: 232px; --delay: 240ms; }
  .daily-podium-confetti i:nth-child(12) { left: 95%; --fall: 152px; --delay: 390ms; }
  #daily-podium-ceremony[data-phase="reveal"] .daily-podium-confetti i,
  #daily-podium-ceremony[data-phase="payoff"] .daily-podium-confetti i {
    animation: daily-podium-confetti 1050ms steps(7, end) var(--delay) both;
  }
  .daily-podium-result { opacity: 0; transform: translateY(9px); }
  #daily-podium-ceremony[data-phase="reveal"] .daily-podium-result,
  #daily-podium-ceremony[data-phase="payoff"] .daily-podium-result,
  #daily-podium-ceremony[data-phase="final"] .daily-podium-result {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 140ms steps(2, end), transform 210ms steps(4, end);
  }
  .daily-podium-result > span {
    color: var(--podium-accent);
    font-family: var(--pixel-font);
    font-size: 0.48rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .daily-podium-result h2 {
    margin: 7px 0 8px;
    color: var(--podium-primary);
    font-family: var(--pixel-font);
    font-size: clamp(1.18rem, 6.3vw, 2rem);
    line-height: 1.12;
    text-shadow: 3px 3px 0 #0b2119;
  }
  .daily-podium-scoreline {
    display: flex;
    justify-content: center;
    gap: 10px;
    color: #b5cbc4;
    font-family: var(--pixel-font);
    font-size: 0.52rem;
    letter-spacing: 0.08em;
  }
  .daily-podium-scoreline strong { color: #fff; font-weight: 400; }
  .daily-podium-scoreline b { color: var(--podium-accent); }
  #daily-podium-award {
    margin: 8px 0 0;
    color: var(--podium-secondary);
    font-family: var(--pixel-font);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
  }
  .daily-podium-archive { margin-top: 8px; }
  .daily-podium-archive > strong {
    display: block;
    color: var(--podium-accent);
    font-family: var(--pixel-font);
    font-size: 0.48rem;
    letter-spacing: 0.1em;
  }
  #daily-podium-archive-list {
    margin-top: 6px;
    overflow: hidden;
  }
  #daily-podium-archive-list[hidden] { display: none; }
  .daily-podium-archive-track {
    display: flex;
    gap: 6px;
  }
  .daily-podium-archive-track.is-animated {
    animation: daily-podium-archive 4s steps(var(--archive-steps), end) infinite alternate;
  }
  #daily-podium-archive-list span {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 4px;
    border: 1px solid #285149;
    background: #06110e;
    font-family: var(--pixel-font);
    text-align: left;
  }
  #daily-podium-archive-list small,
  #daily-podium-archive-list strong,
  #daily-podium-archive-list b { display: block; }
  #daily-podium-archive-list small { color: #9db6af; font-size: 0.38rem; }
  #daily-podium-archive-list strong { margin-top: 3px; color: var(--podium-primary); font-size: 0.52rem; }
  #daily-podium-archive-list b { margin-top: 3px; color: var(--podium-accent); font-size: 0.43rem; }
  .daily-podium-payoff {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 4px 10px;
    align-items: center;
    margin-top: 10px;
    padding: 9px 10px;
    border: 2px solid var(--podium-accent);
    border-left-width: 7px;
    background: #04110e;
    opacity: 0;
    transform: translateY(10px);
  }
  #daily-podium-ceremony[data-phase="payoff"] .daily-podium-payoff,
  #daily-podium-ceremony[data-phase="final"] .daily-podium-payoff {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 150ms steps(2, end), transform 220ms steps(4, end);
  }
  .daily-podium-payoff img { grid-row: 1 / 3; width: 44px; height: 44px; image-rendering: pixelated; }
  .daily-podium-payoff > span { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .daily-podium-payoff small { color: var(--podium-accent); font-family: var(--pixel-font); font-size: 0.48rem; letter-spacing: 0.08em; }
  .daily-podium-payoff strong { color: #fff; font-family: var(--pixel-font); font-size: 0.68rem; }
  .daily-podium-payoff strong b { color: var(--podium-primary); font-size: 1.08rem; }
  .daily-podium-payoff p { grid-column: 2; margin: 0; color: #a9c2bb; font-size: 0.52rem; line-height: 1.35; text-align: left; }
  .daily-podium-status { min-height: 15px; margin: 5px 0 0; color: #ff9e4a; font-family: var(--pixel-font); font-size: 0.45rem; }
  .daily-podium-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
  }
  #daily-podium-ceremony[data-phase="payoff"] .daily-podium-actions,
  #daily-podium-ceremony[data-phase="final"] .daily-podium-actions {
    opacity: 1;
    pointer-events: auto;
  }
  .daily-podium-actions button {
    min-height: 42px;
    border: 2px solid var(--podium-primary);
    border-radius: 0;
    background: #020807;
    color: var(--podium-primary);
    font-family: var(--pixel-font);
    font-size: 0.55rem;
    text-transform: uppercase;
  }
  .daily-podium-actions button.primary { background: var(--podium-primary); color: #06100d; }
  .daily-podium-actions button:focus-visible { outline: 3px solid var(--podium-accent); outline-offset: 2px; }
  .daily-podium-actions button:disabled { opacity: 0.55; }

  @keyframes daily-podium-boot {
    0% { background: #15382e; }
    50%, 100% { background: var(--podium-accent); }
  }
  @keyframes daily-podium-rise {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes daily-podium-confetti {
    0% { opacity: 0; transform: translate(0, 0) rotate(0); }
    12% { opacity: 1; }
    100% { opacity: 0; transform: translate(18px, var(--fall)) rotate(180deg); }
  }
  @keyframes daily-podium-archive {
    from { transform: translateX(0); }
    to { transform: translateX(var(--archive-shift)); }
  }

  @media (max-height: 690px) {
    .daily-podium-cabinet { min-height: 0; padding: 10px 12px; }
    .daily-podium-stage { height: 212px; }
    .daily-podium-stage > img { width: 128px; }
    .daily-podium-result h2 { margin: 4px 0 5px; font-size: 1.05rem; }
    #daily-podium-award { margin-top: 5px; }
    .daily-podium-payoff { margin-top: 7px; padding-block: 6px; }
    .daily-podium-actions button { min-height: 36px; }
  }

  @media (prefers-reduced-motion: reduce) {
    #daily-podium-ceremony *,
    #daily-podium-ceremony *::before,
    #daily-podium-ceremony *::after {
      animation: none !important;
      transition: none !important;
    }
    #daily-podium-ceremony[data-phase="final"] .daily-podium-stage > img,
    #daily-podium-ceremony[data-phase="final"] .daily-podium-result,
    #daily-podium-ceremony[data-phase="final"] .daily-podium-payoff,
    #daily-podium-ceremony[data-phase="final"] .daily-podium-actions { opacity: 1; transform: none; }
    #daily-podium-ceremony[data-phase="final"] .daily-podium-rays i { opacity: 0.2; }
    #daily-podium-ceremony[data-phase="final"] .daily-podium-beam { opacity: 0.06; }
    .daily-podium-confetti { display: none; }
  }

  .vs-challenge-transmission { position: fixed; inset: 0; z-index: 160; display: none; place-items: center; padding: 18px; background: rgba(0,0,0,.88); }
  .vs-challenge-transmission.visible { display: grid; }
  .vs-challenge-card { width: min(100%,420px); padding: 18px; border: 3px solid #ffcf40; background: radial-gradient(circle at 50% 0,#3c1730,#090609 65%); box-shadow: 0 0 0 4px #130b00,0 0 36px rgba(255,55,108,.35); }
  .vs-challenge-card header { display:flex; align-items:center; gap:12px; text-align:left; }
  .vs-challenge-card header img { width:76px; image-rendering:pixelated; }
  .vs-challenge-card header span,.vs-challenge-card header strong { display:block; font-family:var(--pixel-font); text-transform:uppercase; }
  .vs-challenge-card header span { color:#ffcf40; font-size:.48rem; letter-spacing:.12em; }
  .vs-challenge-card header strong { margin-top:6px; color:#fff; font-size:.95rem; }
  .vs-challenge-screen { margin:16px 0; padding:18px 12px; border:2px inset #692642; background:#050305; text-align:center; }
  .vs-challenge-screen > span,.vs-challenge-screen > strong { display:block; font-family:var(--pixel-font); text-transform:uppercase; }
  .vs-challenge-screen > span { color:#ff7198; font-size:.75rem; }
  .vs-challenge-screen > strong { margin:12px 0; color:#ffcf40; font-size:2rem; text-shadow:3px 3px #5b4100; }
  .vs-challenge-screen p { color:#fff; font: .56rem/1.7 var(--pixel-font); }
  .vs-challenge-screen small { color:var(--muted); font-size:.63rem; line-height:1.5; }
  .vs-challenge-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
  .vs-challenge-actions button { min-height:42px; border:1px solid #7e3150; background:#120810; color:#fff; font:.55rem var(--pixel-font); text-transform:uppercase; }
  .vs-challenge-actions .primary { grid-column:1/-1; border-color:#ffcf40; background:#ffcf40; color:#190e00; }
  .vs-challenge-actions button[hidden] { display:none; }

  #player-message {
    min-height: 1.4em;
    margin: 12px 0 0;
    color: var(--accent);
    font-size: 0.72rem;
    line-height: 1.45;
  }
  #player-message.error { color: #ff8b8b; }
  #player-back { width: 100%; margin-top: 16px; }
  #player-display-setup { margin-top: 16px; }
  #player-display-name-save { width: 100%; margin-top: 8px; }
  .lb-player-link {
    appearance: none;
    -webkit-appearance: none;
    display: inline;
    border: 0;
    border-bottom: 1px dotted currentColor;
    border-radius: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    padding: 0 0 1px;
    text-align: inherit;
    touch-action: manipulation;
  }
  .lb-player-link:hover { color: var(--accent); border-bottom-style: solid; }
  .lb-player-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }
  #public-player-card-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 120;
    width: 100%;
    height: 100dvh;
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    overflow: hidden;
    background:
      linear-gradient(90deg, rgba(37,220,255,.05) 1px, transparent 1px),
      linear-gradient(rgba(37,220,255,.04) 1px, transparent 1px),
      radial-gradient(circle at 50% 42%, rgba(37,220,255,.15), transparent 48%),
      #010408;
    background-size: 24px 24px, 24px 24px, auto, auto;
  }
  #public-player-card-panel.visible { display: block; }
  .public-player-card {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    justify-items: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 8px 0 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-family: var(--pixel-font);
    text-align: center;
  }
  .public-player-card-semantic-name {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  .public-player-card-stage {
    align-self: center;
    width: min(90vw, 430px, calc((100dvh - 128px) * 2 / 3));
    aspect-ratio: 2 / 3;
    min-width: 0;
    min-height: 0;
  }
  #public-player-card-message {
    min-height: 18px;
    margin: 0;
    color: #8fc8c4;
    font-size: max(12px, .68rem);
    line-height: 1.3;
  }
  #public-player-card-close {
    width: min(100%, 430px);
    min-height: 50px;
    margin: 0;
    border: 2px solid #25dcff;
    border-radius: 0;
    background: #06110c;
    color: #65ff35;
    box-shadow: inset 0 -5px #001b11, 0 0 14px rgba(37,220,255,.25);
    cursor: pointer;
    font-family: var(--pixel-font);
    font-size: max(12px, .72rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  @media (max-height: 700px) {
    .public-player-card { gap: 5px; padding-top: 2px; }
    .public-player-card-stage { width: min(72vw, 360px, calc((100dvh - 100px) * 2 / 3)); }
    #public-player-card-close { min-height: 44px; }
  }
  .lb-you-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 4px;
    background: var(--accent);
    color: #020504;
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    vertical-align: 1px;
  }

  /* Controls Edit Mode */
  #settings-btn, #notifications-btn {
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: #888;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px 20px;
    margin-top: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
  }
  #settings-btn:active, #notifications-btn:active { background: rgba(255,255,255,0.12); }
  #controls-edit-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: #010504;
  }
  #controls-edit-overlay.visible {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  #controls-settings-panel {
    width: min(100%, 410px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    padding: 28px 24px 24px;
    background: var(--panel-strong);
    border: 1px solid var(--accent-dim);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.9), 0 0 28px var(--accent-glow-soft);
    text-align: center;
  }
  #controls-settings-panel h2 {
    color: var(--accent);
    font-family: var(--pixel-font);
    font-size: 1.35rem;
    letter-spacing: 0.16em;
    margin: 4px 0 10px;
    text-transform: uppercase;
  }
  .settings-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin: 0 0 18px;
    border-bottom: 2px solid var(--accent-dim);
  }
  .settings-tabs button {
    min-height: 44px;
    padding: 8px 4px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 0;
    background: #06110e;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--pixel-font);
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .settings-tabs button[aria-selected="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #020504;
    box-shadow: 0 -3px 0 #020504 inset, 0 0 14px var(--accent-glow-soft);
  }
  .settings-tabs button:focus-visible { outline: 3px solid #ffcf40; outline-offset: 2px; }
  .settings-tab-panel { min-height: 180px; }
  .settings-tab-panel[hidden] { display: none; }
  .settings-intro {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.5;
  }
  #controls-settings-panel #music-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
  }
  #controls-settings-panel #music-controls .music-toggle {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) minmax(72px, 0.7fr) 48px;
    align-items: center;
    gap: 14px;
    min-height: 92px;
    padding: 14px 16px;
    border: 2px solid #17665d;
    border-left: 6px solid #4ecca3;
    border-bottom: 6px solid #001b18;
    border-radius: 0;
    background: #061a16;
    color: var(--text);
    cursor: pointer;
    font-family: var(--pixel-font);
    text-transform: uppercase;
  }
  #controls-settings-panel #music-controls .music-toggle:focus-visible { outline: 3px solid #ffcf40; outline-offset: 3px; }
  #controls-settings-panel #music-controls .music-toggle:active { transform: translate(2px, 3px); border-bottom-width: 3px; }
  .music-channel-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 3px solid #4ecca3;
    background: #020807;
    box-shadow: 4px 4px 0 #00100d;
  }
  #controls-settings-panel #music-controls .music-toggle svg { width: 25px; height: 25px; color: #4ecca3; }
  .music-channel-copy { display: block; min-width: 0; text-align: left; }
  .music-channel-copy small { display: block; margin-bottom: 7px; color: #00efff; font-size: 0.52rem; letter-spacing: 0.12em; }
  .music-channel-copy strong { display: block; overflow: hidden; color: #f4ffe9; font-size: 0.8rem; letter-spacing: 0.06em; text-overflow: ellipsis; white-space: nowrap; }
  .music-level-meter {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 4px;
    height: 36px;
    padding: 5px 7px;
    border: 1px solid #11463f;
    background: #010705;
  }
  .music-level-meter i { width: 5px; background: #4ecca3; animation: settings-level-pulse 850ms steps(3, end) infinite alternate; }
  .music-level-meter i:nth-child(1) { height: 30%; }
  .music-level-meter i:nth-child(2) { height: 70%; animation-delay: -180ms; }
  .music-level-meter i:nth-child(3) { height: 45%; animation-delay: -360ms; }
  .music-level-meter i:nth-child(4) { height: 90%; animation-delay: -540ms; }
  .music-level-meter i:nth-child(5) { height: 55%; animation-delay: -720ms; }
  .music-level-meter i:nth-child(6) { height: 25%; animation-delay: -270ms; }
  @keyframes settings-level-pulse { from { transform: scaleY(0.45); } to { transform: scaleY(1); } }
  .music-channel-state {
    display: grid;
    place-items: center;
    min-height: 38px;
    border: 2px solid #4ecca3;
    background: #4ecca3;
    color: #00120f;
    font-size: 0.66rem;
    box-shadow: 3px 3px 0 #003b35;
  }
  #controls-settings-panel #music-controls .music-toggle.muted { border-left-color: #7a303f; color: #9aa39f; background: #12090b; }
  #controls-settings-panel #music-controls .music-toggle.muted svg,
  #controls-settings-panel #music-controls .music-toggle.muted .music-channel-copy strong { color: #9a8689; }
  #controls-settings-panel #music-controls .music-toggle.muted .music-channel-icon { border-color: #a33f53; }
  #controls-settings-panel #music-controls .music-toggle.muted .music-level-meter i { height: 3px; animation: none; background: #61313a; }
  #controls-settings-panel #music-controls .music-toggle.muted .music-channel-state { border-color: #a33f53; background: #251015; color: #ff8b9f; box-shadow: 3px 3px 0 #2b080f; }
  @media (prefers-reduced-motion: reduce) {
    .music-level-meter i { animation: none; }
  }
  #settings-graphics .player-toggle { margin-top: 0; }
  .refresh-rate-guide {
    margin-top: 14px;
    padding: 14px;
    border: 2px solid #00efff;
    border-left-width: 5px;
    background: #010b0a;
    box-shadow: inset 0 0 0 3px #041b18, 5px 5px 0 #001d20;
    text-align: left;
  }
  .refresh-rate-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    padding-bottom: 11px;
    border-bottom: 1px solid #15584f;
  }
  .refresh-rate-heading > span:last-child { display: grid; gap: 3px; }
  .refresh-rate-heading small {
    margin: 0;
    color: #ffcf40;
    font-family: var(--pixel-font);
    font-size: 0.52rem;
    letter-spacing: 0.12em;
    line-height: 1;
    text-transform: uppercase;
  }
  .refresh-rate-heading strong {
    color: #00efff;
    font-family: var(--pixel-display-font);
    font-size: 1.08rem;
    letter-spacing: 0.1em;
    line-height: 1;
    text-transform: uppercase;
  }
  .refresh-rate-signal {
    display: flex;
    align-items: end;
    gap: 3px;
    width: 38px;
    height: 38px;
    padding: 7px;
    border: 2px solid #ffcf40;
    box-shadow: inset 0 0 0 2px #3a2700;
  }
  .refresh-rate-signal i { width: 4px; background: #00efff; }
  .refresh-rate-signal i:nth-child(1) { height: 6px; }
  .refresh-rate-signal i:nth-child(2) { height: 11px; }
  .refresh-rate-signal i:nth-child(3) { height: 17px; }
  .refresh-rate-signal i:nth-child(4) { height: 23px; background: #90ff25; }
  .refresh-rate-guide > p { margin: 11px 0 0; color: var(--text); font-size: 0.76rem; line-height: 1.45; }
  .refresh-rate-platforms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
  .refresh-rate-platform {
    position: relative;
    padding: 12px;
    border: 1px solid #25776c;
    border-left-width: 4px;
    background: #03120f;
  }
  .refresh-rate-platform::after { content: ''; position: absolute; right: 7px; top: 8px; width: 6px; height: 6px; background: #90ff25; box-shadow: 0 10px #00efff; }
  .refresh-rate-platform > strong {
    display: block;
    padding-right: 18px;
    color: #4ecca3;
    font-family: var(--pixel-font);
    font-size: 0.72rem;
    letter-spacing: 0.07em;
    line-height: 1.25;
    text-transform: uppercase;
  }
  .refresh-rate-platform ol { display: grid; gap: 7px; margin: 10px 0 0; padding-left: 20px; color: #dce8e4; }
  .refresh-rate-platform li { padding-left: 2px; font-size: clamp(0.76rem, 2.4vw, 0.82rem); line-height: 1.42; }
  .refresh-rate-platform li::marker { color: #ffcf40; font-family: var(--pixel-font); }
  .refresh-rate-platform b { color: #fff; font-weight: 700; }
  .refresh-rate-platform > small { display: block; margin-top: 10px; color: #a2b7b1; font-size: 0.68rem; line-height: 1.45; }
  .chrome-refresh-guide { border-left-color: #ffcf40; }
  .chrome-refresh-guide > strong { color: #ffcf40; }
  @media (max-width: 700px) {
    .refresh-rate-guide { padding: 12px; }
    .refresh-rate-platforms { grid-template-columns: 1fr; }
    .refresh-rate-platform { padding: 11px; }
  }
  #controls-settings-panel .controls-copy,
  #controls-settings-panel .controls-note {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.5;
    margin: 0 auto 18px;
    max-width: 290px;
  }
  #controls-settings-panel .controls-note {
    font-size: 0.68rem;
    margin: 10px auto 0;
  }
  #controls-settings-panel .control-mode-toggle {
    justify-content: center;
    margin: 0 0 18px;
    width: 100%;
  }
  #gamepad-status {
    margin: -8px auto 14px;
    color: var(--muted);
    font-family: var(--pixel-font);
    font-size: 0.56rem;
    letter-spacing: 0.06em;
    line-height: 1.45;
    text-transform: uppercase;
  }
  #gamepad-status.connected {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
  }
  #controls-settings-panel .control-mode-btn {
    flex: 1 1 0;
    min-width: 0;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--line);
    color: var(--muted);
    cursor: pointer;
    font-family: var(--pixel-font);
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    padding: 11px 8px;
    text-transform: uppercase;
  }
  #controls-settings-panel .control-mode-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #020504;
    box-shadow: 0 0 18px var(--accent-glow);
  }
  #controls-customize-btn,
  #controls-back-btn {
    width: 100%;
    border-radius: 0;
    cursor: pointer;
    font-family: var(--pixel-font);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 12px 16px;
    text-transform: uppercase;
  }
  #controls-customize-btn {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #020504;
  }
  #controls-back-btn {
    background: transparent;
    border: 1px solid var(--accent-dim);
    color: var(--accent);
    margin-top: 16px;
  }
  #controls-edit-overlay.customizing #controls-settings-panel { display: none; }

  /* Full-screen cabinet system: Settings is a game state, not a modal card. */
  #controls-edit-overlay.visible:not(.customizing) {
    display: block;
    padding: 0;
    overflow: hidden;
    background:
      linear-gradient(90deg, #00efff 0 4px, #002b29 4px 8px, transparent 8px calc(100% - 8px), #002b29 calc(100% - 8px) calc(100% - 4px), #00efff calc(100% - 4px)),
      #010504;
  }
  #controls-edit-overlay.visible:not(.customizing)::before,
  #controls-edit-overlay.visible:not(.customizing)::after {
    content: '';
    position: fixed;
    z-index: 0;
    left: 8px;
    right: 8px;
    height: 5px;
    background: repeating-linear-gradient(90deg, #004c47 0 18px, #00efff 18px 25px, #001815 25px 38px);
  }
  #controls-edit-overlay.visible:not(.customizing)::before { top: max(env(safe-area-inset-top), 0px); }
  #controls-edit-overlay.visible:not(.customizing)::after { bottom: max(env(safe-area-inset-bottom), 0px); }
  #controls-settings-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(100%, 900px);
    height: 100dvh;
    max-height: none;
    margin: 0 auto;
    overflow: hidden;
    padding: max(calc(env(safe-area-inset-top) + 18px), 24px) clamp(18px, 5vw, 54px) max(calc(env(safe-area-inset-bottom) + 16px), 22px);
    border: 0;
    background:
      repeating-linear-gradient(0deg, rgba(0,239,255,0.025) 0 1px, transparent 1px 5px),
      #03100d;
    box-shadow: -8px 0 0 #001c19, 8px 0 0 #001c19;
    text-align: left;
  }
  .settings-marquee {
    display: grid;
    grid-template-columns: 58px 1fr 12px;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
    padding: 10px 12px 12px;
    border: 2px solid #00efff;
    border-bottom: 5px solid #006f68;
    background: #001c18;
    box-shadow: 5px 5px 0 #000;
  }
  .settings-marquee-snake {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border: 3px solid #00efff;
    background: #030807;
    color: #4ecca3;
    font-family: var(--pixel-font);
    font-size: 2.25rem;
    line-height: 1;
    text-shadow: 3px 0 #006c61, 0 0 10px rgba(0,239,255,0.6);
  }
  .settings-marquee small {
    display: block;
    margin-bottom: 5px;
    color: #ffcf40;
    font-family: var(--pixel-font);
    font-size: 0.58rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
  }
  #controls-settings-panel .settings-marquee h2 {
    margin: 0;
    color: #f4ffe9;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    line-height: 1;
    text-shadow: 3px 3px 0 #006c61;
  }
  .settings-marquee > i {
    width: 10px;
    height: 10px;
    background: #92ff00;
    box-shadow: 0 16px 0 #00efff, 0 -16px 0 #ff315f;
  }
  #controls-settings-panel .settings-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    flex: 0 0 auto;
    gap: 5px;
    margin: 18px 0 0;
    border: 0;
  }
  #controls-settings-panel .settings-tabs button {
    min-height: 50px;
    border: 2px solid #12433d;
    border-bottom: 5px solid #001b18;
    background: #071713;
    font-size: clamp(0.55rem, 2.5vw, 0.72rem);
  }
  #controls-settings-panel .settings-tabs button[aria-selected="true"] {
    border-color: #4ecca3;
    border-bottom-color: #006c61;
    background: #4ecca3;
    box-shadow: none;
  }
  #controls-settings-panel .settings-tab-panel {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 12px;
    overflow-y: auto;
    padding: clamp(18px, 4vw, 34px);
    border: 2px solid #0b5b52;
    border-left: 6px solid #00efff;
    background: rgba(0, 14, 12, 0.94);
    box-shadow: inset 0 0 0 3px #001c19, 5px 5px 0 #000;
    scrollbar-color: #4ecca3 #001b18;
  }
  #controls-settings-panel .settings-intro {
    color: #c4d8d1;
    font-size: clamp(0.78rem, 2.4vw, 0.94rem);
  }
  #controls-settings-panel #controls-back-btn {
    flex: 0 0 auto;
    width: min(100%, 320px);
    min-height: 48px;
    margin: 14px auto 0;
    border: 2px solid #4ecca3;
    border-bottom: 5px solid #005c54;
    background: #061713;
    font-size: 0.72rem;
  }
  .settings-channel-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    text-align: left;
  }
  .settings-channel-heading small,
  .settings-channel-heading strong { display: block; font-family: var(--pixel-font); text-transform: uppercase; }
  .settings-channel-heading small { margin-bottom: 4px; color: #00efff; font-size: 0.55rem; letter-spacing: 0.12em; }
  .settings-channel-heading strong { color: #ffcf40; font-size: 1.1rem; letter-spacing: 0.08em; }
  .settings-speaker-icon,
  .settings-alerts-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 3px solid #ffcf40;
    background: #160f00;
    color: #ffcf40;
    box-shadow: 4px 4px 0 #000;
  }
  .settings-speaker-icon::before,
  .settings-speaker-icon::after,
  .settings-speaker-icon i {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #ffcf40;
  }
  .settings-speaker-icon::before { left: 8px; width: 10px; height: 16px; }
  .settings-speaker-icon i { left: 17px; width: 12px; height: 26px; clip-path: polygon(0 7px, 100% 0, 100% 100%, 0 calc(100% - 7px)); }
  .settings-speaker-icon::after { left: 32px; width: 5px; height: 18px; box-shadow: 6px -6px 0 -1px #ffcf40, 6px 6px 0 -1px #ffcf40; }
  .settings-alerts-icon { border-color: #ff315f; background: #19050b; color: #ff315f; }
  .settings-alerts-icon b { font-family: var(--pixel-font); font-size: 1.5rem; line-height: 1; }
  #controls-settings-panel .settings-alert-toggle {
    min-height: 72px;
    margin: 12px 0 0;
    padding: 11px 14px;
    border: 2px solid #17665d;
    border-left: 6px solid #ff315f;
    background: #071713;
  }
  #controls-settings-panel .settings-alert-toggle.podium-alert-toggle { border-left-color: #00b9aa; }
  #controls-settings-panel .settings-alert-toggle > span {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-align: left;
  }
  #controls-settings-panel .settings-alert-toggle > span > b {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    background: #ff315f;
    color: #fff;
    font-family: var(--pixel-font);
    font-size: 0.66rem;
    box-shadow: 3px 3px 0 #3a0010;
  }
  #controls-settings-panel .podium-alert-toggle > span > b { background: #00b9aa; box-shadow: 3px 3px 0 #003d37; }
  #controls-settings-panel .settings-alert-toggle > span > span { min-width: 0; }
  #controls-settings-panel .settings-alert-toggle > span > span > small { margin-top: 5px; }
  .settings-alert-status {
    margin: 5px 4px 0;
    color: #7ca69f;
    font-family: var(--pixel-font);
    font-size: 0.5rem;
    letter-spacing: 0.06em;
    text-align: left;
    text-transform: uppercase;
  }
  #settings-notifications .podium-signal-relay {
    margin-top: 20px;
    border-color: #00efff;
    background: #001513;
  }
  #settings-notifications .podium-signal-relay .settings-notification-defaults {
    padding-left: 9px;
    border-left: 3px solid #ffcf40;
    color: #dce8e4;
    font-size: 0.7rem;
  }
  .settings-notification-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 2px solid #00efff;
    background: #001e1b;
    color: #00efff;
    box-shadow: 3px 3px 0 #000;
  }
  .settings-notification-icon svg { width: 22px; height: 22px; }
  #settings-notifications .podium-relay-actions button {
    min-height: 46px;
    border-radius: 0;
    font-family: var(--pixel-font);
  }
  @media (max-width: 560px) {
    #controls-settings-panel {
      padding-right: 14px;
      padding-left: 14px;
    }
    .settings-marquee { grid-template-columns: 46px 1fr 8px; gap: 10px; padding: 8px 10px 10px; }
    .settings-marquee-snake { width: 42px; height: 42px; font-size: 1.7rem; }
    #controls-settings-panel .settings-tabs { gap: 3px; margin-top: 12px; }
    #controls-settings-panel .settings-tabs button { min-height: 46px; padding: 6px 2px; letter-spacing: 0.02em; }
    #controls-settings-panel .settings-tab-panel { margin-top: 8px; padding: 16px 13px; }
    #controls-settings-panel #music-controls .music-toggle {
      grid-template-columns: 44px minmax(0, 1fr) 52px;
      gap: 10px;
      min-height: 84px;
      padding: 11px 12px;
    }
    .music-channel-icon { width: 40px; height: 40px; }
    .music-level-meter { display: none; }
    #controls-settings-panel #controls-back-btn { margin-top: 9px; min-height: 44px; }
  }
  @media (max-height: 700px) {
    #controls-settings-panel { padding-top: max(calc(env(safe-area-inset-top) + 9px), 12px); padding-bottom: max(calc(env(safe-area-inset-bottom) + 9px), 12px); }
    .settings-marquee { padding-top: 6px; padding-bottom: 7px; }
    .settings-marquee-snake { width: 38px; height: 38px; font-size: 1.5rem; }
    .settings-marquee small { margin-bottom: 2px; font-size: 0.48rem; }
    #controls-settings-panel .settings-marquee h2 { font-size: 1.05rem; }
    #controls-settings-panel .settings-tabs { margin-top: 8px; }
    #controls-settings-panel .settings-tabs button { min-height: 42px; }
    #controls-settings-panel .settings-tab-panel { margin-top: 6px; padding-top: 12px; padding-bottom: 12px; }
    #controls-settings-panel #controls-back-btn { min-height: 40px; margin-top: 6px; }
  }
  #controls-edit-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: max(env(safe-area-inset-top), 16px) 16px 12px;
    display: none;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    z-index: 41;
  }
  #controls-edit-bar .edit-hint {
    font-size: 0.85rem;
    color: #aaa;
    font-weight: 500;
  }
  #controls-edit-bar .edit-hint .accent { color: var(--accent); }
  #controls-reset-btn, #controls-done-btn {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    color: #ccc;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  #controls-done-btn {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
  }
  #controls-reset-btn:active, #controls-done-btn:active { transform: scale(0.95); }
  #dpad.edit-mode { pointer-events: auto; opacity: 1 !important; z-index: 50 !important; }
  #dpad.edit-mode .btn {
    pointer-events: auto;
    opacity: 0.85;
    background: rgba(78,204,163,0.12);
    border: 2px dashed var(--accent);
    cursor: grab;
    z-index: 50;
  }
  #dpad.edit-mode .btn:active { cursor: grabbing; }
  #dpad.edit-mode .btn.dragging {
    opacity: 1;
    background: rgba(78,204,163,0.25);
    box-shadow: 0 0 20px var(--accent-glow);
  }

  /* Turn Controls edit-mode */
  #turn-controls.edit-mode { pointer-events: auto; opacity: 1 !important; z-index: 50 !important; }
  #turn-controls.edit-mode .turn-btn {
    pointer-events: auto;
    opacity: 0.85;
    background: rgba(78,204,163,0.12);
    border: 2px dashed var(--accent);
    cursor: grab;
    z-index: 50;
  }
  #turn-controls.edit-mode .turn-btn:active { cursor: grabbing; }
  #turn-controls.edit-mode .turn-btn.dragging {
    opacity: 1;
    background: rgba(78,204,163,0.25);
    box-shadow: 0 0 20px var(--accent-glow);
  }

  /* Turn Controls (2-button) */
  #turn-controls {
    position: fixed;
    bottom: max(env(safe-area-inset-bottom), 24px);
    right: max(env(safe-area-inset-right), 16px);
    display: none;
    flex-direction: row;
    gap: 16px;
    z-index: 15;
    opacity: 0.52;
    transition: opacity 0.3s;
  }
  #turn-controls.active { opacity: 1; }
  #turn-controls .turn-btn {
    width: 72px;
    height: 72px;
    background: rgba(255,255,255,0.11);
    border: 1.5px solid rgba(255,255,255,0.22);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.08s, transform 0.08s, box-shadow 0.08s;
    user-select: none;
    -webkit-user-select: none;
  }
  #turn-controls .turn-btn svg {
    width: 32px;
    height: 32px;
    fill: none;
    stroke: rgba(255,255,255,0.72);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  #turn-controls .turn-btn:active, #turn-controls .turn-btn.pressed {
    background: var(--accent-glow-mid);
    border-color: var(--accent-glow);
    box-shadow: 0 0 20px var(--accent-glow), inset 0 0 10px var(--accent-glow-soft);
    transform: scale(0.9);
  }
  #turn-controls .turn-btn:active svg, #turn-controls .turn-btn.pressed svg {
    stroke: var(--accent);
  }
  .control-mode-toggle {
    display: flex;
    gap: 6px;
    margin-top: 8px;
  }

  /* ========================================================
     GLOBAL PIXEL-ARCADE VISUAL SYSTEM
     Theme artwork stays untouched; the shell inherits accents.
     ======================================================== */
  body {
    background:
      radial-gradient(circle at 50% 42%, var(--accent-glow-soft) 0, transparent 38%),
      #000;
  }
  body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 19;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(255,255,255,0.025) 3px 4px);
    mix-blend-mode: screen;
  }
  button, input { font-family: var(--pixel-font); }
button:focus-visible, input:focus-visible, .theme-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

body.controller-navigation :is(button, a, input, select, [role="button"], [tabindex], .theme-btn):focus {
  outline: 2px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 2px #000, 0 0 14px var(--accent-glow);
}

  #score-bar {
    display: grid;
    grid-template-columns: minmax(52px, 1fr) minmax(64px, 78px) 50px 42px minmax(52px, 1fr);
    grid-template-areas: "score mode timer pause best";
    gap: clamp(4px, 1.5vw, 12px);
    padding: max(env(safe-area-inset-top), 8px) clamp(12px, 4vw, 28px) 8px;
    background: linear-gradient(180deg, rgba(1,6,5,0.97), rgba(1,6,5,0.88));
    border-bottom: 1px solid var(--accent-glow);
    box-shadow: 0 5px 20px rgba(0,0,0,0.55);
    font-family: var(--pixel-font);
  }
  .hud-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }
  .hud-score { grid-area: score; align-items: flex-start; text-align: left; }
  .hud-best { grid-area: best; align-items: flex-end; text-align: right; }
  #score-bar.vs-advantage-active {
    grid-template-columns: minmax(22px, 30px) minmax(174px, 760px) minmax(22px, 30px);
    grid-template-areas: "score advantage best";
    justify-content: center;
    gap: clamp(2px, 0.8vw, 6px);
    padding: max(env(safe-area-inset-top), 5px) clamp(8px, 2vw, 18px) 5px;
  }
  #score-bar.vs-advantage-active #hud-mode,
  #score-bar.vs-advantage-active #pause-btn {
    display: none;
  }
  #score-bar.vs-advantage-active .hud-score,
  #score-bar.vs-advantage-active .hud-best {
    position: relative;
    z-index: 3;
    min-height: 24px;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  #score-bar.vs-advantage-active .hud-score {
    align-items: flex-end;
    color: var(--vs-cyan, #25dcff);
    text-align: right;
  }
  #score-bar.vs-advantage-active .hud-best {
    align-items: flex-start;
    color: var(--vs-magenta, #ff4878);
    text-align: left;
  }
  #score-bar.vs-advantage-active .hud-score .label,
  #score-bar.vs-advantage-active .hud-best .label {
    display: none;
  }
  #score-bar.vs-advantage-active .hud-score .val,
  #score-bar.vs-advantage-active .hud-best .val {
    color: currentColor;
    font-size: 0.96rem;
    text-shadow: 0 0 2px currentColor, 0 0 7px currentColor, 0 0 13px currentColor;
  }
  #vs-advantage {
    --vs-cyan: #25dcff;
    --vs-magenta: #ff4878;
    --vs-neutral: #344047;
    grid-area: advantage;
    display: grid;
    grid-template-columns: minmax(174px, 760px);
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    min-width: 0;
    min-height: 24px;
    color: #fff;
    font-family: var(--pixel-font);
    font-size: 0.45rem;
    letter-spacing: 0.08em;
  }
  #vs-advantage[hidden] { display: none; }
  .vs-advantage-side { display: none; }
  .vs-advantage-track {
    position: relative;
    height: 19px;
    overflow: hidden;
    border: 1px solid rgba(196,221,228,0.42);
    background:
      repeating-linear-gradient(90deg, transparent 0 calc(6.25% - 2px), rgba(1,5,9,0.92) calc(6.25% - 2px) 6.25%),
      var(--vs-neutral);
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.82), 0 0 8px rgba(115,143,150,0.2);
  }
  .vs-advantage-fill {
    position: absolute;
    z-index: 1;
    top: 1px;
    bottom: 1px;
    width: calc(50% - 1px);
    background: repeating-linear-gradient(90deg, currentColor 0 calc(12.5% - 2px), rgba(255,255,255,0.18) calc(12.5% - 2px) 12.5%);
    filter: saturate(1.12) brightness(1.08);
    transition: clip-path 260ms steps(8, end), filter 140ms steps(2, end);
  }
  .vs-advantage-fill.player {
    left: 1px;
    color: var(--vs-cyan);
    clip-path: inset(0 0 0 calc(100% - var(--vs-fill, 0%)));
    box-shadow: 7px 0 11px currentColor;
  }
  .vs-advantage-fill.rival {
    right: 1px;
    color: var(--vs-magenta);
    clip-path: inset(0 calc(100% - var(--vs-fill, 0%)) 0 0);
    box-shadow: -7px 0 11px currentColor;
  }
  .vs-advantage-center {
    position: absolute;
    z-index: 2;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: transparent;
    transform: translateX(-50%);
    box-shadow: none;
  }
  #vs-advantage.score-shift .vs-advantage-track {
    animation: vs-advantage-track-hit 360ms steps(3, end);
  }
  #vs-advantage.score-shift .vs-advantage-fill {
    filter: saturate(1.28) brightness(1.55);
  }
  #vs-advantage[data-state="stale"] { opacity: 0.62; }
  #vs-advantage[data-state="stale"] .vs-advantage-track { filter: grayscale(1); }
  #vs-advantage-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  @keyframes vs-advantage-track-hit {
    0%, 100% { transform: scaleY(1); }
    35% { transform: scaleY(1.45); }
    70% { transform: scaleY(0.88); }
  }
  #controls-edit-overlay.customizing #controls-edit-bar { display: flex; }
  #score-bar .label {
    color: var(--muted);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 1.4px;
  }
  #score-bar .val {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 0 12px var(--accent-glow);
  }
  #timer-block { display: flex; visibility: hidden; }
  #timer-block {
    grid-area: timer;
    width: 50px;
    align-items: center;
    justify-self: center;
    text-align: center;
  }
  #timer-block.visible { display: flex; visibility: visible; }
  #vs-advantage-signal { display: none; }
  #score-bar.vs-advantage-active #timer-block {
    grid-area: advantage;
    z-index: 4;
    align-self: center;
    justify-self: center;
    display: grid;
    grid-template-areas: "timer";
    align-items: center;
    width: 43px;
    min-width: 43px;
    min-height: 23px;
    padding: 1px 3px 0;
    visibility: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
  }
  #score-bar.vs-advantage-active #timer-block .label {
    display: none;
  }
  #score-bar.vs-advantage-active #timer {
    grid-area: timer;
    justify-self: center;
    color: #f0fbff;
    font-size: 0.7rem;
    -webkit-text-stroke: 0.75px #010607;
    paint-order: stroke fill;
    text-shadow:
      -1px -1px 0 #010607,
      1px -1px 0 #010607,
      -1px 1px 0 #010607,
      1px 1px 0 #010607,
      0 0 4px #010607,
      0 0 8px #010607;
  }
  #score-bar.vs-advantage-active #vs-advantage-signal {
    display: none;
  }
  #score-bar.vs-advantage-active #vs-advantage-signal[data-advantage-state="player"] {
    color: var(--vs-cyan, #25dcff);
  }
  #score-bar.vs-advantage-active #vs-advantage-signal[data-advantage-state="rival"] {
    color: var(--vs-magenta, #ff4878);
  }
  #hud-mode {
    grid-area: mode;
    align-self: center;
    justify-self: stretch;
    width: 100%;
    color: var(--accent);
    border: 1px solid var(--accent-glow);
    background: var(--accent-glow-soft);
    padding: 4px 6px;
    font-family: var(--pixel-font);
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-align: center;
    white-space: nowrap;
  }
  #pause-btn {
    grid-area: pause;
    align-self: center;
    justify-self: center;
    min-width: 42px;
    min-height: 34px;
    border-radius: 2px;
    background: var(--panel);
    border-color: var(--line);
  }

  canvas {
    border: 2px solid var(--accent-dim);
    border-radius: 1px;
    outline: 1px solid rgba(255,255,255,0.08);
    outline-offset: 3px;
    box-shadow:
      inset 0 0 34px rgba(0,0,0,0.42),
      0 0 0 6px rgba(0,0,0,0.72),
      0 0 28px var(--accent-glow);
  }

  #overlay {
    background: rgba(0,0,0,0.82);
  }
  #overlay .ov-content {
    position: relative;
    isolation: isolate;
    width: min(90vw, 360px);
    padding: clamp(22px, 5vh, 34px) 24px 26px;
    background: transparent;
    border: solid transparent;
    border-width: 0 5px 2px;
    border-radius: 0;
    box-shadow:
      inset 12px 0 22px -18px rgba(0,229,255,0.34),
      inset -12px 0 22px -18px rgba(0,229,255,0.34),
      inset 0 0 42px rgba(0,0,0,0.78);
  }
  #overlay .ov-content::before {
    content: '';
    position: absolute;
    z-index: 0;
    inset: 0 5px;
    pointer-events: none;
    background:
      repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,229,255,0.018) 3px 4px),
      linear-gradient(90deg, rgba(0,0,0,0.9), transparent 7%, transparent 93%, rgba(0,0,0,0.9)),
      linear-gradient(135deg, var(--accent-glow-soft), transparent 38%),
      var(--panel-strong);
    clip-path: polygon(0 0, 100% 0, 100% 19%, calc(100% - 6px) 31%, calc(100% - 6px) 100%, 6px 100%, 6px 31%, 0 19%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px);
    mask-image: linear-gradient(to bottom, transparent 0, #000 24px);
  }
  #overlay .ov-content > .menu-cabinet-shell {
    position: absolute;
    z-index: 0;
    inset: -15px -12px 0;
    display: block;
    width: calc(100% + 24px);
    height: calc(100% + 15px);
    overflow: visible;
    pointer-events: none;
  }
  #overlay .menu-cabinet-rail {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
  }
  #overlay .menu-cabinet-rail path { vector-effect: non-scaling-stroke; }
  #overlay .menu-cabinet-rail-structure {
    stroke: #010407;
    stroke-width: 20;
  }
  #overlay .menu-cabinet-rail-frame {
    stroke: #081820;
    stroke-width: 14;
  }
  #overlay .menu-cabinet-rail-channel {
    stroke: rgba(0,229,255,0.24);
    stroke-width: 7;
  }
  #overlay .menu-cabinet-rail-core {
    stroke: rgba(0,229,255,0.92);
    stroke-width: 2.5;
    filter: drop-shadow(0 0 2px rgba(0,229,255,0.72)) drop-shadow(0 0 8px rgba(0,229,255,0.16));
  }
  #overlay .menu-cabinet-rail-secondary {
    stroke: rgba(30,144,255,0.2);
    stroke-width: 1;
  }
  #overlay .ov-content::after {
    content: '';
    position: absolute;
    z-index: 0;
    inset: 24px 7px 7px;
    pointer-events: none;
    border: 0;
    background:
      linear-gradient(90deg, rgba(0,0,0,0.18), transparent 8%, transparent 92%, rgba(0,0,0,0.18)),
      repeating-linear-gradient(0deg, transparent 0 4px, rgba(0,229,255,0.02) 4px 5px);
    box-shadow:
      inset 0 0 18px rgba(0,0,0,0.42),
      inset 0 0 7px rgba(0,229,255,0.06);
  }
  #overlay .ov-content > * { position: relative; z-index: 1; }
  #overlay h2 {
    font-family: var(--pixel-font);
    font-size: clamp(1.65rem, 7vw, 2.15rem);
    letter-spacing: 4px;
    line-height: 1;
    text-transform: uppercase;
    text-shadow: 0 0 18px var(--accent-glow);
  }
  #overlay h2.menu-brand {
    width: clamp(11rem, min(68vw, 25dvh), 14.5rem);
    aspect-ratio: 72 / 53;
    flex: 0 0 auto;
    overflow: visible;
    margin: -8px auto 9px;
    line-height: 0;
    filter:
      drop-shadow(0 0 15px rgba(255, 176, 38, 0.25))
      drop-shadow(0 0 11px var(--accent-glow));
    text-shadow: none;
  }
  #overlay h2.menu-brand .menu-brand-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: auto;
  }
  #overlay .theme-label {
    color: var(--muted);
    font-family: var(--pixel-font);
    margin-top: 5px;
  }
  #overlay p {
    color: var(--text);
    font-size: 0.98rem;
    margin-bottom: 18px;
  }
  .menu-kicker {
    color: var(--muted);
    font-family: var(--pixel-font);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 7px;
    text-transform: uppercase;
  }
  .game-mode-toggle { margin-bottom: 16px; }
  #overlay .game-mode-btn {
    border-radius: 2px;
    min-height: 34px;
  }
  #overlay #startBtn {
    width: min(100%, 210px);
    min-height: 50px;
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 2px;
    box-shadow: 0 0 20px var(--accent-glow), inset 0 -4px rgba(0,0,0,0.16);
    font-family: var(--pixel-font);
    letter-spacing: 1px;
    text-transform: uppercase;
  }
  #overlay #options-btn, #overlay #settings-btn, #overlay #notifications-btn, #overlay #player-btn, #overlay #stats-btn, #overlay #how-to-play-btn, #overlay #whats-new-btn, #overlay #vs-live-btn,
  #overlay #shareBtn, #overlay #lbBtn {
    width: min(100%, 228px);
    min-height: 42px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent-dim);
    border-radius: 2px;
    color: var(--text);
    font-size: 0.82rem;
    letter-spacing: 0.6px;
    padding: 10px 16px;
    box-shadow: none;
    text-transform: uppercase;
    pointer-events: auto;
    touch-action: manipulation;
  }
  #overlay #options-btn:hover, #overlay #settings-btn:hover, #overlay #notifications-btn:hover, #overlay #player-btn:hover, #overlay #stats-btn:hover, #overlay #how-to-play-btn:hover, #overlay #whats-new-btn:hover, #overlay #vs-live-btn:hover,
  #overlay #shareBtn:hover, #overlay #lbBtn:hover {
    border-color: var(--accent-dim);
    background: var(--accent-glow-soft);
  }
  #overlay #mute-btn { margin-top: 16px; }
  #overlay #music-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: min(100%, 228px);
    height: 42px;
    min-height: 42px;
    margin-top: 16px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent-dim);
    border-radius: 2px;
  }
  #overlay #music-controls .music-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    min-width: 0;
    height: 40px;
    min-height: 40px;
    margin: 0;
    padding: 6px 4px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: var(--text);
    font-size: 0.62rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
  }
  #overlay #music-controls .music-toggle:first-child {
    border-right: 1px solid var(--line);
  }
  #overlay #music-controls .music-toggle:hover,
  #overlay #music-controls .music-toggle:focus-visible {
    background: var(--accent-glow-soft);
    color: #fff;
  }
  #overlay #music-controls .music-toggle.muted { color: #666; }
  #overlay #music-controls .music-toggle b {
    color: var(--accent);
    font-size: 0.53rem;
  }
  #overlay #music-controls .music-toggle.muted b { color: #666; }
  #overlay #shareBtn { display: none; }
  #overlay #lbBtn { display: block; }
  #overlay #options-btn, #overlay #settings-btn, #overlay #notifications-btn, #overlay #player-btn, #overlay #stats-btn, #overlay #whats-new-btn { margin-top: 7px; }
  #overlay #vs-live-btn {
    margin-top: 9px;
    border-color: rgba(255, 72, 120, 0.62);
    border-left-color: #ff4878;
    color: #fff;
    background:
      repeating-linear-gradient(135deg, rgba(255,72,120,0.08) 0 5px, transparent 5px 10px),
      var(--panel);
  }
  #overlay #vs-live-btn svg { color: #ff4878; margin-right: 5px; vertical-align: -2px; }

  /* Main menu: arcade launch deck rather than a flat settings list. */
  #menu-theme-marquee {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    min-height: 48px;
    margin: 1px 0 10px;
  }
  #menu-theme-art {
    display: grid;
    place-items: center;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-glow-mid), rgba(0,0,0,0.84));
    border: 1px solid var(--accent-dim);
    box-shadow: 0 0 14px var(--accent-glow-soft), inset 0 0 12px rgba(0,0,0,0.45);
  }
  #menu-theme-art img,
  #menu-theme-art canvas,
  #menu-theme-art svg {
    width: 40px;
    height: 40px;
    image-rendering: pixelated;
  }
  #menu-theme-art svg { color: var(--accent); }
  .menu-theme-copy { min-width: 0; text-align: left; }
  #overlay #menu-theme-marquee .theme-label {
    margin: 0 0 5px;
    color: var(--accent);
    font-size: 0.64rem;
    letter-spacing: 0.14em;
    text-shadow: 0 0 10px var(--accent-glow);
  }
  #overlay #menu-theme-marquee #overlayMsg {
    margin: 0;
    color: var(--muted);
    font-family: var(--pixel-font);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1.35;
    text-transform: uppercase;
  }
  .menu-section {
    width: min(100%, 228px);
    margin-top: 9px;
  }
  .menu-section-label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 5px;
    color: var(--muted);
    font-family: var(--pixel-font);
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    line-height: 1;
    text-transform: uppercase;
  }
  .menu-section-label::before,
  .menu-section-label::after {
    content: '';
    height: 1px;
    flex: 1;
    background: linear-gradient(90deg, transparent, var(--line));
  }
  .menu-section-label::after { background: linear-gradient(90deg, var(--line), transparent); }
  #overlay .snakebits-balance-ticket {
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(65px, 1fr) auto;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-height: 50px;
    margin-bottom: 6px;
    padding: 5px 6px 7px;
    border: 1px solid #087e75;
    border-bottom: 3px solid #03443f;
    border-left: 3px solid #92ff00;
    border-radius: 0;
    background: #001412;
    box-shadow: inset 0 0 0 1px #002e29, 3px 3px 0 #000;
    color: #f5ffba;
    font-family: var(--pixel-font);
    text-align: left;
    transition: none;
  }
  #overlay .snakebits-balance-ticket::before,
  #overlay .snakebits-balance-ticket::after {
    content: '';
    position: absolute;
    left: -3px;
    width: 3px;
    height: 6px;
    background: #001412;
  }
  #overlay .snakebits-balance-ticket::before { top: 6px; }
  #overlay .snakebits-balance-ticket::after { bottom: 6px; }
  #overlay .snakebits-balance-ticket[hidden] { display: none !important; }
  #overlay .snakebits-balance-ticket img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    filter: drop-shadow(2px 2px 0 #00100f);
  }
  #overlay .snakebits-ticket-balance {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
  }
  #overlay .snakebits-ticket-balance small {
    overflow: hidden;
    color: #00e8d6;
    font-size: 0.43rem;
    letter-spacing: 0.08em;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #overlay .snakebits-ticket-balance strong {
    display: flex;
    align-items: baseline;
    gap: 4px;
    color: #f5ffba;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    line-height: 1;
    text-shadow: none;
    white-space: nowrap;
  }
  #overlay .snakebits-ticket-balance strong b {
    color: #92ff00;
    font-size: 1rem;
    line-height: 1;
    text-shadow: 0 0 7px rgba(146,255,0,0.45);
  }
  #overlay .snakebits-ticket-balance strong i {
    color: #f5ffba;
    font-size: 0.56rem;
    font-style: normal;
  }
  #overlay .snakebits-ticket-destination {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    min-width: 76px;
    padding: 2px 1px 2px 8px;
    border-left: 1px dashed #087e75;
    color: #ffe96a;
    line-height: 1;
    text-align: left;
  }
  #overlay .snakebits-ticket-destination small {
    grid-column: 1 / -1;
    margin-bottom: 3px;
    color: #6bbab1;
    font-size: 0.35rem;
    letter-spacing: 0.12em;
  }
  #overlay .snakebits-ticket-destination strong,
  #overlay .snakebits-ticket-destination em {
    color: #ffe96a;
    font-size: 0.49rem;
    font-style: normal;
    letter-spacing: 0.08em;
    line-height: 1.05;
    text-shadow: none;
    white-space: nowrap;
  }
  #overlay .snakebits-ticket-destination em {
    grid-column: 1 / -1;
    margin-top: 2px;
    color: #f5ffba;
  }
  #overlay .snakebits-balance-ticket:hover,
  #overlay .snakebits-balance-ticket:focus-visible {
    border-color: #00e8d6;
    border-left-color: #92ff00;
    border-bottom-color: #087e75;
    border-radius: 0;
    outline: 2px solid #ffe96a;
    outline-offset: 2px;
    background: #00231f;
    box-shadow: inset 0 0 0 1px #005249, 3px 3px 0 #000;
  }
  #overlay .snakebits-balance-ticket:active { transform: translate(2px, 2px); }
  #overlay .snakebits-balance-ticket[data-prize-ready="true"] {
    animation: snakebits-prize-ready 560ms steps(4, end) 1;
  }
  #overlay .snakebits-balance-ticket[data-prize-ready="true"] .snakebits-ticket-destination small::before { content: '◆ '; color: #ffe96a; }
  @keyframes snakebits-prize-ready {
    0%, 100% { box-shadow: inset 0 0 0 1px #002e29, 3px 3px 0 #000; }
    50% { box-shadow: inset 0 0 0 2px #ffe96a, 3px 3px 0 #000, 0 0 10px rgba(255,233,106,0.42); }
  }
  @media (prefers-reduced-motion: reduce) {
    #overlay .snakebits-balance-ticket[data-prize-ready="true"] { animation: none; }
  }
  #overlay .snakebits-balance-ticket[data-saved-player="false"] { border-left-color: #ffe96a; }
  #overlay .snakebits-balance-ticket[data-saved-player="false"] .snakebits-ticket-balance small,
  #overlay .snakebits-balance-ticket[data-saved-player="false"] .snakebits-ticket-balance b { color: #ffe96a; }
  .menu-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .menu-settings-grid #options-btn { grid-column: auto; }
  #overlay .menu-settings-grid > button { min-height: 44px !important; }
  #overlay .menu-action-grid > #vs-live-btn,
  #overlay .menu-action-grid > #lbBtn,
  #overlay .menu-action-grid > #options-btn,
  #overlay .menu-action-grid > #settings-btn,
  #overlay .menu-action-grid > #notifications-btn,
  #overlay .menu-action-grid > #how-to-play-btn,
  #overlay .menu-action-grid > #whats-new-btn,
  #overlay .menu-player-primary-grid > #player-btn,
  #overlay .menu-player-primary-grid > #stats-btn {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 8px 5px;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
  }
  #overlay .menu-action-grid > button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    white-space: nowrap;
  }
  #overlay .menu-settings-grid > button:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    filter: saturate(0.55);
  }
  #overlay .menu-action-grid > button > svg,
  #overlay .menu-player-primary-grid > button > svg { flex: 0 0 18px; margin: 0; }
  .menu-pixel-icon {
    width: 18px;
    height: 18px;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 5px currentColor);
  }
  #overlay .menu-action-grid > button[hidden] { display: none !important; }
  #overlay .menu-competition #vs-live-btn {
    margin: 0;
    border-color: rgba(255,72,120,0.62);
  }
  #overlay .menu-competition #lbBtn {
    display: flex;
    border-left-color: var(--accent-dim);
  }
  #overlay .menu-competition #lbBtn svg { color: var(--accent); }
  #overlay .menu-setup #music-controls {
    width: 100%;
    height: 46px;
    min-height: 46px;
    margin: 0 0 6px;
  }
  #overlay .menu-setup #music-controls .music-toggle {
    height: 44px;
    min-height: 44px;
    color: var(--text);
    font-size: 0.68rem;
  }
  #overlay .menu-setup #music-controls .music-toggle.muted { color: #d0d4d2; }
  #overlay .menu-setup #music-controls .music-toggle.muted svg { color: #8f9995; }
  #overlay .menu-setup #music-controls .music-toggle.muted b {
    color: #ff8b8b;
    border: 1px solid rgba(255,139,139,0.38);
    padding: 2px 3px;
  }
  #overlay .menu-setup #music-controls .music-toggle b { font-size: 0.58rem; }
  #overlay .menu-setup #music-controls .music-toggle:not(.muted) b {
    border: 1px solid var(--accent-glow);
    padding: 2px 3px;
  }
  .menu-player-primary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 6px;
  }
  .menu-player-primary-grid > #player-btn,
  .menu-player-primary-grid > #stats-btn { min-width: 0; }
  #overlay .menu-player-primary-grid > #player-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    min-height: 48px;
    padding: 6px 12px;
    text-align: left;
  }
  #overlay .menu-player-primary-grid > #player-btn > svg { color: var(--accent); }
  #overlay .menu-player-primary-grid > #stats-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-left-color: var(--accent-dim);
    color: var(--text);
    font-family: var(--pixel-font);
    font-size: 0.64rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  #overlay .menu-player-primary-grid > #stats-btn > svg { color: var(--accent); }
  .career-teaser {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
    text-align: left;
  }
  .career-teaser small,
  .career-teaser em {
    overflow: hidden;
    width: 100%;
    color: var(--muted);
    font-size: 0.43rem;
    font-style: normal;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .career-teaser strong {
    overflow: hidden;
    max-width: 100%;
    color: var(--accent);
    font-size: 0.66rem;
    line-height: 1.05;
    text-overflow: ellipsis;
    text-shadow: 0 0 8px var(--accent-glow);
    white-space: nowrap;
  }
  .career-teaser[data-state="guest"] strong,
  .career-teaser[data-state="offline"] strong { color: #fff; }
  #overlay .menu-player-primary-grid > #stats-btn:focus-visible {
    border-color: var(--accent-dim);
    background: var(--accent-glow-soft);
  }
  .player-menu-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }
  .player-menu-copy strong {
    display: block;
    overflow: hidden;
    width: 100%;
    color: var(--text);
    font-family: var(--pixel-font);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .player-menu-copy small {
    overflow: hidden;
    color: var(--muted);
    font-family: var(--pixel-font);
    font-size: 0.55rem;
    letter-spacing: 0.07em;
    line-height: 1.1;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }
  #overlay .menu-player-info #display-name-invite { width: 100%; }
  #overlay .menu-support-grid { margin-top: 6px; }
  .menu-cabinet-footer {
    z-index: 3 !important;
    align-self: center;
    width: min(calc(100% + 96px), calc(100vw - 8px));
    height: auto;
    aspect-ratio: 1200 / 265;
    flex: 0 0 auto;
    margin: 7px 0 -36px;
    overflow: visible;
    pointer-events: none;
    filter: none;
  }
  .menu-cabinet-footer img {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: auto;
    user-select: none;
  }
  .menu-cabinet-footer-interactive {
    /* Keep the menu and gameplay decks registered to the same cabinet
       footprint; the approved replacement art is fitted inside it. */
    aspect-ratio: 1200 / 265;
    pointer-events: auto;
  }
  .menu-cabinet-deck-stage {
    position: relative;
    width: 100%;
    height: 100%;
  }
  .menu-cabinet-deck-stage > img {
    width: 100%;
    height: 100% !important;
    object-fit: fill;
    image-rendering: pixelated;
  }
  #overlay .menu-deck-control {
    position: absolute;
    z-index: 2;
    display: block;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    color: transparent;
    box-shadow: none;
    cursor: pointer;
    transform-origin: center;
    transition: filter 90ms steps(1, end), transform 90ms steps(1, end), box-shadow 90ms steps(1, end);
  }
  #overlay .menu-deck-control-rivals { left: 19%; top: 14%; width: 18%; height: 42%; }
  #overlay .menu-deck-control-alerts { left: 63%; top: 14%; width: 19%; height: 42%; }
  #menu-deck-rivals-badge {
    position: absolute;
    z-index: 4;
    top: -9px;
    right: -7px;
    min-width: 23px;
    height: 23px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 0;
    color: #fff;
    background: #ff1d7b;
    box-shadow: 3px 3px #000, 0 0 10px rgba(255,29,123,.72);
    font: 11px/1 var(--pixel-font);
    letter-spacing: 0;
    image-rendering: pixelated;
  }
  #menu-deck-rivals-badge[hidden] { display: none; }
  #menu-deck-rivals-badge.is-new { animation: rivals-badge-arrival 650ms steps(2, end) 3; }
  @keyframes rivals-badge-arrival {
    0%, 100% { transform: translate(0, 0) scale(1); filter: brightness(1); }
    50% { transform: translate(-2px, -2px) scale(1.16); filter: brightness(1.4); }
  }
  #overlay .menu-deck-control:hover,
  #overlay .menu-deck-control:focus-visible {
    filter: brightness(1.22) saturate(1.2);
  }
  #overlay .menu-deck-control:focus-visible {
    outline: none;
  }
  #overlay .menu-deck-control:active,
  #overlay .menu-deck-control[data-pressed="true"] {
    filter: brightness(.88) saturate(1.25);
    transform: translateY(4px) scale(.96);
  }
  .menu-cabinet-deck-stage:has(.menu-deck-control:hover) > img,
  .menu-cabinet-deck-stage:has(.menu-deck-control:focus-visible) > img {
    filter: brightness(1.08) saturate(1.1);
  }
  .menu-cabinet-deck-stage:has(.menu-deck-control:active) > img,
  .menu-cabinet-deck-stage:has(.menu-deck-control[data-pressed="true"]) > img {
    filter: brightness(.94) saturate(1.12);
    transform: translateY(2px);
  }
  #overlay .menu-deck-control[data-alert="true"] { animation: menu-deck-alert-pulse 900ms steps(2, end) infinite; }
  @keyframes menu-deck-alert-pulse {
    0%, 100% { filter: brightness(1) saturate(1); }
    50% { filter: brightness(1.34) saturate(1.35); }
  }
  @media (prefers-reduced-motion: reduce) {
    #overlay .menu-deck-control { transition: none; }
    .menu-cabinet-deck-stage:has(.menu-deck-control:active) > img,
    .menu-cabinet-deck-stage:has(.menu-deck-control[data-pressed="true"]) > img { transform: none; }
    #overlay .menu-deck-control[data-alert="true"] { animation: none; filter: brightness(1.2) saturate(1.2); }
    #menu-deck-rivals-badge.is-new { animation: none; filter: brightness(1.3); }
  }
  body.golden-secret .menu-competition,
  body.golden-secret .menu-player-info { display: none !important; }

  #live-vs-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 190;
    align-items: flex-start;
    justify-content: center;
    padding: max(env(safe-area-inset-top), 14px) 12px max(env(safe-area-inset-bottom), 18px);
    overflow-y: auto;
    background:
      linear-gradient(rgba(37, 220, 255, 0.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,72,120,0.035) 1px, transparent 1px),
      radial-gradient(circle at 15% 20%, rgba(37,220,255,0.14), transparent 30%),
      radial-gradient(circle at 85% 30%, rgba(255,72,120,0.16), transparent 34%),
      #020207;
    background-size: 12px 12px, 12px 12px, auto, auto, auto;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  #live-vs-panel.visible { display: flex; }
  .live-vs-card {
    position: relative;
    width: min(100%, 540px);
    margin: auto 0;
    padding: 0 16px 18px;
    overflow: hidden;
    border: 2px solid #ff4878;
    background:
      repeating-linear-gradient(to bottom, transparent 0 3px, rgba(255,255,255,0.018) 3px 4px),
      linear-gradient(135deg, rgba(37,220,255,0.055), transparent 32%, rgba(255,72,120,0.05)),
      #05050b;
    box-shadow:
      0 0 0 4px #000,
      0 0 0 5px rgba(37,220,255,0.42),
      0 0 38px rgba(255,72,120,0.24),
      0 22px 70px #000;
    text-align: center;
    font-family: var(--pixel-font);
  }
  .live-vs-card::before, .live-vs-card::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    z-index: 2;
    pointer-events: none;
  }
  .live-vs-card::before { top: 5px; left: 5px; border-top: 3px solid #25dcff; border-left: 3px solid #25dcff; }
  .live-vs-card::after { right: 5px; bottom: 5px; border-right: 3px solid #ff4878; border-bottom: 3px solid #ff4878; }
  .live-vs-marquee {
    margin: 0 -16px 18px;
    padding: 17px 16px 14px;
    border-bottom: 2px solid rgba(37,220,255,0.5);
    background:
      repeating-linear-gradient(90deg, transparent 0 8px, rgba(255,255,255,0.025) 8px 9px),
      linear-gradient(90deg, rgba(37,220,255,0.12), rgba(255,72,120,0.14));
  }
  .live-vs-live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    background: #64ff94;
    box-shadow: 0 0 10px #64ff94;
    animation: live-vs-blink 1s steps(2, end) infinite;
  }
  @keyframes live-vs-blink { 50% { opacity: 0.22; } }
  .live-vs-marquee .menu-kicker { display: inline; color: #b8f4ff; }
  .live-vs-card h2 {
    margin: 9px 0 7px;
    color: #fff;
    font-size: clamp(1.55rem, 7vw, 2.2rem);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-shadow: -3px 0 #25dcff, 3px 0 #ff4878, 0 0 18px rgba(255,255,255,0.35);
  }
  .live-vs-tagline, .live-vs-ghost-note {
    color: var(--muted);
    font-size: 0.64rem;
    line-height: 1.55;
  }
  #live-vs-setup { margin: 22px auto 4px; max-width: 390px; }
  .live-vs-room-settings {
    margin: 14px 0;
    padding: 13px;
    border: 1px solid rgba(37,220,255,0.32);
    background: linear-gradient(135deg, rgba(37,220,255,0.07), rgba(255,72,120,0.045));
    text-align: left;
  }
  .live-vs-settings-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 9px;
    border-bottom: 1px dashed rgba(255,255,255,0.12);
  }
  .live-vs-settings-heading strong { color: #fff; font-size: 0.58rem; letter-spacing: 0.08em; }
  .live-vs-room-settings fieldset { min-width: 0; margin: 12px 0 0; padding: 0; border: 0; }
  .live-vs-room-settings legend {
    margin-bottom: 6px;
    color: #8ca7b8;
    font-size: 0.48rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  .live-vs-setting-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  .live-vs-setting-options.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #live-vs-panel .live-vs-setting-options button {
    min-height: 34px;
    padding: 7px 5px;
    border-color: rgba(255,255,255,0.15);
    color: #9fb6c3;
    font-size: 0.52rem;
  }
  #live-vs-panel .live-vs-setting-options button.selected {
    border-color: #25dcff;
    background: rgba(37,220,255,0.13);
    color: #fff;
    box-shadow: inset 0 -2px #25dcff, 0 0 10px rgba(37,220,255,0.12);
  }
  .live-vs-setting-help { margin: 6px 0 0; color: #687f8c; font-size: 0.46rem; line-height: 1.45; }
  .live-vs-switch-row { display: grid; gap: 5px; margin-top: 12px; }
  .live-vs-switch-row label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 9px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.24);
  }
  .live-vs-switch-row label span { display: grid; gap: 3px; }
  .live-vs-switch-row label b { color: #e8f9ff; font-size: 0.52rem; }
  .live-vs-switch-row label small { color: #718995; font-size: 0.42rem; line-height: 1.35; }
  .live-vs-switch-row input { width: 22px; height: 22px; accent-color: #25dcff; }
  .live-vs-setup-art {
    display: grid;
    grid-template-columns: 1fr 52px 1fr;
    align-items: center;
    margin: 4px 0 18px;
    color: #25dcff;
    font-size: 1.1rem;
    font-weight: 900;
  }
  .live-vs-setup-art span {
    padding: 13px 7px;
    border: 1px solid currentColor;
    background: rgba(37,220,255,0.055);
    box-shadow: inset 0 -3px rgba(0,0,0,0.4);
  }
  .live-vs-setup-art span:last-child { color: #ff6b93; background: rgba(255,72,120,0.06); }
  .live-vs-setup-art b { color: #fff; font-size: 1.15rem; text-shadow: 0 0 12px #ff4878; }
  #live-vs-panel button, #live-vs-panel input {
    min-height: 42px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 0;
    font-family: var(--pixel-font);
    text-transform: uppercase;
  }
  #live-vs-panel button {
    cursor: pointer;
    background: rgba(255,255,255,0.035);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 10px 14px;
  }
  #live-vs-panel button.primary {
    width: 100%;
    border-color: #25dcff;
    background: linear-gradient(90deg, #25dcff, #77edff);
    color: #02060a;
    box-shadow: inset 0 -4px rgba(0,0,0,0.2), 0 0 17px rgba(37,220,255,0.3);
  }
  #live-vs-panel button:disabled { cursor: default; opacity: 0.35; }
  #live-vs-panel label, .live-vs-label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 0.58rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
  }
  .live-vs-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    color: #777;
    font-size: 0.58rem;
  }
  .live-vs-divider::before, .live-vs-divider::after { content: ''; height: 1px; flex: 1; background: var(--line); }
  .live-vs-code-entry { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
  #live-vs-code {
    width: 100%;
    min-width: 0;
    background: #020504;
    border-color: rgba(37,220,255,0.65);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.26em;
    padding: 8px 8px 8px 14px;
    text-align: center;
  }
  #live-vs-lobby { animation: live-vs-arrive 0.24s steps(4, end); }
  @keyframes live-vs-arrive {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
  .live-vs-room-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    margin: 0 -4px 12px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.13);
    background: rgba(0,0,0,0.45);
    text-align: left;
  }
  #live-vs-room-code {
    display: block;
    color: #fff;
    font-size: 1.35rem;
    letter-spacing: 0.22em;
    margin-top: 3px;
    text-shadow: -2px 0 #25dcff, 2px 0 #ff4878;
  }
  #live-vs-share {
    min-height: 34px !important;
    padding: 6px 10px !important;
    border-color: #ff4878 !important;
    color: #ff9ab5 !important;
  }
  .live-vs-session-strip {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    color: #95a6af;
    font-size: 0.54rem;
    letter-spacing: 0.09em;
  }
  .live-vs-session-strip strong {
    min-width: 104px;
    padding: 7px 10px;
    border-top: 1px solid #25dcff;
    border-bottom: 1px solid #ff4878;
    color: #fff;
    font-size: 1.28rem;
    letter-spacing: 0.16em;
    text-shadow: -2px 0 #25dcff, 2px 0 #ff4878;
  }
  .live-vs-session-strip span:last-child { text-align: right; }
  .live-vs-rule-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin: 8px 0 12px;
  }
  .live-vs-rule-strip span {
    padding: 4px 6px;
    border: 1px solid rgba(37,220,255,0.24);
    background: rgba(37,220,255,0.055);
    color: #9cefff;
    font-size: 0.43rem;
    letter-spacing: 0.08em;
  }
  .live-vs-series-result {
    margin: 12px 0;
    padding: 15px 12px;
    border: 2px solid #ffe45b;
    background: radial-gradient(circle at 50% 0, rgba(255,228,91,0.18), transparent 68%), #070806;
    text-align: center;
    box-shadow: 0 0 18px rgba(255,228,91,0.14);
  }
  .live-vs-series-result > strong {
    display: block;
    margin: 7px 0;
    color: #ffe45b;
    font-size: 0.74rem;
    letter-spacing: 0.09em;
    text-shadow: 0 0 12px rgba(255,228,91,0.52);
  }
  .live-vs-series-result p { margin: 0; color: #a9b2ae; font-size: 0.48rem; line-height: 1.5; }
  #live-vs-room-status {
    margin: 12px 0 9px;
    color: #d9f8ff;
    font-size: 0.62rem;
    line-height: 1.5;
  }
  .live-vs-waiting-board {
    margin: 10px 0 13px;
    padding: 13px 12px 11px;
    border: 1px solid #25dcff;
    background:
      repeating-linear-gradient(0deg, transparent 0 3px, rgba(37,220,255,0.035) 3px 4px),
      rgba(2,14,24,0.92);
    box-shadow: inset 0 0 24px rgba(37,220,255,0.08), 0 0 16px rgba(37,220,255,0.1);
  }
  .live-vs-waiting-board > strong {
    display: block;
    margin: 5px 0 7px;
    color: #fff;
    font-size: 1rem;
    letter-spacing: 0.12em;
    text-shadow: 2px 0 #25dcff, -2px 0 #ff4878;
  }
  .live-vs-waiting-board p {
    margin: 7px 0 0;
    color: #b8f4ff;
    font-size: 0.58rem;
    line-height: 1.5;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  #live-vs-spectate {
    width: 100%;
    margin-top: 11px;
    border: 1px solid #25dcff;
    background: linear-gradient(180deg, #1b8bb0, #075373);
    color: #fff;
    box-shadow: inset 0 -3px rgba(0,0,0,0.28), 0 0 14px rgba(37,220,255,0.22);
    font-family: var(--pixel-font);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    padding: 11px 10px;
    text-transform: uppercase;
  }
  .live-vs-waiting-pulse { display: flex; justify-content: center; gap: 7px; }
  .live-vs-waiting-pulse i {
    width: 7px;
    height: 7px;
    background: #25dcff;
    box-shadow: 0 0 9px #25dcff;
    animation: live-vs-waiting-dot 1.05s steps(2, end) infinite;
  }
  .live-vs-waiting-pulse i:nth-child(2) { animation-delay: 0.18s; }
  .live-vs-waiting-pulse i:nth-child(3) { animation-delay: 0.36s; }
  @keyframes live-vs-waiting-dot { 50% { opacity: 0.18; transform: translateY(-2px); } }
  #live-vs-spectator-bar {
    position: fixed;
    left: 50%;
    bottom: max(env(safe-area-inset-bottom), 10px);
    z-index: 26;
    width: min(calc(100% - 24px), 410px);
    min-height: 48px;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 9px;
    padding: 7px 8px 7px 11px;
    border: 1px solid #25dcff;
    background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(37,220,255,0.04) 3px 4px), rgba(1,9,15,0.94);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.72), 0 0 18px rgba(37,220,255,0.22);
    font-family: var(--pixel-font);
  }
  #live-vs-spectator-bar[hidden] { display: none; }
  #live-vs-spectator-bar div { min-width: 0; }
  #live-vs-spectator-bar div > span { display: block; color: #77dff3; font-size: 0.47rem; letter-spacing: 0.16em; }
  #live-vs-spectator-name { display: block; overflow: hidden; color: #fff; font-size: 0.66rem; letter-spacing: 0.08em; text-overflow: ellipsis; white-space: nowrap; }
  #live-vs-spectator-signal { color: #52ff9b; font-size: 0.48rem; letter-spacing: 0.1em; }
  #live-vs-spectator-signal[data-state="reconnecting"] { color: #ffd447; }
  #live-vs-spectator-signal[data-state="signal-lost"] { color: #ff648d; }
  #live-vs-stop-spectating {
    min-height: 34px;
    border: 1px solid rgba(37,220,255,0.55);
    background: rgba(37,220,255,0.08);
    color: #d9f8ff;
    font-family: var(--pixel-font);
    font-size: 0.48rem;
    font-weight: 800;
    padding: 6px 8px;
    text-transform: uppercase;
  }
  body.live-vs-spectating #dpad,
  body.live-vs-spectating #turn-controls { display: none !important; }
  .live-vs-fighter.departed {
    border-color: rgba(255,72,120,0.48);
    filter: grayscale(0.7);
    opacity: 0.58;
  }
  .live-vs-fighter.departed .live-vs-ready-state { color: #ff8aaa; }
  .live-vs-stage-select, .live-vs-stage-reveal {
    margin: 14px 0 12px;
    padding: 12px;
    border: 1px solid rgba(37,220,255,0.42);
    background:
      linear-gradient(135deg, rgba(37,220,255,0.055), transparent 48%),
      rgba(1,8,14,0.86);
    box-shadow: inset 0 0 22px rgba(37,220,255,0.045);
  }
  .live-vs-stage-heading strong {
    display: block;
    margin: 4px 0 10px;
    color: #fff;
    font-size: 0.72rem;
    letter-spacing: 0.13em;
  }
  .live-vs-stage-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }
  .live-vs-stage-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    min-height: 64px;
    padding: 6px 3px 5px !important;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15) !important;
    background: rgba(255,255,255,0.035) !important;
    color: #b8c7d2 !important;
    font-size: 0.48rem !important;
    line-height: 1.25;
    letter-spacing: 0.03em !important;
    text-transform: uppercase;
  }
  .live-vs-stage-art,
  .live-vs-stage-card-art,
  .live-vs-roulette-art {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
  }
  .live-vs-stage-art {
    width: 30px;
    height: 30px;
  }
  .live-vs-stage-art > img,
  .live-vs-stage-art > canvas,
  .live-vs-stage-art > svg,
  .live-vs-stage-card-art > img,
  .live-vs-stage-card-art > canvas,
  .live-vs-stage-card-art > svg,
  .live-vs-roulette-art > img,
  .live-vs-roulette-art > canvas,
  .live-vs-roulette-art > svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
  }
  .live-vs-stage-option-name {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .live-vs-stage-option.selected {
    border-color: var(--stage-color, #25dcff) !important;
    color: #fff !important;
    background: color-mix(in srgb, var(--stage-color, #25dcff) 16%, #02070d) !important;
    box-shadow: inset 0 -3px var(--stage-color, #25dcff), 0 0 10px color-mix(in srgb, var(--stage-color, #25dcff) 30%, transparent);
  }
  .live-vs-stage-option:disabled { opacity: 0.42; cursor: default; }
  #live-vs-stage-lock-status {
    margin: 9px 0 0;
    min-height: 1.3em;
    color: #9eb3c1;
    font-size: 0.52rem;
    line-height: 1.4;
  }
  .live-vs-stage-reveal {
    border-color: #ffe45b;
    background:
      repeating-linear-gradient(90deg, rgba(255,228,91,0.04) 0 4px, transparent 4px 8px),
      #04080d;
    box-shadow: inset 0 0 28px rgba(255,228,91,0.07), 0 0 18px rgba(255,228,91,0.08);
  }
  .live-vs-stage-duel {
    display: grid;
    grid-template-columns: 1fr 28px 1fr;
    gap: 6px;
    align-items: center;
    margin: 8px 0 10px;
  }
  .live-vs-stage-duel > b { color: #fff; font-size: 0.7rem; font-style: italic; }
  .live-vs-stage-card {
    min-width: 0;
    padding: 8px 4px;
    border: 1px solid var(--stage-color, #25dcff);
    background: rgba(255,255,255,0.035);
    box-shadow: inset 0 -3px var(--stage-color, #25dcff);
  }
  .live-vs-stage-card > span:first-child { display: block; color: #8ca7b8; font-size: 0.44rem; }
  .live-vs-stage-card-art {
    width: 30px;
    height: 30px;
    margin: 5px auto 2px;
  }
  .live-vs-stage-card strong {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    color: #fff;
    font-size: 0.56rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .live-vs-roulette-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 5px;
    border: 2px solid var(--stage-color, #ffe45b);
    background: color-mix(in srgb, var(--stage-color, #ffe45b) 12%, #020408);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.13em;
    text-shadow: 2px 0 #25dcff, -2px 0 #ff4878;
    box-shadow: 0 0 16px color-mix(in srgb, var(--stage-color, #ffe45b) 28%, transparent);
  }
  .live-vs-roulette-art {
    width: 44px;
    height: 44px;
  }
  .live-vs-roulette-stage strong { font: inherit; }
  #live-vs-roulette-status {
    margin: 8px 0 0;
    color: #ffe45b;
    font-size: 0.5rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .live-vs-fighters {
    display: grid;
    grid-template-columns: 1fr 46px 1fr;
    align-items: stretch;
    gap: 7px;
    margin: 10px 0 14px;
  }
  .live-vs-fighter {
    position: relative;
    min-width: 0;
    min-height: 112px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 6px 9px;
    border: 1px solid rgba(37,220,255,0.52);
    border-bottom-width: 3px;
    background: linear-gradient(145deg, rgba(37,220,255,0.09), rgba(0,0,0,0.1));
  }
  .live-vs-fighter:last-child { border-color: rgba(255,72,120,0.55); background: linear-gradient(215deg, rgba(255,72,120,0.1), rgba(0,0,0,0.1)); }
  .live-vs-fighter.ready { box-shadow: inset 0 0 17px rgba(100,255,148,0.12), 0 0 10px rgba(100,255,148,0.14); }
  .live-vs-fighter.winner::after {
    content: '★';
    position: absolute;
    top: -8px;
    right: 5px;
    color: #ffe45b;
    font-size: 0.88rem;
    text-shadow: 0 0 8px #ffe45b;
  }
  .live-vs-fighter strong {
    max-width: 100%;
    color: #fff;
    font-size: 0.72rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  .live-vs-seat { color: #7eeeff !important; font-size: 0.48rem !important; letter-spacing: 0.12em; }
  .live-vs-fighter:last-child .live-vs-seat { color: #ff94b0 !important; }
  .live-vs-win-count { color: #ffe45b !important; font-size: 0.55rem !important; }
  .live-vs-ready-state { color: #66ffb3 !important; font-size: 0.49rem !important; }
  .live-vs-fighter small { color: #8abfff; font-size: 0.48rem; letter-spacing: 0.08em; }
  .live-vs-fighter.empty { border-color: var(--line); opacity: 0.58; }
  .live-vs-bolt {
    position: relative;
    align-self: center;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    transform: rotate(-8deg);
    color: #fff;
    background: linear-gradient(135deg, #25dcff 0 48%, #ff4878 52% 100%);
    clip-path: polygon(16% 0, 100% 0, 80% 42%, 100% 42%, 18% 100%, 33% 57%, 0 57%);
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.35));
  }
  .live-vs-bolt span { transform: rotate(8deg); font-size: 0.72rem; font-weight: 900; text-shadow: 1px 1px #000; }
  .live-vs-result-board {
    margin: 15px 0 12px;
    padding: 12px;
    border: 1px solid #ffe45b;
    background: linear-gradient(180deg, rgba(255,228,91,0.09), rgba(0,0,0,0.2));
    box-shadow: inset 0 0 18px rgba(255,228,91,0.035);
  }
  .live-vs-result-board.you-won { border-color: #66ffb3; }
  .live-vs-result-board.you-lost { border-color: #ff6b93; }
  #live-vs-result-title {
    display: block;
    margin: 3px 0 12px;
    color: #ffe45b;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
  }
  .live-vs-result-scores {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
  }
  .live-vs-result-scores div { display: grid; gap: 4px; }
  .live-vs-result-scores span { color: #9fb0ba; font-size: 0.52rem; }
  .live-vs-result-scores b { color: #fff; font-size: 1.5rem; }
  .live-vs-result-scores small { color: #65dfff; font-size: 0.52rem; }
  .live-vs-result-scores em { color: #6f7a80; font-size: 0.45rem; font-style: normal; }
  .live-vs-history {
    margin: 12px 0;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.32);
  }
  .live-vs-history summary {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 10px;
    cursor: pointer;
    list-style: none;
    background: linear-gradient(90deg, rgba(37,220,255,0.06), rgba(255,72,120,0.035));
  }
  .live-vs-history summary::-webkit-details-marker { display: none; }
  .live-vs-history summary strong {
    color: #d4e0e6;
    font-size: 0.48rem;
    letter-spacing: 0.05em;
  }
  .live-vs-history summary i {
    color: #65dfff;
    font-size: 0.45rem;
    font-style: normal;
  }
  .live-vs-history[open] summary i::before { content: 'CLOSE'; }
  .live-vs-history[open] summary i { font-size: 0; }
  .live-vs-history[open] summary i::before { font-size: 0.45rem; }
  .live-vs-history > p {
    margin: 8px 10px 6px;
    color: #748892;
    font-size: 0.46rem;
    line-height: 1.4;
  }
  #live-vs-history-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    max-height: 178px;
    padding: 0 9px 9px;
    overflow-y: auto;
  }
  .live-vs-history-card {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding: 7px;
    border-left: 2px solid #65dfff;
    background: rgba(255,255,255,0.03);
    color: #8b9aa3;
    font-size: 0.5rem;
    text-align: left;
  }
  .live-vs-history-card.you-won { border-left-color: #66ffb3; }
  .live-vs-history-card.you-lost { border-left-color: #ff6b93; }
  .live-vs-history-card.draw { border-left-color: #ffe45b; }
  .live-vs-history-art { width: 30px; height: 30px; }
  .live-vs-history-art > img,
  .live-vs-history-art > canvas,
  .live-vs-history-art > svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
  }
  .live-vs-history-card > span { display: grid; min-width: 0; gap: 2px; }
  .live-vs-history-card small { color: #758994; font-size: 0.42rem; }
  .live-vs-history-card b { color: #fff; font-size: 0.62rem; }
  .live-vs-history-card em {
    overflow: hidden;
    color: #ffe45b;
    font-size: 0.43rem;
    font-style: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .live-vs-arena-spec {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin: 11px 0;
  }
  .live-vs-arena-spec span {
    padding: 4px 6px;
    border: 1px solid rgba(255,255,255,0.12);
    color: #91a2aa;
    background: rgba(255,255,255,0.025);
    font-size: 0.46rem;
    letter-spacing: 0.08em;
  }
  #live-vs-ready { margin: 12px 0 4px; }
  #live-vs-ready.armed {
    background: linear-gradient(90deg, #66ffb3, #a4ffd0);
    border-color: #66ffb3;
    box-shadow: inset 0 -4px rgba(0,0,0,0.18), 0 0 18px rgba(102,255,179,0.32);
  }
  #live-vs-message { min-height: 2.9em; margin: 14px 0 5px; color: #66ffb3; font-size: 0.62rem; line-height: 1.45; }
  #live-vs-message.error { color: #ff8aaa; }
  #live-vs-close { width: 100%; color: #ff9ab5 !important; border-color: rgba(255,72,120,0.55) !important; }
  @media (max-width: 390px) {
    .live-vs-card { padding-left: 11px; padding-right: 11px; }
    .live-vs-marquee { margin-left: -11px; margin-right: -11px; }
    .live-vs-fighters { grid-template-columns: 1fr 38px 1fr; gap: 4px; }
    .live-vs-bolt { width: 37px; height: 39px; }
    .live-vs-fighter { min-height: 104px; }
    .live-vs-stage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }
  @media (prefers-reduced-motion: reduce) {
    .live-vs-live-dot, #live-vs-lobby { animation: none; }
  }
  #hud-mode.vs-latency-debug {
    font-size: 0.48rem;
    letter-spacing: 0.025em;
    white-space: nowrap;
  }
  #player-btn, #whats-new-btn { position: relative; }
  #player-add-name-badge {
    position: absolute;
    top: -7px;
    right: -8px;
    padding: 3px 5px;
    background: var(--accent);
    border: 1px solid #fff;
    color: #020504;
    font-family: var(--pixel-font);
    font-size: 0.46rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    line-height: 1;
    box-shadow: 0 0 12px var(--accent-glow);
  }
  #player-add-name-badge[hidden] { display: none; }
  #display-name-invite {
    width: min(100%, 228px);
    margin-top: 7px;
    padding: 10px;
    background: linear-gradient(135deg, var(--accent-glow-soft), transparent 55%), var(--panel);
    border: 1px solid var(--accent-dim);
    border-left: 3px solid var(--accent);
    color: var(--text);
    font-family: var(--pixel-font);
    text-align: left;
    box-shadow: 0 0 14px var(--accent-glow-soft);
  }
  #display-name-invite[hidden] { display: none; }
  #overlay #display-name-invite p {
    margin: 0 0 9px;
    color: var(--text);
    font-size: 0.66rem;
    line-height: 1.45;
  }
  #display-name-invite-id { color: var(--accent); font-weight: 800; }
  .display-name-invite-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }
  #overlay .display-name-invite-actions button {
    width: 100%;
    min-height: 32px;
    margin: 0;
    padding: 7px 6px;
    border: 1px solid var(--accent-dim);
    border-radius: 0;
    background: transparent;
    color: var(--accent);
    font-size: 0.56rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  #overlay .display-name-invite-actions #display-name-invite-add {
    background: var(--accent);
    color: #020504;
  }
  #whats-new-badge {
    position: absolute;
    top: -7px;
    right: -8px;
    padding: 3px 5px;
    background: var(--food);
    border: 1px solid #fff;
    color: #fff;
    font-family: var(--pixel-font);
    font-size: 0.5rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1;
    box-shadow: 0 0 12px var(--food-glow);
  }
  #whats-new-badge[hidden] { display: none; }
  #whats-new-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 90;
    align-items: center;
    justify-content: center;
    padding: max(env(safe-area-inset-top), 20px) 18px max(env(safe-area-inset-bottom), 20px);
    overflow-y: auto;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    touch-action: auto;
  }
  #whats-new-panel.visible { display: flex; }
  .whats-new-card {
    width: calc(100vw - 36px);
    max-width: 430px;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    padding: 26px 22px 22px;
    background: linear-gradient(135deg, var(--accent-glow-soft), transparent 42%), var(--panel-strong);
    border: 1px solid var(--accent-dim);
    box-shadow: 0 0 0 4px #000, 0 0 28px var(--accent-glow);
  }
  .whats-new-card h2 {
    margin: 4px 0 5px;
    color: var(--accent);
    font-family: var(--pixel-font);
    font-size: 1.35rem;
    letter-spacing: 0.14em;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 0 14px var(--accent-glow);
  }
  #whats-new-current {
    margin-bottom: 18px;
    color: var(--muted);
    font-family: var(--pixel-font);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-align: center;
    text-transform: uppercase;
  }
  .whats-new-release + .whats-new-release {
    margin-top: 19px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
  }
  .whats-new-release h3 {
    margin: 0 0 4px;
    color: var(--text);
    font-family: var(--pixel-font);
    font-size: 0.86rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }
  .whats-new-release-meta {
    margin-bottom: 9px;
    color: var(--accent-dim);
    font-family: var(--pixel-font);
    font-size: 0.56rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .whats-new-headline + .whats-new-headline {
    margin-top: 15px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }
  .whats-new-headline h4 {
    margin: 0 0 7px;
    color: var(--accent);
    font-family: var(--pixel-font);
    font-size: 0.76rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }
  .whats-new-release ul {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1.55;
  }
  .whats-new-release li + li { margin-top: 6px; }
  #whats-new-older-toggle {
    width: 100%;
    min-height: 40px;
    margin-top: 20px;
    border: 1px solid var(--accent-dim);
    border-radius: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-family: var(--pixel-font);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }
  #whats-new-older-toggle[aria-expanded="true"] {
    background: var(--accent-glow-soft);
  }
  .whats-new-archive {
    margin-top: 13px;
    border-top: 1px solid var(--line);
  }
  .whats-new-archive[hidden] { display: none; }
  .whats-new-archive details {
    border-bottom: 1px solid var(--line);
  }
  .whats-new-archive summary {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 10px;
    align-items: center;
    padding: 13px 2px;
    color: var(--text);
    cursor: pointer;
    font-family: var(--pixel-font);
    font-size: 0.68rem;
    list-style: none;
  }
  .whats-new-archive summary::-webkit-details-marker { display: none; }
  .whats-new-archive summary::before {
    content: '+';
    color: var(--accent);
    font-size: 0.9rem;
  }
  .whats-new-archive details[open] summary::before { content: '−'; }
  .whats-new-archive time {
    color: var(--accent-dim);
    font-size: 0.56rem;
    letter-spacing: 0.06em;
  }
  .whats-new-archive .whats-new-release {
    padding: 0 2px 15px 22px;
  }
  .whats-new-archive .whats-new-release h3,
  .whats-new-archive .whats-new-release-meta {
    display: none;
  }
  #whats-new-close {
    width: 100%;
    min-height: 44px;
    margin-top: 22px;
    border: 1px solid var(--accent);
    border-radius: 0;
    background: var(--accent);
    color: #020504;
    cursor: pointer;
    font-family: var(--pixel-font);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  #overlay .control-mode-toggle { margin-top: 0; }
  #namePrompt {
    width: 100%;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
  #namePrompt .np-label, #scoreMethodLabel { font-family: var(--pixel-font); }
  #nameInput {
    border-radius: 2px;
    background: #030807;
    border-color: var(--accent-dim);
  }
  #submitScoreBtn { border-radius: 2px; }

  #leaderboardOverlay {
    background:
      radial-gradient(circle at 50% 18%, var(--accent-glow-soft), transparent 35%),
      #000;
    padding-top: max(env(safe-area-inset-top), 28px);
  }
  #leaderboardOverlay h2, .lb-filter-label, .lb-filter, .lb-table th,
  .lb-method-tag, #lbPageInfo, .lb-page-btn, .lb-back {
    font-family: var(--pixel-font);
  }
  #leaderboardOverlay h2 {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--accent-glow);
    text-shadow: 0 0 15px var(--accent-glow);
  }
  .lb-filter-group { margin-bottom: 14px; }
  .lb-filter { border-radius: 2px; background: var(--panel); }
  .lb-filter.active { color: #fff; box-shadow: inset 0 -2px var(--accent-dim); }
  .lb-table {
    background: rgba(3,8,7,0.72);
    border: 1px solid var(--line);
  }
  .lb-table th { background: rgba(255,255,255,0.025); }
  .lb-table td { height: 35px; }
  .lb-table tr:nth-child(even) td { background: rgba(255,255,255,0.018); }
  .lb-page-btn, .lb-back { border-radius: 2px; }

  #options-panel {
    justify-content: flex-start;
    overflow-y: auto;
    background:
      radial-gradient(circle at 50% 15%, var(--accent-glow-soft), transparent 36%),
      rgba(0,0,0,0.97);
    padding: max(env(safe-area-inset-top), 28px) 18px max(env(safe-area-inset-bottom), 24px);
  }
  #options-panel h2, .theme-name, #options-back { font-family: var(--pixel-font); }
  #options-panel h2 {
    font-size: 1.25rem;
    letter-spacing: 2px;
    text-transform: uppercase;
  }
  .theme-grid { max-width: 480px; gap: 9px; }
  .theme-btn {
    position: relative;
    min-height: 106px;
    border-radius: 2px;
    background: var(--panel);
  }
  .theme-btn[data-locked="true"] {
    cursor: pointer;
    border-color: rgba(141,165,162,0.56);
  }
  .theme-btn[data-locked="true"][data-affordable="true"] {
    border-color: rgba(145,255,36,0.78);
    box-shadow: inset 0 -2px rgba(145,255,36,0.55), 0 0 12px rgba(145,255,36,0.12);
  }
  .theme-btn[data-unavailable="true"] {
    cursor: not-allowed;
    filter: grayscale(0.75) brightness(0.62);
    opacity: 0.58;
  }
  .theme-lock-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    padding: 3px 6px;
    color: #b6c8c5;
    background: #07110f;
    border: 1px solid #49615f;
    font-family: var(--pixel-font);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    line-height: 1;
    white-space: nowrap;
    text-transform: uppercase;
  }
  .theme-lock-badge img {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    image-rendering: pixelated;
    filter: grayscale(0.72) brightness(0.76);
  }
  .theme-lock-badge strong { font-weight: 700; }
  .theme-lock-badge[data-affordable="true"] {
    color: #92ff00;
    border-color: #92ff00;
    text-shadow: 0 0 7px rgba(146,255,0,0.5);
  }
  .theme-lock-badge[data-affordable="true"] img { filter: none; }
  .theme-btn[data-locked="true"]:active { transform: translate(2px, 2px); }
  .theme-btn.selected { box-shadow: inset 0 -3px var(--accent), 0 0 16px var(--accent-glow); }
  .theme-btn .theme-name { font-size: 0.72rem; letter-spacing: 0.6px; }
  .theme-access-note {
    color: #ffe96a;
    font-family: var(--pixel-font);
    font-size: 0.45rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  #options-back { border-radius: 2px; }

  #controls-edit-bar { font-family: var(--pixel-font); border-bottom-color: var(--accent-glow); }
  #controls-reset-btn, #controls-done-btn { border-radius: 2px; }

  #dpad, #turn-controls { opacity: 0.28; }
  #dpad.active, #turn-controls.active { opacity: 1; }
  #dpad .btn, #turn-controls .turn-btn {
    background: rgba(5,12,10,0.78);
    border-color: rgba(255,255,255,0.34);
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.32);
  }
  #dpad .btn svg, #turn-controls .turn-btn svg { stroke: rgba(255,255,255,0.9); }
  #dpad .btn:active, #dpad .btn.pressed,
  #turn-controls .turn-btn:active, #turn-controls .turn-btn.pressed {
    background: var(--accent-glow-mid);
    border-color: var(--accent);
    box-shadow: 0 0 22px var(--accent-glow), inset 0 0 12px var(--accent-glow-soft);
    transform: translateY(2px) scale(0.95);
  }

  /* Dedicated end-of-run presentation. The main menu and result screen are
     intentionally separate visual states even though they share the overlay. */
  #run-result-panel[hidden] { display: none !important; }

  #overlay.run-result .ov-content {
    width: min(92vw, 390px);
    padding: 22px 22px 20px;
    overflow: hidden;
    background:
      linear-gradient(180deg, var(--accent-glow-soft), transparent 32%),
      repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 4px),
      #020706;
    border-color: var(--accent);
    box-shadow:
      0 0 0 4px #000,
      0 0 0 6px var(--accent-glow),
      0 0 42px var(--accent-glow),
      inset 0 0 36px rgba(0,0,0,0.75);
  }

  #overlay.run-result .ov-content > :not(#run-result-panel) {
    display: none !important;
  }

  #run-result-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    color: var(--text);
    font-family: var(--pixel-font);
    text-align: center;
  }

  #run-result-panel::before,
  #run-result-panel::after {
    content: '';
    position: absolute;
    top: -22px;
    width: 46px;
    height: 5px;
    background: var(--accent);
    box-shadow: 0 8px 0 var(--accent-dim);
  }
  #run-result-panel::before { left: -22px; }
  #run-result-panel::after { right: -22px; }

  #run-result-kicker {
    color: var(--accent-dim);
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    line-height: 1.4;
    text-transform: uppercase;
  }

  .run-result-emblem {
    width: 42px;
    height: 42px;
    margin: 10px 0 7px;
    padding: 7px;
    border: 1px solid currentColor;
    color: var(--death, #ff4a5f);
    filter: drop-shadow(0 0 8px currentColor);
  }
  .run-result-emblem svg { display: block; width: 100%; height: 100%; }

  #run-result-panel[data-tone="complete"] .run-result-emblem { color: var(--accent); }
  #run-result-panel[data-tone="warning"] .run-result-emblem { color: #ffb84d; }
  #run-result-panel[data-tone="golden"] .run-result-emblem { color: #ffd700; }

  #run-result-panel #run-result-title {
    margin: 0 0 15px;
    color: var(--text);
    font-family: var(--pixel-font);
    font-size: clamp(1.55rem, 7vw, 2rem);
    letter-spacing: 0.12em;
    line-height: 1.12;
    text-shadow: 3px 3px 0 #000, 0 0 16px var(--accent-glow);
    text-transform: uppercase;
  }

  .run-result-score-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 13px 15px 14px;
    border: 1px solid var(--accent-dim);
    background:
      linear-gradient(90deg, transparent, var(--accent-glow-soft), transparent),
      rgba(0,0,0,0.5);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.5), 0 0 18px var(--accent-glow-soft);
    isolation: isolate;
    overflow: hidden;
  }
  .run-result-score-card.has-final-moments {
    padding-bottom: 36px;
    cursor: pointer;
    background: #010504;
    transition: border-color 120ms ease, box-shadow 120ms ease;
  }
  .run-result-score-card.has-final-moments:hover,
  .run-result-score-card.has-final-moments:focus-visible {
    border-color: var(--accent);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.5), 0 0 24px var(--accent-glow);
    outline: none;
  }
  #run-result-moment-canvas {
    position: absolute;
    inset: 0;
    z-index: -2;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    outline: 0;
    object-fit: cover;
    opacity: 0.84;
    filter: saturate(1.35) contrast(1.25) brightness(0.94);
    image-rendering: pixelated;
    box-shadow: none;
  }
  #run-result-moment-canvas[hidden] { display: none; }
  .run-result-moment-shade {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
      linear-gradient(90deg, rgba(0,0,0,0.58), rgba(0,0,0,0.16) 50%, rgba(0,0,0,0.58)),
      linear-gradient(0deg, rgba(0,0,0,0.9) 0 23%, transparent 50%, rgba(0,0,0,0.28));
  }
  .run-result-score-card:not(.has-final-moments) .run-result-moment-shade { display: none; }
  #run-result-moment-prompt {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 27px;
    padding: 5px 9px;
    border-top: 1px solid var(--accent-dim);
    background: rgba(0,0,0,0.84);
    color: var(--text);
    font-family: var(--pixel-font);
    font-size: 0.48rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }
  #run-result-moment-prompt[hidden] { display: none; }
  #run-result-moment-prompt strong { color: var(--accent); font-size: 0.52rem; letter-spacing: 0.11em; }
  .run-result-score-card[data-drama="record"] { --moment-signal: #ffd84a; border-color: rgba(255,216,74,0.72); }
  .run-result-score-card[data-drama="near"] { --moment-signal: #ff4d67; border-color: rgba(255,77,103,0.72); }
  .run-result-score-card[data-drama="sonic"] { --moment-signal: #dffcff; border-color: rgba(223,252,255,0.74); }
  .run-result-score-card[data-drama] #run-result-moment-prompt strong { color: var(--moment-signal, var(--accent)); }
  .run-result-score-card::before,
  .run-result-score-card::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-color: var(--accent);
    z-index: 2;
  }
  .run-result-score-card::before { top: -1px; left: -1px; border-top: 3px solid; border-left: 3px solid; }
  .run-result-score-card::after { right: -1px; bottom: -1px; border-right: 3px solid; border-bottom: 3px solid; }
  #run-result-mode {
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  #run-result-score {
    margin: 5px 0 0;
    color: var(--accent);
    font-size: clamp(3.4rem, 17vw, 5rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    text-shadow: 3px 3px 0 #000, -2px -2px 0 rgba(0,0,0,0.72), 0 0 18px #000;
    line-height: 0.95;
    text-shadow: 4px 4px 0 #000, 0 0 22px var(--accent-glow);
  }
  #run-result-score-label {
    margin-top: 5px;
    color: var(--text);
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
  }
  #run-result-detail {
    margin: 8px 0 0 !important;
    color: var(--muted) !important;
    font-size: 0.62rem !important;
    letter-spacing: 0.06em;
    line-height: 1.45;
    text-transform: uppercase;
  }

  .snakebits-receipt {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 3px 10px;
    width: 100%;
    margin-top: 10px;
    padding: 8px 10px;
    overflow: hidden;
    border: 1px solid #00d7c8;
    border-left: 4px solid #92ff00;
    background:
      repeating-linear-gradient(135deg, rgba(0,215,200,0.07) 0 4px, transparent 4px 8px),
      rgba(0,19,18,0.96);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.5), 0 0 17px rgba(0,215,200,0.2);
    color: #f5ffba;
    font-family: var(--pixel-font);
    text-align: left;
  }
  .snakebits-receipt[hidden] { display: none !important; }
  .snakebits-receipt::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 5px;
    background: #92ff00;
    box-shadow: -5px 5px 0 rgba(0,215,200,0.72);
  }
  .snakebits-receipt img {
    grid-row: 1 / 3;
    width: 42px;
    height: 42px;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 6px rgba(0,245,225,0.72));
  }
  .snakebits-receipt > span { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .snakebits-receipt small {
    color: #00e8d6;
    font-size: 0.5rem;
    letter-spacing: 0.1em;
    line-height: 1.25;
  }
  .snakebits-receipt strong {
    color: #f5ffba;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }
  .snakebits-receipt strong b {
    color: #92ff00;
    font-size: 1.08rem;
    text-shadow: 0 0 9px rgba(146,255,0,0.58);
  }
  .snakebits-receipt p {
    grid-column: 2;
    margin: 0 !important;
    color: #b6d7d2 !important;
    font-size: 0.46rem !important;
    letter-spacing: 0.055em;
    line-height: 1.45;
    text-transform: uppercase;
  }
  .snakebits-receipt[data-state="pending"] { border-left-color: #ffe96a; }
  .snakebits-receipt[data-state="pending"] small,
  .snakebits-receipt[data-state="pending"] strong b { color: #ffe96a; }
  .snakebits-receipt[data-state="offline"],
  .snakebits-receipt[data-state="zero"] { border-color: #49615f; border-left-color: #8da5a2; }
  .snakebits-receipt[data-state="offline"] img,
  .snakebits-receipt[data-state="zero"] img { filter: grayscale(0.72) brightness(0.76); }
  .snakebits-receipt[data-state="offline"] small,
  .snakebits-receipt[data-state="zero"] small,
  .snakebits-receipt[data-state="offline"] strong b,
  .snakebits-receipt[data-state="zero"] strong b { color: #b6c8c5; text-shadow: none; }
  .snakebits-receipt[data-state="capped"] { border-left-color: #ffb84d; }
  .snakebits-receipt[data-state="capped"] small,
  .snakebits-receipt[data-state="capped"] strong b { color: #ffb84d; }
  .snakebits-receipt[data-state="held"] { border-left-color: #ffe96a; }
  .snakebits-receipt[data-state="held"] small,
  .snakebits-receipt[data-state="held"] strong b { color: #ffe96a; }

  .snakebits-vs-receipt {
    width: min(100%, 520px);
    margin: 12px auto 0;
  }

  #run-result-panel #namePrompt {
    width: 100%;
    margin-top: 12px;
    padding: 12px 8px 0;
    border-top: 1px dashed var(--accent-glow);
  }
  #run-result-panel #namePrompt .np-label { color: var(--text); }
  #run-result-panel #scoreMethodLabel { max-width: 290px; line-height: 1.5; }

  .run-result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
  }
  #overlay .run-result-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 9px 8px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent-dim);
    border-radius: 0;
    background: rgba(2,8,7,0.94);
    color: var(--text);
    font-size: 0.67rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  #overlay .run-result-actions button:hover { border-color: var(--accent); background: var(--accent-glow-soft); }
  #overlay .run-result-actions .run-result-primary {
    grid-column: 1 / -1;
    min-height: 52px;
    border-color: var(--accent);
    background: var(--accent);
    color: #020504;
    font-size: 0.82rem;
    box-shadow: inset 0 -4px rgba(0,0,0,0.18), 0 0 20px var(--accent-glow);
  }
  #overlay .run-result-actions .run-result-primary:hover,
  #overlay .run-result-actions .run-result-primary:focus-visible {
    border-color: var(--accent);
    background: var(--accent);
    color: #020504;
    box-shadow: inset 0 -4px rgba(0,0,0,0.12), 0 0 28px var(--accent-glow);
    filter: brightness(1.14);
  }
  #overlay .run-result-actions.single-secondary #run-result-leaderboard { grid-column: 1 / -1; }
  #overlay .run-result-actions #run-result-menu { grid-column: 1 / -1; }
  #overlay .run-result-actions button[hidden] { display: none !important; }

  @media (max-height: 760px) {
    #overlay.run-result .ov-content { margin: 14px 0; padding-top: 17px; padding-bottom: 16px; }
    .run-result-emblem { width: 34px; height: 34px; margin: 7px 0 5px; padding: 5px; }
    #run-result-panel #run-result-title { margin-bottom: 10px; }
    #run-result-score { font-size: 3.2rem; }
    .run-result-score-card { padding-top: 10px; padding-bottom: 10px; }
  }

  @media (min-width: 720px) {
    #overlay .ov-content { width: 380px; }
    .theme-grid { grid-template-columns: repeat(3, 1fr); }
  }
  @media (max-height: 860px) {
    #overlay .ov-content { padding-top: 18px; padding-bottom: 16px; }
    #overlay h2.menu-brand {
      width: clamp(9.5rem, min(61vw, 19dvh), 12rem);
      margin-top: -6px;
      margin-bottom: 4px;
    }
    #menu-theme-marquee { min-height: 38px; margin-bottom: 6px; }
    #menu-theme-art { width: 38px; height: 38px; flex-basis: 38px; }
    #menu-theme-art img, #menu-theme-art canvas, #menu-theme-art svg { width: 34px; height: 34px; }
    #overlay .game-mode-toggle { margin-bottom: 9px; }
    #overlay #startBtn { min-height: 44px; }
    .menu-section { margin-top: 6px; }
    .menu-section-label { margin-bottom: 3px; font-size: 0.5rem; }
    #overlay .menu-action-grid > #vs-live-btn,
    #overlay .menu-action-grid > #lbBtn,
    #overlay .menu-action-grid > #options-btn,
    #overlay .menu-action-grid > #settings-btn,
    #overlay .menu-action-grid > #notifications-btn,
    #overlay .menu-action-grid > #how-to-play-btn,
    #overlay .menu-action-grid > #whats-new-btn,
    #overlay .menu-player-primary-grid > #player-btn,
    #overlay .menu-player-primary-grid > #stats-btn { min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
    #overlay .menu-setup #music-controls { height: 44px; min-height: 44px; margin-bottom: 5px; }
    #overlay .menu-setup #music-controls .music-toggle { height: 42px; min-height: 42px; }
    #overlay .menu-player-primary-grid > #player-btn { min-height: 42px; }
    #overlay .menu-support-grid { margin-top: 5px; }
    .menu-cabinet-footer {
      width: min(calc(100% + 90px), calc(100vw - 8px));
      margin-top: 5px;
      margin-bottom: -34px;
    }
  }
  @media (max-height: 700px) {
    #overlay .ov-content { margin: 12px 0 8px; padding-top: 14px; padding-bottom: 12px; }
    #overlay .ov-content::before {
      inset: 0 4px;
    }
    #overlay .ov-content > .menu-cabinet-shell {
      inset: -10px -9px 0;
      width: calc(100% + 18px);
      height: calc(100% + 10px);
    }
    #overlay h2.menu-brand { width: min(9rem, 18dvh); margin-top: -5px; margin-bottom: 3px; }
    #overlay #menu-theme-marquee { min-height: 32px; margin-bottom: 4px; }
    #overlay #menu-theme-art { width: 32px; height: 32px; flex-basis: 32px; }
    #overlay #menu-theme-art img, #overlay #menu-theme-art canvas, #overlay #menu-theme-art svg { width: 29px; height: 29px; }
    #overlay #mute-btn { margin-top: 11px; }
    #overlay #music-controls { margin-top: 11px; }
    .menu-cabinet-footer {
      width: min(calc(100% + 74px), calc(100vw - 8px));
    }
  }
  /* One fluid mobile cabinet rhythm across browser and installed modes.
     Fill the usable height, then distribute surplus between the major menu
     groups instead of turning it into one device-dependent footer spacer. */
  @media (max-width: 600px) {
    #overlay:not(.run-result) .ov-content {
      min-height: calc(100% - 20px);
      justify-content: space-between;
    }
    #overlay:not(.run-result) .menu-cabinet-footer {
      margin-top: 5px;
      margin-bottom: -10px;
    }
  }
  /* iOS zooms the viewport when a focused text control computes below 16px.
     Keep every touch text-entry surface readable without disabling pinch zoom. */
  @media (hover: none), (pointer: coarse) {
    input,
    textarea,
    select { font-size: 16px !important; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
    body::after { display: none; }
    .vs-advantage-fill { transition: none; }
    #vs-advantage.score-shift .vs-advantage-track { animation: none; }
  }
  @media (hover: hover) and (pointer: fine) {
    #dpad:not(.edit-mode), #turn-controls:not(.edit-mode) { display: none !important; }
  }
