:root {
  /* a dark, muted green theme (halfway between grey and #063115) */
  --bg: #0e2418; --panel: #142e20; --panel2: #1c3829; --line: #2a4a3a;
  --panel-a: #142e20ee;   /* floating trays over the map */
  --ink: #07110b;         /* outlines on the board */
  --fog: #1b1e2280; --fog-line: #2a2f3580;   /* unexplored hexes: grey, not green, half see-through */
  --board-in: #143021; --board-out: #0a1911;   /* the board's glow */
  --text: #e6e2d8; --muted: #8da198; --good: #7bc47f; --bad: #e86a5a; --accent: #d9a441;
  /* board overlay sizes — shrunk for tablets and phones in the media queries at the end */
  --gap: 14px; --clock: 296px; --col: 236px; --orbmax: 64px;
  --dockl: var(--gap);   /* where the action dock may start */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 18px; margin: 0; letter-spacing: .02em; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.muted { color: var(--muted); font-weight: normal; }
button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .35; cursor: not-allowed; }
button.primary { background: var(--accent); color: #1a1a1a; border: 0; font-weight: 600; width: 100%; padding: 10px; }

/* setup */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: min(360px, 100%); display: grid; gap: 12px; }
.card h1 { font-size: 24px; }
.card p { margin: -8px 0 0; }
.card label { display: flex; justify-content: space-between; align-items: center; }
#names { display: grid; gap: 6px; }
input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; padding: 6px 8px; }
#count { width: 64px; border-left-width: 1px; }

/* layout */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.unread { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; animation: unreadpop .3s cubic-bezier(.2, 1.8, .5, 1); }
@keyframes unreadpop { from { transform: scale(0); } }
main { flex: 1; display: grid; grid-template-columns: 1fr 0; min-height: 0; position: relative; }
body.log-open main { grid-template-columns: 1fr 380px; }
body:not(.log-open) #panel { display: none; }
#board { position: relative; min-height: 0; overflow: hidden; container: board / inline-size;
  background: radial-gradient(circle at 50% 50%, var(--board-in) 0%, var(--board-out) 100%); }
