/*
 * Second Guess.
 *
 * Its own sheet for the same reason Dial It In has one: the board is a
 * different shape. Dial's board is a single horizontal bar; this one is a
 * column of answer rows that fill in as they are found, on a screen that might
 * be a projector, a shared window, or a phone held by the one person in the
 * room who owns a TV stick.
 *
 * Everything sizes off --unit, which the board sets from the viewport, so the
 * same markup is a phone page and a projector slide without a second layout.
 */

:root {
  --unit: 1vw;
  --bg: #0d1117;
  --panel: #161b26;
  --ink: #eef2f9;
  --dim: #8b96ad;
  --line: #262f42;
  /* Amber is the points colour, and points are what this game is about. */
  --accent: #f0b429;
  --found: #7dd3fc;
  --good: #4ade80;
  --bad: #f87171;
  --quiet: #c98f6a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0 0 0.4em; line-height: 1.1; font-weight: 800; }
p { margin: 0 0 0.6em; line-height: 1.45; }
a { color: var(--found); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  /* --unit tracks the viewport so the board scales to whatever it is projected
     on. A page that is read at arm's length wants none of that: the same answer
     list at 1vw on a phone is four-pixel type. Inside a wrap it is a fixed
     number, so the shared components below can use it either way. */
  --unit: 8px;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 0 0 14px;
}

.hint { color: var(--dim); font-size: 14px; }
.err { color: var(--bad); font-weight: 700; }
.ok { color: var(--good); font-weight: 700; }

/* The line that says who wrote the answers. Quiet, always present, never a
   thing a screen can be configured to leave off -- it is the reason this mode
   exists rather than a footer. */
.credit {
  color: var(--quiet);
  font-size: 13px;
  line-height: 1.4;
  margin: 10px 0 0;
}

label {
  display: block;
  font-size: 13px;
  color: var(--dim);
  margin: 10px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 12px 14px;
  font-size: 17px;
  color: var(--ink);
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  background: #212b3f;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}
button:hover { background: #2b3750; }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #1b1200; }
button.warn { background: var(--quiet); border-color: var(--quiet); color: #1b0d05; }
button.ghost { background: transparent; }
/* For the one-word buttons that sit inside a line of text -- removing a player
   from the roster, mostly -- where a full-size control would own the row. */
button.tiny { padding: 4px 9px; font-size: 12px; border-radius: 7px; }

/* An author rule outranks the browser's own [hidden] { display: none }, so
   .row below would keep a hidden row on screen laid out in flex. */
[hidden] { display: none !important; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }

/* ------------------------------------------------------------- the answers */

/*
 * One row per answer, always the right number of them, blank until found. The
 * count is public from the moment the question goes up -- knowing there are
 * seven answers is part of the question, not a leak -- and the text arrives
 * only at the reveal.
 */
.answers { display: grid; gap: calc(var(--unit) * 0.6); margin: 0; padding: 0; list-style: none; }

.answers li {
  display: flex;
  align-items: center;
  gap: calc(var(--unit) * 0.8);
  padding: calc(var(--unit) * 0.7) calc(var(--unit) * 1);
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: calc(var(--unit) * 2);
  min-height: calc(var(--unit) * 4);
}

.answers .n {
  flex: none;
  width: 1.6em;
  color: var(--dim);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.answers .t { flex: 1 1 auto; font-weight: 700; }
.answers .by { color: var(--found); font-size: 0.8em; font-weight: 700; }
.answers .p {
  flex: none;
  color: var(--accent);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Found rows lift off the board; the ones nobody reached stay flat and dim, so
   at the reveal the shape of what the room missed is readable at a glance. */
.answers li.found { border-color: var(--found); background: #10202c; }
.answers li.missed .t, .answers li.missed .p { opacity: 0.55; }
.answers li.blank .t { color: var(--dim); font-weight: 400; }

/* ---------------------------------------------------------- the host queue */

.queue { display: grid; gap: 8px; }

.queue .item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #0b0f18;
}
.queue .item .said { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.queue .item .who { color: var(--dim); font-size: 13px; }
.queue .item select { margin-top: 8px; }
/* The matcher's guess, offered and not applied. It is a starting point for the
   host's eye, never a decision already taken. */
.queue .item .sugg { color: var(--accent); font-size: 13px; margin-top: 6px; }
/* Inside the row on purpose: a refusal about this answer belongs beside this
   answer, not in the status line at the foot of the page. */
.queue .item .qmsg:not(:empty) { color: var(--bad); font-size: 13px; margin-top: 8px; }

/* ------------------------------------------------- what came out of the chat

   A running receipt, not a control: the host's eyes are in a chat window, and
   this is glanced at sideways to confirm a line landed and what it was worth.
   Small, dense, and quiet on purpose. */

.chatlog { display: grid; gap: 6px; margin-top: 10px; }
.chatlog .line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 14px;
  padding: 6px 10px;
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.chatlog .who { color: var(--dim); flex: 0 0 auto; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatlog .said { flex: 1 1 auto; font-weight: 700; }
.chatlog .pts { flex: 0 0 auto; color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums; }
.chatlog .pts.none { color: var(--dim); font-weight: 400; }

/* --------------------------------------------------------------- the board */

.board {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: calc(var(--unit) * 1.2);
  padding: calc(var(--unit) * 2);
}

.board .meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--dim);
  font-size: calc(var(--unit) * 1.5);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.board .question {
  font-size: calc(var(--unit) * 3.6);
  font-weight: 800;
  line-height: 1.15;
  text-wrap: balance;
  text-align: center;
  margin: 0;
}

.board .clock {
  font-size: calc(var(--unit) * 3);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.board .clock.low { color: var(--bad); }

/* Names of people who have answered. Names only: what they typed is the one
   thing this screen must not carry while anybody is still thinking. */
.names { display: flex; flex-wrap: wrap; gap: calc(var(--unit) * 0.5); justify-content: center; }
.names span {
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: calc(var(--unit) * 0.3) calc(var(--unit) * 1);
  font-size: calc(var(--unit) * 1.5);
  font-weight: 700;
}

.multiplier {
  color: var(--accent);
  font-weight: 800;
  font-size: calc(var(--unit) * 1.6);
}

.joinstrip {
  display: flex;
  align-items: center;
  gap: calc(var(--unit) * 1);
  justify-content: center;
  color: var(--dim);
  font-size: calc(var(--unit) * 1.5);
}
.joinstrip b { color: var(--ink); letter-spacing: 0.08em; }
.joinstrip .qr { flex: none; width: calc(var(--unit) * 8); }
.joinstrip .qr svg { display: block; width: 100%; height: auto; border-radius: 4px; }

.lb { width: 100%; border-collapse: collapse; font-size: calc(var(--unit) * 1.9); }
.lb td { padding: calc(var(--unit) * 0.5) calc(var(--unit) * 0.8); border-bottom: 1px solid var(--line); }
.lb td:first-child { color: var(--dim); width: 3em; }
.lb td:last-child { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

.go { color: var(--accent); font-weight: 800; font-size: 18px; margin-bottom: 0.4em; }
a:hover .go { text-decoration: underline; }

.opts { width: 100%; border-collapse: collapse; font-size: 14px; }
.opts td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.opts td:first-child { width: 12em; white-space: nowrap; }
.opts td:last-child { color: var(--dim); }
.opts code { color: var(--ink); font-weight: 700; }

/* A phone is not 100 units wide, so the board's --unit has to stop tracking the
   viewport before the type collapses. */
@media (max-width: 900px) {
  .board { --unit: 8px; padding: 14px; }
  .board .question { font-size: 26px; }
  .answers li { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
