/* War Chest — the exchequer table.
 *
 * Where every value comes from (sampled from the game's own print files in assets/):
 *   felt / chequer   the board's green outer rim (board.webp corners, #1d4a31 → deepened for a room)
 *   walnut           the wooden header band of every unit card (cards/*.webp tops, #5a3418 / #8a5528)
 *   parchment        the hex field and the cards' bodies (#f3e6c4 / #e8d5a6)
 *   gold             the knot rules and the corner medallion rings of the board (#c9a24a)
 *   emblem green     the location medallions on the board (#2f7a4e) — "act here", the primary
 *   raven / wolf     the two factions' coins and seals: slate #2c3336, cream-gold #efe2b9 / #b8933f
 *   blood            the crossbow / lancer foot bands of the cards (#b23a2a) — attacks only
 * Type: Uncial Antiqua — the hand the unit names are lettered in on the cards; Alegreya Sans —
 * a calligraphic humanist sans that reads at 11px on parchment. Both self-hosted (SIL OFL).
 */
@font-face { font-family: 'Uncial Antiqua'; src: url('assets/fonts/UncialAntiqua.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url('assets/fonts/AlegreyaSans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url('assets/fonts/AlegreyaSans-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url('assets/fonts/AlegreyaSans-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
    --felt: #10261b; --felt-2: #183a27; --felt-deep: #081510; --felt-line: rgba(201, 162, 74, .055);
    --walnut-9: #21110a; --walnut-8: #351c0e; --walnut-7: #5a3418; --walnut-6: #6f4220; --walnut-5: #8a5528; --oak: #b98545;
    --parch: #f3e6c4; --parch-2: #e8d5a6; --parch-3: #d6bd86; --ink: #2a1b0e; --ink-2: #553c22; --ink-3: #74583a;
    --gold: #c9a24a; --gold-2: #e4c77d; --gold-ink: #7f611d;
    --emblem: #2f7a4e; --emblem-deep: #1b5235; --emblem-lite: #6fbf8a;
    --raven: #2c3336; --raven-2: #4a5458; --raven-lite: #b9c4c8;
    --wolf: #efe2b9; --wolf-2: #b8933f; --wolf-deep: #6e5418;
    --blood: #b23a2a; --blood-lite: #e8664e;
    --uncial: 'Uncial Antiqua', 'Palatino Linotype', Georgia, serif;
    --sans: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
    --ease: cubic-bezier(.16, .84, .3, 1);
    --hand: 60px; --mini: 34px; --coin: 40px;
    /* parchment.webp: generated, original (assets/gen/make_bg.sh); tiled under every sheet */
    --paper: var(--parch) url('assets/bg/parchment.webp') center / 460px repeat;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background-color: var(--felt);
    background-image:
        radial-gradient(ellipse 120% 90% at 50% 42%, rgba(46, 96, 64, .55), transparent 62%),
        repeating-linear-gradient(0deg, var(--felt-line) 0 1px, transparent 1px 56px),
        repeating-linear-gradient(90deg, var(--felt-line) 0 1px, transparent 1px 56px),
        radial-gradient(ellipse at 50% 50%, var(--felt-2), var(--felt-deep) 92%);
    color: var(--parch);
    font: 500 15px/1.35 var(--sans);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
button { font: inherit; color: inherit; touch-action: manipulation; }
button svg, button img { pointer-events: none; }
::selection { background: var(--gold); color: var(--walnut-9); }
:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 2px; }
/* on parchment the gold ring is ~1.3:1 and vanishes: every sheet takes a walnut ring instead */
:is(.start-card, #writ, .end-sheet, .v-sheet, .wc-pp, .wcm, .hdr-menu, .side-panel, #rules-popup, .tut-slip, .ledger, .army, .start-lang-picker, #ai-card) :focus-visible { outline-color: var(--walnut-8); }
/* pressed: every button settles a pixel (the coins and board pieces have their own feedback) */
:is(.pill, .primary-btn, .secondary-btn, .w-btn, .w-verb, .w-unit, .w-decree, .start-link, .start-lang-btn, .fl-btn, .hdr-btn):active:not(:disabled) { transform: translateY(1px); }
.flag svg { width: 100%; height: 100%; display: block; border-radius: 2px; }

/* ── header: a walnut rail ───────────────────────────────────────────────────── */
#header-bar {
    position: fixed; left: 0; right: 0; top: 0; height: 54px; z-index: 40;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 0 10px env(safe-area-inset-right) 10px;
    background:
        linear-gradient(rgba(36, 18, 8, .42), rgba(30, 14, 6, .62)),
        url('assets/ui/wood.webp') center / 100% 100%, var(--walnut-7);
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}
body:not(.in-game) #header-bar, body.phone #header-bar { display: none; }
.hdr-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hdr-title { font: 400 26px/1 var(--uncial); color: var(--parch); letter-spacing: .02em; white-space: nowrap; text-shadow: 0 2px 0 rgba(0, 0, 0, .45); }
.hdr-round { font: 700 13px/1 var(--sans); color: var(--gold-2); padding: 5px 9px; border: 1px solid rgba(228, 199, 125, .45); border-radius: 999px; white-space: nowrap; }
.hdr-round:empty { display: none; }
.hdr-tools { display: flex; align-items: center; gap: 2px; }
.hdr-btn {
    width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px;
    background: transparent; color: var(--parch-2); cursor: pointer;
}
.hdr-btn:hover { background: rgba(243, 230, 196, .1); color: var(--parch); }
.hdr-btn.active { background: var(--parch); color: var(--walnut-8); }
.hdr-btn.off { color: var(--ink-3); }
#more-btn { display: none; }
@media (max-width: 860px) { .hdr-btn.tool { display: none; } #more-btn { display: grid; } }
#ai-indicator {
    height: 34px; display: flex; align-items: center; gap: 7px; padding: 0 12px 0 10px; margin-right: 4px;
    border: 1px solid rgba(228, 199, 125, .5); border-radius: 999px; background: rgba(33, 17, 10, .55);
    color: var(--parch); font: 700 13px/1 var(--sans); cursor: pointer; position: relative; white-space: nowrap;
}
#ai-indicator::before { content: ''; position: absolute; inset: -5px -2px; }
.ai-lamp { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .4); flex: none; }
.ai-heuristic .ai-lamp, .ai-onnx .ai-lamp, .ai-search .ai-lamp { background: var(--emblem-lite); box-shadow: 0 0 0 2px rgba(111, 191, 138, .3); }
.ai-random .ai-lamp { background: var(--gold-2); }
.ai-pending .ai-lamp { animation: lamp 1.2s ease-in-out infinite; background: var(--gold); }
@keyframes lamp { 50% { opacity: .35; } }
#ai-card {
    position: fixed; z-index: 90; width: 260px; padding: 12px 14px; border-radius: 10px;
    background: var(--paper); color: var(--ink); box-shadow: 0 10px 28px rgba(0, 0, 0, .5); border: 2px solid var(--walnut-5);
    overflow-y: auto; max-width: calc(100vw - 12px);
}
.ai-detail-head { font: 400 17px/1.2 var(--uncial); color: var(--walnut-7); margin-bottom: 6px; }
.ai-detail-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 3px 0; border-bottom: 1px dotted var(--parch-3); }
.ai-detail-row span { color: var(--ink-2); }
.ai-detail-why { font-size: 13px; color: var(--ink-2); margin-top: 7px; }

/* phone: tools in the board's free corners */
.float-tools { position: fixed; z-index: 35; display: flex; gap: 4px; }
.float-tools[hidden] { display: none; }
.fl-btn {
    width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--gold);
    background: radial-gradient(circle at 40% 30%, rgba(60, 30, 12, .2), rgba(24, 11, 4, .7)), url('assets/ui/wood.webp') center / cover, var(--walnut-7); color: var(--parch);
    box-shadow: 0 3px 8px rgba(0, 0, 0, .5); cursor: pointer; padding: 0;
}
.fl-btn .ai-lamp { width: 12px; height: 12px; }

/* menus, panels, rules: parchment sheets with a walnut head */
.hdr-menu {
    position: fixed; z-index: 95; min-width: 200px; padding: 6px; border-radius: 10px;
    background: var(--paper); border: 2px solid var(--walnut-5); box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
}
.hdr-menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 10px;
    border: 0; border-radius: 7px; background: none; color: var(--ink); text-align: left; cursor: pointer; font-weight: 500;
}
.hdr-menu-item:hover, .hdr-menu-item:focus-visible { background: var(--parch-2); }
.hdr-menu-item.on { font-weight: 700; color: var(--emblem-deep); }
.mi-icon { width: 24px; display: grid; place-items: center; color: var(--walnut-7); }
.mi-icon .flag { width: 22px; height: 15px; display: block; }
.side-panel {
    position: fixed; right: 10px; z-index: 60; width: min(380px, calc(100vw - 20px)); max-height: calc(100vh - 80px);
    display: flex; flex-direction: column; border-radius: 12px; overflow: hidden;
    background: var(--paper); color: var(--ink); border: 2px solid var(--walnut-5); box-shadow: 0 14px 34px rgba(0, 0, 0, .55);
}
body.phone .side-panel { left: 4px; right: auto; top: 4px !important; max-height: calc(100vh - 8px); width: min(360px, 58vw); }
.panel-head {
    display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 14px;
    background: linear-gradient(rgba(36, 18, 8, .5), rgba(30, 14, 6, .68)), url('assets/ui/wood.webp') center / cover, var(--walnut-7); color: var(--parch);
}
.panel-head h3 { margin: 0; font: 400 19px/1.2 var(--uncial); }
.panel-close { width: 44px; height: 44px; border: 0; background: none; color: var(--parch); cursor: pointer; display: grid; place-items: center; }
.panel-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 12px 12px; font-size: 14px; }
.panel-foot { padding: 8px 12px; font-size: 12.5px; color: var(--ink-2); border-top: 1px solid var(--parch-3); background: var(--parch-2); }
.log-empty { color: var(--ink-2); font-style: italic; }
.log-round { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; color: var(--gold-ink); font: 400 14px/1 var(--uncial); }
.log-round::before, .log-round::after { content: ''; flex: 1; border-top: 1px dashed var(--parch-3); }
.log-block { position: relative; padding: 5px 0 5px 18px; margin: 3px 0; border-bottom: 1px dotted var(--parch-2); }
.log-block::before { content: ""; position: absolute; left: 2px; top: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--parch-3); }
.log-block.raven::before { background: var(--raven); box-shadow: 0 0 0 1.5px var(--raven-lite); }
.log-block.wolf::before { background: var(--wolf); box-shadow: 0 0 0 1.5px var(--wolf-2); }
.log-block p { margin: 1px 0; }
.lg-who.raven { color: var(--raven); }
.lg-who.wolf { color: var(--wolf-deep); }
.lg-u { color: var(--walnut-7); }
.ai-entry { padding: 7px 0; border-bottom: 1px dotted var(--parch-3); }
.ai-meta { font-size: 12.5px; color: var(--ink-2); }
.ai-choice { font-weight: 700; margin: 2px 0; }
.ai-opt { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 1px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.ai-opt.chosen { background: rgba(47, 122, 78, .15); font-weight: 700; }
.ai-hidden { font-size: 12px; color: var(--ink-3); font-style: italic; padding: 1px 6px; }
#rules-popup {
    position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 16px));
    max-height: calc(100vh - 80px); overflow-y: auto; padding: 14px 20px 18px; border-radius: 12px;
    background: var(--paper); color: var(--ink); border: 2px solid var(--walnut-5); box-shadow: 0 16px 40px rgba(0, 0, 0, .6);
}
body.phone #rules-popup { top: 6px !important; max-height: calc(100vh - 12px); }
#rules-popup h3 { margin: 0 40px 8px 0; font: 400 22px/1.2 var(--uncial); color: var(--walnut-7); }
#rules-popup p { margin: 6px 0; font-size: 14.5px; line-height: 1.4; }
#rules-popup b { color: var(--emblem-deep); }
#rules-popup-close { position: absolute; right: 6px; top: 6px; width: 44px; height: 44px; border: 0; background: none; color: var(--walnut-7); cursor: pointer; display: grid; place-items: center; }

