  /* ===== LEGO-brick design tokens (shared by main menu, in-game menu, join
     tiles, and the controller Help Panel — one source of truth so the whole
     UI is consistent by construction). ===== */
  :root {
    --brick-red: #e5322b; --brick-red-lo: #a81f1a;
    --brick-yellow: #ffcf3f; --brick-yellow-lo: #c99a00;
    --brick-blue: #2f6fe0; --brick-blue-lo: #1c3aa0;
    --brick-green: #57b93a; --brick-green-lo: #2f7d1e;
    --brick-teal: #12b3a3; --brick-teal-lo: #0a7a70;
    --brick-magenta: #c33bd8; --brick-magenta-lo: #7d1f8c;
    --gold: #ffd54f; --gold-lo: #7a5c00;
    --ink: #0b0f24;                 /* heavy dark outline */
    --panel-bg: linear-gradient(180deg, #1c2450 0%, #131a38 100%);
    --gloss: rgba(255, 255, 255, 0.42);
    --type-display: 'Arial Black', 'Segoe UI', Arial, sans-serif;
    --t-fast: 120ms; --t-pop: 180ms;
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --space-1: 6px; --space-2: 10px; --space-3: 16px; --space-4: 24px;
  }
  html, body { margin: 0; padding: 0; overflow: hidden; height: 100%; font-family: Arial, Helvetica, sans-serif; }
  /* The 3D arena renders behind the menu; a soft vignette (not a flat wall)
     keeps it visible while the setup card stays readable. */
  #overlay {
    position: fixed; inset: 0; color: #fff;
    background: radial-gradient(ellipse at 50% 42%, rgba(14, 20, 48, 0.55) 0%, rgba(6, 8, 24, 0.9) 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; z-index: 10; cursor: pointer;
    overflow-y: auto; padding: 20px 0;
    /* 'safe' matters: with plain `center`, content taller than the viewport is
       pushed ABOVE the scroll area and can never be reached (measured on the
       Shield: the wordmark sat at top:-84px). `safe center` centers when it
       fits and falls back to flex-start when it doesn't. */
    justify-content: safe center;
  }
  /* Chunky LEGO wordmark: fat outlined display type, gold with a heavy dark
     edge, tipped a hair so it feels hand-placed. */
  #overlay h1 {
    font-family: var(--type-display); font-size: 58px; margin: 0 0 4px; color: var(--brick-yellow);
    letter-spacing: 1px; transform: rotate(-2deg);
    text-shadow: 0 3px 0 var(--gold-lo), 0 6px 0 var(--ink), 0 10px 16px rgba(0, 0, 0, 0.6);
    -webkit-text-stroke: 2px var(--ink);
  }
  #bigmsg { font-size: 34px; color: var(--gold); margin-bottom: 8px; text-shadow: 0 2px 0 var(--ink); }
  #overlay p { font-size: 18px; margin: 5px 0; }
  /* The setup controls sit on a glossy brick console card so they read over
     the moving arena. */
  #diffbtns {
    background: var(--panel-bg); border: 4px solid var(--gold); border-radius: 22px;
    padding: 16px 26px 18px; margin: 8px 12px; max-width: 680px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.12);
  }
  .setup-h {
    font-family: var(--type-display); font-size: 16px; letter-spacing: 1px; text-transform: uppercase;
    color: var(--gold); margin: 14px 0 6px; text-shadow: 0 2px 0 var(--ink);
  }
  .setup-hint { font-size: 14px; color: #b9c4e6; margin: 4px auto 8px; max-width: 460px; line-height: 1.4; }
  /* Difficulty = big primary brick buttons (green/orange/red set inline). */
  .btn {
    font-family: var(--type-display); font-size: 22px; color: #fff; border: 3px solid var(--ink);
    border-radius: 14px; padding: 12px 28px; margin: 8px; cursor: pointer;
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.45), inset 0 2px 0 var(--gloss);
    transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease, filter var(--t-fast) ease;
  }
  .btn:hover { filter: brightness(1.12); transform: translateY(-2px); }
  .btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), inset 0 2px 0 var(--gloss); }
  /* Small chunky "stud" chips for color / hat / level / game-type picks. */
  .hatbtn, .brick-btn {
    font-family: var(--type-display); font-size: 16px; color: #fff;
    background: linear-gradient(180deg, #46527e 0%, #303a63 100%);
    border: 3px solid var(--ink); border-radius: 12px; padding: 8px 16px; margin: 4px; cursor: pointer;
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.45);
    box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 rgba(255, 255, 255, 0.22);
    transition: transform var(--t-fast) var(--ease-spring), box-shadow var(--t-fast) ease, filter var(--t-fast) ease;
  }
  .hatbtn:hover, .brick-btn:hover { filter: brightness(1.14); transform: translateY(-2px) scale(1.04); }
  .hatbtn:active, .brick-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink), inset 0 2px 0 rgba(255, 255, 255, 0.22); }
  /* Selected pick (color/hat/level) + game-type selection: gold brick. */
  .hatbtn.hatsel, .brick-btn.gtsel {
    border-color: var(--gold);
    background: linear-gradient(180deg, #5a83ff 0%, #274bc4 100%);
    box-shadow: 0 4px 0 var(--brick-blue-lo), 0 0 0 3px rgba(255, 213, 79, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  }
  /* Controller / keyboard FOCUS ring — must read clearly for gamepad nav. */
  .hatbtn.focus, .btn.focus, .brick-btn.focus, .pslot.focus {
    outline: 4px solid var(--gold); outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(255, 213, 79, 0.35), 0 6px 0 var(--ink), inset 0 2px 0 var(--gloss);
    transform: translateY(-2px) scale(1.05);
  }
  /* ---- shared Mode / Difficulty rows ---- */
  .setup-shared { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0; flex-wrap: wrap; }
  .shared-label { font-family: var(--type-display); font-size: 13px; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; }
  #gametyperow, #diffrow { display: inline-flex; gap: 4px; }
  /* ---- lobby shared-strip cursor: a card's D-pad Down drops focus here so any
     player (not just P1) can reach Mode / Difficulty / How-to-play / Controller.
     The gold pulsing ring wraps whichever shared control is focused. ---- */
  .lobbyfocus {
    outline: 4px solid var(--gold); outline-offset: 4px; border-radius: 12px;
    animation: lobbyPulse 0.85s ease-in-out infinite;
  }
  @keyframes lobbyPulse { 0%, 100% { outline-color: rgba(255,213,79,1); } 50% { outline-color: rgba(255,213,79,0.3); } }
  .diffbtn.diffsel {
    border-color: var(--gold);
    background: linear-gradient(180deg, #5a83ff 0%, #274bc4 100%);
    box-shadow: 0 4px 0 var(--brick-blue-lo), 0 0 0 3px rgba(255, 213, 79, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  }
  /* ---- player-join / character-select cards ---- */
  #playerslots {
    display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 6px 0 4px;
  }
  .pcard {
    width: 210px; min-height: 132px; border-radius: 16px; color: #fff;
    border: 4px solid var(--ink); padding: 8px 8px 10px; font-family: var(--type-display);
    background: linear-gradient(180deg, #2b3566 0%, #1a2246 100%);
    box-shadow: 0 5px 0 var(--ink), inset 0 2px 0 var(--gloss);
    display: flex; flex-direction: column; gap: 6px; align-items: stretch;
  }
  .pcard.ready { box-shadow: 0 5px 0 var(--ink), 0 0 0 4px rgba(87, 185, 58, 0.75), inset 0 2px 0 var(--gloss); }
  .pcard-top { display: flex; justify-content: space-between; align-items: center; }
  .pcard-num { font-size: 16px; text-shadow: 0 2px 0 var(--ink); }
  .pcard-dev { font-family: Arial, sans-serif; font-size: 12px; font-weight: bold; color: #b9c4e6; }
  .pcard-persona { display: flex; align-items: center; justify-content: center; gap: 6px; }
  .pcard-arrow {
    font-size: 16px; color: #fff; background: #3a4570; border: 2px solid var(--ink);
    border-radius: 8px; cursor: pointer; width: 30px; height: 30px; line-height: 1; flex: none;
  }
  .pcard-arrow[disabled] { opacity: 0.35; cursor: default; }
  .pcard-swatch { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; display: inline-block; flex: none; }
  .pcard-name { font-size: 14px; flex: 1; text-align: center; }
  .pcard-ready {
    font-family: var(--type-display); font-size: 15px; color: #fff; cursor: pointer;
    border: 3px solid var(--ink); border-radius: 10px; padding: 7px;
    background: linear-gradient(180deg, #5a83ff 0%, #274bc4 100%); box-shadow: 0 3px 0 var(--ink);
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.45);
  }
  .pcard.ready .pcard-ready { background: linear-gradient(180deg, var(--brick-green) 0%, var(--brick-green-lo) 100%); }
  .pcard-leave { font-family: Arial, sans-serif; font-size: 12px; color: #cfd8ff; background: none; border: none; cursor: pointer; }
  .pcard.join, .pcard.kbjoin {
    justify-content: center; align-items: center; border-style: dashed;
    background: linear-gradient(180deg, #33405f 0%, #232d47 100%); text-align: center;
  }
  .pcard.kbjoin { cursor: pointer; }
  .pcard-plus { font-size: 36px; line-height: 1; }
  @media (prefers-reduced-motion: reduce) {
    .btn, .hatbtn, .brick-btn, .pcard-arrow { transition: none; }
    .lobbyfocus { animation: none; }
    #overlay h1 { transform: rotate(0deg); }
  }
  .initbox {
    width: 58px; height: 70px; font-size: 44px; font-weight: bold; color: #fff;
    background: #2c3450; border: 4px solid rgba(255,255,255,0.4); border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
  }
  #scoreboard { margin: 10px 0 4px; font-size: 17px; color: #ffd54f; }
  .blindfx {
    position: fixed; display: none; z-index: 6; pointer-events: none;
    background: #000; align-items: center; justify-content: center;
    color: #7cb342; font-family: 'Arial Black', Arial, sans-serif; font-size: 40px;
    text-shadow: 2px 2px 0 #1a1a1a;
  }
  .scorerow { font-family: 'Courier New', monospace; font-size: 17px; color: #fff; }
  #levelmsg {
    position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%);
    color: #ffd54f; font-size: 46px; font-weight: bold; text-shadow: 0 2px 6px #000;
    z-index: 6; pointer-events: none; display: none;
  }
  /* Popup panels (pause, settings, results, rules, initials) — glossy
     "Lego City" console look: gradient panel, gold trim, chunky 3D buttons. */
  .menu {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #1c2450 0%, #131a38 100%);
    border: 4px solid #ffd54f; border-radius: 20px;
    padding: 26px 46px; z-index: 20; text-align: center; color: #fff;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.12);
  }
  .menu h2 {
    margin: 0 0 18px; font-size: 32px; letter-spacing: 2px; text-transform: uppercase;
    color: #ffd54f; text-shadow: 0 2px 0 #7a5c00, 0 4px 8px rgba(0, 0, 0, 0.6);
  }
  .mbtn {
    display: block; width: 260px; margin: 12px auto; font-size: 20px; font-weight: bold;
    padding: 13px 12px; border-radius: 14px; border: 3px solid rgba(255, 255, 255, 0.85);
    background: linear-gradient(180deg, #5a83ff 0%, #2f55d4 62%, #274bc4 100%); color: #fff; cursor: pointer;
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.45);
    box-shadow: 0 5px 0 #1c3aa0, 0 8px 14px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35);
    transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.08s ease;
  }
  .mbtn:hover {
    filter: brightness(1.1); transform: translateY(-2px);
    box-shadow: 0 7px 0 #1c3aa0, 0 11px 18px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.4);
  }
  .mbtn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #1c3aa0, 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.3);
  }
  /* controller/keyboard-selected button: gold ring + glow */
  .mbtn.sel {
    border-color: #ffd54f; transform: translateY(-2px);
    box-shadow: 0 5px 0 #1c3aa0, 0 0 0 4px rgba(255, 213, 79, 0.55), 0 10px 18px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.4);
  }
  #crosshair {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    color: #fff; font-size: 24px; text-shadow: 0 0 4px #000; z-index: 5; pointer-events: none;
  }
  #paddebug {
    position: fixed; left: 12px; bottom: 12px; z-index: 30; pointer-events: none;
    background: rgba(0, 0, 0, 0.82); color: #7cff7c; border: 2px solid #7cff7c; border-radius: 8px;
    padding: 10px 14px; font-family: 'Courier New', monospace; font-size: 13px; line-height: 1.35;
    white-space: pre; max-width: 60vw; max-height: 70vh; overflow: auto;
  }
  #hud {
    position: fixed; top: 10px; left: 10px; color: #fff; text-shadow: 0 1px 3px #000;
    font-size: 16px; z-index: 5; pointer-events: none; line-height: 1.6;
  }
  #maskoverlay {
    position: fixed; inset: 0; width: 100%; height: 100%; z-index: 4;
    pointer-events: none; display: none;
    animation: breathe 3.2s ease-in-out infinite;
  }
  @keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
  }
  #hudroot { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-family: 'Arial Black', Arial, sans-serif; }
  .hpanel {
    position: fixed; background: rgba(10, 15, 35, 0.55); border: 3px solid rgba(255,255,255,0.9);
    border-radius: 16px; padding: 8px 20px; text-align: center; color: #fff;
  }
  #hudTL { top: 14px; left: 14px; }
  #hudTR { top: 14px; right: 14px; }
  #hudP3 { bottom: 14px; left: 14px; display: none; }
  /* multiplayer game tile (level/difficulty/rivals — never inside a player
     tile); JS moves it bottom-right over the bird's-eye quadrant in 3P */
  #hudGame { top: 14px; left: 50%; transform: translateX(-50%); display: none; }
  #stambar {
    position: fixed; bottom: 64px; left: 50%; transform: translateX(-50%);
    width: 240px; height: 14px; z-index: 5; pointer-events: none;
    background: rgba(0,0,0,0.5); border: 3px solid #fff; border-radius: 8px; overflow: hidden;
  }
  #stamfill { height: 100%; width: 100%; background: #66bb6a; }
  #bossbar {
    position: fixed; top: 108px; left: 50%; transform: translateX(-50%);
    width: 420px; text-align: center; z-index: 5; pointer-events: none;
  }
  #bossname {
    font-family: 'Arial Black', Arial, sans-serif; font-size: 17px; color: #ff8a65;
    text-shadow: 2px 2px 0 #000; letter-spacing: 2px; margin-bottom: 4px;
  }
  #bosstrack {
    height: 18px; background: rgba(0,0,0,0.55); border: 3px solid #fff; border-radius: 10px; overflow: hidden;
  }
  #bossfill { height: 100%; width: 100%; background: #e53935; }
  #minimap {
    position: fixed; right: 14px; bottom: 14px; z-index: 5;
    border: 3px solid rgba(255,255,255,0.75); border-radius: 8px;
    background: rgba(10, 15, 35, 0.6);
  }
  .hlabel { font-size: 14px; letter-spacing: 2px; color: #ffd54f; text-transform: uppercase; text-shadow: 1px 1px 0 #000; }
  .hbig { font-size: 42px; line-height: 1.05; text-shadow: 3px 3px 0 #000; }
  .hsub { font-size: 13px; color: #b3e5fc; text-shadow: 1px 1px 0 #000; }
  #slots { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 18px; }
  .slotbox {
    width: 104px; height: 78px; background: rgba(10, 15, 35, 0.55);
    border: 4px solid rgba(255,255,255,0.9); border-radius: 16px; position: relative;
    display: flex; align-items: center; justify-content: center;
  }
  .slotname { font-size: 16px; color: #fff; text-align: center; text-shadow: 2px 2px 0 #000; padding: 0 6px; line-height: 1.2; }
  .slotkey {
    position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%);
    background: #ffd54f; color: #1a2036; font-size: 15px; width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; border: 3px solid #fff;
  }
  #hudBL { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; }
  .chip {
    background: rgba(10, 15, 35, 0.55); border: 3px solid; border-radius: 999px; color: #fff;
    font-size: 16px; padding: 7px 18px; display: flex; align-items: center; gap: 9px; text-shadow: 1px 1px 0 #000;
  }
  .chip i { width: 15px; height: 15px; border-radius: 50%; display: inline-block; border: 2px solid rgba(255,255,255,0.7); }
  .chip b { font-size: 22px; }
  .pmsg {
    position: fixed; z-index: 6; pointer-events: none; display: none;
    transform: translateX(-50%); text-align: center;
    color: #ffd54f; font-family: 'Arial Black', Arial, sans-serif; font-size: 19px;
    text-shadow: 2px 2px 0 #000;
  }
  .cdnum {
    /* kart-racer countdown: one per viewport, centered via left/top from JS */
    position: fixed; z-index: 7; pointer-events: none; display: none;
    transform: translate(-50%, -50%); text-align: center;
    color: #ffd54f; font-family: 'Arial Black', Arial, sans-serif; font-size: 110px;
    -webkit-text-stroke: 4px #1a2036;
    text-shadow: 6px 6px 0 rgba(0,0,0,0.8);
  }
  .cdnum.scoot { font-size: 58px; color: #aeea00; letter-spacing: 2px; }
  .rtable { margin: 8px auto 14px; border-collapse: collapse; font-size: 17px; }
  .rtable th { padding: 3px 12px; font-size: 18px; text-shadow: 1px 1px 0 #000; }
  .rtable td { padding: 3px 12px; color: #fff; }
  .rtable td.rlabel { text-align: left; color: #b3e5fc; }
  .rtable td.rval { text-align: center; font-family: 'Courier New', monospace; font-size: 18px; font-weight: bold; }
  /* Controller Help Panel — glossy "Lego City" look, matches .menu */
  #helppanel {
    width: 680px; max-width: 94vw; max-height: 90vh; overflow-y: auto;
  }
  #helptoggle {
    display: flex; gap: var(--space-1); justify-content: center;
    margin: 0 auto var(--space-3);
  }
  .helptypebtn {
    font-family: var(--type-display); font-size: 16px; font-weight: bold;
    padding: 8px 18px; border-radius: 12px; cursor: pointer; color: #fff;
    border: 3px solid rgba(255, 255, 255, 0.85);
    background: linear-gradient(180deg, #3a4560 0%, #26324a 100%);
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.45);
    box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 rgba(255, 255, 255, 0.25);
    transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease, filter var(--t-fast) ease;
  }
  .helptypebtn:hover { filter: brightness(1.12); transform: translateY(-2px); }
  .helptypebtn.sel {
    border-color: var(--gold);
    background: linear-gradient(180deg, #5a83ff 0%, #274bc4 100%);
    box-shadow: 0 4px 0 var(--brick-blue-lo), 0 0 0 3px rgba(255, 213, 79, 0.55),
                inset 0 2px 0 rgba(255, 255, 255, 0.4);
  }
  #helphint {
    text-align: center; color: var(--gold); font-weight: bold;
    margin: 0 auto var(--space-2); min-height: 20px; font-size: 15px;
  }
  #helpstage {
    max-width: 600px; margin: 0 auto var(--space-3);
  }
  #helpstage svg { display: block; width: 100%; height: auto; }
  #helpclose { margin-top: var(--space-2); }
  @media (prefers-reduced-motion: reduce) {
    .helptypebtn { transition: none; }
    .helptypebtn:hover { transform: none; }
  }

  /* ---- START: the deliberate launch. Everyone readies on their card, then
     somebody presses this. Disabled until the whole group is ready, and the
     hint underneath names who we are still waiting on. ---- */
  #startrow { margin: 8px 0 2px; }
  .startbtn {
    font-family: var(--type-display); font-size: 26px; letter-spacing: 2px;
    color: #fff; border: 3px solid var(--ink); border-radius: 16px;
    padding: 12px 54px; cursor: pointer;
    background: linear-gradient(180deg, #6a7490 0%, #49516b 100%);
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.45), inset 0 2px 0 var(--gloss);
    transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease,
                background var(--t-pop) ease;
  }
  .startbtn:disabled { opacity: 0.55; cursor: default; }
  .startbtn.on {
    background: linear-gradient(180deg, var(--brick-green) 0%, var(--brick-green-lo) 100%);
    animation: startPulse 1.1s ease-in-out infinite;
  }
  .startbtn.on:hover { transform: translateY(-2px); }
  .startbtn.on:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); }
  @keyframes startPulse {
    0%, 100% { box-shadow: 0 6px 0 rgba(0,0,0,0.45), inset 0 2px 0 var(--gloss), 0 0 0 0 rgba(87,185,58,0.55); }
    50%      { box-shadow: 0 6px 0 rgba(0,0,0,0.45), inset 0 2px 0 var(--gloss), 0 0 22px 7px rgba(87,185,58,0.45); }
  }
  @media (prefers-reduced-motion: reduce) { .startbtn.on { animation: none; } }
  .starthint { font-size: 14px; color: #b9c4e6; margin: 5px 0 0; min-height: 1.2em; }
  .starthint b { color: var(--gold); }

  /* Per-card button legend. The letters come from the pad's own type (see
     lettersFor in ui.js) -- a Switch pad says B where an Xbox pad says A. */
  .pcard-hint {
    font-family: Arial, Helvetica, sans-serif; font-weight: bold;
    font-size: 11px; color: #9fb0da; line-height: 1.3; margin: 1px 0 0;
  }

  /* ===== Short viewports: TV =====================================
     An NVIDIA Shield on a 1080p TV gives the page about 1005x565 CSS pixels
     (1920x1080 at devicePixelRatio ~1.9) -- barely more than half the height
     a laptop window has. The lobby measured 721px tall there, so the wordmark
     scrolled off the top and the How-to-play / Controller buttons clipped off
     the bottom, with no comfortable way to scroll using a gamepad.

     This trims ~265px of vertical padding, type and decoration so the whole
     lobby fits on screen at once. Keep it measurable: `python
     tools/measure_tv.py` reports the real numbers at TV viewports.
     ================================================================ */
  @media (max-height: 620px) {
    #overlay { padding: 6px 0; }
    #overlay h1 { font-size: 24px; margin: 0 0 1px; -webkit-text-stroke-width: 1px; }
    /* The "Blast the toilet paper..." tagline is pure flavour; the How-to-play
       panel carries the real explanation. First to go when space is tight. */
    #overlay > p { display: none; }
    #bigmsg { font-size: 22px; margin-bottom: 3px; }

    #diffbtns { padding: 5px 16px 7px; margin: 3px 12px; border-width: 3px; }
    .setup-h { font-size: 12px; margin: 2px 0 2px; }
    .setup-hint { font-size: 11px; margin: 2px auto 4px; max-width: 620px; line-height: 1.3; }
    .setup-shared { margin: 2px 0; gap: 8px; }
    .shared-label { font-size: 12px; }

    .pcard { min-height: 76px; width: 152px; padding: 4px 5px 5px; gap: 2px; }
    #playerslots { gap: 6px; margin: 2px 0 1px; }

    .btn { font-size: 17px; padding: 7px 16px; margin: 4px; }
    .brick-btn { font-size: 15px; padding: 6px 12px; }
    .hatbtn { font-size: 14px; padding: 5px 12px; }
    #padstatus { font-size: 13px; margin-top: 2px; }
    #startrow { margin: 3px 0 0; }
    .startbtn { font-size: 19px; padding: 6px 30px; border-width: 2px; letter-spacing: 1px; }
    .starthint { font-size: 11px; margin-top: 2px; }
    .pcard-hint { font-size: 10px; }

    /* The join paragraph is now redundant: every card and the join tile carry
       their own button legend, in that pad's own letters. */
    #joinhint { display: none; }
    /* Mode and Difficulty share one row -- a whole row of vertical budget back,
       and they read as the pair of settings they are. */
    #sharedrows { display: flex; justify-content: center; align-items: center;
                  flex-wrap: wrap; gap: 14px; }
    #sharedrows .setup-shared { margin: 1px 0; }
    /* The long "Each player: pick character / ready / D-pad Down..." footnote.
       Same information lives on the How-to-play panel. */
    #diffbtns > p:last-child { display: none; }
  }
