/* Kingdom Road — festival-banner aesthetic: deep purple, gold, cream, with the
   primary-colour space types. Phase 6 layers cutscenes and camera motion on top;
   nothing here assumes a static board. */

:root {
  /* Quieter and cooler than the first pass. The board's space colours are the
     only saturated things on screen; everything around them is near-neutral so
     the eye goes to the path, not the furniture. */
  --purple-deep: #131220;
  --purple: #1e1c30;
  --purple-light: #2c2942;
  --gold: #c9a227;
  --gold-bright: #e8c86a;
  --cream: #e6dcc4;
  --ink: #131220;

  --easy: #d9b64a;
  --medium: #4a86a8;
  --hard: #c05a63;
  --sabbath: #5b9e78;
  --choice: #d4894a;

  --radius: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --hairline: rgba(230, 220, 196, 0.14);
  --font: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100dvh;
  /* Flat, not a vignette. */
  background: var(--purple-deep);
  color: var(--cream);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

body.sabbath-dusk {
  background: #191627;
  transition: background 1.2s ease;
}

a { color: var(--gold-bright); }
.muted { opacity: 0.7; }
.hidden { display: none; }
.phase-note { opacity: 0.7; padding: 2rem; text-align: center; }
.warn { color: #ffc46b; }
.form-error { color: #ff9aa6; min-height: 1.2em; margin: 0.35rem 0; }

/* --- buttons and fields --------------------------------------------------- */

.btn {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  border-radius: var(--radius);
  padding: 0.85rem 1.2rem;
  background: rgba(246, 239, 223, 0.12);
  color: var(--cream);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }

.btn-primary { background: var(--gold); color: var(--ink); }
.btn-danger { background: var(--hard); }
.btn-ghost { background: transparent; border: 1px solid var(--hairline); }
.btn-small { padding: 0.45rem 0.75rem; font-size: 0.85rem; }
.btn-huge { width: 100%; padding: 1.15rem; font-size: 1.2rem; margin-top: 0.75rem; }

.field {
  width: 100%;
  padding: 0.85rem;
  margin: 0.3rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.28);
  color: var(--cream);
  font-family: var(--font);
  font-size: 1rem;
}
.field-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.7; margin: 0.75rem 0 0.2rem; }

/* --- connection pill ------------------------------------------------------ */

.conn-pill {
  position: fixed;
  top: 0.6rem; right: 0.6rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
}
.conn-pill[data-status="connected"] { color: #9be49b; }
.conn-pill[data-status="reconnecting"],
.conn-pill[data-status="connecting"] { color: #ffc46b; animation: pulse 1.2s infinite; }
.conn-pill[data-status="rejected"] { color: #ff9aa6; }

/* An offline board must LOOK offline — a frozen board that looks live is worse
   than an obvious one. */
.is-offline .board-mount,
.is-offline .action-screen { filter: grayscale(0.6) brightness(0.7); }

@keyframes pulse { 50% { opacity: 0.45; } }

/* --- landing -------------------------------------------------------------- */

.landing { display: grid; place-items: center; min-height: 100dvh; padding: 1.5rem; }
.landing-card {
  width: min(420px, 100%);
  background: rgba(0, 0, 0, 0.3);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.brand { font-size: 2.4rem; margin: 0; color: var(--gold-bright); letter-spacing: 0.02em; }
.brand-sub { margin: 0 0 1.5rem; opacity: 0.75; }
.landing-links { display: flex; gap: 1rem; justify-content: center; margin-top: 1.25rem; font-size: 0.9rem; }

/* The host's three settings, asked once, before the game exists. Left-aligned
   inside a centred card because a form reads badly centred. */
.host-options {
  display: flex; flex-direction: column; gap: 0.9rem;
  text-align: left; margin: 1.25rem 0 0.5rem;
}
.host-options .opt { display: block; }
.host-options .field { margin: 0.25rem 0 0; }
.opt-label {
  display: block; font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.1em; opacity: 0.75;
}
.opt-hint { display: block; font-size: 0.8rem; opacity: 0.55; margin-top: 0.25rem; }
/* The switch puts its box beside the label rather than under it. Qualified by
   .host-options because `.host-options .opt` is two classes and this was one:
   the block rule won on specificity and the box sat above its own label. */
.host-options .opt-switch {
  display: flex; gap: 0.7rem; align-items: flex-start; cursor: pointer;
}
.host-options .opt-switch input {
  width: 1.15rem; height: 1.15rem; margin-top: 0.15rem; flex: none;
  /* Without this the box paints in the browser's own blue — the one bright
     hue on a screen whose palette is gold, cream and ink. */
  accent-color: var(--gold);
}

/* --- host ----------------------------------------------------------------- */

.host-shell {
  display: grid;
  grid-template-columns: 1fr 280px;
  min-height: 100dvh;
}
.host-main { position: relative; display: flex; flex-direction: column; min-width: 0; }

.board-mount { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0.5rem; }
.board-svg { width: 100%; height: 100%; max-height: 100dvh; }

.token { transition: none; }
.token-animated { transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1); }

/* 6c: the hop — the outer .token group glides between tiles (above) while the
   inner body arcs up and lands with a squash. Transform-only, one node. */
.token-hop {
  animation: token-hop 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  transform-box: fill-box;
  transform-origin: 50% 88%;
}
@keyframes token-hop {
  0%   { transform: translateY(0) scale(1, 1); }
  38%  { transform: translateY(-3.4px) scale(0.95, 1.06); }
  72%  { transform: translateY(0) scale(1, 1); }
  84%  { transform: translateY(0) scale(1.14, 0.8); }   /* landing squash */
  100% { transform: translateY(0) scale(1, 1); }
}

.turn-banner {
  text-align: center;
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  padding: 0.5rem;
  min-height: 2.8rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
/* The sweep lands early (by ~30% of the run) so the text is readable exactly
   when the turn_change stinger's attack sounds — both fire off the same
   kb:event, so matching their onsets is all the sync there is to do — then
   the remainder is a gentle settle. */
.banner-sweep { animation: sweep 0.7s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes sweep {
  0% { opacity: 0; transform: translateX(-44px); }
  30% { opacity: 1; transform: translateX(3px); }
  100% { opacity: 1; transform: none; }
}

.ticker {
  text-align: center;
  padding: 0.6rem;
  min-height: 2.2rem;
  font-size: 1.05rem;
  opacity: 0.9;
}
.ticker-in { animation: fadeUp 0.5s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

.stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.stage > * { pointer-events: auto; }

/* 6c: the dimming layer behind a question card — flat ink, faded in, so the
   card reads against the board instead of fighting it. */
.stage.has-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(19, 18, 32, 0.55);
  animation: dim-in 0.35s ease;
}
@keyframes dim-in { from { opacity: 0; } }

/* 6c: the spin dial — a flat printed disc; the needle decelerates over ~0.7s
   in time with the ten spin ticks, then the roll stamps in. */
.spin-dial {
  position: relative;
  display: grid;
  place-items: center;
  pointer-events: none;
  animation: fadeUp 0.2s ease;
}
/* Sized for a television across a room: the 7.5rem disc it replaced was a
   coin on a 1080p screen and the roll was unreadable from the sofa. The
   second, inset ring is the printed-dial detail — a double keyline, the way a
   1970s board's spinner was actually printed. Flat ink on flat paper: no
   gradient, no filter. */
.spin-face {
  width: 15rem; height: 15rem;
  border-radius: 50%;
  background: var(--kb-paper, #e7dcc2);
  border: 5px solid var(--kb-ink, #26221c);
  box-shadow:
    inset 0 0 0 0.55rem var(--kb-paper, #e7dcc2),
    inset 0 0 0 0.7rem var(--kb-ink, #26221c),
    8px 8px 0 rgba(19, 18, 32, 0.5);
  display: grid; place-items: center;
}
/* Six ticks, one per face of the die the spinner stands in for. */
.spin-tick {
  position: absolute;
  top: 0.95rem;
  width: 0.2rem; height: 0.85rem;
  background: var(--kb-ink, #26221c);
  transform-origin: 50% 6.05rem;
}
.spin-needle {
  width: 0; height: 0;
  border-left: 0.85rem solid transparent;
  border-right: 0.85rem solid transparent;
  border-bottom: 5.6rem solid var(--kb-ink, #26221c);
  transform-origin: 50% 100%;
  translate: 0 -2.8rem;
  animation: needle-settle 0.77s cubic-bezier(0.15, 0.6, 0.2, 1) forwards;
}
/* The hub the needle turns on, printed over its tail. */
.spin-hub {
  position: absolute;
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  background: var(--kb-ink, #26221c);
}
@keyframes needle-settle {
  0% { transform: rotate(0turn); }
  100% { transform: rotate(2.6turn); }
}
/* The roll lands on a paper chip rather than floating over the needle, which
   at this size crossed the digit and made 4 and 1 hard to tell apart. */
.spin-roll {
  position: absolute;
  display: grid; place-items: center;
  width: 6.4rem; height: 6.4rem;
  border-radius: 50%;
  background: var(--kb-paper, #e7dcc2);
  border: 4px solid var(--kb-ink, #26221c);
  font-size: 4.2rem; font-weight: 800; line-height: 1;
  color: var(--kb-ink, #26221c);
  animation: roll-stamp 0.35s cubic-bezier(0.2, 1.1, 0.3, 1) 0.77s both;
}
@keyframes roll-stamp {
  from { transform: scale(2); opacity: 0; }
}

/* --- lobby ---------------------------------------------------------------- */

.lobby {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
  background: rgba(14, 13, 24, 0.94);
  border: 1px solid var(--hairline);
  padding: 2.75rem;
  border-radius: 16px;
  box-shadow: var(--shadow);
  max-width: 900px;
}
.lobby-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.15em; opacity: 0.65; margin: 0; }
.code-huge {
  font-size: clamp(3rem, 10vw, 6rem);
  letter-spacing: 0.18em;
  font-weight: 500;
  color: var(--gold-bright);
  margin: 0.25rem 0;
  font-weight: 700;
}
.lobby-hint { opacity: 0.75; font-size: 0.9rem; }
.qr-img { width: 190px; height: 190px; background: var(--cream); padding: 8px; border-radius: 12px; }
.lobby-players, .lobby-actions { grid-column: 1 / -1; }

.avatar-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.5rem; }
.avatar-chip {
  display: flex; align-items: center; gap: 0.4rem;
  background: rgba(246, 239, 223, 0.12);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
}
.avatar-glyph { font-size: 1.3rem; }
.pop-in { animation: pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }

.season-banner { margin-top: 1rem; text-align: left; }
.season-line { margin: 0.25rem 0; font-size: 0.9rem; color: var(--gold-bright); }

/* --- scoreboard ----------------------------------------------------------- */

.scoreboard {
  background: rgba(0, 0, 0, 0.35);
  padding: 1rem;
  overflow-y: auto;
}
.scoreboard-title { margin: 0; font-size: 1.1rem; color: var(--gold-bright); }
.scoreboard-round { margin: 0 0 1rem; opacity: 0.6; font-size: 0.85rem; }
.score-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto auto;
  gap: 0.4rem;
  align-items: center;
  padding: 0.55rem 0.5rem;
  border-radius: 10px;
  margin-bottom: 0.3rem;
  background: rgba(230, 220, 196, 0.04);
}
.score-row.is-active { background: rgba(201, 162, 39, 0.14); box-shadow: inset 2px 0 0 var(--gold); }
.score-avatar { font-size: 1.3rem; }
.score-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-talents { font-weight: 700; color: var(--gold-bright); }
.score-sheaf, .score-grace { font-size: 0.85rem; }

/* --- question staging ----------------------------------------------------- */

.question-card {
  width: min(760px, 92vw);
  background: rgba(14, 13, 24, 0.97);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 1.9rem 2rem;
  box-shadow: var(--shadow);
}
.slide-in { animation: slideIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes slideIn { from { transform: translateY(30px) scale(0.97); opacity: 0; } }

.question-category { text-transform: uppercase; letter-spacing: 0.15em; font-size: 0.8rem; color: var(--gold); margin: 0; }
.question-text { font-size: 1.6rem; margin: 0.5rem 0 1.25rem; }
.question-reference { text-align: right; opacity: 0.7; font-style: italic; margin-top: 0.75rem; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.option {
  display: flex; gap: 0.7rem; align-items: center;
  background: rgba(230, 220, 196, 0.05);
  border: 1px solid var(--hairline);
  padding: 0.95rem 1.1rem;
  border-radius: 9px;
  font-size: 1.05rem;
}
.option-key {
  display: grid; place-items: center;
  width: 1.7rem; height: 1.7rem; flex: none;
  border-radius: 6px;
  background: rgba(230, 220, 196, 0.12); color: var(--cream);
  font-weight: 600; font-size: 0.85rem;
}
.option.is-correct { background: rgba(91, 158, 120, 0.55); border-color: #5b9e78; }
.option.is-wrong { background: rgba(192, 90, 99, 0.3); border-color: rgba(192, 90, 99, 0.6); animation: shake 0.3s ease; }
@keyframes flash { 50% { filter: brightness(1.6); } }
@keyframes shake {
  25% { transform: translateX(-6px); } 75% { transform: translateX(6px); }
}

.countdown { height: 6px; background: rgba(246, 239, 223, 0.15); border-radius: 3px; margin-top: 1.25rem; overflow: hidden; }
.countdown-fill { height: 100%; background: var(--gold-bright); transform-origin: left; }

/* --- cutscenes: vintage card inserts (Phase 6c) ---------------------------- */
/* A takeover beat is a parchment card with a double keyline and one flat-print
   illustration — the card you would pull from the game box. The scrim behind
   it is flat ink at partial opacity: no gradients, no filters, and every
   moving part below animates transform/opacity only, so the global
   reduced-motion rule shortens all of it for free. */

.cutscene {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(19, 18, 32, 0.62);
  text-align: center;
  animation: fadeUp 0.3s ease;
  cursor: pointer;
  z-index: 5;
}
.cutscene-card {
  width: min(560px, 86vw);
  background: var(--kb-paper, #e7dcc2);
  color: var(--kb-ink, #26221c);
  border: 2px solid var(--kb-ink, #26221c);
  box-shadow: inset 0 0 0 5px var(--kb-paper, #e7dcc2),
              inset 0 0 0 6px var(--kb-ink, #26221c),
              8px 8px 0 rgba(19, 18, 32, 0.55);   /* hard offset, not a blur */
  border-radius: 4px;
  padding: 1.4rem 1.6rem 1rem;
  animation: card-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes card-in {
  from { transform: translateY(26px) rotate(-1.2deg); opacity: 0; }
}
.cutscene-art { width: 100%; display: block; }
.cutscene-title {
  margin: 0.7rem 0 0.1rem;
  font-family: var(--kb-display, inherit);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.28em;
}
.cutscene-caption { margin: 0.2rem 0 0; font-size: 1.35rem; }
.cutscene-hint {
  margin: 0.8rem 0 0;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.45;
}

/* Gate: the door leaf swings from its left jamb. */
.cut-door {
  transform-box: fill-box;
  transform-origin: 0% 100%;
  animation: door-open 3s cubic-bezier(0.5, 0, 0.3, 1) forwards;
}
@keyframes door-open {
  0%, 22% { transform: none; }
  80%, 100% { transform: skewY(-6deg) scaleX(0.12); }   /* seen edge-on */
}
.cut-motif { animation: motif-rise 3.2s ease both; }
@keyframes motif-rise {
  0%, 35% { opacity: 0; transform: translateY(4px); }
  60%, 100% { opacity: 1; transform: none; }
}

/* Trumpets: rising light, and the die upgrade stamping in. */
.cut-rays {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: rays-rise 3.2s cubic-bezier(0.3, 0, 0.3, 1) both;
}
@keyframes rays-rise {
  0% { opacity: 0; transform: scale(0.4); }
  45%, 100% { opacity: 1; transform: scale(1); }
}
.cut-die-old { animation: die-retire 3.2s ease both; transform-box: fill-box; transform-origin: 50% 50%; }
@keyframes die-retire {
  0%, 55% { opacity: 1; transform: none; }
  85%, 100% { opacity: 0.35; transform: scale(0.9); }
}
.cut-die-new { animation: die-stamp 3.2s cubic-bezier(0.2, 1.1, 0.3, 1) both; transform-box: fill-box; transform-origin: 50% 50%; }
@keyframes die-stamp {
  0%, 45% { opacity: 0; transform: scale(1.8); }
  62%, 100% { opacity: 1; transform: scale(1); }
}

/* Atonement: the chains cross the pit (~1.6s in, inside the stinger), then
   the paper brightens — timed to the music change the audio already makes. */
.cut-chain-a { animation: chain-a 3.4s cubic-bezier(0.5, 0, 0.2, 1) both; }
.cut-chain-b { animation: chain-b 3.4s cubic-bezier(0.5, 0, 0.2, 1) both; }
@keyframes chain-a {
  0%, 12% { transform: translateX(-96px); }
  47%, 100% { transform: none; }
}
@keyframes chain-b {
  0%, 12% { transform: translateX(96px); }
  47%, 100% { transform: none; }
}
.cut-brighten { animation: brighten 3.4s ease both; transform-box: fill-box; transform-origin: 50% 60%; }
@keyframes brighten {
  0%, 55% { opacity: 0; transform: scale(0.6); }
  80%, 100% { opacity: 1; transform: scale(1); }
}

/* The Sabbath heal: the storm breaks apart, the candle stays lit. */
.cut-storm-a { animation: storm-a 2.6s ease both; }
.cut-storm-b { animation: storm-b 2.6s ease both; }
@keyframes storm-a {
  0%, 30% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translate(-20px, -8px); }
}
@keyframes storm-b {
  0%, 30% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translate(20px, -8px); }
}
.cut-candle { animation: candle-up 2.6s ease both; }
@keyframes candle-up {
  0% { opacity: 0.4; }
  55%, 100% { opacity: 1; }
}

/* Great White Throne: the covers open, the writing appears. */
.cut-leaf-left { transform-box: fill-box; transform-origin: 100% 50%; animation: leaf-left 2.2s cubic-bezier(0.4, 0, 0.2, 1) both; }
.cut-leaf-right { transform-box: fill-box; transform-origin: 0% 50%; animation: leaf-right 2.2s cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes leaf-left {
  0%, 15% { transform: scaleX(0.06); }
  55%, 100% { transform: none; }
}
@keyframes leaf-right {
  0%, 15% { transform: scaleX(0.06); }
  55%, 100% { transform: none; }
}
.cut-line { animation: line-in 2.2s ease both; }
@keyframes line-in {
  0%, 60% { opacity: 0; }
  90%, 100% { opacity: 0.5; }
}

/* Kingdom: the crown descends and settles. */
.cut-crown { animation: crown-descend 3.4s cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes crown-descend {
  0%, 10% { transform: translateY(-34px); opacity: 0; }
  22% { opacity: 1; }
  60% { transform: translateY(0); }
  72% { transform: translateY(-2.5px); }   /* one soft settle bounce */
  84%, 100% { transform: translateY(0); }
}

/* Grace: the lamb steps in. */
.cut-lamb { animation: lamb-in 2s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@keyframes lamb-in {
  0% { transform: translateX(-18px); opacity: 0; }
  40%, 100% { transform: none; opacity: 1; }
}

/* --- podium --------------------------------------------------------------- */

.podium {
  background: rgba(10, 6, 18, 0.95);
  padding: 2rem;
  border-radius: 20px;
  width: min(700px, 92vw);
}
.podium-list { list-style: none; padding: 0; }
.podium-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto auto;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(246, 239, 223, 0.15);
  align-items: center;
}
.podium-place { font-size: 1.4rem; color: var(--gold-bright); font-weight: 700; }

/* 6c: rows reveal from last place up to the winner (delays set inline, in
   reverse order, by renderPodium). Clicking the podium removes .podium-reveal
   and everything shows at once — the skip rule applies here too. */
.podium-reveal .podium-row {
  animation: podium-row-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
@keyframes podium-row-in {
  from { opacity: 0; transform: translateY(14px); }
}
.podium-talents { font-weight: 700; }
.podium-accuracy { opacity: 0.7; font-size: 0.9rem; }
.podium-note { opacity: 0.6; font-size: 0.85rem; margin-top: 1rem; }

/* The Steward's closing paragraph. Arrives after the podium has rendered, or
   never — so it is styled to slot in under the note without shifting anything
   above it. Full width, like the game-card chronicle. */
.chronicle {
  margin: 1.25rem 0 0;
  font-size: 0.95rem;
  line-height: 1.55;
  text-align: left;
  opacity: 0.85;
  animation: fadeUp 0.8s ease both;
}

/* --- player phone --------------------------------------------------------- */

.player-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.join-card { margin-top: 2rem; }
.join-title { color: var(--gold-bright); margin: 0; text-align: center; }
.join-code { text-align: center; letter-spacing: 0.2em; opacity: 0.7; margin: 0.25rem 0 1.5rem; }

.avatar-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.avatar-btn {
  aspect-ratio: 1;
  font-size: 1.9rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: rgba(246, 239, 223, 0.1);
  cursor: pointer;
}
.avatar-btn.is-chosen { border-color: var(--gold-bright); background: rgba(224, 179, 60, 0.28); }

.nudge {
  font-size: 0.85rem;
  opacity: 0.85;
  background: rgba(224, 179, 60, 0.12);
  border-left: 3px solid var(--gold);
  padding: 0.6rem 0.8rem;
  border-radius: 0 10px 10px 0;
}

.player-status { display: flex; justify-content: space-between; align-items: center; }
.player-identity { display: flex; align-items: center; gap: 0.5rem; }
.player-glyph { font-size: 2rem; }
.player-name { font-weight: 700; }
.player-stats { display: flex; gap: 1rem; }
.stat { text-align: center; }
.stat-value { display: block; font-size: 1.4rem; font-weight: 700; color: var(--gold-bright); }
.stat-label { font-size: 0.7rem; text-transform: uppercase; opacity: 0.6; }

.watch-hint { opacity: 0.75; text-align: center; margin: auto 0; }

/* Actions sit in the lower half, where a thumb reaches. */
.action-screen {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex: 1;
  gap: 0.6rem;
}
.action-title { text-transform: uppercase; letter-spacing: 0.15em; font-size: 0.85rem; color: var(--gold); text-align: center; margin: 0; }
.q-text { font-size: 1.3rem; text-align: center; margin: 0 0 0.5rem; }
.q-options { display: grid; gap: 0.6rem; }

.btn-option {
  display: flex; align-items: center; gap: 0.7rem;
  text-align: left;
  min-height: 4rem;
  font-size: 1.05rem;
  font-weight: 500;
}
.btn-option.is-picked { background: var(--gold); color: var(--ink); }

.btn-spin {
  background: var(--gold);
  color: var(--ink);
  font-size: 2.2rem;
  letter-spacing: 0.1em;
  border-radius: 50%;
  aspect-ratio: 1;
  margin: 0 auto 2rem;
  /* Sized for a thumb on a phone, but capped so a desktop window does not turn
     it into a full-screen disc. `width: 60%` alone ballooned to ~1200px. */
  width: min(60%, 16rem);
  min-height: 0;
}

/* The phone UI is portrait-first. In a wide desktop window (the harness, or a
   tablet) keep it in a phone-shaped column rather than stretching edge to edge. */
.player-shell {
  width: min(100%, 30rem);
  margin: 0 auto;
}

.wager-value { display: block; text-align: center; font-size: 3rem; color: var(--gold-bright); font-weight: 700; }
.wager-slider { width: 100%; height: 3rem; accent-color: var(--gold); }

.fork-choices, .difficulty-choices { display: grid; gap: 0.75rem; }
.fork-choices .btn, .difficulty-choices .btn {
  display: flex; flex-direction: column; gap: 0.2rem; min-height: 5rem;
}
.btn-narrow { background: linear-gradient(135deg, #d1495b, #8a2f3c); }
.btn-broad { background: linear-gradient(135deg, #3a7ca5, #27566f); }
.btn-easy { background: var(--easy); color: var(--ink); }
.btn-medium { background: var(--medium); }
.btn-hard { background: var(--hard); }
.difficulty-choices .btn strong { text-transform: capitalize; font-size: 1.2rem; }

.grace-screen .action-title { font-size: 1.6rem; }

/* --- admin ---------------------------------------------------------------- */

.admin { max-width: 1000px; margin: 0 auto; padding: 1.5rem; }
.admin-header { display: flex; justify-content: space-between; align-items: baseline; }
.admin-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0; }
.admin-controls .field { width: auto; flex: 1 1 160px; margin: 0; }

.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.4rem; }
.health-cell {
  display: flex; justify-content: space-between;
  background: rgba(246, 239, 223, 0.08);
  padding: 0.4rem 0.6rem; border-radius: 8px; font-size: 0.8rem;
}
.health-cell.is-short { background: rgba(209, 73, 91, 0.3); }
.health-count { font-weight: 700; color: var(--gold-bright); }

.q-row, .draft-card {
  display: flex; justify-content: space-between; gap: 1rem;
  background: rgba(246, 239, 223, 0.06);
  padding: 0.9rem; border-radius: 12px; margin-bottom: 0.5rem;
}
.draft-card { flex-direction: column; border-left: 3px solid var(--gold); }
.q-row.is-inactive { opacity: 0.5; }
.q-meta, .draft-meta { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.6; margin: 0 0 0.3rem; }
.q-answer { font-size: 0.85rem; color: #9be49b; margin: 0.3rem 0 0; }
.draft-options li.is-correct { color: #9be49b; font-weight: 700; }
.row-actions { display: flex; gap: 0.4rem; align-items: flex-start; flex: none; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  display: grid; place-items: center; padding: 1rem;
}
.modal {
  background: var(--purple);
  padding: 1.5rem; border-radius: 18px;
  width: min(560px, 100%); max-height: 90dvh; overflow-y: auto;
}

/* --- the scorecards (/leaderboard and /me) -------------------------------- */
/* A printed score sheet from the game's own box: cream stock, one dark ink for
   every keyline and every letter, and the board's four spot colours used only
   to tab a block. The rules are hairlines, the shadow is a hard offset, and
   there is no gradient and no filter anywhere below — same print language as
   the board and the cutscene cards, and it reuses their palette variables so a
   scorecard repaints with the board rather than carrying its own colours. */

.card-page {
  min-height: 100dvh;
  padding: clamp(1rem, 4vw, 3rem) 1rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.card-sheet {
  width: min(880px, 100%);
  background: var(--kb-paper);
  color: var(--kb-ink);
  border: 2px solid var(--kb-ink);
  box-shadow: 10px 10px 0 rgba(19, 18, 32, 0.5);   /* hard offset, not a blur */
  border-radius: 3px;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  font-family: var(--kb-display);
}
.card-sheet a { color: var(--kb-ink); }

.card-head { border-bottom: 3px double var(--kb-ink); padding-bottom: 1rem; }
.card-eyebrow {
  margin: 0; font-size: 0.7rem; letter-spacing: 0.32em;
  text-transform: uppercase; opacity: 0.6;
}
.card-title { margin: 0.15rem 0 0; font-size: clamp(1.9rem, 6vw, 2.8rem); letter-spacing: 0.04em; }
.card-sub { margin: 0.35rem 0 0; font-size: 0.95rem; max-width: 56ch; opacity: 0.75; }
.card-nav { display: flex; gap: 1.25rem; margin-top: 0.9rem; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; }

/* One block per claim. The colour tab is the only hue on the sheet, and the two
   groups get different ones because they are different claims about a player. */
.card-block { margin-top: 2rem; border-top: 1px solid var(--kb-ink); padding-top: 1rem; }
.card-block[data-tone="easy"] { border-top-color: var(--kb-easy); }
.card-block[data-tone="medium"] { border-top-color: var(--kb-medium); }
.card-block[data-tone="hard"] { border-top-color: var(--kb-hard); }
.card-block[data-tone="commandments"] { border-top-color: var(--kb-commandments); }
.card-block { border-top-width: 5px; }

.card-block-title { margin: 0; font-size: 1.35rem; letter-spacing: 0.16em; text-transform: uppercase; }
.card-blurb { margin: 0.4rem 0 1.25rem; font-size: 0.9rem; max-width: 62ch; opacity: 0.8; }
.card-note { margin: 0.2rem 0 0.6rem; font-size: 0.78rem; opacity: 0.65; }
.card-empty { margin: 0.5rem 0; font-size: 0.9rem; font-style: italic; opacity: 0.6; }

.card-board { margin-bottom: 1.6rem; }
.card-board-title {
  margin: 1rem 0 0; font-size: 0.85rem;
  letter-spacing: 0.2em; text-transform: uppercase;
}

/* Ruled rows, like a score sheet you would fill in with a pencil. */
.rank-list { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.rank-row {
  display: grid;
  grid-template-columns: 1.9rem 1fr auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--kb-ink-soft);
}
.rank-list-tight .rank-row { padding: 0.3rem 0; }
.rank-row:last-child { border-bottom: none; }
.rank-place {
  font-weight: 700; font-size: 1.05rem;
  border: 1px solid var(--kb-ink); border-radius: 2px;
  text-align: center; line-height: 1.5;
}
.rank-name { overflow-wrap: anywhere; }
.rank-value { font-weight: 700; white-space: nowrap; }
.rank-aside { font-size: 0.8rem; opacity: 0.7; white-space: nowrap; grid-column: 3; }
.rank-row-block { grid-template-columns: 1.9rem 1fr auto auto; }

.guest-tag, .kingdom-tag {
  display: inline-block; margin-left: 0.5rem;
  font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px solid var(--kb-ink); border-radius: 2px;
  padding: 0.05rem 0.35rem; opacity: 0.7;
}

.figure-row { display: flex; flex-wrap: wrap; gap: 1.6rem; margin: 0.5rem 0 0.5rem; }
.card-figure { min-width: 6rem; }
.card-figure-value { display: block; font-size: 2rem; font-weight: 700; line-height: 1.05; }
.card-figure-label {
  display: block; font-size: 0.7rem; letter-spacing: 0.14em;
  text-transform: uppercase; opacity: 0.65;
}

/* A printed meter: an outlined bar filled with flat ink. */
.mastery-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.mastery-row {
  display: grid; grid-template-columns: 10rem 1fr auto;
  gap: 0.75rem; align-items: center;
  padding: 0.3rem 0; border-bottom: 1px solid var(--kb-ink-soft);
}
.mastery-name { text-transform: capitalize; font-size: 0.9rem; }
.mastery-value { font-size: 0.78rem; white-space: nowrap; opacity: 0.75; }
.card-meter {
  display: block; height: 0.7rem;
  border: 1px solid var(--kb-ink); border-radius: 1px;
  background: var(--kb-special);
}
.card-meter-fill { display: block; height: 100%; background: var(--kb-commandments); }

.game-card { border-bottom: 1px solid var(--kb-ink-soft); padding: 0.75rem 0; }
.game-card:last-child { border-bottom: none; }
.game-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 0 0 0.2rem; font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase;
}
.game-code { font-weight: 700; letter-spacing: 0.22em; }
.game-date { opacity: 0.6; }
/* The Steward's paragraph. Set full width: it was a 52ch column inside a card
   more than twice that wide, which read as an unfinished layout rather than as
   a caption — the whole right side of every game card sat empty. */
.game-chronicle {
  display: block;
  margin: 0.5rem 0 0; font-size: 0.85rem; line-height: 1.55;
  font-style: italic; opacity: 0.8;
}

@media (max-width: 620px) {
  .rank-row, .rank-row-block { grid-template-columns: 1.7rem 1fr auto; }
  .rank-aside { grid-column: 2 / -1; }
  .mastery-row { grid-template-columns: 1fr; gap: 0.2rem; }
}

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
  .host-shell { grid-template-columns: 1fr; }
  .scoreboard { order: -1; display: flex; gap: 0.5rem; overflow-x: auto; }
  .score-row { min-width: 170px; margin: 0; }
  .lobby { grid-template-columns: 1fr; padding: 1.5rem; }
  .options { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- audio controls -------------------------------------------------------- */

.audio-controls { position: fixed; bottom: 0.75rem; right: 0.75rem; z-index: 60; }
.audio-toggle {
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  border: 2px solid rgba(246, 239, 223, 0.3);
  background: rgba(10, 6, 18, 0.85); color: var(--cream);
  font-size: 1.2rem; cursor: pointer;
}
.audio-panel {
  position: absolute; bottom: 3.4rem; right: 0;
  width: 15rem; padding: 0.9rem;
  background: rgba(10, 6, 18, 0.95);
  border: 1px solid rgba(246, 239, 223, 0.2);
  border-radius: 14px; box-shadow: var(--shadow);
}
.audio-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.audio-row input[type="range"] { flex: 1; accent-color: var(--gold); }
.audio-label { font-size: 0.75rem; opacity: 0.7; width: 3.6rem; }
.audio-mute {
  width: 1.9rem; height: 1.9rem; flex: none; border-radius: 8px;
  border: 1px solid rgba(246, 239, 223, 0.25);
  background: rgba(246, 239, 223, 0.1); color: var(--cream); cursor: pointer;
}
.audio-mute.is-muted { background: rgba(209, 73, 91, 0.4); }
.audio-hint { font-size: 0.7rem; opacity: 0.55; margin: 0.4rem 0 0; }

.phone-mute {
  position: fixed; top: 0.6rem; left: 0.6rem; z-index: 60;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 2px solid rgba(246, 239, 223, 0.25);
  background: rgba(10, 6, 18, 0.8); color: var(--cream);
  font-size: 1.05rem; cursor: pointer;
}

/* --- Sabbath Rest and all-play cards --------------------------------------- */

.card-rest {
  border-color: rgba(176, 164, 214, 0.4);
  background: rgba(20, 19, 34, 0.97);
}
.rest-header { text-align: center; margin-bottom: 1rem; }
.rest-title {
  font-size: 1.6rem; color: #cfc7e8; margin: 0;
  letter-spacing: 0.16em; font-weight: 400;
}
.rest-sub { margin: 0.2rem 0 0.4rem; opacity: 0.8; font-size: 0.95rem; }
.rest-rules {
  margin: 0; font-size: 0.85rem; letter-spacing: 0.04em;
  color: #cbb8f5; text-transform: uppercase;
}

.allplay-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.allplay-chip {
  background: var(--sabbath); color: #08170f; font-weight: 700;
  padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem;
  letter-spacing: 0.12em;
}
.allplay-note { font-size: 0.85rem; opacity: 0.75; }

/* Who has to answer, and — after the reveal — who got it. */
.eligible-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.9rem; }
.eligible-chip {
  display: flex; align-items: center; gap: 0.35rem;
  background: rgba(246, 239, 223, 0.1);
  border: 2px solid transparent;
  padding: 0.3rem 0.7rem; border-radius: 999px; font-size: 0.9rem;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.eligible-chip.is-right { background: rgba(76, 149, 108, 0.55); border-color: #7fd4a2; }
.eligible-chip.is-wrong { background: rgba(209, 73, 91, 0.4); border-color: #e08a96; }
.eligible-chip.is-silent { opacity: 0.4; }
.eligible-status { font-size: 0.85rem; }

/* The heal keeps its dusk-lavender scrim, now flat — the print language has
   no gradients anywhere, cutscenes included. */
.cutscene-healed { background: rgba(46, 38, 74, 0.72); }

/* The dusk shift needs to be unmistakable, not subtle. */
body.sabbath-dusk .board-mount { filter: saturate(0.65) brightness(0.75); transition: filter 1.2s ease; }
body.sabbath-dusk .turn-banner { color: #e6dcff; }

/* --- the public site: header, landing sheet, footer ------------------------- */
/* `/` signed out is a marketing page and `/` signed in is the host panel; both
   sit in this frame. The frame itself is the app chrome (ink ground, gold
   wordmark) and everything inside the sheet is the BOARD's language: cream
   stock, one dark ink, the four code colours and nothing else. No gradients,
   no filters, no blurred shadows — the drop shadows here are hard offsets of
   flat ink, exactly as on the board and the scorecards. Every colour is a
   custom property already defined in palettes.css or at the top of this file. */

.site {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* --- masthead --------------------------------------------------------------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--hairline);
}
.site-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  font-family: var(--kb-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-decoration: none;
}
.site-brand-mark { font-size: 0.8em; color: var(--gold); }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.site-nav a { color: var(--cream); text-decoration: none; opacity: 0.85; }
.site-nav a:hover { opacity: 1; text-decoration: underline; }

/* --- the sheet -------------------------------------------------------------- */

.sheet {
  flex: 1;
  width: min(1080px, 100%);
  margin: clamp(1rem, 3vw, 2.5rem) auto;
  padding: clamp(1.25rem, 4vw, 3rem);
  background: var(--kb-paper);
  color: var(--kb-ink);
  border: 2px solid var(--kb-ink);
  border-radius: 3px;
  box-shadow: 10px 10px 0 rgba(19, 18, 32, 0.5);   /* hard offset, not a blur */
  font-family: var(--kb-display);
  line-height: 1.55;
}
.sheet-narrow { width: min(560px, 100%); }
.sheet a { color: var(--kb-ink); }
.sheet :focus-visible { outline: 3px solid var(--kb-medium); outline-offset: 2px; }

/* The app chrome's controls are drawn for a dark screen; on paper they need the
   paper's ink. Scoped to .sheet so nothing else in the app is touched. */
.sheet .field {
  background: var(--kb-paper);
  color: var(--kb-ink);
  border: 1px solid var(--kb-ink);
  border-radius: 2px;
  font-family: var(--kb-display);
}
.sheet .field-label { color: var(--kb-ink); opacity: 0.75; }
/* On paper the app chrome's 0.55 hint is below the contrast floor. */
.sheet .opt-hint { opacity: 0.75; }
.sheet .form-error { color: var(--kb-medium); font-weight: 600; }
.sheet .btn {
  border-radius: 2px;
  border: 2px solid var(--kb-ink);
  background: var(--kb-special);
  color: var(--kb-ink);
  font-family: var(--kb-display);
  letter-spacing: 0.08em;
  /* No filter on hover: the print language has none anywhere. */
  transition: transform 0.12s ease;
}
.sheet .btn:hover:not(:disabled) { filter: none; background: var(--kb-paper-edge); }
.sheet .btn-primary { background: var(--kb-easy); }
.sheet .btn-primary:hover:not(:disabled) { background: var(--kb-easy); }
.sheet .host-options .opt-switch input { accent-color: var(--kb-medium); }
.sheet .landing-links { flex-wrap: wrap; margin-top: 1.5rem; }
.sheet .landing-links a { color: var(--kb-ink); }

.sheet-block {
  margin-top: clamp(2rem, 5vw, 3.25rem);
  border-top: 5px solid var(--kb-ink);
  padding-top: 1.1rem;
  scroll-margin-top: 1rem;
}
.sheet-block-first { margin-top: 0; border-top: none; padding-top: 0; }
.block-title {
  margin: 0;
  font-size: clamp(1.15rem, 3.4vw, 1.5rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.block-title-lead {
  font-size: clamp(1.9rem, 7vw, 2.6rem);
  letter-spacing: 0.04em;
  text-transform: none;
  margin: 0.1rem 0 0;
}
.block-lede { margin: 0.5rem 0 1.25rem; max-width: 60ch; opacity: 0.8; }

/* --- hero ------------------------------------------------------------------- */

/* On a phone the order is: what it is, then the code box, then the rest of the
   sentence — so the box a player at a table needs is still above the fold.
   Wide, the code box moves into its own column beside the whole introduction. */
.hero {
  display: grid;
  gap: clamp(1.25rem, 4vw, 2.5rem);
  align-items: start;
  grid-template-areas: "text" "join" "more";
}
/* Grid items floor at min-content, and an <input>'s min-content is its default
   twenty-character width — which is what pushed this page off a 390px screen. */
.hero > * { min-width: 0; }
.hero-text { grid-area: text; }
.hero-join { grid-area: join; }
.hero-more { grid-area: more; }
.hero-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0.75;
}
.hero-title {
  margin: 0.15rem 0 0;
  font-size: clamp(2.6rem, 11vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0.01em;
}
.hero-lede {
  margin: 0.9rem 0 0;
  font-size: clamp(1.05rem, 3.2vw, 1.3rem);
  font-weight: 600;
  max-width: 30ch;
}
.hero-body { margin: 0.7rem 0 0; max-width: 52ch; opacity: 0.85; }

@media (min-width: 880px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 22rem;
    grid-template-areas: "text join" "more join";
    column-gap: clamp(1.5rem, 4vw, 3rem);
    row-gap: 0;
  }
}

/* --- the room-code panel ---------------------------------------------------- */
/* The first thing a player needs, so it is the loudest thing on the page: a
   parchment card printed over the paper, one flat yellow key, ink keylines. */

.join-panel {
  background: var(--kb-special);
  border: 2px solid var(--kb-ink);
  border-radius: 3px;
  box-shadow: 7px 7px 0 var(--kb-ink);
  padding: clamp(1rem, 3.5vw, 1.4rem);
  scroll-margin-top: 1rem;
}
.join-heading {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.join-label {
  display: block;
  margin: 0.85rem 0 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.7;
}
.join-row { display: flex; gap: 0.6rem; }
.join-code-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.7rem 0.75rem;
  border: 2px solid var(--kb-ink);
  border-radius: 2px;
  background: var(--kb-paper);
  color: var(--kb-ink);
  font-family: var(--kb-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  min-height: 3.4rem;
}
.join-code-input::placeholder { color: var(--kb-ink); opacity: 0.3; }
.join-go {
  flex: 0 0 auto;
  min-height: 3.4rem;
  padding: 0 1.4rem;
  border: 2px solid var(--kb-ink);
  border-radius: 2px;
  background: var(--kb-easy);
  color: var(--kb-ink);
  font-family: var(--kb-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.join-go:active:not(:disabled) { transform: translate(1px, 1px); }
.join-go:disabled { opacity: 0.5; cursor: default; }
.join-error {
  margin: 0.6rem 0 0;
  min-height: 1.2em;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--kb-medium);
}
.join-help { margin: 0.5rem 0 0; font-size: 0.82rem; opacity: 0.82; }

/* --- the board figure ------------------------------------------------------- */

.board-figure { margin: 0; }
/* On a phone a 16:9 board scaled to 350px is a decorative strip nobody can
   read, so below the breakpoint the board keeps a usable size and the figure
   scrolls sideways inside itself. The page body never scrolls horizontally. */
.board-scroller { overflow-x: auto; overscroll-behavior-x: contain; }
.board-figure-mount {
  display: block;
  aspect-ratio: 192 / 112;
  border: 2px solid var(--kb-ink);
  border-radius: 2px;
  overflow: hidden;
  background: var(--kb-paper);
}
@media (max-width: 760px) {
  .board-figure-mount { min-width: 680px; }
}
.board-figure-mount .board-svg { display: block; width: 100%; height: 100%; max-height: none; }
.board-caption {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  font-style: italic;
  opacity: 0.78;
}
/* The only affordance the print language allows: a fade at the edge would be a
   gradient, so the caption says it in words — and only where it is true. */
.board-swipe { display: none; font-style: normal; font-weight: 700; }
@media (max-width: 760px) {
  .board-swipe { display: inline; }
}

/* --- how it plays ----------------------------------------------------------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.1rem 2rem;
}
.step { display: flex; gap: 0.9rem; align-items: flex-start; }
.step-number {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2rem; height: 2rem;
  border: 2px solid var(--kb-ink);
  border-radius: 2px;
  background: var(--kb-special);
  font-weight: 700;
  font-size: 0.95rem;
}
.step-title {
  margin: 0.1rem 0 0.2rem;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.step-body { margin: 0; font-size: 0.95rem; opacity: 0.85; }

@media (min-width: 780px) {
  .steps { grid-template-columns: 1fr 1fr; }
}

/* --- the printed key -------------------------------------------------------- */

.key-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.key-item {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.15rem 0.7rem;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--kb-ink-soft);
}
.key-item .key-name { grid-column: 2; }
.key-item .key-note { grid-column: 2; }
.key-chip, .key-tile {
  grid-row: 1 / span 2;
  align-self: center;
  width: 2rem; height: 2rem;
  border: 1.5px solid var(--kb-ink);
  border-radius: 1px;
}
.key-tile { background: var(--kb-special); display: grid; place-items: center; }
.key-mark { width: 1.4rem; height: 1.4rem; display: block; }
.key-name { font-weight: 700; font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; }
.key-note { font-size: 0.82rem; opacity: 0.8; }

/* --- the seven lands -------------------------------------------------------- */

.land-list {
  margin: 0;
  display: grid;
  gap: 0.2rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
}
.land-item { padding: 0.55rem 0; border-bottom: 1px solid var(--kb-ink-soft); }
.land-name {
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.land-day {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: none;
  opacity: 0.75;
}
.land-body { margin: 0.25rem 0 0; font-size: 0.95rem; opacity: 0.85; }
.land-ref {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

/* --- sign in ---------------------------------------------------------------- */

.auth-form { max-width: 26rem; }
.auth-toggle { margin: 0.9rem 0 0; font-size: 0.9rem; }

/* --- footer ----------------------------------------------------------------- */

.site-footer {
  padding: 1.75rem clamp(1rem, 4vw, 2.5rem) 2.25rem;
  border-top: 1px solid var(--hairline);
  text-align: center;
  font-size: 0.85rem;
}
.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
.site-footer-nav a { color: var(--gold-bright); text-decoration: none; }
.site-footer-nav a:hover { text-decoration: underline; }
.site-footer-note {
  margin: 0.9rem auto 0;
  max-width: 62ch;
  opacity: 0.65;
}
.site-copyright {
  margin: 0.8rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  opacity: 0.5;
}

/* --- the rules document (/rules) -------------------------------------------- */
/* A document, not a page of blocks: the sheet narrows to a single readable
   column so the measure fills the paper instead of leaving a third of it blank
   at desk width. Tables keep their own scroller inside it. */
.sheet-document { width: min(840px, 100%); }

/* The same printed sheet as `/`: flat spot colour, thin dark keylines, no
   gradient and no filter anywhere, and not one colour that is not already a
   custom property in palettes.css. What this block adds is long-document
   ergonomics — a contents list that jumps, headings with room around them, a
   printed key with a payout column, and tables that scroll INSIDE their own box
   so a 390px screen never scrolls the page sideways. */

.rules-lede {
  margin: 0.7rem 0 0;
  max-width: 60ch;
  font-size: 1.02rem;
  opacity: 0.85;
}
.rules-p { margin: 0.75rem 0 0; max-width: 66ch; }
.rules-p:first-child { margin-top: 0; }

.rules-sub {
  margin: 1.6rem 0 0;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.rules-sub + .rules-p { margin-top: 0.4rem; }

.rules-list, .rules-steps { margin: 0.75rem 0 0; padding-left: 1.15rem; max-width: 66ch; }
.rules-list { list-style: square; }
.rules-list li, .rules-steps li { margin: 0.35rem 0; }

/* The contents. Two columns where there is room; one on a phone, where a wrapped
   two-column list of long labels is harder to scan than a plain run. */
.rules-toc {
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}
.rules-toc li { counter-increment: toc; border-bottom: 1px solid var(--kb-ink-soft); }
.rules-toc li:last-child { border-bottom: none; }
.rules-toc a {
  display: block;
  padding: 0.5rem 0;
  text-decoration: none;
  font-size: 0.95rem;
}
.rules-toc a::before {
  content: counter(toc) ".";
  display: inline-block;
  min-width: 1.9rem;
  font-weight: 700;
}
.rules-toc a:hover { text-decoration: underline; }
@media (min-width: 760px) {
  .rules-toc { columns: 2; column-gap: 2.5rem; }
  .rules-toc li { break-inside: avoid; }
}

.to-top {
  margin: 1.5rem 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* The aside that must not be missed: a keylined box with a heavy rule down its
   left edge. Flat ink on paper — no tint wash, which the print language has no
   way to make. */
.rules-note {
  margin: 1.2rem 0 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--kb-ink);
  border-left: 6px solid var(--kb-medium);
  background: var(--kb-special);
  max-width: 66ch;
}
.rules-note-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.rules-note .rules-p { margin-top: 0.45rem; }

/* --- tables ------------------------------------------------------------------ */
/* Every table lives in its own scroller. The page body must never scroll
   sideways, so the overflow is here and nowhere else. */
.table-scroll {
  margin: 1rem 0 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--kb-ink);
}
.rules-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 32rem;
  font-size: 0.86rem;
  text-align: left;
}
.rules-table-narrow { min-width: 0; }
.rules-table th, .rules-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--kb-ink-soft);
  vertical-align: top;
}
.rules-table thead th {
  border-bottom: 2px solid var(--kb-ink);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.rules-table tbody th { font-weight: 700; }
.rules-table tbody tr:last-child th,
.rules-table tbody tr:last-child td { border-bottom: none; }
.rules-table td.num { white-space: nowrap; }

/* --- the printed key of squares ---------------------------------------------- */
/* Mark, name and payout on one line; the sentence underneath. On a phone the
   payout drops under the name rather than squeezing the name to nothing. */
.square-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}
.square-item {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 0.2rem 0.85rem;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--kb-ink-soft);
}
.square-item:last-child { border-bottom: none; }
.square-item .key-chip, .square-item .key-tile { grid-row: 1 / span 3; align-self: start; }
.square-name {
  grid-column: 2;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.square-pay {
  grid-column: 2;
  font-size: 0.82rem;
  font-weight: 700;
}
.square-body { grid-column: 2; margin: 0.2rem 0 0; font-size: 0.9rem; opacity: 0.85; }
@media (min-width: 620px) {
  .square-item { grid-template-columns: 2.4rem 1fr auto; }
  .square-item .key-chip, .square-item .key-tile { grid-row: 1 / span 2; }
  .square-name { grid-column: 2; }
  .square-pay { grid-column: 3; grid-row: 1; text-align: right; white-space: nowrap; }
  .square-body { grid-column: 2 / span 2; }
}
.steps-more { margin: 1.25rem 0 0; font-size: 0.95rem; }
.steps-more a { font-weight: 700; }
/* Only true where a table actually overflows, which is a narrow screen. No
   fade and no shadow: the print language has neither, so it says it in words. */
.table-hint { display: none; }
@media (max-width: 760px) {
  .table-hint {
    display: block;
    margin: 0.35rem 0 0;
    font-size: 0.76rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.7;
  }
}
