:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #edf1ef;
  --surface-3: #e5ebe8;
  --text: #18211d;
  --text-2: #5d6963;
  --border: #d7dfdb;
  --border-strong: #aab8b1;
  --primary: #176b55;
  --primary-strong: #105343;
  --primary-soft: #e5f2ed;
  --accent: #a76716;
  --accent-soft: #fff3d9;
  --danger: #bd433b;
  --danger-soft: #faecea;
  --shadow-sm: 0 1px 2px rgba(19, 34, 27, 0.06);
  --shadow-md: 0 8px 24px rgba(19, 34, 27, 0.08);
  --radius-sm: 4px;
  --radius-md: 8px;
  --sidebar-width: 232px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111614;
  --surface: #181f1c;
  --surface-2: #202925;
  --surface-3: #29342f;
  --text: #eef3f0;
  --text-2: #a9b5af;
  --border: #303b36;
  --border-strong: #56655e;
  --primary: #4cb18f;
  --primary-strong: #6bc5a6;
  --primary-soft: #17382e;
  --accent: #e4ad59;
  --accent-soft: #3d311d;
  --danger: #ef8179;
  --danger-soft: #412522;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--bg); line-height: 1.5; }
button, input { font: inherit; }
button { color: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 34%, transparent); outline-offset: 2px; }
.icon { display: block; flex: 0 0 auto; }
.page-width { width: min(1080px, calc(100% - 48px)); margin-inline: auto; }
.loading, .fatal { min-height: 100dvh; display: grid; place-content: center; padding: 24px; text-align: center; color: var(--text-2); }
.fatal h1 { color: var(--text); }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--text); color: var(--surface); text-decoration: none; }
.skip-link:focus { top: 16px; }

