:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1f2630;
  --border: #2a323d;
  --text: #e6edf3;
  --text-dim: #9aa6b2;
  --accent: #58a6ff;
  --ok: #57c98a;
  --warn: #d29922;
  --bad: #f85149;
  --code: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Yu Gothic UI", system-ui, sans-serif;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

header { margin-bottom: 18px; }

h1 {
  font-size: 28px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.lede {
  margin: 0;
  color: var(--text-dim);
  max-width: 720px;
}

.lede strong { color: var(--text); }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

code {
  font-family: var(--code);
  font-size: 12.5px;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

/* ────────── controls ────────── */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.control-group span {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}

select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
}

button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-family: var(--code);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: rgba(88, 166, 255, 0.15);
  border-color: var(--accent);
  color: var(--accent);
  margin-left: auto;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: rgba(88, 166, 255, 0.25);
}

/* ────────── quiz ────────── */

.quiz-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 8px 8px;
  text-align: center;
}

.question {
  font-size: 17px;
  color: var(--text);
  min-height: 44px;
  max-width: 560px;
  line-height: 1.6;
}

.question .badge {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-family: var(--code);
  font-size: 14px;
  color: var(--accent);
  margin: 0 4px;
}

.quiz-actions {
  display: flex;
  gap: 10px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.choice {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--code);
  font-size: 16px;
  font-weight: 500;
  padding: 12px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.08s, border-color 0.12s, background 0.12s;
}

.choice:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.choice.correct {
  background: rgba(87, 201, 138, 0.15);
  border-color: var(--ok);
  color: var(--ok);
}

.choice.wrong {
  background: rgba(248, 81, 73, 0.15);
  border-color: var(--bad);
  color: var(--bad);
}

.choice.highlight {
  border-color: var(--accent);
  color: var(--accent);
}

.feedback {
  margin-top: 14px;
  font-family: var(--code);
  font-size: 14px;
  text-align: center;
  min-height: 22px;
}

.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }
.feedback.info { color: var(--text-dim); }

/* ────────── stats ────────── */

.stats-section {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
}

@media (min-width: 600px) {
  .stats-section { grid-template-columns: repeat(4, 1fr); }
}

.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}

.stat-label {
  font-size: 10.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--code);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ────────── status ────────── */

.status-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-family: var(--code);
  font-size: 12px;
  color: var(--text-dim);
}

.status.ready { color: var(--ok); }
.status.bad { color: var(--bad); }

.reset {
  font-size: 11.5px;
  color: var(--text-dim);
}

/* ────────── footer ────────── */

footer {
  margin-top: 24px;
  font-size: 12.5px;
  color: var(--text-dim);
}

footer p { margin: 4px 0; }