/* ── the table ───────────────────────────────────────────────────────────────── */
#game { position: fixed; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
body:not(.in-game) #game { display: none; }
#board {
    position: absolute; overflow: hidden; border-radius: 10px;
    box-shadow: 0 0 0 2px var(--walnut-8), 0 0 0 4px var(--gold), 0 18px 40px rgba(0, 0, 0, .6);
    background: var(--walnut-7);
}
#board .board-img { position: absolute; max-width: none; pointer-events: none; }
#board svg { position: absolute; left: 0; top: 0; overflow: visible; }
.hex-under { pointer-events: none; }
.hex-under .wing { fill: url(#wc-hatch); }
.hex-under .last { fill: none; stroke-width: 2.5; stroke-dasharray: 5 4; }
.hex-under .last.raven { stroke: var(--raven); }
.hex-under .last.wolf { stroke: var(--wolf-2); }
.ctl-layer, .unit-layer { position: absolute; inset: 0; pointer-events: none; }
.ctl { position: absolute; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45)); }
.unit {
    position: absolute; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; pointer-events: auto;
    --rim: var(--raven); --rim-2: var(--raven-lite); --rim-dark: #151a1b;
    box-shadow: 0 0 0 3.5px var(--rim), 0 0 0 5.5px var(--rim-2),
        0 calc(var(--edge) * 3px) 0 3.5px var(--rim-dark),
        0 calc(var(--edge) * 3px + 5px) 8px 4px rgba(0, 0, 0, .45);
}
.unit.wolf { --rim: #f6ecc9; --rim-2: #8c6a1f; --rim-dark: #6e5418; }
.unit img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.unit .n {
    /* the stack count: a badge that stays legible on the smallest board (>= 13px type on an
       18px pill), dark ink on cream or cream on slate, with a dark keyline off the coin art */
    /* centred 0.7 hex radii out toward the lower-right of the HEX (view.js badgeAt(): the badge
       takes the lower-left) — 0.7R / the coin's 1.48R = 33.4% of the coin from its centre, plus
       the stack's lift (unitHtml raises a tall stack by edge × 1.5px), so it never drifts up */
    position: absolute; left: 83.4%; top: calc(83.4% + var(--edge, 0) * 1.5px); transform: translate(-50%, -50%); min-width: max(19px, 46%); height: max(19px, 46%); padding: 0 4px; border-radius: 999px;
    display: grid; place-items: center; font: 700 max(13px, calc(var(--coin) * .32))/1 var(--sans); font-variant-numeric: tabular-nums;
    background: var(--raven); color: #fff; border: 1.5px solid var(--raven-lite);
    box-shadow: 0 0 0 1.5px rgba(10, 6, 3, .85), 0 2px 4px rgba(0, 0, 0, .5); z-index: 1;
}
.unit.wolf .n { background: var(--wolf); color: #3e2e0a; border-color: var(--wolf-2); }
.unit .n:empty { display: none; }
.hex-over { pointer-events: none; }
.hex-over .lit { pointer-events: all; cursor: pointer; stroke-width: 3.5; stroke-linejoin: round; }
.hex-over .lit.dest { fill: rgba(47, 122, 78, .3); stroke: var(--emblem); }
.hex-over .lit.target { fill: rgba(178, 58, 42, .2); stroke: var(--blood); }
.hex-over .lit.unit { fill: rgba(201, 162, 74, .24); stroke: var(--gold); }
.hex-over .lit.sel { fill: rgba(228, 199, 125, .5); stroke: var(--walnut-7); stroke-width: 4.5; }
.hex-over .chosen { fill: rgba(228, 199, 125, .32); stroke: var(--walnut-7); stroke-width: 2.5; pointer-events: none; }
.hex-over .trail { fill: none; stroke: var(--walnut-7); stroke-width: 3; stroke-dasharray: 2 6; stroke-linecap: round; pointer-events: none; }
.hex-over.asking .lit:not(.sel) { animation: lit 1.8s ease-in-out infinite; }
@keyframes lit { 50% { stroke-opacity: .45; } }
.unit.hit { animation: hit .5s ease-out; }
@keyframes hit { 30% { filter: brightness(1.6) sepia(.6) hue-rotate(-30deg) saturate(3); transform: translateX(-3px); } 60% { transform: translateX(3px); } }
.pulse { animation: pulse .6s var(--ease); }
@keyframes pulse { 40% { transform: scale(1.08); } }

/* the initiative marker: two faces, a gold ring, sealed once claimed this round */
#init {
    position: absolute; z-index: 12; border-radius: 50%; transform-style: preserve-3d;
    box-shadow: 0 0 0 2px var(--walnut-8), 0 0 0 4px var(--gold), 0 4px 10px rgba(0, 0, 0, .5);
    background: var(--walnut-8);
}
#init[hidden] { display: none; }
.init-face { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.init-face img { width: 100%; height: 100%; display: block; }
#init .init-face.wolf { display: none; }
#init.wolf .init-face.wolf { display: block; }
#init.wolf .init-face.raven { display: none; }
.init-claim { position: absolute; width: 62%; right: -26%; bottom: -22%; display: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
#init.claimed .init-claim { display: block; }

/* ── the camps: walnut trays, parchment ledgers ─────────────────────────────── */
.camp { position: absolute; display: flex; flex-direction: column; }
.camp.you { justify-content: flex-end; }
.camp-inner {
    display: flex; flex-direction: column; gap: 6px; padding: 7px;
    border-radius: 12px;
    background:
        linear-gradient(170deg, rgba(40, 20, 8, .55), rgba(24, 11, 4, .78)),
        url('assets/ui/wood2.webp') center / cover, var(--walnut-7);
    box-shadow: inset 0 0 0 1px rgba(228, 199, 125, .35), 0 10px 26px rgba(0, 0, 0, .5);
}
.camp.acting .camp-inner { box-shadow: inset 0 0 0 2px var(--gold-2), 0 10px 26px rgba(0, 0, 0, .5); }
.camp-head { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 2px; }
.emblem { width: 34px; height: 34px; border-radius: 50%; flex: none; box-shadow: 0 2px 4px rgba(0, 0, 0, .5); }
.who { display: flex; align-items: baseline; gap: 6px; min-width: 0; flex: 1; flex-wrap: wrap; row-gap: 0; }
.who .nm { font: 400 19px/1.1 var(--uncial); color: var(--parch); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.who .side { font-size: 12.5px; color: var(--gold-2); white-space: nowrap; }
.ai-tag { font: 700 11px/1 var(--sans); padding: 3px 5px; border-radius: 4px; background: var(--gold); color: var(--walnut-9); }
.init-slot { width: 40px; height: 40px; flex: none; }
.camp.acting .camp-head .nm::after { content: ' …'; color: var(--gold-2); animation: lamp 1.2s ease-in-out infinite; }
.camp.you.acting .camp-head .nm::after { content: ''; }

.hand {
    display: flex; align-items: center; justify-content: center; gap: 6px; min-height: calc(var(--hand) + 12px);
    padding: 6px; border-radius: 9px;
    background: radial-gradient(ellipse at 50% 30%, rgba(46, 96, 64, .9), var(--felt-deep));
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, .6);
}
/* the opponent's hand recedes (the Lit Table: only YOUR hand is lit felt): a slim walnut pocket
   cut into the tray, the hidden coins a size down, and an empty hand folds to one quiet line */
.hand.theirs {
    min-height: calc(var(--hand) * .6 + 10px); padding: 5px 6px;
    background: linear-gradient(180deg, rgba(10, 5, 2, .62), rgba(16, 8, 3, .38));
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(228, 199, 125, .2), 0 1px 0 rgba(228, 199, 125, .12);
}
.hand.theirs:has(.hand-empty) { min-height: 30px; padding: 2px 6px; }
.hand.theirs .hand-empty { color: var(--parch-3); font-size: 12.5px; }
.hand-coin {
    position: relative; width: var(--hand); height: var(--hand); padding: 0; border: 0; border-radius: 50%; background: none;
    box-shadow: 0 3px 6px rgba(0, 0, 0, .55); flex: none;
}
.hand.theirs .hand-coin { width: calc(var(--hand) * .6); height: calc(var(--hand) * .6); box-shadow: 0 2px 4px rgba(0, 0, 0, .6); }
.hand-coin img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.hand-coin.live { cursor: pointer; box-shadow: 0 0 0 2px rgba(228, 199, 125, .55), 0 3px 6px rgba(0, 0, 0, .55); }
.hand-coin.live:hover { filter: brightness(1.12); }
.hand-coin.sel { box-shadow: 0 0 0 3px var(--gold-2), 0 0 0 5px var(--walnut-8), 0 8px 14px rgba(0, 0, 0, .6); transform: translateY(-4px); }
.hand-coin.forced { box-shadow: 0 0 0 3px var(--blood-lite), 0 3px 6px rgba(0, 0, 0, .55); }
.forced-tag { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--blood); color: #fff; font-size: 12px; display: grid; place-items: center; }
.hand-empty { color: var(--parch-3); font-size: 13px; font-style: italic; }

.ledger {
    display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 6px; padding: 5px 6px;
    border-radius: 9px; background: var(--paper); color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--parch-3);
}
.ledger > * { min-height: 44px; }
.bag {
    position: relative; width: 46px; height: 46px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center;
}
.bag svg { width: 44px; height: 44px; }
.bag-body { fill: #6b4423; stroke: var(--walnut-9); stroke-width: 1.5; }
.bag-neck { fill: #845530; stroke: var(--walnut-9); stroke-width: 1.5; }
.bag-tie { stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; }
.bag-n { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); font: 700 15px/1 var(--sans); color: var(--parch); font-variant-numeric: tabular-nums; }
.discard {
    display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 1px; min-width: 0; padding: 2px 4px;
    border: 1px dashed var(--parch-3); border-radius: 7px; background: none; cursor: pointer; overflow: hidden;
}
.discard .lbl { font-size: 11px; color: var(--ink-2); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-fan { display: flex; align-items: center; min-height: calc(var(--mini) * .82); overflow: hidden; }
.dc-fan .dc { width: calc(var(--mini) * .82); height: calc(var(--mini) * .82); border-radius: 50%; flex: none; margin-right: calc(var(--mini) * -.42); box-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.dc-fan .dc.down:not(.hid) { filter: grayscale(.55) brightness(.82); box-shadow: 0 0 0 1.5px var(--ink-3); }
.dc-empty { width: 1px; height: 1px; }
.markers { display: flex; align-items: center; gap: 4px; }
.mk-stack { position: relative; width: calc(var(--mini) * .9 + 10px); height: calc(var(--mini) * .9); }
.mk-stack .mk { position: absolute; left: calc(var(--i) * 2px); top: calc(var(--i) * -1.5px + 4px); width: calc(var(--mini) * .9); height: calc(var(--mini) * .9); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .4)); }
.mk-n { font: 700 17px/1 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums; min-width: 12px; }
.seals { display: flex; align-items: center; justify-content: center; grid-column: 1 / -1; min-height: 0 !important; margin-top: -2px; }
/* a height of its own: an image sized by width only is 0px tall until it loads, and the tray it
   sits in (and the decrees under it) were placed 18-23px short on the first paint */
.seals .sl { width: calc(var(--mini) * .72); height: calc(var(--mini) * .72); object-fit: contain; margin-left: calc(var(--mini) * -.18); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
.seals .sl.used { opacity: .18; filter: grayscale(1); }

.army { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px 6px; border-radius: 9px; background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--parch-3); }
.army-row {
    display: grid; grid-template-columns: var(--mini) 1fr; grid-template-rows: auto auto; column-gap: 7px; row-gap: 1px; align-items: center;
    min-height: max(var(--mini), 40px); padding: 2px 3px; border: 0; background: none; text-align: left; cursor: pointer; border-radius: 6px; color: var(--ink);
}
.army-row:hover { background: var(--parch-2); }
.army-coin { grid-row: span 2; width: var(--mini); height: var(--mini); border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .45); }
.army-name { font: 400 15px/1.05 var(--uncial); color: var(--walnut-7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: end; }
.army-counts { display: flex; gap: 10px; font-size: 12px; line-height: 1.1; color: var(--ink-2); align-self: start; white-space: nowrap; overflow: hidden; }
.army-counts i { font-style: normal; }
.army-counts b { font: 700 14px/1 var(--sans); font-variant-numeric: tabular-nums; }
.army-row .sup b { color: var(--emblem-deep); }
.army-row .out b { color: var(--blood); }
/* a zero recedes by colour, not by fading: ink-3 on parchment still reads at ~5:1 */
.army-row .out.zero { color: var(--ink-3); }
.army-row .out.zero b { color: var(--ink-3); font-weight: 500; }

/* decrees */
#decrees { position: absolute; display: flex; gap: 6px; justify-content: center; align-items: flex-end; }
#decrees[hidden] { display: none; }
#decrees.vertical { flex-direction: column; justify-content: center; align-items: center; }
.decree {
    position: relative; padding: 0; border: 0; background: none; cursor: pointer; height: 100%; max-height: 100%;
    flex: 0 1 auto; border-radius: 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink);
}
.decree:not(.chip-d) { width: var(--dw, 80px); height: auto; }
.decree .dframe { position: relative; width: 100%; aspect-ratio: 744 / 1028; display: block; flex: none; }
#decrees.vertical .decree { height: auto; width: 100%; max-height: 32%; }
#decrees.vertical .decree .dframe { width: auto; height: calc(100% - 33px); max-width: 100%; }
.decree .dcard { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; display: block; box-shadow: 0 4px 10px rgba(0, 0, 0, .5); }
/* the name under the card: parchment label, two lines at most, the language's own hyphenation */
.decree .dname {
    flex: none; max-width: 100%; min-width: 100%; padding: 2px 4px; border-radius: 4px; background: var(--paper);
    font: 700 11.5px/1.15 var(--sans); color: var(--walnut-8); text-align: center; hyphens: auto; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--parch-3), 0 2px 5px rgba(0, 0, 0, .4);
}
.decree .seal { position: absolute; width: 27%; bottom: 7%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); }
.decree .seal.s0 { left: 13%; }
.decree .seal.s1 { right: 13%; }
/* the phone's decree slips: a sliver of the card's art, the name legible beside it */
#decrees.chips { align-items: stretch; gap: 4px; }
.decree.chip-d {
    flex: 1 1 0; min-width: 0; height: auto; flex-direction: column; justify-content: center; gap: 2px; padding: 0 3px 3px; border-radius: 7px; overflow: hidden;
    background: var(--paper); box-shadow: inset 0 0 0 1px var(--parch-3), inset 0 0 0 2.5px rgba(201, 162, 74, .35), 0 3px 8px rgba(0, 0, 0, .45);
}
/* a strip of the card's own green-and-gold head, so each slip still reads as that card */
.decree.chip-d .dthumb { flex: none; align-self: stretch; height: 6px; margin: 0 -3px; background: center 4% / 100% auto no-repeat; }
.decree.chip-d .dname { min-width: 0; width: 100%; flex: 0 1 auto; padding: 0; background: none; box-shadow: none; font-size: 11.5px; letter-spacing: -.01em; overflow-wrap: normal; word-break: normal; }
.decree.chip-d .seal { position: absolute; width: 14px; bottom: -3px; }
.decree.chip-d .seal.s0 { left: auto; right: 12px; }
.decree.chip-d .seal.s1 { right: -2px; }
.decree.lit { box-shadow: 0 0 0 3px var(--emblem-lite), 0 0 0 5px var(--walnut-8); animation: lit-card 1.8s ease-in-out infinite; }
@keyframes lit-card { 50% { box-shadow: 0 0 0 3px rgba(111, 191, 138, .4), 0 0 0 5px var(--walnut-8); } }
.decree.proclaim { animation: pulse .7s var(--ease); }

