/* 单词卡片展示页
   配色沿用墨墨牌组的三色系统：teal 主色、slate 信息底、orange 助记。
   深浅色都要能长时间盯着看，所以正文对比度按 WCAG AA 往上取。 */

:root {
  color-scheme: light dark;

  --teal: #0e9384;
  --teal-soft: #d7f3ee;
  --teal-ink: #05564d;
  --orange: #c2620a;
  --orange-soft: #fdf0dd;
  --rose: #c0392f;
  --rose-soft: #fdeceb;

  --bg: #f4f5f7;
  --bg-elev: #ffffff;
  --line: #e3e6ea;
  --line-soft: #eef0f3;
  --ink: #16181d;
  --ink-2: #4a5057;
  --ink-3: #838b95;
  --shadow: 0 1px 2px rgba(16, 20, 26, .05), 0 12px 32px -12px rgba(16, 20, 26, .16);
  --shadow-sm: 0 1px 2px rgba(16, 20, 26, .06);

  --radius: 18px;
  --radius-sm: 10px;
  --maxw: 760px;
  --keybar-h: 36px;   /* 底部快捷键条的高度，评价条要粘在它上面 */

  --sans: -apple-system, "SF Pro SC", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --serif: "Iowan Old Style", "Charter", Georgia, "Songti SC", serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --teal: #35c2ad;
    --teal-soft: #10312e;
    --teal-ink: #8ee5d5;
    --orange: #e8a35c;
    --orange-soft: #33230f;
    --rose: #f08a80;
    --rose-soft: #3a1c19;

    --bg: #0f1115;
    --bg-elev: #171a20;
    --line: #262b33;
    --line-soft: #1e222a;
    --ink: #eceef2;
    --ink-2: #b3bac4;
    --ink-3: #7e8794;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 18px 40px -16px rgba(0, 0, 0, .7);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    /* 图片墙专用：白底插图铺满一屏时，纯黑底会把它们衬成灯箱。
       墙的地色抬到这一档，配合 wall.css 里对图的压暗一起收光。 */
    --wall-ground: #191d24;
  }
}

:root[data-theme="dark"] {
  --teal: #35c2ad;
  --teal-soft: #10312e;
  --teal-ink: #8ee5d5;
  --orange: #e8a35c;
  --orange-soft: #33230f;
  --rose: #f08a80;
  --rose-soft: #3a1c19;

  --bg: #0f1115;
  --bg-elev: #171a20;
  --line: #262b33;
  --line-soft: #1e222a;
  --ink: #eceef2;
  --ink-2: #b3bac4;
  --ink-3: #7e8794;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 18px 40px -16px rgba(0, 0, 0, .7);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  /* 图片墙专用：白底插图铺满一屏时，纯黑底会把它们衬成灯箱。
     墙的地色抬到这一档，配合 wall.css 里对图的压暗一起收光。 */
  --wall-ground: #191d24;
}

* { box-sizing: border-box; }

/* 面板和图片区都设了 display，会盖掉浏览器默认的 [hidden]{display:none}，
   所以这条必须带 !important，否则「隐藏」的抽屉一进页面就是开的。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

button { font: inherit; color: inherit; cursor: pointer; }

/* 键盘操作要看得见焦点在哪。鼠标点击不出现（:focus-visible 的作用）。 */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 6px;
}
.spell input:focus-visible { outline-offset: 0; }

/* 图片换卡时先压暗，避免翻卡瞬间还挂着上一张 */
.figure img.loading { opacity: 0; }
.figure img { transition: opacity .18s ease; }
@media (prefers-reduced-motion: reduce) {
  .figure img { transition: none; }
  .toast { animation: none; }
}
kbd {
  font: 500 11px/1.6 var(--mono);
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 5px;
  color: var(--ink-2);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 8px; flex: none; }
.logo { font-size: 19px; }
.brand-text { font-weight: 650; letter-spacing: .02em; font-size: 15px; }

