/* ===================================================================
 * Campaign — themed CSS for the 12 story locations.
 *
 * Each location class drops onto the campaign-stage element and provides:
 *   1. a fallback gradient background (for when no real bg image is loaded)
 *   2. a tinted ::after vignette/atmosphere overlay
 *   3. accent colors for the location nameplate / nodes
 *
 * When real exterior/interior background images arrive, drop them into
 * /rice-street/bg/ and add a `background-image:` line to the matching
 * theme — the gradient stays as fallback.
 * =================================================================== */

/* Background lives on its own fixed layer — full viewport, never scrolls,
   floats behind the content. The content layer (#campaign-stage) stays
   transparent and scrolls normally. The theme classes apply to the
   background layer (#campaign-bg). */
#campaign-bg {
    /* Hard-locked to the visible viewport so the artwork never extends past
       what the user can see. Belt-and-suspenders explicit sizing because
       inset:0 alone wasn't enough on mobile (iOS in particular). 100dvh
       uses the *dynamic* viewport on mobile (collapses with the address
       bar) and falls back to 100vh on browsers that don't support it. */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    z-index: 0;
    background-size: cover !important;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    transition: background-image 0.6s ease;
    pointer-events: none;
    overflow: hidden;
}
/* Per-location bg override. setStageTheme() sets --loc-bg-outside / --loc-bg-inside
   inline as `url(...)` strings whenever the active location has bgOutside / bgInside
   slugs. These rules use !important so they win over any theme-X background-image
   rule below — letting generic-themed sub-locations (Vespera's parlor, the crypt,
   fortune booth, mt olympus, etc.) actually render their own art instead of the
   theme's fallback gradient. Theme classes still own accent color + node styling. */
#campaign-bg.has-loc-bg                 { background-image: var(--loc-bg-outside) !important; }
#campaign-bg.has-loc-bg.mode-inside     { background-image: var(--loc-bg-inside)  !important; }

#campaign-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* Previously darkened edges to 55% black, which crushed half of the
       location art. Softer now — just enough vignette to frame the map
       center against the background. */
    background: radial-gradient(ellipse at center, transparent 20%, rgba(0,0,0,0.28) 100%);
}
#campaign-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    color: var(--ivory);
    font-family: 'Inter', sans-serif;
    background: transparent;
}
#campaign-stage > * { position: relative; z-index: 1; }

/* Two-mode location backdrops:
 *   default (just .theme-X)        → OUTSIDE establishing shot (used on the map)
 *   .theme-X.mode-inside           → INSIDE dialogue backdrop (used when an
 *                                    overlay opens — feels like "going in")
 *
 * Gradient stays as bottom layer so a missing image falls back gracefully.
 */