/* App shell */
.app-shell { min-height: 100dvh; padding-left: var(--sidebar-width); }
.app-stage { min-width: 0; min-height: 100dvh; }
.app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar-width); padding: 24px 16px 18px; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); }
.brand { min-height: 44px; border: 0; background: transparent; display: flex; align-items: center; gap: 11px; padding: 4px 6px; cursor: pointer; text-align: left; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 6px; background: var(--primary); color: #fff; font-weight: 800; }
.brand strong, .brand small { display: block; letter-spacing: 0; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 1px; color: var(--text-2); font-size: 11px; }
.primary-nav { display: grid; gap: 4px; margin-top: 34px; }
.nav-link { min-height: 46px; border: 0; border-radius: 6px; padding: 0 12px; display: flex; align-items: center; gap: 11px; background: transparent; color: var(--text-2); cursor: pointer; text-align: left; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav-icon { width: 22px; height: 22px; display: grid; place-items: center; position: relative; }
.count-badge { position: absolute; top: -7px; right: -11px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; border: 2px solid var(--surface); border-radius: 9px; background: var(--danger); color: #fff; font-size: 9px; line-height: 1; }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.bank-status { padding: 12px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.bank-status > span { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--primary); }
.bank-status strong, .bank-status small { display: block; }
.bank-status strong { font-size: 12px; }
.bank-status small { color: var(--text-2); font-size: 10px; }
.theme-toggle { min-height: 44px; border: 0; border-radius: 6px; padding: 0 12px; display: flex; align-items: center; gap: 10px; background: transparent; color: var(--text-2); cursor: pointer; }
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.mobile-header, .mobile-nav { display: none; }
.shell-focus { padding-left: 0; }
.shell-focus .app-sidebar, .shell-focus .mobile-header, .shell-focus .mobile-nav { display: none; }

/* Home */
.home-page { padding-block: 44px 64px; }
.home-header { min-height: 106px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--border); }
.home-header h1, .library-header h1, .result-copy h1 { margin: 5px 0 7px; letter-spacing: 0; line-height: 1.18; }
.home-header h1 { font-size: 31px; }
.home-header p, .library-header p, .result-copy p { margin: 0; color: var(--text-2); }
.eyebrow { color: var(--primary); font-size: 11px; font-weight: 800; }
.header-visual { width: 132px; height: 90px; object-fit: contain; opacity: 0.92; }
.metrics-strip { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--border); }
.metrics-strip > div { min-height: 88px; padding: 18px 24px; display: flex; align-items: baseline; gap: 5px; border-right: 1px solid var(--border); }
.metrics-strip > div:first-child { padding-left: 0; }
.metrics-strip > div:last-child { border-right: 0; }
.metrics-strip span { align-self: center; margin-right: auto; color: var(--text-2); font-size: 12px; }
.metrics-strip strong { font-size: 25px; font-variant-numeric: tabular-nums; }
.metrics-strip small { color: var(--text-2); font-size: 11px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr); gap: 44px; padding-top: 36px; }
.setup-panel, .recent-panel { min-width: 0; }
.recent-panel { padding-left: 32px; border-left: 1px solid var(--border); }
.section-heading { margin-bottom: 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading > div:first-child { display: flex; align-items: center; gap: 9px; }
.section-heading h2 { margin: 0; font-size: 19px; letter-spacing: 0; }
.section-heading.compact h2 { font-size: 17px; }
.section-index { color: var(--accent); font-size: 10px; font-weight: 800; }
.question-total { padding: 5px 9px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 700; }
fieldset { margin: 0 0 24px; padding: 0; border: 0; }
legend { margin-bottom: 10px; color: var(--text-2); font-size: 12px; font-weight: 700; }
.choice-grid { display: grid; gap: 8px; }
.source-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.source-option { min-height: 78px; border: 1px solid var(--border); border-radius: 6px; padding: 14px; display: flex; align-items: flex-start; gap: 9px; background: var(--surface); cursor: pointer; text-align: left; }
.source-option:hover { border-color: var(--border-strong); }
.source-option.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.source-option strong, .source-option small, .segmented strong, .segmented span, .switch-row strong, .switch-row small { display: block; }
.source-option strong { font-size: 14px; }
.source-option small { margin-top: 4px; color: var(--text-2); font-size: 10px; line-height: 1.45; }
.radio-dot { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); }
.source-option.selected .radio-dot { border: 5px solid var(--primary); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 6px; background: var(--surface-2); }
.segmented button { min-height: 56px; border: 0; border-radius: var(--radius-sm); padding: 9px 13px; background: transparent; cursor: pointer; text-align: left; }
.segmented button.selected { background: var(--surface); box-shadow: var(--shadow-sm); }
.segmented strong { font-size: 13px; }
.segmented span { margin-top: 2px; color: var(--text-2); font-size: 10px; }
.setup-row { margin-bottom: 22px; padding-block: 17px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; border-block: 1px solid var(--border); }
.count-control > label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 700; }
.count-control.muted { opacity: 0.5; }
.stepper { width: 150px; height: 42px; display: grid; grid-template-columns: 42px 66px 42px; }
.stepper button, .stepper input { min-width: 0; border: 1px solid var(--border); background: var(--surface); text-align: center; }
.stepper button { cursor: pointer; font-size: 17px; }
.stepper button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.stepper button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.stepper input { width: 66px; border-inline: 0; appearance: textfield; }
.switch-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; cursor: pointer; }
.switch-row strong { font-size: 12px; }
.switch-row small { margin-top: 3px; color: var(--text-2); font-size: 10px; line-height: 1.45; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 44px; height: 24px; padding: 3px; border-radius: 12px; background: var(--border-strong); transition: background 160ms ease; }
.switch::after { content: ""; width: 18px; height: 18px; display: block; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 160ms ease; }
.switch-row input:checked + .switch { background: var(--primary); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.primary-action { width: 100%; min-height: 50px; border: 0; border-radius: 6px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; }
.primary-action > span { display: flex; align-items: center; gap: 9px; }
.primary-action:hover, .primary-button:hover, .submit-button:hover { background: var(--primary-strong); }
.resume-banner { margin-bottom: 22px; padding: 13px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.resume-banner strong, .resume-banner span { display: block; }
.resume-banner span { margin-top: 2px; color: var(--text-2); font-size: 11px; }
.resume-banner > div:last-child { display: flex; gap: 7px; }
.text-button, .danger-text { min-height: 36px; border: 0; background: transparent; cursor: pointer; font-size: 11px; }
.text-button { color: var(--primary); }
.danger-text { color: var(--danger); }
.history-list, .history-table { display: grid; gap: 7px; }
.history-row { width: 100%; min-height: 66px; border: 1px solid transparent; border-radius: 6px; padding: 9px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto 18px; gap: 10px; align-items: center; background: transparent; cursor: pointer; text-align: left; }
.history-row:hover { border-color: var(--border); background: var(--surface); }
.history-score { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--danger-soft); color: var(--danger); font-size: 12px; font-weight: 800; }
.history-score.good { background: var(--primary-soft); color: var(--primary); }
.history-score.medium { background: var(--accent-soft); color: var(--accent); }
.history-row strong, .history-row small { display: block; overflow-wrap: anywhere; }
.history-row strong { font-size: 12px; }
.history-row small { margin-top: 3px; color: var(--text-2); font-size: 10px; }
.history-result { text-align: right; }
.wrong-book-link { width: 100%; min-height: 64px; margin-top: 16px; padding: 14px 2px; display: flex; align-items: center; justify-content: space-between; border: 0; border-top: 1px solid var(--border); background: transparent; cursor: pointer; text-align: left; }
.wrong-book-link strong, .wrong-book-link small { display: block; }
.wrong-book-link small { margin-top: 3px; color: var(--text-2); font-size: 11px; }
.empty-state { min-height: 132px; padding: 25px; display: grid; place-content: center; border: 1px dashed var(--border-strong); border-radius: 6px; color: var(--text-2); text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { margin-bottom: 5px; color: var(--text); }
.empty-state span { font-size: 11px; }

/* Quiz */
.quiz-page { min-height: 100dvh; background: var(--bg); }
.quiz-toolbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.quiz-toolbar > div, .icon-text-button, .primary-button, .secondary-button, .confirm-answer { display: flex; align-items: center; justify-content: center; gap: 7px; }
.icon-text-button { min-height: 42px; border: 0; padding: 0 4px; background: transparent; color: var(--text-2); cursor: pointer; }
.toolbar-divider { width: 1px; height: 18px; background: var(--border); }
.mode-tag { padding: 4px 7px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); font-size: 10px; }
.toolbar-meta #elapsed { color: var(--text-2); font-variant-numeric: tabular-nums; }
.submit-button { min-height: 38px; border: 0; border-radius: var(--radius-sm); padding: 0 17px; background: var(--primary); color: #fff; cursor: pointer; }
.progress-track { height: 3px; background: var(--surface-3); }
.progress-track span { height: 100%; display: block; background: var(--primary); transition: width 160ms ease; }
.quiz-layout { padding-block: 30px 52px; display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 26px; }
.question-workspace { min-height: 590px; padding: 30px 36px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.question-meta { display: flex; justify-content: space-between; color: var(--text-2); font-size: 11px; }
.question-meta span:last-child { color: var(--primary); font-weight: 700; }
.question-title { margin: 20px 0 25px; font-size: 21px; line-height: 1.65; letter-spacing: 0; }
.options { display: grid; gap: 10px; }
.option-row { width: 100%; min-height: 56px; border: 1px solid var(--border); border-radius: 6px; padding: 10px 13px; display: grid; grid-template-columns: 32px minmax(0, 1fr) 22px; gap: 11px; align-items: center; background: var(--surface); cursor: pointer; text-align: left; }
.option-row:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); }
.option-row.selected, .option-row.correct { border-color: var(--primary); background: var(--primary-soft); }
.option-row.incorrect { border-color: var(--danger); background: var(--danger-soft); }
.option-control { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: var(--text-2); font-size: 11px; font-weight: 800; }
.option-control.checkbox { border-radius: var(--radius-sm); }
.option-row.selected .option-control { border-color: var(--primary); background: var(--primary); color: #fff; }
.option-text { min-width: 0; line-height: 1.55; overflow-wrap: anywhere; }
.option-result { color: var(--primary); font-size: 19px; font-weight: 800; text-align: center; }
.option-result.wrong { color: var(--danger); }
.feedback { margin-top: 18px; padding: 14px 16px; border-left: 3px solid var(--primary); background: var(--primary-soft); }
.feedback.error { border-left-color: var(--danger); background: var(--danger-soft); }
.feedback > div { display: flex; justify-content: space-between; gap: 18px; }
.feedback span, .feedback p { color: var(--text-2); font-size: 12px; }
.feedback p { margin: 8px 0 0; }
.question-actions { margin-top: 30px; padding-top: 20px; display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); }
.question-actions > div { display: flex; gap: 8px; }
.primary-button, .secondary-button, .confirm-answer { min-height: 42px; border-radius: var(--radius-sm); padding: 0 15px; cursor: pointer; }
.primary-button { border: 0; background: var(--primary); color: #fff; }
.secondary-button { border: 1px solid var(--border); background: var(--surface); }
.confirm-answer { border: 1px solid var(--primary); background: var(--surface); color: var(--primary); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.question-map { position: sticky; top: 24px; align-self: start; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.map-heading { display: flex; justify-content: space-between; }
.map-heading span { color: var(--text-2); font-size: 11px; }
.map-legend { margin: 11px 0 14px; display: flex; gap: 13px; color: var(--text-2); font-size: 10px; }
.map-legend span { display: flex; align-items: center; gap: 5px; }
.map-legend i { width: 9px; height: 9px; border: 1px solid var(--border); border-radius: 2px; }
.map-legend i.done { border-color: var(--primary); background: var(--primary-soft); }
.number-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.number-grid button { min-width: 0; aspect-ratio: 1; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font-size: 10px; cursor: pointer; }
.number-grid button.answered { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.number-grid button.current { box-shadow: 0 0 0 2px var(--text); }
.number-grid button.right { background: var(--primary); color: #fff; }
.number-grid button.wrong { border-color: var(--danger); background: var(--danger); color: #fff; }

/* Results and libraries */
.result-summary { padding: 40px max(28px, calc((100vw - 1000px) / 2)); display: grid; grid-template-columns: 128px minmax(0, 1fr) auto; align-items: center; gap: 30px; border-bottom: 1px solid var(--border); background: var(--surface); }
.score-ring { width: 122px; height: 122px; display: grid; place-items: center; border: 10px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; }
.score-ring div { text-align: center; }
.score-ring strong, .score-ring span { display: block; }
.score-ring strong { font-size: 30px; }
.score-ring span { color: var(--text-2); font-size: 10px; }
.result-copy h1 { font-size: 30px; }
.result-stats { margin-top: 16px; display: flex; gap: 22px; }
.result-stats span { color: var(--text-2); font-size: 11px; }
.result-stats strong { color: var(--text); font-size: 15px; }
.result-actions { display: flex; gap: 8px; }
.review-section { padding-block: 38px 64px; }
.filter-tabs { padding: 3px; display: flex; gap: 3px; border: 1px solid var(--border); border-radius: 6px; }
.filter-tabs button { min-height: 34px; border: 0; border-radius: var(--radius-sm); padding: 0 10px; background: transparent; color: var(--text-2); cursor: pointer; font-size: 11px; }
.filter-tabs button.active { background: var(--text); color: var(--surface); }
.review-list { display: grid; gap: 10px; }
.review-item { display: grid; grid-template-columns: 120px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.review-status { padding: 21px 16px; background: var(--primary-soft); color: var(--primary); }
.review-item.is-wrong .review-status { background: var(--danger-soft); color: var(--danger); }
.review-status > span { width: 32px; height: 32px; display: grid; place-items: center; border: 2px solid currentColor; border-radius: 50%; font-size: 18px; font-weight: 800; }
.review-status small { display: block; margin-top: 12px; color: var(--text-2); font-size: 10px; line-height: 1.5; }
.review-content { min-width: 0; padding: 20px 23px; }
.review-meta { display: flex; justify-content: space-between; color: var(--text-2); font-size: 10px; }
.review-content h3 { margin: 8px 0 16px; font-size: 15px; line-height: 1.6; letter-spacing: 0; }
.review-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.review-options > div { min-height: 40px; padding: 8px 9px; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); font-size: 11px; }
.review-options > div.right { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.review-options > div.chosen-wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--text); }
.review-options em { color: var(--primary); font-size: 9px; font-style: normal; }
.review-options .chosen-wrong em { color: var(--danger); }
.library-page { padding-block: 42px 64px; }
.library-header { padding-bottom: 26px; display: flex; align-items: end; justify-content: space-between; gap: 26px; border-bottom: 1px solid var(--border); }
.library-header h1 { font-size: 32px; }
.bank-breakdown { padding: 14px 0; display: flex; gap: 22px; color: var(--text-2); font-size: 11px; }
.question-library { display: grid; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.question-library > div:not(.empty-state) { padding: 16px 19px; display: grid; grid-template-columns: 120px minmax(0, 1fr) 110px; gap: 18px; align-items: center; border-bottom: 1px solid var(--border); }
.question-library > div:last-child { border-bottom: 0; }
.question-library span, .question-library small { color: var(--text-2); font-size: 10px; }
.question-library strong { font-size: 12px; line-height: 1.55; }
.history-table { max-width: 780px; margin-top: 22px; }
.history-table .history-row { border-color: var(--border); background: var(--surface); }

dialog { width: min(420px, calc(100% - 32px)); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-md); }
dialog::backdrop { background: rgba(5, 10, 8, 0.55); }
dialog form { padding: 24px; }
dialog h2 { margin: 0 0 8px; font-size: 19px; }
dialog p { margin: 0; color: var(--text-2); line-height: 1.6; }
dialog form > div { margin-top: 22px; display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 980px) {
  .home-grid { grid-template-columns: 1fr; gap: 34px; }
  .recent-panel { padding: 30px 0 0; border-left: 0; border-top: 1px solid var(--border); }
  .quiz-layout { grid-template-columns: 1fr; }
  .question-map { position: static; order: -1; }
  .number-grid { grid-template-columns: repeat(10, 1fr); }
  .result-summary { grid-template-columns: 112px 1fr; }
  .result-actions { grid-column: 1 / -1; }
}

@media (max-width: 767px) {
  .page-width { width: min(100% - 28px, 1080px); }
  .app-shell { padding-left: 0; padding-bottom: 64px; }
  .app-sidebar { display: none; }
  .mobile-header { height: 58px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: var(--surface); }
  .mobile-header .brand { padding: 0; }
  .mobile-header .brand-mark { width: 30px; height: 30px; }
  .mobile-header .theme-toggle { width: 44px; padding: 0; justify-content: center; }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 40; height: 64px; padding: 4px max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left)); display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); background: var(--surface); box-shadow: 0 -4px 16px rgba(12, 24, 18, 0.07); }
  .mobile-nav .nav-link { min-height: 54px; padding: 4px; flex-direction: column; justify-content: center; gap: 2px; font-size: 10px; }
  .mobile-nav .nav-link.active { background: transparent; color: var(--primary); }
  .shell-focus { padding-bottom: 0; }
  .shell-focus .mobile-header, .shell-focus .mobile-nav { display: none; }
  .home-page { padding-block: 25px 42px; }
  .home-header { min-height: 100px; }
  .home-header h1 { font-size: 26px; }
  .home-header p { font-size: 12px; }
  .header-visual { width: 88px; height: 66px; }
  .metrics-strip > div { min-height: 72px; padding: 13px 10px; display: grid; align-content: center; gap: 0; }
  .metrics-strip > div:first-child { padding-left: 0; }
  .metrics-strip span { margin: 0; font-size: 10px; }
  .metrics-strip strong { font-size: 21px; }
  .metrics-strip small { display: none; }
  .home-grid { padding-top: 28px; }
  .source-grid, .setup-row { grid-template-columns: 1fr; }
  .source-option { min-height: 68px; }
  .setup-row { gap: 20px; }
  .resume-banner { align-items: flex-start; flex-direction: column; }
  .quiz-toolbar { min-height: 58px; }
  .quiz-toolbar strong, .mode-tag, .toolbar-divider { display: none; }
  .quiz-layout { width: 100%; padding-block: 0 32px; gap: 0; }
  .question-map { padding: 12px 14px; overflow-x: auto; border-inline: 0; border-radius: 0; scrollbar-width: thin; }
  .map-heading, .map-legend { display: none; }
  .number-grid { width: max-content; display: flex; }
  .number-grid button { width: 34px; height: 34px; aspect-ratio: auto; }
  .question-workspace { min-height: calc(100dvh - 95px); padding: 23px 16px; border: 0; border-radius: 0; box-shadow: none; }
  .question-title { margin-block: 16px 21px; font-size: 18px; }
  .option-row { min-height: 54px; grid-template-columns: 32px minmax(0, 1fr) 18px; padding-inline: 11px; }
  .question-actions { align-items: stretch; }
  .question-actions > div { flex: 1; display: grid; }
  .question-actions .primary-button { width: 100%; }
  .feedback > div { flex-direction: column; gap: 3px; }
  .result-summary { padding: 27px 16px; grid-template-columns: 82px minmax(0, 1fr); gap: 16px; }
  .score-ring { width: 80px; height: 80px; border-width: 7px; }
  .score-ring strong { font-size: 23px; }
  .result-copy h1 { font-size: 21px; }
  .result-copy p { font-size: 11px; }
  .result-stats { gap: 11px; }
  .result-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .review-section { padding-top: 27px; }
  .review-section .section-heading { align-items: flex-start; flex-direction: column; }
  .review-item { grid-template-columns: 1fr; }
  .review-status { padding: 10px 14px; display: flex; align-items: center; gap: 9px; }
  .review-status > span { width: 26px; height: 26px; font-size: 14px; }
  .review-status small { margin-top: 0; }
  .review-content { padding: 16px 14px; }
  .review-options { grid-template-columns: 1fr; }
  .library-page { padding-block: 28px 42px; }
  .library-header { align-items: flex-start; flex-direction: column; }
  .library-header h1 { font-size: 27px; }
  .question-library > div:not(.empty-state) { grid-template-columns: 1fr; gap: 6px; }
  .history-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .history-row > .icon { display: none; }
}

@media (max-width: 400px) {
  .header-visual { display: none; }
  .segmented button { padding-inline: 9px; }
  .question-actions { display: grid; grid-template-columns: auto 1fr; }
  .question-actions .secondary-button { padding-inline: 11px; }
  .result-stats { flex-wrap: wrap; }
  .bank-breakdown { gap: 12px; flex-wrap: wrap; }
}

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