        /* ============ LOBBY ON A PHONE: the same four screens, tighter ======
           lobby.css owns the slide machinery - #lobby[data-step] shows ONE
           screen at EVERY width, and answering a screen advances to the next
           (that auto-advance only runs while this breakpoint is active, which
           is what lobby.js's isStepNarrow() reads the same two numbers for).
           Nothing here re-lays the trail out: it only buys the space back - the
           pills shrink, the podium loses its stat rows, the bar stacks. */
        @media (max-width: 999px), (max-height: 560px) {
            #lobby { font-size: 17px; }
            .lb-top { gap: 6px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-right: calc(56px + env(safe-area-inset-right, 0px)); padding-left: calc(10px + env(safe-area-inset-left, 0px)); }
            .lb-brand { display: none; }
            .lb-rail { gap: 4px; }
            .lb-rail-btn { padding: 6px 8px; font-size: 9px; letter-spacing: 0.05em; }
            /* thumb-sized hit areas: nothing you can tap is under 40px here */
            .lb-icon-btn { width: 44px; height: 44px; }
            .lb-scr { padding-left: calc(10px + env(safe-area-inset-left, 0px)); padding-right: calc(10px + env(safe-area-inset-right, 0px)); }
            .lb-name { gap: 8px; }
            .lb-tag { margin-bottom: 10px; font-size: 13px; }
            .lb-fighter { flex-direction: column-reverse; gap: 6px; }
            /* the podium must be able to give ground: the roster grid is the
               screen's only scroll box (`overflow-y: auto` zeroes a flex item's
               automatic minimum size), so an unsquishable podium squeezes it to
               its padding and the roster shows nothing at all */
            .lb-podium { flex: 0 1 auto; gap: 4px; }
            .lb-art { width: min(132px, 30vh); aspect-ratio: 3 / 4; animation: none; }
            .lb-art-mono { font-size: 40px; }
            .lb-stats { display: none; }
            .lb-hn { font-size: 22px; }
            .lb-hr { margin: 0; font-size: 12px; }
            .lb-roster { flex: 1 1 auto; }
            .lb-search { padding: 10px 16px; font-size: 16px; }
            /* a tile always has an art box: on iOS the square comes from the
               tile's aspect-ratio, and a grid item with a percentage height is
               exactly where that has been known to fall back to content height
               (which is only the name strip, so the fighter never shows) */
            #player-cards .lb-tile { min-height: 66px; }
            /* never a hairline: hold a row of tiles (66px is this tier's own
               column floor) plus the grid's 15px padding */
            .lb-grid {
                grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
                gap: 6px;
                min-height: calc(66px + 30px);
            }
            .lb-cta { padding: 12px 26px; font-size: 14px; }
            .lb-arena { gap: 8px; }
            .lb-car { padding: 14px calc(50% - 96px); gap: 12px; }
            .lb-map { width: 190px; height: 258px; border-radius: 95px 95px 14px 14px; }
            .lb-map-roll { top: 30px; }
            .lb-lines { flex-direction: column; align-items: stretch; gap: 8px; width: 100%; }
            .lb-line { gap: 6px; }
            .lb-seg { flex: 1 1 auto; }
            .lb-seg-btn { flex: 1 1 auto; min-width: 0; padding: 12px 10px; }
            .lb-caption { font-size: 12px; }
            .lb-stages { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
            .lb-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px calc(10px + env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) calc(10px + env(safe-area-inset-left, 0px)); }
            .lb-slots { overflow-x: auto; scrollbar-width: none; }
            .lb-slot { padding: 4px 8px 4px 4px; }
            .lb-slot-art { width: 34px; height: 34px; }
            .lb-slot-nm { font-size: 13px; }
            .lb-slot-sx { font-size: 8px; letter-spacing: 0.05em; }
            .lb-foot { flex-direction: column; align-items: stretch; gap: 8px; }
            .lb-load {
                display: flex;
                align-items: center;
                gap: 8px;
                min-width: 0;
            }
            .lb-picked { max-width: none; text-align: center; white-space: normal; font-size: 12.5px; }
            .lb-note { max-width: none; text-align: center; }
            .lb-buttons { width: 100%; }
            .lb-btn { flex: 1 1 auto; min-width: 0; padding: 15px 18px; }
            .lb-bests { top: auto; bottom: calc(128px + env(safe-area-inset-bottom, 0px)); left: calc(12px + env(safe-area-inset-left, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); width: auto; }
        }

        /* the lobby's motion is decoration: the drifting motes, the floating
           art, the pulsing logo and the slide's scale-in are all things a
           player never asked for - a system that asked for none gets a still
           screen (the art's float is also off on a phone, for the same cost) */
        @media (prefers-reduced-motion: reduce) {
            .lb-bg::before, .lb-bg-stars, .lb-logo, .lb-art, .lb-cta, .lb-gate-title, .lb-gate-vs > div { animation: none; }
            .lb-scr { transition: opacity 0.15s, visibility 0.15s; }
            .lb-tile, .lb-map, .lb-btn, .lb-stage, .lb-rail-btn, .lb-dice { transition: none; }
            .lb-gate.on { animation: none; }
        }

        /* landscape phones: the podium cannot afford a tall art frame - the
           roster row and the arena carousel need the vertical space */
        @media (max-height: 480px) {
            .lb-art { width: 96px; aspect-ratio: 3 / 4; }
            .lb-art-mono { font-size: 34px; }
            .lb-stats { display: none; }
            .lb-fighter { flex-direction: row; gap: 8px; }
            .lb-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
        }

        /* ============ MOBILE / NARROW: compact HUD, big tap targets =====
           The 1250x500 threshold settings.js applyMinimap() uses for its
           minimap cap. The phone's TOP edge is two thin full-width rows
           (Life/XP, then the loadout cells) with the minimap under them; the
           BOTTOM edge belongs to the thumbs - the move ring left, the aim ring
           right with the cast discs arced off it - and the last 30px is the
           corner-button row. Positions are collision-checked for the thumb-arc
           dock; the :has() rules right after cover the top-dock case. */
        @media (max-width: 1250px), (max-height: 500px) {
            #debug-info { display: none; }

            /* ONE source of truth for the thumb geometry, so the cast arc is
               tangent to the AIM area at EVERY phone size rather than at one
               hand-tuned viewport: --ring-d sizes the ghost rings (they read it
               in controls.css) to the stick base input.js already sizes off the
               viewport (radius min(w,h) * 0.22), and --arc-r is the tangent
               itself - the ring's radius plus half a disc. Every offset below
               is built from these; none of them is a magic pixel. */
            :root {
                --ring-inset: 20px;
                --ring-d: clamp(128px, 44vmin, 200px);
                --ring-r: calc(var(--ring-d) / 2);
                --disc: clamp(40px, 12.4vmin, 56px);
                --arc-r: calc(var(--ring-r) + var(--disc) / 2);
            }

            /* THE TOP EDGE: two rows, full width, thin.
               row 1 = HP [====] XP [====] (10px bars, the label printed
                       inside) + the buff chips at the end of the line
               row 2 = the loadout cells (15px, one row of up to 20)
               The portrait / name / level / target read-outs are DROPPED
               here - a phone spends its pixels on the arena; they all stay
               on the desktop tier and in the pause / scoreboard windows. */
            #hud {
                top: calc(6px + env(safe-area-inset-top, 0px));
                bottom: auto;
                left: calc(6px + env(safe-area-inset-left, 0px));
                right: calc(6px + env(safe-area-inset-right, 0px));
                transform: none;
                flex-direction: column;
                align-items: stretch;
                gap: 4px;
                /* the strip spans the whole top edge, where the wave banner
                   and a tap-to-walk click both want to be: nothing on it is a
                   button except the loadout's title / cells */
                pointer-events: none;
            }

            #hud #hud-weapons .hud-panel-title,
            #hud #hud-weapons .weapon-slot { pointer-events: auto; }

            .hud-panel { padding: 2px 4px; border-radius: 6px; background: rgba(6, 8, 14, 0.5); border-width: 1px; }
            #hud-status {
                display: flex;
                flex-direction: row;
                align-items: center;
                gap: 5px;
                width: auto;
            }
            .uf { flex: 1 1 auto; min-width: 0; display: block; }
            .uf-portrait, #hud-name, #target-row { display: none; }
            /* one row: [HP] [XP] [MP when the fighter has it] [gold] */
            .uf-body { display: flex; flex-direction: row; align-items: center; gap: 5px; min-width: 0; }
            .bar { flex: 1 1 0; min-width: 0; height: 10px; border-radius: 99px; }
            .bar.xp { height: 10px; }
            .bar.mp { flex: 0 1 22%; }
            /* the bar prints its own name at the left end and its numbers in
               the middle, so the row needs no label column */
            .bar::before {
                content: "HP";
                position: absolute;
                left: 4px;
                top: 50%;
                transform: translateY(-50%);
                font-size: 6px;
                font-weight: 700;
                letter-spacing: 0.5px;
                color: rgba(255, 255, 255, 0.8);
                text-shadow: 0 1px 2px #000;
                z-index: 2;
            }
            .bar.xp::before { content: "XP"; }
            .bar.mp::before { content: "MP"; }
            .bar-label { font-size: 7px; }
            #hud-topline { flex: none; gap: 3px; }
            #hud-gold { font-size: 8px; }
            #buff-row { flex: none; width: 54px; height: 12px; gap: 2px; }
            /* single line: chips truncate instead of growing the row */
            .buff-chip { font-size: 7px; padding: 0 3px; max-width: 52px; }

            #hud-weapons { width: auto; }
            /* the loadout is ONE row of cells on a phone (the cap is 20 and a
               390px screen fits them all at 15px + 3px); the title stays -
               it is the tap target that expands/collapses the panel */
            #hud-weapons #weapon-list {
                grid-template-columns: repeat(auto-fill, 15px);
                justify-content: start;
                gap: 3px;
                max-height: none;
                overflow-y: visible;
            }
            .weapon-slot { width: 15px; height: 15px; border-radius: 3px; }
            .weapon-icon { width: 12px; height: 12px; }
            .weapon-level { font-size: 6px; right: 0; }
            #hud-weapons .hud-panel-title { font-size: 7px; margin-bottom: 1px; }
            /* while the level-up sheet is open the cells grow (the sheet lands
               right above the thumbs, so the loadout is read at arm's length) */
            #game-container:has(#level-up-modal.level-up-open) .weapon-slot { width: 25px; height: 25px; border-radius: 5px; }
            #game-container:has(#level-up-modal.level-up-open) .weapon-icon { width: 20px; height: 20px; }
            #game-container:has(#level-up-modal.level-up-open) .weapon-level { font-size: 8px; right: 1px; }


            /* the wave banner drops below the two status rows (it is centred,
               so it never meets the top-right minimap) */
            #wave-banner { top: 46px; padding: 2px 10px; }
            #wave-text { font-size: 11px; }
            #wave-enemies { font-size: 9px; }
            /* the event banner (boss entrance / chest / fallen / revived) is a
               28-40px SINGLE line on the desktop sheet: wider than a phone, and
               16% of a short screen lands inside the status rows. Here it is a
               framed card that wraps, parked under the two status rows and
               above the cast arc, and it rides OVER the boss-ult surge (z 900)
               so the card still reads while the screen goes dark. */
            .event-banner {
                top: calc(140px + env(safe-area-inset-top, 0px));
                width: min(86vw, 420px);
                padding: 7px 12px 8px;
                border: 1px solid rgba(243, 217, 139, 0.34);
                border-radius: 10px;
                background-color: rgba(6, 8, 14, 0.66);
                text-align: center;
                font-size: 14px;
                letter-spacing: 0.5px;
                line-height: 1.25;
                text-shadow: 0 1px 3px #000;
                z-index: 950;
            }
            .event-banner.boss-banner {
                font-size: 16px;
                letter-spacing: 1px;
                border-color: rgba(255, 82, 82, 0.55);
                box-shadow: 0 0 22px rgba(255, 40, 40, 0.22);
            }
            .event-banner .eb-title { font-size: 1.3em; letter-spacing: 1.5px; }
            .event-banner .eb-sub { font-size: 0.8em; letter-spacing: 0.4px; margin-top: 2px; }
            /* above the bottom dock, clear of the top-left status column */
            #spectate-hint { top: auto; bottom: calc(128px + env(safe-area-inset-bottom, 0px)); left: 50%; font-size: 10px; }

            /* the bottom edge's last row: pause + gear at the left, the two
               thumb toggles in the middle band (see #dock-toggles), the
               dock-side arrow at the right. No vertical chain here - the
               thumb rings own the row above it. */
            #ability-side-toggle {
                top: auto;
                right: calc(8px + env(safe-area-inset-right, 0px));
                bottom: calc(8px + env(safe-area-inset-bottom, 0px));
                width: 30px;
                height: 30px;
                font-size: 13px;
            }
            #settings-gear {
                top: auto;
                left: calc(42px + env(safe-area-inset-left, 0px));
                right: auto;
                bottom: calc(8px + env(safe-area-inset-bottom, 0px));
                width: 30px;
                height: 30px;
                font-size: 14px;
            }
            body.in-game #settings-gear {
                left: calc(42px + env(safe-area-inset-left, 0px));
                right: auto;
                bottom: calc(8px + env(safe-area-inset-bottom, 0px));
            }
            #pause-button {
                top: auto;
                left: calc(8px + env(safe-area-inset-left, 0px));
                right: auto;
                bottom: calc(8px + env(safe-area-inset-bottom, 0px));
                width: 30px;
                height: 30px;
                font-size: 12px;
            }
            body.in-game #settings-menu { right: calc(8px + env(safe-area-inset-right, 0px)); }


            /* world labels: a phone shows the arena at a fraction of a desktop's
               pixels, so a 14px nametag is twice the size it reads as on a monitor */
            .nametag { font-size: 10px; padding: 1px 5px; border-radius: 5px; }
            .healthbar { width: 30px; height: 4px; }
            .boss-healthbar { width: 92px; height: 7px; }
            .boss-hp-text { font-size: 9px; }
            #stick-knob, #aim-stick-knob { width: calc(var(--disc) * 0.92); height: calc(var(--disc) * 0.92); }
            #paused-banner { font-size: 10px; padding: 3px 10px; }

            /* minimap: moves to the TOP-right so the whole bottom edge is
               free for the ability dock + thumb. The sizes below are the
               fallback before Settings paints its own (inline) width - in a
               live match settings.js caps the player's size to ~19% of the
               short edge on this tier, so the two numbers agree */
            #minimap {
                width: 74px;
                height: 74px;
                top: calc(52px + env(safe-area-inset-top, 0px));
                bottom: auto;
                right: calc(10px + env(safe-area-inset-right, 0px));
                border-width: 1px;
                border-radius: 8px;
            }
            /* THE CAST ROW IS AN ARC ON THE AIM RING. The dock collapses to a
               POINT at the ring's centre (inset + its radius), and the four
               discs ride out to --arc-r = ring radius + half a disc, which is
               the TANGENT: each disc touches the ring and the aiming thumb
               never leaves its circle. The fan runs Q at 240deg (up-left) via
               262 and 284 to R at 306 (up-right), i.e. along the ring's OUTER
               rim: the arena centre and the MOVE ring's rim stay uncovered, and
               every disc stays inside the viewport at both phone clamps. The
               fan's origin is the bar's own anchor, which is the ring centre
               (see the #ability-bar rule below - anchoring it on the strip
               panel's corner is what put the arc in the middle of the screen). side-left / side-right / side-bottom all land on
               this arc, so a stale saved side still sits under the thumb;
               side-top still means top-centre. */
            #ability-dock.side-left,
            #ability-dock.side-right,
            #ability-dock.side-bottom {
                top: auto;
                left: auto;
                right: calc(var(--ring-inset) + var(--ring-r) + env(safe-area-inset-right, 0px));
                bottom: calc(var(--ring-inset) + var(--ring-r) + env(safe-area-inset-bottom, 0px));
                transform: none;
                width: 0;
                height: 0;
            }

            /* the panel is the strip rack (arsenal / magazine / fury / ... and
               the two thumb toggles) - it floats above the arc and flush with
               the screen's right edge, so the arena centre stays uncovered */
            #ability-dock:is(.side-left,.side-right,.side-bottom) .hud-panel {
                position: absolute;
                /* flush with the screen's right edge (the point it hangs from
                   sits --ring-inset + --ring-r inside that edge), and above the
                   topmost disc of the arc */
                right: calc(-1 * (var(--ring-inset) + var(--ring-r) - 10px));
                bottom: calc(var(--arc-r) + var(--disc) / 2 + 6px);
                display: grid;
                justify-items: end;
                gap: 2px;
                padding: 3px 5px;
                width: max-content;
                max-width: 46vw;
            }
            #ability-dock .hud-panel-title { display: none; }
            #ability-dock .arsenal-row,
            #ability-dock .shotgun-strip,
            #ability-dock .snip-strip,
            #ability-dock .frenzy-bank,
            #ability-dock .unleash-bank,
            #ability-dock .hex-bank,
            #ability-dock .fury-bar,
            #ability-dock .ferocity-bar,
            #ability-dock .splinter-bar,
            #ability-dock .grit-bar,
            #ability-dock .style-bar,
            #ability-dock .blade-bar { font-size: 8px; padding: 0 3px; margin-bottom: 2px; }

            /* auto-cast / auto-chase: thumb toggles (a phone has neither the C
               nor the A key). They leave the dock panel - which on this tier
               floats over the arena above the cast arc and is the strips' rack
               - and are pinned to the bottom edge instead, spanning the band
               the pause/gear cluster and the side arrow leave between them. */
            #dock-toggles {
                position: fixed;
                left: calc(80px + env(safe-area-inset-left, 0px));
                right: calc(46px + env(safe-area-inset-right, 0px));
                bottom: calc(8px + env(safe-area-inset-bottom, 0px));
                height: 30px;
                width: auto;
                flex-direction: row;
                align-items: center;
                justify-content: center;
                gap: 4px;
                pointer-events: none;
            }
            #dock-toggles > button { flex: none; width: auto; pointer-events: auto; }
            #auto-cast-indicator,
            #auto-chase-indicator {
                display: inline-block;
                width: auto;
                max-width: 100%;
                margin-top: 0;
                min-height: 30px;
                font-size: 8px;
                padding: 0 5px;
            }

            /* THE BAR IS ANCHORED ON THE RING CENTRE ITSELF. The strip panel is
               `position: absolute` AND content-sized, so an `absolute` bar here
               resolves against the PANEL's corner: the whole arc then floats up
               and right of the ring by the panel's own size, and jumps again
               the moment a kit strip appears. `fixed` with the dock's own
               right/bottom expression puts the origin exactly on the aim ring's
               centre (this tier keeps `transform: none` on these sides, so the
               viewport is the containing block). */
            #ability-dock:is(.side-left,.side-right,.side-bottom) #ability-bar {
                position: fixed;
                left: auto;
                top: auto;
                right: calc(var(--ring-inset) + var(--ring-r) + env(safe-area-inset-right, 0px));
                bottom: calc(var(--ring-inset) + var(--ring-r) + env(safe-area-inset-bottom, 0px));
                width: 0;
                height: 0;
                display: block;
            }
            /* ability slots: circular thumb tiles ON the ring's rim - the angle
               comes in first, then the disc is pushed out to --arc-r (the
               tangent) and un-rotated so it stays upright. The fan runs Q at
               240deg (up-left) via 262 and 284 to R at 306deg (up-right): the
               arena centre, the MOVE ring's rim and both screen edges stay
               clear at both phone clamps. */
            #ability-dock:is(.side-left,.side-right,.side-bottom) .ability-slot {
                position: absolute;
                left: 0;
                top: 0;
                margin: calc(var(--disc) / -2) 0 0 calc(var(--disc) / -2);
                transform: rotate(var(--arc-a)) translateX(var(--arc-r)) rotate(calc(-1 * var(--arc-a)));
            }
            #ability-dock:is(.side-left,.side-right,.side-bottom) .ability-slot:nth-child(1) { --arc-a: 240deg; }
            #ability-dock:is(.side-left,.side-right,.side-bottom) .ability-slot:nth-child(2) { --arc-a: 262deg; }
            #ability-dock:is(.side-left,.side-right,.side-bottom) .ability-slot:nth-child(3) { --arc-a: 284deg; }
            #ability-dock:is(.side-left,.side-right,.side-bottom) .ability-slot:nth-child(4) { --arc-a: 306deg; }
            .ability-slot {
                width: var(--disc);
                height: var(--disc);
                border-radius: 50%;
                border-width: 1px;
            }
            .ability-slot:active { border-color: var(--gold-hi); }
            .ability-name { display: none; }
            .ability-glyph { font-size: 17px; }
            .ability-radial { border-radius: 50%; }
            .ability-key {
                top: -1px;
                left: 50%;
                transform: translateX(-50%);
                border-radius: 0 0 4px 4px;
                font-size: 8px;
                padding: 0 3px;
            }
            .ability-cost {
                left: 0;
                right: 0;
                bottom: 1px;
                text-align: center;
                font-size: 8px;
            }
            .ability-cd { font-size: 13px; }
            .ability-lock { font-size: 9px; border-radius: 50%; }

            /* chat: the top-left corner under the two status rows (the
               minimap owns the top-right); the bottom edge belongs to the
               thumbs and the toggle row. Hidden while empty, 16px input = no
               iOS focus-zoom */
            #chat-container {
                top: calc(52px + env(safe-area-inset-top, 0px));
                bottom: auto;
                left: calc(6px + env(safe-area-inset-left, 0px));
                width: 8em;
                height: 3.4em;
            }
            #chat-container:not(.chat-open):not(.has-messages) { display: none; }
            #chat-messages { font-size: 9px; }
            #chat-input { font-size: 16px; }


            /* settings panel: fit the screen instead of spilling off the
               left edge; the in-game offset (clearing the side toggle) is
               dropped - the open menu just covers the corner it is in */
            #settings-menu { width: min(274px, calc(100vw - 20px)); }
            body.in-game #settings-menu { right: calc(10px + env(safe-area-inset-right, 0px)); }

            /* LEVEL-UP SHEET (mobile): a bottom sheet in the arena band between
               the two status rows and the cast arc, that SCROLLS VERTICALLY.
               Every offer is a full-width row with its WEAPON / PASSIVE badge,
               its column header sticky, and its description never clipped, and
               the ROLL button is the sheet's own bottom row - not a tile
               waiting at the end of a horizontal strip nobody discovers. The
               arena above it stays live (the game keeps running while it
               waits for a pick). */
            #level-up-modal {
                left: calc(6px + env(safe-area-inset-left, 0px));
                right: calc(6px + env(safe-area-inset-right, 0px));
                width: auto;
                /* under the two status rows (bars + loadout cells) */
                top: calc(58px + env(safe-area-inset-top, 0px));
                /* above the topmost disc (262deg is the arc's high point, so all
                   of --arc-r of rise) + a gap */
                bottom: calc(var(--ring-inset) + var(--ring-r) + var(--arc-r) * 1 + var(--disc) / 2 + 14px + env(safe-area-inset-bottom, 0px));
                transform: none;
                flex-direction: column;
                flex-wrap: nowrap;
                align-items: stretch;
                max-height: none;
                overflow: hidden;
            }
            #level-up-header { flex: 0 0 auto; font-size: 11px; padding: 6px 10px; letter-spacing: 1px; }
            #level-up-team { flex: 0 0 auto; font-size: 9px; padding: 0 10px 4px; min-height: 12px; }
            #level-up-options {
                flex: 1 1 auto;
                min-height: 0;
                min-width: 0;
                display: flex;
                flex-direction: column;
                align-items: stretch;
                gap: 5px;
                padding: 2px 6px 10px;
                overflow-x: hidden;
                overflow-y: auto;
                overscroll-behavior: contain;
                scrollbar-width: none;
            }
            #level-up-options::-webkit-scrollbar { display: none; }
            /* the two things that made the sheet a trap: the column header and
               the kind badge were hidden, so a WEAPON offer and a PASSIVE offer
               looked identical and nobody could tell which column a pick spent */
            #level-up-options .lu-section-title {
                display: block;
                position: sticky;
                top: 0;
                z-index: 2;
                font-size: 9px;
                padding: 4px 2px 2px;
                background-color: rgba(12, 9, 24, 0.96);
            }
            #level-up-options .lu-empty { font-size: 10px; padding: 2px; }
            .lu-kind {
                display: inline-block;
                order: 1;
                flex: 0 0 auto;
                font-size: 8px;
                padding: 1px 6px;
            }
            .level-up-option {
                flex: 0 0 auto;
                width: 100%;
                min-height: 52px;
                display: flex;
                flex-wrap: wrap;
                align-items: center;
                gap: 2px 8px;
                padding: 8px 10px;
                border-radius: 8px;
            }
            .lu-icon { order: -1; width: 30px; height: 30px; margin: 0; }
            .lu-name { order: 2; flex: 1 1 auto; font-size: 12.5px; margin: 0; }
            .lu-key {
                order: 3;
                position: static;
                top: auto;
                right: auto;
                min-width: 16px;
                height: 16px;
                line-height: 16px;
                font-size: 9px;
                border-radius: 4px;
                padding: 0 4px;
            }
            .lu-desc {
                order: 4;
                flex: 1 1 100%;
                font-size: 11px;
                line-height: 1.35;
                max-height: none;
                overflow: visible;
            }
            .lu-effect { order: 5; flex: 1 1 100%; font-size: 11px; margin-top: 2px; line-height: 1.3; }
            .lu-scaling, .lu-rarity { order: 6; font-size: 9px; margin-top: 2px; }
            #level-up-roll {
                flex: 0 0 auto;
                align-self: stretch;
                width: auto;
                min-height: 42px;
                margin: 0;
                padding: 6px 10px;
                font-size: 12px;
                border-radius: 0 0 12px 12px;
            }
            #level-up-roll .lu-roll-key { display: none; }
            #level-up-roll .lu-roll-count { font-size: 11px; }

            #scoreboard { width: 94vw; }
            .sb-row {
                grid-template-columns: 1fr 30px 76px 76px 44px;
                font-size: 10px;
            }
            .sb-row span:nth-child(n + 6) { display: none; } /* kills */
            /* the loadout line stays (it is the whole point of the panel on a
               big run) but every part of it shrinks to the icon, not the label */
            .sb-loadout { gap: 6px; padding: 2px 4px 6px; }
            .sb-strip { gap: 4px; }
            .sb-strip-label { font-size: 8px; }
            .sb-slot { width: 20px; height: 20px; }
            .sb-slot .weapon-icon { width: 18px; height: 18px; }
            .sb-chip { font-size: 9px; padding: 1px 4px; }
            #game-over-card { min-width: 0; width: 92vw; padding: 16px 18px; }
            #game-over-title { font-size: 30px; letter-spacing: 2px; }
            #game-over-sub { font-size: 11px; }
            .go-stat { min-width: 72px; padding: 6px 10px; }
            .go-sb-table { font-size: 11px; }
            .go-sb-table th, .go-sb-table td { padding: 4px 5px; }
        }

        /* narrow screens + TOP dock: the centered ability row owns the top
           edge, so it drops below the two status rows (and the wave banner);
           the bottom edge and the thumb arc are free again. */
        @media (max-width: 1250px), (max-height: 500px) {
            /* the top dock must keep transform: none: a transform makes the
               dock the containing block of the fixed #dock-toggles, which is
               centered off the viewport, not off the panel */
            #game-container:has(#ability-dock.side-top) #ability-dock {
                top: calc(56px + env(safe-area-inset-top, 0px));
                left: calc(6px + env(safe-area-inset-left, 0px));
                right: calc(6px + env(safe-area-inset-right, 0px));
                transform: none;
            }
            #game-container:has(#ability-dock.side-top) #ability-dock .hud-panel {
                width: max-content;
                margin-inline: auto;
            }
            #game-container:has(#ability-dock.side-top) #minimap {
                top: calc(150px + env(safe-area-inset-top, 0px));
            }
            #game-container:has(#ability-dock.side-top) #chat-container {
                top: calc(150px + env(safe-area-inset-top, 0px));
            }
            #game-container:has(#ability-dock.side-top) #spectate-hint {
                bottom: calc(12px + env(safe-area-inset-bottom, 0px));
            }
        }

        /* wide desktops: the bottom dock parks next to the (bottom-right)
           minimap instead of the screen center */
        @media (min-width: 1251px) {
            #ability-dock.side-bottom { left: auto; right: 230px; transform: none; }
            /* desktop minimap is bottom-anchored; only re-park it when the
               top dock is active */
            #game-container:has(#ability-dock.side-top) #minimap { top: auto; bottom: 16px; }
        }

        /* short windows: vertical centers collide with the top-right minimap
           (mobile) / top-left status column, so side docks drop to the
           bottom edge (the narrow-screen chat rule above keeps clearing it) */
        @media (max-height: 480px) {
            /* landscape/short: the bottom corners belong to the cast arc, so
               the stick ghosts would only overlap (the sticks still work) */
            .stick-ghost { display: none !important; }
        }

        /* the phone tier in LANDSCAPE: the short edge is the binding one, so
           the ring and the discs get their own clamp - the arc and the sheet
           follow them, because both are built from the same variables */
        @media (max-height: 480px) and (max-width: 1250px) {
            /* the short edge is the binding one here: the ring, the discs and
               therefore the whole arc shrink, and the tangent still holds */
            :root {
                --ring-d: clamp(104px, 28vh, 148px);
                --disc: clamp(34px, 9vh, 46px);
            }
            /* landscape/short: the cast arc cannot also be cleared by a sheet
               that has to hold readable offers, so the sheet takes the band down
               to the safe edge and hands the arc back when it closes */
            #level-up-modal {
                top: calc(50px + env(safe-area-inset-top, 0px));
                bottom: calc(8px + env(safe-area-inset-bottom, 0px));
            }
        }

        /* short WIDE desktops only: the chat box clears the bottom-left dock */
        @media (max-height: 480px) and (min-width: 1251px) {
            #chat-container { left: 80px; bottom: 8px; }
        }

        /* short WIDE desktops: the 200px bottom-right minimap + bottom-left
           HUD leave only a mid-bottom band for side docks */
        @media (min-width: 1251px) and (max-height: 700px) {
            #ability-dock.side-right { top: auto; bottom: 236px; transform: none; }
            #ability-dock.side-left  { top: auto; bottom: 236px; transform: none; }
        }

        /* ============ BIGSCREEN (>= 1700px wide, >= 900px tall) ============
           The HUD is authored for a laptop; on a big display one 68px button
           and a 15px bar read as a footnote floating over the arena. This tier
           scales the READ-ONLY parts (frames, type, tap targets) - never the
           layout: the corners belong to the same panels as everywhere else, and
           the minimap's on-screen size stays the player's Settings slider. */
        @media (min-width: 1700px) and (min-height: 900px) {
            #hud { bottom: calc(26px + env(safe-area-inset-bottom, 0px)); left: calc(26px + env(safe-area-inset-left, 0px)); gap: 14px; }
            .hud-panel { padding: 16px 18px; border-radius: 18px; }
            .hud-panel-title { font-size: 13px; margin-bottom: 10px; }
            #hud-status { width: 420px; }
            #hud-weapons { width: 420px; }
            .uf { gap: 16px; }
            .uf-portrait { width: 86px; height: 86px; padding: 4px; }
            .uf-mono { font-size: 30px; }
            #hud-level { min-width: 36px; height: 26px; line-height: 22px; font-size: 14px; right: -10px; bottom: -4px; }
            #hud-name { font-size: 18px; max-width: 220px; }
            #hud-gold { font-size: 16px; }
            .bar { height: 24px; }
            .bar-label { font-size: 13px; }
            .bar.xp { height: 15px; }
            .bar.xp .bar-label { font-size: 11px; }
            #buff-row { height: 48px; gap: 6px; }
            .buff-chip { font-size: 13px; padding: 2px 10px; }
            #target-row { font-size: 13px; margin-top: 8px; }
            #weapon-list { grid-template-columns: repeat(8, 40px); gap: 6px; }
            .weapon-slot { width: 40px; height: 40px; border-radius: 10px; }
            .weapon-icon { width: 34px; height: 34px; }
            .weapon-level { font-size: 12px; }
            /* clear of the minimap column (Settings sizes it up to 280px) */
            #ability-dock.side-bottom { bottom: calc(26px + env(safe-area-inset-bottom, 0px)); right: 320px; }
            #ability-dock .hud-panel { padding: 14px 16px; }
            #ability-bar { gap: 12px; }
            .ability-slot { width: 96px; height: 96px; border-radius: 18px; }
            .ability-glyph { font-size: 38px; }
            .ability-key { font-size: 15px; padding: 1px 7px; top: 6px; left: 6px; }
            .ability-name { font-size: 11px; padding: 10px 26px 4px 6px; }
            .ability-cost { font-size: 14px; bottom: 5px; right: 7px; }
            .ability-cd { font-size: 28px; }
            .ability-lock { font-size: 15px; }
            #dock-toggles { gap: 10px; }
            #auto-cast-indicator,
            #auto-chase-indicator { min-height: 52px; font-size: 14px; }
            #wave-banner { padding: 8px 26px; }
            #wave-text { font-size: 22px; }
            #wave-enemies { font-size: 14px; }
            #minimap { bottom: calc(26px + env(safe-area-inset-bottom, 0px)); right: calc(26px + env(safe-area-inset-right, 0px)); }
        }
