:root {
  color-scheme: light;
  --bg: #f7f8f6;
  --surface: #ffffff;
  --text: #18211d;
  --muted: #67736d;
  --line: #dfe5e1;
  --green: #167a55;
  --green-dark: #0e6042;
  --green-soft: #e8f4ed;
  --amber: #a96309;
  --amber-soft: #fff3df;
  --red: #b43d32;
  --red-soft: #fff0ed;
  --shadow: 0 8px 24px rgb(22 50 38 / 8%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.shell { width: min(100%, 720px); min-height: 100dvh; margin: 0 auto; padding: env(safe-area-inset-top) 18px calc(92px + env(safe-area-inset-bottom)); }
.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 760; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 21px; }
.hero { padding: 22px; border-radius: 6px; color: white; background: var(--green-dark); box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 8px; color: #cce5d9; font-size: 13px; }
.hero h2 { margin: 0; font-size: 24px; line-height: 1.35; }
.hero p { margin: 8px 0 18px; color: #d7eae0; font-size: 14px; }
.primary, .secondary, .danger { min-height: 46px; border-radius: 6px; padding: 0 18px; font-weight: 700; }
.primary { border: 1px solid transparent; background: var(--green); color: white; }
.hero .primary { background: white; color: var(--green-dark); }
.secondary { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.danger { border: 1px solid #efcbc6; background: var(--red-soft); color: var(--red); }
.section-title { margin: 24px 0 12px; font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.stat { padding: 17px 10px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat strong { display: block; font-size: 21px; }
.stat span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.actions { display: grid; gap: 9px; }
.action-row { width: 100%; min-height: 68px; display: flex; align-items: center; gap: 14px; padding: 12px 14px; text-align: left; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); }
.action-mark { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 6px; background: var(--green-soft); color: var(--green-dark); font-weight: 800; }
.action-copy { flex: 1; min-width: 0; }
.action-copy strong { display: block; font-size: 15px; }
.action-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.chevron { color: var(--muted); font-size: 20px; }
.bottom-nav { position: fixed; z-index: 10; left: 50%; bottom: 0; width: min(100%, 720px); transform: translateX(-50%); display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(12px); }
.nav-item { min-height: 50px; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.nav-item.active { color: var(--green-dark); font-weight: 750; }
.setup { display: grid; gap: 16px; padding-top: 8px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 700; }
.field select { height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); }
.question-head { position: sticky; top: 0; z-index: 5; margin: 0 -18px; padding: 12px 18px; display: flex; align-items: center; gap: 12px; background: rgb(247 248 246 / 95%); backdrop-filter: blur(12px); }
.question-head .icon-button { border-color: transparent; background: transparent; }
.progress-wrap { flex: 1; }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.progress { height: 5px; overflow: hidden; border-radius: 3px; background: var(--line); }
.progress > i { display: block; height: 100%; background: var(--green); }
.question { padding: 20px 0; }
.type-label { display: inline-block; margin-bottom: 12px; padding: 5px 8px; border-radius: 4px; background: var(--green-soft); color: var(--green-dark); font-size: 12px; font-weight: 700; }
.question h2 { margin: 0; font-size: 19px; line-height: 1.65; font-weight: 720; }
.options { display: grid; gap: 10px; margin-top: 22px; }
.option { width: 100%; min-height: 58px; display: flex; align-items: flex-start; gap: 12px; padding: 14px; text-align: left; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); line-height: 1.5; }
.option-key { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-weight: 700; }
.option.selected { border-color: var(--green); background: var(--green-soft); }
.option.selected .option-key { border-color: var(--green); background: var(--green); color: white; }
.option.correct { border-color: var(--green); background: var(--green-soft); }
.option.wrong { border-color: var(--red); background: var(--red-soft); }
.feedback { margin-top: 18px; padding: 16px; border-left: 4px solid var(--green); border-radius: 0 6px 6px 0; background: var(--surface); }
.feedback.wrong { border-left-color: var(--red); }
.feedback h3 { margin: 0 0 8px; font-size: 15px; }
.feedback p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.feedback .note { color: var(--amber); }
.question-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.question-actions .wide { grid-column: 1 / -1; }
.result { padding-top: 34px; text-align: center; }
.score-ring { width: 128px; height: 128px; display: grid; place-items: center; margin: 18px auto; border: 10px solid var(--green-soft); border-top-color: var(--green); border-radius: 50%; }
.score-ring strong { font-size: 30px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin: 24px 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.empty { padding: 72px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 8px; color: var(--text); font-size: 18px; }
.history { display: grid; gap: 9px; }
.history-row { display: flex; justify-content: space-between; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.history-row:first-child { border-radius: 6px 6px 0 0; }
.history-row:last-child { border-radius: 0 0 6px 6px; border-bottom: 0; }
.history-row small { color: var(--muted); }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 88px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 36px); padding: 10px 14px; border-radius: 6px; background: #18211d; color: white; font-size: 13px; box-shadow: var(--shadow); }

@media (min-width: 721px) {
  .shell { padding-left: 32px; padding-right: 32px; }
  .question-head { margin-left: -32px; margin-right: -32px; padding-left: 32px; padding-right: 32px; }
  .actions { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .option, .action-row, button { transition: border-color .16s ease, background-color .16s ease, transform .16s ease; }
  button:active { transform: scale(.985); }
}
