/* Böhmische Dörfer — THE PAINTED CHEST.
 *
 * Where each choice came from (impeccable new-work, seed d4c139ed, 2026-11-16):
 *   world      Bohemian folk-painted furniture (Bauernmalerei): the villages are laid on the lid of a
 *              painted dowry chest. Not the tavern table every dice game ships.
 *   --chest    the deep painted blue of those chests, darkened so Klemens Franz's sunlit village
 *              tiles (greens, straw, cobble grey) are by far the brightest thing on screen.
 *   --ochre    the chests' frame bands; sampled near the tiles' parchment ribbons (#d6ae63) and
 *              pushed to a painted ochre for the bands. Structure only — never a signal.
 *   --vermilion the folk tulip red; a hair line inside the ochre bands, and refusals.
 *   --lime     lime-wash white, the comma strokes of the ornament. It is the ink, and the ONE signal
 *              "you may act here": lit buildings, playable dice, the primary button.
 *   seat inks  the five drawn wooden figures (scripts/bd_draw_pieces.mjs).
 *   fonts      Grenze Gotisch (OFL) for names and titles — the tiles letter their village names in
 *              blackletter; Vollkorn (OFL, a German book face) for every UI line, tabular numerals.
 *              Both self-hosted in assets/fonts (latin + latin-ext).
 */

@font-face { font-family: 'Grenze Gotisch'; font-weight: 400 900; font-display: swap;
    src: url('assets/fonts/GrenzeGotisch-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Grenze Gotisch'; font-weight: 400 900; font-display: swap;
    src: url('assets/fonts/GrenzeGotisch-latinext.woff2') format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Vollkorn'; font-weight: 400 900; font-display: swap;
    src: url('assets/fonts/Vollkorn-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Vollkorn'; font-weight: 400 900; font-display: swap;
    src: url('assets/fonts/Vollkorn-latinext.woff2') format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    --chest: #17324f;
    --chest-deep: #0d1f33;
    --chest-lift: #22476b;
    --panel: #1c3b5b;
    --panel-hi: #26507a;
    --ochre: #d39a3a;
    --ochre-deep: #9c6b22;
    --vermilion: #c24a33;
    --leaf: #7aa257;
    --lime: #f2ead8;
    --lime-soft: rgba(242, 234, 216, 0.74);
    --lime-faint: rgba(242, 234, 216, 0.16);
    --ink: #142c45;
    --seat-red: #b8322a; --seat-blue: #2f5f9e; --seat-green: #3d8a3a; --seat-yellow: #e2b02a; --seat-black: #2e2a27;
    --f-display: 'Grenze Gotisch', 'Vollkorn', Georgia, serif;
    --f-ui: 'Vollkorn', Georgia, 'Times New Roman', serif;
    --head-h: 48px;
    --tile: 200px;
    --cham: 10px;                                     /* the painted panels' chamfered corner */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    /* the shared back.js dialog, re-pointed at the chest */
    --dk-dialog-top: #22476b; --dk-dialog-bottom: #17324f; --dk-dialog-line: rgba(211, 154, 58, 0.7);
    --dk-panel-text: #f2ead8; --dk-panel-accent: #f2ead8; --dk-font-ui: 'Vollkorn', Georgia, serif;
    --dk-font-display: 'Grenze Gotisch', Georgia, serif; --dk-scrim: rgba(8, 18, 30, 0.66);
    --dk-back-btn-bg: #f2ead8; --dk-back-btn-ink: #142c45; --dk-back-btn-line: #f2ead8;
    --dk-back-alt-line: rgba(242, 234, 216, 0.5); --dk-back-focus: #d39a3a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    background: var(--chest);
    color: var(--lime);
    font-family: var(--f-ui);
    font-variant-numeric: lining-nums;
    overflow: hidden;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; background: none; border: 0; }
button svg { pointer-events: none; }
::selection { background: var(--ochre); color: var(--ink); }
:focus-visible { outline: 2px dashed var(--ochre); outline-offset: 3px; }
* { scrollbar-width: thin; scrollbar-color: var(--ochre-deep) transparent; }

/* ── The chest: brushed blue paint, darker at the edges ────────────────────────────────── */
#game, #start-screen {
    background:
        radial-gradient(120% 90% at 50% 40%, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0) 55%),
        radial-gradient(140% 120% at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(4, 12, 22, 0.55) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360'%3E%3Cfilter id='b' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006 0.09' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.92 0 0 0 0 0.95 0 0 0 0 1 0 0 0 0.10 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23b)'/%3E%3C/svg%3E"),
        var(--chest);
}
#game { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
body:not(.in-game) #game, body:not(.in-game) #bd-head { visibility: hidden; }

/* the ochre frame band around the villages: a painted panel moulding */
#board-frame {
    position: absolute; pointer-events: none;
    border: 6px solid var(--ochre);
    box-shadow:
        inset 0 0 0 1px var(--vermilion),
        inset 0 0 0 4px rgba(13, 31, 51, 0.6),
        0 6px 18px rgba(4, 12, 22, 0.55);
    clip-path: polygon(var(--cham) 0, calc(100% - var(--cham)) 0, 100% var(--cham), 100% calc(100% - var(--cham)), calc(100% - var(--cham)) 100%, var(--cham) 100%, 0 calc(100% - var(--cham)), 0 var(--cham));
    background: rgba(9, 22, 37, 0.28);
}
#board { position: absolute; }

/* ── A village ─────────────────────────────────────────────────────────────────────────── */
.village {
    position: absolute; width: var(--tile); height: var(--tile);
    filter: drop-shadow(0 4px 6px rgba(3, 10, 20, 0.55));
    transition: filter 0.25s ease, opacity 0.25s ease;
}
.village > .vg-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.village.dim { filter: drop-shadow(0 4px 6px rgba(3, 10, 20, 0.55)) brightness(0.55) saturate(0.7); }
.village.has-target { cursor: pointer; }
.village.zoomable { overflow: hidden; }
.village.zoomable .vg-ring::before { border-width: 2px; box-shadow: 0 0 0 1.5px rgba(13, 31, 51, 0.8); }
.village.complete::before {
    content: ''; position: absolute; right: 3%; bottom: 3%; width: 13%; aspect-ratio: 1;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='17' fill='%23d39a3a' stroke='%239c6b22' stroke-width='2'/%3E%3Cpath d='M12 20.5l5.5 5.5L29 14' fill='none' stroke='%23142c45' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    z-index: 3; pointer-events: none;
}
.vg-fig {
    position: absolute; width: calc(var(--tile) * 0.126); height: calc(var(--tile) * 0.176);
    transform: translate(-50%, -100%); pointer-events: none; z-index: 4;
}
/* a slight lime-wash backdrop so the figure reads on the busy painted village (user 2026-11-17):
   a soft halo behind the body and a little plinth under the foot */
.vg-fig::before {
    content: ''; position: absolute; left: -22%; right: -22%; top: 4%; bottom: -10%;
    border-radius: 50% 50% 46% 46% / 42% 42% 58% 58%;
    background: radial-gradient(ellipse at 50% 58%, rgba(242, 234, 216, 0.86) 0%, rgba(242, 234, 216, 0.7) 46%, rgba(242, 234, 216, 0) 72%);
    box-shadow: 0 0 6px 1px rgba(13, 31, 51, 0.18);
}
.vg-fig::after {
    content: ''; position: absolute; left: 6%; right: 6%; bottom: -7%; height: 16%; border-radius: 50%;
    background: rgba(13, 31, 51, 0.42);
}
.vg-fig img {
    position: relative; z-index: 1; width: 100%; height: 100%; display: block;
    filter: drop-shadow(0 0 1px rgba(13, 31, 51, 0.9)) drop-shadow(1px 2px 1.5px rgba(0, 0, 0, 0.55));
}
.vg-ring {
    position: absolute; z-index: 6;
    width: var(--hit); height: var(--hit); transform: translate(-50%, -50%);
    display: grid; place-items: center; border-radius: 50%;
    touch-action: manipulation;
}
.vg-ring::before {
    content: ''; width: var(--ring); height: var(--ring); border-radius: 50%;
    border: 3px solid var(--lime);
    box-shadow: 0 0 0 2px rgba(13, 31, 51, 0.75), inset 0 0 0 2px rgba(13, 31, 51, 0.45), 0 2px 8px rgba(0, 0, 0, 0.45);
    animation: breathe 2.4s ease-in-out infinite;
}
.vg-ring.kick::before { border-style: dashed; }
.vg-ring.chosen::before { background: rgba(242, 234, 216, 0.35); animation: none; }
.vg-ring.preview { pointer-events: none; }
.vg-ring:focus-visible { outline: none; }
.vg-ring:focus-visible::before { outline: 2px dashed var(--ochre); outline-offset: 3px; }
@media (hover: hover) { .vg-ring:hover::before { background: rgba(242, 234, 216, 0.28); } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.62; } }

