/* ---------- 颜色和字体 ---------- */

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #1c1c1e;
  --muted: #6b6b72;
  --border: #e3e0d9;
  --accent: #2f5bd3;
  --accent-soft: #e5ebfb;
  --accent-text: #ffffff;
  --good: #1b8549;
  --good-soft: #e1f2e7;
  --warn: #a8700f;
  --warn-soft: #fbf0da;
  --bad: #c93636;
  --bad-soft: #fae5e5;
  --memo: #b55f1b;
  --memo-soft: #fbeedd;
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.04), 0 4px 14px rgba(20, 20, 30, 0.04);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-word: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-phon: "Lucida Sans Unicode", "Segoe UI", "Arial Unicode MS", "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1b1c20;
    --surface-2: #26282d;
    --text: #ececee;
    --muted: #9c9da4;
    --border: #2f3137;
    --accent: #7493ff;
    --accent-soft: #222d52;
    --accent-text: #0c1120;
    --good: #4cc483;
    --good-soft: #16302a;
    --warn: #e2ab4f;
    --warn-soft: #382c16;
    --bad: #f27474;
    --bad-soft: #3a1e21;
    --memo: #ec9f62;
    --memo-soft: #3a2918;
    --shadow: none;
    color-scheme: dark;
  }
}

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

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.boot { padding: 40vh 16px 0; text-align: center; }

/* ---------- 框架：顶栏、底部标签栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 56px;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 16px; }
.brand img { width: 26px; height: 26px; }
.nav-top { display: flex; gap: 4px; }
.nav-top a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 14.5px; }
.nav-top a:hover { color: var(--text); }
.nav-top a.active { color: var(--text); background: var(--surface-2); font-weight: 600; }

.sync {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.sync:hover { background: var(--surface-2); }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.sync[data-state="pending"] i, .sync[data-state="syncing"] i { background: var(--warn); }
.sync[data-state="syncing"] i { animation: pulse 1s infinite alternate; }
.sync[data-state="offline"] i, .sync[data-state="auth"] i { background: var(--bad); }
.sync[data-state="offline"], .sync[data-state="auth"] { color: var(--bad); }
@keyframes pulse { to { opacity: 0.3; } }

#view {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 6px;
  font-size: 11px;
  color: var(--muted);
}
.tabbar a .icon { width: 22px; height: 22px; }
.tabbar a.active { color: var(--accent); font-weight: 600; }

body.studying .topbar, body.studying .tabbar { display: none; }
body.studying #view { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

@media (max-width: 719px) {
  .nav-top { display: none; }
}
@media (min-width: 720px) {
  .tabbar { display: none; }
  #view { padding-top: 28px; padding-bottom: 48px; }
}

/* ---------- 通用组件 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 15px; margin-bottom: 12px; }
.hero { margin: 4px 0 16px; }
.hero h1 { font-size: 26px; margin: 2px 0 4px; }
.page-title { font-size: 24px; margin: 4px 0 10px; }
.page-title .subtitle { margin-left: 10px; color: var(--muted); font-size: 17px; font-weight: 500; }
.page-title + .muted { margin: 0 0 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.good { background: var(--good-soft); border-color: transparent; color: var(--good); }
.btn.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.btn.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.btn.good:hover, .btn.warn:hover, .btn.bad:hover { filter: brightness(0.97); }
.btn.danger { color: var(--bad); }
.btn.block { display: flex; width: 100%; }

kbd {
  font: 600 11px/1 var(--font);
  padding: 3px 5px;
  border-radius: 5px;
  background: rgba(127, 127, 127, 0.16);
  opacity: 0.75;
}
@media (hover: none) { kbd { display: none; } }

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sound { color: var(--accent); }

.link-btn {
  display: block;
  margin: 14px auto 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

.banner { padding: 12px 14px; margin-bottom: 12px; border-radius: 12px; font-size: 14px; }
.banner ul { margin: 6px 0 0; padding-left: 18px; }
.banner.warn { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.banner.good { background: var(--good-soft); color: var(--good); font-weight: 550; }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.seg button {
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  white-space: nowrap;
  cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.seg.filters { display: flex; margin-bottom: 12px; }
.seg.filters button { flex: 1; padding: 7px 4px; }

.empty { text-align: center; padding: 28px 16px; }
.empty p { margin: 4px 0; }

.dots { display: flex; gap: 4px; margin-top: 10px; }
.dots i { width: 20px; height: 5px; border-radius: 3px; background: var(--surface-2); }
.dots i.on { background: var(--good); }

.back { display: inline-flex; align-items: center; gap: 2px; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.back:hover { color: var(--text); }

/* ---------- 今日 ---------- */

.task-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.task-label .count {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 11px;
  line-height: 18px;
}
.task-main, .task-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.task-row + .task-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.task-title { font-size: 18px; font-weight: 650; }
.task > p { margin: 0; }
.done-line { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--good); font-weight: 550; }
.late { color: var(--bad); }
.upcoming { display: grid; gap: 4px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 13px; }
.up-row { display: flex; gap: 12px; }
.up-row .muted { flex: none; width: 52px; }

