/* Clocktower table, in the same minimal look as clocktowerbench.com. Two things are big and obvious at all times:
   what phase it is (the band under the header) and what you can do right now (the dock at the bottom). Everything
   else is quiet: flat dark surfaces, thin rules, gold as the one accent (your turn, your choices, links); good blue
   and evil red only where they mean a team. Inter for interface, EB Garamond for what people say, Pirata One only
   for the wordmark and the result. Phone first; every control is at least 44 px. Fonts are served from /fonts. */
@font-face { font-family: "Pirata One"; src: url(/fonts/pirata-one.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Inter"; src: url(/fonts/inter.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url(/fonts/eb-garamond.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url(/fonts/eb-garamond-italic.woff2) format("woff2"); font-weight: 400 600; font-style: italic; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0f0d13; --surface: #18151d; --surface-2: #211d27; --rule: #2c2733; --rule-2: #3d3646;
  --text: #ece6da; --text-2: #c3baad; --faint: #9e96a7;
  --gold: #e0b052; --gold-2: #f3cd7a; --gold-bg: rgba(224,176,82,.12);
  --good: #73adf0; --evil: #f06e64; --good-bg: rgba(115,173,240,.12); --evil-bg: rgba(240,110,100,.12);
  --whisper-bg: #1b1726; --whisper-rule: #4b4166;   /* private: a faint cool tint, never an accent */
  --outline: #08060a; --wood: #3a2418; --wood-2: #684428; --parch: #e4d2aa; --ink: #241a14;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --title: "Pirata One", Georgia, serif;
  --dock-h: 0px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; }
em { color: var(--faint); font-style: italic; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-2); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.center { text-align: center; }
.fine { color: var(--faint); font-size: 14px; line-height: 1.5; }
.err { color: var(--evil); margin: 10px 0 0; font-size: 15px; }
.err:empty { display: none; }
.eyebrow { font: 600 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 6px; }
.plate { display: inline-block; font: 600 11px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; padding: 4px 6px; border: 1px solid var(--rule-2); border-radius: 3px; color: var(--text-2); }
.plate.gold { color: var(--gold); border-color: rgba(224,176,82,.45); }
.plate.good { color: var(--good); border-color: rgba(115,173,240,.45); }
.plate.evil { color: var(--evil); border-color: rgba(240,110,100,.45); }
.good { color: var(--good); } .evil { color: var(--evil); }

/* ---------- controls ---------- */
.primary {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; padding: 0 18px;
  font: 600 16px/1 var(--sans); background: var(--gold); color: #1a1206; border: 0; border-radius: 6px; text-decoration: none;
  transition: background .12s, transform .06s;
}
.primary:hover { background: var(--gold-2); text-decoration: none; color: #1a1206; }
.primary:active:not(:disabled) { transform: translateY(1px); }
.primary:disabled { background: var(--surface-2); color: var(--faint); cursor: not-allowed; }
.primary.small { width: auto; min-height: 44px; font-size: 15px; padding: 0 14px; }
.primary.busy, .ghost.busy { cursor: progress; opacity: .8; }
.as-link { text-decoration: none; }
.ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px;
  font: 600 15px/1 var(--sans); background: transparent; color: var(--text); border: 1px solid var(--rule-2); border-radius: 6px;
  transition: border-color .12s, transform .06s;
}
.ghost:hover { border-color: var(--faint); }
.ghost:active { transform: translateY(1px); }
.ghost.small { min-height: 44px; font-size: 14px; padding: 0 12px; }
.ghost.done { color: var(--gold); border-color: var(--gold); }
.linkish { background: none; border: 0; padding: 0; min-height: 44px; color: var(--gold); font: 500 15px/1 var(--sans); }
.linkish:hover { color: var(--gold-2); text-decoration: underline; text-underline-offset: 3px; }
.round { width: 48px; height: 48px; border: 1px solid var(--rule-2); border-radius: 50%; background: var(--surface); color: var(--text); font: 400 26px/1 var(--sans); display: grid; place-items: center; padding: 0 0 2px; }
.round:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.round:disabled { opacity: .35; cursor: default; }
.icon { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); }
.icon svg.i { width: 21px; height: 21px; }
.icon:hover, .icon.on { color: var(--gold); background: var(--surface); }
input, select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--rule-2); border-radius: 6px; padding: 11px 12px; min-height: 48px;
  color: var(--text); outline: none; font-size: 16px; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
