/*!
 * app.css — 词书 · 视觉系统
 * 纸质暖白底色 + 墨绿主色，英文用衬线体强调字形，中文用系统黑体。
 * 纯 CSS，无外部字体与图片请求。
 */

:root {
  --paper: #f5f2ea;
  --paper-2: #efe9dd;
  --card: #fffdf8;
  --card-2: #fcf8ef;
  --ink: #1d1b17;
  --ink-2: #5b554b;
  --ink-3: #8c8478;
  --line: #e7e0d2;
  --line-2: #d8cfbc;
  --green: #1d5c4f;
  --green-2: #2a7c68;
  --green-soft: #e6f0eb;
  --green-line: #c9ded5;
  --clay: #a8523f;
  --clay-soft: #f9ece7;
  --clay-line: #e6c9bf;
  --gold: #a4813d;
  --gold-soft: #f7efdc;
  --shadow-s: 0 1px 2px rgba(62, 50, 30, .05);
  --shadow-m: 0 2px 6px rgba(62, 50, 30, .04), 0 18px 44px -20px rgba(62, 50, 30, .22);
  --shadow-l: 0 30px 70px -30px rgba(50, 40, 24, .35), 0 2px 6px rgba(62, 50, 30, .05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  /* 学习页内容不超过一屏，不加这一行右侧滚动条会消失；常驻显示，保证各页面一致 */
  overflow-y: scroll;
  /* 自定义滚动条：轨道与页面底色一致，滑块取纸张边线色，悬停加深 */
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) var(--paper);
}
html::-webkit-scrollbar { width: 10px; }
html::-webkit-scrollbar-track { background: var(--paper); }
html::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border: 2px solid var(--paper);
  border-radius: 10px;
}
html::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
html::-webkit-scrollbar-corner { background: var(--paper); }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 50% -14%, #fffdf6 0%, rgba(255, 253, 246, 0) 68%),
    radial-gradient(760px 520px at 106% 104%, #ece5d6 0%, rgba(236, 229, 214, 0) 62%);
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
svg { display: block; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
::selection { background: #cfe3da; }

:focus-visible {
  outline: 2px solid var(--green-2);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ================= 顶栏 ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(245, 242, 234, .84);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid rgba(231, 224, 210, .85);
}
.topbar-in {
  max-width: 840px;
  margin: 0 auto;
  height: 66px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}
.mark {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #f8f5ec;
  font-family: var(--serif);
  font-size: 17px;
  box-shadow: 0 4px 10px -4px rgba(29, 92, 79, .7);
}
.brand-text { display: block; min-width: 0; }
.brand-text b {
  display: block;
  font-size: 15px;
  letter-spacing: .06em;
  line-height: 1.3;
}
.brand-text small {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .03em;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-actions { display: flex; align-items: center; gap: 4px; }
.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  transition: background .18s, color .18s, border-color .18s;
}
.ghost-btn svg { width: 17px; height: 17px; }
.ghost-btn:hover { background: rgba(255, 253, 248, .9); border-color: var(--line); color: var(--ink); }

/* ================= 布局 ================= */
.view { display: block; }
.wrap {
  max-width: 840px;
  margin: 0 auto;
  padding: 0 24px 60px;
}
.view-enter > .wrap,
.view-enter > .study,
.view-enter > .done { animation: viewIn .42s var(--ease) both; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.eyebrow {
  font-size: 11.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

.home-head { padding: 46px 2px 24px; }
.home-head h1 {
  font-size: clamp(25px, 3.8vw, 33px);
  line-height: 1.32;
  letter-spacing: -.015em;
  font-weight: 600;
  margin: 12px 0 9px;
}
.lede { color: var(--ink-2); font-size: 14px; }

/* ================= 今日卡片 ================= */
.today {
  position: relative;
  overflow: hidden;
  background: linear-gradient(178deg, #fffefb 0%, var(--card-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 24px 22px;
  box-shadow: var(--shadow-m);
}
.today::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(520px 200px at 92% -30%, rgba(29, 92, 79, .11), transparent 72%);
}
.today-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11.5px;
  letter-spacing: .08em;
  font-weight: 600;
}
.tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.tag.gold { background: var(--gold-soft); color: var(--gold); }
.tag.clay { background: var(--clay-soft); color: var(--clay); }
.today-hint { font-size: 11.5px; color: var(--ink-3); letter-spacing: .03em; }

.today-main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.num {
  font-family: var(--serif);
  font-size: clamp(42px, 7vw, 54px);
  line-height: 1;
  font-weight: 500;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.num em {
  font-style: normal;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink-3);
  margin-left: 7px;
  letter-spacing: 0;
}
.num-label { margin-top: 9px; font-size: 12px; color: var(--ink-3); letter-spacing: .05em; }

.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: #ebe4d4; }
.ring .fill { stroke: var(--green); transition: stroke-dashoffset .8s var(--ease); }
.ring.is-complete .fill { stroke: var(--gold); }
.ring-txt {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.ring-txt svg { width: 26px; height: 26px; color: var(--gold); transform: none; }

.progress {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: #ece5d6;
  overflow: hidden;
  margin: 20px 0 20px;
}
.progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green) 0%, var(--green-2) 100%);
  transition: width .7s var(--ease);
}
.today-actions { position: relative; display: flex; gap: 10px; }
.today-actions .btn { flex: 1; }

/* ================= 按钮 ================= */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: transform .12s var(--ease), background .18s, border-color .18s, box-shadow .2s, color .18s;
}
.btn:active { transform: scale(.985); }
.btn-primary {
  background: var(--green);
  color: #fbf9f2;
  box-shadow: 0 10px 22px -14px rgba(29, 92, 79, .9);
}
.btn-primary:hover { background: #194f44; }
.btn-ghost {
  background: rgba(255, 253, 248, .6);
  border-color: var(--line-2);
  color: var(--ink-2);
}
.btn-ghost:hover { background: #fffdf8; color: var(--ink); border-color: #c9bfa9; }
.btn-known { background: var(--green); color: #fbf9f2; }
.btn-known:hover { background: #194f44; }
.btn-unknown { background: #fffdf8; border-color: var(--clay-line); color: var(--clay); }
.btn-unknown:hover { background: var(--clay-soft); }
.btn-danger { background: var(--clay); color: #fffaf7; }
.btn-danger:hover { background: #94452f; }
.btn-lg { height: 54px; font-size: 15.5px; flex: 1; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .4; cursor: default; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 13.5px; border-radius: 11px; }

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--green);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .02em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.link-btn:hover { color: var(--green-2); }
.link-btn svg { width: 14px; height: 14px; }

.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-3);
  transition: background .18s, color .18s, border-color .18s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: rgba(255, 253, 248, .9); border-color: var(--line); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn:disabled:hover { background: transparent; border-color: transparent; }

/* ================= 数据块 ================= */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  margin-top: 14px;
}
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 15px 15px 13px;
  box-shadow: var(--shadow-s);
}
.tile b {
  display: block;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.tile b small { font-family: var(--sans); font-size: 12px; color: var(--ink-3); margin-left: 1px; }
.tile span { display: block; margin-top: 5px; font-size: 11.5px; color: var(--ink-3); letter-spacing: .05em; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px 16px;
  margin-top: 14px;
  box-shadow: var(--shadow-s);
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.panel-head h3 {
  font-size: 12px;
  letter-spacing: .1em;
  font-weight: 600;
  color: var(--ink-2);
}
.panel-note { font-size: 11.5px; color: var(--ink-3); letter-spacing: .02em; }
.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 13px;
}
.panel-foot p { font-size: 12.5px; color: var(--ink-2); }
.panel-foot p b { color: var(--ink); font-weight: 600; }

/* 今日这一组：完成/剩余 + 管理入口 */
.task-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -8px 0 16px;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .02em;
}
.task-foot b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.task-foot .link-btn { font-size: 11.5px; white-space: nowrap; }
.card-links { display: flex; gap: 18px; margin-top: 14px; }
.link-muted {
  border: 0;
  background: none;
  padding: 0;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .02em;
  transition: color .18s;
}
.link-muted:hover { color: var(--clay); }

/* 复习周期条 *//* 复习周期条 */
.cbars { display: flex; gap: 6px; }
.cbars i {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: #ece5d6;
  transition: background .3s;
}
.cbars i.on { background: var(--green-line); }
.cbars i.on.last { background: var(--green); }
.cbars i.due { background: var(--clay-line); }
.cbars i.due.last { background: var(--clay); }

/* 最近 7 天 */
.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
}
.wcol { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.wnum {
  font-size: 10.5px;
  color: var(--ink-3);
  height: 14px;
  font-variant-numeric: tabular-nums;
}
.wbar-wrap { height: 52px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.wbar {
  width: 100%;
  max-width: 24px;
  border-radius: 7px;
  background: #ece5d6;
  transition: height .5s var(--ease), background .2s;
}
.wbar.on { background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green-line); }
.wbar.is-today { background: var(--green); box-shadow: none; }
.wday { font-size: 11px; color: var(--ink-3); }
.wcol.is-today .wday { color: var(--ink); font-weight: 600; }

.foot {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .02em;
}
.foot .sep { opacity: .5; }

/* ================= 登录页 ================= */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 28px 28px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-m);
  text-align: center;
}
.login-card h1 { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: .02em; }
.login-card .lede { color: var(--ink-2); font-size: 14px; }
.login-input {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  margin-top: 6px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  outline: none;
  text-align: center;
  letter-spacing: .08em;
}
.login-input:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px var(--green-soft); }
.login-card .btn-block { width: 100%; margin-top: 4px; }
.login-err { min-height: 1.4em; font-size: 13px; color: var(--clay); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ================= 学习界面 ================= */
body.in-study .topbar { display: none; }
.study {
  min-height: 100dvh;
  max-width: 840px;
  margin: 0 auto;
  padding: 16px 24px calc(22px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.study-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 44px;
}
.study-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.study-kind {
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--green);
  background: var(--green-soft);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.study-kind.review { color: var(--gold); background: var(--gold-soft); }
.study-meta b { font-size: 16px; color: var(--ink); font-weight: 600; }
.study-tools { display: flex; align-items: center; gap: 6px; }
.save-pill {
  font-size: 11px;
  color: var(--green);
  background: var(--green-soft);
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: .04em;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  white-space: nowrap;
}
.save-pill.show { opacity: 1; transform: none; }

.segs { display: flex; gap: 3px; margin-top: 12px; }
.seg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: #e7e0d2;
  transition: background .25s;
}
.seg.is-done { background: var(--green-2); }
.seg.is-now { background: var(--gold); }
.stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 20px 0;
  min-height: 0;
}

.card {
  width: min(568px, 100%);
  min-height: 348px;
  display: flex;
  flex-direction: column;
  padding: 26px 32px 22px;
  background: linear-gradient(178deg, #fffefb 0%, var(--card-2) 100%);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow-l);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.card.enter { animation: cardIn .34s var(--ease) both; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(.992); }
  to { opacity: 1; transform: none; }
}
.card.out-left { animation: outLeft .2s ease-out both; }
.card.out-right { animation: outRight .2s ease-out both; }
@keyframes outLeft {
  to { opacity: 0; transform: translateX(-44px) rotate(-1.4deg); }
}
@keyframes outRight {
  to { opacity: 0; transform: translateX(44px) rotate(1.4deg); }
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lvl {
  font-size: 10.5px;
  letter-spacing: .1em;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  background: #f1ebdd;
  color: var(--ink-2);
}
.lvl.core { background: var(--green-soft); color: var(--green); }
.lvl.base { background: #eef0e6; color: #5e6b45; }
.lvl.ext { background: var(--gold-soft); color: var(--gold); }
.pos { font-size: 11.5px; color: var(--ink-3); letter-spacing: .04em; }

.card-mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 0 4px;
  min-height: 0;
}
.word {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 7.4vw, 56px);
  line-height: 1.12;
  letter-spacing: -.015em;
  text-align: center;
  word-break: break-word;
  margin-bottom: 10px;
}
.card.mid .word { font-size: clamp(32px, 6.2vw, 46px); }
.card.long .word { font-size: clamp(25px, 4.8vw, 34px); letter-spacing: 0; }

.phon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-3);
  font-size: 14px;
  letter-spacing: .02em;
  min-height: 26px;
}
.speak {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, .8);
  color: var(--ink-3);
  transition: color .18s, border-color .18s, background .18s;
}
.speak svg { width: 15px; height: 15px; }
.speak:hover { color: var(--green); border-color: var(--green-line); background: var(--green-soft); }

