/* ==========================================================================
   行测题库速练 · 样式
   设计语言：Apple-like 极简 / 克制用色 / 大留白 / 弹性动效
   ========================================================================== */

/* ------------------------------------------------------------ 设计令牌 */
:root {
  --bg: #fbfbfd;
  --bg-soft: #f3f3f6;
  --surface: #ffffff;
  --surface-2: #f7f7f9;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #a1a1a6;
  --line: rgba(0, 0, 0, 0.075);
  --line-strong: rgba(0, 0, 0, 0.12);

  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.08);
  --accent-ring: rgba(0, 113, 227, 0.22);
  --ok: #1f9d63;
  --ok-soft: rgba(31, 157, 99, 0.1);
  --bad: #e0332a;
  --bad-soft: rgba(224, 51, 42, 0.09);

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 10px rgba(0, 0, 0, 0.03);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.07);
  --shadow-3: 0 8px 18px rgba(0, 0, 0, 0.06), 0 28px 60px rgba(0, 0, 0, 0.12);

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.45s;

  --nav-h: 56px;
  --maxw: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0d;
    --bg-soft: #141417;
    --surface: #17171a;
    --surface-2: #1e1e22;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #74747a;
    --line: rgba(255, 255, 255, 0.085);
    --line-strong: rgba(255, 255, 255, 0.14);

    --accent: #3d9bff;
    --accent-soft: rgba(61, 155, 255, 0.12);
    --accent-ring: rgba(61, 155, 255, 0.3);
    --ok: #3ecf8e;
    --ok-soft: rgba(62, 207, 142, 0.12);
    --bad: #ff6b63;
    --bad-soft: rgba(255, 107, 99, 0.12);

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-3: 0 8px 18px rgba(0, 0, 0, 0.4), 0 28px 60px rgba(0, 0, 0, 0.5);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-ring); }

/* 键盘焦点：只在键盘导航时出现，不影响鼠标点击 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}
.nav-link:focus-visible,
.opt:focus-visible,
.unit-card:focus-visible,
.seg-item:focus-visible,
.sheet-cell:focus-visible { outline-offset: 2px; }

/* ------------------------------------------------------------ 顶部导航 */
.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.nav.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: opacity 0.25s var(--ease);
}
.brand:hover { opacity: 0.65; }
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  display: grid;
  place-items: center;
  transition: transform 0.5s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); }

.nav-links {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-soft);
  border-radius: 999px;
}
.nav-link {
  padding: 6px 15px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  border-radius: 999px;
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease),
    box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
.nav-link:hover { color: var(--ink); }
.nav-link:active { transform: scale(0.96); }
.nav-link.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ------------------------------------------------------------ 视图切换 */
.view { display: none; }
.view.is-active {
  display: block;
  animation: viewIn 0.5s var(--ease-out) both;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px calc(72px + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------ 首页 */
.hero {
  position: relative;
  padding: 64px 0 44px;
}
/* 极淡的顶部光晕，撑起页面纵深 */
.hero::before {
  content: "";
  position: absolute;
  top: -160px;
  left: 50%;
  width: 820px;
  height: 460px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center,
    color-mix(in srgb, var(--accent) 9%, transparent) 0%,
    transparent 62%);
  pointer-events: none;
  z-index: -1;
}
.hero-eyebrow {
  font-size: 13px;
  font-weight: 590;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.hero-title {
  font-size: clamp(34px, 6.6vw, 54px);
  line-height: 1.12;
  font-weight: 640;
  letter-spacing: -0.035em;
}
.br-mobile { display: none; }
.hero-sub {
  margin-top: 20px;
  max-width: 30em;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
}

.stat-row {
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 6px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat { flex: 1; min-width: 0; }
.stat-num {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-num .unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  margin-left: 2px;
}
.stat-label {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 3px;
  letter-spacing: 0.01em;
}
.stat-divider { width: 1px; height: 30px; background: var(--line); }

/* 分类 */
.cat-list { display: flex; flex-direction: column; gap: 46px; padding-top: 12px; }

.cat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.cat-title {
  font-size: 19px;
  font-weight: 620;
  letter-spacing: -0.02em;
}
.cat-desc { font-size: 13.5px; color: var(--ink-3); }

.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 14px;
}

.unit-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 20px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease),
    border-color 0.4s var(--ease);
}
.unit-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, var(--accent-soft), transparent 55%);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}
.unit-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
  border-color: var(--line-strong);
}
.unit-card:hover::after { opacity: 1; }
.unit-card:active { transform: translateY(-1px) scale(0.994); }

