:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --surface: #fff;
  --surface-alt: #f5f5f9;
  --ink: #202124;
  --text: #202124;
  --muted: #686b74;
  --line: #dedee5;
  --blue: #0066d6;
  --blue-soft: #e8f1ff;
  --green: #237344;
  --green-soft: #eaf6ee;
  --red: #b73335;
  --red-soft: #fff0ef;
  --orange: #865b1a;
  --orange-soft: #fff4df;
  --purple: #7751b5;
  --purple-soft: #f1ebfc;
  --glass: #f2f2f7ed;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --surface: #1c1c1e;
    --surface-alt: #29292d;
    --ink: #f5f5f7;
    --text: #f5f5f7;
    --muted: #adaeb8;
    --line: #3a3a3f;
    --blue: #78b5ff;
    --blue-soft: #132d4b;
    --green: #7bdfa0;
    --green-soft: #153222;
    --red: #ff9b96;
    --red-soft: #3b2022;
    --orange: #efc277;
    --orange-soft: #382c18;
    --purple: #c7a5ff;
    --purple-soft: #2e2341;
    --glass: #000000e8;
  }
}
html, body { background: var(--bg); color: var(--ink); }
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 16px; line-height: 1.65; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea, summary { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
input, select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-height: 44px; font-size: 16px; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
h1, h2, h3 { color: var(--ink); }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
.muted, .small, .tiny, .page-desc, .section-title p, .setting-row p, .collection-meta, .collection-group, .source-table, .source-table th, .exam-description p, .dialog-description, .modal-summary, .dialog .config-label, .dialog label.field, .result-label, .result-stat span, .result-hero p, .footnote, .notice, .legend, .storage-alert, .checkbox-label { font-size: 13px; color: var(--muted); }
.green { color: var(--green); }
.red { color: var(--red); }
.blue { color: var(--blue); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.main-wrap { margin-left: 208px; }
.main { max-width: 1056px; padding: 36px 32px 56px; }
.topbar { height: 76px; padding: 0 32px; background: transparent; border: 0; display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.sidebar { width: 208px; background: var(--surface); border-right: 1px solid var(--line); padding: 26px 18px; }
.brand { gap: 10px; padding: 0 12px; color: var(--ink); }
.brand-name { font-size: 23px; letter-spacing: -.6px; }
.brand-symbol { width: 38px; height: 38px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); box-shadow: none; }
.nav-list { margin-top: 38px; gap: 8px; }
.nav-item { min-height: 48px; font-size: 15px; border-radius: 12px; color: var(--muted); }
.nav-item.active { color: var(--blue); background: var(--blue-soft); }
.nav-item:hover:not(.active) { background: var(--surface-alt); color: var(--ink); }
.mobile-header, .mobile-nav { display: none; }
.page-heading { margin-bottom: 24px; gap: 16px; }
.page-heading h1 { font-size: 28px; letter-spacing: -.8px; line-height: 1.4; }
.page-desc { margin-top: 10px; max-width: 650px; line-height: 1.8; }
.primary, .secondary, .ghost, .danger, .text-link { min-height: 44px; border-radius: 12px; font-size: 14px; padding: 10px 18px; gap: 8px; box-shadow: none; }
.primary { background: #0066d6; color: #fff; border: 1px solid transparent; }
.primary:hover { background: #0058ba; }
.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.secondary:hover, .ghost:hover { background: var(--surface-alt); }
.ghost, .text-link { color: var(--blue); background: transparent; }
.text-link { padding-inline: 10px; font-size: 13px; }
.danger { color: var(--red); background: var(--red-soft); }
.icon-btn, .mobile-header .icon-btn, .collection-card > .icon-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; background: transparent; border: 0; color: var(--muted); border-radius: 12px; position: relative; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { color: var(--ink); background: var(--surface-alt); }
.icon-btn.active { color: var(--orange); background: var(--orange-soft); }
.icon-btn.active svg { fill: currentColor; }
.has-note { color: var(--blue); }
.has-note::after { content: ""; position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); border: 2px solid var(--surface); }
.home-content { display: grid; gap: 28px; }
.continue-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; width: 100%; min-height: 90px; padding: 24px; border-radius: 20px; background: #0066d6; color: #fff; text-align: left; font-size: 20px; font-weight: 600; line-height: 1.55; }
.continue-card > svg { width: 24px; min-width: 24px; }
.minimal-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; margin: 0; padding: 10px 0; }
.minimal-stats > div { display: flex; flex-direction: column-reverse; }
.minimal-stats > div + div { border-left: 1px solid var(--line); }
.minimal-stats dt { font-size: 13px; color: var(--muted); margin-top: 4px; }
.minimal-stats dd { font-size: 28px; line-height: 1.35; font-weight: 650; font-variant-numeric: tabular-nums; margin: 0; letter-spacing: -.8px; }
.subject-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.subject-card.subject-row { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 88px; padding: 20px; border: 0; border-radius: 16px; text-align: left; background: var(--surface); color: var(--ink); transform: none; }
.subject-row:hover { background: var(--surface-alt); }
.subject-row > .grow { min-width: 0; }
.subject-row > svg { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; }
.subject-name { display: block; font-size: 17px; font-weight: 600; letter-spacing: 0; }
.subject-description { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; max-width: none; }
.subject-icon { width: 44px; height: 44px; min-width: 44px; border-radius: 13px; background: var(--blue-soft); color: var(--blue); }
.subject-icon.service { background: var(--green-soft); color: var(--green); }
.subject-icon.regulations { background: var(--orange-soft); color: var(--orange); }
.subject-icon.english { background: var(--purple-soft); color: var(--purple); }
.outline-entry { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 24px; padding: 18px 20px; min-height: 64px; background: var(--surface); border-radius: 16px; text-align: left; font-size: 16px; }
.outline-entry span { display: inline-flex; align-items: center; gap: 12px; }
.outline-entry svg { width: 20px; height: 20px; }
.panel, .empty, .outline-card, .collection-card { background: var(--surface); border: 0; border-radius: 18px; padding: 24px; }
.filter-bar { gap: 10px; }
.filter-bar select { font-size: 14px; max-width: 210px; }
.search-field input { font-size: 16px; min-height: 46px; }
.search-field > svg { color: var(--muted); }
.tag, .collection-card .tag { font-size: 13px; line-height: 1.65; padding: 3px 8px; color: var(--muted); background: var(--surface-alt); }
.tag.blue { color: var(--blue); background: var(--blue-soft); }
.tag.green { color: var(--green); background: var(--green-soft); }
.tag.orange { color: var(--orange); background: var(--orange-soft); }
.tag.purple { color: var(--purple); background: var(--purple-soft); }
.review-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 4px; background: var(--line); border-radius: 13px; margin-bottom: 24px; }
.review-tabs button { min-height: 44px; border-radius: 10px; font-size: 15px; background: transparent; color: var(--muted); }
.review-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px #0000000d; }
.review-tabs button span { margin-left: 8px; font-size: 13px; }
.collection-card { gap: 12px; }
.collection-question { min-height: 44px; font-size: 16px; color: var(--ink); line-height: 1.8; }
.collection-meta { gap: 8px; margin-top: 10px; }
.question-index { width: 32px; height: 32px; color: var(--muted); background: var(--surface-alt); font-size: 13px; }
.note-preview { font-size: 14px; color: var(--muted); background: var(--surface-alt); border-color: var(--line); }
.empty h3 { font-size: 18px; }
.empty p { font-size: 14px; color: var(--muted); }
.empty-icon { background: var(--blue-soft); color: var(--blue); }
.choice-radio span { min-height: 48px; font-size: 14px; background: var(--surface); }
.choice-radio input:checked + span { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.choice-radio span svg, .exam-description svg { color: var(--muted); }
.choice-radio span .tiny { border: 0; padding: 0; min-height: 0; }
.config-label, .config-label span { font-size: 14px; }
.notice.info { background: var(--blue-soft); border: 0; color: var(--blue); }
.outline-card summary { min-height: 44px; font-size: 16px; }
.outline-card summary svg, .outline-card li::marker { color: var(--muted); }
.outline-card ol { font-size: 15px; color: var(--ink); line-height: 1.9; }
.setting-row h3 { font-size: 15px; }
.setting-row > select { font-size: 16px; }
.settings-actions .primary, .settings-actions .secondary { font-size: 14px; }
.switch { min-width: 51px; min-height: 44px; display: flex; align-items: center; }
.switch span { position: relative; width: 51px; height: 31px; background: var(--line); }
.switch span::before { top: 3px; left: 3px; width: 25px; height: 25px; box-shadow: 0 1px 4px #0002; }
.switch input:checked + span { background: #248544; }
.switch input:checked + span::before { transform: translateX(20px); }
.source-table th, .source-table td { padding-block: 12px; }
.session-active .main-wrap { margin: 0; }
.session-active .main { max-width: 860px; padding: 0 24px 32px; }
.study-toolbar { position: sticky; top: 0; z-index: 12; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 0; min-height: 76px; padding-block: 8px; background: var(--glass); backdrop-filter: blur(20px); }
.study-toolbar .ghost { padding-inline: 8px; font-size: 16px; }
.study-toolbar .ghost:first-child { justify-self: start; }
.study-toolbar .ghost:last-child { justify-self: end; }
.study-position { font-size: 15px; font-weight: 550; font-variant-numeric: tabular-nums; }
.exam-timer { display: flex; justify-content: center; margin-bottom: 12px; }
.timer-pill { background: var(--surface); color: var(--muted); border-color: var(--line); font-size: 14px; }
.timer-pill.urgent { color: var(--red); background: var(--red-soft); border-color: var(--red); }
.question-card { background: var(--surface); border: 0; border-radius: 20px; }
.question-card-head { justify-content: flex-end; gap: 4px; border: 0; padding: 8px 16px 0; min-height: 52px; }
.question-body { padding: 8px 28px 28px; }
.question-text, .question-text.english { font-size: 18px; line-height: 1.85; font-weight: 550; letter-spacing: 0; }
.options { margin-top: 24px; gap: 12px; }
.option { background: var(--surface); color: var(--ink); border-color: var(--line); font-size: 16px; min-height: 60px; padding: 14px 16px; line-height: 1.75; border-radius: 14px; gap: 14px; }
.option:hover:not(:disabled) { background: var(--surface-alt); border-color: var(--blue); }
.option-letter { width: 30px; height: 30px; font-size: 14px; color: var(--muted); border-color: var(--line); }
.option.selected { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }
.option.selected .option-letter { color: #fff; background: #0066d6; border-color: #0066d6; }
.option.correct { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.option.correct .option-letter { color: #fff; background: #237344; border-color: #237344; }
.option.wrong { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.option.wrong .option-letter { color: #fff; background: #b73335; border-color: #b73335; }
.option:disabled:not(.correct):not(.wrong) { opacity: 1; }
.session-main[data-font="large"] .question-text { font-size: 22px; }
.session-main[data-font="large"] .option { font-size: 18px; }
.session-main[data-font="larger"] .question-text { font-size: 25px; }
.session-main[data-font="larger"] .option { font-size: 20px; }
.multi-submit { background: var(--surface-alt); padding: 12px; gap: 12px; }
.multi-submit p { font-size: 13px; color: var(--muted); }
.answer-feedback { border-top: 1px solid var(--line); padding-top: 22px; }
.verdict { font-size: 15px; }
.answer-summary { background: var(--surface-alt); font-size: 16px; padding: 14px 16px; gap: 18px; }
.answer-summary span { font-size: 13px; color: var(--muted); }
.analysis-text { color: var(--ink); font-size: 16px; line-height: 1.85; }
.empty-analysis { color: var(--muted); font-size: 13px; }
.source-note { background: var(--orange-soft); color: var(--orange); font-size: 13px; line-height: 1.8; }
.note-inline { background: var(--surface-alt); border: 0; padding: 14px 16px; }
.note-inline p { font-size: 15px; line-height: 1.85; color: var(--ink); }
.source-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.question-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px 28px; border-color: var(--line); background: var(--surface); }
.question-footer button { min-height: 48px; min-width: 0; font-size: 15px; }
.result-hero { background: var(--blue-soft); border: 0; }
.result-hero p, .result-score span { color: var(--muted); font-size: 14px; }
.result-label { letter-spacing: 0; }
.result-score { color: var(--blue); }
.result-stats { background: var(--surface); border: 0; }
.result-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 10px; }
.sheet-cell { min-height: 44px; font-size: 14px; color: var(--muted); background: var(--surface-alt); border-color: var(--line); border-radius: 10px; }
.sheet-cell.current { outline-color: var(--blue); }
.sheet-cell.right { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.sheet-cell.wrong { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.sheet-cell.answered { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.legend { gap: 16px; }
.legend i { background: var(--line); width: 9px; height: 9px; }
.legend .right i { background: var(--green); }
.legend .wrong i { background: var(--red); }
.legend .answered i { background: var(--blue); }
.dialog-overlay { background: #0007; backdrop-filter: blur(6px); }
.dialog { background: var(--surface); border: 0; border-radius: 24px; box-shadow: 0 24px 80px #0003; max-height: 88dvh; }
.dialog-head { padding: 16px 24px; border-color: var(--line); }
.dialog-head h2 { font-size: 19px; }
.dialog-body { padding: 24px; }
.dialog-footer { padding: 16px 24px; background: var(--surface); border-color: var(--line); }
.dialog label.field { font-size: 14px; }
.dialog label.field input, .dialog label.field select, .dialog label.field textarea { font-size: 16px; }
.dialog .result-grid { max-height: 48dvh; padding: 4px; }
.modal-summary { background: var(--surface-alt); font-size: 13px; gap: 22px; }
.modal-summary strong { color: var(--ink); font-size: 23px; }
.toast { color: var(--surface); background: var(--ink); font-size: 14px; border-radius: 16px; }
.storage-alert { background: var(--orange-soft); color: var(--orange); }
.boot-message { color: var(--muted); }
@media (max-width: 700px) {
  .sidebar, .topbar { display: none; }
  .main-wrap { margin: 0; }
  .main { padding: 20px 20px calc(104px + env(safe-area-inset-bottom)); }
  .mobile-header { display: flex; min-height: 64px; height: auto; padding: 10px 16px; background: var(--bg); border: 0; }
  .mobile-header .brand { padding: 0; gap: 10px; }
  .mobile-header .brand-symbol { width: 34px; height: 34px; border-radius: 11px; }
  .mobile-header .brand-name { font-size: 22px; }
  .mobile-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--glass); padding: 8px 12px max(8px, env(safe-area-inset-bottom)); border-color: var(--line); backdrop-filter: blur(20px); }
  .mobile-nav button { min-height: 52px; border-radius: 12px; font-size: 13px; color: var(--muted); padding: 6px 0; gap: 3px; }
  .mobile-nav button svg { width: 22px; height: 22px; }
  .mobile-nav button.active { background: var(--blue-soft); color: var(--blue); font-weight: 550; }
  .mobile-nav button.active::before { display: none; }
  .home-content { gap: 24px; }
  .continue-card { min-height: 84px; font-size: 18px; padding: 20px; border-radius: 18px; }
  .minimal-stats { padding: 4px 0; }
  .minimal-stats dd { font-size: 26px; }
  .subject-card.subject-row { padding: 16px; min-height: 82px; gap: 12px; }
  .subject-name { font-size: 16px; }
  .page-heading h1 { font-size: 26px; }
  .page-heading { align-items: center; }
  .page-heading > .primary { padding: 10px 12px; flex-shrink: 0; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .search-field { min-width: 100%; }
  .filter-bar select { max-width: none; font-size: 14px; }
  .panel, .empty, .outline-card, .collection-card { padding: 18px; border-radius: 16px; }
  .collection-card { gap: 8px; }
  .collection-card .question-index { display: none; }
  .collection-question { font-size: 16px; }
  .collection-meta { font-size: 13px; }
  .subject-choices { grid-template-columns: 1fr; }
  .choice-radio span { font-size: 15px; }
  .choice-radio span .tiny { font-size: 13px; }
  .config-selects { gap: 12px; }
  .exam-layout .panel, .settings-grid .panel { padding: 20px; }
  .setting-row { gap: 12px; }
  .outline-card summary { font-size: 15px; }
  .outline-card ol { font-size: 15px; }
  .session-active .main { padding: 0 16px calc(102px + env(safe-area-inset-bottom)); }
  .study-toolbar { min-height: 64px; padding-top: max(8px, env(safe-area-inset-top)); gap: 8px; }
  .question-card { border-radius: 18px; }
  .question-card-head { padding: 4px 12px 0; min-height: 50px; }
  .question-body { padding: 8px 20px 22px; }
  .question-text, .question-text.english { font-size: 18px; line-height: 1.85; }
  .option { font-size: 16px; padding: 13px 14px; gap: 12px; }
  .option-letter { width: 28px; height: 28px; font-size: 14px; }
  .question-footer { position: fixed; left: 16px; right: 16px; bottom: 0; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); border: 0; background: var(--glass); backdrop-filter: blur(20px); z-index: 14; gap: 12px; }
  .question-footer button { min-height: 50px; font-size: 15px; }
  .answer-summary span { font-size: 13px; margin-right: 8px; }
  .multi-submit .primary { font-size: 14px; min-height: 44px; padding: 10px 14px; }
  .multi-submit p, .source-note { font-size: 13px; }
  .dialog-overlay { align-items: flex-end; padding: 12px; }
  .dialog { max-width: 100%; max-height: calc(100dvh - 24px); border-radius: 24px; }
  .dialog-head { padding: 14px 20px; position: relative; touch-action: none; cursor: grab; }
  .dialog-head::before { content: ""; position: absolute; top: 6px; left: calc(50% - 18px); height: 4px; width: 36px; border-radius: 4px; background: var(--line); }
  .dialog-body { padding: 20px; }
  .dialog-footer { padding: 14px 20px max(14px, env(safe-area-inset-bottom)); }
  .dialog-footer .primary, .dialog-footer .secondary, .dialog-footer .danger { font-size: 14px; min-height: 44px; padding: 10px 16px; }
  .dialog-description, .dialog label.field { font-size: 14px; }
  .result-stat span { font-size: 13px; }
  .result-stat strong { font-size: 24px; }
  .result-actions button { font-size: 14px; }
  .toast, .session-active .toast { bottom: calc(88px + env(safe-area-inset-bottom)); font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
