/* ============================================================
   经济师百题砍
   百词斩式单卡界面：一次一张 / 全内容直出 / 左右滑动即记录（左未掌握 · 右掌握），模糊点底部小按钮
   ============================================================ */

:root {
  --paper: #f7f5ef;
  --paper-deep: #efece3;
  --surface: #fffefa;
  --surface-2: #fbfaf6;
  --ink: #22262b;
  --ink-2: #4d545c;
  --muted: #7c838c;
  --faint: #a7adb4;
  --line: #e5e1d7;
  --line-strong: #d6d0c2;
  --accent: #175e54;
  --accent-2: #2d7a6d;
  --accent-soft: #e8f1ed;
  --blue: #2c5f9e;
  --blue-soft: #edf3fa;
  --green: #24734f;
  --green-soft: #edf6f1;
  --amber: #9a6418;
  --amber-soft: #fbf3e4;
  --rose: #9d4b5d;
  --rose-soft: #faeef1;
  --violet: #6a4e8e;
  --violet-soft: #f3eef9;
  --slate: #56616e;
  --slate-soft: #eef1f4;
  --shadow: 0 1px 2px rgba(34, 38, 43, .04), 0 10px 28px rgba(34, 38, 43, .035);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", SimSun, serif;
}

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

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: var(--accent); text-decoration: none; }

button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(23, 94, 84, .55);
  outline-offset: 2px;
}

::selection { background: rgba(23, 94, 84, .16); }

.wrap {
  width: min(1080px, calc(100% - 48px));
  margin-inline: auto;
}

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  transform: translateY(-160%);
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
}
.skip-link:focus { transform: translateY(0); }

/* ---------------- Topbar ---------------- */

.topbar { padding: 16px 0 8px; }

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  margin: 0;
  flex: none;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.2;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
}

.brand-free {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border: 1px solid rgba(36, 115, 79, .28);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1;
}

