:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #0d1b2b;
  --panel-2: #122338;
  --line: #26384e;
  --text: #f5f7fb;
  --muted: #94a3b8;
  --accent: #ff7a1a;
  --accent-2: #ff9c52;
  --good: #2dd4a3;
  --bad: #fb7185;
  --blue: #55b6ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 12% 0%, #102742 0, transparent 36%), var(--bg); color: var(--text); }
button, select, input { font: inherit; }
button { color: inherit; }
.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(148,163,184,.18); }
.brand { border: 0; background: none; display: flex; align-items: center; gap: 12px; padding: 0; cursor: pointer; text-align: left; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid rgba(255,122,26,.45); border-radius: 12px; background: rgba(255,122,26,.09); }
.brand-mark svg { width: 28px; fill: var(--accent); }
.brand-mark svg path:last-child { fill: none; stroke: #fff; stroke-width: 2; }
.brand strong { display: block; font-size: 16px; letter-spacing: .01em; }
.brand small { display: block; color: var(--muted); margin-top: 2px; font-size: 12px; }
.dataset-pill { border: 1px solid var(--line); background: rgba(13,27,43,.8); border-radius: 999px; padding: 9px 14px; color: var(--muted); font-size: 13px; }
.dataset-pill span { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 14px var(--good); }
.dataset-pill b { color: var(--text); }
.screen { min-height: calc(100vh - 92px); }
.hidden { display: none !important; }

.setup-screen { display: grid; grid-template-columns: 1fr minmax(400px, 480px); gap: 90px; align-items: center; padding: 64px 20px 80px; }
.setup-copy { max-width: 570px; }
.eyebrow { margin: 0 0 18px; color: var(--accent-2); font-size: 12px; line-height: 1; font-weight: 800; letter-spacing: .17em; }
.setup-copy h1, .result-hero h1 { margin: 0; font-size: clamp(46px, 6vw, 78px); line-height: .98; letter-spacing: -.055em; }
.setup-copy h1 { font-size: clamp(32px, 4.8vw, 60px); line-height: 1.1; letter-spacing: -.04em; }
.setup-copy h1 em { color: transparent; font-style: normal; -webkit-text-stroke: 1px var(--accent); text-stroke: 1px var(--accent); }
.lead { max-width: 500px; margin: 28px 0 38px; color: #b7c3d3; font-size: 18px; line-height: 1.6; }
.stats-strip { display: flex; gap: 0; }
.stats-strip div { min-width: 170px; padding-right: 28px; }
.stats-strip div + div { padding-left: 28px; border-left: 1px solid var(--line); }
.stats-strip strong { display: block; font-size: 28px; }
.stats-strip span { display: block; color: var(--muted); margin-top: 4px; font-size: 13px; }

.setup-card { padding: 32px; background: linear-gradient(145deg, rgba(18,35,56,.96), rgba(10,23,38,.96)); border: 1px solid #2a3d55; border-radius: 22px; box-shadow: 0 28px 80px rgba(0,0,0,.34); }
.card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 30px; }
.step-number { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; background: var(--accent); color: #101010; font-weight: 900; }
.card-head h2 { margin: 0; font-size: 21px; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.field-label, legend { display: block; margin: 0 0 10px; color: #d9e1ec; font-size: 13px; font-weight: 700; }
.select-wrap { position: relative; margin-bottom: 24px; }
select { width: 100%; height: 52px; appearance: none; color: var(--text); background: #091625; border: 1px solid #31435a; border-radius: 11px; padding: 0 46px 0 15px; outline: none; }
select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,122,26,.13); }
.select-wrap svg { position: absolute; right: 15px; top: 16px; width: 21px; fill: none; stroke: var(--muted); stroke-width: 2; pointer-events: none; }
fieldset { min-width: 0; margin: 0 0 24px; padding: 0; border: 0; }
.segmented { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.segmented button { height: 42px; border: 1px solid #31435a; border-radius: 9px; background: #091625; cursor: pointer; font-size: 13px; font-weight: 700; }
.segmented button:hover { border-color: #607087; }
.segmented button.active { color: #111; background: var(--accent); border-color: var(--accent); }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-option { display: flex; gap: 10px; min-height: 86px; padding: 14px; border: 1px solid #31435a; border-radius: 11px; background: #091625; cursor: pointer; }
.mode-option:has(input:checked) { border-color: var(--accent); background: rgba(255,122,26,.08); }
.mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.radio-dot { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; border: 1px solid #607087; border-radius: 50%; }
.mode-option:has(input:checked) .radio-dot { border: 5px solid var(--accent); }
.mode-option b, .mode-option small { display: block; }
.mode-option b { font-size: 14px; }
.mode-option small { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.primary-button, .secondary-button, .ghost-button, .danger-button { min-height: 48px; border-radius: 10px; border: 0; padding: 0 18px; font-weight: 800; cursor: pointer; }
.primary-button { width: 100%; display: flex; align-items: center; justify-content: space-between; color: #111; background: var(--accent); box-shadow: 0 10px 30px rgba(255,122,26,.2); }
.primary-button:hover { background: var(--accent-2); }
.primary-button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.primary-button.compact { width: auto; min-width: 210px; gap: 28px; }
.form-note { margin: 12px 0 0; text-align: center; color: #708198; font-size: 11px; }

.quiz-screen { padding: 40px 50px 70px; }
.quiz-meta, .progress-row { display: flex; align-items: center; justify-content: space-between; }
.quiz-meta > div:first-child span, .quiz-meta > div:first-child b { display: block; }
.quiz-meta span { color: #c8d1dd; font-size: 13px; }
.quiz-meta b { margin-top: 5px; color: var(--accent-2); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.timer { min-width: 92px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); text-align: center; font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: .06em; }
.progress-row { margin: 30px 0 10px; color: var(--muted); font-size: 13px; }
.progress-track { height: 4px; background: #1d2c40; border-radius: 99px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--accent), #ffc26e); transition: width .35s ease; }
.question-card { display: grid; grid-template-columns: 70px 1fr; gap: 28px; max-width: 900px; margin: 62px auto 46px; }
.question-number { color: #4a5c73; font-size: 36px; line-height: 1; font-weight: 900; letter-spacing: -.04em; }
.question-content h2 { min-height: 72px; margin: 0 0 34px; font-size: clamp(22px, 3vw, 31px); line-height: 1.32; letter-spacing: -.025em; }
.multi-hint { margin: 0 0 9px; color: var(--accent-2); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.answers { display: grid; gap: 12px; }
.answer { position: relative; width: 100%; display: grid; grid-template-columns: 42px 1fr 22px; gap: 13px; align-items: center; min-height: 66px; padding: 10px 16px 10px 12px; border: 1px solid #2c3e54; border-radius: 12px; color: #dce4ee; background: rgba(13,27,43,.92); cursor: pointer; text-align: left; transition: transform .15s, border-color .15s, background .15s; }
.answer:hover:not(:disabled) { transform: translateX(3px); border-color: #566b84; }
.answer-key { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: #17283c; color: #98a9bc; font-size: 13px; font-weight: 900; }
.answer-check { width: 19px; height: 19px; border: 1px solid #4d6077; border-radius: 50%; }
.answer.multiple .answer-check { border-radius: 5px; }
.answer.selected { border-color: var(--blue); background: rgba(85,182,255,.08); }
.answer.selected .answer-key { background: var(--blue); color: #061321; }
.answer.selected .answer-check { border: 5px solid var(--blue); }
.answer.multiple.selected .answer-check { border: 0; background: var(--blue); position: relative; }
.answer.multiple.selected .answer-check::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #07111f; font-size: 13px; font-weight: 900; }
.answer.correct { border-color: var(--good); background: rgba(45,212,163,.09); }
.answer.correct .answer-key { background: var(--good); color: #06130f; }
.answer.wrong { border-color: var(--bad); background: rgba(251,113,133,.08); }
.answer.wrong .answer-key { background: var(--bad); color: #1c080c; }
.feedback { margin-top: 18px; padding: 14px 16px; border-left: 3px solid var(--good); background: rgba(45,212,163,.07); color: #c8f8e9; border-radius: 0 8px 8px 0; font-weight: 700; }
.feedback.bad { border-color: var(--bad); background: rgba(251,113,133,.07); color: #ffd6dc; }
.quiz-actions { max-width: 900px; margin: 0 auto; padding-left: 98px; display: flex; justify-content: space-between; }
.ghost-button { color: #a8b5c5; background: transparent; border: 1px solid #31435a; }
.ghost-button:hover { border-color: #64748b; color: #fff; }

.results-screen { padding: 66px 70px 90px; }
.result-hero { display: grid; grid-template-columns: 190px 1fr; gap: 40px; align-items: center; max-width: 880px; margin: 0 auto 45px; }
.result-gauge { --score: 0deg; width: 180px; height: 180px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--accent) var(--score), #1b2b3f 0); position: relative; }
.result-gauge::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--bg); }
.result-gauge div { position: relative; text-align: center; }
.result-gauge strong, .result-gauge span { display: block; }
.result-gauge strong { font-size: 38px; letter-spacing: -.05em; }
.result-gauge span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.result-hero h1 { font-size: clamp(38px, 6vw, 62px); }
.result-hero > div:last-child > p:last-child { color: #aebaca; font-size: 17px; }
.result-stats { max-width: 880px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--panel); }
.result-stats div { padding: 20px; text-align: center; }
.result-stats div + div { border-left: 1px solid var(--line); }
.result-stats span, .result-stats strong { display: block; }
.result-stats span { color: var(--muted); font-size: 12px; }
.result-stats strong { margin-top: 7px; font-size: 27px; }
.result-stats .good strong { color: var(--good); }
.result-stats .bad strong { color: var(--bad); }
.result-actions { max-width: 880px; margin: 22px auto 58px; display: flex; justify-content: flex-end; gap: 10px; }
.secondary-button { color: var(--text); background: #17283c; border: 1px solid #31435a; }
.review-section { max-width: 880px; margin: 0 auto; }
.review-head { display: flex; align-items: end; justify-content: space-between; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.review-head h2 { margin: 0; font-size: 23px; }
.review-head .eyebrow { margin-bottom: 8px; }
.review-head > span { color: var(--muted); font-size: 13px; }
.review-list { display: grid; gap: 12px; margin-top: 18px; }
.review-item { padding: 19px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.review-item > span { color: var(--accent-2); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.review-item h3 { margin: 7px 0 14px; font-size: 16px; line-height: 1.45; }
.review-item p { margin: 6px 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.review-item p b { color: #cbd5e1; }
.review-item .right-answer { color: var(--good); }
.source-note { margin: 18px 0; padding: 14px 16px; border: 1px solid #706144; border-radius: 10px; background: #242019; color: #e9d2ab; font-size: 13px; line-height: 1.6; }
.source-note p { margin: 0; }

dialog { width: min(440px, calc(100% - 32px)); color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 0; box-shadow: 0 30px 90px #000; }
dialog::backdrop { background: rgba(2,8,18,.78); backdrop-filter: blur(4px); }
dialog form { padding: 28px; }
dialog h2 { margin: 0 0 8px; }
dialog p { color: var(--muted); }
dialog form > div { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.danger-button { color: #fff; background: #d9465f; }

@media (max-width: 860px) {
  .app-shell { width: min(100% - 28px, 680px); }
  .setup-screen { grid-template-columns: 1fr; gap: 48px; padding: 52px 8px 70px; }
  .setup-copy { text-align: center; margin: 0 auto; }
  .lead { margin-inline: auto; }
  .stats-strip { justify-content: center; text-align: left; }
  .quiz-screen, .results-screen { padding: 35px 8px 70px; }
  .question-card { grid-template-columns: 1fr; gap: 13px; margin-top: 42px; }
  .question-number { font-size: 24px; }
  .quiz-actions { padding-left: 0; }
}

@media (max-width: 560px) {
  .app-shell { width: calc(100% - 22px); }
  .topbar { height: 76px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand small { display: none; }
  .dataset-pill { padding: 8px 10px; font-size: 11px; }
  .screen { min-height: calc(100vh - 76px); }
  .setup-screen { padding-top: 38px; }
  .setup-copy h1 { font-size: clamp(32px, 8vw, 44px); }
  .lead { font-size: 16px; }
  .stats-strip div { min-width: 0; flex: 1; padding-right: 18px; }
  .stats-strip div + div { padding-left: 18px; }
  .setup-card { padding: 23px 18px; border-radius: 17px; }
  .segmented { gap: 5px; }
  .segmented button { padding: 0 4px; font-size: 12px; }
  .mode-grid { grid-template-columns: 1fr; }
  .question-content h2 { min-height: 0; margin-bottom: 25px; font-size: 21px; }
  .answer { grid-template-columns: 38px 1fr 19px; padding-right: 12px; font-size: 14px; }
  .answer-key { width: 34px; height: 34px; }
  .quiz-actions { gap: 8px; }
  .quiz-actions .primary-button { min-width: 0; flex: 1; }
  .result-hero { grid-template-columns: 1fr; text-align: center; gap: 25px; }
  .result-gauge { width: 150px; height: 150px; margin: 0 auto; }
  .result-stats { grid-template-columns: 1fr 1fr; }
  .result-stats div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .result-stats div:nth-child(4) { border-top: 1px solid var(--line); }
  .result-actions { display: grid; grid-template-columns: 1fr; }
  .result-actions .primary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
