/* Runaround: the shared look for splash, phone and TV. Jonathan's board is a white page with heavy
   black walls and red and yellow arrows, so this is that: warm paper, ink-black lines, a signal red
   and a school-bus yellow. No web fonts, no remote anything: the party rig is offline. */
:root {
  --paper: #f5eedc; --paper2: #ebe1c8; --paper3: #ded2b3; --board: #fffdf6;
  --ink: #17130e; --dim: #5d5446; --line: #b9ab8a;
  --red: #e8361c; --red2: #b52410; --yel: #ffd21f; --yel2: #c99a00;
  --good: #1f8a4c; --bad: #b52410;
  --cs-end-bg: radial-gradient(120% 90% at 50% -10%, #fffdf6 0%, #ebe1c8 70%); --cs-end-fg: #17130e; --cs-end-dim: #5d5446;
  --cs-end-accent: #e8361c; --cs-end-win: #e8361c; --cs-end-loss: #5d5446;
  --display: "Arial Black", "Helvetica Neue", Impact, system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); font: 500 16px/1.4 var(--body); background: var(--paper);
  background-image: repeating-linear-gradient(90deg, #0000 0 38px, #00000008 38px 40px); -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); font-weight: 900; margin: 0; letter-spacing: -.01em; }
h1 { color: var(--ink); font-size: 34px; line-height: 1.05; }
h2 { color: var(--ink); font-size: 20px; }
button { background: var(--board); border: 2.5px solid var(--ink); color: var(--ink); padding: 10px 14px; border-radius: 12px;
  font: inherit; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
button.primary { background: var(--red); color: #fff; }
button:disabled { opacity: .45; cursor: default; box-shadow: none; }
select, input { font: inherit; padding: 8px; border-radius: 8px; background: var(--board); color: var(--ink); border: 2px solid var(--ink); }
a { color: var(--red2); }
.muted, .hint, .tagg { color: var(--dim); }
.tagg { font-size: 13px; margin-left: 6px; }
.av { border-radius: 50%; vertical-align: middle; margin-right: 4px; }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(160px); background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: 10px; transition: transform .25s; z-index: 50; max-width: 92vw; font-weight: 700; }
#toast.show { transform: translateX(-50%) translateY(0); }
#conn { position: fixed; top: 8px; right: 8px; background: var(--bad); color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 13px; display: none; z-index: 60; }
#conn.show { display: block; }

/* ---- kit phone shell: join + lobby ---- */
.join, .lobbyv { max-width: 480px; margin: 0 auto; padding: 24px 16px; display: grid; gap: 12px; }
.join input { font-size: 20px; padding: 12px; }
.join button, .lobbyv button { font-size: 17px; padding: 12px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.btnrow button { flex: 1 1 auto; }
.seat-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; background: var(--board); border: 2px solid var(--ink); border-radius: 10px; margin: 4px 0; }
.levers { display: grid; gap: 8px; }
.levers label { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--dim); font-weight: 700; }

/* ---- the board (client/shared/ui.ts) ---- */
svg.board { display: block; width: 100%; height: 100%; overflow: visible; }
.board .sp { fill: var(--board); stroke: var(--ink); stroke-width: .9; }
.board .sp.start.a0 { fill: #fde3dd; } .board .sp.start.a1 { fill: #fff4c2; }
.board .sp.last.s0 { fill: #f9c2b8; } .board .sp.last.s1 { fill: #ffe98a; }
.board .sp.from { fill: var(--paper3); }
.board .sp.target { fill: #b8e6c9; }
.board .sp.via { fill: #b8e6c9; cursor: pointer; }
.board .walls path { fill: none; stroke: var(--ink); stroke-width: 4.5; stroke-linejoin: round; stroke-linecap: round; }
.board .arw { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.board .arw.s0 { stroke: var(--red); } .board .arw.s1 { stroke: var(--yel2); }
.board .startmark { stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; } .board .startmark.s0 { fill: var(--red); } .board .startmark.s1 { fill: var(--yel); }
.board .pawn .body { stroke: var(--ink); stroke-width: 2.4; }
.board .pawn.s0 .body { fill: var(--red); } .board .pawn.s1 .body { fill: var(--yel); }
.board .pawn .shine { fill: #ffffff8c; }
.board .pawn .ring { fill: #ffffff00; stroke: var(--good); stroke-width: 3.5; stroke-dasharray: 5 3; }
.board .pawn.can { cursor: pointer; }
.board .pawn.sel .ring { stroke-dasharray: none; stroke-width: 5; }
.board .tgtdot { fill: none; stroke: var(--good); stroke-width: 3; }
.board .viadot { fill: var(--good); stroke: #fff; stroke-width: 2; cursor: pointer; }
.die { width: 1em; height: 1em; display: block; }
.die rect { fill: var(--board); stroke: var(--ink); stroke-width: 2.4; }
.die.s0 rect { fill: var(--red); } .die.s1 rect { fill: var(--yel); }
.die circle { fill: var(--ink); } .die.s0 circle { fill: #fff; }
.die.blank { opacity: .35; }
.track { display: inline-flex; gap: 3px; }
.track i { font-style: normal; display: grid; place-items: center; width: 1.45em; height: 1.45em; border: 2px solid var(--ink); border-radius: 5px; font: 900 .8em/1 var(--display); color: var(--dim); background: var(--board); }
.track.s0 i.on { background: var(--red); color: #fff; } .track.s1 i.on { background: var(--yel); color: var(--ink); }
.home { display: inline-flex; gap: 4px; align-items: center; min-height: 1em; }
.home i { width: .85em; height: .85em; border-radius: 50%; border: 2px solid var(--ink); }
.home.s0 i { background: var(--red); } .home.s1 i { background: var(--yel); }
.home em { font-size: .75em; color: var(--dim); }
.dot { display: inline-block; width: .8em; height: .8em; border-radius: 50%; border: 2px solid var(--ink); vertical-align: -.05em; margin-right: .35em; }
.dot.s0 { background: var(--red); } .dot.s1 { background: var(--yel); }

/* ---- the phone: a fixed skeleton that never scrolls the page ---- */
.g { position: fixed; inset: 0; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; overflow: hidden; }
.g-head { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.g-title { font: 900 21px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: auto; }
.help { flex: none; width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 20px; }
.help.pulse { animation: helppulse 1.6s ease-in-out infinite; border-color: var(--red); }
@keyframes helppulse { 50% { box-shadow: 0 0 0 6px #e8361c55; } }
#cs-pres-slot { display: flex; justify-content: center; min-height: 0; }
.g-coach { background: var(--board); border: 2px solid var(--ink); border-left-width: 7px; border-radius: 6px 12px 12px 6px; padding: 7px 11px; font-size: 15px; line-height: 1.3; min-height: 58px; display: flex; align-items: center; }
.g:not(.mine) .g-coach { border-color: var(--line); color: var(--dim); }
.g.mine .g-coach { border-left-color: var(--yel2); } .g.mine.red .g-coach { border-left-color: var(--red); }
.g-table { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; min-height: 0; }
.g-board { min-height: 0; height: 100%; aspect-ratio: 188 / 624; max-width: 62vw; justify-self: center; }
.g-player { display: flex; flex-direction: column; gap: 4px; font-size: 15px; min-width: 0; padding-top: 4px; }
.g-player.s1 { align-items: flex-end; text-align: right; }
.g-player .track { flex-direction: column-reverse; }
.g-player.s1 .home { justify-content: flex-end; }
.g-player .home { flex-wrap: wrap; max-width: 4.6em; }
.pl-name { font-weight: 800; font-size: 14px; line-height: 1.15; overflow-wrap: anywhere; padding: 4px 6px; border-radius: 8px; border: 2px solid transparent; }
.pl-name.up { border-color: var(--ink); background: var(--board); }
.pl-name em { font-style: normal; font-weight: 700; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.pl-label { font-size: 11px; font-weight: 800; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }
.g-bar { display: grid; grid-template-columns: auto 1.5fr 1fr; gap: 8px; align-items: center; }
.g-die { font-size: 50px; width: 50px; height: 50px; }
.g-bar button { min-height: 52px; padding: 6px 8px; font-size: 17px; line-height: 1.15; }
.g-bar .undo { font-size: 13.5px; }

/* The kit's pill (the "Table" sheet) sits up beside "?", off the bottom corner where Move lives. */
body.phone #cs-pill { top: max(8px, env(safe-area-inset-top)); bottom: auto; left: 58px; right: auto; height: 40px; width: 96px; padding: 0 6px;
  font-size: 13.5px; white-space: nowrap; text-align: center; }
.g-pillgap { flex: none; width: 96px; }

/* A rig panel or a phone on its side: the board lies flat across the top, the players and the
   buttons below. Nothing a player presses is below the fold. */
@media (min-width: 720px) and (max-height: 640px) {
  .g { max-width: none; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-columns: 1fr; padding: 8px 14px 10px; gap: 6px; }
  .g-head { display: grid; grid-template-columns: auto auto 1fr; }
  .g-head .g-title { margin-left: 0; justify-self: end; }
  #cs-pres-slot { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 5; }
  body.phone #cs-pill { left: 62px; top: 8px; }
  .g-coach { min-height: 40px; }
  .g-table { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
  .g-board { aspect-ratio: auto; max-width: none; width: 100%; height: 100%; }
  .g-player { display: none; }
  .g-bar { grid-template-columns: minmax(0, 1fr) auto minmax(0, 14em) minmax(0, 10em) minmax(0, 1fr); }
  .g-bar .p-mini { display: flex; }
  .g-die { font-size: 46px; width: 46px; height: 46px; }
}
.p-mini { display: none; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; min-width: 0; }
.p-mini.s1 { justify-content: flex-end; }
.p-mini .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- coach marks (table/client/coach.ts draws them; these are its classes) ---- */
.coach { position: fixed; inset: 0; z-index: 2300; color: var(--ink); -webkit-user-select: none; user-select: none; animation: cmin .18s ease-out; }
@keyframes cmin { from { opacity: 0; } to { opacity: 1; } }
.cm-svg { position: absolute; inset: 0; display: block; }
.cm-dim { fill: rgba(23, 19, 14, .78); }
.cm-ring { fill: none; stroke: var(--yel); stroke-width: 3; }
.cm-ln { stroke: var(--yel); stroke-width: 2; stroke-linecap: round; }
.cm-dot { fill: var(--yel); stroke: var(--ink); stroke-width: 1.5; }
.cm-call { position: absolute; padding: 9px 12px 10px; border-radius: 14px; font-size: 14.5px; line-height: 1.33; background: var(--board); border: 2.5px solid var(--ink); box-shadow: 0 10px 28px #0008; }
.cm-call .cm-n { float: left; width: 22px; height: 22px; margin: 0 8px 0 0; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; font: 700 13px/1 var(--body); }
.cm-call .cm-t { font: 900 15.5px/22px var(--display); color: var(--ink); }
.cm-call .cm-b { margin-top: 3px; clear: both; } .cm-call .cm-b b { color: var(--red2); }
.cm-measure { visibility: hidden; left: -9999px; top: 0; pointer-events: none; }
.cm-none { text-align: center; }
.cm-pager { position: absolute; display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 16px; background: var(--board); border: 2px solid var(--ink); box-shadow: 0 8px 26px #0008; }
.cm-pager button { min-height: 44px; padding: 0 16px; font-size: 16px; border-radius: 12px; }
.cm-pager .cm-close { width: 44px; padding: 0; font-size: 26px; line-height: 1; border-radius: 50%; flex: none; }
.cm-pager .cm-count { flex: 1; text-align: center; color: var(--dim); font-weight: 700; white-space: nowrap; }
.cm-last { position: absolute; left: 8px; right: 8px; display: flex; overflow: auto; overscroll-behavior: contain; }
.cm-lastin { margin: auto; width: 100%; max-width: 460px; max-height: 100%; overflow-y: auto; padding: 14px 16px 16px; border-radius: 18px; border: 2.5px solid var(--ink); background: var(--board); font-size: 15px; line-height: 1.4; -webkit-user-select: text; user-select: text; }
.cm-lastin .cm-kick { text-align: center; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: var(--red2); }
.cm-lastin h2 { margin: 0 0 8px; text-align: center; font-size: 22px; padding-bottom: 7px; border-bottom: 2px solid var(--ink); }
.cm-lastin ul { margin: 0; padding-left: 1.2em; } .cm-lastin li { margin: 0 0 6px; } .cm-lastin b { color: var(--red2); }

/* ---- the end screen's board ---- */
.end-board { max-width: 40em; margin: 0 auto; } .end-board svg.board { height: auto; }

/* ---- splash + help ---- */
.wrap { max-width: 860px; margin: 0 auto; padding: 28px 18px 60px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.hero h1 { font-size: clamp(40px, 8vw, 72px); }
.hero .mark { width: clamp(90px, 18vw, 150px); }
.byline { font-weight: 800; margin-top: 4px; }
.tag { font-size: 1.15em; color: var(--dim); margin: 6px 0 4px; }
.cta { display: inline-block; margin: 14px 10px 6px 0; padding: 12px 20px; border-radius: 14px; background: var(--red); color: #fff; font-weight: 800; text-decoration: none; border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.cta.alt { background: var(--board); color: var(--ink); }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 26px; }
.how div { background: var(--board); border: 2px solid var(--ink); border-radius: 14px; padding: 12px 14px; } .how h3 { color: var(--red2); margin-bottom: 4px; }
.rooms { margin-top: 30px; } .rooms .room { display: flex; justify-content: space-between; align-items: center; background: var(--board); border: 2px solid var(--ink); border-radius: 12px; padding: 10px 14px; margin: 6px 0; }
.rooms .code { font-family: var(--display); color: var(--red2); letter-spacing: 3px; font-size: 22px; }
#rejoin { display: none; background: var(--board); border-left: 6px solid var(--red); border-radius: 8px; padding: 12px 16px; margin-top: 18px; } #rejoin.show { display: block; }
footer { margin-top: 40px; color: var(--dim); font-size: .9em; }
.helppage h2 { margin: 26px 0 6px; } .helppage li { margin-bottom: 6px; } .helppage .back { text-decoration: none; font-weight: 700; }
.helppage figure { margin: 22px 0; } .helppage figure img { width: 100%; height: auto; border-radius: 12px; border: 2px solid var(--ink); display: block; }
.helppage figure.phone img { max-width: 300px; margin: 0 auto; }
.helppage figcaption { color: var(--dim); margin-top: 8px; font-size: .95em; }