.uc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.uc-index {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.uc-badge {
  font-size: 11.5px;
  font-weight: 560;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-2);
}
.uc-badge.is-done { background: var(--ok-soft); color: var(--ok); }
.uc-badge.is-wrong { background: var(--bad-soft); color: var(--bad); }

.uc-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}
.uc-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-3);
}
.uc-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); opacity: 0.6; }

.uc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
}
.uc-go {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 560;
  color: var(--accent);
}
.uc-go svg { transition: transform 0.4s var(--ease); }
.unit-card:hover .uc-go svg { transform: translateX(3px); }

/* 空状态 */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14.5px;
}

/* ------------------------------------------------------------ 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 46px;
  padding: 0 26px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 560;
  letter-spacing: -0.01em;
  transition: transform 0.28s var(--ease), background-color 0.28s var(--ease),
    box-shadow 0.28s var(--ease), opacity 0.28s var(--ease);
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.965); }
.btn:disabled { opacity: 0.42; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 113, 227, 0.28), 0 6px 18px rgba(0, 113, 227, 0.2);
}
.btn-primary:hover { background: #0077ed; box-shadow: 0 2px 4px rgba(0, 113, 227, 0.3), 0 10px 26px rgba(0, 113, 227, 0.26); }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-block { width: 100%; }

.link-btn {
  font-size: 13.5px;
  font-weight: 540;
  color: var(--accent);
  padding: 4px 2px;
  border-radius: 8px;
  transition: opacity 0.25s var(--ease);
}
.link-btn:hover { opacity: 0.65; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-2);
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease),
    transform 0.25s var(--ease);
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }
.icon-btn:active { transform: scale(0.9); }

/* ------------------------------------------------------------ 答题页 */
#view-quiz { padding-bottom: 96px; }

.quiz-bar {
  position: sticky;
  top: var(--nav-h);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 10px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}
.quiz-bar-mid { flex: 1; min-width: 0; }
.quiz-bar-title {
  font-size: 14.5px;
  font-weight: 590;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quiz-bar-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.timer {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 7px 6px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.timer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  transition: background-color 0.3s var(--ease);
}
.timer.is-paused .timer-dot { background: var(--ink-3); }
.timer.is-paused .timer-text { color: var(--ink-3); }
.timer-text {
  font-size: 14px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  transition: color 0.3s var(--ease);
}
.timer-toggle {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--ink-2);
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease),
    transform 0.25s var(--ease);
}
.timer-toggle:hover { background: var(--line); color: var(--ink); }
.timer-toggle:active { transform: scale(0.9); }
.ic-play { display: none; }
.timer.is-paused .ic-pause { display: none; }
.timer.is-paused .ic-play { display: block; }

/* 计时跳动 */
.timer-text.tick { animation: tickPulse 1s var(--ease) infinite; }
@keyframes tickPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.quiz-progress { padding: 2px 0 22px; }
.quiz-progress-track {
  height: 3px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--ink);
  transition: width 0.6s var(--ease);
}
.quiz-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.q-wrap { min-height: 46vh; }

.q-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 26px 26px 22px;
  box-shadow: var(--shadow-1);
}
.q-card.swap { animation: cardSwap 0.42s var(--ease-out) both; }
@keyframes cardSwap {
  from { opacity: 0; transform: translateY(10px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

.q-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.q-no {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.q-tag {
  font-size: 11.5px;
  color: var(--ink-3);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.q-stem {
  font-size: 16.5px;
  line-height: 1.78;
  letter-spacing: 0.002em;
  white-space: pre-line;
  color: var(--ink);
}

.q-options {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease),
    background-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
  animation: optIn 0.45s var(--ease-out) both;
  animation-delay: calc(var(--i) * 45ms + 90ms);
  -webkit-tap-highlight-color: transparent;
}
@keyframes optIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.opt:hover { border-color: var(--line-strong); background: var(--surface-2); }
.opt:active { transform: scale(0.99); }

.opt-key {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: all 0.3s var(--ease);
}
.opt-text {
  font-size: 15.5px;
  line-height: 1.65;
  white-space: pre-line;
  padding-top: 1px;
}

.opt.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.opt.is-selected .opt-key {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.04);
}

/* 答题操作条 */
.quiz-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
.quiz-actions .btn { flex: 1; max-width: 320px; }

/* 暂停遮罩 */
.pause-veil {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
}
.pause-veil.is-open { opacity: 1; pointer-events: auto; }
.pause-card {
  width: 100%;
  max-width: 320px;
  padding: 30px 26px 26px;
  text-align: center;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  transform: scale(0.94) translateY(8px);
  transition: transform 0.5s var(--ease-out);
}
.pause-veil.is-open .pause-card { transform: none; }
.pause-ic {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--ink-2);
}
.pause-card h3 { font-size: 19px; font-weight: 620; letter-spacing: -0.02em; }
.pause-card p { margin: 6px 0 22px; font-size: 14px; color: var(--ink-2); }
.pause-card .btn { width: 100%; }

/* ------------------------------------------------------------ 结算页 */
.result-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 34px;
  padding: 42px 0 34px;
}

/* 正确率达标时的一次性点状绽放（克制版庆祝） */
.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.confetti-piece {
  position: absolute;
  left: 84px;
  top: 74px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c, var(--accent));
  opacity: 0;
  animation: burst 1.1s var(--ease-out) forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  18% { opacity: 0.9; }
  100% { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(0.9); opacity: 0; }
}