#map { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }   /* drag to look around (game.js) */
#map.dragging, #map.dragging * { cursor: grabbing; }
#panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--panel); }
/* the log's heading: ✕ (hide it) at its right end, the note box straight under it, then the messages */
.loghead { display: flex; align-items: center; justify-content: space-between; }
#logclose { margin: -8px -10px; padding: 4px 10px; background: none; border: 0; color: var(--muted); font-size: 16px; }
#logclose:hover { color: var(--text); }
.chathead { padding: 12px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); border-bottom: 1px solid var(--line); }
#log { flex: 1; overflow-y: auto; padding: 12px 12px 4px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; animation: msgin .25s ease-out; }
.bubble { display: flex; align-items: center; gap: 8px; max-width: 92%; background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 4px 10px 10px 10px; padding: 6px 10px; }
.msg.good .bubble { border-left-color: var(--good); }
.msg.bad .bubble { border-left-color: var(--bad); color: #f2b0a6; }
.msg.phase { align-items: center; margin: 8px 0 2px; }
.msg.phase span { font-size: 11.5px; font-weight: 600; color: var(--accent); background: #d9a4411a; border: 1px solid #d9a44144; border-radius: 999px; padding: 2px 10px; }
.msg.chat { align-items: flex-end; }
.msg.chat .bubble { background: #2a3b52; border-color: #3b5577; border-radius: 10px 4px 10px 10px; }
.who-name { font-size: 11px; color: var(--muted); margin: 0 4px 2px; }
.mdice { display: flex; gap: 3px; flex-shrink: 0; }
.sdie rect { fill: #f4efe4; }
.sdie circle { fill: #1b1b1b; }
@keyframes msgin { from { opacity: 0; transform: translateY(6px); } }
#chatform { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
#chatform input { flex: 1; border-left-width: 1px; min-width: 0; }

/* clock */
#clock { position: absolute; top: var(--gap); right: var(--gap); width: var(--clock); height: var(--clock); z-index: 2; filter: drop-shadow(0 6px 14px #000a); pointer-events: none; }
.wedge path { stroke: var(--ink); stroke-width: 1.5; transition: fill .3s; }
.wedge.night path { fill: #1c2238; }
.wedge.day path { fill: #3a3220; }
.wedge text { text-anchor: middle; fill: var(--muted); }
.wedge .rn { font-size: 15px; font-weight: 800; }
.wedge .up { font-size: 10px; }
/* a night attack's wedge glows red, by --heat (0–1: how near it is) — pulsing, over the wedge's own colour */
.wedge .heat { fill: #ff2020; stroke: none; pointer-events: none; opacity: calc(var(--heat) * .45);
  filter: drop-shadow(0 0 calc(var(--heat) * 9px) #ff2020); animation: heat 1.6s ease-in-out infinite; }
@keyframes heat { 50% { opacity: calc(var(--heat) * .2); } }
.wedge.now path { stroke: var(--accent); stroke-width: 3; }
.wedge.night.now path { fill: #34407a; }
.wedge.day.now path { fill: #8a6a22; }
.wedge.now text { fill: #fff; }
#hand { transition: transform .8s cubic-bezier(.3, 1.4, .5, 1); }
#hand path { fill: var(--accent); stroke: var(--ink); stroke-width: 1.5; }
#clock .hub { fill: var(--panel); stroke: var(--line); stroke-width: 1.5; }
#clock .dl { text-anchor: middle; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; fill: var(--muted); }
#clock .dn { text-anchor: middle; font-size: 22px; font-weight: 800; fill: var(--accent); }

/* hexes */
.hex polygon { stroke: var(--ink); stroke-width: 3; transition: fill .15s; }
.fog polygon { fill: var(--fog); stroke: var(--fog-line); stroke-dasharray: 4 4; stroke-width: 1.5; }
.tile.d1 polygon { fill: #3d4a33; }
.tile.town polygon { fill: #5b5a52; }   /* settlements: paved grey (a dangerous place still shows its danger colour) */
.tile.d2 polygon { fill: #4e4a2e; }
.tile.d3 polygon { fill: #5a3a2c; }
.tile.d4 polygon { fill: #5e2a2a; }
.tile.barren polygon { fill: #4a4237; }
.tile.impassable polygon { fill: #3a3d42; stroke: var(--ink); }
.tile.impassable .name { fill: #b8bec6; }
.tile.nofort .pip:not(.zed) { opacity: .35; stroke-dasharray: 2 2; }
.tile.here polygon { stroke-width: 5; }
.hex.target { cursor: pointer; }
.hex.target polygon { stroke: #fff; stroke-width: 3; stroke-dasharray: none; filter: brightness(1.35); }
.fog.target polygon { fill: #2a3138; }
.hex text { text-anchor: middle; pointer-events: none; fill: var(--text); }
.hex .name { font-size: 14px; font-weight: 700; letter-spacing: .02em; }
.hex .townname { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; fill: var(--muted); }
.hex .art { font-size: 64px; text-anchor: middle; dominant-baseline: central; filter: drop-shadow(0 4px 6px #0008); }   /* the place's picture, away from you (its name on hover) */
.hex .safety { font-size: 12px; fill: #cfd6dc; }
.hex .veh { font-size: 18px; }
.hex .veh.parked { font-size: 48px; filter: drop-shadow(0 2px 3px #000a); }   /* out front of the place on the map */
.hex .veh.parked.small { font-size: 24px; }   /* (a bike: half the size) */
.hex .pip { fill: #0006; stroke: #f2c94c66; stroke-width: 1.5; }
.hex .pip.zed { fill: #0b0b0b; stroke: #c0392b; stroke-width: 2; }
.tile.revealed { animation: reveal .7s cubic-bezier(.2, 1.4, .5, 1) backwards; animation-delay: calc(var(--i, 0) * 120ms); transform-box: fill-box; transform-origin: center; }   /* a ripple when several appear */
.tile.revealed polygon { stroke: #fff; stroke-width: 4; animation: revealglow 1.4s ease-in-out infinite alternate; }
@keyframes reveal { from { transform: scale(.3) rotate(-30deg); opacity: 0; } }
@keyframes revealglow { from { filter: drop-shadow(0 0 4px #fff8); } to { filter: drop-shadow(0 0 18px #fffc); } }
.tile.infested polygon { filter: saturate(.5) brightness(.75); }
.tile.infested .name { fill: #ff8c7c; }
.hex .pip.on { fill: #f2c94c; stroke: #8a6d12; filter: drop-shadow(0 0 3px #f2c94c88); }
.hex .pip.fuel { stroke: #f0922b66; }   /* a generator's: its fuel, a day each */
.hex .pip.fuel.on { fill: #f0922b; stroke: #8a4b12; filter: drop-shadow(0 0 3px #f0922b88); }
.hex .tbl { fill: #0007; stroke: #0009; stroke-width: 1; }
.hex .tbl-div { stroke: #fff2; stroke-width: 1; }
.hex .cell { text-anchor: start; font-size: 14px; }
.hex .cell.long { font-size: 12.5px; }
.hex .cell .n { fill: var(--muted); font-weight: 700; }
.hex .cell.z { fill: #ff8c7c; }
.pick circle { fill: var(--accent); stroke: #111; stroke-width: 2; animation: pickpulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.pick text { font-size: 15px; font-weight: 800; fill: #111 !important; }
.pick.big text { font-size: 24px; }
@keyframes pickpulse { 50% { transform: scale(1.12); } }

/* panel */
/* resources: a column of coloured numbers filling the space under the backpack, growing with the room available */
#stats { flex: 1; min-height: 0; container-type: size; display: flex; flex-direction: column; justify-content: space-evenly; align-items: flex-end; }
.stat { --o: clamp(28px, calc(20cqh - 12px), var(--orbmax)); display: flex; flex-direction: row-reverse; align-items: center; gap: 10px; pointer-events: auto; }
.stat small { font-size: 12px; font-weight: 600; color: var(--text); text-transform: uppercase; letter-spacing: .1em; text-shadow: 0 1px 3px #000, 0 0 8px #000; }
.stat .orb { --c: #888; position: relative; min-width: var(--o); height: var(--o); display: grid; place-items: center; }
.stat .orb b { font-size: calc(var(--o) * .7); font-weight: 900; line-height: 1; color: var(--c); text-shadow: 0 2px 3px #000, 0 0 10px #000c; font-variant-numeric: tabular-nums; }
.stat.food .orb { --c: #ff5a52; }
.stat.water .orb { --c: #4aa8ff; }
.stat.fuel .orb { --c: #ffa040; }
.stat.ammo .orb { --c: #5fd068; }
.stat.low2 .orb, .stat.low1 .orb { --glow: #f0922b; }
.stat.low1 .orb { --glow: #ff3b30; }
.stat.low2 .orb b, .stat.low1 .orb b { animation: lowglow 1.6s ease-in-out infinite; }
.stat.low1 .orb b { animation-duration: .9s; }
@keyframes lowglow { 50% { text-shadow: 0 2px 3px #000, 0 0 12px var(--glow), 0 0 4px var(--glow); } }
.delta { position: absolute; left: 50%; top: -4px; font-size: 18px; font-weight: 900; text-shadow: 0 2px 4px #000; pointer-events: none; animation: deltafloat 1.4s ease-out forwards; }
.delta.up { color: #4cd964; }
.delta.down { color: #ff5b4f; }
@keyframes deltafloat { 0% { opacity: 0; transform: translate(-50%, 0) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -26px) scale(1); } }
.stat.up .orb { animation: orbup .7s cubic-bezier(.2, 1.8, .5, 1); }
.stat.down .orb { animation: orbdown .7s ease-out; }
@keyframes orbup { 40% { transform: scale(1.25); filter: drop-shadow(0 0 8px #4cd964); } }
@keyframes orbdown { 20% { transform: translateX(-4px); filter: drop-shadow(0 0 8px #ff3b30); } 40% { transform: translateX(4px); } }
/* AP around the clock: lit up to your AP (coloured by how much of the 12 you have; purple at your max), dim up
   to your max AP, black above it. It pops when AP changes and the lit segments pulse when you're low. */
#clock { --c: var(--bad); }
#clock.full { --c: #4cd964; }   /* green, like high: purple is hope's colour */
#clock.high { --c: #4cd964; }
#clock.mid { --c: #f0922b; }
#clock.low { --c: #ff3b30; }
#apring .seg { fill: #ffffff26; stroke: var(--ink); stroke-width: 1.5; transition: fill .3s; }
#apring .seg.on { fill: var(--c); }
#apring .seg.locked { fill: #050505; stroke: #000; }
#clock.full #apring .seg.on { filter: drop-shadow(0 0 3px #4cd964); }
#clock.low #apring .seg.on { animation: lowseg 1s ease-in-out infinite; }
@keyframes lowseg { 50% { opacity: .45; } }
#apring .seg.gaining { animation: seggain .35s cubic-bezier(.2, 1.8, .5, 1); transform-box: fill-box; transform-origin: center; }   /* sleep fills it a segment at a time */
#clock.up #apring, #clock.down #apring { animation: ringpop .5s cubic-bezier(.2, 1.8, .5, 1); transform-box: view-box; transform-origin: center; }
@keyframes ringpop { 40% { transform: scale(1.05); } }
@keyframes seggain { 0% { transform: scale(.4); filter: drop-shadow(0 0 10px #fff); } 60% { transform: scale(1.25); } }
#popup.sleep { background: #050a1fcc; }
/* a missed check: the max AP being lost takes the colour of what was missing (--lc), then swells and goes dark */
#apring.food { --lc: #ff5a52; }
#apring.water { --lc: #4aa8ff; }
#apring.hope { --lc: #c084ff; }
#apring .seg.doomed { fill: var(--lc); filter: drop-shadow(0 0 4px var(--lc)); }   /* only the segments being lost */
#apring .seg.doomed { animation: doomed .5s ease-in-out infinite alternate; }
@keyframes doomed { to { opacity: .55; } }
#clock.shake { animation: clockshake .5s ease-in-out; }
@keyframes clockshake { 15%, 55% { translate: -7px 0; } 35%, 75% { translate: 7px 0; } 90% { translate: -3px 0; } }
.clocktag { position: fixed; z-index: 7; translate: -50% -50%; pointer-events: none; white-space: nowrap; padding: 6px 14px; border-radius: 999px;
  font-size: 18px; font-weight: 900; letter-spacing: .02em; color: #fff; background: var(--lc); box-shadow: 0 6px 20px #000a, 0 0 18px var(--lc);
  animation: tagpop .35s cubic-bezier(.2, 1.8, .5, 1); }
.clocktag.food { --lc: #e0443c; } .clocktag.water { --lc: #2f8de0; } .clocktag.hope { --lc: #9b5de5; }
@keyframes tagpop { from { scale: .3; opacity: 0; } }
#apring .seg.losing { animation: ringloss 1s ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes ringloss { 0% { fill: var(--lc); transform: scale(1.35); filter: drop-shadow(0 0 10px var(--lc)); } 50% { fill: var(--lc); transform: scale(1); } 100% { fill: #050505; } }
/* bottom dock: the action ribbon, centred along the bottom — drawn above the backpack bar (z 3), so the backpack's
   shadow doesn't fall across it */
#dock { position: absolute; z-index: 4; left: var(--dockl); right: var(--gap); bottom: var(--gap); width: fit-content; margin-inline: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
#actions { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 100%; }
/* with room to spare, the same inset on both sides, so the dock (and the notes above it) centre under your tile */
/* (one line, never wrapped: too wide to centre, it starts at the left and runs on to the right) */
@container board (min-width: 1260px) { #dock { right: var(--dockl); width: max-content; } }
@media (max-height: 860px) { @container board (min-width: 1190px) { #dock { right: var(--dockl); width: max-content; } } }   /* smaller dials there */
/* round timer: a thin yellow line along the top edge of the map, its full width, draining as the round runs; red in
   the last 10 s, white while Paused (nothing else stops it). No numbers. */
#timer { position: absolute; z-index: 5; left: 0; right: 0; top: 0; height: 3px; pointer-events: none; }
/* the menu (☰) and, under it, the chat (💬, the log — its unread count on it): small round buttons at the clock's
   bottom right — the clock's in the board's top-right corner in every layout */
#corner { display: contents; }
#corner button { position: absolute; z-index: 3; top: calc(var(--gap) + var(--clock) - 4px); right: var(--gap); display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 18px; background: var(--panel-a); box-shadow: 0 6px 16px #000a; }
#corner #menubtn { font-size: 24px; }
#corner #logtoggle { top: calc(var(--gap) + var(--clock) + 44px); }
#corner .unread { position: absolute; top: -5px; right: -4px; margin: 0; }
#timer:empty { display: none; }
#timer i { display: block; height: 100%; background: #f2c94c; box-shadow: 0 0 6px #f2c94c88; transition: width .1s linear, background .3s; }
#timer.low i { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
#timer.held i { background: #fff; box-shadow: 0 0 6px #fff8; }   /* Paused: white */
#actions > * { pointer-events: auto; }
#actions.roundover > :not(.ribbon), #actions.roundover .act:not([data-act="pause"]), #pack.roundover { opacity: .35; filter: grayscale(1); pointer-events: none; }   /* the whole bar, panel and all, like the action ribbon — all but Pause, which works any time */
#actions.roundover .act.sel { animation: none; }
#actions .note { margin: 0; box-shadow: 0 4px 12px #0008; background: var(--panel-a); border: 1px solid var(--line); }
.ribbon { display: flex; gap: 6px; padding: 14px 8px 8px; background: var(--panel-a); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px #000a; backdrop-filter: blur(4px); flex-wrap: wrap; justify-content: center; max-width: 100%; }
.act { display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-width: 0; padding: 7px 10px; white-space: nowrap; flex-shrink: 0; }
.act small { color: var(--muted); font-size: 11px; }
kbd { font: 600 10px ui-monospace, monospace; margin-left: 6px; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); }
.act.on { border-color: var(--accent); background: #3a3220; }
.act.sel { position: relative; border-color: var(--accent); background: #3a3220; animation: selpulse 1.2s ease-in-out infinite; }
.act.sel::after { content: 'Enter ↵'; position: absolute; top: -10px; right: 8px; font-size: 10px; font-weight: 700; background: var(--accent); color: #111; padding: 1px 6px; border-radius: 4px; }
.act.nope { animation: nope .3s; }
@keyframes selpulse { 50% { box-shadow: 0 0 0 3px #d9a44155; } }
@keyframes nope { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.note { margin: 8px 0; padding: 6px 8px; border-radius: 6px; background: var(--panel2); font-size: 12.5px; }
.note.good { color: var(--good); }
.note.bad { color: var(--bad); }
.dice { display: flex; gap: 18px; margin-top: 10px; }
.dice > div { display: flex; align-items: center; gap: 8px; }
.die.mini { width: 34px; height: 34px; padding: 4px; border-radius: 7px; gap: 0; transform: none; box-shadow: inset 0 -2px 0 #0003; }
.die.mini i { margin: 1.5px; }
.dice.fresh .die { animation: roll .45s ease-out; }
@keyframes roll { 0% { transform: rotate(-360deg) scale(.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
.share { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.share span { flex: 1; font-weight: 600; }
.share button { padding: 2px 6px; }
#panel section > h3 + .share { margin-top: 0; }
.mini { display: grid; grid-template-columns: 12px auto 1fr; gap: 2px 8px; align-items: center; padding: 4px 0; font-size: 12.5px; }
.mini i { width: 10px; height: 10px; border-radius: 50%; }
.mini span { text-align: right; }
.mini small { grid-column: 2 / 4; color: var(--muted); }
.mini.me b { color: var(--accent); }
.mini em { color: var(--bad); font-style: normal; }

/* scavenge popup */
/* Paused: a veil over the whole board, no words — the map shows through and can be dragged and zoomed (the veil lets
   the pointer by); the bars wait, greyed out, all but the Pause button, which glows */
#pauseveil { position: absolute; inset: 0; z-index: 8; background: #07141055; animation: fade .2s; pointer-events: none; }
body.paused :is(#dock, #pack, #rightcol, #msgs, #stats), body.paused :is(#dock, #pack, #rightcol, #msgs, #stats) * { pointer-events: none !important; }
body.paused #dock .act[data-act="pause"], body.paused #dock .act[data-act="pause"] * { pointer-events: auto !important; }
body.paused #dock :is(.act:not([data-act="pause"]), .note), body.paused #pack > * { opacity: .35; filter: grayscale(1); }
/* Trade (🤝 in the action bar): the others' faces on your hex are whom to give to (dashed gold; the one picked glows),
   the resource numbers you can give lift and glow (a tap gives 1), and the items light up gold with Give */
.survivor.mate { cursor: pointer; }
.survivor.mate circle { stroke: var(--accent); stroke-dasharray: 5 4; }
.survivor.chosen circle { stroke-dasharray: none; stroke-width: 4; animation: chosenglow 1.4s ease-in-out infinite; }
@keyframes chosenglow { 50% { filter: drop-shadow(0 0 9px var(--accent)); } }
#stats .stat.give { pointer-events: auto; cursor: pointer; }
#stats .stat.give .orb { animation: chosenglow 1.4s ease-in-out infinite; }
#stats.trading .stat:not(.give) { opacity: .35; }
#pack.trading { border-color: var(--accent); box-shadow: 0 0 24px #d9a44155, 0 10px 30px #000a; }
#pack .slot-item.give { border-color: var(--accent); box-shadow: 0 0 10px #d9a44166; }
#pack .slot-item .use.give { background: var(--accent); border-color: var(--accent); color: #111; }
body.paused #dock .act[data-act="pause"] { border-color: var(--accent); background: #3a3220; animation: pauseglow 1.4s ease-in-out infinite; }   /* the one way on */
@keyframes pauseglow { 50% { box-shadow: 0 0 18px #d9a441cc, 0 0 0 2px #d9a44188; background: #3a3220; } }
/* round banner: a band across the middle of the board at the start of every round */
#roundbanner { position: absolute; left: 0; right: 0; top: 50%; z-index: 6; transform: translateY(-50%); pointer-events: none; text-align: center; padding: 18px 16px;
  background: linear-gradient(90deg, transparent, var(--rb) 15%, var(--rb) 85%, transparent); border-block: 2px solid var(--rbl);
  animation: rbsweep 1.7s cubic-bezier(.2, .8, .3, 1) forwards; }
#roundbanner.day, #roundbanner.night { padding-block: clamp(30px, 5vw, 46px); }   /* room under the sun or moon, title centred */
#roundbanner.day { --rb: #3a3220ee; --rbl: #d9a44188; }
#roundbanner.night { --rb: #1c2238ee; --rbl: #6f82d988; }
#roundbanner.town { --rb: #2b2e33ee; --rbl: #c8ccd288; }   /* a settlement found: paved grey, like its tiles */
#roundbanner.town .rb-title { color: #f2f2f2; }
#roundbanner.town { animation-duration: 2.4s; }
#roundbanner.night, #roundbanner.night .rb-sky { animation-duration: 2.6s; }   /* night lingers */   /* a beat longer: there's a sign to read */
.rb-sign { margin-top: 4px; font-size: clamp(13px, 2.4vw, 17px); font-style: italic; color: #c8ccd2; }
.rb-title { font-size: clamp(28px, 6vw, 52px); font-weight: 900; letter-spacing: .04em; text-shadow: 0 4px 16px #000c; }
#roundbanner.day .rb-title { color: var(--accent); }
#roundbanner.night .rb-title { color: #b9c6ff; }
/* the sun or moon, big, sitting on the middle of the band's top line — rising into place */
.rb-sky { position: absolute; left: 50%; top: 0; translate: -50% -50%;   /* centred on the band's top line */ font-size: clamp(48px, 9vw, 84px); line-height: 1;
  animation: rbsky 1.7s cubic-bezier(.2, .8, .3, 1) both; }
#roundbanner.day .rb-sky { filter: drop-shadow(0 0 22px #ffcf5acc); }
#roundbanner.night .rb-sky { filter: drop-shadow(0 0 22px #b9c6ffaa); }
@keyframes rbsky { 0% { opacity: 0; transform: translateY(24px) scale(.8); } 25% { opacity: 1; transform: none; } 82% { opacity: 1; } 100% { opacity: 0; } }
.rb-sub { margin-top: 2px; font-size: clamp(13px, 2.4vw, 17px); color: var(--text); opacity: .85; }
@keyframes rbsweep { 0% { opacity: 0; transform: translate(-30%, -50%); } 18% { opacity: 1; transform: translate(0, -50%); } 82% { opacity: 1; transform: translate(0, -50%); } 100% { opacity: 0; transform: translate(30%, -50%); } }
#popup, #modal, #menu { position: absolute; inset: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; background: #0009; backdrop-filter: blur(3px); animation: fade .2s; cursor: pointer; z-index: 5; padding: 16px; }
.pcard { background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 20px 26px 14px; min-width: min(380px, 100%); text-align: center; box-shadow: 0 20px 60px #000c; animation: popin .3s cubic-bezier(.2, 1.6, .5, 1); }
.ptitle small { text-transform: uppercase; letter-spacing: .15em; color: var(--muted); font-size: 11px; }
.ptitle h2 { font-size: 22px; margin: 2px 0 14px; }
.prow { display: flex; align-items: center; justify-content: center; gap: 22px; }
.dicecol { display: flex; flex-direction: column; gap: 6px; }
/* sleep: the die + the tile's Safety pips (up to 4 to a row) */
.sleepsum { gap: 14px; }
.sleepsum .plus { font-size: 44px; font-weight: 900; color: var(--text); line-height: 1; }
.sleepsum .sleepsafe { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: calc(4 * 26px + 3 * 8px); margin: 0; }   /* rows of 4, each centred */
.prow2 { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 0; margin-top: 14px; }
.prow2:empty { margin: 0; }
.mult { font-size: 30px; font-weight: 800; color: var(--accent); }
.slot { width: 78px; height: 78px; display: grid; place-items: center; }
.die { width: 70px; height: 70px; background: #f4efe4; border-radius: 12px; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 9px; gap: 2px; box-shadow: inset 0 -4px 0 #0003, 0 6px 14px #0008; transform: rotate(var(--rot)); }
.die i { border-radius: 50%; margin: 3px; }
.die i.on { background: #1b1b1b; }
.die.num { display: grid; place-items: center; font-size: 34px; font-weight: 900; color: #1b1b1b; grid-template: none; }
.msg.cheat .bubble, .msg.help .bubble { border-left-color: #a259ff; color: #d8c2ff; font-size: 12px; }
.die.tumble { animation: tumble .12s linear infinite alternate; }
.die.land { transform: none; animation: land .4s cubic-bezier(.2, 1.8, .5, 1); }
.ptable { list-style: none; margin: 0; padding: 0; text-align: left; font-size: 14px; min-width: 150px; }
.ptable li { padding: 3px 10px; border-radius: 5px; transition: background .08s, transform .15s; }
.ptable li b { display: inline-block; width: 20px; color: var(--muted); }
.ptable li.z { color: var(--bad); }
.ptable li.hl { background: #ffffff1f; }
.ptable li.picked { background: var(--accent); color: #111; font-weight: 700; transform: scale(1.12); }
.ptable li.picked b { color: #111; }
.ptable li.z.picked { background: var(--bad); }
.presult { min-height: 10px; margin-top: 12px; }
.big { font-size: 38px; font-weight: 900; letter-spacing: .02em; animation: popin .35s cubic-bezier(.2, 1.8, .5, 1); }
.big.good { color: var(--good); }
.big.bad { color: var(--bad); text-shadow: 0 0 20px #f004; }
.big.jackpot { color: var(--accent); text-shadow: 0 0 24px #d9a44188; }
#popup.zombie { background: #4a0000aa; animation: redflash .5s; }
#popup.zombie .pcard { border-color: var(--bad); animation: shake .5s; }
#popup.jackpot .pcard { border-color: var(--accent); box-shadow: 0 0 40px #d9a44155, 0 20px 60px #000c; }
/* zombie contest pips in popups */
.cpips { display: flex; justify-content: center; gap: 10px; margin: 6px 0 10px; }
.cpips i { width: 26px; height: 26px; border-radius: 50%; background: #0006; border: 2px solid #f2c94c55; transition: background .2s, border-color .2s; }
.cpips i.on { background: #f2c94c; border-color: #8a6d12; box-shadow: 0 0 10px #f2c94c88; }
.cpips i.fill { animation: fillpop .35s cubic-bezier(.2, 1.8, .5, 1); }
@keyframes fillpop { 0% { transform: scale(0); } 60% { transform: scale(1.4); box-shadow: 0 0 22px #f2c94c; } }
.cpips i.burst { animation: burst .35s ease-out forwards; }
.cpips i.zed { background: #0b0b0b; border-color: #c0392b; box-shadow: 0 0 10px #c0392b88; }
.cpips i.zed.pop { animation: zpop .3s cubic-bezier(.2, 1.8, .5, 1); }
/* hiding: a zombie and a yellow pip meet in the middle and go together */
.cpips i.gone { animation: zgone .3s ease-out forwards; }
@keyframes zgone { 40% { scale: 1.3; filter: drop-shadow(0 0 10px #f2c94c); } 100% { opacity: 0; scale: .3; } }
.cpips.many { gap: 6px; }   /* a full stronghold and a full horde: smaller circles, so they fit */
.cpips.many i { width: 18px; height: 18px; }
@keyframes burst { 0% { transform: scale(1); background: #fff3b0; } 50% { transform: scale(1.5); } 100% { transform: scale(1); background: #0006; border-color: #f2c94c33; box-shadow: none; } }
@keyframes zpop { from { transform: scale(0); } }
#popup.night { background: #050a1fcc; }
#popup.dead { cursor: default; background: #1a0000e6; }
#popup.dead .pcard p { margin: 6px 0; }
#popup.dead .primary { margin-top: 12px; }
#popup.dead kbd { color: #111; border-color: #0004; }
#popup.dead .dawn { margin-top: 14px; }
/* the opening menu: Play (the Tutorial is parked) */
:is(#popup, #modal, #menu).menu { cursor: default; background: #000; backdrop-filter: none; }   /* (the world behind: hidden, not blurred) */
/* the menu, who you are, joining, are you sure?: over the whole screen — the log too, wherever it is */
#modal { position: fixed; z-index: 30; }
#menu { position: fixed; z-index: 32; }   /* (the menu over the game, ☰: over everything) */
.menucard h2 { font-size: 30px; letter-spacing: .02em; }
.menucard:has(.menuver) { position: relative; }
.menuver { position: absolute; left: 0; right: 0; top: 100%; margin-top: 10px; font-size: 12px; color: var(--muted, #8a9a90); letter-spacing: .05em; pointer-events: none; }   /* under the menu */
.menubtns { display: grid; gap: 10px; margin: 4px 0 2px; }
.menubtns button { padding: 12px; font-size: 16px; }
.menucard kbd, .tutcard .primary kbd { color: #111; border-color: #0004; }
/* your survivor (name and face), the join card, and the lobby joining (who's in) */
.menubtns .frow button { flex: 1; }
.mjoin .frow button { padding: 12px; }
.mjoin .jcode { font-weight: 700; letter-spacing: .15em; }   /* the menu's join code: a row like the others (no link) */
.mjoin .qr { width: 160px; margin: 10px auto 0; padding: 6px; background: #fff; border-radius: 8px; }
.mjoin .qr svg { display: block; width: 100%; height: auto; }
.menucard input { display: block; width: 100%; margin: 0 0 12px; padding: 10px 12px; font: inherit; font-size: 16px; text-align: center; color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: 8px; }
.menucard input:focus { outline: none; border-color: var(--accent); }
#jcode { font-size: 28px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; }
#jcode.nope { animation: shake .4s; border-color: var(--bad); }
.roster { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; min-height: 20px; margin: 0 0 14px; }
.roster span { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.roster span.me { color: var(--accent); }
.roster i.face { background: #000; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink); font-style: normal; font-size: 15px; }
.faces { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 0 12px; }   /* (one face for each way in: centred, however many) */
.faces button { flex: 0 0 calc((100% - 30px) / 6); }
.faces button { padding: 4px 0; font-size: 24px; line-height: 1.3; background: var(--bg); border: 2px solid var(--line); border-radius: 8px; }
.faces button:disabled { opacity: .3; cursor: default; }   /* someone else's already */
.faces button.sel { border-color: var(--accent); background: var(--panel2); box-shadow: 0 0 10px #d9a44155; }
.lwait { font-size: 26px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
/* waiting to join a game under way: the day's rounds (night ones dark), then the dawn you come in at */
.dawn { display: flex; align-items: center; justify-content: center; gap: 5px; }
.dawn i { width: 22px; height: 10px; border-radius: 5px; border: 2px solid var(--accent); }
.dawn i.night { border-color: var(--muted); }
.dawn i.past { background: var(--accent); }
.dawn i.night.past { background: var(--muted); }
.dawn i.now { animation: pulse 1.4s ease-in-out infinite; background: var(--accent); }
.dawn i.night.now { background: var(--muted); }
.dawn b { font-size: 24px; margin-left: 4px; }
.survivor circle { fill: #000; stroke: var(--ink); stroke-width: 3; }
.survivor.me circle { stroke: #fff; }
/* someone else: their outline is their AP, in the clock ring's colours (apLevel) — how strong they are (trading: accent) */
.survivor:is(.ap-full, .ap-high):not(.mate) circle { stroke: #4cd964; }
.survivor.ap-mid:not(.mate) circle { stroke: #f0922b; }
.survivor.ap-low:not(.mate) circle { stroke: #ff3b30; }
.survivor.bot:not(.mate) circle { stroke: #8a8f98; }   /* others in the world (bots): grey */
/* turning: the face fades out as a zombie fades in, where they lay */
.survivor.turning .was { animation: turnout .9s ease-in forwards; }
.survivor.turning .zed { opacity: 0; animation: turnin .9s ease-out .3s forwards; }
@keyframes turnout { to { opacity: 0; filter: grayscale(1) blur(2px); } }
@keyframes turnin { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.survivor.turning text { transform-box: fill-box; transform-origin: center; }
.survivor.dim { opacity: .45; filter: grayscale(1); }   /* someone else is doing something (the fortify hex) */
.survivor text { font-size: 28px; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
/* asleep this round: three z's, growing, drifting up off the top right of the face one after another */
.survivor .zzz text { font-size: calc(13px + var(--i) * 4px); font-weight: 900; font-style: italic; fill: #cfe3ff; stroke: #0b1a2a; stroke-width: 3px; paint-order: stroke;
  transform-box: fill-box; transform-origin: center; animation: zfloat 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * .5s); opacity: 0; }
.survivor text.blood { font-size: 14px; }   /* infected */
.survivor text.did { font-size: 19px; filter: drop-shadow(0 1px 2px #000) drop-shadow(0 0 1px #000); transform-box: fill-box; transform-origin: 50% 80%; }
.survivor .did.scavenge { animation: didsearch 2.2s ease-in-out infinite; }
.survivor .did.fortify { animation: didknock 1.1s ease-in-out infinite; transform: scaleX(-1); }
.survivor .did.scout { animation: didbob 2.4s ease-in-out infinite; }
@keyframes didsearch { 0%, 100% { translate: -3px 0; rotate: -10deg; } 50% { translate: 3px -2px; rotate: 10deg; } }
@keyframes didknock { 0%, 60%, 100% { rotate: 0deg; } 30% { rotate: 35deg; } }
@keyframes didbob { 50% { translate: 0 -3px; } }
.hex .pip.pop { transform-box: fill-box; transform-origin: center; animation: pippop .35s cubic-bezier(.2, 1.8, .5, 1); }   /* someone else's fortify filling */
@keyframes zfloat { 0% { opacity: 0; translate: -3px 5px; scale: .6; } 25%, 70% { opacity: 1; } 100% { opacity: 0; translate: 4px -7px; scale: 1.1; } }
/* everyone on the tile, in their map seats at map size (black discs, you in a white ring) */
.bf-you, .bf-mate { position: absolute; translate: -50% -50%; display: grid; place-items: center; width: 20.4cqw; height: 20.4cqw; border-radius: 50%;
  background: #000; border: 1.33cqw solid var(--ink); font-size: 12.4cqw; line-height: 1; }   /* (the map's: a 23 disc, 28 face, on a hex 225 wide) */
.bf-you { border-color: #fff; }
#battle .bf-walk ~ .bf-you { transition: top .45s ease-in-out; }   /* backing off, as they come through the wall */
#battle[data-stage="fight"] .bf-safe { top: 31%; }   /* a fight's wall: up, just under the horde (game.js's ZED_EDGE, YOU_BACK) */
.bf-mate:is(.ap-full, .ap-high) { border-color: #4cd964; }   /* their AP, as on the map */
.bf-mate.ap-mid { border-color: #f0922b; }
.bf-mate.ap-low { border-color: #ff3b30; }
/* a weapon in use: off the top right of whoever's using it, for the kill (a blade swings, a gun kicks) */
.bf-weapon { position: absolute; left: 72%; top: -18%; font-size: 10cqw; line-height: 1; filter: drop-shadow(0 .5cqw .8cqw #000); transform-origin: 30% 80%; }
.bf-weapon.swing { animation: wswing .6s ease-out; }
.bf-weapon.throw { animation: wkick 1s ease-in-out infinite; }   /* a rescue's 🛟 */
/* infected: 🩸 (bitten) or 🤢 (sick) by the face, top left — as on the map */
.bf-blood { position: absolute; left: -3cqw; top: -3cqw; font-size: 6cqw; line-height: 1; pointer-events: none; }
.bf-weapon.shoot { animation: wkick .6s ease-out; }
@keyframes wswing { 0% { opacity: 0; rotate: -40deg; } 20% { opacity: 1; rotate: -40deg; } 55% { rotate: 45deg; } 100% { rotate: 20deg; } }
@keyframes wkick { 0% { opacity: 0; scale: .6; } 20% { opacity: 1; scale: 1; } 35% { rotate: -25deg; translate: -1cqw 0; } 60%, 100% { rotate: 0deg; translate: 0 0; } }
/* got away: the hexes you can run to, as their keys on the zombie screen's edges */
.bf-pick { position: absolute; translate: -50% -50%; display: grid; place-items: center; width: 12cqw; height: 12cqw; padding: 0; border-radius: 50%;
  background: var(--accent); border: .8cqw solid #6b4e12; color: #111; font-size: 6.5cqw; font-weight: 900; line-height: 1; cursor: pointer; z-index: 2;
  animation: pickpulse 1.2s ease-in-out infinite; box-shadow: 0 0 3cqw #d9a441aa; }
.bf-you.escaped::after, .bf-mate.escaped::after { content: '🏃'; position: absolute; right: -1.5cqw; bottom: -.5cqw; font-size: 7cqw; }   /* got away, not yet gone */
/* tutorial cards: what an action or item does, the first time */
:is(#popup, #modal, #menu).tut { cursor: default; }
.tutcard { max-width: min(460px, 100%); border-color: #4aa8ff88; }
.tutcard h2 { display: flex; align-items: center; justify-content: center; gap: 8px; }
.tutic { font-size: 30px; line-height: 1; }
.tutic .iimg { width: 32px; height: 32px; }
.tutcard p { text-align: left; margin: 0 0 10px; line-height: 1.5; }
.tutcard .frow { margin-top: 14px; }
#popup.night.zombie { background: #3a0010cc; }
.ribbon.threat { border-color: var(--bad); box-shadow: 0 0 30px #c0392b66, 0 10px 30px #000a; }
/* Fight or Flee: the choice moves to the middle of the board, bigger, with a red vignette behind it */
#board.threat::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(ellipse at center, #4a000033 0%, #3a000099 100%); animation: fade .3s; }
#board.threat #notes .note { font-size: 15px; padding: 8px 14px; }
/* in a fight, Flee and Hide stand in for Move and Fortify — lit red, the rest greyed; their odds are in the tooltip */
.ribbon.main.threat .act:not(:disabled) { border-color: var(--bad); background: #3a1a18; box-shadow: 0 0 12px #e86a5a55; }

/* backpack */
/* right column runs down the board; --dockh (set in game.js) lifts its bottom clear of the action dock when they'd overlap */
#rightcol { position: absolute; top: var(--gap); right: var(--gap); bottom: calc(var(--dockh, 0px) + var(--packh, 0px) + 2 * var(--gap)); z-index: 3; width: var(--col); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
#pack { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; pointer-events: auto; padding: 12px; background: var(--panel-a); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px #000a; }
#playersbox { flex-shrink: 0; }
#playersbox > summary { cursor: pointer; list-style: none; user-select: none; }
#playersbox > summary::-webkit-details-marker { display: none; }
#playersbox > summary::before { content: '▸'; display: inline-block; width: 16px; font-size: 1.4em; line-height: 0; vertical-align: -1px; }
#playersbox[open] > summary::before { content: '▾'; }
#players { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px; max-height: 40vh; overflow-y: auto; border-bottom: 1px solid var(--line); }
.prow-pl { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; }
.prow-pl i.face { background: #000; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-style: normal; font-size: 13px; }
.prow-pl em { font-style: normal; color: var(--muted); font-weight: 400; }
.prow-pl small { color: var(--muted); white-space: nowrap; }
.prow-pl.me { border-color: #d9a44166; }
.prow-pl.dead { opacity: .5; }
.joinbox { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; }
.joinbox .jrow { display: flex; gap: 8px; }
.joinbox .jcode { flex: 1; padding: 0; background: none; border: 0; text-align: left; font-size: 18px; font-weight: 700; letter-spacing: .15em; }
.joinbox .qr { width: min(140px, 100%); padding: 6px; background: #fff; border-radius: 8px; }
.joinbox .qr svg { display: block; width: 100%; height: auto; }
.joinbox .lnk { padding: 0; background: none; border: 0; color: var(--muted); font: 12px/1.4 ui-monospace, monospace; text-align: left; word-break: break-all; }
.joinbox .lnk:hover { color: var(--text); }
.packhead { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding-left: 2px; }
button.packhead { display: flex; align-items: center; gap: 6px; width: 100%; padding: 0 0 0 2px; background: none; border: 0; border-radius: 0; text-align: left; cursor: default; }
.packhead .packicons, .packhead .caret, .packhead .bag { display: none; }
.packhead .packname { white-space: nowrap; }
/* desktop: the backpack is a bar of six slots just above the action bar (tablets and phones have their own, below) */
@media (not (pointer: coarse)) and (orientation: landscape) and (min-width: 1101px) and (min-height: 501px) {
  /* the right column dissolves: the resources are a row along the top left, each label over its number */
  #rightcol { display: contents; }
  #stats { position: absolute; z-index: 3; top: var(--gap); left: calc(var(--gap) + 6px); flex: none; container-type: normal; flex-direction: row; align-items: flex-start;
    gap: 26px; pointer-events: none; }
  #stats .stat { --o: 58px; flex-direction: column-reverse; gap: 4px; }   /* (label first) */
  /* the backpack and the action bar are the same width: six 150px slots, or the board's width if that's less */
  #board { --barw: min(962px, calc(100cqw - 2 * var(--gap))); }
  #pack { position: absolute; z-index: 3; left: var(--gap); right: var(--gap); bottom: calc(var(--dockh, 0px) + var(--gap) / 2); width: var(--barw);
    margin-inline: auto; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: center; gap: 8px; padding: 8px 10px; }
  #pack button.packhead { display: none; }   /* six slots say it all */
  /* the main actions: equal buttons, just name and key — the details (cost, what's left) are in each one's tooltip */
  .ribbon.main { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: var(--barw); padding: 8px; }
  .ribbon.main .act { align-items: center; padding: 10px 14px; }
  .ribbon.main .act small { display: none; }
  /* each slot: the icon (Use / Take / Drink as a badge under it), its name over its condition, leave (✕) at the right */
  #pack .slot-item { display: grid; grid-template: auto auto / auto minmax(0, 1fr) auto; grid-template-areas: "ic name drop" "ic pips pips";
    align-items: center; column-gap: 6px; row-gap: 3px; height: 50px; min-width: 0; padding: 4px 4px 4px 6px; }
  #pack .slot-item.empty { display: block; }
  #pack .slot-item .ic { grid-area: ic; align-self: start; justify-self: center; }
  #pack .slot-item div { display: contents; }
  #pack .slot-item b { grid-area: name; overflow: hidden; text-overflow: ellipsis; }
  #pack .slot-item .cond { grid-area: pips; }
  #pack .slot-item .use { grid-area: ic; align-self: end; justify-self: center; z-index: 1; padding: 0 3px; font-size: 9px; line-height: 1.35; border-radius: 4px; }
  #pack .slot-item .use kbd { display: none; }
}
.slot-item { display: flex; align-items: center; gap: 8px; height: 42px; padding: 4px 6px 4px 8px; background: var(--panel-a); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 12px #0007; }
.slot-item.empty { background: #ffffff06; border-style: dashed; box-shadow: none; }
.slot-item { position: relative; }
.slot-item .slotkey { position: absolute; top: -7px; left: -6px; margin: 0; padding: 0 4px; background: var(--panel); line-height: 1.4; }
.slot-item.sel { border-color: var(--accent); background: #3a3220; animation: selpulse 1.2s ease-in-out infinite; }
.slot-item.sel .slotkey { color: #111; background: var(--accent); border-color: var(--accent); }
.slot-item.sel::after { content: 'Enter ↵'; position: absolute; top: -9px; right: 8px; font-size: 10px; font-weight: 700; background: var(--accent); color: #111; padding: 0 6px; border-radius: 4px; }
.slot-item .ic { font-size: 22px; }
.iimg { width: 1.15em; height: 1.15em; vertical-align: -0.2em; object-fit: contain; }   /* an item's own picture, sized like an emoji */
.slot-item div { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.slot-item b { font-size: 12.5px; white-space: nowrap; }
.slot-item .cond { flex-shrink: 0; }
.slot-item button { flex-shrink: 0; }
/* no Drink / Take / Use / Hope / Fire tags anywhere: clicking the item does it (the button stays, hidden, for keys) */
#pack .slot-item .use { display: none !important; }
#pack .slot-item.usable, #pack .slot-item.pickable { cursor: pointer; }
#pack .slot-item.usable:hover { border-color: var(--accent); }
.slot-item .use { padding: 2px 6px; font-size: 11px; font-weight: 700; color: #111; background: var(--accent); border-color: var(--accent); }
.slot-item .use kbd { margin-left: 3px; color: #111; border-color: #0004; }
/* messages: up top, under the timer — notes for what's going on, and toasts */
#msgs { position: absolute; z-index: 4; top: var(--gap); left: var(--gap); right: var(--gap); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
#notes { display: contents; }
#notes .note { margin: 0; box-shadow: 0 4px 12px #0008; background: var(--panel-a); border: 1px solid var(--line); }
:is(#toast, #mtoast) { position: relative; transform: translateY(-10px); z-index: 6; width: max-content; max-width: calc(100vw - 32px); text-align: center; padding: 8px 14px; border-radius: 8px; background: var(--panel-a); border: 1px solid var(--accent); box-shadow: 0 8px 24px #000a; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
:is(#toast, #mtoast).show { opacity: 1; transform: none; }
#mtoast { position: fixed; z-index: 33; top: 16px; left: 50%; translate: -50% 0; }   /* (over a full-screen card) */
/* someone's note while the log's closed: a chat bubble (as in the log) under the toast — tap it to open the log */
#chattoast { display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 6px 12px 6px 6px; border-radius: 10px 4px 10px 10px;
  background: #2a3b52ee; border: 1px solid #3b5577; box-shadow: 0 8px 24px #000a; pointer-events: auto; cursor: pointer; animation: msgin .25s ease-out; }
#chattoast:not(.show) { display: none; }
#chattoast i.face { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #000; font-style: normal; font-size: 15px; flex-shrink: 0; }
#chattoast b { color: var(--muted); font-size: 12px; white-space: nowrap; }
#chattoast span { overflow-wrap: anywhere; }
/* a Note's words: they stay up till a later round ends (noteCard) */
#notecard { width: max-content; max-width: calc(100vw - 32px); text-align: center; padding: 8px 14px; border-radius: 8px; background: var(--panel-a); border: 1px solid var(--hope); box-shadow: 0 8px 24px #000a; }
.cond { display: inline-flex; gap: 2px; vertical-align: middle; }
.cond i { width: 8px; height: 8px; border-radius: 50%; background: #ffffff1a; }
.cond i.on { background: var(--accent); }
.hex .cell.it { fill: var(--accent); font-weight: 700; }
.ptable li.it { color: var(--accent); }
.ptable li.it.picked, .ptable li.stash.picked { color: #111; }   /* a picked item or stash row: dark on gold, like the rest */
/* hope is purple: hope items' pips, their rows on a table, a place a Note leads to, and the night's question */
:root { --hope: #c084ff; }
.cond.hope i.on { background: var(--hope); }
/* a Note losing hope (its place reached): it glows purple and its pips go out */
.losehope { border-color: var(--hope) !important; box-shadow: 0 0 14px #c084ff88 !important; background: #2e2140 !important; }
.cond i.going { animation: pipout .25s ease-in forwards; }
/* a Note new to the backpack, not yet read: it glows purple to be noticed (its first round) */
.newnote { border-color: var(--hope) !important; animation: notepulse 1.4s ease-in-out infinite; }
@keyframes notepulse { 50% { box-shadow: 0 0 16px #c084ffaa; background: #2e2140; } }
@keyframes pipout { 40% { scale: 1.5; } to { scale: 1; background: #ffffff1a; box-shadow: none; } }
.hex .cell.hope { fill: var(--hope); font-weight: 700; }
.ptable li.hope { color: var(--hope); }
.ptable li.hope.picked { color: #111; background: var(--hope); }
.hex.lead polygon { stroke: var(--hope); stroke-width: 5; filter: drop-shadow(0 0 10px #c084ffaa); animation: leadglow 2.4s ease-in-out infinite; }
@keyframes leadglow { 50% { filter: drop-shadow(0 0 3px #c084ff55); } }
#leadmarks { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
/* the battlefield: the tile come forward — hex-shaped, grown from the tile to fill the open space above the bars
   (which stay clear). No words: just the horde, the die and your Safety. Sized off its width (cqw). */
#battle { position: absolute; z-index: 4; container-type: size;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--line); }   /* (its edge: your colour, set in bfOpen) */
/* while it's open the board goes out of focus but for the bars (and a toast, if one comes up); the log stays sharp */
#map, #clock, #notes > *, #stats, #leadmarks { transition: filter .3s; }
body.battling :is(#map, #clock, #notes > *, #stats, #leadmarks) { filter: blur(3px); }
body.battling #clock { filter: drop-shadow(0 6px 14px #000a) blur(3px); }   /* (its shadow kept, so it eases in) */
#battle::before { content: ''; position: absolute; inset: 1.4cqw; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: var(--tilebg, #3d4a33); }   /* the place's own colour (bfOpen: read off its hex on the map) */
.bf-in { position: absolute; inset: 9% 10% calc(50% + 12cqw); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }   /* (the horde: centred in the space above the die) */
.bf-horde { --zs: 11cqw; font-size: var(--zs); display: flex; flex-wrap: wrap; justify-content: center; gap: .1em .2em; max-width: 4em; min-height: 1.2em; }   /* (three to a row) */
.bf-horde .z { position: relative; font-style: normal; width: 1.2em; line-height: 1.15; display: inline-block; text-align: center; transition: transform .38s ease-in, opacity .38s ease-in; }
.bf-horde .z.pop { animation: zpop .3s cubic-bezier(.2, 1.8, .5, 1); }
/* the horde walking in: each zombie down its own lane (left / top set by bfLayout), a step at a time */
.bf-horde.bf-walk { position: absolute; inset: 0; display: block; max-width: none; min-height: 0; --zs: 9cqw; pointer-events: none; }
.bf-walk .z { position: absolute; translate: -50% -50%; width: auto; line-height: 1;
  transition: left .45s ease-in-out, top .45s ease-in-out, transform .38s ease-in, opacity .38s ease-in; }
/* in a fight the dice stand aside, right of the lanes, so the horde can walk down past them */
#battle[data-stage="fight"] .bf-mid { left: 87%; flex-direction: column; align-items: center; gap: 1cqw; }
#battle[data-stage="fight"] .bf-mid :is(.slot, .bf-face) { width: 14cqw; height: 14cqw; }
#battle[data-stage="fight"] .bf-mid .plus { font-size: 7cqw; line-height: 1; }
.bf-horde .z.shot::after { content: '💥'; position: absolute; left: 50%; top: 45%; translate: -50% -50%; font-size: 1.2em; animation: bang .3s ease-out both; }
/* a blade (or a chainsaw): 💢 */
.bf-horde .z.cut::after { content: '💢'; position: absolute; left: 50%; top: 40%; translate: -50% -50%; font-size: .9em; animation: bang .3s ease-out both; }
@keyframes bang { from { scale: .2; opacity: 0; } 50% { scale: 1.3; opacity: 1; } to { scale: 1; } }
.bf-horde .z.fall { transform: rotate(90deg) translateX(30%); opacity: 0; }
.bf-horde .z.gone, .bf-safe i.gone { animation: zgone .25s ease-out forwards; }
/* the die, while one's rolling — its space kept, so nothing jumps */
.bf-mid { position: absolute; left: 50%; top: 50%; translate: -50% -50%; display: flex; gap: 4cqw; }   /* the die (or dice): dead centre */
.bf-mid .slot, .bf-top .slot { width: 19cqw; height: 19cqw; flex: none; }
#battle .slot .die { width: 100%; height: 100%; padding: 14%; border-radius: 16%; }
#battle .slot .die i { margin: 8%; }
.bf-die:empty { display: none; }
/* your Safety: fixed where the pips sit on your hex on the map — in a row 82% of the way down, the same size and spacing
   in proportion (a 13px pip, 17px apart, on a 208px-wide hex; smaller and closer when there are more, as there) */
.bf-safe { position: absolute; left: 0; right: 0; top: 64.6%;   /* (where the map has them) */ translate: 0 -50%; display: flex; justify-content: center; gap: 1.78cqw; }
.bf-safe i { width: 5.77cqw; height: 5.77cqw; border-radius: 50%; background: #f2c94c; border: .5cqw solid #8a6d12; box-shadow: 0 0 10px #f2c94c88; }
.bf-safe.n7 { gap: 1.33cqw; } .bf-safe.n7 i { width: 5.33cqw; height: 5.33cqw; }
/* you, down in the bottom point under your Safety */
/* the tile come forward for other things than a fight (bfStage): Sleep, Fortify, Scavenge */
.bf-safe i.off { background: #0006; border-color: #f2c94c66; box-shadow: none; }   /* room to fortify */
.bf-safe i.fill { animation: fillpop .35s cubic-bezier(.2, 1.8, .5, 1); }
.bf-safe i.count { animation: pipcount .3s ease-out; }
@keyframes pipcount { 50% { scale: 1.45; box-shadow: 0 0 3cqw #f2c94c; } }
/* the action hex (Sleep, Fortify, Find): the tile as it is on the board (an SVG drawn the same way, but for its name
   and anyone else), the dice up top where the name was, the action in the middle, you in your seat at the bottom */
#battle:is([data-stage="sleep"], [data-stage="fortify"], [data-stage="scav"]) { background: none !important; }
#battle:is([data-stage="sleep"], [data-stage="fortify"], [data-stage="scav"])::before { display: none; }
.bf-top { position: absolute; left: 50%; top: 21.9%; translate: -50% -50%; display: flex; align-items: center; gap: 3cqw; }   /* (where the name sits) */
.bf-top .slot { width: 13cqw; height: 13cqw; }
.bf-top .mult { font-size: 6cqw; }
#battle[data-stage="scav"] .bf-top { top: 18%; }   /* (clear of the table's top) */
/* sleep: the die + your Safety as a die face in the middle, the ⚡ they come to counted up top */
#battle[data-stage="sleep"] .bf-mid { align-items: center; }
.bf-mid .plus { font-size: 10cqw; font-weight: 900; color: var(--muted); }
.bf-top .gain { font-size: 11cqw; font-weight: 900; color: #5ee87a; text-shadow: 0 .5cqw 0 #000, 0 0 3cqw #000; white-space: nowrap; }
.bf-face { width: 19cqw; height: 19cqw; padding: 2.6cqw; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); border-radius: 16%;
  border: .5cqw solid #f2c94c55; background: #0005; }
.bf-face i { border-radius: 50%; margin: 10%; }
.bf-face i.on { background: #f2c94c; box-shadow: 0 0 1.4cqw #f2c94c88; }
.bf-face i.count { animation: pipcount .3s ease-out; }
/* fortify: the place's picture and Safety pips; the pips fill one at a time, the 🔨 knocking off the top right of
   your face (as the map shows it after), a knock each */
#battle .hm { position: absolute; translate: -50% -50%; font-size: 12cqw; line-height: 1; transform: scaleX(-1); transform-origin: 50% 80%;
  filter: drop-shadow(0 .6cqw 1cqw #000a); pointer-events: none; }
#battle .hm.hit { animation: hammer .3s ease-out; }
.bf-tile .pip.fill { transform-box: fill-box; transform-origin: center; animation: pippop .35s cubic-bezier(.2, 1.8, .5, 1); }
@keyframes pippop { 0% { transform: scale(0); } 60% { transform: scale(1.7); } }
@keyframes hammer { 40% { rotate: 35deg; } 70% { rotate: -12deg; } }   /* (on the mirrored 🔨: down and away) */
/* find: what you found over the faded table */
.bf-tile { position: absolute; inset: 0; width: 100%; height: 100%; }
.bf-tile .tblrows { transition: opacity .3s; } .bf-tile .tblrows.done { opacity: .06; }
.trow .rhl { fill: transparent; transition: fill .08s; }
.trow.hl .rhl { fill: #ffffff26; }
.trow.picked .rhl { fill: var(--accent); } .trow.z.picked .rhl { fill: var(--bad); } .trow.hope.picked .rhl { fill: var(--hope); }
.hex .trow.picked .cell, .hex .trow.picked .cell .n { fill: #111; font-weight: 800; }
.trow.nope { animation: nope .3s; } .hex .trow.nope .cell { fill: var(--bad); }
/* what scavenging found: big, filling the middle of the hex (between the die and you) — an icon, what it is or
   how many under it, its condition; a mix (Food + Water) side by side, a little smaller */
.bf-res { position: absolute; left: 50%; top: 31.7%; translate: -50% 0; width: 84cqw; display: flex; justify-content: center; align-items: flex-start; gap: 6cqw;   /* (the icon's top held in place) */
  text-align: center; font-weight: 900; line-height: 1.15; text-shadow: 0 .5cqw 0 #000, 0 0 3cqw #000; }
.bf-res:empty { display: none; }
.bf-res > * { animation: popin .35s cubic-bezier(.2, 1.8, .5, 1); }
.bf-res .fd { display: flex; flex-direction: column; align-items: center; gap: 1.5cqw; min-width: 0; }
.bf-res .fi { font-size: 24cqw; line-height: 1; margin-bottom: 2.5cqw; }   /* what it is / how many: under it — the lot clear of your face below */
.bf-res .fi:empty { display: none; }
.bf-res .fn { font-size: 8cqw; }
.bf-res.two .fi { font-size: 16cqw; } .bf-res.two .fn { font-size: 6cqw; }
.bf-res.bad { top: 50%; translate: -50% -50%; } .bf-res.bad .fn { font-size: 13cqw; }   /* Nothing: in the middle */
.bf-res.good { color: #5ee87a; } .bf-res.bad { color: #ff5a4a; } .bf-res.jackpot { color: var(--accent); }
.bf-res small { display: block; font-size: 5cqw; font-weight: 600; color: var(--text); }
.bf-res .cond { gap: 1cqw; } .bf-res .cond i { width: 4.2cqw; height: 4.2cqw; }
.bf-res.two .cond i { width: 3.2cqw; height: 3.2cqw; }
/* how a flee went: one big word under the die, so the roll still shows (the zombies can rush you behind it) */
.bf-word { position: absolute; left: 50%; top: 70%; translate: -50% -50%; z-index: 2; white-space: nowrap; font-size: 12cqw; font-weight: 900;
  letter-spacing: .02em; text-shadow: 0 .6cqw 0 #000, 0 0 3cqw #000; animation: wordin .35s cubic-bezier(.2, 1.6, .4, 1) both; pointer-events: none; }
.bf-word.good { color: #5ee87a; } .bf-word.bad { color: #ff5a4a; }
@keyframes wordin { from { scale: .3; opacity: 0; } }
/* with no Safety left you're out in the open: up where the pips were, shaking */
.bf-you.bare { animation: shiver .18s linear infinite; }   /* backed into the corner */
.bf-you.down { animation: none; transition: rotate .4s ease-in, opacity .6s ease-in .3s; rotate: 90deg; opacity: 0; }   /* the end */
@keyframes shiver { 25% { transform: translateX(-6%) rotate(-5deg); } 75% { transform: translateX(6%) rotate(5deg); } }
.bf-safe.n9 { gap: .89cqw; } .bf-safe.n9 i { width: 4.44cqw; height: 4.44cqw; }

.leadmark { position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; display: grid; place-items: center; border-radius: 50%;
  background: #241038e6; border: 2px solid var(--hope); box-shadow: 0 0 14px #c084ff88; }
.leadmark span { font-size: 20px; line-height: 1; }
/* another survivor out of view: their face on the ring, pointing their way */
.leadmark.playermark { background: #000; border-color: #d8d8d8; box-shadow: 0 0 10px #0009; }
.leadmark.playermark i::after { border-left-color: #e8e8e8; }
/* fog of war: a hex out of sight, shown as you last saw it */
.hex.tile.stale { filter: saturate(.45) brightness(.7); }
/* locked out of a hex (greyed, its 🔒 on the picture) — or shut in one, and every other hex greyed */
/* a way in's nudge: the action to try first, glowing purple till you've used it (shown, not said) */
.act.nudge { border-color: #b57bff; box-shadow: 0 0 0 2px #b57bff66, 0 0 14px #9b5de5; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { box-shadow: 0 0 0 3px #b57bffaa, 0 0 22px #b57bff; } }
/* a generator running: lit up */
.hex.tile.powered polygon { filter: drop-shadow(0 0 10px #ffe066); }
.hex.tile.powered .art { filter: drop-shadow(0 0 12px #ffe066) drop-shadow(0 4px 6px #0008); }
.hex.tile.shut { filter: grayscale(1) brightness(.55); }
.lockmark { font-size: 20px; text-anchor: middle; dominant-baseline: central; pointer-events: none; filter: drop-shadow(0 1px 2px #000); }
.leadmark i { position: absolute; inset: 0; }
.leadmark i::after { content: ''; position: absolute; right: -11px; top: 50%; margin-top: -6px; border: 6px solid transparent; border-left: 9px solid var(--hope); }
/* the night asks for hope: chosen in the backpack — hope items lit purple, the rest greyed out */
.note.hope { color: var(--hope); border: 1px solid #c084ff66; }
#pack.hoping { border-color: var(--hope); box-shadow: 0 0 24px #c084ff55, 0 10px 30px #000a; }
#pack .slot-item.greyed { opacity: .3; filter: grayscale(1); }
#pack .slot-item.pickable { cursor: pointer; }
#pack .slot-item.hope { border-color: var(--hope); }
#pack .slot-item .use.hope { background: var(--hope); border-color: var(--hope); }
/* zombies on you: the weapons you can use light up red in the backpack; flee is the one button left in the middle */
#pack.fighting { border-color: var(--bad); box-shadow: 0 0 24px #e86a5a55, 0 10px 30px #000a; }
#pack .slot-item.fight { border-color: var(--bad); box-shadow: 0 0 10px #e86a5a66; }
#pack .slot-item .use.fight { background: var(--bad); border-color: var(--bad); color: #fff; }
/* a Tool in hand (tap and tap): it's lit; what it can mend lights up green — in the backpack, and the vehicles' buttons */
#pack.mending { border-color: var(--good); box-shadow: 0 0 24px #7bc47f44, 0 10px 30px #000a; }
#pack .slot-item.toolon { border-color: var(--accent); background: #3a3220; box-shadow: 0 0 12px #f2c94c66; cursor: pointer; }
#pack .slot-item.mend { border-color: var(--good); }
#pack .slot-item .use.mend { background: var(--good); border-color: var(--good); }
.act.mend { border-color: var(--good); box-shadow: 0 0 10px #7bc47f55; }
.act .cond { margin-top: 4px; }   /* a vehicle's condition, under its button's words */
/* 💬 Say open: what can be said lights up blue — the action buttons, the resource numbers, the backpack (and any hex) */
#pack.saying { border-color: #6ab8ff; box-shadow: 0 0 24px #6ab8ff44, 0 10px 30px #000a; }
#pack .slot-item.say { border-color: #6ab8ff; }
#pack .slot-item .use.say { background: #6ab8ff; border-color: #6ab8ff; }
.act.sayable { border-color: #6ab8ff; }
#stats.saying .stat { cursor: pointer; }
#stats.saying .stat .orb { filter: drop-shadow(0 0 6px #6ab8ff); }
/* what's said: a bubble off the top left of the face; a hex pointed at: 📍 on it (and on the ring, out of view) */
.survivor .says path { fill: #f4f1ea; stroke: #0b1a2a; stroke-width: 2; }
.survivor .says text { font-size: 17px; text-anchor: middle; dominant-baseline: central; }
.survivor .says.pop { transform-box: fill-box; transform-origin: 70% 100%; animation: saypop .4s cubic-bezier(.2, 1.8, .5, 1); }
@keyframes saypop { from { transform: scale(0); } }
.saypin { font-size: 30px; text-anchor: middle; dominant-baseline: central; pointer-events: none; filter: drop-shadow(0 2px 3px #000a); }
.leadmark.saymark { background: #0b1a2a; border-color: #6ab8ff; box-shadow: 0 0 14px #6ab8ff88; }
.leadmark.saymark i::after { border-left-color: #6ab8ff; }
/* looted rows are crossed off; stashes stand out */
.hex .cell.looted { opacity: .35; text-decoration: line-through; }
.ptable li.looted { opacity: .4; text-decoration: line-through; }
.ptable li.nope { opacity: .8; color: var(--bad); animation: nope .3s; }
.hex .cell.stash { fill: #8fd3ff; font-weight: 700; }
.ptable li.stash { color: #8fd3ff; font-weight: 700; }
.stashgot { font-size: 22px; margin-top: 4px; }

/* fight */
#popup.fight { background: #1a0505cc; cursor: default; }
#popup.fight .pcard { border-color: var(--bad); }
.cpips i.dead { background: transparent; border: 2px dashed #c0392b55; }
.cpips i.hit { animation: hit .35s ease-out; }
@keyframes hit { 0% { transform: scale(1.6); background: #ff3b30; } 100% { transform: scale(1); } }
.pcard.flash { animation: flash .18s; }
@keyframes flash { 0% { box-shadow: 0 0 80px #ffd27a, 0 20px 60px #000c; background: #3a2a10; } }
.fammo { margin: 6px 0 12px; color: var(--muted); }
.fammo b { color: var(--good); font-size: 20px; }
.frow { display: flex; gap: 8px; }
.fammo b.warnap { color: var(--bad); }
.frow small { opacity: .7; font-weight: 400; }
.frow .primary { flex: 2; }
.frow button { flex: 1; padding: 10px; }
.frow kbd { color: inherit; }

@keyframes fade { from { opacity: 0; } }
@keyframes popin { from { transform: scale(.6); opacity: 0; } }
@keyframes tumble { from { transform: rotate(-18deg) translateY(-4px); } to { transform: rotate(18deg) translateY(3px); } }
@keyframes land { from { transform: scale(1.5) rotate(25deg); } }
@keyframes shake { 0%, 100% { transform: none; } 15% { transform: translate(-12px, 4px) rotate(-2deg); } 30% { transform: translate(10px, -4px) rotate(2deg); } 45% { transform: translate(-8px, 2px); } 60% { transform: translate(6px, -2px); } 75% { transform: translate(-3px, 1px); } }
@keyframes redflash { 0% { background: #c00c; } 100% { background: #4a0000aa; } }

/* ---------------------------------------------------------------- responsive
   Desktop (≥1200px wide): log docks beside the board.
   Tablet landscape / small laptop (900–1199px): narrower docked log; overlays shrink.
   Tablet portrait (<900px): log slides over the board as a drawer.
   Phone (≤640px wide, or ≤500px tall in landscape): full-screen log.
   Touch screens, and any window that's upright, ≤1100px wide or ≤500px tall (a snapped desktop window too),
   use the touch layout (end of file). */
@media (min-width: 900px) and (max-width: 1199px) {
  body.log-open main { grid-template-columns: 1fr 320px; }
}
@media (max-width: 899px) {
  main, body.log-open main { grid-template-columns: 1fr; }
  #panel { position: absolute; top: 0; right: 0; bottom: 0; z-index: 10; width: min(380px, 100%); box-shadow: -12px 0 40px #000a; }
}
@media (max-width: 1100px), (max-height: 860px) {
  :root { --clock: 240px; --col: 220px; }   /* (desktop: 20% up from 200; the touch layouts set their own below) */
  .slot-item { height: 38px; }
  .slot-item .ic { font-size: 19px; }
}
/* touch screens: no keyboard hints */
@media (hover: none) and (pointer: coarse) {
  kbd, .act.sel::after, .slot-item.sel::after { display: none; }
}
@media (max-width: 640px), (max-height: 500px) {
  :root { --gap: 8px; --clock: 104px; --orbmax: 48px; }
  #panel { width: 100%; }
  kbd, .act.sel::after, .slot-item.sel::after { display: none; }
  /* resources: one tight row */
  #pack { padding: 8px; border-radius: 10px; }
  .stat { gap: 8px; }
  .stat small { font-size: 10.5px; }
  .delta { font-size: 14px; }
  /* actions */
  .ribbon { padding: 8px 6px 6px; gap: 5px; }
  .act { padding: 6px 8px; flex: 1 1 auto; }
  .act b { font-size: 13px; }
  .act small { font-size: 10.5px; }
  #actions .note { font-size: 12px; }
  .pcard { padding: 16px 14px 12px; }
}
/* ---------------------------------------------------------------- touch layout (phones and tablets, either way up)
   The map fills the board under everything (game.js frames the open space, #mapframe). As on desktop, the
   resources are at the top left (each label over its number, no tray) and the clock (AP around it, 📜 at its
   bottom right) at the top right. Upright: those, then the map, then the backpack and the action tray. Sideways:
   the map between them, then the backpack and the action tray along the bottom. The main action tray leads with
   emoji, each named in small grey type under it (phones drop the names: no room). Used on touch screens, and on any
   window that's upright, ≤1100px wide or ≤500px tall — so a desktop window snapped to half or a quarter of
   the screen gets it too. Keep in step with touchUI in game.js. */
#mapframe { display: none; }
@media (pointer: coarse), (orientation: portrait), (max-width: 1100px), (max-height: 500px) {
  /* the clock: as big as leaves the map ~280px of height (the rest: the bars and the dock ≈ 280px) and fits its half of
     the width — up to 280px (an unfolded foldable, near square, gets a big one too) */
  :root { --clock: clamp(110px, min(calc(100dvh - 560px), calc((100dvw - 3 * var(--gap)) / 2)), 280px); --orbsize: 50px; --bar: 64px; }
  #board { display: grid; padding: var(--gap); gap: 8px 10px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) var(--bar) auto;
    grid-template-areas: "stats clock" ". clock" "map map" "pack pack" "dock dock"; }
  #map { grid-area: 1 / 1 / -1 / -1; margin: calc(-1 * var(--gap)); width: calc(100% + 2 * var(--gap)); height: calc(100% + 2 * var(--gap)); min-height: 0; border-radius: 0; background: none; }
  #mapframe { display: block; grid-area: map; visibility: hidden; pointer-events: none; }
  #board.threat #pack, #board.threat #dock, #board.threat #stats { position: relative; inset: auto; z-index: 3; }   /* above the red vignette, never dimmed */
  #clock { grid-area: clock; position: static; align-self: start; justify-self: end; }
  #rightcol { display: contents; }
  /* resources: as on desktop — a row of big coloured numbers over the map, each label over its number, no tray */
  #stats { grid-area: stats; flex: none; container-type: normal; flex-direction: row; justify-content: flex-start; align-items: flex-start; align-self: start;
    justify-self: start; gap: clamp(10px, 3vw, 26px); padding-left: 6px; pointer-events: none; }
  .stat { --o: var(--orbsize); flex-direction: column-reverse; gap: 2px; }   /* (label first) */
  /* the backpack is a full bar above the actions — all six slots, each with its Use / Take / leave buttons, no need to open it */
  #pack, #pack.open { grid-area: pack; position: static; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: center; gap: 6px;
    align-self: stretch; justify-self: stretch; width: auto; max-height: none; overflow: visible; padding: 6px 8px; border-radius: 12px; background: var(--panel-a); }
  #pack button.packhead { display: none; }   /* six slots say it all */
  /* each slot: the icon (Use / Take as a badge under it), then its name over its condition, and leave (✕) at the top right */
  #pack .slot-item, #pack:not(.open) .slot-item { display: grid; grid-template: auto auto / auto minmax(0, 1fr) auto; grid-template-areas: "ic name drop" "ic pips pips";
    align-items: center; column-gap: 6px; row-gap: 3px; height: 50px; min-width: 0; padding: 4px 4px 4px 6px; box-shadow: none; }
  #pack .slot-item.empty { display: block; }
  #pack .slot-item .ic { grid-area: ic; align-self: start; justify-self: center; }
  #pack .slot-item div { display: contents; }
  #pack .slot-item b { grid-area: name; overflow: hidden; text-overflow: ellipsis; }
  #pack .slot-item .cond { grid-area: pips; }
  #pack .slot-item .use { grid-area: ic; align-self: end; justify-self: center; z-index: 1; padding: 0 3px; font-size: 9px; line-height: 1.35; border-radius: 4px; }
  #pack .slot-item .use kbd { display: none; }
  /* the action tray: one row; the main tray shows the emoji, named small underneath */
  #dock { grid-area: dock; position: static; width: auto; margin: 0; }
  #actions, #actions .ribbon { width: 100%; }
  .ribbon { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
  .act { min-width: 0; white-space: normal; }
  .ribbon.main .act { align-items: center; justify-content: center; padding: 8px 4px 6px; }
  .ribbon.main .act small, .ribbon.main .act kbd { display: none; }
  .ribbon.main .act b { display: flex; flex-direction: column; align-items: center; gap: 4px; }
  .ribbon.main .act .al { font-size: 10.5px; font-weight: 500; line-height: 1.25; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .ribbon.main .act .ai { font-size: 28px; line-height: 1; }
  .ribbon.main .act:disabled .ai { filter: grayscale(1); }
  /* the round notices ("Next round starts with…") would push the map aside — the clock already shows what's coming */
  #notes.main { display: none; }
  /* messages: over the top of the map's open space */
  #msgs { grid-area: map; top: 4px; left: 0; right: 0; }
  /* Fight or Flee still takes the middle of the board (out of the grid, so it centres on the whole board) */
}
/* sideways: the resources top left, the clock top right, the map between them; the backpack and the actions along the
   bottom */
@media (orientation: landscape) and (pointer: coarse), (orientation: landscape) and (max-width: 1100px), (orientation: landscape) and (max-height: 500px) {
  #board { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) auto auto;
    grid-template-areas: "stats map clock" "pack pack pack" "dock dock dock"; }
  /* (keep room beside it for the resources, ~260px, and the map, ~300px) */
  :root { --clock: clamp(110px, min(calc(100dvw - 600px), calc(100dvh - 300px)), 280px); }
}
/* tablets and half-screen windows held sideways: the clock as big as the bars below leave room for */
@media (pointer: coarse) and (min-width: 700px) and (min-height: 600px) and (orientation: landscape), (max-width: 1100px) and (min-width: 700px) and (min-height: 600px) and (orientation: landscape) {
  :root { --clock: clamp(110px, min(calc(100dvw - 600px), calc(100dvh - 370px)), 280px); }
}
/* phone sizes */
@media (max-width: 640px), (max-height: 500px) {
  /* the clock fills its corner: half the width, less the gaps */
  :root { --gap: 8px; --clock: clamp(96px, calc((100dvw - 3 * var(--gap)) / 2), 180px); --orbsize: 44px; --bar: 50px; }
  #board { gap: 6px 8px; }
  /* six narrow slots: the icon, its condition under it, ✕ in the corner, Use / Take on the icon (no names: tap a slot for it) */
  #pack, #pack.open { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding: 4px; }
  #pack button.packhead { display: none; }
  #pack .slot-item, #pack:not(.open) .slot-item { position: relative; grid-template: minmax(0, 1fr) auto / minmax(0, 1fr); grid-template-areas: "ic" "pips";
    justify-items: center; row-gap: 2px; height: 100%; max-height: 46px; padding: 3px 2px; }
  #pack .slot-item.empty { height: 100%; max-height: 46px; }
  #pack .slot-item b { display: none; }
  #pack .slot-item .ic { align-self: center; font-size: 21px; line-height: 1; }
  #pack .slot-item .cond { gap: 1px; }
  #pack .slot-item .cond i { width: 4px; height: 4px; }
  #pack .slot-item .use { position: absolute; left: 1px; top: 1px; }
  .ribbon.main .act { padding: 8px 2px; }
  .ribbon.main .act .ai { font-size: 24px; }
  .ribbon.main .act .al { display: none; }   /* no room for the names */
  .stat small { font-size: 9.5px; letter-spacing: .06em; }   /* (the resources keep theirs: small) */
  #stats { gap: 6px; padding-left: 2px; }   /* (four to the half the clock leaves) */
  .stat .orb { min-width: 36px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  :root { --clock: 120px; }
}
/* upright: messages come in level with 📜 (at the clock's bottom right: its top is 10px above the map's), in the room
   left of it */
@media (orientation: portrait) {
  #msgs { top: -10px; right: calc(40px + 2 * var(--gap)); }
  #msgs > * { max-width: 100%; }
}

/* ---- the action bar and the backpack: every action, vehicle and item the same size — --sq wide, 0.72 of that high —
   six to a row. The emoji in the middle, its key (or slot number) on the top-left corner, a condition's pips small under
   it; names and costs are in the tooltips. The backpack, the context row (Trade, Say, vehicles: filling from the left,
   gone when empty) and the six always there are each as wide as six buttons, so they line up. Each layout sets --sq
   (and --barw with it: a custom property's var()s are filled in where it's set). */
#board { --sq: 64px; --sqgap: 8px; --sqpad: 8px; --barw: calc(6 * var(--sq) + 5 * var(--sqgap) + 2 * var(--sqpad) + 2px); }
#board #pack, #board #pack.open { width: var(--barw); max-width: 100%; justify-self: center; margin-inline: auto;
  grid-template-columns: repeat(6, var(--sq)); gap: var(--sqgap); padding: var(--sqpad); }
#board #pack .slot-item, #board #actions .ribbon.main .act { flex: none; position: relative; width: var(--sq); height: calc(var(--sq) * .72); max-height: none; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
#board #pack .slot-item > * { align-self: center; }   /* (not where the old slot layout put them) */
#board #pack .slot-item div { display: contents; }
#board #pack .slot-item b { display: none; }
#board #actions .ribbon.main { display: flex; justify-content: center; gap: var(--sqgap); padding: var(--sqpad); width: var(--barw); max-width: 100%; margin-inline: auto; }
#board #actions .ribbon.ctx { justify-content: flex-start; }
#board :is(#pack .slot-item .ic, #actions .act .ai) { font-size: calc(var(--sq) * .36); line-height: 1; }
#board #actions .act:disabled .ai { filter: grayscale(1); }
#board #actions .act kbd { position: absolute; top: -7px; left: -6px; margin: 0; padding: 0 4px; background: var(--panel); line-height: 1.4; }
#board :is(#pack .slot-item, #actions .act) .cond { gap: 1px; }
#board :is(#pack .slot-item, #actions .act) .cond i { width: 4px; height: 4px; }
#board :is(#pack .slot-item, #actions .act).sel::after { content: '↵'; top: -9px; right: -6px; padding: 0 5px; }   /* (Enter: no room for the word) */
@media (pointer: coarse) { #board #actions .act kbd { display: none; } }   /* (no keyboard) */
/* The bars, by the board's width — on every device:
   ≥1000px: one band along the bottom — the backpack left, the six always there in the middle, the context row right.
   690–1000px: the backpack and the six side by side along the bottom; the context row floats over the map above the six
   (often empty, so it takes no room of its own: nothing moves as it comes and goes).
   Narrower (phones upright): the three stacked, as below.
   The buttons are sized so it all fits (up to 64px). */
@container board (min-width: 690px) {
  #dock, #pack { --bandgap: 16px; --sq: min(64px, calc((100cqw - 2 * var(--gap) - var(--bandgap) - 2 * (5 * var(--sqgap) + 2 * var(--sqpad) + 2px)) / 12));
    --barw: calc(6 * var(--sq) + 5 * var(--sqgap) + 2 * var(--sqpad) + 2px); }
  #actions { position: relative; }
  #board #actions .ribbon.ctx { position: absolute; bottom: calc(100% + var(--sqgap)); left: 0; }
}
@container board (min-width: 1000px) {
  #dock, #pack { --sq: min(64px, calc((100cqw - 2 * var(--gap) - 2 * var(--bandgap) - 3 * (5 * var(--sqgap) + 2 * var(--sqpad) + 2px)) / 18)); }
  #board #actions .ribbon.ctx { bottom: 0; left: calc(100% + var(--bandgap)); }
}
/* …desktop: placed on the board */
@media (not (pointer: coarse)) and (orientation: landscape) and (min-width: 1101px) and (min-height: 501px) {
  @container board (min-width: 690px) {
    #dock { left: calc(50% + var(--bandgap) / 2); right: auto; bottom: var(--gap); width: var(--barw); margin: 0; }
    #board #pack { left: auto; right: calc(50% + var(--bandgap) / 2); bottom: var(--gap); margin: 0; }
  }
  @container board (min-width: 1000px) {
    #dock { left: 0; right: 0; margin-inline: auto; }
    #board #pack { right: calc(50% + var(--barw) / 2 + var(--bandgap)); }
  }
}
/* …touch: in the bottom row of the grid together (the backpack's own row left empty), centred as a pair or a band */
@media (pointer: coarse), (orientation: portrait), (max-width: 1100px), (max-height: 500px) {
  @container board (min-width: 690px) {
    #board #pack, #board #pack.open { grid-area: dock; align-self: end; justify-self: center; margin: 0 calc(var(--barw) + var(--bandgap)) 0 0; }
    #dock { width: var(--barw); align-self: end; justify-self: center; margin: 0 0 0 calc(var(--barw) + var(--bandgap)); }
  }
  @container board (min-width: 1000px) {
    #board #pack, #board #pack.open { margin: 0 calc(2 * var(--barw) + 2 * var(--bandgap)) 0 0; }
    #dock { margin: 0; }
  }
}
/* upright: the backpack's row is as tall as it needs */
@media (orientation: portrait) { #board { grid-template-rows: auto auto minmax(0, 1fr) auto auto; } }
/* phones: six to the board's width, as big as fits */
@media (max-width: 640px), (max-height: 500px) {
  #board { --sqgap: 4px; --sqpad: 4px; --sq: min(64px, calc((100cqw - 5 * var(--sqgap) - 2 * var(--sqpad) - 2px) / 6)); }
}
/* tablets held sideways */
@media (pointer: coarse) and (min-width: 700px) and (min-height: 600px) and (orientation: landscape), (max-width: 1100px) and (min-width: 700px) and (min-height: 600px) and (orientation: landscape) {
  #board { --sq: 64px; }
}
/* choosing what to carry (pickup): what's on offer in a row of its own above the backpack, ✓ in its last place; lit
   gold, in either row, what's to be carried */
#pack.choosing { border-color: var(--accent); box-shadow: 0 0 24px #d9a44144, 0 10px 30px #000a; }
#pack .slot-item.offer { background: #2b2417; cursor: pointer; }
#pack .slot-item.offergap { visibility: hidden; }
#pack .slot-item.pick-ok { color: #111; background: var(--accent); border-color: var(--accent); cursor: pointer; }
#pack .slot-item.pick-ok .ic { font-weight: 900; }
#pack .slot-item.pick-ok:disabled { opacity: .35; cursor: default; }
#pack .slot-item.carry { border-color: var(--accent); background: #3a3220; box-shadow: 0 0 12px #d9a44199; }
/* the arena (PvP): the hex, everyone in their seats. Each ring is the face's border — their ⚡ colour, yours white
   (--rc): emptied as they strike, it fills back round over the beat (--beat, from --cool: how far in it already is).
   The one you've lit glows; 🏳️ by a face that's surrendered; 💤 on one out cold (or asleep) */
@property --beat { syntax: '<number>'; inherits: false; initial-value: 1; }
#battle .bf-seat { --rc: #fff; cursor: pointer; }
#battle .bf-seat:is(.ap-full, .ap-high) { --rc: #4cd964; }
#battle .bf-seat.ap-mid { --rc: #f0922b; }
#battle .bf-seat.ap-low { --rc: #ff3b30; }
#battle .bf-seat.cooling { border-color: #ffffff1f; }
#battle .bf-seat.cooling::before { content: ''; position: absolute; inset: -1.33cqw; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--rc) calc(var(--beat) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.33cqw), #000 calc(100% - 1.33cqw));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.33cqw), #000 calc(100% - 1.33cqw));
  animation: beat var(--beatlen) linear var(--cool) forwards; }
@keyframes beat { from { --beat: 0; } to { --beat: 1; } }
#battle .bf-seat.target { box-shadow: 0 0 0 1cqw var(--accent), 0 0 5cqw var(--accent); }
#battle .bf-seat.out { opacity: .55; filter: grayscale(1); cursor: default; }
#battle .bf-seat.out::after { content: '💤'; position: absolute; right: -3cqw; top: -4cqw; font-size: 7cqw; }
#battle .bf-seat.flag::after { content: '🏳️'; position: absolute; left: -4cqw; top: -5cqw; font-size: 8cqw; }
#battle .bf-seat.struck { animation: shiver .18s linear 3; }
.bf-dmg { position: absolute; left: 50%; top: -14%; translate: -50% 0; white-space: nowrap; font-size: 7cqw; font-weight: 900; color: #ff5a4a;
  text-shadow: 0 .5cqw 0 #000, 0 0 2cqw #000; pointer-events: none; animation: dmgup .9s ease-out forwards; }
@keyframes dmgup { from { transform: translateY(2cqw) scale(.6); opacity: 0; } 25% { transform: scale(1.25); opacity: 1; } to { transform: translateY(-9cqw); opacity: 0; } }
/* the map: ⚔️ over a hex with a fight on, for anyone who can see it */
.arenamark { font-size: 30px; text-anchor: middle; dominant-baseline: central; pointer-events: none; filter: drop-shadow(0 2px 3px #000a); animation: arenamark 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes arenamark { 50% { transform: scale(1.15) rotate(-6deg); } }
/* the round's banner over a fight: the arena held — dimmed, its rings stopped — till it's gone */
#battle.held { filter: brightness(.6) saturate(.5); transition: filter .3s; }
#battle.held .bf-seat::before { animation-play-state: paused; }
/* 💀 a kill on the map: the weapon off the killer's face (as in a fight), a 💥 / 💢 on the sleeper, who jolts — then a 💀 */
.survivor .mapweapon { font-size: 24px; text-anchor: middle; dominant-baseline: central; pointer-events: none; transform-box: fill-box; transform-origin: 30% 80%;
  filter: drop-shadow(0 2px 3px #000); }
.survivor .mapweapon.swing { animation: wswing .6s ease-out; }
.survivor .mapweapon.shoot { animation: wkick .6s ease-out; }
.survivor .mapweapon.turnkey { transform-origin: 50% 50%; animation: wturn .65s ease-in-out forwards; }   /* a key, turning in the lock */
@keyframes wturn { 0% { opacity: 0; scale: .6; rotate: 0deg; } 25% { opacity: 1; scale: 1; rotate: 0deg; } 75%, 100% { opacity: 1; rotate: 90deg; } }
.survivor .mapblast { font-size: 36px; text-anchor: middle; dominant-baseline: central; pointer-events: none; transform-box: fill-box; transform-origin: center; animation: bang .35s ease-out both; }
.survivor.jolt { transform-box: fill-box; transform-origin: center; animation: shiver .18s linear 3; }
.survivor.skull circle { stroke: #555; }