.meaning {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .38s var(--ease), opacity .3s ease .06s, margin-top .3s var(--ease);
}
.card.is-revealed .meaning {
  max-height: 42vh;
  opacity: 1;
  margin-top: 20px;
  overflow-y: auto;
}
.meaning p {
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--ink-2);
  text-align: center;
  padding: 0 4px;
  word-break: break-word;
}
.meaning p::-webkit-scrollbar { width: 4px; }
.meaning p::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

.card-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding-top: 15px;
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .03em;
  max-height: 60px;
  overflow: hidden;
  transition: opacity .2s, max-height .3s var(--ease), padding .3s var(--ease), margin .3s var(--ease), border-color .3s;
}
.card.is-revealed .card-hint {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  margin-top: 0;
  border-top-color: transparent;
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 19px;
  padding: 0 5px;
  border: 1px solid currentColor;
  border-bottom-width: 2px;
  border-radius: 5px;
  font-size: 10px;
  font-family: var(--sans);
  line-height: 1;
  opacity: .55;
  letter-spacing: .02em;
}

.study-actions { display: flex; gap: 11px; }
.study-actions .btn { min-width: 0; }

/* ================= 完成页 ================= */
.done {
  max-width: 620px;
  margin: 0 auto;
  padding: 12vh 24px 60px;
  text-align: center;
}
.done-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fbf9f2;
  box-shadow: 0 0 0 10px rgba(29, 92, 79, .07);
  animation: popIn .5s var(--ease) both;
}
.done-mark svg { width: 28px; height: 28px; }
.done-mark.gold { background: var(--gold); color: #fdf7ec; box-shadow: 0 0 0 10px rgba(164, 129, 61, .09); }
@keyframes popIn {
  0% { opacity: 0; transform: scale(.7); }
  60% { opacity: 1; transform: scale(1.06); }
  100% { transform: scale(1); }
}
.done h1 {
  font-size: clamp(24px, 4vw, 31px);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.35;
  margin: 12px 0 10px;
}
.done .lede { font-size: 14px; }
.done-stats {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 32px 0 30px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.done-stats > div {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
}
.done-stats > div + div { border-left: 1px solid var(--line); }
.done-stats b {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.done-stats b small { font-family: var(--sans); font-size: 12px; color: var(--ink-3); margin-left: 1px; }
.done-stats span { font-size: 11.5px; color: var(--ink-3); letter-spacing: .05em; }
.done-actions { display: flex; flex-direction: column; gap: 10px; max-width: 360px; margin: 0 auto; }
.done-actions .btn { width: 100%; }
.done-note { margin-top: 20px; font-size: 12px; color: var(--ink-3); }

/* ================= 浮层 ================= */
#layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  visibility: hidden;
  pointer-events: none;
}
#layer.open { visibility: visible; pointer-events: auto; }
.layer-bg {
  position: absolute;
  inset: 0;
  background: rgba(30, 25, 18, .36);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .24s ease;
}
#layer.in .layer-bg { opacity: 1; }

.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(720px, 100%);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 60px -20px rgba(40, 32, 20, .35);
  transform: translate(-50%, 100%);
  transition: transform .32s var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
}
#layer.in .sheet { transform: translate(-50%, 0); }

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 14px 24px;
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.sheet-head p { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 24px 26px;
  -webkit-overflow-scrolling: touch;
}
.sheet-body::-webkit-scrollbar { width: 6px; }
.sheet-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }

