:root {
  --bg: #f9f9f7;
  --surface: #ffffff;
  --text: #111111;
  --muted: #888888;
  --line: #e0e0e0;
  --accent: #111111;
  --accent-text: #ffffff;
  --correct: #1a7a4a;
  --wrong: #b0290a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

:root.dark {
  --bg: #111111;
  --surface: #1a1a1a;
  --text: #f2f2f2;
  --muted: #666666;
  --line: #2a2a2a;
  --accent: #f2f2f2;
  --accent-text: #111111;
  --correct: #3ecf8e;
  --wrong: #ff6b4a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button { font: inherit; cursor: pointer; }

.app {
  width: min(600px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}

.hidden { display: none !important; }

/* ── Labels ── */
.label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Start screen ── */
.start-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

h1 {
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.desc {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 340px;
}

/* ── Primary button ── */
.btn-primary {
  margin-top: 8px;
  width: 100%;
  height: 52px;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ── Question screen ── */
.question-header {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-bar {
  height: 2px;
  background: var(--line);
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 200ms ease;
}

.question-text {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 24px;
  flex: 1;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  background: var(--surface);
  border: none;
  color: var(--text);
  text-align: left;
  font-size: 0.92rem;
  transition: background 100ms;
}

.option-btn:hover { background: var(--bg); }

.option-btn.selected {
  background: var(--accent);
  color: var(--accent-text);
}

.option-label {
  flex: 0 0 28px;
  height: 28px;
  border: 1px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.5;
}

.option-btn.selected .option-label { opacity: 1; }

/* ── Result screen ── */
.result-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

h2 {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mistakes {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.mistake-item {
  background: var(--surface);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mistake-q {
  font-size: 0.85rem;
  font-weight: 500;
}

.mistake-wrong {
  font-size: 0.8rem;
  color: var(--wrong);
}

.mistake-correct {
  font-size: 0.8rem;
  color: var(--correct);
}

.all-correct {
  background: var(--surface);
  padding: 24px 16px;
  text-align: center;
  font-size: 1rem;
  color: var(--correct);
  font-weight: 500;
}
