/* ==========================================================================
   LexiFlow 2.0 · Oxford Picture Dictionary × Academic Editorial
   原则：主词第一；留白多于装饰；细线代替卡片；默认可见，不依赖悬停。
   ========================================================================== */

:root {
  --paper: #FFFCF6;
  --paper-2: #F5EFE3;
  --ink: #26314B;
  --ink-2: #424C61;
  --ink-3: #687080;
  --rule: #E2DDD2;
  --rule-strong: #C7C0B3;
  --accent: #36689D;
  --accent-soft: #E8F1F8;
  --on-accent: #FFFEFA;
  --note-bg: #FFF6DD;
  --highlight: #FBE6A2;
  --mnemonic-bg: #F7F1FC;
  --mnemonic-rule: #E5D9F0;
  --mnemonic-accent: #765394;
  /* 图版内（插画叠加层）始终使用浅底配色，深色模式下也保持插画原色 */
  --plate-bg: transparent;
  --plate-ink: #1C1B19;
  --plate-ink-2: #4A4741;
  --plate-accent: #36689D;
  --plate-halo: #FFFCF6;

  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, "URW Palladio L", P052, Georgia, "Noto Serif", serif;
  --serif-zh: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "PingFang SC", "Microsoft YaHei", serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --ipa: "Iowan Old Style", "Palatino Linotype", "Charis SIL", "Doulos SIL", "Segoe UI", "Lucida Sans Unicode", "Arial Unicode MS", serif;

  --gutter: clamp(20px, 4.5vw, 64px);
  --maxw: 1320px;
  --turn-h: 76px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #191D26;
  --paper-2: #232936;
  --ink: #E9EAF0;
  --ink-2: #C6CDD6;
  --ink-3: #A2ADBC;
  --rule: #353D4A;
  --rule-strong: #4D5766;
  --accent: #A8C9EA;
  --accent-soft: #283B50;
  --on-accent: #172A40;
  --note-bg: #2D2C26;
  --highlight: #504A2E;
  --mnemonic-bg: #292536;
  --mnemonic-rule: #493D59;
  --mnemonic-accent: #CDB2E8;
  --plate-bg: #E9E5DC;
  --plate-halo: #E9E5DC;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #191D26;
    --paper-2: #232936;
    --ink: #E9EAF0;
    --ink-2: #C6CDD6;
    --ink-3: #A2ADBC;
    --rule: #353D4A;
    --rule-strong: #4D5766;
    --accent: #A8C9EA;
    --accent-soft: #283B50;
    --on-accent: #172A40;
    --note-bg: #2D2C26;
    --highlight: #504A2E;
    --mnemonic-bg: #292536;
    --mnemonic-rule: #493D59;
    --mnemonic-accent: #CDB2E8;
    --plate-bg: #E9E5DC;
    --plate-halo: #E9E5DC;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; }
p, h1, h2, h3, ol, ul, dl, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 50; text-decoration: none; }
.skip:focus { top: 12px; }
svg { display: block; }

/* ---------- 小标题（kicker）：小号大写字母 + 中文，后接一条细线 ---------- */
.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 600 11.5px/1 var(--sans);
  letter-spacing: .04em;
  color: var(--ink-3);
}
.kicker > span[lang="en"] { text-transform: uppercase; letter-spacing: .16em; }
.kicker::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* ==========================================================================
   刊头
   ========================================================================== */