/* ── The header: the chest's top rail ──────────────────────────────────────────────────── */
#bd-head {
    position: fixed; left: 0; top: 0; right: 0; height: var(--head-h); z-index: 50;
    display: flex; align-items: center; gap: 6px; padding: 0 8px;
    background: linear-gradient(180deg, #10263d, var(--chest-deep));
    border-bottom: 3px solid var(--ochre);
    box-shadow: 0 1px 0 var(--vermilion), 0 4px 12px rgba(3, 10, 20, 0.5);
}
.bd-name {
    font-family: var(--f-display); font-weight: 700; font-size: 26px; line-height: 1;
    color: var(--lime); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 0 1 auto; min-width: 0; padding-bottom: 2px;
}
.bd-name small { font-family: var(--f-ui); font-size: 13px; font-style: italic; color: var(--lime-soft); margin-left: 10px; font-weight: 400; }
.bd-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.tool {
    flex: none; width: 44px; height: 44px; display: grid; place-items: center; color: var(--lime);
    border-radius: 6px; position: relative;
}
.tool svg { width: 24px; height: 24px; }
.tool.active { background: var(--lime-faint); }
.tool.active::after { content: ''; position: absolute; left: 50%; bottom: 3px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--ochre); }
@media (hover: hover) { .tool:hover { background: var(--lime-faint); } }
.tool.off svg .on-only { display: none; }
.tool:not(.off) svg .off-only { display: none; }

/* AI badge: state by WORD and by lamp shape, never by hue alone */
.ai-badge {
    height: 32px; padding: 0 12px 0 10px; display: inline-flex; align-items: center; gap: 8px;
    border: 1px solid rgba(242, 234, 216, 0.4); border-radius: 16px; margin-right: 6px;
    font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--lime); position: relative;
    min-height: 44px; border-color: transparent; background: none;
}
.ai-badge::before { content: ''; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--lime); }
.ai-badge.ai-heuristic::before { background: var(--ochre); border-color: var(--ochre); }
.ai-badge.ai-pending::before { border-style: dotted; }
.ai-badge.ai-random::before { background: transparent; border-color: var(--vermilion); border-style: dashed; }
.ai-badge .ai-lbl { border-bottom: 1px solid rgba(242, 234, 216, 0.35); }
#ai-indicator-detail {
    display: none; position: absolute; top: calc(100% + 8px); right: 0; width: 260px; z-index: 70;
    padding: 12px 14px; text-align: left; font-weight: 400; white-space: normal; line-height: 1.4;
    background: var(--panel); border: 2px solid var(--ochre); color: var(--lime);
    box-shadow: 0 8px 22px rgba(3, 10, 20, 0.6);
}
#ai-indicator-detail b { display: block; font-family: var(--f-display); font-size: 18px; margin-bottom: 4px; }
.ai-badge.tip-open #ai-indicator-detail { display: block; }
@media (hover: hover) { .ai-badge:hover #ai-indicator-detail { display: block; } }

/* ── The right column ──────────────────────────────────────────────────────────────────── */
#side { position: absolute; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
#seats { display: flex; flex-direction: column; gap: 6px; min-height: 0; flex: 0 1 auto; overflow-y: auto; overscroll-behavior: contain; }
#own { flex: 0 0 auto; }
body:not(.phone):not(.tall) #tray { margin-top: auto; }

/* a player's drawer: a painted panel with its own figure */
.drawer {
    --seat: var(--seat-blue);
    position: relative; padding: 7px 10px 8px 12px;
    background: linear-gradient(180deg, var(--panel-hi), var(--panel));
    clip-path: polygon(var(--cham) 0, calc(100% - var(--cham)) 0, 100% var(--cham), 100% calc(100% - var(--cham)), calc(100% - var(--cham)) 100%, var(--cham) 100%, 0 calc(100% - var(--cham)), 0 var(--cham));
    box-shadow: inset 0 0 0 2px rgba(211, 154, 58, 0.55), inset 0 0 0 5px rgba(13, 31, 51, 0.35);
    transition: background 0.3s ease, box-shadow 0.3s ease;
    color: var(--lime); cursor: default;
}
.drawer.current { background: linear-gradient(180deg, #2f5f8c, #24496f); box-shadow: inset 0 0 0 3px var(--ochre), inset 0 0 0 6px rgba(13, 31, 51, 0.35); }
.drawer.current.mine { box-shadow: inset 0 0 0 3px var(--lime), inset 0 0 0 6px rgba(13, 31, 51, 0.35); }
.dr-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dr-fig { width: 20px; height: 28px; flex: none; filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.5)); }
.dr-name { font-family: var(--f-display); font-size: 20px; font-weight: 700; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dr-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }
.dr-stat { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.dr-stat img { height: 22px; width: auto; display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45)); }
.dr-stat.coins img { height: 24px; }
.dr-stat.zero { opacity: 0.45; }
.dr-tiles { display: inline-flex; align-items: center; gap: 3px; }
.dr-inn { position: relative; width: 28px; height: 28px; display: block; }
.dr-inn img { width: 100%; height: 100%; }
.dr-inn i { position: absolute; right: -3px; bottom: -3px; font: 700 10px/1 var(--f-ui); font-style: normal; background: var(--chest-deep); color: var(--lime); padding: 1px 3px; border-radius: 3px; }
.dr-bishop img, .dr-special img { height: 26px; }
.drawer.compact .dr-row { font-size: 15px; gap: 2px 8px; margin-top: 3px; }
.drawer.compact .dr-name { font-size: 18px; }
.drawer.compact .dr-stat img { height: 19px; }
.drawer.compact .dr-inn { width: 22px; height: 22px; }

/* ── The dice tray ─────────────────────────────────────────────────────────────────────── */
#tray {
    position: relative; flex: 0 0 auto; padding: 8px 10px 10px;
    background: linear-gradient(180deg, rgba(9, 22, 37, 0.55), rgba(9, 22, 37, 0.35));
    box-shadow: inset 0 0 0 2px rgba(211, 154, 58, 0.5), inset 0 2px 10px rgba(0, 0, 0, 0.45);
    clip-path: polygon(var(--cham) 0, calc(100% - var(--cham)) 0, 100% var(--cham), 100% calc(100% - var(--cham)), calc(100% - var(--cham)) 100%, var(--cham) 100%, 0 calc(100% - var(--cham)), 0 var(--cham));
}
#status-line { min-height: 22px; margin-bottom: 6px; pointer-events: none; }
#status-msg { display: block; font-size: 15px; line-height: 1.25; color: var(--lime-soft); font-style: italic; }
#status-msg.msg-alert { color: #ffb9a6; font-style: normal; font-weight: 600; }
#tray-row { display: flex; align-items: center; gap: 10px; }
#dice { display: flex; gap: 8px; flex: none; }
.die {
    width: var(--die, 52px); height: var(--die, 52px); position: relative; display: block; border-radius: 9px;
    transition: transform 0.18s var(--ease-out), filter 0.2s ease, opacity 0.2s ease;
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.5));
}
.die img { width: 100%; height: 100%; display: block; pointer-events: none; }
.die.used { filter: grayscale(0.8) brightness(0.55); opacity: 0.55; transform: scale(0.88); cursor: default; }
.die.free.can { cursor: pointer; }
.die.can::after { content: ''; position: absolute; inset: -4px; border-radius: 12px; border: 2px solid rgba(242, 234, 216, 0.45); }
.die.picked { transform: translateY(-6px); }
.die.picked::after { content: ''; position: absolute; inset: -5px; border-radius: 13px; border: 3px solid var(--lime); box-shadow: 0 0 0 2px rgba(13, 31, 51, 0.8); }
.die.reroll-mark::after { content: ''; position: absolute; inset: -5px; border-radius: 13px; border: 3px dashed var(--ochre); }
.die.rolling img { animation: tumble 0.12s linear infinite; }
@keyframes tumble { 0% { transform: rotate(0deg) scale(0.92); } 50% { transform: rotate(14deg) scale(1); } 100% { transform: rotate(0deg) scale(0.92); } }
#tray-tiles { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tt {
    position: relative; width: 48px; height: 48px; display: grid; place-items: center; flex: none;
}
.tt img { max-width: 42px; max-height: 44px; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5)); }
.tt .cnt { position: absolute; right: -2px; bottom: -2px; min-width: 18px; padding: 0 4px; font: 700 12px/18px var(--f-ui); text-align: center; background: var(--chest-deep); color: var(--lime); border-radius: 9px; box-shadow: 0 0 0 1px rgba(211, 154, 58, 0.6); }
.tt.empty img { opacity: 0.3; filter: grayscale(1); }
.tt.target::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid var(--lime); box-shadow: 0 0 0 2px rgba(13, 31, 51, 0.75); animation: breathe 2.4s ease-in-out infinite; }
.tt.held-by::before { content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--owner); box-shadow: 0 0 0 2px var(--lime); }
.tt-small { width: 34px; height: 40px; pointer-events: none; }
.tt-small img { max-width: 28px; max-height: 32px; }

