/* 电击小子 · 高压电工题库
   设计语言：暖纸底 + 深青主色 + 珊瑚强调色，支持浅色/深色/跟随系统三种主题。 */

/* ============================== 主题令牌 ============================== */
:root {
  color-scheme: light;

  --bg: #f2ece0;
  --bg-deep: #0e2a30;
  --surface: #fffdf7;
  --surface-2: #f8f2e6;
  --surface-3: #efe7d7;

  --ink: #14303a;
  --ink-2: #4c666f;
  --ink-3: #85999f;

  --brand: #14706f;
  --brand-2: #0f5c5d;
  --brand-ink: #0b3a3e;
  --brand-soft: rgba(20, 112, 111, 0.1);

  --accent: #ea6248;
  --accent-2: #cd4a34;
  --accent-soft: rgba(234, 98, 72, 0.12);

  --gold: #d99b2e;
  --gold-soft: rgba(217, 155, 46, 0.14);
  --ok: #2d8760;
  --ok-soft: rgba(45, 135, 96, 0.13);
  --bad: #cc4a41;
  --bad-soft: rgba(204, 74, 65, 0.12);

  --line: rgba(20, 48, 58, 0.12);
  --line-strong: rgba(20, 48, 58, 0.22);

  --shadow-s: 0 1px 2px rgba(14, 42, 48, 0.06), 0 2px 6px rgba(14, 42, 48, 0.05);
  --shadow-m: 0 4px 12px rgba(14, 42, 48, 0.08), 0 12px 28px rgba(14, 42, 48, 0.07);
  --shadow-l: 0 18px 48px rgba(14, 42, 48, 0.16);

  --r-s: 10px;
  --r-m: 16px;
  --r-l: 22px;
  --r-pill: 999px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --step: 1;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1b21;
    --bg-deep: #060f13;
    --surface: #14272e;
    --surface-2: #19313a;
    --surface-3: #21404a;

    --ink: #e9f1ef;
    --ink-2: #a8c1c3;
    --ink-3: #7b9499;

    --brand: #3cb0a4;
    --brand-2: #2f9a90;
    --brand-ink: #d6f2ee;
    --brand-soft: rgba(60, 176, 164, 0.14);

    --accent: #ff8164;
    --accent-2: #ff6a48;
    --accent-soft: rgba(255, 129, 100, 0.16);

    --gold: #e9b455;
    --gold-soft: rgba(233, 180, 85, 0.16);
    --ok: #46b183;
    --ok-soft: rgba(70, 177, 131, 0.16);
    --bad: #f2695e;
    --bad-soft: rgba(242, 105, 94, 0.16);

    --line: rgba(233, 241, 239, 0.12);
    --line-strong: rgba(233, 241, 239, 0.24);

    --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-m: 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-l: 0 20px 52px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1b21;
  --bg-deep: #060f13;
  --surface: #14272e;
  --surface-2: #19313a;
  --surface-3: #21404a;

  --ink: #e9f1ef;
  --ink-2: #a8c1c3;
  --ink-3: #7b9499;

  --brand: #3cb0a4;
  --brand-2: #2f9a90;
  --brand-ink: #d6f2ee;
  --brand-soft: rgba(60, 176, 164, 0.14);

  --accent: #ff8164;
  --accent-2: #ff6a48;
  --accent-soft: rgba(255, 129, 100, 0.16);

  --gold: #e9b455;
  --gold-soft: rgba(233, 180, 85, 0.16);
  --ok: #46b183;
  --ok-soft: rgba(70, 177, 131, 0.16);
  --bad: #f2695e;
  --bad-soft: rgba(242, 105, 94, 0.16);

  --line: rgba(233, 241, 239, 0.12);
  --line-strong: rgba(233, 241, 239, 0.24);

  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-m: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-l: 0 20px 52px rgba(0, 0, 0, 0.5);
}

:root[data-size="s"] { --step: 0.92; }
:root[data-size="l"] { --step: 1.1; }
:root[data-size="xl"] { --step: 1.22; }

/* ================================ 基础 ================================ */
* { box-sizing: border-box; }

html {
  background: var(--bg-deep);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: calc(15px * var(--step));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: break-word;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding-left: 1.15em; }

:where(button, select, input, a):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.is-hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

::selection { background: var(--accent-soft); }

