/* Up & Over: the shared look for splash, phone and TV. A card table at dusk: indigo cloth, cream
   cards, a coral line that climbs to a gold bar at 21 and a rose drop beyond it. 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 {
  --night: #14122b; --night2: #1f1c40; --night3: #2b2758; --line: #45408a;
  --ink: #f6f1e7; --dim: #aeaad6; --paper: #fbf6ea; --inkd: #1c1a2e;
  --amber: #ff8552; --amber2: #e0633a; --bar: #ffd166; --suit: #d6304a;
  --good: #2fd6a8; --bad: #ff5c7a;
  /* the kit's shared end screen (client/endscreen.ts), in this game's colours */
  --cs-end-bg: radial-gradient(120% 90% at 50% -10%, #2b2758 0%, #14122b 62%); --cs-end-fg: #f6f1e7; --cs-end-dim: #aeaad6;
  --cs-end-accent: #ffd166; --cs-end-win: #2fd6a8; --cs-end-loss: #ff5c7a;
  --display: "Trebuchet MS", "Avenir Next", "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); background: var(--night) radial-gradient(ellipse at 50% -10%, var(--night3), var(--night) 70%) fixed;
  -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; margin: 0; letter-spacing: -.01em; }
h1 { color: var(--amber); font-size: 34px; line-height: 1.1; }
h2 { color: var(--paper); font-size: 20px; }
button { background: var(--night3); 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(--amber); border-color: var(--amber); color: var(--inkd); }
button:disabled { opacity: .38; cursor: default; }
select, input { font: inherit; padding: 8px; border-radius: 8px; background: var(--night2); color: var(--ink); border: 1.5px solid var(--line); }
a { color: var(--amber); }
.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(--paper); 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: 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: 8px; }
.levers label { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--dim); font-weight: 700; }

