:root {
  color-scheme: dark;
  --ink: #f8fbff;
  --muted: #b7c8db;
  --navy: #061422;
  --panel: #0b2138;
  --card: #102f4e;
  --blue: #58aefc;
  --blue-soft: #a5d5ff;
  --green: #34d58a;
  --red: #ff9aa4;
  --line: rgba(255,255,255,.18);
  --focus-ring: #a5d5ff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(42,123,190,.38), transparent 35%),
    linear-gradient(140deg, #061422, #020811 72%);
}
button { font: inherit; }

/* Skip link: hidden until focused, then a fully opaque, high-contrast target */
.skip-link {
  position: absolute;
  top: -60px;
  left: 12px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: 10px;
  background: #ffffff;
  color: #061422;
  font-weight: 800;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

.app-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.stage {
  width: min(96vw, 1440px);
  aspect-ratio: 16 / 9;
  min-height: 650px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(11,33,56,.98), rgba(3,12,23,.99));
  box-shadow: 0 28px 90px rgba(0,0,0,.5);
}
.top-bar { display: flex; justify-content: space-between; gap: 24px; padding: 20px 36px 17px; font-weight: 800; }
.brand { color: var(--blue-soft); }
.progress { flex: 0 0 auto; color: var(--blue); font-variant-numeric: tabular-nums; }
.timer-meter { height: 7px; margin: 0 36px; overflow: hidden; border-radius: 99px; background: rgba(88,174,252,.14); }
.timer-meter div { width: 0; height: 100%; background: linear-gradient(90deg, var(--green), var(--blue)); transition: width .15s linear; }
.timer-meter.paused div { background: #f6bd4d; }

.screen { display: none; padding: 30px 64px; opacity: 0; transform: translateY(10px); }
.screen.active { display: block; animation: enter .35s ease forwards; }
@keyframes enter { to { opacity: 1; transform: none; } }
.intro-screen, .end-screen { align-self: center; max-width: 1180px; overflow-y: auto; max-height: 100%; }
.eyebrow, .question-meta { margin: 0 0 16px; color: var(--blue-soft); font-size: 20px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(38px, 4.6vw, 68px); line-height: 1.06; }
h2 { margin: 16px 0 0; color: #deedfb; font-size: clamp(24px, 2.5vw, 38px); line-height: 1.18; }
.subline { margin: 22px 0 10px; color: var(--muted); font-size: clamp(19px, 1.8vw, 27px); }
.coverage { color: var(--blue-soft); font-size: 17px; font-weight: 750; }
.coverage span { padding: 0 9px; color: var(--green); }
.disclaimer { max-width: 950px; color: var(--muted); line-height: 1.55; }
.a11y-note { max-width: 950px; margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(88,174,252,.08); color: var(--muted); line-height: 1.5; font-size: 15px; }

button {
  border: 1px solid rgba(88,174,252,.5);
  border-radius: 12px;
  padding: 14px 22px;
  min-height: 48px;
  background: #126bb9;
  color: white;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
button:hover { background: #0f72ba; }
button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}
button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.primary { margin-top: 18px; font-size: 20px; }

.quiz-toprow { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.countdown-badge {
  min-width: 78px;
  padding: 8px 12px;
  border: 1px solid rgba(165,213,255,.3);
  border-radius: 11px;
  background: rgba(88,174,252,.1);
  color: var(--muted);
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.question-meta { font-size: 14px; letter-spacing: .08em; margin: 0; }
.quiz-screen h2#questionText { font-size: clamp(27px, 2.8vw, 44px); line-height: 1.16; margin-top: 14px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 24px; }
.option {
  min-height: 92px;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 15px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(16,47,78,.75);
  font-size: clamp(17px, 1.5vw, 24px);
  line-height: 1.25;
}
.letter {
  width: 46px; height: 46px; display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.2); border-radius: 10px;
  background: rgba(88,174,252,.16); color: var(--blue-soft); font-weight: 950;
}
.option.correct { border-color: var(--green); background: rgba(52,213,138,.16); }
.option.correct .letter { background: var(--green); color: #03150c; }
.option.incorrect { border-color: var(--red); background: rgba(255,154,164,.1); }
.option.incorrect .letter { border-color: var(--red); }
/* Correctness is never color-only: revealed options also gain a text-visible state via the answer heading and per-option explanation list below. */

.answer-mode { padding-top: 20px; }
.answer-mode .question-meta { margin-bottom: 6px; }
.answer-mode h2#questionText { font-size: clamp(21px, 2.05vw, 33px); margin-top: 8px; }
.answer-mode .options { gap: 9px; margin-top: 12px; }
.answer-mode .option { min-height: 55px; grid-template-columns: 34px 1fr; gap: 10px; padding: 8px 12px; font-size: clamp(14px, 1.02vw, 17px); }
.answer-mode .letter { width: 34px; height: 34px; border-radius: 8px; }
.answer-panel { margin-top: 12px; padding: 14px 18px; border: 1px solid rgba(52,213,138,.4); border-radius: 14px; background: rgba(4,23,32,.8); }
.answer-panel h2 { margin: 0; color: var(--green); font-size: clamp(17px, 1.4vw, 22px); }
.answer-panel p { margin: 7px 0 10px; font-size: clamp(14px, 1vw, 17px); line-height: 1.4; color: var(--ink); }
.answer-panel h3 { margin: 0 0 5px; color: var(--blue-soft); font-size: clamp(14px, 1vw, 16px); }
.answer-panel ul { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: clamp(12px, .85vw, 14px); line-height: 1.3; }

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}
.control-btn {
  flex: 1 1 140px;
  min-height: 48px;
  font-size: 16px;
  font-weight: 750;
  text-align: center;
}
#pauseBtn[aria-pressed="true"] {
  background: #7a530d;
  border-color: rgba(246,189,77,.6);
}
.keys-hint { margin: 12px 0 0; color: var(--muted); font-size: 13px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .screen.active { animation: none; opacity: 1; transform: none; }
  .timer-meter div { transition: none; }
  .skip-link { transition: none; }
}

@media (max-width: 850px) {
  .app-shell { padding: 0; }
  .stage { width: 100%; min-height: 100vh; aspect-ratio: auto; border: 0; border-radius: 0; }
  .top-bar { padding: 17px 20px; font-size: 13px; }
  .timer-meter { margin: 0 20px; }
  .screen { padding: 26px 20px; }
  .options { grid-template-columns: 1fr; }
  .answer-panel ul { grid-template-columns: 1fr; }
  .controls-bar { flex-direction: column; }
  .control-btn { flex: 1 1 auto; }
}