/* ── the writ: your orders ──────────────────────────────────────────────────── */
#writ {
    position: absolute; z-index: 20; display: none; flex-direction: column; overflow: hidden;
    border-radius: 12px; background: var(--paper); color: var(--ink);
    border: 2px solid var(--walnut-5); box-shadow: 0 14px 34px rgba(0, 0, 0, .55);
}
#writ.show { display: flex; }
.w-head {
    display: flex; align-items: center; gap: 9px; padding: 6px 10px; min-height: 48px;
    background: linear-gradient(rgba(36, 18, 8, .5), rgba(30, 14, 6, .68)), url('assets/ui/wood.webp') center / cover, var(--walnut-7);
    color: var(--parch);
}
.w-head h3 { margin: 0; font: 400 20px/1.1 var(--uncial); flex: 1; min-width: 0; }
.w-card { width: 40px; height: 40px; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; flex: none; position: relative; }
.w-card::after { content: 'i'; position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; background: var(--parch); color: var(--walnut-7); font: 700 11px/16px Georgia, serif; text-align: center; }
.w-card img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.w-card img.sq { border-radius: 4px; }
.w-body { padding: 8px 10px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1 1 auto; min-height: 0; }
.w-line { margin: 0 0 8px; font-size: 15px; color: var(--ink-2); }
.w-order { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 8px; }
.w-order .sep { color: var(--ink-3); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 3px; border-radius: 999px; background: var(--parch-2); font-size: 13px; font-weight: 700; color: var(--walnut-7); }
.chip.auto { box-shadow: inset 0 0 0 1.5px var(--emblem); }
.chip img { width: 20px; height: 20px; border-radius: 50%; }
.chip svg { width: 18px; height: 16px; fill: var(--parch-3); stroke: var(--walnut-7); stroke-width: 1.5; }
.chip.wolf { background: var(--wolf); }
.w-verbs { display: flex; flex-direction: column; gap: 5px; }
.w-verb {
    display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 44px; padding: 6px 10px;
    border: 1px solid var(--parch-3); border-radius: 8px; background: #fbf4dd; text-align: left; cursor: pointer; color: var(--ink);
}
.w-verb b { font: 700 16px/1.1 var(--sans); color: var(--walnut-7); }
.w-verb span { font-size: 13px; line-height: 1.25; color: var(--ink-2); }
.w-verb:hover, .w-verb:focus-visible { background: var(--parch-2); border-color: var(--walnut-5); }
.w-verb.v-attack b, .w-verb.v-tactic b { color: var(--blood); }
.w-down { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 7px; padding-top: 6px; border-top: 1px dashed var(--parch-3); }
.w-down-l { width: 100%; font-size: 12px; color: var(--ink-3); }
.w-verb.small { flex: 1 1 auto; min-height: 44px; align-items: center; justify-content: center; padding: 4px 8px; }
.w-verb.small b { font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.w-units { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 5px; }
.w-unit { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 5px; min-height: 44px; padding: 4px 6px; border: 1px solid var(--parch-3); border-radius: 8px; background: #fbf4dd; cursor: pointer; text-align: left; color: var(--ink); }
.w-unit img { width: 32px; height: 32px; border-radius: 50%; }
.w-unit span { font: 400 13px/1.05 var(--uncial); color: var(--walnut-7); }
.w-unit b { font-size: 14px; color: var(--emblem-deep); }
.w-unit:hover { background: var(--parch-2); }
.w-decrees { display: flex; flex-direction: column; gap: 5px; }
.w-decree { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 5px 8px; border: 1px solid var(--parch-3); border-radius: 8px; background: #fbf4dd; text-align: left; cursor: pointer; color: var(--ink); min-height: 44px; }
.w-decree img { grid-row: span 2; width: 34px; border-radius: 3px; }
.w-decree b { font: 400 16px/1.1 var(--uncial); color: var(--walnut-7); }
.w-decree span { font-size: 12.5px; color: var(--ink-2); }
.w-foot { display: flex; gap: 6px; padding: 7px 8px; border-top: 1px solid var(--parch-3); background: var(--parch-2); flex: none; }
.w-btn { flex: 1; min-height: 44px; padding: 0 10px; border-radius: 9px; font: 700 15px/1 var(--sans); cursor: pointer; border: 1.5px solid var(--walnut-5); background: var(--parch); color: var(--walnut-7); }
.w-btn.primary, .primary-btn {
    border: 0; color: var(--parch);
    background: radial-gradient(circle at 50% 0%, #3f9363, var(--emblem) 55%, var(--emblem-deep));
    box-shadow: inset 0 0 0 1.5px rgba(243, 230, 196, .35), 0 3px 8px rgba(0, 0, 0, .35);
}
.w-btn.primary:hover, .primary-btn:hover { filter: brightness(1.08); }
.w-btn.skip { background: none; }
.w-cardtext { display: grid; grid-template-columns: 34% 1fr; gap: 8px; align-items: start; }
.w-cardimg { width: 100%; border-radius: 6px; grid-row: span 3; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.w-cardtext p { margin: 0; font-size: 13.5px; line-height: 1.3; }
.w-cardtext .tac { font-weight: 700; color: var(--walnut-7); }
.w-cardtext .attr { color: var(--ink-2); }
.w-left { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-3); }

/* the news plate: what the computer does — picture left, words right */
#news {
    position: absolute; z-index: 25; transform: translate(-50%, -10px); opacity: 0; pointer-events: none;
    display: flex; align-items: center; gap: 10px; max-width: min(360px, 60vw); padding: 7px 14px 7px 7px; border-radius: 999px;
    background: var(--paper); color: var(--ink); border: 2px solid var(--wolf-2); box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
    transition: opacity .25s ease, transform .35s var(--ease);
}
#news.show { opacity: 1; transform: translate(-50%, 0); }
#news.raven { border-color: var(--raven-2); }
#news img { width: 42px; height: 42px; border-radius: 50%; flex: none; object-fit: cover; }
#news div { display: flex; flex-direction: column; min-width: 0; }
#news b { font: 400 16px/1.1 var(--uncial); color: var(--walnut-7); }
#news span { font-size: 14px; color: var(--ink-2); }

.round-banner { position: absolute; z-index: 26; transform: translate(-50%, -50%); pointer-events: none; animation: banner-in .45s var(--ease); }
.round-banner span { display: block; padding: 10px 26px; font: 400 30px/1 var(--uncial); color: var(--parch); background: linear-gradient(rgba(36, 18, 8, .5), rgba(30, 14, 6, .68)), url('assets/ui/wood.webp') center / cover, var(--walnut-7); border: 2px solid var(--gold); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .55); white-space: nowrap; }
.round-banner.out { opacity: 0; transition: opacity .35s ease; }
@keyframes banner-in { from { opacity: 0; transform: translate(-50%, -40%); } }

/* flights */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 70; }
.ghost { position: fixed; border-radius: 50%; box-shadow: 0 8px 16px rgba(0, 0, 0, .5); will-change: transform; }
.ghost.g-marker { box-shadow: none; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .5)); }
.ghost.g-card { border-radius: 6px; }

