/* ==========================================================================
   HanziPress · design system
   视觉语言：宣纸 + 墨 + 朱印（paper / ink / seal）
   移植自 flashcard-demo 的设计语言：暖白宣纸底、墨黑正文、朱砂单点强调，
   声调配色 1 红 · 2 橙 · 3 绿 · 4 蓝 · 5 灰。
  零依赖，纯令牌 + 组件；营销页在 home.css 里继续叠加。
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  /* 纸与墨 */
  --paper: #fbf8f1;
  --paper-2: #f5f0e4;
  --paper-3: #ece4d4;
  --surface: #ffffff;
  --ink: #1b1916;
  --ink-2: #4b453c;
  --ink-3: #8a8172;
  --line: #e5ddcc;
  --line-2: #d5c9b1;

  /* 朱印 */
  --seal: #b4342a;
  --seal-2: #8d2620;
  --seal-soft: #fbedeb;
  --seal-line: #eccfc9;

  /* 靛 */
  --indigo: #2c5d8a;
  --indigo-soft: #edf2f8;
  --indigo-line: #cfdfee;

  /* 声调 */
  --t1: #c93b33;
  --t2: #bd7514;
  --t3: #2b8a56;
  --t4: #2d6cb3;
  --t5: #8a8172;

  /* 状态 */
  --ok: #2b8a56;
  --ok-soft: #eaf5ef;
  --warn: #bd7514;
  --warn-soft: #fbf1e0;

  /* 形状 */
  --r-xs: 5px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-full: 999px;

  --sh-1: 0 1px 2px rgba(43, 35, 20, 0.06), 0 1px 1px rgba(43, 35, 20, 0.04);
  --sh-2: 0 6px 18px -6px rgba(43, 35, 20, 0.16), 0 1px 2px rgba(43, 35, 20, 0.05);
  --sh-3: 0 24px 48px -18px rgba(43, 35, 20, 0.28), 0 3px 8px rgba(43, 35, 20, 0.06);

  --maxw: 1180px;
  --topbar-h: 62px;

  /* 字体 */
  --f-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Helvetica, Arial, sans-serif;
  --f-serif: "LXGW WenKai", "Kaiti SC", "KaiTi", "STKaiti", "Noto Serif SC",
    "Source Han Serif SC", "Songti SC", "SimSun", Georgia, "Times New Roman", serif;
  --f-pinyin: "Charis SIL", "DejaVu Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 15px;
  line-height: 1.62;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 12% 6%, rgba(180, 52, 42, 0.05), transparent 40%),
    radial-gradient(circle at 92% 2%, rgba(44, 93, 138, 0.055), transparent 34%),
    repeating-linear-gradient(0deg, rgba(27, 25, 22, 0.013) 0 1px, transparent 1px 3px);
  background-attachment: fixed;
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: var(--r-xs); }

