:root {
  color-scheme: light;
  --bg: oklch(0.97 0.012 220);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.94 0.018 220);
  --ink: oklch(0.24 0.035 235);
  --muted: oklch(0.49 0.035 230);
  --line: oklch(0.88 0.025 220);
  --navy: oklch(0.25 0.06 245);
  --blue: oklch(0.62 0.15 235);
  --cyan: oklch(0.76 0.14 185);
  --lime: oklch(0.82 0.17 125);
  --coral: oklch(0.69 0.16 30);
  --danger: oklch(0.58 0.18 25);
  --shadow: 0 8px 24px oklch(0.25 0.06 245 / 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-family: Manrope, system-ui, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 5vw, 72px); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 10px; align-items: center; border: 0; background: transparent; font-weight: 800; letter-spacing: -0.02em; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; background: var(--navy); color: var(--cyan); border-radius: 8px; font: 500 11px/1 "DM Mono", monospace; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.streak-chip, .icon-button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 12px; font-size: 12px; }
.streak-chip span { color: var(--coral); margin-right: 5px; }
.icon-button { width: 34px; height: 34px; padding: 0; }
.main-content { width: min(100% - 40px, 920px); margin: 0 auto; flex: 1; padding: 42px 0 36px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 0 20px 26px; }
.footer span { color: var(--cyan); padding: 0 6px; }

.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 34px; align-items: end; margin-bottom: 38px; }
.kicker { margin: 0 0 14px; color: var(--blue); font: 500 12px/1 "DM Mono", monospace; letter-spacing: .06em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 570px; margin-bottom: 14px; font-size: clamp(34px, 5vw, 58px); line-height: 1.02; letter-spacing: -0.035em; text-wrap: balance; }
.hero-copy { max-width: 530px; color: var(--muted); line-height: 1.7; font-size: 15px; }
.quote-note { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.quote-note strong { display: block; margin-bottom: 8px; font-size: 13px; }
.quote-note p { margin: 0; color: var(--muted); font: 13px/1.65 "DM Mono", monospace; }
.quote-note code { color: var(--blue); }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.section-heading span { color: var(--muted); font-size: 12px; }
.home-tabs { display: flex; gap: 24px; margin: 0 0 24px; border-bottom: 1px solid var(--line); }
.home-tab { position: relative; border: 0; background: transparent; padding: 0 0 12px; color: var(--muted); font-size: 13px; font-weight: 700; }
.home-tab.active { color: var(--ink); }
.home-tab.active::after { content: ''; position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--blue); }
.home-tab span { color: var(--blue); font: 11px "DM Mono", monospace; }
.jd-panel { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 22px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--navy); color: white; }
.jd-panel .kicker { color: var(--cyan); margin-bottom: 10px; }
.jd-panel h2 { margin-bottom: 8px; font-size: 24px; letter-spacing: -0.03em; }
.jd-panel p:not(.kicker) { max-width: 590px; margin: 0; color: oklch(0.86 0.04 230); font-size: 13px; line-height: 1.7; }
.jd-meta { min-width: 145px; padding-left: 20px; border-left: 1px solid oklch(0.8 0.04 230 / .25); }
.jd-meta span, .jd-meta small { display: block; color: oklch(0.75 0.04 230); font-size: 11px; }
.jd-meta strong { display: block; margin: 5px 0 9px; color: var(--cyan); font: 500 14px "DM Mono", monospace; }
.single-mode { grid-template-columns: minmax(0, 1fr); margin-bottom: 38px; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 38px; }
.mode-card { position: relative; min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; padding: 18px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .2s ease, transform .2s ease, background .2s ease; }
.mode-card:hover { transform: translateY(-2px); border-color: var(--blue); }
.mode-icon { font-size: 20px; }
.mode-card h3 { margin: 18px 0 5px; font-size: 16px; }
.mode-card p { margin: 0; color: var(--muted); font-size: 12px; }
.mode-arrow { align-self: flex-end; color: var(--blue); font-size: 20px; }
.mode-card.featured { background: var(--navy); color: white; border-color: var(--navy); }
.mode-card.featured p { color: oklch(0.85 0.04 230); }
.mode-card.featured .mode-arrow { color: var(--cyan); }
.review-strip { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-radius: var(--radius); background: oklch(0.88 0.09 182 / .35); }
.review-strip p { margin: 0; font-size: 13px; }
.review-strip small { color: var(--muted); display: block; margin-top: 3px; }
.primary-button, .secondary-button { border: 0; border-radius: 9px; padding: 11px 16px; font-weight: 700; font-size: 13px; }
.primary-button { background: var(--navy); color: white; }
.primary-button:hover { background: var(--blue); }
.secondary-button { background: var(--surface); border: 1px solid var(--line); }
.secondary-button:hover { border-color: var(--blue); }

