:root {
  --bg: #14161c; --panel: #1e2129; --panel2: #272b35; --line: #343947;
  --text: #e9ebf0; --muted: #9aa1b2; --accent: #f0a43a; --bad: #e5534b; --good: #3fb950;
  --R: #e0443e; --Y: #e8c02a; --G: #3fa34d; --B: #3b7ddd; --W: #e8e8e8;
  --M: conic-gradient(from 0deg, #e0443e, #e8c02a, #3fa34d, #3b7ddd, #a04bd8, #e0443e);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 760px; margin: 0 auto; padding: 12px 12px 120px; }
h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 15px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; }
a { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; cursor: pointer; }
button:hover { border-color: #4a5163; }
button.primary { background: var(--accent); color: #1b1300; border-color: var(--accent);
  font-weight: 600; }
button.danger { color: var(--bad); }
button.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
button:disabled { opacity: .4; cursor: default; }
button.sel { outline: 3px solid var(--accent); outline-offset: 1px; }
select, input { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; width: 100%; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin: 10px 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack > * + * { margin-top: 10px; }
.top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.code { font: 700 22px/1 ui-monospace, Menlo, monospace; letter-spacing: .12em; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--panel2);
  border: 1px solid var(--line); font-size: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good);
  margin-left: 4px; vertical-align: middle; }
.alert { border-left: 4px solid var(--accent); background: #2a2418; padding: 10px 12px;
  border-radius: 8px; margin: 8px 0; }
.alert.bad { border-color: var(--bad); background: #2c1a1a; }
.alert.good { border-color: var(--good); background: #16261a; }

/* board */
.board { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.stat { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; }
.stat b { font-size: 17px; }
.tokens span { display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  background: #4aa3ff; margin-right: 2px; }
.tokens span.off { background: var(--panel2); border: 1px solid var(--line); }
.strikes span { color: var(--bad); font-weight: 700; }

/* cards */
.card { position: relative; width: 46px; height: 64px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; font: 700 22px/1 system-ui, sans-serif;
  border: 2px solid rgba(0,0,0,.35); color: #111; flex: none; padding: 0; }
.card.R { background: var(--R); } .card.Y { background: var(--Y); } .card.G { background: var(--G); }
.card.B { background: var(--B); color: #fff; } .card.W { background: var(--W); }
.card.M { background: var(--M); color: #fff; text-shadow: 0 0 3px #000; }
.card.unknown { background: var(--panel2); color: var(--accent); border: 2px dashed var(--accent); }
.card.hidden { background: repeating-linear-gradient(45deg, #2d3240, #2d3240 6px, #262a35 6px, #262a35 12px);
  color: var(--muted); border-color: var(--line); font-size: 13px; }
.card.empty { background: transparent; border: 2px dashed var(--line); color: var(--muted); font-size: 14px; }
.card.touched { box-shadow: 0 0 0 3px var(--accent); }
.card.pick { box-shadow: 0 0 0 4px #fff; }
.card .slotno { position: absolute; top: -9px; left: -6px; font-size: 10px; background: var(--bg);
  color: var(--muted); border-radius: 6px; padding: 0 4px; border: 1px solid var(--line); }
.cardcol { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; width: 50px; }
.clues { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; min-height: 14px; }
.clue { font-size: 10px; line-height: 13px; padding: 0 4px; border-radius: 4px; background: var(--panel2);
  border: 1px solid var(--line); color: var(--text); }
.clue.cR { background: var(--R); color: #111; } .clue.cY { background: var(--Y); color: #111; }
.clue.cG { background: var(--G); color: #111; } .clue.cB { background: var(--B); color: #fff; }
.clue.cW { background: var(--W); color: #111; } .clue.cM { background: var(--M); color: #fff; }
.hand { display: flex; gap: 6px; padding-top: 8px; overflow-x: auto; }
.player { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); margin: 8px 0;
  background: var(--panel); }
.player.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.player .name { font-weight: 600; }
.discards { display: flex; flex-wrap: wrap; gap: 4px; }
.discards .card { width: 30px; height: 42px; font-size: 15px; border-radius: 6px; }

/* log */
.log { list-style: none; padding: 0; margin: 0; }
.log li { padding: 8px 2px; border-bottom: 1px solid var(--line); display: flex; gap: 8px;
  align-items: baseline; }
.log .t { color: var(--muted); font-size: 12px; min-width: 26px; }
.log .ok { color: var(--good); } .log .bad { color: var(--bad); }
.mini { display: inline-block; padding: 0 5px; border-radius: 4px; font-weight: 700; font-size: 13px;
  color: #111; }
.mini.R { background: var(--R); } .mini.Y { background: var(--Y); } .mini.G { background: var(--G); }
.mini.B { background: var(--B); color: #fff; } .mini.W { background: var(--W); }
.mini.M { background: var(--M); color: #fff; } .mini.q { background: var(--panel2); color: var(--muted); }

/* action bar + sheet */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(20,22,28,.96);
  border-top: 1px solid var(--line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.actionbar .inner { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: center; }
.actionbar button { flex: 1; padding: 12px 0; }
#sheet-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex;
  align-items: flex-end; justify-content: center; z-index: 10; }
#sheet-wrap[hidden] { display: none; }
#sheet { background: var(--panel); width: 100%; max-width: 760px; max-height: 92vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  border: 1px solid var(--line); }
#sheet h3 { margin: 0 0 12px; font-size: 17px; }
.picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.picker .card { width: 100%; height: 54px; font-size: 20px; }
.picker .left { position: absolute; bottom: 1px; right: 4px; font-size: 10px; font-weight: 600; opacity: .8; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choices button { min-width: 48px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 16px; }
.sheet-actions button { flex: 1; padding: 12px 0; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; background: #3a1f1f;
  border: 1px solid var(--bad); color: #ffd7d4; padding: 10px 14px; border-radius: 10px; z-index: 20;
  max-width: 92vw; }
#toast.info { background: #1d2a1f; border-color: var(--good); color: #d6f5da; }
.seatlist button { width: 100%; text-align: left; margin: 4px 0; display: flex; justify-content: space-between; }