/* ---------- typography ---------- */
.h1 {
  font-family: var(--f-serif);
  font-size: clamp(30px, 4.6vw, 50px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  font-weight: 600;
}
.h2 {
  font-family: var(--f-serif);
  font-size: clamp(21px, 2.4vw, 27px);
  line-height: 1.3;
  font-weight: 600;
}
.h3 { font-size: 17px; font-weight: 650; letter-spacing: -0.005em; }
.h4 { font-size: 14px; font-weight: 650; }

.lead { font-size: 16px; color: var(--ink-2); line-height: 1.7; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: -0.01em; }
.serif { font-family: var(--f-serif); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--seal);
}
.eyebrow::before {
  content: "";
  width: 16px;
  height: 2px;
  background: var(--seal);
  border-radius: 2px;
}
.eyebrow--ink { color: var(--ink-3); }
.eyebrow--ink::before { background: var(--line-2); }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.page { padding: 34px 0 72px; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 28px; }
.stack-sm > * + * { margin-top: 9px; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.section { margin-top: 52px; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 14px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.section-head p { color: var(--ink-3); font-size: 13.5px; margin-top: 5px; }
.section-head .h2 { margin-top: 8px; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(251, 248, 241, 0.86);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__in {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 22px;
}
/* The brand is the delivered HanziPress lockup as a single <img>, not live
   text: the letterforms are outlined in design/hanzipress/, so the header
   cannot drift from the logo. Size it by height only — the 515×172 viewBox
   already carries the required clear space around mark and wordmark.
   `flex: none` and `max-width: none` both matter: the global
   `img { max-width: 100% }` below makes the lockup's automatic minimum size
   collapse, so a tight bar shrank it to whatever room was left (137.7px →
   115px at 761px) and squashed the wordmark instead of taking the missing
   ~10px from the nav spacing. */
.brand { display: flex; align-items: center; }
.brand__logo { display: block; height: 46px; width: auto; flex: none; max-width: none; }

.nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav__link {
  padding: 7px 12px;
  border-radius: var(--r-full);
  font-size: 14px;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
}
.nav__link:hover { background: var(--paper-3); color: var(--ink); }
.nav__link.is-active { background: var(--ink); color: var(--paper); }

.topbar__side { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---------- pills / chips / tags ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}
.pill--ok { border-color: #cfe6d9; background: var(--ok-soft); color: #1f6b43; }
.pill--seal { border-color: var(--seal-line); background: var(--seal-soft); color: var(--seal-2); }
.pill--indigo { border-color: var(--indigo-line); background: var(--indigo-soft); color: var(--indigo); }
.pill--lang { border-color: var(--line-2); background: var(--paper-2); font-weight: 600; }
.pill--lang:hover { border-color: var(--seal-line); background: var(--seal-soft); color: var(--seal-2); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--ok .dot { background: var(--ok); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
}
.chip--plain { background: transparent; }
.chip--seal { background: var(--seal-soft); border-color: var(--seal-line); color: var(--seal-2); }
.chip .dot { background: var(--seal); }
.chip--link { cursor: pointer; transition: border-color 0.16s, background 0.16s, color 0.16s; }
.chip--link:hover { border-color: var(--seal-line); background: var(--seal-soft); color: var(--seal-2); }

/* 标签（小号大写字母，用于卡片底部） */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--seal);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
  box-shadow: var(--sh-1);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: linear-gradient(160deg, var(--seal), var(--seal-2));
  border-color: var(--seal-2);
  color: #fff;
}
.btn--ink { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--ghost { background: transparent; border-color: var(--line-2); box-shadow: none; }
.btn--ghost:hover { background: var(--paper-2); box-shadow: var(--sh-1); }
.btn--sm { padding: 7px 12px; font-size: 12.5px; }
.btn--lg { padding: 13px 22px; font-size: 15px; }
.btn--block { width: 100%; }
.btn__k {
  font-family: var(--f-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(27, 25, 22, 0.1);
  border: 1px solid rgba(27, 25, 22, 0.12);
}
.btn--primary .btn__k { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.22); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
}
.panel--pad { padding: 20px; }
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel__body { padding: 18px; }
.panel__foot {
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  border-radius: 0 0 var(--r) var(--r);
}

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- progress ---------- */
.bar {
  height: 7px;
  border-radius: var(--r-full);
  background: var(--paper-3);
  overflow: hidden;
}
.bar__fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--seal), #d2705f);
}
.bar__fill--ink { background: linear-gradient(90deg, #6c6355, #9a9082); }
.bar__fill--ok { background: linear-gradient(90deg, #2b8a56, #62b189); }

/* ---------- forms ---------- */
.field { display: block; }
.field__label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 7px;
}
.input, .select, .textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 14px;
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-soft);
}

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-sm);
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.seg__btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink-2);
  transition: background 0.14s, color 0.14s, box-shadow 0.14s;
}
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-1);
  font-weight: 600;
}
.seg--full { display: flex; width: 100%; }
.seg--full .seg__btn { flex: 1 1 0; min-width: 0; padding: 6px 8px; font-size: 12.5px; text-align: center; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row__t { font-size: 13.5px; }
.toggle-row__t small { display: block; font-size: 11.5px; color: var(--ink-3); }
.switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: var(--r-full);
  background: var(--paper-3);
  border: 1px solid var(--line-2);
  transition: background 0.16s, border-color 0.16s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--sh-1);
  transition: transform 0.16s;
}
.switch.is-on { background: var(--seal); border-color: var(--seal-2); }
.switch.is-on::after { transform: translateX(16px); }

