/*
 * Clans — board skin.
 *
 * The board is laid out in its OWN pixel space (board.jpg, 1890x1260) exactly like
 * games/Ra: every piece is positioned as a percentage of that native size, so one
 * width on #board scales the whole thing and nothing has to be re-measured. Numbers
 * that come out of board_model.json are native pixels and go straight in.
 */

/* Caesar Dressing (Open Window, SIL OFL 1.1 -- fonts/OFL.txt): hewn capitals with chipped
   sides, the nearest a typeface comes to the cover's own hand-cut CLANS. The WHOLE game is set
   in it -- buttons, the log, player names, the scores (user, 2026-10-20: "the same stone age
   font throughout the complete game"; until then the UI was Fredoka). It has one weight, so
   faux bold is off: a 700 smeared its chipped edges. It carries every letter and digit the
   five languages use. */
@font-face {
    font-family: 'Caesar Dressing';
    src: url('fonts/caesar-dressing.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
/* ITS DIGITS ARE TOO STYLISED TO READ: its 8 is a cross (an X), its 3 and 5 hooks (user,
   2026-11-06: "sometimes it is hard to read, e.g. the number 8"). So 0-9 alone come from Grenze
   SemiBold (Omnibus-Type, SIL OFL 1.1 -- fonts/OFL-grenze.txt), a cut serif of the same weight:
   a 3.5 KB subset of just the ten digits, put in front of Caesar by unicode-range, so every
   letter stays Caesar and only the numbers change. size-adjust lifts them to Caesar's caps. */
@font-face {
    font-family: 'Clans Digits';
    src: url('fonts/grenze-digits.woff2') format('woff2');
    unicode-range: U+0030-0039;
    size-adjust: 108%;
    font-weight: 400; font-style: normal; font-display: swap;
}
/* ...and Grenze's 0 is a short narrow oval, read as an o (user, 2026-11-06: "a 0 is also hard
   to read. make it rounder"). The 0 alone comes from Cinzel Black (Natanael Gama, SIL OFL 1.1
   -- fonts/OFL-cinzel.txt): a round zero, sized down to stand as tall as Grenze's 1 and 8. */
@font-face {
    font-family: 'Clans Zero';
    src: url('fonts/cinzel-zero.woff2') format('woff2');
    unicode-range: U+0030;
    size-adjust: 86%;
    font-weight: 400; font-style: normal; font-display: swap;
}
/* RUNNING TEXT in the rulebook (user, 2026-11-16: "change the font in the rules page to a better
   readable one"): Caesar's chipped capitals are a display face, tiring over paragraphs. The rule
   text is Alegreya Sans (Huerta Tipografica, SIL OFL 1.1 -- fonts/OFL-alegreya-sans.txt), a warm
   humanist sans, shipped locally (latin subset, every letter the five languages use) so the app
   reads it offline. Headings, chapter titles and the epoch numerals stay in the carved face. */
@font-face {
    font-family: 'Clans Text';
    src: url('fonts/alegreya-sans-400.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Clans Text';
    src: url('fonts/alegreya-sans-700.woff2') format('woff2');
    font-weight: 600 700; font-style: normal; font-display: swap;
}

/* ══ Skin: CARVED STONE AND CAVE OCHRE ═══════════════════════════════════════════
 * User direction 2026-10-01: "a stone age theme, so make all screens and elements look like
 * it". Every surface the game draws is a slab of the same warm stone -- the start card, the
 * dialogs, the docked panels, the HUD plates -- and the one colour on it is the brick red of
 * the cover's wordmark, which is what red ochre on rock looks like. The board stays the
 * brightest thing on screen; the stone is the dark that surrounds it.
 *
 * The accent is still the wordmark's red (sampled rgb(117,52,45), lifted for legibility);
 * the highland green of the painting tints the table. */
:root {
    --dk-accent:      #b8503f;                      /* the wordmark's brick red */
    --dk-accent-soft: rgba(184, 80, 63, 0.35);
    --dk-tint:        rgba(122, 132, 52, 0.30);     /* the highland green over the felt */
    --dk-font-display: 'Clans Zero', 'Clans Digits', 'Caesar Dressing', 'Cormorant Garamond', Georgia, serif;
    --dk-font-ui: var(--dk-font-display);

    /* ── the stone (registered as clans-*) ───────────────────────────────────────
       Three layers, all WARM ALPHA rather than grey at low opacity (the Joan lesson: a grey
       grain greys the surface it lies on). Grit at 190px, a scatter of pale quartz flecks in
       the same tile, and a 1200px mottle so one slab is never evenly coloured. The mottle tile is
       larger than any slab it lies on: at 560px its edges showed as hard rectangles across the
       start card (critique 2026-10-16). */
    --clans-stone-hi:  #564b41;
    --clans-stone:     #433a32;
    --clans-stone-lo:  #2d2621;
    --clans-hollow:    #231d19;                     /* a hollow cut into the stone: fields */
    --clans-bone:      #efe4cf;                     /* chalk / bone ink */
    --clans-bone-dim:  rgba(239, 228, 207, 0.66);
    --clans-chisel:    rgba(14, 10, 7, 0.62);       /* the cut edge of a slab */
    --clans-grit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='190' height='190'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .07 0 0 0 0 .05 0 0 0 0 .03 0 0 0 1.25 -.5'/%3E%3C/filter%3E%3Cfilter id='q'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='1' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .94 0 0 0 0 .84 0 0 0 2.2 -1.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3Crect width='100%25' height='100%25' filter='url(%23q)' opacity='.55'/%3E%3C/svg%3E");
    --clans-mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='1200'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.008' numOctaves='3' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .07 0 0 0 0 .04 0 0 0 1.5 -.55'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
    --clans-slab:
        var(--clans-grit) 0 0 / 190px 190px,
        var(--clans-mottle) var(--grain-x, 0) var(--grain-y, 0) / 1200px 1200px,
        radial-gradient(130% 90% at 28% 0%, rgba(255, 232, 196, 0.10), transparent 62%),
        linear-gradient(180deg, var(--clans-stone-hi), var(--clans-stone) 46%, var(--clans-stone-lo));
    /* A slab is hewn, not machined: no two corners alike. */
    --clans-hewn:      13px 7px 15px 6px / 8px 13px 7px 14px;
    --clans-hewn-sm:   8px 5px 9px 4px / 5px 8px 4px 9px;
    /* Lit lip along the top, a darker foot, the handled edge, then the cast. */
    --clans-slab-depth:
        inset 0 1px 0 rgba(255, 236, 206, 0.16),
        inset 0 -2px 0 rgba(0, 0, 0, 0.32),
        inset 0 0 22px rgba(10, 6, 2, 0.42);

    /* ── the chrome, re-tinted from violet to stone (documented tokens only) ───── */
    --dk-panel:        var(--clans-slab);
    --dk-panel-line:   var(--clans-chisel);
    --dk-panel-text:   var(--clans-bone);
    --dk-panel-dim:    var(--clans-bone-dim);
    --dk-panel-shadow: var(--clans-slab-depth), 0 10px 28px rgba(0, 0, 0, 0.6);
    /* The two stops come first and are stone too: a shared sheet older than --dk-dialog-bg
       (a deploy that missed core/deckades.css -- it happened, 2026-10-01) still paints the
       dialogs from these, and they used to fall through to the house violet. */
    --dk-dialog-top:    var(--clans-stone-hi);
    --dk-dialog-bottom: var(--clans-stone-lo);
    --dk-dialog-bg:     var(--clans-slab);
    --dk-dialog-radius: 15px 9px 17px 8px / 10px 15px 9px 16px;
    --dk-dialog-line:   var(--clans-chisel);
    --dk-scrim:         rgba(10, 7, 4, 0.78);
    --dk-field-bg:      var(--clans-hollow);
    --dk-field-line:    rgba(0, 0, 0, 0.55);
    --dk-header-bg:     linear-gradient(180deg, rgba(16, 11, 7, 0.94), rgba(16, 11, 7, 0.66) 80%, rgba(16, 11, 7, 0));
    --dk-header-line:   rgba(184, 80, 63, 0.22);
    --dk-logo:          rgba(239, 228, 207, 0.45);
    --dk-logo-hover:    rgba(239, 228, 207, 0.92);
    --dk-spade:         rgba(184, 80, 63, 0.7);
    --dk-spade-hover:   #d4654f;
    --dk-tool-ring:       rgba(239, 228, 207, 0.26);
    --dk-tool-ink:        rgba(239, 228, 207, 0.82);
    --dk-tool-wash:       rgba(184, 80, 63, 0.22);
    --dk-tool-ink-hover:  #fff6e6;
    --dk-tool-ring-hover: #b8503f;
    --dk-ai-bg:           rgba(22, 16, 11, 0.7);
    --dk-ai-ink:          rgba(239, 228, 207, 0.72);
    --dk-popup-line:      var(--clans-chisel);
    --dk-popup-close:     rgba(239, 228, 207, 0.75);
    --dk-scroll-thumb:    rgba(239, 228, 207, 0.22);

    /* ── the start screen: a standing stone on the cover's hillside ─────────────── */
    /* The cave wall's top band carries the carved title (the film's last frame), so the scrim
       leaves it clear and only darkens the rock the card stands on. */
    --dk-start-scrim:   linear-gradient(180deg, rgba(12, 8, 4, 0) 0%, rgba(12, 8, 4, 0) 24%, rgba(12, 8, 4, 0.34) 48%, rgba(12, 8, 4, 0.55) 100%);
    --dk-start-blur:    none;               /* the painting stays sharp: it is the place */
    --dk-start-surface: var(--clans-slab);
    --dk-start-edge:    var(--clans-chisel);
    --dk-start-radius:  var(--clans-hewn);
    --dk-start-glow:    var(--clans-slab-depth), 0 4px 0 rgba(12, 8, 4, 0.55), 0 22px 46px rgba(0, 0, 0, 0.72);
    --dk-start-pad:        34px 32px 40px;
    --dk-start-pad-narrow: 30px 20px 34px;
    --dk-start-ink:      var(--clans-bone);
    --dk-start-ink-dim:  #d6c8ae;
    --dk-start-ink-soft: #e6dac4;
    --dk-start-ink-fade: #d0c3a7;      /* the win line: was #bfb096, the faintest text on the card */
    --dk-start-title-shadow: none;
    --dk-start-play-ink: #fff8ec;
    --dk-start-field:      var(--clans-hollow);
    --dk-start-field-edge: rgba(0, 0, 0, 0.6);
    --dk-start-field-ink:  var(--clans-bone);
    --dk-start-lang-on:    var(--clans-bone);
    --dk-start-focus:        2px solid var(--clans-bone);
    --dk-start-focus-offset: 3px;
    /* The controls are carved too (critique 2026-10-02: "only the box is stone"). Play is a
       hewn plate of red ochre with grit, a lit lip and a short hard foot, so it presses; the
       selects are hollows cut into the slab. */
    --dk-start-play-bg:
        var(--clans-grit) 0 0 / 190px 190px,
        linear-gradient(180deg, #b9503e, #983d31);       /* #fff8ec on it: >= 4.9:1 */
    --dk-start-play-radius:  var(--clans-hewn-sm);
    --dk-start-play-shadow:
        inset 0 1px 0 rgba(255, 220, 190, .28),
        inset 0 -2px 0 rgba(60, 18, 10, .35),
        0 3px 0 rgba(60, 20, 12, .7),
        0 7px 12px rgba(0, 0, 0, .45);
    --dk-start-secondary-edge: rgba(239, 228, 207, .52);   /* was .34: 2.4:1, now over 3:1 */
    --dk-start-play-press-move:   translateY(2px);
    --dk-start-play-press-shadow: inset 0 1px 0 rgba(255, 220, 190, .2), 0 1px 0 rgba(60, 20, 12, .7);
    /* --dk-start-lang-h stays the shared 32px: at 44 the 44px-wide flag was a square (user,
       2026-10-03: "the language flag must not be square") */
    --dk-start-hint-short:   block;      /* the hint here IS the win condition: keep it on phones */
}

::selection { background: rgba(184, 80, 63, 0.55); color: #fff8ec; }

:root {
    --clans-board-w: 1890;      /* board.jpg native size — keep in sync with */
    --clans-board-h: 1260;      /* board_model.json image_size               */

    /* The camera strips at the sides. Every lane rule reads these, never env() itself:
       game.js (cameraInsetFallback) puts a strip in when an iPhone gives the page the whole
       screen but reports none (iPhone 13, iOS 26.6.2: the score rail sat under the notch,
       user 2026-10-20). */
    --clans-sa-l: env(safe-area-inset-left, 0px);
    --clans-sa-r: env(safe-area-inset-right, 0px);

    /* Clan colours. Same five as gfx/hut_*.svg; the scoring disks are drawn from
       these so a disk and its huts are unmistakably the same clan. */
    --clan-red:    #c8302c;
    --clan-blue:   #2f5fbf;
    --clan-green:  #2f8f43;
    --clan-yellow: #e0aa1c;
    --clan-black:  #3a3842;

    /* The HUD is EMPTY until the clan reveal is dismissed and then fills with text. Left to
       size itself it grows at that moment, the stage shrinks, and the whole board jumps
       upward mid-game. Its height is fixed here and subtracted from the board's height
       budget below, so the board is the same size before and after. */
    --clans-gap:    12px;
    --clans-pad:    14px;
    --clans-col:    244px;      /* both side columns — fixed, so the board never resizes */
    /* The backdrop is the intro film's LAST FRAME (gfx/cave-menu.webp, videos/clans-cave): the
       torch-lit wall with the designer and CLANS carved at its top. Covering the window from
       the top edge keeps the title in view on any shape of screen; the publisher's cover is
       out of the game for the time being (art.js). */
    --clans-backdrop: url('gfx/cave-menu.webp');
    /* In play the same wall WITHOUT the carved designer and CLANS (user, 2026-10-20): the film's
       last frame shot with ?notitle (videos/clans-cave/paint.js). */
    --clans-backdrop-play: url('gfx/cave-play.webp');
    --clans-land:   cover;
}

html, body { height: 100%; }
html { font-synthesis: none; }
/* Not the shared sheet's `touch-action: manipulation` on the root (deckades.css, 2026-10-12):
   in the iOS app (build 2) every tap's click then came about ten seconds late on an iPhone 12
   mini -- Play, the back chip, everything. The buttons that need it carry it themselves. */
html, body { touch-action: auto; }

/* The fallback colour goes on <html>, NOT on <body>. body::before carries the cover at a
   NEGATIVE z-index, and a negative-z child paints above the CANVAS background but below its
   own parent's — an opaque `body { background }` hides the artwork completely. So the felt
   only goes on the body once a game is running, which is also when we want it. */
html { background: #120d09; }

/* The cover is the background DURING PLAY too, not only behind the start screen.
 *
 * Worth being explicit: deckades.css says the shared felt at games/table.avif is the table
 * in every game and that a per-game cover belongs behind the start screen only — this is a
 * deliberate departure from that, asked for twice. The recipe is otherwise --dk-table's,
 * with the cover swapped in for the felt photo, so the tint and the darkening layers behave
 * exactly as everywhere else. Reverting is one line: `background: var(--dk-table)`. */
body.playing {
    background:
        radial-gradient(ellipse at 50% 40%, var(--dk-tint), transparent 68%),
        linear-gradient(rgba(22, 15, 9, 0.76), rgba(14, 10, 6, 0.88)),
        var(--clans-backdrop-play) center top / var(--clans-land) no-repeat fixed;
}
body {
    margin: 0;
    font-family: var(--dk-font-ui);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* the header is fixed at --dk-header-h, so the board starts below it */
    padding: calc(var(--dk-header-h) + var(--clans-pad)) var(--clans-pad) var(--clans-pad);
    box-sizing: border-box;
}

/* A GRID, not a flex row. As a row the board took `min(100%, ...)` of the whole stage, so on
   any window narrower than about 1700px it ate both side columns' width and pushed them off
   the screen -- the player's own clan was hanging off the left edge. The board's width is
   now what is LEFT after the columns, or what the height allows, whichever is smaller. */
#stage {
    position: relative; z-index: 2;      /* above the cover pseudo-elements */
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    /* every player on the right, yours on top (user, 2026-11-06: "always put all players on
       the right, the human player on top") -- on the widest desk too, not only below 1640px */
    grid-template-columns: auto var(--clans-col);
    grid-template-areas: "board mine" "board side";
    grid-template-rows: 1fr 1fr;
    align-items: center;
    justify-content: center;
    gap: var(--clans-gap);
    width: 100%;
    --clans-room-w: calc(100vw - 2 * var(--clans-pad) - var(--clans-col) - var(--clans-gap));
    --clans-room-h: calc(100dvh - var(--dk-header-h) - 2 * var(--clans-pad));
}
#mine  { grid-area: mine; align-self: end; }
#board { grid-area: board; }
#side  { grid-area: side; align-self: start; }

#board {
    position: relative;
    aspect-ratio: var(--clans-board-w) / var(--clans-board-h);
    width: min(calc(var(--clans-room-w) - var(--clans-lane-x, 0px)),
               calc((var(--clans-room-h) - var(--clans-lane-y, 0px)) * var(--clans-board-w) / var(--clans-board-h)));
    /* the board's own frame: a dark stone lip round the printed edge */
    border-radius: 6px;

    /* NOT overflow:hidden — a claimed chip flies out of the board to a side panel, and
       clipping it at the edge is exactly the moment you want to see. */
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.35), 0 14px 44px rgba(0, 0, 0, 0.6);
}
/* The board art is bright, saturated and busy in every direction — a yellow hut on steppe
   or a black one on forest gets lost in it. Knock the artwork back so the PIECES are the
   high-contrast thing on screen; the map stays perfectly readable, it just stops
   competing. Only the image is dimmed, never #pieces. */
#board-img {
    display: block; width: 100%; height: 100%;
    user-select: none;
    filter: brightness(0.74) saturate(0.88);
}

#pieces { position: absolute; inset: 0; pointer-events: none; }

/* ── zoom (zoom.js) ───────────────────────────────────────────────────────────
   Two fingers zoom the board, one pans it. The page itself never pinches or scrolls under
   the board -- #areas already said so for drags, the image and the credit say it too. While
   zoomed the board is cut back to its own box (an inline clip-path), so the frame's shadow
   would only show as a hard edge inside the clip: it steps out until the board is whole. */
#board { touch-action: none; }
#board.zoomed { box-shadow: none; }
#stage.board-zoomed { overflow: clip; }
#board-unzoom {
    position: absolute; z-index: 40;
    width: 44px; height: 44px; padding: 0;
    transform: translateX(-100%);              /* left/top are the frame's top-RIGHT corner */
    display: grid; place-items: center;
    background: rgba(28, 20, 13, .82);
    border: 1px solid rgba(239, 228, 207, .42);
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .5);
    color: var(--clans-bone);
    cursor: pointer; touch-action: manipulation;
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
}
#board-unzoom.show { opacity: 1; pointer-events: auto; }
#board-unzoom svg {
    width: 24px; height: 24px;
    fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round;
}
#board-unzoom:focus-visible { outline: 2px solid var(--clans-bone); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { #board-unzoom { transition: none; } }

/* ── huts ─────────────────────────────────────────────────────────────────────
   Sized off the board WIDTH (cqw) so a hut keeps its proportion to the terrain
   underneath it at every scale. */
#board { container-type: inline-size; }

