/* Uncontrolled Squid: the shared look for splash, phone and TV. Deep water, an orange plush squid,
   two cults: Ink in violet with a diamond, Brine in sea green with a dot (never colour alone). Cards
   are bone white. 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 {
  --deep: #07151f; --deep2: #0d2230; --deep3: #163447; --line: #2a5068;
  --ink: #eaf4f2; --dim: #93b3bd; --bone: #fbf3e4; --boned: #1b1a22;
  --squid: #ff8a3d; --squid2: #d9561c; --squid3: #ffd2a8;
  --t0: #b39bff; --t0d: #6d55d8; --t1: #3fd2b4; --t1d: #169a80;
  --good: #7be08f; --bad: #ff6b6b; --red: #c8323c;
  /* the kit's shared end screen (client/endscreen.ts), in this game's colours */
  --cs-end-bg: radial-gradient(120% 90% at 50% -10%, #163447 0%, #07151f 62%); --cs-end-fg: #eaf4f2; --cs-end-dim: #93b3bd;
  --cs-end-accent: #ff8a3d; --cs-end-win: #ff8a3d; --cs-end-loss: #b39bff;
  --display: "Trebuchet MS", "Gill Sans", "Segoe 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); -webkit-tap-highlight-color: transparent;
  background: var(--deep) radial-gradient(ellipse at 50% -20%, var(--deep3), var(--deep) 70%) fixed; }
/* a few bubbles drifting up behind everything */
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: .5;
  background: radial-gradient(circle at 12% 80%, #ffffff14 0 5px, transparent 6px), radial-gradient(circle at 85% 35%, #ffffff12 0 7px, transparent 8px),
    radial-gradient(circle at 70% 88%, #ffffff10 0 4px, transparent 5px), radial-gradient(circle at 30% 20%, #ffffff0e 0 6px, transparent 7px); }
h1, h2, h3 { font-family: var(--display); font-weight: 800; margin: 0; letter-spacing: .01em; }
h1 { color: var(--squid); font-size: 34px; line-height: 1.1; }
h2 { color: var(--squid3); font-size: 20px; }
button { background: var(--deep3); 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(--squid); border-color: var(--squid); color: var(--boned); }
button:disabled { opacity: .4; cursor: default; }
select, input { font: inherit; padding: 8px; border-radius: 8px; background: var(--deep2); color: var(--ink); border: 1.5px solid var(--line); }
a { color: var(--squid); }
.muted, .hint, .tagg { color: var(--dim); }
.hint { font-size: 14px; }
.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(--boned);
  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: 6px; }
.levers label { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--dim); font-weight: 700; font-size: 15px; }
.levers select { max-width: 60%; padding: 5px 6px; }

