/* Shift: the shared look for splash, phone and TV. The game was invented for hiking (painted
   clothespins on a cord round your neck), so: bark brown, a pale cord, four painted pegs and a
   trail-blaze orange for 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 {
  --bark: #1c1611; --bark2: #2a211a; --bark3: #3a2e24; --line: #5a4838;
  --ink: #f4ecdc; --dim: #b9a88f; --cord: #e2cfa4; --inkd: #20160c;
  --blaze: #ff9d3c; --blaze2: #d97a1c;
  --s0: #e5484d; --s1: #f5c542; --s2: #4ea1ff; --s3: #3fbf6b;
  --good: #7bd88f; --bad: #ff7b6b;
  /* the kit's shared end screen (client/endscreen.ts), in this game's colours */
  --cs-end-bg: radial-gradient(120% 90% at 50% -10%, #3a2e24 0%, #1c1611 62%); --cs-end-fg: #f4ecdc; --cs-end-dim: #b9a88f;
  --cs-end-accent: #ff9d3c; --cs-end-win: #ff9d3c; --cs-end-loss: #4ea1ff;
  --display: "Trebuchet MS", "Gill Sans", "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(--bark) radial-gradient(ellipse at 50% -10%, var(--bark3), var(--bark) 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(--blaze); font-size: 34px; line-height: 1.1; }
h2 { color: var(--cord); font-size: 20px; }
button { background: var(--bark3); 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(--blaze); border-color: var(--blaze); color: var(--inkd); }
button:disabled { opacity: .45; cursor: default; }
select, input { font: inherit; padding: 8px; border-radius: 8px; background: var(--bark2); color: var(--ink); border: 1.5px solid var(--line); }
a { color: var(--blaze); }
.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(--cord); 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; }

