/* Pokino: the shared look for splash, phone and TV. A card table: green baize, bone dominoes with a
   coloured numeral for each number (after the coloured pips of a double-twelve set), copper beads.
   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: #0c2620; --felt2: #12362d; --felt3: #1b4a3e; --line: #2f6a5a;
  --ink: #f3ead7; --dim: #a5c2b6; --bone: #f6eeda; --inkd: #1d1a14;
  --copper: #f08a4b; --copper2: #c9652c; --teal: #35c4b5;
  --good: #7be08f; --bad: #ff7a6b;
  /* the kit's shared end screen (client/endscreen.ts), in this game's colours */
  --cs-end-bg: radial-gradient(120% 90% at 50% -10%, #1b4a3e 0%, #0c2620 62%); --cs-end-fg: #f3ead7; --cs-end-dim: #a5c2b6;
  --cs-end-accent: #f08a4b; --cs-end-win: #f08a4b; --cs-end-loss: #35c4b5;
  --display: "Rockwell", "Roboto Slab", "DejaVu Serif", Georgia, 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(--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: 700; margin: 0; }
h1 { color: var(--copper); font-size: 34px; line-height: 1.1; }
h2 { color: var(--bone); 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(--copper); border-color: var(--copper); color: var(--inkd); }
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(--copper); }
.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(--bone); color: var(--inkd);
  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); }
/* on a seat the bottom of the screen is the play button: news drops in from the top instead */
body.phone #toast { bottom: auto; top: 56px; transform: translateX(-50%) translateY(-220px); text-align: center; }
body.phone #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; }
.levers { display: grid; gap: 6px; }
.levers label { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--dim); font-weight: 700; font-size: 14px; }
.levers select { max-width: 62%; padding: 5px 6px; font-size: 14px; }

