/* Quiz master's phone. Mobile first (~390px), Flink teal, big thumb-sized buttons. */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f4faf8, #061f26);
  --ink: light-dark(#08343f, #e6f5f2);
  --soft: light-dark(#4a6b70, #9cc2c0);
  --card: light-dark(#ffffff, #0c2d35);
  --line: light-dark(#c3e0da, #1f4c56);
  --go: light-dark(#08343f, #5fd3c2);
  --goink: light-dark(#ffffff, #05252c);
  --good: light-dark(#11795f, #6fe0b8);
  --bad: light-dark(#c2362a, #ff9a86);
  --gold: #ffc145;
  --focus: #2f6fdb;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, 'Nunito', sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { line-height: 1.15; margin: 0 0 6px; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; margin-top: 18px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.small { font-size: 0.85rem; }
.soft { color: var(--soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.brand { font-weight: 800; letter-spacing: 0.02em; color: var(--soft); margin: 0 0 4px; }

.start, .game { max-width: 560px; margin: 0 auto; padding: 16px; }
.start { padding-top: 40px; }
.lead { color: var(--soft); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin: 12px 0;
}
.card label { display: block; font-weight: 700; margin-bottom: 6px; }
input:not([type='checkbox']) {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.btn {
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card);
  font-weight: 700;
  cursor: pointer;
}
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 0.9rem; }
.btn.go { background: var(--go); color: var(--goink); border-color: var(--go); }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.armed { background: var(--gold); color: #08343f; border-color: var(--gold); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: 0.6; }
.notice { color: var(--bad); font-weight: 700; }
.banner { background: var(--gold); color: #08343f; padding: 8px 12px; border-radius: 10px; font-weight: 700; }
.banner.warn { background: light-dark(#fff1bd, #4d3d00); color: var(--ink); }

/* top bar */
.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: -16px -16px 8px;
  background: var(--go);
  color: var(--goink);
}
.bar .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.8; }
.bar .code { font-size: 1.6rem; font-weight: 900; letter-spacing: 0.12em; line-height: 1; }
.bar .tv { flex: 1; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.bar .tv i { width: 10px; height: 10px; border-radius: 50%; background: #9fbcb9; }
.bar .tv.on i { background: #6fe0b8; box-shadow: 0 0 0 3px rgba(111, 224, 184, 0.35); }
.btn.cast { background: var(--goink); color: var(--go); border-color: var(--goink); }
.btn.cast.on { background: #6fe0b8; color: #05252c; border-color: #6fe0b8; }
.connect ul { padding-left: 18px; margin: 6px 0 10px; }
.connect li { margin-bottom: 6px; }

/* the turn */
.turn h1 { margin-top: 2px; }
.hint { color: var(--soft); margin: 0 0 10px; }
.msg { font-weight: 700; margin: 0 0 4px; }
.msg.good { color: var(--good); }
.msg.bad { color: var(--bad); }
.sides { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.sides .side:only-child { grid-column: 1 / -1; }
.side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  min-height: 96px;
  padding: 12px;
  border-radius: 14px;
  border: 2px solid var(--go);
  background: var(--card);
  cursor: pointer;
}
.side .answer { margin-top: auto; font-size: 0.8rem; color: var(--soft); letter-spacing: 0.06em; }
.guess .reveal { font-size: 1.1rem; margin: 0 0 10px; }
.guess .reveal strong { letter-spacing: 0.08em; }
.judge { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.btn.right { background: var(--good); border-color: var(--good); color: light-dark(#fff, #05252c); }
.btn.wrong { background: var(--bad); border-color: var(--bad); color: light-dark(#fff, #05252c); }
.typed { display: flex; gap: 8px; margin-top: 10px; }
.actions { display: flex; gap: 8px; }

/* scores */
.scores { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.scores li {
  flex: 1 1 140px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 2px solid var(--line);
  border-left: 8px solid var(--tc);
}
.scores li.turn { border-color: var(--tc); box-shadow: 0 0 0 2px var(--tc) inset; }

/* the train, as a list with the answers */
.train { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.train li { border-radius: 12px; background: var(--card); border: 2px solid var(--line); }
.train li.solved { border-color: var(--cc, var(--line)); }
.train li.front { border-color: var(--go); border-style: dashed; }
.train li.sel { border-color: var(--gold); border-style: solid; box-shadow: 0 0 0 3px var(--gold); }
.carbtn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 10px;
  background: none;
  border: 0;
  text-align: left;
}
button.carbtn { cursor: pointer; }
.carbtn .lbl { width: 62px; flex: none; font-size: 0.75rem; color: var(--soft); font-weight: 700; }
.carbtn .tiles { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; }
.carbtn .t {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 28px;
  border-radius: 5px;
  font-weight: 800;
  background: var(--cc, light-dark(#e8f4f1, #14505c));
  color: light-dark(#08343f, #e6f5f2);
}
.train li.solved .t { color: #fff; }
.carbtn .t.hid { background: transparent; border: 1px dashed var(--line); color: var(--soft); font-weight: 500; }
.carbtn .who { font-size: 0.75rem; font-weight: 700; color: var(--cc); }

/* settings */
.settings summary { font-weight: 800; cursor: pointer; min-height: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.chip.on { background: var(--go); color: var(--goink); border-color: var(--go); cursor: default; }
.chip.armed { background: var(--gold); color: #08343f; border-color: var(--gold); }
.puzzles, .teams { list-style: none; padding: 0; margin: 6px 0 10px; display: grid; gap: 6px; }
.puzzles li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.puzzles li.on strong { color: var(--good); }
.teams li { display: flex; gap: 8px; align-items: center; border-left: 6px solid var(--tc); padding-left: 8px; }
.toggle { display: flex !important; align-items: center; gap: 10px; font-weight: 600 !important; margin: 10px 0; min-height: 40px; }
.toggle input { width: 22px; height: 22px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .side, .chip { transition: transform 0.08s; }
  .btn:active, .side:active, .chip:active { transform: scale(0.97); }
}