.masthead {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.masthead__brand { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.wordmark { font: 400 23px/1 var(--serif); letter-spacing: .005em; color: var(--ink); white-space: nowrap; }
.wordmark i { font-style: italic; }
.tagline {
  font: italic 14px/1 var(--serif);
  color: var(--ink-3);
  padding-left: 14px;
  border-left: 1px solid var(--rule);
  white-space: nowrap;
}
.masthead__tools { display: flex; align-items: center; gap: 4px; }
.tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  background: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-2);
}
.tool:hover { background: var(--paper-2); color: var(--ink); }
.tool__label { color: var(--ink-3); }
.tool__value { color: var(--ink); }
.tool__value::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-right: 1.3px solid currentColor; border-bottom: 1.3px solid currentColor; transform: translateY(-3px) rotate(45deg); opacity: .6; }
.tool--icon { width: 44px; padding: 0; justify-content: center; }
.tool--icon svg { width: 22px; height: 22px; fill: currentColor; }
.tool--search svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* 词库归属与学习范围是两层筛选；主题分类继续沿用刊头入口。 */
#wordListControls {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 24px;
  padding: 8px var(--gutter);
  border-top: 1px solid var(--rule);
}
.wordlist-controls__row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.wordlist-controls__row--scope { gap: 18px; }
#wordListChoices, #studyModeChoices { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
#wordListChoices button, #studyModeChoices button {
  min-height: 40px; padding: 6px 12px; border: 0; border-radius: 3px;
  background: transparent; color: var(--ink-2); font: 400 14px/1.4 var(--sans); cursor: pointer;
}
#wordListChoices button:hover, #studyModeChoices button:hover { background: var(--paper-2); color: var(--ink); }
#wordListChoices button { border-radius: 0; border-bottom: 2px solid transparent; }
#wordListChoices button[aria-pressed="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
#studyModeChoices { flex-wrap: nowrap; gap: 2px; padding: 2px; border-radius: 4px; background: var(--paper-2); }
#studyModeChoices button { min-height: 32px; padding: 5px 10px; font-size: 12px; color: var(--ink-3); }
#studyModeChoices button[aria-pressed="true"] {
  background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px #0000000d;
}
#wordListStatus { font-size: 12px; line-height: 1.5; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
#wordListContext { grid-column: 1 / -1; margin-top: 4px; font-size: 12px; color: var(--ink-3); }
#wordListContext[hidden] { display: none; }
.entry.entry--empty { display: block; }
.entry__empty { max-width: 38em; margin: 0 auto; padding: clamp(48px, 12vh, 120px) 0; text-align: center; color: var(--ink-3); }
.entry__empty > p:first-child { font: 400 22px/1.6 var(--serif-zh); color: var(--ink-2); }
.entry__empty > p + p { margin-top: 12px; font-size: 14px; line-height: 1.8; }
.choice__count { flex: none; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.turn__next:disabled { opacity: .4; cursor: default; }
.turn__next:disabled:hover { filter: none; }
.turn__next:disabled:active { transform: none; }

/* ==========================================================================
   页面与词条
   ========================================================================== */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(20px, 3.2vw, 44px) var(--gutter) 40px;
  border-top: 1px solid var(--rule);
  outline: none;
}
.entry__loading, .entry__error { font: italic 17px/1.6 var(--serif); color: var(--ink-3); padding: 18vh 0; text-align: center; }
.entry__error button { margin-top: 14px; }

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "meta" "head" "pron" "senses" "example" "plate" "related" "more";
  transition: opacity .16s ease, transform .16s ease;
}
.entry.is-turning { opacity: 0; transform: translateY(6px); }
@media (prefers-reduced-motion: reduce) { .entry { transition: none; } .entry.is-turning { transform: none; } }

/* —— 序号行：小、稳定、克制 —— */
.entry__meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: var(--ink-3);
}
.folio {
  font: 400 15px/1 var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: .06em;
  color: var(--ink-3);
}
.folio i { font-style: italic; letter-spacing: 0; margin-right: .2em; }
.entry__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--rule-strong); }
.cat { font: 13px/1 var(--sans); color: var(--ink-3); }
.cat [lang="en"] { font: italic 14px/1 var(--serif); margin-left: .35em; }
.bookmark {
  margin-left: auto;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: none; border-radius: 3px; cursor: pointer;
  color: var(--ink-3);
}
.bookmark:hover { color: var(--ink); background: var(--paper-2); }
.bookmark svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.bookmark[aria-pressed="true"] { color: var(--accent); }
.bookmark[aria-pressed="true"] svg { fill: currentColor; }

