
/* ============================================================
   设计系统 v3
   品牌：墨绿（成长）× 暖纸白（专注）× 琥珀（激励）
   间距 4px 网格 · 圆角 sm10/md14/lg20/xl24 · 阴影 3 级
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #f6f4ef;
  --surface: #fffefa;
  --ink: #1f2a26;
  --ink-2: #66716c;
  --ink-3: #98a19d;
  --line: #e9e5db;
  --brand: #1e6b54;
  --brand-deep: #0e4635;
  --brand-soft: #e0eee7;
  --brand-tint: #f2f8f5;
  --blue: #3b6ea5;
  --blue-soft: #e9eff7;
  --red: #c25b4c;
  --red-soft: #f8e9e6;
  --amber: #b97f2e;
  --amber-soft: #f6eeda;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --sh-1: 0 1px 2px rgba(31,42,38,.04), 0 4px 12px rgba(31,42,38,.05);
  --sh-2: 0 2px 4px rgba(31,42,38,.05), 0 14px 34px rgba(31,42,38,.09);
  --sh-3: 0 4px 8px rgba(14,70,53,.1), 0 18px 44px rgba(14,70,53,.2);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ===================== 应用框架 ===================== */
.app {
  max-width: 520px; margin: 0 auto;
  min-height: 100vh;
  display: flex; flex-direction: column;
  position: relative;
  background: linear-gradient(180deg, #f8f6f1 0%, var(--bg) 180px);
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 10px;
  background: linear-gradient(#f8f6f1 78%, rgba(246,244,239,0));
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; letter-spacing: .01em; color: var(--brand-deep); }
.brand .ic { width: 23px; height: 23px; stroke-width: 1.9; }
.streak-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--amber);
  background: var(--amber-soft); border-radius: 999px; padding: 5px 12px;
  font-weight: 700;
}
.streak-chip .ic { width: 15px; height: 15px; fill: currentColor; stroke: none; }