.quiz-wrap { max-width: 700px; margin: 0 auto; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.back-button { border: 0; background: transparent; color: var(--muted); padding: 5px 0; font-size: 13px; }
.back-button:hover { color: var(--ink); }
.progress-meta { color: var(--muted); font: 12px/1 "DM Mono", monospace; }
.progress-track { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 30px; }
.progress-fill { height: 100%; background: var(--cyan); border-radius: inherit; transition: width .35s ease; }
.topic-label { display: inline-flex; gap: 7px; align-items: center; color: var(--blue); font: 500 11px/1 "DM Mono", monospace; letter-spacing: .04em; }
.topic-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.question-title { margin: 13px 0 24px; font-size: clamp(22px, 4vw, 31px); line-height: 1.25; letter-spacing: -0.025em; text-wrap: balance; }
.option-list { display: grid; gap: 10px; }
.option { width: 100%; display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: center; padding: 14px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); line-height: 1.45; font-size: 14px; transition: border-color .2s ease, background .2s ease; }
.option:hover:not(:disabled) { border-color: var(--blue); background: oklch(0.96 0.03 230); }
.option:disabled { cursor: default; }
.option-key { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); color: var(--muted); font: 500 12px/1 "DM Mono", monospace; }
.option.selected { border-color: var(--blue); background: oklch(0.94 0.06 230); }
.option.selected .option-key { background: var(--blue); color: white; }
.option.correct { border-color: var(--lime); background: oklch(0.94 0.11 125 / .28); }
.option.correct .option-key { background: var(--lime); color: var(--navy); }
.option.wrong { border-color: var(--coral); background: oklch(0.95 0.07 30 / .25); }
.option.wrong .option-key { background: var(--coral); color: white; }
.feedback { margin-top: 20px; padding: 18px; border-radius: var(--radius); background: var(--navy); color: white; animation: appear .25s ease-out; }
.feedback-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-weight: 800; }
.feedback-head.good { color: var(--lime); }
.feedback-head.bad { color: #ff9c87; }
.feedback p { margin: 0; color: oklch(0.88 0.035 230); font-size: 13px; line-height: 1.7; }
.feedback .command { margin-top: 10px; color: var(--cyan); font: 12px/1.5 "DM Mono", monospace; }
.quiz-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.quiz-actions .primary-button:disabled { opacity: .45; cursor: not-allowed; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0 34px; }
.stat { padding: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.stat b { display: block; margin-bottom: 5px; font-size: 25px; letter-spacing: -0.04em; }
.stat span { color: var(--muted); font-size: 11px; }
.result-card { padding: 26px; background: var(--navy); color: white; border-radius: var(--radius); }
.result-card h2 { margin-bottom: 8px; font-size: 24px; }
.result-card p { color: oklch(0.84 0.035 230); font-size: 13px; line-height: 1.65; }
.result-score { display: flex; align-items: end; gap: 10px; margin: 22px 0; }
.result-score strong { color: var(--cyan); font-size: 52px; line-height: .9; letter-spacing: -0.06em; }
.result-score span { color: oklch(0.83 0.035 230); font-size: 13px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.result-actions .primary-button { background: var(--cyan); color: var(--navy); }
.wrong-list { display: grid; gap: 9px; margin-top: 16px; }
.wrong-item { padding: 14px; display: flex; gap: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.wrong-item > span { flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: oklch(0.95 0.07 30 / .25); color: var(--danger); font-size: 12px; }
.wrong-item p { margin: 0; font-size: 13px; line-height: 1.5; }
.wrong-item small { display: block; color: var(--muted); margin-top: 4px; }
.empty-state { padding: 25px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }

body.dark { color-scheme: dark; --bg: oklch(0.17 0.035 235); --surface: oklch(0.22 0.04 240); --surface-2: oklch(0.27 0.04 240); --ink: oklch(0.94 0.02 230); --muted: oklch(0.72 0.035 230); --line: oklch(0.34 0.04 240); --shadow: none; }
body.dark .topbar, body.dark .mode-card, body.dark .option, body.dark .stat, body.dark .wrong-item, body.dark .quote-note, body.dark .secondary-button { background: var(--surface); }
body.dark .mode-card:hover, body.dark .option:hover:not(:disabled) { background: oklch(0.27 0.06 235); }

@keyframes appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
@media (max-width: 680px) {
  .topbar { height: 64px; padding: 0 18px; }
  .streak-chip { padding: 7px 9px; }
  .main-content { width: min(100% - 28px, 620px); padding-top: 30px; }
  .hero { grid-template-columns: 1fr; gap: 20px; margin-bottom: 30px; }
  .jd-panel { grid-template-columns: 1fr; gap: 17px; }
  .jd-meta { padding-top: 14px; padding-left: 0; border-top: 1px solid oklch(0.8 0.04 230 / .25); border-left: 0; }
  h1 { font-size: 39px; }
  .mode-grid { grid-template-columns: 1fr; gap: 9px; }
  .mode-card { min-height: 110px; }
  .mode-card h3 { margin-top: 10px; }
  .review-strip { align-items: flex-start; flex-direction: column; }
  .stats-grid { gap: 7px; }
  .stat { padding: 12px 10px; }
  .stat b { font-size: 21px; }
  .result-card { padding: 20px; }
}
