:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #172033;
  --panel-2: #111827;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.22);
  --accent: #22c55e;
  --accent-2: #38bdf8;
  --danger: #fb7185;
  --button: #1f2937;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  background: var(--button);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

button:active {
  transform: scale(0.985);
}

button:disabled {
  color: #64748b;
  cursor: not-allowed;
  transform: none;
}

button.primary {
  background: var(--accent);
  color: #052e16;
}

button.full {
  width: 100%;
}

input {
  width: 100%;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0b1220;
  color: var(--ink);
  padding: 0 16px;
  font-size: 18px;
  font-weight: 800;
  outline: none;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.app {
  width: min(480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0 18px;
  background: linear-gradient(var(--bg) 80%, rgba(15, 23, 42, 0));
}

.phase-label {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.08;
}

.timer {
  display: grid;
  place-items: center;
  min-width: 96px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--accent);
  font-size: 20px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.time-low .timer {
  color: var(--danger);
}

.screen {
  display: grid;
  gap: 16px;
}

.setup-card,
.question-card,
.score-card,
.summary-grid,
.wrong-list-wrap {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

.setup-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.question-card {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.question-number {
  display: grid;
  gap: 6px;
}

.question-number span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.question-number strong {
  font-size: 64px;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #0b1220;
}

.progress div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 160ms ease;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice {
  min-height: 132px;
  border: 2px solid transparent;
  border-radius: 26px;
  background: #f8fafc;
  color: #111827;
  font-size: 64px;
  font-weight: 950;
}

.choice.selected {
  border-color: var(--accent);
  background: #bbf7d0;
}

.nav-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr;
  gap: 10px;
}

.score-card {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 28px 18px;
}

.score-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.score-card strong {
  color: var(--accent);
  font-size: 72px;
  line-height: 1;
}

.score-card span {
  color: var(--muted);
  font-weight: 900;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  padding: 0;
}

.summary-grid div {
  display: grid;
  gap: 4px;
  background: var(--panel-2);
  padding: 14px 10px;
  text-align: center;
}

.summary-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-grid strong {
  font-size: 20px;
}

.wrong-list-wrap {
  display: grid;
  gap: 12px;
  padding: 18px;
}

h2 {
  margin: 0;
  font-size: 18px;
}

.wrong-list {
  display: grid;
  gap: 10px;
}

.wrong-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0b1220;
  padding: 12px;
}

.wrong-item strong {
  font-size: 18px;
}

.wrong-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.empty {
  margin: 0;
  color: var(--accent);
  font-weight: 900;
}

@media (min-width: 700px) {
  body {
    background:
      radial-gradient(circle at top, rgba(56, 189, 248, 0.16), transparent 34rem),
      var(--bg);
  }
}