.scope { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .1s;
}
.chip:hover { border-color: var(--teal); }
.chip:active { transform: scale(.98); }
.caret { color: var(--ink-3); font-size: 10px; }

.progress-wrap { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.progress {
  flex: 1;
  min-width: 40px;
  max-width: 260px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--teal);
  transition: width .35s cubic-bezier(.2, .8, .3, 1);
}
.progress-text { font: 500 12px/1 var(--mono); color: var(--ink-3); white-space: nowrap; }

.tools { display: flex; align-items: center; gap: 8px; flex: none; }

.search { position: relative; }
.search input {
  width: 190px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .15s, width .2s;
}
.search input:focus { border-color: var(--teal); width: 230px; }

.results {
  position: absolute;
  top: 38px;
  right: 0;
  width: 320px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 40;
}
.results button {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
}
.results button:hover, .results button.on { background: var(--line-soft); }
.results .rw { font: 600 15px var(--serif); }
.results .rc { font-size: 12px; color: var(--ink-3); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .rd { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.results .none { padding: 14px; text-align: center; color: var(--ink-3); font-size: 13px; }

.icon {
  height: 32px;
  min-width: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}
.icon:hover { border-color: var(--teal); color: var(--ink); }

/* ------------------------------------------------------------ 舞台 */

.stage {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 16px 30px;
}

/* 注意：这里不能加 overflow:hidden。评价条用的是 position:sticky，
   一旦祖先有 overflow 裁剪，粘的就是这个盒子而不是视口，条会失效。 */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise .28s cubic-bezier(.2, .8, .3, 1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  .progress i { transition: none; }
}

/* ---------------------------------------------------- 回忆面：图片 */

.figure-wrap { padding: 14px 20px 2px; }

/* 插图全是 480×480 方图。摆成居中方形比拉成横幅留白边好看得多；同时封顶
   高度，保证提示阶梯和拼写框永远留在首屏之内，不用滚动就能作答。 */
.figure {
  margin: 0 auto;
  width: min(100%, 44svh, 400px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 16px;
  background: var(--line-soft);
  box-shadow: 0 10px 28px -16px rgba(16, 20, 26, .45);
}
.figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.figure-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--ink-3);
  font-size: 14px;
}
.figure-empty small { font-size: 12px; }

.badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
}
.badge.ghost {
  background: none;
  color: var(--ink-3);
  border: 1px solid var(--line);
}
.badge:empty { display: none; }
.seq-no {
  margin-left: auto;
  font: 500 11px var(--mono);
  color: var(--ink-3);
}

/* ---------------------------------------------------- 回忆面：正文 */

.recall-body { padding: 20px 22px 22px; }

.ask {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: center;
}

.hints { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: none;
  font-size: 13px;
  color: var(--ink-2);
  transition: all .15s;
}
.hint b {
  font: 600 10px/1 var(--mono);
  color: var(--ink-3);
  background: var(--line-soft);
  border-radius: 4px;
  padding: 3px 4px;
}
.hint:hover { border-color: var(--teal); color: var(--ink); }
.hint.used {
  border-style: solid;
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-ink);
}
.hint.used b { background: color-mix(in srgb, var(--teal) 22%, transparent); color: var(--teal-ink); }

