/* Buck The Trend: the shared look for splash, phone and TV. Jonathan's play sheet: cream paper, columns
   striped pale blue, green and lavender, the 20 in red, the target die on a peach star in a circle.
   Over is teal, spot-on is the star's amber, under is violet. No web fonts, no remote anything: the
   party rig is offline, so every asset is local (test/pages.test.ts fails on an external URL). */
:root {
  --paper: #fbf7ec; --paper2: #f3eddc; --paper3: #e9e1c9; --rule: #2b2a33; --line: #cfc5a8;
  --ink: #26242e; --dim: #6b6676; --red: #e4252b;
  --s0: #cbeef6; --s1: #dcf2e1; --s2: #dcd7ef;             /* the sheet's three stripes */
  --over: #1f7a8c; --spot: #c0711b; --under: #6a55b5;      /* the three calls */
  --over-l: #d5eef3; --spot-l: #fde7cf; --under-l: #e4def5;
  --star: #fbdcc4; --ring: #fff3d6;
  --good: #2f8a4b;
  /* the kit's shared end screen (client/endscreen.ts), in this game's colours */
  --cs-end-bg: linear-gradient(180deg, #fbf7ec 0%, #f0e8d2 100%); --cs-end-fg: #26242e; --cs-end-dim: #6b6676;
  --cs-end-accent: #1f7a8c; --cs-end-win: #c0711b; --cs-end-loss: #6a55b5;
  --display: "Avenir Next", "Segoe UI", "Helvetica Neue", Ubuntu, Cantarell, 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); -webkit-tap-highlight-color: transparent;
  background: var(--paper) repeating-linear-gradient(90deg, #cbeef633 0 34px, #dcf2e133 34px 68px, #dcd7ef33 68px 102px) fixed; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; margin: 0; letter-spacing: -.01em; }
h1 { color: var(--ink); font-size: 34px; line-height: 1.1; }
h2 { color: var(--over); font-size: 20px; }
button { background: #fff; border: 2px solid var(--rule); color: var(--ink); padding: 10px 14px; border-radius: 12px;
  font: inherit; font-weight: 700; cursor: pointer; }
button.primary { background: var(--over); border-color: var(--over); color: #fff; }
button:disabled { opacity: .45; cursor: default; }
select, input { font: inherit; padding: 8px; border-radius: 8px; background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
a { color: var(--over); }
.muted, .hint, .tagg, .dim { color: var(--dim); }
.tagg { font-size: 13px; margin-left: 6px; }
.av { border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.red { color: var(--red); }
.w-over { color: var(--over); } .w-spot { color: var(--spot); } .w-under { color: var(--under); }

#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(--red); 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: #fff9; border: 1px solid var(--line); 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; }

/* ---- shared pieces: pawns, dice, the star ---- */
.pawn { display: inline-grid; place-items: center; width: 2em; height: 2em; border-radius: 50%; flex: none;
  background: var(--pc); color: var(--pf); border: .14em solid #fff; box-shadow: 0 0 0 .07em var(--rule), 0 .12em .3em #0004;
  font: 800 .8em/1 var(--body); letter-spacing: -.02em; text-transform: none; }
.pawn.ghost { opacity: .4; box-shadow: 0 0 0 .07em var(--rule); border-style: dashed; }
.pawn.small { font-size: 13px; }
.pawn.tiny { font-size: 10px; margin-left: -4px; }
.die { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: .3em; background: #fff; color: var(--ink);
  border: .08em solid var(--rule); box-shadow: inset 0 -.09em 0 var(--paper3); font: 800 1em/1 var(--display); }
.die.rolled { background: var(--ink); color: #fff; box-shadow: none; }
.star { position: relative; display: grid; place-items: center; width: 92px; height: 92px; flex: none; }
.star svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.star .star-ring { fill: var(--ring); stroke: var(--rule); stroke-width: 1.5; }
.star .star-pt { fill: var(--star); stroke: var(--rule); stroke-width: 1.2; stroke-linejoin: round; }
.star .star-die { position: relative; font-size: 28px; margin-top: 4px; }
.star .star-cap { position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; color: var(--dim); background: var(--paper); padding: 0 5px; border-radius: 6px; }
.gain { color: var(--good); font-weight: 900; }

/* ---- the phone: a fixed skeleton that never scrolls the page (the rig's panels are 960x540 with
   no scrollbar: a control below the fold there is not a control) ---- */
.g { position: fixed; inset: 0; display: grid; grid-template-rows: auto auto auto auto auto auto minmax(0, 1fr); gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 12px 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: 800 18px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-me { margin-left: auto; white-space: nowrap; display: flex; align-items: center; gap: 6px; font-size: 22px; }
.g-me .of { font-size: 13px; color: var(--dim); font-weight: 700; }
.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(--over); }
@keyframes helppulse { 50% { box-shadow: 0 0 0 6px #1f7a8c44; } }
#cs-pres-slot { display: flex; justify-content: center; min-height: 0; }
.g-coach { background: #fff; border: 1.5px solid var(--line); border-left: 5px solid var(--over); border-radius: 6px 12px 12px 6px; padding: 8px 12px;
  font-size: 15px; line-height: 1.3; min-height: 52px; display: flex; align-items: center; }
.g:not(.mine) .g-coach { border-left-color: var(--line); color: var(--dim); }
.g-table { display: flex; align-items: center; gap: 14px; min-height: 92px; }
.g-table .t-what { display: grid; gap: 2px; font-size: 15.5px; }
.g-table .t-roll { display: flex; align-items: center; gap: 10px; }
.g-table .t-roll .die { font-size: 30px; }
.g-calls { display: grid; gap: 7px; }
.call { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name pay" "faces who"; align-items: center; gap: 1px 10px; text-align: left;
  padding: 7px 12px; min-height: 58px; border-radius: 14px; border-width: 2px; }
.call .c-name { grid-area: name; font: 800 19px/1.1 var(--display); }
.call .c-faces { grid-area: faces; font-size: 13.5px; color: var(--dim); font-weight: 600; }
.call .c-pay { grid-area: pay; font-size: 13px; font-weight: 700; text-align: right; }
.call .c-who { grid-area: who; display: flex; justify-content: flex-end; padding-left: 4px; min-height: 18px; }
.call.c-over { background: var(--over-l); border-color: var(--over); } .call.c-over .c-name { color: var(--over); }
.call.c-spot { background: var(--spot-l); border-color: var(--spot); } .call.c-spot .c-name { color: var(--spot); }
.call.c-under { background: var(--under-l); border-color: var(--under); } .call.c-under .c-name { color: var(--under); }
.call:disabled { opacity: 1; filter: saturate(.35); }
.g.mine .call:not(:disabled) { box-shadow: 0 3px 0 var(--rule); }
.g.mine .call:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--rule); }
.call.chosen { filter: none; outline: 3px solid var(--rule); outline-offset: 2px; }
.call.chosen .c-name::after { content: "  ← your call"; font: 700 12.5px var(--body); color: var(--ink); }
.call.right { filter: none; box-shadow: 0 0 0 4px var(--good) !important; }
.g-roll { min-height: 52px; font-size: 17px; }
.g-roll:disabled { background: var(--paper2); color: var(--dim); border-color: var(--line); opacity: 1; font-size: 14.5px; font-weight: 600; }
.g-list { display: grid; grid-auto-rows: minmax(0, 30px); align-content: start; gap: 3px; min-height: 0; overflow: hidden; }
.g-list.two { grid-template-columns: 1fr 1fr; column-gap: 8px; }
.p-row { display: flex; align-items: center; gap: 7px; padding: 0 8px 0 4px; border-radius: 9px; background: #fffa; border: 1px solid var(--line); font-size: 14.5px; min-width: 0; }
.p-row.me { border-color: var(--rule); font-weight: 800; }
.p-row.next { background: #fff; box-shadow: 0 0 0 2px var(--over); }
.p-row .p-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-row .p-name i { font-style: normal; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 700; }
.p-row .p-st { font-size: 13px; font-weight: 700; white-space: nowrap; }
.p-row .p-score { font: 800 17px var(--display); min-width: 1.6em; text-align: right; }
.g-list.two .p-row { font-size: 13px; gap: 5px; } .g-list.two .p-row .p-st { font-size: 11.5px; }
.now { color: var(--over); } .in { color: var(--good); }

/* The kit's pill (table-dock.ts: "Table", or "Sound") opens the sheet with what happened, and the phone's
   sound switches. Its own spot is the bottom right corner, which is where the player list ends, so it is
   moved up beside "?" and the header keeps a gap for it (.g-pillgap). */
body.phone #cs-pill { top: max(8px, env(safe-area-inset-top)); bottom: auto; left: 60px; 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; }
@media (max-width: 400px) { .g-title { font-size: 15px; } }
@media (max-height: 760px) and (max-width: 719px) {
  .g { gap: 6px; } .g-table { min-height: 76px; } .star { width: 76px; height: 76px; } .star .star-die { font-size: 23px; }
  .call { min-height: 50px; padding: 5px 12px; } .g-roll { min-height: 46px; }
}

/* A rig panel or a phone on its side: use the width. The dice and the calls left, the players right.
   Nothing a player presses is below the fold, and the top centre stays clear for the launcher's own strip. */
@media (min-width: 720px) and (max-height: 640px) {
  .g { max-width: none; grid-template-columns: 1.1fr 1fr; grid-template-rows: auto auto auto auto minmax(0, 1fr) auto; column-gap: 16px; padding: 8px 16px 10px; }
  .g-head, #cs-pres-slot { grid-column: 1 / -1; }
  .g-coach { grid-column: 1; grid-row: 3; }
  .g-table { grid-column: 1; grid-row: 4; min-height: 80px; } .star { width: 80px; height: 80px; }
  .g-calls { grid-column: 1; grid-row: 5; align-content: start; }
  .g-roll { grid-column: 1; grid-row: 6; }
  .g-list { grid-column: 2; grid-row: 3 / 7; }
  body.phone #cs-pill { left: 64px; top: 8px; }
  .lobbyv { max-width: 900px; grid-template-columns: 1fr 1fr; align-items: start; padding: 44px 16px 10px; gap: 8px 16px; }
  .lobbyv h1 { grid-column: 1 / -1; font-size: 26px; }
  .lobbyv > div:nth-child(2) { grid-row: span 4; }
  .join { padding-top: 44px; }
}

/* ---- 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(38, 36, 46, .78); }
.cm-ring { fill: none; stroke: var(--star); stroke-width: 2.5; }
.cm-ln { stroke: var(--paper); stroke-width: 2; stroke-linecap: round; }
.cm-dot { fill: var(--star); stroke: var(--rule); 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(--paper); border: 2px solid var(--rule); 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(--over); color: #fff; font: 700 13px/1 var(--body); }
.cm-call .cm-t { font: 800 15.5px/22px var(--display); color: var(--ink); }
.cm-call .cm-b { margin-top: 3px; clear: both; } .cm-call .cm-b b { color: var(--over); }
.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(--paper); border: 2px solid var(--rule); 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: 2px solid var(--rule); background: var(--paper); 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(--over); }
.cm-lastin h2 { margin: 0 0 8px; text-align: center; font-size: 22px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.cm-lastin ul { margin: 0; padding-left: 1.2em; } .cm-lastin li { margin: 0 0 6px; } .cm-lastin b { color: var(--over); }

/* ---- splash + help ---- */
.wrap { max-width: 860px; margin: 0 auto; padding: 28px 18px 60px; }
.hero h1 { font-size: clamp(36px, 7vw, 60px); }
.hero .mark { display: block; width: clamp(160px, 30vw, 240px); height: auto; margin-bottom: 8px; }
.tag { font-size: 1.2em; color: var(--dim); margin: 6px 0 4px; }
.credit { font-weight: 700; margin: 2px 0 6px; }
.cta { display: inline-block; margin: 14px 10px 6px 0; padding: 12px 20px; border-radius: 14px; background: var(--over); color: #fff; font-weight: 800; text-decoration: none; border: 2px solid var(--over); }
.cta.alt { background: #fff; color: var(--ink); border: 2px solid var(--rule); }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 26px; }
.how div { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; } .how h3 { color: var(--over); margin-bottom: 4px; }
.how div:nth-child(2) h3 { color: var(--spot); } .how div:nth-child(3) h3 { color: var(--under); } .how div:nth-child(4) h3 { color: var(--red); }
.rooms { margin-top: 30px; } .rooms .room { display: flex; justify-content: space-between; align-items: center; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 6px 0; }
.rooms .code { font-family: var(--display); color: var(--over); letter-spacing: 3px; font-size: 22px; }
#rejoin { display: none; background: #fff; border-left: 4px solid var(--over); 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: 1.5px solid var(--rule); display: block; }
.helppage figure.phone img { max-width: 300px; margin: 0 auto; }
.helppage figcaption { color: var(--dim); margin-top: 8px; font-size: .95em; }
.helppage table { border-collapse: collapse; margin: 8px 0; } .helppage td, .helppage th { border: 1px solid var(--line); padding: 4px 10px; text-align: left; background: #fff; }