.range { width: 100%; margin: 0; accent-color: var(--seal); }

.swatches { display: flex; gap: 7px; }
.swatch {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid rgba(27, 25, 22, 0.14);
  box-shadow: inset 0 0 0 2px #fff;
  cursor: pointer;
}

/* ---------- 手风琴 ---------- */
.acc { border-bottom: 1px solid var(--line); }
.acc:last-child { border-bottom: none; }
.acc__head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 0;
  font-size: 13.5px;
  font-weight: 650;
  text-align: left;
}
.acc__head .caret { color: var(--ink-3); transition: transform 0.18s; }
.acc.is-open .caret { transform: rotate(90deg); }
.acc__body { display: none; padding: 2px 0 14px; }
.acc.is-open .acc__body { display: block; }

/* ---------- 拼音声调着色 ---------- */
.py { font-family: var(--f-pinyin); letter-spacing: 0.01em; }
.tone1 { color: var(--t1); }
.tone2 { color: var(--t2); }
.tone3 { color: var(--t3); }
.tone4 { color: var(--t4); }
.tone5 { color: var(--t5); }
.py--plain .tone1, .py--plain .tone2, .py--plain .tone3,
.py--plain .tone4, .py--plain .tone5 { color: inherit; }

/* ---------- 汉字 ---------- */
.hanzi { font-family: var(--f-serif); line-height: 1; letter-spacing: 0.02em; }

/* ---------- 词条行 ---------- */
.wlist { border-top: 1px solid var(--line); }
.wrow {
  display: grid;
  grid-template-columns: 34px 96px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 11px 6px;
  border-bottom: 1px solid var(--line);
  transition: background 0.14s;
}
.wrow:hover { background: var(--paper-2); }
.wrow__no { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); }
.wrow__hz { font-family: var(--f-serif); font-size: 22px; }
.wrow__py { font-size: 14px; }
.wrow__en { font-size: 13.5px; color: var(--ink-2); }

/* ---------- 表格 ---------- */
.tbl th, .tbl td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.tbl th {
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
  background: var(--paper);
}
.tbl tr:last-child td { border-bottom: none; }

/* ---------- 词汇表变体（textbook 课时页） ---------- */
/* 编号/词条/拼音/词性收缩到内容宽，释义占满剩余宽度；
   斑马纹 + 行 hover 帮助长表扫读，词条用衬线大字承担视觉主次。 */
.tbl--vocab tbody td { padding: 11px 12px; }
.tbl--vocab th { border-bottom-color: var(--line-2); }
.tbl--vocab .def { color: var(--ink-2); }
.tbl--vocab tbody .py { font-size: 14.5px; }
.tbl--vocab tbody tr { transition: background 0.14s; }
.tbl--vocab tbody tr:nth-child(even) { background: rgba(245, 240, 228, 0.55); }
.tbl--vocab tbody tr:hover { background: var(--paper-3); }
.tbl--vocab td a:hover { color: var(--seal); }

/* ---------- callout ---------- */
.note {
  display: flex;
  gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.65;
}
.note--indigo { background: var(--indigo-soft); border-color: var(--indigo-line); }
.note--seal { background: var(--seal-soft); border-color: var(--seal-line); }
.note__k { flex: none; font-size: 15px; line-height: 1.4; }

/* ---------- footer ---------- */
.foot {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  background: rgba(245, 240, 228, 0.7);
  padding: 30px 0 40px;
}
.foot__in { display: flex; flex-wrap: wrap; gap: 26px; justify-content: space-between; }
.foot__brand { font-family: var(--f-serif); font-size: 16px; }
.foot__brand .hl { color: var(--seal); }
/* No max-width here: the footer links already wrap onto their own row, so
   capping the note only forced an awkward mid-phrase break
   (…classrooms. © 2026 / hanzipress.com…). */