.hint-out {
  min-height: 0;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.hint-out:empty { margin-top: 0; }
.hint-line {
  font-size: 14px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.hint-line .k { font-size: 11px; color: var(--ink-3); }
.skeleton {
  font: 600 22px/1.5 var(--mono);
  letter-spacing: .28em;
  color: var(--ink);
}
.skeleton .miss { color: var(--ink-3); }
.hint-cn { font-size: 19px; font-weight: 650; color: var(--teal); }

/* 语境填空：给上下文，不给答案 */
.cloze {
  display: block;
  max-width: 46ch;
  font: 400 16px/1.7 var(--serif);
  color: var(--ink-2);
  text-align: center;
}
.cloze i {
  font-style: normal;
  font-family: var(--mono);
  letter-spacing: .08em;
  color: var(--teal);
  border-bottom: 2px solid var(--teal);
  padding: 0 4px;
}

/* 上次评价——是这张卡的历史，不泄露答案 */
.last-mark {
  display: inline-block;
  margin: -4px 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--ink-3);
}
.last-mark.again { background: var(--rose-soft); color: var(--rose); }
.last-mark.hard { background: var(--orange-soft); color: var(--orange); }
.last-mark.good, .last-mark.easy { background: var(--teal-soft); color: var(--teal-ink); }

.spell { display: flex; gap: 8px; margin-top: 18px; }
.spell input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: 500 17px/1 var(--serif);
  outline: none;
  transition: border-color .15s;
}
.spell input:focus { border-color: var(--teal); }
.spell input::placeholder { font-family: var(--sans); font-size: 14px; color: var(--ink-3); }

.primary {
  height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--teal);
  color: #fff;
  font-weight: 650;
  font-size: 15px;
  box-shadow: var(--shadow-sm);
  transition: transform .1s, filter .15s;
}
.primary:hover { filter: brightness(1.06); }
.primary:active { transform: scale(.98); }

.spell-result {
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  animation: rise .2s;
}
.spell-result.ok { background: var(--teal-soft); color: var(--teal-ink); }
.spell-result.no { background: var(--rose-soft); color: var(--rose); }
.spell-result .diff { font: 600 17px var(--mono); letter-spacing: .04em; }
.spell-result .diff .bad { text-decoration: line-through; opacity: .65; }

.recall-actions { margin-top: 16px; display: flex; justify-content: center; }

.ghost-btn {
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .15s;
}
.ghost-btn:hover { border-color: var(--teal); color: var(--ink); }

/* ---------------------------------------------------------- 揭示面 */

.reveal { padding: 0; }

.reveal-head {
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--teal) 6%, transparent), transparent);
}

.headword-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.headword {
  margin: 0;
  font: 700 clamp(30px, 7vw, 44px)/1.1 var(--serif);
  letter-spacing: -.015em;
  color: var(--ink);
  word-break: break-word;
}
.speak { display: flex; gap: 6px; }
.sound {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-elev);
  font-size: 16px;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, border-color .15s;
}
.sound:hover { border-color: var(--teal); }
.sound.playing { transform: scale(1.1); border-color: var(--teal); background: var(--teal-soft); }
.sound[disabled] { opacity: .3; cursor: default; }

.ipa-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.ipa { font: 400 15px var(--mono); color: var(--ink-3); }
.ipa:empty { display: none; }
.verdict {
  font-size: 12px;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 999px;
}
.verdict.ok { background: var(--teal-soft); color: var(--teal-ink); }
.verdict.no { background: var(--rose-soft); color: var(--rose); }

.meaning-row { display: flex; align-items: baseline; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.pos {
  font: 600 12px/1 var(--mono);
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--line-soft);
  color: var(--ink-2);
  white-space: nowrap;
}
.pos:empty { display: none; }
.cn { font-size: clamp(19px, 4.4vw, 24px); font-weight: 650; letter-spacing: .01em; }

.en-def {
  margin: 10px 0 0;
  font: 400 15px/1.65 var(--serif);
  color: var(--ink-2);
}
.en-def:empty { display: none; }

