/* WHO SITS WHERE: printed-matter look, all CSS + code-drawn SVG. Code: 0BSD.
 * Colour-blind safe: state is always shown by symbol + pattern + colour (Okabe-Ito blue/vermilion/yellow). */
@font-face { font-family: "IM Fell English SC"; src: url("../fonts/IMFeENsc28P.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("../fonts/CourierPrime-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("../fonts/CourierPrime-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Bungee"; src: url("../fonts/Bungee-Regular.woff2") format("woff2"); font-display: swap; }

:root {
  --ink: #2a241d; --ink-2: #5b5044; --faint: #8b7d68; --paper: #fbf7ec; --paper-2: #f3ecd9; --rule: rgba(47, 95, 143, .16);
  --ok: #0b5c97; --bad: #b8460b; --hl: #e9c419; --sel: #0b5c97; --stamp: #b3261e;
  --floor: #cdbb98; --floor-2: #c2ae88; --wall: #d9ceb6; --cloth: #fffdf7; --cloth-hem: #e7dfcb; --plate: #ffffff;
  --card: #fffdf6; --card-edge: #cfc3a8; --wood: #8a5a33;
  --serif: "IM Fell English SC", Georgia, "Times New Roman", serif;
  --type: "Courier Prime", ui-monospace, "Courier New", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cardfont: var(--serif);
  --r: 4px; --shadow: 0 1px 0 rgba(0,0,0,.06), 0 6px 14px -8px rgba(40, 30, 10, .45);
  font-size: 100%;
}
/* table linens (earned) */
.theme-formica { --floor: #b9c7b4; --floor-2: #a9b9a4; --cloth: #dfeee6; --cloth-hem: #c4dccf; --wall: #d2dccd; }
.theme-mahogany { --floor: #6e5a4a; --floor-2: #614e40; --cloth: #7a4526; --cloth-hem: #9a5e37; --plate: #f6f1e6; --wall: #8a7663; }
.theme-marquee { --floor: #a9c08f; --floor-2: #9bb281; --cloth: #fffbee; --cloth-hem: #e6b8b8; --wall: #e9e3d2; }
.theme-canteen { --floor: #9aa3ad; --floor-2: #8d96a0; --cloth: #f2b562; --cloth-hem: #d9953e; --wall: #c7ccd2; }
/* place-card lettering (earned) */
.font-fell { --cardfont: var(--serif); }
.font-plain { --cardfont: var(--sans); }
.font-courier { --cardfont: var(--type); }
.font-bungee { --cardfont: "Bungee", var(--sans); }
.big { font-size: 118%; }
.contrast { --ink: #000; --ink-2: #000; --faint: #3b3b3b; --paper: #fff; --paper-2: #fff; --card: #fff; --card-edge: #000; --ok: #00467a; --bad: #8f2f00; --rule: rgba(0,0,0,.18); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--sans); line-height: 1.45;
  background-color: var(--floor);
  background-image: repeating-linear-gradient(90deg, transparent 0 46px, rgba(0,0,0,.035) 46px 48px), repeating-linear-gradient(0deg, transparent 0 22px, rgba(255,255,255,.05) 22px 23px);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ok); }
:focus-visible { outline: 3px solid var(--sel); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.offscreen { position: fixed; left: -9999px; top: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--paper); padding: 8px 12px; border: 2px solid var(--ink); }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }

/* ---------- top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 8px clamp(10px, 3vw, 28px); background: #2f4a3a; color: #f6efdc; border-bottom: 3px double #1b2c22; }
.logo { background: none; border: 0; color: inherit; font-family: var(--serif); font-size: 1.45rem; letter-spacing: .02em; padding: 4px 2px; cursor: pointer; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav button { background: transparent; border: 1px solid transparent; color: inherit; font-family: var(--type); font-size: .92rem; padding: 6px 10px; border-radius: var(--r); cursor: pointer; min-height: 40px; }
.nav button:hover { border-color: rgba(246, 239, 220, .45); }
.nav button[aria-current="page"] { border-color: #f6efdc; background: rgba(255,255,255,.08); }
.nav :focus-visible, .logo:focus-visible { outline-color: #f6efdc; }

main { display: block; max-width: 1240px; margin: 0 auto; padding: clamp(10px, 2.4vw, 26px); outline: none; }

/* ---------- paper */
.paper { background: var(--paper); border-radius: 2px; box-shadow: var(--shadow); position: relative; }
.sheet { padding: clamp(16px, 3vw, 34px); max-width: 860px; margin: 0 auto 18px;
  background-image: linear-gradient(90deg, transparent 52px, rgba(179, 38, 30, .22) 52px 54px, transparent 54px), repeating-linear-gradient(180deg, transparent 0 31px, var(--rule) 31px 32px);
  padding-left: clamp(22px, 7vw, 76px); }
.contrast .sheet { background-image: none; border: 2px solid #000; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(1.7rem, 4.4vw, 2.6rem); }
h2 { font-size: 1.35rem; }
h1:focus { outline: none; }
.kicker { font-family: var(--type); font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 6px; }
.title { font-size: clamp(2.3rem, 8vw, 4.2rem); margin-bottom: .15em; }
.lede { font-size: 1.12rem; max-width: 40em; }
.dateline { font-family: var(--type); font-weight: 700; margin: .8em 0 0; }
.fine { font-family: var(--type); font-size: .84rem; color: var(--ink-2); }
.prose p, .prose li { max-width: 44em; }
.prose li { margin: .3em 0; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border: 2px solid var(--ink); border-radius: var(--r); background: var(--card); color: var(--ink); font-family: var(--type); font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none; box-shadow: 0 2px 0 var(--ink); transition: transform .08s, box-shadow .08s; }
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: #2f4a3a; color: #f6efdc; border-color: #1b2c22; box-shadow: 0 2px 0 #1b2c22; }
.btn.primary:hover { background: #3a5a47; }
.btn.ghost { background: transparent; box-shadow: none; border-style: dashed; }
.btn.danger { color: var(--bad); border-color: var(--bad); box-shadow: 0 2px 0 var(--bad); }
.btn.small { min-height: 40px; padding: 6px 11px; font-size: .86rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- front desk */
.intro { padding-top: 26px; }
.today { list-style: none; margin: 0 auto 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; max-width: 860px; }
.tcard { display: grid; gap: 4px; padding: 18px 18px 16px; color: var(--ink); text-decoration: none; min-height: 150px; border-top: 10px solid var(--cloth-hem);
  transform: rotate(var(--tilt, -.6deg)); transition: transform .15s; }
.today li:nth-child(2) .tcard { --tilt: .5deg; } .today li:nth-child(3) .tcard { --tilt: -.3deg; }
.tcard:hover, .tcard:focus-visible { transform: rotate(0) translateY(-2px); }
.tc-tier { font-family: "Bungee", var(--sans); font-size: 1.05rem; letter-spacing: .04em; }
.tc-event { font-family: var(--serif); font-size: 1.3rem; line-height: 1.15; }
.tc-meta { font-family: var(--type); font-size: .85rem; color: var(--ink-2); }
.tc-status { font-family: var(--type); font-size: .85rem; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-top: auto; }
.tcard.part .tc-status::before { content: "◐"; } .tcard:not(.part):not(.done) .tc-status::before { content: "○"; }
.mini-stamp { font-family: "Bungee", var(--sans); font-size: .8rem; color: var(--stamp); border: 2px solid var(--stamp); padding: 1px 6px; transform: rotate(-6deg); display: inline-block; }
.home-links { text-align: center; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
#scr-home > .fine { text-align: center; max-width: 640px; margin: 14px auto; color: var(--ink); }

/* ---------- the game header */
.game-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 18px; padding: 12px 16px; margin-bottom: 14px; }
.game-head .event { font-size: clamp(1.25rem, 3vw, 1.9rem); margin: 0; }
.venue { margin: 2px 0 0; font-family: var(--type); font-size: .88rem; color: var(--ink-2); }
.gh-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.clock { font-family: var(--type); font-weight: 700; padding: 0 8px; min-width: 4.5em; text-align: right; }

/* ---------- play layout */
.play { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.board-wrap { position: sticky; top: 8px; }
.board { --ar: 1.4; position: relative; container-type: inline-size; aspect-ratio: var(--ar); width: min(100%, calc((100svh - 70px) * var(--ar))); margin: 0 auto; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.board-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: 3px; box-shadow: var(--shadow); }
.board-help { font-family: var(--type); font-size: .8rem; color: var(--ink-2); text-align: center; margin: 8px auto 0; max-width: 46em; }
/* svg room */
.room { fill: var(--floor-2); }
.lm-window { fill: #cfe3ee; stroke: var(--ink-2); stroke-width: .35; }
.lm-pane { stroke: var(--ink-2); stroke-width: .3; }
.lm-wall { fill: var(--wall); stroke: var(--ink-2); stroke-width: .35; }
.lm-kitchen { fill: #e8d9b2; stroke: var(--ink-2); stroke-width: .35; }
.lm-door { fill: #b88d5c; stroke: var(--ink-2); stroke-width: .35; }
.lm-text { font-family: var(--type); font-size: 2.3px; letter-spacing: .12px; fill: var(--ink); font-weight: 700; }
.lm-small { font-size: 2px; font-weight: 400; fill: var(--ink-2); }
.cloth { fill: var(--cloth); stroke: var(--ink); stroke-width: .45; stroke-linejoin: round; }
.cloth-hem { fill: none; stroke: var(--cloth-hem); stroke-width: .7; stroke-dasharray: 1.2 .9; }
.plate { fill: var(--plate); stroke: var(--ink-2); stroke-width: .25; }
.plate-in { fill: none; stroke: var(--card-edge); stroke-width: .2; }
.lm-leaf { fill: #4f7a45; stroke: #2e4a29; stroke-width: .15; }
.lm-pot { fill: #a2552e; }
.lm-buffet { fill: #e8d9b2; stroke: var(--ink-2); stroke-width: .35; }
.lm-exit { fill: #2f7d4f; stroke: #174a2c; stroke-width: .35; }
.lm-exit-t { fill: #fff; }
.lm-radiator { fill: #eae6dc; stroke: var(--ink-2); stroke-width: .3; }
.lm-fin { stroke: var(--ink-2); stroke-width: .25; }
.lm-speaker { fill: #3a3a3a; } .lm-cone { fill: #777; }

/* ---------- seats = place cards */
.seat { position: absolute; display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; padding: .5cqw .7cqw; margin: 0;
  border: .22cqw solid var(--card-edge); border-radius: .5cqw; background: var(--card); color: var(--ink); cursor: pointer; text-align: center; overflow: hidden;
  box-shadow: 0 .3cqw .6cqw -.2cqw rgba(40,30,10,.5); transition: transform .12s, box-shadow .12s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.seat::before { content: ""; position: absolute; left: 6%; right: 6%; top: calc(100cqw * var(--chw, .1) * .31); border-top: .12cqw dashed var(--card-edge); pointer-events: none; } /* the tent-card fold */
.seat-top { display: flex; justify-content: space-between; align-items: baseline; gap: .4cqw; font-family: var(--type); font-weight: 700; font-size: calc(100cqw * var(--chw, .1) * .17); line-height: 1.15; color: var(--ink-2); white-space: nowrap; }
.seat-tag { overflow: hidden; text-overflow: ellipsis; font-size: .92em; letter-spacing: .02em; }
.seat-name { flex: 1; display: flex; align-items: center; justify-content: center; font-family: var(--cardfont); line-height: 1.02; overflow-wrap: anywhere;
  font-size: min(calc(100cqw * var(--cw, .14) * .165), calc(100cqw * var(--chw, .1) * .27)); padding-top: .2cqw; }
.font-bungee .seat-name { font-size: min(calc(100cqw * var(--cw, .14) * .13), calc(100cqw * var(--chw, .1) * .23)); }
.seat.empty { background: rgba(255, 253, 246, .55); border-style: dashed; border-color: var(--ink-2); box-shadow: none; }
.seat.empty .seat-name { font-family: var(--type); font-style: italic; color: var(--faint); font-size: calc(100cqw * var(--chw, .1) * .17); }
.seat.filled { touch-action: none; }
.seat:hover { transform: translateY(-.25cqw); }
.seat.sel { outline: .5cqw solid var(--sel); outline-offset: .2cqw; transform: translateY(-.4cqw) scale(1.04); z-index: 3; }
.seat.sel::after { content: "▲ picked"; position: absolute; right: .4cqw; bottom: .2cqw; font: 700 calc(100cqw * var(--chw, .1) * .13) var(--type); color: var(--sel); }
.seat.hl { box-shadow: 0 0 0 .5cqw var(--hl), 0 0 0 .75cqw var(--ink); z-index: 2; }
.seat.bad { border: .4cqw dashed var(--bad); background-image: repeating-linear-gradient(135deg, rgba(184, 70, 11, .16) 0 .6cqw, transparent .6cqw 1.4cqw); }
.seat.bad .seat-top::after { content: "✗"; color: var(--bad); font-size: 1.3em; line-height: .9; }
.seat.drop-over { outline: .6cqw dashed var(--sel); outline-offset: .2cqw; background: #e6f0f8; }
.seat.dragging { opacity: .45; }
.seat:focus-visible { outline: .55cqw solid var(--ink); outline-offset: .25cqw; z-index: 4; }
.board.solved .seat { cursor: default; }
.board.solved .seat:hover { transform: none; }
.board.solved::after { content: attr(data-stamp); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-12deg); font-family: "Bungee", var(--sans); font-size: 5cqw; color: var(--stamp);
  border: .7cqw solid var(--stamp); padding: .4cqw 2cqw; background: rgba(255,255,255,.55); pointer-events: none; z-index: 5; white-space: nowrap; animation: stamp-in .45s cubic-bezier(.2, 1.6, .5, 1) both; mix-blend-mode: multiply; }
@keyframes stamp-in { from { transform: translate(-50%, -50%) rotate(-24deg) scale(2.2); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-12deg) scale(1); opacity: 1; } }

/* ---------- side: tray + demands */
.side { display: grid; gap: 14px; }
.tray, .clues, .solved-box { padding: 12px 14px 14px; }
.tray h2, .clues h2, .solved-box h2 { font-size: 1.2rem; margin-bottom: 8px; }
.count { font-family: var(--type); font-size: .85rem; color: var(--ink-2); }
.tray-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; }
.card.guest { display: grid; text-align: left; gap: 1px; padding: 7px 10px 8px; min-height: 44px; max-width: 100%; border: 1.5px solid var(--card-edge); border-radius: 3px; background: var(--card); cursor: grab; box-shadow: 0 2px 4px -2px rgba(40,30,10,.5); touch-action: none; transition: transform .12s; -webkit-tap-highlight-color: transparent; }
.card.guest:hover { transform: translateY(-1px) rotate(-.6deg); }
.g-name { font-family: var(--cardfont); font-size: 1.12rem; line-height: 1.1; }
.font-bungee .g-name { font-size: .95rem; }
.g-note { font-family: var(--type); font-size: .76rem; color: var(--ink-2); line-height: 1.2; }
.card.guest.sel { outline: 3px solid var(--sel); outline-offset: 2px; transform: translateY(-2px); background: #e6f0f8; }
.card.guest.sel .g-name::after { content: " ▲"; font-size: .7em; color: var(--sel); }
.card.guest.hl { box-shadow: 0 0 0 3px var(--hl), 0 0 0 5px var(--ink); }
.card.guest.dragging { opacity: .4; }
.tray.drop-over { outline: 3px dashed var(--sel); outline-offset: -3px; }
.tray-empty { font-family: var(--type); font-size: .88rem; color: var(--ink-2); margin: 6px 0; }
.ghost.card { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; padding: 8px 14px; background: var(--card); border: 2px solid var(--ink); border-radius: 3px; font-family: var(--cardfont); font-size: 1.1rem; box-shadow: 0 10px 18px -6px rgba(0,0,0,.45); transform: translate(-200px, -200px); white-space: nowrap; }
body.is-dragging { cursor: grabbing; }
body.is-dragging * { cursor: grabbing !important; }

.clue-list { list-style: none; margin: 0; padding: 0; counter-reset: clue; }
.clue { counter-increment: clue; display: grid; grid-template-columns: 1.9em 1fr auto; gap: 8px; align-items: start; padding: 8px 4px 8px 6px; border-top: 1px dashed var(--card-edge); border-left: 4px solid transparent; }
.clue:first-child { border-top: 0; }
.clue .st { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; border: 2px solid var(--faint); color: var(--faint); font-weight: 700; font-size: .9rem; line-height: 1; }
.clue.ok .st { border-color: var(--ok); background: var(--ok); color: #fff; }
.clue.bad { border-left-color: var(--bad); background-image: repeating-linear-gradient(135deg, rgba(184, 70, 11, .1) 0 6px, transparent 6px 14px); }
.clue.bad .st { border-color: var(--bad); color: var(--bad); border-style: dashed; background: #fff; }
.c-text { font-family: var(--type); font-size: .98rem; line-height: 1.3; }
.c-text::before { content: counter(clue) ". "; color: var(--ink-2); }
.c-why { display: block; font-size: .8rem; color: var(--ink-2); font-style: italic; margin-top: 2px; }
.clue.struck .c-text { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--ink-2); }
.clue.struck .c-why { opacity: .6; }
.strike { min-width: 40px; min-height: 40px; border: 1px solid transparent; border-radius: 3px; background: transparent; cursor: pointer; color: var(--ink-2); font-size: 1.05rem; }
.strike:hover { border-color: var(--card-edge); }
.strike[aria-pressed="true"] { color: var(--ink); background: var(--paper-2); border-color: var(--ink-2); }
.clue-legend { font-family: var(--type); font-size: .78rem; color: var(--ink-2); margin: 8px 0 0; }
.clue-legend .st { display: inline-block; font-weight: 700; }
.st-ok { color: var(--ok); } .st-bad { color: var(--bad); }
.solved-box { border: 3px double var(--ok); }
.solved-box p { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }

/* ---------- archive */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0; }
.month-nav h2 { margin: 0; text-align: center; flex: 1; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; font-family: var(--type); }
.cal th { font-size: .8rem; color: var(--ink-2); padding: 4px 0; font-weight: 700; }
.cal td { vertical-align: top; border: 1px solid var(--card-edge); height: 76px; padding: 3px; background: rgba(255,255,255,.4); }
.cal td.future { background: transparent; color: var(--faint); }
.cal td.is-today { outline: 3px solid var(--ok); outline-offset: -3px; }
.day-no { font-size: .8rem; font-weight: 700; display: block; }
.pips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.pip { display: inline-grid; place-items: center; min-width: 26px; height: 26px; font-size: .78rem; font-weight: 700; border: 1.5px solid var(--ink-2); border-radius: 50%; color: var(--ink); background: var(--card); text-decoration: none; }
.pip.part { background: linear-gradient(90deg, var(--hl) 50%, var(--card) 50%); }
.pip.done { background: var(--ok); color: #fff; border-color: var(--ok); }
.pip.done::after { content: "✓"; font-size: .6rem; margin-left: 1px; }
a.pip:hover { transform: scale(1.08); }
@media (max-width: 560px) { .cal td { height: 92px; padding: 2px 1px; } .pips { flex-direction: column; align-items: center; } .pip { min-width: 30px; height: 22px; border-radius: 11px; } }

/* ---------- cabinet */
.cab-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cab { display: flex; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--card-edge); background: var(--card); border-radius: 3px; }
.cab.locked { background: repeating-linear-gradient(135deg, rgba(0,0,0,.035) 0 6px, transparent 6px 12px), var(--paper-2); color: var(--ink-2); border-style: dashed; }
.cab-mark { font-size: 1.1rem; }

/* ---------- settings */
.settings fieldset { border: 1.5px solid var(--card-edge); border-radius: 3px; margin: 0 0 14px; padding: 8px 14px 12px; }
.settings legend { font-family: var(--serif); font-size: 1.15rem; padding: 0 6px; }
.settings .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 44px; }
.settings input[type="checkbox"] { width: 22px; height: 22px; accent-color: #2f4a3a; }
.settings input[type="range"] { flex: 1; min-width: 140px; accent-color: #2f4a3a; }
.settings select { min-height: 40px; padding: 4px 8px; border: 1.5px solid var(--ink-2); border-radius: 3px; background: var(--card); max-width: 100%; }

/* ---------- dialogs, toast, update */
dialog { border: 0; padding: 0; background: transparent; max-width: min(96vw, 620px); width: 100%; max-height: 96svh; }
dialog::backdrop { background: rgba(28, 22, 14, .62); }
.pw-inner { background: var(--paper); padding: 16px; border-radius: 3px; box-shadow: 0 20px 40px -10px rgba(0,0,0,.6); max-height: 94svh; overflow: auto; }
.pw-inner h2 { margin-bottom: 8px; }
#pw-img { display: block; width: 100%; max-height: 62svh; object-fit: contain; background: var(--floor); border-radius: 2px; }
.pw-note { font-family: var(--type); font-size: .84rem; color: var(--ink-2); margin: 8px 0; }
.pw-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.pw-preview summary { font-family: var(--type); cursor: pointer; padding: 8px 0; min-height: 40px; }
.pw-preview pre { font-size: 1rem; line-height: 1.25; white-space: pre-wrap; background: var(--card); border: 1px dashed var(--card-edge); padding: 10px; margin: 0; }
@media (max-height: 520px) { #pw-img { max-height: 52dvh; } #pw-h { font-size: 1.05rem; margin: 0 0 .2em; } .pw-inner { padding: .5em .8em; } }
#pr-text { width: 100%; font-family: var(--type); font-size: .85rem; border: 1.5px solid var(--ink-2); padding: 6px; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 160%); z-index: 90; max-width: min(92vw, 520px); background: var(--ink); color: var(--paper); font-family: var(--type); font-size: .92rem; padding: 10px 16px; border-radius: 3px; box-shadow: var(--shadow); transition: transform .25s; pointer-events: none; }
.toast:empty { visibility: hidden; }
.toast.show { transform: translate(-50%, 0); }
.update { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); z-index: 95; background: var(--paper); border: 2px solid var(--ink); padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; box-shadow: var(--shadow); max-width: 94vw; }
.update p { margin: 0 6px 0 0; font-family: var(--type); font-size: .9rem; }

/* ---------- phones and tall screens: stack, keep the standing guests in reach */
@media (max-width: 860px) and (orientation: portrait) {
  .play { display: flex; flex-direction: column; gap: 10px; }
  .side { display: contents; }
  .board-wrap { position: static; width: 100%; order: 1; }
  .board { width: min(100%, calc(64svh * var(--ar))); }
  .board-help { display: none; }
  .tray { order: 2; position: sticky; bottom: 0; z-index: 10; padding: 8px 10px 10px; box-shadow: 0 -8px 16px -10px rgba(40,30,10,.6); max-height: 38svh; overflow: auto; }
  .tray h2 { font-size: 1rem; margin-bottom: 6px; }
  .tray-list { gap: 6px; }
  .card.guest { padding: 6px 9px; }
  .g-note { display: none; }
  .solved-box { order: 3; }
  .clues { order: 4; }
  .game-head { padding: 10px 12px; }
  .gh-tools { width: 100%; }
  .gh-tools .btn { flex: 1 1 auto; }
}
@media (max-width: 860px) and (orientation: landscape), (max-height: 520px) {
  .play { grid-template-columns: minmax(0, 1.25fr) minmax(250px, 1fr); gap: 10px; }
  .board { width: min(100%, calc((100svh - 24px) * var(--ar))); }
  .board-help { display: none; }
  .side { max-height: calc(100svh - 16px); overflow: auto; position: sticky; top: 8px; }
  .g-note { display: none; }
  .card.guest { padding: 5px 8px; }
}
@media (max-height: 520px) {
  .topbar { padding: 2px 10px; } .logo { font-size: 1.1rem; } .nav button { min-height: 36px; padding: 4px 8px; }
  .game-head { padding: 6px 10px; margin-bottom: 8px; } .game-head .kicker, .venue { display: none; } .game-head .event { font-size: 1.05rem; }
}
@media (max-width: 480px) { .nav button { padding: 6px 7px; font-size: .84rem; } .logo { font-size: 1.2rem; } .topbar { justify-content: center; } }

/* ---------- motion */
.calm *, .calm *::before, .calm *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
.calm .tcard { transform: none; }
@media (forced-colors: active) {
  .seat, .card.guest, .clue .st { border: 2px solid CanvasText; }
  .seat.sel, .card.guest.sel { outline: 4px solid Highlight; }
  .seat.bad { border-style: dashed; border-width: 4px; }
  .board.solved::after { border-color: CanvasText; color: CanvasText; }
}
@media print { .topbar, .gh-tools, .tray, .board-help, .toast, .update, .solved-box { display: none !important; } body { background: #fff; } .play { display: block; } }
/* dossier line: the picked guest's note, shown where the cards are too small to carry it */
.dossier { display: none; font-family: var(--type); font-size: .8rem; font-style: italic; color: var(--ink-2); margin: 6px 0 0; min-height: 1.2em; }
@media (max-width: 860px) and (orientation: portrait) { .dossier { display: block; } }
@media (max-width: 860px) and (orientation: landscape), (max-height: 520px) { .dossier { display: block; } }
/* phones upright: compact chrome so the table, not the paperwork, gets the screen */
@media (max-width: 860px) and (orientation: portrait) {
  .topbar { flex-wrap: nowrap; padding: 2px 8px; } .logo { font-size: 1.05rem; white-space: nowrap; }
  .nav { flex-wrap: nowrap; gap: 0; } .nav button { font-size: .78rem; padding: 4px 6px; min-height: 40px; }
  #scr-game .game-head { padding: 6px 10px; margin-bottom: 6px; } #scr-game .venue { display: none; }
  #scr-game .game-head .kicker { font-size: .68rem; margin: 0; } #scr-game .event { font-size: 1.05rem; }
  .gh-tools .btn.small { min-height: 40px; padding: 2px 6px; font-size: .82rem; }
  .tray { max-height: 30svh; } .card.guest { padding: 3px 8px; min-height: 40px; } .g-name { font-size: 1rem; }
}
@media (max-width: 400px) and (orientation: portrait) { .nav button[data-go="cabinet"] { display: none; } }
@media (max-width: 860px) and (orientation: portrait) { .toast { bottom: auto; top: calc(8px + env(safe-area-inset-top)); transform: translate(-50%, -180%); } .toast.show { transform: translate(-50%, 0); } }

/* ---------- planned: 3D version note (trailer worker) */
.note3d { font-family: var(--type); font-size: .9rem; color: var(--ink); display: inline-block; margin: 6px 0 0; padding: 4px 10px; border: 1.5px dashed currentColor; transform: rotate(-.6deg); }