.resume {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: var(--accent-soft);
}
.resume > div:first-child { flex: 1 1 180px; }
.resume .task-label { margin-bottom: 2px; }
.btn-pair { display: flex; gap: 8px; }

/* ---------- 词表 ---------- */

.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.list-grid .card { margin: 0; }
.list-card { display: block; transition: border-color 0.15s; }
.list-card:hover { border-color: var(--accent); }
.lc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.lc-head b { font-size: 17px; }
.lc-sub { margin-bottom: 2px; font-size: 14px; }

.list-section { margin: 20px 4px 8px; font-size: 16px; }
.tip {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--memo-soft);
  font-size: 14px;
  line-height: 1.65;
}
.tip-label { margin-right: 8px; color: var(--memo); font-size: 12.5px; font-weight: 700; }
.tip summary { display: flex; align-items: baseline; gap: 0; list-style: none; cursor: pointer; }
.tip summary::-webkit-details-marker { display: none; }
.tip-preview { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tip-more { flex: none; margin-left: 8px; color: var(--memo); font-size: 13px; }
.tip[open] .tip-preview, .tip[open] .tip-more { display: none; }
.tip-body { white-space: pre-line; }

.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
@media (min-width: 720px) {
  .mode-grid { grid-template-columns: repeat(4, 1fr); }
  .mode-grid.three { grid-template-columns: repeat(3, 1fr); }
}
.mode-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
}
.mode-btn:hover { border-color: var(--accent); }
.mode-btn b { font-size: 16px; }
.mode-btn span { color: var(--muted); font-size: 12.5px; line-height: 1.4; }

.word-list {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.word-row { display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 6px; }
.word-row + .word-row { border-top: 1px solid var(--border); }
.wr-main { flex: 1; min-width: 0; }
.wr-word { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.wr-word b { font-family: var(--font-word); font-size: 16px; }
.wr-meaning { font-size: 14px; overflow-wrap: anywhere; white-space: pre-line; }
.word-row.is-known .wr-main { opacity: 0.45; }
.phon { color: var(--muted); font-family: var(--font-phon); font-size: 13px; }
.known-btn {
  flex: none;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.known-btn:hover { border-color: var(--muted); }
.known-btn.on { background: var(--good-soft); border-color: transparent; color: var(--good); }
.list-foot { margin: 8px 0 16px; text-align: center; }

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

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 720px) { .tiles:not(.two) { grid-template-columns: repeat(4, 1fr); } }
.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.tile b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 12.5px; }

.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; max-width: 300px; }
.heat i { aspect-ratio: 1; border-radius: 4px; }
i.l0 { background: var(--surface-2); }
i.l1 { background: color-mix(in srgb, var(--good) 35%, var(--surface-2)); }
i.l2 { background: color-mix(in srgb, var(--good) 65%, var(--surface-2)); }
i.l3 { background: var(--good); }
.heat-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.heat-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }

.stat-list { margin: 0; padding: 0; list-style: none; }
.stat-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.stat-list li + li { border-top: 1px solid var(--border); }
.stat-list .dots { flex: none; margin: 0; }
.stat-list .dots i { width: 12px; }

/* ---------- 设置 ---------- */