.foot__note { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.7; }
.foot__links { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12.5px; color: var(--ink-2); align-self: flex-start; }
.foot__links a:hover { color: var(--seal); }
.foot__note a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.foot__note a:hover { color: var(--seal); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 200;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  max-width: min(90vw, 620px);
  padding: 11px 18px;
  border-radius: var(--r-full);
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  box-shadow: var(--sh-3);
  transition: opacity 0.22s, transform 0.22s;
  pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translateX(-50%); }

/* ---------- helpers ---------- */
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hr { height: 1px; background: var(--line); border: 0; margin: 0; }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- closing CTA band ---------- */
.cta-band-section { margin-top: 52px; }
.cta-band {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 50px 44px;
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--seal), var(--seal-2));
  color: #fff;
  box-shadow: var(--sh-3);
}
.cta-band h2 {
  position: relative;
  font-family: var(--f-serif);
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 12px;
}
.cta-band p {
  position: relative;
  max-width: 560px;
  margin: 0 auto 26px;
  font-size: 15.5px;
  opacity: 0.9;
}
.cta-band .grid-deco { position: absolute; inset: 0; opacity: 0.14; pointer-events: none; }
.cta-band .cta-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.cta-band .btn--light {
  background: #fff;
  border-color: #fff;
  color: var(--seal-2);
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.6);
}
.cta-band .btn--light:hover { transform: translateY(-1px); }
.cta-band .btn--outline { background: transparent; border-color: rgba(255, 255, 255, 0.55); color: #fff; box-shadow: none; }
.cta-band .btn--outline:hover { background: rgba(255, 255, 255, 0.12); box-shadow: none; }
.cta-band .cta-link {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.45);
  text-underline-offset: 4px;
}
.cta-band .cta-link:hover { text-decoration-color: #fff; }

/* ---------- inner-page header ---------- */
.page-head { padding: 34px 0 6px; }
/* .eyebrow is inline-flex, so as the first child of .page-head it sat inside
   the parent's 1.62 line box and the half-leading pushed it ~7px below the
   padding edge — pages that start with a block-level .crumbs line up flush.
   flex makes it block-level here (the ::before rule and gap still work), so
   every page-head starts at the same y. */
.page-head .eyebrow { display: flex; margin-bottom: 4px; }
.page-head .h1 { margin: 12px 0; }
/* Intro copy: 68ch was too narrow under a full-width h1 — it forced a ragged
   third line and broke mid-phrase ("…then drill into the / level/volume").
   92ch + balance keeps the break at a natural sentence boundary and evens the
   line lengths (balance is ignored by older browsers, which fall back to the
   92ch measure). */
.page-head .lead { max-width: 92ch; text-wrap: balance; }
/* HSK level intros: two sentences, each on its own line, filling the measure
   and wrapping to the viewport instead of the 92ch cap used elsewhere. */
.page-head .lead--fluid { max-width: none; text-wrap: pretty; }
.page-head .badge-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--seal); }
.crumbs .sep { color: var(--line-2); }
.crumbs .here { color: var(--ink-2); font-weight: 600; }

/* ---------- generic surface card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
  padding: 18px;
}
.card--link { display: block; transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s; }
.card--link:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--seal-line); }
.card h3 { font-size: 15.5px; font-weight: 650; }
.card p { color: var(--ink-3); font-size: 13.5px; line-height: 1.65; }

/* ---------- stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat {
  padding: 15px 16px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
}
.stat__n { font-family: var(--f-serif); font-size: 25px; line-height: 1.1; }
.stat__l {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- alphabet / tag index ---------- */
.alpha { display: flex; flex-wrap: wrap; gap: 6px; }
.alpha a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.alpha a:hover { border-color: var(--seal-line); background: var(--seal-soft); color: var(--seal-2); }
.alpha .n { font-size: 11px; font-weight: 500; color: var(--ink-3); }