/* ── the draft: the muster ──────────────────────────────────────────────────── */
#draft {
    position: absolute; z-index: 15; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 10px;
    background: radial-gradient(ellipse 120% 90% at 40% 45%, rgba(46, 96, 64, .55), transparent 62%),
        repeating-linear-gradient(0deg, var(--felt-line) 0 1px, transparent 1px 56px),
        repeating-linear-gradient(90deg, var(--felt-line) 0 1px, transparent 1px 56px), var(--felt);
}
#game.drafting > #board, #game.drafting > .camp, #game.drafting > #decrees, #game.drafting > #init, #game.drafting > #news { visibility: hidden; }
#draft[hidden] { display: none; }
.dr-side { display: flex; align-items: center; gap: 12px; flex: none; }
.dr-label { display: flex; align-items: center; gap: 8px; min-width: 150px; font: 400 18px/1.1 var(--uncial); color: var(--parch); }
.dr-label img { width: 34px; height: 34px; border-radius: 50%; }
.dr-army { display: flex; gap: 8px; }
.army-card { width: var(--ac, calc(var(--pc) * .55)); aspect-ratio: 742 / 1024; padding: 0; border: 0; background: none; border-radius: 5px; cursor: pointer; }
.army-card img { width: 100%; height: 100%; border-radius: 5px; display: block; box-shadow: 0 3px 8px rgba(0, 0, 0, .5); }
.army-card.empty { border: 2px dashed rgba(228, 199, 125, .35); background: rgba(0, 0, 0, .15); cursor: default; }
.dr-mid { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.dr-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dr-head h2 { margin: 0; font: 400 26px/1.1 var(--uncial); color: var(--parch); }
.dr-order { display: flex; gap: 4px; }
.ord { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--raven-lite); background: var(--raven); opacity: .45; }
.ord.wolf { border-color: var(--wolf-2); background: var(--wolf); }
.ord.done { opacity: .25; }
.ord.now { opacity: 1; box-shadow: 0 0 0 2px var(--gold-2); }
.dr-pool { flex: 0 1 auto; min-height: calc(var(--pc) / .724); display: grid; grid-template-columns: repeat(var(--cols), var(--pc)); gap: 8px; align-content: center; justify-content: center; }
.pool-card { position: relative; width: var(--pc); aspect-ratio: 742 / 1024; padding: 0; border: 0; background: none; border-radius: 7px; cursor: default; }
.pool-card img { width: 100%; height: 100%; border-radius: 7px; display: block; box-shadow: 0 5px 12px rgba(0, 0, 0, .5); }
.pool-card .pc-name { position: absolute; left: 0; right: 0; bottom: -2px; display: none; }
.pool-card.live { cursor: pointer; }
.pool-card.live:hover img { filter: brightness(1.08); }
.pool-card.sel img { box-shadow: 0 0 0 3px var(--gold-2), 0 0 0 6px var(--walnut-8), 0 10px 20px rgba(0, 0, 0, .6); }

/* ── dialogs: card viewer, welcome, end ─────────────────────────────────────── */
#viewer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 10px; background: rgba(8, 21, 16, .72); }
.v-sheet {
    position: relative; display: flex; gap: 16px; align-items: flex-start; width: min(680px, 100%); max-height: calc(100vh - 20px); overflow: auto;
    padding: 16px; border-radius: 14px; background: var(--paper); color: var(--ink); border: 2px solid var(--walnut-5); box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
}
.v-close { position: absolute; right: 6px; top: 6px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; font-size: 20px; color: var(--walnut-7); cursor: pointer; }
.v-pic { flex: 0 0 auto; }
.v-card { width: min(260px, 38vw); max-height: calc(100vh - 60px); object-fit: contain; border-radius: 10px; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); display: block; }
.v-coin { width: 150px; height: 150px; border-radius: 50%; }
.v-bag { display: grid; place-items: center; width: 110px; height: 110px; border-radius: 50%; background: #6b4423; color: var(--parch); font: 700 40px/1 var(--sans); }
.v-text { flex: 1; min-width: 0; padding-right: 30px; }
.v-text h3 { margin: 2px 0 10px; font: 400 28px/1.1 var(--uncial); color: var(--walnut-7); }
.v-tac { font-weight: 700; font-size: 16px; line-height: 1.35; margin: 0 0 8px; }
.v-attr { font-size: 15px; line-height: 1.35; color: var(--ink-2); margin: 0 0 8px; }
.v-count { position: relative; font-size: 14px; margin: 4px 0; padding-left: 16px; }
.v-count::before { content: ""; position: absolute; left: 0; top: .35em; width: 9px; height: 9px; border-radius: 50%; background: var(--raven); box-shadow: 0 0 0 1.5px var(--raven-lite); }
.v-count.wolf::before { background: var(--wolf); box-shadow: 0 0 0 1.5px var(--wolf-2); }
.v-coins { display: flex; flex-wrap: wrap; gap: 6px; }
.v-coins img { width: 42px; height: 42px; border-radius: 50%; }
.v-coins.list { flex-direction: column; }
.v-dc { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.v-dc.down img { filter: grayscale(.5) brightness(.85); }
body.phone .v-sheet { gap: 10px; padding: 10px; }
body.phone .v-card { width: min(170px, 30vw); }
body.phone .v-text h3 { font-size: 22px; margin-bottom: 6px; }
body.phone .v-tac, body.phone .v-attr { font-size: 13.5px; }

#wc-welcome { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; background: rgba(8, 21, 16, .35); opacity: 0; transition: opacity .3s ease; }
#wc-welcome.show { opacity: 1; }
.wc-welcome-plate {
    display: flex; align-items: center; gap: 16px; padding: 16px 26px 16px 16px; max-width: min(520px, calc(100vw - 20px));
    border-radius: 14px; background: var(--paper); color: var(--ink); border: 2px solid var(--gold); box-shadow: 0 18px 44px rgba(0, 0, 0, .6);
}
.wc-welcome-plate img { width: 74px; height: 74px; border-radius: 50%; }
.wc-welcome-plate .wt { font: 400 30px/1.1 var(--uncial); color: var(--walnut-7); }
.wc-welcome-plate .wl { font-size: 16px; color: var(--ink-2); margin-top: 4px; }

#wc-end { position: fixed; inset: 0; z-index: 88; display: grid; place-items: center; padding: 10px; background: rgba(8, 21, 16, .6); overflow-y: auto; }
.end-sheet {
    position: relative; width: min(460px, 100%); padding: 26px 24px 18px; border-radius: 14px; text-align: center;
    background: var(--paper); color: var(--ink); border: 2px solid var(--walnut-5); box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
}
.end-seal { position: absolute; top: -34px; left: 50%; width: 76px; transform: translateX(-50%) rotate(-8deg); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); }
.end-sheet h2 { margin: 10px 0 4px; font: 400 40px/1 var(--uncial); color: var(--walnut-7); }
#wc-end.won h2 { color: var(--emblem-deep); }
#wc-end.lost h2 { color: var(--blood); }
.end-sub { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }
.end-row { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 7px 0; border-top: 1px dotted var(--parch-3); }
.end-row > img { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; }
.end-row b { font: 400 18px/1.1 var(--uncial); color: var(--walnut-7); }
.end-marks { display: flex; gap: 3px; grid-column: 2; }
.end-marks img { width: 22px; height: 22px; }
.end-marks img.empty { opacity: .2; filter: grayscale(1); }
.end-n { display: none; }
.end-rounds { margin: 8px 0 12px; font-size: 13px; color: var(--ink-3); }
.end-btns { display: flex; gap: 8px; }
.end-btns button { flex: 1; }
.primary-btn, .secondary-btn { min-height: 48px; padding: 0 18px; border-radius: 10px; font: 700 17px/1 var(--sans); cursor: pointer; }
.secondary-btn { border: 1.5px solid var(--walnut-5); background: var(--parch); color: var(--walnut-7); }
.secondary-btn:hover { background: var(--parch-2); }

/* the upright-phone gate */
#wc-rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) and (max-width: 560px) {
    #wc-rotate { position: fixed; inset: 0; z-index: 200; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; background: var(--felt-deep); color: var(--parch); font-size: 18px; }
}