#view { flex: 1; padding: 6px 20px 100px; }
main > section { animation: fadeUp .38s var(--ease-out); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 520px; margin: 0 auto;
  display: flex; z-index: 30;
  background: rgba(255,254,250,.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 7px 12px calc(8px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; background: none; cursor: pointer;
  font-size: 11.5px; color: var(--ink-3); padding: 7px 0 6px;
  font-family: inherit; border-radius: 14px;
  transition: background .25s ease, color .25s ease;
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease-spring); }
.tab.on { color: var(--brand); font-weight: 700; background: var(--brand-soft); }
.tab.on svg { transform: translateY(-1px); }
.tab:hover { color: var(--ink-2); }
.tab.on:hover { color: var(--brand); }

/* ===================== 通用控件 ===================== */
.btn {
  font-family: inherit; font-size: 15px; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius-md);
  padding: 13px 18px;
  transition: transform .12s var(--ease-out), background .2s ease, box-shadow .25s ease, border-color .2s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn:active { transform: scale(.97); }
.btn-lg { padding: 15px 18px; font-size: 16px; border-radius: 16px; }
.btn-ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary {
  background: linear-gradient(180deg, #278163 0%, var(--brand) 55%, #1a5f4a 100%);
  color: #fff; font-weight: 700;
  box-shadow: 0 4px 16px rgba(30,107,84,.32), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn.primary:hover { box-shadow: 0 7px 22px rgba(30,107,84,.4), inset 0 1px 0 rgba(255,255,255,.18); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(0) scale(.97); }
.btn.ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); font-weight: 600; }
.btn.ghost:hover { border-color: #d5d0c2; color: var(--ink); box-shadow: var(--sh-1); }
.btn.ghost.sm { padding: 8px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn.ghost.danger { color: var(--red); border-color: #ecd3ce; }
.btn.ghost.danger:hover { background: var(--red-soft); border-color: #e2b9b2; }
.btn-block { display: flex; width: 100%; }
.tip { font-size: 12.5px; color: var(--ink-3); margin-top: 14px; text-align: center; }

/* ===================== 单词本 ===================== */
.libs { margin-top: 22px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 11px; }
.sec-head h2 { font-size: 17px; font-weight: 800; }
.sec-head span { font-size: 12px; color: var(--ink-3); }
.lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.lib-card {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 16px;
  padding: 13px 14px 11px; text-align: left; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; gap: 7px;
  transition: transform .16s var(--ease-out), border-color .2s ease, box-shadow .25s ease, background .2s ease;
}
.lib-card:hover { transform: translateY(-2px); border-color: #c9d6ce; box-shadow: 0 6px 18px rgba(30,60,48,.08); }
.lib-card:active { transform: scale(.97); }
.lib-card.cur { border-color: var(--brand); background: var(--brand-tint); }
.lib-card.cur:hover { border-color: var(--brand); }
.lib-top { display: flex; align-items: center; justify-content: space-between; }
.lib-top b { font-size: 16px; font-weight: 800; letter-spacing: .2px; }
.lib-chip {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  color: var(--ink-2); background: var(--bg);
}
.lib-card.cur .lib-chip { color: var(--brand); background: #e3efe8; }
.lib-count { font-size: 11.5px; color: var(--ink-3); }
.lib-bar { height: 5px; border-radius: 99px; background: #ece9df; overflow: hidden; }
.lib-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #3fa887); transition: width .5s var(--ease-out); }
.lib-card.cur .lib-bar i { background: linear-gradient(90deg, #1c6b52, #35a07f); }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--sh-1);
}
.panel-title { font-size: 12.5px; font-weight: 800; color: var(--ink-2); letter-spacing: .06em; margin-bottom: 14px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ===================== 首页 ===================== */
.week-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 6px 4px 16px;
}
.w-dots { display: flex; gap: 9px; }
.w-dot { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.w-dot i {
  width: 26px; height: 26px; border-radius: 50%;
  background: #eae7dd; display: block;
  transition: background .25s ease, transform .3s var(--ease-spring), box-shadow .25s ease;
}
.w-dot em { font-style: normal; font-size: 10.5px; color: var(--ink-3); }
.w-dot.on i { background: var(--brand); box-shadow: 0 3px 8px rgba(30,107,84,.3); animation: dotPop .4s var(--ease-spring); }
.w-dot.on em { color: var(--brand); font-weight: 700; }
.w-dot.today i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.w-dot.today.on i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand), 0 3px 8px rgba(30,107,84,.3); }
@keyframes dotPop { from { transform: scale(.4); } to { transform: scale(1); } }
.w-streak { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.w-streak svg { width: 15px; height: 15px; fill: var(--amber); stroke: none; animation: flame 2.4s ease-in-out infinite; }
.w-streak b { color: var(--amber); font-size: 14px; }
@keyframes flame { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }

.hero-card {
  position: relative; overflow: hidden;
  background: linear-gradient(158deg, #2a8767 0%, #17573f 55%, #0e4635 100%);
  color: #fff; border-radius: var(--radius-xl); padding: 22px 22px 20px;
  box-shadow: var(--sh-3), inset 0 1px 0 rgba(255,255,255,.18);
  margin-bottom: 16px;
}
.hero-card::before {
  content: ""; position: absolute; top: -90px; right: -60px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.16), rgba(255,255,255,0) 62%);
  pointer-events: none;
}
.hero-card::after {
  content: ""; position: absolute; bottom: -120px; left: -70px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle at 70% 70%, rgba(255,255,255,.06), rgba(255,255,255,0) 60%);
  pointer-events: none;
}
.hero-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.hero-date { letter-spacing: .06em; opacity: .85; font-weight: 600; }
.hero-goal { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.16); padding: 3px 11px; border-radius: 999px; font-weight: 600; backdrop-filter: blur(4px); }
.hero-main { position: relative; z-index: 1; display: flex; align-items: center; gap: 22px; margin-top: 18px; }
.hero-ring-big { position: relative; width: 148px; height: 148px; flex: none; }
.hero-ring-big svg { width: 148px; height: 148px; transform: rotate(-90deg); }
.hero-ring-big .ring-track { stroke: rgba(255,255,255,.16); }
.hero-ring-big .ring-val { stroke: #fff; stroke-linecap: round; filter: drop-shadow(0 2px 6px rgba(255,255,255,.35)); transition: stroke-dashoffset .9s var(--ease-out); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center b { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ring-center span { font-size: 11.5px; opacity: .78; margin-top: 1px; letter-spacing: .08em; }
.hero-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.mini-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.mini-label { width: 26px; opacity: .82; font-weight: 600; }
.mini-row .bar { flex: 1; height: 7px; background: rgba(255,255,255,.15); border-radius: 99px; overflow: hidden; }
.mini-row .bar i { display: block; height: 100%; background: #fff; border-radius: 99px; box-shadow: 0 1px 4px rgba(255,255,255,.4); transition: width .7s var(--ease-out); }
.mini-row .bar i.rev { background: #ffd9a0; box-shadow: 0 1px 4px rgba(255,210,150,.45); }
.mini-row b { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.mini-note { font-size: 12px; opacity: .78; margin-top: 2px; }

/* ===================== 学习卡片（3D 翻面） ===================== */
.session-head { display: flex; align-items: center; gap: 10px; margin: 8px 4px 14px; }
.chip { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 12px; letter-spacing: .04em; }
.chip.learn { color: var(--brand); background: var(--brand-soft); }
.chip.review { color: var(--blue); background: var(--blue-soft); }
.counter { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.wrong-tag { margin-left: auto; font-size: 11.5px; color: var(--red); background: var(--red-soft); border-radius: 999px; padding: 3px 10px; font-weight: 600; }

.flip-scene { perspective: 1400px; margin-bottom: 16px; }
.flip-inner { display: grid; position: relative; transition: transform .55s var(--ease-out); transform-style: preserve-3d; }
.flip-scene.flipped .flip-inner { transform: rotateY(180deg); }
.face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face-back { transform: rotateY(180deg); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl);
  box-shadow: var(--sh-2), inset 0 1px 0 rgba(255,255,255,.8);
  padding: 34px 26px;
  min-height: 340px;
}
.card.front-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.f-word {
  font-size: 48px; font-weight: 800; letter-spacing: -.03em; color: var(--ink);
  word-break: break-all; line-height: 1.12;
}
.f-phon {
  margin-top: 14px; font-size: 15px; color: var(--ink-3); letter-spacing: .03em;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 14px; min-height: 28px; display: inline-flex; align-items: center;
}
.f-hint { font-size: 12.5px; color: var(--ink-3); margin: 26px 0 20px; }
.f-actions { display: flex; align-items: center; justify-content: center; }

.speak-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--brand);
  border-radius: 999px; padding: 9px 18px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: transform .12s var(--ease-out), box-shadow .22s ease, border-color .2s ease, background .2s ease;
}
.speak-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.speak-btn:hover { border-color: #bcd8cc; box-shadow: 0 4px 14px rgba(30,107,84,.18); }
.speak-btn:active { transform: scale(.93); }

.back-card { padding: 26px; min-height: 340px; display: flex; flex-direction: column; }
.back-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.back-word b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.back-word span { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-3); }
.back-speak .speak-btn { padding: 9px; border-radius: 50%; width: 42px; height: 42px; }
.back-speak .speak-btn svg { width: 19px; height: 19px; }
.card-body { flex: 1; min-width: 0; }
.defs { display: flex; flex-direction: column; gap: 10px; }
.def { font-size: 17px; color: var(--ink); line-height: 1.5; }
.def-type {
  display: inline-block; min-width: 30px; margin-right: 9px;
  font-size: 11.5px; font-weight: 800; color: var(--blue);
  background: var(--blue-soft); border-radius: 7px; padding: 2px 7px; text-align: center;
  vertical-align: 2.5px;
}
.block-title { font-size: 12px; font-weight: 800; color: var(--ink-3); margin: 18px 0 9px; letter-spacing: .1em; display: flex; align-items: center; gap: 8px; }
.block-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.phrases { background: var(--brand-tint); border: 1px solid #e3efe9; border-radius: var(--radius-md); padding: 6px 14px; }
.phrase { font-size: 14px; color: var(--ink-2); padding: 8px 0; display: flex; align-items: baseline; gap: 10px; }
.phrase + .phrase { border-top: 1px dashed #dcebe3; }
.phrase b { color: var(--brand-deep); font-weight: 700; white-space: nowrap; }
.phrase span { flex: 1; }
.sents { display: flex; flex-direction: column; gap: 9px; }
.sent {
  position: relative; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 12px 14px 11px 36px;
}
.sent .q-ic { position: absolute; left: 13px; top: 13px; width: 15px; height: 15px; color: var(--ink-3); opacity: .7; }
.sent p { color: var(--ink); font-size: 14px; margin-bottom: 2px; }
.sent span { font-size: 12.5px; color: var(--ink-3); }

.grade-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; animation: fadeUp .3s var(--ease-out); }
.grade-row:has(> :nth-child(4)) { grid-template-columns: repeat(4, 1fr); }
.grade {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 6px; font-size: 13px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-weight: 600; font-family: inherit; cursor: pointer;
  transition: transform .12s var(--ease-out), box-shadow .22s ease, background .2s ease, border-color .2s ease;
}
.grade .g-ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.grade:active { transform: scale(.93); }
.grade.again { color: var(--red); border-color: #e7c4be; background: var(--red-soft); }
.grade.again:hover { box-shadow: 0 5px 14px rgba(194,91,76,.22); }
.grade.hard { color: var(--amber); border-color: #e8d3a6; background: var(--amber-soft); }
.grade.hard:hover { box-shadow: 0 5px 14px rgba(185,127,46,.22); }
.grade.good { color: var(--brand); border-color: #bfddd1; background: #eef7f3; }
.grade.good:hover { box-shadow: 0 5px 14px rgba(30,107,84,.22); }
.grade.easy { color: var(--blue); border-color: #c5d6ea; background: #f1f6fb; }
.grade.easy:hover { box-shadow: 0 5px 14px rgba(56,103,154,.22); }
.reveal { margin-top: 2px; }

/* ===================== 完成页 ===================== */
.finish { text-align: center; padding-top: 44px; }
.badge-wrap { position: relative; width: 96px; height: 96px; margin: 0 auto 22px; }
.halo {
  position: absolute; inset: -12px; border-radius: 50%;
  background: radial-gradient(circle, rgba(30,107,84,.14) 0%, rgba(30,107,84,0) 66%);
  animation: haloPulse 1.8s var(--ease-out) infinite;
}
@keyframes haloPulse { 0%, 100% { transform: scale(.92); opacity: .7; } 50% { transform: scale(1.06); opacity: 1; } }
.finish-mark {
  position: relative; width: 96px; height: 96px; border-radius: 50%;
  background: linear-gradient(160deg, #2a8767, var(--brand-deep));
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 28px rgba(30,107,84,.36), inset 0 2px 0 rgba(255,255,255,.22);
  animation: popIn .55s var(--ease-spring);
}
.finish-mark .finish-check { width: 46px; height: 46px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 34; stroke-dashoffset: 34; animation: draw .6s .3s var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes popIn { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.finish h2 { font-size: 24px; font-weight: 800; letter-spacing: .01em; }
.finish-sub { color: var(--ink-2); margin: 8px 0 28px; }
.finish-nums { display: flex; gap: 10px; margin-bottom: 20px; }
.num {
  flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 8px; box-shadow: var(--sh-1);
  animation: fadeUp .45s var(--ease-out) both;
}
.num:nth-child(2) { animation-delay: .08s; }
.num:nth-child(3) { animation-delay: .16s; }
.num b { display: block; font-size: 26px; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.num span { font-size: 12px; color: var(--ink-3); }
.finish-note { font-size: 13px; color: var(--ink-2); margin-bottom: 24px; }
.finish-note b { color: var(--brand); font-weight: 700; }

/* ===================== 统计 ===================== */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 15px 16px 14px; box-shadow: var(--sh-1);
  position: relative; overflow: hidden;
  transition: transform .2s var(--ease-out), box-shadow .25s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.stat-card::after {
  content: ""; position: absolute; top: 0; right: 0; left: 0; height: 3px;
  opacity: .9;
}
.stat-card.tone-green::after { background: linear-gradient(90deg, #278163, #7fbda8); }
.stat-card.tone-amber::after { background: linear-gradient(90deg, #d69f4f, #f0cd94); }
.stat-card.tone-blue::after { background: linear-gradient(90deg, #3b6ea5, #8fb2d8); }
.stat-card.tone-red::after { background: linear-gradient(90deg, #c25b4c, #e09a8f); }
.stat-ic {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-tint); color: var(--brand);
}
.stat-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tone-amber .stat-ic { background: var(--amber-soft); color: var(--amber); }
.tone-blue .stat-ic { background: var(--blue-soft); color: var(--blue); }
.tone-red .stat-ic { background: var(--red-soft); color: var(--red); }
.stat-card b { display: block; font-size: 27px; font-weight: 800; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.stat-card > span:not(.stat-ic) { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.stat-card em { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.chart-bars { width: 100%; height: auto; display: block; }
.chart-bars .axis { stroke: var(--line); stroke-width: 1; }
.chart-bars text { font-size: 10.5px; fill: var(--ink-3); text-anchor: middle; font-family: inherit; }
.dot-mark { fill: var(--brand); opacity: .5; }
.dot-mark.idle { fill: #dcd8cc; }
.bar-new { fill: var(--blue); }
.bar-rev { fill: var(--brand); }
.bar-new.idle, .bar-rev.idle { fill: #e8e4da; }
.chart-bars rect { transform-origin: 50% 100%; animation: growBar .55s var(--ease-out) both; }
@keyframes growBar { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.legend { display: flex; justify-content: flex-end; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg::before { content: ""; width: 10px; height: 10px; border-radius: 3px; }
.lg-new::before { background: var(--blue); }
.lg-rev::before { background: var(--brand); }

.mastery { display: flex; flex-direction: column; gap: 13px; }
.m-seg { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: #ece9e0; gap: 2px; }
.m-seg i { border-radius: 99px; transition: width .7s var(--ease-out); min-width: 0; }
.m-new { background: var(--blue); }
.m-learning { background: var(--amber); }
.m-mastered { background: var(--brand); }
.m-legend { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-2); }
.m-legend span { display: inline-flex; align-items: center; gap: 5px; }
.m-legend i { width: 9px; height: 9px; border-radius: 3px; }
.m-legend b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.d-new { background: var(--blue); }
.d-learning { background: var(--amber); }
.d-mastered { background: var(--brand); }

.heat-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.heat-head b { color: var(--brand); }
.heat-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.cell { aspect-ratio: 1; border-radius: 5px; background: #ece9e0; transition: transform .15s ease, background .2s ease; }
.cell:hover { transform: scale(1.18); }
.cell.l1 { background: #cfe4da; }
.cell.l2 { background: #7fbda8; }
.cell.l3 { background: var(--brand); }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin-top: 10px; font-size: 11px; color: var(--ink-3); }
.heat-legend .cell { width: 13px; height: 13px; }

/* ===================== 错词本 ===================== */
.wrong-actions { display: flex; gap: 10px; margin-bottom: 4px; }
.wrong-actions .btn { flex: 1; }
.wrong-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.wrong-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; display: flex; align-items: center; gap: 10px; box-shadow: var(--sh-1);
  animation: fadeUp .35s var(--ease-out) both;
  transition: transform .2s var(--ease-out), box-shadow .25s ease;
}
.wrong-item:hover { transform: translateX(3px); box-shadow: var(--sh-2); }
.wrong-main { flex: 1; min-width: 0; }
.wrong-main b { font-size: 17px; margin-right: 8px; }
.wrong-main span { font-size: 13px; color: var(--ink-2); }
.wrong-main .def-type { vertical-align: 1px; }
.wrong-count { font-size: 12px; color: var(--red); font-weight: 800; }
.empty { text-align: center; padding-top: 64px; color: var(--ink-2); }
.empty-icon {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  animation: popIn .5s var(--ease-spring);
}
.empty-icon svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.empty-icon path { stroke-dasharray: 44; stroke-dashoffset: 44; animation: draw .7s .2s var(--ease-out) forwards; }
.empty p { font-size: 16px; font-weight: 700; color: var(--ink); }
.empty span { font-size: 13px; color: var(--ink-3); }

/* ===================== 设置 ===================== */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; font-size: 14.5px; }
.setting-row + .setting-row { border-top: 1px solid #f3f1ea; }
.seg { display: flex; background: #f0eee6; border-radius: 11px; padding: 3px; gap: 2px; }
.seg-btn {
  border: 0; background: none; font-family: inherit; font-size: 13px; color: var(--ink-2);
  padding: 6px 12px; border-radius: 9px; cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { background: #fff; color: var(--brand); font-weight: 700; box-shadow: 0 1px 5px rgba(31,42,38,.1); }
.switch { position: relative; display: inline-block; width: 46px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; background: #dcd8cc; border-radius: 99px; transition: background .22s ease; cursor: pointer;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  background: #fff; border-radius: 50%; transition: transform .25s var(--ease-spring);
  box-shadow: 0 1px 3px rgba(0,0,0,.16);
}
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(19px); }
.data-actions { display: flex; gap: 8px; }
.about { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }

/* ===================== Toast ===================== */
#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(10px);
  background: rgba(31,42,38,.94); color: #fff; font-size: 13.5px;
  padding: 10px 20px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .3s var(--ease-out); z-index: 50;
  max-width: 82vw; text-align: center;
  box-shadow: 0 8px 24px rgba(31,42,38,.24);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== 悬浮添加 & 添加面板 ===================== */
.fab {
  position: fixed; right: 22px; bottom: calc(92px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(180deg, #278163 0%, var(--brand) 55%, #1a5f4a 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(30,107,84,.36), inset 0 1px 0 rgba(255,255,255,.2);
  z-index: 45;
  transition: transform .15s var(--ease-out), box-shadow .25s ease;
}
.fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 26px rgba(30,107,84,.44), inset 0 1px 0 rgba(255,255,255,.2); }
.fab:active { transform: scale(.94); }

.sheet-mask {
  position: fixed; inset: 0; background: rgba(15,25,22,.44);
  z-index: 60; animation: maskIn .25s ease both;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 520px; margin: 0 auto;
  background: var(--surface); border-radius: 24px 24px 0 0;
  z-index: 61; padding: 8px 22px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(15,25,22,.16);
  animation: sheetUp .38s var(--ease-out) both;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 40px; height: 4.5px; border-radius: 99px; background: #e2ded2; margin: 2px auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h3 { font-size: 18px; font-weight: 800; }
.sheet-close {
  border: 0; background: var(--bg); width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-2);
  transition: background .2s ease, color .2s ease, transform .12s var(--ease-out);
}
.sheet-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sheet-close:hover { background: #eceae2; color: var(--ink); }
.sheet-close:active { transform: scale(.9); }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 14px 0 8px; }
.field {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 13px;
  padding: 12px 14px; outline: none;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.field:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(30,107,84,.12); }
.field::placeholder { color: var(--ink-3); }
textarea.field { resize: none; line-height: 1.5; }
.match-box { min-height: 0; }
.match-box:not(:empty) { margin-top: 10px; }
.match {
  border-radius: 12px; padding: 10px 13px; font-size: 13.5px;
  display: flex; flex-direction: column; gap: 5px; animation: fadeUp .25s var(--ease-out) both;
}
.match b { font-weight: 700; }
.match-box.ok .match { background: var(--brand-tint); border: 1px solid #dcebe3; color: var(--ink-2); }
.match-box.ok .match b { color: var(--brand); }
.match-box.warn .match { background: var(--amber-soft); border: 1px solid #ecdcb6; color: var(--ink-2); }
.match-box.warn .match b { color: var(--amber); }
.match .def-type { vertical-align: 1.5px; margin-right: 6px; }
.add-submit { margin-top: 20px; }

.manual-tag {
  font-size: 11.5px; color: var(--amber); background: var(--amber-soft);
  border-radius: 999px; padding: 3px 10px; font-weight: 700; white-space: nowrap;
}

/* ===================== 骨架屏 ===================== */
#skeleton {
  position: fixed; inset: 0; z-index: 90;
  background: linear-gradient(180deg, #f8f6f1 0%, var(--bg) 180px);
  transition: opacity .45s ease;
  pointer-events: none;
}
#skeleton.hide { opacity: 0; }
.sk-inner { max-width: 520px; margin: 0 auto; padding: 18px 18px calc(130px + env(safe-area-inset-bottom)); }
.sk-b {
  background: linear-gradient(100deg, #e9e6dc 30%, #f5f3ec 50%, #e9e6dc 70%);
  background-size: 220% 100%;
  animation: skShimmer 1.6s linear infinite;
  border-radius: 8px;
}
@keyframes skShimmer { from { background-position: 130% 0; } to { background-position: -130% 0; } }
.sk-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.sk-logo { width: 88px; height: 22px; border-radius: 8px; }
.sk-pill { width: 52px; height: 24px; border-radius: 999px; }
.sk-week { display: flex; align-items: center; gap: 15px; margin-bottom: 16px; }
.sk-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.sk-flame { width: 66px; height: 16px; border-radius: 8px; margin-left: auto; }
.sk-hero {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--sh-1); margin-bottom: 14px;
}
.sk-row { display: flex; justify-content: space-between; margin-bottom: 18px; }
.sk-line { height: 14px; }
.w50 { width: 50%; } .w40 { width: 40%; } .w30 { width: 30%; } .w70 { width: 70%; } .w60 { width: 60%; }
.sk-hero-main { display: flex; align-items: center; gap: 20px; }
.sk-ring { width: 108px; height: 108px; border-radius: 50%; flex: none; }
.sk-side { flex: 1; display: flex; flex-direction: column; gap: 13px; }
.sk-bar { height: 10px; border-radius: 99px; }
.sk-btn { height: 50px; border-radius: var(--radius-md); margin-bottom: 24px; }
.sk-sec { margin-bottom: 10px; }
.sk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.sk-card {
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 13px 14px;
  display: flex; flex-direction: column; gap: 9px;
}
.sk-track { height: 5px; border-radius: 99px; }
.sk-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 520px; margin: 0 auto;
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}
.sk-tab { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sk-ico { width: 22px; height: 22px; border-radius: 7px; }
@media (prefers-reduced-motion: reduce) {
  #skeleton .sk-b { animation: none; background: #e9e6dc; }
}

/* ===================== 动效：尊重系统减弱动效设置 ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}


/* ===== shell ===== */
/* ============================================================
   PC shell + reading module
   在 template.html 既有设计系统上扩展，不替换原移动端样式。
   ============================================================ */

:root {
  --sidebar-w: 240px;
  --topbar-h: 72px;
  --content-max: 980px;
  --rail-w: 300px;
}

html, body { min-height: 100%; }
body { background: var(--bg); }
.app { max-width: none; margin: 0; background: var(--bg); }
#app { min-height: 100vh; }
#view.content { padding: 28px 32px 80px; }
main > section { animation: fadeUp .3s var(--ease-out); }

a { color: inherit; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ===================== 布局 ===================== */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.shell-main { min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 254, 250, .66);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 25;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 22px;
  text-decoration: none; color: var(--brand-deep);
  font-weight: 800; font-size: 16px; letter-spacing: .01em;
}
.side-mark {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  box-shadow: 0 6px 16px rgba(30,107,84,.24);
}
.side-mark .ic { width: 20px; height: 20px; }
.side-nav { display: flex; flex-direction: column; gap: 20px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-label {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; padding: 0 12px 8px;
}
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  text-decoration: none; color: var(--ink-2);
  font-size: 13.5px; font-weight: 550;
  transition: background .18s ease, color .18s ease;
}
.side-link .ic { width: 18px; height: 18px; opacity: .78; }
.side-link:hover { background: var(--brand-tint); color: var(--brand-deep); }
.side-link.on { background: var(--brand-soft); color: var(--brand-deep); font-weight: 700; }
.side-link.on .ic { opacity: 1; }
.side-link.soon { opacity: .58; }
.side-link em {
  margin-left: auto; font-style: normal; font-size: 9px;
  letter-spacing: .04em; text-transform: uppercase;
  background: var(--amber-soft); color: var(--amber);
  padding: 2px 5px; border-radius: 5px;
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; text-decoration: none;
  color: var(--ink-2); font-size: 13px; border-radius: 10px;
}
.side-user:hover { background: var(--brand-tint); }
.side-user .ic { width: 18px; height: 18px; }
.side-version { padding: 8px 12px 0; font-size: 10px; color: var(--ink-3); }

.shell-topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 244, 239, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.shell-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shell-crumb { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.shell-title h1 { font-size: 19px; line-height: 1.2; color: var(--ink); }
.shell-actions { display: flex; align-items: center; gap: 14px; }

.global-search {
  display: flex; align-items: center; gap: 8px;
  width: 280px; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface);
  color: var(--ink-3);
}
.global-search .search-ic { width: 16px; height: 16px; flex: none; }
.global-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 12.5px; color: var(--ink);
}
.global-search kbd {
  font-size: 10px; color: var(--ink-3); border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 5px; background: var(--bg);
}
.streak-chip { text-decoration: none; white-space: nowrap; }
.streak-chip .flame-ic { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; text-decoration: none;
  background: var(--brand-soft); color: var(--brand-deep);
  font-size: 12px; font-weight: 800;
  border: 1px solid rgba(30,107,84,.12);
}

.content {
  width: 100%; max-width: var(--content-max);
  margin: 0 auto; padding: 28px 32px 80px;
}
.content-wide { max-width: 1180px; }

/* 桌面端旧页面栅格 */
@media (min-width: 1024px) {
  .lib-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .home .hero-card { padding: 24px 26px; }
  .home > .btn-block { max-width: 320px; }
}

/* ===================== 今日阅读 ===================== */
.today-reading { margin: 22px 0 6px; }
.today-rd-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.today-rd-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--sh-1);
  transition: transform .18s var(--ease-out), box-shadow .18s ease, border-color .18s ease;
}
.today-rd-card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: rgba(30,107,84,.24); }
.today-rd-cover {
  width: 46px; height: 56px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--brand-soft), #f7ead0);
  color: var(--brand-deep); font-size: 12px; font-weight: 800;
}
.today-rd-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.today-rd-main b { font-size: 13.5px; line-height: 1.3; }
.today-rd-main em { font-style: normal; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-rd-main span { font-size: 10.5px; color: var(--ink-3); }
.today-rd-arrow { margin-left: auto; color: var(--brand); font-size: 18px; }
.reading-loading { padding: 16px 18px; color: var(--ink-3); font-size: 12.5px; }

/* ===================== 阅读库 ===================== */
.reading-lib { display: flex; flex-direction: column; gap: 22px; }
.rd-hero {
  display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, .8fr);
  gap: 28px; align-items: end;
  padding: 32px;
  border: 1px solid rgba(30,107,84,.12);
  border-radius: 24px;
  background:
    radial-gradient(700px 280px at 90% -10%, rgba(185,127,46,.13), transparent 60%),
    linear-gradient(135deg, #f2f8f5 0%, #fffefa 55%, #f8f1e4 100%);
  box-shadow: var(--sh-1);
}
.rd-kicker {
  display: inline-block; font-size: 10.5px; letter-spacing: .2em;
  color: var(--brand); font-weight: 800; margin-bottom: 10px;
}
.rd-hero h1 { font-size: 34px; line-height: 1.12; letter-spacing: -.02em; color: var(--brand-deep); }
.rd-hero-copy p { margin-top: 10px; max-width: 520px; color: var(--ink-2); font-size: 14px; line-height: 1.7; }
.rd-hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rd-hero-stats div {
  background: rgba(255,254,250,.7); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 12px; text-align: center;
}
.rd-hero-stats b { display: block; font-size: 22px; color: var(--brand-deep); line-height: 1.2; }
.rd-hero-stats span { font-size: 10.5px; color: var(--ink-3); }
.rd-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.rd-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.rd-chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.rd-chip:hover { border-color: rgba(30,107,84,.3); color: var(--brand-deep); }
.rd-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.rd-search {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 7px 10px; color: var(--ink-3); font-size: 11px;
}
.rd-search input { border: 0; outline: 0; background: transparent; width: 160px; font: inherit; color: var(--ink); font-size: 12px; }
.rd-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.rd-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; overflow: hidden;
  box-shadow: var(--sh-1);
  transition: transform .2s var(--ease-out), box-shadow .2s ease;
}
.rd-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.rd-cover {
  position: relative; height: 148px; width: 100%;
  border: 0; cursor: pointer; text-align: left;
  background:
    linear-gradient(140deg, rgba(30,107,84,.18), rgba(30,107,84,.02) 55%),
    linear-gradient(20deg, #f8f1e4, #fffefa);
  color: var(--brand-deep);
}
.rd-cover::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, transparent 0 22px, rgba(31,42,38,.035) 22px 23px);
}
.rd-cover-level {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  font-size: 10px; font-weight: 800; letter-spacing: .08em;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--brand); border-radius: 6px; padding: 3px 7px;
}
.rd-cover-letter { position: absolute; right: 18px; bottom: -12px; font-size: 96px; font-weight: 800; opacity: .16; }
.rd-done {
  position: absolute; top: 12px; right: 12px; z-index: 1;
  font-size: 10px; color: var(--brand); background: var(--brand-soft);
  border-radius: 6px; padding: 3px 7px; font-weight: 700;
}
.rd-body { padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.rd-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 10.5px; color: var(--ink-3); }
.rd-meta span + span::before { content: '·'; margin-right: 8px; color: var(--line); }
.rd-card h3 { font-size: 16.5px; line-height: 1.3; letter-spacing: -.01em; }
.rd-card h3 button { border: 0; background: none; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.rd-card h3 button:hover { color: var(--brand); }
.rd-sub, .rd-topics { font-size: 11.5px; color: var(--ink-2); line-height: 1.5; }
.rd-topics { color: var(--ink-3); }
.rd-progress { display: flex; align-items: center; gap: 8px; }
.rd-progress::before {
  content: ''; flex: 1; height: 4px; border-radius: 4px; background: var(--line);
}
.rd-progress i {
  position: absolute; height: 4px; border-radius: 4px; background: var(--brand);
  max-width: calc(100% - 34px);
}
.rd-progress { position: relative; padding-right: 34px; }
.rd-progress span { position: absolute; right: 0; top: -7px; font-size: 10px; color: var(--ink-3); }
.rd-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rd-foot > span { font-size: 10px; color: var(--ink-3); }
.rd-empty { grid-column: 1 / -1; }
.rd-loading { color: var(--ink-3); }

/* ===================== 阅读器 ===================== */
.reader { position: relative; }
.reader-progress {
  position: sticky; top: var(--topbar-h); z-index: 15; height: 3px;
  background: var(--line); margin: -28px -32px 22px;
}
.reader-progress i { display: block; height: 100%; background: var(--brand); border-radius: 0 3px 3px 0; }
.reader-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.reader-back { text-decoration: none; color: var(--ink-2); font-size: 12.5px; }
.reader-back:hover { color: var(--brand); }
.reader-tools { display: flex; align-items: center; gap: 6px; }
.reader-level { font-size: 10px; font-weight: 800; color: var(--brand); background: var(--brand-soft); padding: 3px 7px; border-radius: 6px; margin-right: 4px; }
.rd-tool {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 7px; padding: 5px 8px; font-size: 11px; cursor: pointer;
}
.rd-tool:hover, .rd-tool.on { border-color: rgba(30,107,84,.35); color: var(--brand); }
.reader-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail-w); gap: 30px; align-items: start; }
.reader-article {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; padding: 38px 44px 26px;
  box-shadow: var(--sh-1);
  max-width: 760px; justify-self: center;
}
.reader-head { border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: 24px; }
.reader-head h1 { font-size: 32px; line-height: 1.16; letter-spacing: -.025em; color: var(--brand-deep); margin-top: 10px; }
.reader-sub { margin-top: 8px; color: var(--ink-2); font-size: 14px; }
.reader-body {
  font-family: Georgia, 'Times New Roman', 'Songti SC', serif;
  font-size: var(--reader-size, 18px); line-height: 1.9; color: #26312d;
}
.rd-p { margin-bottom: 1.25em; }
.rd-w { cursor: pointer; border-radius: 3px; padding: 0 1px; transition: background .15s ease; }
.rd-w:hover { background: var(--amber-soft); color: var(--brand-deep); }
.rd-tr-btn {
  border: 0; background: transparent; color: var(--ink-3);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 9px; line-height: 1; padding: 1px 3px; margin-left: 2px;
  border-radius: 4px; cursor: pointer; opacity: .35; vertical-align: super;
}
.rd-sent:hover .rd-tr-btn, .reader.show-tr .rd-tr-btn { opacity: 1; }
.rd-tr {
  display: none; margin: 6px 0 12px; padding-left: 12px;
  border-left: 2px solid var(--line); color: var(--ink-2);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: .72em; line-height: 1.8;
}
.rd-sent.tr-open .rd-tr, .reader.show-tr .rd-tr { display: block; }
.reader-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-top: 1px solid var(--line); margin-top: 26px; padding-top: 18px;
}
.reader-foot div { display: flex; align-items: baseline; gap: 8px; }
.reader-foot b { font-size: 22px; color: var(--brand-deep); }
.reader-foot span { font-size: 11px; color: var(--ink-3); }
.reader-rail { position: sticky; top: calc(var(--topbar-h) + 24px); }
.word-empty, .word-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px;
  box-shadow: var(--sh-1);
}
.word-empty { text-align: center; color: var(--ink-2); }
.word-empty-mark {
  width: 44px; height: 44px; margin: 2px auto 12px; border-radius: 14px;
  display: grid; place-items: center; background: var(--brand-soft);
  color: var(--brand-deep); font-weight: 800; font-size: 15px;
}
.word-empty b { display: block; color: var(--ink); font-size: 14px; }
.word-empty p { margin: 6px 0 14px; font-size: 11.5px; line-height: 1.65; color: var(--ink-3); }
.word-tip { font-size: 10.5px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 10px; }
.word-tip kbd { border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; font-size: 9px; background: var(--bg); }
.word-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.word-head b { font-size: 22px; line-height: 1.2; color: var(--brand-deep); display: block; }
.word-head span { font-size: 11px; color: var(--ink-3); }
.word-close { border: 0; background: transparent; color: var(--ink-3); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.word-pos { margin-top: 8px; font-size: 10px; color: var(--amber); font-weight: 700; text-transform: uppercase; }
.word-def { margin-top: 6px; font-size: 14px; line-height: 1.6; color: var(--ink); }
.word-actions { display: flex; gap: 6px; margin-top: 14px; }
.word-actions .btn { flex: 1; }
.word-source { margin-top: 10px; font-size: 10px; color: var(--ink-3); }

/* ===================== 词库 / 我的 / 占位 ===================== */
.page-head-inline { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.page-head-inline h2 { font-size: 26px; letter-spacing: -.02em; }
.page-head-inline p { margin-top: 4px; color: var(--ink-2); font-size: 13px; }
.page-hint { font-size: 11px; color: var(--ink-3); }
.deck-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.deck-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px; box-shadow: var(--sh-1);
  display: flex; flex-direction: column; gap: 8px;
}
.deck-card.cur { border-color: rgba(30,107,84,.32); background: linear-gradient(180deg, var(--brand-tint), var(--surface)); }
.deck-top { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); }
.deck-badge { color: var(--brand); font-weight: 700; }
.deck-card h3 { font-size: 19px; color: var(--brand-deep); }
.deck-card p { font-size: 11.5px; color: var(--ink-2); }
.deck-bar { height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; }
.deck-bar i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.deck-actions { display: flex; gap: 6px; margin-top: 6px; }
.deck-actions .btn { flex: 1; }
.decks-page > .tip { margin-top: 16px; }

.me-hero {
  display: flex; align-items: center; gap: 16px;
  padding: 24px; border-radius: 20px;
  background: linear-gradient(135deg, var(--brand-tint), var(--surface));
  border: 1px solid rgba(30,107,84,.12); margin-bottom: 18px;
}
.me-avatar {
  width: 58px; height: 58px; border-radius: 18px;
  display: grid; place-items: center; background: var(--brand); color: #fff;
}
.me-avatar .ic { width: 28px; height: 28px; }
.me-hero h2 { font-size: 24px; color: var(--brand-deep); }
.me-hero p { margin-top: 4px; color: var(--ink-2); font-size: 13px; }
.me-stats { margin-bottom: 18px; }
.me-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.me-link {
  display: flex; flex-direction: column; gap: 3px;
  padding: 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); text-decoration: none;
}
.me-link:hover { border-color: rgba(30,107,84,.3); background: var(--brand-tint); }
.me-link span { font-size: 14px; font-weight: 700; color: var(--ink); }
.me-link em { font-style: normal; font-size: 11px; color: var(--ink-3); }

.soon-page, .page-error, .page-loading, .study-intro {
  max-width: 620px; margin: 60px auto; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 24px; padding: 44px 32px; box-shadow: var(--sh-1);
}
.soon-mark, .page-loading-mark {
  width: 52px; height: 52px; margin: 0 auto 16px; border-radius: 16px;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
}
.soon-page h2, .page-error h2, .study-intro h1 { font-size: 24px; color: var(--brand-deep); }
.soon-page p, .page-error p, .study-intro p { margin: 8px 0 18px; color: var(--ink-2); font-size: 13px; line-height: 1.7; }
.page-error .btn, .soon-page .btn, .study-intro .btn { margin-top: 4px; }
.page-loading p { color: var(--ink-3); font-size: 12px; }
.loading-bar { height: 3px; width: 160px; margin: 18px auto 0; border-radius: 3px; background: var(--line); overflow: hidden; }
.loading-bar i { display: block; width: 40%; height: 100%; background: var(--brand); border-radius: 3px; animation: loadingSlide 1.1s ease-in-out infinite; }
@keyframes loadingSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
.study-intro-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.boot-error { max-width: 560px; margin: 80px auto; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.boot-error h1 { font-size: 20px; color: var(--red); }
.boot-error p { margin-top: 8px; color: var(--ink-2); }
.boot-error pre { margin-top: 12px; white-space: pre-wrap; font-size: 11px; color: var(--ink-3); }

/* ===================== 移动端 ===================== */
@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .shell-topbar { height: 62px; padding: 0 18px; }
  .shell-title h1 { font-size: 17px; }
  .shell-crumb { display: none; }
  .global-search { display: none; }
  .shell-actions { gap: 8px; }
  #view.content { padding: 18px 18px 100px; }
  #view.content-wide { padding: 0 12px 100px; }
  .rd-hero { grid-template-columns: 1fr; padding: 24px 20px; }
  .rd-hero h1 { font-size: 28px; }
  .rd-grid { grid-template-columns: 1fr; }
  .today-rd-list { grid-template-columns: 1fr; }
  .rd-toolbar { flex-direction: column; align-items: stretch; }
  .rd-search input { width: 100%; }
  .reader-progress { margin: -18px -18px 16px; top: 62px; }
  .reader-layout { grid-template-columns: 1fr; }
  .reader-article { padding: 24px 20px; border-radius: 18px; max-width: none; }
  .reader-head h1 { font-size: 26px; }
  .reader-body { font-size: var(--reader-size, 17px); line-height: 1.85; }
  .reader-rail {
    position: fixed; left: 14px; right: 14px; bottom: 14px;
    top: auto; z-index: 50; display: none;
    max-height: 44vh; overflow: auto;
    box-shadow: var(--sh-3);
  }
  .reader.has-word .reader-rail { display: block; }
  .reader.has-word::after {
    content: ''; position: fixed; inset: 0; background: rgba(31,42,38,.16);
    z-index: 40; pointer-events: none;
  }
  .word-empty { display: none; }
  .reader-top { gap: 8px; }
  .reader-tools { flex-wrap: wrap; justify-content: flex-end; }
  .deck-grid { grid-template-columns: 1fr 1fr; }
  .me-links { grid-template-columns: 1fr; }
  .rd-cover { height: 130px; }
  .tabbar { display: flex; max-width: none; left: 0; right: 0; }
}

@media (max-width: 560px) {
  .rd-hero-stats { grid-template-columns: repeat(3, 1fr); }
  .rd-hero h1 { font-size: 25px; }
  .deck-grid { grid-template-columns: 1fr; }
  .reader-tools .reader-level { display: none; }
  .reader-article { border-radius: 0; border-left: 0; border-right: 0; }
  #view.content-wide { padding-left: 0; padding-right: 0; }
  .reader-progress { margin-left: 0; margin-right: 0; }
  .reader-top { padding: 0 16px; }
  .reader-foot { padding: 0 4px 8px; }
  .tab-main { flex: 0 0 54px; height: 54px; margin-top: -20px; }
}

/* 桌面隐藏底部导航 */
@media (min-width: 1024px) {
  .tabbar { display: none; }
}

/* 骨架屏在桌面更宽 */
@media (min-width: 1024px) {
  .sk-inner { max-width: 960px; }
}

/* 修正：移动端今日阅读卡片的最小宽度，避免横向滚动 */
.today-reading, .today-rd-list, .today-rd-card, .today-rd-main { min-width: 0; }
.today-rd-card { width: 100%; max-width: 100%; }
.today-rd-main b, .today-rd-main em { max-width: 100%; }
.today-rd-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1023px) {
  .tabbar { gap: 2px; align-items: flex-end; }
  .tab-main {
    flex: 0 0 58px; height: 58px; margin-top: -22px;
    background: var(--brand); color: #fff;
    border-radius: 18px; padding: 9px 0 5px;
    box-shadow: 0 8px 20px rgba(30,107,84,.3);
  }
  .tab-main svg { width: 24px; height: 24px; }
  .tab-main span { color: #fff; font-size: 10px; }
  .tab-main.on { background: var(--brand-deep); color: #fff; }
}

/* 阅读器/学习页：顶部栏更实，避免正文透出 */
.shell-topbar { background: rgba(246, 244, 239, .97); }

/* 学习会话在桌面居中，不铺满 980 */
@media (min-width: 1024px) {
  #view > .session-head,
  #view > .flip-scene,
  #view > .grade-row,
  #view > .reveal,
  #view > .finish,
  #view > .tip {
    max-width: 720px; margin-left: auto; margin-right: auto;
  }
  #view > .flip-scene .card { min-height: 380px; }
  #view > .grade-row { width: 100%; }
  #view > .reveal { width: 100%; }
}

/* 翻面卡：用 visibility 兜底，避免部分桌面渲染器同时显示两面 */
.flip-scene:not(.flipped) .face-back { visibility: hidden; }
.flip-scene.flipped .face-front { visibility: hidden; }

.manual-tag.reading-tag { color: var(--blue); background: var(--blue-soft); }

/* 阅读进度条：覆盖早期 flex/absolute 混用 */
.rd-progress {
  position: relative; height: 4px; padding: 0; margin: 6px 0 4px;
  background: var(--line); border-radius: 4px;
}
.rd-progress::before { content: none; }
.rd-progress i {
  position: absolute; left: 0; top: 0; height: 100%;
  background: var(--brand); border-radius: 4px; max-width: 100%;
}
.rd-progress span {
  position: absolute; right: 0; top: -15px;
  font-size: 10px; color: var(--ink-3);
}

@media (min-width: 1024px) {
  .week-strip { justify-content: flex-start; gap: 40px; }
  .w-dot i { width: 18px; height: 18px; background: transparent; border: 1.5px solid var(--line); }
  .w-dot.on i { background: var(--brand); border-color: var(--brand); }
  .w-dot em { font-size: 10px; }
}
