/* Below/Above: the shared look for splash, phone and TV. After Jonathan's banner for the game: a slash
   between "Below" in mint and "Above" in coral, on a night violet with streaks. Over is coral and
   points up; under is mint and points down. The die is a pale d20. No web fonts, no remote anything:
   the party rig is offline (test/pages.test.ts fails on an external URL). */
:root {
  --bg: #160f2b; --bg2: #221840; --bg3: #2f2357; --line: #4a3b7a;
  --ink: #f4effa; --dim: #b8adD4; --deep: #1c1233;
  --above: #ff8a7a; --above2: #e0604f; --below: #3ee8a6; --below2: #19b47f;
  --stake: #ffd166; --bad: #ff5d6c;
  /* the kit's shared end screen (client/endscreen.ts), in this game's colours */
  --cs-end-bg: linear-gradient(115deg, #221840 0%, #160f2b 60%); --cs-end-fg: #f4effa; --cs-end-dim: #b8add4;
  --cs-end-accent: #ff8a7a; --cs-end-win: #3ee8a6; --cs-end-loss: #ff8a7a;
  --display: "Trebuchet MS", "Segoe UI", 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: repeating-linear-gradient(115deg, #ffffff05 0 2px, transparent 2px 46px), radial-gradient(ellipse at 30% -10%, var(--bg3), var(--bg) 70%) fixed var(--bg); }
h1, h2, h3 { font-family: var(--display); font-weight: 800; margin: 0; }
h1 { color: var(--ink); font-size: 34px; line-height: 1.1; }
h2 { color: var(--ink); font-size: 20px; }
h1 i, .g-title i { color: var(--dim); font-style: normal; font-weight: 400; }
button { background: var(--bg3); border: 1.5px solid var(--line); color: var(--ink); padding: 10px 14px; border-radius: 12px;
  font: inherit; font-weight: 700; cursor: pointer; }
button.primary { background: var(--below); border-color: var(--below); color: var(--deep); }
button:disabled { opacity: .4; cursor: default; }
select, input { font: inherit; padding: 8px; border-radius: 8px; background: var(--bg2); color: var(--ink); border: 1.5px solid var(--line); }
a { color: var(--below); }
.muted, .hint { color: var(--dim); }
.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(--deep);
  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: #0006; border-radius: 10px; margin: 4px 0; }

/* ---- the die: a d20 face-on (shared/ui.ts dieSvg) ---- */
.die { display: block; width: 100%; height: auto; overflow: visible; }
.die .d-out { fill: #e9e2fb; stroke: #8d80b8; stroke-width: 2; stroke-linejoin: round; }
.die .d-face { fill: #fbf8ff; stroke: #8d80b8; stroke-width: 1.5; stroke-linejoin: round; }
.die .d-edge { fill: none; stroke: #b6aad6; stroke-width: 1.2; }
.die .d-num { font: 800 25px var(--display); fill: var(--deep); }
.die.right .d-face { fill: #dffbef; } .die.wrong .d-face { fill: #ffe2dd; }
.die.rolling { animation: tumble .42s linear infinite; }
.die.rolling .d-num { fill: #8d80b8; }
.die.landed { animation: land .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes tumble { 0% { transform: rotate(0) scale(.92); } 25% { transform: rotate(14deg) scale(1); } 50% { transform: rotate(0) scale(.94); } 75% { transform: rotate(-14deg) scale(1); } 100% { transform: rotate(0) scale(.92); } }
@keyframes land { from { transform: scale(1.35); } to { transform: scale(1); } }

/* ---- the circle of players round the die (shared/ui.ts circleHtml). Sized by its own box (cqmin), so the
   same markup reads on a phone, a rig panel and the TV. ---- */
.circle { position: relative; container-type: size; width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); margin: 0 auto; }
.circle::before { content: ""; position: absolute; inset: 9% 9%; border-radius: 50%; border: .5cqmin dashed #ffffff1f; }
.circle .seat { position: absolute; transform: translate(-50%, -50%); width: 21cqmin; padding: 1cqmin .6cqmin 1.2cqmin; border-radius: 3cqmin;
  display: grid; justify-items: center; gap: .2cqmin; background: #120b24d9; border: .5cqmin solid var(--line); text-align: center; line-height: 1.05; }
.circle.n9 .seat, .circle.n10 .seat { width: 19cqmin; }
.seat .s-num { font: 800 7.6cqmin/1 var(--display); color: var(--ink); }
.seat .s-name { font-size: 3.5cqmin; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .s-name i { font-style: normal; color: var(--below); font-weight: 600; }
.seat .s-tag { font-size: 2.6cqmin; color: var(--dim); min-height: 1.1em; white-space: nowrap; }
.seat.has { border-color: var(--ink); box-shadow: 0 0 0 .6cqmin #f4effa33, 0 0 3cqmin #f4effa55; background: var(--bg3); }
.seat.has .s-tag { color: var(--ink); font-weight: 700; }
.seat.stake { border-color: var(--stake); border-style: dashed; animation: stake 1.2s ease-in-out infinite; }
.seat.stake .s-tag, .seat.stake .s-num { color: var(--stake); }
@keyframes stake { 50% { box-shadow: 0 0 0 1cqmin #ffd16633; } }
.seat.out { opacity: .42; border-color: transparent; background: #0b061877; }
.seat.out .s-num { text-decoration: line-through; text-decoration-thickness: .5cqmin; color: var(--dim); }
.seat.me .s-name { color: var(--below); }
.seat.won { border-color: var(--below); box-shadow: 0 0 4cqmin #3ee8a666; }
.circle .hub { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 46cqmin; display: grid; justify-items: center; gap: .8cqmin; text-align: center; }
.hub .die { width: 25cqmin; }
.hub .h-call, .hub .h-was, .hub .h-res { font-size: 3.5cqmin; line-height: 1.2; color: var(--dim); }
.hub .h-call b { color: var(--ink); white-space: nowrap; }
.hub .h-call.over b, .hub .h-was.over { color: var(--above); } .hub .h-call.under b, .hub .h-was.under { color: var(--below); }
.hub .h-res { font-weight: 800; color: var(--ink); font-size: 3.9cqmin; }
.hub .h-res.wrong { color: var(--above); } .hub .h-res.right { color: var(--below); }

/* ---- 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-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr) auto; 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-title, .t-head h1 { background: linear-gradient(100deg, var(--below) 0 46%, var(--above) 54%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.g-left { margin-left: auto; white-space: nowrap; color: var(--dim); font-weight: 700; font-size: 14px; } .g-left b { color: var(--ink); font-size: 1.2em; }
.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(--below); }
@keyframes helppulse { 50% { box-shadow: 0 0 0 6px #3ee8a655; } }
#cs-pres-slot { display: flex; justify-content: center; min-height: 0; }
.g-coach { background: var(--bg2); border-left: 4px solid var(--below); border-radius: 6px 12px 12px 6px; padding: 9px 12px; font-size: 15px; line-height: 1.35; min-height: 62px; display: flex; align-items: center; }
.g:not(.mine) .g-coach { border-left-color: var(--line); color: var(--dim); }
.g-table { min-height: 0; min-width: 0; height: 100%; container-type: size; display: flex; align-items: center; justify-content: center; }
.g-act { display: grid; gap: 8px; min-height: 84px; align-content: end; }
.g-act .calls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g-act .big { min-height: 76px; border-radius: 16px; display: grid; place-content: center; gap: 2px; padding: 8px; }
.g-act .call .c-main { font: 800 24px/1.05 var(--display); }
.g-act .call .c-sub { font-size: 13px; font-weight: 600; opacity: .85; }
.g-act .over { background: var(--above); border-color: var(--above2); color: var(--deep); }
.g-act .under { background: var(--below); border-color: var(--below2); color: var(--deep); }
.g-act .roll { background: var(--ink); color: var(--deep); font: 800 24px var(--display); }
.g-act .pass { min-height: 52px; font-size: 16px; background: var(--bg3); }
.g-act .watch { min-height: 76px; display: grid; place-items: center; text-align: center; padding: 8px 12px; border-radius: 16px; border: 1.5px dashed var(--line); color: var(--dim); font-weight: 600; }
.g-act .watch b { color: var(--stake); }
.g-act .watch.out { border-color: #ff8a7a66; }

/* 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 call buttons live, 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; }

/* A rig panel or a phone on its side: the circle on the left, the words and the buttons on the right.
   Nothing a player presses is below the fold, and the top centre stays clear for the launcher's strip. */
@media (min-width: 720px) and (max-height: 640px) {
  .g { max-width: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr); column-gap: 18px; padding: 8px 16px 10px; }
  .g-head { grid-column: 1 / -1; }
  .g-table { grid-column: 1; grid-row: 2 / 5; }
  #cs-pres-slot, .g-coach, .g-act { grid-column: 2; }
  .g-act { align-content: end; }
  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(4, 7, 14, .82); }
.cm-ring { fill: none; stroke: var(--above); stroke-width: 2; }
.cm-ln { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.cm-dot { fill: var(--above); stroke: var(--deep); 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(--bg2); border: 1.5px solid var(--above); box-shadow: 0 10px 28px #000a; }
.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(--above); color: var(--deep); font: 700 13px/1 var(--body); }
.cm-call .cm-t { font: 700 15.5px/22px var(--display); color: var(--ink); }
.cm-call .cm-b { margin-top: 3px; clear: both; } .cm-call .cm-b b { color: #fff; }
.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: #120b24f7; border: 1px solid var(--line); box-shadow: 0 8px 26px #000a; }
.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(--above); background: var(--bg2); 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(--above); }
.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: #fff; }

/* ---- splash + help ---- */
.wrap { max-width: 860px; margin: 0 auto; padding: 28px 18px 60px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mark { position: relative; display: grid; grid-template-columns: auto auto; width: max-content; font: 800 clamp(44px, 9vw, 84px)/1 var(--display); margin: 10px 0 8px; }
.mark .b { color: var(--below); } .mark .a { color: var(--above); grid-column: 2; padding-left: .5em; }
.mark .slash { position: absolute; left: 12%; right: 6%; top: 50%; height: .09em; border-radius: 1em; background: #ffffff55; transform: rotate(-12deg); }
.tag { font-size: 1.2em; color: var(--dim); margin: 6px 0 4px; }
.credit { color: var(--ink); margin: 8px 0; font-weight: 600; }
.cta { display: inline-block; margin: 14px 10px 6px 0; padding: 12px 20px; border-radius: 14px; background: var(--below); color: var(--deep); font-weight: 800; text-decoration: none; }
.cta.alt { background: var(--bg3); color: var(--ink); border: 1.5px solid var(--line); }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 26px; }
.how div { background: var(--bg2); border-radius: 14px; padding: 12px 14px; } .how h3 { color: var(--above); margin-bottom: 4px; }
.how div:nth-child(even) h3 { color: var(--below); }
.rooms { margin-top: 30px; } .rooms .room { display: flex; justify-content: space-between; align-items: center; background: var(--bg2); border-radius: 12px; padding: 10px 14px; margin: 6px 0; }
.rooms .code { font-family: var(--display); color: var(--above); letter-spacing: 3px; font-size: 22px; }
#rejoin { display: none; background: var(--bg2); border-left: 4px solid var(--below); border-radius: 8px; padding: 12px 16px; margin-top: 18px; } #rejoin.show { display: block; }
footer { margin-top: 40px; color: var(--dim); font-size: .9em; }
.helppage h1 { margin-top: 10px; } .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: 1px solid var(--line); display: block; }
.helppage figure.phone img { max-width: 300px; margin: 0 auto; }
.helppage figcaption { color: var(--dim); margin-top: 8px; font-size: .95em; }