.settings { padding: 4px 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.set-row + .set-row { border-top: 1px solid var(--border); }
.settings > p { margin: 0; padding: 10px 0 12px; border-top: 1px solid var(--border); }

.switch { position: relative; flex: none; width: 46px; height: 28px; }
.switch input { position: absolute; inset: 0; z-index: 1; margin: 0; opacity: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background 0.2s; }
.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch input:checked + i { background: var(--good); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.login { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.login-card { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 360px; padding: 28px 24px; text-align: center; }
.login-card h1 { font-size: 22px; }
.login-card p { margin: 0; }
.login-logo { width: 56px; height: 56px; margin: 0 auto 4px; }
.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 16px;
  outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { min-height: 1.4em; color: var(--bad); font-size: 14px; }

/* ---------- 练习 ---------- */

.study {
  display: flex;
  flex-direction: column;
  max-width: 600px;
  min-height: calc(100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: 0 auto;
}
.st-top { display: flex; align-items: center; gap: 8px; }
.st-title { flex: 1; overflow: hidden; font-size: 15px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.st-count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.st-progress { height: 4px; margin: 8px 0 20px; overflow: hidden; border-radius: 2px; background: var(--surface-2); }
.st-bar { display: block; width: 0; height: 100%; border-radius: 2px; background: var(--accent); transition: width 0.3s; }
.st-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
/* 释义和笔记很长时页面会滚动，按钮固定在底部 */
.st-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 16px 0 calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 14px);
}
.mode-spell .st-body { flex: none; }
.mode-spell .st-actions { padding-top: 12px; }

.btn-row { display: grid; gap: 10px; }
.btn-row.two { grid-template-columns: 1fr 1fr; }
.btn-row.three { grid-template-columns: repeat(3, 1fr); }
.st-actions .btn { min-height: 52px; border-radius: 12px; font-size: 16px; }
.st-actions .btn-row.three .btn { padding: 8px 6px; }
.summary .btn { min-height: 50px; border-radius: 12px; }

.word-card { margin: 0; padding: 32px 20px; text-align: center; }
.word-card.compact { padding: 22px 18px; }
.w-word {
  font-family: var(--font-word);
  font-size: clamp(32px, 9vw, 44px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.w-phon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 36px;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--font-phon);
  font-size: 16px;
}
.w-hidden { margin-top: 20px; color: var(--muted); font-size: 14px; }
.w-meaning { margin-top: 16px; font-size: 18px; font-weight: 550; line-height: 1.5; white-space: pre-line; }
.w-meaning.big { margin-top: 0; font-size: 22px; }
.w-example { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: 14.5px; text-align: left; }
.w-example p { margin: 0; }
.w-example p + p { margin-top: 4px; }
.w-example b { color: var(--accent); }
.w-example.blank { text-align: center; }
.w-star { margin-left: 4px; color: var(--memo); font-size: 0.5em; vertical-align: super; }
.wr-word .w-star { margin-left: -4px; font-size: 12px; }

/* 书上的「记 / 例 / 变 / 搭 …」 */
.notes { display: grid; gap: 8px; margin-top: 16px; text-align: left; }
.note { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; line-height: 1.6; }
.nl {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}
.note.memo .nl { background: var(--memo-soft); color: var(--memo); }
.note.ex .nl { background: var(--accent-soft); color: var(--accent); }
.nt { flex: 1; min-width: 0; white-space: pre-line; overflow-wrap: anywhere; }
.nt b { color: var(--accent); }
.nt .cn { color: var(--muted); }
.word-card.detail { padding: 8px 4px 4px; text-align: center; }
.wr-main[data-act] { cursor: pointer; }

.spell-card { margin: 0; padding: 28px 20px; text-align: center; }
.spell-hint { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 16px; }
.letters { display: flex; flex-wrap: wrap; justify-content: center; font-family: var(--font-mono); font-size: 22px; letter-spacing: 0.22em; }
.letters .blank { color: var(--muted); opacity: 0.6; }
.letters .gap { width: 0.8em; }
.spell-hint .muted { font-size: 13px; }
.feedback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
}
.feedback.ok { background: var(--good-soft); color: var(--good); }
.feedback.bad { background: var(--bad-soft); }
.feedback s { color: var(--bad); }
.feedback .answer { font-family: var(--font-word); font-size: 20px; }
.feedback .small { margin-top: 4px; color: var(--muted); }
.spell-form { display: flex; gap: 8px; margin-top: 14px; }
.spell-input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-family: var(--font-word);
  font-size: 20px;
  outline: none;
}
.spell-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.spell-input.ok { border-color: var(--good); color: var(--good); }
.spell-form .btn { min-height: 52px; padding: 0 20px; border-radius: 12px; }
.shake { animation: shake 0.35s; }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.options { display: grid; gap: 10px; margin-top: 14px; }
@media (min-width: 560px) { .options.cn2en { grid-template-columns: 1fr 1fr; } }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 15.5px;
  line-height: 1.4;
  text-align: left;
  white-space: pre-line;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s, background 0.15s;
}
.option:hover:not(:disabled) { border-color: var(--accent); }
.option:disabled { cursor: default; }
.option.correct { border-color: var(--good); background: var(--good-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.options.cn2en .option span { font-family: var(--font-word); font-size: 17px; font-weight: 600; }

.summary { max-width: 520px; margin: 0 auto; padding-top: 28px; text-align: center; }
.summary h1 { font-size: 26px; }
.summary > p { margin: 6px 0 20px; }
.summary .card { text-align: left; }
.summary-badge {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--good-soft);
  color: var(--good);
}
.summary-badge .icon { width: 30px; height: 30px; }
.mini-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mini-list li { display: flex; gap: 12px; }
.mini-list b { flex: none; min-width: 30%; font-family: var(--font-word); }
.mini-list span { color: var(--muted); font-size: 14px; white-space: pre-line; }
.btn-col { display: grid; gap: 10px; margin-top: 16px; }

/* ---------- 弹窗和提示 ---------- */

.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(10, 10, 15, 0.4);
  animation: fade 0.15s;
}
.modal {
  width: 100%;
  max-width: 440px;
  max-height: 85dvh;
  overflow: auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--bg);
  animation: rise 0.2s;
}
@media (min-width: 720px) {
  .modal-wrap { align-items: center; }
  .modal { border-radius: 18px; }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-size: 18px; }
.modal .mode-grid { grid-template-columns: 1fr; margin: 12px 0 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 720px) { #toast { bottom: 32px; } }
body.studying #toast { top: calc(56px + env(safe-area-inset-top)); bottom: auto; }