/* ---- shared pieces: the table of dominoes (client/shared/board.ts), cards, hand dominoes, beads ---- */
.board { width: 100%; height: 100%; display: block; }
.board text { font-family: var(--body); text-anchor: middle; dominant-baseline: central; pointer-events: none; -webkit-user-select: none; user-select: none; }
.b-dot { fill: #ffffff26; }
.b-dom { fill: var(--bone); stroke: #b3a688; stroke-width: .3; }
.b-dom.last { stroke: var(--copper); stroke-width: .9; animation: lastpulse 1.4s ease-in-out 3; }
@keyframes lastpulse { 50% { stroke-width: 1.7; } }
.b-mid { stroke: #a2957a; stroke-width: .45; stroke-linecap: round; }
.b-n { font-size: 5.6px; font-weight: 800; } .b-n.two { font-size: 5px; letter-spacing: -.25px; }
.b-l { font-size: 2.2px; font-weight: 700; fill: #8b7f68; }
.b-tok { stroke: var(--inkd); stroke-width: .5; }
.b-lastrun { fill: none; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; opacity: .55; stroke-dasharray: .2 2.2; }
.b-ring { fill: #7be08f24; stroke: var(--good); stroke-width: .85; animation: ringpulse 1.3s ease-in-out infinite; }
@keyframes ringpulse { 50% { stroke-opacity: .35; } }
.b-spot { fill: #7be08f1c; stroke: var(--good); stroke-width: .5; stroke-dasharray: 1.4 1; }
.b-plus { font-size: 5px; font-weight: 700; fill: var(--good); }
.b-dom.ghost { fill: #f6eedacc; stroke: var(--teal); stroke-width: .8; stroke-dasharray: 1.6 .9; }
.b-mid.ghost { stroke: var(--teal); }
.b-path { fill: none; stroke: var(--teal); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; opacity: .5; }
.b-start, .b-end { fill: none; stroke: var(--teal); stroke-width: .9; }
.b-end { stroke-dasharray: 1.6 1; }
.hit { fill: transparent; cursor: pointer; }

.card { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; flex: none; width: 34px; height: 46px; border-radius: 6px;
  background: #fffdf6; color: var(--inkd); border: 1px solid #c9bfa6; line-height: 1; transition: transform .12s, box-shadow .12s; }
.card b { font-size: 16px; font-weight: 800; letter-spacing: -.5px; }
.card i { font-style: normal; font-size: 14px; }
.card u { position: absolute; right: 2px; bottom: 1px; font-size: 9px; font-weight: 700; text-decoration: none; color: #7a705c; }
.card.red b, .card.red i { color: #c0392b; }
.card.used { transform: translateY(-7px); box-shadow: 0 0 0 2.5px var(--teal), 0 6px 10px #0007; }
.card.none { background: none; border: 1.5px dashed var(--line); }
.bead { display: inline-block; width: .72em; height: .72em; border-radius: 50%; margin-right: .28em; vertical-align: -.02em;
  background: radial-gradient(circle at 35% 30%, #ffc79e, var(--copper) 55%, var(--copper2)); }
.tile { display: inline-flex; align-items: stretch; padding: 0; width: 86px; height: 46px; border-radius: 9px; background: var(--bone); border: 1.5px solid #b3a688; color: var(--inkd); overflow: hidden; transition: transform .12s, box-shadow .12s; }
.tile span { position: relative; flex: 1; display: grid; place-items: center; font: 800 22px/1 var(--body); }
.tile span u { position: absolute; left: 4px; top: 3px; font-size: 10px; font-weight: 700; text-decoration: none; color: #8b7f68; }
.tile em { width: 2px; margin: 7px 0; background: #a2957a; border-radius: 2px; }
.tile.picked { transform: translateY(-5px); box-shadow: 0 0 0 3px var(--good), 0 8px 14px #0008; }
.tile.picked .first { background: #7be08f4d; }
.tile.fresh { box-shadow: 0 0 0 3px var(--copper); animation: freshin .5s ease-out; }
@keyframes freshin { from { transform: translateY(-14px); opacity: 0; } }
.tile:disabled { opacity: .8; }

/* ---- 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 minmax(0, 1fr) auto; gap: 7px;
  padding: max(8px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); max-width: 620px; margin: 0 auto; overflow: hidden; }
.g-head { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.g-title { font: 700 19px var(--display); color: var(--copper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-stock { margin-left: auto; white-space: nowrap; color: var(--dim); font-size: 13px; font-weight: 700; } .g-stock 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(--copper); }
@keyframes helppulse { 50% { box-shadow: 0 0 0 6px #f08a4b55; } }
#cs-pres-slot { display: flex; justify-content: center; min-height: 0; }
.g-seats { display: flex; gap: 6px; }
.chip { flex: 1 1 0; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; align-items: baseline; padding: 4px 8px 5px; border-radius: 10px; background: #0005; border: 1.5px solid transparent; border-left: 5px solid var(--seat); }
.chip.up { border-color: var(--seat); background: #ffffff14; }
.chip .c-name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .c-score { font: 700 19px/1 var(--display); color: var(--bone); }
.chip .c-sub { grid-column: 1 / -1; font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-coach { background: var(--felt2); border-left: 4px solid var(--copper); border-radius: 6px 12px 12px 6px; padding: 7px 11px; font-size: 14.5px; line-height: 1.3; min-height: 54px; display: flex; align-items: center; }
.g:not(.mine) .g-coach { border-left-color: var(--line); color: var(--dim); }
.g-board { position: relative; min-height: 0; border-radius: 14px; background: #0003; box-shadow: inset 0 0 0 1.5px #ffffff12; overflow: hidden; }
.g-svg { position: absolute; inset: 4px; touch-action: none; overscroll-behavior: contain; }
.g-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.g-zoom[hidden] { display: none; }
.g-zoom button { min-width: 44px; height: 44px; padding: 0 10px; border-radius: 22px; background: #0c2620e6; font-size: 16px; }
.g-zoom #g-zin { font-size: 24px; line-height: 1; }
.g-mine { display: grid; gap: 8px; min-width: 0; }
.g-hand { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-end; min-height: 54px; padding-top: 8px; }
.g-hand.some .card { width: 29px; height: 40px; } .g-hand.some .card b { font-size: 14px; } .g-hand.some .card i { font-size: 12px; }
.g-hand.many { gap: 3px; } .g-hand.many .card { width: 24px; height: 34px; border-radius: 5px; } .g-hand.many .card b { font-size: 12px; } .g-hand.many .card i { font-size: 10px; } .g-hand.many .card u { display: none; }
.g-none { color: var(--dim); align-self: center; }
.g-next { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding-left: 8px; }
.g-next small { color: var(--dim); font-size: 11px; line-height: 1.1; max-width: 52px; text-align: right; }
.g-next .card { box-shadow: 2px 2px 0 #c9bfa6, 4px 4px 0 #8f8672; }
.g-row { display: grid; gap: 8px; }
.g-tiles { display: flex; gap: 8px; justify-content: center; min-height: 46px; }
.g-btns { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.g-btns button { min-height: 48px; padding: 6px 12px; font-size: 15px; line-height: 1.15; }

/* 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 play 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; }

/* A rig panel or a phone on its side: use the width. The table left, everything you hold 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: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-rows: auto auto auto auto minmax(0, 1fr); column-gap: 14px; padding: 8px 14px 10px; }
  .g-head { grid-column: 2; grid-row: 1; } .g-seats { grid-column: 2; grid-row: 2; } #cs-pres-slot { grid-column: 2; grid-row: 3; } .g-coach { grid-column: 2; grid-row: 4; }
  .g-board { grid-column: 1; grid-row: 1 / -1; }
  .g-mine { grid-column: 2; grid-row: 5; align-content: end; }
  body.phone #cs-pill { left: auto; right: calc(14px + 50px); top: 8px; }
  .g-head { justify-content: flex-start; flex-direction: row-reverse; } .g-stock { margin-left: 0; margin-right: auto; }
  .g-coach { min-height: 44px; font-size: 14px; }
  .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; }
  .levers { gap: 3px; } .levers label { font-size: 13px; } .levers select { padding: 2px 4px; font-size: 13px; }
  .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(3, 12, 9, .84); }
.cm-ring { fill: none; stroke: var(--copper); stroke-width: 2; }
.cm-ln { stroke: var(--bone); stroke-width: 2; stroke-linecap: round; }
.cm-dot { fill: var(--copper); stroke: var(--inkd); 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(--copper); 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(--copper); color: var(--inkd); font: 700 13px/1 var(--body); }
.cm-call .cm-t { font: 700 15.5px/22px var(--display); color: var(--bone); }
.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: #081a15f7; 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(--copper); 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(--copper); }
.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(36px, 7vw, 60px); }
.tag { font-size: 1.2em; color: var(--dim); margin: 6px 0 4px; }
.cta { display: inline-block; margin: 14px 10px 6px 0; padding: 12px 20px; border-radius: 14px; background: var(--copper); color: var(--inkd); 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(--copper); margin-bottom: 4px; }
.credit { margin-top: 14px; color: var(--dim); } .credit b { color: var(--ink); }
.pips { display: flex; gap: 8px; margin: 2px 0 14px; } .pips .tile { cursor: default; }
.scoretable { border-collapse: collapse; margin: 8px 0; } .scoretable th, .scoretable td { padding: 4px 12px; border: 1px solid var(--line); text-align: center; } .scoretable th { color: var(--dim); font-weight: 700; text-align: left; }
.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(--display); color: var(--copper); letter-spacing: 3px; font-size: 22px; }
#rejoin { display: none; background: var(--felt2); border-left: 4px solid var(--copper); 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; }
