/* Seven Pennies: the shared look for splash, phone and TV. An old playhouse: velvet red walls, a dark
   stage under one warm light, brass on the balcony rail, copper pennies. 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 {
  --velvet: #2c0a12; --velvet2: #45111d; --velvet3: #5f1c2b; --line: #8b3d4c;
  --ink: #fbeedd; --dim: #dfb9aa; --cream: #f8e6c4; --inkd: #2a1408;
  --brass: #ecc063; --brass2: #b98a2f; --copper: #e59a57; --copper2: #9a5526;
  --stage: #17100d; --stage2: #2a1b14;
  --good: #8fe0ad; --bad: #ff9a85;
  /* the kit's shared end screen (client/endscreen.ts), in this game's colours */
  --cs-end-bg: radial-gradient(120% 90% at 50% -10%, #5f1c2b 0%, #2c0a12 62%); --cs-end-fg: #fbeedd; --cs-end-dim: #dfb9aa;
  --cs-end-accent: #ecc063; --cs-end-win: #ecc063; --cs-end-loss: #e59a57;
  --display: Georgia, "Times New Roman", serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); font: 500 16px/1.4 var(--body); background: var(--velvet) radial-gradient(ellipse at 50% -10%, var(--velvet3), var(--velvet) 70%) fixed;
  -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; }
h1 { color: var(--brass); font-size: 34px; line-height: 1.1; font-style: italic; }
h2 { color: var(--cream); font-size: 20px; }
button { background: var(--velvet3); 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(--brass); border-color: var(--brass); color: var(--inkd); }
button:disabled { opacity: .45; cursor: default; }
select, input { font: inherit; padding: 8px; border-radius: 8px; background: var(--velvet2); color: var(--ink); border: 1.5px solid var(--line); }
a { color: var(--brass); }
.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(--cream); 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); }
#conn { position: fixed; top: 8px; right: 8px; background: #b3261e; 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; }
.levers select { padding: 6px 8px; max-width: 62%; }

