:root {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #121c2f;
  --surface-2: #18243a;
  --border: #2a3850;
  --text: #f4f7fb;
  --muted: #a8b3c7;
  --accent: #ff9900;
  --accent-soft: rgba(255, 153, 0, .13);
  --success: #44d19d;
  --danger: #ff8585;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% 0%, #1b2942 0, transparent 35%), var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.55; }
button, input { font: inherit; }
button { cursor: pointer; }
.topbar { min-height: 72px; padding: 14px clamp(18px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); background: rgba(11,18,32,.88); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-size: 15px; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 36px; border-radius: 9px; background: var(--accent); color: #151515; font-weight: 900; letter-spacing: -.5px; }
.set-pill { color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 7px 13px; font-size: 13px; white-space: nowrap; }
.page-shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 46px 0 32px; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .15em; }
h1 { font-size: clamp(28px, 4vw, 44px); letter-spacing: -.035em; line-height: 1.12; margin: 0 0 12px; }
.subtitle { color: var(--muted); max-width: 680px; margin: 0; }
.progress-card { min-width: 155px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); display: grid; }
.progress-number { font-size: 25px; font-weight: 800; }
.progress-caption { color: var(--muted); font-size: 13px; }
.progress-track { height: 4px; margin-top: 12px; background: var(--border); border-radius: 4px; overflow: hidden; }
#progress-fill { width: 0; height: 100%; background: var(--accent); transition: width .2s ease; }
.notice { padding: 13px 16px; margin: 0 0 20px; border-radius: 12px; border: 1px solid #355071; background: #172941; color: #dceaff; }
.notice.success { border-color: #27654f; background: #13382f; color: #b8f4df; }
.notice.error { border-color: #744343; background: #3c2027; color: #ffc6c6; }
.quiz-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 24px; align-items: start; }
.question-nav { position: sticky; top: 98px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.nav-heading { font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 13px; }
.question-nav-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.nav-button { aspect-ratio: 1; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--muted); position: relative; }
.nav-button:hover { border-color: var(--accent); color: var(--text); }
.nav-button.current { outline: 2px solid var(--accent); color: var(--text); }
.nav-button.answered { background: var(--accent-soft); border-color: #8b621c; color: #ffd89b; }
.nav-button.guessed::after { content: ""; position: absolute; width: 6px; height: 6px; right: 3px; top: 3px; border-radius: 50%; background: var(--danger); }
.nav-legend { color: var(--muted); font-size: 11px; margin-top: 16px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 5px; }
.legend-dot.answered { background: var(--accent); }
.legend-dot.guessed { background: var(--danger); }
.quiz-card { min-height: 480px; padding: clamp(22px, 4vw, 40px); border: 1px solid var(--border); border-radius: 20px; background: linear-gradient(145deg, rgba(24,36,58,.95), rgba(18,28,47,.95)); box-shadow: 0 18px 50px rgba(0,0,0,.16); }
.loading-state { min-height: 400px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.loader { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; margin: auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.question-meta { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 13px; font-weight: 650; margin-bottom: 20px; }
.question-count { color: var(--accent); }
.question-text { margin: 0 0 26px; font-size: clamp(18px, 2.2vw, 22px); line-height: 1.48; letter-spacing: -.01em; }
.options { display: grid; gap: 11px; }
.option { display: flex; gap: 14px; align-items: flex-start; padding: 15px 17px; border: 1px solid var(--border); border-radius: 12px; background: rgba(11,18,32,.36); cursor: pointer; transition: border-color .15s, background .15s; }
.option:hover { border-color: #526581; background: rgba(40,56,82,.4); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); }
.option input { margin: 4px 0 0; width: 17px; height: 17px; accent-color: var(--accent); flex: 0 0 auto; }
.option-letter { font-weight: 800; color: var(--accent); min-width: 18px; }
.option-text { color: #e8edf5; }
.question-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); }
.guess-toggle { color: var(--muted); display: flex; gap: 9px; align-items: center; cursor: pointer; font-size: 14px; }
.guess-toggle input { accent-color: var(--accent); width: 17px; height: 17px; }
.actions { display: flex; gap: 10px; }
.button { border: 1px solid var(--border); border-radius: 10px; padding: 10px 18px; color: var(--text); background: var(--surface-2); font-weight: 700; }
.button:hover:not(:disabled) { border-color: #71829d; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #181818; }
.button.primary:hover:not(:disabled) { background: #ffad33; border-color: #ffad33; }
.button:disabled { opacity: .4; cursor: not-allowed; }
.readonly-banner { padding: 14px; border-radius: 10px; background: var(--accent-soft); color: #ffda9e; margin-bottom: 20px; }
.footer { color: #7f8ca3; text-align: center; padding: 22px 18px 36px; font-size: 13px; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; }
  .brand > span:last-child { display: none; }
  .page-shell { width: min(100% - 24px, 680px); padding-top: 28px; }
  .hero { align-items: start; gap: 18px; }
  .progress-card { min-width: 110px; padding: 12px 14px; }
  .subtitle { font-size: 14px; }
  .quiz-layout { grid-template-columns: 1fr; gap: 14px; }
  .question-nav { position: static; padding: 12px 14px; }
  .nav-heading, .nav-legend { display: none; }
  .question-nav-grid { grid-template-columns: repeat(12, 1fr); gap: 5px; }
  .nav-button { border-radius: 6px; font-size: 12px; }
  .quiz-card { min-height: 440px; }
  .question-footer { align-items: stretch; flex-direction: column-reverse; }
  .actions { justify-content: space-between; }
}

@media (max-width: 480px) {
  .question-nav-grid { grid-template-columns: repeat(6, 1fr); }
  .nav-button { aspect-ratio: 1.15; }
  .hero { display: block; }
  .progress-card { display: none; }
  .quiz-card { padding: 22px 17px; }
  .question-meta { flex-direction: column; gap: 3px; }
  .option { padding: 13px; gap: 10px; }
}