#totals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 0; }
#totals:empty { display: none; }
.total {
    min-width: 44px; height: 40px; padding: 0 9px; display: inline-flex; align-items: center; gap: 6px;
    background: rgba(242, 234, 216, 0.1); color: var(--lime); font-weight: 700; font-size: 18px;
    box-shadow: inset 0 0 0 1.5px rgba(242, 234, 216, 0.55);
    clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
    font-variant-numeric: tabular-nums lining-nums;
}
.total small { font-size: 12px; font-weight: 400; color: var(--lime-soft); }
.total.on { background: var(--lime); color: var(--ink); }
.total.on small { color: rgba(20, 44, 69, 0.75); }
@media (hover: hover) { .total:not(.on):hover { background: rgba(242, 234, 216, 0.2); } }
/* a 44px hit box around a 40px chip */
.total::before { content: ''; position: absolute; inset: -2px 0; }

#actions { display: flex; gap: 8px; margin-top: 10px; }
#actions:empty { display: none; }

/* ── Two button voices ─────────────────────────────────────────────────────────────────── */
.btn {
    min-height: 44px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 17px; font-weight: 700; white-space: nowrap; letter-spacing: 0.01em;
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: linear-gradient(180deg, #fbf6ea 0%, var(--lime) 55%, #e2d7bd 100%); color: var(--ink); box-shadow: 0 2px 6px rgba(3, 10, 20, 0.4); }
.btn.secondary { background: transparent; color: var(--lime); box-shadow: inset 0 0 0 2px rgba(242, 234, 216, 0.6); }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: default; }
.btn.primary:disabled { background: #6c7f92; color: #23384d; box-shadow: none; }
.btn.secondary:disabled { color: rgba(242, 234, 216, 0.4); box-shadow: inset 0 0 0 2px rgba(242, 234, 216, 0.2); }
@media (hover: hover) {
    .btn.primary:not(:disabled):hover { background: #fffaf0; }
    .btn.secondary:not(:disabled):hover { background: var(--lime-faint); }
}
#actions .btn { flex: 1 1 0; padding: 0 10px; }

/* ── Plates: welcome, scoring, passes (hints live on painted plates, never on the cloth) ─── */
.plate {
    background: linear-gradient(180deg, var(--panel-hi), var(--panel));
    color: var(--lime);
    clip-path: polygon(var(--cham) 0, calc(100% - var(--cham)) 0, 100% var(--cham), 100% calc(100% - var(--cham)), calc(100% - var(--cham)) 100%, var(--cham) 100%, 0 calc(100% - var(--cham)), 0 var(--cham));
    box-shadow: inset 0 0 0 3px var(--ochre), inset 0 0 0 4px var(--vermilion), inset 0 0 0 8px rgba(13, 31, 51, 0.35);
}
#bd-welcome, #bd-toast {
    position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; pointer-events: auto;
    background: rgba(8, 18, 30, 0.35); opacity: 0; transition: opacity 0.3s ease;
}
#bd-toast { background: transparent; pointer-events: none; place-items: start center; }
#bd-welcome.show, #bd-toast.show { opacity: 1; }
#bd-welcome .plate, #bd-toast .plate { padding: 22px 34px 24px; text-align: center; max-width: min(460px, 92vw); transform: translateY(10px); transition: transform 0.45s var(--ease-out); }
#bd-welcome.show .plate, #bd-toast.show .plate { transform: none; }
.pl-title { font-family: var(--f-display); font-weight: 700; font-size: 34px; line-height: 1.05; }
.pl-line { margin-top: 8px; font-size: 18px; color: var(--lime-soft); }
.pl-pics { display: flex; justify-content: center; gap: 10px; margin-bottom: 8px; }
.pl-pics img { height: 44px; width: auto; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5)); }
#bd-toast .plate { padding: 14px 22px; margin-top: 18vh; }
#bd-toast .pl-title { font-size: 24px; }
#bd-toast .pl-line { font-size: 15px; margin-top: 4px; }

