:root {
  --bg: #f8fafc; /* light */
  --fg: #0f172a; /* dark text */
  --muted: #475569;
  --card: #ffffff;
  --accent: #22c55e;
  --accent-2: #3b82f6;
  --danger: #ef4444;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--fg);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.subtitle { color: var(--muted); margin-top: -8px; }

.screen { display: none; }
.screen.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.field { display: grid; gap: 6px; margin-bottom: 12px; }
label { font-weight: 600; }
input, select {
  background: #ffffff;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.btn {
  background: #ffffff;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.leaderboard-header { display: flex; align-items: center; justify-content: space-between; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
caption { text-align: left; color: var(--muted); margin-bottom: 6px; }
.muted { color: var(--muted); }

.quiz-header { display: flex; align-items: center; justify-content: space-between; margin: 10px 0; }
.score { font-weight: 700; }
.timer {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
}

.question-text { font-size: 1.15rem; line-height: 1.5; margin-bottom: 12px; }
.options { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.options .option-btn {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: #f1f5f9; /* light readable */
  border: 1px solid var(--border);
  border-radius: 10px;
  line-height: 1.5;
}
.options .option-btn:hover {
  background: #e2e8f0;
}
.options .option-btn:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}
.options .option-btn.correct {
  border-color: var(--accent);
  background: rgba(34, 197, 94, 0.25);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}
.options .option-btn.incorrect {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.2);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 20%, transparent);
}

.feedback { min-height: 28px; margin: 10px 0; font-weight: 600; }

.nav { 
  margin-top: 8px; 
  display: flex; 
  gap: 8px; 
  justify-content: space-between; 
  flex-wrap: wrap;
}
.nav-home, .nav-home-top {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}
.btn.secondary { 
  background: #f1f5f9; 
  border-color: var(--border); 
  color: var(--fg);
}
.btn.secondary:hover {
  background: #e2e8f0;
}
.btn.home {
  background: #fbbf24;
  border-color: #fbbf24;
  color: #78350f;
  font-weight: 600;
}
.btn.home:hover {
  background: #f59e0b;
  border-color: #f59e0b;
}

/* Flash animations */
.flash-correct { animation: flashGreen 500ms ease; }
.flash-incorrect { animation: flashRed 500ms ease; }
@keyframes flashGreen {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  100% { box-shadow: 0 0 0 20px rgba(34,197,94,0); }
}
@keyframes flashRed {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  100% { box-shadow: 0 0 0 20px rgba(239,68,68,0); }
}

.consent { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; font-size: 0.95rem; }

@media (max-width: 640px) {
  .question-text { font-size: 1.05rem; }
}


