/* campaignmap_map.css — the campaign map's main stylesheet, moved verbatim out of
   campaignmap_map.html on 2026-10-24. Loaded by <link> in the map's <head>; bump its ?v= token
   there when this file changes (browsers cache it). The Map Builder keeps its own small
   scoped <style> beside its markup in the HTML. */
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

        :root {
            --bg:           #0b0b14;
            --bg-deep:      #07070d;
            --surface:      #12121e;
            --surface2:     #1a1a2a;
            --gold:         #c9a84c;
            --gold-dim:     #7a6030;
            --gold-faint:   rgba(201,168,76,0.08);
            --text:         #e8d5a3;
            --text-dim:     #8a7a5a;
            --border:       #252535;
            --border-mid:   #303045;
            --red:          #b84040;
            --red-faint:    rgba(184,64,64,0.08);
            --green:        #4a9a5a;

            /* One width for every overlay window and modal, matched to the
               widest of them (the Faction Research overlay). Change it here and
               every window follows. The ≤640px blocks still override to full
               width for phones. */
            --win-w:        min(1560px, 97vw);
        }

        /* ══ UI revamp Phase 0 — the shared card idiom ══════════════════════
           UI_REVAMP_DESIGN.md §4.1. Four ornaments, given real class names now
           so Phases 1 (shell), 2 (hex rail) and 9 (council) consume them rather
           than each inventing one: the double-ruled frame with corner
           flourishes, the circular portrait ring, the badge, and the centred
           pull quote.

           ⚠ THERE IS NOW EXACTLY ONE COPY OF THIS BLOCK, AND IT IS THIS ONE.
           It was three — campaignmap_map.html, campaignmap_council.html and
           campaignmap_research.html were three standalone pages that each
           carried their own theme, byte-identical, CHANGE ONE CHANGE ALL THREE.
           Both subpages became overlays on the map on 2026-08-22 and both files
           are redirect stubs now, with nothing to style; each copy went with the
           page it themed. So the standing instruction is retired: edit this
           freely. If a fourth surface ever wants the idiom, the argument for
           copying it again has to be made afresh rather than inherited.
           campaignmap_mobile.html deliberately does NOT carry it (U26 leaves
           that file alone; Phase 10 edits only its council tab).

           It ADDS to the palette and rewrites none of it. Every token below is
           new and `vt-`-prefixed, so nothing above can be shadowed.

           INERT IN PHASE 0. No element in any of the three pages carried a
           `vt-` class yet; the block was dead CSS until a later phase added one.
           (Two of those three pages are redirect stubs now — see above.) */
        :root {
            /* --vt-accent is --gold. It was --gold on all three pages so the
               block could stay byte-identical; the other two are stubs now, but
               the value stands on its own — the two faction-accented surfaces
               moved into this file as the #council-panel and #rs-panel
               overlays, and each scopes its own accent variable rather than
               repointing this one. Do not point --vt-accent at a faction
               accent: it is read by the shared card idiom, which is used by
               surfaces that have no faction. */
            --vt-accent:        var(--gold);
            --vt-rule:          var(--gold-dim);
            --vt-rule-inner:    var(--border-mid);
            --vt-flourish:      var(--gold);
            --vt-card-bg:       var(--surface);
            --vt-card-pad:      18px;
            --vt-card-radius:   3px;
            --vt-frame-inset:   5px;
            --vt-flourish-arm:  14px;
            --vt-portrait:      64px;
            --vt-portrait-ring: var(--gold-dim);
        }

        /* ── The ornate double-ruled frame ─────────────────────────────────
           ONE class, NO extra markup — a phase adds `class="vt-card"` and gets
           the whole frame, which is what stops three surfaces growing three
           different wrapper structures.

             border  = the outer rule
             ::before = the inner rule, inset --vt-frame-inset
             ::after  = the four corner flourishes, eight 1px gradient strips

           The flourishes are CSS gradients rather than glyphs for U11's reason:
           a Unicode ornament renders differently on every OS and some resolve to
           colour emoji, which no CSS colour can correct. ::after is inset -1px,
           which resolves to exactly the border box, so the strips land ON the
           outer rule and brighten its corners rather than floating near them. */
        .vt-card {
            position: relative;
            background: var(--vt-card-bg);
            border: 1px solid var(--vt-rule);
            border-radius: var(--vt-card-radius);
            padding: var(--vt-card-pad);
        }
        .vt-card::before,
        .vt-card::after { content: ''; position: absolute; pointer-events: none; }
        .vt-card::before {
            inset: var(--vt-frame-inset);
            border: 1px solid var(--vt-rule-inner);
            border-radius: 1px;
        }
        .vt-card::after {
            inset: -1px;
            background:
                linear-gradient(var(--vt-flourish) 0 0) left  0 top    0 / 1px var(--vt-flourish-arm) no-repeat,
                linear-gradient(var(--vt-flourish) 0 0) left  0 top    0 / var(--vt-flourish-arm) 1px no-repeat,
                linear-gradient(var(--vt-flourish) 0 0) right 0 top    0 / 1px var(--vt-flourish-arm) no-repeat,
                linear-gradient(var(--vt-flourish) 0 0) right 0 top    0 / var(--vt-flourish-arm) 1px no-repeat,
                linear-gradient(var(--vt-flourish) 0 0) left  0 bottom 0 / 1px var(--vt-flourish-arm) no-repeat,
                linear-gradient(var(--vt-flourish) 0 0) left  0 bottom 0 / var(--vt-flourish-arm) 1px no-repeat,
                linear-gradient(var(--vt-flourish) 0 0) right 0 bottom 0 / 1px var(--vt-flourish-arm) no-repeat,
                linear-gradient(var(--vt-flourish) 0 0) right 0 bottom 0 / var(--vt-flourish-arm) 1px no-repeat;
        }
        /* --flush hands the interior to the consumer (a table, a list, an image
           that should bleed); --quiet drops the inner rule and the flourishes
           for a card nested inside another, where two full frames read as
           noise. Both are modifiers, so the frame keeps one definition. */
        .vt-card--flush { padding: 0; }
        .vt-card--quiet::before,
        .vt-card--quiet::after { display: none; }
        .vt-card--quiet { border-color: var(--border); }

        /* Structural slots. A card that is only a border forces every consumer
           to invent a title class, which is the drift this block exists to
           prevent. */
        .vt-card-head   { display: flex; align-items: flex-start; gap: 12px; }
        .vt-card-head + .vt-card-body { margin-top: 10px; }
        .vt-card-kicker {
            font-family: 'Cinzel', serif; font-size: 10.5px; letter-spacing: .12em;
            text-transform: uppercase; color: var(--vt-accent);
        }
        .vt-card-title  {
            font-family: 'Cinzel', serif; font-size: 17px; line-height: 1.25;
            color: var(--gold); font-weight: 600;
        }
        .vt-card-sub    { font-size: 13.5px; font-style: italic; color: var(--text-dim); }
        .vt-card-body   { font-size: 14.5px; line-height: 1.55; }
        .vt-card-foot   {
            margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
            display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
        }

        /* ── The circular portrait ring ────────────────────────────────────
           Goes straight on the <img>, so there is no wrapper to keep in step.
           The ring is a box-shadow rather than a border so it does not eat into
           the 44/64/120px the image is sized at — but it does draw ~3px OUTSIDE
           the layout box, so give it that much room in a tight flex gap.

           `background` matters: leaders.id IS the portrait filename and a rename
           is completely silent (_council_harness.php asserts both directions
           precisely because nothing on screen would say so), and a broken image
           inside a ring reads as a deliberate empty seat rather than a broken
           glyph. Mobile takes `thumb` only, never the ~136 KB `portrait`. */
        .vt-portrait {
            width: var(--vt-portrait); height: var(--vt-portrait); flex: none;
            border-radius: 50%; object-fit: cover; display: block;
            background: var(--surface2);
            box-shadow: 0 0 0 1px var(--bg), 0 0 0 3px var(--vt-portrait-ring);
        }
        .vt-portrait--sm { --vt-portrait: 44px; }
        .vt-portrait--lg { --vt-portrait: 120px; }
        .vt-portrait--on { --vt-portrait-ring: var(--gold); }

        /* ── The stance / consensus badge ──────────────────────────────────
           ALL FOUR council_stances.stance ENUM members are styled, not just the
           ones the mockup drew, so an unstyled stance is impossible. `oppose`
           and `independent` are the two that read wrong if they fall back to
           the gold default — a dissent rendered in the approving colour is a
           badge that says the opposite of what it means.

           --consensus is D26's: two leaders on one merged option, badged from
           the ROW COUNT rather than a flag, so the badge is derived from the
           data. --seat is the elected-seat marker. */
        .vt-badge {
            display: inline-block; padding: 2px 8px; border-radius: 3px;
            font-family: 'Cinzel', serif; font-size: 9.5px; letter-spacing: .1em;
            text-transform: uppercase; white-space: nowrap; line-height: 1.6;
            background: var(--gold-faint); border: 1px solid var(--gold-dim);
            color: var(--gold);
        }
        .vt-badge--support         { background: rgba(74,154,90,.12);   border-color: var(--green);      color: #8fd3a2; }
        .vt-badge--oppose          { background: rgba(184,64,64,.12);   border-color: var(--red);        color: #e08a8a; }
        .vt-badge--counterproposal { background: rgba(190,200,215,.10); border-color: var(--border-mid); color: var(--text); }
        .vt-badge--independent     { background: transparent;           border-color: var(--border-mid); color: var(--text-dim); }
        .vt-badge--consensus       { background: var(--gold-faint);     border-color: var(--gold);       color: var(--gold); }
        .vt-badge--seat            { background: rgba(201,168,76,.18);  border-color: var(--gold);       color: var(--gold); }

        /* ── The centred italic pull quote ─────────────────────────────────
           DISTINCT from the research overlay's left-ruled `.rs-voice`, which
           stays exactly as it is. (It was `.voice` on campaignmap_research.html
           until that page became an overlay in this file.) The two are
           different objects: `.rs-voice` annotates a technology card, this is a
           leader speaking to a ballot, and §4.1 asks for it centred. Do not
           merge them. */
        .vt-quote {
            margin: 12px auto 0; max-width: 46ch; text-align: center;
            padding: 10px 14px;
            border-top: 1px solid var(--gold-dim);
            border-bottom: 1px solid var(--gold-dim);
        }
        .vt-quote p {
            font-style: italic; font-size: 15px; line-height: 1.55; color: var(--text);
        }
        .vt-quote cite {
            display: block; margin-top: 6px; font-style: normal;
            font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .13em;
            text-transform: uppercase; color: var(--gold);
        }
        .vt-quote cite::before { content: '\2014\00a0'; }

        /* The icon set campaignmap_nav.js emits (U11). Sized here rather than
           on the <svg> so a phase can scale it per surface with one variable;
           `currentColor` is what makes it inherit --gold / --text-dim from
           whatever it is placed in. */
        .vt-icon { width: 1.25em; height: 1.25em; display: block; flex: none; }
        /* ══ end of the shared card idiom ══════════════════════════════════ */

        body {
            background: var(--bg);
            color: var(--text);
            font-family: 'Crimson Text', serif;
            height: 100dvh;
            display: flex;
            flex-direction: column;
            align-items: center;
            overflow: hidden;
            /* Standalone (installed) has no browser chrome, so a downward drag
               on the map would otherwise reach Chrome's pull-to-refresh. */
            overscroll-behavior: none;
        }

        /* Atmospheric vignette */
        body::after {
            content: '';
            position: fixed;
            inset: 0;
            background:
                radial-gradient(ellipse at 15% 15%, rgba(201,168,76,0.04) 0%, transparent 55%),
                radial-gradient(ellipse at 85% 85%, rgba(120,30,30,0.05) 0%, transparent 55%),
                radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(0,0,0,0.5) 100%);
            pointer-events: none;
            z-index: 0;
        }

        /* ── Header ─ ONE ROW (UI revamp Phase 1, §2.4) ──────────
           56px: title left, subtitle centred, GM Panel + the user menu right.
           The six nav glyphs that used to sit here are now the left rail
           (§2.1), and the header-collapse strip is gone entirely (U27).
           ⚠ The subtitle text is DB-driven (`header_subtitle`) and U28 has the
           owner changing it to "Campaign Atlas" in the GM Panel — content, not
           code. Do not hardcode it here. */
        /* == Header - TWO ROWS =============================================
           Row 1 (.hdr-main): the brand at the left, the campaign title centred
           and flourished, the GM button and user menu at the right.
           Row 2 (.hdr-status): cycle number, countdown, faction emblems.

           WARNING - z-index 5, NOT 1. .shell is also a stacking context at
           z-index 1 and comes LATER in the document, so at equal z-index it
           paints ON TOP of the header - which puts the map over the user
           dropdown, and the dropdown opens downward into exactly that space.
           The floating map cards are z-index 4 INSIDE .shell, so they can
           never escape above this either. */
        header {
            position: relative;
            z-index: 5;
            width: 100%;
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
            align-items: stretch;
            border-bottom: 1px solid var(--border);
        }

        .hdr-main {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 1rem;
            min-height: 44px;
            padding: 0.4rem 1.1rem;
        }

        header h1 {
            font-family: 'Cinzel Decorative', cursive;
            font-size: clamp(0.85rem, 1.35vw, 1.15rem);
            color: var(--gold);
            letter-spacing: 0.2em;
            white-space: nowrap;
            flex-shrink: 0;
            text-shadow: 0 0 30px rgba(201,168,76,0.35);
        }

        /* The campaign title. It is #site-subtitle and it is still written by
           applyCampaignHeader() as textContent - pseudo-elements are not child
           nodes, so the flourishes survive that write. The TEXT is content:
           `header_subtitle` in campaign_settings, edited in the GM Panel, and
           nothing here hardcodes it (U28). */
        .subtitle {
            flex: 1;
            min-width: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.7rem;
            font-family: 'Cinzel', serif;
            font-size: clamp(0.6rem, 1.1vw, 0.92rem);
            letter-spacing: 0.3em;
            color: var(--gold);
            text-transform: uppercase;
            white-space: nowrap;
            overflow: hidden;
        }
        /* A rule fading outward from a small gold pip at the inner end, one
           each side. Two background layers rather than a glyph: the diamond
           characters render at wildly different weights per platform, which is
           the same argument U11 makes for the nav icons being SVG. */
        .subtitle::before,
        .subtitle::after {
            content: '';
            flex: 0 1 clamp(26px, 5.5vw, 86px);
            height: 5px;
            background:
                linear-gradient(to right, transparent, var(--gold-dim)) 0 50% / 100% 1px no-repeat,
                radial-gradient(circle, var(--gold) 0 2px, transparent 2px) 100% 50% / 5px 5px no-repeat;
        }
        .subtitle::after {
            background:
                linear-gradient(to left, transparent, var(--gold-dim)) 0 50% / 100% 1px no-repeat,
                radial-gradient(circle, var(--gold) 0 2px, transparent 2px) 0 50% / 5px 5px no-repeat;
        }

        /* Row 2. Holds .campaign-timer and #faction-panel, both MOVED here
           rather than copied - see the markup note on the strip. */
        .hdr-status {
            position: relative;
            display: flex;
            align-items: center;
            gap: 1.4rem;
            min-height: 40px;
            padding: 0.26rem 1.1rem 0.32rem;
            border-top: 1px solid var(--border);
        }

        /* WARNING - THE SECOND min-width: 641px BLOCK, and it is scoped for the
           same reason the shell one is: every selector below is a DESCENDANT
           (`.hdr-status .faction-panel`) and so outranks the bare class
           selectors the <=640px block uses, which a media query cannot fix
           because a media query adds no specificity. Unscoped, these would win
           INSIDE the mobile block and the phone would lose its fixed faction
           strip. It lives here, next to the header rules it belongs to, rather
           than with the shell block. */
        @media (min-width: 640.99px) {
            /* -- The countdown, on one line ------------------------------- */
            .hdr-status .campaign-timer {
                /* ⚠ STATIC, overriding the base rule's `position: relative`.
                   The progress bar below is `position: absolute` and is meant
                   to span the whole strip; while this stayed relative it
                   resolved against the TIMER instead and rendered as a 254px
                   stub tucked under the countdown, in roughly the right place
                   and completely the wrong width. */
                position: static;
                flex: none;
                display: flex;
                align-items: baseline;
                gap: 0.9rem;
                width: auto;
                padding: 0;
                text-align: left;
            }
            .hdr-status .ct-label {
                margin-bottom: 0;
                opacity: 1;
                color: var(--gold-dim);
                font-size: 0.58rem;
                letter-spacing: 0.24em;
            }
            .hdr-status .ct-countdown {
                margin-bottom: 0;
                align-items: baseline;
                gap: 0.5rem;
            }
            /* A divider between the cycle number and the clock. As a pseudo on
               a flex container it becomes a flex item, which is what lets it
               sit inside the row without any markup. */
            .hdr-status .ct-countdown::before {
                content: '';
                align-self: center;
                flex: none;
                width: 1px;
                height: 1.05rem;
                margin-right: 0.4rem;
                background: var(--border-mid);
            }
            /* Value and unit side by side: "13 Days", not a stacked clock. */
            .hdr-status .ct-unit {
                flex-direction: row;
                align-items: baseline;
                gap: 0.3rem;
                min-width: 0;
            }
            .hdr-status .ct-val        { font-size: 0.92rem; }
            .hdr-status .ct-unit-label { margin-top: 0; font-size: 0.46rem; letter-spacing: 0.16em; }
            /* The separator is a ":" in the markup, which reads as a clock in
               the stacked mobile layout and wrong on one line. Swapped by
               pseudo rather than by editing the markup, so the phone keeps the
               colon it was authored with. */
            .hdr-status .ct-sep         { font-size: 0; padding: 0; }
            .hdr-status .ct-sep::after  { content: '\00B7'; font-size: 0.8rem; }

            /* The cycle progress bar becomes the header's bottom edge - a hair
               of gold growing along the full width as the cycle runs down.
               Nothing else in the strip has room for it and dropping it would
               lose a real reading of where the cycle stands. */
            .hdr-status .ct-progress-wrap {
                position: absolute;
                left: 0; right: 0; bottom: -1px;
                width: auto;
                max-width: none;
                height: 2px;
                margin: 0;
                background: transparent;
            }

            /* -- The three faction emblems, at the right ------------------- */
            .hdr-status .faction-panel {
                position: static;
                margin-left: auto;
                width: auto;
                height: auto;
                flex: none;
                flex-direction: row;
                align-items: center;
                justify-content: flex-end;
                gap: 0.3rem;
                padding: 0;
                border-left: none;
            }
            .hdr-status .faction-panel::before {
                content: '';
                align-self: center;
                flex: none;
                width: 1px;
                height: 1.5rem;
                margin-right: 0.9rem;
                background: var(--border-mid);
            }
            .hdr-status .faction-card {
                position: relative;
                flex-direction: row;
                align-items: center;
                gap: 0.5rem;
                padding: 0.2rem 0.55rem;
                border-radius: 3px;
            }
            .hdr-status .faction-card + .faction-card::before {
                content: '';
                position: absolute;
                left: -0.15rem;
                top: 22%; bottom: 22%;
                width: 1px;
                background: var(--border);
            }
            .hdr-status .faction-card-icon { width: 30px; height: 30px; border-width: 1px; }
            .hdr-status .faction-card-name {
                font-size: 0.55rem;
                letter-spacing: 0.1em;
                text-align: left;
                line-height: 1.2;
                white-space: nowrap;
            }
        }

        /* ⚠ MEASURED: THE STRIP OVERFLOWS ITS OWN HEADER BELOW ~820px, and
           that is the GM-panel tab row's failure one element over. The three
           named cards are 131 + 150 + 167px and the countdown is 254px, so at
           660px the row wanted 772px — and a flex row in a header that does not
           scroll does not REPORT that, it just draws outside itself. Nothing
           throws, nothing logs, and on a wide monitor it looks perfect.

           So the names go and the emblems stay: an emblem is the identity, the
           name is the gloss, and clicking either still opens the faction modal.
           900px rather than the measured 820px because `factions.name` is
           content — a faction renamed in the GM Panel must not be able to push
           the header apart again. This is also what the <=640px block does with
           the same element, for the same reason, so the two agree. */
        @media (max-width: 900.98px) {
            .hdr-status .faction-card-name  { display: none; }
            .hdr-status .faction-card       { padding: 0.2rem 0.3rem; }
            .hdr-status .faction-panel::before { margin-right: 0.6rem; }
        }

        /* Retired by Phase 1's one-row header — kept as a no-op rule rather
           than deleted so any stray markup carrying the class stays invisible. */
        .header-rule { display: none; }

        .header-rule-retired {
            width: 260px;
            height: 1px;
            background: linear-gradient(to right, transparent, var(--gold-dim), transparent);
            margin: 1rem auto 0;
        }

        /* ── Auth area ──────────────────────── */
        header { position: relative; }

        .auth-area {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex-shrink: 0;
        }

        .btn-login {
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.15em;
            text-transform: uppercase;
            color: var(--gold-dim);
            border: 1px solid var(--gold-dim);
            background: transparent;
            padding: 0.35rem 0.8rem;
            cursor: pointer;
            text-decoration: none;
            display: inline-block;
            transition: color 0.15s, border-color 0.15s;
        }
        .btn-login:hover { color: var(--gold); border-color: var(--gold); }

        /* ⚠ The chip shows for EVERYONE, signed in or not (owner's call
           2026-08-21, resolving a gap U5 leaves). U5 moves Help and My Reports
           into "the user menu", but this element was login-gated, so a guest
           would have had no menu and would have lost Help entirely on desktop
           — U16 gives mobile a hamburger holding Help for everyone, so the menu
           was never meant to be login-gated. `.visible` is still added by
           applyUserSession() and is now what SWAPS the menu's guest contents
           for the signed-in ones (.when-out / .when-in below) rather than what
           reveals the chip. */
        .user-chip {
            display: flex;
            align-items: center;
            gap: 0.45rem;
            cursor: pointer;
            padding: 0.2rem 0.5rem;
            border: 1px solid transparent;
            transition: border-color 0.15s;
            position: relative;
        }
        /* A caret, drawn in CSS rather than as a glyph — U11's argument: a
           Unicode ornament renders differently on every OS. It is the only
           thing telling a guest (who has no avatar) that this opens a menu. */
        .user-chip::after {
            content: ''; flex: none; margin-left: 0.15rem;
            border: 3px solid transparent; border-top-color: var(--text-dim);
            transform: translateY(2px); transition: border-top-color .15s;
        }
        .user-chip:hover::after { border-top-color: var(--gold); }

        /* Menu contents by session state. Specificity beats `.user-dropdown a`
           and `.user-dropdown button`, both of which set display:block. */
        .user-dropdown .when-in  { display: none; }
        .user-chip.visible .user-dropdown .when-in  { display: block; }
        .user-chip.visible .user-dropdown .when-out { display: none; }
        /* U16's GM Panel entry is hidden everywhere by default; the ≤640px
           block is the only thing that reveals it, and only for a GM. */
        .user-dropdown .when-gm { display: none; }
        .user-chip:hover { border-color: var(--gold-dim); }

        .user-chip-avatar {
            width: 26px;
            height: 26px;
            border-radius: 50%;
            border: 1px solid var(--gold-dim);
            background: rgba(201,168,76,0.1);
            object-fit: cover;
        }
        .user-chip-info { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; }
        .user-chip-name { font-family: 'Cinzel', serif; font-size: 0.58rem; letter-spacing: 0.08em; color: var(--text-dim); }
        .user-chip-gm   { font-size: 0.5rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-dim); }

        .user-dropdown {
            display: none;
            position: absolute;
            top: calc(100% + 0.4rem);
            right: 0;
            background: var(--bg-deep);
            border: 1px solid var(--border-mid);
            min-width: 130px;
            z-index: 500;
        }
        .user-dropdown.open { display: block; }
        .user-dropdown a {
            display: block;
            padding: 0.6rem 0.9rem;
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--text-dim);
            text-decoration: none;
            transition: color 0.15s;
        }
        .user-dropdown a:hover { color: var(--gold); }
        .user-dropdown button {
            display: block;
            width: 100%;
            padding: 0.6rem 0.9rem;
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--text-dim);
            text-decoration: none;
            background: transparent;
            border: none;
            text-align: left;
            cursor: pointer;
            transition: color 0.15s;
        }
        .user-dropdown button:hover { color: var(--gold); }

        /* ── My Reports overlay ─────────────── */
        #my-reports-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            z-index: 2500;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        #my-reports-overlay.open { display: flex; }
        #my-reports-modal {
            background: var(--surface);
            border: 1px solid var(--border-mid);
            width: var(--win-w);
            max-height: 80vh;
            display: flex;
            flex-direction: column;
        }
        #my-reports-list {
            overflow-y: auto;
            flex: 1;
            padding: 0.5rem 0.8rem 0.8rem;
        }

        /* ── My Report edit overlay ─────────── */
        #my-report-edit-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            z-index: 3000;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        #my-report-edit-overlay.open { display: flex; }
        #my-report-edit-modal {
            background: var(--surface);
            border: 1px solid var(--border-mid);
            width: 100%;
            max-width: 480px;
            padding: 1.4rem 1.5rem 1.2rem;
            position: relative;
        }

        .auth-error-bar {
            display: none;
            background: rgba(184,64,64,0.12);
            border-bottom: 1px solid rgba(184,64,64,0.25);
            color: var(--red);
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.1em;
            text-align: center;
            padding: 0.4rem 1rem;
        }

        /* ── Map container ─────────────────── */
        /* ⚠ NO z-index HERE, AND THAT IS A FIX RATHER THAN A TIDY-UP. This
           carried `z-index: 1`, which looks inert because the element is
           `position: static` - but Z-INDEX APPLIES TO A FLEX ITEM WHATEVER ITS
           POSITION, and this is a flex item of .shell. So it opened a stacking
           context at level 1 and CLAMPED EVERY POSITIVE z-index inside it:
           measured, the hex-browse drawer's 1800 rendered UNDERNEATH the
           dispatch card's 4, because the comparison the browser makes is 1
           against 4, not 1800 against 4. The drawer was still there, still
           full of rows, and simply painted behind a card that had not existed
           before the floats did.
           Removing it costs nothing: the two floats and the map cluster all
           declare their own z-index and now compete at .shell level, where
           they were always meant to. */
        .map-wrap {
            flex: 1;
            min-width: 0;
            min-height: 0;
            display: flex;
            flex-direction: row;
            align-items: stretch;
            padding: 0.4rem;
            gap: 0;
        }

        .map-svg-wrap {
            flex: 1;
            min-width: 0;
            min-height: 0;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        /* Shown by showMapLoadError() when init() could not get the hexes. Sits
           over the (empty) board; z-index 7 clears the map cluster and zoom (6). */
        .map-load-error {
            position: absolute;
            inset: 0;
            z-index: 7;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 16px;
            background: rgba(7, 7, 13, 0.92);
        }
        .map-load-error[hidden] { display: none; }
        .map-load-error-card {
            max-width: 26rem;
            padding: 1.4rem 1.5rem;
            text-align: center;
            background: var(--surface);
            border: 1px solid var(--gold-dim);
            border-radius: 6px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.8rem;
        }
        .map-load-error-title {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            font-size: 1.05rem;
            letter-spacing: 0.04em;
        }
        /* .btn-share carries order:-1 for the Battle Setup share row; reset it
           so Retry sits under the message, not above the title. Two classes, because
           this rule comes before .btn-share in the sheet. */
        .map-load-error-card .map-load-error-retry { order: 0; font-size: 0.7rem; }
        .map-load-error-detail {
            color: var(--text-dim);
            font-size: 0.9rem;
            line-height: 1.45;
        }

        #campaign-map {
            width: 100%;
            height: 100%;
            max-width: 100%;
            max-height: 100%;
            display: block;
            filter: drop-shadow(0 8px 40px rgba(0,0,0,0.7));
        }

        /* ── Faction panel ──────────────────── */
        .faction-panel {
            position: absolute;
            right: 0;
            top: 0;
            height: 100%;
            width: 180px;
            display: flex;
            flex-direction: column;
            justify-content: space-evenly;
            align-items: center;
            padding: 1rem 0.5rem;
            border-left: 1px solid var(--border);
        }

        .faction-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.65rem;
            cursor: pointer;
            padding: 0.6rem 0.5rem;
            border: 1px solid transparent;
            transition: border-color 0.18s;
        }

        .faction-card:hover {
            border-color: var(--gold-dim);
        }

        .faction-card-icon {
            width: 144px;
            height: 144px;
            border-radius: 50%;
            border: 1.5px solid var(--gold-dim);
            background: rgba(10, 10, 20, 0.7);
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            transition: border-color 0.18s, box-shadow 0.18s;
        }

        .faction-card:hover .faction-card-icon {
            border-color: var(--gold);
            box-shadow: 0 0 20px rgba(201,168,76,0.45);
        }

        .faction-card-icon img {
            width: 82%;
            height: 82%;
            object-fit: contain;
        }

        .faction-card-name {
            font-family: 'Cinzel', serif;
            font-size: 0.62rem;
            letter-spacing: 0.1em;
            color: var(--text-dim);
            text-transform: uppercase;
            text-align: center;
            line-height: 1.45;
            transition: color 0.18s;
        }

        .faction-card:hover .faction-card-name {
            color: var(--gold);
        }

        /* ── Faction detail modal ────────────── */
        #faction-modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.82);
            z-index: 2500;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s ease;
            backdrop-filter: blur(3px);
        }

        #faction-modal-overlay.visible {
            opacity: 1;
            pointer-events: all;
        }

        #faction-modal {
            background: var(--surface);
            border: 1px solid var(--gold-dim);
            width: var(--win-w);
            max-height: 90vh;
            overflow-y: auto;
            position: relative;
            box-shadow: 0 0 80px rgba(0,0,0,0.9), 0 0 40px rgba(201,168,76,0.04);
            transform: translateY(12px);
            transition: transform 0.2s ease;
        }

        #faction-modal-overlay.visible #faction-modal {
            transform: translateY(0);
        }

        #faction-modal::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 2px;
            background: linear-gradient(to right, transparent, var(--gold), transparent);
        }

        .fm-header {
            padding: 1.4rem 2.5rem 1.1rem 1.4rem;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 1.2rem;
        }

        .fm-icon {
            width: 80px;
            height: 80px;
            flex-shrink: 0;
            border-radius: 50%;
            border: 1.5px solid var(--gold-dim);
            background: rgba(10,10,20,0.7);
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .fm-icon img {
            width: 82%;
            height: 82%;
            object-fit: contain;
        }

        .fm-header-text { flex: 1; }

        .fm-title {
            font-family: 'Cinzel Decorative', cursive;
            font-size: 1rem;
            color: var(--gold);
            letter-spacing: 0.08em;
            margin-bottom: 0.3rem;
        }

        .fm-tag {
            font-family: 'Cinzel', serif;
            font-size: 0.6rem;
            letter-spacing: 0.2em;
            color: var(--text-dim);
            text-transform: uppercase;
            font-style: italic;
        }

        .fm-body {
            padding: 1.3rem 1.4rem 0.6rem;
        }

        .fm-section {
            margin-bottom: 1.1rem;
        }

        .fm-section-label {
            font-family: 'Cinzel', serif;
            font-size: 0.54rem;
            letter-spacing: 0.22em;
            text-transform: uppercase;
            color: var(--gold-dim);
            margin-bottom: 0.4rem;
        }

        /* Phase 6b — the faction modal's research tab now points at the research
           page rather than rendering a retired vote. */
        .fm-empty-note {
            font-size: 0.78rem;
            line-height: 1.5;
            color: var(--text-dim);
            margin: 0 0 0.7rem;
        }

        .fm-section-text {
            font-family: 'Crimson Text', serif;
            font-size: 0.95rem;
            color: var(--text);
            line-height: 1.6;
        }
        .fm-book-link { color: var(--gold); white-space: nowrap; }

        .fm-footer {
            padding: 0.8rem 1.4rem 1.2rem;
            display: flex;
            justify-content: flex-end;
        }

        /* ── Faction modal tab bar ───────────────── */
        .fm-tab-row {
            display: flex;
            border-bottom: 1px solid var(--border-mid);
            padding: 0 1.4rem;
        }

        /* ── Research section (faction modal) ────── */
        .fm-research-category {
            margin-bottom: 0.9rem;
        }
        .fm-research-cat-label {
            font-family: 'Cinzel', serif;
            font-size: 0.5rem;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            color: var(--text-dim);
            border-bottom: 1px solid rgba(201,168,76,0.15);
            padding-bottom: 0.3rem;
            margin-bottom: 0.4rem;
        }

        /* ── Proposal cards ───────────────────────────
           Authored for the building vote in the faction modal, which D72 retires.
           `.fm-proposal-card` and the rules under it are still used by the FEATURE
           vote overlay, so they stay; `.fm-vote-balance-row`, `.fm-vote-balance-num`
           and `.fm-vote-input` went with the vote itself — a ranked ballot has no
           balance to show and no per-option number to type into. */
        .fm-proposal-card {
            border: 1px solid rgba(201,168,76,0.2);
            border-radius: 4px;
            padding: 0.55rem 0.75rem;
            margin-bottom: 0.45rem;
            background: rgba(201,168,76,0.04);
        }
        .fm-proposal-name {
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--gold-dim);
            margin-bottom: 0.2rem;
        }
        .fm-proposal-meta {
            font-family: 'Crimson Text', serif;
            font-size: 0.78rem;
            color: var(--text-dim);
            margin-bottom: 0.3rem;
        }
        .fm-proposal-costs {
            display: flex;
            gap: 0.4rem;
            flex-wrap: wrap;
            margin-bottom: 0.35rem;
        }
        .fm-cost-chip {
            font-family: 'Cinzel', serif;
            font-size: 0.42rem;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--text-dim);
            background: rgba(255,255,255,0.05);
            border-radius: 3px;
            padding: 0.12rem 0.38rem;
        }
        .fm-cost-chip.active { color: var(--text); background: rgba(201,168,76,0.1); }
        .fm-proposal-vote-row {
            display: flex;
            align-items: center;
            gap: 0.7rem;
            margin-top: 0.3rem;
        }
        .fm-total-votes-lbl {
            font-family: 'Cinzel', serif;
            font-size: 0.44rem;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-dim);
            flex: 1;
        }
        .fm-vote-footer {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-top: 0.7rem;
            padding-top: 0.55rem;
            border-top: 1px solid rgba(201,168,76,0.15);
        }
        .fm-vote-msg {
            font-family: 'Crimson Text', serif;
            font-size: 0.78rem;
            color: var(--text-dim);
            flex: 1;
        }

        /* ── GM Vote management (Campaign tab) ──── */
        .gm-proposal-row {
            display: flex;
            align-items: flex-start;
            gap: 0.5rem;
            margin-bottom: 0.35rem;
            padding: 0.45rem 0.6rem;
            background: rgba(255,255,255,0.04);
            border-radius: 3px;
        }
        .gm-proposal-info {
            flex: 1;
            font-family: 'Crimson Text', serif;
            font-size: 0.78rem;
            color: var(--text);
        }
        .gm-proposal-votes-badge {
            font-family: 'Cinzel', serif;
            font-size: 0.44rem;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--gold-dim);
            white-space: nowrap;
            margin-top: 0.15rem;
        }

        #layer-highlight {
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s ease;
        }
        #layer-highlight.active { opacity: 1; }

        #campaign-map.is-panning { cursor: grabbing !important; }
        #campaign-map.can-pan    { cursor: grab; }

        /* ⚠ THE 180px WAS THE FACTION PANEL, AND IT IS NOT THERE ANY MORE.
           This offset existed to clear .faction-panel, which was
           position:absolute right:0 width:180px ON TOP OF THE MAP. Phase 1
           moved that row to the foot of the right rail, so the reservation
           became a 180px hole between these buttons and the edge they are
           meant to sit in. That is why U23's "zero change to existing zoom
           CSS" no longer holds — the note was written while the panel was
           still overlaying the map. Zoom stays bottom-RIGHT as U23 says; it
           just reaches the corner again. */
        /* Centred on the right edge, where the mockup puts them, rather than
           tucked into the bottom corner. `bottom: auto` is explicit because
           the <=640px block still sets `bottom` and would otherwise stretch
           the box between the two. */
        .zoom-controls {
            position: absolute;
            top: 50%;
            bottom: auto;
            right: 0.9rem;
            transform: translateY(-50%);
            display: flex;
            flex-direction: column;
            gap: 0.3rem;
            /* ⚠ ABOVE .map-float's 4. Both are centred on an edge now, and a
               tall hex card reaches down past the middle of the board, so a
               zoom button under a card is a control that is visible and dead.
               This competes at .shell level rather than inside .map-wrap:
               .map-wrap is `position: static`, so its own z-index is inert and
               it opens no stacking context. */
            z-index: 6;
        }

        .zoom-btn {
            width: 2.2rem;
            height: 2.2rem;
            background: rgba(12, 12, 22, 0.88);
            border: 1px solid var(--gold-dim);
            color: var(--gold);
            font-family: 'Cinzel', serif;
            font-size: 1.1rem;
            line-height: 1;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.15s, border-color 0.15s;
            user-select: none;
        }

        .zoom-btn:hover {
            background: rgba(30, 28, 50, 0.96);
            border-color: var(--gold);
        }

        #btn-zoom-reset { display: none; font-size: 0.85rem; letter-spacing: 0.05em; }

        /* ── Hex SVG styles ─────────────────── */
        .hex-group { cursor: pointer; }
        .locked-hex { cursor: default; }

        /* Hover brightening via an overlay polygon so no CSS filter is applied to
           the terrain tile — CSS filters rasterise in the element's rectangular
           bounding box and bleed coloured pixels into the inter-hex gaps */
        .hex-hover-overlay {
            fill: rgba(255, 255, 255, 0);
            transition: fill 0.15s ease;
            pointer-events: none;
        }
        .hex-group:not(.hex-dormant):hover .hex-hover-overlay {
            fill: rgba(255, 255, 255, 0.18);
        }

        .hex-dormant {
            cursor: default;
        }

        .hex-label {
            font-family: 'Cinzel', serif;
            font-size: 7.5px;
            fill: rgba(232,213,163,0.65);
            text-anchor: middle;
            dominant-baseline: middle;
            pointer-events: none;
            letter-spacing: 0.05em;
        }

        /* Event marker pulse */
        .event-ring {
            animation: pulse-ring 3.6s ease-in-out infinite;
        }
        @keyframes pulse-ring {
            0%, 100% { opacity: 0.8; r: 34px; }
            50%       { opacity: 0.1; r: 4px;  }
        }

        /* Center hex glow */
        .nexus-glow {
            animation: nexus 3s ease-in-out infinite;
        }
        @keyframes nexus {
            0%, 100% { opacity: 0.25; }
            50%       { opacity: 0.55; }
        }

        /* ── Tooltip ────────────────────────── */
        #tooltip {
            position: fixed;
            pointer-events: none;
            z-index: 1000;
            background: rgba(11,11,20,0.97);
            border: 1px solid var(--gold-dim);
            padding: 0.85rem 1rem;
            max-width: 230px;
            min-width: 160px;
            opacity: 0;
            transform: translateY(4px);
            transition: opacity 0.15s ease, transform 0.15s ease;
            box-shadow: 0 6px 30px rgba(0,0,0,0.7);
        }

        #tooltip.visible {
            opacity: 1;
            transform: translateY(0);
        }

        #tooltip::before {
            content: '';
            position: absolute;
            top: 0; left: 10%; right: 10%;
            height: 1px;
            background: linear-gradient(to right, transparent, var(--gold), transparent);
        }

        .tt-normal { display: block; }
        .tt-locked-msg { display: none; }

        #tooltip.is-locked .tt-normal { display: none; }
        #tooltip.is-locked .tt-locked-msg { display: block; }

        .tt-name {
            font-family: 'Cinzel', serif;
            font-size: 0.82rem;
            color: var(--gold);
            font-weight: 600;
            margin-bottom: 0.2rem;
        }

        .tt-terrain {
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.18em;
            color: var(--text-dim);
            text-transform: uppercase;
            margin-bottom: 0.45rem;
        }

        .tt-desc {
            font-size: 0.82rem;
            color: var(--text);
            line-height: 1.45;
        }

        .tt-contested-note {
            margin-top: 0.5rem;
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: #c97a2a;
        }

        .tt-effect-block {
            margin-top: 0.5rem;
            padding-top: 0.45rem;
            border-top: 1px solid rgba(201,168,76,0.12);
        }

        .tt-effect-label {
            font-family: 'Cinzel', serif;
            font-size: 0.52rem;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            color: var(--gold-dim);
            margin-bottom: 0.25rem;
        }

        .tt-effect-desc {
            font-size: 0.78rem;
            color: var(--text);
            line-height: 1.4;
        }

        .tt-inactive-note {
            margin-top: 0.5rem;
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.15em;
            color: var(--text-dim);
            text-transform: uppercase;
            opacity: 0.7;
        }

        .tt-event-block {
            margin-top: 0.6rem;
            padding-top: 0.6rem;
            border-top: 1px solid rgba(201,168,76,0.15);
        }

        .tt-event-tag {
            font-family: 'Cinzel', serif;
            font-size: 0.56rem;
            letter-spacing: 0.15em;
            color: var(--red);
            text-transform: uppercase;
            margin-bottom: 0.25rem;
        }

        .tt-event-name {
            font-family: 'Cinzel', serif;
            font-size: 0.75rem;
            color: var(--text);
            margin-bottom: 0.2rem;
        }

        .tt-event-desc {
            font-size: 0.75rem;
            color: var(--text-dim);
            font-style: italic;
            line-height: 1.4;
        }

        .tt-scenario-block {
            margin-top: 0.5rem;
            padding-top: 0.5rem;
            border-top: 1px solid rgba(74,122,184,0.18);
        }

        .tt-scenario-tag {
            font-family: 'Cinzel', serif;
            font-size: 0.56rem;
            letter-spacing: 0.15em;
            color: #4a7ab8;
            text-transform: uppercase;
            margin-bottom: 0.2rem;
        }

        .tt-scenario-name {
            font-family: 'Cinzel', serif;
            font-size: 0.72rem;
            color: var(--text);
            margin-bottom: 0.15rem;
        }

        .tt-scenario-brief {
            font-size: 0.72rem;
            color: var(--text-dim);
            font-style: italic;
            line-height: 1.4;
        }

        .tt-locked-msg {
            font-family: 'Cinzel', serif;
            font-size: 0.72rem;
            letter-spacing: 0.15em;
            color: rgba(100,100,140,0.7);
            text-transform: uppercase;
        }

        /* ── Modal ──────────────────────────── */
        #img-lightbox {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.88);
            z-index: 3000;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.18s ease;
            cursor: zoom-out;
        }
        #img-lightbox.visible {
            opacity: 1;
            pointer-events: all;
        }
        #img-lightbox-img {
            width: 320px;
            height: 320px;
            border: 1px solid var(--border);
            box-shadow: 0 0 40px rgba(0,0,0,0.8);
        }

        #modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.82);
            z-index: 2000;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s ease;
            backdrop-filter: blur(3px);
        }

        #modal-overlay.visible {
            opacity: 1;
            pointer-events: all;
        }

        #modal {
            background: var(--surface);
            border: 1px solid var(--gold-dim);
            width: var(--win-w);
            max-height: 92vh;
            overflow: hidden;
            position: relative;
            display: flex;
            flex-direction: column;
            box-shadow: 0 0 80px rgba(0,0,0,0.9), 0 0 40px rgba(201,168,76,0.04);
            transform: translateY(12px);
            transition: transform 0.2s ease;
        }

        #modal-body {
            overflow-y: auto;
            flex: 1;
            min-height: 0;
        }

        #modal-overlay.visible #modal {
            transform: translateY(0);
        }

        #modal-hex-id {
            position: absolute;
            bottom: 0.5rem;
            left: 0.7rem;
            font-family: 'Courier New', monospace;
            font-size: 0.65rem;
            color: rgba(201,168,76,0.35);
            pointer-events: none;
            user-select: none;
        }

        #modal::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 2px;
            background: linear-gradient(to right, transparent, var(--gold), transparent);
        }

        .modal-close {
            position: absolute;
            top: 0.9rem;
            right: 0.9rem;
            width: 26px;
            height: 26px;
            background: none;
            border: 1px solid var(--border-mid);
            color: var(--text-dim);
            cursor: pointer;
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: border-color 0.15s, color 0.15s;
            font-family: sans-serif;
        }
        .modal-close:hover { border-color: var(--gold-dim); color: var(--text); }

        .modal-header {
            padding: 1rem 2.5rem 1rem 1.4rem;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 1rem;
        }
        .modal-terrain-img {
            width: 80px;
            height: 80px;
            flex-shrink: 0;
            border: 1px solid var(--border);
            display: none;
            cursor: zoom-in;
        }
