/* ==========================================================================
   words · 个人表达语料库
   设计系统 —— 暖纸底 + 墨色正文 + 靛蓝强调；词条用衬线，正文用无衬线。
   移动端优先，深浅色自动适配，零外部依赖。
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* 画布 */
  --bg: #f4f3ef;
  --bg-glow: rgba(79, 70, 229, 0.07);
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --surface-3: #f2f0ea;

  /* 文字 */
  --ink: #1b1a17;
  --ink-2: #45423c;
  --muted: #7a756c;

  /* 描边 */
  --line: #e8e4dc;
  --line-2: #d7d2c8;

  /* 强调色 */
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0fe;
  --accent-line: #ccd1fa;
  --on-accent: #ffffff;

  /* 语义色 */
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fdf2e2;
  --danger: #dc2626;
  --danger-soft: #fdeaea;

  /* 形状 */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* 阴影 */
  --sh-1: 0 1px 2px rgba(28, 26, 23, 0.05);
  --sh-2: 0 4px 14px -6px rgba(28, 26, 23, 0.12);
  --sh-3: 0 18px 44px -22px rgba(28, 26, 23, 0.28);

  /* 字体 */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Source Serif 4",
    Georgia, "Songti SC", "SimSun", serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131317;
    --bg-glow: rgba(129, 140, 248, 0.12);
    --surface: #1c1c22;
    --surface-2: #202027;
    --surface-3: #26262f;

    --ink: #f1f0ee;
    --ink-2: #c9c7c2;
    --muted: #9a958c;

    --line: #2e2e37;
    --line-2: #3c3c47;

    --accent: #8b8cf7;
    --accent-hover: #a0a1fb;
    --accent-soft: #23243a;
    --accent-line: #3a3b5c;
    --on-accent: #14141c;

    --ok: #6ee7a0;
    --ok-soft: #17281d;
    --warn: #fbbf6e;
    --warn-soft: #2a2113;
    --danger: #f87171;
    --danger-soft: #2c1717;

    --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --sh-2: 0 6px 18px -8px rgba(0, 0, 0, 0.6);
    --sh-3: 0 22px 50px -24px rgba(0, 0, 0, 0.75);
  }
}

/* ---------- 基础 ---------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 480px at 100% -8%, var(--bg-glow), transparent 62%),
    radial-gradient(700px 420px at -10% 4%, var(--bg-glow), transparent 58%);
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: clamp(24px, 3.6vw, 32px); }
h2 { font-size: 15px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

img, svg { max-width: 100%; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

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

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--accent), var(--accent-hover));
  color: #fff;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  box-shadow: var(--sh-1);
  flex: none;
}
.brand-text { font-size: 17px; }
.brand-sub { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex-wrap: wrap;
}
.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-pill);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav a:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-hover); }
.nav a.active::after { content: none; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.warn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid var(--warn);
  border-color: color-mix(in srgb, var(--warn) 24%, transparent);
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
}
.warn-chip::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* ---------- 主区 ---------- */

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 26px 16px 72px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head .lede { color: var(--muted); font-size: 14px; margin-top: 6px; max-width: 60ch; }

.eyebrow {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.tnum { font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- 按钮 ---------- */

button, .btn {
  --btn-bg: var(--accent);
  --btn-fg: var(--on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
button:hover, .btn:hover { filter: brightness(1.06); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }

.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--on-accent); }
.btn-ghost {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink-2);
  border-color: var(--line-2);
  box-shadow: var(--sh-1);
}
.btn-ghost:hover { --btn-fg: var(--ink); background: var(--surface-2); }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-danger:hover { --btn-bg: var(--danger); --btn-fg: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 22px; font-size: 16px; }

/* ---------- 表单 ---------- */

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 78%, transparent); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 74px; line-height: 1.55; }
select { appearance: none; background-image: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.stack {
  display: grid;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--sh-1);
}
.stack > label, .field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.stack label .hint, .field .hint { font-weight: 450; color: var(--muted); font-size: 12.5px; }
.stack .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stack .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- 搜索 ---------- */

.search {
  display: flex;
  gap: 9px;
  margin-bottom: 16px;
  position: relative;
}
.search .field-search { flex: 1; position: relative; }
.search .field-search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input[type="search"] { padding-left: 38px; }
.search button { flex: none; }

