/* The Island of Doctor Necreaux: the shared look for splash, phone and TV. The board's brushed steel, its
   warning reds and yellows, the XP pool's teal. No web fonts, no remote anything: the party rig is offline. */
:root {
  --night: #101318; --night2: #1b2029; --night3: #262d39; --line: #3d4757;
  --ink: #eef1f5; --dim: #9aa6b8; --paper: #f4ecd6; --inkd: #1d1408;
  --amber: #f5c842; --amber2: #d99a12; --storm: #9b6bff; --storm2: #6a3fd6;
  --red: #e0402a; --teal: #39c6c0; --good: #4fd27d; --bad: #ff5a4a;
  --cs-end-bg: radial-gradient(120% 90% at 50% -10%, #2a303c 0%, #101318 62%); --cs-end-fg: #eef1f5; --cs-end-dim: #9aa6b8;
  --cs-end-accent: #f5c842; --cs-end-win: #f5c842; --cs-end-loss: #e0402a;
  --display: "Impact", "Haettenschweiler", "Arial Narrow Bold", "Franklin Gothic Bold", 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) linear-gradient(160deg, #1c222c 0%, #101318 55%, #0b0d11 100%) fixed;
  -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; letter-spacing: .02em; }
h1 { color: var(--amber); font-size: 34px; line-height: 1.05; text-transform: uppercase; }
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: 10px;
  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; }
.levers select { max-width: 60%; }

