:root {
  color-scheme: light;
  --ink: #251b35;
  --muted: #635a70;
  --accent: #5f36a1;
  --accent-dark: #482680;
  --lavender: #f1e9fa;
  --paper: #fff;
  --line: #e7deef;
  --background: #f8f5fc;
  font: 16px/1.6 "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--accent-dark); text-underline-offset: 0.2em; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #8354cd; outline-offset: 3px; }
.shell { width: min(100% - 2.25rem, 58rem); margin-inline: auto; }
.site-header { background: #ffffffd9; border-bottom: 1px solid var(--line); }
.topbar { min-height: 4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 750; text-decoration: none; }
.brand-icon { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; background: var(--accent); border-radius: 0.55rem; color: white; font: 750 1rem/1 system-ui, sans-serif; }
.back { font-size: 0.92rem; font-weight: 650; }
.home { padding-block: clamp(2.75rem, 9vw, 6rem); }
.home-intro { padding-bottom: 2.25rem; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.95rem, 6vw, 3.15rem); letter-spacing: -0.04em; line-height: 1.25; }
.home-intro p, .practice-intro p { margin-top: 0.7rem; color: var(--muted); }
.subject-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1rem; list-style: none; padding: 0; margin: 0; }
.subject-list li { min-width: 0; }
.subject-card { display: block; color: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 1.2rem; padding: clamp(1.25rem, 4vw, 1.8rem); text-decoration: none; height: 100%; box-shadow: 0 0.3rem 1.3rem #3b23550b; }
.subject-card:hover { border-color: #a579cf; }
.subject-card h2 { font-size: 1.38rem; }
.subject-card p { color: var(--muted); margin-top: 0.4rem; }
.subject-card .subject-count { color: var(--accent-dark); font-size: 0.96rem; font-weight: 700; margin-top: 1.15rem; }
.practice { max-width: 47rem; padding-block: 2.5rem 3.5rem; }
.practice-intro { margin-bottom: 1.55rem; }
.practice-intro h1 { font-size: clamp(1.85rem, 5vw, 2.75rem); }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; justify-content: space-between; margin-bottom: 1rem; }
.mode-group { display: inline-flex; background: var(--lavender); border-radius: 0.8rem; padding: 0.25rem; gap: 0.25rem; }
.mode-group button { color: var(--accent-dark); font-size: 0.94rem; font-weight: 650; background: none; border: 1px solid transparent; padding: 0.45rem 0.65rem; border-radius: 0.6rem; }
.mode-group button[aria-pressed="true"] { background: var(--paper); border-color: var(--line); box-shadow: 0 1px 2px #4b307318; }
.mode-group button:disabled, .chapter-field select:disabled { opacity: 0.6; }
#wrong-count { min-width: 1.45em; display: inline-block; text-align: center; font-variant-numeric: tabular-nums; }
.chapter-field { display: flex; gap: 0.55rem; align-items: center; color: var(--muted); font-size: 0.94rem; min-width: 0; }
.chapter-field label { flex: none; }
.select-wrap { position: relative; flex: 1; min-width: 0; }
.select-wrap::after { content: ""; width: 0.42rem; height: 0.42rem; border-right: 2px solid var(--accent-dark); border-bottom: 2px solid var(--accent-dark); transform: rotate(45deg); position: absolute; right: 1rem; top: 43%; pointer-events: none; }
.chapter-field select { appearance: none; width: 100%; min-height: 2.65rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 0.7rem; padding: 0.4rem 2.25rem 0.4rem 0.75rem; text-overflow: ellipsis; }
.question-card { background: var(--paper); border: 1px solid var(--line); box-shadow: 0 0.3rem 1.5rem #3b23550e; border-radius: 1.2rem; padding: clamp(1rem, 4vw, 1.85rem); }
.question-meta { display: flex; justify-content: space-between; gap: 0.65rem; color: var(--muted); font-size: 0.91rem; font-variant-numeric: tabular-nums; }
.progress-track { background: var(--lavender); height: 0.3rem; border-radius: 1rem; margin: 0.62rem 0 1.2rem; overflow: hidden; }
#progress-fill { height: 100%; border-radius: inherit; background: #8161b1; }
#origin { margin-bottom: 0.5rem; color: #704684; font-size: 0.92rem; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
legend { margin-bottom: 1rem; padding: 0; font-size: clamp(1.12rem, 3.5vw, 1.33rem); line-height: 1.55; font-weight: 720; }
#options { display: grid; gap: 0.58rem; }
.option { display: grid; grid-template-columns: 1rem 1.7rem minmax(0, 1fr); align-items: baseline; gap: 0.65rem; background: #fbf9fd; border: 1px solid var(--line); border-radius: 0.8rem; padding: 0.67rem 0.76rem; min-height: 2.9rem; cursor: pointer; overflow-wrap: anywhere; }
.option input { margin: 0; accent-color: var(--accent); align-self: center; }
.option .letter { font: 700 0.93rem/1.45 system-ui, sans-serif; color: var(--accent-dark); }
.option:has(input:checked:not(:disabled)) { background: #f0e7fc; border-color: #a780cb; }
.option:has(input:disabled) { cursor: default; }
.option.is-correct { background: #e8f7ed; border-color: #5c9670; }
.option.is-wrong { background: #fff0f0; border-color: #c47779; }
.actions { margin-top: 0.95rem; }
.primary { min-height: 2.75rem; border: 1px solid transparent; border-radius: 0.72rem; padding: 0.55rem 1.22rem; color: white; background: var(--accent); font-weight: 700; }
.primary:hover { background: var(--accent-dark); }
.primary:disabled { color: #4c405f; background: #e8deef; }
.feedback { display: grid; gap: 1rem; margin-top: 1rem; padding: 1rem; background: #f7f3fc; border-radius: 0.85rem; overflow-wrap: anywhere; }
.feedback h2 { font-size: 0.94rem; color: #493960; }
.feedback div > p { margin-top: 0.2rem; }
.feedback .verdict { font-size: 1.12rem; font-weight: 760; }
.verdict.correct { color: #1e633d; }
.verdict.wrong { color: #913b43; }
.feedback button { justify-self: start; }
.notice { color: var(--muted); }
#storage-note { margin-bottom: 0.7rem; font-size: 0.93rem; }

@media (max-width: 38rem) {
  .toolbar, .chapter-field { width: 100%; }
  .toolbar { gap: 0.65rem; }
  .practice { padding-top: 1.45rem; }
}