/* ---- the pieces: a penny is 1em across, so its container's font size is its size ---- */
.pc { display: inline-block; width: 1em; height: 1em; flex: none; vertical-align: middle; line-height: 1; }
.pc svg { display: block; width: 100%; height: 100%; overflow: visible; }
.coin .rim { fill: none; stroke-width: 3.6; }
.coin.heads .fld { fill: #eba564; } .coin.heads .rim { stroke: #b96d2f; } .coin.heads .art { fill: #6f3611; }
.coin.tails .fld { fill: #93501f; } .coin.tails .rim { stroke: #5f2f10; } .coin.tails .art { fill: #f6c896; }
.coin.blank .fld { fill: #c17f45; } .coin.blank .rim { stroke: #7f4a21; }
.pc.die { width: 1.56em; height: 1.56em; font-size: .64em; display: inline-grid; place-items: center; border-radius: .22em; background: var(--cream); color: var(--inkd);
  font-weight: 800; font-family: var(--body); box-shadow: inset 0 -.1em 0 #0003; }

/* the balcony: a brass rail with the pennies waiting on it */
.balcony { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 12px 12px 4px 4px; background: linear-gradient(#3a0f1a, #2a0a12);
  border: 1.5px solid var(--brass2); border-bottom: 5px solid var(--brass2); box-shadow: 0 6px 14px #0007; min-height: 44px; }
.b-lab { font: italic 700 15px var(--display); color: var(--brass); letter-spacing: .04em; }
.b-coins { flex: 1; display: flex; flex-wrap: wrap; font-size: 22px; min-width: 0; padding-left: .3em; }
.b-coins .pc { margin-left: -.3em; filter: drop-shadow(0 1px 1px #0008); }
.b-n { white-space: nowrap; color: var(--dim); font-size: 13.5px; } .b-n b { color: var(--ink); font-size: 1.3em; }

/* the theatre: a dark stage, one light */
.theatre { position: relative; min-height: 0; border-radius: 4px 4px 14px 14px; border: 1.5px solid #000; overflow: hidden;
  background: radial-gradient(ellipse 75% 85% at 50% 42%, #5a3b24 0%, #2c1c13 55%, var(--stage) 100%); box-shadow: inset 0 0 26px #000c; display: grid; }
.th-coins { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; align-items: center; gap: .14em; padding: .16em; font-size: 64px; min-height: 0; }
.th-coins.many { font-size: 46px; }
.th-coins.empty { font-size: 15px; } .th-none { color: #c9a58c; font-style: italic; }
.th-coins .pc { transition: transform .3s, opacity .3s; filter: drop-shadow(0 .05em .05em #000a); }
.th-coins .paired { opacity: .3; transform: scale(.58); }
.th-coins .back { opacity: .3; transform: scale(.58); }
.th-coins .taken { border-radius: 50%; box-shadow: 0 0 0 .06em var(--brass), 0 0 .3em .06em #ecc06399; }
.th-coins .die.taken { border-radius: .22em; }
.th-coins .cancelled { opacity: .5; filter: grayscale(.7); border-radius: 50%; box-shadow: 0 0 0 .05em var(--bad); }
.th-coins .sel { transform: translateY(-.12em); border-radius: .22em; box-shadow: 0 0 0 .1em var(--good); }
.th-coins [data-face] { cursor: pointer; }
/* a throw that has just landed: each piece drops and spins, then the pairs shrink away */
.th-coins.fresh .pc { animation: land .62s cubic-bezier(.3, 1.4, .5, 1) backwards; animation-delay: calc(var(--i) * 55ms); }
.th-coins.fresh .paired { animation: land .62s cubic-bezier(.3, 1.4, .5, 1) backwards, leave .5s 1.25s ease-in backwards; animation-delay: calc(var(--i) * 55ms), 1.25s; }
@keyframes land { 0% { opacity: 0; transform: translateY(-1.6em) rotateX(900deg) scale(1.25); } 25% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes leave { from { opacity: 1; transform: none; } to { opacity: .3; transform: scale(.58); } }
@media (prefers-reduced-motion: reduce) { .th-coins.fresh .pc, .th-coins.fresh .paired { animation: none; } }
.th-cap { text-align: center; font-size: 14.5px; color: var(--cream); min-height: 1.4em; }

.nickels { display: inline-flex; align-items: center; gap: 3px; }
.nickels i { width: .8em; height: .8em; border-radius: 50%; background: #d5dce3; border: 1.5px solid #89939d; }
.nickels em { font-style: normal; font-size: .8em; color: var(--dim); }

/* ---- 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: 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: italic 700 18px var(--display); color: var(--brass); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-round { margin-left: auto; white-space: nowrap; color: var(--dim); font-size: 13.5px; 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(--brass); }
@keyframes helppulse { 50% { box-shadow: 0 0 0 6px #ecc06355; } }
#cs-pres-slot { display: flex; justify-content: center; min-height: 0; }

.g-seats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.g.n3 .g-seats, .g.n5 .g-seats, .g.n6 .g-seats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seat { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1px 6px; padding: 5px 9px; border-radius: 10px; background: #0005; border: 1.5px solid transparent; min-width: 0; }
.seat.up { border-color: var(--brass); background: #ecc0631f; }
.seat.out { opacity: .5; }
.s-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-name i { font-style: normal; font-weight: 600; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.s-score { font: 700 20px/1 var(--display); color: var(--brass); white-space: nowrap; } .s-score em { font: 700 13px var(--body); color: var(--good); margin-left: 3px; }
.seat .nickels { font-size: 14px; }
@media (max-width: 480px) { .g.n3 .seat .nickels, .g.n5 .seat .nickels, .g.n6 .seat .nickels { font-size: 10.5px; gap: 2px; } }
.s-pile { grid-column: 1 / -1; display: flex; align-items: center; gap: 5px; font-size: 18px; min-height: 22px; white-space: nowrap; }
.s-pile b { font-size: 14.5px; } .s-pile i { font-style: normal; font-size: 12.5px; color: var(--dim); }

.g-coach { background: var(--velvet2); border-left: 4px solid var(--brass); border-radius: 6px 12px 12px 6px; padding: 8px 12px; font-size: 14.5px; line-height: 1.35; min-height: 60px; display: flex; align-items: center; }
.g:not(.mine) .g-coach { border-left-color: var(--line); color: var(--dim); }
.g-stage { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 5px; min-height: 0; }
.g-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.g-btns button { min-height: 54px; padding: 6px 8px; font-size: 16.5px; line-height: 1.15; }
#g-toss { grid-column: 1 / -1; font-size: 18px; }
.g-who { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-height: 54px; }
.g-who span { font-weight: 700; font-size: 14.5px; }
.g-who button { flex: 1; min-height: 54px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-who .back { flex: none; width: 54px; }

/* 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 Cancel 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; }
body.phone #cs-pill { z-index: 5; }
.g-round .short { display: none; }
@media (max-width: 480px) { .g-round .long { display: none; } .g-round .short { display: inline; } }

/* A rig panel or a phone on its side: use the width. The stage on the left, the players and the
   buttons on the 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.15fr 1fr; grid-template-rows: auto auto auto minmax(0, 1fr) auto; column-gap: 16px; padding: 8px 16px 10px; }
  .g-head { grid-column: 1 / -1; }
  .g-stage { grid-column: 1; grid-row: 2 / -1; }
  .g-seats, #cs-pres-slot, .g-coach, .g-btns { grid-column: 2; }
  .g-coach { align-self: start; }
  body.phone #cs-pill { left: 64px; top: 8px; }
  .g-head .g-title { max-width: 190px; }
  .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(14, 3, 6, .84); }
.cm-ring { fill: none; stroke: var(--brass); stroke-width: 2; }
.cm-ln { stroke: var(--cream); stroke-width: 2; stroke-linecap: round; }
.cm-dot { fill: var(--brass); 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(--velvet2); border: 1.5px solid var(--brass); 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(--brass); color: var(--inkd); font: 700 13px/1 var(--body); }
.cm-call .cm-t { font: 700 15.5px/22px var(--display); color: var(--cream); }
.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: #1b060bf7; 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(--brass); background: var(--velvet2); 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(--brass); }
.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(40px, 8vw, 66px); }
.hero .pennies { font-size: clamp(30px, 6vw, 46px); margin: 10px 0 4px; display: flex; gap: .12em; }
.hero .pennies .pc { filter: drop-shadow(0 3px 3px #0008); }
.byline { font: italic 600 1.1em var(--display); color: var(--cream); margin-top: 2px; }
.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(--brass); color: var(--inkd); font-weight: 800; text-decoration: none; }
.cta.alt { background: var(--velvet3); 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(--velvet2); border-radius: 14px; padding: 12px 14px; } .how h3 { color: var(--brass); margin-bottom: 4px; }
.rooms { margin-top: 30px; } .rooms .room { display: flex; justify-content: space-between; align-items: center; background: var(--velvet2); border-radius: 12px; padding: 10px 14px; margin: 6px 0; }
.rooms .code { font-family: var(--display); color: var(--brass); letter-spacing: 3px; font-size: 22px; }
#rejoin { display: none; background: var(--velvet2); border-left: 4px solid var(--brass); border-radius: 8px; padding: 12px 16px; margin-top: 18px; } #rejoin.show { display: block; }
.credit { margin-top: 26px; padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--line); color: var(--dim); }
.credit b { color: var(--ink); }
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; }
.helppage .pc { font-size: 1.3em; }
/* three chips across a phone: the name needs the room more than the "bot" tag does */
@media (max-width: 480px) { .g.n5 .seat:not(.me) .s-name i, .g.n6 .seat:not(.me) .s-name i { display: none; } }