/* ---- shared pieces: cards, agent mats, dice ---- */
img.card { display: block; border-radius: 4.5% / 3.3%; box-shadow: 0 2px 8px #000a; background: #000; }
.bolt { width: .9em; height: .9em; fill: #6fd3ff; vertical-align: -.1em; }
.chg { position: absolute; right: 3px; top: 3px; background: #0b1320e6; color: #fff; border: 1px solid #6fd3ff; border-radius: 999px; padding: 0 .4em 0 .25em; font-weight: 800; font-size: .8em; line-height: 1.35; }
.tok { position: absolute; left: 3px; top: 3px; background: var(--amber); color: var(--inkd); border-radius: 50%; width: 1.3em; height: 1.3em; display: grid; place-items: center; font-size: .8em; font-weight: 900; }
.agent { background: #0007; border: 1.5px solid var(--line); border-radius: 12px; padding: 6px 8px 8px; min-width: 0; }
.agent.captain { border-color: var(--amber); }
.agent.dead { opacity: .45; filter: grayscale(.8); }
.agent.off:not(.dead) { border-style: dashed; }
.agent header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; margin-bottom: 4px; }
.agent .an { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12em; }
.hp { color: #ff8f8f; font-weight: 800; }
.trs { display: inline-flex; gap: 4px; }
.tr { font-size: .85em; font-weight: 800; padding: 0 .35em; border-radius: 6px; background: var(--night3); }
.tr-Combat { color: #ff9a7a; } .tr-Heroic { color: var(--amber); } .tr-Psychic { color: #d2a6ff; } .tr-Tech { color: var(--teal); }
.badge { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: 1px 6px; border-radius: 99px; background: var(--night3); color: var(--dim); }
.badge.cap { background: var(--amber); color: var(--inkd); } .badge.dead { background: var(--red); color: #fff; } .badge.lost, .badge.phase { background: var(--storm2); color: #fff; }
.mat { display: flex; gap: 5px; flex-wrap: wrap; }
.sk, .it { position: relative; width: 74px; cursor: pointer; }
.sk img, .it img { width: 100%; display: block; border-radius: 6px; box-shadow: 0 1px 4px #000a; }
.sk.down img { filter: brightness(.55); }
.sk.neutral img { filter: grayscale(1) brightness(.7); }
.sk-name, .it-name { display: block; font-size: 10.5px; line-height: 1.15; margin-top: 2px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-name i, .it-name i { color: var(--bad); font-style: normal; }
.it { width: 56px; } .it.down img { filter: brightness(.5); }
.sk.hl img, .it.hl img { outline: 3px solid var(--good); outline-offset: 1px; }
.atts { position: absolute; left: 2px; right: 2px; bottom: 16px; display: grid; gap: 2px; }
.att { background: var(--red); color: #fff; font-size: 9.5px; font-weight: 800; border-radius: 4px; padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.die { display: inline-grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); width: 1.7em; height: 1.7em; padding: .18em; margin: 0 .1em; background: #f7f7f2; border-radius: .3em; box-shadow: inset 0 -2px 0 #0003, 0 1px 3px #000a; vertical-align: middle; }
.die i { display: block; width: 72%; height: 72%; margin: auto; border-radius: 50%; }
.die i.on { background: #1a1a1a; }
.die.ghost { opacity: .45; }
.roll { background: var(--night2); border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 10px; display: grid; gap: 5px; }
.roll.live { border-color: var(--amber); }
.roll .rh { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; } .roll .need { color: var(--amber); font-weight: 800; white-space: nowrap; }
.re { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 2.2em 3.2em; align-items: center; gap: 6px; font-size: 15px; }
.re .rn { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.re .rm { color: var(--amber); font-weight: 800; } .re .rv { font: 400 1.4em var(--display); text-align: right; }
.re .rk { font-weight: 900; font-size: .8em; text-align: center; border-radius: 6px; padding: 1px 0; }
.re.ok .rk { background: var(--good); color: #062; } .re.no .rk { background: var(--bad); color: #fff; } .re.push .rk { color: var(--dim); }
.re.out { opacity: .4; }
.re .rnotes { grid-column: 1 / -1; font-size: 11.5px; color: var(--dim); margin-top: -3px; }
.re .fixed { font: 400 1.3em var(--display); color: #d2a6ff; }
.pill { display: inline-block; padding: 3px 8px; border-radius: 99px; background: var(--night3); font-size: 13px; font-weight: 800; white-space: nowrap; }
.pill.cd { background: var(--red); color: #fff; } .pill.xp { background: #2b6c3a; }

/* ---- the phone: a fixed skeleton; only the middle scrolls ---- */
.g { position: fixed; inset: 0; display: grid; grid-template-rows: auto auto auto auto minmax(0, 1fr) auto; gap: 6px;
  padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom)); max-width: 620px; margin: 0 auto; overflow: hidden; }
.g-head { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.g-pills { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.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 #f5c84255; } }
#cs-pres-slot { display: flex; justify-content: center; min-height: 0; }
.g-coach { background: var(--night2); border-left: 4px solid var(--amber); border-radius: 6px 12px 12px 6px; padding: 7px 10px; font-size: 14.5px; line-height: 1.3; min-height: 44px; display: flex; align-items: center; }
.g:not(.mine) .g-coach { border-left-color: var(--line); color: var(--dim); }
.g-tabs { display: flex; gap: 6px; } .g-tabs button { flex: 1; padding: 6px; font-size: 14px; } .g-tabs button.on { background: var(--night2); border-color: var(--amber); color: var(--amber); }
.g-tabs button.dot::after { content: ' ●'; color: var(--bad); }
.g-main { overflow-y: auto; min-height: 0; display: grid; gap: 8px; align-content: start; padding-bottom: 6px; overscroll-behavior: contain; }
.g-foot { display: flex; gap: 8px; align-items: center; }
.g-foot .undo { flex: none; max-width: 55%; font-size: 13px; padding: 8px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-feed { color: var(--dim); font-size: 12.5px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ask { background: var(--night2); border-radius: 12px; padding: 8px 10px; border: 1.5px solid var(--line); }
.ask.mine { border-color: var(--amber); box-shadow: 0 0 0 2px #f5c84233; }
.ask-row { display: flex; gap: 10px; align-items: flex-start; }
.ask img.thumb { width: 74px; flex: none; cursor: pointer; }
.ask-t { font: 400 19px/1.1 var(--display); color: var(--amber); letter-spacing: .02em; }
.ask-x { font-size: 14px; color: var(--ink); margin-top: 2px; }
.ask-w, .mon-s { font-size: 13px; color: var(--dim); margin-top: 4px; } .mon-s b { color: var(--bad); }
.opts { display: grid; gap: 8px; }
.og { display: grid; gap: 6px; }
.ogh { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
.opt { display: flex; align-items: center; gap: 8px; text-align: left; padding: 9px 11px; min-height: 44px; font-size: 15px; line-height: 1.2; }
.opt .othumb { width: 34px; border-radius: 3px; flex: none; }
.opt.go { background: #1f3a28; border-color: var(--good); }
.opt.bad { background: #3d1c1a; border-color: var(--bad); }
.opt.pass { background: var(--night2); color: var(--dim); }
.opt.power { background: #2a2044; border-color: var(--storm); }
.opt.sent { opacity: .5; }
.speeds { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.spd { padding: 10px 0; font: 400 20px var(--display); background: #1f3a28; border-color: var(--good); }
.hand { display: grid; gap: 6px; } .hand-cards { display: flex; gap: 6px; flex-wrap: wrap; } img.card.hc { width: 86px; cursor: pointer; }
.lootrow { display: grid; gap: 6px; } .depth { position: relative; } .depth i { position: absolute; left: 3px; bottom: 3px; background: #000c; padding: 0 4px; border-radius: 4px; font-style: normal; font-size: 12px; }
.feedlist { font-size: 13px; color: var(--dim); display: grid; gap: 3px; }
.zoom { position: fixed; inset: 0; z-index: 2400; background: #000d; display: grid; place-items: center; padding: 12px; }
.zoom[hidden] { display: none; }
.zc { max-width: 420px; width: 100%; max-height: 100%; overflow: auto; display: grid; gap: 10px; justify-items: center; }
.zc img { width: min(100%, 360px); border-radius: 12px; } .zc .zt { background: var(--night2); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; }
.zc .zt p { margin: 6px 0 0; } .zc button { width: 100%; }

/* The kit's pill sits beside "?" (its own corner is busy) */
body.phone #cs-pill { top: max(8px, env(safe-area-inset-top)); bottom: auto; left: 56px; right: auto; height: 40px; width: 90px; padding: 0 6px;
  font-size: 13px; white-space: nowrap; text-align: center; }
.g-pillgap { flex: none; width: 90px; }

/* A rig panel or a phone on its side: two columns, the decision on the left, your agent on the right. */
@media (min-width: 720px) and (max-height: 640px) {
  .g { max-width: none; padding: 8px 14px 8px; }
  .g-main { grid-template-columns: 1.1fr 1fr; column-gap: 14px; }
  .g-main > .agent.me { grid-column: 2; grid-row: 1 / span 4; }
  .speeds { grid-template-columns: repeat(8, 1fr); }
  body.phone #cs-pill { left: 60px; top: 8px; }
  .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(--amber); 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; }
.hero .cover { float: right; width: 190px; margin: 0 0 12px 18px; border-radius: 10px; box-shadow: 0 6px 20px #000a; }
@media (max-width: 560px) { .hero .cover { width: 120px; } }