.theme-main-floor                 { background-image: url('../bg/outside-01-main-entrance.jpg'),
                                                       linear-gradient(135deg, #1d4d35 0%, #0a2e1c 60%, #050a08 100%); }
.theme-main-floor.mode-inside     { background-image: url('../bg/inside-01-main-floor.jpg'),
                                                       linear-gradient(135deg, #1d4d35 0%, #0a2e1c 60%, #050a08 100%); }
.theme-main-floor .location-accent { color: #d4af37; }

.theme-salon                      { background-image: url('../bg/outside-02-salon.jpg'),
                                                       linear-gradient(160deg, #093d28 0%, #042418 70%, #02110b 100%); }
.theme-salon.mode-inside          { background-image: url('../bg/inside-02-salon.jpg'),
                                                       linear-gradient(160deg, #093d28 0%, #042418 70%, #02110b 100%); }
.theme-salon .location-accent     { color: #f0d879; }

.theme-cabaret                    { background-image: url('../bg/outside-03-cabaret.jpg'),
                                                       linear-gradient(160deg, #4a0a1a 0%, #220505 60%, #100202 100%); }
.theme-cabaret.mode-inside        { background-image: url('../bg/inside-03-cabaret.jpg'),
                                                       linear-gradient(160deg, #4a0a1a 0%, #220505 60%, #100202 100%); }
.theme-cabaret .location-accent   { color: #e879a5; }

.theme-spa                        { background-image: url('../bg/outside-04-rooftop-spa.jpg'),
                                                       linear-gradient(160deg, #0c2538 0%, #1a1545 60%, #420a3d 100%); }
.theme-spa.mode-inside            { background-image: url('../bg/inside-04-rooftop-spa.jpg'),
                                                       linear-gradient(160deg, #0c2538 0%, #1a1545 60%, #420a3d 100%); }
.theme-spa .location-accent       { color: #66ccff; }

.theme-cigar                      { background-image: url('../bg/outside-05-cigar-lounge.jpg'),
                                                       linear-gradient(160deg, #3a2410 0%, #1a1208 60%, #0a0604 100%); }
.theme-cigar.mode-inside          { background-image: url('../bg/inside-05-cigar-lounge.jpg'),
                                                       linear-gradient(160deg, #3a2410 0%, #1a1208 60%, #0a0604 100%); }
.theme-cigar .location-accent     { color: #c89a4a; }

.theme-counting                   { background-image: url('../bg/outside-06-counting-room.jpg'),
                                                       linear-gradient(160deg, #1a2418 0%, #0a1208 60%, #050805 100%); }
.theme-counting.mode-inside       { background-image: url('../bg/inside-06-counting-room.jpg'),
                                                       linear-gradient(160deg, #1a2418 0%, #0a1208 60%, #050805 100%); }
.theme-counting .location-accent  { color: #c8e890; }

.theme-sportsbook                 { background-image: url('../bg/outside-07-sportsbook.jpg'),
                                                       linear-gradient(160deg, #0a3520 0%, #051a10 60%, #020805 100%); }
.theme-sportsbook.mode-inside     { background-image: url('../bg/inside-07-sportsbook.jpg'),
                                                       linear-gradient(160deg, #0a3520 0%, #051a10 60%, #020805 100%); }
.theme-sportsbook .location-accent{ color: #4adc8a; }

.theme-diner                      { background-image: url('../bg/outside-08-diner.jpg'),
                                                       linear-gradient(160deg, #2a0a0a 0%, #100404 60%, #2a1a3a 100%); }
.theme-diner.mode-inside          { background-image: url('../bg/inside-08-diner.jpg'),
                                                       linear-gradient(160deg, #2a0a0a 0%, #100404 60%, #2a1a3a 100%); }
.theme-diner .location-accent     { color: #ff5a5a; }

.theme-koi                        { background-image: url('../bg/outside-09-koi-lounge.jpg'),
                                                       linear-gradient(160deg, #4a0a1a 0%, #1a0410 60%, #0a020a 100%); }
.theme-koi.mode-inside            { background-image: url('../bg/inside-09-koi-lounge.jpg'),
                                                       linear-gradient(160deg, #4a0a1a 0%, #1a0410 60%, #0a020a 100%); }
.theme-koi .location-accent       { color: #ff8aaa; }

.theme-chapel                     { background-image: url('../bg/outside-10-chapel.jpg'),
                                                       linear-gradient(160deg, #6a1a4a 0%, #2a0a2a 60%, #100410 100%); }
.theme-chapel.mode-inside         { background-image: url('../bg/inside-10-chapel.jpg'),
                                                       linear-gradient(160deg, #6a1a4a 0%, #2a0a2a 60%, #100410 100%); }
.theme-chapel .location-accent    { color: #ffb6e0; }

.theme-fight-pit                  { background-image: url('../bg/outside-11-fight-pit.jpg'),
                                                       linear-gradient(160deg, #2a0505 0%, #100202 60%, #050102 100%); }
.theme-fight-pit.mode-inside      { background-image: url('../bg/inside-11-fight-pit.jpg'),
                                                       linear-gradient(160deg, #2a0505 0%, #100202 60%, #050102 100%); }
.theme-fight-pit .location-accent { color: #ff3030; }

.theme-devils-lair                { background-image: url('../bg/outside-12-devils-lair.jpg'),
                                                       linear-gradient(160deg, #4a0a05 0%, #1a0202 50%, #2a0a3a 100%); }
.theme-devils-lair.mode-inside    { background-image: url('../bg/inside-12-devils-lair.jpg'),
                                                       linear-gradient(160deg, #4a0a05 0%, #1a0202 50%, #2a0a3a 100%); }
.theme-devils-lair .location-accent { color: #ff7d57; }

/* --- New story-specific locations --- */
.theme-gulf                       { background-image: url('../bg/outside-13-gulf.jpg'),
                                                       linear-gradient(180deg, #05282c 0%, #0a1a2a 55%, #020810 100%); }
.theme-gulf.mode-inside           { background-image: url('../bg/inside-13-gulf.jpg'),
                                                       linear-gradient(180deg, #05282c 0%, #0a1a2a 55%, #020810 100%); }
.theme-gulf .location-accent      { color: #9fe4d0; }

.theme-vault                      { background-image: url('../bg/outside-14-vault.jpg'),
                                                       linear-gradient(160deg, #1a2418 0%, #2a1a08 55%, #0a0805 100%); }
.theme-vault.mode-inside          { background-image: url('../bg/inside-14-vault.jpg'),
                                                       linear-gradient(160deg, #1a2418 0%, #2a1a08 55%, #0a0805 100%); }
.theme-vault .location-accent     { color: #d8c078; }

.theme-seance                     { background-image: url('../bg/outside-15-seance.jpg'),
                                                       linear-gradient(180deg, #30104a 0%, #1a0a2a 60%, #0a0410 100%); }
.theme-seance.mode-inside         { background-image: url('../bg/inside-15-seance.jpg'),
                                                       linear-gradient(180deg, #30104a 0%, #1a0a2a 60%, #0a0410 100%); }
.theme-seance .location-accent    { color: #e4a070; }

.theme-under-table                { background-image: url('../bg/outside-16-under-table.jpg'),
                                                       linear-gradient(180deg, #2a2418 0%, #1a2028 55%, #050810 100%); }
.theme-under-table.mode-inside    { background-image: url('../bg/inside-16-under-table.jpg'),
                                                       linear-gradient(180deg, #2a2418 0%, #1a2028 55%, #050810 100%); }
.theme-under-table .location-accent { color: #c8d8e8; }

.theme-racetrack                  { background-image: url('../bg/outside-17-racetrack.jpg'),
                                                       linear-gradient(180deg, #1a3020 0%, #2a2810 55%, #080504 100%); }
.theme-racetrack.mode-inside      { background-image: url('../bg/inside-17-racetrack.jpg'),
                                                       linear-gradient(180deg, #1a3020 0%, #2a2810 55%, #080504 100%); }
.theme-racetrack .location-accent { color: #d8b878; }

.theme-furrier                    { background-image: url('../bg/outside-18-furrier.jpg'),
                                                       linear-gradient(160deg, #3a2818 0%, #1a1208 55%, #0a0804 100%); }
.theme-furrier.mode-inside        { background-image: url('../bg/inside-18-furrier.jpg'),
                                                       linear-gradient(160deg, #3a2818 0%, #1a1208 55%, #0a0804 100%); }
.theme-furrier .location-accent   { color: #d8a868; }

.theme-print-shop                 { background-image: url('../bg/outside-19-print-shop.jpg'),
                                                       linear-gradient(180deg, #28201a 0%, #181208 55%, #050402 100%); }
.theme-print-shop.mode-inside     { background-image: url('../bg/inside-19-print-shop.jpg'),
                                                       linear-gradient(180deg, #28201a 0%, #181208 55%, #050402 100%); }
.theme-print-shop .location-accent { color: #c8a868; }

.theme-docks                      { background-image: url('../bg/outside-20-docks.jpg'),
                                                       linear-gradient(180deg, #0a1a2a 0%, #12202e 55%, #020810 100%); }
.theme-docks.mode-inside          { background-image: url('../bg/inside-20-docks.jpg'),
                                                       linear-gradient(180deg, #0a1a2a 0%, #12202e 55%, #020810 100%); }
.theme-docks .location-accent     { color: #a8c8e8; }

.theme-penthouse                  { background-image: url('../bg/outside-21-penthouse.jpg'),
                                                       linear-gradient(180deg, #0a0a14 0%, #100a1a 55%, #020204 100%); }
.theme-penthouse.mode-inside      { background-image: url('../bg/inside-21-penthouse.jpg'),
                                                       linear-gradient(180deg, #0a0a14 0%, #100a1a 55%, #020204 100%); }
.theme-penthouse .location-accent { color: #e8d470; }

.theme-archives                   { background-image: url('../bg/outside-22-archives.jpg'),
                                                       linear-gradient(160deg, #182818 0%, #2a1a08 55%, #0a0805 100%); }
.theme-archives.mode-inside       { background-image: url('../bg/inside-22-archives.jpg'),
                                                       linear-gradient(160deg, #182818 0%, #2a1a08 55%, #0a0805 100%); }
.theme-archives .location-accent  { color: #b8d478; }

/* --- Generic theme groups for the 28 expansion locations. Each one is
       applied to multiple locations; individual bg images ride on
       body.story-mode.location-X via --loc-bg-image in campaign-board.css.
       For the MAP THUMBNAIL (location header) these still use their own
       gradient fallback since we can't tie bg-image to this selector
       (no parent-aware CSS), so we skip the inside-*.jpg href here —
       the per-location story-node thumbnails in index render already
       use loc.bgOutside slugs directly. */
.theme-generic-ruby                  { background-image: linear-gradient(160deg, #440a12 0%, #200408 60%, #100204 100%); }
.theme-generic-ruby.mode-inside      { background-image: linear-gradient(160deg, #440a12 0%, #200408 60%, #100204 100%); }
.theme-generic-ruby .location-accent { color: #ff8090; }

.theme-generic-green                 { background-image: linear-gradient(160deg, #0a3018 0%, #041808 60%, #02100a 100%); }
.theme-generic-green.mode-inside     { background-image: linear-gradient(160deg, #0a3018 0%, #041808 60%, #02100a 100%); }
.theme-generic-green .location-accent{ color: #d0ff90; }

.theme-generic-rose                  { background-image: linear-gradient(160deg, #3a0818 0%, #200410 60%, #100208 100%); }
.theme-generic-rose.mode-inside      { background-image: linear-gradient(160deg, #3a0818 0%, #200410 60%, #100208 100%); }
.theme-generic-rose .location-accent { color: #ffb0c8; }

.theme-generic-jade                  { background-image: linear-gradient(160deg, #0a2820 0%, #041812 60%, #020808 100%); }
.theme-generic-jade.mode-inside      { background-image: linear-gradient(160deg, #0a2820 0%, #041812 60%, #020808 100%); }
.theme-generic-jade .location-accent { color: #a0ffcc; }

.theme-generic-steel                 { background-image: linear-gradient(160deg, #1a1e24 0%, #0c1014 60%, #050608 100%); }
.theme-generic-steel.mode-inside     { background-image: linear-gradient(160deg, #1a1e24 0%, #0c1014 60%, #050608 100%); }
.theme-generic-steel .location-accent{ color: #c0d0e0; }

.theme-generic-aqua                  { background-image: linear-gradient(180deg, #05282c 0%, #0a1a2a 55%, #020810 100%); }
.theme-generic-aqua.mode-inside      { background-image: linear-gradient(180deg, #05282c 0%, #0a1a2a 55%, #020810 100%); }
.theme-generic-aqua .location-accent { color: #c8ffe8; }

.theme-generic-amber                 { background-image: linear-gradient(160deg, #3a2008 0%, #1c1004 60%, #0a0602 100%); }
.theme-generic-amber.mode-inside     { background-image: linear-gradient(160deg, #3a2008 0%, #1c1004 60%, #0a0602 100%); }
.theme-generic-amber .location-accent{ color: #ffd080; }

.theme-generic-violet                { background-image: linear-gradient(180deg, #30104a 0%, #1a0a2a 60%, #0a0410 100%); }
.theme-generic-violet.mode-inside    { background-image: linear-gradient(180deg, #30104a 0%, #1a0a2a 60%, #0a0410 100%); }
.theme-generic-violet .location-accent { color: #e0a8ff; }

.story-node.theme-generic-ruby   { border-color: rgba(255,128,144,0.55); }
.story-node.theme-generic-green  { border-color: rgba(208,255,144,0.55); }
.story-node.theme-generic-rose   { border-color: rgba(255,176,200,0.55); }
.story-node.theme-generic-jade   { border-color: rgba(160,255,204,0.55); }
.story-node.theme-generic-steel  { border-color: rgba(192,208,224,0.55); }
.story-node.theme-generic-aqua   { border-color: rgba(200,255,232,0.55); }
.story-node.theme-generic-amber  { border-color: rgba(255,208,128,0.55); }
.story-node.theme-generic-violet { border-color: rgba(224,168,255,0.55); }

/* ===================================================================
 * Map / node graph
 * =================================================================== */
.story-header {
    text-align: center;
    /* Top padding clears the fixed nav row (LOBBY / SWITCH CHARACTER
       buttons sit at top:14px, ~36px tall) so the chapter title
       doesn't crash into them. */
    padding: 64px 16px 8px;
}
.story-header h1 {
    margin: 0 0 4px;
    /* h1 is the wrapper — the two child spans (.story-title-prefix
       and .story-title-main) carry the actual sizing. Each renders
       on its own line so the chapter prefix doesn't share a wrap
       boundary with the title and shift the block left. */
    display: block;
    text-align: center;
}
.story-title-prefix {
    display: block;
    font-family: 'Courier Prime', monospace;
    font-weight: 700;
    font-size: clamp(11px, 2.4vw, 14px);
    letter-spacing: 6px;
    color: rgba(212,175,55,0.78);
    line-height: 1.1;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    /* letter-spacing trailing pad compensation — same trick as the
       title below; keeps geometric center == visual center. */
    padding-left: 6px;
    margin-bottom: 4px;
}
.story-title-main {
    display: block;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(20px, 4.5vw, 44px);
    letter-spacing: 4px;
    color: var(--gold);
    line-height: 1.25;
    text-shadow: 0 2px 10px rgba(0,0,0,0.6);
    padding-left: 4px;
    overflow-wrap: break-word;
}
.story-header .sub {
    font-size: 12px;
    letter-spacing: 4px;
    color: var(--ash);
    text-transform: uppercase;
    padding-left: 4px;
}
/* Phones: shrink the title and tighten letter-spacing so the whole
   "CH.1 — THE VESTIBULE WAKES" fits on at most two lines instead of
   one word per line. */
@media (max-width: 480px) {
    .story-header { padding-top: 56px; }
    .story-header h1 {
        font-size: 19px;
        letter-spacing: 2px;
        padding-left: 2px;
    }
    .story-header .sub {
        letter-spacing: 2px;
        padding-left: 2px;
    }
}
/* Character-selection grid. Two modes:
 *   default (above the map): compact horizontal rows (not currently used —
 *     the post-pick view hides the picker entirely)
 *   .story-picker-fullscreen: the landing grid when a session starts — big
 *     portrait tiles arranged in a responsive grid, centered.
 */
.story-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    max-width: 1100px;
    margin: 16px auto;
    padding: 0 16px;
}
.story-picker-fullscreen {
    /* Wraps the bookbar + tile grid. NOT itself the tile grid anymore
       (the inner .story-pick-grid handles tile layout). Children must
       declare grid-column: 1 / -1 to span; the few children we have
       (.story-pick-bookbar, .story-pick-grid, ::before title) all do.
       This wrapper keeps a dark scrim under the picker so the busy
       campaign-bg behind it doesn't wash out the tile readability. */
    grid-template-columns: 1fr;
    justify-content: center;
    gap: 0;
    max-width: 1280px;
    margin: 40px auto;
    padding: 32px 24px 40px;
    /* Solid-ish backing rather than radial fade so the bottom of the
       picker (locked tiles) gets the same legibility as the top. */
    background:
        linear-gradient(180deg, rgba(8,6,12,0.92) 0%, rgba(8,6,12,0.86) 100%),
        radial-gradient(ellipse at top, rgba(40,30,18,0.5) 0%, transparent 70%);
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 16px;
    box-shadow: 0 18px 48px rgba(0,0,0,0.65);
}
/* Mobile: always at least 2 columns. Tiles shrink to fit. */
@media (max-width: 720px) {
    .story-picker-fullscreen {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-top: 60px;
        padding: 0 12px;
    }
    .story-picker-fullscreen .story-pick { padding: 12px; }
    .story-picker-fullscreen .story-pick-portrait {
        width: 110px;
        height: 110px;
    }
    .story-picker-fullscreen .story-pick-meta h3 {
        font-size: 15px;
        letter-spacing: 2px;
    }
    .story-picker-fullscreen .story-pick-sub {
        font-size: 11px;
        min-height: 0;
    }
    .story-picker-fullscreen .story-pick-btn {
        padding: 8px;
        font-size: 11px;
        letter-spacing: 2px;
    }
}
.story-picker-fullscreen::before {
    content: 'Choose your story';
    grid-column: 1 / -1;
    text-align: center;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(28px, 5vw, 48px);
    letter-spacing: 8px;
    color: var(--gold);
    text-shadow: 0 2px 10px rgba(0,0,0,0.7);
    margin-bottom: 12px;
}
.story-pick {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(180deg, rgba(28,28,28,0.85), rgba(8,8,8,0.95));
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 10px;
    transition: all 0.2s;
}
/* Fullscreen grid: switch each tile to vertical layout with big portrait. */
.story-picker-fullscreen .story-pick {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 18px;
    text-align: center;
    cursor: pointer;
}
.story-picker-fullscreen .story-pick:hover:not(.locked) {
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0,0,0,0.55), 0 0 16px rgba(212,175,55,0.25);
}
/* Locked tiles stay fully opaque — they're "mystery" cards with a solid
   background, not a faded version of the real tile. No transparency, no
   grayscale filter; the ? glyph + "???" title carries the meaning. */
.story-pick.locked {
    cursor: default;
    background: linear-gradient(180deg, rgba(18,18,18,0.95), rgba(6,6,6,1));
    border-color: rgba(80,80,80,0.5);
}
.story-pick.locked .story-pick-meta h3 { color: #888; letter-spacing: 6px; }
.story-pick-mystery {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 88px;
    color: rgba(212,175,55,0.5);
    text-shadow: 0 2px 6px rgba(0,0,0,0.85);
    background:
        radial-gradient(circle at center, rgba(40,36,24,0.85), rgba(6,4,0,1)) !important;
    border-color: rgba(120,100,60,0.6) !important;
}
.story-pick-portrait {
    width: 56px;
    height: 56px;
    object-fit: cover;
    object-position: center top;
    border-radius: 50%;
    border: 1px solid rgba(212,175,55,0.4);
    background: rgba(0,0,0,0.4);
    flex-shrink: 0;
}
.story-picker-fullscreen .story-pick-portrait {
    width: 180px;
    height: 180px;
    align-self: center;
    border-width: 2px;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
}
.story-pick-meta { flex: 1; min-width: 0; }
.story-picker-fullscreen .story-pick-meta { flex: 0; }
.story-pick-meta h3 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    color: var(--gold);
    letter-spacing: 1px;
}
.story-picker-fullscreen .story-pick-meta h3 {
    font-size: 22px;
    letter-spacing: 3px;
    margin-bottom: 4px;
}
.story-pick-sub {
    font-size: 11px;
    color: var(--ash);
    line-height: 1.3;
    margin-top: 2px;
}
.story-picker-fullscreen .story-pick-sub {
    font-size: 12px;
    line-height: 1.4;
    min-height: 42px;
}
.story-pick-btn {
    padding: 6px 12px;
    background: linear-gradient(180deg, var(--gold), #a88420);
    color: #0a0a0a;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    font-family: inherit;
}
.story-picker-fullscreen .story-pick-btn {
    padding: 12px;
    font-size: 13px;
    letter-spacing: 3px;
}
.story-pick-btn:disabled { opacity: 0.5; cursor: default; background: rgba(60,60,60,0.6); color: var(--ash); }

/* =====================================================================
   Book tabs — appear at the top of the story picker once Book 2 has
   any unlocked chapter. Until then, no tab bar shows; the picker is
   just Book 1's stories the way it always was.

   Both .story-pick-bookbar and .story-pick-grid live inside
   #story-picker, which is a grid container in fullscreen mode. They
   MUST span every column (grid-column: 1 / -1) — otherwise each one
   becomes a single 320px-wide grid cell and the layout collapses into
   a vertical strip on the left side of the screen.
   ===================================================================== */
.story-pick-bookbar {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 1100px;
    margin: 0 auto 22px auto;
    padding: 0 16px;
    flex-wrap: wrap;
}
.story-pick-booktab {
    flex: 0 1 auto;
    padding: 12px 28px;
    background: linear-gradient(180deg, rgba(28,28,28,0.92), rgba(10,10,10,0.96));
    border: 1px solid rgba(212,175,55,0.35);
    border-radius: 8px;
    color: var(--ash);
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}
.story-pick-booktab:hover { color: var(--gold); border-color: rgba(212,175,55,0.7); }
.story-pick-booktab.active {
    color: #0a0a0a;
    background: linear-gradient(180deg, var(--gold), #a88420);
    border-color: var(--gold);
    box-shadow: 0 0 14px rgba(212,175,55,0.45);
}

/* The grid wrapper holds the actual tile grid. ALSO must span all
   parent columns so it isn't squished into a single 320px cell. */
.story-pick-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 320px));
    justify-content: center;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}
@media (max-width: 720px) {
    .story-pick-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 0 12px;
    }
    .story-pick-bookbar { gap: 6px; padding: 0 10px; margin-bottom: 14px; }
    .story-pick-booktab { padding: 9px 14px; font-size: 11px; letter-spacing: 1.5px; }
}

/* Locked tiles — when the picker has lots of them (Book 2 mid-game has
   9 locked + 1 unlocked), the grid feels like a wall of question marks.
   De-emphasize locked tiles so the unlocked ones read as the primary
   action and the locks fade into background. */
.story-picker-fullscreen .story-pick.locked {
    opacity: 0.6;
    transform: scale(0.92);
}
.story-picker-fullscreen .story-pick.locked .story-pick-portrait {
    width: 100px;
    height: 100px;
    font-size: 56px;
}
.story-picker-fullscreen .story-pick.locked .story-pick-meta h3 {
    font-size: 16px;
    letter-spacing: 4px;
}
/* Mobile: lock to exactly 2 columns. Without this, the desktop auto-fit
   on a tablet-width viewport (or any phone where some ancestor is wider
   than the viewport) collapses to 3+ cols, then content overflows and
   forces the user to pinch-zoom. The same rule applies to the outer
   .story-picker wrapper which is itself a grid. */
@media (max-width: 720px) {
    .story-picker,
    .story-pick-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 0 10px;
        max-width: 100%;
    }
    .story-pick {
        flex-direction: column;
        text-align: center;
        padding: 10px;
        gap: 8px;
    }
    .story-pick-portrait {
        width: 84px;
        height: 84px;
        align-self: center;
    }
    .story-pick-meta h3 {
        font-size: 13px;
        letter-spacing: 1.5px;
    }
    .story-pick-sub {
        font-size: 10px;
        line-height: 1.35;
    }
    .story-pick-btn {
        font-size: 10px;
        padding: 7px 4px;
        letter-spacing: 1.5px;
    }
}

/* =====================================================================
   Completed stories — distinct visual so the player can see at a glance
   which chapters they've finished. Greyed-out portrait + "✓ COMPLETED"
   badge always visible. Replay button revealed on hover.
   ===================================================================== */
.story-pick.completed {
    border-color: rgba(120,200,120,0.45);
    background: linear-gradient(180deg, rgba(15,28,15,0.85), rgba(6,12,6,0.95));
    cursor: default;
}
.story-pick.completed .story-pick-portrait {
    filter: grayscale(0.55) brightness(0.85);
    border-color: rgba(120,200,120,0.55);
    transition: filter 0.2s;
}
.story-pick.completed:hover .story-pick-portrait {
    filter: grayscale(0) brightness(1);
}
.story-pick-completed-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}
.story-pick-completed-badge {
    padding: 6px 10px;
    background: linear-gradient(180deg, rgba(80,160,80,0.85), rgba(40,90,40,0.95));
    color: #f0fff0;
    text-align: center;
    font-size: 11px;
    letter-spacing: 2.5px;
    font-weight: 700;
    border-radius: 4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
/* The replay button is hidden by default and revealed when the user
   hovers the tile. Keeps the "completed" feel as the dominant message
   while still giving access to a fresh run. */
.story-pick-replay {
    background: transparent;
    border: 1px solid rgba(120,200,120,0.55);
    color: rgba(180,220,180,0.9);
    padding: 8px 12px;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s, transform 0.2s, color 0.2s, border-color 0.2s;
    pointer-events: none;
    font-family: inherit;
}
.story-pick.completed:hover .story-pick-replay {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.story-pick-replay:hover {
    color: var(--gold);
    border-color: var(--gold);
}

/* =====================================================================
   Closure banner — sits at the top of the story map when every node is
   cleared. Clean ending screen with explicit replay + back-to-picker
   actions, instead of the old wall of disabled "Cleared" tiles that
   read as a broken game.
   ===================================================================== */
.story-closure-banner {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 24px 28px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, rgba(20,40,20,0.92), rgba(8,18,8,0.96));
    border: 2px solid rgba(120,200,120,0.55);
    border-radius: 12px;
    box-shadow: 0 0 28px rgba(80,160,80,0.25), inset 0 0 22px rgba(40,90,40,0.18);
}
.story-closure-mark {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    color: #f0fff0;
    background: linear-gradient(180deg, rgba(80,180,80,0.95), rgba(40,110,40,1));
    border-radius: 50%;
    box-shadow: 0 0 18px rgba(80,180,80,0.6), inset 0 1px 4px rgba(255,255,255,0.25);
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
.story-closure-text { flex: 1; min-width: 0; }
.story-closure-text h2 {
    margin: 0 0 6px 0;
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    letter-spacing: 4px;
    color: #cfeacf;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    /* Don't lock each title word at min-content width — that's what
       caused "CH.1 — THE / VESTIBULE / WAKES — / COMPLETE" on phones.
       overflow-wrap break-word lets a single big word fit the column,
       and word-spacing/letter-spacing get scaled down at the mobile
       breakpoint below. */
    overflow-wrap: anywhere;
    line-height: 1.2;
}
.story-closure-text p {
    margin: 0;
    color: rgba(200,220,200,0.85);
    font-size: 13px;
    line-height: 1.5;
}
.story-closure-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

/* Mobile / narrow viewport — stack the banner vertically so the
   title row gets the FULL width instead of being squeezed between
   the ✓ medallion (64px) and the action buttons. Without this stack,
   on a 360px-wide phone the title column collapses to ~150px and
   every chapter-title word wraps onto its own line. */
@media (max-width: 720px) {
    .story-closure-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 18px 16px;
        text-align: center;
    }
    .story-closure-mark {
        align-self: center;
        width: 48px;
        height: 48px;
        font-size: 28px;
    }
    .story-closure-text h2 {
        font-size: 17px;
        letter-spacing: 1.5px;   /* much tighter so multi-word titles fit one line */
        line-height: 1.25;
    }
    .story-closure-text p {
        font-size: 12px;
    }
    .story-closure-actions {
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }
    .story-closure-btn {
        flex: 1;
        max-width: 180px;
        padding: 11px 12px;
        font-size: 11px;
        letter-spacing: 1.4px;
    }
}
.story-closure-btn {
    padding: 10px 22px;
    background: linear-gradient(180deg, rgba(80,180,80,0.95), rgba(40,110,40,1));
    color: #0a1a0a;
    border: 1px solid rgba(120,200,120,0.7);
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
}
.story-closure-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(80,180,80,0.35);
}
.story-closure-btn.ghost {
    background: transparent;
    color: rgba(200,220,200,0.85);
    border-color: rgba(120,200,120,0.4);
    font-weight: 500;
}
.story-closure-btn.ghost:hover {
    color: #cfeacf;
    border-color: rgba(120,200,120,0.85);
}

.story-map {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    max-width: 1100px;
    margin: 16px auto;
    padding: 0 16px;
}
.story-node {
    background: linear-gradient(180deg, rgba(20,20,20,0.85), rgba(8,8,8,0.95));
    border: 1px solid rgba(212,175,55,0.35);
    border-radius: 10px;
    padding: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.story-node-thumb {
    width: 100%;
    aspect-ratio: 16 / 7;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid rgba(212,175,55,0.3);
}
.story-node-body { padding: 14px 18px 16px; flex: 1; display: flex; flex-direction: column; }
.story-node-body button.enter { margin-top: auto; }
/* Per-location card border-glow uses the same accent color as the theme */
.story-node.theme-main-floor    { border-color: rgba(212,175,55,0.55); }
.story-node.theme-salon         { border-color: rgba(240,216,121,0.55); }
.story-node.theme-cabaret       { border-color: rgba(232,121,165,0.55); }
.story-node.theme-spa           { border-color: rgba(102,204,255,0.55); }
.story-node.theme-cigar         { border-color: rgba(200,154,74,0.55); }
.story-node.theme-counting      { border-color: rgba(200,232,144,0.55); }
.story-node.theme-sportsbook    { border-color: rgba(74,220,138,0.55); }
.story-node.theme-diner         { border-color: rgba(255,90,90,0.55); }
.story-node.theme-koi           { border-color: rgba(255,138,170,0.55); }
.story-node.theme-chapel        { border-color: rgba(255,182,224,0.55); }
.story-node.theme-fight-pit     { border-color: rgba(255,48,48,0.55); }
.story-node.theme-devils-lair   { border-color: rgba(255,125,87,0.65); box-shadow: 0 0 18px rgba(255,80,40,0.25); }
.story-node.theme-gulf          { border-color: rgba(159,228,208,0.55); }
.story-node.theme-vault         { border-color: rgba(216,192,120,0.55); }
.story-node.theme-seance        { border-color: rgba(228,160,112,0.55); }
.story-node.theme-under-table   { border-color: rgba(200,216,232,0.55); }
.story-node.theme-racetrack     { border-color: rgba(216,184,120,0.55); }
.story-node.theme-furrier       { border-color: rgba(216,168,104,0.55); }
.story-node.theme-print-shop    { border-color: rgba(200,168,104,0.55); }
.story-node.theme-docks         { border-color: rgba(168,200,232,0.55); }
.story-node.theme-penthouse     { border-color: rgba(232,212,112,0.55); }
.story-node.theme-archives      { border-color: rgba(184,212,120,0.55); }
/* Cleared and locked nodes both drop off the map. Cleared = already done,
   locked = the player hasn't earned the right to see it yet. Only available
   nodes are shown — the player makes a decision from a clean slate, not by
   reading a roadmap. */
.story-node.cleared { display: none; }
.story-node.locked { display: none; }
.story-node h3 {
    margin: 0 0 4px;
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    font-size: 18px;
    letter-spacing: 1.5px;
}
.story-node .loc { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--ash); margin-bottom: 6px; }
.story-node .flavor { font-size: 13px; font-style: italic; color: var(--ivory); margin-bottom: 12px; }
.story-node .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    color: var(--ash);
    margin-bottom: 12px;
}
.story-node .badge {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(212,175,55,0.12);
    border: 1px solid rgba(212,175,55,0.4);
    color: var(--gold-soft);
}
.story-node .badge.battle { background: rgba(208,48,48,0.12); border-color: rgba(208,48,48,0.5); color: #ff9090; }
.story-node .badge.dialogue { background: rgba(102,204,255,0.12); border-color: rgba(102,204,255,0.5); color: #9cdcff; }
.story-node .badge.choice { background: rgba(212,175,55,0.12); border-color: rgba(212,175,55,0.5); color: var(--gold); }
.story-node .badge.team { background: rgba(232,121,165,0.12); border-color: rgba(232,121,165,0.5); color: #ffaad0; }
.story-node button.enter {
    width: 100%;
    padding: 10px;
    background: linear-gradient(180deg, var(--gold), #a88420);
    color: #0a0a0a;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;
}
.story-node button.enter:hover { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); }
.story-node button.enter:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===================================================================
 * Dialogue overlay
 * =================================================================== */
.dlg-overlay {
    position: fixed;
    inset: 0;
    /* Light radial scrim — center darker for dialog-panel readability,
       edges nearly transparent so the location art (the divine venue bg
       set by setStageTheme on #campaign-bg) reads through clearly. */
    background: radial-gradient(ellipse at center,
        rgba(0,0,0,0.55) 0%,
        rgba(0,0,0,0.30) 45%,
        rgba(0,0,0,0.10) 100%);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.dlg-panel {
    width: 100%;
    max-width: 1180px;
    background: linear-gradient(180deg, rgba(28,28,32,0.96), rgba(8,8,12,0.98));
    border: 2px solid rgba(212,175,55,0.4);
    border-radius: 18px;
    box-shadow: 0 0 60px rgba(212,175,55,0.18), inset 0 0 40px rgba(0,0,0,0.6);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
@media (max-width: 720px) { .dlg-panel { padding: 14px; gap: 12px; border-radius: 14px; } }
.dlg-stage {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(212,175,55,0.26);
    background: linear-gradient(180deg, rgba(16,16,20,0.98), rgba(8,8,12,1));
    /* Inset shadow used to vignette corners at 0.45 black which combined
       with the scrim + brightness filter made the edges unreadable.
       Softer inset so corners still frame the scene without eating it. */
    box-shadow: inset 0 0 28px rgba(0,0,0,0.22), 0 10px 32px rgba(0,0,0,0.35);
}
.dlg-stage-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.dlg-portrait-scenery {
    object-fit: cover;
    object-position: center;
    /* No brightness dimming — show the scene at full fidelity. The
       corner inset on .dlg-stage still frames the edges. */
}
.dlg-portrait-narrator {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(45deg,
            rgba(255,255,255,0.025) 0 6px,
            rgba(255,255,255,0) 6px 14px),
        radial-gradient(ellipse at top, rgba(60,42,30,0.55), rgba(8,8,10,0.95));
}
.dlg-portrait-narrator::before {
    content: '✶';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 38px;
    color: rgba(212,175,55,0.4);
    text-shadow: 0 0 12px rgba(212,175,55,0.25);
}
.dlg-stage-scrim {
    /* Scrim removed — the JS still emits the element but it's invisible.
       Keeping the rule so the selector resolves cleanly; just no
       background at all. Corner inset on .dlg-stage does the framing. */
    position: absolute;
    inset: 0;
    background: none;
    z-index: 1;
    pointer-events: none;
}
.dlg-stage-floor {
    position: absolute;
    left: -12%;
    right: -12%;
    bottom: -8%;
    height: 32%;
    background: radial-gradient(ellipse at center, rgba(212,175,55,0.2), rgba(212,175,55,0) 68%);
    filter: blur(18px);
    z-index: 1;
}
.dlg-actor {
    position: absolute;
    bottom: 0;
    width: min(39%, 360px);
    height: 100%;
    padding: 0 0 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    z-index: 2;
    opacity: 0.44;
    filter: saturate(0.82) grayscale(0.08);
    transition: transform 0.18s ease, opacity 0.18s ease, filter 0.18s ease;
}
.dlg-actor-left { left: 2.5%; transform: translateY(8px) scale(0.93); }
.dlg-actor-right { right: 2.5%; transform: translateY(8px) scale(0.93); }
.dlg-actor-center {
    left: 50%;
    width: min(44%, 420px);
    transform: translate(-50%, 10px) scale(0.96);
}
.dlg-actor.is-active {
    opacity: 1;
    filter: none;
}
.dlg-actor-left.is-active,
.dlg-actor-right.is-active { transform: translateY(0) scale(1); }
.dlg-actor-center.is-active { transform: translate(-50%, 0) scale(1.02); }
.dlg-actor-glow {
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: 12px;
    height: 44px;
    border-radius: 999px;
    background: radial-gradient(ellipse at center, rgba(212,175,55,0.28), rgba(212,175,55,0) 70%);
    filter: blur(10px);
    pointer-events: none;
}
.dlg-actor-art,
.dlg-actor-placeholder,
.dlg-portrait {
    position: relative;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    object-position: center bottom;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    filter: drop-shadow(0 12px 28px rgba(0,0,0,0.48));
}
.dlg-actor-placeholder {
    aspect-ratio: 3 / 4;
    border-radius: 18px;
    background:
        radial-gradient(circle at 50% 28%, rgba(212,175,55,0.18), rgba(212,175,55,0) 32%),
        linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid rgba(212,175,55,0.26);
}
.dlg-nameplate {
    font-family: 'Playfair Display', serif;
    font-size: 17px;
    color: var(--gold);
    letter-spacing: 2px;
    text-align: center;
    padding: 7px 16px;
    background: rgba(8,8,12,0.68);
    border: 1px solid rgba(212,175,55,0.38);
    border-radius: 999px;
    backdrop-filter: blur(8px);
}
.dlg-actor-nameplate {
    position: relative;
    z-index: 1;
    margin-top: -10px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.28);
}
.dlg-nameplate-you {
    background: linear-gradient(180deg, rgba(60,90,40,0.75), rgba(30,50,20,0.9));
    border-color: rgba(156,255,87,0.55);
    color: #d8ffb0;
    box-shadow: 0 0 10px rgba(156,255,87,0.25);
}
.dlg-content-col { display: flex; flex-direction: column; gap: 12px; }
.dlg-bubble {
    background: linear-gradient(180deg, rgba(24,24,28,0.94), rgba(14,14,18,0.97));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 18px 20px 20px;
    min-height: 140px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.22);
}
.dlg-bubble-narrator {
    background: linear-gradient(180deg, rgba(20,22,26,0.94), rgba(12,12,16,0.98));
}
.dlg-bubble-head {
    min-height: 28px;
    margin-bottom: 12px;
}
.dlg-speaker-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(212,175,55,0.42);
    background: rgba(212,175,55,0.12);
    color: var(--gold-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.dlg-speaker-tag.is-you {
    border-color: rgba(156,255,87,0.56);
    background: rgba(95,155,54,0.18);
    color: #d8ffb0;
}
.dlg-speaker-tag.is-narrator {
    border-color: rgba(160,190,255,0.36);
    background: rgba(120,140,200,0.14);
    color: #d3dffb;
}
.dlg-bubble-text {
    font-size: 18px;
    line-height: 1.6;
    color: var(--ivory);
}
.dlg-choices { display: flex; flex-direction: column; gap: 8px; }
.dlg-choice {
    text-align: left;
    padding: 14px 18px;
    background: linear-gradient(180deg, rgba(40,40,40,0.7), rgba(20,20,20,0.85));
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 6px;
    color: var(--ivory);
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.dlg-choice:hover {
    background: linear-gradient(180deg, rgba(60,60,60,0.85), rgba(30,30,30,0.95));
    border-color: var(--gold);
    color: var(--gold-soft);
}
.dlg-choice.dlg-continue {
    text-align: center;
    color: var(--gold);
    background: linear-gradient(180deg, rgba(212,175,55,0.18), rgba(120,90,20,0.3));
}
@media (max-width: 720px) {
    .dlg-stage { min-height: 300px; }
    .dlg-actor { width: min(46%, 240px); }
    .dlg-actor-center { width: min(58%, 280px); }
    .dlg-actor-art,
    .dlg-actor-placeholder,
    .dlg-portrait { max-height: 248px; }
    .dlg-nameplate { font-size: 14px; letter-spacing: 1.5px; padding: 6px 12px; }
    .dlg-bubble { padding: 16px; min-height: 0; }
    .dlg-bubble-text { font-size: 16px; }
    .dlg-choice { font-size: 13px; padding: 12px 14px; }
}

/* ===================================================================
 * Choice overlay
 * =================================================================== */
.choice-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 100;
    display: flex;
    /* `safe center` falls back to flex-start when content overflows the
     * cross-axis — keeps tall panels scrollable on mobile instead of
     * clipping the top above the viewport. */
    align-items: safe center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.choice-panel {
    width: 100%;
    max-width: 980px;
    background: linear-gradient(180deg, rgba(28,28,32,0.96), rgba(8,8,12,0.98));
    border: 2px solid rgba(212,175,55,0.4);
    border-radius: 14px;
    padding: 28px;
    /* Cap to viewport height so the option grid scrolls inside the panel
     * and the confirm button below it never falls off-screen. Flex column
     * lets the grid take leftover space and pin the footer. */
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    display: flex;
    flex-direction: column;
}
.choice-head { text-align: center; margin-bottom: 20px; flex-shrink: 0; }
.choice-title { font-family: 'Playfair Display', serif; font-size: 26px; color: var(--gold); margin: 0 0 6px; letter-spacing: 3px; }
.choice-subtitle { color: var(--ash); font-size: 14px; margin-bottom: 8px; }
.choice-counter { font-size: 12px; letter-spacing: 2px; color: var(--gold-soft); text-transform: uppercase; }
.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
    /* Take the leftover space in the panel's flex column. min-height: 0
     * is the flex-child fix that lets overflow:auto actually take effect. */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.choice-card {
    text-align: left;
    padding: 18px;
    background: linear-gradient(180deg, rgba(40,40,40,0.7), rgba(20,20,20,0.85));
    border: 2px solid rgba(212,175,55,0.3);
    border-radius: 8px;
    color: var(--ivory);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.choice-card:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212,175,55,0.2);
}
.choice-card.picked {
    border-color: #9cff57;
    background: linear-gradient(180deg, rgba(60,120,40,0.4), rgba(30,60,20,0.6));
    box-shadow: 0 0 20px rgba(156,255,87,0.3);
}
.choice-card-label { font-family: 'Playfair Display', serif; font-size: 18px; color: var(--gold); margin-bottom: 6px; letter-spacing: 1.5px; }
.choice-card-canonical {
    font-family: 'Courier Prime', monospace;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ash);
    opacity: 0.8;
    margin-left: 6px;
    font-weight: normal;
    vertical-align: middle;
}
.choice-card-flavor { font-size: 13px; color: var(--ivory); margin-bottom: 8px; font-style: italic; }
.choice-card-rule { font-size: 12px; color: var(--ash); }
.choice-footer {
    text-align: center;
    /* Pin the footer at the bottom of the panel's flex column — it never
     * shrinks and is always visible no matter how tall the option grid is. */
    flex-shrink: 0;
    padding-top: 14px;
    border-top: 1px solid rgba(212,175,55,0.18);
}
.choice-confirm {
    padding: 12px 32px;
    background: linear-gradient(180deg, var(--gold), #a88420);
    color: #0a0a0a;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.choice-confirm:disabled { opacity: 0.4; cursor: not-allowed; }

/* Mobile tightening — single column, smaller paddings, tighter buttons. */
@media (max-width: 600px) {
    .choice-overlay { padding: 8px; }
    .choice-panel {
        padding: 16px 14px;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
    }
    .choice-head { margin-bottom: 14px; }
    .choice-title { font-size: 20px; letter-spacing: 2px; }
    .choice-subtitle { font-size: 13px; }
    .choice-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 14px;
    }
    .choice-card { padding: 12px 14px; }
    .choice-card-label { font-size: 16px; margin-bottom: 4px; }
    .choice-card-flavor { font-size: 12px; margin-bottom: 6px; }
    .choice-card-rule { font-size: 11px; }
    .choice-footer { padding-top: 10px; }
    .choice-confirm { padding: 10px 22px; font-size: 12px; letter-spacing: 2px; }
}