/* ---- the card: a painted peg on a cord. Sized in em: the row's font-size is the card's width ---- */
.row { position: relative; display: inline-flex; gap: .12em; align-items: center; padding: .1em 0; }
.row::before { content: ""; position: absolute; left: -.25em; right: -.25em; top: .42em; height: .07em; min-height: 1.5px; background: var(--cord); opacity: .7; border-radius: 1px; }
.cd { position: relative; flex: none; display: inline-grid; place-items: center; width: 1em; height: 1.45em; padding: 0; border-radius: .2em; border: .06em solid #0007;
  background: var(--c, var(--bark3)); color: #0009; font: inherit; line-height: 1; vertical-align: middle; box-shadow: inset 0 .08em 0 #fff5, 0 .06em .12em #0008; }
.cd::after { content: ""; position: absolute; top: .16em; left: 50%; width: .2em; height: .2em; margin-left: -.1em; border-radius: 50%; background: #0008; box-shadow: 0 .03em 0 #fff4; }
.cd .sh { width: .62em; height: .62em; margin-top: .3em; fill: #0009; }
.cd.back { --c: #6b5644; background: repeating-linear-gradient(135deg, #6b5644 0 .14em, #5c4939 .14em .28em); }
.s0 { --c: var(--s0); } .s1 { --c: var(--s1); } .s2 { --c: var(--s2); } .s3 { --c: var(--s3); }
.sh { width: 1em; height: 1em; fill: currentColor; vertical-align: -.12em; }
.dry { display: inline-flex; align-items: center; gap: .25em; font-size: .8em; font-weight: 700; color: var(--dim); white-space: nowrap; }
.dry i { display: inline-grid; position: relative; color: var(--c); font-style: normal; }
.dry i::after { content: ""; position: absolute; left: -10%; right: -10%; top: 46%; height: 2px; background: var(--ink); transform: rotate(-35deg); }

/* ---- 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 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 19px var(--display); color: var(--blaze); white-space: nowrap; }
.g-turn { margin-left: auto; white-space: nowrap; color: var(--dim); font-weight: 700; font-size: 14px; }
.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(--blaze); }
@keyframes helppulse { 50% { box-shadow: 0 0 0 6px #ff9d3c55; } }
#cs-pres-slot { display: flex; justify-content: center; min-height: 0; }
.g-coach { background: var(--bark2); border-left: 4px solid var(--blaze); border-radius: 6px 12px 12px 6px; padding: 8px 12px; font-size: 14.5px; line-height: 1.32; min-height: 76px; display: flex; align-items: center; }
.g:not(.mine) .g-coach { border-left-color: var(--line); color: var(--dim); }

.g-others { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-height: 0; overflow: hidden; }
.opp { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; width: 100%; padding: 6px 12px; border-radius: 12px; text-align: left;
  background: #0004; border: 2px solid transparent; color: var(--ink); font-size: 15px; }
.opp:disabled { opacity: 1; }
.opp.can { border-color: var(--line); background: var(--bark2); }
.opp.on { border-color: var(--cord); }
.opp.sel { border-color: var(--good); box-shadow: 0 0 0 2px var(--good); }
.opp .o-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.opp .o-name em { font-style: normal; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--inkd); background: var(--cord); border-radius: 99px; padding: 1px 7px; margin-left: 8px; vertical-align: 2px; }
.opp .row { font-size: 23px; }
.opp .dry { grid-column: 1 / -1; font-size: 12.5px; }
.g-others[data-n="2"] .opp, .g-others[data-n="3"] .opp { padding: 10px 12px; }
.g-others[data-n="2"] .opp .row, .g-others[data-n="3"] .opp .row { font-size: 26px; }
.g-others[data-n="6"] .opp, .g-others[data-n="7"] .opp { padding: 3px 10px; }
.g-others[data-n="6"] .opp .row, .g-others[data-n="7"] .opp .row { font-size: 20px; }
.opp .cd.end { outline: 2px solid #fff3; outline-offset: 1px; }

.g-mine { display: grid; gap: 8px; justify-items: center; }
.g-in { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 44px; font-size: 14px; color: var(--dim); }
.g-in .cd { font-size: 26px; }
.g-in .g-ends { flex: 1; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; align-self: flex-end; }
.g-in .g-ends.r { text-align: right; }
.g-hand { font-size: min(38px, calc((100vw - 24px - 27px) / 10)); display: flex; gap: 3px; justify-content: center; align-items: flex-end; min-height: 1.75em; padding-top: .3em;
  background: linear-gradient(var(--cord), var(--cord)) 0 calc(.3em + .32em) / 100% 2px no-repeat; width: 100%; }
.g-hand .cd { transition: transform .12s, box-shadow .12s; }
.g-hand .cd:disabled { opacity: 1; }
.g.mine .g-hand .cd.can { box-shadow: 0 0 0 2px var(--ink), 0 .06em .12em #0008; cursor: pointer; }
.g-hand .cd.picked { transform: translateY(-.3em); box-shadow: 0 0 0 3px var(--good), 0 .2em .4em #000a; }
.g-hand .cd.leaving { opacity: .45; transform: translateY(.18em); }
.g-hand .cd.slot { background: none; border: .06em dashed var(--cord); color: var(--cord); box-shadow: none; font-size: 1em; }
.g-hand .cd.slot::after { display: none; }
.g-hand button.cd.slot:not(.picked) { font-size: .9em; width: 1.11em; height: 1.61em; line-height: 1; font-weight: 800; }
.g-hand .cd.slot.picked { border-style: solid; background: var(--c); }
.g-none { font-size: 15px; color: var(--dim); }
.g-suits { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; width: 100%; }
.suit { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 4px 4px; font-size: 14px; background: var(--bark2); border: 2px solid var(--c); color: var(--ink); }
.suit .sh { color: var(--c); width: 1.2em; height: 1.2em; }
.suit.sel { background: var(--c); color: var(--inkd); box-shadow: 0 0 0 2px var(--good); } .suit.sel .sh { color: var(--inkd); }
.suit:disabled { opacity: .35; }
#g-go { width: 100%; min-height: 52px; font-size: 16px; line-height: 1.15; padding: 6px 10px; }

/* 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 big 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 other hands left, your hand 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: 1fr 1.1fr; grid-template-rows: auto auto auto minmax(0, 1fr); column-gap: 18px; padding: 8px 16px 10px; }
  .g-head, .g-coach, #cs-pres-slot { grid-column: 1 / -1; }
  body.phone #cs-pill { left: 64px; top: 8px; }
  .g-coach { min-height: 44px; }
  .g-mine { align-content: center; }
  .g-hand { font-size: 38px; }
  .g-others[data-n="6"] .opp, .g-others[data-n="7"] .opp { padding: 2px 10px; }
  .g-others[data-n="6"] .opp .row, .g-others[data-n="7"] .opp .row { font-size: 18px; }
  .opp .dry { grid-column: auto; grid-row: 1; }
  .opp { grid-template-columns: minmax(0, 1fr) auto auto; }
  .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 "every hand, face up" (sized in em: the kit's fit loop shrinks it) ---- */
.end-rows { display: grid; gap: .5em; justify-content: center; }
.end-row { display: grid; grid-template-columns: 6em auto; align-items: center; gap: .8em; text-align: right; }
.end-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.end-row .row { font-size: 1.5em; }

/* ---- 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(12, 8, 5, .84); }
.cm-ring { fill: none; stroke: var(--blaze); stroke-width: 2; }
.cm-ln { stroke: var(--cord); stroke-width: 2; stroke-linecap: round; }
.cm-dot { fill: var(--blaze); 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(--bark2); border: 1.5px solid var(--blaze); 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(--blaze); color: var(--inkd); font: 700 13px/1 var(--body); }
.cm-call .cm-t { font: 800 15.5px/22px var(--display); color: var(--cord); }
.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: #140f0bf7; 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(--blaze); background: var(--bark2); 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(--blaze); }
.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, 68px); letter-spacing: .04em; }
.hero .demo { font-size: clamp(26px, 6vw, 44px); margin: 14px 0 4px; display: block; }
.byline { color: var(--cord); font-weight: 700; margin: 2px 0 0; } .byline a { color: var(--cord); }
.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(--blaze); color: var(--inkd); font-weight: 800; text-decoration: none; }
.cta.alt { background: var(--bark3); 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(--bark2); border-radius: 14px; padding: 12px 14px; } .how h3 { color: var(--blaze); margin-bottom: 4px; }
.rooms { margin-top: 30px; } .rooms .room { display: flex; justify-content: space-between; align-items: center; background: var(--bark2); border-radius: 12px; padding: 10px 14px; margin: 6px 0; }
.rooms .code { font-family: var(--display); color: var(--blaze); letter-spacing: 3px; font-size: 22px; }
#rejoin { display: none; background: var(--bark2); border-left: 4px solid var(--blaze); 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 .eg { font-size: 30px; display: block; margin: 8px 0; }
.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; }