/* ---------- 统计条 ---------- */

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  font-size: 13px;
}
.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: var(--sh-1);
}
.stat b { color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.stat.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-hover); }
.stat.accent b { color: var(--accent-hover); }

/* ---------- 词条卡片 ---------- */

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px 17px;
  box-shadow: var(--sh-1);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.card::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.card:hover { border-color: var(--line-2); box-shadow: var(--sh-2); }
.card:hover::before { opacity: 1; }
.card:hover .term { color: var(--accent-hover); }

.line1 { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.term {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.15s ease;
}
.term:hover { text-decoration: none; }

.kind {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 2px 9px;
  white-space: nowrap;
}
.kind[data-kind="word"] { color: var(--accent-hover); background: var(--accent-soft); border-color: var(--accent-line); }

.zh { color: var(--ink-2); margin-top: 5px; font-size: 15px; }
.zh-en { color: var(--muted); font-size: 14px; margin-top: 3px; }

.src, blockquote.src {
  margin: 11px 0 0;
  padding: 9px 13px;
  border-left: 3px solid var(--accent-line);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 14.5px;
  font-style: italic;
  line-height: 1.55;
}
blockquote.src { margin: 14px 0 0; }
.src .src-note { font-style: normal; color: var(--muted); font-size: 13px; display: block; margin-top: 5px; }

.empty {
  text-align: center;
  padding: 52px 24px;
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  color: var(--muted);
}
.empty .empty-mark {
  font-family: var(--serif);
  font-size: 40px;
  color: var(--accent-line);
  line-height: 1;
  margin-bottom: 12px;
}
.empty p { margin-bottom: 16px; }

/* ---------- 词条详情区块 ---------- */

.entry-hero { margin-bottom: 20px; }
.entry-hero .term-lg {
  font-family: var(--serif);
  font-size: clamp(30px, 6vw, 42px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.phonetic {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--muted);
  margin-top: 6px;
}
.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.meta-line .dot { opacity: 0.5; }

.block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px 18px;
  margin: 12px 0;
  box-shadow: var(--sh-1);
}
.block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.block-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.block p { color: var(--ink-2); }
.block .zh { color: var(--ink); font-weight: 500; }
.block ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.block ul li {
  position: relative;
  padding-left: 17px;
  color: var(--ink-2);
  font-size: 15px;
}
.block ul li::before {
  content: "";
  position: absolute;
  left: 2px; top: 0.62em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent-line);
}

.block.def-en p { font-size: 16px; }
.def-en .label, .def-zh .label { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; font-weight: 700; }

.dict-body {
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0;
  max-height: 340px;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 11px 13px;
}

.example {
  padding: 11px 0;
  border-top: 1px dashed var(--line);
}
.example:first-of-type { border-top: 0; padding-top: 2px; }
.example .en { font-family: var(--serif); font-size: 16.5px; color: var(--ink); }
.example .en em { color: var(--accent-hover); font-style: normal; font-weight: 600; }
.example .zh { font-size: 14.5px; margin-top: 3px; }
.example .style {
  display: inline-block;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 1px 9px;
}

.tag {
  display: inline-block;
  margin: 0 6px 6px 0;
  padding: 3px 11px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--accent-hover);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
}

/* ---------- 折叠区 / 编辑表单 ---------- */

details.edit {
  margin: 16px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-1);
}
details.edit > summary {
  cursor: pointer;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
  user-select: none;
}
details.edit > summary::-webkit-details-marker { display: none; }
details.edit > summary::before {
  content: "";
  width: 7px; height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
  flex: none;
  margin-left: 2px;
}
details.edit[open] > summary::before { transform: rotate(45deg); }
details.edit[open] > summary { border-bottom: 1px solid var(--line); color: var(--ink); }
details.edit > summary:hover { background: var(--surface-2); }
details.edit .details-body { padding: 16px 18px; }
details.edit .stack { border: 0; box-shadow: none; padding: 0; background: transparent; }
details.edit .block { border: 0; box-shadow: none; padding: 0; margin: 12px 0; background: transparent; }
details.edit .block-title { margin-top: 4px; }

.danger-zone { margin-top: 22px; display: flex; justify-content: flex-end; }