.brand-name {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(360px, 100%);
  margin-left: auto;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.search-box:focus-within {
  border-color: rgba(23, 94, 84, .45);
  box-shadow: 0 0 0 3px rgba(23, 94, 84, .08);
}
.search-icon {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.search-box input {
  width: 100%;
  min-width: 0;
  height: 33px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}
.search-box input::placeholder { color: var(--faint); }
.search-box input::-webkit-search-cancel-button { cursor: pointer; }
.search-box kbd {
  flex: none;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 9.5px;
}
.search-box:has(input:disabled) { opacity: .62; }
.search-box input:disabled { cursor: not-allowed; }

/* ---------------- Toolbar ---------------- */

.toolbar {
  position: relative;
  z-index: 30;
  padding-bottom: 10px;
}

.toolbar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select {
  flex: none;
  min-width: 0;
  height: 32px;
  padding: 0 28px 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1.5 5 5 5-5' fill='none' stroke='%237c838c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--ink-2);
  font-size: 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.select:focus { border-color: rgba(23, 94, 84, .45); box-shadow: 0 0 0 3px rgba(23, 94, 84, .08); }
.select:disabled { opacity: .55; cursor: not-allowed; }
.select-chapter { flex: 1 1 auto; max-width: 380px; }
.select-type { width: 126px; }
.select-mark { width: 106px; }

/* ---------------- Content / Deck ---------------- */

.content {
  padding: 4px 0 40px;
  /* 卡片区占满一整屏：把页面下方那段可索引的说明文字顶到折叠线以下，首屏仍然只有一张卡。
     减掉的是顶部品牌行 + 筛选行的高度，多减一点只是让说明文字更靠下，不会露出来。 */
  min-height: calc(100vh - 120px);
  min-height: calc(100dvh - 120px);
}

.deck {
  width: min(920px, 100%);
  margin: 0 auto;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 2px 9px;
  color: var(--muted);
  font-size: 11px;
}

.stage-context {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stage-position {
  flex: none;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.stage-position b {
  margin-right: 2px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
}

.stage { touch-action: pan-y; }

.stage-card { width: 100%; }

.stage-card.slide-next { animation: stageInNext .24s cubic-bezier(.22, .8, .32, 1) both; }
.stage-card.slide-prev { animation: stageInPrev .24s cubic-bezier(.22, .8, .32, 1) both; }
.stage-card.slide-in { animation: stageIn .2s ease both; }

@keyframes stageInNext {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes stageInPrev {
  from { opacity: 0; transform: translateX(-28px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes stageIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- Card ---------------- */

.card {
  --type: var(--slate);
  --type-soft: var(--slate-soft);
  position: relative;
  padding: 22px 26px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--type);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 2px 4px rgba(34, 38, 43, .045), 0 18px 44px rgba(34, 38, 43, .055);
  overflow-wrap: anywhere;
}

.card.type-examPoint { --type: var(--blue); --type-soft: var(--blue-soft); }
.card.type-example { --type: var(--green); --type-soft: var(--green-soft); }
.card.type-note { --type: var(--amber); --type-soft: var(--amber-soft); }
.card.type-mnemonic { --type: var(--violet); --type-soft: var(--violet-soft); }
.card.type-story { --type: var(--rose); --type-soft: var(--rose-soft); }
.card.type-knowledge { --type: var(--slate); --type-soft: var(--slate-soft); }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-badges { display: flex; align-items: center; gap: 8px; min-width: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--type-soft);
  color: var(--type);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}

.card-seq {
  color: var(--faint);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .05em;
}

.mark-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.mark-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
}
.mark-chip.state-1 { border-color: rgba(157, 75, 93, .26); background: var(--rose-soft); color: var(--rose); }
.mark-chip.state-1 .mark-dot { background: var(--rose); }
.mark-chip.state-2 { border-color: rgba(154, 100, 24, .26); background: var(--amber-soft); color: var(--amber); }
.mark-chip.state-2 .mark-dot { background: var(--amber); }
.mark-chip.state-3 { border-color: rgba(36, 115, 79, .26); background: var(--green-soft); color: var(--green); }
.mark-chip.state-3 .mark-dot { background: var(--green); }

.card-title {
  margin: 13px 0 0;
  color: var(--ink);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 650;
  line-height: 1.62;
  letter-spacing: -.008em;
  overflow-wrap: anywhere;
}
.card.type-story .card-title { font-weight: 550; line-height: 1.82; }

.card-sub {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* options */

.options {
  display: grid;
  gap: 7px;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
}
.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.65;
}
.opt-label {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  flex: none;
  margin-top: 1px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}
.opt-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt-tick {
  flex: none;
  margin-top: 2px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
}
.option.correct {
  border-color: rgba(36, 115, 79, .32);
  background: var(--green-soft);
  color: #1e5c40;
}
.option.correct .opt-label {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}
.option.correct .opt-tick { opacity: 1; }

.answer-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  font-size: 12.5px;
}
.answer-tag {
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--ink);
  color: var(--paper);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
}
.answer-letters {
  color: var(--green);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .06em;
}
.answer-text { color: var(--muted); }

/* analysis + points */

.analysis {
  display: flex;
  gap: 10px;
  margin-top: 13px;
  padding: 11px 13px;
  border-radius: 9px;
  background: rgba(23, 94, 84, .045);
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.8;
}
.analysis-tag {
  flex: none;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(23, 94, 84, .1);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .05em;
}
.analysis p { margin: 0; overflow-wrap: anywhere; }

.points {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 13.8px;
  line-height: 1.8;
}
.points li {
  position: relative;
  padding-left: 15px;
  overflow-wrap: anywhere;
}
.points li + li { margin-top: 3px; }
.points li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: .72em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--type);
  opacity: .55;
}

.points-callout {
  margin-top: 13px;
  padding: 11px 13px;
  border: 1px solid rgba(106, 78, 142, .16);
  border-radius: 10px;
  background: var(--violet-soft);
}
.points-callout .callout-label {
  display: block;
  margin-bottom: 4px;
  color: var(--violet);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
}
.points-callout .points { margin-top: 0; }

/* tips */

.tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.75;
}
.tip-label {
  flex: none;
  padding-top: 2px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .05em;
}
.tip-warn { background: var(--amber-soft); color: #7a5216; }
.tip-warn .tip-label { color: var(--amber); }
.tip-info { background: var(--blue-soft); color: #31567f; }
.tip-info .tip-label { color: var(--blue); }
.tip-muted { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line); }
.tip-muted .tip-label { color: var(--faint); }

.card-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 15px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  color: var(--faint);
  font-size: 10.5px;
}
.foot-chapter {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--type-soft);
  color: var(--type);
  font-weight: 600;
}
.foot-tags { min-width: 0; overflow-wrap: anywhere; }
.foot-source { min-width: 0; overflow-wrap: anywhere; }
.foot-anchor {
  flex-basis: 100%;
  min-width: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.foot-anchor b {
  margin-right: 4px;
  color: var(--accent);
  font-weight: 600;
}
.foot-anchor .sep { margin: 0 7px; color: var(--line-strong); }
.foot-diff { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.foot-diff i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}
.foot-diff i.on { background: var(--type); opacity: .65; }

/* ---------------- Empty ---------------- */

.empty-state {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 68px 20px 76px;
  text-align: center;
}
.empty-mark {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--faint);
  font-family: var(--font-serif);
  font-size: 30px;
}
.empty-state h2 { margin: 0 0 8px; font-size: 21px; }
.empty-state p { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; }