/* ── the start screen ───────────────────────────────────────────────────────── */
#start-screen { position: fixed; inset: 0; z-index: 30; overflow: hidden; }
.start-stage { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 26px; transform-origin: center; }
.start-poster { position: relative; width: 440px; height: 600px; flex: none; }
.poster-field {
    position: absolute; inset: 40px 20px 60px; border-radius: 16px; overflow: hidden;
    box-shadow: 0 0 0 3px var(--walnut-8), 0 0 0 5px var(--gold), 0 24px 50px rgba(0, 0, 0, .6);
}
.poster-field img { position: absolute; height: 118%; left: -42%; top: -9%; filter: saturate(.85) brightness(.62); }
.poster-chest { position: absolute; left: 50%; top: 50%; width: 248px; transform: translate(-50%, -54%); }
.poster-logo { position: relative; width: 100%; display: block; border-radius: 12px; box-shadow: 0 0 0 3px var(--walnut-9), 0 24px 44px rgba(0, 0, 0, .7); }
.poster-decree { position: absolute; width: 62%; right: -26%; top: 8%; border-radius: 8px; transform: rotate(9deg); opacity: 0; transition: opacity .35s ease, transform .45s var(--ease); box-shadow: 0 10px 24px rgba(0, 0, 0, .6); }
.start-poster.nobility .poster-decree { opacity: 1; transform: rotate(14deg) translateX(8px); }
.poster-army { position: absolute; left: 0; right: 0; display: flex; justify-content: center; gap: 10px; perspective: 600px; }
.poster-army.wolf { top: 4px; }
.poster-army.raven { bottom: 18px; }
.pa-coin, .pa-royal { width: 62px; height: 62px; border-radius: 50%; box-shadow: 0 0 0 3px var(--raven), 0 0 0 5px var(--raven-lite), 0 8px 14px rgba(0, 0, 0, .55); }
.pa-coin.wolf { box-shadow: 0 0 0 3px var(--wolf), 0 0 0 5px var(--wolf-2), 0 8px 14px rgba(0, 0, 0, .55); }
.pa-royal { box-shadow: 0 8px 14px rgba(0, 0, 0, .55); }
.pa-coin img, .pa-royal img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.start-tag { position: absolute; left: 0; right: 0; bottom: -18px; margin: 0; text-align: center; font: 400 17px/1.2 var(--uncial); color: var(--gold-2); white-space: nowrap; }

/* the menu card stands off the bright dawn sky in a carved walnut frame: wood band (border-box
   layer of assets/ui/wood.webp) between a gold inner rule and a gold outer rule, then a dark halo */