/* ---- shared pieces: a card, the trick, the climb ---- */
.card { position: relative; display: inline-grid; place-items: center; width: var(--cw, 44px); aspect-ratio: 5 / 7; border-radius: calc(var(--cw, 44px) * .13);
  background: var(--paper); color: var(--inkd); border: 1.5px solid #0003; box-shadow: 0 2px 6px #0006; font-family: var(--display); line-height: 1; user-select: none; }
.card.red { color: var(--suit); } .card.wild { color: #7a3fd0; }
.card .c-corner { position: absolute; top: 6%; left: 9%; display: grid; justify-items: center; font-size: calc(var(--cw, 44px) * .3); font-weight: 800; }
.card .c-corner i { font-style: normal; font-size: .8em; margin-top: .05em; }
.card .c-pip { font-size: calc(var(--cw, 44px) * .52); margin-top: 18%; }
.card .c-joker { font-size: calc(var(--cw, 44px) * .22); font-weight: 800; letter-spacing: .02em; }
.t-card { display: grid; justify-items: center; gap: 2px; min-width: 0; }
.t-card .t-count { font-weight: 800; font-size: 13px; color: var(--bar); font-variant-numeric: tabular-nums; }
.t-card .t-who { font-size: 10.5px; color: var(--dim); max-width: calc(var(--cw, 44px) + 8px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-card.latest .card { box-shadow: 0 0 0 2.5px var(--amber), 0 4px 12px #0008; }

.climb { position: relative; height: 14px; border-radius: 99px; background: #ffffff1c; overflow: visible; }
.climb .cl-over { position: absolute; left: var(--bar); right: 0; top: 0; bottom: 0; border-radius: 0 99px 99px 0;
  background: repeating-linear-gradient(135deg, #ff5c7a55 0 6px, #ff5c7a22 6px 12px); }
.climb .cl-fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--at); border-radius: 99px; background: linear-gradient(90deg, var(--amber2), var(--amber)); transition: width .35s ease-out; z-index: 1; }
.climb.exact .cl-fill { background: var(--good); } .climb.over .cl-fill { background: var(--bad); }
.climb .cl-bar { position: absolute; left: var(--bar); top: -5px; bottom: -5px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--bar); z-index: 2; }
.climb .cl-bar b { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); font: 800 11px var(--display); color: var(--bar); padding-bottom: 1px; }
.climb .cl-dot { position: absolute; left: var(--at); top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--paper); border: 3px solid var(--amber); transition: left .35s ease-out; z-index: 3; }
.climb.exact .cl-dot { border-color: var(--good); } .climb.over .cl-dot { border-color: var(--bad); }
.logo { height: .8em; width: auto; vertical-align: -.06em; margin-right: .25em; color: var(--amber); }

/* ---- 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: 800 18px var(--display); color: var(--amber); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-goal { margin-left: auto; white-space: nowrap; color: var(--dim); font-weight: 700; font-size: 13px; } .g-goal b { color: var(--bar); font-size: 1.25em; }
.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(--amber); }
@keyframes helppulse { 50% { box-shadow: 0 0 0 6px #ff855255; } }
#cs-pres-slot { display: flex; justify-content: center; min-height: 0; }
.g-seats { display: flex; align-items: stretch; gap: 2px; }
.g-seat { flex: 1 1 0; min-width: 0; display: grid; justify-items: center; gap: 1px; padding: 5px 2px 4px; border-radius: 10px; background: #0004; border: 1.5px solid transparent; }
.g-seat.me { background: var(--night2); }
.g-seat.up { border-color: var(--amber); background: #ff85521f; }
.g-seat.took { border-color: var(--good); background: #2fd6a822; }
.g-seat .s-name { font-size: 12px; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-seat .s-tricks b { font: 800 22px/1 var(--display); color: var(--bar); font-variant-numeric: tabular-nums; }
.g-seat .s-cards { font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.g-arrow { align-self: center; color: var(--line); font-weight: 800; }
.g-coach { background: var(--night2); border-left: 4px solid var(--amber); border-radius: 6px 12px 12px 6px; padding: 8px 12px; font-size: 14.5px; line-height: 1.33; min-height: 56px; display: flex; align-items: center; }
.g:not(.mine) .g-coach { border-left-color: var(--line); color: var(--dim); }
.g-table { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 8px; min-height: 0; padding: 10px 10px 6px; border-radius: 16px; background: radial-gradient(120% 100% at 50% 0%, #2b2758, #1a1838); border: 1.5px solid var(--line); }
.g-sumrow { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; }
.g-sum { display: grid; justify-items: center; min-width: 74px; }
.g-sum .sum-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); }
.g-sum b { font: 800 50px/1 var(--display); color: var(--paper); font-variant-numeric: tabular-nums; }
.g-sum b.exact { color: var(--good); } .g-sum b.over { color: var(--bad); }
.g-climb { display: grid; gap: 8px; padding-top: 12px; }
.g-deck { font-size: 12px; color: var(--dim); text-align: right; }
.g-trick { --cw: 50px; padding: 4px; display: flex; flex-wrap: wrap; gap: 6px 5px; justify-content: center; align-content: center; min-height: 0; overflow: hidden; }
.g-trick.many { --cw: 38px; gap: 4px; } .g-trick.many .t-who { display: none; }
.g-mine { display: grid; gap: 8px; }
.g-hand { --cw: 62px; display: flex; gap: 8px; justify-content: center; min-height: 88px; align-items: flex-end; }
.g-none { color: var(--dim); align-self: center; text-align: center; }
.hcard { padding: 0; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.hcard:disabled { opacity: 1; cursor: default; filter: saturate(.7) brightness(.82); }
.hcard.picked { transform: translateY(-10px); box-shadow: 0 0 0 3px var(--amber), 0 10px 18px #0009; }
.g-act { display: flex; gap: 8px; min-height: 58px; align-items: stretch; }
.g-act button { flex: 1 1 0; min-height: 54px; padding: 6px 8px; font-size: 15.5px; line-height: 1.15; display: grid; align-content: center; gap: 2px; }
.g-act button small { font-size: 12px; font-weight: 600; opacity: .85; }
.g-act.idle { align-items: center; justify-content: center; }
.g-note { color: var(--dim); font-size: 13.5px; text-align: center; }
.g-act.chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.g-act.chips button { min-height: 40px; padding: 0; font-size: 16px; }
.g-chipnote { grid-column: 1 / -1; color: var(--dim); font-size: 12.5px; text-align: center; }

/* A toast ("You drew...") drops from the top on a seat: the bottom is where the Play button is. */
body.phone #toast { top: max(54px, env(safe-area-inset-top)); bottom: auto; transform: translateX(-50%) translateY(-220px); }
body.phone #toast.show { transform: translateX(-50%) translateY(0); }

/* 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; }
@media (max-width: 380px) { .g-hand { --cw: 54px; gap: 6px; } .g-title { display: none; } }

/* A rig panel or a phone on its side: use the width. The trick on the left, your hand 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.1fr 1fr; grid-template-rows: auto auto auto minmax(0, 1fr); column-gap: 16px; padding: 8px 16px 10px; }
  .g-head { grid-column: 1 / -1; grid-row: 1; }
  .g-seats { grid-column: 1; grid-row: 2; } .g-coach { grid-column: 2; grid-row: 2; min-height: 0; }
  #cs-pres-slot { grid-column: 1 / -1; grid-row: 3; }
  .g-table { grid-column: 1; grid-row: 4; } .g-mine { grid-column: 2; grid-row: 4; align-content: center; }
  body.phone #cs-pill { left: 64px; top: 8px; }
  .g-head .g-title { max-width: 190px; }
  .g-hand { --cw: 72px; }
  .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(--amber); stroke-width: 2; }
.cm-ln { stroke: var(--paper); stroke-width: 2; stroke-linecap: round; }
.cm-dot { fill: var(--amber); 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(--night2); border: 1.5px solid var(--amber); 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(--amber); color: var(--inkd); font: 700 13px/1 var(--body); }
.cm-call .cm-t { font: 700 15.5px/22px var(--display); color: var(--paper); }
.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: #0a0f1af7; 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(--amber); background: var(--night2); 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(--amber); }
.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(--amber); color: var(--inkd); font-weight: 800; text-decoration: none; }
.cta.alt { background: var(--night3); 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(--night2); border-radius: 14px; padding: 12px 14px; } .how h3 { color: var(--amber); margin-bottom: 4px; }
.rooms { margin-top: 30px; } .rooms .room { display: flex; justify-content: space-between; align-items: center; background: var(--night2); border-radius: 12px; padding: 10px 14px; margin: 6px 0; }
.rooms .code { font-family: var(--display); color: var(--bar); letter-spacing: 3px; font-size: 22px; }
#rejoin { display: none; background: var(--night2); border-left: 4px solid var(--amber); 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; }
.credit { color: var(--dim); margin-top: 6px; } .credit a { color: var(--bar); }
.values { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; padding: 0; list-style: none; }
.values li { background: var(--night2); border-radius: 10px; padding: 8px 12px; margin: 0; } .values b { color: var(--bar); font-size: 1.15em; }