.modal-header-text {
            flex: 1;
            text-align: center;
        }
        .modal-event-icon {
            width: 80px;
            height: 80px;
            flex-shrink: 0;
            border: 1px solid var(--border);
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            display: none;
            cursor: zoom-in;
        }

        .modal-title {
            font-family: 'Cinzel Decorative', cursive;
            font-size: 1rem;
            color: var(--gold);
            letter-spacing: 0.08em;
            margin-bottom: 0.25rem;
        }

        .modal-sub {
            font-family: 'Cinzel', serif;
            font-size: 0.6rem;
            letter-spacing: 0.2em;
            color: var(--text-dim);
            text-transform: uppercase;
        }

        .modal-body { padding: 1.3rem 1.4rem 0.5rem; }

        .info-block {
            padding: 0.75rem 0.9rem;
            border: 1px solid;
            margin-bottom: 1rem;
            cursor: pointer;
            transition: filter 0.15s;
        }

        .info-block:hover { filter: brightness(1.15); }

        .info-block.hex-info {
            border-color: rgba(201,168,76,0.2);
            background: var(--gold-faint);
        }

        /* A guest asked for the report form: why it is locked, and the way in. */
        .report-signin-note {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 0.6rem 1rem;
            padding: 0.75rem 0.9rem;
            margin-bottom: 1rem;
            border: 1px solid var(--gold-dim);
            background: var(--gold-faint);
            color: var(--text);
            font-size: 0.85rem;
        }
        .report-signin-note span { flex: 1 1 14rem; min-width: 0; }
        .report-signin-note .btn { text-decoration: none; }

        .info-block.event-info {
            border-color: rgba(184,64,64,0.2);
            background: var(--red-faint);
            display: none;
        }

        .info-block.event-info.visible { display: block; }

        .info-block.scenario-info {
            border-color: rgba(64,120,184,0.2);
            background: rgba(64,120,184,0.05);
            display: none;
        }

        .info-block.scenario-info.visible { display: block; }
        .info-block.scenario-info .info-label { color: #4a7ab8; }

        .scenario-desc {
            margin-top: 0.45rem;
            font-size: 0.78rem;
            color: var(--text-dim);
            line-height: 1.5;
        }

        .info-label {
            font-family: 'Cinzel', serif;
            font-size: 0.56rem;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            margin-bottom: 0.25rem;
        }

        .info-block.hex-info .info-label { color: var(--gold-dim); }
        .info-block.event-info .info-label { color: var(--red); }

        /* ── Text lightbox ──────────────────── */
        #text-lightbox {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.88);
            z-index: 3000;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.18s ease;
            cursor: zoom-out;
            backdrop-filter: blur(4px);
        }
        #text-lightbox.visible {
            opacity: 1;
            pointer-events: all;
        }
        #text-lightbox-inner {
            max-width: 520px;
            width: 90%;
            background: var(--bg-deep);
            border: 1px solid var(--border-mid);
            padding: 2rem 2.2rem;
            box-shadow: 0 0 60px rgba(0,0,0,0.9);
            cursor: default;
        }
        #text-lightbox-label {
            font-family: 'Cinzel', serif;
            font-size: 0.6rem;
            letter-spacing: 0.22em;
            text-transform: uppercase;
            margin-bottom: 0.6rem;
        }
        #text-lightbox-title {
            font-family: 'Cinzel', serif;
            font-size: 1.15rem;
            color: var(--text);
            margin-bottom: 0.6rem;
            line-height: 1.4;
        }
        #text-lightbox-body {
            font-size: 0.95rem;
            color: var(--text-dim);
            line-height: 1.7;
            white-space: pre-line;
        }
        #text-lightbox-hint {
            margin-top: 1.4rem;
            font-size: 0.6rem;
            letter-spacing: 0.15em;
            text-transform: uppercase;
            color: rgba(255,255,255,0.2);
            text-align: center;
        }

        .info-name {
            font-family: 'Cinzel', serif;
            font-size: 0.82rem;
            color: var(--text);
            margin-bottom: 0.15rem;
        }

        .info-detail {
            font-size: 0.78rem;
            color: var(--text-dim);
            font-style: italic;
        }

        /* Form */
        .form-row { margin-bottom: 1rem; }

        .form-label {
            display: block;
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            color: var(--text-dim);
            margin-bottom: 0.4rem;
        }

        .form-input,
        .form-select,
        .form-textarea {
            width: 100%;
            background: rgba(255,255,255,0.03);
            border: 1px solid var(--border-mid);
            color: var(--text);
            font-family: 'Crimson Text', serif;
            font-size: 1rem;
            padding: 0.5rem 0.7rem;
            outline: none;
            transition: border-color 0.15s;
            -webkit-appearance: none;
            appearance: none;
        }

        .form-input::placeholder { color: var(--text-dim); opacity: 0.5; }
        .form-input:focus,
        .form-select:focus,
        .form-textarea:focus { border-color: var(--gold-dim); }

        .form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a7a5a'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.7rem center; padding-right: 2rem; }
        .form-select option { background: #12121e; }

        .faction-select-wrap { position: relative; }

        .form-textarea { resize: vertical; min-height: 78px; }

        /* VP row */
        .vp-row {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .vp-row .form-input {
            width: 7rem;
            flex-shrink: 0;
        }

        /* Kill points row: two numbers and how they were counted; wraps on a phone. */
        .kp-row {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
        }
        .kp-row .form-input { width: 7rem; flex: 0 1 7rem; min-width: 0; }
        .kp-row select.form-input { width: 10rem; flex: 0 1 10rem; }

        .vp-forget {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            font-family: 'Crimson Text', serif;
            font-size: 0.9rem;
            color: var(--text-dim);
            cursor: pointer;
            user-select: none;
        }

        .vp-forget input[type="checkbox"] {
            accent-color: var(--gold-dim);
            width: 14px;
            height: 14px;
            cursor: pointer;
            flex-shrink: 0;
        }

        /* Objectives checklist */
        .objectives-list {
            display: flex;
            flex-direction: column;
            gap: 0.45rem;
        }

        .objective-item {
            display: flex;
            align-items: flex-start;
            gap: 0.5rem;
            font-family: 'Crimson Text', serif;
            font-size: 0.95rem;
            color: var(--text-dim);
            cursor: pointer;
            user-select: none;
        }

        .objective-item input[type="checkbox"] {
            accent-color: var(--gold-dim);
            width: 14px;
            height: 14px;
            margin-top: 3px;
            flex-shrink: 0;
            cursor: pointer;
        }

        .objective-item input:checked ~ span { color: var(--text); }

        /* Result radio row */
        .result-row {
            display: flex;
            gap: 0.5rem;
        }

        .result-opt { flex: 1; }
        .result-opt input[type="radio"] { display: none; }

        .result-opt label {
            display: block;
            text-align: center;
            font-family: 'Cinzel', serif;
            font-size: 0.62rem;
            letter-spacing: 0.15em;
            text-transform: uppercase;
            padding: 0.5rem 0.25rem;
            border: 1px solid var(--border-mid);
            cursor: pointer;
            color: var(--text-dim);
            transition: all 0.15s;
        }

        .result-opt label:hover { border-color: var(--text-dim); color: var(--text); }

        .result-opt.win  input:checked + label { border-color: var(--green);    color: var(--green);    background: rgba(74,154,90,0.08); }
        .result-opt.loss input:checked + label { border-color: var(--red);      color: var(--red);      background: var(--red-faint); }
        .result-opt.draw input:checked + label { border-color: var(--gold-dim); color: var(--gold);     background: var(--gold-faint); }

        /* Modal footer */
        .modal-footer {
            padding: 0.8rem 1.4rem 1.4rem;
            display: flex;
            gap: 0.6rem;
            justify-content: flex-end;
        }

        /* ⚠ `border: 1px solid` WITH NO COLOUR IS BLACK, and so was the text.
           This rule set neither `color` nor a border colour, so a bare `.btn`
           fell back to `currentColor` → the initial `black` — black text inside
           a black border on a near-black panel. "Copy details" and the hex
           modal's "Challenge Link" have been rendering that way; measured
           rgb(0,0,0) on both. It only ever looked deliberate because the
           modifiers below (`.btn-cancel`, `.btn-submit`) set a colour and almost
           every `.btn` in the app carries one. The bare form is the SECONDARY
           button, so it takes the gold OUTLINE the primary used to have —
           legible, and still a step below the filled primary. */
        .btn {
            font-family: 'Cinzel', serif;
            font-size: 0.6rem;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            padding: 0.55rem 1.1rem;
            border: 1px solid var(--gold-dim);
            color: var(--gold);
            cursor: pointer;
            background: transparent;
            transition: all 0.15s;
        }
        .btn:hover { border-color: var(--gold); background: var(--gold-faint); }

        .btn-cancel { border-color: var(--border-mid); color: var(--text-dim); }
        .btn-cancel:hover { border-color: var(--text-dim); color: var(--text); }
        .btn-submit { border-color: var(--gold-dim); color: var(--gold); }
        .btn-submit:hover { background: var(--gold-faint); border-color: var(--gold); }

        .btn-locked,
        .tab-locked {
            opacity: 0.35 !important;
            cursor: not-allowed !important;
            position: relative;
        }
        .btn-locked:hover  { background: transparent !important; border-color: var(--gold-dim) !important; }
        .tab-locked:hover  { color: var(--text-dim) !important; }

        .btn-locked::after,
        .tab-locked::after {
            content: 'Login with Discord to submit a report';
            position: absolute;
            bottom: calc(100% + 8px);
            left: 50%;
            transform: translateX(-50%);
            background: rgba(8,8,18,0.97);
            border: 1px solid var(--border-mid);
            color: var(--text-dim);
            font-family: 'Cinzel', serif;
            font-size: 0.55rem;
            letter-spacing: 0.1em;
            white-space: nowrap;
            padding: 0.4rem 0.8rem;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.15s;
            z-index: 100;
        }
        .btn-locked:hover::after,
        .tab-locked:hover::after { opacity: 1; }

        /* Success state */
        #success-panel {
            display: none;
            padding: 2.5rem 1.5rem;
            text-align: center;
        }

        #success-panel.visible { display: block; }

        .success-glyph {
            font-size: 2rem;
            margin-bottom: 0.8rem;
            display: block;
        }

        .success-title {
            font-family: 'Cinzel', serif;
            font-size: 0.85rem;
            letter-spacing: 0.15em;
            color: var(--gold);
            text-transform: uppercase;
        }

        .success-body {
            font-size: 0.85rem;
            color: var(--text-dim);
            margin-top: 0.4rem;
            font-style: italic;
        }

        /* ── Announcement banner ────────────── */
        .announcement-banner {
            display: none;
            position: relative;
            z-index: 1;
            width: 100%;
            flex-shrink: 0;
            background: rgba(201,168,76,0.06);
            border-top:    1px solid var(--gold-dim);
            border-bottom: 1px solid var(--gold-dim);
            padding: 0.5rem 2.8rem 0.5rem 1rem;
            text-align: center;
        }
        .announcement-banner.visible { display: block; }

        /* ══ Install prompt ════════════════════════════════════
           iOS fires no beforeinstallprompt and offers no install API at all, so
           without a hint most players will never learn the app can be installed —
           which is the entire point of the PWA. Hence a banner rather than relying
           on the browser.

           ⚠ `display: none` here and revealed ONLY inside the ≤640px block, so the
           desktop shell is untouched by construction rather than by testing. It
           mirrors #mob-info-bar's `order: -1` so it lands under the dispatch and
           above the map; at default order it would sort after .map-wrap and end up
           behind the fixed faction strip. */
        .pwa-install { display: none; }
        .pwa-install-text { flex: 1; min-width: 0; font-size: 0.9rem; line-height: 1.35; }
        .pwa-install-text b { color: var(--gold); font-weight: 600; }
        .pwa-install .btn-pwa {
            flex: none; font-family: 'Cinzel', serif; font-size: 0.58rem;
            letter-spacing: 0.12em; text-transform: uppercase; color: #1a1206;
            cursor: pointer; padding: 0 0.85rem; min-height: 34px;
            border: 1px solid var(--gold);
            background: linear-gradient(180deg, #e0c368, #a8873a);
        }
        .pwa-install .btn-pwa-x {
            flex: none; width: 34px; min-height: 34px; cursor: pointer;
            background: none; border: 1px solid var(--border-mid);
            color: var(--text-dim); font-size: 0.85rem;
        }
        /* Guest welcome card (issue 15). Placement is per width: a float at the
           map's foot-left above 640px, an in-flow strip under the header at or
           below it (both further down). */
        .welcome-card {
            position: relative;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            padding: 0.7rem 2.4rem 0.75rem 0.85rem;
            border: 1px solid var(--gold-dim);
            background: rgba(12, 12, 22, 0.94);
            color: var(--text);
            font-size: 0.85rem;
            line-height: 1.4;
        }
        .welcome-card[hidden] { display: none; }
        .welcome-kicker {
            font-family: 'Cinzel', serif; font-size: 0.55rem; letter-spacing: 0.22em;
            text-transform: uppercase; color: var(--gold);
        }
        .welcome-text b { color: var(--gold); font-weight: 600; }
        .welcome-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
        .welcome-actions .btn { text-decoration: none; }
        .welcome-x {
            position: absolute; top: 0.45rem; right: 0.45rem;
            width: 28px; height: 28px; cursor: pointer;
            background: none; border: 1px solid var(--border-mid);
            color: var(--text-dim); font-size: 0.8rem;
        }
        .welcome-x:hover { color: var(--text); border-color: var(--text-dim); }

        /* Recovery route for a player who dismissed the banner. Hidden until JS
           decides the app is actually installable. */
        #pwa-menu-item { display: none; }

        .announcement-label {
            font-family: 'Cinzel', serif;
            font-size: 0.5rem;
            letter-spacing: 0.22em;
            text-transform: uppercase;
            color: var(--gold-dim);
            margin-bottom: 0.2rem;
        }

        .announcement-body {
            font-family: 'Crimson Text', serif;
            font-size: 0.95rem;
            color: var(--text);
            line-height: 1.45;
            /* The dispatch is GM-authored free text and routinely carries a
               patch-notes URL, which has no break opportunity in it. Full
               width that never showed; in Phase 1's right rail it pushed the
               rail into a horizontal scroll at the 280px end of the clamp.
               `anywhere` rather than `break-word` so the URL also stops
               counting toward min-content width, which is what was actually
               widening the column. */
            overflow-wrap: anywhere;
        }

        .announcement-dismiss {
            position: absolute;
            top: 50%;
            right: 0.7rem;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: var(--text-dim);
            font-size: 0.85rem;
            cursor: pointer;
            line-height: 1;
            padding: 0.2rem 0.3rem;
        }
        .announcement-dismiss:hover { color: var(--text); }

        /* ── Campaign Timer ─────────────────── */
        .campaign-timer {
            position: relative;
            z-index: 1;
            text-align: center;
            padding: 0.2rem 1rem 0.5rem;
            width: 100%;
            flex-shrink: 0;
        }

        .ct-label {
            font-family: 'Cinzel', serif;
            font-size: 0.52rem;
            letter-spacing: 0.3em;
            color: var(--text-dim);
            text-transform: uppercase;
            margin-bottom: 0.55rem;
            opacity: 0.55;
        }

        .ct-progress-wrap {
            width: 260px;
            height: 2px;
            background: var(--border);
            margin: 0 auto 0.5rem;
        }

        .ct-progress-bar {
            height: 100%;
            background: linear-gradient(to right, var(--gold-dim), var(--gold));
            width: 100%;
            transition: width 0.6s ease;
        }

        .ct-countdown {
            display: flex;
            justify-content: center;
            align-items: flex-start;
            gap: 0.5rem;
            margin-bottom: 0.55rem;
        }

        .ct-unit {
            display: flex;
            flex-direction: column;
            align-items: center;
            min-width: 2.8rem;
        }

        .ct-val {
            font-family: 'Cinzel', serif;
            font-size: 1.05rem;
            color: var(--gold);
            letter-spacing: 0.05em;
            line-height: 1;
        }

        .ct-unit-label {
            font-family: 'Cinzel', serif;
            font-size: 0.42rem;
            letter-spacing: 0.2em;
            color: var(--text-dim);
            text-transform: uppercase;
            margin-top: 0.2rem;
        }

        .ct-sep {
            font-family: 'Cinzel', serif;
            font-size: 0.9rem;
            color: var(--gold-dim);
            opacity: 0.35;
            padding-top: 0.05rem;
        }

        .ct-countdown.overdue .ct-val { color: var(--red); }

        /* U27 — the header-collapse strip is GONE: the button, toggleHeader(),
           the restore IIFE and every rule that styled them, all in one commit.
           §8.1 is why they cannot be separated: the IIFE dereferenced
           #btn-collapse-header UNGUARDED at module scope, so deleting the
           button alone would throw before init() ran, for exactly those users
           whose localStorage carried the flag — i.e. it passes in a fresh
           browser and fails for returning players. */

        /* ── Modal tabs ─────────────────────── */
        .modal-tabs {
            display: flex;
            border-bottom: 1px solid var(--border);
        }

        .modal-tab {
            flex: 1;
            padding: 0.65rem 0.5rem;
            background: none;
            border: none;
            border-bottom: 2px solid transparent;
            color: var(--text-dim);
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s;
            margin-bottom: -1px;
        }

        .modal-tab:hover { color: var(--text); }

        .modal-tab.active {
            color: var(--gold);
            border-bottom-color: var(--gold-dim);
        }

        /* ── GM edit event overlay ──────────── */
        #gm-edit-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            z-index: 2500;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        #gm-edit-overlay.open { display: flex; }

        #gm-edit-modal {
            background: var(--surface);
            border: 1px solid var(--border-mid);
            width: 100%;
            max-width: 480px;
            padding: 1.4rem 1.5rem 1.2rem;
            position: relative;
        }

        .gm-edit-title {
            font-family: 'Cinzel', serif;
            font-size: 0.72rem;
            letter-spacing: 0.2em;
            text-transform: uppercase;
            color: var(--gold);
            margin-bottom: 1.1rem;
        }

        .gm-edit-row { margin-bottom: 0.85rem; }
        .gm-edit-label {
            display: block;
            font-family: 'Cinzel', serif;
            font-size: 0.52rem;
            letter-spacing: 0.15em;
            text-transform: uppercase;
            color: var(--text-dim);
            margin-bottom: 0.3rem;
        }
        .gm-edit-input,
        .gm-edit-textarea,
        .gm-edit-select {
            width: 100%;
            background: var(--bg);
            border: 1px solid var(--border-mid);
            color: var(--text);
            font-family: 'Crimson Text', serif;
            font-size: 1rem;
            padding: 0.4rem 0.6rem;
        }
        .gm-edit-textarea { resize: vertical; min-height: 70px; }
        .gm-edit-select option { background: var(--bg); }

        .gm-edit-footer {
            display: flex;
            justify-content: flex-end;
            gap: 0.6rem;
            margin-top: 1.1rem;
        }

        /* ── GM close event overlay ─────────── */
        #gm-close-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            z-index: 2500;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        #gm-close-overlay.open { display: flex; }
        #gm-close-modal {
            background: var(--surface);
            border: 1px solid var(--border-mid);
            width: 100%;
            max-width: 420px;
            padding: 1.4rem 1.5rem 1.2rem;
            position: relative;
        }

        /* ── GM move event overlay (issue #7) ─ */
        #gm-move-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            z-index: 2500;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        #gm-move-overlay.open { display: flex; }
        #gm-move-modal {
            background: var(--surface);
            border: 1px solid var(--border-mid);
            width: 100%;
            max-width: 460px;
            padding: 1.4rem 1.5rem 1.2rem;
            position: relative;
        }
        .gm-move-note { color: var(--text-dim); font-size: 0.82rem; margin: 0.6rem 0 0; }
        .gm-move-msg { color: var(--red); font-size: 0.85rem; min-height: 1.1em; margin-top: 0.4rem; }

        /* ── GM ownership overlay ───────────── */
        #gm-ownership-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            z-index: 2500;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        #gm-ownership-overlay.open { display: flex; }
        #gm-ownership-modal {
            background: var(--surface);
            border: 1px solid var(--border-mid);
            width: 100%;
            max-width: 420px;
            padding: 1.4rem 1.5rem 1.2rem;
            position: relative;
        }

        /* ── GM building overlay ────────────── */
        #gm-building-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            z-index: 2500;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        #gm-building-overlay.open { display: flex; }
        #gm-building-modal {
            background: var(--surface);
            border: 1px solid var(--border-mid);
            width: 100%;
            max-width: 420px;
            padding: 1.4rem 1.5rem 1.2rem;
            position: relative;
        }

        /* ── GM edit report overlay ────────── */
        #gm-report-edit-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            z-index: 2500;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        #gm-report-edit-overlay.open { display: flex; }
        #gm-report-edit-modal {
            background: var(--surface);
            border: 1px solid var(--border-mid);
            width: 100%;
            max-width: 480px;
            padding: 1.4rem 1.5rem 1.2rem;
            position: relative;
        }

        /* ── GM create scenario overlay ────── */
        #gm-scenario-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            z-index: 2500;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        #gm-scenario-overlay.open { display: flex; }
        #gm-scenario-modal {
            background: var(--surface);
            border: 1px solid var(--border-mid);
            width: 100%;
            max-width: 480px;
            padding: 1.4rem 1.5rem 1.2rem;
            position: relative;
        }

        /* ── GM edit hex overlay ───────────── */
        #gm-hex-edit-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            z-index: 2500;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        #gm-hex-edit-overlay.open { display: flex; }
        #gm-hex-edit-modal {
            background: var(--surface);
            border: 1px solid var(--border-mid);
            width: 100%;
            max-width: 480px;
            padding: 1.4rem 1.5rem 1.2rem;
            position: relative;
        }

        /* ── GM hex controls strip ──────────── */
        .gm-hex-controls {
            display: none;
            padding: 0.6rem 1.4rem;
            border-top: 1px solid var(--border);
            background: rgba(201,168,76,0.04);
            gap: 0.6rem;
            align-items: center;
            flex-wrap: wrap;
        }
        .gm-hex-controls.visible { display: flex; }

        .gm-hex-label {
            font-family: 'Cinzel', serif;
            font-size: 0.52rem;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: var(--gold-dim);
            margin-right: auto;
        }

        .btn-gm-contested {
            font-family: 'Cinzel', serif;
            font-size: 0.52rem;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            border: 1px solid #c97a2a;
            color: #c97a2a;
            background: transparent;
            padding: 0.28rem 0.7rem;
            cursor: pointer;
            transition: background 0.15s;
        }
        .btn-gm-contested:hover { background: rgba(201,122,42,0.12); }
        .btn-gm-contested.is-contested {
            border-color: var(--text-dim);
            color: var(--text-dim);
        }
        .btn-gm-contested.is-contested:hover { background: rgba(138,122,90,0.12); }

        /* ── Footer ─────────────────────────── */
        footer { display: none; }

        /* ── GM Panel button ────────────────── */
        .btn-gm-panel {
            display: none;
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.15em;
            text-transform: uppercase;
            color: var(--gold-dim);
            border: 1px solid var(--gold-dim);
            background: transparent;
            padding: 0.35rem 0.8rem;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s;
        }
        .btn-gm-panel:hover { color: var(--gold); border-color: var(--gold); }
        .btn-gm-panel.visible { display: inline-block; }

        /* ── GM Panel overlay ───────────────── */
        #gm-panel-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.82);
            z-index: 600;
            align-items: flex-start;
            justify-content: center;
            padding: 2rem 1rem;
            overflow-y: auto;
        }
        #gm-panel-overlay.open { display: flex; }

        #gm-panel {
            /* chrome: .ov-panel (Phase 14) */
            width: var(--win-w);
            padding: 1.5rem;
            position: relative;
        }

        .gm-panel-header {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            margin-bottom: 1rem;
        }
        .gm-panel-title {
            font-family: 'Cinzel', serif;
            font-size: 0.85rem;
            letter-spacing: 0.2em;
            text-transform: uppercase;
            color: var(--gold);
        }
        .gm-panel-close {
            background: none;
            border: none;
            color: var(--text-dim);
            font-size: 1rem;
            cursor: pointer;
            line-height: 1;
            padding: 0.2rem 0.4rem;
        }
        .gm-panel-close:hover { color: var(--text); }

        /* Top-level tabs (Reports / Campaign) */
        .gm-tab-row {
            display: flex;
            border-bottom: 1px solid var(--border-mid);
            margin-bottom: 1.2rem;
        }
        .gm-tab-btn {
            background: none;
            border: none;
            border-bottom: 2px solid transparent;
            padding: 0.55rem 1.2rem;
            font-family: 'Cinzel', serif;
            font-size: 0.65rem;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            color: var(--text-dim);
            cursor: pointer;
            margin-bottom: -1px;
            transition: color 0.15s, border-color 0.15s;
        }
        .gm-tab-btn:hover { color: var(--text); }
        .gm-tab-btn.active { color: var(--gold); border-bottom-color: var(--gold-dim); }

        /* Appendix A settings grid (plan §18.4) */
        .gm-set-row {
            display: grid;
            grid-template-columns: minmax(0,1fr) 7rem auto;
            gap: 0.6rem;
            align-items: center;
            padding: 0.32rem 0;
            border-bottom: 1px solid rgba(255,255,255,0.05);
        }
        .gm-set-row:last-child { border-bottom: none; }
        .gm-set-key { font-size: 0.78rem; color: var(--text); min-width: 0; }
        .gm-set-key code { font-size: 0.74rem; color: var(--text); word-break: break-all; }
        .gm-set-input {
            background: rgba(0,0,0,0.35);
            border: 1px solid rgba(255,255,255,0.14);
            border-radius: 4px;
            color: var(--text);
            padding: 0.3rem 0.45rem;
            font-size: 0.8rem;
            width: 100%;
        }
        .gm-set-input:focus { outline: none; border-color: var(--gold-dim); }
        .gm-set-default { font-size: 0.68rem; color: var(--text-dim); white-space: nowrap; }
        .gm-set-badge {
            display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.35rem;
            border-radius: 3px; font-size: 0.6rem; letter-spacing: 0.06em;
            text-transform: uppercase; color: var(--text-dim);
            border: 1px solid rgba(255,255,255,0.12);
        }
        .gm-set-badge.gm-set-custom { color: var(--gold); border-color: var(--gold-dim); }

        /* ── Phase 2: the faction action ledger ──────────────────────────────
           Status colour is the only thing carrying meaning at a glance here, so
           it is never the ONLY channel — every row also prints the status word,
           and a skipped row prints its stated reason (D33). */
        .gm-act-form {
            display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 0.5rem; align-items: end; margin-bottom: 0.7rem;
        }
        .gm-act-field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
        .gm-act-label {
            font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase;
            color: var(--text-dim);
        }
        .gm-act-input, .gm-act-select {
            background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.14);
            color: var(--text); border-radius: 4px; padding: 0.32rem 0.4rem;
            font-size: 0.78rem; font-family: inherit; width: 100%; box-sizing: border-box;
        }
        .gm-act-input:focus, .gm-act-select:focus { outline: none; border-color: var(--gold-dim); }
        .gm-act-hexname { font-size: 0.68rem; color: var(--text-dim); min-height: 0.9rem; }
        .gm-act-slots { font-size: 0.72rem; color: var(--text-dim); margin-bottom: 0.5rem; }
        .gm-act-slots strong { color: var(--gold); }

        .gm-act-filter-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }

        /* ⚠ A FACTION-PLUS-ITS-BUTTONS GROUP, AND IT MUST BE ABLE TO WRAP INSIDE
           ITSELF. Three Council AI renderers emit one of these per faction; each
           carried an inline `white-space:nowrap`, which made the WHOLE group one
           unbreakable box — "The Verdant Dominion" plus Actions/Research/Reactions
           is 334px, so in the 290px row it drew to x=376 on a 375px viewport: past
           the panel edge AND past the screen. `flex-wrap` on the ROW cannot fix
           that, because the item itself is wider than the line; the nowrap is what
           forbids the break. Wrapping is INSIDE the group so the buttons drop under
           their own faction rather than joining the next one — which is why this is
           a group with `min-width: 0`, not just a deleted nowrap.
           The NAME keeps its nowrap: a faction name broken mid-phrase is the one
           break that reads as damage. Costs nothing — every name fits one line at
           320px. Above ~400px nothing wraps and the row renders as it always did. */
        .gm-fac-group {
            display: inline-flex; flex-wrap: wrap; align-items: center;
            gap: 0.25rem 0.3rem; margin-right: 14px; min-width: 0;
        }
        .gm-fac-group > strong { white-space: nowrap; }
        .gm-act-filter {
            background: none; border: 1px solid rgba(255,255,255,0.14); color: var(--text-dim);
            border-radius: 3px; padding: 0.2rem 0.5rem; font-size: 0.7rem;
            font-family: inherit; cursor: pointer;
        }
        .gm-act-filter:hover { color: var(--text); }
        .gm-act-filter.active { color: var(--gold); border-color: var(--gold-dim); }

        .gm-act-row {
            display: grid; grid-template-columns: 2.4rem 1fr 1.6fr auto;
            gap: 0.5rem; align-items: baseline;
            padding: 0.4rem 0; border-bottom: 1px solid rgba(255,255,255,0.06);
            font-size: 0.76rem;
        }
        /* ⚠️ `.gm-act-row` IS A FOUR-COLUMN GRID AND ONLY THE ACTIONS LEDGER FILLS
           ALL FOUR. Anything else that borrows the class puts its FIRST child in
           the 2.4rem id column, which squeezes that text to roughly one word per
           line — the whole row then reads as a vertical stack of single words.
           Reported on the GM Research tab's Funding Targets 2026-08-16.

           Two variants for the borrowers, so the ledger's own columns never move:
             --pair  a main block plus a control on the right (Research tab)
             --stack free-form blocks that were never columnar at all
                     (council proposals, conflict results)
           `min-width: 0` is load-bearing on the pair: a grid item's default
           `min-width:auto` refuses to shrink below its longest word, so a long
           technology name would push the select off the row instead of wrapping. */
        .gm-act-row--pair  { grid-template-columns: 1fr auto; align-items: center; }
        .gm-act-row--pair > * { min-width: 0; }
        .gm-act-row--stack { display: block; }
        .gm-act-main { min-width: 0; }
        .gm-act-side { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

        .gm-act-id { color: var(--text-dim); font-size: 0.68rem; }
        .gm-act-what strong { color: var(--text); }
        .gm-act-where { color: var(--text-dim); font-size: 0.72rem; }
        .gm-act-status {
            font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase;
            padding: 0.05rem 0.35rem; border-radius: 3px; white-space: nowrap;
            border: 1px solid rgba(255,255,255,0.12); color: var(--text-dim);
        }
        .gm-act-status.st-queued   { color: var(--gold);    border-color: var(--gold-dim); }
        .gm-act-status.st-executed { color: #2db969;        border-color: rgba(45,185,105,0.5); }
        .gm-act-status.st-skipped  { color: #d8a24a;        border-color: rgba(216,162,74,0.5); }
        .gm-act-status.st-failed   { color: #e0645c;        border-color: rgba(224,100,92,0.55); }
        .gm-act-reason { grid-column: 2 / -1; color: var(--text-dim); font-size: 0.7rem; font-style: italic; }

        /* Conflict resolution (Phase 4) — BLD §14.2's breakdown */
        .btn-sm { padding: 0.25rem 0.6rem; font-size: 0.68rem; }
        .gm-conflict-row {
            border: 1px solid rgba(255,255,255,0.08); border-radius: 4px;
            padding: 0.5rem 0.6rem; margin-bottom: 0.5rem;
        }
        .gm-conflict-head { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
        .gm-conflict-hex  { color: var(--text); font-size: 0.8rem; font-weight: 600; }
        .gm-conflict-owner { color: var(--text-dim); font-size: 0.7rem; flex: 1; }
        .gm-conflict-def  { color: var(--gold); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.05em; }
        .gm-conflict-body:not(:empty) { margin-top: 0.55rem; }
        .gm-conflict-outcome {
            font-size: 0.74rem; font-weight: 600; margin-bottom: 0.45rem;
            padding: 0.25rem 0.5rem; border-radius: 3px; display: inline-block;
        }
        .gm-conflict-outcome.transfer  { color: #2db969; background: rgba(45,185,105,0.12); }
        .gm-conflict-outcome.held      { color: var(--gold); background: rgba(215,182,80,0.12); }
        .gm-conflict-outcome.contested { color: #d8a24a; background: rgba(216,162,74,0.12); }
        .gm-conflict-table {
            width: 100%; border-collapse: collapse; font-size: 0.68rem; margin-bottom: 0.4rem;
            display: block; overflow-x: auto;
        }
        .gm-conflict-table th {
            text-align: left; color: var(--text-dim); font-weight: 500;
            font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.04em;
            padding: 0.2rem 0.4rem; border-bottom: 1px solid rgba(255,255,255,0.1); white-space: nowrap;
        }
        .gm-conflict-table td { padding: 0.25rem 0.4rem; border-bottom: 1px solid rgba(255,255,255,0.05); white-space: nowrap; }
        .gm-conflict-table tr.gc-win td { color: var(--gold); }
        .gm-conflict-cap { color: #d8a24a; font-size: 0.58rem; text-transform: uppercase; }
        .gm-conflict-note { color: var(--text-dim); font-size: 0.7rem; margin: 0.2rem 0; }
        .gm-conflict-refusal { color: #e0645c; font-size: 0.72rem; margin: 0.3rem 0; }
        .gm-conflict-accepted { color: #2db969; font-size: 0.72rem; margin: 0.3rem 0; }
        .gm-conflict-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
        .gm-act-cost   { grid-column: 2 / -1; color: var(--text-dim); font-size: 0.68rem; }
        .gm-act-cost .cost-spend  { color: #e0a05c; }
        .gm-act-cost .cost-refund { color: #2db969; }
        .gm-act-empty { color: var(--text-dim); font-size: 0.78rem; padding: 0.5rem 0; }

        .gm-viewas-row {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            padding: 0.5rem 0.8rem;
            margin-bottom: 0.8rem;
            background: rgba(255,255,255,0.03);
            border: 1px solid var(--border-mid);
            border-radius: 4px;
        }
        .gm-viewas-label {
            font-size: 0.6rem;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: var(--text-dim);
            margin-right: 0.3rem;
        }
        .gm-viewas-btn {
            background: none;
            border: 1px solid var(--border-mid);
            border-radius: 3px;
            padding: 0.25rem 0.7rem;
            font-family: 'Cinzel', serif;
            font-size: 0.6rem;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--text-dim);
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s;
        }
        .gm-viewas-btn:hover { color: var(--text); border-color: var(--text-dim); }
        .gm-viewas-btn.active { color: var(--gold); border-color: var(--gold-dim); }

        /* Filter tabs (inside Reports tab) */
        /* The five resource inputs on the Campaign tab. It was an inline
           `repeat(5,1fr)`, which cannot be overridden from a stylesheet without
           `!important` — hence the class. **`1fr` DOES NOT MEAN "shrink to
           anything"**: its floor is min-content, so at 320px the five columns
           refused to go below their own labels ("Population" is the widest) and
           the grid ran 20px past its own box. `auto-fit` + `minmax` re-flows to
           however many columns actually fit — five on a desktop panel, three or
           two on a phone — instead of insisting on five. */
        .gm-res-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(4.4rem, 1fr));
            gap: 0.5rem;
            margin-bottom: 0.75rem;
        }

        .gm-filter-row {
            display: flex;
            /* ⚠ WRAPS. Four filter buttons (Pending/Approved/Rejected/All) want
               320px against the 275px the panel gives them at a 320px viewport,
               so "All" drew to x=342 — past the panel (312) and off the screen.
               Same family as `.bs-density-head` and `.gm-fac-group`; the row is
               the thing that has to yield, since the buttons are already only
               ~90px each. */
            flex-wrap: wrap;
            gap: 0;
            border-bottom: 1px solid var(--border);
            margin-bottom: 1.2rem;
        }
        .gm-filter-btn {
            background: none;
            border: none;
            border-bottom: 2px solid transparent;
            padding: 0.5rem 1rem;
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.15em;
            text-transform: uppercase;
            color: var(--text-dim);
            cursor: pointer;
            margin-bottom: -1px;
            transition: color 0.15s, border-color 0.15s;
        }
        .gm-filter-btn:hover { color: var(--text); }
        .gm-filter-btn.active { color: var(--gold); border-bottom-color: var(--gold-dim); }

        /* Campaign tab */
        .gm-campaign-section {
            border: 1px solid var(--border);
            padding: 1.1rem 1.2rem;
            margin-bottom: 1rem;
        }
        .gm-campaign-section-title {
            font-family: 'Cinzel', serif;
            font-size: 0.72rem;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            color: var(--gold);
            margin-bottom: 0.5rem;
        }
        .gm-campaign-desc {
            font-size: 0.85rem;
            color: var(--text-dim);
            margin-bottom: 0.9rem;
            line-height: 1.5;
        }
        .gm-cycle-badge {
            font-family: 'Cinzel', serif;
            font-size: 0.52rem;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            border: 1px solid var(--gold-dim);
            color: var(--gold);
            padding: 0.18rem 0.45rem;
            white-space: nowrap;
        }
        .gm-cycle-badge.past { border-color: var(--border); color: var(--text-dim); }
        .btn-gm-action {
            font-family: 'Cinzel', serif;
            font-size: 0.58rem;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            border: 1px solid var(--gold-dim);
            color: var(--gold-dim);
            background: transparent;
            padding: 0.4rem 1rem;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s, background 0.15s;
        }
        .btn-gm-action:hover { color: var(--gold); border-color: var(--gold); background: var(--gold-faint); }
        .btn-gm-action:disabled { opacity: 0.4; cursor: not-allowed; }
        .gm-reroll-result {
            margin-top: 0.9rem;
            padding: 0.7rem 0.9rem;
            border: 1px solid var(--border);
            background: var(--bg);
            font-size: 0.82rem;
            color: var(--text-dim);
            display: none;
        }
        .gm-reroll-result.visible { display: block; }
        .gm-reroll-result-row { padding: 0.2rem 0; }
        .gm-reroll-result-row strong { color: var(--gold); }

        /* Report cards */
        /* Army list attachment (report form + editor + cards) */
        .army-src-toggle { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; }
        .army-src-btn {
            flex: 1; padding: 0.4rem 0.5rem; font-size: 0.72rem;
            background: transparent; color: var(--text-dim);
            border: 1px solid var(--border-mid); border-radius: 5px; cursor: pointer;
        }
        .army-src-btn.active { color: var(--gold); border-color: var(--gold); background: rgba(215,182,80,0.08); }
        .army-preview { margin-top: 0.4rem; font-size: 0.72rem; min-height: 1em; line-height: 1.3; }
        .army-preview.checking { color: var(--text-dim); font-style: italic; }
        .army-preview.ok  { color: var(--green); }
        .army-preview.err { color: var(--red); }
        .gm-card-army { font-size: 0.68rem; color: var(--gold); margin-top: 0.3rem; }
        .army-card-link { color: var(--text-dim); text-decoration: underline; }

        .gm-report-list { display: flex; flex-direction: column; gap: 0.75rem; }

        .gm-report-card {
            border: 1px solid var(--border);
            padding: 0.85rem 1rem;
            background: var(--surface2);
        }

        .gm-card-top {
            display: flex;
            align-items: baseline;
            gap: 0.6rem;
            flex-wrap: wrap;
            margin-bottom: 0.4rem;
        }
        .gm-card-hex  { font-family: 'Cinzel', serif; font-size: 0.78rem; color: var(--gold); }
        .gm-card-player { font-size: 0.85rem; color: var(--text); }
        .gm-card-faction { font-size: 0.75rem; color: var(--text-dim); }
        .gm-card-date { font-size: 0.7rem; color: var(--text-dim); margin-left: auto; }

        .gm-card-result-row {
            display: flex;
            align-items: center;
            gap: 0.8rem;
            margin-bottom: 0.4rem;
            font-size: 0.8rem;
        }
        .gm-result-win  { color: var(--green); font-weight: 600; }
        .gm-result-loss { color: var(--red);   font-weight: 600; }
        .gm-result-draw { color: var(--text-dim); font-weight: 600; }
        .gm-card-vp { color: var(--text-dim); font-size: 0.75rem; }

        .gm-card-desc { font-size: 0.82rem; color: var(--text-dim); font-style: italic; margin-bottom: 0.6rem; }

        .gm-card-status-badge {
            display: inline-block;
            font-family: 'Cinzel', serif;
            font-size: 0.52rem;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            padding: 0.15rem 0.5rem;
            border: 1px solid;
            margin-right: 0.5rem;
        }
        .gm-badge-pending  { color: var(--gold-dim);  border-color: var(--gold-dim); }
        .gm-badge-approved { color: var(--green);     border-color: var(--green); }
        .gm-badge-rejected { color: var(--red);       border-color: var(--red); }

        .gm-card-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

        .gm-btn {
            font-family: 'Cinzel', serif;
            font-size: 0.52rem;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            border: 1px solid;
            background: transparent;
            padding: 0.25rem 0.65rem;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s, background 0.15s;
        }
        .gm-btn-approve { color: var(--green); border-color: var(--green); }
        .gm-btn-approve:hover { background: rgba(74,154,90,0.15); }
        .gm-btn-reject  { color: var(--red);   border-color: var(--red); }
        .gm-btn-reject:hover  { background: rgba(184,64,64,0.15); }
        .gm-btn-delete  { color: var(--text-dim); border-color: var(--border); }
        .gm-btn-delete:hover  { color: var(--red); border-color: var(--red); }

        .gm-empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-dim); font-style: italic; }
        .gm-loading { text-align: center; padding: 1.5rem; color: var(--text-dim); font-size: 0.8rem; }

        /* ── Help button ────────────────────── */
        .btn-help {
            background: none;
            border: 1px solid var(--border-mid);
            color: var(--text-dim);
            font-family: 'Cinzel', serif;
            font-size: 0.72rem;
            font-weight: 600;
            width: 26px;
            height: 26px;
            padding: 0;
            cursor: pointer;
            border-radius: 50%;
            line-height: 1;
            transition: color 0.15s, border-color 0.15s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .btn-help:hover { color: var(--gold); border-color: var(--gold-dim); }

        /* ── Help overlay ───────────────────── */
        #help-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.78);
            z-index: 3200;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        #help-overlay.open { display: flex; }

        #help-panel {
            /* chrome: .ov-panel (Phase 6) */
            width: var(--win-w);
            max-height: 88vh;
            display: flex;
            flex-direction: column;
            position: relative;
        }
        #help-panel::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 2px;
            background: linear-gradient(to right, transparent, var(--gold), transparent);
            border-radius: 4px 4px 0 0;
        }

        .help-header {
            padding: 1.3rem 2.5rem 0.9rem 1.6rem;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }
        .help-title {
            font-family: 'Cinzel Decorative', cursive;
            font-size: 0.9rem;
            color: var(--gold);
            letter-spacing: 0.12em;
            text-align: center;
        }
        .help-subtitle {
            font-family: 'Cinzel', serif;
            font-size: 0.5rem;
            letter-spacing: 0.28em;
            text-transform: uppercase;
            color: var(--text-dim);
            text-align: center;
            margin-top: 0.35rem;
        }

        #help-body {
            overflow-y: auto;
            flex: 1;
            padding: 1.1rem 1.6rem 1.4rem;
        }

        .help-section {
            margin-bottom: 1.2rem;
        }
        .help-section:last-child { margin-bottom: 0; }

        .help-section-title {
            font-family: 'Cinzel', serif;
            font-size: 0.56rem;
            letter-spacing: 0.24em;
            text-transform: uppercase;
            color: var(--gold-dim);
            border-bottom: 1px solid rgba(201,168,76,0.18);
            padding-bottom: 0.3rem;
            margin-bottom: 0.6rem;
        }

        .help-entry {
            display: flex;
            gap: 0.75rem;
            margin-bottom: 0.5rem;
            align-items: flex-start;
        }
        .help-entry:last-child { margin-bottom: 0; }

        .help-key {
            font-family: 'Cinzel', serif;
            font-size: 0.5rem;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--gold-dim);
            white-space: nowrap;
            min-width: 90px;
            flex-shrink: 0;
            padding-top: 0.18rem;
        }

        .help-desc {
            font-family: 'Crimson Text', serif;
            font-size: 0.95rem;
            color: var(--text-dim);
            line-height: 1.5;
        }
        .help-desc strong {
            color: var(--text);
            font-weight: 600;
        }

        .help-chip {
            display: inline-block;
            font-family: 'Cinzel', serif;
            font-size: 0.42rem;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-dim);
            background: rgba(255,255,255,0.06);
            border: 1px solid var(--border-mid);
            border-radius: 3px;
            padding: 0.1rem 0.38rem;
            vertical-align: middle;
            margin: 0 0.1rem;
        }

        /* ── Options panel ──────────────────── */
        .btn-options {
            background: none;
            border: 1px solid var(--border-mid);
            color: var(--text-dim);
            font-size: 0.9rem;
            padding: 0.28rem 0.55rem;
            cursor: pointer;
            border-radius: 3px;
            line-height: 1;
            transition: color 0.15s, border-color 0.15s;
        }
        .btn-options:hover { color: var(--gold); border-color: var(--gold-dim); }

        #options-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.75);
            z-index: 3200;
            align-items: center;
            justify-content: center;
        }
        #options-overlay.open { display: flex; }

        #options-panel {
            /* chrome: .ov-panel (Phase 6) */
            padding: 1.6rem 1.8rem 1.4rem;
            width: var(--win-w);
            position: relative;
        }

        .opt-title {
            font-family: 'Cinzel Decorative', cursive;
            font-size: 0.8rem;
            color: var(--gold);
            letter-spacing: 0.1em;
            text-align: center;
            margin-bottom: 1.3rem;
        }

        .opt-row {
            display: flex;
            align-items: center;
            gap: 0.9rem;
            margin-bottom: 0.85rem;
        }

        .opt-label {
            font-family: 'Cinzel', serif;
            font-size: 0.52rem;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            color: var(--text-dim);
            width: 80px;
            flex-shrink: 0;
        }

        .opt-size-val {
            font-family: 'Cinzel', serif;
            font-size: 0.5rem;
            color: var(--text-dim);
            min-width: 2.8rem;
            text-align: right;
        }

        /* ⚠ `min-width: 0` IS WHAT LETS `flex: 1` ACTUALLY SHRINK IT. A range
           input carries an INTRINSIC minimum width (~129px in Chrome), and a
           flex item's default `min-width: auto` floors it there — so `flex: 1`
           set a basis of 0 the item then refused to honour, and at 320px the row
           wanted 277px in a 267px box. ⚠ IT GETS WORSE AS Text Size RISES, which
           is the trap: the label and the readout scale with the setting and the
           range's floor does not, so at the default it only pushed the readout
           9px past its own row, but AT 130% the row overflowed by 47px and the
           readout drew to x=333 — past the panel (312) and off a 320px screen.
           That is the setting a player on a small phone is most likely to raise.
           Same shape as `.rs-tools`, one step further in: there the floor was the
           buttons' max-content, here it is a form control's own intrinsic size,
           which no amount of wrapping would have reached. */
        /* ⚠ THE TRACK IS 3px AND THE TARGET NO LONGER IS. With `height: 3px` on
           the INPUT the whole control was a 3px box — the thumb overflows it and
           is hit-testable, so the effective target measured ~14px (probed, not
           assumed), but tapping the TRACK to jump to a value was a 3px target.
           The box is now 22px and the 3px line is painted by the input's own
           background as a centred gradient, so the SAME element still owns the
           painting and the line lands at the vertical centre by construction.
           Deliberately NOT done with `::-webkit-slider-runnable-track`: that
           moves the painting to a pseudo-element whose default vertical
           placement differs between engines and would need a compensating
           `margin-top` on the thumb — a change whose only proof is looking at it,
           and this environment cannot screenshot. The thumb keeps centring
           itself in the box, which is what it already did. */
        input[type=range].opt-range {
            flex: 1;
            min-width: 0;
            -webkit-appearance: none;
            appearance: none;
            height: 22px;
            background: linear-gradient(var(--border-mid), var(--border-mid))
                        center / 100% 3px no-repeat;
            border-radius: 2px;
            outline: none;
            cursor: pointer;
        }
        input[type=range].opt-range::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: var(--gold);
            cursor: pointer;
            border: 2px solid var(--surface);
        }
        input[type=range].opt-range::-moz-range-thumb {
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: var(--gold);
            cursor: pointer;
            border: 2px solid var(--surface);
            box-shadow: none;
        }

        input[type=color].opt-color {
            -webkit-appearance: none;
            appearance: none;
            width: 44px;
            height: 28px;
            border: 1px solid var(--border-mid);
            border-radius: 3px;
            background: none;
            cursor: pointer;
            padding: 2px;
        }
        input[type=color].opt-color::-webkit-color-swatch-wrapper { padding: 0; }
        input[type=color].opt-color::-webkit-color-swatch { border: none; border-radius: 2px; }

        .opt-divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

        .opt-footer {
            display: flex;
            justify-content: space-between;
            gap: 0.5rem;
            margin-top: 1.3rem;
        }

        /* ── Map control cluster (Phase 3, U6/U23) ──────────────────────
           Bottom-LEFT of the map, at every width. Zoom keeps the bottom-right
           corner (U23), which is why this is a corner apiece rather than one
           stack of five controls down a single edge.

           These two rules replaced three near-identical positioned ones, each
           carrying `display: none` plus a `display: flex` override in the
           ≤640px block. Anchoring the WRAPPER once and letting the buttons flow
           is what makes Phase 4's fourth button a one-line addition instead of
           a fourth hardcoded bottom offset.

           It lives inside .map-svg-wrap, so on a phone it clears the fixed
           faction strip for free: .map-wrap already carries the padding-bottom
           that reserves it (§2.4's three-way fight for the bottom edge). */
        .map-cluster {
            position: absolute;
            top: 50%;
            bottom: auto;
            left: 0.9rem;
            transform: translateY(-50%);
            display: flex;
            /* `column`, not `column-reverse`: DOM order IS visual order, so the
               red Active-missions button stays above Browse hexes exactly as
               it did in the old mobile layout (4.1rem vs 0.65rem), and Phase
               4's layers toggle appends to the foot rather than silently
               displacing everything above it. */
            flex-direction: column;
            gap: 0.45rem;
            /* ⚠ 6, ABOVE .map-float's 4, AND IT CARRIES THE POPOVER WITH IT.
               This element is `position: absolute` WITH a z-index, so it opens
               a stacking context - which means .layers-popover's 1900 is
               clamped to whatever this number is, no matter how large it looks.
               At 2 the popover rendered UNDERNEATH the dispatch card, and only
               when the dispatch was long enough to reach the middle of the
               board, which is the kind of thing that looks fine until the GM
               posts a paragraph. */
            z-index: 6;
        }
        .map-cluster-btn {
            width: 2.8rem;
            height: 2.8rem;
            background: rgba(12,12,22,0.88);
            border: 1px solid var(--gold-dim);
            color: var(--gold);
            font-size: 1.2rem;
            line-height: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
            transition: background 0.15s, border-color 0.15s;
        }
        .map-cluster-btn:hover { background: rgba(30,28,50,0.96); border-color: var(--gold); }
        /* Active missions keeps its red. It is the one button here that reports
           a state of the board rather than opening a tool. */
        .map-cluster-btn--alert { border-color: rgba(184,64,64,0.6); color: #b84040; font-size: 1rem; }
        .map-cluster-btn--alert:hover { border-color: #b84040; }
        /* The injected SVG sizes off the button rather than the icon idiom's
           1.25em default, which is relative to a font-size these buttons only
           carry for their fallback glyph. */
        .map-cluster-btn .vt-icon { width: 1.35rem; height: 1.35rem; }

        /* ── The layers popover (Phase 4, U6/U22) ───────────────────────────
           Opens to the RIGHT of the cluster, aligned to the button's own row,
           because the cluster is pinned to the left edge and there is nowhere
           else for it to go. Anchored to .map-cluster, so it travels with the
           cluster at every width and needs no second position for mobile. */
        .layers-popover {
            display: none;
            position: absolute;
            left: calc(100% + 0.45rem);
            bottom: 0;
            width: 14.5rem;
            padding: 0.6rem 0.7rem;
            background: rgba(12,12,22,0.97);
            border: 1px solid var(--gold-dim);
            border-radius: 3px;
            z-index: 1900;
        }
        .layers-popover.open { display: block; }
        .lp-title {
            font-family: 'Cinzel', serif; font-size: 0.55rem; letter-spacing: .16em;
            text-transform: uppercase; color: var(--text-dim);
            padding-bottom: 0.45rem; margin-bottom: 0.4rem;
            border-bottom: 1px solid var(--border);
        }
        /* Second heading inside the same popover — needs a rule above it to
           separate the Hex fill group from the layer toggles. */
        .lp-title--sub { margin-top: 0.55rem; }
        /* Swatch key for the active Hex fill mode. Scrolls if a terrain legend
           runs long rather than growing the popover past the map. */
        .lp-legend {
            margin-top: 0.4rem; padding-top: 0.4rem;
            border-top: 1px solid var(--border);
            display: flex; flex-direction: column; gap: 0.24rem;
            max-height: 11rem; overflow-y: auto;
        }
        .lp-swatch-row {
            display: flex; align-items: center; gap: 0.4rem;
            font-family: 'Cinzel', serif; font-size: 0.5rem; letter-spacing: .08em;
            color: var(--text-dim);
        }
        .lp-swatch {
            flex: none; width: 0.85rem; height: 0.85rem; border-radius: 2px;
            border: 1px solid rgba(0,0,0,0.55);
        }
        .lp-swatch-label { flex: 1; min-width: 0; }
        .lp-row {
            display: flex; align-items: center; gap: 0.5rem;
            padding: 0.3rem 0; cursor: pointer;
            font-family: 'Cinzel', serif; font-size: 0.58rem;
            letter-spacing: .08em; color: var(--text);
        }
        .lp-row:hover { color: var(--gold); }
        .lp-row input { accent-color: var(--gold); cursor: pointer; flex: none; }
        .lp-label { flex: 1; min-width: 0; }
        /* Not a disabled state: the layer really is switchable, it just will not
           be drawn at the current zoom. Saying which zoom is the whole point. */
        .lp-gate {
            flex: none;
            font-family: 'Cinzel', serif; font-size: 0.42rem; letter-spacing: .1em;
            text-transform: uppercase; color: var(--text-dim);
            border: 1px solid var(--border-mid); border-radius: 2px;
            padding: 0.08rem 0.25rem;
        }

        /* ── The hex-browse panel (Phase 3) ─────────────────────────────
           ⚠ §2.5 SAYS "the handlers and panels are already width-agnostic".
           The HANDLERS are. The PANEL WAS NOT: its whole box and every one
           of its list rules lived inside the ≤640px block, so promoting the
           two buttons that open it gave a desktop user two controls that set
           `.open` on an element still sitting at `display: none`. Measured
           before it was fixed: the class went on, the list filled with five
           real rows, and the panel had zero height. Nothing threw.
           So the list styling below is now width-agnostic (it never had a
           width assumption in it), and the BOX is stated twice: a left
           drawer over the map here, the full-screen sheet in the ≤640px
           block. It is a child of .map-svg-wrap, so `absolute` puts it over
           the map and never over the rails (§8.8). */
        #mobile-hex-search {
            display: none;
            position: absolute;
            top: 0; bottom: 0; left: 0;
            width: min(360px, 100%);
            background: var(--surface);
            border-right: 1px solid var(--gold-dim);
            z-index: 1800;
            flex-direction: column;
        }
        #mobile-hex-search.open { display: flex; }

        .mhs-mode-bar {
            display: none;
            font-family: 'Cinzel', serif;
            font-size: 0.48rem;
            letter-spacing: 0.22em;
            text-transform: uppercase;
            padding: 0.35rem 0.9rem;
            flex-shrink: 0;
        }
        #mobile-hex-search.contested-mode .mhs-mode-bar {
            display: block;
            color: #b84040;
            background: rgba(184,64,64,0.08);
            border-bottom: 1px solid rgba(184,64,64,0.2);
        }

        .mhs-header {
            display: flex; align-items: center;
            padding: 0.6rem 0.75rem; gap: 0.5rem;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }
        #mhs-input {
            flex: 1;
            background: var(--bg);
            border: 1px solid var(--border-mid);
            color: var(--text);
            font-family: 'Crimson Text', serif; font-size: 1rem;
            padding: 0.4rem 0.6rem;
        }
        #mhs-input::placeholder { color: var(--text-dim); }
        .mhs-close {
            background: none; border: 1px solid var(--border-mid);
            color: var(--text-dim);
            width: 2rem; height: 2rem;
            font-size: 0.85rem; cursor: pointer; flex-shrink: 0;
        }
        #mhs-list { overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }

        .mhs-item {
            display: flex; align-items: center; gap: 0.7rem;
            padding: 0.65rem 0.9rem;
            border-bottom: 1px solid var(--border);
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
        }
        .mhs-item:active { background: var(--surface2); }
        .mhs-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
        .mhs-text { flex: 1; min-width: 0; }
        .mhs-name {
            font-family: 'Cinzel', serif; font-size: 0.68rem;
            letter-spacing: 0.06em; color: var(--text);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .mhs-meta {
            font-family: 'Crimson Text', serif; font-size: 0.82rem;
            color: var(--text-dim); margin-top: 0.08rem;
        }
        .mhs-tag {
            font-family: 'Cinzel', serif; font-size: 0.42rem;
            letter-spacing: 0.14em; text-transform: uppercase;
            color: var(--text-dim); border: 1px solid var(--border-mid);
            padding: 0.15rem 0.35rem; flex-shrink: 0;
        }
        .mhs-scenario-icon {
            width: 32px; height: 32px; flex-shrink: 0;
            object-fit: contain; border-radius: 50%;
            border: 1px solid var(--border-mid);
            background: rgba(201,168,76,0.06);
        }
        .mhs-event-name {
            font-family: 'Cinzel', serif; font-size: 0.52rem;
            letter-spacing: 0.06em; color: var(--gold-dim);
            margin-top: 0.18rem;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .mhs-field-badge {
            display: inline-block;
            font-family: 'Cinzel', serif; font-size: 0.38rem;
            letter-spacing: 0.12em; text-transform: uppercase;
            color: #4a9a5a; border: 1px solid rgba(74,154,90,0.35);
            padding: 0.1rem 0.28rem; margin-left: 0.4rem;
            vertical-align: middle; line-height: 1.6;
        }

/* Dispatch bar: a floating card on desktop, a collapsible bar on mobile.
           The mobile block re-declares all three at ID specificity, so it wins
           there regardless of what these say. */
        #mob-info-bar     { display: block; }
        #mob-info-content { display: block; }
        #mob-info-toggle  { display: none; }

        /* == The shell: map, two floating cards, nav bar at the foot ========
           A COLUMN at every width. `body` is already flex-column/100dvh/
           overflow-hidden, so the shell is the row that used to hold two rails
           either side of the map and is now just the map with the nav under it.
           #campaign-map has a fixed viewBox at width/height 100%, so it
           rescales into whatever is left for free.

           WARNING - .shell IS `position: relative` AND THAT IS LOAD-BEARING.
           Both floating cards are `position: absolute` and resolve against it.
           They are children of .shell rather than of .map-svg-wrap so that at
           <=640px they can drop back into the column: #mob-info-bar is pulled
           above the map with `order: -1` there, which an absolutely-positioned
           box inside the map could not be. */
        .shell {
            position: relative;
            z-index: 1;
            flex: 1;
            min-height: 0;
            width: 100%;
            display: flex;
            flex-direction: column;
            align-items: stretch;
        }

        /* -- The nav bar (U8, U12, U13) ------------------------------------
           campaignmap_nav.js renders the markup; this file styles it. The two
           are split on purpose: adding a destination is one edit in the shared
           module rather than three in three pages, and the module makes no
           styling decision, so each surface places the same nav differently.

           FULL labels >=1100px, SHORT labels below - and that is paintNav
           swapping the VARIANT, not CSS truncating. Seven tabs at 641px give
           91px each, which "Faction Research" cannot fit; an ellipsis is not a
           label, so the module hands over "Research" instead. The width the
           variant flips at is the same 1099.99/1099.98 pairing the old icon
           collapse used - see the .98 note further down, it is measured and it
           is not a typo. */
        .nav-bar {
            flex: none;
            min-width: 0;
            border-top: 1px solid var(--border);
            background: rgba(9, 9, 16, 0.96);
        }
        .nav-bar .vt-nav-list {
            list-style: none;
            display: flex;
            flex-direction: row;
            gap: 0;
        }
        .nav-bar .vt-nav-item { flex: 1 1 0; min-width: 0; }
        .nav-bar .vt-nav-link {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.32rem;
            width: 100%;
            padding: 0.62rem 0.35rem 0.5rem;
            background: transparent;
            border: none;
            /* The active marker sits on the BOTTOM edge, where the mockup draws
               it. 2px of transparent on every tab, so switching tabs cannot
               shift the row by the height of a border. */
            border-bottom: 2px solid transparent;
            color: var(--text-dim);
            cursor: pointer;
            text-decoration: none;
            text-align: center;
            font-family: 'Cinzel', serif;
            font-size: 0.56rem;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            transition: color 0.15s, border-color 0.15s, background 0.15s;
        }
        .nav-bar .vt-nav-link:hover { color: var(--gold); background: var(--gold-faint); }
        .nav-bar .vt-nav-link.is-active {
            color: var(--gold);
            border-bottom-color: var(--gold);
            background: var(--gold-faint);
        }
        .nav-bar .vt-nav-icon { display: flex; flex: none; }
        /* Overrides the idiom default, which at this 0.56rem label size would
           render the icons at ~11px. */
        .nav-bar .vt-icon { width: 22px; height: 22px; }
        .nav-bar .vt-nav-label {
            display: block; max-width: 100%;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }

        /* -- The two cards that float on the map ---------------------------
           WARNING - THIS REVERSES S8.8, deliberately (owner call). What S8.8
           protected was the map staying interactive while a hex is selected.
           That is kept, differently: the WRAPPER is `pointer-events: none` and
           only its children take clicks, so the board is live everywhere a card
           is not actually drawn - including the whole strip between them.
           Get this backwards and the map is dead under two invisible boxes,
           which looks like nothing at all until someone tries to click there.

           --nav-h is measured in _updateMobHdr(), the same idiom --mob-hdr and
           --mob-strip already use, because the bar height follows the icon size
           and the root font size, and the root font size is a Display Option
           the player can move. The 62px fallback is what it measures at the
           default; a wrong fallback only ever costs the card some scroll. */
        .map-float {
            position: absolute;
            top: 0.85rem;
            z-index: 4;
            width: clamp(232px, 21vw, 330px);
            max-height: calc(100% - var(--nav-h, 62px) - 1.7rem);
            overflow-y: auto;
            overscroll-behavior: contain;
            pointer-events: none;
            scrollbar-width: thin;
            scrollbar-color: var(--border-mid) transparent;
        }
        .map-float > * { pointer-events: auto; }
        .map-float--tl { left: 0.85rem; }
        .map-float--tr { right: 0.85rem; }

        /* WARNING - THESE ARE min-width: 641px AND THAT IS LOAD-BEARING, not
           tidiness. Every rule below is a DESCENDANT or a class selector that
           the <=640px block also styles with a bare class selector - and a
           media query adds no specificity of its own, so left unscoped they
           win INSIDE the mobile block. Measured once already at 375px: the
           faction strip lost `position: fixed`, fell back into flow at 114px
           against its intended ~50px, and took 114px off the map, with nothing
           thrown and the page still rendering. Anything new that reaches into
           an element the mobile block also styles belongs in here. */
        @media (min-width: 640.99px) {
            /* The dispatch card. #mob-info-toggle is hidden above, so the
               announcement banner IS the card - and the banner is
               `display: none` until it has something to say, which collapses
               the float to nothing rather than parking an empty frame over the
               board. Re-dressed from a full-width strip into a card: it was
               authored as a centred banner spanning the page. */
            .announcement-banner {
                border: 1px solid var(--gold-dim);
                border-radius: 3px;
                padding: 0.62rem 2.2rem 0.7rem 0.85rem;
                background: rgba(12, 12, 22, 0.94);
                -webkit-backdrop-filter: blur(6px);
                backdrop-filter: blur(6px);
                text-align: left;
            }
            .announcement-label { margin-bottom: 0.35rem; }

            /* renderHexRail() writes an empty STATE into the section, so this
               only catches the gap between markup and first paint - but an
               empty bordered box flashing in the corner is worth the line. */
            .rail-section:empty { display: none; }

            /* The guest welcome floats over the map's foot-left, clear of the
               nav bar (--nav-h, see .map-float) and the left-hand controls. */
            .welcome-card {
                position: absolute;
                left: 0.85rem;
                bottom: calc(var(--nav-h, 62px) + 0.85rem);
                z-index: 4;
                width: clamp(260px, 24vw, 360px);
                border-radius: 3px;
                -webkit-backdrop-filter: blur(6px);
                backdrop-filter: blur(6px);
            }
        }
        /* ── The hex summary (Phase 2, §3.1) ───────────────────────────────
           Built on the shared card idiom rather than a fourth private frame:
           .vt-card gives the double rule and the corner flourishes, and
           .vt-card-kicker / -title / -sub give the head. That is what Phase 0
           wrote them for. */
        .rail-hex { --vt-card-pad: 14px; }
        .rail-hex .vt-card-title { margin-top: 3px; }
        .rail-hex .vt-card-sub   { margin-top: 2px; font-style: normal; letter-spacing: .04em; }

        .rail-hex--empty {
            font-family: 'Cinzel', serif; font-size: 0.62rem; letter-spacing: .14em;
            text-transform: uppercase; color: var(--text-dim); text-align: center;
            padding: 22px 14px;
        }

        /* U7's status row. It is ABSENT on an ordinary hex, so these colours are
           only ever seen when there is something to say. Deliberately NOT the
           idiom's stance modifiers (--support / --oppose / …): those name a
           council stance, and dressing "Contested" in one because the colour
           happens to suit is reading a meaning off a value that only
           coincidentally matches — the defect shape this codebase records at
           plan §7.3 and §8.1. The badge SHAPE is shared; the tone is local.
           Two classes deep so the tone beats .vt-badge regardless of order. */
        .rail-states { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
        .vt-badge.rail-state--contested { background: rgba(184,64,64,.12);   border-color: var(--red);        color: #e08a8a; }
        .vt-badge.rail-state--hazard    { background: rgba(201,168,76,.14);  border-color: var(--gold);       color: var(--gold); }
        .vt-badge.rail-state--locked    { background: rgba(190,200,215,.08); border-color: var(--border-mid); color: var(--text-dim); }
        .vt-badge.rail-state--inactive  { background: transparent;           border-color: var(--border-mid); color: var(--text-dim); }

        .rail-fields { margin-top: 11px; display: grid; gap: 5px; }
        .rail-fields > div {
            display: flex; align-items: center; gap: 8px;
            font-size: 0.82rem; line-height: 1.4;
        }
        .rail-fields dt {
            flex: 0 0 5.2rem;
            font-family: 'Cinzel', serif; font-size: 0.55rem; letter-spacing: .12em;
            text-transform: uppercase; color: var(--text-dim);
        }
        .rail-fields dd {
            flex: 1; min-width: 0;
            display: flex; align-items: center; gap: 6px;
            color: var(--text); overflow-wrap: anywhere;
        }
        .rail-fields .rail-none { color: var(--text-dim); font-style: italic; }
        .rail-fac-icon {
            width: 18px; height: 18px; flex: none; object-fit: contain;
            border-radius: 50%; background: rgba(10,10,20,.7);
        }

        /* Both buttons hand off to the existing modal (§3.1). Side by side,
           as the mockup draws them, and `flex-wrap` is what makes that safe:
           at the 232px end of .map-float's clamp they stack again on their own
           rather than wrapping their own labels. */
        .rail-actions { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 6px; }
        .rail-btn {
            flex: 1 1 7.5rem;
            padding: 0.5rem 0.7rem;
            background: var(--gold-faint);
            border: 1px solid var(--gold-dim);
            border-radius: 3px;
            color: var(--gold);
            font-family: 'Cinzel', serif; font-size: 0.6rem;
            letter-spacing: .12em; text-transform: uppercase;
            cursor: pointer;
            transition: background .15s, border-color .15s, color .15s;
        }
        .rail-btn:hover { background: rgba(201,168,76,.16); border-color: var(--gold); }
        /* ── 641–1099px: the nav bar tightens ─────────────────────────
           U8's original job here was collapsing the LEFT RAIL to icons to buy
           back 126px of map width. There is no left rail any more, and a
           horizontal bar loses nothing by being narrow - so what this block
           does now is tighten the type, while paintNav swaps in the SHORT
           labels at the paired 1099.99px. The two must move together: this
           block and _navMQ are the same breakpoint written twice, once in CSS
           and once in JS, and only the JS one decides the label text. */
        /* ⚠ THE .98 IS NOT A TYPO — it is measured. At Windows' 125% display
           scaling (devicePixelRatio 1.25, the common case on this project's own
           machines) the viewport width is FRACTIONAL: a window reporting
           innerWidth 1099 is really 1099.2 CSS px, so `max-width: 1099px` does
           NOT match it while `max-width: 1100px` does. Measured in a browser:
           at innerWidth 1099 the icon collapse simply did not fire.
           The same arithmetic opens a GAP between the two blocks below: a
           viewport of 640.4px matches neither `max-width: 640px` nor
           `min-width: 641px`, so a window sitting there would get the mobile
           block's rules from neither side and fall back to the bare
           `.faction-panel` rule — position:absolute, 180px, inside the right
           rail. The pairing below closes it to 0.01px. Integer widths behave
           exactly as they did before. */
        @media (max-width: 1099.98px) {
            .nav-bar .vt-nav-link { font-size: 0.5rem; letter-spacing: 0.1em; padding: 0.55rem 0.2rem 0.45rem; }
            .nav-bar .vt-icon     { width: 20px; height: 20px; }
        }

        /* ════════════════════════════════════════════
           Mobile / touch  —  max-width: 640 px  (see the .98 note above)
           ════════════════════════════════════════════ */
        @media (max-width: 640.98px) {

            /* ── Header: compact single row, plus the status strip ──
               ⚠ THE ROW IS .hdr-main NOW, NOT <header>. The header is a COLUMN
               of two rows at every width; making it a row here again would put
               .hdr-main and .hdr-status side by side and squeeze both. It is
               restated rather than left to the base rule because the base rule
               is what changed. */
            header {
                display: flex;
                flex-direction: column;
                align-items: stretch;
                text-align: left;
                padding: 0;
                gap: 0;
            }
            .hdr-main {
                display: flex;
                flex-direction: row;
                align-items: center;
                min-height: 0;
                padding: 0.42rem 0.6rem;
                gap: 0.4rem;
            }
            /* The strip is just a wrapper on a phone: .campaign-timer keeps the
               compact horizontal treatment authored for it further down, and
               #faction-panel is `position: fixed` so it leaves this flow
               entirely for the bottom strip Phase 5 built. */
            .hdr-status {
                display: block;
                min-height: 0;
                padding: 0;
                gap: 0;
            }
            header h1 {
                flex: 1;
                font-size: 0.95rem;
                letter-spacing: 0.1em;
                text-align: center;
            }
            .subtitle              { display: none !important; }
            .btn-gm-panel          { display: none !important; }
            /* #btn-collapse-header, .btn-help and the desktop-to-mobile link are
               all GONE from the markup as of Phase 1 (U27 and U5), so the rules
               that used to hide them here went with them. The user menu now
               carries Help and shows for guests too, which means Help is
               reachable on a phone for the first time — U16 still owes the same
               fix for GM Panel, and that is Phase 5's. */

            /* ── The shell unwinds to a column (Phase 5 does the real work) ──
               .rail-right becomes `display: contents`, so the dispatch bar, the
               territory section and the faction strip become children of .shell
               directly — which is the arrangement that existed before Phase 1,
               one level deeper. #mob-info-bar has to be pulled back ABOVE the
               map because the rail sits after it in source order; .faction-panel
               is position:fixed here so its DOM parent does not matter. */
            .shell           { flex-direction: column; }
            #rail-territory  { display: none; }

            /* ⚠ THE FLOATS MUST BE UNDONE HERE, all four properties. They are
               `position: absolute` against .shell on desktop; left absolute at
               375px the dispatch bar would sit over the map instead of above
               it, and `pointer-events: none` on the wrapper would make its own
               collapse toggle untappable - a control that is visible, looks
               enabled and does nothing. */
            .map-float {
                position: static;
                width: auto;
                max-height: none;
                overflow: visible;
                pointer-events: auto;
            }

            /* The bar now carries ONLY the announcement - the countdown moved
               to the header strip, where it is always visible. So with nothing
               posted there is nothing behind the lip, and a toggle that opens
               onto an empty box is worse than no toggle. :has() is not
               supported everywhere; where it is missing the rule is dropped and
               the lip simply shows again, which is the old behaviour. */
            #mob-info-bar:not(:has(.announcement-banner.visible)) { display: none; }

            /* ── The seven-icon strip (U15, §2.4) ────────────────────────
               The SAME #nav-bar the desktop uses, re-rendered by paintNav()
               with the strip variant and its short labels. One nav element and
               one set of handlers at every width, rather than a second nav in
               the markup for the two of them to drift apart.
               `order` is what puts it under the header rather than at the foot
               where every other width now shows it: .shell is a column and the
               nav follows the map in source order, so without this the strip
               would land under the map on a phone too. That is a live question
               for a later pass — desktop moved its nav to the bottom and this
               did not — but Phase 5 authored the phone this way deliberately
               and moving it is not part of the desktop change. */
            .nav-bar {
                order: -2;
                flex: none;
                padding: 0;
                border-right: none;
                border-bottom: 1px solid var(--border);
                overflow: visible;
                background: rgba(9,9,16,0.95);
            }
            #mob-info-bar { order: -1; }
            .pwa-install.show {
                display: flex; order: -1; align-items: center; gap: 0.6rem;
                width: 100%; flex-shrink: 0; padding: 0.55rem 0.7rem;
                background: rgba(201,168,76,0.07);
                border-bottom: 1px solid var(--gold-dim);
            }
            #pwa-menu-item.avail { display: block; }
            /* The guest welcome: a strip under the header, like the install
               prompt, so it never sits over the map's corner controls. */
            .welcome-card {
                order: -1; width: 100%; flex-shrink: 0;
                border-width: 0 0 1px 0;
                background: rgba(201,168,76,0.07);
            }
            .nav-bar .vt-nav-list { flex-direction: row; gap: 0; }
            .nav-bar .vt-nav-item { flex: 1; min-width: 0; }
            /* Labels UNDER icons, ~53px per tab at 375px — the shape
               campaignmap_mobile.html's six-tab nav already proves. */
            /* ⚠ 0.42rem RENDERED AT 6.72px — the smallest text on the phone
               surface, on its primary navigation. Raised to 8px, which is the
               most this strip can carry: the seven items share the width, so at
               320px each label gets ~44px and "Research" is the binding word.
               The tracking and the inline padding pay for it — 0.1em → 0.04em
               and 0.15rem → 0.05rem — because at 8px with the old values every
               label ellipsised. Measured across all seven at 320 and 375: zero
               overflow. Do not raise it further without re-measuring "Research";
               0.52rem/0.02em already clips it by 1px. */
            .nav-bar .vt-nav-link {
                flex-direction: column;
                justify-content: center;
                gap: 0.18rem;
                padding: 0.45rem 0.05rem 0.5rem;
                border: none;
                border-radius: 0;
                font-size: 0.5rem;
                letter-spacing: 0.04em;
                text-align: center;
            }
            .nav-bar .vt-nav-link:hover,
            .nav-bar .vt-nav-link.is-active { background: none; border: none; }
            .nav-bar .vt-icon { width: 1.05rem; height: 1.05rem; }
            /* ⚠ `display: block` UNDOES U8's 1099px BLOCK, which also matches
               at 375px — `max-width: 1099.98px` is true on a phone too, and it
               hides .vt-nav-label to collapse the rail to icons. Without this
               the strip renders as seven unlabelled icons and U15's "labels
               under icons" is quietly not built. Measured, not reasoned: all
               seven computed to display:none. The two blocks have equal
               specificity, so what decides it is that this one comes later. */
            .nav-bar .vt-nav-label {
                display: block;
                width: 100%; overflow: hidden; text-overflow: ellipsis;
            }

            /* U16 — the only route into the GM Panel on a phone. */
            .user-chip.is-gm .user-dropdown .when-gm { display: block; }

            /* Auth area inline (no absolute positioning) */
            .auth-area {
                position: static;
                transform: none;
                flex-shrink: 0;
            }

            /* ── Faction panel: fixed at viewport bottom (not an SVG overlay) ── */
            .faction-panel {
                position: fixed;
                bottom: 0; left: 0; right: 0; top: auto;
                width: 100%; height: auto;
                flex-direction: row;
                justify-content: space-evenly;
                align-items: center;
                padding: 0.35rem 1rem;
                /* Installed on a notched iPhone there is no browser chrome below
                   this strip, so bottom:0 puts the faction emblems under the home
                   indicator. The shorthand above stays as the fallback: if env()
                   is unsupported this declaration is dropped, not the padding. */
                padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
                gap: 0;
                border-left: none;
                border-top: 1px solid var(--border);
                background: rgba(9,9,16,0.95);
                backdrop-filter: blur(6px);
                -webkit-backdrop-filter: blur(6px);
                z-index: 3;
            }
            .faction-card  { flex-direction: column; gap: 0.2rem; padding: 0.2rem 0.5rem; align-items: center; }
            .faction-card-icon { width: 36px; height: 36px; }
            /* Hide long names — icon + tap is enough; full name in faction modal */
            .faction-card-name { display: none; }

            /* Map-wrap: bottom padding so SVG stops above the fixed faction strip */
            .map-wrap { padding-bottom: 3.5rem; }
            .map-wrap { padding-bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px)); }

            /* The cluster stays in the bottom corner on a phone, which is
               where Phase 5 put it and what .map-wrap's padding-bottom already
               reserves room for against the fixed faction strip. */
            .map-cluster { left: 0.65rem; bottom: 0.65rem; top: auto; transform: none; }

            /* ── Zoom controls: bottom of the map area (not of the viewport) ── */
            /* Back to the bottom corner on a phone: the middle of the right
               edge is where a thumb rests while panning. `top`/`transform`
               must both be undone or the stack stretches. */
            .zoom-controls { right: 0.65rem; bottom: 0.65rem; top: auto; transform: none; }
            .zoom-btn { width: 2.8rem; height: 2.8rem; font-size: 1.3rem; }

            /* ── Hex modal: bottom sheet ── */
            /* ⚠ THE RESERVATION IS PADDING ON THE OVERLAY, NOT `bottom` ON THE
               SHEET. #modal is a FLEX ITEM here (align-items:flex-end), not a
               positioned box, so `bottom` on it is inert — measured: the sheet
               still finished 39px over the faction strip. Padding the overlay
               moves the flex-end item up by exactly the strip's height. */
            #modal-overlay { align-items: flex-end; padding: 0 0 var(--mob-strip, 56px); }
            #modal {
                width: 100%; max-width: 100%;
                /* §2.4 — the faction strip is the TRUE bottom edge and the sheet
                   slides above it, so both read at once. Without the second
                   subtraction the sheet covers the switcher at full extension.
                   --mob-strip is measured in _updateMobHdr(); the 56px fallback
                   only applies before the first measure. */
                max-height: calc(100dvh - var(--mob-hdr, 56px) - var(--mob-strip, 56px));
                transform: translateY(40px);
                border-left: none; border-right: none; border-bottom: none;
            }
            #modal-overlay.visible #modal { transform: translateY(0); }
            /* Repurpose the gold top-bar pseudo-element as a drag-handle pill */
            #modal::before {
                top: 0.5rem; left: 50%; right: auto;
                width: 2.4rem; height: 3px;
                background: var(--border-mid);
                border-radius: 2px;
                transform: translateX(-50%);
            }
            /* Extra space so drag handle doesn't overlap the title */
            .modal-header { padding-top: 1.2rem; }

            /* ── Faction modal: bottom sheet ── */
            #faction-modal-overlay { align-items: flex-end; padding: 0 0 var(--mob-strip, 56px); }
            #faction-modal {
                width: 100%; max-width: 100%;
                max-height: calc(100dvh - var(--mob-hdr, 56px) - var(--mob-strip, 56px));
                transform: translateY(40px);
                transition: transform 0.2s ease;
            }
            #faction-modal-overlay.visible #faction-modal { transform: translateY(0); }

            /* ── Hex-browse panel: full-screen on a phone ──
               The desktop box is at the base level (see there); this is the
               override, and it is the only part of the panel that ever cared
               about width. */
            #mobile-hex-search {
                position: fixed;
                top: var(--mob-hdr, 56px); bottom: 0; left: 0; right: 0;
                /* ⚠ BOTH RESETS ARE REQUIRED, and neither used to be: the base
                   rule this overrides did not exist before Phase 3. `width`
                   beats `left`+`right` on a fixed box, so the desktop drawer's
                   min(360px, 100%) left the sheet 360px wide on a 375px phone
                   — measured — and its border-right drew a stray rule down the
                   screen. Anything else added to the base box owes a reset
                   here. */
                width: auto;
                border-right: none;
                max-height: none;
                background: var(--surface);
                border-top: 1px solid var(--gold-dim);
                z-index: 1800;
                flex-direction: column;
            }
            #mobile-hex-search.open { display: flex; }

            /* ── Mobile floating buttons ── */
            /* The three map buttons show at every width as of Phase 3 (U6),
               so the reveals that used to live here went with the
               `display: none` they were undoing. */

            /* ── Faction modal tabs: equal-width, compact ── */
            .fm-tab-row { padding: 0; }
            #faction-modal .gm-tab-btn {
                flex: 1;
                padding: 0.55rem 0.3rem;
                font-size: 0.54rem;
                letter-spacing: 0.08em;
            }

            /* ── Campaign info bar (cycle timer + announcement) ── */
            #mob-info-bar {
                display: flex;
                flex-direction: column;
                flex-shrink: 0;
                width: 100%;
            }
            #mob-info-content {
                display: flex;
                flex-direction: column;
            }
            body.mob-bar-collapsed #mob-info-content { display: none; }

            #mob-info-toggle {
                display: flex;
                align-items: center;
                justify-content: center;
                gap: 0.45rem;
                width: 100%;
                padding: 0.32rem 1rem;
                background: rgba(201,168,76,0.04);
                border: none;
                border-top: 1px solid rgba(201,168,76,0.12);
                border-bottom: 1px solid rgba(201,168,76,0.12);
                color: var(--gold-dim);
                font-family: 'Cinzel', serif;
                /* 0.46rem was 7.36px on the one control that opens the dispatch.
                   It is full-width, so unlike the nav labels it has room. */
                font-size: 0.58rem;
                letter-spacing: 0.16em;
                text-transform: uppercase;
                cursor: pointer;
                -webkit-tap-highlight-color: transparent;
            }
            #mob-info-toggle:active { background: rgba(201,168,76,0.09); color: var(--gold); }

            /* Campaign timer: compact horizontal strip on mobile */
            .campaign-timer {
                padding: 0.45rem 1rem;
                display: flex;
                flex-direction: row;
                align-items: center;
                justify-content: center;
                gap: 1rem;
            }
            .campaign-timer .ct-label {
                margin-bottom: 0;
                font-size: 0.56rem;
                letter-spacing: 0.14em;
                opacity: 0.55;
                white-space: nowrap;
            }
            .campaign-timer .ct-countdown { margin-bottom: 0; gap: 0.3rem; }
            /* min-width grows with the label: "Hours" at 8px needs more than the
               2rem the 5.6px version fitted in. */
            .campaign-timer .ct-unit { min-width: 2.4rem; }
            .campaign-timer .ct-val { font-size: 0.9rem; }
            /* ⚠ 0.35rem RENDERED AT 5.6px — the smallest text anywhere in the
               app, on the three words that say what the countdown counts. */
            .campaign-timer .ct-unit-label { font-size: 0.5rem; margin-top: 0.1rem; }
            .campaign-timer .ct-sep { font-size: 0.8rem; }
            .campaign-timer .ct-progress-wrap { display: none; }

            /* ── Touch targets ────────────────────────────────────────────
               Everything below was measured under 30px on a phone. These are
               all CORNER or ROW controls with slack around them, so growing the
               box moves no layout — which is why this is a size bump and not a
               re-layout. Scoped to ≤640 deliberately: a pointer is precise and
               the desktop spacing was authored against these numbers. */
            .modal-close, .gm-panel-close {
                width: 36px; height: 36px;       /* was 26 × 26 */
            }
            /* The dismiss is a bare glyph with 0.2rem of padding — 21 × 20. */
            .announcement-dismiss { padding: 0.55rem 0.6rem; }
            /* 23px rows in the layers popover, which is itself a small target
               opened from a 45px cluster button. */
            .lp-row { padding: 0.5rem 0; }
            .lp-row input { width: 16px; height: 16px; }
            /* 19–21px on every GM control, and the GM Panel is reachable on a
               phone (U16), so these are real phone targets rather than desktop
               ones that happen to render small. */
            .btn-gm-action, .gm-btn-small { min-height: 28px; }
            /* 14 × 14, inside a label that was itself only 18px tall. Padding on
               the label is what actually makes it tappable — the checkbox is a
               third of the target even at 18px. */
            .vp-forget { padding: 0.35rem 0; }
            .vp-forget input[type="checkbox"] { width: 18px; height: 18px; }
            /* 62 × 20, and on a phone it is the ONLY route to Help, My Reports
               and (U16) the GM Panel. */
            .user-chip { min-height: 30px; }
            /* Full width but 21px tall — the one control that opens the
               dispatch. The bigger type above already took it to 24. */
            #mob-info-toggle { padding: 0.5rem 1rem; }

        }

        .bs-board { width: 100%; height: auto; display: block; }

        .bs-legend { font-family: 'Crimson Text', serif; font-size: 0.82rem; margin-top: 0.4rem; }
        .bs-leg-row { display: flex; align-items: center; gap: 0.45rem; padding: 0.18rem 0; border-bottom: 1px solid rgba(37,37,53,0.5); }
        .bs-swatch { width: 13px; height: 13px; border-radius: 3px; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.45); }
        .bs-leg-name { color: var(--text); min-width: 9rem; }
        .bs-leg-name b { color: var(--gold); }
        .bs-leg-tags { display: flex; gap: 0.2rem; flex-wrap: wrap; }

        .bs-tag { color: #15110a; font-size: 0.6rem; padding: 0.05rem 0.4rem; border-radius: 8px; letter-spacing: 0.04em; }

        .bs-footer { display: flex; justify-content: flex-end; gap: 0.8rem; margin-top: 1.2rem; }

        .btn-share {
            order: -1;
            border-color: var(--gold);
            background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dim) 100%);
            color: #1a1206;
            font-weight: 700;
            box-shadow: 0 0 0 1px rgba(201,168,76,0.4), 0 2px 12px rgba(201,168,76,0.35);
        }
        .btn-share:hover {
            filter: brightness(1.08);
            box-shadow: 0 0 0 1px var(--gold), 0 4px 16px rgba(201,168,76,0.55);
        }

        /* ══ THE GOLD-FILLED PRIMARY — ONE DEFINITION, THREE CLASSES ════════
           Owner's call 2026-08-24: the primary action should read like Share
           link rather than like the panel behind it. `.btn`, `.btn-submit` and
           `.btn-gm-action` were all `background: transparent` over a near-black
           surface, so every "do the thing" button in the app — Submit Battle
           Report, File Report, Save Changes, Apply Changes — looked identical to
           Cancel next to it.
           **This is a selector list rather than a fourth copy of the look.**
           `.btn-share` already painted it, and the app separately grew
           `.rs-submit` (a different gold gradient) and `.cnl-submit` (gold-faint
           with gold text) — three answers to one question. Those two are left
           alone deliberately: they already read as gold, so they were never the
           complaint, and folding them in would restyle two surfaces nobody
           asked about. **If a fourth primary button appears, add it to THIS
           list; do not paint it again.**
           ⚠ It must stay AFTER `.btn` (transparent), `.btn-submit` and
           `.btn-gm-action`, all declared above — equal specificity, so position
           is what decides. `.btn.btn-submit` is (0,2,0) on purpose: `.btn` sets
           the transparent background and a bare `.btn-submit` would tie. */
        .btn-share,
        .btn.btn-submit,
        .btn-gm-action {
            border-color: var(--gold);
            background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dim) 100%);
            color: #1a1206;
            font-weight: 700;
            box-shadow: 0 0 0 1px rgba(201,168,76,0.4), 0 2px 12px rgba(201,168,76,0.35);
        }
        .btn-share:hover,
        .btn.btn-submit:hover,
        .btn-gm-action:hover {
            filter: brightness(1.08);
            color: #1a1206;
            border-color: var(--gold);
            background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dim) 100%);
            box-shadow: 0 0 0 1px var(--gold), 0 4px 16px rgba(201,168,76,0.55);
        }
        .btn.btn-submit:disabled,
        .btn-gm-action:disabled { filter: none; box-shadow: none; opacity: 0.45; }
        /* the hex panel's footer greys out Set Up Battle and Challenge Link on a hex that is
           not contested; the plain .btn (Challenge Link) has no disabled look of its own */
        .modal-footer .btn:disabled { opacity: 0.45; cursor: not-allowed; }

        /* ⚠ DESTRUCTIVE ACTIONS MUST NOT INHERIT THE GOLD FILL, and six of them
           would have. Clear, Advance Cycle, Close Event and three feature-vote
           removals were each made red by an INLINE
           `border-color:var(--red);color:var(--red)` — which sets the border and
           the text and says nothing about the background, so under the rule
           above they would have come out as a gold gradient with red text on it:
           unreadable, and it would style the one button you cannot undo as the
           one the eye is drawn to. Six inline copies are now this one class.
           (0,2,0) and declared after the block above, so it wins on position the
           same way that one does. */
        .btn.btn-danger,
        .btn-gm-action.btn-danger {
            background: transparent;
            border-color: var(--red);
            color: var(--red);
            box-shadow: none;
            font-weight: 400;
            filter: none;
        }
        .btn.btn-danger:hover,
        .btn-gm-action.btn-danger:hover {
            background: rgba(184,64,64,0.12);
            border-color: var(--red);
            color: var(--red);
            box-shadow: none;
            filter: none;
        }

        /* The locked File Report stays FLAT. `.btn-locked` is the logged-out
           state and already dims to 0.35; a dimmed gold gradient reads as a
           button that is merely loading rather than one you cannot press, and
           its existing `:hover { background: transparent !important }` would
           have stripped the gradient on hover only, which is a flash. */
        .btn.btn-locked,
        .btn.btn-locked:hover {
            background: transparent;
            border-color: var(--gold-dim);
            color: var(--gold-dim);
            font-weight: 400;
            box-shadow: none;
            filter: none;
        }

        /* ── My Terrain editor: campaignmap_myterrain.css (shared with the OPR Notebook) ── */

        /* ── Feature Vote ───────────────────────── */
        #fv-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.78);
            z-index: 3200;
            align-items: center;
            justify-content: center;
        }
        #fv-overlay.open { display: flex; }
        #fv-panel {
            /* chrome: .ov-panel (Phase 6) */
            padding: 1.4rem 1.5rem 1.2rem;
            width: var(--win-w);
            max-height: 92vh;
            overflow-y: auto;
            position: relative;
        }
        .fv-rank-select {
            background: rgba(255,255,255,0.06);
            border: 1px solid rgba(201,168,76,0.35);
            border-radius: 3px;
            color: var(--gold);
            font-family: 'Crimson Text', serif;
            font-size: 0.85rem;
            padding: 0.18rem 0.35rem;
        }

        /* ══ UI revamp Phase 6 — the player-facing overlays ══════════════════
           UI_REVAMP_DESIGN.md U10 and U25. Five overlays — Help, Settings,
           Battle Setup, My Terrain and Feature Vote — brought onto Phase 0's
           card language. TOKEN POLISH ONLY: frame, headings, buttons, spacing.
           Not one control in any of them changes position, order, id or
           nesting, and §8.7's panel in particular is untouched — Battle Setup's
           options are read at FOUR call sites (desktop `opts()` plus
           `quickStart`, mobile's two `bsmRefresh` branches) and CLAUDE.md
           records that density was already missed by one of them once.

           SETTLED BEFORE THE PHASE, NOT AFTER: SETTINGS IS IN. §7's phase table
           lists only four panels and omits #options-overlay, but §2.1 row 7
           calls it "unchanged overlay, restyled" and §6.4 says it "is already
           in U10's restyle scope" — two sources against one omission. Doing it
           here is also what keeps Phase 12 purely additive: its Player block
           (three faction-rank selects plus discord_tag) drops into a panel that
           is already styled, instead of arriving with a restyle bolted on. The
           .opt-section rules below are declared for exactly that and are
           deliberately unused today — the shape Phase 0's idiom block shipped
           in.

           THE GM PANEL IS NOT HERE, deliberately (U10; §10 reassesses it once
           it sits next to a restyled Battle Setup). Neither is the hex modal,
           the report form, #success-panel or the share/challenge footer (§3.4).

           WHAT THIS BLOCK MAY AND MAY NOT REACH. `.opt-*`, `.help-*`, `.bs-*`
           and `.mt-*` were each grepped and are used by these five overlays and
           nothing else, so they are restyled unscoped. `.fm-proposal-*`,
           `.fm-vote-*` and `.fm-total-votes-lbl` LOOK like faction-modal
           classes and are not: D72 retired the building vote and the comment
           above their definitions already says the Feature Vote overlay is
           their only remaining consumer — checked again here, and every call
           site is inside featureItemHTML / featureOptionsListHTML. `.btn`,
           `.modal-close` and the other genuinely shared globals are NOT
           rewritten; anything aimed at them is scoped under .ov-panel.

           ── WHY .ov-panel AND NOT .vt-card ─────────────────────────────────
           .vt-card draws its inner rule and its corner flourishes with
           ABSOLUTELY POSITIONED pseudo-elements. Three of these five panels are
           their own scroll container — #bs-panel, #mt-panel and #fv-panel all
           carry `overflow-y: auto` — and an absolutely positioned descendant of
           a scroll container SCROLLS WITH ITS CONTENT. The frame would sit
           correctly at scroll-top and then slide off the top of Battle Setup
           the moment anyone scrolled it: a panel that renders perfectly in the
           only state a screenshot catches.

           So the inner rule is an OUTLINE with a negative offset and the corner
           arms are `background-image` layers. Both are painted relative to the
           border box and neither scrolls. The geometry is .vt-card's exactly:
           `inset: 5px` on an absolutely positioned pseudo-element resolves
           against the PADDING box, and `outline-offset: -(border + inset)`
           resolves against the border box, so the two land on the same line.
           The one deliberate difference is the arms, which sit 1px inside the
           outer rule rather than on it — a background cannot paint over a
           border — and at 1px the corners simply read as brighter and slightly
           thicker.

           It is a LOCAL class rather than an addition to the Phase 0 block on
           purpose. That block is byte-identical in three HTML files by design,
           and nothing on the other two pages is a scroll container that needs
           this. It consumes the SAME --vt-* tokens, so the two frames cannot
           drift on colour, inset or arm length — and because --vt-flourish is
           var(--gold) and --vt-card-bg is var(--surface), the frame follows the
           two colour pickers in this very panel for free. */
        .ov-panel {
            position: relative;
            background-color: var(--vt-card-bg);
            border: 1px solid var(--vt-rule);
            border-radius: var(--vt-card-radius);
            outline: 1px solid var(--vt-rule-inner);
            outline-offset: calc(-1px - var(--vt-frame-inset));
            background-repeat: no-repeat;
            background-image:
                linear-gradient(var(--vt-flourish) 0 0), linear-gradient(var(--vt-flourish) 0 0),
                linear-gradient(var(--vt-flourish) 0 0), linear-gradient(var(--vt-flourish) 0 0),
                linear-gradient(var(--vt-flourish) 0 0), linear-gradient(var(--vt-flourish) 0 0),
                linear-gradient(var(--vt-flourish) 0 0), linear-gradient(var(--vt-flourish) 0 0);
            background-position:
                left 0 top 0,     left 0 top 0,
                right 0 top 0,    right 0 top 0,
                left 0 bottom 0,  left 0 bottom 0,
                right 0 bottom 0, right 0 bottom 0;
            background-size:
                1px var(--vt-flourish-arm), var(--vt-flourish-arm) 1px,
                1px var(--vt-flourish-arm), var(--vt-flourish-arm) 1px,
                1px var(--vt-flourish-arm), var(--vt-flourish-arm) 1px,
                1px var(--vt-flourish-arm), var(--vt-flourish-arm) 1px;
        }
        /* --quiet is .vt-card--quiet's argument one level down: #mt-form-panel
           opens ON TOP of an already-framed #mt-panel, and two full frames read
           as noise. */
        .ov-panel--quiet {
            outline: none;
            background-image: none;
            border-color: var(--border);
        }

        /* One scrim and one gutter across all five, where there were two scrim
           values and padding on Help alone. The padding is also what stops a
           panel touching the viewport edge on a phone — and it stays part of
           the overlay element, so the `event.target === this` backdrop-close
           each of them carries still fires on it. */
        #help-overlay, #options-overlay, #mt-overlay, #fv-overlay,
        #rs-overlay, #fr-overlay {
            background: rgba(3,3,8,0.84);
            padding: 1.4rem 1rem;
        }
        /* Heights re-expressed against the gutter rather than a bare vh, so
           panel + padding cannot exceed the viewport. dvh, matching body. */
        #mt-panel, #fv-panel { max-height: calc(100dvh - 2.8rem); }
        /* #options-panel had NO max-height and no overflow. It fits today and
           will not once Phase 12 adds the Player block; given here so that
           phase adds rows and nothing else. */
        #options-panel { max-height: calc(100dvh - 2.8rem); overflow-y: auto; }
        /* Help's own padding lives on .help-header and #help-body, which both
           span the full panel width — so their rules would cross the inner rule
           and poke 5px past it on each side. 10px on the panel puts every child
           inside the frame instead. */
        #help-panel { padding: 10px; max-height: calc(100dvh - 2.8rem); }
        /* The gold top-bar pseudo-element is retired: with flourishes on all
           four corners it is a second ornament arguing with the first. Cleared
           here rather than deleted so the rule stays greppable beside
           #modal::before, which the shell's ≤640px block repurposes as a drag
           handle and which must NOT be confused with this one. */
        #help-panel::before { display: none; }

        /* MEASURED, and it is the one place the frame and the scrollbar share
           ground: a scrolling .ov-panel reserves a 10px gutter INSIDE its
           padding box, and the inner rule sits 5px in — i.e. down the middle of
           it. There is no way to dodge that without either moving the rule
           further in than the two non-scrolling panels (inconsistent ornament
           across the five) or giving up the frame on the three that scroll.
           So the thumb is pinned to --border-mid, which IS --vt-rule-inner: the
           rule and the thumb are the same colour, and the right edge reads as
           the rule thickening exactly where you can grab it. Do not "fix" this
           by recolouring the thumb — that is what would make it look broken. */
        .ov-panel, #help-body {
            scrollbar-width: thin;
            scrollbar-color: var(--border-mid) transparent;
        }

        /* Scoped to .ov-panel: .modal-close is shared with the hex and faction
           modals, which §3.4 leaves alone. */
        .ov-panel > .modal-close {
            top: 0.7rem; right: 0.7rem;
            border-radius: 3px;
            z-index: 2;
        }
        .ov-panel > .modal-close:hover { background: var(--gold-faint); }

        /* Keyboard focus. Scoped for the same reason, and :focus-visible only,
           so nothing changes for a pointer. */
        .ov-panel :is(a, button, select, summary, input, [tabindex]):focus-visible {
            outline: 1px solid var(--gold);
            outline-offset: 2px;
        }

        /* ── The dialog heading ────────────────────────────────────────────
           .opt-title is the heading on four of the five (Settings, Battle
           Setup, My Terrain, Feature Vote) plus the My Terrain edit form, so it
           is the one place a change reaches all of them. Help keeps its own
           two-line header, restyled to match below. */
        .opt-title {
            font-family: 'Cinzel Decorative', cursive;
            font-size: 0.84rem;
            color: var(--gold);
            letter-spacing: 0.14em;
            text-align: center;
            margin: 0 0 1.2rem;
            padding-bottom: 0.65rem;
            position: relative;
        }
        .opt-title::after {
            content: '';
            position: absolute;
            left: 50%; bottom: 0;
            transform: translateX(-50%);
            width: 104px; height: 1px;
            background: linear-gradient(to right, transparent, var(--gold-dim) 25%, var(--gold-dim) 75%, transparent);
        }

        /* Declared for Phase 12's Player block (§6.4) and UNUSED today — the
           shape Phase 0's idiom block shipped in, and the reason 12 is
           additive. */
        .opt-section { margin-bottom: 1.3rem; }
        .opt-section:last-of-type { margin-bottom: 0; }
        .opt-section-title {
            font-family: 'Cinzel', serif;
            font-size: 0.52rem;
            letter-spacing: 0.22em;
            text-transform: uppercase;
            color: var(--gold-dim);
            border-bottom: 1px solid rgba(201,168,76,0.18);
            padding-bottom: 0.3rem;
            margin-bottom: 0.8rem;
        }

        /* Phase 12's Player block. `.opt-section` / `.opt-section-title` were
           declared in Phase 6 and left unused for exactly this. */
        .opt-text, select.opt-rank {
            flex: 1; min-width: 0;
            background: var(--surface2); color: var(--text);
            border: 1px solid var(--border-mid); border-radius: 3px;
            font-family: 'Crimson Text', serif; font-size: 0.85rem;
            padding: 0.34rem 0.45rem;
            transition: border-color 0.15s;
        }
        .opt-text:hover, select.opt-rank:hover { border-color: var(--gold-dim); }
        .opt-hint {
            font-size: 0.78rem; color: var(--text-dim); line-height: 1.45;
            margin: 0.15rem 0 0.7rem;
        }
        .opt-hint em { color: var(--text); font-style: italic; }
        .opt-save-row { display: flex; align-items: center; gap: 0.7rem; }
        .opt-msg { font-size: 0.8rem; color: var(--text-dim); }

        /* ══ First-run faction-ranking prompt (#fr-overlay) ══════════════════
           A one-time nudge for a logged-in player who has not yet ranked the
           three factions. Writes through `save_faction_ranking` — the SAME
           single writer the Settings Player block uses — so the two surfaces
           cannot store disagreeing rankings. Presented faction-FIRST (each
           faction carries its own rank select) rather than rank-first like
           Settings, because the point here is to show WHAT each faction is
           before asking a newcomer to order them. Frame comes from .ov-panel. */
        #fr-overlay {
            display: none;
            position: fixed;
            inset: 0;
            z-index: 3200;
            align-items: center;
            justify-content: center;
        }
        #fr-overlay.open { display: flex; }
        #fr-panel {
            /* chrome: .ov-panel */
            position: relative;
            width: min(560px, 94vw);
            max-height: calc(100dvh - 2.8rem);
            padding: 1.5rem 1.6rem 1.3rem;
            overflow-y: auto;
        }
        .fr-intro {
            font-family: 'Crimson Text', serif;
            font-size: 0.9rem; line-height: 1.5;
            color: var(--text-dim);
            text-align: center;
            margin: 0 0 1.2rem;
        }
        .fr-intro em { color: var(--text); font-style: italic; }
        .fr-list { display: flex; flex-direction: column; gap: 0.7rem; }
        .fr-faction {
            display: flex; align-items: center; gap: 0.85rem;
            padding: 0.6rem 0.7rem;
            border: 1px solid var(--border-mid); border-radius: 5px;
            background: var(--surface2);
        }
        select.fr-rank {
            flex-shrink: 0; width: 4.6rem;
            background: var(--surface); color: var(--text);
            border: 1px solid var(--border-mid); border-radius: 3px;
            font-family: 'Cinzel', serif; font-size: 0.72rem; letter-spacing: 0.04em;
            padding: 0.36rem 0.3rem; cursor: pointer;
            transition: border-color 0.15s;
        }
        select.fr-rank:hover { border-color: var(--gold-dim); }
        select.fr-rank.fr-ranked { border-color: var(--gold-dim); color: var(--gold); }
        .fr-logo {
            flex-shrink: 0; width: 44px; height: 44px;
            display: flex; align-items: center; justify-content: center;
        }
        .fr-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
        .fr-body { flex: 1; min-width: 0; }
        .fr-name {
            font-family: 'Cinzel', serif; font-size: 0.8rem; letter-spacing: 0.03em;
            color: var(--text); margin-bottom: 0.15rem;
        }
        .fr-summary {
            font-family: 'Crimson Text', serif; font-size: 0.82rem; line-height: 1.4;
            color: var(--text-dim);
            display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4;
            overflow: hidden;
        }
        .fr-foot {
            display: flex; align-items: center; justify-content: flex-end;
            gap: 0.8rem; margin-top: 1.3rem;
            /* Pinned to the panel's foot (issue 15): on a short phone the list
               scrolls and Save sat out of sight with nothing hinting at it. The
               -1.3rem bottom and margin cancel #fr-panel's bottom padding, so the
               bar rests flush on the frame and covers what scrolls beneath it. */
            position: sticky; bottom: -1.3rem; z-index: 1;
            margin-bottom: -1.3rem; padding: 0.75rem 0 1.3rem;
            background: var(--vt-card-bg);
            border-top: 1px solid var(--border);
        }
        .fr-msg { font-size: 0.8rem; color: var(--text-dim); margin-right: auto; }

        /* Phase 13's two additions to the report form. */
        .form-optional {
            font-family: 'Cinzel', serif; font-size: 0.44rem; letter-spacing: 0.1em;
            text-transform: uppercase; color: var(--text-dim); margin-left: 0.4rem;
        }
        .form-hint {
            font-size: 0.76rem; color: var(--text-dim); font-style: italic;
            margin-top: 0.3rem; line-height: 1.4; min-height: 1em;
        }

        .opt-row   { margin-bottom: 0.72rem; }
        .opt-label { width: 88px; font-size: 0.5rem; letter-spacing: 0.2em; }
        .opt-divider { margin: 1.15rem 0; border-top-color: rgba(201,168,76,0.14); }
        .opt-footer { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
        input[type=color].opt-color { width: 48px; height: 26px; transition: border-color 0.15s; }
        input[type=color].opt-color:hover { border-color: var(--gold-dim); }

        /* ── Help ────────────────────────────────────────────────────────── */
        .help-header       { padding: 1.15rem 2.4rem 0.85rem 1.5rem; border-bottom-color: rgba(201,168,76,0.16); }
        .help-title        { font-size: 0.94rem; letter-spacing: 0.14em; }
        .help-subtitle     { margin-top: 0.4rem; color: var(--gold-dim); opacity: 0.8; }
        .help-section-title{ color: var(--gold); border-bottom-color: rgba(201,168,76,0.22); }
        .help-key          { color: var(--gold); opacity: 0.82; }
        .help-chip         { color: var(--gold); border-color: var(--gold-dim); background: var(--gold-faint); }

        /* .bs-footer is also the My Terrain edit form's footer — both want the
           same separating rule above the buttons. */
        .bs-footer           { margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--border); }

        /* ── My Terrain ──────────────────────────────────────────────────── */
        .mt-tbtn           { border-radius: 3px; transition: background 0.15s, border-color 0.15s, color 0.15s; }
        .mt-tbtn:hover     { border-color: var(--gold); }
        .mt-card           { border-radius: 3px; transition: border-color 0.15s, background 0.15s; }
        .mt-card:hover     { border-color: var(--gold-dim); }
        .mt-card-name      { color: var(--text); }
        #mt-filter-bar     { border-bottom-color: rgba(201,168,76,0.16); }

        /* ── Feature Vote ────────────────────────────────────────────────── */
        .fm-proposal-card       { border-radius: 3px; border-color: rgba(201,168,76,0.22); transition: border-color 0.15s, background 0.15s; }
        .fm-proposal-card:hover { border-color: var(--gold-dim); }
        .fm-proposal-name       { color: var(--gold); }
        .fm-vote-footer         { border-top-color: rgba(201,168,76,0.2); }
        .fv-rank-select         { padding: 0.22rem 0.4rem; transition: border-color 0.15s; }
        .fv-rank-select:hover   { border-color: var(--gold); }

        /* ── Phase 6 at ≤640px ─────────────────────────────────────────────
           A SECOND ≤640.98px block, after the shell's, and deliberately so: the
           shell block is Phase 5's and reaches nothing in here, so nothing in
           here can out-specify it. The .98 is not a typo — at 125% Windows
           scaling the viewport is fractional.
           Every panel goes edge-to-edge minus a half-rem gutter. The five
           overlays sit at z-index 3200 and the fixed faction strip at 3, so
           they cover it rather than sliding under it and none of them needs
           --mob-strip. */
        @media (max-width: 640.98px) {
            #help-overlay, #options-overlay, #mt-overlay, #fv-overlay,
            #rs-overlay, #fr-overlay {
                padding: 0.5rem;
            }
            #help-panel, #options-panel, #mt-panel, #fv-panel, #rs-panel, #fr-panel {
                width: 100%;
                max-height: calc(100dvh - 1rem);
            }
            /* Faction row goes vertical on a phone: the summary needs the full
               width, so the rank select + logo sit on their own line above it. */
            .fr-faction { flex-wrap: wrap; }
            .fr-body    { flex-basis: 100%; }
            #rs-panel { padding: 1.1rem 0.9rem 1rem; }
            #mt-panel, #fv-panel { padding: 1.1rem 0.9rem 1rem; }
            #options-panel                  { padding: 1.3rem 1.1rem 1.1rem; }
            #help-panel                     { padding: 7px; }
            .help-header                    { padding: 1rem 2.2rem 0.75rem 1rem; }
            #help-body                      { padding: 0.9rem 1rem 1.1rem; }
            /* .help-key is min-width:90px and nowrap, which on a ~340px column
               leaves the description about half a line. Stack them. */
            .help-entry { flex-direction: column; gap: 0.15rem; margin-bottom: 0.7rem; }
            .help-key   { min-width: 0; white-space: normal; padding-top: 0; }
            .opt-label  { width: 74px; }
        }

        /* ══ Faction Research — the overlay (2026-08-22) ════════════════════
           campaignmap_research.html's tree and its funding ballot, moved INTO
           this file as a sixth .ov-panel overlay beside Help, Settings, Battle
           Setup, My Terrain and Feature Vote. The standalone page is retired to
           a redirect stub, so this is the only research surface on desktop and
           there is no second copy to drift.

           ⚠ FACTION ACCENT IS SCOPED TO #rs-panel, NEVER TO <body>. The
           standalone page swapped --accent on <body> because it had nothing
           else on screen; here the map, the nav bar and five other overlays are
           all one Escape away, and a body-level swap would repaint the whole
           app the moment someone looked at the Verdant tree. --rs-accent is
           declared on the panel and read only by .rs-* rules.

           ⚠ THE CONNECTOR OVERLAY NEEDS `width: max-content` ON .rs-canvas.
           It is `position:absolute; inset:0` inside a flex row in a horizontal
           scroller, so without it the SVG sizes to the SCROLLER and the lines
           stop at the viewport edge — the trap CLAUDE.md records against the
           standalone page, carried here with the markup that has it. */
        #rs-overlay {
            display: none;
            position: fixed;
            inset: 0;
            z-index: 3200;
            align-items: center;
            justify-content: center;
        }
        #rs-overlay.open { display: flex; }
        #rs-panel {
            /* chrome: .ov-panel */
            --rs-accent:      #bec8d7;
            --rs-accent-soft: rgba(190,200,215,0.14);
            position: relative;
            width: var(--win-w);
            max-height: calc(100dvh - 2.8rem);
            padding: 1.3rem 1.4rem 1.1rem;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
        }
        #rs-panel.fac-iron    { --rs-accent:#bec8d7; --rs-accent-soft:rgba(190,200,215,0.14); }
        #rs-panel.fac-verdant { --rs-accent:#2db969; --rs-accent-soft:rgba(45,185,105,0.14); }
        #rs-panel.fac-ruin    { --rs-accent:#d7b650; --rs-accent-soft:rgba(215,182,80,0.14); }

        /* The title carries the nav's own book icon rather than the ⚯ glyph,
           for U11's reason: that glyph resolves to a colour emoji on some
           platforms and no CSS colour can correct it. */
        .rs-title-row { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
        .rs-title-row .vt-icon { width: 17px; height: 17px; color: var(--gold); }

        /* ── faction tabs + progress ─────────────────────────────────────── */
        .rs-facs {
            display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
            margin-bottom: 0.85rem;
        }
        .rs-fac {
            flex: 1 1 190px; min-width: 0;
            display: flex; align-items: center; gap: 0.65rem;
            padding: 0.6rem 0.85rem;
            background: var(--surface2); color: var(--text-dim);
            border: 1px solid var(--border); border-radius: 3px;
            font-family: 'Cinzel', serif; font-size: 0.8rem; letter-spacing: 0.06em;
            cursor: pointer; text-align: left;
            transition: border-color 0.15s, color 0.15s, background 0.15s;
        }
        .rs-fac:hover { border-color: var(--gold-dim); color: var(--text); }
        .rs-fac img { width: 24px; height: 24px; flex: none; object-fit: contain; opacity: 0.5; }
        .rs-fac b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
        /* The double rule is .vt-card's, expressed as an outline so it cannot
           be confused with the border it sits inside. */
        .rs-fac.on {
            color: var(--rs-accent);
            border-color: var(--rs-accent);
            background: var(--rs-accent-soft);
            outline: 1px solid var(--rs-accent);
            outline-offset: -4px;
        }
        .rs-fac.on img { opacity: 1; }
        .rs-facs-aside {
            display: flex; align-items: center; gap: 1rem; flex: 0 0 auto;
            font-family: 'Cinzel', serif; font-size: 0.6rem;
            letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
        }
        .rs-facs-aside b { color: var(--text); }
        .rs-gm-toggle { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
        .rs-gm-toggle input { accent-color: var(--gold); cursor: pointer; }

        /* ── the frontier card and the minimap ───────────────────────────── */
        .rs-frontier-row { display: flex; align-items: stretch; gap: 0.7rem; margin-bottom: 0.75rem; }
        .rs-frontier { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.85rem 1.1rem; }
        .rs-frontier-main { flex: 1 1 260px; min-width: 0; }
        .rs-frontier-h {
            font-family: 'Cinzel', serif; font-size: 1.05rem; color: var(--gold);
            letter-spacing: 0.04em;
        }
        .rs-stats {
            margin-top: 0.35rem;
            display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
            font-family: 'Cinzel', serif; font-size: 0.58rem;
            letter-spacing: 0.13em; text-transform: uppercase; color: var(--text-dim);
        }
        .rs-stats b { color: var(--text); }
        .rs-stats i { font-style: normal; color: var(--gold-dim); }
        .rs-stat-target { color: var(--gold); }
        /* ⚠ WRAPS AND SHRINKS, and `flex: 0 0 auto` was why it could do neither.
           The four controls need 287px (Fit tree 73 · − 30 · + 30 · Jump to
           Frontier 134, plus gaps) and `.rs-frontier`'s content box is 221px at
           320px of viewport — so "Jump to Frontier" ran to x=336, clipped at the
           panel edge, and #rs-panel scrolled SIDEWAYS to reach it (that panel is
           overflow-y:auto, so its overflow-x computes to auto — see the same
           finding on `.bs-density-head`). `flex-wrap` alone is NOT enough here:
           with `flex-shrink: 0` the row keeps its max-content width and simply
           never reaches a line it has to break, so both halves are load-bearing.
           Wrapped, the zoom cluster stays together on line 1 (146px) and Jump
           drops to line 2 — nothing else in the card moves. */
        .rs-tools {
            display: flex; align-items: center; gap: 0.4rem;
            flex: 0 1 auto; flex-wrap: wrap; min-width: 0;
        }
        .rs-btn {
            background: var(--surface2); color: var(--text);
            border: 1px solid var(--border-mid); border-radius: 3px;
            font-family: 'Cinzel', serif; font-size: 0.6rem;
            letter-spacing: 0.12em; text-transform: uppercase;
            padding: 0.42rem 0.7rem; cursor: pointer;
            transition: border-color 0.15s, color 0.15s, background 0.15s;
        }
        .rs-btn:hover { border-color: var(--gold); color: var(--gold); }
        .rs-btn--sq { width: 30px; padding: 0.42rem 0; font-size: 0.8rem; letter-spacing: 0; }
        .rs-btn:disabled { opacity: 0.4; cursor: not-allowed; }

        /* The minimap is its own frame rather than a slot in the card: it is a
           second view of the tree, not a fact about the frontier. */
        .rs-mini {
            flex: 0 0 236px; position: relative;
            border: 1px solid var(--gold-dim); border-radius: 3px;
            background: rgba(0,0,0,0.28); overflow: hidden; cursor: pointer;
        }
        .rs-mini svg { display: block; width: 100%; height: 100%; }
        .rs-mini rect.cell { fill: var(--rs-accent); opacity: 0.5; }
        .rs-mini rect.dim  { fill: var(--border-mid); opacity: 0.7; }
        .rs-mini rect.goal { fill: var(--gold); opacity: 0.85; }
        .rs-mini rect.view { fill: rgba(201,168,76,0.10); stroke: var(--gold); stroke-width: 1; }

        /* ── the tree ────────────────────────────────────────────────────── */
        .rs-tree-scroll {
            flex: 1 1 auto; min-height: 260px;
            overflow: auto;
            border: 1px solid var(--border); border-radius: 3px;
            background: rgba(0,0,0,0.18);
            padding-bottom: 0.4rem;
        }
        /* ⚠ THE TRANSFORM IS ON .rs-canvas AND THE SIZE IS ON .rs-zoom, and the
           split is what makes zooming out actually shrink the scroll extent: a
           transformed element still occupies its UNSCALED layout box, so a
           scale on the canvas alone leaves the scroller sized for 100% however
           far you zoom out. rsApplyZoom() writes the wrapper's px width/height
           as offsetWidth × k. .rs-canvas therefore must NOT carry
           `min-width: 100%` — that would resolve against the width JS is
           computing from it. */
        .rs-zoom { position: relative; }
        .rs-canvas {
            position: relative; display: flex; align-items: stretch; gap: 46px;
            padding: 10px 22px 20px 12px; width: max-content;
            transform-origin: 0 0;
        }
        .rs-links { position: absolute; inset: 0; z-index: 0; overflow: visible; pointer-events: none; color: var(--rs-accent); }
        .rs-links path { fill: none; stroke: currentColor; stroke-width: 2; opacity: 0.55; }
        .rs-links path.faint { opacity: 0.16; stroke-width: 1.4; stroke-dasharray: 3 4; }

        .rs-rank {
            position: relative; z-index: 1; display: flex; flex-direction: column;
            flex: 0 0 150px; padding-left: 14px; border-left: 1px solid var(--border);
        }
        .rs-rank:first-child { border-left: 0; }
        .rs-rank.final { flex-basis: 186px; border-left-color: var(--gold-dim); }
        .rs-rank-h {
            min-height: 30px;
            font-family: 'Cinzel', serif; font-size: 0.56rem;
            letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim);
        }
        .rs-rank-h b { color: var(--rs-accent); font-size: 0.72rem; letter-spacing: 0.06em; }
        .rs-rank.final .rs-rank-h b { color: var(--gold); }
        .rs-cards { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 22px; }

        .rs-tech {
            position: relative; overflow: hidden; isolation: isolate;
            min-height: 58px; padding: 8px 9px 8px 34px; text-align: left;
            border: 1px solid var(--border-mid); border-radius: 4px;
            background: var(--surface); color: var(--text);
            font-family: 'Crimson Text', serif; cursor: pointer;
            transition: transform 0.16s, border-color 0.16s;
        }
        .rs-tech::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--rs-accent); }
        button.rs-tech:hover { transform: translateY(-2px); border-color: var(--rs-accent); z-index: 3; }
        .rs-tech .glyph { position: absolute; z-index: 2; left: 9px; top: 50%; transform: translateY(-50%); width: 18px; text-align: center; font-size: 0.95rem; color: var(--rs-accent); }
        .rs-tech .sigil {
            position: absolute; z-index: 0; inset: 0 0 0 auto; width: 64%; color: var(--rs-accent); opacity: 0.42; pointer-events: none;
            -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,.25) 26%, #000 68%);
                    mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,.25) 26%, #000 68%);
        }
        .rs-tech .nm  { position: relative; z-index: 1; display: block; font-size: 0.82rem; line-height: 1.2; }
        .rs-tech .sub { position: relative; z-index: 1; display: block; margin-top: 5px; font-family: 'Cinzel', serif; font-size: 0.45rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
        .rs-tech .mark { position: absolute; z-index: 2; top: 5px; right: 6px; font-size: 0.7rem; color: var(--rs-accent); }

        .rs-tech.s-unlocked  { border-color: var(--rs-accent); background: linear-gradient(180deg, var(--rs-accent-soft), var(--surface)); }
        .rs-tech.s-available { border-color: var(--rs-accent); box-shadow: 0 0 0 1px var(--rs-accent-soft), 0 0 14px var(--rs-accent-soft); }
        .rs-tech.s-revealed  { opacity: 0.72; }
        .rs-tech.s-outlined  { cursor: default; border-style: dashed; border-color: #2a2a3c; background: #0f0f19; }
        .rs-tech.s-outlined::before { opacity: 0.25; }
        .rs-tech.s-outlined .glyph { color: var(--text-dim); opacity: 0.5; }
        .rs-tech.s-outlined .sigil { opacity: 0.16; }
        .rs-tech.s-outlined .nm { color: var(--text-dim); font-style: italic; font-size: 0.76rem; }
        /* Unsurveyed: holds its slot, so the shape and length of the tree read
           without its contents. */
        .rs-tech.s-hidden { cursor: default; min-height: 58px; border: 1px dashed #1c1c2a; background: rgba(255,255,255,0.012); }
        .rs-tech.s-hidden::before { display: none; }
        /* The technology this cycle's RP are going into. */
        .rs-tech.is-target { box-shadow: 0 0 0 1px var(--gold), 0 0 16px rgba(201,168,76,0.28); border-color: var(--gold); }

        .rs-rank.final .rs-tech { min-height: 150px; padding-bottom: 30px; border-color: var(--gold-dim); background: linear-gradient(180deg, rgba(201,168,76,0.14), var(--surface)); }
        .rs-rank.final .rs-tech::before { background: var(--gold); }
        .rs-rank.final .rs-tech .nm { font-family: 'Cinzel', serif; font-size: 0.9rem; color: var(--gold); }
        .rs-rank.final .rs-tech .glyph { color: var(--gold); }
        .rs-rank.final .rs-tech .sigil { color: var(--gold); opacity: 0.3; width: 100%; -webkit-mask-image: none; mask-image: none; }
        .rs-tech .rp {
            position: absolute; z-index: 1; left: 34px; right: 9px; bottom: 8px;
            font-family: 'Cinzel', serif; font-size: 0.56rem; letter-spacing: 0.12em;
            text-transform: uppercase; color: var(--gold);
        }

        /* ── the funding ballot ──────────────────────────────────────────── */
        .rs-ballot-h {
            display: flex; align-items: center; gap: 0.8rem;
            margin: 1rem 0 0.8rem;
            font-family: 'Cinzel', serif; font-size: 0.62rem;
            letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold);
        }
        .rs-ballot-h::before, .rs-ballot-h::after {
            content: ''; flex: 1; height: 1px;
            background: linear-gradient(to right, transparent, var(--gold-dim), transparent);
        }
        .rs-ballot { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 0.8rem; }

        .rs-prop { display: flex; flex-direction: column; padding: 0.95rem 1rem 0.9rem; }
        .rs-prop.is-top { border-color: var(--gold); }
        .rs-prop-head { display: flex; align-items: flex-start; gap: 0.6rem; }
        .rs-prop-head .vt-portrait { --vt-portrait: 58px; --vt-portrait-ring: var(--rs-accent); }
        .rs-prop-sigil { width: 46px; height: 46px; flex: none; color: var(--rs-accent); opacity: 0.85; margin-top: 4px; }
        .rs-prop-id { flex: 1 1 auto; min-width: 0; }
        .rs-prop-kicker {
            font-family: 'Cinzel', serif; font-size: 0.5rem;
            letter-spacing: 0.14em; text-transform: uppercase; color: var(--rs-accent);
        }
        .rs-prop-name { margin-top: 0.15rem; font-family: 'Cinzel', serif; font-size: 0.95rem; color: var(--gold); line-height: 1.2; }
        /* The name is the card's "Details" affordance — the retired page spent a
           whole button on it and the mockup has no room for one. */
        .rs-prop-name[data-open] { cursor: pointer; }
        .rs-prop-name[data-open]:hover { text-decoration: underline; text-underline-offset: 3px; }
        .rs-prop-lead { margin-top: 0.2rem; font-size: 0.78rem; font-style: italic; color: var(--text-dim); }
        /* A per-option SELECT feeding one ordered array — the idiom every other
           ranked ballot in this app uses (the council's `.cnl-rank`, mobile's
           `.rank-select` on this same ballot, the feature vote's). rankState
           stays the single source of truth and the selects are only its
           rendering, which is what keeps two options from ever showing the same
           ordinal. It replaced a click-to-cycle badge, which ranked only by
           appending and so could not express "make this my 2nd". */
        .rs-ranksel { flex: none; align-self: flex-start; min-width: 0; }
        .rs-ranksel select {
            width: 104px;
            background: var(--bg); color: var(--gold);
            border: 1px solid var(--border-mid);
            border-radius: var(--vt-card-radius);
            padding: 0.35rem 0.4rem;
            font-family: 'Cinzel', serif; font-size: 0.56rem;
            letter-spacing: 0.1em; text-transform: uppercase;
            cursor: pointer;
        }
        .rs-ranksel select:disabled { color: var(--text-dim); cursor: default; }
        .rs-prop.is-ranked .rs-ranksel select { border-color: var(--gold); }
        .rs-ranksel select:focus { outline: none; border-color: var(--gold); }

        .rs-fund {
            margin-top: 0.7rem; position: relative;
            border: 1px solid var(--gold-dim); border-radius: 3px;
            background: rgba(0,0,0,0.3); overflow: hidden;
            padding: 0.32rem 0; text-align: center;
        }
        .rs-fund i {
            position: absolute; inset: 0 auto 0 0; display: block;
            background: linear-gradient(90deg, rgba(122,96,48,0.55), rgba(201,168,76,0.45));
            transition: width 0.3s ease;
        }
        .rs-fund span {
            position: relative;
            font-family: 'Cinzel', serif; font-size: 0.62rem;
            letter-spacing: 0.14em; color: var(--text);
        }
        .rs-fund.is-target { box-shadow: 0 0 0 1px var(--gold-dim) inset; }
        .rs-fund.is-target span { color: var(--gold); }

        .rs-unlocks { margin-top: 0.65rem; font-size: 0.82rem; line-height: 1.45; color: var(--text); }
        .rs-unlocks u {
            text-decoration: none; margin-right: 0.4rem;
            font-family: 'Cinzel', serif; font-size: 0.5rem;
            letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
        }

        .rs-tabs { display: flex; gap: 0.3rem; margin-top: 0.75rem; }
        .rs-tab {
            background: var(--surface2); color: var(--text-dim);
            border: 1px solid var(--border); border-bottom: 0;
            border-radius: 3px 3px 0 0; padding: 0.3rem 0.6rem; cursor: pointer;
            font-family: 'Cinzel', serif; font-size: 0.5rem;
            letter-spacing: 0.13em; text-transform: uppercase;
        }
        .rs-tab.on { color: var(--gold); background: rgba(201,168,76,0.08); border-color: var(--gold-dim); }
        .rs-prop-text {
            flex: 1 1 auto;
            border: 1px solid var(--border); border-radius: 0 3px 3px 3px;
            padding: 0.6rem 0.7rem; font-size: 0.86rem; line-height: 1.5;
        }
        .rs-prop-text.case p { font-style: italic; }
        .rs-prop-text cite {
            display: block; margin-top: 0.4rem; font-style: normal;
            font-family: 'Cinzel', serif; font-size: 0.5rem;
            letter-spacing: 0.13em; text-transform: uppercase; color: var(--gold);
        }
        .rs-prop-text cite::before { content: '\2014\00a0'; }

        .rs-ballot-foot {
            display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap;
            margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--border);
        }
        .rs-ballot-count {
            font-family: 'Cinzel', serif; font-size: 0.6rem;
            letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
        }
        .rs-ballot-count b { color: var(--gold); }
        .rs-submit {
            background: linear-gradient(180deg, #d8bb63, #a8873a);
            color: #16110a; border: 1px solid var(--gold); border-radius: 3px;
            font-family: 'Cinzel', serif; font-size: 0.72rem;
            letter-spacing: 0.16em; text-transform: uppercase;
            padding: 0.55rem 1.6rem; cursor: pointer;
        }
        .rs-submit:disabled { opacity: 0.45; cursor: not-allowed; }
        .rs-note { font-size: 0.8rem; font-style: italic; color: var(--text-dim); }
        .rs-empty {
            padding: 1.1rem; border: 1px dashed var(--border); border-radius: 3px;
            color: var(--text-dim); font-size: 0.86rem; text-align: center;
        }
        .rs-err {
            margin-bottom: 0.8rem; padding: 0.7rem 0.9rem;
            border: 1px solid var(--red); border-radius: 3px;
            background: var(--red-faint); font-size: 0.86rem;
        }

        /* ── the technology sheet ────────────────────────────────────────── */
        #rs-sheet-overlay {
            display: none; position: fixed; inset: 0; z-index: 3300;
            background: rgba(3,3,8,0.84); padding: 1.4rem 1rem;
            align-items: center; justify-content: center;
        }
        #rs-sheet-overlay.open { display: flex; }
        #rs-sheet {
            position: relative; isolation: isolate; overflow: hidden auto;
            width: min(540px, 100%); max-height: calc(100dvh - 2.8rem);
            padding: 1.5rem 1.6rem;
        }
        #rs-sheet .sigil-bg { position: absolute; z-index: -1; top: -8%; right: -6%; width: 50%; aspect-ratio: 1; color: var(--rs-accent); opacity: 0.12; }
        .rs-sheet-kicker { font-family: 'Cinzel', serif; font-size: 0.55rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rs-accent); }
        .rs-sheet-h { margin: 0.35rem 0 0.2rem; font-family: 'Cinzel', serif; font-size: 1.2rem; color: var(--gold); }
        .rs-sheet-body { margin: 0.7rem 0 0; font-size: 0.9rem; line-height: 1.6; }
        .rs-voice { margin-top: 0.7rem; padding-left: 0.7rem; border-left: 2px solid var(--gold-dim); }
        .rs-voice p { font-style: italic; font-size: 0.88rem; line-height: 1.5; }
        .rs-voice cite { display: block; margin-top: 0.25rem; font-style: normal; font-family: 'Cinzel', serif; font-size: 0.5rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--gold); }
        .rs-voice cite::before { content: '\2014\00a0'; }
        .rs-unl-list { margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }
        .rs-unl-list h4 { font-family: 'Cinzel', serif; font-size: 0.55rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rs-accent); margin-bottom: 0.5rem; }
        .rs-unl { display: flex; gap: 0.5rem; padding: 0.3rem 0; }
        .rs-unl > i { flex: 0 0 15px; color: var(--rs-accent); font-style: normal; }
        .rs-unl b { display: block; font-size: 0.86rem; }
        .rs-unl p { margin-top: 0.1rem; font-size: 0.82rem; line-height: 1.45; color: var(--text-dim); }
        .rs-unl .tag { display: inline-block; margin-top: 0.2rem; font-family: 'Cinzel', serif; font-size: 0.45rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
        .rs-unl .tag.event { color: var(--gold); }
        .rs-unl > div { min-width: 0; flex: 1; }
        /* Research unit cards: an unlock's entry from the faction's army book. */
        .rs-card { margin-top: 0.45rem; padding: 0.55rem 0.65rem; border: 1px solid var(--border-mid); background: rgba(255,255,255,0.025); font-size: 0.8rem; }
        .rs-card-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.2rem 0.6rem; }
        .rs-card-h b { font-size: 0.86rem; color: var(--text); }
        .rs-card-h span { font-family: 'Cinzel', serif; font-size: 0.5rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--rs-accent); }
        .rs-card-stats { margin-top: 0.15rem; color: var(--text-dim); }
        .rs-card-row { display: flex; gap: 0.6rem; margin-top: 0.4rem; }
        .rs-card-row .k { flex: 0 0 4.6rem; font-family: 'Cinzel', serif; font-size: 0.48rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); padding-top: 0.2rem; }
        .rs-card-row > div { min-width: 0; flex: 1; }
        .rs-card-sec { margin-top: 0.45rem; font-style: italic; color: var(--text-dim); }
        .rs-card-scroll { overflow-x: auto; }
        .rs-card-costs { border-collapse: collapse; margin-top: 0.25rem; font-size: 0.78rem; }
        .rs-card-costs th, .rs-card-costs td { padding: 0.15rem 0.6rem 0.15rem 0; text-align: left; white-space: nowrap; }
        .rs-card-costs tr:first-child th { font-family: 'Cinzel', serif; font-size: 0.5rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--rs-accent); font-weight: normal; }
        .rs-card-costs td { color: var(--text-dim); }
        .rs-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
        .rs-card-row .rs-chips { margin-top: 0; }
        .rs-chip { font: inherit; font-size: 0.75rem; padding: 0.1rem 0.45rem; border: 1px solid var(--border-mid); background: none; color: var(--text); }
        button.rs-chip { cursor: pointer; border-style: dashed; }
        button.rs-chip:hover, button.rs-chip.on { border-color: var(--rs-accent); color: var(--rs-accent); }
        .rs-card-desc { margin-top: 0.45rem; font-size: 0.78rem; line-height: 1.45; color: var(--text-dim); }
        .rs-card-desc b { color: var(--text); }
        .rs-card-book { display: inline-block; margin-top: 0.5rem; font-size: 0.75rem; color: var(--rs-accent); }
        .rs-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }
        .rs-state { font-family: 'Cinzel', serif; font-size: 0.55rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--text-dim); }
        .rs-state.unlocked, .rs-state.available { color: var(--rs-accent); }

        /* ── ≤640px ──────────────────────────────────────────────────────
           This file IS the phone experience (U1), so the overlay degrades
           rather than hiding: the tree keeps its horizontal scroll at a smaller
           zoom, the minimap goes (236px of a 375px viewport spent on an
           overview is the wrong trade), and the ballot stacks. */
        @media (max-width: 640.98px) {
            .rs-mini { display: none; }
            .rs-facs-aside { width: 100%; justify-content: space-between; }
            .rs-frontier-row { flex-direction: column; }
            .rs-ballot { grid-template-columns: 1fr; }
            /* 200px was a 198px-tall window onto a 2572x524 canvas — about 5% of
               the tree visible at once, on the surface where the minimap is
               hidden and this scroller is therefore the ONLY view of it. 45vh is
               ~365px on a 812pt phone and still leaves the frontier card, the
               faction tabs and the top of the ballot on screen. */
            .rs-tree-scroll { min-height: 45vh; }
            .rs-prop-sigil { display: none; }
            /* The rank select is 104px of a 359px panel, and the technology's
               NAME is what a voter is ranking — so here the select takes its own
               full-width line under the head rather than squeezing the name to
               two wrapped lines beside it. */
            .rs-prop-head { flex-wrap: wrap; }
            .rs-ranksel { width: 100%; margin-top: 0.5rem; }
            .rs-ranksel select { width: 100%; }
        }

        /* ══ UI revamp Phase 14 — the GM Panel token pass (U35, §10.1) ══════
           §10's second open question, closed 2026-08-22 once Phase 6 restyled
           Battle Setup and the condition it was waiting on was met. The argument
           for doing it rather than deferring again: this panel opens INSIDE the
           same page as five reframed overlays, so leaving it alone reads as
           broken rather than merely dated.

           BOUNDED, and §10.1 spells out what that means:
             · no control moves — this panel holds monthly_reroll, advance_cycle,
               delete_report, accept_conflict and set_faction;
             · `.gm-act-row` is NOT rebuilt. §8.5 records four renderers
               borrowing that four-column grid with the wrong child count, and
               the two variants that fixed it. Touching it again means re-driving
               all eight tabs, which is the FULL restyle that was explicitly not
               chosen;
             · no endpoint changes.

           ⚠️ §10.1 SAID `#gm-panel` IS A SCROLL CONTAINER AND IT IS NOT — the
           OVERLAY scrolls (`#gm-panel-overlay` carries `overflow-y: auto` and
           `align-items: flex-start`). That was written from memory when the
           decision was recorded and is corrected in the doc. It changes nothing
           here: `.ov-panel` is a superset — an outline and background arms work
           on any element, scrolling or not — and using the SAME class as the
           five player overlays is the whole point of the phase. */
        #gm-panel-overlay {
            background: rgba(3,3,8,0.84);
        }
        /* The header rule and the frame want a little more room than 1.5rem. */
        #gm-panel { padding: 1.5rem 1.6rem 1.4rem; }

        .gm-panel-header {
            padding-bottom: 0.7rem;
            border-bottom: 1px solid var(--border);
            margin-bottom: 1rem;
        }
        .gm-panel-title {
            font-family: 'Cinzel Decorative', cursive;
            font-size: 0.8rem;
            letter-spacing: 0.14em;
            text-transform: none;
        }
        .gm-panel-close {
            border: 1px solid var(--border-mid);
            border-radius: 3px;
            width: 26px; height: 26px;
            display: flex; align-items: center; justify-content: center;
            padding: 0;
            font-family: sans-serif; font-size: 0.8rem;
            transition: border-color 0.15s, color 0.15s, background 0.15s;
        }
        .gm-panel-close:hover { border-color: var(--gold-dim); background: var(--gold-faint); }

        /* ── The tab strip, and a defect the styling pass found ────────────
           ⚠️ EIGHT TABS HAVE NEVER FIT, AT ANY WIDTH. Measured before changing
           anything: the row wants 833px and the panel gives it 730px at 1280px
           of viewport, so the Settings tab was drawing 78px OUTSIDE the panel's
           own border — on desktop, not just on a phone. `docOverflow` stays 0
           because the row simply overflows a `visible` box, so nothing scrolls
           and nothing complains; it just hangs off the edge. The eighth tab
           (Balance) arrived in Phase 10 of the Vhal'Terra work and nobody
           measured after.

           WRAPPING RATHER THAN SCROLLING, deliberately. `overflow-x: auto`
           keeps one line and hides tabs behind a gesture with no affordance —
           and a GM tab nobody can find is worse than a second row. Wrapping
           shows all eight at every width and costs one line of panel height.
           This moves no control: same tabs, same order, same handlers. */
        .gm-tab-row {
            flex-wrap: wrap;
            gap: 0 0.1rem;
            border-bottom-color: var(--border);
        }
        .gm-tab-btn {
            padding: 0.5rem 0.85rem;
            font-size: 0.6rem;
            letter-spacing: 0.14em;
        }
        .gm-tab-btn:hover { color: var(--text); background: var(--gold-faint); }
        .gm-tab-btn.active { border-bottom-color: var(--gold); }

        .gm-viewas-btn { border-radius: 3px; transition: color .15s, border-color .15s, background .15s; }
        .gm-viewas-btn:hover  { background: var(--gold-faint); }
        .gm-viewas-btn.active { background: var(--gold-faint); border-color: var(--gold); }

        /* Section headings and buttons — the two things a GM reads and presses.
           Colour, radius and hover only; no box moves. */
        .gm-campaign-section {
            border-color: var(--border-mid);
            border-radius: var(--vt-card-radius);
        }
        .gm-campaign-section-title {
            color: var(--gold-dim);
            border-bottom: 1px solid rgba(201,168,76,0.16);
            padding-bottom: 0.32rem;
        }
        .btn-gm-action, .gm-btn-small { border-radius: 3px; }
        /* ⚠ `.gm-btn-small` HAD NO STYLING AT ALL beyond that border-radius, so
           the ~21 per-faction controls in the Council AI tab rendered as NATIVE
           buttons — measured `rgb(240,240,240)` background with `rgb(0,0,0)`
           text, i.e. the OS default, light grey in a black app. Not a colour
           choice that drifted; a class that was used in markup and never
           written. Styled as a secondary GM control, matching `.gm-act-filter`
           beside it rather than the gold-filled primary — these are per-faction
           tools, not the panel's main action. */
        .gm-btn-small {
            font-family: 'Cinzel', serif;
            font-size: 0.5rem;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            border: 1px solid var(--gold-dim);
            color: var(--gold-dim);
            background: transparent;
            padding: 0.28rem 0.6rem;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s, background 0.15s;
        }
        .gm-btn-small:hover { color: var(--gold); border-color: var(--gold); background: var(--gold-faint); }
        .gm-btn-small:disabled { opacity: 0.4; cursor: not-allowed; }

        /* Consistency with the five, and cheap: the scrollbar here is the
           OVERLAY's, because that is what scrolls. */
        #gm-panel-overlay { scrollbar-width: thin; scrollbar-color: var(--border-mid) transparent; }
        #gm-panel :is(a, button, select, summary, input, textarea, [tabindex]):focus-visible {
            outline: 1px solid var(--gold);
            outline-offset: 2px;
        }

        /* ── The GM Panel on a phone ───────────────────────────────────────
           U16 made this reachable at ≤640px for the first time in Phase 5 — the
           button is `display:none` there, and the hamburger entry is the only
           way in — so until then none of this had a reader. A second
           ≤640.98px block, after the shell's, which reaches nothing in here. */
        @media (max-width: 640.98px) {
            #gm-panel-overlay { padding: 0.75rem 0.5rem; }
            #gm-panel         { padding: 1rem 0.85rem 0.9rem; }
            /* Let the tabs share the rows evenly rather than leaving a ragged
               tail — with eight of them at this width there are four rows
               either way, so this only decides whether they look deliberate. */
            .gm-tab-btn { flex: 1 0 auto; padding: 0.5rem 0.5rem; letter-spacing: 0.1em; }
        }
        /* ══ The Council overlay ═══════════════════════════════════════════
           THE COUNCIL IS NO LONGER A PAGE. It was `campaignmap_council.html`,
           a standalone file with its own copy of the theme — the precedent the
           research tree set and UI_REVAMP_DESIGN.md §3.5 recorded. It is now
           the sixth `.ov-panel` overlay on this file, opened by
           `window.openCouncil()` exactly as Battle Setup and My Terrain are,
           and the old page is a redirect stub that lands here on `#council`.

           WHAT THAT BUYS, and it is the reason for the move rather than tidiness:
           the council is the one destination that needs the MAP beside it —
           every proposal names a hex, and on a separate page "at Hills (hex
           308)" was a string a player could not go and look at. As an overlay
           it closes onto the board.

           ⚠ THE `.vt-*` IDIOM IS DOWN TO ONE COPY AND IT IS THE ONE IN THIS
           FILE. It was three — this file, campaignmap_research.html and
           campaignmap_council.html — under a CHANGE ONE, CHANGE ALL THREE rule.
           Both subpages became overlays here on 2026-08-22 and both are
           redirect stubs now, with nothing to style, so each copy went with the
           page it themed. Nothing below touches that block. Everything here is
           new, `cnl-`-prefixed and local to this file, the same footing
           `.ov-panel` itself sits on.

           ⚠ IT CONSUMES THE IDIOM, IT DOES NOT RESTATE IT. `.vt-portrait`,
           `.vt-badge` and `.vt-quote` are used as-is; the stance badge's four
           ENUM colours in particular are Phase 0's and are not re-declared, so
           a stance can never render here in a colour it does not render in on
           mobile's council tab.

           ── The layout, against the owner's mockup ─────────────────────────
           The card-per-proposal stack the standalone page shipped is replaced
           by a TABLE: one row per proposal across six columns — number,
           sponsors, proposal, base cost, arguments, your rank — with the
           arguments opening into a full-width drawer BELOW the row rather than
           in a column of their own.

           WHY A DRAWER AND NOT THE OLD STANCE COLUMN. U20's five columns put
           the statements and the reactions side by side in ~1.6fr of a 1400px
           page, which is where the old card spent most of its height and read
           as a wall. The mockup asks for the row to be scannable and the
           argument to be something you open. Nothing is dropped: the sponsor
           statements AND U17's stance reactions both live in the drawer, the
           statements first because they are the case being made and the
           reactions second because they answer it.

           ⚠ ONE DRAWER AT A TIME, and it is deliberate rather than a
           limitation. Two open drawers push the third row off the fold and the
           table stops being a comparison, which is the whole point of the row
           form. */
        #council-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(3,3,8,0.84);
            padding: 1.4rem 1rem;
            z-index: 3200;
            align-items: center;
            justify-content: center;
        }
        #council-overlay.open { display: flex; }
        #council-panel {
            /* chrome: .ov-panel */
            padding: 1.4rem 1.5rem 1.1rem;
            width: var(--win-w);
            max-height: calc(100dvh - 2.8rem);
            overflow-y: auto;
            position: relative;
        }

        /* ── The faction switcher ──────────────────────────────────────────
           Emblem plus name, three across. The icons come from `factionsData`
           (get_factions' `icon` column) — the SAME source buildFactionPanel()
           uses for the header strip, so the two can never show different art
           for one faction. The names come from there too, so a GM renaming a
           faction renames it here for free; the mottoes below them are the one
           authored string, keyed by faction id. */
        .cnl-factions {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 0.55rem;
            margin-bottom: 0.85rem;
        }
        .cnl-fac {
            display: flex; align-items: center; gap: 0.7rem;
            padding: 0.55rem 0.8rem;
            background: var(--surface2);
            border: 1px solid var(--border-mid);
            border-radius: var(--vt-card-radius);
            color: var(--text-dim);
            font-family: 'Cinzel', serif;
            cursor: pointer;
            text-align: left;
            min-width: 0;
        }
        .cnl-fac:hover { border-color: var(--gold-dim); color: var(--text); }
        .cnl-fac.is-on {
            border-color: var(--gold);
            background: var(--gold-faint);
            color: var(--gold);
            box-shadow: inset 0 0 0 1px rgba(201,168,76,0.18);
        }
        .cnl-fac-icon {
            width: 34px; height: 34px; flex: none;
            display: flex; align-items: center; justify-content: center;
        }
        .cnl-fac-icon img { width: 100%; height: 100%; object-fit: contain; }
        .cnl-fac-name {
            font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase;
            line-height: 1.25; min-width: 0;
        }

        /* ── The ballot header bar ─────────────────────────────────────────
           Status centred, weight chip pushed right. The chip is
           `get_my_vote_balance`'s D28 weight and appears only for a signed-in
           player — for a guest there is no weight to state, and "0 votes" would
           be a lie about a ballot they simply have not logged in to. */
        .cnl-bar {
            position: relative;
            display: flex; align-items: center; gap: 0.8rem;
            padding: 0.6rem 0.9rem;
            border: 1px solid var(--gold-dim);
            border-radius: var(--vt-card-radius);
            background: rgba(201,168,76,0.04);
            margin-bottom: 0.9rem;
        }
        .cnl-bar-main { flex: 1; text-align: center; min-width: 0; }
        .cnl-bar-title {
            font-family: 'Cinzel', serif; font-size: 0.8rem;
            letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold);
        }
        .cnl-bar-sub {
            margin-top: 0.15rem;
            font-family: 'Crimson Text', serif; font-style: italic;
            font-size: 0.82rem; color: var(--text-dim);
        }
        .cnl-weight {
            flex: none;
            padding: 0.35rem 0.7rem;
            border: 1px solid var(--border-mid);
            border-radius: var(--vt-card-radius);
            background: var(--surface2);
            font-family: 'Cinzel', serif; font-size: 0.62rem;
            letter-spacing: 0.1em; text-transform: uppercase; color: var(--text);
        }
        /* The chip is absolutely positioned so the status above stays centred on
           the PANEL rather than on the space the chip leaves — with it in flow
           the title drifts left by half the chip whenever a player signs in,
           which reads as the bar being misaligned. */
        @media (min-width: 900px) {
            .cnl-weight { position: absolute; right: 0.9rem; top: 50%; transform: translateY(-50%); }
        }

        /* ── The proposal table ────────────────────────────────────────────
           ONE column template, declared once as a custom property and used by
           both the header row and every proposal row. Two templates is how the
           headings and the cells come to disagree about which column is which,
           and a table whose headings are one column out still renders
           perfectly. */
        .cnl-table { --cnl-cols: 2.1rem minmax(0,1.45fr) minmax(0,1.9fr) minmax(0,1.35fr) minmax(0,0.95fr) 9.5rem; }
        .cnl-head {
            display: grid;
            grid-template-columns: var(--cnl-cols);
            gap: 0.75rem;
            padding: 0 0.7rem 0.45rem;
            font-family: 'Cinzel', serif; font-size: 0.56rem;
            letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim);
        }
        .cnl-head > span { text-align: center; }
        .cnl-head > span:nth-child(2),
        .cnl-head > span:nth-child(3) { text-align: left; }

        .cnl-row {
            display: grid;
            grid-template-columns: var(--cnl-cols);
            gap: 0.75rem;
            align-items: center;
            padding: 0.7rem;
            background: var(--surface2);
            border: 1px solid var(--border-mid);
            border-radius: var(--vt-card-radius);
            margin-bottom: 0.5rem;
        }
        /* The open row and its drawer are ONE object visually: the row loses its
           bottom radius, the drawer loses its top, and the 0.5rem gap between
           them is collapsed. */
        .cnl-row.is-open {
            border-color: var(--gold);
            background: rgba(201,168,76,0.06);
            margin-bottom: 0;
            border-bottom-left-radius: 0; border-bottom-right-radius: 0;
        }
        /* A seated proposal (the ballot has resolved and this one took a seat)
           keeps the gold frame the old card used. */
        .cnl-row.is-seated { border-color: var(--gold-dim); }

        .cnl-num {
            font-family: 'Cinzel', serif; font-size: 0.95rem; color: var(--text-dim);
            text-align: center;
            border-right: 1px solid var(--border);
            align-self: stretch;
            display: flex; align-items: center; justify-content: center;
        }
        .cnl-row.is-open .cnl-num { color: var(--gold); }

        /* Sponsors — portrait over name, side by side. A merged option (D26)
           puts two or three in this cell, which is what the wrap is for. */
        .cnl-sponsors { display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem; min-width: 0; }
        .cnl-sponsor {
            display: flex; flex-direction: column; align-items: center;
            gap: 0.3rem; width: 5.4rem; text-align: center;
        }
        .cnl-sponsor .vt-portrait { --vt-portrait: 46px; }
        .cnl-sponsor-name {
            font-family: 'Cinzel', serif; font-size: 0.54rem;
            letter-spacing: 0.08em; text-transform: uppercase;
            color: var(--gold); line-height: 1.35;
        }

        .cnl-prop { min-width: 0; }
        .cnl-prop-title {
            font-family: 'Cinzel', serif; font-size: 1rem; color: var(--gold);
            line-height: 1.2; text-transform: uppercase; letter-spacing: 0.03em;
        }
        .cnl-prop-where {
            margin-top: 0.2rem;
            font-family: 'Crimson Text', serif; font-size: 0.86rem; color: var(--text-dim);
        }
        .cnl-prop-badges { margin-top: 0.4rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }

        /* Base cost — U18/U36's non-zero chips. "Base cost", never "cost to
           you": this is `buildings.cost_*`, the LIST price, and BLD §4.2's
           duplicate multiplier and the upgrade ladder both move what the
           faction actually pays. The heading above the column says so, which is
           why the chips themselves carry no label here. */
        .cnl-cost { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center; }
        .cnl-res {
            font-family: 'Cinzel', serif; font-size: 0.55rem;
            letter-spacing: 0.08em; text-transform: uppercase;
            background: var(--bg); border: 1px solid var(--border);
            border-radius: 3px; padding: 0.22rem 0.42rem; color: var(--text-dim);
            white-space: nowrap;
        }
        .cnl-res b { color: var(--text); font-weight: 600; }
        .cnl-cost-none {
            font-family: 'Crimson Text', serif; font-style: italic;
            font-size: 0.82rem; color: var(--text-dim); text-align: center; width: 100%;
        }

        /* Arguments — the drawer toggle. Disabled (not hidden) where a proposal
           has nothing behind it, so the column still reads as a column and the
           absence is stated rather than left as a hole. */
        .cnl-args { display: flex; justify-content: center; }
        .cnl-args-btn {
            display: flex; align-items: center; gap: 0.45rem;
            width: 100%; justify-content: center;
            padding: 0.45rem 0.55rem;
            background: var(--bg); border: 1px solid var(--border-mid);
            border-radius: var(--vt-card-radius); color: var(--text);
            font-family: 'Cinzel', serif; font-size: 0.58rem;
            letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer;
        }
        .cnl-args-btn:hover:not(:disabled) { border-color: var(--gold-dim); color: var(--gold); }
        .cnl-args-btn:disabled { opacity: 0.45; cursor: default; }
        .cnl-args-btn.is-on { border-color: var(--gold); color: var(--gold); background: var(--gold-faint); }
        .cnl-args-btn svg { width: 13px; height: 13px; flex: none; }

        .cnl-rank { min-width: 0; }
        .cnl-rank select {
            width: 100%;
            background: var(--bg); color: var(--gold);
            border: 1px solid var(--border-mid);
            border-radius: var(--vt-card-radius);
            padding: 0.45rem 0.5rem;
            font-family: 'Cinzel', serif; font-size: 0.62rem;
            letter-spacing: 0.1em; text-transform: uppercase;
        }
        .cnl-row.is-ranked .cnl-rank select { border-color: var(--gold); }
        .cnl-rank select:focus { outline: none; border-color: var(--gold); }
        .cnl-tally {
            margin-top: 0.3rem;
            font-family: 'Cinzel', serif; font-size: 0.5rem;
            letter-spacing: 0.08em; color: var(--text-dim); text-align: center; line-height: 1.5;
        }

        /* ── The arguments drawer ──────────────────────────────────────────
           Full width under its row. Statements first (the case), reactions
           second (the answer to it). */
        .cnl-drawer {
            border: 1px solid var(--gold);
            border-top: none;
            border-bottom-left-radius: var(--vt-card-radius);
            border-bottom-right-radius: var(--vt-card-radius);
            background: rgba(201,168,76,0.03);
            padding: 0.9rem 1rem 1rem;
            margin-bottom: 0.5rem;
        }
        .cnl-drawer-head {
            display: flex; align-items: center; gap: 0.8rem;
            padding-bottom: 0.7rem; margin-bottom: 0.9rem;
            border-bottom: 1px solid var(--gold-dim);
        }
        .cnl-drawer-title {
            flex: 1; text-align: center;
            font-family: 'Cinzel', serif; font-size: 0.76rem;
            letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold);
        }
        .cnl-drawer-close {
            flex: none; width: 1.7rem; height: 1.7rem;
            display: flex; align-items: center; justify-content: center;
            background: none; border: 1px solid transparent; border-radius: 3px;
            color: var(--gold); font-size: 0.8rem; cursor: pointer; line-height: 1;
        }
        .cnl-drawer-close:hover { border-color: var(--gold-dim); background: var(--gold-faint); }

        .cnl-args-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
            gap: 1rem 1.6rem;
        }
        /* The vertical hairline between two statements in the mockup. Only
           between columns, so a single statement (the common case at U17's
           measured 0–2) gets no orphan rule beside it. */
        .cnl-arg { display: flex; gap: 0.85rem; min-width: 0; position: relative; }
        .cnl-arg + .cnl-arg::before {
            content: ''; position: absolute; left: -0.8rem; top: 0; bottom: 0;
            width: 1px; background: var(--border-mid);
        }
        @media (max-width: 900px) { .cnl-arg + .cnl-arg::before { display: none; } }
        .cnl-arg .vt-portrait { --vt-portrait: 70px; }
        .cnl-arg-body { min-width: 0; flex: 1; }
        .cnl-arg-name {
            font-family: 'Cinzel', serif; font-size: 0.85rem;
            letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold);
        }
        .cnl-arg-epi {
            font-family: 'Crimson Text', serif; font-style: italic;
            font-size: 0.86rem; color: var(--text-dim);
        }
        .cnl-arg-move {
            margin-top: 0.1rem;
            font-family: 'Cinzel', serif; font-size: 0.53rem;
            letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
        }
        /* U19's clamp, moved onto the statement. Clamped in CSS and expanded on
           click — NEVER truncated server-side, because the full text is already
           published and cutting it there would make the payload and the page
           disagree about what a leader said. The affordance below is only added
           once the renderer has MEASURED that something is hidden. */
        .cnl-arg-text {
            margin-top: 0.5rem;
            font-family: 'Crimson Text', serif; font-style: italic;
            font-size: 0.95rem; line-height: 1.55; color: var(--text);
            display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4;
            overflow: hidden;
        }
        .cnl-arg-text.is-open { -webkit-line-clamp: unset; overflow: visible; }
        .cnl-arg-more {
            display: none; margin-top: 0.45rem;
            background: none; border: none; padding: 0; cursor: pointer;
            font-family: 'Cinzel', serif; font-size: 0.56rem;
            letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold);
        }
        .cnl-arg-more.is-shown { display: block; }
        .cnl-arg-more:hover { text-decoration: underline; }

        /* Reactions — U17's stances, under the statements they answer. */
        .cnl-reacts { margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }
        .cnl-reacts-lbl {
            font-family: 'Cinzel', serif; font-size: 0.56rem;
            letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim);
            margin-bottom: 0.6rem;
        }
        .cnl-reacts-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
            gap: 0.7rem 1.4rem;
        }
        .cnl-react { display: flex; gap: 0.6rem; min-width: 0; }
        .cnl-react .vt-portrait { --vt-portrait: 30px; --vt-portrait-ring: var(--border-mid); }
        .cnl-react-body { min-width: 0; }
        .cnl-react-head { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: baseline; }
        .cnl-react-name { font-family: 'Crimson Text', serif; font-size: 0.88rem; color: var(--text); }
        .cnl-react-text {
            margin-top: 0.2rem;
            font-family: 'Crimson Text', serif; font-size: 0.86rem;
            line-height: 1.45; color: var(--text-dim);
        }

        /* The score breakdown, D63 — present in the payload only once the
           ballot has CLOSED, so this renders nothing while it is open rather
           than a blank where a number belongs. */
        .cnl-bd { margin-top: 0.9rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }
        .cnl-bd span {
            background: var(--bg); border: 1px solid var(--border); border-radius: 3px;
            padding: 0.18rem 0.45rem;
            font-family: 'Cinzel', serif; font-size: 0.55rem; color: var(--text-dim);
        }
        .cnl-bd b { color: var(--text); }

        /* ── The ballot footer ─────────────────────────────────────────────
           Count on the left, the three seat slots in the middle, the ornate
           submit on the right. The slots are a RENDERING of `rankState`, which
           is the single source of truth — the same rule the selects follow, and
           what guarantees no two controls can ever show different rankings. */
        .cnl-ballotfoot {
            display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
            margin-top: 0.9rem; padding: 0.8rem 0.95rem;
            border: 1px solid var(--gold-dim);
            border-radius: var(--vt-card-radius);
            background: rgba(201,168,76,0.04);
        }
        .cnl-ballotfoot-lbl { flex: none; }
        .cnl-ballotfoot-lbl b {
            display: block;
            font-family: 'Cinzel', serif; font-size: 0.7rem; font-weight: 400;
            letter-spacing: 0.13em; text-transform: uppercase; color: var(--gold);
        }
        .cnl-ballotfoot-lbl span {
            display: block; margin-top: 0.15rem;
            font-family: 'Crimson Text', serif; font-style: italic;
            font-size: 0.8rem; color: var(--text-dim);
        }
        .cnl-slots { flex: 1; display: flex; flex-wrap: wrap; gap: 0.5rem; min-width: 0; }
        .cnl-slot {
            display: flex; align-items: center; gap: 0.5rem; min-width: 0;
            padding: 0.45rem 0.8rem;
            border: 1px solid var(--gold-dim); border-radius: var(--vt-card-radius);
            background: var(--surface2);
            font-family: 'Cinzel', serif; font-size: 0.64rem;
            letter-spacing: 0.08em; text-transform: uppercase; color: var(--text);
        }
        .cnl-slot i {
            flex: none; width: 1.35rem; height: 1.35rem; border-radius: 50%;
            border: 1px solid var(--gold); color: var(--gold);
            display: flex; align-items: center; justify-content: center;
            font-style: normal; font-size: 0.6rem;
        }
        .cnl-slot.is-empty { border-color: var(--border-mid); color: var(--text-dim); background: var(--bg); }
        .cnl-slot.is-empty i { border-color: var(--border-mid); color: var(--text-dim); }
        .cnl-slot-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

        .cnl-submit {
            flex: none; cursor: pointer;
            background: var(--gold-faint); color: var(--gold);
            border: 1px solid var(--gold); border-radius: var(--vt-card-radius);
            font-family: 'Cinzel', serif; font-size: 0.7rem;
            letter-spacing: 0.2em; text-transform: uppercase;
            padding: 0.8rem 1.6rem;
        }
        .cnl-submit:hover:not(:disabled) { background: rgba(201,168,76,0.18); }
        .cnl-submit:disabled { opacity: 0.5; cursor: default; }
        .cnl-msg {
            flex-basis: 100%; text-align: center;
            font-family: 'Crimson Text', serif; font-size: 0.9rem;
        }

        /* ── The two views, and the footer that switches them ──────────────
           The mockup's footer links. As an overlay they are VIEWS rather than
           pages: the standalone file stacked its sections down one scroll,
           which is why the roster sat 900px below a vote nobody had cast yet.
           Both are listed with the current one marked, rather than only the
           one you are not on — a nav that changes its own contents as you use
           it is a nav you have to re-read.

           ⚠ THERE WAS A THIRD, "Research Ballot", AND IT WAS REMOVED ON
           2026-08-23 (owner's call). D91 put a research SUMMARY on the council
           because the standalone page's only way out was a back-link to the
           map — a player reading the council had no route to the research
           ballot except two navigations. That premise is gone twice over:
           Faction Research is a nav destination on every surface, and since
           2026-08-22 it is an overlay in THIS FILE, so the summary was a
           read-only restatement sitting one click from the real thing.
           `get_research_ballot` is no longer called from the council at all —
           one fewer request per faction switch. Do not re-add it without a
           new reason; D90 still keeps that ballot on the research tree,
           because half the reasoning a voter needs is the tree itself. */
        .cnl-foot {
            display: flex; justify-content: center; flex-wrap: wrap; gap: 0.4rem;
            margin-top: 1rem; padding-top: 0.8rem;
            border-top: 1px solid var(--border);
        }
        .cnl-foot button {
            display: flex; align-items: center; gap: 0.5rem;
            background: none; border: 1px solid transparent; border-radius: var(--vt-card-radius);
            padding: 0.45rem 0.9rem; cursor: pointer; color: var(--text-dim);
            font-family: 'Cinzel', serif; font-size: 0.64rem;
            letter-spacing: 0.13em; text-transform: uppercase;
        }
        .cnl-foot button:hover { color: var(--gold); background: var(--gold-faint); }
        .cnl-foot button.is-on { color: var(--gold); border-color: var(--gold-dim); background: var(--gold-faint); }
        .cnl-foot .vt-icon { width: 17px; height: 17px; }

        /* ── The roster view (D62) ─────────────────────────────────────────
           Five at a time, following the faction switcher — the scope every
           other block here uses. The FULL portrait (~136 KB against the thumb's
           ~2 KB) is put in the DOM only for the card that is open, which is why
           the roster re-renders on expand rather than toggling a class. */
        .cnl-roster { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
        .cnl-ldr {
            display: flex; gap: 0.8rem; align-items: flex-start; width: 100%;
            text-align: left; color: inherit; cursor: pointer;
            background: var(--surface2); border: 1px solid var(--border-mid);
            border-radius: var(--vt-card-radius); padding: 0.7rem 0.85rem;
        }
        .cnl-ldr:hover { border-color: var(--gold-dim); }
        .cnl-ldr.is-open { grid-column: 1 / -1; cursor: default; border-color: var(--gold-dim); }
        .cnl-ldr .vt-portrait { --vt-portrait: 56px; }
        .cnl-ldr.is-open .vt-portrait { --vt-portrait: 130px; }
        .cnl-ldr-body { min-width: 0; flex: 1; }
        .cnl-ldr-name {
            font-family: 'Cinzel', serif; font-size: 0.85rem;
            letter-spacing: 0.05em; text-transform: uppercase; color: var(--gold);
        }
        .cnl-ldr-epi { font-family: 'Crimson Text', serif; font-style: italic; font-size: 0.88rem; color: var(--text-dim); }
        .cnl-ldr-traits { margin-top: 0.45rem; display: flex; flex-wrap: wrap; gap: 0.28rem; }
        .cnl-trait {
            background: var(--bg); border: 1px solid var(--border); border-radius: 3px;
            padding: 0.12rem 0.42rem;
            font-family: 'Cinzel', serif; font-size: 0.5rem;
            letter-spacing: 0.08em; color: var(--text-dim);
        }
        .cnl-ldr-origin {
            margin-top: 0.5rem;
            font-family: 'Cinzel', serif; font-size: 0.53rem;
            letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
        }
        .cnl-ldr-bio { margin-top: 0.55rem; font-family: 'Crimson Text', serif; font-size: 0.93rem; line-height: 1.55; }
        .cnl-ldr-doctrine {
            margin-top: 0.6rem; padding-left: 0.7rem; border-left: 2px solid var(--gold-dim);
            font-family: 'Crimson Text', serif; font-style: italic; font-size: 0.93rem; line-height: 1.5;
        }
        .cnl-ldr-hint {
            margin-top: 0.55rem;
            font-family: 'Cinzel', serif; font-size: 0.5rem;
            letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-dim);
        }

        /* Shared small pieces. */
        .cnl-empty {
            padding: 1.6rem 0.5rem; text-align: center;
            font-family: 'Crimson Text', serif; font-style: italic;
            font-size: 0.95rem; color: var(--text-dim);
        }
        .cnl-login {
            margin-top: 0.9rem; padding: 0.7rem 0.9rem;
            border: 1px dashed var(--border-mid); border-radius: var(--vt-card-radius);
            font-family: 'Crimson Text', serif; font-size: 0.92rem;
            color: var(--text-dim); text-align: center;
        }
        .cnl-section-lede {
            font-family: 'Crimson Text', serif; font-size: 0.95rem;
            line-height: 1.55; color: var(--text-dim); margin-bottom: 0.9rem;
        }

        /* ── Narrow widths ─────────────────────────────────────────────────
           The map page IS the phone surface (U1), so the table has to survive
           down there rather than being desktop-only. Below 1100px it stops
           being a grid and becomes a stack of labelled blocks: the six columns
           cannot each hold their meaning at 375px, and a horizontal scroller
           would hide the rank control — the one thing a player came to use —
           off the right-hand edge. */
        @media (max-width: 1099.98px) {
            #council-panel { padding: 1.1rem 0.9rem 0.9rem; }
            .cnl-head { display: none; }
            .cnl-row {
                grid-template-columns: 2.1rem minmax(0, 1fr);
                align-items: start;
                gap: 0.6rem 0.75rem;
            }
            .cnl-num { align-self: start; padding-top: 0.15rem; border-right: none; }
            .cnl-sponsors  { grid-column: 2; justify-content: flex-start; }
            .cnl-prop      { grid-column: 2; }
            .cnl-cost      { grid-column: 2; justify-content: flex-start; }
            .cnl-args      { grid-column: 2; }
            .cnl-rank      { grid-column: 2; }
            .cnl-args-btn  { width: auto; }
            .cnl-tally     { text-align: left; }
            .cnl-factions  { grid-template-columns: minmax(0, 1fr); }
            .cnl-ballotfoot { flex-direction: column; align-items: stretch; }
            .cnl-submit    { width: 100%; }
        }
        @media (max-width: 640.98px) {
            #council-overlay { padding: 0.75rem 0.5rem; }
            #council-panel   { padding: 0.9rem 0.7rem 0.8rem; max-height: calc(100dvh - 1.5rem); }
            .cnl-arg { flex-direction: column; align-items: flex-start; }
            .cnl-arg .vt-portrait { --vt-portrait: 56px; }
            .cnl-ldr.is-open { flex-direction: column; }
        }
        /* ══ Touch targets, part two — LAST IN THE SHEET ON PURPOSE ═════════
           The ≤640 block further up cannot reach these: `.gm-panel-close` is
           re-declared at its Phase 14 size AFTER that block, and equal
           specificity means the later rule wins, so the 36px there was silently
           overridden back to 26. Rather than raise specificity per selector —
           which invites the same race the next time a rule is appended — the
           remaining bumps live at the end of the sheet where nothing follows
           them. Every one was measured under 30px on a phone.
           ⚠ If you add CSS after this block, check these still win. */
        @media (max-width: 640.98px) {
            .gm-panel-close { width: 36px; height: 36px; }
            /* The GM buttons in the hex modal footer — six of them, all 22px. */
            .btn-gm-contested { min-height: 30px; }
            /* The GM Panel's own view-as switch, 22px. */
            .gm-viewas-btn { min-height: 30px; }
            /* 28 → 30, so nothing in the GM Panel is under the bar. */
            .btn-gm-action, .gm-btn-small { min-height: 30px; }
            /* The Settings sliders and colour wells: 22px and 26px. */
            input[type=range].opt-range { height: 30px; }
            input[type=color].opt-color { height: 30px; }

            /* Faction Research: the two card tabs (22px), the rank select (26),
               the toolbar buttons (28) and the GM reveal switch (13). */
            .rs-tab       { min-height: 30px; }
            .rs-btn       { min-height: 30px; }
            .rs-ranksel select { min-height: 30px; }
            .rs-gm-toggle { min-height: 30px; }
            .rs-gm-toggle input { width: 16px; height: 16px; }
            /* The council's arguments drawer toggle, 29px. */
            .cnl-args-btn { min-height: 30px; }
            .cnl-rank select { min-height: 30px; }

            /* ⚠ THE LOCKED-TAB TOOLTIP IS 253px OF `nowrap` CENTRED ON A SMALL
               HOST, and on a phone both its hosts sit right of centre: the
               Battle Report tab's tooltip ran to x=408 and the File Report
               button's to x=432, against a 375px screen. `#modal` is
               `overflow: hidden`, so it did not scroll anything — it CUT THE
               SENTENCE OFF, which is the one thing a tooltip must not do.
               Anchoring it to the tab ROW / the footer instead of to the control
               is what bounds it: `left`+`right` on a full-width parent make the
               box the row's width whatever the host's position, so no host can
               push it off an edge. Both hosts must therefore stop being the
               containing block, which is all `position: static` is doing here —
               their `position: relative` exists only for this tooltip. */
            .modal-tabs, .modal-footer { position: relative; }
            .tab-locked, .btn-locked   { position: static; }
            .tab-locked::after, .btn-locked::after {
                left: 0.5rem; right: 0.5rem;
                transform: none;
                white-space: normal;
                text-align: center;
            }
        }