/* ---------- 复习 ---------- */

.review-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.progress {
  flex: 1;
  min-width: 140px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: inherit;
  transition: width 0.3s ease;
}

.review-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 26px 24px;
  box-shadow: var(--sh-3);
}
.review-card .term {
  font-family: var(--serif);
  font-size: clamp(30px, 6vw, 40px);
  font-weight: 600;
  letter-spacing: -0.02em;
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}
.review-card .sub { color: var(--muted); font-size: 14px; }
.review-actions { margin-top: 20px; }

.ratings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin-top: 20px;
}
.ratings button {
  display: grid;
  gap: 3px;
  padding: 11px 6px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 650;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-1);
}
.ratings button span { font-size: 11px; font-weight: 550; opacity: 0.72; font-variant-numeric: tabular-nums; }
.ratings button:hover { transform: translateY(-1px); }
.ratings button[data-rating="again"] { border-color: color-mix(in srgb, var(--danger) 34%, transparent); color: var(--danger); background: var(--danger-soft); }
.ratings button[data-rating="hard"] { border-color: color-mix(in srgb, var(--warn) 34%, transparent); color: var(--warn); background: var(--warn-soft); }
.ratings button[data-rating="good"] { border-color: color-mix(in srgb, var(--ok) 34%, transparent); color: var(--ok); background: var(--ok-soft); }
.ratings button[data-rating="easy"] { border-color: var(--accent-line); color: var(--accent-hover); background: var(--accent-soft); }
.ratings button[data-rating="again"]:hover { background: var(--danger); color: #fff; }
.ratings button[data-rating="hard"]:hover { background: var(--warn); color: #fff; }
.ratings button[data-rating="good"]:hover { background: var(--ok); color: #fff; }
.ratings button[data-rating="easy"]:hover { background: var(--accent); color: var(--on-accent); }

/* ---------- 表格 ---------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-1);
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table tbody tr:hover { background: var(--surface-2); }
.table td.num { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.table .dict-name { font-family: var(--serif); font-size: 15.5px; color: var(--ink); font-weight: 600; }

/* ---------- 登录 ---------- */

.login-wrap {
  min-height: calc(100vh - 60px);
  display: grid;
  place-items: center;
  padding: 24px 16px 72px;
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  box-shadow: var(--sh-3);
  text-align: center;
}
.login-card .brand-mark { width: 46px; height: 46px; border-radius: 14px; font-size: 26px; margin: 0 auto 16px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card .lede { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.login-card .stack { border: 0; box-shadow: none; padding: 0; background: transparent; text-align: left; }

/* ---------- 页脚 ---------- */

.foot {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  gap: 8px 16px;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--line);
}
.foot a { color: var(--muted); }
.foot a:hover { color: var(--accent); }

/* ---------- 响应式 ---------- */

@media (max-width: 620px) {
  main { padding: 20px 13px 64px; }
  .topbar-inner { padding: 9px 13px; gap: 8px 10px; }
  .brand-sub { display: none; }
  .brand { order: 1; }
  .warn-chip { order: 2; margin-left: auto; font-size: 11.5px; padding: 3px 9px; }
  .nav { order: 3; width: 100%; margin-left: 0; justify-content: space-between; gap: 4px; }
  .nav a { padding: 6px 10px; font-size: 13.5px; }
  .search { flex-direction: column; }
  .search button { width: 100%; }
  .stack { padding: 16px; }
  .stack .row { grid-template-columns: 1fr; }
  .ratings { grid-template-columns: repeat(2, 1fr); }
  .review-card { padding: 22px 18px; }
  .block { padding: 14px 15px; }
  .table th, .table td { padding: 9px 11px; font-size: 13px; }
  .page-head { margin-bottom: 14px; }
}

/* ---------- 复习 · 日期索引 ---------- */

details.month {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  box-shadow: var(--sh-1);
  overflow: hidden;
}
details.month > summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 18px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  user-select: none;
}
details.month > summary::-webkit-details-marker { display: none; }
details.month > summary::before {
  content: "";
  width: 7px; height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
  flex: none;
  margin-right: 2px;
}
details.month[open] > summary::before { transform: rotate(45deg); }
details.month[open] > summary { border-bottom: 1px solid var(--line); }
details.month > summary:hover { background: var(--surface-2); }
.month-title { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--ink); }
.month-meta { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.month-body { padding: 10px 12px 14px; display: grid; gap: 8px; }

details.day {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
}
details.day > summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
  user-select: none;
}
details.day > summary::-webkit-details-marker { display: none; }
details.day > summary::before {
  content: "";
  width: 6px; height: 6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
  flex: none;
}
details.day[open] > summary::before { transform: rotate(45deg); }
details.day > summary:hover { background: var(--surface-3); }
.day-date { font-family: var(--serif); font-size: 15.5px; font-weight: 650; color: var(--ink); }
.day-week { color: var(--muted); font-size: 13px; }
.day-count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.day-seen, .day-new {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-pill);
  padding: 2px 9px;
}
.day-seen { color: var(--ok); background: var(--ok-soft); }
.day-new { color: var(--warn); background: var(--warn-soft); }
.day-body { padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.day-actions { margin-bottom: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 列表 · 筛选与命中提示 ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
.filter-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}
.filter-label:not(:first-child) { margin-left: 12px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  box-shadow: var(--sh-1);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.chip:hover { border-color: var(--accent-line); color: var(--accent-hover); text-decoration: none; }
.chip b { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.is-on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-hover);
}
.chip.is-on b { color: var(--accent-hover); }

.export-group { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.export-group .chip { box-shadow: none; }

.match-hint {
  margin-top: 8px;
  padding: 6px 11px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 12.5px;
  line-height: 1.55;
}
.match-hint em { font-style: normal; font-weight: 700; background: rgba(79, 70, 229, 0.16); border-radius: 3px; padding: 0 2px; }

.load-more { display: flex; justify-content: center; margin: 20px 0 4px; }
.load-more-end { text-align: center; margin: 18px 0 0; }

.term em, .zh em, .zh-en em, .src em {
  font-style: normal;
  font-weight: 700;
  background: rgba(79, 70, 229, 0.16);
  border-radius: 3px;
  padding: 0 2px;
  color: inherit;
}

/* ---------- 复习 · 自测 ---------- */

.quiz-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.quiz-back { font-size: 13.5px; color: var(--muted); }
.quiz-back:hover { color: var(--accent); text-decoration: none; }
.quiz-root { min-height: 240px; }
.quiz-top { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.quiz-tag {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
  padding: 2px 9px;
}
.quiz-prompt { font-size: 20px; line-height: 1.5; font-weight: 550; color: var(--ink); margin-bottom: 6px; }
.quiz-hint { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.quiz-cloze { font-family: var(--serif); font-size: 19px; line-height: 1.6; color: var(--ink); margin: 4px 0 18px; }
.quiz-body { margin-top: 4px; }

.quiz-options { display: grid; gap: 9px; margin-bottom: 16px; }
.quiz-option {
  justify-content: flex-start;
  text-align: left;
  padding: 13px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 550;
  box-shadow: var(--sh-1);
}
.quiz-option:hover:not(:disabled) { filter: none; border-color: var(--accent); background: var(--accent-soft); }
.quiz-option:disabled { cursor: default; }
.quiz-option.is-right { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.quiz-option.is-wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

.quiz-form { display: grid; gap: 10px; margin-bottom: 16px; }
.quiz-form input { font-size: 17px; padding: 12px 14px; }
.quiz-form input.is-right { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.quiz-form input.is-wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

.quiz-feedback { margin-top: 6px; padding-top: 14px; border-top: 1px dashed var(--line); }
.quiz-verdict { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.quiz-feedback.is-ok .quiz-verdict { color: var(--ok); }
.quiz-feedback.is-no .quiz-verdict { color: var(--danger); }
.quiz-answer-line { font-family: var(--serif); font-size: 17px; color: var(--ink-2); margin-bottom: 14px; }

.quiz-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  box-shadow: var(--sh-3);
  animation: toast-in 0.18s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 620px) {
  .quiz-prompt { font-size: 18px; }
  .quiz-option { padding: 12px 14px; font-size: 15.5px; }
  .quiz-cloze { font-size: 17px; }
  .month-title { font-size: 17px; }
  .month-body { padding: 8px 8px 12px; }
  .day-body { padding: 10px 11px 12px; }
}