/* ============================== 应用外壳 ============================== */
.app-shell {
  position: relative;
  width: min(100%, 980px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.22);
}

/* ------------------------------- 顶栏 -------------------------------- */
.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 6px;
  min-height: calc(62px + var(--safe-top));
  padding: var(--safe-top) 10px 0;
  color: #f7f3ea;
  background: linear-gradient(135deg, var(--brand-ink) 0%, #123f45 62%, #17514f 100%);
  border-bottom: 2px solid var(--accent);
}

/* 显式指定列位：返回按钮隐藏时不能让品牌区被挤进第一列 */
.back-button { grid-column: 1; }
.brand { grid-column: 2; }
.topbar-tools { grid-column: 3; }

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  color: inherit;
  text-align: left;
}
.brand img {
  width: 34px; height: 34px;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.brand span { display: grid; min-width: 0; line-height: 1.25; }
.brand strong {
  font-size: calc(15px * var(--step));
  letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand small {
  font-size: calc(11px * var(--step));
  color: rgba(247, 243, 234, 0.66);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.topbar-tools { display: flex; align-items: center; gap: 2px; }

.icon-button {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  color: inherit;
  font-size: calc(16px * var(--step));
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.16s var(--ease), transform 0.16s var(--ease);
}
.icon-button:hover { background: rgba(255, 255, 255, 0.17); }
.icon-button:active { transform: scale(0.93); }
.back-button { background: rgba(255, 255, 255, 0.13); }

/* ------------------------------ 主内容 ------------------------------- */
.main-content {
  padding-bottom: calc(96px + var(--safe-bottom));
  min-height: 60vh;
}
.content-pad { padding: 0 16px; }
.page { animation: page-in 0.28s var(--ease) both; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------ 底部导航 ----------------------------- */
.bottom-nav {
  position: fixed;
  z-index: 40;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 980px);
  padding: 6px 6px calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.nav-item {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 7px 4px 5px;
  color: var(--ink-3);
  border-radius: 13px;
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
}
.nav-item span { font-size: calc(17px * var(--step)); line-height: 1; }
.nav-item b { font-size: calc(10.5px * var(--step)); font-weight: 600; letter-spacing: 0.04em; }
.nav-item:hover { color: var(--ink-2); }
.nav-item.is-active { color: var(--brand); background: var(--brand-soft); }

/* =============================== 首页 ================================ */
.hero {
  position: relative;
  overflow: hidden;
  padding: 22px 18px 24px;
  color: #f7f3ea;
  background: linear-gradient(150deg, #123f45 0%, #17514f 55%, #1d6b62 100%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -120px auto;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(234, 98, 72, 0.35), transparent 68%);
  pointer-events: none;
}
.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  font-size: calc(10.5px * var(--step));
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #ffd9ce;
  border-radius: var(--r-pill);
  background: rgba(234, 98, 72, 0.24);
}
.hero h1 {
  font-size: calc(25px * var(--step));
  font-weight: 800;
  letter-spacing: 0.01em;
}
.hero-sub {
  margin-top: 4px;
  font-size: calc(12.5px * var(--step));
  color: rgba(247, 243, 234, 0.72);
}

.hero-main { display: flex; align-items: center; gap: 18px; }
.hero-copy { min-width: 0; flex: 1; }

.ring {
  position: relative;
  flex: none;
  width: 88px; height: 88px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.16) 0);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #133f45;
}
.ring-label { position: relative; display: grid; justify-items: center; line-height: 1.1; }
.ring-label b { font-size: calc(20px * var(--step)); font-weight: 800; }
.ring-label small { font-size: calc(9.5px * var(--step)); color: rgba(247, 243, 234, 0.66); letter-spacing: 0.06em; }

.stat-strip {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}
.stat-cell {
  display: grid;
  gap: 1px;
  padding: 10px 8px;
  text-align: center;
  border-radius: var(--r-s);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.stat-cell strong { font-size: calc(18px * var(--step)); font-weight: 800; }
.stat-cell span { font-size: calc(10.5px * var(--step)); color: rgba(247, 243, 234, 0.7); }

/* 继续答题条 */
.resume-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -14px 0 16px;
  padding: 13px 14px;
  border-radius: var(--r-m);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-m);
  animation: pop-in 0.34s var(--ease) both;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.resume-mark {
  flex: none;
  display: grid;
  justify-items: center;
  min-width: 52px;
  padding: 7px 8px;
  border-radius: var(--r-s);
  background: var(--accent-soft);
  color: var(--accent-2);
  line-height: 1.1;
}
.resume-mark span { font-size: calc(19px * var(--step)); font-weight: 800; }
.resume-mark small { font-size: calc(10px * var(--step)); opacity: 0.8; }
.resume-copy { display: grid; gap: 1px; min-width: 0; flex: 1; }
.resume-copy small { font-size: calc(10.5px * var(--step)); color: var(--accent-2); font-weight: 700; letter-spacing: 0.05em; }
.resume-copy strong { font-size: calc(13.5px * var(--step)); }
.resume-copy span { font-size: calc(11.5px * var(--step)); color: var(--ink-2); }
.resume-button {
  flex: none;
  padding: 9px 13px;
  font-size: calc(12.5px * var(--step));
  font-weight: 700;
  color: #fff;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 12px var(--accent-soft);
  transition: transform 0.16s var(--ease);
}
.resume-button:active { transform: scale(0.95); }

/* 练习设置卡 */
.home-layout { display: grid; gap: 14px; padding-top: 18px; }
.study-starter {
  padding: 16px;
  border-radius: var(--r-l);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
}
.section-kicker {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}
.section-kicker small {
  display: block;
  font-size: calc(10.5px * var(--step));
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--brand);
  text-transform: uppercase;
}
.section-kicker h2 { font-size: calc(18px * var(--step)); font-weight: 800; }
.section-kicker > small:last-child { color: var(--ink-3); font-weight: 500; letter-spacing: 0; text-align: right; }

.mode-segment {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  margin-bottom: 13px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
}
.mode-segment button {
  padding: 8px 6px;
  font-size: calc(12.5px * var(--step));
  font-weight: 700;
  color: var(--ink-2);
  border-radius: var(--r-pill);
  transition: background 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.mode-segment button.is-active {
  color: var(--brand-ink);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.form-grid { display: grid; gap: 11px; grid-template-columns: 1fr 1fr; }
.form-grid.is-countless { grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: calc(11.5px * var(--step)); font-weight: 600; color: var(--ink-2); }
.field select, .field input[type="text"], .field input[type="search"] {
  width: 100%;
  padding: 10px 11px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-size: calc(13.5px * var(--step));
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.field input[type="text"], .field input[type="search"] { background-image: none; padding-right: 11px; }
.form-note {
  grid-column: 1 / -1;
  padding: 9px 11px;
  font-size: calc(11.5px * var(--step));
  line-height: 1.6;
  color: var(--ink-2);
  border-radius: var(--r-s);
  background: var(--brand-soft);
}

/* 按钮 */
.primary-button, .secondary-button, .danger-button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 18px;
  font-size: calc(14px * var(--step));
  font-weight: 700;
  border-radius: var(--r-pill);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease);
}
.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 16px rgba(20, 112, 111, 0.26);
}
.primary-button:hover { box-shadow: 0 8px 22px rgba(20, 112, 111, 0.32); }
.secondary-button {
  color: var(--ink);
  background: var(--surface-3);
  border: 1px solid var(--line);
}
.secondary-button:hover { background: var(--surface-2); }
.danger-button { color: #fff; background: linear-gradient(135deg, #d8574c, var(--bad)); box-shadow: 0 6px 16px var(--bad-soft); }
.text-button { color: var(--ink-2); background: transparent; padding: 10px 12px; }
.text-button:hover { color: var(--brand); background: var(--brand-soft); }
.primary-button:active, .secondary-button:active, .danger-button:active { transform: scale(0.97); }
.primary-button[disabled], .secondary-button[disabled] { opacity: 0.45; pointer-events: none; }
.start-button { width: 100%; margin-top: 14px; padding: 14px; font-size: calc(15px * var(--step)); }
.button-stack { display: grid; gap: 9px; margin-top: 12px; }

/* 快捷入口 */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.quick-action {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 14px 6px 12px;
  border-radius: var(--r-m);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-m); }
.quick-action:active { transform: scale(0.96); }
.quick-icon {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  font-size: calc(16px * var(--step));
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
}
.quick-action b { font-size: calc(11.5px * var(--step)); font-weight: 700; }
.quick-action[data-action="speed"] .quick-icon { background: var(--gold-soft); color: var(--gold); }
.quick-action[data-action="wrong"] .quick-icon { background: var(--bad-soft); color: var(--bad); }
.quick-action[data-action="star"] .quick-icon { background: var(--accent-soft); color: var(--accent-2); }

/* 分区标题 */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 24px 0 11px;
}
.section-title h2 { font-size: calc(16.5px * var(--step)); font-weight: 800; }
.section-title span { font-size: calc(11.5px * var(--step)); color: var(--ink-3); }