.btn {
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  transition: border-color .16s ease, background .16s ease;
}
.btn:hover { border-color: var(--ink-2); }
.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #124d45; border-color: #124d45; }

/* ---------------- Footer ---------------- */

.footer {
  padding: 20px 0 calc(124px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
}
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
/* 页脚是淡灰底、说明区是正文灰，链接都靠 accent 绿 + 细下划线拉出来，不靠 hover 才显形。 */
.footer a,
.notes a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(23, 94, 84, .3);
}
.footer a:hover,
.notes a:hover { border-bottom-color: var(--accent); }

/* ---------------- Notes（可被爬虫读到的正文） ---------------- */

.notes {
  padding: 22px 0 6px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.85;
}
.notes h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.notes h3 {
  margin: 15px 0 3px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 650;
}
.notes p { margin: 0 0 9px; }
.notes strong { color: var(--ink); font-weight: 650; }
.notes code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}
.notes-keys {
  margin: 0;
  padding: 0;
  list-style: none;
}
.notes-keys li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 6px;
}
.notes-keys li > span {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--slate-soft);
  color: var(--slate);
  font-size: 11px;
  font-weight: 600;
}
/* 说明文字必须包在 .nk-body 里：li 是 flex，裸文字会被拆成一堆不折行的 flex item，
   在 390px 下直接把 <kbd> 顶出屏幕右侧。 */
.notes-keys .nk-body {
  flex: 1 1 auto;
  min-width: 0;
}
.notes kbd {
  display: inline-block;
  min-width: 17px;
  margin: 0 1px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 16px;
  text-align: center;
}
.notes details {
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}
.notes summary {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  list-style: none;
}
.notes summary::-webkit-details-marker { display: none; }
.notes summary::before {
  content: '+';
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}
.notes details[open] summary { margin-bottom: 8px; }
.notes details[open] summary::before { content: '−'; }
.notes-chips { color: var(--muted); font-size: 12.5px; }

/* ---------------- Fixed deck dock ---------------- */