.start-card {
    position: relative; width: 430px; flex: none; padding: 16px 18px 12px; border-radius: 18px;
    color: var(--ink); border: 11px solid transparent;
    background:
        url('assets/bg/parchment.webp') center / 460px repeat padding-box,
        linear-gradient(180deg, rgba(255, 220, 160, .12), rgba(0, 0, 0, .28)) border-box,
        url('assets/ui/wood.webp') center / 220px repeat border-box;
    background-color: var(--walnut-7);          /* a colour may only sit in the last layer */
    box-shadow:
        inset 0 0 0 1.5px var(--gold), inset 0 0 0 3px rgba(53, 28, 14, .55), inset 0 2px 10px rgba(53, 28, 14, .35),
        0 0 0 2px var(--gold), 0 0 0 4px var(--walnut-9),
        0 0 0 9px rgba(10, 8, 4, .28), 0 0 70px 18px rgba(8, 6, 3, .5), 0 28px 60px rgba(0, 0, 0, .65);
}
.start-field { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: start; padding: 7px 0; border-bottom: 1px dotted var(--parch-3); }
.start-label { font: 400 16px/1.2 var(--uncial); color: var(--walnut-7); padding-top: 11px; white-space: nowrap; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pill {
    min-height: 44px; padding: 4px 11px; border-radius: 9px; border: 1.5px solid var(--parch-3); background: #fbf4dd;
    color: var(--ink-2); font: 700 14px/1.1 var(--sans); cursor: pointer; white-space: nowrap;
}
.pill:hover { border-color: var(--walnut-5); }
.pill.on { background: var(--walnut-7); border-color: var(--walnut-8); color: var(--parch); }
/* the four armies and the four battles stand as two even rows of two — never a ragged 3 + 1, and a
   long name (de "Berühmte Schlacht") breaks inside its pill instead of adding a third row */
.pills.modes, .pills.battles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pills.modes .pill { white-space: normal; line-height: 1.1; }
.pill { min-width: 44px; }
.pills.battles .pill { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }
.pills.battles small { font-weight: 500; font-size: 11.5px; opacity: .8; }
.pills.sides .pill { display: flex; align-items: center; gap: 8px; }
.side-coins { display: flex; }
.side-coins img { width: 24px; height: 24px; border-radius: 50%; margin-left: -5px; box-shadow: 0 0 0 1.5px var(--parch); }
.start-note { margin: 5px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.nob-row { display: flex; align-items: center; gap: 10px; }
.nob-row .start-note { margin: 0; }
.switch {
    position: relative; flex: none; width: 92px; height: 44px; border-radius: 999px; border: 1.5px solid var(--walnut-5);
    background: var(--parch-2); cursor: pointer; padding: 0; font: 700 13px/1 var(--sans); color: var(--ink-2);
}
.switch .knob { position: absolute; top: 3px; left: 3px; width: 36px; height: 36px; border-radius: 50%; transition: left .25s var(--ease); filter: grayscale(1) opacity(.6); }
.switch .knob img { width: 100%; height: 100%; }
.switch .sw-on, .switch .sw-off { position: absolute; top: 50%; transform: translateY(-50%); }
.switch .sw-on { left: 14px; display: none; color: var(--parch); }
.switch .sw-off { right: 14px; }
/* the deep emblem green: parchment "On" reads at 8:1 on it (the light emblem gave 4.2:1) */
.switch.on { background: var(--emblem-deep); border-color: #123b26; }
.switch.on .knob { left: 51px; filter: none; }
.switch.on .sw-on { display: block; }
.switch.on .sw-off { display: none; }
.switch:disabled { cursor: default; opacity: .85; }
.start-launch { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; }
.start-launch .primary-btn { min-height: 54px; font-size: 20px; font-family: var(--uncial); font-weight: 400; }
.start-continue { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.cont-sub { font: 500 12.5px/1 var(--sans); opacity: .85; }
.start-minor { display: flex; justify-content: center; gap: 18px; }
.start-link { min-height: 44px; min-width: 44px; border: 0; background: none; color: var(--walnut-7); font: 700 15px/1 var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 0 6px; }
.start-credits { margin: 6px 0 0; font-size: 12px; color: var(--ink-2); text-align: center; line-height: 1.4; }
.start-credits b { color: var(--ink); font-weight: 700; }
/* a link, but a finger-sized one: the whole 44px band takes the tap */
.start-support { display: flex; align-items: center; justify-content: center; min-height: 44px; width: max-content; max-width: 100%; margin: 0 auto; padding: 0 10px; font-size: 12.5px; color: var(--emblem-deep); text-underline-offset: 2px; }
.start-lang { position: absolute; top: 8px; right: 8px; }
.start-lang-btn { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--parch-3); background: #fbf4dd; display: grid; place-items: center; cursor: pointer; padding: 0; }
.start-lang-btn .flag { width: 24px; height: 16px; }
.start-lang-picker { position: absolute; right: 0; top: 50px; z-index: 5; width: 180px; padding: 5px; border-radius: 10px; background: var(--paper); border: 2px solid var(--walnut-5); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); }
.start-lang-opt { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 44px; padding: 4px 9px; border: 0; border-radius: 7px; background: none; cursor: pointer; color: var(--ink); text-align: left; }
.start-lang-opt .flag { width: 22px; height: 15px; display: block; }
.start-lang-opt.on { font-weight: 700; background: var(--parch-2); }
.start-field:first-child .start-label { padding-right: 0; }
.start-card .start-field:first-of-type { padding-right: 46px; }

/* ── phone: the same table, re-arranged ──────────────────────────────────────── */
body.phone .camp-inner { padding: 4px; gap: 3px; border-radius: 9px; }
body.phone .camp-head { min-height: 30px; gap: 5px; }
body.phone .emblem { width: 24px; height: 24px; }
body.phone .who .nm { font-size: 15px; }
body.phone .who .side { display: none; }
body.phone .init-slot { width: 30px; height: 30px; }
body.phone .hand { min-height: calc(var(--hand) + 6px); padding: 3px; gap: 4px; }
body.phone .hand.theirs { min-height: calc(var(--hand) * .6 + 6px); padding: 3px; }
body.phone .hand.theirs:has(.hand-empty) { min-height: 24px; padding: 1px 4px; }
body.phone .ledger { gap: 3px; padding: 2px 4px; grid-template-columns: auto 1fr auto; }
body.phone .ledger > * { min-height: 36px; }
body.phone .seals { grid-column: 1 / -1; min-height: 0; justify-content: center; }
body.phone .bag { width: 40px; height: 40px; }
body.phone .bag svg { width: 38px; height: 38px; }
body.phone .discard .lbl { display: none; }
body.phone .army { padding: 2px 4px 3px; flex-direction: row; flex-wrap: wrap; justify-content: space-around; gap: 2px; }
body.phone .army-row { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 0; width: 24%; padding: 1px 0; }
body.phone .army-name, body.phone .army-counts i { display: none; }
body.phone .army-counts, .camp.compact .army-counts { gap: 4px; align-self: center; }   /* the counts sit under their coin, not at the cell's edge */
body.phone .army-counts b { font-size: 12px; }
body.phone .army-row .out.zero { display: none; }
body.phone .w-head { min-height: 38px; padding: 3px 8px; }
body.phone .w-head h3 { font-size: 16px; }
body.phone .w-card { width: 32px; height: 32px; }
body.phone .w-body { padding: 5px 7px; }
body.phone .w-line { font-size: 13px; margin-bottom: 5px; }
body.phone .w-verb { min-height: 40px; padding: 4px 8px; }
body.phone .w-verb b { font-size: 14px; }
body.phone .w-verb span { font-size: 11.5px; }
body.phone .w-foot { padding: 4px 5px; gap: 4px; }
body.phone .w-btn { min-height: 40px; font-size: 14px; }
body.phone .w-units { grid-template-columns: 1fr; }
body.phone .w-cardtext { grid-template-columns: 30% 1fr; }
body.phone .w-cardtext p { font-size: 12px; }
body.phone #news { max-width: 54vw; padding: 4px 10px 4px 4px; }
body.phone #news img { width: 32px; height: 32px; }
body.phone #news b { font-size: 13px; }
body.phone #news span { font-size: 12px; }
body.phone .round-banner span { font-size: 22px; padding: 7px 16px; }
body.phone #draft { padding: 4px; gap: 4px; }
body.phone .dr-label { min-width: 0; font-size: 14px; }
body.phone .dr-label img { width: 24px; height: 24px; }
body.phone .dr-head h2 { font-size: 17px; }
body.phone .dr-side { gap: 6px; }
body.phone .dr-pool { gap: 5px; }
body.phone .wc-welcome-plate { padding: 10px 16px 10px 10px; }
body.phone .wc-welcome-plate img { width: 52px; height: 52px; }
body.phone .wc-welcome-plate .wt { font-size: 22px; }
body.phone .end-sheet { padding: 18px 16px 12px; }
body.phone .end-sheet h2 { font-size: 30px; }
body.phone .end-seal { width: 56px; top: -24px; }

/* portrait tablets: the camps sit under the board */
body.portrait .camp.you { justify-content: flex-start; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .hex-over.asking .lit:not(.sel), .decree.lit, .ai-pending .ai-lamp { animation: none; }
}

/* portrait tablets: each tray's army rolls into two columns so the hand stays on screen */
body.portrait .army { display: grid; grid-template-columns: 1fr 1fr; column-gap: 8px; }

/* the start card's two halves: one column on a tall screen (the halves dissolve into it) */
.start-set, .start-go { display: contents; }
.start-mark { display: none; }

/* short screens (phones in landscape): the start screen RE-ARRANGED, not shrunk — landscape has
   width to spare and no height, so the card turns into two columns (the muster roll | the
   launch) at full size: every control >= 34px, every word >= 11px, Play/Tutorial/Play
   together/Rules on the first view. The poster gives way below 820px; the chest-lid mark then
   heads the launch column, so the game's name is always on screen. */
@media (max-height: 460px) {
    .start-stage { gap: 12px; }
    .start-poster { width: 196px; height: 286px; }
    .poster-field { inset: 30px 8px 40px; }
    .poster-chest { width: 116px; }
    .pa-coin, .pa-royal { width: 30px; height: 30px; }
    .poster-army { gap: 5px; }
    .poster-army.wolf { top: 2px; }
    .poster-army.raven { bottom: 12px; }
    .start-tag { display: none; }
    .start-card {
        width: 612px; padding: 4px 10px 4px 12px; border-width: 6px; border-radius: 14px;
        display: grid; grid-template-columns: minmax(0, 1fr) 190px; column-gap: 12px; align-items: start;
        box-shadow: inset 0 0 0 1.5px var(--gold), 0 0 0 1.5px var(--gold), 0 0 0 3px var(--walnut-9), 0 0 40px 10px rgba(8, 6, 3, .5), 0 16px 36px rgba(0, 0, 0, .6);
    }
    .start-set { display: flex; flex-direction: column; min-width: 0; }
    .start-go { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding-left: 12px; border-left: 1px dotted var(--parch-3); align-self: stretch; }
    .start-field { grid-template-columns: 78px minmax(0, 1fr); gap: 6px; padding: 2px 0; align-items: center; }
    .start-field:last-child { border-bottom: 0; }
    .start-label { font-size: 13px; line-height: 1.05; padding-top: 0; white-space: normal; }
    .start-card .start-field:first-of-type { padding-right: 0; }
    .pill { min-height: 44px; padding: 2px 8px; font-size: 13px; border-radius: 8px; }
    .pills { gap: 3px; }
    /* the four army choices stay one row: a long name ("Berühmte Schlacht") breaks inside its pill
       rather than pushing a pill onto a second row of the card */
    .pills.modes { display: flex; flex-wrap: nowrap; }
    /* the four battles too, one row of four (the year is dropped here; "Bosworth Field" takes two
       lines inside its pill): five settings rows of 44px then fit the phone floor's 288px */
    .pills.battles { display: flex; flex-wrap: nowrap; }
    .pills.battles .pill { flex: 1 1 auto; align-items: center; text-align: center; white-space: normal; line-height: 1.05; padding: 2px 5px; }
    .pills.modes .pill { white-space: normal; line-height: 1.05; text-align: center; padding: 2px 7px; }
    .pills.battles small { display: none; }
    .side-coins img { width: 20px; height: 20px; }
    .start-note { display: none; }
    .nob-row .start-note { display: block; font-size: 11.5px; line-height: 1.2; }
    .switch { width: 80px; height: 44px; }
    .switch .knob { width: 36px; height: 36px; top: 2.5px; left: 3px; }
    .switch.on .knob { left: 38px; }
    .switch .sw-on { left: 10px; } .switch .sw-off { right: 10px; }
    .start-mark { display: block; margin: 6px 48px 4px 0; font: 400 21px/1.05 var(--uncial); color: var(--walnut-7); letter-spacing: .01em; white-space: nowrap; }
    .start-launch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding-top: 0; }
    .start-launch > * { grid-column: 1 / -1; }
    .start-launch .primary-btn { min-height: 44px; font-size: 18px; }
    .start-launch .secondary-btn { min-height: 44px; font-size: 14px; padding: 0 6px; }
    .start-continue + .start-play, .start-continue ~ .start-tutorial { grid-column: auto; }
    .cont-sub { font-size: 11.5px; }
    .start-minor { gap: 4px; justify-content: space-between; }
    .start-minor .start-link { min-height: 44px; font-size: 13.5px; padding: 0 4px; }
    .start-credits { font-size: 11px; line-height: 1.3; margin-top: 0; text-align: left; }
    /* the 44px band overlaps the credits above and the card's padding below: a full-size hit box
       that costs the column only ~34px */
    .start-support { font-size: 11.5px; min-height: 44px; margin: -4px 0 -6px; padding: 0; justify-content: flex-start; text-align: left; width: auto; position: relative; }
    /* fit tiers (start.js fit()): 44px when the screen has the height, then 38px, then the 33px
       floor — never smaller, and only while the card would otherwise have to be scaled */
    .start-card[data-fit="1"] .pill, .start-card[data-fit="1"] .start-launch .secondary-btn { min-height: 38px; }
    .start-card[data-fit="1"] .switch { height: 38px; width: 76px; }
    .start-card[data-fit="1"] .switch .knob { width: 32px; height: 32px; }
    .start-card[data-fit="1"] .switch.on .knob { left: 38px; }
    .start-card[data-fit="1"] .start-minor .start-link { min-height: 40px; }
    .start-card[data-fit="1"] .start-support { min-height: 36px; }
    .start-card[data-fit="2"] .pill { min-height: 33px; }
    .start-card[data-fit="2"] .start-launch .secondary-btn { min-height: 38px; }
    .start-card[data-fit="2"] .switch { height: 34px; width: 74px; }
    .start-card[data-fit="2"] .switch .knob { width: 28px; height: 28px; top: 2px; left: 2px; }
    .start-card[data-fit="2"] .switch.on .knob { left: 41px; }
    .start-card[data-fit="2"] .start-minor .start-link { min-height: 34px; }
    .start-card[data-fit="2"] .start-support { min-height: 32px; }
    .start-lang { top: 4px; right: 4px; }
    /* the language list opens BESIDE its button, two columns, never past the screen's foot */
    .start-lang-picker { top: 0; right: 50px; width: 300px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
}
@media (max-height: 460px) and (max-width: 820px) {
    .start-poster { display: none; }
}
/* tall enough for the poster's mark: the chest lid heads the launch column only without it */
@media (max-height: 460px) and (min-width: 821px) { .start-mark { display: none; } .start-go { padding-top: 48px; } }

/* phone: the writ keeps the tactic texts (they are the card) and drops the plain verbs' glosses */
body.phone .w-verb:not(.v-tactic) span { display: none; }
body.phone .w-verb { min-height: 44px; justify-content: center; }
body.phone .w-down { margin-top: 4px; padding-top: 4px; gap: 4px; }
body.phone .w-down-l { display: none; }
body.phone .w-verb.small { padding: 2px 6px; }

/* ── the generated backgrounds (assets/bg, original art, assets/gen/make_bg.sh) ──────────── */
/* the table: a war-council table under the board; edges darkened so the trays stay readable */
body.in-game {
    background:
        radial-gradient(ellipse 75% 70% at 50% 50%, rgba(8, 5, 3, 0) 40%, rgba(8, 5, 3, .55) 100%),
        linear-gradient(rgba(12, 7, 4, .25), rgba(12, 7, 4, .25)),
        url('assets/bg/table.webp') center / cover no-repeat,
        var(--walnut-9);
}
#draft {
    background:
        linear-gradient(rgba(14, 8, 4, .62), rgba(14, 8, 4, .62)),
        url('assets/bg/table.webp') center / cover no-repeat, var(--walnut-9);
}
/* the start screen: full-screen dawn battlefield, raven camp left, wolf spears right
   (assets/bg/menu.webp, Gemini, 2752×1536; it stands in for the missing box cover) */
#start-screen {
    background:
        linear-gradient(90deg, rgba(10, 14, 10, 0) 30%, rgba(10, 14, 10, .4) 62%, rgba(10, 14, 10, .62) 100%),
        linear-gradient(180deg, rgba(10, 14, 10, 0) 55%, rgba(10, 14, 10, .5) 100%),
        url('assets/bg/menu.webp?v=20261129c') center / cover no-repeat, var(--felt-deep);
}
.poster-field { display: none; }
.start-poster .poster-chest { top: 46%; }
.start-tag { color: var(--parch); text-shadow: 0 2px 6px rgba(0, 0, 0, .8); }

/* ── ability tooltips: a parchment slip, on hover (mouse) or long-press (touch) ─────────── */
#wc-tip {
    position: fixed; z-index: 120; width: min(300px, calc(100vw - 16px)); padding: 10px 12px 11px; border-radius: 10px;
    background: var(--paper); color: var(--ink); border: 2px solid var(--walnut-5);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .55); pointer-events: none; opacity: 0; transform: translateY(4px);
    transition: opacity .14s ease, transform .18s var(--ease);
}
#wc-tip.show { opacity: 1; transform: none; }
.tip-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.tip-head img { width: 38px; height: 38px; border-radius: 50%; flex: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.tip-head img.sq { border-radius: 4px; width: 30px; height: 41px; }
.tip-head b { font: 400 19px/1.1 var(--uncial); color: var(--walnut-7); }
.tip-head small { display: block; font-size: 12px; color: var(--ink-2); }
.tip-row { display: grid; grid-template-columns: 18px 1fr; gap: 6px; align-items: start; margin-top: 4px; font-size: 13.5px; line-height: 1.32; }
.tip-row svg { width: 16px; height: 16px; margin-top: 1px; }
.tip-row.tac svg { color: var(--blood); }
.tip-row.attr svg { color: var(--emblem-deep); }
.tip-row.res svg { color: var(--blood); }
.tip-row.tac b { color: var(--walnut-7); }
@media (prefers-reduced-motion: reduce) { #wc-tip { transition: none; transform: none; } }

/* gold knot rules between ledger rows (the board's gold lines, doubled) */
.army-row + .army-row { border-top: 0; background-image: linear-gradient(90deg, transparent, rgba(201, 162, 74, .55) 12%, rgba(201, 162, 74, .55) 88%, transparent), linear-gradient(90deg, transparent, rgba(201, 162, 74, .3) 12%, rgba(201, 162, 74, .3) 88%, transparent); background-size: 100% 1px, 100% 1px; background-position: 0 0, 0 3px; background-repeat: no-repeat; }
.army-row + .army-row:hover { background-color: var(--parch-2); }
body.phone .army-row + .army-row { background-image: none; }
.ledger, .army { box-shadow: inset 0 0 0 1px var(--parch-3), inset 0 0 0 3px rgba(201, 162, 74, .35); }
/* the writ's body scrolls behind a fade when an order outgrows its slot */
.w-body.scroll { -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(180deg, #000 calc(100% - 22px), transparent); padding-bottom: 18px; }
/* the claimed initiative: a bigger wax seal, slightly tilted */
.init-claim { width: 74%; right: -34%; bottom: -30%; transform: rotate(-12deg); }
.v-close svg, .tip-hex { width: 1em; height: 1em; vertical-align: -0.12em; }
.ai-choice svg { width: 11px; height: 11px; margin-right: 4px; vertical-align: 0; }
.chip svg.flag-i { width: 10px; height: 12px; fill: none; stroke: none; color: var(--walnut-7); }
.forced-tag svg { width: 11px; height: 11px; color: #fff; }

/* while an order is being written above it, your army rolls into one row of coins */
.camp.compact .army { flex-direction: row; flex-wrap: nowrap; justify-content: space-around; gap: 2px; padding: 3px 4px; }
.camp.compact .army-row { display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 0; width: 24%; padding: 1px 0; background-image: none; }
.camp.compact .army-name, .camp.compact .army-counts i { display: none; }
.camp.compact .army-counts { gap: 4px; }
.camp.compact .army-row .out.zero { display: none; }

/* ── Tutorial (tutorial.js) ──────────────────────────────────────────────────────
 * The slip is a sheet of the writ's parchment under a strip of card-back walnut, sealed with your
 * raven wax seal. The spotlight darkens the counting-house cloth (felt-deep) and rings what the
 * lesson points at in the board's gold; the pinned tap breathes. */
.tut-veil { position: fixed; inset: 0; z-index: 96; pointer-events: none; }
.tut-veil svg { display: block; }
.tut-veil .tut-dark { fill: rgba(8, 21, 16, .7); }
.tut-veil .tut-ring { fill: none; stroke: var(--gold-2); stroke-width: 2.5; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
.tut-veil .tut-ring.pin { stroke-width: 3.5; animation: tut-breathe 1.6s ease-in-out infinite; }
@keyframes tut-breathe { 50% { stroke: var(--gold); stroke-opacity: .55; } }
.tut-slip {
    position: fixed; z-index: 98; left: 8px; top: 8px; max-width: calc(100vw - 16px);
    display: flex; flex-direction: column; overflow: hidden; border-radius: 12px;
    background: var(--paper); color: var(--ink); border: 2px solid var(--walnut-5);
    box-shadow: 0 16px 38px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .35);
    opacity: 0; transform: translateY(6px); pointer-events: none;
    transition: opacity .22s var(--ease), transform .3s var(--ease);
}
.tut-slip.show { opacity: 1; transform: none; pointer-events: auto; }
.tut-slip.doing { border-color: var(--gold); }
.tut-slip.nag { animation: tut-nag .36s ease; }
@keyframes tut-nag { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }
.tut-head {
    display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 8px; min-height: 36px;
    background: linear-gradient(rgba(36, 18, 8, .5), rgba(30, 14, 6, .68)), url('assets/ui/wood.webp') center / cover, var(--walnut-7);
    border-bottom: 1.5px solid var(--gold);
}
.tut-seal { width: 30px; height: 30px; margin: -2px 0; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .55)); transform: rotate(-10deg); }
.tut-tag { font: 400 18px/1 var(--uncial); color: var(--parch); letter-spacing: .02em; text-shadow: 0 1px 0 rgba(0, 0, 0, .5); }
.tut-body { padding: 10px 14px 12px; }
.tut-text { margin: 0; font: 500 16px/1.42 var(--sans); color: var(--ink); text-wrap: pretty; }
.tut-slip.nag .tut-text { color: var(--blood); font-weight: 700; }
.tut-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.tut-btns .primary-btn, .tut-btns .secondary-btn { min-height: 44px; padding: 0 18px; font-size: 16px; border-radius: 10px; }
body.tut-on #news { opacity: 0; }
/* what the header opens during a lesson stands ABOVE the lesson's veil and slip (98): the rules,
   the panels, the menus and the AI lamp's card are read, not taught */
body.tut-on #rules-popup, body.tut-on .side-panel, body.tut-on .hdr-menu, body.tut-on #ai-card { z-index: 110; }
body.phone .tut-head { min-height: 0; padding: 3px 10px 3px 6px; }
body.phone .tut-seal { width: 22px; height: 22px; }
body.phone .tut-tag { font-size: 14px; }
body.phone .tut-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; padding: 6px 8px 6px 10px; }
body.phone .tut-text { font-size: 12.5px; line-height: 1.3; }
body.phone .tut-btns { margin-top: 0; flex-direction: column; gap: 4px; }
body.phone .tut-btns .primary-btn, body.phone .tut-btns .secondary-btn { min-height: 44px; font-size: 14px; padding: 0 12px; }
body.phone .tut-slip.narrow .tut-body { grid-template-columns: minmax(0, 1fr); row-gap: 5px; }
body.phone .tut-slip.narrow .tut-btns { flex-direction: row; justify-content: flex-end; }
/* a slip in a narrow rail: buttons share the width under the text */
.tut-slip.narrow .tut-text { font-size: 15px; line-height: 1.38; }
.tut-slip.narrow .tut-btns { gap: 6px; }
.tut-slip.narrow .tut-btns button { flex: 1 1 0; padding: 0 8px; font-size: 15px; }
body.phone .tut-slip.narrow .tut-text { font-size: 12.5px; line-height: 1.3; }
body.phone .tut-slip.narrow .tut-btns button { font-size: 14px; }
/* folded (the phone rail): a few lines and a More link; unfolded, the text scrolls in its stretch */
.tut-more { display: none; align-self: flex-start; min-height: 36px; margin: 2px 0 0 -6px; padding: 0 6px; border: 0; background: none;
    font: 700 13px/1 var(--sans); color: var(--emblem-deep); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tut-slip.clamp .tut-more { display: inline-flex; align-items: center; }
.tut-slip.clamp:not(.open) .tut-text { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tut-slip.open .tut-text { max-height: var(--tut-textmax, none); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--walnut-5) transparent; }
@media (prefers-reduced-motion: reduce) { .tut-slip { transition: none; transform: none; } .tut-slip.nag, .tut-veil .tut-ring.pin { animation: none; } }

/* ── online (online.js): no computer at the table — the AI lamp has nothing to say ── */
body.online #ai-indicator, body.online #fl-ai { display: none; }

/* the Royal Guard's defence: the attacking unit ringed in blood, a dashed line to the guard */
.hex-over .foe { fill: rgba(178, 58, 42, .18); stroke: var(--blood); stroke-width: 4; pointer-events: none; animation: lit 1.4s ease-in-out infinite; }
.hex-over .foe-line { stroke: var(--blood); stroke-width: 3; stroke-dasharray: 7 5; stroke-linecap: round; pointer-events: none; }

/* the writ's face-down band: outside the scrolling body, always on the sheet */
#writ > .w-down { flex: none; margin: 0; padding: 6px 10px 7px; border-top: 1px dashed var(--parch-3); }
body.phone #writ > .w-down { padding: 4px 6px; gap: 4px; }
/* phone: the plain verbs two to a row (the tactic keeps the full width for its card text), the
   unit choices (recruit, spy, reinforce) as two-up tiles — a short sheet shows them all */
body.phone .w-verbs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
body.phone .w-verb.v-tactic { grid-column: 1 / -1; }
body.phone .w-verb { align-items: center; text-align: center; padding: 3px 6px; }
body.phone .w-verb.v-tactic { align-items: flex-start; text-align: left; }
/* the tactic's card text in two lines (a long-press on the option, or the (i) coin in the head,
   shows all of it): the whole option fits the writ's scroll window, ~100px at the phone floor */
body.phone .w-verb.v-tactic span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 100%; }
/* the unit choices on a phone: two to a row on the widened sheet (view.js placeWrit), each name
   whole — in the sans, which sets the longest of them (de "Armbrustschütze") in ~86px; a name
   never breaks inside a word (only at its spaces: "Royal / Coin") */
body.phone .w-units { grid-template-columns: 1fr 1fr; gap: 4px; }
body.phone .w-unit { grid-template-columns: 30px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 6px; row-gap: 0; padding: 3px 6px 3px 4px; min-height: 44px; }
body.phone .w-unit img { width: 30px; height: 30px; grid-row: span 2; }
body.phone .w-unit span { font: 700 12.5px/1.1 var(--sans); color: var(--walnut-7); hyphens: manual; overflow-wrap: normal; word-break: normal; }
body.phone .w-unit b { font-size: 12px; line-height: 1; }

/* the game-over sheet on a short screen: the verdict on the left, the two buttons FIRST on the
   right with the "more games" strip under them — Play again / Main menu are never off the sheet */
#wc-end { place-items: safe center; }
@media (max-height: 520px) {
    .end-sheet { width: min(660px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 18px; align-items: start; padding: 16px 16px 12px; }
    .end-sheet > * { grid-column: 1; }
    .end-sheet h2 { font-size: 30px; margin-top: 8px; }
    .end-sub { margin-bottom: 8px; font-size: 14px; }
    .end-rounds { margin: 6px 0 0; }
    .end-btns { grid-column: 2; grid-row: 1 / span 2; flex-direction: column; align-self: start; margin-top: 8px; }
    .end-btns button { flex: none; min-height: 46px; }
    /* the strip takes the right column from under the buttons to the sheet's foot: the last row
       is the only flexible one (minmax(0, 1fr)), so a sheet capped at the screen's height gives
       the strip what is left and the strip scrolls inside itself — never past the sheet */
    .end-sheet { grid-template-rows: auto auto auto auto auto minmax(0, 1fr); }
    .end-sheet > .dk-more { grid-column: 2; grid-row: 3 / -1; align-self: stretch; min-height: 0; margin: 10px 0 0; padding-top: 8px;
        overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
    .end-sheet .dk-more-head { margin-bottom: 6px; }
    .end-sheet .dk-more-name { font-size: 11.5px; padding: 4px 3px 5px; }
    .end-sheet .dk-more-discord { margin-top: 6px; font-size: 12px; line-height: 1.3; }
    .end-seal { width: 52px; top: -20px; }
}

/* ── online ── "Play together" (core/passplay.js, online doors only; panelClass wc-pp) ─────
   War Chest does not link core/deckades.css, so the chooser is dressed here, in the start card's
   own frame: parchment in a gold-ruled walnut rim, Uncial heading, the doors as ledger rows. */
.pp-overlay { position: fixed; inset: 0; z-index: 1300; display: grid; place-items: center; padding: 8px;
    background: rgba(8, 21, 16, .72); }
/* away from the table (the chooser, the lobby, a join) the start screen's dawn battlefield stays
   behind the sheet, dimmed toward its middle so the parchment is the brightest thing on screen */
body:not(.in-game) .pp-overlay, body:not(.in-game) .wcm-layer {
    background:
        radial-gradient(ellipse 70% 75% at 50% 50%, rgba(10, 9, 6, .72), rgba(10, 9, 6, .42) 100%),
        url('assets/bg/menu.webp?v=20261129c') center / cover no-repeat, var(--felt-deep);
}
.pp-panel.wc-pp {
    position: relative; width: min(440px, 100%); max-height: calc(100dvh - 16px); overflow: auto; padding: 16px 18px 14px;
    border-radius: 18px; color: var(--ink); border: 11px solid transparent; text-align: left;
    background:
        url('assets/bg/parchment.webp') center / 460px repeat padding-box,
        linear-gradient(180deg, rgba(255, 220, 160, .12), rgba(0, 0, 0, .28)) border-box,
        url('assets/ui/wood.webp') center / 220px repeat border-box;
    background-color: var(--walnut-7);
    box-shadow: inset 0 0 0 1.5px var(--gold), inset 0 0 0 3px rgba(53, 28, 14, .55),
        0 0 0 2px var(--gold), 0 0 0 4px var(--walnut-9), 0 28px 60px rgba(0, 0, 0, .65);
    font: 500 15px/1.35 var(--sans);
}
.wc-pp h2 { margin: 0 0 12px; text-align: center; font: 400 30px/1.05 var(--uncial); color: var(--walnut-7); }
.wc-pp .pp-modes { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; }
.wc-pp .pp-mode {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 14px; text-align: left; cursor: pointer;
    border: 1.5px solid var(--parch-3); border-radius: 11px; background: #fbf4dd; color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 5px rgba(53, 28, 14, .18);
}
.wc-pp .pp-mode:hover { border-color: var(--walnut-5); background: #fff8e4; }
.wc-pp .pp-mode:active { transform: translateY(1px); }
.wc-pp .pp-mode:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.wc-pp .pp-mode-icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
    color: var(--parch); background: radial-gradient(circle at 50% 0%, #3f9363, var(--emblem) 55%, var(--emblem-deep)); }
.wc-pp .pp-mode-icon svg { width: 24px; height: 24px; }
.wc-pp .pp-mode-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wc-pp .pp-mode-title { font: 400 19px/1.1 var(--uncial); color: var(--walnut-7); }
.wc-pp .pp-mode-sub { font-size: 13.5px; line-height: 1.3; color: var(--ink-2); }
.wc-pp > .primary-btn, .wc-pp .pp-actions .primary-btn { display: block; width: 100%; }
.wc-pp .primary-btn.alt { border: 1.5px solid var(--walnut-5); background: var(--parch); color: var(--walnut-7); box-shadow: none; }
.wc-pp .primary-btn.alt:hover { background: var(--parch-2); filter: none; }
@media (max-height: 420px) {
    .pp-panel.wc-pp { padding: 8px 12px 8px; border-width: 7px; border-radius: 14px; }
    .wc-pp h2 { font-size: 22px; margin-bottom: 6px; }
    .wc-pp .pp-modes { flex-direction: row; gap: 6px; margin-bottom: 6px; }
    .wc-pp .pp-mode { min-height: 56px; padding: 6px 10px; gap: 8px; }
    .wc-pp .pp-mode-icon { width: 34px; height: 34px; }
    .wc-pp .pp-mode-title { font-size: 16px; }
    .wc-pp .pp-mode-sub { font-size: 12px; }
    .wc-pp .primary-btn { min-height: 44px; }
}

/* ── the velvet bags (bag.js / bag3d.js): a 3D bag drawn into a canvas over the button; the
   drawn icon stays underneath until it is in (and for good without WebGL). The public count
   moves to a walnut tab at the bag's foot, beside the cloth, never printed on it. ── */
.bag { width: 50px; height: 50px; }
.bag canvas.bag3d { position: absolute; left: 50%; top: 50%; width: 118%; height: 118%; transform: translate(-50%, -54%); pointer-events: none; }
.bag.has3d svg { visibility: hidden; }
.bag.has3d .bag-n {
    left: auto; right: -5px; bottom: -3px; transform: none; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
    display: grid; place-items: center; font: 700 13px/1 var(--sans); color: var(--parch);
    background: var(--walnut-8); box-shadow: 0 0 0 1.5px var(--gold), 0 2px 4px rgba(0, 0, 0, .45);
}
.bag:focus-visible { outline-offset: 0; border-radius: 10px; }
body.phone .bag canvas.bag3d { width: 112%; height: 112%; }
body.phone .bag.has3d .bag-n { min-width: 18px; height: 18px; font-size: 12px; right: -9px; bottom: -3px; }

/* ── control, readable under an army (user, 2026-11-29) ──────────────────────────────────
   The whole location hex is outlined and tinted in its holder's colours — a SOLID double rule
   at the hex's edge (the last action's trace is a dashed inner hex; the lit choices are filled,
   breathing hexes above the coins) — and with a stack on it the control marker peeks out as a
   rimmed badge at the hex's upper-left corner, above the coins and clear of the count. */
.hex-under .ring { stroke-width: 6; stroke-linejoin: round; }
.hex-under .ring.raven { stroke: var(--raven); fill: rgba(44, 51, 54, .26); }
.hex-under .ring.wolf { stroke: var(--wolf-2); fill: rgba(201, 162, 74, .26); }
.hex-under .ring-in { fill: none; stroke-width: 1.6; stroke-linejoin: round; }
.hex-under .ring-in.raven { stroke: var(--raven-lite); }
.hex-under .ring-in.wolf { stroke: #f6ecc9; }
.ctl-badges { position: absolute; inset: 0; pointer-events: none; }
.ctl.badge { pointer-events: auto; cursor: pointer; border-radius: 50%; filter: none; box-shadow: 0 0 0 2px var(--raven), 0 0 0 3.5px var(--raven-lite), 0 2px 5px rgba(0, 0, 0, .6); }
.ctl.badge.wolf { box-shadow: 0 0 0 2px #f6ecc9, 0 0 0 3.5px var(--wolf-deep), 0 2px 5px rgba(0, 0, 0, .6); }
/* the phone's face-down band: one row of three, the labels may break in two */
body.phone #writ > .w-down { flex-wrap: nowrap; }
body.phone #writ > .w-down .w-verb.small { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 2px 3px; }
body.phone #writ > .w-down .w-verb.small b { white-space: normal; font-size: 12px; line-height: 1.05; text-align: center; hyphens: auto; overflow-wrap: anywhere; }
.hex-over .ring-top { fill: none; stroke-width: 3.5; stroke-linejoin: round; pointer-events: none; }
.hex-over .ring-top.raven { stroke: var(--raven); filter: drop-shadow(0 0 1px var(--raven-lite)); }
.hex-over .ring-top.wolf { stroke: var(--wolf-2); filter: drop-shadow(0 0 1px #f6ecc9); }
/* the game-over sheet never outgrows a short screen: the strip scrolls inside it, the seal sits
   on the sheet's corner instead of above its edge */
@media (max-height: 520px) {
    .end-sheet { max-height: calc(100dvh - 20px); overflow-y: auto; overscroll-behavior: contain; }
    .end-seal, body.phone .end-seal { top: 8px; left: 14px; width: 46px; transform: rotate(-10deg); }
}

/* ── Japanese and Korean ─────────────────────────────────────────────────────────────────────────
 * Uncial Antiqua and Alegreya Sans have no CJK glyphs, so ja/ko put a matching CJK face BEHIND
 * each: Latin, digits and punctuation keep the game's own hands, the CJK glyphs come from
 *   ja  Shippori Mincho B1 700 — a mincho with brush-cut serifs, the closest relative of the cards'
 *       uncial lettering — for headings, unit names and buttons; Zen Kaku Gothic New for text
 *   ko  Song Myung — a brush-drawn myeongjo — for the same roles; Nanum Gothic for text
 * vendor/fonts-ja|ko/fonts.css (CJK unicode-range slices only, SIL OFL) is linked by i18n.js only
 * when the game runs in that language. Lining figures: Alegreya's old-style digits sink beside CJK.
 * CJK has no spaces: Japanese breaks anywhere under line-break: strict (no small kana or 。at a
 * line start); Korean keeps words whole (keep-all), with overflow-wrap as the safety net. */
:root:lang(ja) {
    --uncial: 'Uncial Antiqua', 'Shippori Mincho B1', 'Yu Mincho', 'Hiragino Mincho ProN', serif;
    --sans: 'Alegreya Sans', 'Zen Kaku Gothic New', 'Yu Gothic', 'Hiragino Sans', system-ui, sans-serif;
}
:root:lang(ko) {
    --uncial: 'Uncial Antiqua', 'Song Myung', 'Batang', serif;
    --sans: 'Alegreya Sans', 'Nanum Gothic', 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, sans-serif;
}
/* lnum as a feature setting, not font-variant-numeric: the `font:` shorthand used all over this
   sheet resets font-variant-numeric, never font-feature-settings */
:root:lang(ja) :is(body, body *), :root:lang(ko) :is(body, body *) { font-feature-settings: 'lnum' 1; }
:root:lang(ja) body { line-break: strict; }
:root:lang(ko) body { word-break: keep-all; overflow-wrap: break-word; }
/* hyphens:auto means nothing to CJK; where a rule asks for it the CJK line still breaks per glyph */
:root:lang(ja) :is(.dname, .w-unit span, .w-verb b) { hyphens: manual; }
/* the longest katakana unit name (ウォリアープリースト, 10 glyphs) must fit the ledger row unclipped */
:root:lang(ja) .army-name { font-size: 13.5px; letter-spacing: -.02em; }
/* the writ's title breaks only between its segments ("ソードマン ·" | "配置"), never inside a name;
   view.js fitWritTitle() shrinks the type when one segment alone is too wide for the head */
:root:lang(ja) .w-head h3 .w-ts, :root:lang(ko) .w-head h3 .w-ts { white-space: nowrap; }
/* no transition on the measured title: reduced motion's .01ms ones would hand fitWritTitle() the old size */
:root:lang(ja) :is(.w-head h3, .w-head h3 *), :root:lang(ko) :is(.w-head h3, .w-head h3 *) { transition-property: none; }
:root:lang(ja) .w-head h3.w-tbreak .w-ts, :root:lang(ko) .w-head h3.w-tbreak .w-ts { white-space: normal; }

/* The crawlable #about summary (index.html): hidden from sight, kept for search engines and
   screen readers — the BoN pattern (.bon-about). */
.wc-about { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* The rules popup's link to the full how-to-play page (header.js): a text link, not a button. */
#rules-popup .rules-more { display: inline-flex; align-items: center; min-height: 44px; margin-top: 2px; color: var(--emblem-deep);
    font: 700 15px/1.2 var(--sans); text-decoration: underline; text-underline-offset: 3px; touch-action: manipulation; }

/* Seven languages make the in-game language menu 7 x 44px tall — taller than the 300px phone
   floor. On a short screen it folds into two columns, and no menu ever runs off the screen. */
.hdr-menu { max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); overflow-y: auto; }
@media (max-height: 460px) { #wc-lang-menu { display: grid; grid-template-columns: 1fr 1fr; column-gap: 2px; } }
