:root {
  --bg: #0e1416;
  --panel: #171f22;
  --panel2: #1d292d;
  --line: #2a383d;
  --text: #d7e2e4;
  --dim: #7e9298;
  --accent: #70a0af;
  --accent2: #9ec8d4;
  --good: #67c382;
  --bad: #d56a6a;
  --gold: #d9b45c;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; justify-content: center;
}
#app { width: 100%; max-width: 560px; padding: 14px 14px 90px; min-height: 100%; }
h1, h2 { font-weight: 700; letter-spacing: .2px; }
input, textarea, button { font: inherit; }
input, textarea {
  width: 100%; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
button {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 16px; cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #0b1012; font-weight: 700; }
button.danger { background: var(--bad); border-color: var(--bad); color: #14090a; font-weight: 700; }
button.good { background: var(--good); border-color: var(--good); color: #07130a; font-weight: 700; }
button:disabled { opacity: .35; cursor: default; }
button.wide { width: 100%; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.muted { color: var(--dim); font-size: 14px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

.codebox { font-size: 42px; font-weight: 800; letter-spacing: 8px; color: var(--accent2); font-family: ui-monospace, monospace; }

/* scoreboard strip */
.strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; display: flex; gap: 6px; align-items: center;
}
.chip .sc { font-weight: 700; color: var(--accent2); }
.chip.me { border-color: var(--accent); }

/* question */
.qtext { font-size: 22px; line-height: 1.4; font-weight: 600; }
.val { color: var(--gold); font-weight: 700; font-size: 18px; }
.ddbadge { background: var(--gold); color: #14100a; font-weight: 800; border-radius: 6px; padding: 2px 8px; font-size: 12px; }

/* buzzer */
.buzz {
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #a7d8e5, var(--accent) 60%);
  border: 4px solid #0b1012; box-shadow: 0 8px 30px rgba(112,160,175,.35);
  font-size: 24px; font-weight: 800; color: #0b1012; letter-spacing: 2px;
}
.buzz:disabled { filter: grayscale(.9); opacity: .5; box-shadow: none; }

/* countdown */
.timer { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.timer > div { height: 100%; background: var(--accent); transition: width .2s linear; }

/* trio cards */
.trio { display: grid; gap: 10px; }
.tcard {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
}
.tcard .btn { flex: 0 0 auto; }

/* judging */
.jcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.ansref { display: flex; gap: 6px; flex-direction: column; }
.ref { color: var(--gold); }
.winner-line { color: var(--good); font-weight: 700; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--bad); color: #fff; padding: 10px 18px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 9;
}
#toast.show { opacity: 1; }

.biganswer { font-size: 28px; font-weight: 800; color: var(--gold); }
.ranks { display: grid; gap: 6px; }
.rank { display: flex; justify-content: space-between; padding: 10px 14px; background: var(--panel2); border-radius: 10px; }
.rank.top { border: 1px solid var(--gold); color: var(--gold); font-weight: 700; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button { flex: 1; }
.tabs button.on { background: var(--accent); color: #0b1012; border-color: var(--accent); font-weight: 700; }
.catlist { display: grid; gap: 6px; max-height: 40vh; overflow: auto; }
.cat { display: flex; justify-content: space-between; background: var(--panel2); border-radius: 8px; padding: 8px 10px; align-items: center; gap: 8px; }
svg.ic { width: 20px; height: 20px; vertical-align: -4px; }
