/* TavernRasa. Colours are taken from the tile sheet itself so the interface and the
   tavern are one object: slate and stone for surfaces, chalk for words, paper for what
   you owe, brass for money and for the one thing to press. The game speaks in the pixel
   face; the engine (ledger, numbers) speaks in the plain system face. */

/* The pixel face covers everything except the digits 0-9: its 2, 5 and 8 are too easy to
   mistake for one another (and for S) at phone sizes, and the numbers here are money and
   seconds. Digits fall through to the system face, in whatever weight the text has. */
@font-face {
  font-family: 'Pixelify Sans';
  src: url('../vendor/fonts/pixelify-sans-latin-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-002F, U+003A-10FFFF;
}
@font-face {
  font-family: 'Pixelify Sans';
  src: url('../vendor/fonts/pixelify-sans-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-002F, U+003A-10FFFF;
}

:root {
  --ink: #3f2631;
  --void: #763b36;
  --slate: #262b44;
  --slate-2: #343b5e;
  --pit: #181c30;
  --stone: #8b9bb4;
  --stone-2: #52607c;
  --chalk: #e4edf9;
  --paper: #f7c282;
  --sand: #eaa56c;
  --clay: #bd6c4a;
  --brass: #feae34;
  --gold: #fee761;
  --ember: #e84537;
  --rose: #ff706d;
  --mint: #43e1b3;
  --t-O: #d176d0;
  --t-C: #75e3ff;
  --t-E: #fee761;
  --t-A: #43e1b3;
  --t-N: #ff706d;
  --pix: 'Pixelify Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --plain: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--slate);
  color: var(--chalk);
  font: 400 16px/1.4 var(--pix);
  /* the pixel face's fi and ff ligatures read as other letters at small sizes */
  font-variant-ligatures: none;
  font-feature-settings: 'liga' 0, 'clig' 0, 'calt' 0;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.plain { font-family: var(--plain); }
.num { font-family: var(--plain); font-variant-numeric: tabular-nums; }

/* ---------- sprites ---------- */
.spr {
  --k: 2; --c: 0; --r: 0;
  display: inline-block;
  flex: none;
  width: calc(16px * var(--k));
  height: calc(16px * var(--k));
  background-image: url('../assets/extras.png');
  background-size: calc(128px * var(--k)) calc(64px * var(--k));
  background-position: calc(-16px * var(--k) * var(--c)) calc(-16px * var(--k) * var(--r));
  background-repeat: no-repeat;
  image-rendering: pixelated;
}
.spr.tile {
  background-image: url('../assets/tiles.png');
  background-size: calc(192px * var(--k)) calc(176px * var(--k));
}

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 11px 16px 14px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--brass);
  color: var(--ink);
  font: 700 18px/1.05 var(--pix);
  text-align: center;
  text-decoration: none;
  box-shadow: inset 0 -4px 0 rgba(63, 38, 49, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active:not([disabled]) { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(63, 38, 49, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.3); }
.btn.quiet { background: var(--slate-2); color: var(--chalk); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.12); }
.btn.danger { background: var(--ember); color: #fff; }
.btn.small { min-height: 40px; padding: 7px 12px 10px; font-size: 15px; }
.btn[disabled] { opacity: 0.45; cursor: default; }
.link { background: none; border: 0; padding: 4px 0; color: var(--stone); text-decoration: underline; text-underline-offset: 3px; font: 400 15px/1.2 var(--pix); }

/* a row of mutually exclusive choices, chalked on the slate */
.choice { display: flex; gap: 0; border: 2px solid var(--stone-2); }
.choice label { flex: 1; position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: block; padding: 10px 6px 12px; text-align: center;
  font: 700 15px/1.1 var(--pix); color: var(--stone);
  border-left: 2px solid var(--stone-2);
}
.choice label:first-child span { border-left: 0; }
.choice input:checked + span { background: var(--chalk); color: var(--slate); }
.choice input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: -4px; }

.field {
  width: 100%; min-height: 48px; padding: 10px 12px;
  background: var(--pit); color: var(--chalk);
  border: 2px solid var(--stone-2); border-radius: 0;
  font: 400 18px/1.2 var(--pix);
}
.field::placeholder { color: var(--stone-2); }
.field:focus { outline: none; border-color: var(--chalk); }

/* on/off, drawn as a tap handle */
.switch { position: relative; flex: none; width: 60px; height: 32px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; background: var(--pit); border: 2px solid var(--stone-2); }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; background: var(--stone); }
.switch input:checked + i { border-color: var(--brass); }
.switch input:checked + i::after { left: 30px; background: var(--brass); }
.switch input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- landing ---------- */
.landing { min-height: 100vh; min-height: 100dvh; padding: clamp(20px, 6vw, 64px) 20px 40px; background: var(--slate); }
.landing main { max-width: 560px; margin: 0 auto; }
.sign h1 { font: 700 clamp(52px, 17vw, 104px)/0.86 var(--pix); letter-spacing: -0.02em; color: var(--chalk); }
.sign .rule { height: 10px; margin: 14px 0 16px; background: repeating-linear-gradient(90deg, var(--chalk) 0 14px, transparent 14px 20px); opacity: 0.85; clip-path: polygon(0 30%, 100% 0, 100% 70%, 0 100%); }
.sign p { font-size: 19px; line-height: 1.35; color: var(--chalk); max-width: 30em; }
.regulars { display: flex; justify-content: space-between; margin: 26px 0 6px; padding: 10px 6px 0; background: var(--void); border: 2px solid var(--ink); overflow: hidden; }
.regulars .spr { --k: 2; }
@media (min-width: 560px) { .regulars .spr { --k: 3; } }
.regulars-note { font-size: 14px; color: var(--stone); margin-bottom: 30px; }
.block { margin-top: 26px; padding-top: 22px; border-top: 2px dashed var(--stone-2); }
.block h2 { font: 700 26px/1 var(--pix); margin-bottom: 16px; }
.opt { margin-bottom: 16px; }
.opt > b { display: block; font: 700 15px/1.2 var(--pix); color: var(--stone); margin-bottom: 6px; }
.opt > small { display: block; min-height: 2.6em; margin-top: 6px; font: 400 14px/1.3 var(--pix); color: var(--stone); }
.joinrow { display: flex; gap: 10px; }
.joinrow .field { flex: 1; text-transform: uppercase; letter-spacing: 0.3em; font-weight: 700; font-size: 22px; text-align: center; }
.joinrow .field::placeholder { letter-spacing: 0.3em; }
.landing .btn.wide { width: 100%; font-size: 22px; min-height: 58px; }
.note-err { min-height: 1.4em; margin-top: 8px; color: var(--rose); font-size: 15px; }
.colophon { margin-top: 44px; font: 400 13px/1.5 var(--plain); color: var(--stone-2); }
.colophon a { color: var(--stone); }

/* ---------- the stage: canvas + world-anchored layer ---------- */
.stage { position: absolute; inset: 0; overflow: hidden; background: var(--void); touch-action: none; }
.stage .game { position: absolute; inset: 0; }
.stage canvas { display: block; image-rendering: pixelated; }
.layer { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; will-change: transform; }
.at { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.at.above > * { position: absolute; left: 0; bottom: 0; transform: translateX(-50%); }
.at.below > * { position: absolute; left: 0; top: 0; transform: translateX(-50%); }
.at.gone { display: none; }

.tag {
  display: flex; align-items: center; gap: 3px; white-space: nowrap;
  font: 700 max(11px, calc(var(--k, 2) * 5.2px))/1 var(--pix); color: var(--chalk);
  text-shadow: 1px 0 var(--ink), -1px 0 var(--ink), 0 1px var(--ink), 0 -1px var(--ink), 1px 1px var(--ink), -1px 1px var(--ink);
}
.tag small { font-weight: 400; font-size: 0.9em; color: var(--paper); }
.tag small:empty { display: none; }
.tag.player b { font-weight: 700; }
.at.away .tag { opacity: 0.5; }
.pip { display: none; width: 7px; height: 7px; border: 1px solid var(--ink); }
.pip.on { display: block; }

.bubble {
  --shift: 0px;
  width: max-content; max-width: max(172px, calc(var(--k, 2) * 84px));
  transform: translateX(calc(-50% + var(--shift))) !important;
  padding: 5px 8px 7px;
  background: #fff; color: var(--ink);
  border: 2px solid var(--ink);
  font: 400 max(14px, calc(var(--k, 2) * 6.6px))/1.18 var(--pix);
  margin-bottom: 7px;
  animation: pop-in 0.14s ease-out;
}
.bubble p { overflow-wrap: anywhere; }
.bubble::after {
  content: ''; position: absolute; left: calc(50% - var(--shift)); bottom: -7px; width: 8px; height: 8px; margin-left: -4px;
  background: inherit; border: 2px solid var(--ink); border-top: 0; border-left: 0; transform: rotate(45deg) translate(-2px, -2px);
}
.bubble.tone-warm { background: #fff1d0; }
.bubble.tone-bright { background: #fff9bf; font-weight: 700; }
.bubble.tone-cold { background: #dbe4f0; }
.bubble.tone-anxious { background: #f4ecff; font-style: italic; }
.bubble.aside { font-size: 12px; opacity: 0.86; max-width: 140px; }
.bubble.pending p { display: flex; gap: 3px; padding: 4px 2px 2px; }
.bubble.pending i { width: 5px; height: 5px; background: var(--ink); animation: dot 0.9s infinite; }
.bubble.pending i:nth-child(2) { animation-delay: 0.15s; }
.bubble.pending i:nth-child(3) { animation-delay: 0.3s; }

.pop {
  display: flex; align-items: center; gap: 2px; white-space: nowrap;
  font: 800 max(15px, calc(var(--k, 2) * 7px))/1 var(--plain); font-variant-numeric: tabular-nums; color: var(--gold);
  text-shadow: 1px 0 var(--ink), -1px 0 var(--ink), 0 1px var(--ink), 0 -1px var(--ink), 0 2px var(--ink);
  animation: rise 1.5s ease-out forwards;
}
.pop .spr { filter: drop-shadow(0 0 0 var(--ink)); }
.pop.bad { color: var(--rose); }
.pop.note { color: var(--chalk); font-size: 13px; }

/* the engine, over each head: five bars, one tick each for the anchor */
.chip {
  position: relative;
  transform: translateX(-50%) scale(var(--chip-scale, 1)) !important;
  transform-origin: 50% 100%;
  margin-bottom: 3px; padding: 3px 3px 1px;
  background: var(--pit); border: 1px solid var(--ink);
  box-shadow: 0 0 0 1px rgba(228, 237, 249, 0.25);
}
.bars { display: flex; gap: 2px; }
.bar { position: relative; width: 5px; height: 24px; background: #0e1122; }
.bar .fill { position: absolute; left: 0; right: 0; bottom: 0; background: currentColor; transition: height 0.4s ease-out; }
.bar .tick { position: absolute; left: -1px; right: -1px; height: 2px; margin-bottom: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(14, 17, 34, 0.9); }
.bar.up { animation: flash 0.9s; }
.bar.down { animation: flash 0.9s; }
.letters { display: flex; gap: 2px; margin-top: 1px; font: 700 7px/9px var(--plain); }
.letters span { width: 5px; text-align: center; }
.t-O { color: var(--t-O); } .t-C { color: var(--t-C); } .t-E { color: var(--t-E); } .t-A { color: var(--t-A); } .t-N { color: var(--t-N); }
.deltas {
  position: absolute; left: 100%; bottom: 2px; margin-left: 4px;
  display: flex; flex-direction: column-reverse; gap: 1px;
  font: 700 10px/11px var(--plain); font-variant-numeric: tabular-nums; white-space: nowrap;
  text-shadow: 1px 0 var(--pit), -1px 0 var(--pit), 0 1px var(--pit), 0 -1px var(--pit);
}
.deltas b { animation: delta 1.9s ease-out forwards; }

/* ---------- play (phone) ---------- */
.play { position: fixed; inset: 0; overflow: hidden; background: var(--void); user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
.play .frame { position: absolute; top: 0; bottom: 0; left: 50%; width: min(100%, 480px); transform: translateX(-50%); overflow: hidden; }

.hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  padding: calc(6px + var(--safe-t)) 8px 8px 10px;
  background: var(--slate); border-bottom: 2px solid var(--ink);
  box-shadow: 0 2px 0 rgba(63, 38, 49, 0.35);
}
.hud-coins { display: flex; align-items: center; gap: 5px; color: var(--gold); min-width: 64px; }
/* amounts of money use the plain face: the pixel 5 reads as an S */
.hud-coins b { font: 800 24px/1 var(--plain); font-variant-numeric: tabular-nums; }
.hud-coins small { font: 400 12px/1 var(--pix); color: var(--stone); margin-left: 2px; white-space: nowrap; }
.hud-coins.bump b { animation: bump 0.35s; }
.hud-hold { display: flex; align-items: center; gap: 6px; min-width: 0; font: 400 14px/1.1 var(--pix); color: var(--stone); }
.hud-hold span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-hold.full { color: var(--chalk); }
.hud-clock { font: 800 22px/1 var(--plain); font-variant-numeric: tabular-nums; color: var(--chalk); text-align: right; min-width: 3.2em; }
.hud-clock small { display: block; font: 400 11px/1.1 var(--pix); color: var(--stone); }
.hud-clock.low { color: var(--rose); }
.icon-btn { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; background: var(--slate-2); border: 2px solid var(--ink); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.28); color: var(--chalk); }
.icon-btn svg { width: 22px; height: 22px; }

.tickets { position: absolute; left: 0; right: 0; top: calc(60px + var(--safe-t)); z-index: 15; display: flex; gap: 8px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; pointer-events: none; }
.ticket {
  position: relative; flex: none; display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: center;
  min-width: 132px; padding: 5px 8px 9px; background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink); border-top: 0;
  font: 700 14px/1.1 var(--pix);
}
.ticket small { display: block; font: 400 12px/1.15 var(--pix); }
.ticket .left { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(63, 38, 49, 0.2); }
.ticket .left i { display: block; height: 100%; background: var(--ink); transform-origin: 0 50%; }
.ticket.late { background: #ffd0b0; }
.ticket.late .left i { background: var(--ember); }
.ticket.favor { background: var(--chalk); }

.banner { position: absolute; left: 50%; top: calc(118px + var(--safe-t)); z-index: 14; transform: translateX(-50%); max-width: 92%; padding: 7px 12px 9px; background: var(--slate); border: 2px solid var(--ink); color: var(--chalk); font: 700 16px/1.2 var(--pix); text-align: center; pointer-events: none; }
.banner.alert { background: var(--ember); color: #fff; }
.toast { position: absolute; left: 50%; bottom: calc(156px + var(--safe-b)); z-index: 30; transform: translateX(-50%); max-width: 88%; padding: 7px 12px 9px; background: var(--ink); color: var(--chalk); border: 2px solid var(--stone); font: 400 15px/1.25 var(--pix); text-align: center; pointer-events: none; animation: pop-in 0.14s ease-out; }
.offline { position: absolute; left: 0; right: 0; top: calc(58px + var(--safe-t)); z-index: 40; padding: 6px 10px 8px; background: var(--ember); color: #fff; font: 700 15px/1.2 var(--pix); text-align: center; }

.pad { position: absolute; inset: 0; z-index: 10; touch-action: none; }
.stick { position: absolute; z-index: 11; width: 104px; height: 104px; margin: -52px 0 0 -52px; border: 2px solid rgba(228, 237, 249, 0.55); background: rgba(38, 43, 68, 0.35); border-radius: 50%; pointer-events: none; }
.stick i { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; background: rgba(228, 237, 249, 0.85); border: 2px solid var(--ink); border-radius: 50%; }
.stick.rest { left: 76px; bottom: calc(76px + var(--safe-b)); margin: 0 0 -52px -52px; opacity: 0.55; }

.actions { position: absolute; right: 8px; bottom: calc(14px + var(--safe-b)); z-index: 12; display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: min(54%, 220px); }
.actions .btn.primary { min-height: 64px; flex-direction: column; gap: 3px; font-size: 19px; }
.actions .btn.primary small { font: 400 13px/1 var(--pix); }
.actions .btn.primary.idle { background: var(--slate-2); color: var(--stone); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.28); }
.ledger-tab { position: absolute; left: 8px; right: calc(min(54%, 220px) + 16px); bottom: calc(132px + var(--safe-b)); z-index: 12; padding: 6px 8px 7px; background: var(--pit); border: 2px solid var(--ink); box-shadow: 0 0 0 1px rgba(228, 237, 249, 0.25); color: var(--chalk); text-align: left; font: 400 12px/1.25 var(--plain); font-variant-numeric: tabular-nums; }
.ledger-tab b { display: block; font: 700 13px/1.1 var(--pix); color: var(--brass); margin-bottom: 2px; }
.ledger-tab span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.backdrop { position: absolute; inset: 0; z-index: 49; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 50;
  max-height: 60%; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 12px calc(14px + var(--safe-b));
  background: var(--slate); border-top: 2px solid var(--ink);
  box-shadow: 0 -2px 0 var(--stone-2);
  transform: translateY(104%); transition: transform 0.18s ease-out;
  user-select: text; -webkit-user-select: text;
}
.sheet.open { transform: none; }
.sheet.tall { max-height: 82%; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sheet-head h2 { font: 700 22px/1 var(--pix); }
.sheet-head p { font: 400 14px/1.2 var(--pix); color: var(--stone); margin-top: 3px; }
.sheet-head .grow { flex: 1; min-width: 0; }
.sheet-head .portrait { --k: 3; background-color: var(--void); border: 2px solid var(--ink); }
.close { width: 40px; height: 40px; background: none; border: 2px solid var(--stone-2); font: 700 18px/1 var(--pix); color: var(--stone); }

.verbs { display: grid; gap: 8px; }
.verb {
  display: grid; grid-template-columns: 1fr auto; column-gap: 10px; align-items: center; width: 100%; min-height: 52px;
  padding: 8px 12px 10px; text-align: left;
  background: var(--slate-2); border: 2px solid var(--ink); color: var(--chalk);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.1);
  touch-action: manipulation;
}
.verb b { display: block; font: 700 17px/1.1 var(--pix); }
.verb small { display: block; margin-top: 2px; font: 400 13px/1.2 var(--pix); color: var(--stone); }
.verb small:empty, .verb em:empty { display: none; }
.verb em { font: 700 14px/1 var(--pix); font-style: normal; color: var(--gold); white-space: nowrap; }
.verb.lead { background: var(--brass); color: var(--ink); box-shadow: inset 0 -4px 0 rgba(63, 38, 49, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.45); }
.verb.lead small, .verb.lead em { color: var(--ink); }
.verb.harsh b { color: var(--rose); }
.verb[disabled] { opacity: 0.45; }
.verb:active:not([disabled]) { transform: translateY(2px); }
.sayrow { margin-top: 10px; }
.sayrow label { display: block; font: 400 13px/1.2 var(--pix); color: var(--stone); margin-bottom: 4px; }

.traitrows { display: grid; gap: 4px; margin: 2px 0 12px; font: 400 12px/1 var(--plain); font-variant-numeric: tabular-nums; }
.traitrow { display: grid; grid-template-columns: 9.5em 1fr 3.2em; align-items: center; gap: 8px; }
.traitrow .track { position: relative; height: 10px; background: var(--pit); }
.traitrow .track i { position: absolute; left: 0; top: 0; bottom: 0; background: currentColor; }
.traitrow .track u { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: #fff; }
.traitrow span:first-child { color: var(--chalk); }
.traitrow span:last-child { text-align: right; color: var(--chalk); }

.setrow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 2px dashed var(--stone-2); }
.setrow:first-of-type { border-top: 0; }
.setrow .grow { flex: 1; min-width: 0; }
.setrow b { display: block; font: 700 18px/1.1 var(--pix); }
.setrow small { display: block; margin-top: 3px; font: 400 13px/1.25 var(--pix); color: var(--stone); }
.setrow .field { min-height: 44px; }
.howto { margin: 0; padding: 0 0 0 1.3em; font: 400 15px/1.35 var(--pix); color: var(--chalk); }
.howto li { margin-bottom: 4px; }

/* ledger: the engine's own account of what just happened */
.filters { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; scrollbar-width: none; }
.filters button { flex: none; padding: 6px 10px 8px; background: none; border: 2px solid var(--stone-2); color: var(--stone); font: 700 14px/1 var(--pix); }
.filters button.on { background: var(--chalk); border-color: var(--chalk); color: var(--slate); }
.ledger { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; font: 400 13px/1.35 var(--plain); font-variant-numeric: tabular-nums; }
.entry { min-width: 0; padding: 8px 10px 9px; background: var(--pit); border-left: 3px solid var(--stone-2); }
.entry.pos { border-left-color: var(--mint); }
.entry.neg { border-left-color: var(--rose); }
.entry.formative { border-left-width: 6px; }
.entry header { display: flex; justify-content: space-between; gap: 8px; font: 700 15px/1.2 var(--pix); color: var(--chalk); }
.entry header time { font: 400 12px/1.3 var(--plain); color: var(--stone); white-space: nowrap; }
.entry dl { display: grid; grid-template-columns: 5.2em 1fr; gap: 1px 8px; margin: 5px 0 0; }
.entry dt { color: var(--stone); }
.entry dd { margin: 0; min-width: 0; color: var(--chalk); overflow-wrap: anywhere; }
.entry dd b { display: inline-block; font-weight: 700; margin-right: 8px; white-space: nowrap; }
.entry .mark { display: inline-block; padding: 0 5px; margin-left: 6px; background: var(--brass); color: var(--ink); font-weight: 700; }
.empty { padding: 18px 4px; color: var(--stone); font: 400 15px/1.35 var(--pix); }

.radar { display: block; width: min(100%, 300px); margin: 0 auto 6px; }
.radar text { font: 700 12px var(--plain); fill: var(--chalk); }
.legend { display: flex; justify-content: center; gap: 16px; margin-bottom: 12px; font: 400 12px/1 var(--plain); color: var(--stone); }
.legend i { display: inline-block; width: 16px; height: 0; margin-right: 5px; vertical-align: middle; border-top: 2px solid var(--brass); }
.legend i.start { border-top: 2px dashed var(--stone); }
.itable { width: 100%; border-collapse: collapse; font: 400 12px/1.3 var(--plain); font-variant-numeric: tabular-nums; }
.itable th { text-align: right; font-weight: 400; color: var(--stone); padding: 3px 0 3px 8px; }
.itable th:first-child { text-align: left; padding-left: 0; }
.itable td { text-align: right; padding: 3px 0 3px 8px; border-top: 1px solid var(--stone-2); color: var(--chalk); }
.itable td:first-child { text-align: left; padding-left: 0; }
.answers { margin: 12px 0 0; padding: 0; list-style: none; font: 400 12px/1.3 var(--plain); color: var(--chalk); }
.answers li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px solid var(--stone-2); }
.answers b { white-space: nowrap; color: var(--brass); }
.fine { margin-top: 10px; font: 400 12px/1.4 var(--plain); color: var(--stone); }

/* welcome card and full-screen states */
.card { position: absolute; left: 12px; right: 12px; top: 50%; z-index: 60; transform: translateY(-50%); padding: 18px 16px 16px; background: var(--slate); border: 2px solid var(--ink); box-shadow: 0 0 0 2px var(--stone-2), 0 0 0 4000px rgba(24, 28, 48, 0.55); user-select: text; -webkit-user-select: text; }
.card h2 { font: 700 30px/1 var(--pix); margin-bottom: 4px; }
.card .who { display: flex; align-items: center; gap: 10px; margin: 10px 0 12px; font: 400 17px/1.2 var(--pix); }
.card .who .spr { --k: 3; }
.card .howto { margin: 14px 0 16px; }
.card .btn { width: 100%; }
.card .row { display: flex; gap: 8px; margin-bottom: 12px; }
.card .row .field { flex: 1; min-width: 0; }
.fatal { position: absolute; inset: 0; z-index: 80; display: grid; place-content: center; gap: 14px; padding: 24px; background: var(--slate); text-align: center; }
.fatal h2 { font: 700 30px/1.05 var(--pix); }
.fatal p { color: var(--stone); max-width: 20em; }

/* ---------- last call ---------- */
.reveal { position: absolute; inset: 0; z-index: 70; display: flex; flex-direction: column; background: var(--slate); user-select: text; -webkit-user-select: text; }
.reveal-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: calc(16px + var(--safe-t)) 14px 20px; }
.reveal h2 { font: 700 44px/0.9 var(--pix); }
.reveal .sub { margin: 6px 0 16px; color: var(--stone); font-size: 15px; }
.reveal h3 { margin: 22px 0 8px; padding-top: 14px; border-top: 2px dashed var(--stone-2); font: 700 20px/1 var(--pix); }
.board { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.board li { display: grid; grid-template-columns: 1.6em auto 1fr auto; align-items: center; gap: 8px; padding: 4px 8px 6px 4px; background: var(--pit); font: 700 18px/1.1 var(--pix); }
.board li.me { outline: 2px solid var(--brass); outline-offset: -2px; }
.board .place { text-align: right; color: var(--stone); }
.board .who small { display: block; font: 400 12px/1.25 var(--plain); color: var(--stone); font-variant-numeric: tabular-nums; }
.board .sum { display: flex; align-items: center; gap: 4px; color: var(--gold); font: 800 22px/1 var(--plain); font-variant-numeric: tabular-nums; }
.board .spr { --k: 2; }
.became { display: grid; gap: 6px; }
.became article { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 6px 8px 8px; background: var(--pit); }
.became .spr { --k: 2; background-color: var(--void); }
.became b { font: 700 17px/1.1 var(--pix); }
.became p { font: 400 14px/1.2 var(--pix); color: var(--paper); }
.became small { display: block; margin-top: 2px; font: 400 12px/1.3 var(--plain); color: var(--stone); }
.shift { display: flex; gap: 3px; align-items: flex-end; }
.shift .pair { position: relative; width: 9px; height: 30px; background: #0e1122; }
.shift .pair i { position: absolute; bottom: 0; width: 4px; background: var(--stone-2); }
.shift .pair i + i { left: 5px; background: currentColor; }
.awards { margin: 0; padding: 0; list-style: none; font-size: 16px; }
.awards li { padding: 3px 0; }
.awards b { color: var(--brass); }
.reveal .next { flex: none; padding: 10px 14px calc(12px + var(--safe-b)); background: var(--ink); text-align: center; font: 700 17px/1.2 var(--pix); }
.became .fine { margin: 4px 0 0; }

/* ---------- host (projector) ---------- */
.host { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(250px, 23vw) minmax(0, 1fr) minmax(270px, 27vw); background: var(--slate); }
.host .col { min-height: 0; overflow-y: auto; padding: clamp(14px, 1.6vw, 28px); display: flex; flex-direction: column; }
.host .col > * { flex: none; }
.host .col .push { margin-top: auto; }
.host .mapcol { position: relative; display: block; padding: 0; background: var(--void); border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); overflow: hidden; }
.host h1 { font: 700 clamp(30px, 3.4vw, 56px)/0.9 var(--pix); }
.host .tagline { margin: 6px 0 clamp(12px, 1.6vw, 24px); color: var(--stone); font-size: clamp(13px, 1.1vw, 18px); line-height: 1.3; }
.qr { display: block; width: 100%; aspect-ratio: 1; background: #fff; border: 2px solid var(--ink); padding: 0; }
.qr img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.scan { margin-top: 10px; font: 700 clamp(18px, 1.7vw, 28px)/1.1 var(--pix); }
.joinurl { margin-top: 4px; font: 400 clamp(13px, 1.15vw, 19px)/1.3 var(--plain); color: var(--chalk); overflow-wrap: anywhere; }
.joinurl b { color: var(--brass); font-weight: 700; }
.bigcode { margin-top: 8px; font: 700 clamp(44px, 5.4vw, 92px)/0.9 var(--pix); letter-spacing: 0.12em; color: var(--brass); }
.hostctl { display: grid; gap: 8px; margin-top: clamp(14px, 1.6vw, 26px); padding-top: clamp(12px, 1.4vw, 22px); border-top: 2px dashed var(--stone-2); }
.hostctl .setrow { padding: 6px 0; border: 0; }
.hostclock { font: 700 clamp(40px, 4.6vw, 80px)/0.9 var(--pix); }
.hostclock.time { font-family: var(--plain); font-weight: 800; font-variant-numeric: tabular-nums; }
.hostclock small { display: block; margin-top: 6px; font: 400 clamp(13px, 1.1vw, 18px)/1.2 var(--pix); color: var(--stone); }
.host .col > h2, .host #ledger-wrap > h2 { margin: clamp(16px, 1.8vw, 28px) 0 8px; padding-top: clamp(12px, 1.4vw, 20px); border-top: 2px dashed var(--stone-2); font: 700 clamp(18px, 1.6vw, 26px)/1 var(--pix); }
.host .board li { font-size: clamp(16px, 1.5vw, 24px); }
.host .board .sum { font-size: clamp(20px, 1.9vw, 30px); }
.feed { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font: 400 clamp(13px, 1.1vw, 17px)/1.3 var(--pix); color: var(--chalk); }
.feed li { padding: 3px 0; border-bottom: 1px solid var(--stone-2); }
.feed li.bad { color: var(--rose); }
.host .ledger { font-size: clamp(11px, 0.95vw, 15px); }
.host .reveal { position: absolute; z-index: 30; }
.host .stage { position: absolute; inset: 0; }
.spend { margin-top: 10px; font: 400 12px/1.4 var(--plain); color: var(--stone); font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .host { position: static; display: block; min-height: 100vh; }
  .host .mapcol { height: 78vh; border: 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
  .host .qr { max-width: 260px; }
}

/* ---------- motion ---------- */
@keyframes pop-in { from { opacity: 0; transform: translateX(calc(-50% + var(--shift, 0px))) translateY(4px); } }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, 6px); } 12% { opacity: 1; transform: translate(-50%, 0); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -26px); } }
@keyframes delta { 0% { opacity: 0; transform: translateY(4px); } 12% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6px); } }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 2px #fff; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes dot { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }
@keyframes bump { 40% { transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .pop, .deltas b { animation: none; }
}