/* —— 主词：页面第一视觉中心 —— */
.headword-wrap { grid-area: head; container-type: inline-size; position: relative; }
.headword-wrap--bell .headword { max-width: calc(100% - 100px); font-size: min(112px, calc((100cqi - 100px) / (var(--len, 6) * 0.56))); }
.word-sticker { position: absolute; right: 0; top: 4px; width: 90px; height: 90px; object-fit: contain; pointer-events: none; }
.headword {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(56px, 9vw, 120px);
  font-size: min(112px, calc(100cqi / (var(--len, 6) * 0.56)));
  line-height: 1.02;
  letter-spacing: -0.018em;
  color: var(--accent);
  margin: 4px 0 20px;
  overflow-wrap: anywhere;
}

/* —— 发音 —— */
.pron { grid-area: pron; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; margin: 0 0 22px -10px; }
.ipa--solo { margin: 0 8px 0 10px; }
.pron__btn {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px; padding: 0 10px;
  border: 0; background: none; border-radius: 3px; cursor: pointer;
}
.pron__btn:hover { background: var(--paper-2); }
.pron__tag { font: 600 11px/1 var(--sans); letter-spacing: .14em; color: var(--ink-3); }
.ipa { font: 400 19px/1 var(--ipa); color: var(--ink-2); }
.pron__btn svg { width: 17px; height: 17px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pron__btn.is-speaking svg { animation: pulse .9s ease-in-out infinite; }
.pron__btn[disabled] { cursor: default; opacity: .55; }
.pron__btn[disabled] svg { display: none; }
.pron__status { flex-basis: 100%; margin: 0 10px; font: 13px/1.6 var(--sans); color: var(--ink-3); }
.pron__status[hidden] { display: none; }
@keyframes pulse { 50% { opacity: .35; } }

/* —— 义项 —— */
.senses { grid-area: senses; display: grid; gap: 14px; margin-bottom: 30px; }
.sense { display: grid; grid-template-columns: minmax(3.1em, max-content) minmax(0, 1fr); align-items: baseline; }
.pos { font: italic 19px/1 var(--serif); color: var(--accent); }
.sense > .pos { white-space: nowrap; padding-right: 12px; }
.sense__zh { font: 500 21px/1.45 var(--serif-zh); color: var(--ink); }
.sense__en { font: 400 16.5px/1.5 var(--serif); color: var(--ink-2); margin-top: 2px; }

/* 淡黄便笺：只高亮目标词，例句正文保持正常阅读颜色。 */
.entry__example { grid-area: example; min-width: 0; margin-bottom: 24px; }
.example-note { position: relative; padding: 14px 18px 16px; background: var(--note-bg); border-radius: 12px; overflow: hidden; }
.example-note__corner { position: absolute; width: 22px; height: 22px; right: 0; top: 0; pointer-events: none; }
.example-note__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 5px; padding-right: 5px; }
.example-label { font: 500 12.5px/1.4 var(--sans); color: var(--ink-3); }
.example-note__head .say { width: 32px; height: 28px; margin: 0; }
.example-note .ex__en { font-size: 17px; line-height: 1.5; }
.example-note .ex__zh { margin-top: 7px; }
.target-word { background: var(--highlight); color: var(--accent); font-weight: 600; padding: .02em .12em; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* 可选助记紧随例句；沿用原来的 example 栅格区域，无内容时不留空位。 */
.mnemonic-note { margin-top: 12px; padding: 14px 18px 16px; background: var(--mnemonic-bg); border: 1px solid var(--mnemonic-rule); border-radius: 12px; }
.mnemonic-note:first-child { margin-top: 0; }
.mnemonic-note__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mnemonic-note h2 { display: flex; align-items: center; gap: 7px; font: 600 13px/1.5 var(--sans); color: var(--ink); }
.mnemonic-note h2 svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--mnemonic-accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.mnemonic-note__kind { flex: none; padding: 2px 8px; border: 1px solid var(--mnemonic-rule); border-radius: 999px; color: var(--mnemonic-accent); font: 400 11px/1.5 var(--sans); white-space: nowrap; }
.mnemonic-note p { margin-top: 8px; font: 400 15px/1.65 var(--sans); color: var(--ink-2); overflow-wrap: anywhere; }
.mnemonic-note .mnemonic-note__caution { margin-top: 6px; font-size: 12px; line-height: 1.5; color: var(--mnemonic-accent); }

/* —— 图版 —— */
.entry__plate { grid-area: plate; margin: 4px 0 30px; min-width: 0; }
.plate { background: var(--plate-bg); border-radius: 3px; }
.plate svg { width: 100%; height: auto; overflow: visible; }
.plate image { image-rendering: auto; }
.callout__halo { stroke: var(--plate-halo); stroke-linecap: round; fill: none; }
.callout__line { stroke: var(--plate-ink-2); stroke-linecap: round; fill: none; }
.callout__dot { fill: var(--plate-ink); stroke: var(--plate-halo); }
.callout__label { font-family: var(--serif); fill: var(--plate-ink); paint-order: stroke; stroke: var(--plate-halo); stroke-linejoin: round; }
.callout--self .callout__label { fill: var(--plate-accent); font-weight: 600; }
.callout__ring { fill: var(--plate-halo); stroke: var(--plate-accent); }
.callout__num { font-family: var(--sans); font-weight: 600; fill: var(--plate-accent); }
.callout.is-hot .callout__line { stroke: var(--plate-accent); }
.callout.is-hot .callout__dot { fill: var(--plate-accent); }
.callout.is-hot .callout__label { fill: var(--plate-accent); }
.callout.is-hot .callout__ring { fill: var(--plate-accent); }
.callout.is-hot .callout__num { fill: var(--plate-halo); }
.plate__key { font-family: var(--serif); font-style: italic; fill: var(--plate-ink); }
.figcap {
  margin-top: 12px;
  font: 400 14px/1.6 var(--serif-zh);
  color: var(--ink-3);
  max-width: 62ch;
}
.figcap b { font: italic 600 14px/1 var(--serif); color: var(--ink-2); margin-right: .45em; }
.figcap .credit { white-space: nowrap; }
.plate--none { padding: 40px 0; font: italic 15px/1.6 var(--serif); color: var(--ink-3); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }

/* —— 关联词：从属于主词的词汇列表，不做卡片阵列 —— */
.related { grid-area: related; margin-bottom: 26px; }
.related .kicker { margin-bottom: 4px; }
.rel {
  display: grid;
  grid-template-columns: 1.6em minmax(7.5em, auto) minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 12px;
  padding: 9px 0 8px;
  border-bottom: 1px solid var(--rule);
}
/* 宽版图版直接写出标签，列表无需编号列 */
body:not([data-plate="compact"]) .rel { grid-template-columns: minmax(7.5em, auto) minmax(0, 1fr) auto; }
body:not([data-plate="compact"]) .rel__num { display: none; }
.rel__num { font: 600 12.5px/1 var(--sans); color: var(--accent); font-variant-numeric: tabular-nums; visibility: hidden; }
body[data-plate="compact"] .rel__num { visibility: visible; }
.rel__word { font: 400 20px/1.2 var(--serif); color: var(--ink); }
.rel__word .rel__pos { font: italic 14.5px/1 var(--serif); color: var(--ink-3); margin-left: .4em; }
.rel__zh { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.rel__type { font-size: 12px; color: var(--ink-3); white-space: nowrap; text-align: right; }
.rel[data-ref] { cursor: default; }
.rel.is-hot .rel__word { color: var(--accent); }
.rel a.rel__word { text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 4px; }

/* —— 展开区：例句 · 辨析 · 词形 · 词源 —— */
.more { grid-area: more; border-top: 1px solid var(--rule-strong); }
.more > summary {
  list-style: none;
  display: flex; align-items: center; gap: 14px;
  min-height: 52px;
  cursor: pointer;
  font-size: 15px; color: var(--ink);
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after {
  content: ""; margin-left: auto; width: 11px; height: 11px; flex: none;
  background:
    linear-gradient(currentColor, currentColor) center / 11px 1.4px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.4px 11px no-repeat;
  color: var(--ink-2);
}
.more[open] > summary::after { background: linear-gradient(currentColor, currentColor) center / 11px 1.4px no-repeat; }
.more__hint { font-size: 13px; color: var(--ink-3); }
.more__body { padding: 4px 0 8px; display: grid; gap: 26px; }
.more__sec .kicker { margin-bottom: 12px; }
.ex-group + .ex-group { margin-top: 16px; }
.ex-sense { font-size: 14px; color: var(--ink-2); margin-bottom: 6px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ex-sense .pos { font-size: 16px; }
.ex-sense .tag { font-size: 11.5px; color: var(--ink-3); border: 1px solid var(--rule); padding: 1px 6px; border-radius: 2px; }
.ex-sense .en { font: italic 15px/1.5 var(--serif); color: var(--ink-3); flex-basis: 100%; }
.ex { padding: 6px 0 6px 14px; border-left: 2px solid var(--rule); }
.ex + .ex { margin-top: 8px; }
.ex__en { font: 400 17px/1.55 var(--serif); color: var(--ink); }
.ex__en b { font-weight: 600; }
.ex__zh { font-size: 14.5px; color: var(--ink-2); }
.say {
  display: inline-flex; vertical-align: -3px; margin-left: 6px;
  width: 30px; height: 26px; align-items: center; justify-content: center;
  border: 0; background: none; border-radius: 3px; cursor: pointer;
}
.say:hover { background: var(--paper-2); }
.say svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.note + .note { margin-top: 14px; }
.note__title { font: 600 15px/1.5 var(--serif-zh); color: var(--ink); margin-bottom: 2px; }
.note__body { font-size: 15px; color: var(--ink-2); }
.forms { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: 15px; }
.forms dt { color: var(--ink-3); }
.forms dd { margin: 0; font-family: var(--serif-zh); color: var(--ink); }
.etym { font-size: 15px; color: var(--ink-2); }
.draft-tag { display: inline-block; font-size: 11.5px; color: var(--ink-3); border: 1px dashed var(--rule-strong); padding: 0 6px; border-radius: 2px; margin-left: 6px; vertical-align: 1px; }
.provenance { font-size: 12.5px; line-height: 1.7; color: var(--ink-3); border-top: 1px solid var(--rule); padding-top: 12px; }
.provenance span + span::before { content: " · "; }

/* ==========================================================================
   翻页栏（书页页脚）
   ========================================================================== */
.turn {
  position: sticky;
  bottom: 0;
  z-index: 10;
  width: 100%;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--rule);
}
.turn > * { position: relative; }
.turn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px max(var(--gutter), calc((100vw - var(--maxw)) / 2 + var(--gutter)));
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
.turn__back {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 48px; padding: 0 12px 0 6px;
  border: 0; background: none; border-radius: 3px; cursor: pointer;
  font-size: 15px; color: var(--ink-2);
}
.turn__back:hover:not(:disabled) { background: var(--paper-2); color: var(--ink); }
.turn__back:disabled { opacity: .35; cursor: default; }
.turn__back svg, .turn__next svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.turn__hint { font-size: 12.5px; color: var(--ink-3); }
.turn__hint kbd { font: 11.5px/1 var(--sans); border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 3px; padding: 2px 6px; margin-right: 4px; color: var(--ink-2); }
.turn__next {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 50px; padding: 0 22px 0 26px;
  border: 0; border-radius: 24px; cursor: pointer;
  background: var(--accent); color: var(--on-accent);
  font-size: 16px; font-weight: 600; letter-spacing: .04em;
  transition: background-color .15s ease;
}
.turn__next:hover { background: var(--accent); filter: brightness(.94); }
.turn__next:active { transform: translateY(1px); }

/* ==========================================================================
   弹出面板（分类 / 更多 / 列表）
   ========================================================================== */
.sheet {
  width: min(440px, calc(100vw - 32px));
  max-height: min(78vh, 680px);
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 60px -24px rgba(20, 18, 15, .35);
}
.sheet::backdrop { background: rgba(20, 18, 15, .28); }
.sheet__inner { padding: 6px 24px 22px; display: flex; flex-direction: column; max-height: inherit; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; min-height: 56px; border-bottom: 1px solid var(--rule); margin-bottom: 14px; }
.sheet__head h2 { font: 400 22px/1 var(--serif-zh); }
.sheet__close { width: 40px; height: 40px; margin-right: -10px; border: 0; background: none; border-radius: 3px; font-size: 24px; line-height: 1; color: var(--ink-2); cursor: pointer; }
.sheet__close:hover { background: var(--paper-2); }
.sheet__lead { font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
.sheet__note { font-size: 12.5px; color: var(--ink-3); margin-top: 14px; }
.sheet__group { margin-top: 22px; }
.sheet__group .kicker { margin-bottom: 12px; }
.about p + p { margin-top: 6px; }
.about p { font-size: 14px; color: var(--ink-2); }
.source-notes { margin-top: 12px; color: var(--ink-2); font-size: 13px; }
.source-notes summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.source-notes ul { display: grid; gap: 8px; margin: 10px 0; }
.source-notes a { color: var(--accent); text-underline-offset: 3px; }
.choices { border: 0; padding: 0; margin: 0; display: grid; flex: none; }
.sheet__inner { overflow-y: auto; }
.sheet__inner > *:not(.wordlist) { flex-shrink: 0; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 46px; border-bottom: 1px solid var(--rule); cursor: pointer; font-size: 15px; }
.choice input { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; }
.choice [lang="en"] { margin-left: auto; font: italic 14px/1 var(--serif); color: var(--ink-3); }
.menu__item {
  width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 12px 0; border: 0; border-bottom: 1px solid var(--rule); background: none; cursor: pointer; text-align: left;
  font-size: 16px; color: var(--ink);
}
.menu__item:hover { color: var(--accent); }
a.menu__item { text-decoration: none; }
.menu__desc { font-size: 13px; color: var(--ink-3); }
.segmented { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 3px; overflow: hidden; }
.segmented button { border: 0; background: none; padding: 9px 14px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--rule-strong); }
.segmented button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.wordlist { overflow-y: auto; margin: 0 -24px; padding: 0 24px; flex: 1; min-height: 80px; }
.wordlist li { display: flex; align-items: center; border-bottom: 1px solid var(--rule); }
.wl__open { flex: 1; display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; column-gap: 12px; padding: 11px 0; border: 0; background: none; cursor: pointer; text-align: left; min-width: 0; }
.wl__open:hover .wl__word { color: var(--accent); }
.wl__word { font: 400 19px/1.2 var(--serif); }
.wl__zh { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl__time { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.wl__remove { width: 40px; height: 40px; border: 0; background: none; color: var(--ink-3); cursor: pointer; border-radius: 3px; font-size: 18px; }
.wl__remove:hover { color: var(--ink); background: var(--paper-2); }
.wordlist__empty { padding: 28px 0; font: italic 15px/1.6 var(--serif-zh); color: var(--ink-3); border: 0 !important; }
.sheet__foot { display: flex; justify-content: flex-end; padding-top: 12px; }
.sheet__foot:empty { display: none; }
.text-btn { border: 0; background: none; padding: 8px 4px; font-size: 13.5px; color: var(--ink-3); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.text-btn:hover { color: var(--ink); }

/* 搜索沿用纸面弹窗；结果仅展示英文与归属，不预取整库释义。 */
.sheet--search { width: min(520px, calc(100vw - 32px)); max-height: min(78vh, 660px); max-height: min(78dvh, 660px); overflow: hidden; }
.sheet--search .sheet__inner { overflow: hidden; padding-bottom: 16px; }
.search__field { display: flex; align-items: center; min-height: 48px; border: 1px solid var(--rule-strong); border-radius: 4px; background: var(--paper); }
.search__field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.search__field input { width: 100%; min-width: 0; min-height: 48px; padding: 10px 12px; border: 0; outline: 0; background: transparent; color: var(--ink); font: 400 18px/1.4 var(--sans); border-radius: inherit; }
.search__field input::placeholder { color: var(--ink-3); font-size: 16px; }
.search__field input::-webkit-search-cancel-button { display: none; }
.search__clear { flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: var(--ink-3); font-size: 23px; cursor: pointer; }
.search__clear[hidden] { display: none; }
.search__clear:hover { color: var(--ink); background: var(--paper-2); }
.search__status { padding: 10px 0 8px; color: var(--ink-3); font-size: 12px; line-height: 1.5; }
.sheet--search .sheet__inner > .search__results { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -8px; padding: 0 8px; }
.search__results li + li { border-top: 1px solid var(--rule); }
.search-result { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 14px; width: 100%; min-height: 58px; padding: 12px 4px; border: 0; background: none; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer; }
.search-result:hover { background: var(--paper-2); }
.search-result__word { min-width: 0; overflow-wrap: anywhere; font: 400 22px/1.3 var(--serif); }
.search-result__meta { display: grid; gap: 2px; color: var(--ink-3); font: 400 11.5px/1.6 var(--sans); text-align: right; }
.search-result__alias { grid-column: 1 / -1; color: var(--ink-3); font-size: 12px; }

/* ==========================================================================
   响应式
   ========================================================================== */

/* 桌面：「文字 + 图版」左右舒展的跨页排布 */
@media (min-width: 1024px) {
  .entry {
    grid-template-columns: minmax(0, 4.6fr) minmax(0, 7.4fr);
    grid-template-areas:
      "meta    plate"
      "head    plate"
      "pron    plate"
      "senses  plate"
      "example plate"
      "related plate"
      "more    .";
    column-gap: clamp(48px, 5vw, 80px);
  }
  /* 无插画词条：纯文字跨页 —— 左栏主词与释义，右栏关联词与「更多」，不留空白占位 */
  .entry.entry--text {
    grid-template-columns: minmax(0, 5.2fr) minmax(0, 6.8fr);
    grid-template-rows: auto auto auto auto auto 1fr;
    grid-template-areas:
      "meta    related"
      "head    related"
      "pron    related"
      "senses  related"
      "example related"
      ".       more";
  }
  .entry--text .related { align-self: start; padding-top: 12px; margin-bottom: 20px; }
  .entry--text .more { align-self: start; }
  /* 图版只与首屏信息并排、垂直居中；展开「更多」不会把插画挤走 */
  .entry__plate { align-self: center; margin: 0; padding: 12px 0 8px; }
  .page { padding-top: clamp(16px, 2.4vw, 32px); }
  .senses { margin-bottom: 34px; }
}

/* 平板 / 窄桌面：单列，图版保持宽版标注 */
@media (min-width: 720px) and (max-width: 1023px) {
  .entry__plate { margin: 8px 0 34px; }
}

/* 手机：单列、可滚动；图版切换为编号标注，翻页栏固定在拇指区 */
@media (max-width: 719px) {
  :root { --gutter: 18px; }
  .masthead { height: 48px; }
  .tagline { display: none; }
  .tool { padding: 0 8px; }
  #wordListControls { grid-template-columns: minmax(0, 1fr); row-gap: 4px; padding-top: 4px; padding-bottom: 8px; }
  .wordlist-controls__row { gap: 8px; }
  .wordlist-controls__row--scope { justify-content: space-between; }
  #wordListChoices, #studyModeChoices { gap: 4px; }
  #wordListChoices button, #studyModeChoices button { min-height: 44px; padding: 6px 8px; font-size: 13px; }
  #studyModeChoices { gap: 2px; }
  #studyModeChoices button { padding: 6px 10px; font-size: 12px; }
  #categoryChoices .choice { flex-wrap: wrap; column-gap: 8px; row-gap: 2px; padding: 7px 0; }
  #categoryChoices .choice [lang="en"] { font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
  .page { padding-top: 10px; padding-bottom: 20px; }
  .entry__meta { gap: 8px; }
  .folio { font-size: 13px; white-space: nowrap; }
  .cat { min-width: 0; font-size: 12px; line-height: 1.25; }
  .cat [lang="en"] { font-size: 12px; }
  .bookmark { flex-shrink: 0; }
  /* 主词保留层级，但不再随屏宽放大到 76px；长词仍按容器宽度缩小。 */
  .headword { font-size: clamp(36px, 10.5vw, 46px); font-size: min(clamp(36px, 10.5vw, 46px), calc(100cqi / (var(--len, 6) * 0.56))); margin: 2px 0 8px; }
  .headword-wrap--bell .headword { max-width: calc(100% - 80px); font-size: min(clamp(36px, 10.5vw, 46px), calc((100cqi - 80px) / (var(--len, 6) * 0.56))); }
  .word-sticker { width: 72px; height: 72px; top: 0; }
  .pron { margin-bottom: 8px; }
  .ipa { font-size: 16px; }
  .senses { margin-bottom: 16px; gap: 10px; }
  .sense { grid-template-columns: minmax(2em, max-content) minmax(0, 1fr); }
  .pos { font-size: 17px; }
  .sense__zh { font-size: 18px; line-height: 1.4; }
  .sense__en { font-size: 15.5px; line-height: 1.45; }
  .entry__example { margin-bottom: 16px; }
  .example-note { padding: 10px 14px 12px; border-radius: 10px; }
  .example-note .ex__en { font-size: 15.5px; line-height: 1.45; }
  .example-note .ex__zh { font-size: 13.5px; line-height: 1.5; margin-top: 5px; }
  .example-note__head { margin-bottom: 3px; }
  .mnemonic-note { margin-top: 10px; padding: 12px 14px; border-radius: 10px; }
  .mnemonic-note p { font-size: 14px; }
  .entry__plate { margin: 0 0 18px; }
  .figcap { font-size: 13px; margin-top: 8px; }
  .figcap .credit { white-space: normal; overflow-wrap: anywhere; }
  .related { margin-bottom: 16px; }
  /* 短关联词用一行对照；长词、释义和类型自然换行，不截断内容。 */
  .rel { grid-template-columns: 1.2em minmax(0, 1.1fr) minmax(0, 1fr) auto; align-items: center; column-gap: 8px; row-gap: 0; min-height: 44px; padding: 6px 0; }
  .rel__type { grid-column: 4; grid-row: 1; align-self: center; max-width: 6em; font-size: 11px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
  .rel__zh { grid-column: 3; grid-row: 1; align-self: center; font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
  .rel__word { min-width: 0; font-size: 17px; overflow-wrap: anywhere; }
  .rel__word .rel__pos { font-size: 13px; }
  .more > summary { min-height: 44px; font-size: 14px; }
  .more__hint { font-size: 12px; }
  .turn { padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); gap: 8px; }
  .turn__hint { display: none; }
  .turn__back span { display: none; }
  .turn__back { min-height: 44px; padding: 0 12px; border: 1px solid var(--rule-strong); }
  .turn__next { flex: 1; min-height: 44px; font-size: 15px; }
  .sheet { width: 100vw; max-width: 100vw; max-height: 86vh; margin: auto 0 0; border-radius: 8px 8px 0 0; border-bottom: 0; }
  .sheet__inner { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .sheet--search { width: calc(100vw - 24px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); margin: max(12px, env(safe-area-inset-top)) auto auto; border: 1px solid var(--rule-strong); border-radius: 8px; }
  .sheet--search .sheet__inner { padding: 4px 16px 12px; }
  .search-result { column-gap: 8px; }
  .search-result__meta { max-width: 9em; }
}

@media (hover: none), (pointer: coarse) {
  .turn__hint { display: none; }
}

@media print {
  .masthead__tools, #wordListControls, .turn, .bookmark, .pron__btn svg, .say { display: none !important; }
  .more > *:not(summary) { display: block !important; }
}

/* 无插画词条在手机上没有图中编号，关联词列表去掉编号列 */
@media (max-width: 719px) {
  .entry--text .rel { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; }
  .entry--text .rel__num { display: none; }
  .entry--text .rel__type { grid-column: 3; grid-row: 1; }
  .entry--text .rel__zh { grid-column: 2; grid-row: 1; }
}