/* ── Side panels: log, AI, rules ───────────────────────────────────────────────────────── */
.side-panel {
    position: fixed; z-index: 60; right: 8px; top: calc(var(--head-h) + 8px);
    width: min(380px, calc(100vw - 16px)); max-height: calc(100vh - var(--head-h) - 16px);
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 14px 16px 16px; background: var(--panel); color: var(--lime);
    border: 3px solid var(--ochre); box-shadow: 0 10px 28px rgba(3, 10, 20, 0.65), inset 0 0 0 1px var(--vermilion);
    font-size: 15px; line-height: 1.4;
}
.side-panel h2 { font-family: var(--f-display); font-weight: 700; font-size: 24px; margin: 0 40px 8px 0; line-height: 1.1; }
.panel-close { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; display: grid; place-items: center; color: var(--lime); }
.panel-close svg { width: 20px; height: 20px; }
.log-block { padding: 6px 0; }
.log-block + .log-block { border-top: 1px dashed rgba(242, 234, 216, 0.28); }
.log-line { display: flex; align-items: baseline; gap: 6px; padding: 1px 0; }
.log-line .who { font-weight: 700; color: var(--who, var(--lime)); text-shadow: 0 0 1px rgba(0,0,0,.4); }
.log-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--who); box-shadow: 0 0 0 1.5px var(--lime); transform: translateY(-1px); }
.log-gain { margin-left: auto; font-weight: 700; color: var(--ochre); font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.log-muted { color: var(--lime-soft); font-style: italic; }
.dchips { display: inline-flex; gap: 2px; vertical-align: -3px; }
.dchip { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; background: #ead2a0; color: #3a2a1a; font-size: 12px; font-weight: 700; line-height: 1; }
.ai-entry { padding: 8px 0; }
.ai-entry + .ai-entry { border-top: 1px dashed rgba(242, 234, 216, 0.28); }
.ai-entry-head { font-weight: 700; margin-bottom: 4px; display: flex; gap: 6px; align-items: baseline; }
.ai-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 6px; padding: 2px 0; font-variant-numeric: tabular-nums lining-nums; }
.ai-row.chosen { color: var(--lime); font-weight: 700; }
.ai-row:not(.chosen) { color: var(--lime-soft); }
.ai-row .sc { text-align: right; }
.ai-foot { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(211, 154, 58, 0.5); font-size: 13px; color: var(--lime-soft); }
.rules-sec { margin-top: 10px; }
.rules-sec h3 { font-family: var(--f-display); font-size: 19px; font-weight: 700; margin-bottom: 2px; color: var(--ochre); }
.rules-sec p { max-width: 62ch; }
.aid { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 14px; }
.aid td { padding: 5px 4px; vertical-align: top; border-top: 1px solid rgba(242, 234, 216, 0.15); }
.aid { table-layout: fixed; }
.aid td.n { font-family: var(--f-display); font-size: 20px; font-weight: 700; width: 38px; white-space: nowrap; text-align: center; color: var(--lime); line-height: 1; }
.aid td.b { font-weight: 700; width: 34%; padding-right: 10px; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
.aid tr.shops td.n { font-size: 16px; }

/* ── Phone: zoomed village and seat detail ─────────────────────────────────────────────── */
#bd-zoom {
    position: fixed; z-index: 40; display: grid; place-items: center;
    background: rgba(8, 18, 30, 0.72);
}
#bd-zoom .zoom-close { position: absolute; z-index: 9; width: 44px; height: 44px; display: grid; place-items: center; background: var(--lime); color: var(--ink); clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px); }
#bd-zoom .zoom-close svg { width: 20px; height: 20px; }
#bd-peek { position: fixed; z-index: 45; width: 300px; }
#bd-peek .drawer { box-shadow: inset 0 0 0 3px var(--ochre), 0 8px 20px rgba(0, 0, 0, 0.6); }

/* ── Phone layout: header lives in the right column, chips for seats ───────────────────── */
body.phone #bd-head { left: auto; right: 0; height: 44px; padding: 0 4px; border-bottom-width: 2px; gap: 0; }
body.phone .bd-name { font-size: 19px; }
body.phone .bd-name small { display: none; }
body.phone #full-btn, body.phone #ai-indicator { display: none; }
body.phone .bd-name { font-size: 17px; line-height: 0.92; white-space: normal; overflow: visible; text-overflow: clip; width: min-content; padding: 0 0 0 2px; }
/* on a phone the AI state rides on the AI-decisions button: the same lamp, the word in the panel */
body.phone #ai-eval-btn::after { content: ''; position: absolute; right: 7px; top: 8px; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--lime); }
body.phone.ai-heuristic #ai-eval-btn::after { background: var(--ochre); border-color: var(--ochre); }
body.phone.ai-random #ai-eval-btn::after { border-color: var(--vermilion); border-style: dashed; }
body.phone.ai-pending #ai-eval-btn::after { border-style: dotted; }
body.phone #ai-indicator { padding: 0; width: 44px; justify-content: center; margin: 0; }
body.phone .tool { width: 44px; }
body.phone #side { gap: 6px; }
body.phone #seats { flex-direction: row; overflow: visible; gap: 4px; }
body.phone #own { display: none; }
body.phone #tray { padding: 6px 8px 7px; }
body.phone #status-line { display: none; }
body.phone #totals { margin-top: 6px; flex-wrap: nowrap; overflow-x: auto; gap: 5px; padding-bottom: 2px; }
body.phone .total { height: 40px; font-size: 17px; flex: none; }
body.phone #actions { margin-top: 6px; }
body.phone .btn { font-size: 16px; }
/* on a phone a panel opens over the villages, never over the header's own buttons */
body.phone .side-panel { top: 6px; left: 6px; right: auto; width: min(420px, calc(100vw - 340px)); max-height: calc(100vh - 12px); padding: 10px 12px 12px; font-size: 14px; }
body.phone .side-panel h2 { font-size: 20px; }
.chip {
    flex: 1 1 0; min-width: 0; height: 50px; position: relative; display: flex; flex-direction: column; justify-content: center;
    padding: 3px 4px 3px 26px; background: linear-gradient(180deg, var(--panel-hi), var(--panel));
    box-shadow: inset 0 0 0 1.5px rgba(211, 154, 58, 0.55);
    clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
    font-size: 14px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums lining-nums; text-align: left;
}
.chip.current { box-shadow: inset 0 0 0 3px var(--ochre); background: linear-gradient(180deg, #2f5f8c, #24496f); }
.chip.current.mine { box-shadow: inset 0 0 0 3px var(--lime); }
.chip .ch-fig { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); width: 16px; height: 23px; }
.chip .ch-l { display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.chip .ch-l img { height: 15px; width: auto; }
.chip .ch-marks { position: absolute; right: 3px; top: 3px; display: flex; gap: 1px; }
.chip .ch-marks img { height: 13px; }

/* ── Turn the phone ────────────────────────────────────────────────────────────────────── */
#rotate-cover { display: none; position: fixed; inset: 0; z-index: 3000; background: var(--chest); place-items: center; }
#rotate-cover .rot-plate { padding: 28px 30px; text-align: center; }
.rot-text { font-family: var(--f-display); font-size: 28px; font-weight: 700; color: var(--lime); }
.rot-icon { width: 64px; height: 64px; margin: 0 auto 12px; border: 3px solid var(--lime); border-radius: 10px; transform: rotate(-90deg); animation: rot 2.2s ease-in-out infinite; }
@keyframes rot { 0%, 30% { transform: rotate(0deg); } 60%, 100% { transform: rotate(-90deg); } }
@media (pointer: coarse) and (orientation: portrait) and (max-width: 560px) { #rotate-cover { display: grid; } }

/* ── Start screen: the chest lid with its painted village panel ────────────────────────── */
/* Three arrangements, re-arranged rather than scaled: landscape (arch left, all else right),
   portrait (arch + wordmark on top, choices and doors below), short (<= 430 tall, rows).
   Flex centring, not grid: a card wider than the screen overflows evenly, never off one edge. */
#start-screen { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.st-card {
    flex: none; position: relative;
    width: 940px; display: grid; grid-template-columns: 350px minmax(0, 1fr);
    grid-template-areas: "pic head" "pic body"; grid-template-rows: auto 1fr;
    column-gap: 40px; row-gap: 22px;
    transform-origin: center center; padding: 10px;
}
/* the arch: a village painted from the game's own tiles (scripts/bd_menu_scene.py). Its top is
   level with the wordmark's; the radii are half the width, as a fraction of each axis */
.st-picture {
    grid-area: pic; align-self: start;
    position: relative; aspect-ratio: 692 / 1000; width: 100%;
    border: 8px solid var(--ochre);
    box-shadow: inset 0 0 0 2px var(--vermilion), 0 10px 26px rgba(3, 10, 20, 0.6);
    border-radius: 50% 50% 4px 4px / 34.6% 34.6% 4px 4px;
    background: center / cover no-repeat url('assets/menu_scene.webp'), var(--chest-deep);
    overflow: hidden;
}
/* the arch and its plaque: who made the game, quiet under the painted village */
.st-arch { grid-area: pic; align-self: start; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.st-credits { display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; font-size: 14px; line-height: 1.3; color: var(--lime-soft); }
.st-credit { white-space: nowrap; }
.st-credit-label { font-style: italic; margin-right: 0.45em; }
.st-credit-who { color: var(--lime); font-weight: 600; }
.st-support { margin-top: 4px; color: var(--lime-soft); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,0.35); }
.st-support:hover, .st-support:focus-visible { color: var(--lime); text-decoration-color: currentColor; }
@media (pointer: coarse) { .st-support { display: inline-flex; align-items: center; min-height: 32px; margin-top: 0; } }
.st-picture::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 3px rgba(13, 31, 51, 0.55), inset 0 -40px 50px -30px rgba(8, 18, 30, 0.45); }
.st-head { grid-area: head; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-body { grid-area: body; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.st-logo {
    width: 100%; max-width: 520px; aspect-ratio: 960 / 379; background: var(--lime);
    -webkit-mask: url('assets/logo.webp') center / contain no-repeat; mask: url('assets/logo.webp') center / contain no-repeat;
}
.st-sub { font-family: var(--f-display); font-size: 24px; font-weight: 600; color: var(--ochre); margin-top: -6px; letter-spacing: 0.01em; white-space: nowrap; }
.st-field { display: flex; flex-direction: column; gap: 8px; }
.st-label { font-size: 15px; font-weight: 600; color: var(--lime-soft); white-space: nowrap; }
.st-players { display: flex; gap: 8px; }
.st-num {
    width: 56px; height: 52px; display: grid; place-items: center;
    font-family: var(--f-display); font-weight: 700; font-size: 30px; color: var(--lime);
    box-shadow: inset 0 0 0 2px rgba(242, 234, 216, 0.4); background: rgba(9, 22, 37, 0.35);
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}
/* chosen, one grammar for the numeral and the figure: a lime-wash ring and the lime plinth the
   choice stands on. Lime stays the one act/selected signal, but only Play is filled with it. */
.st-num.on, .st-col.on {
    background: linear-gradient(0deg, var(--lime) 0 6px, rgba(242, 234, 216, 0.15) 6px);
    box-shadow: inset 0 0 0 2px var(--lime);
}
.st-num { padding-bottom: 3px; }
.st-colours { display: flex; gap: 6px; }
.st-col {
    width: 54px; height: 60px; display: grid; place-items: end center; padding-bottom: 6px; position: relative;
    background: rgba(9, 22, 37, 0.35); box-shadow: inset 0 0 0 2px rgba(242, 234, 216, 0.25);
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}
.st-col img { height: 44px; width: auto; filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.5)); transition: transform 0.2s var(--ease-out); }
.st-col.on img { transform: translateY(-1px); }
@media (hover: hover) { .st-num:not(.on):hover, .st-col:not(.on):hover { background: rgba(242, 234, 216, 0.12); } }
/* keyboard focus on a chamfered control: the clip-path cuts any outline, so the ring is drawn
   inside the shape — ochre over chest blue on the dark panels, chest blue over ochre on the
   lime-white primary door. The links and the flags wear the same ring, never a dashed box. */
#start-screen :is(.btn, .st-num, .st-col, .st-link, .st-lang-btn, .st-lang-opt):focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--ochre), inset 0 0 0 5px var(--chest-deep); }
#start-screen .btn.primary:focus-visible { box-shadow: inset 0 0 0 3px var(--chest-deep), inset 0 0 0 5px var(--ochre); }
#start-screen :is(.st-num, .st-col).on:focus-visible { box-shadow: inset 0 0 0 3px var(--ochre), inset 0 0 0 5px var(--chest-deep), inset 0 0 0 7px var(--lime); }
.st-vs { font-size: 15px; line-height: 1.35; color: var(--lime-soft); font-style: italic; margin-top: -6px; }
.st-vs > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-doors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.st-doors-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.st-doors .btn { width: 100%; min-width: 0; padding: 0 10px; }
.st-doors .start-play { grid-column: 1 / -1; min-height: 54px; font-size: 21px; }
.st-doors .st-cont { min-height: 58px; font-size: 21px; flex-direction: column; gap: 1px; line-height: 1.1; }
.st-doors .st-cont small { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.st-foot { display: flex; align-items: center; gap: 4px 10px; }
.st-link { min-height: 44px; padding: 0 6px; color: var(--lime); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(211, 154, 58, 0.8); font-size: 16px; white-space: nowrap; }
.st-back { display: inline-flex; align-items: center; gap: 6px; }
.st-back svg { flex: none; color: var(--ochre); }
.st-lang { margin-left: auto; position: relative; }
.st-lang-btn { width: 52px; height: 44px; display: grid; place-items: center; }
.st-lang-btn svg, .st-lang-opt svg { width: 34px; height: 22px; display: block; box-shadow: 0 0 0 1.5px rgba(242, 234, 216, 0.7); }
/* the flags open sideways from the flag, along the foot — never over the doors, never over Rules
   or Achievements: where the foot is too full for that (the way back to a saved game beside them)
   start.js opens them below the foot instead (.below) */
.st-lang-pick { position: absolute; right: calc(100% + 6px); top: 50%; transform: translateY(-50%); display: flex; gap: 2px; padding: 4px; background: var(--panel); border: 2px solid var(--ochre); box-shadow: inset 0 0 0 1px var(--vermilion), 0 8px 20px rgba(3, 10, 20, 0.5); z-index: 5; }
.st-lang-pick.below { right: 0; top: calc(100% + 6px); transform: none; }
.st-lang-opt { width: 48px; height: 44px; display: grid; place-items: center; }
.st-lang-opt.on { background: linear-gradient(0deg, var(--lime) 0 4px, rgba(242, 234, 216, 0.15) 4px); }

/* low landscape (tablet split, small laptop): the arch narrows */
@media (max-height: 560px) {
    .st-card { width: 900px; grid-template-columns: 270px minmax(0, 1fr); column-gap: 30px; row-gap: 14px; }
    .st-body { gap: 12px; }
}

/* portrait (tablets, narrow windows): arch and wordmark side by side on top, the choices and the
   doors full width below. Sized to the screen, never scaled. */
@media (orientation: portrait) and (min-height: 431px) {
    .st-card {
        width: min(560px, calc(100vw - 32px)); padding: 0;
        grid-template-columns: minmax(0, 37%) minmax(0, 1fr);
        grid-template-areas: "pic head" "body body"; grid-template-rows: auto auto;
        column-gap: 22px; row-gap: 26px;
    }
    .st-picture { border-width: 6px; }
    .st-head { align-self: center; }
    .st-logo { max-width: none; }
    .st-sub { font-size: 21px; white-space: normal; }
    .st-body { gap: 18px; }
}
@media (orientation: portrait) and (min-height: 431px) and (min-width: 900px) {
    .st-card { width: 680px; }
}
@media (orientation: portrait) and (max-width: 480px) {
    .st-doors-3 { grid-template-columns: 1fr 1fr; }
    .st-doors-3 .btn:last-child { grid-column: 1 / -1; }
    .st-vs > div { white-space: normal; }
}

/* ── End sheet ─────────────────────────────────────────────────────────────────────────── */
#bd-end { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; background: rgba(8, 18, 30, 0.62); padding: 10px; }
#bd-end .plate { width: min(720px, 96vw); max-height: calc(100vh - 20px); overflow-y: auto; padding: 22px 26px 22px; }
.end-title { font-family: var(--f-display); font-size: 38px; font-weight: 700; text-align: center; line-height: 1.05; }
.end-why { text-align: center; color: var(--lime-soft); font-style: italic; margin-top: 4px; }
.end-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-variant-numeric: tabular-nums lining-nums; }
.end-table th { font-size: 13px; font-weight: 600; color: var(--lime-soft); padding: 4px 6px; text-align: right; white-space: nowrap; }
.end-table th:first-child { text-align: left; }
.end-table td { padding: 7px 6px; text-align: right; border-top: 1px solid rgba(242, 234, 216, 0.16); font-size: 17px; }
.end-table td:first-child { text-align: left; }
.end-table td.tot { font-weight: 800; font-size: 20px; }
.end-table td.neg { color: #ffb9a6; }
.end-table tr.win td { background: rgba(242, 234, 216, 0.1); }
.end-table tr.win td.tot { color: var(--lime); }
.end-who { display: flex; align-items: center; gap: 8px; font-family: var(--f-display); font-size: 21px; font-weight: 700; white-space: nowrap; }
.end-who img { width: 18px; height: 25px; }
.end-crown { width: 22px; height: 18px; color: var(--ochre); }
.end-btns { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.end-btns .btn { min-width: 180px; }
#bd-end .dk-more { --dk-more-ink: var(--lime); }

/* ── Editor (?edit) ────────────────────────────────────────────────────────────────────── */
.bd-editor { position: fixed; inset: 0; overflow: auto; z-index: 5000; background: var(--chest); padding: 10px; }
.bd-editor-bar { position: sticky; top: 0; display: flex; gap: 10px; align-items: center; padding: 6px; background: var(--chest-deep); z-index: 2; }
.bd-editor-bar button { background: var(--lime); color: var(--ink); padding: 8px 14px; font-weight: 700; }
.bd-editor-bar code { font-size: 11px; word-break: break-all; }
.bd-editor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 10px; }
.bd-editor-tile { position: relative; aspect-ratio: 1; background: center / contain no-repeat; }
.bd-editor-cap { position: absolute; left: 4px; top: 4px; background: var(--chest-deep); padding: 2px 6px; }
.bd-editor-ring { position: absolute; width: 36px; height: 36px; transform: translate(-50%, -50%); border: 3px solid #ff3df2; border-radius: 50%; color: #ff3df2; font-weight: 800; font-size: 11px; display: grid; place-items: center; cursor: grab; touch-action: none; }

/* ── Flights ───────────────────────────────────────────────────────────────────────────── */
.ghost { position: fixed; z-index: 800; pointer-events: none; will-change: transform; }
.ghost img { width: 100%; height: 100%; display: block; filter: drop-shadow(1px 3px 3px rgba(0, 0, 0, 0.55)); }
.pop { animation: pop 0.38s var(--ease-out); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
    .vg-ring::before, .village.zoomable.has-target::after, .tt.target::after { animation: none; }
    .die, .village, .drawer, #bd-welcome, #bd-welcome .plate, #bd-toast, #bd-toast .plate { transition: none; }
    .die.rolling img, .pop, .rot-icon { animation: none; }
}

/* ── Column arrangements ───────────────────────────────────────────────────────────────── */

body.tall #side { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto; gap: 10px; align-items: start; align-content: start; }
body.tall #seats { grid-column: 1 / span 2; grid-row: 2; display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
body.tall #tray { grid-column: 1; grid-row: 3; }
body.tall #own { grid-column: 2; grid-row: 3; }

/* ── Start screen on a short phone: picture left, choices in rows ─────────────────────── */
/* Rules + language (and the way back to a saved game) sit in the top corner beside the wordmark;
   the flags open DOWNWARD from the flag, inside the screen. */
@media (max-height: 430px) {
    .st-card { width: 620px; grid-template-columns: 150px minmax(0, 1fr); column-gap: 16px; row-gap: 6px; padding: 4px; }
    .st-picture { border-width: 5px; align-self: center; }
    /* a narrower arch leaves room for the plaque: each credit as a label over the names */
    .st-arch { align-self: center; align-items: center; gap: 5px; }
    .st-arch .st-picture { width: 84%; }
    .st-credits { font-size: 10.5px; line-height: 1.15; gap: 3px; }
    .st-credit-label { display: block; margin: 0; font-size: 9.5px; }
    .st-support { font-size: 10.5px; }
    .st-body { gap: 6px; }
    .st-logo { max-width: 200px; }
    .st-sub { font-size: 17px; margin-top: -4px; }
    .st-field { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
    .st-label { font-size: 14px; }
    .st-num { width: 46px; height: 44px; font-size: 25px; }
    .st-col { width: 46px; height: 44px; padding-bottom: 3px; }
    .st-col img { height: 34px; }
    .st-players, .st-colours { gap: 4px; }
    .st-vs { font-size: 13px; margin-top: 0; }
    .st-vs-size { display: none; }
    /* the doors share the row by their labels' length ("Gemeinsam spielen" needs more than "Tutorial") */
    .st-doors { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
    .st-doors-3 { grid-template-columns: auto auto auto; }
    .st-doors .btn { font-size: 15px; padding: 0 10px; min-height: 44px; }
    /* Play takes the spare width; the other doors step back to quiet outlines */
    .st-doors .btn.secondary { font-weight: 600; color: var(--lime-soft); box-shadow: inset 0 0 0 1.5px rgba(242, 234, 216, 0.34); }
    .st-doors .start-play { grid-column: auto; min-height: 44px; font-size: 18px; }
    .st-doors .st-cont { grid-column: 1 / -1; min-height: 52px; font-size: 18px; }
    .st-doors .st-cont small { font-size: 12px; }
    .st-foot { position: absolute; top: 4px; right: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 270px; gap: 0 6px; }
    .st-back { order: 3; flex-basis: 100%; justify-content: flex-end; }
    .st-lang { margin-left: 0; }
    /* the flags take the corner row itself (over Rules and Achievements, which they replace while
       open): never down over the player numbers, never left over the wordmark */
    .st-lang-pick, .st-lang-pick.below { right: -4px; top: -4px; transform: none; padding: 2px; }
    .st-lang-opt { width: 44px; }
}

/* ── Pass & Play (core/passplay.js) in the chest's paint ──────────────────────────────── */
.overlay.pp-overlay { position: fixed; inset: 0; z-index: 1400; display: grid; place-items: center; padding: 10px; background: rgba(8, 18, 30, 0.66); }
.overlay.pp-overlay.pp-conceal { background: var(--chest-deep); }
.panel.pp-panel {
    width: min(460px, 94vw); max-height: calc(100vh - 20px); overflow-y: auto; padding: 18px 22px 20px; text-align: left; color: var(--lime);
    background: linear-gradient(180deg, var(--panel-hi), var(--panel));
    clip-path: polygon(var(--cham) 0, calc(100% - var(--cham)) 0, 100% var(--cham), 100% calc(100% - var(--cham)), calc(100% - var(--cham)) 100%, var(--cham) 100%, 0 calc(100% - var(--cham)), 0 var(--cham));
    box-shadow: inset 0 0 0 3px var(--ochre), inset 0 0 0 4px var(--vermilion);
}
.pp-panel h2 { font-family: var(--f-display); font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 10px; }
.pp-modes { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 8px; }
.pp-mode { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; text-align: left; box-shadow: inset 0 0 0 2px rgba(242, 234, 216, 0.45); background: rgba(9, 22, 37, 0.35); }
.pp-mode-icon { color: var(--lime); display: grid; place-items: center; }
.pp-mode-text { display: flex; flex-direction: column; gap: 2px; }
.pp-mode-title { font-weight: 700; font-size: 17px; }
.pp-mode-sub { font-size: 13px; color: var(--lime-soft); }
/* the chooser's Cancel is the close × in its header, like the trophy shelf's: always on screen,
   however short the screen (its text stays its accessible name) */
.bd-pp { position: relative; }
.bd-pp[data-view="choose"] h2 { padding: 0 40px; }
.bd-pp[data-view="choose"] > .primary-btn.alt {
    position: absolute; right: 8px; top: 8px; width: 44px; min-height: 44px; height: 44px; padding: 0;
    margin: 0; font-size: 0; background: none; box-shadow: none; clip-path: none; border-radius: 6px;
}
.bd-pp[data-view="choose"] > .primary-btn.alt::before {
    content: ''; display: block; width: 22px; height: 22px; margin: auto; background: var(--lime);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' stroke='%23000' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' stroke='%23000' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (hover: hover) { .bd-pp[data-view="choose"] > .primary-btn.alt:hover { background: var(--lime-faint); } }
.bd-pp :is(.pp-mode, .pp-icon-btn, .pp-add, .primary-btn):focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--ochre), inset 0 0 0 5px var(--chest-deep); }
.pp-chairs { list-style: none; display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 4px; }
.pp-chair { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pp-disc { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; font-weight: 800; color: #fff; box-shadow: 0 0 0 2px var(--lime); }
.pp-name { flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 10px; background: rgba(9, 22, 37, 0.5); color: var(--lime); border: 0; box-shadow: inset 0 0 0 1.5px rgba(242, 234, 216, 0.5); font-size: 16px; }
.pp-name::placeholder { color: var(--lime-soft); opacity: 0.8; }
.pp-ai-label { flex: 1 1 auto; height: 44px; display: flex; align-items: center; padding: 0 10px; color: var(--lime-soft); font-style: italic; }
.pp-icon-btn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--lime); box-shadow: inset 0 0 0 1.5px rgba(242, 234, 216, 0.35); }
.pp-icon-btn:disabled { opacity: 0.3; cursor: default; }
.pp-add { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--lime); border: 1.5px dashed rgba(242, 234, 216, 0.5); }
.pp-add:disabled { display: none; }
.pp-note { margin-top: 8px; font-size: 13px; text-align: center; color: var(--lime-soft); }
.pp-note.pp-warn { color: #ffb9a6; font-weight: 600; }
.pp-actions { display: flex; flex-direction: row-reverse; gap: 8px; margin-top: 14px; }
.primary-btn {
    flex: 1 1 0; min-height: 46px; padding: 0 16px; font-size: 17px; font-weight: 700; background: var(--lime); color: var(--ink);
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}
.primary-btn.alt { background: transparent; color: var(--lime); box-shadow: inset 0 0 0 2px rgba(242, 234, 216, 0.6); }
.primary-btn:disabled { background: #6c7f92; color: #23384d; cursor: default; }
.pp-panel > .primary-btn { width: 100%; margin-top: 6px; }
.pp-pass { text-align: center; }
.pp-pass-name { font-family: var(--f-display); font-size: 34px; }
.pp-turn {
    position: fixed; left: 50%; top: 42%; z-index: 1300; display: flex; align-items: center; gap: 12px; padding: 14px 26px;
    transform: translate(-50%, -50%) scale(0.92); opacity: 0; pointer-events: none; transition: opacity 0.3s ease, transform 0.35s var(--ease-out);
    font-family: var(--f-display); font-size: 30px; font-weight: 700; color: var(--lime);
    background: linear-gradient(180deg, var(--panel-hi), var(--panel));
    box-shadow: inset 0 0 0 3px var(--pp-seat, var(--ochre)), 0 10px 28px rgba(3, 10, 20, 0.6);
}
.pp-turn.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.pp-turn.folding { transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.45s ease 0.05s; }
@media (max-height: 460px) {
    .pp-chairs { grid-template-columns: 1fr 1fr; column-gap: 12px; row-gap: 6px; }
    .panel.pp-panel { width: min(600px, 96vw); padding: 12px 16px 14px; }
    .pp-panel h2 { font-size: 22px; margin-bottom: 6px; }
    .bd-pp[data-view="choose"] h2 { line-height: 32px; }
    .bd-pp[data-view="choose"] > .primary-btn.alt { top: 6px; right: 6px; }
    .bd-pp .pp-modes { gap: 6px; margin: 2px 0 0; }
    .bd-pp .pp-mode { min-height: 52px; padding: 5px 12px; }
    .bd-pp .pp-mode-title { font-size: 16px; line-height: 1.15; }
    .bd-pp .pp-mode-sub { font-size: 12.5px; line-height: 1.2; }
    .pp-turn { font-size: 24px; padding: 10px 20px; }
}
@media (prefers-reduced-motion: reduce) { .pp-turn { transition: opacity 0.2s; } }

/* the supplies that run out (flour, glass, inns): a painted label at the head of the column */
#supply { display: flex; align-items: center; gap: 14px; padding: 4px 10px; flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums lining-nums; color: var(--lime-soft); font-size: 15px; }
#supply:empty { display: none; }
#supply .sp { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
#supply img { height: 26px; width: auto; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
#supply .sp-lbl { font-weight: 600; font-style: italic; margin-right: -4px; }
body.phone #supply { display: none; }
body.tall #supply { grid-column: 1 / span 2; grid-row: 1; }

@media (max-height: 430px) {
    #bd-end { padding: 6px; }
    #bd-end .plate { padding: 12px 18px 14px; max-height: calc(100vh - 12px); }
    .end-title { font-size: 26px; }
    .end-why { font-size: 13px; margin-top: 0; }
    .end-table { margin-top: 6px; }
    .end-table th { font-size: 11px; padding: 2px 4px; }
    .end-table td { padding: 3px 4px; font-size: 15px; }
    .end-table td.tot { font-size: 17px; }
    .end-who { font-size: 17px; }
    .end-who img { width: 14px; height: 20px; }
    .end-btns { margin-top: 8px; }
    .end-btns .btn { min-width: 150px; }
}

/* phone totals: two rows at most; with many choices the dice breakdown is dropped (kept where two chips share a sum) */
body.phone #totals { flex-wrap: wrap; overflow: visible; gap: 4px; max-height: 84px; }
body.phone #totals.compact .total:not(.dup) small { display: none; }
body.phone #totals .total { min-width: 46px; justify-content: center; padding: 0 7px; }
body.phone #seats .chip { height: 46px; }
body.phone #tray { padding: 5px 8px 6px; }
#dice { gap: 6px; }
#tray-tiles { gap: 6px; }
.tt { width: 44px; height: 44px; }
.tt img { max-width: 40px; max-height: 42px; }

body.phone #board-frame { border-width: 4px; --cham: 6px; box-shadow: inset 0 0 0 1px var(--vermilion), 0 4px 10px rgba(4, 12, 22, 0.5); }

/* a drawer front: painted inset moulding with folk corner strokes (no pull: user 2026-11-18) */
.drawer {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg fill='%23f2ead8' fill-opacity='.55'%3E%3Cpath d='M3 3 C9 3 12 6 12 10 C9 8 6 7 3 3z'/%3E%3Cpath d='M3 3 C3 9 6 12 10 12 C8 9 7 6 3 3z'/%3E%3C/g%3E%3C/svg%3E") 7px 7px / 14px 14px no-repeat, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg fill='%23f2ead8' fill-opacity='.55'%3E%3Cpath d='M17 17 C11 17 8 14 8 10 C11 12 14 13 17 17z'/%3E%3Cpath d='M17 17 C17 11 14 8 10 8 C12 11 13 14 17 17z'/%3E%3C/g%3E%3C/svg%3E") calc(100% - 7px) calc(100% - 7px) / 14px 14px no-repeat, linear-gradient(180deg, var(--panel-hi), var(--panel));
    box-shadow: inset 0 0 0 2px rgba(211, 154, 58, 0.55), inset 0 0 0 5px rgba(13, 31, 51, 0.35), inset 0 0 0 6px rgba(211, 154, 58, 0.35);
    padding-top: 8px;
}
.drawer.current { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg fill='%23f2ead8' fill-opacity='.55'%3E%3Cpath d='M3 3 C9 3 12 6 12 10 C9 8 6 7 3 3z'/%3E%3Cpath d='M3 3 C3 9 6 12 10 12 C8 9 7 6 3 3z'/%3E%3C/g%3E%3C/svg%3E") 7px 7px / 14px 14px no-repeat, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg fill='%23f2ead8' fill-opacity='.55'%3E%3Cpath d='M17 17 C11 17 8 14 8 10 C11 12 14 13 17 17z'/%3E%3Cpath d='M17 17 C17 11 14 8 10 8 C12 11 13 14 17 17z'/%3E%3C/g%3E%3C/svg%3E") calc(100% - 7px) calc(100% - 7px) / 14px 14px no-repeat, linear-gradient(180deg, #2f5f8c, #24496f); }

/* the back question in the chest's paint (core/back.js injects its own sheet later; win by specificity) */
body #dk-back-ask .dk-back-panel {
    border-radius: 0; border: 0;
    background: linear-gradient(180deg, var(--panel-hi), var(--panel));
    clip-path: polygon(var(--cham) 0, calc(100% - var(--cham)) 0, 100% var(--cham), 100% calc(100% - var(--cham)), calc(100% - var(--cham)) 100%, var(--cham) 100%, 0 calc(100% - var(--cham)), 0 var(--cham));
    box-shadow: inset 0 0 0 3px var(--ochre), inset 0 0 0 4px var(--vermilion), inset 0 0 0 8px rgba(13, 31, 51, 0.35);
}
body #dk-back-ask h2 { font-size: 26px; }
body #dk-back-ask button { border-radius: 0; border: 0; clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px); }
body #dk-back-ask button.dk-back-leave { box-shadow: inset 0 0 0 2px rgba(242, 234, 216, 0.6); }

/* phone: the supplies as a sixth chip */
.chip.supply-chip { padding-left: 5px; flex: 0.9 1 0; cursor: default; }
.chip.supply-chip .ch-l img { height: 14px; }

body.phone #side { gap: 7px; }
body.phone #tray { margin-top: 1px; }
body.phone .die.picked { transform: none; }
body.phone #tray { padding-top: 8px; }
body.phone .die.picked::after, body.phone .die.can::after { inset: -3px; }

/* ── Tutorial: a talking cartouche, a spotlight, a lime ring on the one thing to press ─────
 * The slip is the chest's own plate (chamfered panel, ochre band, vermilion hair line) with a
 * blackletter tab; the veil darkens the chest except the lesson's holes. Lime-wash white stays
 * the one "act here" signal: only the ring round what the player must press next is lime. */
.tut-veil { position: fixed; inset: 0; z-index: 700; pointer-events: none; opacity: 0; transition: opacity 0.26s ease; }
.tut-veil.show { opacity: 1; }
.tut-veil svg { display: block; }
.tut-dark { fill: rgba(6, 15, 26, 0.64); }
.tut-ring { fill: none; stroke: var(--ochre); stroke-width: 2.5; stroke-dasharray: 7 5; }
.tut-ring.keep { stroke: var(--lime); stroke-width: 3; stroke-dasharray: none; animation: tut-breathe 2.2s ease-in-out infinite; }
/* the building to tap: its OWN lit ring glows (no second circle drawn round it) */
.vg-ring.tut-mark::before {
    border-width: 4px; background: rgba(242, 234, 216, 0.3);
    box-shadow: 0 0 0 2px rgba(13, 31, 51, 0.75), 0 0 16px 5px rgba(242, 234, 216, 0.75);
}
@keyframes tut-breathe { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: 0.45; } }

.tut-slip {
    position: fixed; z-index: 1050; left: 10px; top: 58px; width: max-content; max-width: 440px;
    filter: drop-shadow(0 10px 18px rgba(3, 10, 20, 0.6));
    opacity: 0; transform: translateY(6px); pointer-events: none;
    transition: opacity 0.22s var(--ease-out), transform 0.32s var(--ease-out), left 0.28s var(--ease-out), top 0.28s var(--ease-out);
}
.tut-slip.show { opacity: 1; transform: none; pointer-events: auto; }
.tut-card {
    padding: 10px 16px 14px;
    background: linear-gradient(180deg, var(--panel-hi), var(--panel));
    color: var(--lime);
    clip-path: polygon(var(--cham) 0, calc(100% - var(--cham)) 0, 100% var(--cham), 100% calc(100% - var(--cham)), calc(100% - var(--cham)) 100%, var(--cham) 100%, 0 calc(100% - var(--cham)), 0 var(--cham));
    box-shadow: inset 0 0 0 3px var(--ochre), inset 0 0 0 4px var(--vermilion), inset 0 0 0 8px rgba(13, 31, 51, 0.35);
}
/* an instruction (no Continue): the band is lime, because the player acts now */
.tut-slip.waiting .tut-card { box-shadow: inset 0 0 0 3px var(--lime), inset 0 0 0 4px var(--vermilion), inset 0 0 0 8px rgba(13, 31, 51, 0.35); }
.tut-slip.nag .tut-card { animation: tut-nag 0.34s ease-in-out; box-shadow: inset 0 0 0 3px var(--vermilion), inset 0 0 0 8px rgba(13, 31, 51, 0.35); }
@keyframes tut-nag { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.tut-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -6px 4px -6px; }
.tut-tag {
    font-family: var(--f-display); font-weight: 700; font-size: 17px; line-height: 1; color: var(--ink);
    background: var(--ochre); padding: 3px 14px 4px 12px;
    clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
}
.tut-slip.waiting .tut-tag { background: var(--lime); }
.tut-leave {
    min-height: 44px; min-width: 44px; padding: 0 4px; margin: -8px -2px -8px 0;
    font-size: 14px; color: var(--lime-soft);
    text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(211, 154, 58, 0.8);
}
@media (hover: hover) { .tut-leave:hover { color: var(--lime); } }
.tut-text { font-size: 16px; line-height: 1.42; max-width: 62ch; }
.tut-text p + p { margin-top: 6px; }
.tut-text b { font-weight: 700; color: #fff8e8; }
.tut-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.tut-foot .btn { min-height: 44px; padding: 0 18px; }
/* Back: a quiet painted chevron at the slip's left foot, never louder than Continue */
.tut-back {
    margin-right: auto; min-height: 44px; min-width: 44px; padding: 0 12px 0 6px;
    display: inline-flex; align-items: center; gap: 2px;
    font-size: 15px; font-weight: 600; color: var(--lime-soft);
}
.tut-back svg { flex: none; color: var(--ochre); }
.tut-head .tut-back { margin: -8px 4px -8px auto; font-size: 14px; padding: 0 6px 0 2px; }
@media (hover: hover) { .tut-back:hover { color: var(--lime); } }
.tut-fig { margin: 10px 0 2px; }
.tut-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.tut-pic { position: relative; display: block; }
.tut-pic img { height: 40px; width: auto; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5)); }
.tut-pic i { position: absolute; right: -10px; bottom: -4px; font: 700 13px/1 var(--f-ui); font-style: normal; color: var(--ink); background: var(--lime); padding: 2px 4px; }
.tut-arrow { color: var(--ochre); display: block; }
.tut-arrow svg { display: block; }
.tut-sets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tut-set {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px 5px;
    background: rgba(9, 22, 37, 0.38); box-shadow: inset 0 0 0 1px rgba(211, 154, 58, 0.45);
    animation: tut-set-in 0.5s var(--ease-out) both; animation-delay: calc(var(--i) * 90ms + 60ms);
}
@keyframes tut-set-in { from { opacity: 0; transform: translateY(5px); } }
.tut-set-k { display: flex; gap: 2px; height: 12px; }
.tut-set-k b { width: 10px; height: 12px; background: var(--ochre); clip-path: polygon(50% 0, 100% 35%, 100% 100%, 0 100%, 0 35%); }
.tut-set-k b:nth-child(2) { background: var(--leaf); }
.tut-set-k b:nth-child(3) { background: var(--vermilion); }
.tut-set-k b:nth-child(4) { background: #8db3d6; }
.tut-set-p { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums lining-nums; }
.tut-set-p img { height: 18px; width: auto; }
.tut-cap { text-align: center; font-size: 13px; font-style: italic; color: var(--lime-soft); margin-top: 4px; }

body.phone .tut-card { padding: 7px 12px 10px; }
body.phone .tut-text { font-size: 14px; line-height: 1.34; }
body.phone .tut-tag { font-size: 15px; }
body.phone .tut-foot { margin-top: 6px; }
body.phone .tut-fig { margin: 6px 0 0; }
body.phone .tut-pic img { height: 30px; }
body.phone .tut-set { padding: 4px 3px; }
body.phone .tut-set-p { font-size: 15px; }
@media (max-height: 420px) { .tut-text p + p { margin-top: 3px; } }
@media (prefers-reduced-motion: reduce) {
    .tut-veil, .tut-slip { transition: none; }
    .tut-ring.keep, .tut-slip.nag .tut-card, .tut-set { animation: none; }
}

/* ── Online lobby (mpDialog.js): a painted cartouche of the chest ─────────────────────────
 * The room code is lettered in the tiles' blackletter on a lime-wash ribbon; the colour choice
 * is the five painted figures themselves (lime ring = yours, faded = another person's); every
 * chair carries its figure. Lime-wash white stays the one "go": Start / Join. */
.bd-mp-layer { position: fixed; inset: 0; z-index: 1450; display: grid; place-items: center; padding: 10px; background: rgba(8, 18, 30, 0.7); }
.plate.bd-mp { width: min(480px, 96vw); max-height: calc(100vh - 20px); overflow-y: auto; padding: 20px 24px 20px; text-align: left; }
.plate.bd-mp.room { width: min(760px, 96vw); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); column-gap: 26px; row-gap: 12px; align-items: start; }
.bd-mp-title { font-family: var(--f-display); font-weight: 700; font-size: 30px; line-height: 1.05; text-align: center; margin-bottom: 12px; }
.bd-mp-line { text-align: center; color: var(--lime-soft); font-style: italic; margin: 4px 0 8px; }
.bd-mp-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bd-mp-label { display: block; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ochre); margin-bottom: 5px; }
.bd-mp-field { display: block; }
.bd-mp-field input {
    width: 100%; height: 44px; padding: 0 12px; border: 0; font: 600 17px var(--f-ui); color: var(--lime);
    background: rgba(9, 22, 37, 0.55); box-shadow: inset 0 0 0 1.5px rgba(242, 234, 216, 0.5); caret-color: var(--ochre);
}
.bd-mp-field input::placeholder { color: var(--lime-soft); opacity: 0.7; font-weight: 400; }
.bd-mp-field input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--lime); }
.bd-mp-code-input { font-family: var(--f-display) !important; font-size: 26px !important; letter-spacing: 0.22em; text-transform: uppercase; }
.bd-mp-fields { display: flex; flex-direction: column; gap: 12px; }
.bd-mp-code-row { display: flex; align-items: center; gap: 10px; }
.bd-mp-code {
    flex: 1 1 auto; min-width: 0; font-family: var(--f-display); font-weight: 700; font-size: 40px; line-height: 1; letter-spacing: 0.16em;
    text-align: center; padding: 8px 6px 9px 14px; color: var(--ink); background: linear-gradient(180deg, #fbf6ea, var(--lime) 60%, #e2d7bd);
    clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%);
    user-select: all;
}
.bd-mp-copy { flex: none; }
.bd-mp-note { font-size: 13px; line-height: 1.35; color: var(--lime-soft); }
.bd-mp-share { margin-top: 6px; }
.bd-mp-figs { display: flex; gap: 6px; }
.bd-mp-fig {
    width: 48px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 10px;
    background: rgba(9, 22, 37, 0.4); box-shadow: inset 0 0 0 1.5px rgba(242, 234, 216, 0.25); transition: background 0.15s ease, opacity 0.15s ease;
}
.bd-mp-fig img { height: 40px; width: auto; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.55)); }
.bd-mp-fig.on { background: rgba(242, 234, 216, 0.16); box-shadow: inset 0 0 0 3px var(--lime); }
.bd-mp-fig.taken { opacity: 0.32; cursor: default; }
@media (hover: hover) { .bd-mp-fig:not(.on):not(:disabled):hover { background: rgba(242, 234, 216, 0.12); } }
.bd-mp-pills { display: flex; gap: 6px; }
.bd-mp-pill { width: 44px; height: 44px; display: grid; place-items: center; font: 700 18px var(--f-ui); color: var(--lime); box-shadow: inset 0 0 0 1.5px rgba(242, 234, 216, 0.4); border-radius: 50%; }
.bd-mp-pill.on { background: var(--lime); color: var(--ink); box-shadow: none; }
.bd-mp-pill:disabled:not(.on) { opacity: 0.35; cursor: default; }
.bd-mp-seats { list-style: none; display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; }
.bd-mp-seat {
    display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center;
    min-height: 44px; padding: 3px 10px 3px 6px; background: rgba(9, 22, 37, 0.42);
    box-shadow: inset 0 -2px 0 var(--seat, rgba(242, 234, 216, 0.15));
}
.bd-mp-seat.me { background: rgba(242, 234, 216, 0.1); }
.bd-mp-mark { grid-row: 1 / span 2; width: 34px; height: 38px; display: grid; place-items: center; font: 700 15px var(--f-ui); color: var(--lime-soft); }
.bd-mp-seat.open .bd-mp-mark { border: 1.5px dashed rgba(242, 234, 216, 0.4); border-radius: 50%; width: 30px; height: 30px; }
.bd-mp-mark img { height: 36px; width: auto; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5)); }
.bd-mp-seat-name { font-family: var(--f-display); font-weight: 700; font-size: 20px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-mp-seat.open .bd-mp-seat-name { font-family: var(--f-ui); font-size: 16px; font-style: italic; color: var(--lime-soft); }
.bd-mp-seat-tag { grid-column: 2; font-size: 12px; color: var(--lime-soft); line-height: 1.2; }
.bd-mp-seat:not(:has(.bd-mp-seat-tag)) .bd-mp-seat-name { grid-row: 1 / span 2; }
.bd-mp-error { color: #ffb9a6; font-weight: 600; font-size: 14px; min-height: 0; }
.bd-mp-error:empty { display: none; }
.bd-mp-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.bd-mp-actions .bd-mp-go { flex: 1 1 auto; }
.bd-mp-foot { grid-column: 1 / -1; margin-top: 2px; }
.bd-mp-wait { flex: 1 1 auto; text-align: right; font-style: italic; color: var(--lime-soft); }
.bd-mp-back { flex: none; }
#bd-mp-toast {
    position: fixed; left: 50%; top: 56px; z-index: 1500; padding: 12px 22px; max-width: min(520px, 92vw); text-align: center;
    font-size: 16px; transform: translate(-50%, -8px); opacity: 0; pointer-events: none; transition: opacity 0.3s ease, transform 0.35s var(--ease-out);
}
#bd-mp-toast.show { opacity: 1; transform: translate(-50%, 0); }
.end-online { margin-top: 10px; text-align: center; font-size: 13px; color: var(--lime-soft); }
/* the phone floor (640x300): the room in two tight columns, the code smaller, no share line */
@media (max-height: 460px) {
    .plate.bd-mp { padding: 12px 16px 12px; }
    .plate.bd-mp.room { width: min(720px, 98vw); column-gap: 16px; row-gap: 6px; max-height: calc(100vh - 12px); }
    .bd-mp-layer { padding: 6px; }
    .bd-mp-title { font-size: 24px; margin-bottom: 6px; }
    .bd-mp-col { gap: 7px; }
    .bd-mp-label { font-size: 11px; margin-bottom: 3px; }
    .bd-mp-code { font-size: 28px; padding: 6px 6px 7px 12px; }
    .bd-mp-share { display: none; }
    .bd-mp-fig { width: 44px; height: 44px; }
    .bd-mp-fig img { height: 34px; }
    .bd-mp-seats { gap: 3px; }
    .bd-mp-seat { min-height: 34px; padding: 1px 8px 1px 4px; }
    .bd-mp-mark { height: 30px; }
    .bd-mp-mark img { height: 28px; }
    .bd-mp-seat.open .bd-mp-mark { width: 24px; height: 24px; }
    .bd-mp-seat-name { font-size: 17px; }
    .bd-mp-seat-tag { font-size: 11px; }
    .bd-mp-right > .bd-mp-note { display: none; }
    .bd-mp-actions { margin-top: 6px; }
    .bd-mp-fields { flex-direction: row; }
    .bd-mp-fields > * { flex: 1 1 0; min-width: 0; }
}
@media (max-width: 560px) { .plate.bd-mp.room { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { #bd-mp-toast { transition: opacity 0.2s; } }
