/* Shared styles: the player page, the admin page and the sign. Dark by
   design: the party is at night, and a dark screen is kinder in a dim room. */

:root {
  color-scheme: dark;
  --page: #0d1714;
  --card: #172320;          /* chart surface; the palette was validated against it */
  --raised: #1f2e2a;
  --line: #2b3b36;          /* hairlines and gridlines */
  --axis: #47574f;
  --ink: #eef3f1;
  --ink-2: #a3b3ad;
  --accent: #f06465;        /* "you": your bar, your dot, your marker */
  --bar: #4f655d;           /* the crowd: de-emphasis */
  --button: #c92f33;
  --button-ink: #ffffff;
  --good: #0aac23;
  --good-ink: #53c556;
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

.stripe {
  height: 6px;
  background: repeating-linear-gradient(135deg, var(--accent) 0 10px, #fff 10px 20px);
}

.shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 14px calc(28px + env(safe-area-inset-bottom));
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 2px 10px;
}
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand .mint { font-size: 22px; }
.who { color: var(--ink-2); font-size: 14px; text-align: right; }
.conn { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--good); margin-left: 6px; vertical-align: middle; }
.conn.connecting, .conn.offline { background: #fbb315; }

h1 { font-size: 26px; line-height: 1.15; margin: 4px 0 8px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--ink);
  font: 600 16px/1 var(--font);
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn.primary { background: var(--button); border-color: var(--button); color: var(--button-ink); }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; font-size: 14px; padding: 0 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.armed { background: #fbb315; border-color: #fbb315; color: #0b0b0b; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 auto; }

label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--raised);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: 17px/1.3 var(--font);
  padding: 12px 14px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.error { color: #ff9a9b; min-height: 1.2em; font-size: 14px; }

/* ---- join ---------------------------------------------------------------- */

.jar { font-size: 64px; text-align: center; line-height: 1; margin: 8px 0 6px; }
.rules { padding-left: 18px; margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.rules li { margin-bottom: 4px; }

/* ---- phase bar ----------------------------------------------------------- */

.phase {
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--raised);
  border: 1px solid var(--line);
}
.phase.lastcall { background: var(--button); border-color: var(--button); color: #fff; }
.phase .count { font-size: 20px; font-variant-numeric: tabular-nums; }

/* ---- guess card ---------------------------------------------------------- */

.guess-label { color: var(--ink-2); font-size: 14px; }
.guess-big { font-size: 56px; font-weight: 700; line-height: 1.05; margin: 2px 0; }
.guess-form { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; margin: 12px 0 10px; }
.guess-form input { margin: 0; text-align: center; font-size: 24px; font-weight: 600; }
.step { font-size: 26px; padding: 0; }
.msg { min-height: 1.4em; font-size: 15px; margin-top: 10px; }
.msg.bad { color: #ff9a9b; }
.msg.good { color: var(--good-ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  appearance: none;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  font: 600 15px var(--font);
}
.fineprint { font-size: 13px; color: var(--ink-2); margin: 8px 0 0; }

/* ---- dashboard ----------------------------------------------------------- */

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.kpi .label { font-size: 12px; color: var(--ink-2); }
.kpi .value { font-size: 24px; font-weight: 650; line-height: 1.2; }
.kpi .delta { font-size: 12px; color: var(--ink-2); }

.headline { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.chart { width: 100%; display: block; touch-action: pan-y; }
.chart text { fill: var(--ink-2); font: 12px var(--font); font-variant-numeric: tabular-nums; }
.chart .ink { fill: var(--ink); font-weight: 600; }
.readout { font-size: 14px; color: var(--ink-2); min-height: 1.4em; margin-top: 4px; }
.readout strong { color: var(--ink); }

details.table { margin-top: 8px; font-size: 14px; }
details.table summary { color: var(--ink-2); cursor: pointer; padding: 4px 0; }
details.table table { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
details.table td, details.table th { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
details.table th { color: var(--ink-2); font-weight: 500; }
details.table td.num, details.table th.num { text-align: right; }


.feed { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--ink-2); white-space: nowrap; }

.locked-dash { text-align: center; padding: 26px 16px; }
.locked-dash .big { font-size: 40px; }

/* ---- hints --------------------------------------------------------------- */

.hint { padding: 10px 0; border-bottom: 1px solid var(--line); }
.hint:last-child { border-bottom: 0; }
.hint .when { font-size: 12px; color: var(--ink-2); }
.hint.latest { font-size: 18px; font-weight: 600; }

.toast {
  position: fixed;
  left: 50%;
  top: calc(10px + env(safe-area-inset-top));
  transform: translate(-50%, -140%);
  width: min(460px, calc(100% - 20px));
  background: #fff;
  color: #0b0b0b;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 10;
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast.show { transform: translate(-50%, 0); }
.toast .kicker { font-size: 12px; font-weight: 700; color: var(--button); text-transform: uppercase; letter-spacing: 0.06em; }
.toast .text { font-size: 18px; font-weight: 600; margin-top: 2px; }

/* ---- reveal -------------------------------------------------------------- */

.status-big { text-align: center; padding: 18px 8px 8px; }
.status-big .word { font-size: 40px; font-weight: 800; line-height: 1.1; }
.status-big .word.in { color: var(--good-ink); }
.status-big .word.out { color: var(--ink-2); }
.status-big .sub { color: var(--ink-2); margin-top: 6px; }
.answer-big { font-size: 72px; font-weight: 800; text-align: center; line-height: 1; margin: 8px 0; }
.finalists { list-style: none; padding: 0; margin: 0; }
.finalists li { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 17px; }
.finalists li.me { font-weight: 700; }
.finalists .g { font-variant-numeric: tabular-nums; font-weight: 600; }
.award { display: grid; grid-template-columns: 34px 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.award:last-child { border-bottom: 0; }
.award .icon { font-size: 22px; }
.award .what { font-size: 13px; color: var(--ink-2); }

.snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.snow span { position: absolute; top: -40px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .snow { display: none; } .toast { transition: none; } }

/* ---- admin --------------------------------------------------------------- */

.tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: var(--page);
  padding: 8px 0;
  margin-bottom: 8px;
}
.tabs button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  border-radius: 10px;
  min-height: 42px;
  font: 600 13px var(--font);
}
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .main { min-width: 0; }
.list-row .main div { overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; background: var(--raised); border: 1px solid var(--line); }
.pill.on { background: var(--good); border-color: var(--good); color: #fff; }
.pill.warn { background: #fbb315; border-color: #fbb315; color: #0b0b0b; }
.say { background: var(--raised); border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-size: 15px; }
.spoiler { filter: blur(8px); transition: filter 0.2s; }
.spoiler.shown { filter: none; }
.admin-toast { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 10; max-width: calc(100% - 24px); }
.admin-toast.bad { background: #ff9a9b; color: #0b0b0b; }
.hidden { display: none !important; }

/* ---- duels --------------------------------------------------------------- */

.ptabs { grid-template-columns: 1fr 1fr; }
.ptabs button { font-size: 15px; min-height: 44px; }
.badge { display: inline-block; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; line-height: 20px; margin-left: 4px; }
.nudge { margin-bottom: 12px; font-size: 15px; line-height: 1.3; padding: 12px 16px; }
.peeks { margin: 0; padding-left: 18px; }
.peeks li { margin: 4px 0; font-weight: 600; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.tile { appearance: none; text-align: left; border: 1px solid var(--line); background: var(--raised); color: var(--ink); border-radius: 12px; padding: 10px; display: grid; align-content: start; gap: 2px; font: inherit; cursor: pointer; }
.tile[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tile .emo { font-size: 22px; line-height: 1.2; }
.tile .nm { font-weight: 700; font-size: 15px; }
.tile .bl { font-size: 12px; color: var(--ink-2); line-height: 1.3; }
.code-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.code-form input { margin: 0; text-transform: uppercase; letter-spacing: 0.2em; font-weight: 700; }
.invite .who-line { font-size: 16px; margin-bottom: 4px; }
.qr-card { text-align: center; }
.qr-card .qr { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 12px; display: block; margin: 6px auto 10px; }
.qr-card .code { font-size: 30px; font-weight: 800; letter-spacing: 0.25em; margin-bottom: 8px; }

.duel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.turn { min-height: 1.4em; font-size: 15px; color: var(--ink-2); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.turn:empty { display: none; }
.turn .mine { color: var(--good-ink); font-weight: 700; }

/* Peppermint Nim */
.pile { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; font-size: 28px; line-height: 1; min-height: 40px; margin: 6px 0; }
.nim-count { text-align: center; font-size: 18px; }
.nim-count strong { font-size: 34px; }
.nim-take { margin: 8px 0 4px; }
.nim-take .btn { flex: 1 1 0; }

/* Connect Four: you are red, they are snow white, so the two differ in
   lightness as well as hue. */
.c4-key { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.c4-key .disc { width: 16px; }
.c4 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; background: var(--raised); padding: 6px; border-radius: 12px; }
.c4col { appearance: none; border: 0; background: transparent; padding: 2px; display: grid; gap: 4px; cursor: pointer; border-radius: 8px; }
.c4col:not(:disabled):active { background: rgba(255, 255, 255, 0.1); }
.c4col:disabled { cursor: default; }
.disc { display: inline-block; aspect-ratio: 1; width: 100%; border-radius: 50%; background: var(--page); }
.disc.me { background: var(--accent); }
.disc.them { background: #eef3f1; }
.disc.last { box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.3); }
.disc.win { box-shadow: 0 0 0 3px var(--good-ink); }

/* Quick Draw: waiting is near-black red, go is bright green, and the words
   change too, so colour is never the only signal. */
.qd-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; text-align: center; margin-bottom: 10px; }
.qd-score b { font-size: 26px; display: block; }
.qd-pad { appearance: none; width: 100%; min-height: 50vh; border: 0; border-radius: 18px; display: grid; place-content: center; gap: 8px; color: #fff; font: inherit; touch-action: manipulation; user-select: none; -webkit-user-select: none; cursor: pointer; }
.qd-pad .big { font-size: 34px; font-weight: 800; }
.qd-pad .sub { font-size: 15px; opacity: 0.9; }
.qd-pad.armed { background: #3a1214; }
.qd-pad.go { background: #19c23a; color: #04120a; }
.qd-pad.result { background: var(--raised); }

/* Chess */
.clock-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px; font-size: 15px; }
.clk { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 20px; padding: 2px 10px; border-radius: 8px; background: var(--raised); color: var(--ink-2); }
.clk.on { background: var(--ink); color: var(--page); }
.clk.low.on { background: var(--accent); color: #fff; }
.chess { display: grid; grid-template-columns: repeat(8, 1fr); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.sq { appearance: none; border: 0; padding: 0; aspect-ratio: 1; display: grid; place-items: center; position: relative; font: inherit; cursor: pointer; }
.sq.light { background: #c8d3cb; }
.sq.dark { background: #6e8a7c; }
.sq.last { box-shadow: inset 0 0 0 100px rgba(251, 179, 21, 0.35); }
.sq.check { background: #e25555; }
.sq.sel { box-shadow: inset 0 0 0 3px var(--accent); }
.sq.dot::after { content: ''; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(13, 23, 20, 0.45); }
.sq.cap::after { content: ''; position: absolute; inset: 4%; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(13, 23, 20, 0.55); }
.pc { font-size: min(9vw, 40px); line-height: 1; position: relative; z-index: 1; }
.pw { color: #fff; text-shadow: 0 0 1px #000, 0 0 1px #000, 0 1px 1px #000; }
.pb { color: #111; text-shadow: 0 0 1px rgba(255, 255, 255, 0.5); }
.promo { margin-top: 8px; }