.ring-wrap { position: relative; flex: none; width: 148px; height: 148px; }
.ring { width: 148px; height: 148px; transform: rotate(-90deg); }
.ring-bg {
  fill: none;
  stroke: var(--line);
  stroke-width: 7;
}
.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 339.3;
  stroke-dashoffset: 339.3;
  transition: stroke-dashoffset 1.4s var(--ease-out), stroke 0.4s var(--ease);
}
.ring-fg.is-low { stroke: var(--bad); }
.ring-fg.is-mid { stroke: #e8a33d; }
.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.ring-num {
  font-size: 38px;
  font-weight: 640;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ring-num .pct { font-size: 17px; font-weight: 560; color: var(--ink-3); margin-left: 2px; }
.ring-cap { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; letter-spacing: 0.04em; }

.result-meta { flex: 1; min-width: 0; }
.result-title { font-size: 21px; font-weight: 620; letter-spacing: -0.02em; }
.result-sub { font-size: 13.5px; color: var(--ink-3); margin-top: 4px; }
.result-cells {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.rcell { min-width: 0; }
.rcell-v {
  display: block;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.rcell-v.bad { color: var(--bad); }
.rcell-k { font-size: 11.5px; color: var(--ink-3); }

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--line);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-soft);
  border-radius: 999px;
  gap: 2px;
}
.seg-item {
  padding: 7px 16px;
  font-size: 13.5px;
  font-weight: 540;
  color: var(--ink-2);
  border-radius: 999px;
  transition: all 0.35s var(--ease);
}
.seg-item.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.09);
}

.review-list { display: flex; flex-direction: column; gap: 12px; }

.rv {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  animation: optIn 0.45s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
.rv-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 18px 20px;
  text-align: left;
}
.rv-mark {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
}
.rv.is-ok .rv-mark { background: var(--ok-soft); color: var(--ok); }
.rv.is-bad .rv-mark { background: var(--bad-soft); color: var(--bad); }
.rv.is-skip .rv-mark { background: var(--bg-soft); color: var(--ink-3); }

.rv-main { flex: 1; min-width: 0; }
.rv-stem {
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: -webkit-line-clamp 0.3s var(--ease);
}
.rv.is-open .rv-stem { -webkit-line-clamp: unset; }
.rv-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--ink-3);
}
.rv-tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-soft);
  font-variant-numeric: tabular-nums;
}
.rv-tag.ok { background: var(--ok-soft); color: var(--ok); }
.rv-tag.bad { background: var(--bad-soft); color: var(--bad); }

.rv-chev {
  flex: none;
  margin-top: 3px;
  color: var(--ink-3);
  transition: transform 0.4s var(--ease);
}
.rv.is-open .rv-chev { transform: rotate(180deg); }

.rv-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s var(--ease);
}
.rv.is-open .rv-body { grid-template-rows: 1fr; }
.rv-body-inner { overflow: hidden; }
.rv-body-pad { padding: 0 20px 20px; }

.rv-opts { display: flex; flex-direction: column; gap: 7px; margin: 4px 0 16px; }
.rv-opt {
  display: flex;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 11px;
  background: var(--surface-2);
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-line;
  border: 1px solid transparent;
}
.rv-opt .k {
  flex: none;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.rv-opt.is-answer {
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 28%, transparent);
}
.rv-opt.is-answer .k { color: var(--ok); }
.rv-opt.is-mine-bad {
  background: var(--bad-soft);
  border-color: color-mix(in srgb, var(--bad) 26%, transparent);
}
.rv-opt.is-mine-bad .k { color: var(--bad); }

