:root {
  /* 温润纸感：米杏底 + 暖白卡 + 墨绿主色 + 陶橙点缀 */
  --bg: #faf6ee;
  --surface: #fffdf8;
  --surface-2: #f4eee1;
  --surface-3: #ece3d1;
  --ink: #2e3a32;
  --ink-2: #5c6a5d;
  --ink-3: #8b8575;
  --brand: #245c4b;
  --brand-deep: #174236;
  --brand-soft: #e6f0e7;
  --accent: #c87a45;
  --accent-soft: #fbeee0;
  --accent-bright: #e9a06b;
  --success: #3e7a56;
  --success-soft: #e7f2e7;
  --danger: #b8514c;
  --danger-soft: #f9e9e4;
  --line: #e9e0ce;
  --shadow: 0 8px 24px rgba(85, 68, 42, .09);
  --shadow-sm: 0 2px 10px rgba(85, 68, 42, .055);
  /* 首页四个快捷入口的暖色图标块 */
  --warm-1: #e9a06b;
  --warm-2: #7fa88a;
  --warm-3: #d9b36b;
  --warm-4: #c98b8b;
  --r-lg: 20px;
  --r-md: 15px;
  --r-sm: 10px;
  --nav-h: 68px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: #ebe3d4;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, textarea, select { outline: none; }

.app {
  position: relative;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 44px rgba(85, 68, 42, .14);
  /* clip 只裁剪圆角，不像 hidden 那样创建滚动容器（会让 header 的 sticky 失效） */
  overflow: hidden;
  overflow: clip;
}

/* ---------- Header ---------- */
.hdr {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  /* 全屏 / 刘海屏：固定页头要避开状态栏，普通设备 env() 为 0 不受影响 */
  padding: calc(9px + env(safe-area-inset-top)) 16px 9px;
  /* 纯白实底：不用半透明 / 毛玻璃，滚动时下方卡片的颜色和文字不会透上来；
     整站换成暖白纸感后，页头仍锁定纯白，保持用户确认过的「不透明」观感 */
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(85, 68, 42, .04);
  transition: box-shadow .2s ease;
}
/* 内容滚到页头下方时只用阴影分层：页头本身完全不透明，内容从下边缘「进去」 */
.hdr.scrolled { box-shadow: 0 8px 22px rgba(80, 64, 42, .15); }
.hdr-title { flex: 1; min-width: 0; display: flex; align-items: baseline; }
.hdr-title h1 { flex-shrink: 0; margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .2px; line-height: 1.3; white-space: nowrap; }
.hdr-title p {
  flex: 1; min-width: 0; margin: 0 0 0 10px;
  padding-left: 10px; border-left: 1px solid var(--line);
  font-size: 11px; line-height: 1.4; letter-spacing: .2px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 窄屏一行放不下完整副标题时整段收起，避免出现半截文字或孤零零一条竖线 */
@media (max-width: 379px) { .hdr-title p { display: none; } }
.hdr-actions { display: flex; gap: 7px; align-items: center; flex-shrink: 0; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--ink-2);
  transition: .15s;
}
.icon-btn:active { transform: scale(.93); background: var(--surface-3); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.brand { background: var(--brand-soft); color: var(--brand); }

.sync-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2);
  white-space: nowrap;
}
.sync-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.sync-pill.busy .dot { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Pages ---------- */
.page { display: none; padding: 14px 14px calc(var(--nav-h) + 34px + env(safe-area-inset-bottom)); }
.page.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 20px 2px 10px; }
.section-title h2 { margin: 0; font-size: 15px; font-weight: 700; }
.section-title .more { font-size: 12px; color: var(--brand); font-weight: 600; }
.section-title .hint { font-size: 11px; color: var(--ink-3); font-weight: 400; }

/* ---------- Cards ---------- */
/* 去掉硬边框，靠暖白卡面 + 柔和阴影在米杏底上分层，减少「表单感」 */
.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 11px; }