.modal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(432px, calc(100% - 40px));
  padding: 26px 26px 20px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow-l);
  transform: translate(-50%, -46%) scale(.97);
  opacity: 0;
  transition: transform .28s var(--ease), opacity .22s ease;
}
#layer.in .modal { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.modal .badge {
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--gold);
  background: var(--gold-soft);
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
  margin-bottom: 14px;
}
.modal h2 { font-size: 23px; font-weight: 600; letter-spacing: -.015em; margin-bottom: 9px; }
.modal p {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-2);
}
.modal p b { color: var(--ink); font-weight: 600; }
.modal-actions { display: flex; gap: 10px; margin: 22px 0 12px; }
.modal-actions .btn { flex: 1; height: 48px; }
.modal .fine { font-size: 11.5px; color: var(--ink-3); text-align: center; }

@media (min-width: 720px) {
  .sheet {
    top: 50%;
    bottom: auto;
    max-height: 80dvh;
    border-radius: 22px;
    transform: translate(-50%, -46%) scale(.98);
    opacity: 0;
    transition: transform .28s var(--ease), opacity .2s ease;
  }
  #layer.in .sheet { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ================= 今天的词（列表 / 复制） ================= */
.bprogress { margin: 2px 0 14px; }
.batch-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}
.batch-label {
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .04em;
  margin-right: 2px;
}
.blist {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.brow {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}
.bno {
  flex: none;
  width: 20px;
  padding-top: 2px;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.bmain {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 7px;
}
.ben { flex: 0 0 auto; font-family: var(--serif); font-size: 16.5px; letter-spacing: -.005em; }
.bph {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bzh {
  flex-basis: 100%;
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-2);
  word-break: break-word;
}
.bst {
  flex: none;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1ece0;
  color: var(--ink-3);
  font-size: 10.5px;
  letter-spacing: .04em;
}
.bst.ok { background: var(--green-soft); color: var(--green); }
.bst.auto { background: var(--gold-soft); color: var(--gold); }
.bst.bad { background: var(--clay-soft); color: var(--clay); }
.batch-links { margin-top: 18px; }
.done-link { margin-top: 18px; font-size: 12.5px; }

/* ================= 词库 ================= */
.search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.search svg {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 14px;
  transition: border-color .18s, box-shadow .18s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus {
  outline: none;
  border-color: var(--green-line);
  box-shadow: 0 0 0 3px rgba(29, 92, 79, .08);
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 6px; }
.chip {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  transition: background .18s, color .18s, border-color .18s;
}
.chip:hover { background: rgba(255, 253, 248, .8); }
.chip[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: #f9f6ee;
}
.chip:disabled { opacity: .4; cursor: default; }
.chip:disabled:hover { background: transparent; }
.lib-count { font-size: 11.5px; color: var(--ink-3); padding: 10px 2px 2px; }

.lib-list { border-top: 1px solid var(--line); margin-top: 4px; }
.wrow {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 9px;
  flex: none;
  background: #d9d1c0;
}
.dot.ok { background: var(--green-2); }
.dot.bad { background: var(--clay); }
.w-main { flex: 1; min-width: 0; }
.w-line1 { display: flex; align-items: baseline; gap: 8px; }
.w-en {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: -.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.w-ph { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-zh {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wrow.open .w-zh { white-space: normal; overflow: visible; }
.wrow .speak { flex: none; margin-top: 2px; }

.more-btn {
  width: 100%;
  height: 42px;
  margin-top: 14px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
}
.more-btn:hover { background: rgba(255, 253, 248, .7); }

/* ================= 设置 ================= */
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.set-row:first-child { padding-top: 2px; }
.set-row b { display: block; font-size: 14px; font-weight: 600; }
.set-row span { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.seg-ctl {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--paper-2);
  flex: none;
}
.seg-ctl button {
  min-width: 42px;
  height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  transition: background .18s, color .18s, box-shadow .18s;
}
.seg-ctl button:hover { color: var(--ink); }
.seg-ctl button[aria-pressed="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-s);
  font-weight: 600;
}

.switch {
  position: relative;
  width: 46px;
  height: 27px;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: #ddd5c4;
  transition: background .22s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(60, 50, 30, .25);
  transition: transform .22s var(--ease);
}
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(19px); }

.sheet-sub {
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--ink-3);
  font-weight: 600;
  margin: 26px 0 12px;
}
.data-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.data-actions .btn { height: 42px; font-size: 13.5px; flex: 1; min-width: 130px; }
.text-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--clay);
  font-size: 12.5px;
}
.text-danger:hover { text-decoration: underline; }
.text-danger svg { width: 15px; height: 15px; }
.fine { font-size: 11.5px; color: var(--ink-3); line-height: 1.7; margin-top: 14px; }

/* ================= 提示 ================= */
#toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  padding: 0 16px;
  width: max-content;
  max-width: 100%;
}
.toast {
  padding: 9px 16px;
  border-radius: 999px;
  background: #22302b;
  color: #f7f4ec;
  font-size: 12.5px;
  letter-spacing: .02em;
  box-shadow: 0 10px 30px -12px rgba(20, 20, 15, .6);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .22s, transform .22s;
}
.toast.in { opacity: 1; transform: none; }

/* 学习界面底部是主操作按钮，提示移到上方避免遮挡 */
body.in-study #toast { bottom: auto; top: 100px; }

.noscript {
  margin: 60px auto;
  max-width: 560px;
  padding: 20px 24px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink-2);
  font-size: 14px;
}

