        /* ability bar */
        #ability-bar { display: flex; gap: 8px; flex-wrap: wrap; }

        /* The Lunari arsenal strip (Aphelios, game_logic/kits/aphelios_kit.py): three rows -
           MAIN / OFF / NEXT - each the gun's authored name and its magazine as `left /
           magazine`. The magazine is a RESOURCE the player spends (every shot and every
           ability burns rounds, and a dry main hand is DISCARDED), so it is drawn next to
           the bar rather than buried in a tooltip. The NEXT row is marked because it is
           what the E slot exists to show. */
        .arsenal-strip {
            display: flex;
            flex-direction: column;
            gap: 2px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
        }
        .arsenal-strip[hidden] { display: none; }
        .arsenal-row {
            display: flex;
            align-items: baseline;
            gap: 6px;
            padding: 1px 4px;
            border-left: 2px solid #3d4655;
            background: rgba(20, 24, 32, 0.55);
        }
        .arsenal-row.main { border-left-color: #8fd3ff; }
        .arsenal-row.off { border-left-color: #6f7f96; }
        .arsenal-row.next { border-left-color: #d8b45e; }
        .arsenal-slot { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; }
        .arsenal-weapon { flex: 1; white-space: nowrap; }
        .arsenal-ammo { font-variant-numeric: tabular-nums; color: #e7eef8; }
        /* a barrel that is running low is the state the next shot can end: the number
           goes red BEFORE the discard happens */
        .arsenal-ammo.low { color: #ff8a7a; }
        .arsenal-ammo.dry { color: #ff5c5c; font-weight: 700; }

        /* New Destiny's magazine (Graves, game_logic/kits/graves_kit.py): one pip per SHELL, because "four
           bullets, then the gun must reload" is a count the party cannot read off a buff chip - the
           `Reloading` pip on the buff bar is a NAME, not a meter (the Adoration / arsenal / wards rule,
           docs/wire-protocol.md). Pips rather than a number row because a shotgun's magazine is read at a
           glance mid-fight, and the count is printed beside them for the same reason Aphelios's rounds
           are: the shell that cannot be paid is a swing that does not happen. */
        .shotgun-strip {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
            padding: 1px 4px;
            border-left: 2px solid #b2a89b;   /* the cloud's own ash grey (client_zone.js) */
            background: rgba(20, 24, 32, 0.55);
        }
        .shotgun-strip[hidden] { display: none; }
        .shotgun-label { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; }
        .shotgun-strip.reloading .shotgun-label { color: #d8b45e; }
        .shotgun-pip {
            width: 7px;
            height: 14px;
            border-radius: 2px 2px 3px 3px;
            background: #6b4a2f;              /* an empty shell: brass case, no charge */
            border: 1px solid #3d4655;
        }
        .shotgun-pip.full { background: #e0a13c; border-color: #f0a24a; }
        /* the cycle is a WINDOW the player plans around (Quickdraw works one shell back into the breech,
           and a gun mid-cycle fires nothing), so every shell reads as moving while it runs */
        .shotgun-pip.cycling { background: #7d5f3a; border-color: #d8b45e; }
        .shotgun-count { font-variant-numeric: tabular-nums; color: #e7eef8; margin-left: 2px; }
        .shotgun-count.dry { color: #ff5c5c; font-weight: 700; }

        /* Snip Snip!'s stack bank (Gwen's Q, game_logic/kits/gwen_kit.py, the `snips` field of her diff).
           "Gains 1 stack when she hits an enemy with an attack. Snip Snip! consumes the stacks to snip
           one extra time each" is a resource the BUTTON is paid from, and it is the one number on this
           bar that can be EMPTY on a button that is READY - which is exactly why it cannot live on a buff
           chip (the `HallowedMist` / `SkipNSlash` chips on the buff bar are NAMES, not meters - the
           Adoration / arsenal / wards / magazine rule, docs/wire-protocol.md). Four pips because
           `stack_max` is authored 4, and the count is printed beside them because a press throws
           1 + stacks + 1 snips and the party is spending that, not "a stack". */
        .snip-strip {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
            padding: 1px 4px;
            border-left: 2px solid #dffbe4;   /* the Mist's own hallowed mint (client_zone.js) */
            background: rgba(20, 24, 32, 0.55);
        }
        .snip-strip[hidden] { display: none; }
        .snip-label { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; }
        .snip-pip {
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: #2c3542;              /* an unfilled snip: the loop of an open pair of shears */
            border: 1px solid #3d4655;
        }
        .snip-pip.full { background: #dffbe4; border-color: #f4ffe9; }
        .snip-count { font-variant-numeric: tabular-nums; color: #e7eef8; margin-left: 2px; }
        .snip-count.dry { color: #ff5c5c; font-weight: 700; }

        /* Wolf's Frenzy's bank (Kindred's W passive, game_logic/kits/kindred_kit.py): the third strip on this
           bar after the shotgun's shells and Gwen's snips - a resource the button's PAYOFF is paid from,
           which can be empty on a row that is READY. A bar rather than pips because the bank is a hundred
           deep and the wire sends it quantised to a twentieth of itself (`the kit's `wire=` row`: the stack
           grows off her FEET every tick, and an integer that moved seven times a second would put a diff
           entry on the wire several times a second for a meter nobody reads that finely - the Gnar `rage`
           rounding note), so the fill has 20 possible widths and nothing finer. The ARM itself needs no
           style here - `PacksFavor` rides the buff bar as a NAME - this is only the progress to it. */
        .frenzy-bank {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
            padding: 1px 4px;
            border-left: 2px solid #c98f4a;   /* the disc's own wolf-hide amber (client_zone.js) */
            background: rgba(20, 24, 32, 0.55);
        }
        .frenzy-bank[hidden] { display: none; }
        .frenzy-label { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; }
        .frenzy-track {
            display: inline-block;
            width: 92px;
            height: 8px;
            border-radius: 4px;
            background: #2c3542;              /* the ground the Wolf has not been told to hold yet */
            border: 1px solid #3d4655;
            overflow: hidden;
        }
        .frenzy-fill {
            display: block;
            height: 100%;
            width: 0;
            background: #8d6534;              /* the fill a stride and a swing bought */
        }
        .frenzy-count { font-variant-numeric: tabular-nums; color: #e7eef8; }
        .frenzy-count.armed { color: #e8b26a; font-weight: 700; }

        /* Cultivation of Spirit's Unleash bank (Yunara's Q passive, game_logic/kits/yunara_kit.py, the
           `unleash` field of her diff): the fourth strip on this bar, for the same reason as the three
           above it - a resource the button's PAYOFF is paid from, which can be empty on a row that is
           READY (her Q refuses a partial bank and stamps no cooldown, so the ring says nothing). Pips
           because the cap is a small integer the row authors (`unleash_max`) and the question is
           "is it live yet"; the empty pip is a bead on an open strand, the filled one a bead she has
           already counted. The gold is the Vow's own, and it is also what the strip turns while the
           Spirit window stands - the press is then free of the bank, so the count says SPIRIT. */
        .unleash-bank {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
            padding: 1px 4px;
            border-left: 2px solid #e8b26a;   /* the Vow's gold (ability_vfx.js buff colour) */
            background: rgba(20, 24, 32, 0.55);
        }
        .unleash-bank[hidden] { display: none; }
        .unleash-bank.spirit { border-left-color: #dffbe4; }
        .unleash-label { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; }
        .unleash-pip {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #2c3542;
            border: 1px solid #3d4655;
        }
        .unleash-pip.full { background: #e8b26a; border-color: #f6d9a4; }
        .unleash-count { font-variant-numeric: tabular-nums; color: #e7eef8; margin-left: 2px; }
        .unleash-count.armed { color: #e8b26a; font-weight: 700; }
        .unleash-count.spirit { color: #dffbe4; font-weight: 700; }

        /* Glorious Evolution's Hex bank (Viktor's passive, game_logic/kits/viktor_kit.py): the four AUGMENT rungs
           he already holds and the progress to the next one. The fill is the bank MODULO the step (the wire
           sends `progress` over `fragment_step`, never a percentage: the rung is a THRESHOLD the sim reads off
           a bank, so the client is told where the bank stands and not what it means), and a bought letter is
           lit because "my E exploded" is a fact about a slot the slot's own ring cannot show. Hex violet
           because it is the only strip on this bar that is not a fighter's own resource colour. */
        .hex-bank {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
            padding: 1px 4px;
            border-left: 2px solid #8f6fd8;   /* the hex core's violet (viktor_kit.py's wire) */
            background: rgba(20, 24, 32, 0.55);
        }
        .hex-bank[hidden] { display: none; }
        .hex-label { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; }
        .hex-track {
            display: inline-block;
            width: 92px;
            height: 8px;
            border-radius: 4px;
            background: #2c3542;              /* the bank the next fragment has not reached yet */
            border: 1px solid #3d4655;
            overflow: hidden;
        }
        .hex-fill {
            display: block;
            height: 100%;
            width: 0;
            background: #6f4fb8;              /* the fragments this rung has already eaten */
        }
        .hex-rungs { font-variant-numeric: tabular-nums; letter-spacing: 2px; color: #6d7889; }
        .hex-rungs b { font-weight: 600; }
        .hex-rungs b.lit { color: #b79bff; }   /* a rung his bank already bought */

        /* Reign of Anger's Fury bar (Renekton's passive, game_logic/kits/renekton_kit.py): the fourth strip on
           this bar, and the only one whose GATE is drawn - the tick inside the track is the authored
           `empower_threshold`, the line his rows' second number sits behind. The fill is the additive
           `fury` key on his own diff entry, rounded to a tenth (`the kit's `wire=` row`), so the bar has a
           hundred plausible widths and the tenth of a point the wire keeps is finer than anyone reads. */
        .fury-bar {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
            padding: 1px 4px;
            border-left: 2px solid #c2a26a;   /* the sandstone of his Q disc (ability_vfx.js) */
            background: rgba(20, 24, 32, 0.55);
        }
        .fury-bar[hidden] { display: none; }
        .fury-label { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; }
        .fury-track {
            position: relative;
            display: inline-block;
            width: 92px;
            height: 8px;
            border-radius: 4px;
            background: #2c3542;
            border: 1px solid #3d4655;
        }
        .fury-fill {
            display: block;
            height: 100%;
            width: 0;
            border-radius: 3px;
            background: #8f6d33;              /* the Fury one swing bought */
        }
        .fury-gate {
            position: absolute;
            top: -1px;
            width: 2px;
            height: 10px;
            background: #e0c37f;              /* the gate: above it, an empowered cast */
        }
        .fury-count { font-variant-numeric: tabular-nums; color: #e7eef8; }
        .fury-count.armed { color: #e8c26a; font-weight: 700; }

        .ferocity-bar {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
            padding: 1px 4px;
            border-left: 2px solid #8f2f2f;
            background: rgba(20, 24, 32, 0.55);
        }
        .ferocity-bar[hidden] { display: none; }
        .ferocity-label { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; margin-right: 2px; }
        .ferocity-pip {
            display: inline-block;
            width: 10px;
            height: 10px;
            border-radius: 2px;
            transform: rotate(45deg);
            background: #2c3542;
            border: 1px solid #3d4655;
        }
        .ferocity-pip.full { background: #a33636; border-color: #d05252; }

        /* Splinters of Wrath (Syndra's Transcendent, game_logic/kits/syndra_kit.py): four gates, one per
           row, painted in the amethyst her spheres and her footprints are drawn in - never the Fury
           gold or the Ferocity red, because this counter upgrades a KIT rather than arming a press. */
        .splinter-bar {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
            padding: 1px 4px;
            border-left: 2px solid #4b2470;
            background: rgba(20, 24, 32, 0.55);
        }
        .splinter-bar[hidden] { display: none; }
        .splinter-label { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; margin-right: 2px; }
        .splinter-pip {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 13px;
            height: 13px;
            border-radius: 3px;
            font-style: normal;
            font-size: 9px;
            color: #6d7a8d;
            background: #2c3542;
            border: 1px solid #3d4655;
        }
        .splinter-pip.full { color: #f0e2ff; background: #6b2d8a; border-color: #9a3fd8; }
        .splinter-count { font-variant-numeric: tabular-nums; color: #e7eef8; }
        .splinter-count.armed { color: #b46bff; font-weight: 700; }
        .ferocity-count { font-variant-numeric: tabular-nums; color: #e7eef8; margin-left: 4px; }
        .ferocity-count.armed { color: #f07b5a; font-weight: 700; }

        /* Pit Grit's bank (Sett, game_logic/kits/sett_kit.py): one track, no gate, because the bank has no
           empowered THRESHOLD - his W spends whatever is in it WHOLE, and the fill is the additive
           `grit` key on his own entry (`the kit's `wire=` row`) measured against `grit_cap_pct` times the
           wire's live `max_hp`. The strip is the only way a pilot can tell an empty Haymaker from a
           full one, since the bank itself never appears as a number anywhere else. */
        .grit-bar {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
            padding: 1px 4px;
            border-left: 2px solid #b4632f;   /* the pit's lantern orange (his W ring) */
            background: rgba(20, 24, 32, 0.55);
        }
        .grit-bar[hidden] { display: none; }
        .grit-label { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; }
        .grit-track {
            position: relative;
            display: inline-block;
            width: 92px;
            height: 8px;
            border-radius: 4px;
            background: #2c3542;
            border: 1px solid #3d4655;
        }
        .grit-fill {
            display: block;
            height: 100%;
            width: 0;
            border-radius: 3px;
            background: #8a4f2a;              /* the damage he is still standing in */
        }
        .grit-count { font-variant-numeric: tabular-nums; color: #e7eef8; }
        .grit-count.armed { color: #e08a4a; font-weight: 700; }

        .style-bar {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
            padding: 1px 4px;
            border-left: 2px solid #b07a2a;
            background: rgba(20, 24, 32, 0.55);
        }
        .style-bar[hidden] { display: none; }
        .style-label { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; margin-right: 2px; }
        .style-pip {
            display: inline-block;
            width: 10px;
            height: 10px;
            border-radius: 2px;
            background: #2c3542;
            border: 1px solid #3d4655;
        }
        .style-pip.full { background: #a9762a; border-color: #e0b25c; }
        .style-grade {
            font-weight: 700;
            font-size: 12px;
            color: #93a2b8;
            margin-left: 4px;
            min-width: 12px;
            text-align: center;
        }
        .style-grade.armed { color: #f0c25a; }

        .blade-bar {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-bottom: 6px;
            font-size: 11px;
            color: #cfd8e6;
            user-select: none;
            padding: 1px 4px;
            border-left: 2px solid #2f6f8f;
            background: rgba(20, 24, 32, 0.55);
        }
        .blade-bar[hidden] { display: none; }
        .blade-label { font-weight: 600; letter-spacing: 0.4px; color: #93a2b8; margin-right: 2px; }
        .blade-pip {
            display: inline-block;
            width: 10px;
            height: 10px;
            border-radius: 2px;
            transform: rotate(45deg);
            background: #2c3542;
            border: 1px solid #3d4655;
        }
        .blade-pip.full { background: #3f8fae; border-color: #62c3e0; }
        .blade-count { font-variant-numeric: tabular-nums; color: #e7eef8; margin-left: 4px; }
        .blade-count.armed { color: #7fd8f0; font-weight: 700; }

        .ability-slot {
            /* tap = instant cast on the DOWN (see public/hud.js), and NONE, not
               manipulation: with a second finger already panning the canvas, a
               touch-action that still allows a pan/pinch makes the browser fold
               this tap into that gesture and no click ever arrives */
            touch-action: none;
            -webkit-tap-highlight-color: transparent;
            position: relative;
            width: 76px;
            height: 76px;
            background-image: linear-gradient(160deg, #2a1d52, #150e30);
            border: 1px solid var(--line);
            border-radius: 14px;
            overflow: hidden;
            user-select: none;
            color: var(--ink);
            cursor: pointer;
            transition: border-color 0.15s, filter 0.15s, box-shadow 0.15s;
        }

        .ability-slot:hover { border-color: var(--gold); }

        .ability-slot:active { border-color: var(--gold-hi); box-shadow: 0 0 14px rgba(243, 217, 139, 0.45); }

        /* OFF = locked by level, unaffordable or burning a cooldown: the tile
           loses its colour rather than fading out, so a ready button and a dead
           one are told apart at a glance even at arm's length */
        .ability-slot.disabled {
            filter: saturate(0.25) brightness(0.72);
        }

        .ability-slot.ready {
            border-color: var(--gold);
            box-shadow: 0 0 12px rgba(243, 217, 139, 0.3);
        }

        /* the spell's own art (/assets/images/spell/<Name><KEY>.png, public/art_paths.js);
           the glyph is the tile drawn when the roster ships no art for the row */
        .ability-icon {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: none;
            z-index: 1;
        }

        .ability-slot.has-art .ability-icon { display: block; }

        .ability-glyph {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: var(--hud-display);
            font-size: 30px;
            font-weight: 800;
            color: var(--gold);
            z-index: 1;
        }

        .ability-slot.has-art .ability-glyph { display: none; }

        /* the cooldown, twice: a radial sweep from the top (--cd, the share of the
           row's cooldown still burning) and the bottom-up fill the checks read */
        .ability-radial {
            position: absolute;
            inset: 0;
            background: conic-gradient(from -90deg, rgba(4, 2, 14, 0.74) calc(var(--cd, 0) * 360deg), rgba(0, 0, 0, 0) 0);
            z-index: 2;
        }

        .ability-fill {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 0%;
            background-color: rgba(4, 2, 14, 0.35);
            z-index: 2;
        }

        .ability-key {
            position: absolute;
            top: 4px;
            left: 4px;
            min-width: 16px;
            text-align: center;
            font-family: var(--hud-display);
            font-size: 12px;
            font-weight: 800;
            color: #2a1546;
            background-color: var(--gold);
            border-radius: 6px;
            padding: 0 4px;
            z-index: 4;
        }

        .ability-name {
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            text-align: center;
            font-size: 10px;
            font-weight: 700;
            color: var(--ink);
            background: linear-gradient(transparent, rgba(4, 2, 14, 0.88) 40%);
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            padding: 8px 20px 2px 4px;
            box-sizing: border-box;
            z-index: 4;
        }

        .ability-cost {
            position: absolute;
            bottom: 3px;
            right: 4px;
            font-size: 12px;
            font-weight: 700;
            color: #9ad0ff;
            text-shadow: 0 1px 2px #000;
            z-index: 4;
        }

        .ability-slot.nomana .ability-cost { color: #ff8a8a; }

        .ability-cd {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 21px;
            font-weight: 800;
            color: #fff;
            text-shadow: 0 0 4px #000, 0 1px 2px #000;
            z-index: 4;
        }

        .ability-lock {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: rgba(4, 2, 14, 0.72);
            font-family: var(--hud-display);
            font-size: 13px;
            font-weight: 800;
            color: var(--mut);
            z-index: 5;
        }

        /* hud.js empties the badge the moment the row unlocks; an empty badge
           must not leave a scrim over the art */
        .ability-lock:empty { background-color: transparent; }

        /* --------------------------------- ability dock (side-placed) ----
           The Q/W/E/R slots live on a configurable screen edge (LEFT/TOP/
           RIGHT/BOTTOM; the round button cycles them). The dock is a DOM
           sibling ABOVE the canvas, so touching it never starts the
           virtual joystick (stick touches only land on the canvas). */
        #ability-dock {
            position: absolute;
            z-index: 60;
            display: none; /* startGame() shows it */
        }

        #ability-dock .hud-panel { padding: 10px 12px; }

        #ability-dock .hud-panel-title { margin-bottom: 6px; }

        /* the per-kit strips (arsenal / magazine / snip / frenzy / hex / fury /
           grit / style / blade / splinter) sit above the buttons and carry their
           own resource colour on the left edge - retinted to this panel's ink so
           they read as part of the frame, not as a second theme */
        #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 {
            background: rgba(4, 2, 14, 0.5);
            color: var(--ink);
        }

        #ability-dock .arsenal-slot,
        #ability-dock .shotgun-label,
        #ability-dock .snip-label,
        #ability-dock .frenzy-label,
        #ability-dock .unleash-label,
        #ability-dock .hex-label,
        #ability-dock .fury-label,
        #ability-dock .ferocity-label,
        #ability-dock .splinter-label,
        #ability-dock .grit-label,
        #ability-dock .style-label,
        #ability-dock .blade-label { color: var(--mut); }

        #ability-dock .arsenal-track,
        #ability-dock .frenzy-track,
        #ability-dock .hex-track,
        #ability-dock .fury-track,
        #ability-dock .grit-track { border-color: rgba(255, 255, 255, 0.16); }

        /* notch/home-indicator safe areas (viewport-fit=cover): env() is 0
           on desktops, so these are no-ops there */
        #ability-dock.side-left  { left: calc(10px + env(safe-area-inset-left, 0px));   top: 50%; transform: translateY(-50%); }

        #ability-dock.side-right { right: calc(10px + env(safe-area-inset-right, 0px));  top: 50%; transform: translateY(-50%); }

        #ability-dock.side-top   { top: calc(10px + env(safe-area-inset-top, 0px));    left: 50%; transform: translateX(-50%); }

        #ability-dock.side-bottom{ bottom: calc(10px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); }

        #ability-dock.side-left #ability-bar,

        #ability-dock.side-right #ability-bar { flex-direction: column; }

        #ability-side-toggle {
            position: absolute;
            top: 10px;
            right: 10px;
            z-index: 61;
            width: 46px;
            height: 46px;
            border-radius: 50%;
            border: 1px solid var(--line);
            background-image: linear-gradient(160deg, var(--panel-a), var(--panel-b));
            color: var(--gold);
            font-size: 20px;
            font-weight: bold;
            line-height: 1;
            cursor: pointer;
            touch-action: manipulation;
            user-select: none;
            -webkit-user-select: none;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
        }

        #ability-side-toggle:active { background-color: rgba(70, 70, 90, 0.9); }

        /* virtual joystick: the base ring sits at the anchor (where the
           thumb first touched) and the knob follows the deflection */
        #stick-base {
            position: absolute;
            z-index: 45;
            display: none;
            border: 2px solid rgba(243, 217, 139, 0.55);
            background: radial-gradient(circle, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
            border-radius: 50%;
            pointer-events: none;
        }

        #stick-knob {
            position: absolute;
            z-index: 46;
            display: none;
            width: 58px;
            height: 58px;
            border-radius: 50%;
            background: radial-gradient(circle at 40% 35%, var(--gold-hi), var(--gold-lo));
            border: 2px solid rgba(255, 240, 184, 0.9);
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.55), 0 0 16px rgba(243, 217, 139, 0.45);
            pointer-events: none;
        }

        /* mobile aim stick (right half of the screen) - same shape as the
           move stick, tinted to read as "attack" */
        #aim-stick-base {
            position: absolute;
            z-index: 45;
            display: none;
            border: 2px solid rgba(255, 154, 122, 0.65);
            background: radial-gradient(circle, rgba(255, 122, 90, 0.14), rgba(255, 122, 90, 0.03));
            border-radius: 50%;
            pointer-events: none;
        }

        #aim-stick-knob {
            position: absolute;
            z-index: 46;
            display: none;
            width: 58px;
            height: 58px;
            border-radius: 50%;
            background: radial-gradient(circle at 40% 35%, #ffd0b8, #d95a3a);
            border: 2px solid rgba(255, 214, 196, 0.95);
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.55), 0 0 16px rgba(255, 122, 90, 0.4);
            pointer-events: none;
        }

        /* mobile stick ghosts (discoverability): the sticks anchor at the
           FIRST touch anywhere in their half, which no one can know until
           they read the code - the dashed rings say where each thumb goes.
           JS toggles display (in-game + narrow layout only); the active
           stick hides its ghost. Short/landscape screens hide them in CSS. */
        /* --ring-d / --ring-inset are declared by the phone tier
           (responsive.css) from the viewport; the fallbacks are the sizes the
           cast arc is tangent to when no tier declares them. */
        .stick-ghost {
            position: absolute;
            z-index: 44;
            display: none;
            width: var(--ring-d, 128px);
            height: var(--ring-d, 128px);
            border: 2px dashed rgba(243, 217, 139, 0.45);
            background: radial-gradient(circle, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
            border-radius: 50%;
            pointer-events: none;
        }

        .stick-ghost span {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 12px;
            font-weight: bold;
            letter-spacing: 2px;
            color: rgba(255, 255, 255, 0.55);
            text-shadow: 0 1px 2px #000;
            pointer-events: none;
        }

        #stick-ghost {
            left: calc(var(--ring-inset, 20px) + env(safe-area-inset-left, 0px));
            bottom: calc(var(--ring-inset, 20px) + env(safe-area-inset-bottom, 0px));
        }

        #aim-ghost {
            right: calc(var(--ring-inset, 20px) + env(safe-area-inset-right, 0px));
            bottom: calc(var(--ring-inset, 20px) + env(safe-area-inset-bottom, 0px));
            border-color: rgba(255, 154, 122, 0.5);
        }

        #aim-ghost span { color: rgba(255, 178, 150, 0.7); }

        .aim-indicator.aim-manual { color: #ffcf7d; border-color: #5a4a3a; }

        /* the dock's thumb toggles share ONE row: the dock's height (and the
           top-dock clearances sized off it) must not depend on how many
           toggles it holds */
        #dock-toggles { display: flex; gap: 8px; }

        #dock-toggles > button {
            flex: 1 1 0;
            min-width: 0;
            width: auto;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        /* auto-cast + auto-chase: real BUTTONs in the ability dock (below the
           slots). Mobile has no C or A key - these are the thumb's toggles */
        #auto-cast-indicator,
        #auto-chase-indicator {
            display: block;
            width: 100%;
            margin-top: 8px;
            min-height: 44px;
            border-radius: 99px;
            border: 1px solid rgba(185, 169, 216, 0.4);
            background-color: rgba(4, 2, 14, 0.5);
            color: var(--mut);
            font-family: inherit;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.5px;
            cursor: pointer;
            touch-action: manipulation;
            user-select: none;
            -webkit-user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        #auto-cast-indicator:active,
        #auto-chase-indicator:active { border-color: var(--gold); color: var(--ink); }

        #auto-cast-indicator.on,
        #auto-chase-indicator.on {
            border-color: #7dffb0;
            background-color: rgba(12, 48, 32, 0.8);
            color: #7dffb0;
            box-shadow: 0 0 10px rgba(125, 255, 176, 0.25);
        }

        /* a top-dock must not cover the wave banner (all screen sizes); the
           banner sits BELOW the dock row (desktop dock ~122 px tall); on
           narrow screens the minimap also clears the top dock */
        #game-container:has(#ability-dock.side-top) #wave-banner { top: 138px; }

        #game-container:has(#ability-dock.side-top) #minimap { top: 120px; }

        #game-container:has(#ability-dock.side-top) #minimap { bottom: auto; }