.senses { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sense {
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.sense i { font-style: normal; color: var(--teal); font-weight: 700; margin-right: 5px; }

.reveal-grid { display: grid; grid-template-columns: 168px 1fr; gap: 20px; padding: 20px 24px 4px; }
.thumb-col img {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  display: block;
}
.thumb-col img[hidden] { display: none; }
.detail-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.block { padding: 0 24px 20px; }
.detail-col .block { padding: 0; }

.block-title {
  margin: 0 0 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips span {
  font-size: 13.5px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-family: var(--serif);
}
.chips.solid span {
  background: var(--teal-soft);
  border-color: transparent;
  color: var(--teal-ink);
  font-weight: 500;
}

/* 词库里有这个词 → 可以点过去，把同义词和易混词串成词群 */
.jump {
  font-size: 13.5px;
  font-family: var(--serif);
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  border-bottom-color: var(--teal);
  background: none;
  color: var(--ink);
  transition: all .14s;
}
.jump:hover { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-ink); }
.jump::after { content: ' ↗'; font-size: 10px; color: var(--teal); }
.jump.inline {
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  font: inherit;
  font-weight: 700;
  color: inherit;
}
.jump.inline:hover { background: none; opacity: .75; }
.jump.inline::after { content: ''; }

.ex {
  padding: 14px 16px;
  border-radius: 13px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  margin-bottom: 10px;
}
.ex:last-child { margin-bottom: 0; }
.ex-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.ex-label { font-size: 11px; font-weight: 650; color: var(--ink-3); letter-spacing: .04em; }
.ex-play {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-elev);
  font-size: 10px;
  line-height: 1;
  color: var(--ink-2);
  display: grid;
  place-items: center;
}
.ex-play:hover { border-color: var(--teal); color: var(--teal); }
.ex-play.playing { background: var(--teal); color: #fff; border-color: var(--teal); }
.ex-play[disabled] { opacity: .3; cursor: default; }
.ex-en { margin: 0; font: 400 16.5px/1.6 var(--serif); color: var(--ink); }
.ex-en mark {
  background: color-mix(in srgb, var(--teal) 18%, transparent);
  color: inherit;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
}
.ex-cn { margin: 7px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-3); }

.tip p, .warn p { margin: 0; font-size: 14px; line-height: 1.7; }
.tip p {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--orange-soft);
  color: var(--orange);
  border-left: 3px solid var(--orange);
}
.warn p {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--rose-soft);
  color: var(--rose);
  border-left: 3px solid var(--rose);
}

/* 评价条常驻在视口底部：揭示面往往比一屏长，翻到底才能评价太别扭。 */
.grade {
  position: sticky;
  bottom: var(--keybar-h, 0px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 24px 16px;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line-soft);
}
.g {
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all .14s;
}
.g kbd { pointer-events: none; }
.g:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.g.again:hover { border-color: var(--rose); color: var(--rose); }
.g.hard:hover  { border-color: var(--orange); color: var(--orange); }
.g.good:hover, .g.easy:hover { border-color: var(--teal); color: var(--teal); }

/* 精简模式：只留图、词、音、中文释义、场景例句 */
body.lean .en-def,
body.lean #blk-syn,
body.lean #blk-tip,
body.lean #blk-conf,
body.lean .senses,
body.lean .ex:not(:first-child) { display: none !important; }

/* ------------------------------------------------------------ 结算 */

.summary { padding: 34px 26px 30px; text-align: center; }
.sum-title { margin: 0 0 6px; font-size: 21px; font-weight: 650; }
.sum-scope { margin: 0 0 24px; font-size: 13px; color: var(--ink-3); }

.sum-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.sum-cell {
  padding: 16px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}
.sum-cell b {
  display: block;
  font: 700 26px/1.2 var(--mono);
  color: var(--teal);
  margin-bottom: 4px;
}
.sum-cell span { font-size: 12px; color: var(--ink-3); }

.sum-note {
  margin: 0 auto 22px;
  max-width: 40ch;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-2);
}
.sum-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.sum-actions .primary[disabled] { opacity: .4; cursor: default; filter: none; }

@media (max-width: 480px) {
  .sum-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------------------------------------------------ 空态 */

.empty { text-align: center; padding: 80px 20px; color: var(--ink-3); }
.empty p { margin-bottom: 18px; }

/* ------------------------------------------------------------ 轻提示 */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--keybar-h, 0px) + 22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  max-width: 84vw;
  padding: 10px 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  color: var(--bg-elev);
  font-size: 13px;
  font-weight: 550;
  box-shadow: var(--shadow);
  animation: rise .2s;
}