.hut {
    position: absolute;
    width: 2.7cqw;
    /* The piece is wider than it is tall (190x167 from the tile), so the anchor sits lower
       than it did on the old cone — this puts the hut's FOOT on the area's point. */
    transform: translate(-50%, -80%);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

/* ── bonus chips, on the epoch chart's centre column ──────────────────────────
   One per printed circle: 4/3/2/2/1 for epochs I-V. */
.chip {
    position: absolute;
    width: 2.35cqw;
    aspect-ratio: 1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background:
        radial-gradient(circle at 36% 30%, #fff, #f2efe6 62%, #d8d2c2 100%);
    border: 0.12cqw solid rgba(90, 70, 40, 0.55);
    box-shadow: 0 0.16cqw 0.3cqw rgba(0, 0, 0, 0.45);
}

/* ── villages: a wall, a fire, ruins ──────────────────────────────────────────
   A founded village is ringed by sharpened stakes (board.js palisade()), the back half under
   the huts and the front half over them. Favourable terrain adds a fire with meat on a spit;
   hostile terrain breaks the wall and leaves the huts as ruins. Wood, not chrome: the
   stakes are the same warm brown as the huts' own timber. */
.palisade {
    position: absolute;
    overflow: visible;
    pointer-events: none;
    filter: drop-shadow(0 0.08cqw 0.12cqw rgba(0, 0, 0, .55));
}
/* Dark timber: each pole is a round-shaded gradient (board.js #clans-wood) with a grain
   split and a knot, and the lashing is a dark rope -- darker than the huts' thatch so the
   wall frames the village instead of competing with it. */
.palisade .pal-pole {
    fill: url(#clans-wood);
    stroke: #1c1008; stroke-width: 1.3; stroke-linejoin: round;
}
.palisade .pal-grain { fill: none; stroke: rgba(20, 10, 4, .55); stroke-width: .9; stroke-linecap: round; }
.palisade .pal-dust { fill: rgba(214, 190, 150, .8); stroke: none; }
.palisade .pal-rail { fill: none; stroke: #8a6236; stroke-width: 2.2; stroke-linecap: round; }
.palisade.golden .pal-rail { stroke: #f2c14e; stroke-width: 2.8; }
.palisade.broken .pal-pole { fill: url(#clans-wood-burnt); stroke: #0c0805; }


/* A bonus village: the ground inside the wall glows like a ripe field (under the back wall
   and the huts), and a carved ochre +N at the gate says what the terrain paid. */
.fertile {
    position: absolute;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(255, 220, 110, .9), rgba(246, 190, 70, .62) 55%, rgba(240, 180, 60, 0));
    z-index: 18;
    pointer-events: none;
}
.bonus-tag {
    position: absolute;
    transform: translate(-50%, -50%);
    padding: .08em .38em .02em;
    font-family: var(--dk-font-display);
    font-weight: 700; line-height: 1;
    color: #ffe08a;
    background: linear-gradient(180deg, var(--clans-stone-hi), var(--clans-stone-lo));
    border: 1px solid rgba(255, 210, 120, .7);
    border-radius: var(--clans-hewn-sm);
    box-shadow: 0 .1em .25em rgba(0, 0, 0, .65);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .6);
    z-index: 49;
    pointer-events: none;
}

/* ...and meat turning over a campfire beside the wall. Three flame layers flicker out of
   step (a scale about their base, never a position change) and embers drift up and fade;
   all of it holds still under reduced motion. */
.campfire {
    position: absolute;
    transform: translate(-50%, -100%);
    filter: drop-shadow(0 0.1cqw 0.15cqw rgba(0, 0, 0, .5));
    pointer-events: none;
}
.campfire svg { display: block; width: 100%; height: auto; overflow: visible; }
.campfire .cf-glow  { fill: rgba(255, 170, 60, .45); }
.campfire .cf-stick { fill: none; stroke: #3a230f; stroke-width: 1.8; stroke-linecap: round; }
.campfire .cf-log   { fill: none; stroke: #4a2c14; stroke-width: 3.2; stroke-linecap: round; }
.campfire .cf-spit  { stroke: #5a3a1c; stroke-width: 1.4; stroke-linecap: round; }
.campfire .cf-meat  { fill: #9a3f1f; stroke: #4a1a0a; stroke-width: 1; }
.campfire .cf-sear  { fill: none; stroke: #d2793f; stroke-width: 1; stroke-linecap: round; }
.campfire .cf-bone  { fill: none; stroke: #efe4cf; stroke-width: 1.6; stroke-linecap: round; }
.campfire .cf-outer { fill: #f08a24; }
.campfire .cf-mid   { fill: #ffb43c; }
.campfire .cf-inner { fill: #fff0a0; }
.campfire .cf-flame { transform-box: fill-box; transform-origin: 50% 100%;
                      animation: cf-flicker 1.1s ease-in-out infinite alternate; }
.campfire .cf-flame-b { animation-duration: .8s; animation-delay: -.3s; }
.campfire .cf-flame-c { animation-duration: .6s; animation-delay: -.5s; }
@keyframes cf-flicker {
    0%   { transform: scale(1, 1); }
    35%  { transform: scale(.9, 1.12) skewX(-4deg); }
    70%  { transform: scale(1.06, .92) skewX(3deg); }
    100% { transform: scale(.96, 1.06) skewX(-1deg); }
}
.campfire .cf-ember { fill: #ffcf5a; transform-box: fill-box; transform-origin: center;
                      animation: cf-ember 1.9s ease-out infinite; opacity: 0; }
.campfire .cf-ember-b { animation-delay: -.7s; animation-duration: 2.3s; }
.campfire .cf-ember-c { animation-delay: -1.3s; animation-duration: 1.6s; }
@keyframes cf-ember {
    0%   { transform: translate(0, 0); opacity: 0; }
    15%  { opacity: 1; }
    100% { transform: translate(2.5px, -11px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .campfire .cf-flame { animation: none; }
    .campfire .cf-ember { animation: none; opacity: 0; }
}

/* A village founded on hostile terrain: its huts are ruins -- leaning, sunk and burnt out. */
.hut.ruined {
    transform: translate(-50%, -80%) rotate(var(--tilt, -7deg)) scaleY(.8);
    transform-origin: 50% 90%;
    filter: sepia(.45) saturate(.55) brightness(.62) drop-shadow(0 1px 2px rgba(0, 0, 0, .45));
}

/* A group that can no longer move: a boulder lashed down with rope at its shoulder -- the
   stone-age "this stays put" (board.js LOCK_ICON). Stone in the skin's own stone, rope in
   the palisade's lashing, so it reads as part of the same world. */
.lock-badge {
    position: absolute;
    width: 2.6cqw; aspect-ratio: 40 / 30;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0.08cqw 0.12cqw rgba(0, 0, 0, .6));
    z-index: 60;
    pointer-events: none;
}
.lock-badge svg { display: block; width: 100%; height: 100%; overflow: visible; }
.lock-badge .lk-shadow { fill: rgba(0, 0, 0, .35); }
.lock-badge .lk-stone  { fill: #8a7f72; stroke: #2b231d; stroke-width: 1.2; stroke-linejoin: round; }
.lock-badge .lk-facet  { fill: #bdb19f; opacity: .75; }
.lock-badge .lk-crack  { fill: none; stroke: #3a3029; stroke-width: .9; stroke-linecap: round; }
.lock-badge .lk-rope   { fill: none; stroke: #5a3a18; stroke-width: 3.4; stroke-linecap: round; }
.lock-badge .lk-braid  { fill: none; stroke: #d9ab66; stroke-width: 1.9; stroke-linecap: round; stroke-dasharray: 2 1; }
.lock-badge .lk-peg    { stroke: #6b4523; stroke-width: 2.4; stroke-linecap: round; }

/* ── HUD ──────────────────────────────────────────────────────────────────── */
/* ── LEFT column: the player's own information ────────────────────────────── */
#mine {
    display: flex; flex-direction: column; gap: 10px;
    min-width: 0;
    color: var(--dk-panel-text);
    font-size: 13px;
}
/* Reserved whether or not it is showing, so the column never shifts when the turn comes
   round — the same reason the HUD has a fixed height. */
/* "Your turn" is painted on, the way a mark goes on rock: ochre, and it fades in rather
   than blinking -- it is a fact about the table, not an alarm. */
#my-turn {
    height: 24px;
    font-family: var(--dk-font-display);
    font-size: 19px; letter-spacing: .08em;
    color: #e0806a;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .6);
    opacity: 0; transform: translateY(3px);
    transition: opacity .3s cubic-bezier(.2, .8, .2, 1), transform .3s cubic-bezier(.2, .8, .2, 1);
}
#my-turn.on { opacity: 1; transform: none; }

/* WHOSE TURN (tester, 2026-11-10): at the top of the column the mover's figure, large, over
   "X's turn" -- your own clan card when it is you. Its room is kept when nobody is lit (the
   game over), so the column never jumps. On a desk it replaces the small "Your turn" line;
   a short screen has no room and keeps that line and the lit slab. */
#turn-banner {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 2px 0 4px;
    visibility: hidden;
}
#turn-banner.on { visibility: visible; }
#turn-banner .turn-face { display: block; width: 50px; height: 86px; }
#turn-banner .turn-face svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .55)); }
#turn-banner.you .turn-face { width: 72px; height: 72px; margin: 7px 0; }
#turn-banner .turn-face img {
    display: block; width: 100%; height: 100%;
    border-radius: 6px; border: 2px solid var(--clans-bone);
    box-shadow: 0 0 0 2px var(--dk-accent), 0 4px 12px rgba(0, 0, 0, .6);
}
#turn-banner .turn-text {
    max-width: 100%;
    font-family: var(--dk-font-display);
    font-size: 21px; letter-spacing: .08em; line-height: 1.1;
    text-align: center;
    color: #f0b48a;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .7), 0 0 14px rgba(224, 128, 106, .45);
    overflow-wrap: anywhere;
}
#turn-banner.fresh .turn-face, #turn-banner.fresh .turn-text { animation: turn-in .38s cubic-bezier(.2, .8, .2, 1); }
@keyframes turn-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { #turn-banner.fresh .turn-face, #turn-banner.fresh .turn-text { animation: none; } }
#my-turn, #mine-title { display: none; }
@media (max-height: 520px), (pointer: coarse) and (orientation: landscape) {
    #turn-banner { display: none; }
    #my-turn { display: block; }
}

/* The "Your turn" line, and on a touch device the music switch at its right end -- there is
   no header there, and this is the top right of the table (user, 2026-10-06). A stone chip
   like the HUD slabs; off, the speaker is crossed and the ink fades. */
#mine-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#mine-top > #my-turn { flex: 1 1 auto; min-width: 0; }
/* The header's way back to the menu: only while a game is on -- the start screen IS the menu. */
#menu-btn { display: none; }
body.playing #menu-btn { display: inline-flex; align-items: center; justify-content: center; }
#menu-btn svg { width: 18px; height: 18px; display: block; }
#sound-btn-touch, #music-btn-touch, #menu-btn-touch { display: none; }
body.chrome-none #sound-btn-touch, body.chrome-none #music-btn-touch, body.chrome-none.playing #menu-btn-touch {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 44px; height: 44px; padding: 0; cursor: pointer;
    color: var(--clans-bone);
    background: var(--dk-panel);
    border: 1px solid var(--clans-chisel);
    border-radius: var(--clans-hewn-sm);
    box-shadow: var(--clans-slab-depth), 0 5px 12px rgba(0, 0, 0, .5);
    touch-action: manipulation;
}
#sound-btn-touch svg, #music-btn-touch svg, #menu-btn-touch svg { width: 22px; height: 22px; display: block; }
/* The way back to the menu, in the screen's top-left corner (user, 2026-10-12): only while a
   game is on -- the start screen IS the menu. Fixed, clear of a notch, over the table. */
body.chrome-none.playing #menu-btn-touch {
    position: fixed; z-index: 40;
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, var(--clans-sa-l));
}
/* ...and the table keeps clear of it rather than hiding a corner of the board under it: a lane
   down the left in landscape, along the top in portrait (where the board spans the width).
   The board's width rule takes the lane off the room it measures. In landscape an iPhone's
   camera sits on one side or the other, so the lane grows by the left inset and the right
   column keeps clear of the right one (both 0 without a notch). */
body.chrome-none #stage { box-sizing: border-box; }
@media (orientation: landscape) {
    body.chrome-none #stage {
        --clans-lane: 48px;
        --clans-lane-x: calc(var(--clans-lane) + var(--clans-sa-l) + var(--clans-sa-r));
        padding-left: calc(var(--clans-lane) + var(--clans-sa-l));
        padding-right: var(--clans-sa-r);
    }
}
/* An iPhone held sideways (the iOS app runs edge to edge, user 2026-10-13) reports a strip of
   about 60px at each side for the Dynamic Island. The lane on the left IS that strip -- the
   island sits mid-height, so the menu chip has the strip's top corner to itself -- and the
   column on the right steps in by as much, wherever the island happens to be. No inset (Android,
   desktop) leaves every number above as it was. */
@supports (padding: max(0px, env(safe-area-inset-left))) {
    @media (orientation: landscape) {
        body.chrome-none #stage {
            --clans-lane-l: max(48px, calc(var(--clans-sa-l) - var(--clans-pad)));
            --clans-lane-r: max(0px, calc(var(--clans-sa-r) - var(--clans-pad)));
            --clans-lane-x: calc(var(--clans-lane-l) + var(--clans-lane-r));
            padding-left: var(--clans-lane-l); padding-right: var(--clans-lane-r);
        }
        body.chrome-none.playing #menu-btn-touch {
            top: 12px;
            left: max(8px, calc(var(--clans-sa-l) - 48px));
        }
    }
}
@media (orientation: portrait) {
    body.chrome-none #stage { --clans-lane-y: 48px; padding-top: var(--clans-lane-y); }
}
#sound-btn-touch.muted, #music-btn-touch.muted { color: var(--clans-bone-dim); }

#mine-title {
    font-family: var(--dk-font-display);
    font-size: 15px; letter-spacing: .14em;
    color: var(--clans-bone-dim);
}
/* Each HUD row is its own small slab; --grain-x/y make every slab a different cut of the
   same stone, so a column of them does not read as one tile repeated. */
.mine-row, .hud-clan, .seat-card {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 12px;
    min-height: 44px;
    box-sizing: border-box;
    background: var(--dk-panel);
    border: 1px solid var(--clans-chisel);
    border-radius: var(--clans-hewn-sm);
    box-shadow: var(--clans-slab-depth), 0 5px 12px rgba(0, 0, 0, .5);
}
#hud-chips    { --grain-x: -140px; --grain-y: -60px; }
#hud-villages { --grain-x: -300px; --grain-y: -220px; }

/* The score box: every clan's points as a plain number under its own hut, in board order.
   The player's own clan is underlined in bone -- their screen, their colour. The number
   pops when a village's +X lands on it. */
.hud-scores {
    --grain-x: -60px; --grain-y: -400px;
    padding: 7px 10px 8px;
    background: var(--dk-panel);
    border: 1px solid var(--clans-chisel);
    border-radius: var(--clans-hewn-sm);
    box-shadow: var(--clans-slab-depth), 0 5px 12px rgba(0, 0, 0, .5);
}
.hud-scores:empty { display: none; }
.scores-title {
    font-family: var(--dk-font-display);
    font-size: 13px; letter-spacing: .12em;
    color: var(--clans-bone-dim);
    margin-bottom: 4px;
}
.scores-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.score-cell {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 3px 0 2px;
    border-radius: 6px;
    border-bottom: 2px solid transparent;
}
.score-cell img { width: 24px; height: auto; display: block; }
.score-cell b {
    font-family: var(--dk-font-ui);
    font-size: 17px; font-weight: 700; line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: var(--clans-bone);
}
.score-cell.me { border-bottom-color: var(--clans-bone); background: rgba(239, 228, 207, .07); }
.score-cell.bump b { animation: score-bump .7s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes score-bump {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.45); color: #fff; }
    100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .score-cell.bump b { animation: none; } }
/* A short landscape phone: the score box is one line (hut beside its number), and the chips
   and the villages count share a row -- the chips as their icon alone, the way the
   opponents' cards show them -- so the column still ends above the opponents. */
@media (max-height: 520px), (pointer: coarse) and (orientation: landscape) {
    .hud-scores { padding: 3px 5px; }
    .scores-title { display: none; }
    .scores-row { gap: 0; }
    .score-cell { flex-direction: row; justify-content: center; gap: 2px; padding: 2px 0; }
    .score-cell img { width: 13px; }
    .score-cell b { font-size: 13px; }
    #mine { display: grid; grid-template-columns: auto 1fr; }
    #mine > * { grid-column: 1 / -1; }
    #mine > #hud-chips, #mine > #hud-villages { grid-column: auto; }
    #hud-chips > span:not(.chip-icon) { display: none; }
}
.seat-card:nth-child(2) { --grain-x: -200px; --grain-y: -330px; }
.seat-card:nth-child(3) { --grain-x: -410px; --grain-y: -120px; }

/* Your own clan, and only yours — the other seats' cards stay face down until the
   final scoring, so nothing about them is written to the DOM at all. */
.hud-clan {
    min-height: 52px;
    border-color: rgba(184, 80, 63, .75);
}
.hud-clan b { font-family: var(--dk-font-display); font-size: 17px; letter-spacing: .06em; font-weight: 400; }
/* "You" over your clan's name: the slab is your row among the players */
.hud-clan-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.hud-clan-who small { font-size: 11px; letter-spacing: .04em; color: var(--clans-bone-dim); }
#hud-villages { font-size: 13px; }
.hud-clan img { width: 30px; display: block; flex: none; }
.hud-clan-label { color: var(--dk-panel-dim); }

.hud-info { color: var(--dk-panel-dim); }
/* .primary-btn is sized for the inside of a .panel (full width, 48px tall). In the HUD
   strip it is one control among several, so shrink it back — scoped to the id so the
   shared class is untouched everywhere else. */
#new-game { width: auto; margin-top: 0; min-height: 34px; padding: 6px 18px; font-size: 13px; }

/* ── the clan-card reveal ─────────────────────────────────────────────────────
   .overlay / .panel / .over-line / .primary-btn all come from deckades.css; only the
   hut portrait and the leftover-cards note are this game's. */
/* The clan-card tile itself, cut from the component photo. Square, so give it the same
   slightly-rounded edge the real cardboard has. */
.reveal-card {
    display: block;
    width: 170px; height: 170px;
    margin: 6px auto 16px;
    border-radius: 6px;
    border: 3px solid #1c1612;
    box-shadow: 0 2px 0 rgba(255, 236, 206, .12), 0 8px 20px rgba(0, 0, 0, 0.7);
    transform: rotate(-1.5deg);
}
.reveal-note {
    color: var(--dk-panel-dim);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}


/* ── the hit layer ─────────────────────────────────────────────────────────────
   Real area polygons from board_model.json, not circles round the anchors: the long thin
   areas are exactly the ones players misclick, and a circle gets those wrong. */
#areas {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    touch-action: none;                 /* or the browser pans the page mid-drag */
}
#areas .area {
    fill: transparent;
    stroke: transparent;
    stroke-width: 3;
    /* The areas are traced terrain, jagged at every turn; a MITER join shoots a thin spike out
       of each sharp corner, which read as stray white lines whenever an outline lit. */
    stroke-linejoin: round;
    cursor: default;
    transition: fill .12s, stroke .12s;
}
body.my-turn #areas .area { cursor: grab; }
/* Which area the pointer is over, always — the borders are terrain edges rather than
   printed lines, so without this you are guessing where one area stops. Kept faint so it
   never competes with the drag's own source/target marks, which override it below. */
@media (hover: hover) and (pointer: fine) {
    #areas .area:hover { fill: rgba(239, 228, 207, .11); stroke: rgba(239, 228, 207, .42); }
}
#areas .area.src     { fill: rgba(239,228,207,.18); stroke: rgba(239,228,207,.85); }
#areas .area.ok      { fill: rgba(90,230,120,.24);  stroke: rgba(90,230,120,.95); }
#areas .area.hover   { fill: rgba(90,230,120,.46);  stroke: #eaffe8; stroke-width: 5; }
#areas .area.village { fill: rgba(255,205,80,.42);  stroke: #ffd76b; stroke-width: 5; }

/* the ✓ over a legal destination — Village uses the same green-tick idiom */
.tick {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: 1.5cqw; line-height: 1;
    color: #dfffe0;
    text-shadow: 0 0 6px #1c7a2e, 0 1px 2px #000;
    pointer-events: none;
}

/* the stack being dragged, pinned to the pointer */
.drag-ghost {
    position: fixed; z-index: 900;
    transform: translate(-50%, -60%);
    font-size: 30px; line-height: 1;
    color: #fff;
    text-shadow: 0 0 10px #000, 0 2px 6px #000;
    pointer-events: none;
    opacity: .85;
}
.drag-ghost.over { color: #9dff9d; transform: translate(-50%, -60%) scale(1.25); }


/* ── side panel ───────────────────────────────────────────────────────────── */
#side {
    display: flex; flex-direction: column; gap: 10px;
    min-width: 0;
    color: var(--dk-panel-text);
}
/* #prompt is gone: "your turn" is obvious from the board being live, and everything else
   worth saying is a move, which belongs in the log where it stays readable. */
/* Panels that drop out of the header. Fixed, so they float over the board rather than
   taking width from it — the board is the thing you are actually looking at. */
/* The shared #move-log-panel / #ai-eval-panel own the geometry and the look; Clans only
   says when they are shut. */
.clans-panel.hidden { display: none; }

/* ── the village-order question ───────────────────────────────────────────── */
.village-pick {
    display: flex; flex-direction: column; gap: 2px;
    text-align: left;
    margin-top: 8px; padding: 9px 14px; min-height: 0;
    background: transparent;
    border-color: rgba(239, 228, 207, .3);
    color: var(--clans-bone);
}
.village-pick:hover { background: var(--dk-accent-soft); filter: none; }
.village-pick b    { font-size: 14px; }
.village-pick span { font-size: 12px; font-weight: 400; color: var(--dk-panel-dim); }

/* ── the final scoring (game.js finish): final.html, a HyperFrames composition, in a frame ──
   The frame is the table; the panel only carries it and the "New game" button, which waits
   (invisible, its space kept) until the timeline has played. */
#game-over .final-panel { width: min(1100px, 96vw); max-width: none; padding: 10px 10px 12px; }
#final-frame {
    display: block; width: 100%; aspect-ratio: 16 / 9;
    max-height: calc(100dvh - 120px);
    border: 0; border-radius: var(--clans-hewn-sm);
    box-shadow: inset 0 0 0 1px var(--clans-chisel);
    background: var(--clans-stone);
}
.final-actions { display: flex; gap: 10px; margin-top: 10px; visibility: hidden; opacity: 0; transition: opacity 300ms ease-out; }
.final-actions.on { visibility: visible; opacity: 1; }
.final-actions { justify-content: center; }
.final-actions .start-play { flex: 0 1 260px; margin: 0; }
/* the More-games strip (core/moreGames.js, mounted by game.js finish once the buttons show):
   the table gives up the strip's height, so the panel still ends inside the window */
#game-over .final-panel:has(.dk-more) #final-frame { max-height: calc(100dvh - 330px); min-height: 260px; }
#game-over .final-panel .dk-more { margin-top: 12px; color: var(--clans-bone); }
/* the tutorial's closing line stands over the foot of the window (game.js tutFinalNote): the
   panel rises to the top, its buttons wait under the slab, and the frame ends above it */
#game-over.tut-note { place-items: start center; padding-top: 8px; }
#game-over.tut-note .final-actions { display: none; }
#game-over.tut-note #final-frame { max-height: none; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* per-colour count, used when a stack is too big to draw hut-by-hut */
.clan-n {
    position: absolute;
    transform: translate(-50%, 0);
    /* one dark plate under the crowd: "• 12 • 4 • 3", a clan-coloured dot before each count */
    display: flex; gap: .45em; align-items: center; white-space: nowrap;
    padding: .2em .5em .22em; border-radius: .6em;
    background: rgba(24, 17, 11, .9);
    box-shadow: 0 0 0 1px rgba(239, 228, 207, .45), 0 .12em .35em rgba(0, 0, 0, .55);
    font-family: var(--dk-font-display); font-weight: 400; line-height: 1;
    color: #fff;
    pointer-events: none;
    z-index: 60;
}

.clan-n span { display: inline-flex; align-items: center; gap: .2em; }
.clan-n span::before {
    content: ''; width: .62em; height: .62em; border-radius: 50%;
    background: var(--c); box-shadow: 0 0 0 1px rgba(255, 255, 255, .5);
}
.clan-n [data-clan="red"]    { --c: var(--clan-red); }
.clan-n [data-clan="blue"]   { --c: var(--clan-blue); }
.clan-n [data-clan="green"]  { --c: var(--clan-green); }
.clan-n [data-clan="yellow"] { --c: var(--clan-yellow); }
.clan-n [data-clan="black"]  { --c: var(--clan-black); }

/* ── an opponent's move ───────────────────────────────────────────────────────
   A stack that teleports between two redraws is unreadable. The huts about to move are
   lifted and lit first, held long enough to register, then slid across. */
#areas .area.move-from { fill: rgba(239,228,207,.2); stroke: rgba(239,228,207,.8); stroke-width: 3.5; }
#areas .area.move-to   { fill: rgba(120,200,255,.30); stroke: #9fd8ff; stroke-width: 5; }

.hut.lifting {
    transform: translate(-50%, -92%) scale(1.16);
    transition: transform .22s ease-out, filter .22s ease-out;
    filter: drop-shadow(0 0 0.5cqw #fff) drop-shadow(0 0.3cqw 0.4cqw rgba(0,0,0,.65));
    z-index: 120 !important;
}
.hut.sliding {
    transition: left .46s cubic-bezier(.35,.05,.25,1),
                top  .46s cubic-bezier(.35,.05,.25,1),
                transform .22s ease-out, filter .22s ease-out;
}


/* ── RIGHT column: one panel per opponent ─────────────────────────────────────
   The hut is the FACE-DOWN one — their clan card is secret until the final scoring, so
   the panel shows the piece with no colour on it. Their name and their chip count are
   public; anyone can count the chips off the epoch chart. */
#seats { display: flex; flex-direction: column; gap: 8px; }

.seat-card { transition: border-color .2s, transform .25s cubic-bezier(.2, .8, .2, 1); }
/* Whose turn it is -- theirs or yours. A painted edge was too easy to miss (tester, 2026-11-10),
   so the slab is LIT: a bone-white face like a wall in torchlight, dark ink, a brick-red rim and
   a warm glow, lifted out of the column. Bone, never a clan colour -- a yellow slab would read
   as a guess. The guess colours on the face-down card stay as they are. */
.hud-clan { transition: border-color .2s, transform .25s cubic-bezier(.2, .8, .2, 1); }
.seat-card.active, .hud-clan.active {
    background: linear-gradient(180deg, #f6ecd6, #e2cfa8);
    border-color: #fff6e2;
    color: #22170c;
    transform: translateX(-6px);
    box-shadow: var(--clans-slab-depth), 0 0 0 2px var(--dk-accent),
                0 0 18px rgba(255, 186, 110, .5), 0 8px 16px rgba(0, 0, 0, .55);
}
.hud-clan.active .hud-clan-who small { color: rgba(34, 23, 12, .7); }
.seat-card.active .seat-name, .hud-clan.active b { color: #22170c; }
.seat-hut  { width: 30px; display: block; flex: none; }
/* Each opponent's figure (avatar.js), painted straight onto the slab like a figure on a cave
   wall: no frame, no backdrop. Earth pigments only -- never a clan colour, the clan is secret. */
.seat-figure { flex: none; display: block; width: 22px; height: 38px; margin: -3px 0; }
.seat-figure svg, .mover-figure svg, .log-figure svg { display: block; width: 100%; height: 100%; }
/* in the log, in front of the name: a line's height tall, sat on the text's baseline */
.log-figure { display: inline-block; width: 15px; height: 26px; margin: -8px 3px -5px -2px; vertical-align: -5px; }
.seat-name {
    flex: 1 1 auto; min-width: 0;
    font-weight: 600; font-size: 13px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* The bonus chip, drawn as the chip with its count ON it — the same cream disc that sits
   on the epoch chart, so the two read as the same object. */
.chip-icon {
    flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 30%, #fff, #f2efe6 62%, #d8d2c2 100%);
    border: 1px solid rgba(90, 70, 40, .55);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .45);
    color: #4a3a1c;
    font-size: 13px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.chip-icon b { font-weight: 700; }

/* ── the dispute ──────────────────────────────────────────────────────────────
   When all five clans meet, every clan with a single hut is thrown out. Removing them in
   a redraw is invisible; they drift up and fade instead, so the player sees who died. */
.hut.evicted {
    transition: transform .62s cubic-bezier(.3,.1,.4,1), opacity .62s ease-in;
    transform: translate(-50%, -190%) scale(.72) rotate(-8deg);
    opacity: 0;
    filter: drop-shadow(0 0 0.4cqw #ff6b6b);
    z-index: 130 !important;
}

/* ── a village paying out ─────────────────────────────────────────────────────
   One +X per clan that scored, flying from the village to that clan's number in the
   score box, which changes as it lands. */
.score-fly {
    position: absolute;
    transform: translate(-50%, -50%);
    font-family: var(--dk-font-display);
    font-size: 1.9cqw; font-weight: 700; line-height: 1;
    color: var(--c, #fff);
    text-shadow: 0 0 0.25cqw #000, 0 0 0.5cqw #000, 0 0.15cqw 0.3cqw rgba(0,0,0,.9);
    pointer-events: none;
    z-index: 140;
}
.score-fly.flying {
    transition: left .9s cubic-bezier(.4,0,.25,1),
                top  .9s cubic-bezier(.4,0,.25,1),
                opacity .55s ease-in .42s;
}
.score-fly[data-clan="red"]    { --c: #ff6b66; }
.score-fly[data-clan="blue"]   { --c: #7aa8ff; }
.score-fly[data-clan="green"]  { --c: #6ee07f; }
.score-fly[data-clan="yellow"] { --c: #ffd45e; }
.score-fly[data-clan="black"]  { --c: #cfcbdc; }

/* ── clan cards in the side panels ────────────────────────────────────────────
   The real component, not a stand-in: the human's own is face up from the start, the
   opponents' sit face down on the generic back until the final scoring flips them. */
.mine-card {
    width: 34px; height: 34px; flex: none;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, .45);
    box-shadow: 0 2px 5px rgba(0, 0, 0, .5);
}
.card-flip {
    position: relative; flex: none;
    width: 34px; height: 34px;
    perspective: 700px;
}
.card-flip .face {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, .35);
    box-shadow: 0 2px 5px rgba(0, 0, 0, .5);
    backface-visibility: hidden;
    transition: transform .62s cubic-bezier(.4, .05, .25, 1);
}
.card-flip .back  { transform: rotateY(0deg); }
.card-flip .front { transform: rotateY(180deg); }
.card-flip.flipped .back  { transform: rotateY(-180deg); }
.card-flip.flipped .front { transform: rotateY(0deg); }
.seat-card.revealed { border-color: var(--dk-accent); }

/* ── the player's own guesses ─────────────────────────────────────────────────
   A click on an opponent's slab opens a note: which clans they might be. The guess paints
   their face-down card -- one colour flat, several in broad diagonal stripes -- with a thin
   bone rim so the black clan still reads on the stone. It sits between back and front, so
   the final scoring's flip covers it. game.js places the menu beside the slab. */
.seat-card { cursor: pointer; }
.seat-card.guessing { border-color: var(--clans-bone, #e8dcc4); }
.card-flip .guess-tint {
    position: absolute; inset: 0;
    border-radius: 4px;
    pointer-events: none;
    display: none;
}
.seat-card.guessed .guess-tint {
    display: block;
    box-shadow: inset 0 0 0 1px rgba(255, 245, 225, .55), 0 2px 5px rgba(0, 0, 0, .5);
}
.card-flip.flipped .guess-tint { display: none; }
#guess-menu {
    position: fixed;
    width: max-content; max-width: min(240px, 80vw);
    padding: 10px 12px 11px;
    background: var(--dk-panel);
    border: 1px solid var(--dk-panel-line);
    border-radius: var(--dk-radius);
    box-shadow: var(--dk-panel-shadow);
    color: var(--dk-panel-text);
    font-family: var(--dk-font-ui);
    z-index: var(--dk-z-panel);
}
.guess-title { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
.guess-sub { font-size: 11.5px; color: var(--dk-panel-dim); margin-bottom: 7px; }
.guess-list { display: flex; flex-direction: column; gap: 2px; }
.guess-opt {
    display: flex; align-items: center; gap: 8px;
    min-height: 30px; padding: 0 6px;
    border-radius: var(--clans-hewn-sm, 4px);
    font-size: 13px; cursor: pointer;
}
.guess-opt:hover { background: rgba(255, 255, 255, .06); }
.guess-opt input { width: 17px; height: 17px; margin: 0; accent-color: var(--dk-accent); cursor: pointer; }
.guess-opt i {
    width: 16px; height: 16px; flex: none; border-radius: 3px;
    background: var(--c);
    box-shadow: inset 0 0 0 1px rgba(255, 245, 225, .45);
}
.guess-opt[data-clan="red"]    { --c: var(--clan-red); }
.guess-opt[data-clan="blue"]   { --c: var(--clan-blue); }
.guess-opt[data-clan="green"]  { --c: var(--clan-green); }
.guess-opt[data-clan="yellow"] { --c: var(--clan-yellow); }
.guess-opt[data-clan="black"]  { --c: var(--clan-black); }
@media (max-height: 520px) { .guess-sub { display: none; } .guess-opt { min-height: 26px; } }

/* ── whose move: the name plate over the board ────────────────────────────────
   Shown from the moment an opponent's turn comes (with the lit slab) to the end of it. Stone when the player has no guess for them, the
   guessed colour(s) when they have -- with a heavy shadow on the name so it reads on yellow
   as well as on black. game.js places it at the foot of the board as the turn passes:
   centred, then slid sideways along the bottom edge off the huts that move. Never takes a
   pointer: it must not stand in the way. */
#mover {
    position: fixed; left: 50%; top: 0;
    z-index: 150;
    transform: translate(-50%, 6px);
    opacity: 0;
    padding: 9px 28px 10px;
    border-radius: var(--clans-hewn-sm, 6px);
    background: var(--dk-panel);
    border: 1px solid var(--dk-panel-line);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .55);
    color: #fff;
    font-family: var(--dk-font-display);
    font-size: 25px; font-weight: 700; line-height: 1.15;
    white-space: nowrap; max-width: 70vw; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none;
    transition: opacity .25s ease-out, transform .25s ease-out;
}
#mover { display: flex; align-items: center; gap: .3em; }
#mover > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* the figure stands the plate's full height, padding and all (user, 2026-11-06: "make the
   avatars on the action name plates bigger") */
.mover-figure { flex: none; display: block; width: 1.12em; height: 1.92em; margin: -.37em .05em -.4em -.55em; }
.mover-figure:empty { display: none; }
#mover.show { opacity: 1; transform: translate(-50%, 0); }
/* up since the turn passed, it glides off the huts once the move is known (game.js showMover) */
#mover.glide { transition: opacity .25s ease-out, transform .25s ease-out, left .3s ease-out; }
#mover.guessed { border-color: rgba(255, 245, 225, .7); }
#mover.guessed span {
    text-shadow: 0 0 3px #000, 0 0 6px rgba(0, 0, 0, .9), 0 1px 2px #000;
}
@media (max-height: 520px) { #mover { font-size: 17px; padding: 5px 15px 6px; } }
@media (prefers-reduced-motion: reduce) { #mover, #mover.glide { transition: opacity .2s; } }


/* ── the cover, behind the start screen ───────────────────────────────────────
   body::before is the art and body::after the scrim: without the scrim the painting's own
   highlights compete with the start card, which has to stay the brightest thing on screen.
   Both are pinned behind everything and neither ever intercepts a pointer. */
/* z-index 0, NOT a negative one. body carries .dk-table, whose background propagates to
   the canvas — a pseudo-element at z-index:-2 ends up behind that and paints as a black
   rectangle. Both pseudo-elements sit at 0 (::after wins on DOM order) and everything the
   player interacts with is lifted above them explicitly. */
body::before {
    content: '';
    position: fixed; inset: 0;
    z-index: -2;
    background: #120d09 var(--clans-backdrop) center top / var(--clans-land) no-repeat;
    pointer-events: none;
}
/* Deliberately LIGHT. #start-screen already lays rgba(8,6,14,0.86) over this and the two
   compose multiplicatively — at the usual 0.5-0.9 the combined scrim is ~0.97 and the cover
   is a black rectangle, which is exactly what happened here. This layer only has to shape
   the art, not hide it. */
body::after {
    content: '';
    position: fixed; inset: 0;
    z-index: -1;
    background: radial-gradient(ellipse at 50% 30%,
        rgba(10, 6, 2, 0) 0%, rgba(9, 6, 2, 0.10) 55%, rgba(6, 4, 1, 0.38) 100%);
    pointer-events: none;
}

/* Before a game starts there is nothing to look at but the cover, so the empty board does
   not sit behind the start card competing with it. `visibility` rather than `display`, so
   the board keeps its box and is already the right size the moment it appears. */
body:not(.playing) #stage { visibility: hidden; }
/* During play the start screen's copy of the cover steps out: its "Leo Colovini" lettering
   sat right above the board and read as a second title. */
body.playing::before, body.playing::after { display: none; }

/* Once the game is running the board is the subject, so the cover recedes further —
   the class goes on <body> when the start screen is dismissed. */
/* Once the felt is down the cover is completely hidden behind it, so there is nothing left
   to tune here — the board is the subject from that point on. */


/* ── credit ───────────────────────────────────────────────────────────────────
   The publisher's logo (studiogiochi, light variant), in the board's lower-left forest
   corner where the print carried its copyright line (painted out of board.jpg). Sized off
   the board width so it keeps its place on the art at every scale. */
#credit {
    position: absolute;
    left: 1.1cqw; bottom: 1.3cqw;
    z-index: 5;                           /* over the art, under huts and pieces */
    line-height: 0;
    pointer-events: none; user-select: none;
}
#credit img { height: 2.1cqw; width: auto; display: block;
              filter: drop-shadow(0 0.1cqw 0.25cqw rgba(0, 0, 0, .55)); }

/* ── a village on hostile terrain ─────────────────────────────────────────────
   It scores nothing at all — no huts, no bonus — and that is otherwise invisible: the
   pieces sit there and no disk moves. The cross is the only thing that says why. */
#areas .area.hostile { fill: rgba(210, 40, 40, .26); stroke: #ff6b6b; stroke-width: 5; }

.hostile-x {
    position: absolute;
    transform: translate(-50%, -50%) scale(.4);
    font-size: 5.2cqw; font-weight: 700; line-height: 1;
    color: #ff5b52;
    text-shadow: 0 0 0.3cqw #000, 0 0 0.9cqw rgba(0, 0, 0, .95);
    opacity: 0;
    transition: transform .34s cubic-bezier(.2, 1.5, .5, 1), opacity .28s;
    pointer-events: none;
    z-index: 150;
}
.hostile-x.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.hostile-x.gone { opacity: 0; transform: translate(-50%, -50%) scale(1.25); }


/* The claimed bonus chip, on its way from the epoch chart to whoever took it. It leaves
   the board entirely, so it is allowed to overflow. */
.chip-fly {
    z-index: 160;
    transition: left .78s cubic-bezier(.4, 0, .25, 1),
                top  .78s cubic-bezier(.4, 0, .25, 1),
                opacity .3s ease-in .5s,
                width .78s ease;
}
.chip-fly.flying { width: 1.5cqw; }


/* ── narrower tables ──────────────────────────────────────────────────────────────────
   Below 1640px the right column slims to 210px. On a portrait screen both go UNDER the
   board, side by side. */
@media (max-width: 1640px) {
    #stage { --clans-col: 210px; }
}
@media (max-width: 1640px) and (orientation: portrait) {
    #stage {
        grid-template-columns: 1fr 1fr;
        grid-template-areas: "board board" "mine side";
        grid-template-rows: auto auto;
        align-content: start;
        --clans-room-w: calc(100vw - 2 * var(--clans-pad));
    }
    #mine, #side { align-self: start; }
    #board { justify-self: center; }
}
/* A short landscape phone: the column has about 280px of height for the whole HUD, so the
   two lines that are reference rather than state (the heading, the seed) step out and every
   slab tightens. The Villages count stays -- it is how far through the game you are. */
@media (max-height: 520px), (pointer: coarse) and (orientation: landscape) {
    body { --clans-pad: 8px; }
    #stage { --clans-col: 172px; --clans-gap: 8px; }
    #mine, #side, #seats { gap: 6px; }
    #mine-title { display: none; }
    #my-turn { height: 18px; font-size: 15px; }
    .mine-row, .seat-card { min-height: 34px; padding: 4px 9px; gap: 7px; font-size: 12px; }
    .hud-clan { min-height: 40px; }
    .chip-icon { width: 24px; height: 24px; font-size: 12px; }
    .card-flip, .mine-card { width: 28px; height: 28px; }
    .seat-figure { width: 18px; height: 31px; }
}
/* The phone floor, 640x300: your column (174px) and three opponents (126px) came to 308px of
   the 284 there are, so the grid grew and pushed the board 4px and the last opponent 16px off
   the bottom (test board, 2026-10-08). Thinner slabs; the 44px sound switch stays. */
@media (max-height: 340px) {
    #mine, #side, #seats { gap: 4px; }
    .seat-card { min-height: 30px; padding: 2px 8px; }
    .seat-card .card-flip { width: 24px; height: 24px; }
    .seat-figure { width: 16px; height: 27px; margin: -2px 0; }
    .hud-clan { min-height: 34px; padding-top: 3px; padding-bottom: 3px; }
    .mine-card { width: 24px; height: 24px; }
    .mine-row { min-height: 30px; padding-top: 2px; padding-bottom: 2px; }
}
@media (prefers-reduced-motion: reduce) {
    #my-turn, .seat-card { transition: none; }
}

/* ── a short screen: as much of it as possible is the board (user, 2026-10-20) ──────────
   On a phone held sideways the board is WIDTH-bound (800x450: 556px of board beside 172px of
   column), so every pixel the column gives up goes to the board. What goes, and where:
     - the Villages count -- the epoch chart on the board says how far the game is;
     - your chips -- onto your clan's slab, the way each opponent's sit on theirs;
     - "Your turn", every name and your clan's name -- the clan card says whose colour is yours,
       and the turn is the slab that is lit and stands out of the column, yours like theirs;
     - on a touch table the music, the effects and the scores go to the lane down the left
       (there for the menu chip anyway): the scores one clan above the other, the two switches
       at its foot.
   That leaves a column of cards and chips, 84px wide. And the board may STRETCH a little
   (up to 10% wider than printed) to fill a screen of another shape: everything on it is placed
   in percentages, so only the picture gives, and at 10% the eye does not notice. */
/* Your chips sit on your own slab everywhere now, the way each opponent's sit on theirs: the
   slab is the first row of the players (tester, 2026-11-10). */
#hud-chips { display: none; }
.hud-clan-chip { display: block; margin-left: auto; }
@media (max-height: 520px), (pointer: coarse) and (orientation: landscape) {
    #hud-villages { display: none; }
    .hud-clan-who b, .hud-clan-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
/* THE DENSE TABLE on every touch screen held sideways, not only below 520px: a 7" tablet or an
   iPad got the desk's two 210px columns and a board of half the screen (user, 2026-10-23: "use
   the 10'' tablet (dense) layout for those, to cover as much space as possible for the board"). */
@media (max-height: 520px) and (orientation: landscape), (pointer: coarse) and (orientation: landscape) {
    /* the column: the players at the top, the chart under them */
    body.chrome-none #stage {
        --clans-col: 84px;                   /* card + chip; the chart's rows are sized to it */
        /* the rail hugs the screen's right edge and the map takes everything between it and the
           lane (user, 2026-10-20: "move the right rail as much to the right as possible") */
        grid-template-columns: minmax(0, 1fr) var(--clans-col);
        justify-content: stretch;
        /* the rail (your slab, the opponents, the chart) is CENTRED in the height (user,
           2026-11-10): an empty row above and below it share what is left over */
        grid-template-areas: "board ." "board mine" "board side" "board .";
        grid-template-rows: 1fr auto auto 1fr;
        align-content: stretch;
        overflow: clip;                      /* the board's cropped-off chart is no page overflow */
    }
    body.chrome-none #mine, body.chrome-none #side { align-self: start; }
    /* THE MAP ONLY, STRETCHED. The board element keeps all of board.jpg (every piece is placed
       in its native px) but is laid out wider than its frame by the chart's share and clipped
       back to the map: --clans-vis is the map's share of the width (x 0-1586 of 1890; every
       board's areas end at 1578). The frame then fills the room, the map stretched to it by
       up to 55% either way from its own 1586:1260 (a 19.5:9 phone needs ~52%); past that it is
       centred in its cell. zoom.js reads --clans-vis too. */
    body.chrome-none #board {
        --clans-vis: 0.83915;
        --clans-fit-w: calc(var(--clans-room-w) - var(--clans-lane-x, 0px));
        --clans-fit-h: calc(var(--clans-room-h) - var(--clans-lane-y, 0px));
        --clans-map-w: min(var(--clans-fit-w), var(--clans-fit-h) * 1.2587 * 1.55);
        --clans-map-h: min(var(--clans-fit-h), var(--clans-fit-w) / 1.2587 * 1.55);
        justify-self: center;
        aspect-ratio: auto;
        width: calc(var(--clans-map-w) / var(--clans-vis));
        height: var(--clans-map-h);
        margin-right: calc(var(--clans-map-w) - var(--clans-map-w) / var(--clans-vis));
        clip-path: inset(0 calc(100% - 100% * var(--clans-vis)) 0 0 round 6px);
        box-shadow: none;
    }
    body.chrome-none #pieces .chip { display: none; }   /* the printed chart's chips: chart.js has them */
    body.chrome-none #hud-chart { display: flex; }
    body.chrome-none #my-turn, body.chrome-none .seat-name, body.chrome-none .hud-clan-who { display: none; }
    body.chrome-none #mine-top { display: contents; }
    body.chrome-none .hud-clan, body.chrome-none .seat-card { justify-content: space-between; gap: 4px; padding-left: 6px; padding-right: 6px; }
    /* card 28 + figure 18 + chip 24 must fit the 82px inside the slab: tighter here only */
    body.chrome-none .seat-card { gap: 2px; padding-left: 4px; padding-right: 4px; }
    body.chrome-none #hud-chart { padding: 4px 3px; }
    body.chrome-none .ch-row { gap: 2px; padding: 2px 2px; }
    body.chrome-none .ch-land { width: 23px; height: 23px; }
    body.chrome-none .ch-disc { width: 21px; height: 21px; font-size: 12px; }
    body.chrome-none .ch-land i { font-size: 10px; right: -3px; bottom: -3px; padding: 1px 2px; }
    body.chrome-none .hud-clan { border-color: var(--clans-chisel); transition: border-color .2s, transform .25s cubic-bezier(.2, .8, .2, 1); }
    body.chrome-none.my-turn .hud-clan {
        border-color: var(--dk-accent);
        transform: translateX(-4px);
        box-shadow: var(--clans-slab-depth), inset 0 0 0 1px rgba(184, 80, 63, .5), 0 8px 16px rgba(0, 0, 0, .55);
    }
    body.chrome-none #sound-btn-touch, body.chrome-none #music-btn-touch, body.chrome-none .hud-scores {
        position: fixed; z-index: 40;
        left: max(8px, var(--clans-sa-l));
    }
    body.chrome-none #sound-btn-touch { bottom: max(8px, env(safe-area-inset-bottom)); }
    body.chrome-none #music-btn-touch { bottom: calc(max(8px, env(safe-area-inset-bottom)) + 50px); }
    /* centred in the lane between the menu chip (to 56px) and the two switches (from 102px off
       the bottom) */
    body.chrome-none .hud-scores { top: calc(50% - 23px); transform: translateY(-50%); width: 44px; box-sizing: border-box; padding: 3px 0; }
    body.chrome-none .scores-row { grid-template-columns: 1fr; gap: 1px; }
    body.chrome-none .score-cell { flex-direction: column; gap: 0; padding: 2px 0 1px; }
    body.chrome-none .score-cell img { width: 18px; }
    body.chrome-none .score-cell b { font-size: 14px; }
}
@media (max-height: 400px) and (orientation: landscape) {
    /* menu chip, five clans and two switches in ~350px of lane: each clan is one line, its
       hut beside its number */
    body.chrome-none .score-cell { flex-direction: row; justify-content: center; gap: 2px; padding: 3px 0; }
    body.chrome-none .score-cell img { width: 13px; }
    body.chrome-none .score-cell b { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { body.chrome-none .hud-clan { transition: none; } }
/* The chart in the column (chart.js): one slab, five rows -- the favoured land, the discs
   left (the count on the disc), the ruined land. The epoch the next village falls in is lit
   in the wordmark red and stands out of the slab; spent epochs fade. */
#hud-chart {
    display: none;
    flex-direction: column; gap: 3px;
    margin-top: 6px; padding: 5px;
    background: var(--dk-panel);
    border: 1px solid var(--clans-chisel);
    border-radius: var(--clans-hewn-sm);
    box-shadow: var(--clans-slab-depth), 0 5px 12px rgba(0, 0, 0, .5);
    --grain-x: -250px; --grain-y: -90px;
}
.ch-row {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 5px;
    padding: 3px 4px;
    border: 1px solid transparent;
    border-radius: 7px;
    transition: background .3s, border-color .3s, opacity .3s;
}
.ch-row.spent { opacity: .38; }
.ch-row.now {
    background: rgba(184, 80, 63, .22);
    border-color: var(--dk-accent);
    box-shadow: inset 0 0 0 1px rgba(184, 80, 63, .45), 0 0 10px rgba(184, 80, 63, .45);
}
.ch-land { position: relative; justify-self: center; width: 30px; height: 30px; }
.ch-land img {
    display: block; width: 100%; height: 100%; object-fit: cover;
    border-radius: 6px; border: 1px solid #1c1612;
}
.ch-land.hostile img { filter: saturate(.55) brightness(.75); }
/* epoch V: every land, a quarter each */
.ch-all {
    display: grid; grid-template-columns: 1fr 1fr; width: 100%; height: 100%;
    border-radius: 6px; border: 1px solid #1c1612; overflow: hidden;
}
.ch-all img { border: 0; border-radius: 0; }
.ch-land i {
    position: absolute; right: -4px; bottom: -4px;
    font-style: normal; font-size: 12px; line-height: 1;
    padding: 2px 3px; border-radius: 5px;
    background: rgba(20, 14, 10, .88); color: #9be08f;
}
.ch-land.hostile i { color: #ff6b5e; }
.ch-disc {
    display: grid; place-items: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: radial-gradient(circle at 36% 30%, #fff, #f2efe6 62%, #d8d2c2 100%);
    border: 1px solid rgba(90, 70, 40, .55);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .45);
    color: #2a2018; font-size: 14px;
}
.ch-row.spent .ch-disc { background: rgba(239, 228, 207, .25); color: var(--clans-bone-dim); }
@media (max-height: 400px) {
    #hud-chart { gap: 1px; padding: 3px 4px; margin-top: 4px; }
    .ch-row { padding: 1px 3px; }
    .ch-land { width: 24px; height: 24px; }
    .ch-disc { width: 22px; height: 22px; font-size: 12px; }
    .ch-land i { font-size: 10px; }
}
/* The phone floor with four players (test board re-run, 2026-10-30): your slab, three opponents
   and the five chart rows came to 313px of the 284 there are, so the rail ran to y321 and the
   board 7px off the screen. The chart rows and the chips are only read, never tapped, so they
   give the 30px; the clan cards (the guess menu's targets) keep their size. 640x360 ran 5px
   over the same way. */
@media (max-height: 400px) and (orientation: landscape) {
    body.chrome-none #seats { gap: 2px; }
    body.chrome-none #hud-chart { padding: 3px; margin-top: 0; }
    body.chrome-none .ch-row { padding: 1px 2px; }
    body.chrome-none .ch-land { width: 20px; height: 20px; }
    body.chrome-none .ch-disc { width: 20px; height: 20px; font-size: 11px; }
    body.chrome-none .seat-card .chip-icon { width: 22px; height: 22px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .ch-row { transition: none; } }

/* A chip or a +N on its way from the board to the HUD flies here, over the board's own box
   but outside its clip (board.js flightLayer). */
#board-flights {
    position: fixed; z-index: 160;
    pointer-events: none;
    container-type: inline-size;
}

/* A phone with its camera on the left edge (the iPhone's island, a punch hole): the whole
   lane stands to the RIGHT of the camera strip. In the strip it sat over the island -- the
   island is mid-height, exactly where the score rail is centred (an emulated 59px inset put
   the rail at x 11-55 against the island's 0-37, user 2026-10-20). The menu chip leaves the
   strip's corner too, to stay in one column with the rail. The lane is the inset plus a
   44px chip; without an inset (most Android phones) it is the 48px it always was. */
@supports (padding: max(0px, env(safe-area-inset-left))) {
    @media (max-height: 520px) and (orientation: landscape), (pointer: coarse) and (orientation: landscape) {
        body.chrome-none #stage {
            --clans-lane-l: max(48px, calc(var(--clans-sa-l) + 44px));
        }
        body.chrome-none #sound-btn-touch, body.chrome-none #music-btn-touch, body.chrome-none .hud-scores,
        body.chrome-none.playing #menu-btn-touch {
            left: max(8px, var(--clans-sa-l));
        }
    }
}

/* ── the start card's title: the cover's carved wordmark ─────────────────────────────── */
.clans-wordmark {
    display: block;
    width: min(380px, 100%); height: auto;
    margin: -6px auto 8px;               /* air under the carved title before the copy */
    /* cut into the slab: a short hard foot, then a soft cast */
    filter: drop-shadow(0 3px 0 rgba(12, 8, 4, 0.55)) drop-shadow(0 9px 12px rgba(0, 0, 0, 0.45));
}
@media (max-width: 620px), (max-height: 540px) { .clans-wordmark { width: min(280px, 100%); } }

/* A Hard seat that is searching: its slab's painted edge breathes, slowly -- an ambient
   "thinking", well under the tempo of any cue on the board. */
.seat-card.active.thinking { animation: clans-think 1.8s ease-in-out infinite; }
@keyframes clans-think {
    0%, 100% { border-color: var(--dk-accent); }
    50%      { border-color: rgba(239, 228, 207, .7); }
}
@media (prefers-reduced-motion: reduce) { .seat-card.active.thinking { animation: none; } }


/* ── the online lobby ─────────────────────────────────────────────────────────────────
   The same slab as every dialog: --dk-dialog-bg, its chiselled edge and hewn corners, the
   stone's own inks. The room code is set in the UI face, tabular -- it is something you
   read out to a friend, not a name, and the display face's capitals blur O and 0. */
#mp-backdrop {
    position: fixed; inset: 0; z-index: 1300;
    display: flex; align-items: center; justify-content: center;
    padding: 16px; box-sizing: border-box;
    background: var(--dk-scrim);
    font-family: var(--dk-font-ui);
}
.mp-card {
    width: 440px; max-width: 94vw; max-height: calc(100dvh - 32px); overflow-y: auto;
    box-sizing: border-box; padding: 24px 26px 22px;
    background: var(--dk-dialog-bg);
    border: 1px solid var(--dk-dialog-line);
    border-radius: var(--dk-dialog-radius);
    box-shadow: var(--dk-panel-shadow), 0 14px 44px rgba(0, 0, 0, .6);
    color: var(--dk-panel-text); text-align: center;
}
.mp-card h2 {
    font-family: var(--dk-font-display); font-weight: 400;
    font-size: 26px; letter-spacing: .06em; margin: 0 0 6px;
    color: var(--dk-accent);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .55);
}
.mp-sub  { font-size: 13px; color: var(--dk-panel-dim); line-height: 1.5; margin-bottom: 16px; }
.mp-field { display: flex; flex-direction: column; gap: 5px; text-align: left; margin-bottom: 12px; }
.mp-field label { font-size: 13px; font-weight: 600; color: var(--dk-panel-dim); }
.mp-field input, .mp-field select {
    min-height: 44px; padding: 8px 10px; box-sizing: border-box;
    background: var(--dk-field-bg); color: var(--dk-panel-text);
    border: 1px solid var(--dk-field-line); border-radius: 6px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, .5);          /* a hollow cut into the slab */
    font-family: var(--dk-font-ui); font-size: 14px;
}
.mp-field input:focus-visible, .mp-field select:focus-visible {
    outline: 2px solid var(--clans-bone); outline-offset: 2px;
}
#mp-code-in {
    text-transform: uppercase; letter-spacing: .34em; text-align: center;
    font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.mp-btn {
    width: 100%; min-height: 48px; margin-top: 8px; padding: 11px 20px;
    font-family: var(--dk-font-ui); font-size: 15px; font-weight: 700; color: #fff8ec;
    background: var(--dk-accent); border: 1px solid var(--dk-accent);
    border-radius: 10px; cursor: pointer; touch-action: manipulation;
    box-shadow: inset 0 1px 0 rgba(255, 236, 206, .22), 0 3px 0 rgba(60, 20, 12, .55);
    transition: filter .15s, transform .1s;
}
.mp-btn:hover:not(:disabled) { filter: brightness(1.12); }
.mp-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 236, 206, .2), 0 1px 0 rgba(60, 20, 12, .55); }
.mp-btn:focus-visible { outline: 2px solid var(--clans-bone); outline-offset: 3px; }
/* Disabled is a FAINT stone, not a see-through one: 0.38 opacity of red over stone read as
   a rendering fault. */
.mp-btn:disabled { background: #5a4a40; border-color: #5a4a40; color: rgba(239, 228, 207, .55); box-shadow: none; cursor: not-allowed; }
.mp-btn.ghost {
    background: transparent; color: var(--dk-panel-text); font-weight: 600;
    border-color: rgba(239, 228, 207, .32); box-shadow: none;
}
.mp-btn.ghost:hover:not(:disabled) { background: rgba(255, 236, 206, .07); border-color: rgba(239, 228, 207, .5); filter: none; }
/* .ghost comes after :disabled at the same weight and won: offline, Join was disabled but still
   looked live beside the faint Create (user, iPhone, 2026-11-02). Disabled is one look. */
.mp-btn.ghost:disabled { background: #5a4a40; border-color: #5a4a40; color: rgba(239, 228, 207, .55); box-shadow: none; cursor: not-allowed; }
.mp-code {
    font-family: var(--dk-font-ui); font-variant-numeric: tabular-nums;
    font-size: 44px; font-weight: 700; letter-spacing: .3em;
    color: var(--clans-bone); margin: 10px 0 4px; padding-left: .3em;
    text-shadow: 0 2px 0 rgba(0, 0, 0, .55);
}
.mp-seats { margin: 12px 0 4px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.mp-seat {
    display: flex; align-items: center; gap: 8px; padding: 7px 10px;
    border-radius: var(--clans-hewn-sm); font-size: 13px;
    background: rgba(0, 0, 0, .18);
}
.mp-seat.taken { background: rgba(184, 80, 63, .2); }
.mp-seat.ai { color: var(--dk-panel-dim); }
.mp-seat b { flex: 1 1 auto; font-weight: 600; }
.mp-err { min-height: 18px; margin-top: 8px; font-size: 12.5px; color: var(--dk-msg-alert); }

/* The AI panel's heading for one decision is a SENTENCE (who, how, how long), so it is set
   in the UI face: the display face's capitals at 12px were unreadable. */
.clans-eval-head { font-size: 12.5px; font-weight: 600; color: var(--dk-panel-text); margin-bottom: 4px; }
/* A short landscape phone: the lobby's three choices must all be on screen without a scroll
   (a confirm button below the fold reads as cut off), so the slab tightens. */
@media (max-height: 520px) {
    .mp-card { padding: 12px 18px 12px; }
    .mp-card h2 { font-size: 20px; margin-bottom: 2px; }
    .mp-sub  { font-size: 12px; margin-bottom: 8px; }
    .mp-btn  { min-height: 44px; margin-top: 6px; padding: 8px 16px; }
    .mp-code { font-size: 34px; margin: 4px 0 2px; }
}


/* ── the club over a five-clan area (board.js renderClubs / strikeClub) ───────────────
   It stays where it is, over the huts, and turns about its own length: the 3D sprite rolls
   through its 24 frames. Held a little tilted, the way a club is held before it comes down.
   Nothing else on the board turns like that, so it cannot be read as anything but "this
   crowd is about to have a fight". */
.club-orbit {
    position: absolute; width: 0; height: 0;
    z-index: 155;                       /* above the huts, below flying scores */
    pointer-events: none;
    animation: club-in .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes club-in { from { opacity: 0; transform: translateY(-1.5cqw) scale(.6); } }
.club {
    position: absolute;
    width: 4.2cqw; height: 4.2cqw;
    margin: -2.1cqw 0 0 -2.1cqw;
    overflow: hidden;
    transform: rotate(-14deg);
    transform-origin: 50% 80%;
    /* a pale edge so brown wood still separates from brown steppe, and a cast shadow */
    filter: drop-shadow(0 0 0.08cqw rgba(255, 240, 215, .85)) drop-shadow(0 0.35cqw 0.3cqw rgba(0, 0, 0, .55));
}
.club-strip {
    width: 2400%; height: 100%;
    background: url('gfx/club.webp') 0 0 / 100% 100% no-repeat;
    animation: club-roll 1.1s steps(24) infinite;
}
@keyframes club-roll { to { transform: translateX(-100%); } }

/* THE STRIKE, timed against strikeClub(): wind-up for ~380ms, the slam lands, a bounce. */
.club-orbit.striking .club-strip { animation-play-state: paused; }
.club-orbit.striking .club { animation: club-strike 1s cubic-bezier(.3, 0, .3, 1) forwards; }
@keyframes club-strike {
    0%   { transform: rotate(-14deg); }
    30%  { transform: translate(-0.8cqw, -1.6cqw) rotate(-75deg) scale(1.15); }
    40%  { transform: translate(0.4cqw, 1.9cqw) rotate(95deg) scale(1.2); }
    52%  { transform: translate(0.3cqw, 0.9cqw) rotate(70deg) scale(1.15); }
    62%  { transform: translate(0.4cqw, 1.8cqw) rotate(92deg) scale(1.18); }
    80%  { transform: translate(0.4cqw, 1.7cqw) rotate(92deg) scale(1.18); opacity: 1; }
    100% { transform: translate(1.6cqw, -2.6cqw) rotate(200deg) scale(.7); opacity: 0; }
}
/* the huts take it: squashed flat, then spring back */
.hut.bonked { animation: hut-bonk .55s cubic-bezier(.2, .9, .3, 1.3) both; transform-origin: 50% 100%; }
@keyframes hut-bonk {
    0%   { transform: translate(-50%, -80%) scale(1.3, .55); }
    45%  { transform: translate(-50%, -80%) scale(.88, 1.14); }
    100% { transform: translate(-50%, -80%) scale(1, 1); }
}
/* BONK! - a comic-strip burst, in the game's own red and bone */
.club-pow {
    position: absolute; z-index: 170; pointer-events: none;
    width: 7cqw; height: 7cqw; margin: -3.5cqw 0 0 -3.5cqw;
    display: grid; place-items: center;
    animation: pow-in .32s cubic-bezier(.2, 1.6, .4, 1) both;
    transition: opacity .35s, transform .35s;
}
.club-pow svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
    filter: drop-shadow(0 0.3cqw 0.4cqw rgba(0, 0, 0, .5)); }
.club-pow polygon { fill: #f4e7c9; stroke: #b8503f; stroke-width: 3.5; stroke-linejoin: round; }
.club-pow span {
    position: relative; transform: rotate(-9deg);
    font-family: var(--dk-font-display); font-size: 1.75cqw; letter-spacing: .04em;
    color: #b8503f;
}
.club-pow.gone { opacity: 0; transform: scale(1.3); }
@keyframes pow-in { from { transform: scale(.2) rotate(-30deg); opacity: 0; } }
/* the table jumps */
#stage.shake { animation: table-shake .5s cubic-bezier(.36, .07, .19, .97); }
@keyframes table-shake {
    10%, 90% { transform: translate(-2px, 1px); }
    20%, 80% { transform: translate(4px, -2px); }
    30%, 50%, 70% { transform: translate(-7px, 3px) rotate(-.3deg); }
    40%, 60% { transform: translate(7px, -3px) rotate(.3deg); }
}
@media (prefers-reduced-motion: reduce) {
    .club-strip, .club-orbit, .club-orbit.striking .club, .hut.bonked, .club-pow { animation: none; }
}

/* ── board life (life.js): lakes, smoke ────────────────────────────────────────────── */
.life-low, .life-high { position: absolute; inset: 0; pointer-events: none; }
.life-high { z-index: 150; }            /* smoke rises in front of the huts */
/* The lakes: two faint wave textures drifting different ways inside a mask of the twelve
   lakes, pulled in off the shore. Light added with `screen`, so it can only brighten the
   water a little - never stain it. */
.life-water {
    position: absolute; inset: 0; overflow: hidden;
    -webkit-mask: url('gfx/lakes_mask.png') 0 0 / 100% 100% no-repeat;
            mask: url('gfx/lakes_mask.png') 0 0 / 100% 100% no-repeat;
    mix-blend-mode: screen;
    opacity: .55;
}
.life-wave { position: absolute; top: -8%; bottom: -8%; left: -16cqw; right: -16cqw; }
.life-wave.a {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='60'%3E%3Cg fill='none' stroke='%23cfe6ff' stroke-width='1.3' stroke-linecap='round' opacity='.55'%3E%3Cpath d='M6 14 q10 -5 20 0 t20 0'/%3E%3Cpath d='M86 44 q10 -5 20 0 t20 0'/%3E%3Cpath d='M118 20 q7 -4 14 0'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 8cqw 3cqw;
    animation: wave-a 13s linear infinite;
}
.life-wave.b {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='90'%3E%3Cg fill='none' stroke='%23e6f2ff' stroke-width='1' stroke-linecap='round' opacity='.4'%3E%3Cpath d='M20 30 q12 -6 24 0 t24 0 t24 0'/%3E%3Cpath d='M130 70 q10 -5 20 0 t20 0'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 11cqw 4.5cqw;
    animation: wave-b 21s linear infinite, wave-breathe 7.5s ease-in-out infinite;
}
@keyframes wave-a { to { transform: translateX(-8cqw); } }
@keyframes wave-b { to { transform: translate(11cqw, 0); } }
@keyframes wave-breathe { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
/* Woodsmoke from a village's roofs (Violet's recipe): each puff is one finite pass - rises,
   widens, leans off with the wind and is gone - and three a third of a cycle apart make a
   broken column. Cycles and phases are random per chimney, so no two villages puff in time. */
.life-chimney { position: absolute; width: 0; height: 0; }
.life-puff {
    position: absolute;
    width: 1.5cqw; height: 1.5cqw; margin: -0.75cqw 0 0 -0.75cqw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(236, 232, 224, .72) 0%, rgba(214, 208, 198, .32) 46%, transparent 72%);
    opacity: 0;
    animation-name: clans-smoke;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
@keyframes clans-smoke {
    0%   { opacity: 0;   transform: translate(0, 0) scale(.35); }
    12%  { opacity: .95; }
    58%  { opacity: .6; }
    100% { opacity: 0;   transform: translate(calc(var(--drift, 1) * 140%), -420%) scale(2.6); }
}
@media (prefers-reduced-motion: reduce) {
    /* .life-wave.a/.b carry their own animation at two-class specificity, so name them here */
    .life-wave, .life-wave.a, .life-wave.b, .life-puff { animation: none; }
    .life-puff { opacity: 0; }
}


/* ── the welcome toast (welcome.js) ────────────────────────────────────────────────────
   When a game starts: a dark grey stone plate over the table -- the club turning, the line in
   the carved face, who starts -- held three seconds, then gone. The table stays visible round
   it; the plate is the only thing that is not the board. */
#clans-welcome {
    position: fixed; inset: 0; z-index: 1150;
    display: flex; align-items: center; justify-content: center;
    padding: 16px; box-sizing: border-box;
    background: rgba(10, 8, 6, .35);
    opacity: 0; transition: opacity 360ms ease;
    pointer-events: none;
}
#clans-welcome.show { opacity: 1; }
.welcome-plate {
    position: relative; isolation: isolate;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 18px 40px 22px; text-align: center;
    border: 1px solid var(--clans-chisel);
    border-radius: var(--clans-hewn);
    box-shadow: var(--clans-slab-depth), 0 4px 0 rgba(12, 8, 4, .55), 0 22px 46px rgba(0, 0, 0, .7);
    transform: translateY(8px) scale(.97);
    transition: transform 420ms cubic-bezier(.2, 1.3, .4, 1);
}
#clans-welcome.show .welcome-plate { transform: none; }
/* dark grey stone, on its own layer (painted under animating content, the noise re-tiled) */
.welcome-plate::before {
    content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
    background:
        var(--clans-grit) 0 0 / 190px 190px,
        radial-gradient(130% 100% at 30% 0%, #474542 0%, #33312f 55%, #262523 100%);
}
.welcome-club {
    width: 72px; height: 72px; overflow: hidden;
    transform: rotate(-14deg);
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .6));
}
.welcome-title {
    font-family: var(--dk-font-display);
    font-size: clamp(24px, 4.2vw, 40px); line-height: 1.1; letter-spacing: .04em;
    color: var(--clans-bone);
    text-shadow: 0 -1px 0 rgba(255, 240, 215, .16), 0 3px 0 rgba(0, 0, 0, .7);
}
.welcome-title::first-letter { color: var(--dk-accent); }
.welcome-line { font-family: var(--dk-font-ui); font-size: 16px; color: var(--clans-bone-dim); }
@media (max-height: 520px) {
    .welcome-plate { padding: 10px 26px 14px; }
    .welcome-club { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
    #clans-welcome, .welcome-plate { transition: none; }
    .welcome-club .club-strip { animation: none; }
}


/* ── the founding-order question (game.js askVillageOrder) ──────────────────────────────
   The choice is about the board, so the board stays in view: a light backdrop, the panel
   docked at the bottom with the options side by side, and each candidate lit and lettered
   where it stands -- tap the letter's village on the board or its button, either works. */
#village-order {
    background: rgba(10, 7, 4, .28);
    align-items: end;
    pointer-events: none;
}
#village-order .panel {
    pointer-events: auto;
    width: min(640px, 96vw);
    padding: 14px 18px 16px;
}
#village-order .panel h2 { font-size: 21px; margin-bottom: 4px; }
#village-order .over-line { font-size: 13.5px; line-height: 1.45; margin-bottom: 4px; }
.village-picks { display: flex; gap: 10px; }
.village-picks .village-pick {
    position: relative; flex: 1 1 0; min-width: 0;
    padding: 9px 12px 9px 40px; margin-top: 8px;
}
.vp-letter, .order-mark {
    font-family: var(--dk-font-display); font-style: normal;
    color: #fff8ec; background: var(--dk-accent);
    display: grid; place-items: center;
    border-radius: 50%;
    box-shadow: 0 2px 0 rgba(60, 20, 12, .6), 0 4px 8px rgba(0, 0, 0, .45);
}
.vp-letter { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; font-size: 15px; }
.vp-score { display: flex; align-items: center; gap: 4px; margin-top: 2px; color: var(--clans-bone) !important; font-weight: 600 !important; }
.vp-then { font-style: normal; font-weight: 400; opacity: .8; }
.vp-dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .6); background: var(--c); }
.vp-dot[data-clan="red"]    { --c: var(--clan-red); }
.vp-dot[data-clan="blue"]   { --c: var(--clan-blue); }
.vp-dot[data-clan="green"]  { --c: var(--clan-green); }
.vp-dot[data-clan="yellow"] { --c: var(--clan-yellow); }
.vp-dot[data-clan="black"]  { --c: var(--clan-black); }
.order-mark {
    position: absolute; z-index: 175; pointer-events: none;
    width: 2.4cqw; height: 2.4cqw; margin: -1.2cqw 0 0 -1.2cqw;
    font-size: 1.5cqw;
    border: 0.15cqw solid #fff8ec;
    animation: order-bob 1.6s ease-in-out infinite;
}
@keyframes order-bob { 50% { transform: translateY(-0.35cqw); } }
#areas .area.village { cursor: pointer; }
@media (max-height: 520px), (max-width: 560px) {
    #village-order .panel { padding: 8px 12px 10px; }
    #village-order .panel h2 { font-size: 17px; margin-bottom: 2px; }
    #village-order .over-line { font-size: 12px; }
    .village-picks .village-pick { padding: 6px 8px 6px 34px; min-height: 44px; }
    .village-picks .village-pick span:not(.vp-score) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .order-mark { animation: none; } }


/* ── the suspicion panel (header eye button) ────────────────────────────────────────────
   Same geometry and material as the shared move-log / AI panels, so the three read as one
   family; its own id, because the shared sheet only knows those two. */
#suspect-btn svg { width: 20px; height: 20px; display: block; margin: auto; }
#sound-btn svg, #music-btn svg { width: 20px; height: 20px; display: block; margin: auto; }
#sound-btn.muted, #music-btn.muted { opacity: .7; }
#suspect-panel {
    position: fixed;
    right: 12px;
    top: calc(var(--dk-header-h) + 6px);
    width: min(280px, 88vw);
    max-height: 68dvh; overflow-y: auto;
    padding: 11px 13px 13px;
    box-sizing: border-box;
    background: var(--dk-panel);
    border: 1px solid var(--dk-panel-line);
    border-radius: var(--dk-radius);
    box-shadow: var(--dk-panel-shadow);
    color: var(--dk-panel-text);
    font-family: var(--dk-font-ui);
    z-index: var(--dk-z-panel);
}
.suspect-sub { font-size: 12px; line-height: 1.45; color: var(--dk-panel-dim); margin-bottom: 9px; }
#suspect { display: flex; flex-direction: column; gap: 5px; }
.suspect-row {
    display: grid; grid-template-columns: 22px 78px 1fr 36px; align-items: center; gap: 7px;
    padding: 3px 5px; border-radius: var(--clans-hewn-sm);
    font-size: 12.5px;
}
.suspect-row img { width: 22px; height: auto; display: block; }
.suspect-row.mine { background: rgba(184, 80, 63, .18); box-shadow: inset 0 0 0 1px rgba(184, 80, 63, .5); }
.suspect-name em { font-style: normal; font-size: 10.5px; color: #e0806a; }
.suspect-bar { height: 7px; border-radius: 4px; background: rgba(0, 0, 0, .35); overflow: hidden; }
/* the fill is a full-width bar scaled from the left (game.js sets --odds): a transform, not a
   width, so a new read of the table never re-lays-out the panel; the track's radius clips it */
.suspect-bar i {
    display: block; height: 100%;
    background: var(--c, var(--clans-bone));
    transform: scaleX(var(--odds, 0)); transform-origin: left center;
    transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}
.suspect-row[data-clan="red"]    { --c: var(--clan-red); }
.suspect-row[data-clan="blue"]   { --c: var(--clan-blue); }
.suspect-row[data-clan="green"]  { --c: var(--clan-green); }
.suspect-row[data-clan="yellow"] { --c: var(--clan-yellow); }
.suspect-row[data-clan="black"]  { --c: #8a8794; }       /* the black clan, lifted to read on stone */
.suspect-pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .suspect-bar i { transition: none; } }
@media (max-height: 520px) { .suspect-sub { display: none; } .suspect-row { padding: 1px 5px; } #suspect { gap: 2px; } }


/* ══ The rulebook (rulebook.js): a stone tablet over the table ══════════════════════════
   The Botanists book, cut in this game's stone: the same slab as every dialog, the cover's
   carved CLANS on its head, bone ink, chapters down the side lit as you read. The worked
   examples are drawn with the real hut pieces, laid in shallow hollows cut into the slab. */
#clans-rulebook {
    position: fixed; inset: 0; z-index: 1300;
    display: flex; align-items: center; justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 12px 12px;
    background: rgba(10, 7, 4, 0.66);
    opacity: 0; transition: opacity 200ms ease-out;
}
#clans-rulebook.show { opacity: 1; }
.rb-book {
    --rb-line: rgba(0, 0, 0, .45);
    position: relative;
    width: min(1040px, 100%); height: min(100%, 900px);
    display: grid; grid-template-columns: 214px 1fr; grid-template-rows: auto 1fr;
    /* grit and light only: at book size the 560px mottle tile shows its seams */
    background:
        var(--clans-grit) 0 0 / 190px 190px,
        radial-gradient(130% 90% at 28% 0%, rgba(255, 232, 196, .10), transparent 62%),
        linear-gradient(180deg, var(--clans-stone-hi), var(--clans-stone) 46%, var(--clans-stone-lo));
    border: 1px solid var(--clans-chisel);
    border-radius: var(--clans-hewn);
    box-shadow: var(--clans-slab-depth), 0 4px 0 rgba(12, 8, 4, .55), 0 26px 60px rgba(0, 0, 0, .65);
    color: var(--clans-bone);
    font-family: var(--dk-font-ui);
    transform: translateY(8px); transition: transform 260ms cubic-bezier(.2, .8, .3, 1);
    overflow: hidden;
}
#clans-rulebook.show .rb-book { transform: none; }
.rb-head {
    grid-column: 1 / -1;
    display: flex; align-items: center; gap: 16px;
    padding: 10px 14px 10px 20px;
    border-bottom: 1px solid var(--rb-line);
    box-shadow: 0 1px 0 rgba(255, 236, 206, .07);
}
.rb-logo { height: 46px; width: auto; filter: drop-shadow(0 2px 0 rgba(12, 8, 4, .55)); }
.rb-sub { font-family: var(--dk-font-display); font-size: 21px; letter-spacing: .06em; color: var(--clans-bone-dim); }
.rb-close {
    margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center;
    border: 1px solid rgba(239, 228, 207, .28); border-radius: 50%; background: rgba(0, 0, 0, .18);
    color: var(--clans-bone); cursor: pointer; font-family: var(--dk-font-ui);
}
.rb-close svg { width: 20px; height: 20px; }
.rb-close:hover { background: var(--dk-accent-soft); border-color: var(--dk-accent); }
.rb-close:focus-visible, .rb-toc a:focus-visible, .rb-body a:focus-visible { outline: 2px solid var(--clans-bone); outline-offset: 2px; }

.rb-toc {
    padding: 14px 8px 14px 12px; border-right: 1px solid var(--rb-line);
    overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
    background: rgba(0, 0, 0, .12);
}
.rb-toc a {
    display: flex; align-items: center; min-height: 44px; box-sizing: border-box;
    padding: 6px 12px; border-radius: var(--clans-hewn-sm);
    color: var(--clans-bone-dim); text-decoration: none; font-size: 14px; line-height: 1.25;
}
.rb-toc a:hover { background: rgba(255, 236, 206, .06); color: var(--clans-bone); }
.rb-toc a.on { background: rgba(184, 80, 63, .22); color: var(--clans-bone); font-weight: 600; }
/* the open chapter carries a tally notch, scratched like the start card's, not a stripe down its side */
.rb-toc a.on::before {
    content: ''; flex: none; width: 3px; height: 14px; margin-right: 9px; border-radius: 1.5px;
    background: #e0806a; transform: rotate(-6deg);
}

.rb-body { overflow-y: auto; padding: 4px 30px 34px; scroll-behavior: smooth; font-size: 17px; line-height: 1.55;
           font-family: 'Clans Text', 'Segoe UI', Roboto, system-ui, sans-serif; letter-spacing: .005em;
           /* the text sinks into the stone at the foot: there is more below, even where no scrollbar shows */
           -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
                   mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent); }
.rb-body::-webkit-scrollbar { width: 10px; }
.rb-body::-webkit-scrollbar-thumb { background: rgba(239, 228, 207, .2); border-radius: 5px; }
.rb-chapter { max-width: 760px; padding-top: 18px; }
.rb-chapter + .rb-chapter { border-top: 1px solid var(--rb-line); box-shadow: 0 -1px 0 rgba(255, 236, 206, .06); margin-top: 18px; }
.rb-chapter h2 {
    font-family: var(--dk-font-display); font-weight: 400; font-size: 28px; letter-spacing: .04em;
    color: var(--dk-accent); margin: 6px 0 12px; text-wrap: balance;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .5);
}
.rb-body p { margin: 0 0 12px; max-width: 68ch; }
.rb-body em { color: #f6d6b0; font-style: normal; font-weight: 600; }
.rb-body b { color: var(--clans-bone); }
.rb-body a { color: #e8a08c; text-underline-offset: 3px; }
.rb-lede { font-size: 17px; line-height: 1.6; }
.rb-credit { font-size: 13px; color: var(--clans-bone-dim); }
.rb-foot { margin-top: 30px; font-size: 12px; color: var(--clans-bone-dim); }
.rb-note {
    display: block; margin: 8px 0 2px; padding: 9px 13px; max-width: 68ch;
    border-radius: var(--clans-hewn-sm); background: rgba(0, 0, 0, .2);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, .35);
    font-size: 14px; color: var(--clans-bone-dim);
}
.rb-steps, .rb-bullets { margin: 0 0 12px; padding-left: 22px; max-width: 68ch; }
.rb-steps li, .rb-bullets li { margin-bottom: 7px; padding-left: 4px; }
.rb-steps li::marker { color: var(--dk-accent); font-family: var(--dk-font-display); }
.rb-bullets li::marker { color: var(--dk-accent); }

.rb-plate { margin: 0; }
.rb-plate img {
    display: block; max-width: 100%; border-radius: 6px;
    border: 3px solid #1c1612;
    box-shadow: 0 2px 0 rgba(255, 236, 206, .1), 0 8px 18px rgba(0, 0, 0, .55);
}
.rb-plate.rb-wide { margin: 6px 0 14px; }
.rb-plate.rb-tall img { width: 128px; }
.rb-row { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; margin: 6px 0 10px; }

.rb-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin: 4px 0 14px; }
.rb-parts figure, .rb-terrains figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; }
.rb-parts figcaption, .rb-terrains figcaption { font-size: 13px; color: var(--clans-bone-dim); line-height: 1.3; }
.rb-board-thumb { width: 150px; border-radius: 4px; border: 2px solid #1c1612; box-shadow: 0 4px 10px rgba(0, 0, 0, .5); }
.rb-hutrow { display: flex; gap: 2px; min-height: 60px; align-items: flex-end; }
.rb-cards { display: flex; gap: 6px; }
.rb-cards img { width: 54px; height: 54px; border-radius: 4px; border: 2px solid #1c1612; box-shadow: 0 4px 8px rgba(0, 0, 0, .5); }
.rb-chip {
    width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
    background: radial-gradient(circle at 36% 30%, #fff, #f2efe6 62%, #d8d2c2 100%);
    border: 1px solid rgba(90, 70, 40, .55); box-shadow: 0 3px 6px rgba(0, 0, 0, .5);
    color: #4a3a1c; font-weight: 700; font-size: 18px;
}
.rb-terrains { display: grid; grid-template-columns: repeat(4, minmax(0, 120px)); gap: 14px; margin: 4px 0 14px; }
.rb-terrains .rb-terrain { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; border: 2px solid #1c1612; box-shadow: 0 4px 10px rgba(0, 0, 0, .5); }

/* worked examples: fields are shallow hollows cut into the stone */
.rb-example { margin: 8px 0 16px; max-width: 700px; }
/* pictures from the game's own table, captioned, in a wrapping row */
.rb-snaps { display: flex; flex-wrap: wrap; gap: 14px 18px; margin: 10px 0 16px; align-items: flex-start; }
.rb-snap { margin: 0; width: 220px; max-width: 100%; }
.rb-snap.rb-snap-wide { width: 250px; }
.rb-snap img { display: block; width: 100%; border-radius: 6px; border: 2px solid #1c1612; box-shadow: 0 4px 10px rgba(0, 0, 0, .5); }
.rb-snap figcaption { margin-top: 6px; font-size: .86em; line-height: 1.4; color: var(--clans-bone-dim); }
.rb-ex-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rb-field {
    display: inline-flex; align-items: flex-end; justify-content: center; flex-wrap: wrap; gap: 0;
    min-width: 72px; min-height: 62px; padding: 6px 8px; box-sizing: border-box;
    border-radius: 14px 9px 15px 8px / 9px 14px 8px 15px;
    background: rgba(0, 0, 0, .24);
    box-shadow: inset 0 3px 7px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 236, 206, .08);
}
.rb-field.rb-empty { opacity: .55; }
.rb-field.rb-lit { box-shadow: inset 0 3px 7px rgba(0, 0, 0, .5), 0 0 0 2px #e0a85c; }
.rb-wide-field { min-width: 260px; }
.rb-hut { width: 34px; height: auto; margin: 0 -3px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); }
.rb-out { display: inline-flex; margin-left: 10px; position: relative; }
.rb-out .rb-hut { opacity: .45; filter: grayscale(.5) drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); }
.rb-out::after {
    content: ''; position: absolute; left: -4px; right: -4px; top: 50%; height: 3px;
    background: var(--dk-accent); transform: rotate(-12deg); border-radius: 2px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .5);
}
.rb-arrow, .rb-eq { font-size: 24px; color: var(--clans-bone-dim); }
.rb-sum { font-size: 15px; }
.rb-sum b { font-size: 19px; color: #f6d6b0; }
.rb-caption { font-size: 13.5px !important; color: var(--clans-bone-dim); margin: 6px 0 0 !important; }

.rb-epochs { border-collapse: collapse; width: 100%; max-width: 640px; font-size: 14px; margin: 4px 0 16px; }
.rb-epochs th { text-align: left; font-weight: 600; color: var(--clans-bone-dim); font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--rb-line); }
.rb-epochs td { padding: 7px 8px; border-bottom: 1px solid rgba(0, 0, 0, .3); vertical-align: middle; }
.rb-epochs td:first-child { font-family: var(--dk-font-display); color: var(--dk-accent); font-size: 17px; }
.rb-epochs td:nth-child(4) { font-weight: 700; color: #f6d6b0; font-variant-numeric: tabular-nums; }
.rb-epochs .rb-terrain { width: 24px; height: 24px; border-radius: 5px; vertical-align: middle; margin-right: 6px; border: 1px solid #1c1612; }

.rb-edition { padding: 14px 18px; border-radius: var(--clans-hewn-sm); background: rgba(184, 80, 63, .1); box-shadow: inset 0 0 0 1px rgba(184, 80, 63, .35); max-width: 720px; }
.rb-edition .rb-bullets { margin: 0; }

/* the start card's small "How to play" link */
.clans-start-rules {
    display: inline-flex; align-items: center; justify-content: center;
    align-self: center; margin-top: 2px; min-height: 44px; padding: 0 14px;
    background: none; border: 0; cursor: pointer; touch-action: manipulation;
    font: 600 14px var(--dk-font-ui); color: var(--clans-bone);
    text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(239, 228, 207, .4);
}
.clans-start-rules:hover { text-decoration-color: currentColor; }
.clans-start-rules:focus-visible { outline: 2px solid var(--clans-bone); outline-offset: 2px; border-radius: 4px; }

@media (max-width: 820px) {
    .rb-book { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; height: 100%; }
    .rb-toc { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--rb-line); padding: 6px 8px; gap: 4px; scrollbar-width: none; }
    .rb-toc a { white-space: nowrap; padding: 8px 12px; }
    .rb-body { padding: 4px 18px 30px; }
    .rb-row { gap: 14px; }
    .rb-plate.rb-tall img { width: 92px; }
    .rb-field { min-width: 56px; min-height: 50px; padding: 4px 6px; }
    .rb-hut { width: 27px; }
    .rb-wide-field { min-width: 0; }
    .rb-terrains { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
    .rb-logo { height: 34px; }
    .rb-sub { font-size: 17px; }
}
@media (max-height: 520px) { .rb-head { padding: 4px 10px 4px 14px; } .rb-logo { height: 28px; } .rb-sub { display: none; } }
@media (prefers-reduced-motion: reduce) { #clans-rulebook, .rb-book { transition: none; } .rb-body { scroll-behavior: auto; } }


/* ── a selected field (tap-to-select, board.js enableDrag) ───────────────────────────────
   While a field waits for its target tap, its outline breathes, slowly — so it reads as
   "holding", and not as the flash a field gives when it has no legal move. */
#areas.selecting .area.src { animation: clans-held 1.4s ease-in-out infinite; stroke-width: 5; }
@keyframes clans-held { 50% { stroke: #e0a85c; fill: rgba(255, 220, 160, .28); } }
@media (prefers-reduced-motion: reduce) { #areas.selecting .area.src { animation: none; } }

/* ── the rotate cover: phones held upright ──────────────────────────────────────────────
   A PHONE, not a tablet: portrait on a tablet has its own layout (board above, columns
   below). The test is a coarse pointer, portrait, and a narrow screen — 700px covers the
   largest phones and foldables' outer screens and stops short of an iPad mini (744). */
#rotate-cover { display: none; }
@media (pointer: coarse) and (orientation: portrait) and (max-width: 700px) {
    #rotate-cover {
        position: fixed; inset: 0; z-index: 2000;
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 12px; padding: 24px; box-sizing: border-box; text-align: center;
        background:
            var(--clans-grit) 0 0 / 190px 190px,
            radial-gradient(ellipse at 50% 42%, #3d3b39 0%, #2b2a28 60%, #1c1b1a 100%);
        color: var(--clans-bone);
    }
}
.rot-phone { width: 120px; height: 120px; fill: none; stroke: var(--clans-bone); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.rot-phone .rot-body { transform-origin: 60px 46px; animation: rot-turn 2.6s cubic-bezier(.6, 0, .3, 1) infinite; }
.rot-phone .rot-line { transform-origin: 60px 46px; animation: rot-turn 2.6s cubic-bezier(.6, 0, .3, 1) infinite; }
.rot-phone .rot-arrow, .rot-phone .rot-head { stroke: var(--dk-accent); }
.rot-phone .rot-head { fill: var(--dk-accent); }
@keyframes rot-turn { 0%, 25% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
.rot-title { font-family: var(--dk-font-display); font-size: 28px; letter-spacing: .04em; }
.rot-title::first-letter { color: var(--dk-accent); }
.rot-body-text { font-size: 15px; line-height: 1.5; max-width: 30ch; color: var(--clans-bone-dim); }
@media (prefers-reduced-motion: reduce) { .rot-phone .rot-body, .rot-phone .rot-line { animation: none; transform: rotate(-90deg); } }

/* ══ PHONES: TWO LAYOUTS, NOT FIVE (user, 2026-10-02; the WayBack rule) ═════════════════════
   Every phone-only rule in this sheet sits behind one of exactly two thresholds:
     PHONE        (max-height: 520px)  any phone held sideways — the bigger ones (Pixel 7,
                                       flagship: 411 tall) get this alone
     SMALL PHONE  (max-height: 400px)  added on top for the small ones (S25 at 384, POCO X3
                                       at 393, the 640x360 budget phone)
   The GAME is one layout on all of them — board left, one column right; measured: board 57–64%
   of the screen, no column overflows, no scroll on any preset — so only the start card and the
   dialogs differ between the two tiers. A new phone rule picks one of these two; a third
   threshold is the drift this note exists to stop. */
/* ── the clan card on a short screen (a phone held sideways) ───────────────────────────────
   Stacked, card over text over button, it measured 493px against a 330–380px window: the
   heading and the top of the card scrolled away. Sideways there is width to spare and no
   height, so the card stands on the left and the words and the button beside it. */
@media (max-height: 520px) {
    #clan-reveal .panel {
        width: min(640px, 94vw);
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-areas: "card head" "card line" "card note" "card ok";
        column-gap: 20px; align-items: center;
        padding: 14px 20px 16px;
        text-align: left;
    }
    #clan-reveal .panel h2 { grid-area: head; font-size: 20px; margin: 0 0 4px; }
    #clan-reveal .reveal-card { grid-area: card; width: min(132px, 34vh); height: auto; aspect-ratio: 1; margin: 0; }
    #clan-reveal .over-line { grid-area: line; font-size: 14px; line-height: 1.45; margin: 0 0 6px; }
    #clan-reveal .reveal-note { grid-area: note; font-size: 12px; line-height: 1.4; margin: 0; }
    #clan-reveal .primary-btn { grid-area: ok; margin-top: 10px; min-height: 44px; }
}

/* ── start card details (critique 2026-10-02) ──────────────────────────────────────────── */
.clans-level-note { font-size: 12.5px; line-height: 1.35; color: var(--dk-start-ink-dim); margin-top: 5px; min-height: 2.7em; }
/* A phone held sideways: the start screen's band begins BELOW the header, so the card is
   centred in the room that is actually free (it was centred in the whole window and its top
   sat 13px under the header strip). */
@media (max-height: 520px) {
    :root { --dk-start-inset: 8px 8px 6px; --dk-start-inset-floor: 8px 8px 4px; }
    /* ...and only where there IS a header: a touch device has none (body.chrome-none), and the
       52px kept for it pushed the card down and shrank it (critique 2026-10-16). */
    body:not(.chrome-none) { --dk-start-inset: calc(var(--dk-header-h) + 2px) 8px 6px;
                             --dk-start-inset-floor: calc(var(--dk-header-h) + 2px) 8px 4px; }
}

/* ── the carved tallies (start.js tallyRow): the choices cut into the stone ────────────────
   Each choice is a small stone of its own, set in a hollow. The chosen one stands up out of
   it — lit lip, a hard foot, an ochre-painted edge — and the others lie sunk and dim. The
   players are counted in NOTCHES (||, |||, ||||), the way a tally is kept; the opponents are
   three named stones with one, two and three notches. */
.clans-tallies {
    display: flex; gap: 6px;
    padding: 4px;
    border-radius: 12px 7px 13px 6px / 7px 12px 6px 13px;
    background: var(--clans-hollow);
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 236, 206, .08);
}
.clans-tally {
    flex: 1 1 0; min-width: 0; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 5px 6px;
    border: 1px solid transparent;
    border-radius: var(--clans-hewn-sm);
    background: transparent;
    color: var(--clans-bone-dim);
    font: 600 13.5px var(--dk-font-ui);
    cursor: pointer; touch-action: manipulation;
    transition: background-color .15s, color .15s, transform .15s cubic-bezier(.2, .8, .2, 1);
}
.clans-tally:hover { color: var(--clans-bone); background: rgba(255, 236, 206, .05); }
.clans-tally[aria-checked="true"] {
    color: var(--clans-bone);
    background:
        var(--clans-grit) 0 0 / 190px 190px,
        linear-gradient(180deg, var(--clans-stone-hi), var(--clans-stone));
    border-color: rgba(184, 80, 63, .85);
    box-shadow: inset 0 1px 0 rgba(255, 236, 206, .18), 0 2px 0 rgba(12, 8, 4, .6), 0 4px 8px rgba(0, 0, 0, .4);
    transform: translateY(-1px);
}
.clans-tally:focus-visible { outline: 2px solid var(--clans-bone); outline-offset: 2px; }
/* the notches: short cuts with a lit lower lip, like marks scratched into rock */
.clans-notches { display: inline-flex; gap: 3px; align-items: center; height: 18px; }
.clans-notches i {
    display: block; width: 3px; height: 16px; border-radius: 1.5px;
    background: currentColor;
    box-shadow: 0 1px 0 rgba(255, 236, 206, .12);
    transform: rotate(-6deg);
}
.clans-notches i:nth-child(2n) { transform: rotate(4deg); height: 15px; }
.clans-tally[aria-checked="true"] .clans-notches i { background: #e0806a; }
.clans-notches-sm { height: 12px; gap: 2px; }
.clans-notches-sm i { width: 2px; height: 11px; }
.clans-notches-sm i:nth-child(2n) { height: 10px; }
.clans-tally-n { font-size: 15px; font-variant-numeric: tabular-nums; }
/* a level name that does not fit wraps onto a second line inside the stone (min-height 44px)
   rather than being cut to an ellipsis -- "Ich denken!" was, on a screen with other fonts */
.clans-tally-w { white-space: normal; text-wrap: balance; text-align: center; line-height: 1.05; min-width: 0; overflow-wrap: break-word; }
.clans-level-note { margin-top: 6px; }
/* the Board stones: a small folded map, its outline whole for the printed board and dashed
   for a generated one (still being drawn). Ochre when chosen, like the notches. */
.clans-board-glyph { width: 22px; height: 16px; flex: none; }
.clans-tally[aria-checked="true"] .clans-board-glyph { color: #e0806a; }
@media (prefers-reduced-motion: reduce) { .clans-tally { transition: none; } }

/* the header's small name steps out while the carved one is on the card */
:root { --dk-start-header-title: hidden; }

/* ── short screens: the card at FULL scale, so every target is a real 44px ────────────────
   fitCard used to shrink the card to 0.86 here, and every control with it (38px). The card
   is tightened instead: a smaller wordmark, and on the smallest phones the premise sentence
   stays while the win condition steps out (it is in the rulebook, and the premise is not). */
@media (max-height: 520px) {
    .clans-wordmark { width: min(150px, 100%); margin: -6px auto 2px; }
    /* the level's line is the one thing on the card that only explains a control beside it */
    .clans-level-note { display: none; }
    .clans-tallies { padding: 2px; gap: 4px; }
    :root { --dk-start-pad-narrow: 10px 20px 12px; --dk-start-pad: 10px 22px 12px; }
}
@media (max-height: 400px) {
    :root { --dk-start-subtitle-floor: block; }   /* the win line stays: it fits down to 340px (below) */
    /* the language flag stands in the card's top-right corner: the subtitle starts below it */
    .clans-wordmark { width: min(120px, 100%); margin: -6px auto 16px; }
}

/* ── the lobby on a short screen: rows side by side, so no view needs a scrollbar ────────
   (user, 2026-10-02: "on a budget phone some screens in mp need a scrollbar".) mpDialog.js
   groups controls into .mp-row; on a normal screen a row is invisible (display: contents) and
   the card stacks exactly as before. Sideways on a phone the card widens and each row lays its
   members out next to each other: Create / Join / Back in one line, the two fields together,
   the room code beside the seat list. */
.mp-row { display: contents; }
.mp-codebox { display: contents; }
@media (max-height: 520px) {
    .mp-card { width: min(600px, 96vw); padding: 10px 16px 12px; }
    .mp-row { display: flex; gap: 10px; align-items: stretch; }
    .mp-row > * { flex: 1 1 0; min-width: 0; }
    .mp-row > .mp-btn { margin-top: 6px; }
    .mp-row > .mp-field { margin-bottom: 4px; }
    .mp-codebox { display: flex; flex-direction: column; justify-content: center; }
    .mp-codebox .mp-code { font-size: 32px; margin: 0 0 4px; }
    .mp-seats { margin: 0; }
    .mp-seat { padding: 4px 8px; min-height: 30px; }
    .mp-err:empty { min-height: 0; margin-top: 0; }
}

/* a phone held sideways: the level stones' names ("Me think!", "Ich denken!") get the room */
@media (max-height: 520px) {
    .clans-tally { gap: 4px; padding: 5px 3px; font-size: 12.5px; }
}



/* ══ THE TURNING OF AN AGE (ages.js) ═══════════════════════════════════════════════════════
   A tablet rises over the top edge of the board when an epoch begins: its numeral, the land
   it favours (+bonus) and the land it ruins (scores nothing), while those terrains light up
   and darken on the board itself. Uncovered top-down like a slab dug out, never modal. */
#clans-age {
    /* centred on the MAP: on a short screen the board's chart strip is cropped off (--clans-vis) */
    position: absolute; top: 1.6cqw; left: calc(50% * var(--clans-vis, 1)); z-index: 140;
    display: flex; align-items: center; gap: .9em;
    padding: .55em 1.25em .6em .95em;
    font-size: clamp(11px, 1.55cqw, 19px);
    color: var(--clans-bone);
    background: var(--clans-slab);
    border: 1px solid var(--clans-chisel);
    border-radius: var(--clans-hewn);
    box-shadow: var(--clans-slab-depth), 0 3px 0 rgba(12, 8, 4, .55), 0 14px 30px rgba(0, 0, 0, .62);
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, -14px);
    opacity: 0;
    clip-path: inset(0 0 100% 0 round 10px);
    transition: transform 560ms cubic-bezier(.16, 1, .3, 1), opacity 240ms ease-out,
                clip-path 560ms cubic-bezier(.16, 1, .3, 1);
}
#clans-age.show { transform: translate(-50%, 0); opacity: 1; clip-path: inset(0 0 0 0 round 10px); }
#clans-age.gone {
    transform: translate(-50%, -10px); opacity: 0;
    transition: transform 380ms ease-in, opacity 380ms ease-in;
}
.age-numeral {
    font-family: var(--dk-font-display);
    font-size: 2.9em; line-height: .9; letter-spacing: .02em;
    color: var(--dk-accent);
    text-shadow: 0 -1px 0 rgba(255, 220, 190, .18), 0 2px 0 rgba(0, 0, 0, .75);
    min-width: 1.2em; text-align: center;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 520ms cubic-bezier(.16, 1, .3, 1) 220ms;
}
#clans-age.show .age-numeral { clip-path: inset(0 0 0 0); }
.age-body { display: flex; flex-direction: column; gap: .3em; }
.age-title {
    font-family: var(--dk-font-display);
    font-size: 1.15em; letter-spacing: .06em; line-height: 1;
    color: var(--clans-bone);
}
.age-lands { display: flex; gap: 1em; align-items: center; }
.age-land {
    position: relative;
    display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto;
    column-gap: .5em; align-items: center;
    font-family: var(--dk-font-ui); line-height: 1.15;
}
.age-land img {
    grid-row: 1 / 3;
    width: 2.5em; height: 2.5em; object-fit: cover;
    border-radius: var(--clans-hewn-sm);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .5), 0 2px 4px rgba(0, 0, 0, .55);
}
.age-land b  { font-weight: 600; font-size: .95em; }
.age-land em { font-style: normal; font-size: .9em; }
.age-land.fav em { color: #f1c27a; font-weight: 700; font-variant-numeric: tabular-nums; }
.age-land.hostile b, .age-land.hostile em { color: var(--clans-bone-dim); }
.age-land.hostile img { filter: grayscale(1) brightness(.5) contrast(1.15); }
/* the ruined land: a chisel crack struck across its tile */
.age-land.hostile::after {
    content: ""; position: absolute; left: 0; top: 50%;
    width: 2.5em; height: 2.5em; transform: translateY(-50%);
    background: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 40 40%22%3E%3Cpath d=%22M6 5 15 17 11 21 23 27 20 31 34 36%22 fill=%22none%22 stroke=%22%23d9584a%22 stroke-width=%222.6%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.age-final { font-family: var(--dk-font-ui); font-weight: 600; color: #f1c27a; }

/* the land itself, while the tablet stands: one ring round each region (board.js ageWash) */
#age-wash { pointer-events: none; animation: clans-age-wash 3.3s ease-out both; }
@keyframes clans-age-wash {
    0%       { opacity: 0; }
    18%, 72% { opacity: 1; }
    100%     { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    #clans-age, #clans-age.show, #clans-age.gone { transform: translate(-50%, 0); clip-path: none; transition: opacity 300ms ease-out; }
    .age-numeral { clip-path: none; transition: none; }
    #age-wash { animation: none; }
}


/* ══ VILLAGERS VISITING (walkers.js) ═══════════════════════════════════════════════════════
   One of a clan's people walks between two neighbouring areas that both hold that clan's huts.
   The frame is a 12-step strip (gfx/walker.webp, rendered with HyperFrames in
   videos/clans-walker) slid one frame per step; z 19 keeps them BEHIND the huts (20+), so a
   villager steps out from behind one hut and disappears behind the other. */
.walker {
    position: absolute;
    width: 1.8cqw; aspect-ratio: 1;
    transform: translate(-50%, -88%);
    z-index: 19;
    pointer-events: none;
    filter: drop-shadow(0 .1cqw .1cqw rgba(0, 0, 0, .45));
}
/* only the FRAME is mirrored for a leftward walk, so the "?" above never reads backwards */
.walker-frame { position: absolute; inset: 0; overflow: hidden; }
.walker.left .walker-frame { transform: scaleX(-1); }
.walker-strip {
    width: 1200%; height: 100%;
    background: url('gfx/walker.webp') 0 0 / 100% 100% no-repeat;
    animation: clans-walk .8s steps(12) infinite;
}
@keyframes clans-walk { to { transform: translateX(-100%); } }
/* a feather in the clan's colour, tucked into the hair */
.walker-feather {
    position: absolute; left: 47%; top: 6%;
    width: 9%; height: 22%;
    border-radius: 50% 50% 45% 45% / 70% 70% 30% 30%;
    background: var(--feather);
    box-shadow: inset 0 0 0 .05cqw rgba(20, 12, 6, .8);
    transform: rotate(-28deg);
    transform-origin: 50% 100%;
}
/* the huts they were walking to have gone: stand still, look round, wonder */
.walker.wonder .walker-strip { animation-play-state: paused; }
.walker-q {
    position: absolute; left: 50%; bottom: 96%;
    font-family: var(--dk-font-display); font-weight: 400;
    font-size: 1.25cqw; line-height: 1;
    color: var(--clans-bone);
    text-shadow: 0 0 .12cqw #24170e, 0 .08cqw .1cqw #24170e;
    transform: translate(-50%, .3cqw) scale(.4);
    opacity: 0;
    transition: opacity 160ms ease-out, transform 260ms cubic-bezier(.16, 1, .3, 1);
}
.walker.wonder .walker-q { opacity: 1; transform: translate(-50%, 0) scale(1); }
@media (prefers-reduced-motion: reduce) { .walker { display: none; } }
@media (max-height: 520px) {
    /* A phone held sideways: the table takes all the height the button leaves -- SOLVED by the
       panel, not guessed. It was `100dvh - 84px`, which forgot the overlay's padding and the
       button's 48px: every phone scrolled the panel by 18px (user, 2026-10-16, a flagship). The
       panel is now a column exactly the window's height and the frame flexes into the rest. */
    #game-over { padding: 8px; }
    #game-over .final-panel {
        display: flex; flex-direction: column;
        height: calc(100dvh - 16px); max-height: none; overflow: hidden;
        padding: 6px 8px 8px;
    }
    #final-frame { flex: 1 1 auto; min-height: 0; aspect-ratio: auto; height: auto; max-height: none; }
    .final-actions { flex: none; margin-top: 6px; }
    .final-actions .start-play { min-height: 44px; padding-top: 6px; padding-bottom: 6px; }
    /* the tutorial's closing line sizes the frame itself (game.js tutFinalNote) */
    #game-over.tut-note .final-panel { height: auto; }
    #game-over.tut-note #final-frame { flex: none; }
    /* a phone: the table and its buttons still fill the window; the strip waits below, a scroll away */
    #game-over .final-panel:has(.dk-more) { height: auto; max-height: calc(100dvh - 16px); overflow-y: auto; }
    #game-over .final-panel:has(.dk-more) #final-frame { flex: none; height: calc(100dvh - 80px); max-height: none; min-height: 0; }
}


/* ══ THE VILLAGE TALLY (tally.js) ══════════════════════════════════════════════════════════
   At the founded village, once the club has struck: the surviving colours with their counts,
   then the sum built term by term -- huts, the age's bonus (its terrain tile) or its penalty
   (the tile cracked, the huts struck through), the total stamped in. A tablet of the same
   stone as the age tablet; it rises out of the village and the parts arrive in reading order. */
#village-tally {
    position: absolute; z-index: 170;
    display: flex; flex-direction: column; align-items: center; gap: .45em;
    padding: .6em .95em .65em;
    font-size: clamp(11px, 1.45cqw, 18px);
    color: var(--clans-bone);
    background: var(--clans-slab);
    border: 1px solid var(--clans-chisel);
    border-radius: var(--clans-hewn);
    box-shadow: var(--clans-slab-depth), 0 3px 0 rgba(12, 8, 4, .55), 0 14px 30px rgba(0, 0, 0, .62);
    pointer-events: none; white-space: nowrap;
    opacity: 0;
    transition: opacity 220ms ease-out, transform 380ms cubic-bezier(.16, 1, .3, 1);
}
#village-tally.above { transform: translate(-50%, -100%) translateY(10px) scale(.94); transform-origin: 50% 100%; }
#village-tally.below { transform: translate(-50%, 0) translateY(-10px) scale(.94); transform-origin: 50% 0; }
#village-tally.above.show { transform: translate(-50%, -100%); opacity: 1; }
#village-tally.below.show { transform: translate(-50%, 0); opacity: 1; }
#village-tally.gone { opacity: 0; transition: opacity 200ms ease-in; }
.t-huts { display: flex; gap: .55em; align-items: flex-end; }
.t-hut { display: inline-flex; align-items: flex-end; gap: .1em; }
.t-hut img { height: 2.3em; width: auto; filter: drop-shadow(0 .12em .12em rgba(0, 0, 0, .55)); }
.t-hut b { font: 700 .9em var(--dk-font-ui); color: var(--clans-bone-dim); font-variant-numeric: tabular-nums; }
.t-sum { display: flex; align-items: center; gap: .4em; font: 600 1em var(--dk-font-ui); }
.t-term { display: inline-flex; align-items: center; gap: .3em; }
/* the village's own patch of the printed board (tally.js): the terrain it stands on, as a small carved window */
.t-tile {
    display: inline-block; vertical-align: middle;
    height: 2.2em; width: 2.2em; margin-right: .2em;
    background-repeat: no-repeat;
    border-radius: var(--clans-hewn-sm);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 2px 5px rgba(0, 0, 0, .5);
}
.t-tile.paid { box-shadow: 0 0 0 2px #f1c27a, 0 2px 6px rgba(0, 0, 0, .55); }
.t-bonus { color: #f1c27a; font-weight: 700; }
.t-penalty { color: var(--clans-bone-dim); }
.t-tile.cracked { filter: grayscale(1) brightness(.5) contrast(1.15); }
.t-struck { color: var(--clans-bone-dim); text-decoration: line-through; text-decoration-color: #d9584a; text-decoration-thickness: .12em; }
.t-op { color: var(--clans-bone-dim); }
.t-total { font: 700 1.6em/1 var(--dk-font-ui); font-variant-numeric: tabular-nums; color: var(--clans-bone); }
.t-total.zero { color: #e58f6f; }
.t-empty { color: var(--clans-bone-dim); }
/* each part arrives in reading order (--d set by tally.js); the total is stamped in */
#village-tally .t-hut, #village-tally .t-term, #village-tally .t-op {
    opacity: 0; transform: translateY(.3em);
    transition: opacity 200ms ease-out var(--d, 0ms), transform 320ms cubic-bezier(.16, 1, .3, 1) var(--d, 0ms);
}
#village-tally .t-hut { transform: translateY(.4em) scale(.7); }
#village-tally .t-total {
    opacity: 0; transform: scale(1.5);
    transition: opacity 160ms ease-out var(--d, 0ms), transform 300ms cubic-bezier(.2, 1.4, .4, 1) var(--d, 0ms);
}
#village-tally.show .t-hut, #village-tally.show .t-term, #village-tally.show .t-op, #village-tally.show .t-total { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    #village-tally, #village-tally.above, #village-tally.below { transition: opacity 200ms ease-out; }
    #village-tally.above, #village-tally.above.show { transform: translate(-50%, -100%); }
    #village-tally.below, #village-tally.below.show { transform: translate(-50%, 0); }
    #village-tally .t-hut, #village-tally .t-term, #village-tally .t-op, #village-tally .t-total { transform: none; transition: opacity 200ms ease-out var(--d, 0ms); }
}

/* ── the carved stones in the lobby (mpDialog.js reuses start.js playersTally / levelTally) ── */
.mp-card .start-field { display: flex; flex-direction: column; gap: 5px; text-align: left; margin-bottom: 12px; }
.mp-card .start-field-label { font-size: 13px; color: var(--dk-panel-dim); }
.mp-card .clans-level-note { color: var(--dk-panel-dim); min-height: 0; }
@media (max-height: 520px) {
    .mp-card .start-field { margin-bottom: 2px; gap: 2px; }
    .mp-card .start-field-label { font-size: 12px; }
}
@media (max-height: 400px) {
    .mp-card .mp-sub { margin-bottom: 4px; }
}

/* Table news (welcome.js banner): a stone strip at the top, above the lobby and the start
   screen, never in the way of a click. */
#clans-banners {
    position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
    z-index: 2000; display: flex; flex-direction: column; align-items: center; gap: 6px;
    width: min(92vw, 520px); pointer-events: none;
}
.clans-banner {
    padding: 9px 16px; border-radius: 8px; text-align: center;
    font-family: var(--dk-font-display); font-size: 17px; letter-spacing: .02em; line-height: 1.3;
    color: var(--clans-bone); background: rgba(38, 32, 27, .94);
    border: 1px solid rgba(239, 228, 207, .28); box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
    opacity: 0; transform: translateY(-8px); transition: opacity 260ms ease, transform 260ms ease;
}
.clans-banner.show { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .clans-banner { transform: none; transition: opacity 200ms ease; } }
@media (max-height: 520px) { .clans-banner { font-size: 14px; padding: 6px 12px; } }

/* Reduced motion: the claimed chip and the +N badges fade where they appear instead of
   flying across the table (the tally already does). */
@media (prefers-reduced-motion: reduce) {
    .score-fly, .score-fly.flying, .chip-fly, .chip-fly.flying { transition: opacity .3s ease !important; }
}


/* ── Tutorial ── ═══════════════════════════════════════════════════════════════════════════════
   tutorial.js. The guide speaks from a slab of the table's own stone, signed with a hand stencil
   blown in red ochre (the negative print: the hand is bare rock, the pigment round it), so its
   lines read as the table talking and never as a browser box. It is uncovered top-down like the
   age tablet; a new line on a slab already up only swaps its words. Continue is a small Play
   plate (the start card's ochre, its lit lip and its foot); Leave is the quiet second voice.
   The spotlight darkens everything but what a lesson points at, with a chalk ring round each
   hole, drawn on once and breathing only while the player is meant to act.
   Layers: the stage is z 2, the touch chips 40, the header 300, the panels 400, overlays 1100 --
   the veil (250) and the slab (290) dim the table and its chips but never the header, the
   rulebook, the panels or a question the game asks. */
.tut-caption {
    position: fixed; z-index: 290; left: 0; top: 0;
    box-sizing: border-box;
    width: fit-content; max-width: min(560px, 90vw);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "mark text" "mark actions";
    column-gap: 14px; row-gap: 6px; align-items: start;
    padding: 14px 16px 10px 12px;
    color: var(--clans-bone);
    font-family: var(--dk-font-ui);
    --grain-x: -330px; --grain-y: -170px;
    background: var(--clans-slab);
    border: 1px solid var(--clans-chisel);
    border-radius: var(--clans-hewn);
    box-shadow: var(--clans-slab-depth), 0 3px 0 rgba(12, 8, 4, .55), 0 18px 36px rgba(0, 0, 0, .62);
    /* buried: the clip keeps the shadow's margin (negative insets), so the cast is never cut */
    visibility: hidden; opacity: 0;
    transform: translateY(-8px);
    clip-path: inset(-48px -48px 100% -48px);
    transition: opacity 180ms ease-in, transform 240ms ease-in, clip-path 240ms ease-in,
                border-color 300ms ease, visibility 0s linear 240ms;
}
.tut-caption.show {
    visibility: visible; opacity: 1;
    transform: none;
    clip-path: inset(-48px -48px -48px -48px);
    transition: opacity 200ms ease-out, transform 560ms cubic-bezier(.16, 1, .3, 1),
                clip-path 560ms cubic-bezier(.16, 1, .3, 1), border-color 300ms ease, visibility 0s;
}
.tut-mark { grid-area: mark; position: relative; width: 46px; height: 46px; margin-top: -3px; }
.tut-mark svg, .tut-toast-mark svg { display: block; width: 100%; height: 100%; }
/* the carving: a groove cut a few millimetres in from the slab's edge -- dark on its upper lip,
   caught by the light on its lower one -- which is what makes a slab a tablet */
.tut-caption::before {
    content: ''; position: absolute; inset: 5px; pointer-events: none;
    border-radius: var(--clans-hewn-sm);
    border: 1px solid rgba(10, 6, 3, .42);
    box-shadow: 0 1px 0 rgba(255, 236, 206, .08), inset 0 1px 0 rgba(255, 236, 206, .05);
}
.tut-text {
    grid-area: text; align-self: center;
    max-width: 46ch; padding-top: 1px;
    font-size: 16px; line-height: 1.45; font-weight: 400;
    text-wrap: pretty;
}
.tut-text b, .tut-text strong, .tut-text em { font-style: normal; font-weight: 600; color: #fff6e6; }
.tut-text.swap { animation: tut-swap 300ms cubic-bezier(.16, 1, .3, 1); }
@keyframes tut-swap { from { opacity: 0; translate: 0 4px; } }
.tut-actions {
    grid-area: actions;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.tut-leave {
    appearance: none; background: none; border: 0;
    min-height: 44px; margin: 0 0 0 -8px; padding: 0 8px;
    font: 500 13.5px/1.2 var(--dk-font-ui);
    color: var(--clans-bone-dim);
    text-decoration: underline; text-decoration-color: rgba(239, 228, 207, .32);
    text-underline-offset: 4px; text-decoration-thickness: 1px;
    border-radius: 6px; cursor: pointer; touch-action: manipulation;
    transition: color 150ms ease, text-decoration-color 150ms ease;
}
.tut-leave:hover { color: var(--clans-bone); text-decoration-color: currentColor; }
/* Back: one step back -- the quiet voice of Leave, with the chevron Continue points the other way */
.tut-back {
    appearance: none; box-sizing: border-box;
    display: inline-flex; align-items: center; gap: 5px;
    min-width: 44px; min-height: 44px; margin: 0 -6px 0 auto; padding: 0 10px 0 6px;
    font: 600 14px/1 var(--dk-font-ui);
    color: var(--clans-bone-dim);
    background: none; border: 1px solid transparent; border-radius: var(--clans-hewn-sm);
    cursor: pointer; touch-action: manipulation;
    transition: color 150ms ease, border-color 150ms ease;
}
.tut-back[hidden] { display: none; }
.tut-back svg { width: 14px; height: 14px; flex: none; }
.tut-back:hover { color: var(--clans-bone); border-color: rgba(239, 228, 207, .22); }
.tut-back:focus-visible { outline: 2px solid var(--clans-bone); outline-offset: 3px; }
.tut-back:not([hidden]) + .tut-continue { margin-left: 0; }
/* the closing line stands over the final scoring (overlays are 1100), not hidden under it */
.tut-caption.tut-above { z-index: 1160; }
.tut-continue {
    appearance: none; box-sizing: border-box;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-width: 44px; min-height: 44px; margin-left: auto; padding: 0 15px 0 19px;
    font: 700 15.5px/1 var(--dk-font-ui); letter-spacing: .01em;
    color: var(--dk-start-play-ink);
    background: var(--dk-start-play-bg);
    border: 1px solid #7d3328;
    border-radius: var(--dk-start-play-radius);
    box-shadow: var(--dk-start-play-shadow);
    cursor: pointer; touch-action: manipulation;
    transition: filter 150ms ease;
}
.tut-continue[hidden] { display: none; }
.tut-continue svg { width: 14px; height: 14px; flex: none; }
.tut-continue:hover { filter: brightness(1.12); }
.tut-continue:active { transform: var(--dk-start-play-press-move); box-shadow: var(--dk-start-play-press-shadow); }
.tut-continue:focus-visible, .tut-leave:focus-visible { outline: 2px solid var(--clans-bone); outline-offset: 3px; }
/* the refusal: the slab is shoved and its edge flushes ochre while the toast stands */
.tut-caption.tut-refuse { border-color: rgba(214, 101, 79, .95); animation: tut-shove 440ms cubic-bezier(.36, .07, .19, .97); }
@keyframes tut-shove {
    16% { translate: -6px 0; } 34% { translate: 5px 0; } 52% { translate: -3px 0; } 70% { translate: 2px 0; }
}

/* the spotlight: one mask, a soft-edged hole per highlight, a chalk ring round each */
.tut-veil {
    position: fixed; inset: 0; z-index: 250; pointer-events: none;
    opacity: 0; transition: opacity 300ms ease-out;
}
.tut-veil.show { opacity: 1; }
.tut-veil svg { position: absolute; left: 0; top: 0; display: block; overflow: visible; }
.tut-veil-dark { fill: rgba(14, 9, 5, .66); }
.tut-ring-under { fill: none; stroke: rgba(12, 8, 4, .55); stroke-width: 6; }
.tut-ring {
    fill: none; stroke: #f4e9d3; stroke-width: 2.5; stroke-linecap: round;
    animation: tut-breathe 2.4s ease-in-out infinite;
}
.tut-veil.reading .tut-ring { animation: none; }
.tut-rings.fresh .tut-ring-under, .tut-rings.fresh .tut-ring { stroke-dasharray: 1; stroke-dashoffset: 1; }
.tut-rings.fresh .tut-ring-under { animation: tut-chalk 640ms cubic-bezier(.16, 1, .3, 1) 60ms forwards; }
.tut-rings.fresh .tut-ring {
    animation: tut-chalk 640ms cubic-bezier(.16, 1, .3, 1) 60ms forwards, tut-breathe 2.4s ease-in-out 900ms infinite;
}
.tut-veil.reading .tut-rings.fresh .tut-ring { animation: tut-chalk 640ms cubic-bezier(.16, 1, .3, 1) 60ms forwards; }
@keyframes tut-chalk { to { stroke-dashoffset: 0; } }
@keyframes tut-breathe { 50% { stroke-opacity: .45; } }

/* the publisher's logo sits on the forest in the board's corner: while a lesson lights a field
   under it, it steps aside (tutorial.js syncCredit) and comes back when the light moves on. It
   never takes a press, in the tutorial or out of it (the credit rule above says so too). */
#credit { transition: opacity 260ms ease; }
#credit.tut-under { opacity: 0; pointer-events: none; }

/* the nag: a small slab where the player pressed, the raised hand saying halt */
.tut-toast {
    position: fixed; z-index: 295; left: 0; top: 0;
    box-sizing: border-box; max-width: min(380px, 86vw);
    display: flex; align-items: center; gap: 10px;
    padding: 7px 16px 8px 9px;
    font: 600 15px/1.3 var(--dk-font-ui);
    color: var(--clans-bone);
    --grain-x: -90px; --grain-y: -260px;
    background: var(--clans-slab);
    border: 1px solid rgba(214, 101, 79, .8);
    border-radius: var(--clans-hewn-sm);
    box-shadow: var(--clans-slab-depth), 0 3px 0 rgba(12, 8, 4, .5), 0 12px 26px rgba(0, 0, 0, .6);
    pointer-events: none;
    opacity: 0; transform: translateY(6px) scale(.96);
    transition: opacity 220ms ease-in, transform 220ms ease-in;
}
.tut-toast.show {
    opacity: 1; transform: none;
    transition: opacity 160ms ease-out, transform 300ms cubic-bezier(.16, 1, .3, 1);
}
.tut-toast-mark { position: relative; flex: none; width: 32px; height: 32px; }

/* A short screen (a phone held sideways): one row -- the mark, the words, then Leave and
   Continue beside them -- so the slab costs the board as little height as it can. */
@media (max-height: 520px) {
    .tut-caption {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "mark text actions";
        column-gap: 9px; align-items: center;
        padding: 6px 7px 6px 9px;
    }
    .tut-caption::before { inset: 3px; }
    .tut-mark { width: 30px; height: 30px; margin: 0; }
    .tut-text { max-width: none; font-size: 13.5px; line-height: 1.34; }
    .tut-actions { gap: 4px; }
    .tut-leave {
        max-width: 6.6em; margin: 0; padding: 0 6px;
        font-size: 12px; line-height: 1.15; text-align: center; text-wrap: balance;
    }
    .tut-continue { padding: 0 11px 0 14px; font-size: 14px; }
    .tut-back { margin: 0; padding: 0 6px 0 3px; font-size: 13px; gap: 3px; }
    /* narrowed to stand beside a ring: words across the slab, Leave and Continue under them */
    .tut-caption.tut-narrow {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas: "mark text" "actions actions";
        row-gap: 4px; align-items: start;
    }
    .tut-caption.tut-narrow .tut-actions { justify-content: flex-end; gap: 10px; }
    .tut-caption.tut-narrow .tut-leave { max-width: none; }
    .tut-toast { padding: 5px 12px 6px 7px; font-size: 13.5px; gap: 8px; }
    .tut-toast-mark { width: 24px; height: 24px; }
}
@media (max-height: 400px) {
    .tut-caption { padding-top: 4px; padding-bottom: 4px; }
    .tut-text { font-size: 13px; line-height: 1.28; }
}

@media (prefers-reduced-motion: reduce) {
    .tut-caption, .tut-caption.show { transform: none; clip-path: none; }
    .tut-caption { transition: opacity 160ms ease-in, border-color 200ms ease, visibility 0s linear 160ms; }
    .tut-caption.show { transition: opacity 200ms ease-out, border-color 200ms ease, visibility 0s; }
    .tut-caption.tut-refuse, .tut-text.swap { animation: none; }
    .tut-ring, .tut-rings.fresh .tut-ring, .tut-rings.fresh .tut-ring-under { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
    .tut-toast, .tut-toast.show { transform: none; transition: opacity 180ms ease; }
}


/* ══ START CARD, critique 2026-10-16 ═══════════════════════════════════════════════════════ */

/* The secondary voice stays secondary on hover: a lit stone, not the primary's ochre wash. */
.start-secondary:hover:not(:disabled) { background: rgba(255, 236, 206, .07); }

/* The launch column starts level with the first row of stones instead of floating in the
   middle of the slab with a void above Play. */
.start-col-right { justify-content: flex-start; }
@media (min-height: 521px) and (min-width: 621px) {
    .start-col-right { padding-top: 22px; }          /* the height of a field label + its gap */
}

/* The language flag: a 44x32 face inside a full 44x44 target (start.js buildLangCorner). */
:root { --dk-start-corner-top: 6px; }
.start-lang-btn {
    height: 44px; display: grid; place-items: center;
    border: 0; background: none; overflow: visible;
    font-family: var(--dk-font-ui);
}
.start-lang-btn:hover { box-shadow: none; }
.start-lang-face {
    display: block; width: 44px; height: 32px; overflow: hidden; box-sizing: border-box;
    border: 1px solid var(--dk-start-edge); border-radius: 5px;
    transition: box-shadow .15s;
}
.start-lang-btn:hover .start-lang-face { box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }

/* Before a game, the header carries no in-game tools: the log, the AI panel, the suspicion
   eye and the AI badge had nothing to show and, behind the start card, could not be pressed. */
body:not(.playing) #log-btn, body:not(.playing) #eval-btn,
body:not(.playing) #suspect-btn, body:not(.playing) #ai-indicator { visibility: hidden; }
body:has(#start-screen) #header-right { visibility: hidden; }

/* The film's last frame has its own CLANS: the card waits until the dissolve is over
   (splash.js adds .clans-handoff for the length of it), then rises. */
#start-screen .start-card { transition: opacity 420ms cubic-bezier(.2, .8, .3, 1); }
body.clans-handoff #start-screen .start-card { opacity: 0; transition: none; }
@media (prefers-reduced-motion: reduce) { #start-screen .start-card { transition: none; } }

/* ── a phone held sideways: the card at FULL scale ────────────────────────────────────────
   fitCard no longer subtracts a header a touch device does not show; the card itself is cut
   to fit 276px of height (the 640x300 floor less fitCard's air) without shrinking a target:
   - the carved title and the premise share one row;
   - each field's label stands BESIDE its stones, not above them (three label lines saved);
   - the level's note comes back, under its stones -- without it "Me hunt!" means nothing;
   - the launch column tightens to 44px rows. */
@media (max-height: 520px) and (min-width: 640px) {
    .start-card {
        display: grid; grid-template-columns: auto 1fr;
        grid-template-areas: "title sub" "cols cols";
        column-gap: 16px; align-items: center;
        width: min(660px, 94vw);
    }
    .start-title    { grid-area: title; margin: 0; }
    .clans-wordmark { width: 150px; margin: 0 auto; }
    .start-subtitle {
        grid-area: sub; display: block; margin: 0; padding-right: 50px;   /* clear of the flag */
        text-align: left; font-size: 12px; line-height: 1.38;
        /* three lines whatever the language, so a switch never moves the card (fr wraps to 3) */
        min-height: calc(3em * 1.38);
    }
    .start-columns  { grid-area: cols; margin-top: 10px; gap: 18px; }
    .start-col-left {
        flex: 0 0 57%;
        display: grid; grid-template-columns: max-content minmax(0, 1fr);
        column-gap: 10px; row-gap: 6px; align-items: center; align-content: start;
    }
    .start-col-left .start-field { display: contents; }
    .start-col-left .start-field-label { font-size: 12.5px; }
    #start-screen #clans-level-note {
        display: block; grid-column: 1 / -1; margin: -2px 0 0; min-height: 2.7em;
        font-size: 12px; line-height: 1.35;
    }
    #start-screen #clans-board-note { display: none; }
    .start-col-right { gap: 6px; }
    .start-col-right .start-play { min-height: 44px; padding-top: 6px; padding-bottom: 6px; }
}
/* the 640x300 floor: the last 6px come from the slab's own padding, not from a stone */
@media (max-height: 340px) and (min-width: 640px) {
    .start-card    { padding-top: 8px; padding-bottom: 8px; }
    .start-columns { margin-top: 8px; }
    .clans-wordmark { width: 120px; }
    /* the floor's last trade: the publisher and the win line step out (both are in the rulebook);
       the author's name stays under the title */
    .clans-byline .by-pub { display: none; }
    :root { --dk-start-hint-short: none; }
}

/* ── the byline and the win line (critique 2026-10-16, re-run) ─────────────────────────────
   The byline is set in the title's carved face, small and dim: the film's "a game by" card,
   kept. On the wide card it is one line under the wordmark; beside the premise on a short
   screen it stacks, author over publisher. */
.clans-byline {
    margin: -2px 0 12px;
    font: 400 13px/1.25 var(--dk-font-display);
    letter-spacing: .12em; text-transform: none; white-space: normal;
    color: var(--clans-bone-dim);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .5);
}
.clans-byline .by-dot { color: rgba(224, 128, 106, .8); }
@media (max-height: 520px) and (min-width: 640px) {
    .clans-byline { margin: 3px 0 0; font-size: 10.5px; letter-spacing: .08em; text-align: center; }
    .clans-byline .by-author, .clans-byline .by-pub { display: block; }
    .clans-byline .by-dot { display: none; }
}
/* the win line closes the launch column, at the foot of the stone beside the settings */
.start-col-right .start-hint {
    margin-top: auto; padding-top: 10px;
    text-align: center; line-height: 1.4; font-size: 12.5px;
}
@media (max-height: 520px) and (min-width: 640px) {
    .start-col-right .start-hint { padding-top: 2px; font-size: 12px; line-height: 1.3; }
}
/* the win line keeps two lines in every language, so a switch never moves the card (de wraps, en
   does not); then the two smallest tiers, placed last so they win over the stacked byline above */
@media (max-height: 520px) and (min-width: 640px) {
    .start-col-right .start-hint { min-height: calc(2em * 1.3); }
}
@media (max-height: 400px) and (min-width: 640px) {
    .clans-wordmark { width: 130px; }
    .clans-byline   { font-size: 10px; line-height: 1.2; }
    .start-columns  { margin-top: 8px; }
    .start-card     { padding-bottom: 11px; }
}
@media (max-height: 340px) and (min-width: 640px) {
    .clans-wordmark { width: 120px; }
    .clans-byline .by-pub { display: none; }
}

/* ══ START CARD, critique 2026-10-16 (third run) ═══════════════════════════════════════════ */

/* The byline reads at phone size too: never under 11px, full bone (was 10px bone-dim). */
@media (max-height: 520px) and (min-width: 640px) {
    .clans-byline { font-size: 11.5px; line-height: 1.2; color: var(--clans-bone); }
}

/* A newcomer's way in: the Tutorial carries an ochre edge until a first game is started. */
.start-play.start-first { border-color: rgba(224, 128, 106, .85); color: #f6d9c9; }

/* The picker's flags: 44px tall targets around the 44x32 face (start.js), the chosen one ringed. */
.start-lang-opt {
    height: 44px; display: grid; place-items: center;
    border: 0; background: none; overflow: visible; font-family: var(--dk-font-ui);
}
.start-lang-opt .start-lang-face { border-color: var(--dk-start-field-edge); }
.start-lang-opt.on .start-lang-face { border: 2px solid var(--dk-start-lang-on); }

/* The card's fade-in now overlaps the film's dissolve (splash.js); a longer rise reads as one move. */
#start-screen .start-card { transition: opacity 560ms cubic-bezier(.2, .8, .3, 1); }
@media (prefers-reduced-motion: reduce) { #start-screen .start-card { transition: none; } }

@media (max-height: 520px) and (min-width: 640px) {
    /* the label column has ONE width in every language, so a switch never moves the stones
       ("Adversaires" is the longest label of the five) */
    .start-col-left { grid-template-columns: 84px minmax(0, 1fr); }
    .start-col-left .start-field-label { white-space: normal; line-height: 1.1; }
    /* one note slot UNDER THE LAST ROW (Board): the level note and the board note lie in the same
       cell and the row last touched shows its own (start.js sets data-note). Under the Opponents
       row the board's note read as if it described the opponents (user, 2026-10-16). */
    #start-screen #clans-level-note, #start-screen #clans-board-note {
        display: block; grid-column: 1 / -1; grid-row: 4; margin: -2px 0 0; min-height: 2.7em;
        font-size: 12px; line-height: 1.35;
    }
    .start-col-left[data-note="level"] #clans-board-note,
    .start-col-left[data-note="board"] #clans-level-note { visibility: hidden; }
}
/* the floor, measured with the byline's face loaded: three more pixels from the wordmark */
@media (max-height: 340px) and (min-width: 640px) {
    .clans-wordmark { width: 110px; }
    .start-card     { padding-top: 7px; }
}

/* ── the rulebook on a short screen: the reading space is the point ─────────────────────────
   The head (wordmark, subtitle, close) took a row of its own above the chapter strip; at
   640x300 the two left ~170px for the text. The close button floats at the strip's end and
   the head's row goes. */
@media (max-height: 520px) {
    .rb-book { grid-template-rows: minmax(0, 1fr); }
    .rb-head {
        position: absolute; top: 0; right: 0; z-index: 3;
        padding: 6px 8px; border: 0; box-shadow: none;
    }
    .rb-logo, .rb-sub { display: none; }
    .rb-body { padding-top: 10px; padding-right: 64px; }
}
@media (max-height: 520px) and (max-width: 820px) {
    .rb-book { grid-template-rows: auto minmax(0, 1fr); }
    .rb-toc  { padding-right: 60px; }
    .rb-body { padding-right: 18px; }
}
/* 640x360 with the 11.5px byline: the last pixels from the slab's foot, not from a stone */
@media (max-height: 400px) and (min-height: 341px) and (min-width: 640px) {
    .start-card   { padding-bottom: 8px; }
    .clans-byline { line-height: 1.12; }
}
/* the floating close stands on a fade of the strip's own stone, so a chapter scrolling under it
   sinks away instead of colliding with the ring */
@media (max-height: 520px) and (max-width: 820px) {
    .rb-head { padding-left: 26px; background: linear-gradient(90deg, rgba(67, 58, 50, 0), #433a32 24px); }
}

/* ── "Drawn art": the carved tick beside the board stones (start.js boardTally) ───────────── */
.clans-board-line { display: flex; gap: 6px; align-items: stretch; min-width: 0; }
.clans-board-line .clans-tallies { flex: 1 1 auto; min-width: 0; }
.clans-art-tick {
    flex: 0 0 auto; gap: 6px; padding: 5px 10px;
    background: var(--clans-hollow);
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 236, 206, .08);
}
.clans-art-tick[aria-checked="true"] { color: var(--clans-bone); }
.clans-tick-box { width: 16px; height: 16px; flex: none; }
.clans-tick-box .box  { fill: rgba(0, 0, 0, .35); stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.clans-tick-box .mark { fill: none; stroke: #e0806a; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.clans-art-tick[aria-checked="true"] .clans-tick-box .mark { opacity: 1; }
.clans-art-tick[aria-checked="true"] .clans-tick-box .box { stroke: rgba(224, 128, 106, .9); }
/* a phone held sideways: the map glyphs step out so three stones fit the row */
@media (max-height: 520px) and (min-width: 640px) {
    #clans-board .clans-board-glyph { display: none; }
    .clans-art-tick { padding: 4px 7px; gap: 5px; }
}
/* with the tick beside them the board stones lose their map glyphs on the start card (the
   lobby keeps them), and a name never breaks inside a word ("Origina|l" at 1440) */
#clans-board .clans-board-glyph { display: none; }
#clans-board .clans-tally-w { overflow-wrap: normal; }

/* ── the menu under the carved title ──────────────────────────────────────────────────────
   The title lives in the backdrop now (gfx/cave-menu.webp): the card keeps only a heading for a
   reader, and on a screen tall enough it stands BELOW the carving instead of over it. The
   carving's foot is 25.7% down a 16:9 frame; covered from the top it lands at
   max(14.5vw, 25.7vh). */
/* the premise is now the card's first line: keep it clear of the flag in the corner */
.start-subtitle { padding: 0 48px; }
.clans-sr-title {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
@media (min-height: 700px) and (min-width: 900px) {
    #start-screen { padding-top: calc(max(14.5vw, 25.7vh) + 12px); align-items: flex-start; }
}
@media (max-height: 520px) and (min-width: 640px) {
    .start-card { grid-template-areas: "sub sub" "cols cols"; }
}

/* ── a phone held sideways: the carved CLANS shows above the card (user, 2026-10-20) ─────────
   The premise steps out (the rulebook has it), the flag leaves the card for the cave wall's
   top-right corner, and the card stands at the foot of the screen, so the carving above it is
   the menu's title again. The notes under Opponents and Board step out as well. */
@media (max-height: 520px) and (min-width: 640px) and (orientation: landscape) {
    #start-screen { align-items: flex-end; }
    .start-card { grid-template-areas: "cols cols"; padding-top: 12px; margin-bottom: 4px; }
    .start-subtitle { display: none; }
    .start-columns { margin-top: 0; }
    #start-screen > .start-lang-corner {           /* start.js seatCorner hangs it on the screen */
        position: fixed; z-index: 5;
        top: max(10px, env(safe-area-inset-top)); right: max(10px, var(--clans-sa-r));
    }
    /* no notes under the stones on a phone (user, 2026-10-20: "remove the additional texts for
       difficulty and map") -- the stones' own names say it; the rulebook explains */
    #start-screen #clans-level-note, #start-screen #clans-board-note { display: none; }
}
@media (max-height: 340px) and (min-width: 640px) and (orientation: landscape) {
    .start-card { padding-top: 8px; }
    /* ...and Tutorial and Multiplayer share a row under Play: a 44px row saved, no target smaller */
    .start-col-right { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 6px; align-content: start; min-width: 0; }
    .start-col-right > .start-play { width: auto; min-width: 0; margin: 0; padding-left: 4px; padding-right: 4px; }
    .start-col-right > .start-play:not(.start-secondary), .start-col-right > .clans-start-rules { grid-column: 1 / -1; }
}

/* the backdrop's torch, alive (menuFire.js): between the cave still and the start screen */
#menu-fire { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

/* ── Continue after an AI move (start screen's "Confirm", game.js holdForContinue) ──────────
   Low on the board, over the map's bottom edge, where it hides the least of the huts. */
#clans-next {
    position: absolute; z-index: 45; left: 50%; bottom: 4%;
    transform: translate(-50%, 6px);
    width: auto; margin: 0; padding: 8px 26px; min-width: 140px; min-height: 44px;
    opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s cubic-bezier(.2, .8, .2, 1);
}
#clans-next.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
/* after an opponent's move it hangs under their name plate (game.js placeNext sets left/top) */
#clans-next.under-mover { position: fixed; z-index: 150; bottom: auto; }
/* black on orange, and it burns (user, 2026-10-23: "a proper flickering, like the background in
   the main menu"): game.js burn() feeds the menu torch's flicker in as --fire (0 guttering .. 1
   flaring) and the wandering hot heart as --fire-x, every frame. */
#clans-next {
    --fire: .55; --fire-x: 50%;
    color: #140b05;
    font-family: var(--dk-font-display); letter-spacing: .08em;
    text-shadow: 0 1px 0 rgba(255, 214, 150, .45);
    background:
        radial-gradient(ellipse 70% 120% at var(--fire-x) 115%, rgba(255, 236, 150, calc(.35 + .65 * var(--fire))) 0%, transparent 70%),
        linear-gradient(180deg, #f08a2a 0%, #e2621a 100%);
    border: 1px solid #7a2e0c;
    filter: brightness(calc(.88 + .26 * var(--fire)));
    box-shadow:
        0 0 calc(6px + 12px * var(--fire)) calc(1px + 3px * var(--fire)) rgba(255, 150, 45, calc(.3 + .5 * var(--fire))),
        0 0 calc(16px + 26px * var(--fire)) calc(3px + 8px * var(--fire)) rgba(255, 85, 20, calc(.15 + .3 * var(--fire))),
        0 4px 14px rgba(0, 0, 0, .55);
}
#clans-next:focus-visible { outline: 2px solid var(--clans-bone); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { #clans-next { transition: none; } }

/* the speed names never break inside a word ("Langsa|m"); on a short screen they step down a size */
#clans-speed .clans-tally { padding-inline: 3px; }
#clans-speed .clans-tally-w { overflow-wrap: normal; word-break: keep-all; }
/* ...and a stone never shrinks below its word: "LangsamNormal" ran together in DE (user,
   2026-11-10). The speed stones keep their width; when the row has no room the Confirm tick
   drops to its own line under them instead of squeezing them. */
#clans-speed .clans-tally { flex: 1 0 auto; min-width: max-content; }
#clans-speed { min-width: min-content; }
.clans-board-line:has(#clans-speed) { flex-wrap: wrap; row-gap: 6px; }
/* the tick reads "Confirm / turns" on two lines (user, 2026-11-10) */
.clans-art-tick .clans-tick-two { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; text-align: left; }
@media (max-height: 520px) and (min-width: 640px) {
    #clans-speed .clans-tally { font-size: 10.5px; letter-spacing: 0; padding-inline: 2px; }
    #clans-speed .clans-tallies { gap: 3px; padding: 3px; }
    #clans-speed .clans-art-tick { font-size: 11px; padding: 4px 6px; gap: 4px; }
}

/* ── 640x300: the card clear of the carved CLANS (test board re-run, 2026-10-30) ──────────────
   Four rows of 48px wells stood the card at y61, over the carving's foot (~y95). The wells lose
   their 2px rim and the rows and the slab their spare pixels, so the card starts below the
   letters; every stone, the tick and the buttons stay 44px tall. */
@media (max-height: 340px) and (min-width: 640px) and (orientation: landscape) {
    #start-screen { padding-bottom: 4px; }
    .start-card { padding-top: 6px; padding-bottom: 6px; margin-bottom: 0; }
    .start-col-left, .start-col-right { row-gap: 4px; }
    .clans-tallies, #clans-speed .clans-tallies { padding: 0 2px; }
    .clans-art-tick { min-height: 44px; }
}

/* ── tablets held sideways, 461-699px tall: the carved CLANS shows above the card too ────────
   (test board re-run, 2026-10-30: at 800x500 and 841x674 the card hid the title.) Below 700px
   the "card under the carving" rule above does not reach, and from 461 to 540px the shared sheet
   stacks the two columns, so the card stood over the whole wall. Here: two columns side by side
   again, and as on a phone the premise steps out (the rulebook has it), the flag goes to the
   wall's corner and the card stands at the foot of the screen. The level and board notes stay. */
@media (min-height: 461px) and (max-height: 540px) and (min-width: 640px) {
    .start-columns     { flex-direction: row; }
    .start-col-divider { display: block; }
    .start-col-left    { flex: 0 0 57%; }
}
@media (min-height: 521px) and (max-height: 699px) and (min-width: 640px) and (orientation: landscape) {
    #start-screen { align-items: flex-end; }
    .start-card { grid-template-areas: "cols cols"; padding-top: 16px; margin-bottom: 4px; }
    .start-subtitle { display: none; }
    .start-columns { margin-top: 0; }
    #start-screen > .start-lang-corner {
        position: fixed; z-index: 5;
        top: max(10px, env(safe-area-inset-top)); right: max(10px, var(--clans-sa-r));
    }
    /* each label BESIDE its stones, as on a phone; one note slot under the last row, showing the
       note of the row last touched (start.js data-note) */
    .start-col-left {
        flex: 0 0 57%;
        display: grid; grid-template-columns: 96px minmax(0, 1fr);
        column-gap: 10px; row-gap: 8px; align-items: center; align-content: start;
    }
    .start-col-left .start-field { display: contents; }
    .start-col-left .start-field-label { white-space: normal; line-height: 1.1; }
    #start-screen #clans-level-note, #start-screen #clans-board-note {
        display: block; grid-column: 1 / -1; grid-row: 5; margin: 0; min-height: 2.7em;
        font-size: 12.5px; line-height: 1.35;
    }
    .start-col-left[data-note="level"] #clans-board-note,
    .start-col-left[data-note="board"] #clans-level-note { visibility: hidden; }
    .start-col-right { gap: 8px; }
}

/* ── tablets held sideways (7", 10" dense, foldable): the card CENTRED under the carving ──────
   (user, 2026-11-10: "the menu should be more centered") It stood on the screen's foot with the
   space all above it; now it sits in the middle of what the carving leaves (its foot is at
   max(14.5vw, 25.7vh), see "the menu under the carved title"). `safe` keeps a card taller than
   that room on the screen's foot instead of pushing it off both ends. Phones keep the foot. */
@media (min-height: 461px) and (max-height: 699px) and (min-width: 640px) and (orientation: landscape) {
    #start-screen {
        align-items: safe center;
        padding-top: calc(max(14.5vw, 25.7vh) + 6px);
        padding-bottom: 6px;
    }
    .start-card { margin-bottom: 0; }
}

/* ── THE DEMO (edition.js): every option is shown, the ones outside the demo table LOCKED
   (user, 2026-11-10: "show all options in the demo, but lock them"). A locked stone keeps its
   place and its name, sunk and dimmed, with a small padlock cut into its top-right corner; it
   never stands up when tapped -- the Demo line under the settings flashes instead. */
.clans-tally.locked, .start-play.locked { position: relative; cursor: not-allowed; }
.clans-tally.locked { opacity: .42; }
.clans-tally.locked:hover { background: transparent; color: var(--clans-bone-dim); }
.start-play.locked { opacity: .5; }
.clans-lock { width: 9px; height: 11px; flex: none; color: #e0806a; }
.clans-tally.locked .clans-lock, .start-play.locked .clans-lock { position: absolute; top: 4px; right: 5px; }
.start-play.locked .clans-lock { top: 50%; right: 12px; transform: translateY(-50%); width: 11px; height: 13px; }
/* the Demo line: what the padlocks mean */
.clans-demo {
    display: flex; align-items: center; gap: 7px;
    color: var(--clans-bone-dim);
    font: 600 12px/1.3 var(--dk-font-ui);
    border-radius: 6px;
}
.clans-demo .clans-lock { width: 10px; height: 12px; }
.clans-demo-tag {
    font-family: var(--dk-font-display); font-weight: 400;
    font-size: 14px; letter-spacing: .14em;
    color: #e0806a;
}
.clans-demo.nudge { animation: demo-nudge .7s cubic-bezier(.2, .8, .2, 1); }
@keyframes demo-nudge {
    0%, 100% { transform: none; background: transparent; }
    20% { transform: translateX(-4px); background: rgba(224, 128, 106, .18); }
    45% { transform: translateX(3px); }
    70% { transform: translateX(-1px); }
}
@media (prefers-reduced-motion: reduce) { .clans-demo.nudge { animation: none; color: var(--clans-bone); } }
@media (max-height: 520px) and (min-width: 640px) {
    .clans-demo { font-size: 11px; gap: 5px; }
    .clans-demo-tag { font-size: 12px; }
}
/* in the launch column, under the rules link: centred like it, and a little apart */
.start-col-right > .clans-demo { justify-content: center; text-align: left; margin-top: 4px; }
.start-col-right > .clans-demo .clans-demo-text { min-width: 0; }
/* the Demo line wraps its text under the tag when the column is narrow (the 640x300 floor), and
   a locked launch button that is too narrow for a padlock beside its word carries it in the
   corner, as the stones do */
.start-col-right > .clans-demo { flex-wrap: wrap; row-gap: 2px; }
.start-col-right > .clans-demo .clans-demo-text { flex: 1 1 150px; }
@media (max-height: 520px) and (min-width: 640px) {
    .start-play.locked .clans-lock { top: 4px; right: 5px; transform: none; width: 9px; height: 11px; }
    .start-col-right > .clans-demo { grid-column: 1 / -1; }
}

/* ── THE CARVED STONES (user, 2026-11-10: "style the buttons into some kind of stone carving
   that fits the game") ───────────────────────────────────────────────────────────────────────
   No header on any screen now. Every control the table keeps -- back, rules, move log, music,
   effects -- is a small tablet hewn from the cave wall: an uneven, torch-lit face with grit in
   it, a chisel bevel along the top, a hard foot where it stands out of the rock. The icon is
   not printed on it but CUT into it: a dark groove with the light catching its lower lip. A
   hand over it rubs ochre into the groove, as the clan marks on the menu are painted; a press
   pushes the stone back into the wall. Each stone is cut a little differently (--hew). */
.clans-stone { display: none; }
body.chrome-none.playing #menu-btn-touch,
body.chrome-none.playing #rules-btn,
body.chrome-none.playing #log-btn,
body.chrome-none #music-btn-touch,
body.chrome-none #sound-btn-touch {
    --hew: 13px 8px 12px 7px / 8px 13px 7px 12px;
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 44px; height: 44px; padding: 0;
    cursor: pointer; touch-action: manipulation;
    border-radius: var(--hew);
    border: 1px solid rgba(20, 13, 8, .9);
    background:
        var(--clans-grit) 0 0 / 190px 190px,
        radial-gradient(130% 95% at 32% 16%, #8c7d6b 0%, #6e6052 44%, #4c4239 100%);
    color: #1a120b;                                   /* the groove */
    box-shadow:
        inset 0 1px 0 rgba(255, 236, 206, .3),        /* the chisel bevel along the top */
        inset 0 -3px 5px rgba(0, 0, 0, .34),
        0 2px 0 #1b130c,                              /* the foot standing out of the rock */
        0 6px 12px rgba(0, 0, 0, .5);
    transition: transform .16s cubic-bezier(.2, .8, .2, 1), box-shadow .16s cubic-bezier(.2, .8, .2, 1), color .3s ease-out;
}
#rules-btn       { --hew: 9px 14px 8px 12px / 13px 7px 12px 8px; }
#log-btn         { --hew: 14px 7px 13px 9px / 9px 12px 8px 14px; }
#music-btn-touch { --hew: 8px 12px 14px 8px / 12px 9px 13px 7px; }
#sound-btn-touch { --hew: 12px 9px 7px 13px / 7px 14px 9px 12px; }
.clans-stone svg {
    width: 24px; height: 24px; display: block;
    /* cut, not printed: light on the groove's lower lip, shadow on its upper one */
    filter: drop-shadow(0 1px 0 rgba(255, 232, 200, .38)) drop-shadow(0 -.6px 0 rgba(0, 0, 0, .55));
}
#music-btn-touch svg, #sound-btn-touch svg { width: 22px; height: 22px; }
@media (hover: hover) {
    body.chrome-none :is(#menu-btn-touch, #rules-btn, #log-btn, #music-btn-touch, #sound-btn-touch):hover {
        color: #b8452a;                               /* ochre rubbed into the groove */
        box-shadow:
            inset 0 1px 0 rgba(255, 236, 206, .34), inset 0 -3px 5px rgba(0, 0, 0, .3),
            0 2px 0 #1b130c, 0 6px 14px rgba(0, 0, 0, .5), 0 0 16px rgba(255, 150, 60, .22);
    }
}
body.chrome-none :is(#menu-btn-touch, #rules-btn, #log-btn, #music-btn-touch, #sound-btn-touch):active,
body.chrome-none :is(#menu-btn-touch, #rules-btn, #log-btn, #music-btn-touch, #sound-btn-touch).active {                /* pushed back into the wall; the log is open */
    transform: translateY(2px);
    color: #b8452a;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, .5), inset 0 -1px 0 rgba(255, 236, 206, .12), 0 0 0 #1b130c, 0 2px 5px rgba(0, 0, 0, .45);
}
body.chrome-none :is(#menu-btn-touch, #rules-btn, #log-btn, #music-btn-touch, #sound-btn-touch):focus-visible { outline: 2px solid var(--clans-bone); outline-offset: 3px; }
/* switched off: the stone sits in shadow and its mark is struck through (header.js draws it) */
#music-btn-touch.muted, #sound-btn-touch.muted {
    color: rgba(26, 18, 11, .8);
    background:
        var(--clans-grit) 0 0 / 190px 190px,
        radial-gradient(130% 95% at 32% 16%, #625649 0%, #4d433a 50%, #3a322b 100%);
}
@media (prefers-reduced-motion: reduce) { .clans-stone { transition: none; } }

/* WHERE THEY STAND. Held sideways, down the lane on the left: back, rules, log from the top,
   music and effects at the foot. Upright, along the lane at the top. A short screen (the dense
   phone table, where the score rail fills the middle of the lane) keeps back, music and effects
   only, as before -- the rules and the log are on the start screen. */
@media (orientation: landscape) {
    body.chrome-none.playing #rules-btn, body.chrome-none.playing #log-btn {
        position: fixed; z-index: 40; left: max(8px, var(--clans-sa-l));
    }
    body.chrome-none.playing #rules-btn { top: calc(max(8px, env(safe-area-inset-top)) + 56px); }
    body.chrome-none.playing #log-btn   { top: calc(max(8px, env(safe-area-inset-top)) + 108px); }
    body.chrome-none.playing #music-btn-touch, body.chrome-none.playing #sound-btn-touch {
        position: fixed; z-index: 40; left: max(8px, var(--clans-sa-l));
    }
    body.chrome-none.playing #sound-btn-touch { bottom: max(8px, env(safe-area-inset-bottom)); }
    body.chrome-none.playing #music-btn-touch { bottom: calc(max(8px, env(safe-area-inset-bottom)) + 52px); }
    /* the move log opens beside the lane, at the top, never over the players' column */
    #move-log-panel { left: calc(max(8px, var(--clans-sa-l)) + 56px); right: auto; top: max(8px, env(safe-area-inset-top)); }
}
@media (orientation: portrait) {
    body.chrome-none.playing #rules-btn, body.chrome-none.playing #log-btn {
        position: fixed; z-index: 40; top: max(8px, env(safe-area-inset-top));
    }
    body.chrome-none.playing #rules-btn { left: 60px; }
    body.chrome-none.playing #log-btn   { left: 112px; }
    #move-log-panel { left: 8px; right: auto; top: calc(max(8px, env(safe-area-inset-top)) + 54px); }
}
@media (max-height: 520px) and (orientation: landscape) {
    body.chrome-none.playing #rules-btn, body.chrome-none.playing #log-btn { display: none; }
}

/* ── THE BIG SCREEN players' column (user, 2026-11-10) ───────────────────────────────────────
   "on big screens: a bigger font, bigger squares, the avatars INSIDE the squares, no grey huts --
   just grey where there is no colour". A desk or a tall tablet, never the dense touch table.
   The figure (.flip-figure, game.js renderSeats) stands on the face-down card, over the guess
   tint, so a guess still paints the square; the printed back is hidden (pushed out of its own
   box) and the face is plain grey stone until a guess colours it. The final flip still turns
   the front over all of it. */
.flip-figure { display: none; }
@media (min-height: 521px) and (pointer: fine), (min-height: 521px) and (orientation: portrait) {
    .mine-row, .seat-card { min-height: 64px; gap: 12px; }
    .hud-clan { min-height: 66px; }
    .seat-name { font-size: 17px; }
    .hud-clan b { font-size: 21px; }
    .hud-clan-who small { font-size: 13px; }
    #hud-villages { font-size: 16px; }
    .scores-title { font-size: 15px; }
    .chip-icon { width: 32px; height: 32px; font-size: 15px; }
    .seat-card .card-flip, .hud-clan img { width: 52px; height: 52px; }
    .seat-card .card-flip .face, .hud-clan img { border-radius: 6px; }
    .seat-card .card-flip .back {
        object-position: -999px 0;               /* the printed hut goes; the box stays */
        background: linear-gradient(160deg, #8d8880, #66625c);
    }
    .seat-card .guess-tint { border-radius: 6px; }
    .seat-card > .seat-figure { display: none; }
    .flip-figure {
        display: block; position: absolute; z-index: 1;
        left: 50%; top: 50%; width: 26px; height: 45px;
        transform: translate(-50%, -50%);
        pointer-events: none;
        /* earth pigments on a clan colour or grey: a pale halo keeps the figure readable */
        filter: drop-shadow(0 0 1.5px rgba(255, 248, 232, .85)) drop-shadow(0 1px 2px rgba(0, 0, 0, .5));
        backface-visibility: hidden;
    }
    .card-flip.flipped .flip-figure { display: none; }
    .card-flip .front { z-index: 2; }
}

/* ── Crawlable copy (#intro in index.html): below the fold, never display:none ──────────────
   SEO 2026-11-16. Out of the way of the table: the document never scrolls to it, but it is
   rendered text, which is what a crawler counts. */
#intro {
    /* FIXED, not absolute: a fixed box below the viewport adds no scroll height, so the table
       never gains a scrollbar (absolute made the page 1312px tall on an 800px window). */
    position: fixed; top: 100vh; left: 0; right: 0; pointer-events: none;
    margin: 0 auto; max-width: 720px; padding: 4px 20px 8px; text-align: center;
    color: rgba(239, 228, 207, .72); font-family: Georgia, serif; font-size: 14px; line-height: 1.55;
}
#intro h1 { color: #efe4cf; font-family: var(--dk-font-display); font-weight: 400; font-size: 27px; margin: 0 0 4px; }
#intro .intro-tagline { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; margin: 0 0 14px; }
#intro h2 { color: #efe4cf; font-family: var(--dk-font-display); font-weight: 400; font-size: 17px; margin: 14px 0 5px; }
#intro p { margin: 0 0 9px; }
#intro strong { color: #efe4cf; }
#intro a { color: var(--dk-accent); }