/* ---------- prose ---------- */
.prose { color: var(--ink-2); font-size: 15px; line-height: 1.75; }
.prose > * + * { margin-top: 12px; }
.prose h2 { font-family: var(--f-serif); font-size: 20px; font-weight: 600; color: var(--ink); margin-top: 26px; }
.prose h3 { font-size: 15.5px; font-weight: 650; color: var(--ink); margin-top: 20px; }
.prose ul, .prose ol { padding-left: 1.2em; list-style: revert; }
.prose li + li { margin-top: 5px; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose code {
  font-family: var(--f-mono);
  font-size: 12.5px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
.prose a, .link { color: var(--seal); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover, .link:hover { color: var(--seal-2); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Tablets (761–900px): nav and pill are both shown, and together they run
   past the bar, so the row tightens up here. The logo cannot absorb it
   (`flex: none` + `max-width: none`), so the space comes out of the header
   gaps, the nav margin and the link padding — nothing overflows, nothing
   distorts. The extra 860px step buys the last ~20px the 768px portrait
   tablet needs. */
@media (max-width: 900px) {
  .topbar__in { gap: 14px; }
  .nav { margin-left: 0; gap: 0; }
  .nav__link { padding: 7px 9px; }
}
@media (max-width: 860px) {
  .nav__link { padding: 7px 7px; }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .topbar__side .pill { display: none; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
  .section-head { flex-direction: column; align-items: flex-start; }
  .wrow { grid-template-columns: 26px 1fr; row-gap: 2px; }
  .wrow__en { grid-column: 2; }
  .page-head { padding-top: 24px; }
  .cta-band { padding: 34px 22px; }
}
/* Narrow phones: the vocabulary table's Word header carries a 7rem floor
   (w-[1%] min-w-[7rem]) and every cell before the Definition column is
   nowrap, so the table's minimum width exceeded the viewport and the panel's
   overflow-hidden clipped the Definition column instead of wrapping it. Drop
   the floor, let the cells wrap and tighten the padding so long definitions
   read inside the viewport. */
@media (max-width: 620px) {
  .tbl--vocab th { min-width: 0; }
  .tbl--vocab th, .tbl--vocab td { white-space: normal; }
  .tbl--vocab th, .tbl--vocab tbody td { padding-left: 9px; padding-right: 9px; }
  .tbl--vocab .def { overflow-wrap: anywhere; }
  /* TonePinyin renders each syllable as an adjacent <span> with no whitespace
     between them, so a multi-syllable reading is one unbreakable token. Let it
     wrap (and only mid-syllable as a last resort) so the column stops pushing
     the table past the viewport. */
  .tbl--vocab td.py { overflow-wrap: anywhere; }
}
/* Below 360px even the tightened padding leaves the Word column's intact
   headword (its link is whitespace-nowrap) a few pixels past the panel; shave
   the cell padding further so the definition stays fully visible. */
@media (max-width: 360px) {
  .tbl--vocab th, .tbl--vocab tbody td { padding-left: 6px; padding-right: 6px; }
}
/* Narrow phones: the lockup must fit a 320–390px bar without a horizontal
   scrollbar (the nav and pill are already hidden below 760px), so drop the
   wordmark a size rather than letting it clip. */
@media (max-width: 560px) {
  .topbar__in { gap: 12px; }
  .brand__logo { height: 38px; }
  .topbar__side { flex: none; }
  .topbar__side .btn--sm { padding: 6px 10px; font-size: 12px; }
}

/* ---------- inline feedback disclosure ---------- */
/* Shared by the worksheet generator (fb-cta card in the preview column) and
   the About page (plain btn trigger). The panel is mounted-but-hidden so a
   half-typed message survives a collapse. */
.fb-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.fb-cta:hover { border-color: var(--seal-line); background: var(--seal-soft); transform: translateY(-1px); }
.fb-cta__title { font-size: 14px; font-weight: 650; color: var(--ink); }
.fb-cta__sub { font-size: 12.5px; color: var(--ink-3); }

.fb-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
/* The panel sets `display`, which would otherwise beat the UA's [hidden] rule. */
.fb-panel[hidden] { display: none; }
.fb-panel__title { font-size: 15px; font-weight: 650; margin: 0; }