/* 知识点列表 */
.category-list { display: grid; gap: 8px; }
.category-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--r-m);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.category-row:hover { transform: translateX(2px); box-shadow: var(--shadow-s); }
.category-row > div:first-child { flex: 1; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; flex-wrap: wrap; }
.row-title strong { font-size: calc(13.5px * var(--step)); }
.count-mark {
  padding: 1px 7px;
  font-size: calc(10.5px * var(--step));
  font-weight: 700;
  color: var(--brand);
  border-radius: var(--r-pill);
  background: var(--brand-soft);
}
.micro-progress {
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.micro-progress i {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 0.5s var(--ease);
}
.row-meta {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: calc(11px * var(--step));
  color: var(--ink-3);
}
.small-arrow {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  font-size: calc(15px * var(--step));
  color: var(--brand);
  border-radius: 11px;
  background: var(--brand-soft);
  transition: background 0.16s var(--ease), transform 0.16s var(--ease);
}
.small-arrow:hover { background: var(--brand); color: #fff; }
.small-arrow:active { transform: scale(0.92); }

/* =============================== 答题页 ============================== */
/* 底部留出浮动题号按钮的高度，避免遮住“下一题／保存并退出” */
.quiz-page { padding-bottom: calc(86px + var(--safe-bottom)); }
.quiz-page.is-swiping .quiz-wrap { transform: translateX(var(--swipe-offset, 0)); }
.quiz-wrap { transition: transform 0.2s var(--ease); padding: 0 16px; }

.quiz-hud {
  position: sticky;
  z-index: 25;
  top: calc(62px + var(--safe-top));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.hud-copy { flex: 1; min-width: 0; display: grid; gap: 6px; }
.hud-copy > div:first-child {
  font-size: calc(11.5px * var(--step));
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quiz-progress { height: 5px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.quiz-progress i {
  display: block; height: 100%;
  width: var(--quiz-progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 0.4s var(--ease);
}
.timer {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 42px; height: 42px;
  padding: 0 8px;
  font-size: calc(16px * var(--step));
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  border-radius: 13px;
  background: var(--brand-soft);
}
.timer.is-urgent { color: #fff; background: var(--bad); animation: pulse 0.9s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

.quiz-view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 14px 16px 0;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
}
.quiz-view-switch button {
  padding: 8px;
  font-size: calc(12.5px * var(--step));
  font-weight: 700;
  color: var(--ink-2);
  border-radius: var(--r-pill);
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.quiz-view-switch button.is-active { color: var(--brand-ink); background: var(--surface); box-shadow: var(--shadow-s); }

.question-card {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--r-l);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
}
.question-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 11px; }
.label {
  padding: 2px 9px;
  font-size: calc(10.5px * var(--step));
  font-weight: 700;
  color: var(--brand);
  border-radius: var(--r-pill);
  background: var(--brand-soft);
}
.label.is-critical { color: #fff; background: var(--bad); }
.label.is-star { color: var(--gold); background: var(--gold-soft); }
.question-number { margin-left: auto; font-size: calc(10.5px * var(--step)); color: var(--ink-3); }
.question-card h1 {
  font-size: calc(17px * var(--step));
  font-weight: 700;
  line-height: 1.7;
  letter-spacing: 0.01em;
}
.question-tools { display: flex; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--line); }
.chip-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: calc(11.5px * var(--step));
  font-weight: 600;
  color: var(--ink-2);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.chip-button:hover { color: var(--brand); background: var(--brand-soft); }
.chip-button.is-on { color: var(--gold); background: var(--gold-soft); border-color: transparent; }

.options { display: grid; gap: 9px; margin-top: 12px; }
.option-button {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  text-align: left;
  border-radius: var(--r-m);
  background: var(--surface);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-s);
  transition: transform 0.14s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.option-button:not([disabled]):hover { border-color: var(--brand); transform: translateY(-1px); }
.option-button:not([disabled]):active { transform: scale(0.985); }
.option-key {
  flex: none;
  display: grid;
  place-items: center;
  width: 27px; height: 27px;
  font-size: calc(12.5px * var(--step));
  font-weight: 800;
  color: var(--ink-2);
  border-radius: 9px;
  background: var(--surface-3);
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.option-text { flex: 1; min-width: 0; font-size: calc(14px * var(--step)); line-height: 1.6; padding-top: 2px; }
.option-button.is-selected { border-color: var(--brand); background: var(--brand-soft); }
.option-button.is-selected .option-key { color: #fff; background: var(--brand); }
.option-button.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.option-button.is-correct .option-key { color: #fff; background: var(--ok); }
.option-button.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.option-button.is-wrong .option-key { color: #fff; background: var(--bad); }
.option-button[disabled] { cursor: default; opacity: 1; }
.option-mark { flex: none; font-size: calc(15px * var(--step)); font-weight: 800; align-self: center; }
.option-button.is-correct .option-mark { color: var(--ok); }
.option-button.is-wrong .option-mark { color: var(--bad); }

.answer-actions { display: grid; gap: 9px; margin-top: 15px; }
.answer-actions.two { grid-template-columns: 1fr auto; align-items: center; }

/* ---------------------------- 解析区 ---------------------------- */
.analysis-area { margin-top: 16px; animation: page-in 0.3s var(--ease) both; }
.answer-banner {
  display: grid;
  gap: 4px;
  padding: 14px 15px;
  border-radius: var(--r-m);
  background: var(--ok-soft);
  border-left: 4px solid var(--ok);
}
.answer-banner.is-wrong { background: var(--bad-soft); border-left-color: var(--bad); }
.answer-banner strong { font-size: calc(15px * var(--step)); color: var(--ok); }
.answer-banner.is-wrong strong { color: var(--bad); }
.answer-banner span { font-size: calc(12.5px * var(--step)); color: var(--ink-2); }

.study-reveal { margin-top: 16px; }
.study-answer {
  display: grid;
  gap: 3px;
  padding: 14px 15px;
  border-radius: var(--r-m);
  background: var(--ok-soft);
  border-left: 4px solid var(--ok);
}
.study-answer span { font-size: calc(11px * var(--step)); font-weight: 700; letter-spacing: 0.08em; color: var(--ok); }
.study-answer strong { font-size: calc(15px * var(--step)); line-height: 1.6; }

.explanation-card {
  margin-top: 12px;
  border-radius: var(--r-l);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
  overflow: hidden;
}
.explanation-card > header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 15px;
  background: linear-gradient(135deg, var(--brand-soft), transparent);
  border-bottom: 1px solid var(--line);
}
.explanation-card > header h2 { font-size: calc(14.5px * var(--step)); font-weight: 800; }
.explanation-card > header .point {
  margin-left: auto;
  padding: 2px 9px;
  font-size: calc(10.5px * var(--step));
  font-weight: 700;
  color: var(--brand);
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  text-align: right;
}
.exp-body { padding: 4px 15px 15px; }
.exp-block { padding: 13px 0; border-bottom: 1px dashed var(--line); }
.exp-block:last-child { border-bottom: 0; padding-bottom: 4px; }
.exp-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  font-size: calc(11.5px * var(--step));
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--brand);
}
.exp-head i {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  font-style: normal;
  font-size: calc(11px * var(--step));
  border-radius: 6px;
  background: var(--brand-soft);
}
.exp-block p { font-size: calc(13.5px * var(--step)); line-height: 1.85; color: var(--ink); }
.exp-block p + p { margin-top: 8px; }
.exp-block.is-trap .exp-head { color: var(--gold); }
.exp-block.is-trap .exp-head i { background: var(--gold-soft); }
.exp-block.is-memory .exp-head { color: var(--accent-2); }
.exp-block.is-memory .exp-head i { background: var(--accent-soft); }

.exp-conclusion {
  padding: 11px 13px;
  margin-bottom: 2px;
  font-size: calc(13.5px * var(--step));
  line-height: 1.75;
  border-radius: var(--r-s);
  background: var(--ok-soft);
  color: var(--ink);
}
.exp-options { display: grid; gap: 8px; }
.exp-option {
  display: flex;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border-left: 3px solid var(--line-strong);
}
.exp-option.is-right { background: var(--ok-soft); border-left-color: var(--ok); }
.exp-option b {
  flex: none;
  width: 18px;
  font-size: calc(12.5px * var(--step));
  font-weight: 800;
  color: var(--ink-2);
}
.exp-option.is-right b { color: var(--ok); }
.exp-option span { font-size: calc(12.5px * var(--step)); line-height: 1.75; color: var(--ink-2); }
.exp-option.is-right span { color: var(--ink); }

/* 题号导航悬浮按钮 */
.question-navigator {
  position: fixed;
  z-index: 35;
  right: max(16px, calc(50vw - 474px));
  bottom: calc(22px + var(--safe-bottom));
  display: grid;
  gap: 0;
  padding: 9px 15px;
  color: #fff;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--brand-ink), var(--brand));
  box-shadow: var(--shadow-l);
  transition: transform 0.16s var(--ease);
}
.question-navigator:active { transform: scale(0.94); }
.question-navigator span { font-size: calc(11.5px * var(--step)); font-weight: 600; }
.question-navigator b { font-size: calc(14px * var(--step)); font-weight: 800; }
.question-navigator small { font-size: calc(9.5px * var(--step)); opacity: 0.72; }

.question-nav-summary {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-bottom: 13px;
  font-size: calc(12px * var(--step));
  color: var(--ink-2);
}
.question-nav-summary span { display: inline-flex; align-items: center; gap: 5px; }
.question-nav-summary i, .completion-legend i {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface-3); display: inline-block;
}
.question-nav-summary i.is-correct, .completion-legend i.is-correct { background: var(--ok); }
.question-nav-summary i.is-wrong, .completion-legend i.is-wrong { background: var(--bad); }
.question-nav-summary i.is-skipped, .completion-legend i.is-skipped { background: var(--ink-3); }

.question-nav-grid, .completion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 7px;
  max-height: 44vh;
  overflow-y: auto;
  padding: 2px;
}
.question-nav-dot, .completion-dot {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: calc(12px * var(--step));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  transition: transform 0.14s var(--ease);
}
.question-nav-dot:active, .completion-dot:active { transform: scale(0.9); }
.question-nav-dot.is-correct, .completion-dot.is-correct { color: #fff; background: var(--ok); border-color: transparent; }
.question-nav-dot.is-wrong, .completion-dot.is-wrong { color: #fff; background: var(--bad); border-color: transparent; }
.question-nav-dot.is-skipped, .completion-dot.is-skipped { color: #fff; background: var(--ink-3); border-color: transparent; }
.question-nav-dot.is-current { box-shadow: 0 0 0 3px var(--accent); }
.question-nav-note, .completion-note {
  margin-top: 11px;
  font-size: calc(11px * var(--step));
  line-height: 1.7;
  color: var(--ink-3);
}

/* =============================== 通用页 ============================== */
.page-header {
  padding: 22px 16px 18px;
  color: #f7f3ea;
  background: linear-gradient(140deg, #123f45, #1a5f59);
}
.page-header h1 { font-size: calc(21px * var(--step)); font-weight: 800; }
.page-header p { margin-top: 5px; font-size: calc(12.5px * var(--step)); color: rgba(247, 243, 234, 0.72); }

.wrong-summary, .result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 16px;
}
.wrong-summary > div, .result-grid > div {
  display: grid;
  gap: 2px;
  padding: 13px 8px;
  text-align: center;
  border-radius: var(--r-m);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
}
.wrong-summary strong, .result-grid strong { font-size: calc(21px * var(--step)); font-weight: 800; color: var(--brand); }
.wrong-summary span, .result-grid span { font-size: calc(11px * var(--step)); color: var(--ink-3); }

.wrong-list { display: grid; gap: 8px; }
.wrong-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--r-m);
  background: var(--surface);
  border: 1px solid var(--line);
}
.wrong-row > div:first-child { flex: 1; min-width: 0; }
.wrong-badge {
  padding: 1px 8px;
  font-size: calc(10.5px * var(--step));
  font-weight: 700;
  color: #fff;
  border-radius: var(--r-pill);
  background: var(--bad);
}
.wrong-badge.is-soft { color: var(--gold); background: var(--gold-soft); }
.stem-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: calc(12.5px * var(--step));
  line-height: 1.65;
  color: var(--ink-2);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 40px 22px;
  text-align: center;
  border-radius: var(--r-l);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 54px; height: 54px;
  font-size: calc(24px * var(--step));
  color: var(--brand);
  border-radius: 17px;
  background: var(--brand-soft);
}
.empty-state h2 { font-size: calc(16px * var(--step)); font-weight: 800; }
.empty-state p { font-size: calc(12.5px * var(--step)); line-height: 1.7; color: var(--ink-2); max-width: 34em; }
.empty-copy { font-size: calc(12.5px * var(--step)); color: var(--ink-3); }

.notice {
  margin-top: 14px;
  padding: 11px 13px;
  font-size: calc(11.5px * var(--step));
  line-height: 1.75;
  color: var(--ink-2);
  border-radius: var(--r-s);
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
}

/* 进度页 */
.progress-panel {
  margin-top: 13px;
  padding: 15px;
  border-radius: var(--r-l);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
}
.progress-panel h3 { font-size: calc(14.5px * var(--step)); font-weight: 800; }
.progress-panel > p { margin-top: 5px; font-size: calc(12px * var(--step)); line-height: 1.7; color: var(--ink-2); }

.completion-history { display: grid; gap: 7px; margin-top: 11px; }
.completion-record {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  text-align: left;
  border-radius: var(--r-m);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background 0.16s var(--ease);
}
.completion-record:hover { background: var(--surface-3); }
.completion-record > span { display: grid; gap: 2px; min-width: 0; }
.completion-record b { font-size: calc(12.5px * var(--step)); }
.completion-record small { font-size: calc(10.5px * var(--step)); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.completion-record strong { font-size: calc(14px * var(--step)); font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.completion-record em { font-size: calc(10.5px * var(--step)); font-style: normal; color: var(--ink-3); }
.completion-legend { display: flex; flex-wrap: wrap; gap: 13px; margin-bottom: 11px; font-size: calc(11.5px * var(--step)); color: var(--ink-2); }
.completion-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* 活跃度条 */
.activity-strip { display: flex; gap: 4px; margin-top: 12px; }
.activity-cell {
  flex: 1;
  display: grid;
  gap: 4px;
  justify-items: center;
}
.activity-cell i {
  display: block;
  width: 100%;
  height: 34px;
  border-radius: 6px;
  background: var(--surface-3);
  position: relative;
  overflow: hidden;
}
.activity-cell i::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: var(--h, 0%);
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
  border-radius: 6px;
}
.activity-cell small { font-size: calc(9.5px * var(--step)); color: var(--ink-3); }

/* 知识点页 */
.knowledge-list { display: grid; gap: 11px; }
.knowledge-card {
  padding: 15px;
  border-radius: var(--r-l);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
}
.knowledge-card h3 { font-size: calc(15px * var(--step)); font-weight: 800; }
.knowledge-card > p { margin-top: 6px; font-size: calc(12.5px * var(--step)); line-height: 1.75; color: var(--ink-2); }
.knowledge-card ul { margin-top: 9px; display: grid; gap: 5px; }
.knowledge-card li { font-size: calc(12.5px * var(--step)); line-height: 1.7; color: var(--ink-2); }
.knowledge-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  font-size: calc(11.5px * var(--step));
  color: var(--ink-3);
}
.kn-tag {
  display: inline-block;
  margin-top: 9px;
  padding: 6px 11px;
  font-size: calc(11.5px * var(--step));
  line-height: 1.7;
  color: var(--ink-2);
  border-radius: var(--r-s);
  background: var(--gold-soft);
}

/* 结果页 */
.result-hero {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 30px 18px 26px;
  text-align: center;
  color: #f7f3ea;
  background: linear-gradient(150deg, #123f45, #1a5f59 60%, #1d6b62);
}
.result-score {
  display: grid;
  place-items: center;
  width: 104px; height: 104px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.16) 0);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.result-score::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: #143f45; }
.result-score strong { position: relative; font-size: calc(30px * var(--step)); font-weight: 800; line-height: 1; }
.result-score span { position: relative; font-size: calc(10px * var(--step)); color: rgba(247, 243, 234, 0.7); }
.result-hero h1 { font-size: calc(20px * var(--step)); font-weight: 800; }
.result-hero p { font-size: calc(12.5px * var(--step)); color: rgba(247, 243, 234, 0.72); }

/* 搜索 */
.search-bar { display: flex; gap: 8px; margin-top: 16px; }
.search-bar input {
  flex: 1;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: calc(13.5px * var(--step));
}
.search-results { display: grid; gap: 8px; margin-top: 14px; }
.search-hit {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  text-align: left;
  border-radius: var(--r-m);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform 0.16s var(--ease);
}
.search-hit:hover { transform: translateX(2px); box-shadow: var(--shadow-s); }
.search-hit > div { flex: 1; min-width: 0; }
.search-hit mark { background: var(--gold-soft); color: inherit; border-radius: 3px; padding: 0 2px; }

/* =============================== 弹层 ================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(8, 24, 28, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 0.2s var(--ease) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-sheet {
  width: min(100%, 540px);
  max-height: 86vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  padding-bottom: calc(18px + var(--safe-bottom));
  border-radius: var(--r-l);
  background: var(--surface);
  box-shadow: var(--shadow-l);
  animation: sheet-up 0.28s var(--ease) both;
}
@keyframes sheet-up { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 13px; }
.modal-head > div { flex: 1; min-width: 0; }
.modal-head h2 { font-size: calc(17px * var(--step)); font-weight: 800; }
.modal-head p { margin-top: 4px; font-size: calc(12px * var(--step)); line-height: 1.65; color: var(--ink-2); }
.modal-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  font-size: calc(18px * var(--step));
  color: var(--ink-2);
  border-radius: 10px;
  background: var(--surface-3);
}
.modal-close:hover { color: var(--ink); }

.range-row { display: flex; align-items: center; gap: 11px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--brand); }
.range-value {
  min-width: 46px;
  padding: 5px 9px;
  text-align: center;
  font-size: calc(12.5px * var(--step));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  border-radius: var(--r-s);
  background: var(--brand-soft);
}

.option-rows { display: grid; gap: 8px; }
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.option-row > div { min-width: 0; }
.option-row strong { display: block; font-size: calc(13px * var(--step)); }
.option-row small { display: block; margin-top: 2px; font-size: calc(11px * var(--step)); line-height: 1.6; color: var(--ink-3); }
.seg {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
}
.seg button {
  padding: 6px 11px;
  font-size: calc(11.5px * var(--step));
  font-weight: 700;
  color: var(--ink-2);
  border-radius: var(--r-pill);
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.seg button.is-active { color: var(--brand-ink); background: var(--surface); box-shadow: var(--shadow-s); }

/* Toast */
.toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(92px + var(--safe-bottom));
  transform: translate(-50%, 16px);
  max-width: min(90vw, 460px);
  padding: 11px 17px;
  font-size: calc(12.5px * var(--step));
  line-height: 1.6;
  color: #f7f3ea;
  text-align: center;
  border-radius: var(--r-pill);
  background: rgba(12, 38, 43, 0.95);
  box-shadow: var(--shadow-l);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* 键盘提示 */
.kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  font-size: calc(10.5px * var(--step));
  font-weight: 700;
  text-align: center;
  color: var(--ink-2);
  border-radius: 5px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line-strong);
}

/* ============================== 宽屏适配 ============================= */
@media (min-width: 720px) {
  .content-pad { padding: 0 24px; }
  .hero { padding: 30px 26px 30px; }
  .hero h1 { font-size: calc(30px * var(--step)); }
  .page-header, .result-hero { padding-left: 26px; padding-right: 26px; }
  .quiz-wrap, .quiz-hud { padding-left: 24px; padding-right: 24px; }
  .quiz-view-switch { margin-left: 24px; margin-right: 24px; }
  .home-layout { grid-template-columns: 1.35fr 1fr; align-items: start; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-action { padding: 18px 10px; }
  .category-list { grid-template-columns: 1fr 1fr; }
  .knowledge-list { grid-template-columns: 1fr 1fr; }
  .modal-backdrop { place-items: center; }
  .question-card h1 { font-size: calc(18.5px * var(--step)); }
}

@media (min-width: 980px) {
  .app-shell { border-radius: 0; }
  .question-navigator { right: calc(50vw - 474px); }
}

/* 打印：把当前页面变成可打印的讲义 */
@media print {
  .topbar, .bottom-nav, .question-navigator, .toast, .quiz-view-switch, .answer-actions, #modalRoot { display: none !important; }
  .app-shell { box-shadow: none; }
  body { background: #fff; }
}