input::placeholder, textarea::placeholder { color: #8d8597; opacity: 1; }
textarea { resize: none; min-height: 72px; line-height: 1.45; display: block; font: 400 17px/1.45 var(--serif); }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
select:disabled { opacity: .7; cursor: default; }
code { font: 14px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- lobby ---------- */
#lobby { min-height: 100%; }
.lobby-inner { max-width: 560px; margin: 0 auto; padding: 22px 16px 56px; }
.hero { text-align: center; padding: clamp(28px, 7vh, 64px) 0 26px; }
.hero .eyebrow { margin-bottom: 8px; }
.hero h1 { font: 400 clamp(56px, 15vw, 84px)/.95 var(--title); color: var(--gold); }
.tagline { font: italic 400 19px/1.35 var(--serif); color: var(--text-2); margin: 10px 0 0; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 22px 20px 20px; margin-bottom: 18px; }
.card h2 { font: 600 20px/1.25 var(--sans); color: var(--text); margin-bottom: 12px; }
.card p { margin: 0 0 14px; color: var(--text-2); }
.card p a { font-weight: 500; }
.card.quiet { background: transparent; }
.card.quiet h2 { font-size: 16px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 0 0 12px 34px; color: var(--text-2); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; display: grid; place-items: center; font: 600 12px/1 var(--sans); color: var(--text); border: 1px solid var(--rule-2); border-radius: 50%; }
.steps b { color: var(--text); font-weight: 600; }
.field { display: block; margin: 0 0 18px; }
.label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 600 14px/1.2 var(--sans); color: var(--text); margin-bottom: 8px; }
.label em { font: italic 400 14px/1.2 var(--serif); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.good { background: var(--good); } .dot.evil { background: var(--evil); }
.allegiance { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.team-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px 11px; min-height: 104px;
  background: var(--bg); border: 1px solid var(--rule-2); border-radius: 8px; color: var(--text-2); transition: border-color .12s, background .12s;
}
.team-tile svg { width: 30px; height: 30px; }
.team-tile b { font: 600 16px/1.1 var(--sans); color: var(--text); }
.team-tile small { font: 400 13px/1.25 var(--sans); color: var(--faint); text-align: center; }
.team-tile:hover { border-color: var(--faint); }
.team-tile.good svg { color: var(--good); } .team-tile.evil svg { color: var(--evil); } .team-tile.any svg { color: var(--text-2); }
.team-tile.on { border-width: 2px; padding: 11px 5px 10px; }
.team-tile.on.good { border-color: var(--good); background: var(--good-bg); }
.team-tile.on.evil { border-color: var(--evil); background: var(--evil-bg); }
.team-tile.on.any { border-color: var(--gold); background: var(--gold-bg); }
.team-tile.on small { color: var(--text-2); }
.people { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.people li { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 6px 6px 6px 8px; background: var(--bg); border: 1px solid var(--rule); border-radius: 6px; min-width: 0; }
.people li.you { border-color: var(--rule-2); }
.people .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.people .who em { font: italic 400 14px var(--serif); }
.online { width: 8px; height: 8px; border-radius: 50%; background: #4a4252; flex: none; }
.online.on { background: #6fcf7f; }
.kick { width: 36px; height: 36px; margin: -4px -2px -4px 0; background: none; border: 0; color: var(--faint); font: 400 22px/1 var(--sans); flex: none; border-radius: 6px; }
.kick:hover { color: var(--text); background: var(--surface-2); }
@media (max-width: 420px) { .people { grid-template-columns: 1fr; } }
.share { margin: 0 0 18px; }
.share-row { display: flex; gap: 8px; align-items: stretch; }
.share-row code { flex: 1; min-width: 0; padding: 12px; background: var(--bg); border: 1px dashed var(--rule-2); border-radius: 6px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; }
.size { display: flex; align-items: center; justify-content: center; gap: 26px; margin: 2px 0 12px; }
.size-n { text-align: center; min-width: 80px; }
.size-n b { display: block; font: 600 48px/1 var(--sans); color: var(--text); font-variant-numeric: tabular-nums; }
.size-n span { font-size: 13px; color: var(--faint); }
.composition { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.composition i { width: 14px; height: 14px; border-radius: 50%; }
.composition .tf { background: var(--good); } .composition .os { background: transparent; box-shadow: inset 0 0 0 2px var(--good); }
.composition .mn { background: var(--evil); } .composition .dm { background: transparent; box-shadow: inset 0 0 0 2px var(--evil), 0 0 0 2px var(--evil); width: 12px; height: 12px; margin: 1px 2px; }
.comp-text { text-align: center; font-size: 14px; margin: 0 0 20px !important; }
.comp-text em { font: italic 400 15px var(--serif); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 460px) { .grid2 { grid-template-columns: 1fr; } }
#settings.readonly .size .round { visibility: hidden; }
details { margin: 0 0 18px; }
details summary { cursor: pointer; list-style: none; color: var(--gold); font: 500 15px/1.3 var(--sans); padding: 12px 0; min-height: 44px; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "+ "; white-space: pre; }
details[open] summary::before { content: "− "; }
details summary em { font: italic 400 14px var(--serif); color: var(--faint); }
.key-row { display: flex; gap: 8px; margin: 10px 0; }
.key-row select { width: auto; flex: none; }
.key-row input { flex: 1; min-width: 0; }
.bell { margin-top: 6px; }
.claim { display: flex; justify-content: center; margin-top: 10px; }
.foot { text-align: center; color: var(--faint); font-size: 14px; margin-top: 10px; }
.foot a { color: var(--text-2); }
.foot p { margin: 8px 0 0; font-size: 12.5px; }

/* ---------- the table: frame ---------- */
#table { height: 100%; display: flex; flex-direction: column; overflow: hidden; }  /* 100% follows the visible viewport on iOS (dvh overshoots behind the toolbar) */
.bar { display: flex; align-items: center; gap: 6px; padding: 5px max(8px, env(safe-area-inset-right)) 5px max(8px, env(safe-area-inset-left)); border-bottom: 1px solid var(--rule); flex: none; min-height: 56px; }
.me-chip { display: flex; align-items: center; gap: 10px; background: none; border: 0; border-radius: 8px; padding: 4px 8px 4px 4px; min-height: 48px; text-align: left; min-width: 0; flex: 1; max-width: 300px; }
.me-chip:hover { background: var(--surface); }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text b { font: 600 16px/1.2 var(--sans); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { font: 500 13.5px/1.3 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small.good { color: var(--good); } .me-text small.evil { color: var(--evil); }
.tools { display: flex; gap: 0; margin-left: auto; }

/* the phase band: when we are, and whether it's your move */
.phase { flex: none; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 16px; padding: 10px 16px; border-bottom: 1px solid var(--rule); background: var(--surface); }
.phase:empty { display: none; }
.ph-text { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ph-text svg.i { width: 22px; height: 22px; color: var(--text-2); }
.ph-title { font: 700 22px/1.1 var(--sans); color: var(--text); white-space: nowrap; letter-spacing: -.01em; }
.ph-sub { font: 500 18px/1.1 var(--sans); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phase .ph-sub::before { content: "·"; margin-right: 9px; color: var(--faint); }
.ph-sub:empty { display: none; }
.track { display: flex; gap: 3px; margin: 0; padding: 0; list-style: none; justify-self: center; width: 100%; max-width: 340px; }
.track li { flex: 1; height: 5px; border-radius: 3px; background: var(--rule-2); }
.track li.night, .track li.noms { flex: 1.5; }
.track li.night + li, .track li.private + li.public, .track li.public + li.noms { margin-left: 6px; }
.track li.done { background: var(--faint); }
.track li.now { background: var(--gold); height: 9px; margin-top: -2px; }
.turnflag { display: inline-flex; align-items: center; gap: 7px; font: 600 15px/1 var(--sans); padding: 9px 12px; border-radius: 6px; white-space: nowrap; }
.turnflag svg.i { width: 17px; height: 17px; }
.turnflag.yours { background: var(--gold); color: #1a1206; }
.turnflag.yours .dot { width: 8px; height: 8px; border-radius: 50%; background: #1a1206; animation: pulse 1.6s ease-in-out infinite; }
.turnflag.yours .timer { margin-left: 2px; padding: 0 0 0 9px; border: 0; border-left: 1px solid rgba(26,18,6,.35); border-radius: 0; background: none; color: inherit; font-size: 15px; }
.turnflag.sealed { color: var(--text-2); }
.turnflag.sealed svg.i { color: var(--gold); }
.turnflag.wait { color: var(--faint); font-weight: 500; }
.phase.night { background: #12111d; }

.strip { display: none; }
.stage { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 42%); }
#town { position: relative; display: flex; align-items: center; justify-content: center; padding: 24px; border-right: 1px solid var(--rule); min-height: 0; overflow: hidden; }
#chronicle { position: relative; display: flex; flex-direction: column; min-height: 0; }

/* ---------- tokens: wooden rim, parchment face (as on clocktowerbench.com) ---------- */
.token {
  --s: 56px; position: relative; width: var(--s); height: var(--s); flex: none; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle closest-side, var(--parch) 0 calc(100% - var(--s) / 7 - 1px), var(--outline) calc(100% - var(--s) / 7 - 1px) calc(100% - var(--s) / 7), var(--wood) calc(100% - var(--s) / 7));
  box-shadow: 0 0 0 1.5px var(--outline), inset 0 0 0 1px var(--wood-2);
  color: var(--ink); text-align: center;
}
.token.good { box-shadow: 0 0 0 1.5px var(--outline), 0 0 0 4px var(--good); }
.token.evil { box-shadow: 0 0 0 1.5px var(--outline), 0 0 0 4px var(--evil); }
.token .initial { font: 600 calc(var(--s) * .4)/1 var(--sans); }
.token .role { display: none; font: 600 calc(var(--s) * .15)/1.1 var(--sans); padding: 0 15%; word-break: break-word; }
.token.big, .rcard > .token { --s: 72px; }
.rcard > .token .role, .token.big .role, .rv-seat .token .role { display: block; font-size: calc(var(--s) * .16); }
.shroud { position: absolute; inset: 0; border-radius: 50%; background: rgba(8,6,10,.55); }
.shroud::after { content: ""; position: absolute; left: 50%; top: 18%; bottom: 18%; width: 2px; margin-left: -1px; background: var(--text-2); transform: rotate(45deg); }
.mini-token {
  --s: 32px; width: var(--s); height: var(--s); flex: none; display: inline-grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle closest-side, var(--parch) 0 calc(100% - 4px), var(--outline) calc(100% - 4px) calc(100% - 3px), var(--wood) calc(100% - 3px));
  box-shadow: 0 0 0 1.5px var(--outline); color: var(--ink); font: 600 14px/1 var(--sans);
}
.mini-token.good { box-shadow: 0 0 0 1.5px var(--outline), 0 0 0 3.5px var(--good); }
.mini-token.evil { box-shadow: 0 0 0 1.5px var(--outline), 0 0 0 3.5px var(--evil); }
.mini-token.dead { filter: grayscale(1) brightness(.55); }
.bar .mini-token { --s: 38px; font-size: 16px; margin: 0 3px; }

/* ---------- the circle ---------- */
.circle { position: relative; width: min(100%, calc(100dvh - 170px), 740px); aspect-ratio: 1; --t: 70px; }
.circle .ring { position: absolute; inset: 9%; border-radius: 50%; border: 1px solid var(--rule); }
.seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; padding: 0; width: calc(var(--t) * 1.5); color: var(--text-2); }
.seat .token { --s: var(--t); transition: box-shadow .2s, filter .2s, transform .15s; }
.seat .name { font: 500 calc(10px + var(--t) * .07)/1.2 var(--sans); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 6px; border-radius: 4px; }
.seat.me .name { color: var(--text); font-weight: 700; }
.seat:not(.me) .token.evil .initial { display: none; }
.seat:not(.me) .token.evil .role { display: block; font-size: calc(var(--s) * .17); }
.seat:hover .token { transform: translateY(-2px); }
.seat.dead .name { color: var(--faint); text-decoration: line-through; }
.seat.speaking .token { box-shadow: 0 0 0 1.5px var(--outline), 0 0 0 4px var(--text-2); }
.seat.nominee .token { box-shadow: 0 0 0 1.5px var(--outline), 0 0 0 5px var(--gold); }
.seat.nominee .name { color: #1a1206; background: var(--gold); font-weight: 600; }
.seat.filtered .name { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--faint); }
.seat.picked .token { box-shadow: 0 0 0 1.5px var(--outline), 0 0 0 5px var(--gold); transform: translateY(-3px); }
.seat.picked .name { background: var(--gold); color: #1a1206; font-weight: 600; }
.seat.dim { opacity: .38; }
.badge { position: absolute; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 10px; font: 600 12px/1 var(--sans); box-shadow: 0 0 0 2px var(--bg); }
.badge.wh { right: -4px; bottom: -2px; background: var(--surface-2); color: var(--text); }
.badge.hand { left: -5px; top: -4px; background: var(--gold); color: #1a1206; padding: 0 3px; }
.badge.hand svg { width: 14px; height: 14px; stroke-width: 2; }
.badge.gv { right: -3px; top: -3px; min-width: 12px; width: 12px; height: 12px; padding: 0; background: #e8e2f2; }
.badge.blk { left: 50%; bottom: -10px; transform: translateX(-50%); background: var(--text); color: var(--bg); }
.centre { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; width: 44%; pointer-events: none; }
.dial { width: 40%; max-width: 110px; display: block; margin: 0 auto 10px; }
.dial .rim { fill: var(--surface); stroke: var(--rule-2); stroke-width: 1.5; }
.dial .face { fill: var(--surface); stroke: none; }
.dial .night-arc { fill: none; stroke: var(--rule-2); stroke-width: 4; }
.dial .tick { stroke: var(--rule-2); stroke-width: 3; }
.dial .tick.done { stroke: var(--faint); }
.dial .hand { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.dial .hub { fill: var(--gold); stroke: none; }
.centre .ph { font: 700 clamp(24px, 2.6vw, 34px)/1.1 var(--sans); color: var(--text); }
.centre .ph-sub { font: 500 clamp(15px, 1.4vw, 18px)/1.25 var(--sans); color: var(--text-2); margin-top: 4px; }
.centre .block { font-size: 15px; color: var(--text-2); margin-top: 8px; min-height: 1em; }
.centre .block b { color: var(--gold); font-weight: 600; }

/* ---------- the chronicle ---------- */
.filters { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; flex: none; scrollbar-width: none; border-bottom: 1px solid var(--rule); }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 12px; background: transparent; border: 1px solid var(--rule-2); border-radius: 18px; color: var(--text-2); font: 500 14px/1 var(--sans); white-space: nowrap; }
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip.on { background: var(--surface-2); color: var(--text); border-color: var(--text-2); }
.chip.who { color: var(--gold); border-color: rgba(224,176,82,.5); }
#feed { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px 22px; overscroll-behavior: contain; }
#jump { position: absolute; right: 16px; bottom: calc(var(--dock-h) + 12px); z-index: 4; min-height: 40px; padding: 0 14px; background: var(--surface-2); color: var(--text); border: 1px solid var(--rule-2); border-radius: 20px; font: 600 14px/1 var(--sans); box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.ev { margin: 0 0 12px; }
.ev.fresh { animation: rise .28s cubic-bezier(0, 0, .2, 1) both; }
.divider { display: flex; align-items: center; gap: 9px; margin: 20px 0 12px; color: var(--faint); }
.divider .rule { flex: 1; height: 1px; background: var(--rule); }
.divider .lbl { font: 600 12px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.divider svg.i { width: 15px; height: 15px; }
.divider.big { margin-top: 28px; color: var(--text); }
.divider.big .lbl { font: 700 18px/1 var(--sans); letter-spacing: 0; text-transform: none; }
.divider.big .rule { background: var(--rule-2); }
.divider.big svg.i { width: 18px; height: 18px; color: var(--text-2); }

/* the Storyteller, to you alone: set apart with a gold rule */
.st-note { background: var(--surface); border-left: 3px solid var(--gold); border-radius: 0 6px 6px 0; padding: 10px 14px 11px; }
.st-note .h, .rcard .h { display: flex; align-items: center; gap: 7px; font: 600 12px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.st-note .h svg.i { width: 15px; height: 15px; }
.st-note p { margin: 0; font: 400 17px/1.45 var(--serif); }
.notice { color: var(--faint); font: italic 400 15.5px/1.4 var(--serif); padding: 2px 8px; text-align: center; }
.rcard { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 14px; }
.rcard.good { border-color: rgba(115,173,240,.35); } .rcard.evil { border-color: rgba(240,110,100,.35); }
.rcard .rc-body { flex: 1; min-width: 0; }
.rcard .h { color: var(--text-2); }
.rcard h3 { font: 700 22px/1.15 var(--sans); color: var(--text); margin: 0 0 6px; }
.rcard p { margin: 8px 0 0; color: var(--text-2); font: 400 16.5px/1.45 var(--serif); }
.rcard p.fine { font: 400 13.5px/1.45 var(--sans); }
.rcard .eyebrow { margin: 0 0 4px; }
.rcard.intro p { font-size: 16px; }
.rcard.intro > .token { --s: 56px; }
#role-banner { margin: 10px 12px 0; flex: none; max-height: 46vh; overflow: auto; }
#role-banner .ghost { flex: none; align-self: flex-start; }
@media (max-width: 560px) { #role-banner { flex-wrap: wrap; } #role-banner .ghost { width: 100%; } #role-banner > .token { --s: 56px; } }
.dawn { text-align: center; padding: 4px 8px; }
.dawn .narr { font: italic 400 17px/1.45 var(--serif); color: var(--text-2); margin: 0 0 8px; }
.dawn .none { font: 500 14px/1.3 var(--sans); color: var(--faint); margin: 0; }
.dawn .died { display: inline-flex; align-items: center; gap: 9px; margin: 0; padding: 9px 14px; background: var(--surface); border: 1px solid var(--rule-2); border-radius: 6px; color: var(--text); font: 500 16px/1.3 var(--sans); text-align: left; }
.dawn .died svg.i { width: 20px; height: 20px; }
.dawn .died b { font-weight: 700; }

/* speech in the town square */
.say { display: flex; gap: 10px; align-items: flex-start; }
.say .mini-token { margin-top: 2px; }
.say .body { min-width: 0; max-width: 88%; }
.say .who { display: flex; align-items: center; gap: 6px; font: 600 14px/1.2 var(--sans); color: var(--text); margin: 0 0 4px 2px; flex-wrap: wrap; }
.say .who svg.i { width: 14px; height: 14px; color: var(--faint); }
.say .bubble { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px 10px 10px 10px; padding: 8px 12px 9px; font: 400 17px/1.45 var(--serif); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.tag { font: 600 11px/1 var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--faint); border: 1px solid var(--rule-2); border-radius: 3px; padding: 3px 5px; }
.say.mine { flex-direction: row-reverse; }
.say.mine .who { justify-content: flex-end; margin: 0 2px 4px 0; }
.say.mine .bubble { background: var(--surface-2); border-radius: 10px 4px 10px 10px; }
.say.dead .bubble { color: var(--text-2); }
/* whispers: private, so set apart: a dashed edge, a lock, italic */
.say.whisper .who { color: var(--text-2); font-weight: 500; }
.say.whisper .who b, .say.whisper .who .to { color: var(--text-2); }
.say.whisper .bubble { background: var(--whisper-bg); border: 1px dashed var(--whisper-rule); font-style: italic; }
.say.whisper.mine .bubble { border-style: solid; }
/* nominations, votes, deaths */
.nomcard { background: var(--surface); border: 1px solid var(--rule-2); border-left: 3px solid var(--text); border-radius: 0 6px 6px 0; padding: 10px 14px 11px; }
.nomcard .h { display: flex; align-items: center; gap: 8px; font: 500 16px/1.3 var(--sans); color: var(--text-2); }
.nomcard .h svg.i { color: var(--text); }
.nomcard .h b { color: var(--text); font-weight: 700; }
.nomcard p { margin: 6px 0 0; font: italic 400 17px/1.45 var(--serif); color: var(--text); }
.nomcard.slay { border-left-color: var(--gold); }
.ballot { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 10px 12px 11px; }
.ballot .h { display: flex; align-items: center; gap: 8px; font: 500 15px/1.2 var(--sans); color: var(--text-2); margin-bottom: 9px; }
.ballot .h b { color: var(--text); font-weight: 700; }
.ballot .h .n { margin-left: auto; min-width: 28px; height: 28px; display: grid; place-items: center; border-radius: 14px; background: var(--gold); color: #1a1206; font: 700 15px/1 var(--sans); }
.ballot .h svg.i { color: var(--text-2); }
.votes { display: flex; flex-wrap: wrap; gap: 5px; }
.v { display: inline-flex; align-items: center; gap: 4px; font: 500 13.5px/1 var(--sans); padding: 6px 8px; border: 1px solid var(--rule-2); border-radius: 14px; color: var(--faint); }
.v svg.i { width: 13px; height: 13px; }
.v.yes { color: #1a1206; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.v.gv { border-style: dashed; }
.remarks { font: 400 16px/1.4 var(--serif); color: var(--text-2); }
.remarks > div { margin-top: 6px; }
.remarks b { font: 600 14px var(--sans); color: var(--text); }
.res { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--rule); font: 500 14.5px/1.3 var(--sans); color: var(--text-2); }
.res b { font-weight: 700; color: var(--text); }
.res.block { color: var(--text); font-weight: 600; }
.doom { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 14px 0; padding: 11px 14px; background: var(--surface-2); border-radius: 6px; color: var(--text); font: 500 16px/1.3 var(--sans); text-align: center; }
.doom b { font-weight: 700; }
.doom svg.i { width: 20px; height: 20px; }
.doom.quiet { background: transparent; border: 1px dashed var(--rule-2); color: var(--faint); }
.over-ev { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 20px 12px; margin: 20px 0 8px; border-top: 1px solid var(--rule-2); }
.over-ev b { font: 400 44px/1.05 var(--title); color: var(--text); }
.over-ev.good b { color: var(--good); } .over-ev.evil b { color: var(--evil); }
.over-ev em { font: italic 400 17px var(--serif); color: var(--text-2); }

/* ---------- the dock: what you can do right now ---------- */
#dock { --dock-pb: calc(12px + env(safe-area-inset-bottom)); flex: none; position: relative; z-index: 3; border-top: 1px solid var(--rule); background: var(--bg); padding: 12px 14px var(--dock-pb); max-height: 72%; overflow-y: auto; }
#dock.turn { border-top: 3px solid var(--gold); background: var(--surface); box-shadow: 0 -12px 28px rgba(0,0,0,.45); display: flex; flex-direction: column; overflow: hidden; }
/* A tall turn (many player picks, a text box, the Slayer box) scrolls inside .dock-body; the buttons in .dock-foot stay put. */
.dock-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.dock-foot { flex: none; padding-top: 10px; }
.dock-foot:empty { display: none; }
#dock.idle, #dock.over { padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
#dock.arrive { animation: dockin .26s cubic-bezier(0, 0, .2, 1); }
.wait { display: flex; align-items: center; gap: 11px; color: var(--text-2); min-height: 44px; font-size: 15px; }
.wait > svg.i { color: var(--faint); width: 20px; height: 20px; }
#dock.sealed .wait > svg.i { color: var(--gold); }
#dock.sealed .wait b { color: var(--text); font-weight: 600; }
.wait em { display: block; font: italic 400 15px var(--serif); }
.wait .primary { margin-left: auto; flex: none; }
.ask { display: flex; gap: 12px; align-items: flex-start; }
.what { flex: 1; min-width: 0; }
.kind { display: flex; align-items: center; gap: 9px; font: 600 13px/1 var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); }
.yt { background: var(--gold); color: #1a1206; padding: 5px 7px; border-radius: 4px; letter-spacing: .04em; }
.head { font: 600 18px/1.3 var(--sans); color: var(--text); margin: 9px 0 3px; }
.head b { font-weight: 700; color: var(--gold-2); }
.head .need { font: 500 15px/1 var(--sans); color: var(--text-2); margin-left: 6px; white-space: nowrap; }
.prompt { font-size: 14px; line-height: 1.45; color: var(--faint); cursor: pointer; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prompt.open { display: block; -webkit-line-clamp: unset; }
.timer { flex: none; font: 600 16px/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--text-2); padding: 7px 9px; border: 1px solid var(--rule-2); border-radius: 6px; }
.timer.low { color: #1a1206; background: var(--gold); border-color: var(--gold); }
.picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.pick { min-height: 44px; min-width: 44px; padding: 0 14px; background: var(--bg); border: 1px solid var(--rule-2); border-radius: 22px; color: var(--text); font: 500 15px/1 var(--sans); transition: transform .06s, background .12s; }
.pick:hover { border-color: var(--faint); }
.pick:active { transform: translateY(1px); }
.pick.on { background: var(--gold); border-color: var(--gold); color: #1a1206; }  /* same weight as unselected, so a pick never changes width and re-wraps the row */
.pick.dead { color: var(--faint); border-style: dashed; }
.pick.on.dead { color: #1a1206; }
.compose { position: relative; margin: 2px 0 10px; }
.compose textarea { padding-bottom: 26px; background: var(--bg); }
.count { position: absolute; right: 10px; bottom: 7px; font: 500 12px/1 var(--sans); color: var(--faint); font-variant-numeric: tabular-nums; }
.count.over { color: var(--evil); }
.actions { display: flex; gap: 10px; }
.actions .primary { flex: 1; }
.actions .ghost { flex: none; }
.vote-btns { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; }
.vote-btns .primary, .vote-btns .ghost { min-height: 56px; font-size: 17px; }
.vote-btns svg.i { width: 22px; height: 22px; stroke-width: 2; }
.slayer-row { margin-top: 2px; }
.slayer-box { margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--rule-2); border-radius: 6px; }
#dock .err { margin: 0 0 8px; }

/* ---------- sheets ---------- */
#scrim { position: fixed; inset: 0; background: rgba(5,3,8,.6); z-index: 20; }
#sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%); z-index: 21; display: flex; flex-direction: column; background: var(--bg); border-left: 1px solid var(--rule-2); box-shadow: -20px 0 50px rgba(0,0,0,.5); animation: slidein .2s cubic-bezier(0, 0, .2, 1); }
#sheet > header { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 18px; border-bottom: 1px solid var(--rule); flex: none; }
#sheet h3 { flex: 1; font: 700 19px/1.2 var(--sans); color: var(--text); }
#sheet .close { font: 400 26px/1 var(--sans); }
#sheet-body { flex: 1; overflow-y: auto; padding: 16px 18px 34px; }
#sheet-body h4 { font: 600 12px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin: 22px 0 10px; }
#sheet-body h4.good { color: var(--good); } #sheet-body h4.evil { color: var(--evil); }
#sheet-body p { margin: 0 0 10px; color: var(--text-2); }
#sheet-body p.told { background: var(--surface); border-left: 3px solid var(--gold); padding: 8px 12px; font: 400 16px/1.45 var(--serif); color: var(--text); }
#sheet-body .circle { width: 100%; margin: 4px auto 14px; }
#sheet-body .rcard { margin: 0 0 16px; }
.kv { display: flex; flex-wrap: wrap; gap: 6px; }
.kv span { padding: 7px 11px; border: 1px solid var(--rule-2); border-radius: 16px; font: 500 14px/1 var(--sans); }
.kv span.evil { border-color: rgba(240,110,100,.5); }
.char { display: flex; gap: 12px; align-items: flex-start; padding: 9px 4px; border-bottom: 1px solid var(--rule); }
.char b { display: block; font: 600 15px/1.2 var(--sans); color: var(--text); margin-bottom: 2px; }
.char span:not(.mini-token) { font-size: 14.5px; color: var(--text-2); }
.char.mine { background: var(--surface); box-shadow: inset 3px 0 0 var(--gold); }
.char .mini-token { --s: 28px; font-size: 13px; margin-top: 2px; }
.rules h4 { text-transform: capitalize !important; letter-spacing: 0 !important; font-size: 15px !important; color: var(--text) !important; }
.rules p { white-space: pre-wrap; font: 400 16px/1.5 var(--serif); }
.rules .note { background: var(--surface); border-left: 3px solid var(--gold); color: var(--text) !important; padding: 10px 14px; font: 400 14.5px/1.5 var(--sans) !important; }
#notes-pad { min-height: 55vh; }

/* ---------- the reveal: the Grimoire opens ---------- */
#reveal { position: fixed; inset: 0; z-index: 30; overflow-y: auto; background: var(--bg); padding: 24px 14px 40px; animation: fade .25s ease-out; }
.rv { max-width: 880px; margin: 0 auto; padding: 18px 8px; text-align: center; }
.rv .crest { font: 600 12px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 0 0 6px; }
.rv h2 { font: 400 clamp(52px, 12vw, 84px)/1 var(--title); color: var(--text); }
#reveal.good .rv h2 { color: var(--good); }
#reveal.evil .rv h2 { color: var(--evil); }
.rv .why { font: italic 400 19px/1.4 var(--serif); color: var(--text-2); margin: 6px 0 26px; }
.rv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 18px 10px; margin: 0 0 22px; }
.rv-seat { display: flex; flex-direction: column; align-items: center; gap: 3px; animation: rise .35s cubic-bezier(0, 0, .2, 1) both; }
.rv-seat .token { --s: 72px; margin-bottom: 8px; }
.rv-seat b { font: 600 15px/1.2 var(--sans); color: var(--text); }
.rv-seat b em { font: italic 400 14px var(--serif); }
.rv-seat small { font-size: 13px; line-height: 1.3; color: var(--text-2); }
.rv-seat small.human { color: var(--gold); font-weight: 600; }
.rv-seat small.model { color: var(--faint); }
.rv-seat small.read { color: var(--text); }
.rv-seat.you .token { outline: 2px solid var(--gold); outline-offset: 6px; }
.reads { text-align: left; margin: 18px 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; }
.reads h3 { font: 700 17px/1.2 var(--sans); color: var(--text); margin: 0 0 6px; }
.reads table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.reads th { font: 500 12px/1.2 var(--sans); color: var(--faint); text-align: left; padding: 6px; }
.reads td { padding: 7px 6px; border-top: 1px solid var(--rule); }
.scroll-x { overflow-x: auto; }
.rv-actions { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; margin: 20px 0 14px; }
.rv .fine a { font-weight: 500; }
@media (max-width: 640px) { .rv-actions { grid-template-columns: 1fr; } .rv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 6px; } .rv-seat .token { --s: 64px; } }

/* ---------- phone ---------- */
@media (max-width: 979px) {
  .stage { display: flex; flex-direction: column; }
  #town { display: none; }
  #chronicle { flex: 1; }
  .strip { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: 4px 2px; padding: 8px 6px 6px; flex: none; border-bottom: 1px solid var(--rule); }
  .strip .seat { position: static; transform: none; width: auto; min-width: 0; gap: 3px; --t: 34px; min-height: 52px; }
  .strip .seat .token .role, .strip .seat.me .token .role, .strip .seat .token.evil .role { display: none; }
  .strip .seat.me .token .initial, .strip .seat .token.evil .initial { display: block; }
  .strip .seat .token.good { box-shadow: 0 0 0 1.5px var(--outline), 0 0 0 3px var(--good); }
  .strip .seat .token.evil { box-shadow: 0 0 0 1.5px var(--outline), 0 0 0 3px var(--evil); }
  .strip .seat .name { font-size: 12.5px; padding: 1px 4px; }
  .strip .badge { transform: scale(.85); }
  .strip .badge.blk { transform: translateX(-50%) scale(.85); bottom: -7px; }
  .strip .seat.nominee .token, .strip .seat.picked .token { box-shadow: 0 0 0 1.5px var(--outline), 0 0 0 4px var(--gold); }
  .strip .seat.speaking .token { box-shadow: 0 0 0 1.5px var(--outline), 0 0 0 3px var(--text-2); }
  .phase { grid-template-columns: 1fr auto; padding: 9px 12px 10px; gap: 8px 10px; }
  .phase .track { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .ph-title { font-size: 20px; }
  .ph-sub { font-size: 16px; }
  .phase .ph-sub::before { margin-right: 7px; }
  .turnflag.yours .timer { display: none; }
  .turnflag { font-size: 14px; padding: 8px 10px; }
  #feed { padding: 10px 10px 18px; }
  .say .body { max-width: 92%; }
  #dock { --dock-pb: calc(10px + env(safe-area-inset-bottom)); padding: 10px 12px var(--dock-pb); }
  .picks { margin: 10px 0 8px; }
  .head { font-size: 17px; }
}
@media (max-width: 380px) { .tools .icon { width: 40px; } .ph-title { font-size: 18px; } .ph-sub { font-size: 15px; } }
@media (min-width: 980px) { .phase { padding-left: 22px; padding-right: 22px; } #feed { padding: 14px 20px 26px; } #dock { padding: 14px 20px 16px; } }

/* ---------- motion: small, and none for those who ask ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes dockin { from { transform: translateY(12px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.rcard .eyebrow { font: 600 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 4px; }
.rv-seat small.rv-char { font: 600 13.5px/1.25 var(--sans); }
.rv-seat small.rv-char.good { color: var(--good); } .rv-seat small.rv-char.evil { color: var(--evil); }
