:root {
  --bg: #0f1420;
  --panel: #18203010;
  --card: #1a2233;
  --card-2: #212c42;
  --line: #2c3854;
  --text: #eef2fb;
  --muted: #9aa8c7;
  --accent: #5ad1a0;
  --accent-2: #46b2ff;
  --power: #ffce54;
  --bad: #ff6b81;
  --radius: 16px;
  --tap: 56px;
  font-synthesis-weight: none;
}

* { box-sizing: border-box; }

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

body { padding: 0 0 96px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }

header.bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  background: rgba(15, 20, 32, 0.96);
  backdrop-filter: blur(8px);
}
header.bar .brand { font-weight: 800; letter-spacing: 0.5px; font-size: 20px; }
header.bar .brand .mark { color: var(--power); }
header.bar .who { margin-left: auto; color: var(--muted); font-size: 16px; }
header.bar a.back {
  color: var(--accent-2); text-decoration: none; font-weight: 600;
  min-height: 40px; display: inline-flex; align-items: center;
}

h1 { font-size: 26px; margin: 18px 0 8px; }
h2 { font-size: 20px; margin: 22px 0 8px; }
p.sub { color: var(--muted); margin: 0 0 16px; }

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

.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) { .grid.three { grid-template-columns: repeat(2, 1fr); } }

button, .btn {
  font: inherit;
  min-height: var(--tap);
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary, .btn.primary { background: var(--accent); color: #06231a; border-color: transparent; }
button.ghost { background: transparent; }
button.danger { background: var(--bad); color: #2a0008; border-color: transparent; }

.buzz {
  width: 100%;
  min-height: 108px;
  font-size: 30px;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #ff9f43, #ff6b81);
  color: #2b0a12;
  border: none;
  border-radius: 20px;
  box-shadow: 0 8px 0 #a8324a;
}
.buzz:active { box-shadow: 0 3px 0 #a8324a; transform: translateY(5px); }
.buzz[disabled] { background: #39435c; color: #7b87a6; box-shadow: none; }

input[type="text"], input[type="password"], input[type="number"], select {
  font: inherit;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0c111c;
  color: var(--text);
}
label.row {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap);
  border-bottom: 1px solid var(--line);
}
label.row:last-child { border-bottom: none; }
label.row span.lbl { flex: 1; }
input[type="checkbox"] { width: 26px; height: 26px; accent-color: var(--accent); }

.question {
  font-size: 22px;
  line-height: 1.6;
  min-height: 190px;
}
.question .said { color: var(--text); }
.question .power { color: var(--power); font-weight: 800; }
.question .buzzmark {
  background: rgba(90, 209, 160, 0.22);
  border-bottom: 2px solid var(--accent);
  border-radius: 3px;
}
.question .rest { color: #46506b; }

.pill {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--card-2); color: var(--muted);
  font-size: 14px; font-weight: 700; margin-right: 6px;
}
.pill.good { background: rgba(90, 209, 160, 0.18); color: var(--accent); }
.pill.power { background: rgba(255, 206, 84, 0.18); color: var(--power); }
.pill.bad { background: rgba(255, 107, 129, 0.18); color: var(--bad); }

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 44px; font-weight: 800; text-align: center;
}
.timer.low { color: var(--bad); }

.scorebar {
  display: flex; gap: 8px; flex-wrap: wrap;
  color: var(--muted); font-size: 15px; font-weight: 700;
}
.scorebar b { color: var(--text); }

.answerline { font-size: 20px; font-weight: 700; }
.answerline b, .answerline u { color: var(--accent); text-decoration: none; }

ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
ul.list li:last-child { border-bottom: none; }
ul.list li .grow { flex: 1; min-width: 0; }
ul.list li .grow .small { color: var(--muted); font-size: 14px; }

.bar-row { margin: 10px 0; }
.bar-row .bar-label { display: flex; justify-content: space-between; font-size: 15px; color: var(--muted); }
.bar-row .bar-track { height: 12px; border-radius: 999px; background: #0c111c; overflow: hidden; margin-top: 4px; }
.bar-row .bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

.player-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px 10px; min-height: 120px;
}
.player-tile .emoji { font-size: 40px; line-height: 1; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.spacer { height: 12px; }
.err { color: var(--bad); font-weight: 700; }
.hidden { display: none !important; }

footer.attrib {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 24px 16px 8px;
}
footer.attrib a { color: var(--muted); }

.explain h3 { margin: 14px 0 4px; font-size: 17px; }
.explain .clue { border-left: 3px solid var(--line); padding-left: 12px; margin: 12px 0; }
.explain .clue .why { color: var(--muted); font-size: 16px; }

/* ---- couch match mode (host.html, join.html) ---- */

.match-code {
  font-size: 64px; font-weight: 900; letter-spacing: 14px;
  font-variant-numeric: tabular-nums; color: var(--power);
  line-height: 1.1; padding-left: 14px;
}
.join-url { word-break: break-all; }
.qr-box {
  background: #fff; padding: 12px; border-radius: 16px;
  display: inline-block; line-height: 0;
}
.qr-box svg { display: block; width: 100%; max-width: 260px; height: auto; }

.judge-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.judge-row button { min-height: 86px; font-size: 19px; flex-direction: column; gap: 2px; }
button.suggested {
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(70, 178, 255, 0.16);
}
.suggest-note { color: var(--accent-2); font-weight: 700; }

.tv .question { font-size: 30px; line-height: 1.55; min-height: 240px; }
.tv .match-code { font-size: 78px; }

ul.scoreboard { list-style: none; margin: 0; padding: 0; }
ul.scoreboard li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
ul.scoreboard li:last-child { border-bottom: none; }
ul.scoreboard li .grow { flex: 1; min-width: 0; }
ul.scoreboard li .sc { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 22px; }
ul.scoreboard li.out { opacity: 0.45; }
ul.scoreboard li.has-buzz { background: rgba(90, 209, 160, 0.12); border-radius: 10px; padding-left: 8px; }

.team-head { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 2px; }
.team-head .sc { font-size: 26px; font-weight: 900; margin-left: auto; }

.phone-status { font-size: 22px; font-weight: 700; text-align: center; margin: 8px 0; }
.phone-score { font-size: 40px; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.dot.on { background: var(--accent); }