.rv-exp {
  font-size: 14.5px;
  line-height: 1.82;
  color: var(--ink-2);
  white-space: pre-line;
  padding: 15px 16px;
  background: var(--surface-2);
  border-radius: 14px;
  border-left: 2px solid var(--line-strong);
}
.rv-exp b { color: var(--ink); font-weight: 600; }

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 32px;
}
.result-actions .btn { flex: 1; }

/* ------------------------------------------------------------ 记录页 */
.page-head { padding: 48px 0 28px; }
.page-head h2 {
  font-size: clamp(26px, 4.6vw, 34px);
  font-weight: 640;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.page-head p { margin-top: 10px; font-size: 15px; color: var(--ink-2); max-width: 32em; }

.chart-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  margin-bottom: 22px;
}
.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}
.chart-title { font-size: 13.5px; font-weight: 560; color: var(--ink-2); }
.chart-legend { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 108px;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  height: 100%;
  min-width: 0;
}
.bar {
  width: 100%;
  max-width: 26px;
  border-radius: 6px;
  background: linear-gradient(to top, var(--accent-ring), var(--accent));
  transform-origin: bottom;
  animation: barGrow 0.9s var(--ease-out) both;
  animation-delay: calc(var(--i) * 45ms);
  min-height: 4px;
  transition: opacity 0.3s var(--ease);
}
.bar.is-low { background: linear-gradient(to top, rgba(224, 51, 42, 0.35), var(--bad)); }
@keyframes barGrow { from { transform: scaleY(0); opacity: 0.4; } to { transform: scaleY(1); opacity: 1; } }
.bar-x { font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.record-list { display: flex; flex-direction: column; gap: 10px; }

.rec {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease),
    border-color 0.4s var(--ease);
}
.rec:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }

.rec-score {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  display: grid;
  place-content: center;
  text-align: center;
  background: var(--bg-soft);
  font-variant-numeric: tabular-nums;
}
.rec-score b { font-size: 16px; font-weight: 620; letter-spacing: -0.02em; line-height: 1.1; }
.rec-score span { font-size: 10px; color: var(--ink-3); }
.rec-score.good { background: var(--ok-soft); }
.rec-score.good b { color: var(--ok); }
.rec-score.low { background: var(--bad-soft); }
.rec-score.low b { color: var(--bad); }

.rec-main { flex: 1; min-width: 0; }
.rec-title {
  font-size: 14.5px;
  font-weight: 560;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rec-meta {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 3px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-variant-numeric: tabular-nums;
}
.rec-del {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-3);
  opacity: 0;
  transition: all 0.3s var(--ease);
}
.rec:hover .rec-del { opacity: 1; }
.rec-del:hover { background: var(--bad-soft); color: var(--bad); }

/* ------------------------------------------------------------ 设置页 */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-1);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.panel-head h3 { font-size: 16px; font-weight: 620; letter-spacing: -0.015em; }

.badge {
  font-size: 11.5px;
  font-weight: 560;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-3);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--bad-soft); color: var(--bad); }
.badge.wait { background: var(--accent-soft); color: var(--accent); }

.field { display: block; margin-bottom: 18px; }
.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--ink-2);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}
.field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14.5px;
  letter-spacing: 0.005em;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
  outline: none;
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-hint {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 6px;
  line-height: 1.5;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
}
.switch-title { font-size: 14.5px; font-weight: 560; }
.switch-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

.switch {
  flex: none;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: var(--line-strong);
  padding: 3px;
  transition: background-color 0.35s var(--ease);
}
.switch .knob {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.35s var(--ease);
}
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"] .knob { transform: translateX(20px); }

.panel-actions { display: flex; gap: 10px; margin-top: 22px; }
.panel-actions .btn { flex: 1; height: 44px; }

.sync-status {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 14px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
.sync-status.err { color: var(--bad); }
.sync-status.ok { color: var(--ok); }

.list-rows { display: flex; flex-direction: column; }
.row-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 2px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  transition: color 0.25s var(--ease), padding 0.3s var(--ease);
}
.row-btn:last-child { border-bottom: 0; }
.row-btn span { display: flex; flex-direction: column; gap: 3px; }
.row-btn b { font-size: 14.5px; font-weight: 560; color: var(--ink); }
.row-btn i { font-size: 12.5px; font-style: normal; color: var(--ink-3); }
.row-btn:hover { color: var(--ink); }
.row-btn.danger b { color: var(--bad); }
.row-btn svg { flex: none; transition: transform 0.35s var(--ease); }
.row-btn:hover svg { transform: translateX(3px); }