/* ------------------------------------------------------------ 底栏 */

.keybar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 9px 16px calc(9px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
}
.keybar .stat { color: var(--teal); font-weight: 600; font-family: var(--mono); }

/* ------------------------------------------------------------ 抽屉 */

.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, .42);
  backdrop-filter: blur(2px);
  z-index: 50;
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px -20px rgba(0, 0, 0, .3);
  z-index: 60;
  animation: slide .24s cubic-bezier(.2, .8, .3, 1);
}
@keyframes slide { from { transform: translateX(100%) } to { transform: none } }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.sheet-body { flex: 1; overflow-y: auto; padding: 18px; }
.sheet-foot {
  display: flex;
  gap: 10px;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.sheet-foot .primary { flex: 1; }

.field { margin-bottom: 20px; }
.field > label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 9px;
}
.opts { display: flex; flex-wrap: wrap; gap: 7px; }
.opts.scroll { max-height: 168px; overflow-y: auto; padding: 2px; }
.opt {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  font-size: 13px;
  color: var(--ink-2);
  transition: all .14s;
}
.opt:hover { border-color: var(--teal); }
.opt.on {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 600;
}
.opt .n { font-size: 11px; opacity: .7; margin-left: 4px; font-family: var(--mono); }

.sheet-count { font-size: 13px; color: var(--ink-3); margin: 0; }

.prose { font-size: 14px; line-height: 1.75; color: var(--ink-2); }
.prose h3 { font-size: 13px; color: var(--ink); margin: 20px 0 8px; }
.prose h3:first-child { margin-top: 0; }
.prose ul { margin: 0; padding-left: 18px; }
.prose li { margin-bottom: 6px; }
.prose kbd { margin: 0 2px; }
.prose .rep { font-family: var(--mono); font-size: 12px; }

/* ------------------------------------------------------------ 移动端 */

@media (max-width: 720px) {
  :root { --keybar-h: 0px; }
  /* 顶栏在手机上只留：范围 · 搜索 · 三个开关。
     进度条挪走——卡片右上角的「3 / 86」已经说清楚位置了。 */
  .brand-text, .keybar, .progress-wrap { display: none; }
  .search input { width: 38px; padding: 0 10px; }
  .search input:focus { width: min(52vw, 200px); }
  .results { width: min(86vw, 320px); }
  .topbar { gap: 8px; padding: 8px 12px; }
  .scope { flex: none; }
  .tools { flex: 1; justify-content: flex-end; }
  .stage { padding: 14px 10px 24px; }

  /* 四个提示排成 2×2，比 3+1 换行整齐 */
  .hints { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .hint { justify-content: center; }

  .recall-body { padding: 16px; }
  .reveal-head { padding: 20px 18px 16px; }
  .block { padding: 0 18px 18px; }
  .reveal-grid { grid-template-columns: 1fr; padding: 18px 18px 4px; gap: 16px; }
  .thumb-col { max-width: 200px; margin: 0 auto; }

  /* 评价条在手机上压成一行四格，常驻底部，不用滚到底才能评价 */
  .grade { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 6px; }
  .g { height: 46px; font-size: 12px; padding: 0 2px; }
  .g kbd { display: none; }

  /* 收窄后的搜索框放不下中文 placeholder，改成一个放大镜 */
  .search::before {
    content: '🔍';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    pointer-events: none;
    opacity: .55;
  }
  .search input::placeholder { color: transparent; }
  .search input:focus::placeholder { color: var(--ink-3); }
  .search:focus-within::before { display: none; }
  .search input:focus { padding-left: 12px; }
  .hint { padding: 9px 14px; }
  .spell input { height: 50px; }
  .primary { height: 50px; }
}

@media (max-width: 400px) {
  .figure { width: min(100%, 38svh, 320px); }
}
