/* Tumblewords: the shared look for splash, phone and TV. A game table: deep teal felt, a dark bin,
   cream letter tiles with soft edges. Coral is the first player, sky blue the second, gold is the
   thing to press. 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 {
  --felt: #12303a; --felt2: #1a4350; --felt3: #235766; --line: #3a7384; --bin: #0b1e25;
  --ink: #f4efe1; --dim: #a3c2c8; --tile: #f3e3b9; --tile2: #d9bf80; --tileink: #2b2113;
  --gold: #ffcf5c; --gold2: #e0a52a; --pa: #ff8a5c; --pb: #7cc4ff;
  --good: #7be0a0; --bad: #ff6b6b;
  /* the kit's shared end screen (client/endscreen.ts), in this game's colours */
  --cs-end-bg: radial-gradient(120% 90% at 50% -10%, #235766 0%, #12303a 62%); --cs-end-fg: #f4efe1; --cs-end-dim: #a3c2c8;
  --cs-end-accent: #ffcf5c; --cs-end-win: #ffcf5c; --cs-end-loss: #7cc4ff;
  --display: "Trebuchet MS", "Gill Sans", "Segoe UI", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --slab: Rockwell, "Courier New", Georgia, 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(--felt) radial-gradient(ellipse at 50% -10%, var(--felt3), var(--felt) 70%) fixed;
  -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; margin: 0; }
h1 { color: var(--gold); font-size: 34px; line-height: 1.1; }
h2 { color: var(--tile); font-size: 20px; }
button { background: var(--felt3); 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(--gold); border-color: var(--gold); color: var(--tileink); }
button:disabled { opacity: .45; cursor: default; }
select, input { font: inherit; padding: 8px; border-radius: 8px; background: var(--felt2); color: var(--ink); border: 1.5px solid var(--line); }
a { color: var(--gold); }
.muted, .hint, .tagg { color: var(--dim); }
.tagg { font-size: 13px; margin-left: 6px; }
.av { border-radius: 50%; vertical-align: middle; margin-right: 4px; }

/* the toast drops in under the header: the bottom of a seat page is the rack and the button */
#toast { position: fixed; left: 50%; top: 58px; transform: translateX(-50%) translateY(-220px); background: var(--tile); color: var(--tileink);
  padding: 10px 18px; border-radius: 10px; transition: transform .25s; z-index: 50; max-width: 92vw; font-weight: 700; box-shadow: 0 6px 18px #0009; text-align: center; }
#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: #0005; 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; }
.levers select { max-width: 68%; }