/* ------------------------------------------------------------ 底部 */
.foot {
  padding: 56px 0 20px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.7;
}

/* ------------------------------------------------------------ 题卡抽屉 */
.sheet-veil {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}
.sheet-veil.is-open { opacity: 1; pointer-events: auto; }

.sheet {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  padding: 10px 22px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.16);
  transform: translateY(102%);
  transition: transform 0.55s var(--ease-out);
}
.sheet-veil.is-open .sheet { transform: none; }
.sheet-grab {
  width: 38px;
  height: 5px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 0 auto 14px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sheet-head h3 { font-size: 16.5px; font-weight: 620; letter-spacing: -0.02em; }

.sheet-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 16px;
}
.sheet-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.done { background: var(--ink); }
.dot.cur { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot.todo { background: var(--line-strong); }

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 2px;
}
.sheet-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: all 0.28s var(--ease);
}
.sheet-cell:hover { background: var(--line); }
.sheet-cell:active { transform: scale(0.94); }
.sheet-cell.is-done { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.sheet-cell.is-cur {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 640;
}

/* ------------------------------------------------------------ 对话框 */
.dialog-veil {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.dialog-veil.is-open { opacity: 1; pointer-events: auto; }

.dialog {
  width: 100%;
  max-width: 340px;
  padding: 24px 22px 18px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  transform: scale(0.92) translateY(10px);
  transition: transform 0.45s var(--ease-out);
}
.dialog-veil.is-open .dialog { transform: none; }
.dialog h3 { font-size: 16.5px; font-weight: 620; letter-spacing: -0.02em; text-align: center; }
.dialog p {
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink-2);
  text-align: center;
  line-height: 1.65;
  white-space: pre-line;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.dialog-actions .btn { flex: 1; height: 42px; padding: 0 12px; font-size: 14.5px; }

/* ------------------------------------------------------------ Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 110;
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.92);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.005em;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transform: translate(-50%, 12px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.45s var(--ease-out);
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.err { background: rgba(196, 40, 32, 0.95); }

/* ------------------------------------------------------------ 入场动画 */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: revealIn 0.85s var(--ease-out) forwards;
}
.reveal:nth-of-type(1) { animation-delay: 0.04s; }
.reveal:nth-of-type(2) { animation-delay: 0.12s; }
.reveal:nth-of-type(3) { animation-delay: 0.2s; }
.reveal:nth-of-type(4) { animation-delay: 0.28s; }
@keyframes revealIn {
  to { opacity: 1; transform: none; }
}

/* 数字滚动 */
.count-up { display: inline-block; }

/* ------------------------------------------------------------ 响应式 */
@media (max-width: 720px) {
  main { padding: 0 18px calc(80px + env(safe-area-inset-bottom)); }
  .nav-inner { padding: 0 18px; }
  .hero { padding: 44px 0 32px; }
  .hero-sub { font-size: 15.5px; }
  .br-mobile { display: inline; }
  .stat-num { font-size: 22px; }
  .stat-row { gap: 4px; padding: 16px 2px; }
  .cat-list { gap: 36px; }
  .q-card { padding: 20px 18px 18px; border-radius: var(--r-lg); }
  .q-stem { font-size: 16px; line-height: 1.75; }
  .opt { padding: 13px 14px; }
  .opt-text { font-size: 15px; }
  .result-hero { flex-direction: column; align-items: center; text-align: center; gap: 22px; padding: 30px 0 26px; }
  .result-meta { width: 100%; }
  .result-cells { margin-top: 16px; }
  .result-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .segmented { align-self: center; }
  .rv-head { padding: 16px; }
  .rv-body-pad { padding: 0 16px 16px; }
  .result-actions .btn { padding: 0 16px; }
  .page-head { padding: 34px 0 22px; }
  .panel { padding: 18px; }
  .panel-actions { flex-direction: column; }
  .rec:hover { transform: none; }
  .rec-del { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 打印（把结算当错题本打印） */
@media print {
  .nav, .quiz-actions, .result-actions, .result-toolbar, .foot, .toast { display: none !important; }
  .rv-body { grid-template-rows: 1fr !important; }
  body { background: #fff; }
}