.boot { padding: 26vh 24px; text-align: center; color: var(--ink-3); font-size: 13px; }
.boot-ring {
  width: 28px;
  height: 28px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--green);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= 响应式 ================= */
@media (max-width: 640px) {
  /* 触屏设备上键盘提示没有意义 */
  .kbd { display: none; }
}

@media (max-width: 560px) {
  .topbar-in { padding: 0 18px; height: 60px; }
  .brand-text small { max-width: 150px; }
  .ghost-btn span { display: none; }
  .ghost-btn { width: 38px; padding: 0; justify-content: center; }
  .wrap { padding: 0 16px 48px; }
  .home-head { padding: 32px 2px 18px; }
  .today { padding: 19px 18px 18px; border-radius: 22px; }
  .ring { width: 78px; height: 78px; }
  .num { font-size: 40px; }
  .tile { padding: 13px 12px 12px; border-radius: 15px; }
  .tile b { font-size: 20px; }
  .tile span { font-size: 10.5px; letter-spacing: .02em; }
  .panel { padding: 16px 16px 14px; }
  .study { padding: 12px 16px calc(18px + env(safe-area-inset-bottom)); }
  .stage { padding: 14px 0; }
  .card { padding: 20px 20px 18px; border-radius: 24px; min-height: 300px; }
  .word { font-size: clamp(34px, 11vw, 44px); }
  .card.mid .word { font-size: clamp(28px, 9vw, 38px); }
  .card.long .word { font-size: clamp(22px, 7.4vw, 30px); }
  .meaning p { font-size: 14.5px; line-height: 1.8; }
  .card.is-revealed .meaning { max-height: 38vh; }
  .study-actions { gap: 9px; }
  .btn-lg { height: 50px; }
  .done { padding: 9vh 20px 44px; }
  .done-stats { margin: 26px 0 24px; }
  .sheet-body { padding: 16px 18px 24px; }
  .sheet-head { padding: 18px 14px 12px 18px; }
  .set-row { gap: 10px; }
  .set-row b { font-size: 13.5px; }
  .set-row span { font-size: 11px; }
  .seg-ctl button { min-width: 36px; padding: 0 7px; }
  .modal { padding: 22px 20px 18px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