/* ---- shared pieces: marks, pips, cards, the Squid ---- */
.mark { font-style: normal; margin-right: .25em; }
.mark.t0 { color: var(--t0); } .mark.t1 { color: var(--t1); }
.pips { display: inline-flex; gap: 4px; vertical-align: middle; }
.pips i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; opacity: .55; }
.pips i.on { background: currentColor; opacity: 1; }
.card { position: relative; display: inline-grid; place-items: center; width: 2.2em; height: 3em; border-radius: .32em; background: var(--bone); color: var(--boned);
  border: .08em solid #0004; box-shadow: 0 .1em .25em #0006; line-height: 1; vertical-align: middle; font-family: var(--display); }
.card b { font-size: 1.15em; font-weight: 800; }
.card i { position: absolute; left: .18em; top: .14em; font-style: normal; font-size: .62em; }
.card.red { color: var(--red); }
.card.back { background: var(--squid2) repeating-linear-gradient(45deg, #ffffff22 0 .18em, transparent .18em .4em); border-color: var(--squid3); }
.card.slot { background: transparent; border: .08em dashed var(--line); box-shadow: none; }
.card.took { box-shadow: 0 0 0 .14em var(--squid), 0 0 .8em .2em #ff8a3d99; }
.card.rnd::after { content: "?"; position: absolute; right: .14em; bottom: .08em; font-size: .55em; font-weight: 800; color: var(--squid2); }
.squid { display: block; width: 100%; height: 100%; overflow: visible; }
.squid .sq-head, .squid .sq-fin { fill: var(--squid); }
.squid .sq-arms { stroke: var(--squid2); }
.squid .sq-eye { fill: #fff; } .squid .sq-pupil { fill: #1b1a22; }

/* ---- the score: Ink | the Squid | Brine ---- */
.score { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; }
.sc { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 6px; border-radius: 10px; background: var(--deep2); border: 1.5px solid var(--line); min-width: 0; }
.sc .sc-n { font-weight: 800; font-size: 14px; white-space: nowrap; }
.sc .sc-n small { margin-left: 5px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
.sc.t0 { color: var(--t0); } .sc.t1 { color: var(--t1); } .sc.sc-sq { color: var(--squid); min-width: 74px; }
.sc.mine { border-color: currentColor; }
.sc.holds { background: #ff8a3d22; }
.sc.sc-sq.loose { background: #ff8a3d33; border-color: var(--squid); }
.sc .sc-n, .sc .sc-n * { color: inherit; } .sc .sc-n .mark { color: inherit; }

/* ---- 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; gap: 7px;
  padding: max(8px, env(safe-area-inset-top)) 10px 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 17px var(--display); color: var(--squid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-round { 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(--squid); }
@keyframes helppulse { 50% { box-shadow: 0 0 0 6px #ff8a3d55; } }
#cs-pres-slot { display: flex; justify-content: center; min-height: 0; }
.g-coach { background: var(--deep2); border-left: 4px solid var(--squid); 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.ph-reveal .g-coach { border-left-color: var(--squid); color: var(--ink); }

/* the table: two cults side by side, the Squid under them */
.g-table { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto; align-content: start; gap: 6px; min-height: 0; }
.g-table .col { display: flex; flex-direction: column; gap: 5px; min-height: 0; }
.g-table { overflow: hidden; }
.chip { flex: none; min-height: 50px; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; column-gap: 6px;
  padding: 3px 7px; border-radius: 10px; text-align: left; font-size: 14px; font-weight: 600; background: #0005; border: 1.5px solid var(--line); cursor: default; }
.chip.t0 { border-left: 5px solid var(--t0); } .chip.t1 { border-left: 5px solid var(--t1); }
.chip.me { background: #ffffff10; }
.chip.holds { background: #ff8a3d1f; }
.chip.can { border-color: var(--good); box-shadow: 0 0 0 2px #7be08f66; cursor: pointer; }
.chip.picked { background: #7be08f33; }
.chip .c-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .c-name small { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
.chip .c-sub { grid-row: 2; font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.chip .c-squid { display: inline-block; width: 15px; height: 17px; flex: none; }
.chip .c-card { grid-row: 1 / span 2; grid-column: 2; font-size: 15px; min-width: 2.2em; }
.g-squid { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13.5px; color: var(--squid3); font-weight: 700; min-height: 30px; }
.g-squid .squid { width: 26px; height: 30px; flex: none; }
.g-squid.loose .squid { animation: wobble 1.2s ease-in-out infinite; }
.g-squid .sq-cards { display: inline-flex; gap: 3px; font-size: 12px; }
@keyframes wobble { 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }

/* your suit: all thirteen, two rows */
.g-mine { display: grid; gap: 8px; }
.g-hand { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.hcard { position: relative; padding: 0; border: 0; background: none; font-size: 21px; display: grid; justify-items: center; transition: transform .12s; }
.hcard .card { width: 100%; max-width: 2.3em; height: 2.75em; }
.hcard .card.gone { opacity: .22; box-shadow: none; }
.hcard .card.lost { opacity: .35; background: var(--deep3); color: var(--squid3); }
.hcard .card.can { box-shadow: 0 0 0 2px var(--t1), 0 .1em .25em #0006; }
.g:not(.mine) .hcard .card.can { box-shadow: 0 .1em .25em #0006; }
.hcard .card.picked { transform: translateY(-6px); box-shadow: 0 0 0 3px var(--good), 0 6px 14px #0009; }
.hcard .card.down { background: var(--squid3); box-shadow: 0 0 0 3px var(--squid); }
.hcard em { position: absolute; bottom: -3px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 8.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  background: var(--squid); color: var(--boned); padding: 0 3px; border-radius: 4px; white-space: nowrap; }
.hcard:disabled { opacity: 1; cursor: default; }
.g-btns { display: grid; grid-template-columns: 1fr 1.7fr; gap: 8px; }
.g-btns button { min-height: 48px; padding: 6px 8px; font-size: 15px; line-height: 1.15; }
.g-btns button[hidden] { display: none; }
.g-btns:has(button[hidden]) { grid-template-columns: 1fr; }

/* 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 Play 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: 58px; 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, your suit 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.2fr 1fr; grid-template-rows: auto auto auto minmax(0, 1fr); column-gap: 14px; padding: 8px 14px 10px; }
  .g-head { grid-column: 1 / -1; }
  #g-score { grid-column: 2; grid-row: 2; }
  #cs-pres-slot { grid-column: 1 / -1; grid-row: 3; }
  .g-coach { grid-column: 1; grid-row: 2; min-height: 46px; }
  .g-table { grid-column: 1; grid-row: 4; }
  .g-mine { grid-column: 2; grid-row: 4; align-content: end; }
  body.phone #cs-pill { left: 62px; top: 8px; }
  .g-head .g-title { max-width: 200px; }
  .hcard { font-size: 20px; }
  .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; }
}
@media (max-height: 700px) and (max-width: 719px) { .chip { font-size: 13px; } .hcard { font-size: 18px; } .g-coach { min-height: 44px; font-size: 13.5px; } }

/* ---- 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, 10, 16, .84); }
.cm-ring { fill: none; stroke: var(--squid); stroke-width: 2; }
.cm-ln { stroke: var(--bone); stroke-width: 2; stroke-linecap: round; }
.cm-dot { fill: var(--squid); stroke: var(--boned); 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(--deep2); border: 1.5px solid var(--squid); 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(--squid); color: var(--boned); font: 700 13px/1 var(--body); }
.cm-call .cm-t { font: 800 15.5px/22px var(--display); color: var(--squid3); }
.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: #06121bf7; 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(--squid); background: var(--deep2); 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(--squid); }
.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; }

/* ---- the debrief's round-by-round table (sized in em: the kit's end screen shrinks it to fit) ---- */
.end-rounds { border-collapse: collapse; font-size: .78em; margin: .3em 0; }
.end-rounds th, .end-rounds td { padding: .12em .32em; text-align: center; white-space: nowrap; }
.end-rounds tr > th:first-child { text-align: left; font-weight: 700; max-width: 7em; overflow: hidden; text-overflow: ellipsis; }
.end-rounds td { border-left: 1px solid #ffffff14; }
.end-rounds tr.t0 th { color: var(--t0); } .end-rounds tr.t1 th { color: var(--t1); } .end-rounds tr.sq th { color: var(--squid); }
.end-rounds td.took { background: var(--squid); color: var(--boned); font-weight: 800; border-radius: .25em; }
.end-rounds td i { font-style: normal; font-size: .75em; opacity: .7; }
.end-rounds tr.ft td, .end-rounds tr.ft th { color: var(--dim); border-top: 1px solid #ffffff22; }

/* ---- splash + help ---- */
.wrap { max-width: 860px; margin: 0 auto; padding: 28px 18px 60px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 24px; align-items: center; }
.hero .hero-squid { width: clamp(90px, 18vw, 150px); height: clamp(100px, 20vw, 168px); grid-row: span 3; animation: wobble 3s ease-in-out infinite; }
.hero h1 { font-size: clamp(36px, 7vw, 60px); }
.tag { font-size: 1.2em; color: var(--dim); margin: 6px 0 4px; }
.byline { color: var(--squid3); font-weight: 700; }
.cta { display: inline-block; margin: 14px 10px 6px 0; padding: 12px 20px; border-radius: 14px; background: var(--squid); color: var(--boned); font-weight: 800; text-decoration: none; }
.cta.alt { background: var(--deep3); 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(--deep2); border-radius: 14px; padding: 12px 14px; } .how h3 { color: var(--squid); margin-bottom: 4px; }
.rooms { margin-top: 30px; } .rooms .room { display: flex; justify-content: space-between; align-items: center; background: var(--deep2); border-radius: 12px; padding: 10px 14px; margin: 6px 0; }
.rooms .code { font-family: var(--display); color: var(--squid); letter-spacing: 3px; font-size: 22px; }
#rejoin { display: none; background: var(--deep2); border-left: 4px solid var(--squid); 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; }
.helppage dt { font-weight: 800; color: var(--squid3); margin-top: 10px; } .helppage dd { margin: 2px 0 0 0; }
.credit { margin-top: 26px; padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--line); color: var(--dim); }
.credit b { color: var(--ink); }
