/* Trivia Night — built to be read in a moving car, at night, by a six-year-old
   and a forty-year-old on the same screen. Dark by default so it doesn't
   blowtorch anyone in the back seat. */

:root {
  --bg: #14161f;
  --surface: #1e212e;
  --surface-2: #272b3b;
  --line: #343950;
  --ink: #f2f0e9;
  --muted: #8a90a6;

  --c0: #f0a020; /* amber   ● */
  --c1: #2ab0a6; /* teal    ■ */
  --c2: #c05cc8; /* plum    ▲ */
  --c3: #9bcb3b; /* lime    ◆ */
  --c4: #4a90e2; /* sky     ✚ */
  --c5: #e8604c; /* coral   ★ */

  --good: #6fd08c;
  --bad: #e8604c;

  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Nunito",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  overscroll-behavior: none;
}

body {
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  max-width: 1100px;
  margin: 0 auto;
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.02em; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shared bits ---------- */

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

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

button {
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
button:active { transform: scale(0.97); }
button:focus-visible { outline: 3px solid var(--c4); outline-offset: 2px; }
button.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
button.ghost { background: transparent; }
button.wide { width: 100%; }
button.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
button:disabled { opacity: 0.4; cursor: default; }

input, select {
  font: inherit;
  width: 100%;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
}
input:focus, select:focus { outline: 2px solid var(--c4); outline-offset: 1px; }
label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.hide { display: none !important; }

/* ---------- room code ---------- */

.code {
  font-size: clamp(56px, 18vw, 132px);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  margin: 6px 0 2px;
}

.joinurl { color: var(--muted); font-size: 15px; word-break: break-all; }

/* ---------- mile-marker timer ----------
   Discrete dashes that go dark one at a time, like the center line of a road
   passing under the car. Reads at a glance from the back seat. */

.timer {
  display: flex;
  gap: 5px;
  height: 12px;
  margin: 14px 0 20px;
}
.timer i {
  flex: 1;
  border-radius: 3px;
  background: var(--c0);
  transition: background 0.2s linear, opacity 0.2s linear;
}
.timer i.spent { background: var(--line); opacity: 0.5; }
.timer.urgent i:not(.spent) { background: var(--c5); }

/* ---------- question ---------- */

.qtext {
  font-size: clamp(24px, 4.6vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 8px 0 4px;
  text-wrap: balance;
}

.qmeta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }

.pill {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill.hot { background: var(--c5); border-color: var(--c5); color: #1a0f0d; }

/* ---------- answer tiles ---------- */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 430px) { .tiles { grid-template-columns: 1fr; } }

.tile {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  min-height: 74px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: var(--surface);
  font-size: 19px;
  font-weight: 700;
}
.tile .glyph {
  flex: 0 0 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 20px;
  color: #12131a;
}
.tile[data-c="0"] { border-color: var(--c0); } .tile[data-c="0"] .glyph { background: var(--c0); }
.tile[data-c="1"] { border-color: var(--c1); } .tile[data-c="1"] .glyph { background: var(--c1); }
.tile[data-c="2"] { border-color: var(--c2); } .tile[data-c="2"] .glyph { background: var(--c2); }
.tile[data-c="3"] { border-color: var(--c3); } .tile[data-c="3"] .glyph { background: var(--c3); }
.tile[data-c="4"] { border-color: var(--c4); } .tile[data-c="4"] .glyph { background: var(--c4); }
.tile[data-c="5"] { border-color: var(--c5); } .tile[data-c="5"] .glyph { background: var(--c5); }

.tile.picked { box-shadow: inset 0 0 0 3px var(--ink); }
.tile.dim { opacity: 0.28; }
.tile.right { background: var(--good); color: #0d1a11; }
.tile.right .glyph { background: #0d1a11; color: var(--good); }
.tile.wrong { background: var(--bad); color: #1a0d0b; }

@media (prefers-reduced-motion: no-preference) {
  .tile.right { animation: pop 0.4s ease; }
  @keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.035); } 100% { transform: scale(1); } }
}

/* ---------- scoreboard ---------- */

.board { display: flex; flex-direction: column; gap: 8px; }
.rank {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.rank .pos { width: 28px; color: var(--muted); font-weight: 800; }
.rank .who { flex: 1; font-weight: 700; }
.rank .who small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.rank .pts { font-weight: 800; font-size: 20px; }
.rank.off { opacity: 0.45; }
.rank.lead { border-color: var(--c0); }

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.in { background: var(--good); }

.team-amber { color: var(--c0); } .team-teal { color: var(--c1); }
.team-plum { color: var(--c2); } .team-lime { color: var(--c3); }

/* ---------- settings ---------- */

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip small { opacity: 0.6; font-weight: 600; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle span { font-weight: 700; font-size: 15px; }
.toggle small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }

.bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.bar > button { flex: 1 1 auto; }

.banner {
  background: var(--c5);
  color: #1a0d0b;
  font-weight: 800;
  text-align: center;
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.notice { color: var(--muted); font-size: 14px; margin-top: 8px; }
.big { font-size: clamp(30px, 8vw, 56px); font-weight: 800; letter-spacing: -0.02em; }
.center { text-align: center; }