/* ---- the name, as tumbling tiles ---- */
.tw-title { display: inline-flex; gap: .09em; font: 800 1em/1 var(--slab); white-space: nowrap; }
.tw-title i { display: inline-grid; place-items: center; width: 1.12em; height: 1.22em; font-style: normal; font-size: .82em; color: var(--tileink);
  background: linear-gradient(160deg, #fff6da, var(--tile) 55%, var(--tile2)); border-radius: .18em; box-shadow: 0 .09em 0 #a88c4e, 0 .16em .3em #0007;
  transform: translateY(var(--hop, 0)) rotate(var(--tilt, 0deg)); }

/* ---- shared pieces: the bin and its tiles ---- */
.bin { display: grid; gap: 3cqw; width: 100%; container-type: inline-size; }
.bin-arrows { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2.2cqw; padding: 0 3.2cqw; }
.bin .arrow { aspect-ratio: 1.5; min-width: 0; padding: 0; border-radius: 2.4cqw 2.4cqw 1cqw 1cqw; font-size: 4.4cqw; line-height: 1; color: var(--gold); background: var(--felt2); border-color: var(--line); }
.bin .arrow.on { background: var(--gold); color: var(--tileink); border-color: var(--gold); }
.bin-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2.2cqw; padding: 3.2cqw; background: var(--bin); border: .8cqw solid var(--line); border-top: 0;
  border-radius: 1cqw 1cqw 4.4cqw 4.4cqw; box-shadow: inset 0 -2cqw 5cqw #0009, 0 2cqw 5cqw #0006; }
.cell { aspect-ratio: 1; min-width: 0; padding: 0; display: grid; place-items: center; border-radius: 16%; border: .35cqw dashed #ffffff1f; background: #ffffff08; color: transparent;
  font: 800 7.4cqw/1 var(--slab); cursor: default; }
.cell.incol { background: #ffcf5c14; border-color: #ffcf5c55; }
.cell.tile, .rt.tile { border: 0; color: var(--tileink); background: linear-gradient(160deg, #fff6da, var(--tile) 55%, var(--tile2)); box-shadow: 0 3px 0 #a88c4e, 0 5px 8px #0008; }
.cell.tile { box-shadow: 0 .7cqw 0 #a88c4e, 0 1.1cqw 1.8cqw #0008; }
.cell.tile.blank, .rt.tile.blank { font-style: italic; color: #7a5a1e; background: linear-gradient(160deg, #fffdf4, #f6efd9 55%, #e6dab0); }
.cell.tile.p0 { box-shadow: 0 .8cqw 0 var(--pa), 0 1.1cqw 1.8cqw #0008; }
.cell.tile.p1 { box-shadow: 0 .8cqw 0 var(--pb), 0 1.1cqw 1.8cqw #0008; }
.cell.ghost { color: #f3e3b9aa; border: .5cqw dashed var(--gold); background: #ffcf5c22; }
.cell.new { outline: .7cqw solid var(--gold); outline-offset: .2cqw; }
.cell.new.fall { animation: fall calc(.1s * var(--fall, 3) + .2s) cubic-bezier(.45, 0, .85, .55) both; }
@keyframes fall { 0% { transform: translateY(calc(-124% * var(--fall, 3))); } 78% { transform: translateY(0); } 88% { transform: translateY(-9%); } 100% { transform: translateY(0); } }
.cell.scored { background: linear-gradient(160deg, #fff8c9, #ffe28a 55%, #f0bf4a); }
.cell.hot { outline: .7cqw solid var(--good); outline-offset: .2cqw; cursor: pointer; }
.cell.sel { outline: 1cqw solid #fff; outline-offset: .2cqw; background: linear-gradient(160deg, #e9ffe9, #b9f0c8 55%, #7be0a0); transform: scale(1.06); }
.bin.still .cell.new { outline: 0; }
.cell > * { pointer-events: none; }

.chip { display: inline-flex; align-items: baseline; gap: .35em; padding: .18em .6em; border-radius: 999px; background: #0006; border: 1.5px solid var(--line); font-weight: 700; white-space: nowrap; }
.chip b { font-family: var(--slab); letter-spacing: .06em; }
.chip em { font-style: normal; color: var(--gold); font-size: .85em; }
.chip.p0 { border-color: var(--pa); } .chip.p1 { border-color: var(--pb); }
.clock { font: 800 1.1em/1 var(--slab); padding: .3em .55em; border-radius: 10px; background: #0007; border: 1.5px solid var(--line); color: var(--ink); min-width: 3.3em; text-align: center; }
.clock.low { color: #fff; background: #b3261e; border-color: var(--bad); }

/* ---- 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 auto minmax(0, 1fr) auto auto; gap: 7px;
  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-size: 17px; min-width: 0; overflow: hidden; padding: 4px 0; }
.g-bag { margin-left: auto; white-space: nowrap; color: var(--dim); font-size: 13px; font-weight: 700; } .g-bag b { color: var(--gold); 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(--gold); }
@keyframes helppulse { 50% { box-shadow: 0 0 0 6px #ffcf5c55; } }
#cs-pres-slot { display: flex; justify-content: center; min-height: 0; }
.g-scores { display: flex; gap: 8px; align-items: stretch; }
.sc { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 10px; border-radius: 12px; background: #0005; border: 2px solid transparent; border-left: 6px solid var(--pa); }
.sc.p1 { border-left-color: var(--pb); }
.sc.up { border-color: var(--gold); border-left-color: var(--pa); background: #ffcf5c1a; } .sc.p1.up { border-left-color: var(--pb); }
.sc-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; }
.sc.me .sc-name::after { content: " (you)"; color: var(--dim); font-weight: 500; }
.sc .bot { font-style: normal; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; padding: 1px 6px; border-radius: 99px; background: var(--felt3); color: var(--dim); margin-right: 5px; }
.sc-n { font: 800 22px/1 var(--slab); color: var(--ink); }
.g-coach { background: var(--felt2); border-left: 4px solid var(--gold); border-radius: 6px 12px 12px 6px; padding: 7px 12px; font-size: 14.5px; line-height: 1.32; min-height: 54px; display: flex; align-items: center; }
.g:not(.mine) .g-coach { border-left-color: var(--line); color: var(--dim); }
.g-binwrap { min-height: 0; min-width: 0; display: grid; place-items: center; container-type: size; }
/* the bin is 7 wide and 6 tall, plus the arrow row: as big as the space allows, never bigger */
.g-bin { width: min(100cqw, 100cqh * 1.02); }
.g-bin .bin:not(.has-arrows) { padding-top: 11.6%; }
.g-found { display: flex; flex-wrap: wrap; gap: 5px 6px; align-items: center; min-height: 30px; max-height: 62px; overflow: hidden; font-size: 13.5px; }
.g-found-l { color: var(--dim); font-weight: 700; }
.g-mine { display: grid; gap: 8px; }
.g-rack { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; justify-content: center; align-items: center; padding: 7px 8px 9px; border-radius: 12px; background: linear-gradient(#6b4a2a, #50351c); box-shadow: inset 0 2px 0 #8a6338, 0 3px 8px #0007; min-height: 58px; }
.g-none { color: var(--tile); grid-column: 1 / -1; text-align: center; }
.rt { aspect-ratio: 1; min-width: 0; max-height: 56px; justify-self: center; width: 100%; max-width: 56px; padding: 0; border-radius: 16%; font: 800 26px/1 var(--slab); transition: transform .12s, box-shadow .12s; }
.rt:disabled { opacity: 1; filter: saturate(.7) brightness(.9); }
.rt.picked { transform: translateY(-9px); box-shadow: 0 0 0 3px var(--good), 0 9px 16px #0009; }
.g-act { min-height: 50px; font-size: 16.5px; }
.letters { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: #06141acc; padding: 12px; }
.letters[hidden] { display: none; }
.letters-in { width: min(100%, 430px); max-height: 100%; background: var(--felt2); border: 2px solid var(--gold); border-radius: 18px; padding: 12px; display: grid; gap: 10px; }
.letters-in h2 { text-align: center; font-size: 18px; }
.letters-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.letters-grid button { padding: 0; aspect-ratio: 1; max-height: 46px; font: 800 19px/1 var(--slab); background: #f6efd9; color: var(--tileink); border-color: #e6dab0; }

/* 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 Drop button lives, so it is
   moved up beside "?" and the header keeps a gap for it (.g-pillgap). Off the top centre and the top right:
   the rig's launcher owns those on a panel. */
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: 430px) { .g-head { gap: 8px; } .g-title { font-size: 11px; } .g-bag { font-size: 12px; } }

/* A rig panel or a phone on its side: use the width. The bin on the left, everything you press on the
   right. Nothing a player presses is below the fold, and the top centre stays clear for the launcher. */
@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 auto minmax(0, 1fr) auto; column-gap: 18px; padding: 8px 16px 10px; }
  .g-head { grid-column: 1 / -1; }
  .g-binwrap { grid-column: 1; grid-row: 2 / -1; }
  .g-scores, #cs-pres-slot, .g-coach, .g-found, .g-mine { grid-column: 2; }
  .g-found { align-content: start; max-height: none; }
  .g-mine { grid-row: 6; }
  body.phone #cs-pill { left: 64px; top: 8px; }
  .g-title { font-size: 17px; }
  .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; }
}

/* ---- the end screen's picture of the bin (sized in em: the kit's fit loop shrinks the font) ---- */
.end-bin { width: 17em; max-width: 100%; margin: .3em auto 0; font-size: 1em; }

/* ---- 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, 14, 18, .84); }
.cm-ring { fill: none; stroke: var(--gold); stroke-width: 2; }
.cm-ln { stroke: var(--tile); stroke-width: 2; stroke-linecap: round; }
.cm-dot { fill: var(--gold); stroke: var(--tileink); 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(--felt2); border: 1.5px solid var(--gold); 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(--gold); color: var(--tileink); font: 700 13px/1 var(--body); }
.cm-call .cm-t { font: 800 15.5px/22px var(--display); color: var(--tile); }
.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: #07171df7; 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(--gold); background: var(--felt2); 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(--gold); }
.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; }
.hero h1 { font-size: clamp(30px, 8.6vw, 64px); padding: .1em 0 .2em; }
.tag { font-size: 1.2em; color: var(--dim); margin: 6px 0 4px; }
.credit { color: var(--tile); margin: 4px 0 2px; }
.cta { display: inline-block; margin: 14px 10px 6px 0; padding: 12px 20px; border-radius: 14px; background: var(--gold); color: var(--tileink); font-weight: 800; text-decoration: none; }
.cta.alt { background: var(--felt3); 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(--felt2); border-radius: 14px; padding: 12px 14px; } .how h3 { color: var(--gold); margin-bottom: 4px; }
.rooms { margin-top: 30px; } .rooms .room { display: flex; justify-content: space-between; align-items: center; background: var(--felt2); border-radius: 12px; padding: 10px 14px; margin: 6px 0; }
.rooms .code { font-family: var(--slab); color: var(--gold); letter-spacing: 3px; font-size: 22px; }
#rejoin { display: none; background: var(--felt2); border-left: 4px solid var(--gold); 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: 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; }