.hero {
  position: relative;
  overflow: hidden;
  color: #fff9ec;
  /* 墨绿实色 + 右上角一点柔光，比原来的冷蓝渐变更温润、不刺眼 */
  background: #245c4b;
  background-image: radial-gradient(circle at 88% 10%, rgba(255, 249, 236, .13), transparent 58%);
  border: 0;
  border-radius: 22px;
  padding: 18px 18px 17px;
  box-shadow: 0 12px 28px rgba(36, 92, 75, .22);
}
.hero::after {
  content: ''; position: absolute; right: -46px; top: -66px;
  width: 178px; height: 178px; border-radius: 50%;
  background: rgba(255, 249, 236, .075);
}
.hero::before {
  content: ''; position: absolute; right: 12px; bottom: -78px;
  width: 132px; height: 132px; border-radius: 50%;
  background: rgba(233, 160, 107, .12);
}
.hero > * { position: relative; z-index: 1; }
.hero-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-info { flex: 1; min-width: 0; }
.hero-label { font-size: 12px; color: #d6e7d9; letter-spacing: .3px; line-height: 1.5; }
.hero-who { display: inline-block; max-width: 10em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; color: #fff9ec; font-size: 12.5px; font-weight: 700; letter-spacing: .2px; }
.hero-count { display: flex; align-items: baseline; gap: 7px; margin: 4px 0 3px; }
.hero-count strong { font-size: 40px; line-height: 1.05; font-weight: 800; letter-spacing: -1.5px; color: #fff9ec; }
.hero-count span { font-size: 13px; color: #d6e7d9; }
.hero-sub { font-size: 12px; color: #c3dbcb; }
.hero-divider { height: 1px; background: rgba(255, 249, 236, .22); margin: 15px 0 12px; }
.hero-row { display: flex; gap: 18px; }
.hero-row > div { flex: 1; }
.hero-row .k { font-size: 11px; color: #c3dbcb; }
.hero-row .v { font-size: 17px; font-weight: 700; margin-top: 1px; color: #fff9ec; }
.progress { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, .24); overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--accent-bright); transition: width .45s ease; }
.progress.solid { background: var(--surface-3); }
.progress.solid > i { background: var(--brand); }

/* 首页今日目标进度环：纯内联 SVG，无外部字体 / 图片 */
.hero-ring { position: relative; width: 76px; height: 76px; flex-shrink: 0; display: grid; place-items: center; }
.hero-ring svg { width: 76px; height: 76px; flex-shrink: 0; }
.hero-ring .ring-bg { stroke: rgba(255, 249, 236, .2); }
.hero-ring .ring-fg {
  stroke: var(--accent-bright); stroke-linecap: round;
  animation: ringIn .9s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes ringIn {
  from { stroke-dashoffset: var(--ring-c, 207); }
  to { stroke-dashoffset: var(--ring-o, 0); }
}
.hero-ring-txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.hero-ring-txt b { font-size: 16px; font-weight: 700; line-height: 1.15; color: #fff9ec; }
.hero-ring-txt span { font-size: 10px; color: #c3dbcb; line-height: 1.2; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 12px; }
.quick {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 13px 3px 11px;
  background: var(--surface); border: 0;
  border-radius: 14px; box-shadow: var(--shadow-sm);
  font-size: 11.5px; color: var(--ink-2); font-weight: 600;
  transition: .18s cubic-bezier(.2, .8, .3, 1);
}
.quick:active { transform: translateY(2px) scale(.97); }
.quick .qi {
  width: 40px; height: 40px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--warm-1); color: #fffdf8;
}
.quick:nth-child(2) .qi { background: var(--warm-2); }
.quick:nth-child(3) .qi { background: var(--warm-3); }
.quick:nth-child(4) .qi { background: var(--warm-4); }
.quick .qi svg { width: 20px; height: 20px; }

/* ---------- Chips / filters ---------- */
/* 筛选项等宽均分一行：文字用简称，不换行也不需要横向滚动 */
.chips { display: flex; gap: 5px; padding: 2px 0 8px; }
.chip {
  flex: 1 1 0; min-width: 0; text-align: center; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  padding: 6px 3px; border-radius: 999px;
  background: var(--surface); border: 0;
  box-shadow: 0 1px 4px rgba(85, 68, 42, .05);
  font-size: 12.5px; color: var(--ink-2); font-weight: 600;
  transition: .15s;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fffdf8; box-shadow: 0 3px 10px rgba(36, 92, 75, .24); }
.chip:active { transform: scale(.96); }
/* 三项以内的筛选组保持自然胶囊宽度，不强行撑满整行 */
.chips-few .chip { flex: 0 0 auto; padding: 6px 13px; overflow: visible; }

.subtabs { display: flex; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.subtabs button { flex: 1; padding: 8px 4px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink-2); transition: .18s; }
.subtabs button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 0;
  box-shadow: var(--shadow-sm);
  border-radius: 12px; padding: 0 12px; height: 42px; margin-bottom: 10px;
}
.search svg { width: 17px; height: 17px; color: var(--ink-3); flex-shrink: 0; }
.search input { flex: 1; border: 0; background: transparent; font-size: 14px; min-width: 0; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; gap: 9px; }
.item {
  background: var(--surface); border: 0;
  border-radius: var(--r-md); padding: 14px;
  box-shadow: var(--shadow-sm);
}
.item:active { background: #fff9ee; }
.item-top { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; flex-wrap: wrap; }
.item-title { font-size: 14.5px; font-weight: 650; line-height: 1.45; margin: 0 0 4px; }
.item-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; margin: 0; }
.item-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; font-size: 11.5px; color: var(--ink-3); }
.item-foot .acts { display: flex; gap: 6px; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 10.5px; font-weight: 600; line-height: 1.7;
  background: var(--brand-soft); color: var(--brand);
  white-space: nowrap;
}
.tag.orange { background: var(--accent-soft); color: #a35f2e; }
.tag.green { background: var(--success-soft); color: var(--success); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.gray { background: var(--surface-3); color: var(--ink-2); }
.tag.purple { background: #f3e9ec; color: #8a5f70; }
.tag-btn { border: 0; cursor: pointer; font-family: inherit; letter-spacing: inherit; }
.tag-btn:active { transform: scale(.96); }

/* 学习档案 · 错题原因分析 */
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.mini-stat { background: var(--surface-2); border-radius: 11px; padding: 10px 4px; text-align: center; }
.mini-stat b { display: block; font-size: 19px; font-weight: 800; line-height: 1.25; color: var(--ink); }
.mini-stat span { font-size: 10.5px; color: var(--ink-3); }
.sub-head { font-size: 12px; font-weight: 700; color: var(--ink-2); margin: 0 0 9px; }
.rank-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 错因标记弹层 */
.reason-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.reason-opt {
  padding: 11px 8px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--ink-2);
  font-family: inherit; font-size: 13px; font-weight: 600;
}
.reason-opt.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.reason-opt:active { transform: scale(.97); }
/* 错题 PDF 导出弹层 */
.pdf-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); line-height: 1.5; cursor: pointer; margin: 2px 0 12px; }
.pdf-check input { width: 17px; height: 17px; accent-color: var(--brand); flex-shrink: 0; }

/* 兜底：内联图标统一尺寸，避免未覆盖的选择器把 SVG 撑成默认 300×150 */
svg { width: 18px; height: 18px; flex-shrink: 0; }

.mini-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  flex-shrink: 0; white-space: nowrap;
  padding: 5px 10px; border-radius: 8px;
  background: var(--surface-2); color: var(--ink-2);
  font-size: 11.5px; font-weight: 600;
}
.mini-btn svg { width: 14px; height: 14px; }
.mini-btn:active { background: var(--surface-3); }
.mini-btn.brand { background: var(--brand-soft); color: var(--brand); }
.mini-btn.danger { background: var(--danger-soft); color: var(--danger); }
.mini-btn.green { background: var(--success-soft); color: var(--success); }

.star { width: 30px; height: 30px; display: grid; place-items: center; color: var(--ink-3); border-radius: 8px; }
.star.on { color: var(--accent); }
.star svg { width: 17px; height: 17px; }

.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.empty { text-align: center; padding: 38px 18px; color: var(--ink-3); }
.empty .e-icon { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 18px; background: var(--surface-3); display: grid; place-items: center; }
.empty .e-icon svg { width: 27px; height: 27px; color: var(--ink-3); }
.empty p { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.empty small { font-size: 11.5px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  font-size: 14px; font-weight: 650;
  background: var(--surface-2); color: var(--ink-2);
  transition: .15s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--brand); color: #fffdf8; box-shadow: 0 5px 15px rgba(36, 92, 75, .24); }
.btn-accent { background: var(--accent); color: #fffdf8; box-shadow: 0 5px 15px rgba(200, 122, 69, .24); }
.btn-ghost { background: var(--surface); border: 0; box-shadow: var(--shadow-sm); color: var(--ink-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 9px; }
.btn-row > * { flex: 1; }
.btn:disabled { opacity: .45; pointer-events: none; }

.fab {
  position: fixed; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
  right: max(16px, calc((100vw - 480px) / 2 + 16px));
  z-index: 25;
  width: 52px; height: 52px; border-radius: 17px;
  display: grid; place-items: center;
  background: var(--brand); color: #fffdf8;
  box-shadow: 0 8px 22px rgba(36, 92, 75, .32);
  transition: .15s;
}
.fab:active { transform: scale(.93); }
.fab svg { width: 23px; height: 23px; }
.fab.hide { display: none; }

/* ---------- Bottom nav ---------- */
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(100%, 480px); z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch;
  /* 与页头一致：底部导航也用实色，不让页面内容透上来 */
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 18px rgba(85, 68, 42, .07);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--ink-3); font-size: 10.5px; font-weight: 600;
  position: relative; padding-top: 4px;
}
.nav-item svg { width: 21px; height: 21px; }
.nav-item.on { color: var(--brand); }
.nav-item.center { color: var(--brand); }
.nav-item.center .bubble {
  width: 50px; height: 50px; border-radius: 17px; margin-top: -22px;
  display: grid; place-items: center;
  background: var(--brand);
  color: #fffdf8; box-shadow: 0 7px 18px rgba(36, 92, 75, .32);
}
.nav-item.center .bubble svg { width: 25px; height: 25px; }
.nav-item.center span { margin-top: -1px; }
.nav-item .badge {
  position: absolute; top: 6px; left: calc(50% + 8px);
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 9px; line-height: 16px; text-align: center;
}

/* ---------- Practice ---------- */
.practice-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.practice-head .pnum { font-size: 13px; font-weight: 700; }
.practice-head .ptimer { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.q-card { padding: 17px 15px; }
.q-meta { display: flex; gap: 7px; align-items: center; margin-bottom: 11px; flex-wrap: wrap; }
.q-stem { font-size: 15.5px; line-height: 1.75; font-weight: 600; margin: 0 0 15px; white-space: pre-wrap; }
.options { display: flex; flex-direction: column; gap: 9px; }
.opt {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 13px; border-radius: 12px;
  background: var(--surface-2); border: 1.5px solid transparent;
  font-size: 14px; line-height: 1.6; text-align: left; width: 100%;
  transition: .14s;
}
.opt .letter {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: #fff; color: var(--ink-2); border: 1px solid var(--line);
}
.opt.sel { background: var(--brand-soft); border-color: var(--brand); }
.opt.sel .letter { background: var(--brand); color: #fff; border-color: var(--brand); }
.opt.correct { background: var(--success-soft); border-color: var(--success); }
.opt.correct .letter { background: var(--success); color: #fff; border-color: var(--success); }
.opt.wrong { background: var(--danger-soft); border-color: var(--danger); }
.opt.wrong .letter { background: var(--danger); color: #fff; border-color: var(--danger); }
.opt.locked { pointer-events: none; }

.feedback { margin-top: 14px; border-radius: 13px; padding: 13px 14px; animation: fade .2s ease; }
.feedback.ok { background: var(--success-soft); }
.feedback.no { background: var(--danger-soft); }
.fb-head { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; margin-bottom: 7px; }
.feedback.ok .fb-head { color: var(--success); }
.feedback.no .fb-head { color: var(--danger); }
.fb-head svg { width: 17px; height: 17px; }
.fb-line { font-size: 12.5px; color: var(--ink-2); margin: 3px 0; }
.fb-analysis { font-size: 13px; line-height: 1.7; color: var(--ink); margin: 9px 0 0; white-space: pre-wrap; }
.fb-actions { display: flex; gap: 8px; margin-top: 12px; }

.setup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.setup-row:last-child { border-bottom: 0; }
.setup-row .lbl { font-size: 13.5px; font-weight: 600; }
.setup-row .sub { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.setup-row select, .setup-row input[type="number"] {
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 9px; padding: 7px 9px; font-size: 13px; max-width: 148px;
}
.result-ring {
  width: 122px; height: 122px; margin: 6px auto 14px;
  border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--brand) var(--p, 0%), var(--surface-3) 0);
  position: relative;
}
.result-ring::before { content: ''; position: absolute; inset: 11px; border-radius: 50%; background: var(--surface); }
.result-ring .inner { position: relative; text-align: center; }
.result-ring .inner b { display: block; font-size: 29px; line-height: 1.1; font-weight: 800; }
.result-ring .inner small { font-size: 11px; color: var(--ink-3); }
.result-stats { display: flex; justify-content: space-around; text-align: center; }
.result-stats b { display: block; font-size: 19px; font-weight: 750; }
.result-stats span { font-size: 11px; color: var(--ink-3); }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.stat-box { background: var(--surface); border: 0; border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow-sm); }
.stat-box .k { font-size: 11.5px; color: var(--ink-3); }
.stat-box .v { font-size: 23px; font-weight: 800; line-height: 1.3; margin-top: 2px; }
.stat-box .v small { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-left: 2px; }

.bars { display: flex; align-items: flex-end; gap: 7px; height: 108px; padding-top: 8px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bars .bar { width: 100%; max-width: 30px; min-height: 3px; border-radius: 6px 6px 3px 3px; background: #7fa88a; transition: height .4s ease; }
.bars .bar.today { background: var(--accent-bright); }
.bars .lbl { font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.bars .val { font-size: 10px; color: var(--ink-2); font-weight: 600; }

.rank-row { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.rank-row .nm { width: 68px; flex-shrink: 0; font-size: 12px; color: var(--ink-2); }
.rank-row .track { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.rank-row .track i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.rank-row .pct { width: 42px; text-align: right; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

.tip { display: flex; gap: 9px; padding: 11px 12px; border-radius: 11px; background: var(--accent-soft); color: #9c5c2e; font-size: 12.5px; line-height: 1.6; }
.tip svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

/* ---------- Settings rows ---------- */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .lbl { font-size: 13.5px; font-weight: 600; }
.set-row .sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; line-height: 1.5; }
.set-row input[type="text"], .set-row input[type="date"], .set-row input[type="number"], .set-row input[type="url"] {
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 9px; padding: 8px 10px; font-size: 13px; width: 155px; text-align: right;
}
.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; border-radius: 99px; background: var(--surface-3); transition: .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: .2s; }
.switch.on { background: var(--brand); }
.switch.on i { left: 21px; }

/* ---------- 批量导入预览 ---------- */
.help { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; margin-top: 6px; }
.mt8 { margin-top: 8px; }
.batch-all { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.batch-all input, .batch-row input { width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--brand); }
.batch-list { max-height: 52dvh; overflow-y: auto; margin-bottom: 12px; }
.batch-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.batch-row:last-child { border-bottom: 0; }
.batch-body { min-width: 0; flex: 1; }
.batch-stem { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.batch-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 4px; }
.batch-meta .tag { font-size: 10.5px; padding: 2px 7px; }
.batch-opts { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Sheet / modal ---------- */
.mask { position: fixed; inset: 0; z-index: 60; background: rgba(40, 48, 38, .42); opacity: 0; pointer-events: none; transition: .22s; }
.mask.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 61; bottom: 0; left: 50%;
  width: min(100%, 480px); transform: translate(-50%, 105%);
  max-height: 88dvh; overflow-y: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  transition: transform .26s cubic-bezier(.22,.8,.3,1);
  box-shadow: 0 -10px 40px rgba(70, 58, 40, .18);
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-handle { width: 38px; height: 4px; border-radius: 9px; background: var(--surface-3); margin: 4px auto 12px; }
.sheet h3 { margin: 0 0 3px; font-size: 17px; font-weight: 750; }
.sheet .sheet-sub { margin: 0 0 15px; font-size: 12px; color: var(--ink-3); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 650; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 11px; padding: 10px 12px; font-size: 14px; line-height: 1.6;
}
.field textarea { resize: vertical; min-height: 84px; }
.field .help { font-size: 11px; color: var(--ink-3); margin-top: 5px; line-height: 1.5; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-footer { display: flex; gap: 9px; margin-top: 16px; }
.sheet-footer .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 14px); opacity: 0; pointer-events: none;
  background: rgba(38, 52, 43, .94); color: #fffdf8;
  padding: 10px 16px; border-radius: 11px; font-size: 13px;
  max-width: 86vw; text-align: center; box-shadow: 0 8px 22px rgba(0,0,0,.18);
  transition: .22s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Misc ---------- */
.note { font-size: 11.5px; color: var(--ink-3); line-height: 1.65; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.hide { display: none !important; }
.chev { color: var(--ink-3); font-size: 18px; line-height: 1; }

/* ---------- 答题计时 / 科目用时 ---------- */
.ptimers { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ptimers #qTimer { background: var(--surface-2); color: var(--ink-2); border-radius: 99px; padding: 3px 9px; }
.ptimers #qTimer.danger { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.rank-row .nm { width: 62px; }
.rank-row .pct { width: 38px; }
.rank-row .avg { width: 46px; flex-shrink: 0; text-align: right; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- 题目图片 / 拍照识字 ---------- */
.media-tools { display: inline-flex; gap: 5px; margin-left: 6px; vertical-align: middle; font-weight: 400; }
.field label .media-tools .mini-btn { font-size: 10.5px; padding: 3px 7px; }
.media-thumb { display: flex; align-items: flex-start; gap: 8px; margin-top: 7px; }
.thumb-img { width: 84px; height: 84px; object-fit: cover; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.q-media { margin: 0 0 12px; }
.q-img { display: block; max-width: 100%; max-height: 320px; width: auto; height: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.opt .opt-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.opt-img { display: block; }
.opt-img .q-img { max-height: 170px; }
.img-missing { font-size: 11px; color: var(--ink-3); }
.judge-opts { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); padding: 8px 0; }
.ocr-status { background: var(--brand-soft); color: var(--brand-deep); font-size: 12px; padding: 8px 10px; border-radius: 9px; margin-bottom: 12px; }

/* ---------- 温润纸感 · 首页细节 ---------- */
/* 首页用一道暖色细边代替「每张卡都描边」，其余页面保持安静 */
#homePoint .card { border-left: 4px solid var(--accent-bright); }
#homeNews .item { border-left: 3px solid var(--warm-2); }
#homeNews .item:nth-child(2) { border-left-color: var(--warm-3); }
#homeNews .item:nth-child(3) { border-left-color: var(--warm-4); }

/* 首屏内容轻微错峰入场，避免整页一起闪 */
@keyframes riseIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
#page-home.active .hero { animation: riseIn .36s cubic-bezier(.2, .8, .3, 1) both; }
#page-home.active .quick { animation: riseIn .34s cubic-bezier(.2, .8, .3, 1) both; }
#page-home.active .quick:nth-child(2) { animation-delay: .05s; }
#page-home.active .quick:nth-child(3) { animation-delay: .1s; }
#page-home.active .quick:nth-child(4) { animation-delay: .15s; }
#page-home.active #homePoint, #page-home.active #homeNews { animation: riseIn .4s ease .12s both; }

/* 刷题 / 答题区保持接近纯白的高对比，不铺大面积暖色，长时间做题不累眼；
   只作用于未选择的选项，避免覆盖选中 / 正确 / 错误的语义配色 */
#page-practice .q-card { background: #ffffff; }
#page-practice .opt:not(.sel):not(.correct):not(.wrong) { background: #faf6ee; }

@media (prefers-reduced-motion: reduce) {
  #page-home.active .hero, #page-home.active .quick,
  #page-home.active #homePoint, #page-home.active #homeNews,
  .hero-ring .ring-fg { animation: none; }
}

@media (min-width: 520px) {
  /* 顶部不留白：否则页头固定后，内容会从页头上方露出一条 */
  body { padding: 0 0 22px; }
  .app { min-height: calc(100dvh - 22px); border-radius: 24px; }
  .hdr { border-radius: 24px 24px 0 0; }
  .nav { border-radius: 0 0 24px 24px; bottom: 22px; }
  .sheet { border-radius: 22px; bottom: 22px; }
  .toast { bottom: 110px; }
  .fab { bottom: 110px; }
}