.deck-dock {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 90;
  width: min(360px, calc(100% - 32px));
  transform: translateX(-50%);
  border: 1px solid rgba(214, 208, 194, .9);
  border-radius: 14px;
  background: rgba(255, 254, 250, .95);
  box-shadow: 0 10px 30px rgba(34, 38, 43, .12), 0 2px 6px rgba(34, 38, 43, .04);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  overflow: hidden;
}

.dock-inner {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 6px;
  padding: 6px;
}

.dock-nav {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 17px;
  transition: background .16s ease, color .16s ease;
}
.dock-nav:hover:not(:disabled) { background: var(--surface-2); color: var(--accent); }
.dock-nav:disabled { opacity: .3; cursor: not-allowed; }
.dock-arrow { line-height: 1; }

.dock-milestone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(23, 94, 84, .2);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease;
}
.dock-milestone:hover { background: #dfeae5; border-color: rgba(23, 94, 84, .34); }
.dock-milestone b {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dock-mid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.dock-vague {
  flex: none;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(154, 100, 24, .28);
  border-radius: 9px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease;
}
.dock-vague:hover { background: #f5e8cf; border-color: rgba(154, 100, 24, .42); }
.dock-vague::after { content: '↑'; margin-left: 5px; opacity: .5; font-size: 10px; }

.dock-hint {
  margin: 0;
  padding: 6px 8px 7px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10px;
  line-height: 1.55;
  text-align: center;
}
.dock-hint kbd {
  display: inline-block;
  min-width: 15px;
  padding: 0 3px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 9.5px;
  line-height: 13px;
  text-align: center;
}
.dock-sub { display: block; margin-top: 1px; font-size: 9.5px; }

/* ---------------- Milestone panel ---------------- */

.milestone {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.milestone-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(34, 38, 43, .34);
}
.milestone-card {
  position: relative;
  width: min(420px, 100%);
  max-height: min(78vh, 540px);
  overflow-y: auto;
  padding: 16px 18px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(34, 38, 43, .22);
  animation: msIn .18s cubic-bezier(.22, .8, .32, 1) both;
}
@keyframes msIn {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.milestone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.milestone-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.milestone-close {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  transition: background .16s ease, color .16s ease;
}
.milestone-close:hover { background: var(--paper-deep); color: var(--ink); }

.milestone-body { margin-top: 13px; }
.ms-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}
.ms-total b {
  color: var(--accent);
  font-size: 33px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ms-total span { color: var(--muted); font-size: 12px; }
.ms-split { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.ms-part {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--slate-soft);
  color: var(--ink-2);
  font-size: 11px;
}
.ms-part b { font-weight: 700; font-variant-numeric: tabular-nums; }
.ms-part.state-3 { background: var(--green-soft); color: var(--green); }
.ms-part.state-2 { background: var(--amber-soft); color: var(--amber); }
.ms-part.state-1 { background: var(--rose-soft); color: var(--rose); }
.ms-meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.ms-days {
  display: grid;
  gap: 5px;
  margin: 13px 0 0;
  padding: 12px 0 2px;
  border-top: 1px solid var(--line);
  list-style: none;
}
.ms-day {
  display: grid;
  grid-template-columns: 40px 1fr 30px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.ms-day.today { color: var(--ink); font-weight: 600; }
.ms-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--paper-deep);
  overflow: hidden;
}
.ms-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent-2);
  transition: width .2s ease;
}
.ms-day.today .ms-bar i { background: var(--accent); }
.ms-num { text-align: right; }
.milestone-foot {
  margin: 12px 0 0;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(126px + env(safe-area-inset-bottom));
  z-index: 110;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(34, 38, 43, .94);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---------------- Responsive ---------------- */

@media (max-width: 980px) {
  .select-chapter { max-width: none; }
}

@media (max-width: 680px) {
  .wrap { width: calc(100% - 24px); }
  .topbar { padding: 12px 0 6px; }
  .topbar-inner { gap: 12px; }
  .brand-link { gap: 7px; }
  .brand-mark { width: 27px; height: 27px; border-radius: 8px; font-size: 15px; }
  .brand-name { font-size: 14px; }
  .search-box { width: auto; flex: 1; padding: 0 8px; }
  .search-box input { height: 32px; font-size: 12.5px; }
  .search-box kbd { display: none; }
  .toolbar { padding-bottom: 8px; }
  .toolbar-inner { gap: 6px; }
  .select {
    height: 30px;
    padding: 0 24px 0 9px;
    background-position: right 8px center;
    font-size: 11.5px;
  }
  .select-chapter { max-width: none; }
  .select-type { width: 98px; }
  .select-mark { width: 90px; }

  .content { padding: 2px 0 24px; min-height: calc(100dvh - 96px); }
  .stage-head { margin-bottom: 7px; font-size: 10px; }
  .stage-position b { font-size: 11.5px; }

  .card { padding: 14px 14px 13px; border-radius: 13px; border-left-width: 4px; }
  .card-top { gap: 8px; }
  .card-badges { gap: 6px; }
  .badge { height: 20px; padding: 0 6px; font-size: 9.5px; }
  .card-seq { font-size: 9.5px; }
  .mark-chip { height: 21px; padding: 0 7px; font-size: 9.5px; }

  .card-title { margin-top: 10px; font-size: 17px; line-height: 1.68; }
  .card-sub { font-size: 11.5px; }
  .options { margin-top: 12px; gap: 6px; }
  .option { gap: 8px; padding: 8px 9px; font-size: 13px; }
  .opt-label { width: 21px; height: 21px; font-size: 9.5px; }
  .answer-row { margin-top: 10px; font-size: 11.5px; }
  .answer-letters { font-size: 14px; }
  .analysis { gap: 8px; margin-top: 11px; padding: 9px 10px; font-size: 12.5px; }
  .points { margin-top: 10px; font-size: 13px; }
  .points-callout { padding: 9px 10px; }
  .tip { gap: 7px; padding: 7px 9px; font-size: 11.5px; }
  .card-foot { gap: 4px 9px; margin-top: 11px; padding-top: 8px; font-size: 9.5px; }
  .foot-diff { margin-left: 0; }

  .empty-state { padding: 58px 16px 64px; }
  .footer { padding: 16px 0 calc(108px + env(safe-area-inset-bottom)); }
  .footer-inner { flex-direction: column; gap: 4px; }

  .deck-dock {
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
    border-radius: 12px;
  }
  .dock-inner { grid-template-columns: 40px 1fr 40px; gap: 4px; padding: 5px; }
  /* 手机端三颗按钮都抬到 38px：拇指落点，比桌面的 36px 再大一档。 */
  .dock-nav { width: 40px; height: 38px; font-size: 16px; }
  .dock-milestone { height: 38px; padding: 0 8px; font-size: 11px; }
  .dock-milestone b { font-size: 13px; }
  .dock-mid { gap: 5px; }
  .dock-vague { height: 38px; padding: 0 9px; font-size: 11px; }
  .dock-hint { padding: 5px 6px 6px; font-size: 9.5px; }
  .milestone-card { padding: 14px 15px 11px; }
  .ms-total b { font-size: 29px; }
  .toast { bottom: calc(112px + env(safe-area-inset-bottom)); font-size: 12px; }
}

@media (max-width: 380px) {
  .brand-name { display: none; }
  .select-type { width: 88px; }
  .select-mark { width: 82px; }
  .dock-inner { grid-template-columns: 36px minmax(0, 1fr) 36px; }
  .dock-nav { width: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  body { background: #fff; }
  .topbar,
  .toolbar,
  .empty-state,
  .footer,
  .deck-dock,
  .milestone,
  .toast,
  .notes,
  .skip-link { display: none !important; }
  .content { padding: 0; min-height: 0; }
  .deck { width: 100%; }
  .stage-head { margin-bottom: 10px; }
  .card { break-inside: avoid; box-shadow: none; }
}
