/* 红星研读 — design system
   Editorial family, neutral base, one red accent, system fonts.
   Inspired by the project's Apple design-language manual; not an Apple asset. */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f2;
  --surface-3: #e6e8eb;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --separator: rgba(29, 29, 31, 0.12);
  --separator-strong: rgba(29, 29, 31, 0.2);
  --accent: #9e1b32;
  --accent-hover: #7f1526;
  --accent-soft: rgba(158, 27, 50, 0.08);
  --on-accent: #ffffff;
  --exam: #8a5a00;
  --exam-bg: #fff8eb;
  --exam-border: rgba(138, 90, 0, 0.25);
  --key-bg: #fff3d6;
  --positive: #1b7f3a;
  --danger: #b42318;
  --radius-s: 8px;
  --radius-m: 16px;
  --radius-l: 28px;
  --content: 1200px;
  --reading: 720px;
  --sidebar: 260px;
  --drawer: 480px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(0, 0, 0, 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", "SimSun",
    "Noto Serif CJK SC", serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --header-h: 64px;
}

[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --text: #f5f5f7;
  --muted: #a1a1a8;
  --separator: rgba(245, 245, 247, 0.16);
  --separator-strong: rgba(245, 245, 247, 0.28);
  --accent: #ff7a7a;
  --accent-hover: #ff9a9a;
  --accent-soft: rgba(255, 122, 122, 0.12);
  --on-accent: #1a0000;
  --exam: #ffb340;
  --exam-bg: #2a1c05;
  --exam-border: rgba(255, 179, 64, 0.3);
  --key-bg: #2a2410;
  --positive: #30d158;
  --danger: #ff453a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

html { scroll-behavior: smooth; }
html, body { overflow-x: clip; }
html.drawer-open, body.drawer-open { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); color: var(--text); }

a { color: var(--accent); text-decoration-thickness: 0.065em; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.22; text-wrap: balance; }
p { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.2em; padding-left: 1.35em; }
li + li { margin-top: 0.35em; }
hr { border: 0; border-top: 1px solid var(--separator); margin: 3rem 0; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--surface-2); padding: 1rem 1.2rem; border-radius: 12px; overflow-x: auto; line-height: 1.55; }
pre code { background: transparent; padding: 0; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 200;
  background: var(--accent); color: var(--on-accent);
  padding: 0.6rem 1rem; border-radius: 999px; text-decoration: none;
}
.skip-link:focus { top: 0.75rem; }

.container { width: min(100% - 48px, var(--content)); margin-inline: auto; }
.narrow { width: min(100% - 48px, 760px); margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.is-hidden { display: none !important; }
.muted { color: var(--muted); }
.callout { background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-m); padding: 20px; margin: 20px 0; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--separator);
}
@supports not (backdrop-filter: blur(20px)) {
  .site-header { background: var(--bg); }
}
.header-inner {
  width: min(100% - 48px, var(--content)); margin-inline: auto;
  height: var(--header-h); display: flex; align-items: center; gap: 28px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--text); text-decoration: none; font-weight: 600;
  letter-spacing: -0.01em; white-space: nowrap;
}
.brand img { width: 26px; height: 26px; }
.brand span { font-size: 1.02rem; }
.site-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-link {
  color: var(--muted); text-decoration: none; font-size: 0.9rem;
  padding: 8px 11px; border-radius: 999px; transition: color 140ms var(--ease), background 140ms var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.is-active { color: var(--text); background: var(--surface-2); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 2px; }
.icon-button {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); background: transparent; border: 0; border-radius: 999px;
  text-decoration: none; transition: background 140ms var(--ease);
}
.icon-button:hover { background: var(--surface-2); }
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.menu-toggle { display: none; }
.mobile-nav {
  display: none; border-top: 1px solid var(--separator); background: var(--surface);
  padding: 8px 24px 16px;
}
.mobile-nav[hidden] { display: none !important; }
.mobile-nav a {
  display: block; padding: 11px 4px; color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--separator); font-size: 1rem;
}
.mobile-nav a:last-child { border-bottom: 0; }

/* ---------- base page ---------- */
.site-main { min-height: 60vh; }
.container.page { padding-block: 48px 96px; }
.page-hero { padding-block: 56px 36px; max-width: 860px; }
.page-hero h1 { font-size: clamp(2.3rem, 5vw, 3.9rem); letter-spacing: -0.025em; margin-bottom: 16px; }
.page-hero .lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); line-height: 1.7; max-width: 680px; margin-bottom: 26px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--accent); display: inline-block; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid transparent; text-decoration: none; font-size: 0.95rem;
  font-weight: 500; transition: background 140ms var(--ease), border-color 140ms var(--ease), transform 140ms var(--ease);
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface); border-color: var(--separator-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-quiet { color: var(--accent); background: transparent; border-color: transparent; padding-inline: 10px; }
.btn-quiet:hover { background: var(--accent-soft); color: var(--accent); }
.btn-small { min-height: 36px; padding: 0 13px; font-size: 0.85rem; }

/* ---------- stats / cards ---------- */
.stats-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px; background: var(--separator); border: 1px solid var(--separator);
  border-radius: var(--radius-m); overflow: hidden; margin: 12px 0 64px;
}
.stat { background: var(--surface); padding: 22px 24px; }
.stat-num { font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 0.83rem; margin-top: 6px; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--separator);
  border-radius: var(--radius-m); padding: 22px;
  text-decoration: none; color: var(--text);
  transition: border-color 140ms var(--ease), background 140ms var(--ease), transform 140ms var(--ease);
}
a.card:hover { border-color: var(--separator-strong); background: var(--surface); transform: translateY(-1px); }
.card-title { font-size: 1.05rem; font-weight: 600; line-height: 1.35; }
.card-text { color: var(--muted); font-size: 0.91rem; line-height: 1.65; margin: 0; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; color: var(--muted); font-size: 0.8rem; }

.section-block { margin-block: 64px; }
.section-block > h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-bottom: 8px; letter-spacing: -0.02em; }
.section-block > .section-desc { color: var(--muted); margin-bottom: 24px; max-width: 720px; }

/* ---------- badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 22px; padding: 1px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em;
  border: 1px solid transparent; white-space: nowrap; vertical-align: middle;
}
.badge-key { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.badge-exam { color: var(--exam); background: var(--exam-bg); border-color: var(--exam-border); }
.badge-neutral { color: var(--muted); background: var(--surface-2); border-color: var(--separator); }
.badge-note { color: var(--exam); background: var(--exam-bg); border-color: var(--exam-border); }
.badge-layer { color: var(--muted); background: var(--surface-2); border-color: var(--separator); }
.badge-level-A { color: var(--on-accent); background: var(--accent); }
.badge-level-B { color: var(--exam); background: var(--exam-bg); border-color: var(--exam-border); }
.badge-level-C { color: var(--muted); background: var(--surface-2); border-color: var(--separator); }
.badge-level-群像 { color: var(--muted); background: var(--surface-2); border-color: var(--separator); }

.cite-chip, .cite-note, .cite-external {
  display: inline; border: 0; background: transparent; padding: 0;
  color: var(--accent); font: inherit; text-decoration: underline; text-decoration-thickness: 0.06em; text-underline-offset: 0.16em;
  cursor: pointer; text-align: left;
}
.cite-note { color: var(--exam); }
.cite-external { color: var(--muted); text-decoration-style: dotted; }
.cite-chip:hover, .cite-note:hover, .cite-external:hover { color: var(--accent-hover); }

.key-strip {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 12px 0 16px; margin-bottom: 8px;
  border-top: 1px solid var(--separator); border-bottom: 1px solid var(--separator);
}
.key-strip-label { font-size: 0.78rem; font-weight: 600; color: var(--accent); letter-spacing: 0.06em; margin-right: 4px; }
.key-link {
  border: 1px solid var(--separator); background: var(--surface); color: var(--text);
  border-radius: 999px; min-height: 34px; padding: 0 12px; font-size: 0.82rem;
}
.key-link:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- document prose ---------- */
.doc-intro { max-width: var(--reading); }
.doc-intro > * { max-width: var(--reading); }
.doc-intro p, .doc-intro blockquote { font-size: 0.95rem; }
.doc-section { margin: 0 0 64px; scroll-margin-top: 84px; }
.section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.section-head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: -0.02em; }
.doc-section h3 { font-size: 1.22rem; margin: 2.2rem 0 0.8rem; scroll-margin-top: 84px; }
.doc-section h4 { font-size: 1.02rem; margin: 1.6rem 0 0.6rem; }
.doc-section p, .doc-section li { max-width: var(--reading); }
.doc-section table { max-width: 100%; }
.doc-section blockquote.plain {
  margin: 1.6rem 0; padding: 0.2rem 0 0.2rem 1.25rem;
  border-left: 3px solid var(--separator-strong); color: var(--muted); max-width: var(--reading);
}
.table-scroll { width: 100%; overflow-x: auto; max-width: 100%; contain: inline-size; margin: 1.4rem 0; border: 1px solid var(--separator); border-radius: 12px; }
.table-scroll table { width: 100%; border-collapse: collapse; margin: 0; font-size: 0.9rem; min-width: 560px; }
.table-scroll th, .table-scroll td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--separator); }
.table-scroll th { font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
.table-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.table-scroll tr:last-child td { border-bottom: 0; }

/* citations in text should not break layout */
.doc-section p .cite-chip, .doc-section p .cite-note, .doc-section p .cite-external { white-space: normal; }

/* quote cards */
.quote-card {
  margin: 1.6rem 0; padding: 20px 22px 14px;
  background: var(--surface); border: 1px solid var(--separator);
  border-left: 3px solid var(--accent); border-radius: 0 var(--radius-m) var(--radius-m) 0;
  max-width: var(--reading);
}
.quote-card.layer-note { border-left-color: var(--exam); background: var(--exam-bg); }
.quote-card.layer-ext { border-left-color: var(--muted); }
.quote-card blockquote {
  margin: 0 0 10px; font-family: var(--font-serif);
  font-size: 1.04rem; line-height: 1.85; color: var(--text);
}
.quote-card figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.quote-card .cite-chip { color: var(--muted); font-size: 0.78rem; text-decoration: none; }
.quote-card .source-btn {
  border: 0; background: transparent; color: var(--accent); font-size: 0.78rem;
  padding: 4px 0; min-height: 30px; text-decoration: underline; text-underline-offset: 0.15em;
}
.quote-card .source-btn:hover { color: var(--accent-hover); }

.editor-note {
  margin: 1.6rem 0; padding: 14px 18px; max-width: var(--reading);
  background: var(--exam-bg); border: 1px solid var(--exam-border); border-radius: var(--radius-s);
  color: var(--text);
}
.editor-note p { margin: 8px 0 0; font-size: 0.93rem; }

mark.key-mark { background: var(--key-bg); color: inherit; padding: 0 2px; border-radius: 2px; }

/* ---------- tabs / filters ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; width: fit-content; max-width: 100%; }
.tab {
  border: 0; background: transparent; color: var(--muted); border-radius: 999px;
  min-height: 40px; padding: 0 16px; font-size: 0.9rem;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06); font-weight: 500; }

.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 20px 0 26px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.field label { font-size: 0.75rem; color: var(--muted); font-weight: 600; letter-spacing: 0.03em; }
.input, .select {
  min-height: 44px; border: 1px solid var(--separator-strong); background: var(--surface);
  border-radius: 10px; padding: 0 12px; color: var(--text); font-size: 0.92rem;
}
.input { min-width: 220px; }
.input:focus, .select:focus { border-color: var(--accent); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 34px; border-radius: 999px; border: 1px solid var(--separator);
  background: var(--surface); color: var(--text); padding: 0 12px; font-size: 0.82rem;
}
.chip:hover { border-color: var(--separator-strong); }
.chip.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- home ---------- */
.home-hero { padding-block: 72px 36px; }
.home-hero h1 { font-size: clamp(2.6rem, 6vw, 4.5rem); letter-spacing: -0.035em; max-width: 760px; }
.home-hero .lead { font-size: clamp(1.08rem, 1.8vw, 1.3rem); color: var(--muted); max-width: 640px; }
.home-hero .hero-actions { margin-top: 28px; }
.home-feature { display: grid; grid-template-columns: 1.25fr .75fr; gap: 24px; align-items: stretch; margin-block: 40px 64px; }
.home-quote-card { background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-l); padding: 32px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.home-quote-card .quote-foot { margin-top: auto; }
.home-quote-card .card-text { margin-top: 10px; }
.quote-foot { display: flex; flex-wrap: wrap; gap: 18px; border-top: 1px solid var(--separator); padding-top: 16px; }
.quote-foot a { font-size: 0.82rem; color: var(--muted); text-decoration: none; }
.quote-foot a:hover { color: var(--accent); }
.home-quote-card .quote-card { border: 0; padding: 0; margin: 0; background: transparent; }
.home-quote-card blockquote { font-size: clamp(1.2rem, 2vw, 1.55rem); line-height: 1.7; }
.home-aside { background: var(--surface-2); border-radius: var(--radius-l); padding: 28px; display: flex; flex-direction: column; justify-content: space-between; }
.home-aside h2 { font-size: 1.1rem; margin-bottom: 8px; }
.home-aside p { color: var(--muted); font-size: 0.92rem; }
.path-card { border-top: 1px solid var(--separator); padding: 18px 0; }
.path-card:first-of-type { border-top: 0; }
.path-card h3 { font-size: 1rem; margin-bottom: 4px; }
.path-card p { color: var(--muted); font-size: 0.88rem; margin-bottom: 8px; }
.path-card a { font-size: 0.86rem; }
.feature-two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.feature-two > div { background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-m); padding: 24px; }
.feature-two .eyebrow { margin-bottom: 8px; }

/* ---------- book / plot ---------- */
.version-card { background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-l); padding: 26px 28px; margin: 8px 0 40px; }
.version-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.version-grid .k { color: var(--muted); font-size: 0.75rem; margin-bottom: 3px; }
.version-grid .v { font-size: 0.95rem; font-weight: 500; }
.section-index { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 28px; }
.part-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 40px; }
.part-nav a { min-height: 36px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; border: 1px solid var(--separator); background: var(--surface); color: var(--text); text-decoration: none; font-size: 0.82rem; }
.part-nav a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- timeline ---------- */
.timeline { position: relative; margin: 30px 0 10px; padding-left: 22px; border-left: 1px solid var(--separator-strong); }
.timeline-item { position: relative; padding: 0 0 28px 22px; }
.timeline-item::before { content: ""; position: absolute; left: -27px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline-date { font-size: 0.76rem; font-weight: 600; color: var(--accent); letter-spacing: 0.03em; margin-bottom: 3px; }
.timeline-title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.timeline-text { color: var(--muted); font-size: 0.9rem; margin-bottom: 5px; }
.timeline-cite { font-size: 0.78rem; color: var(--muted); }
.structure-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.structure-part { border: 1px solid var(--separator); background: var(--surface); border-radius: var(--radius-m); padding: 18px 20px; }
.structure-part h3 { font-size: 1rem; margin-bottom: 8px; }
.structure-part ol { margin: 0; padding-left: 1.15rem; color: var(--muted); font-size: 0.85rem; }
.structure-part li { margin-bottom: 5px; }

/* ---------- characters ---------- */
.character-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.character-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-m); padding: 20px; text-decoration: none; color: var(--text); transition: border-color 140ms var(--ease), transform 140ms var(--ease); }
.character-card .character-traits { min-width: 0; }
.character-card .trait { min-width: 0; flex: 0 1 auto; }
.character-card:hover { border-color: var(--separator-strong); transform: translateY(-1px); color: var(--text); }
.character-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.character-name { font-size: 1.1rem; font-weight: 600; }
.character-cat { color: var(--muted); font-size: 0.76rem; }
.character-one { color: var(--muted); font-size: 0.88rem; line-height: 1.6; margin: 0; }
.character-traits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.trait { font-size: 0.74rem; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.count-line { color: var(--muted); font-size: 0.82rem; margin: 8px 0 20px; }
.character-hero { padding-block: 48px 28px; max-width: 860px; }
.character-hero h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); margin: 10px 0 8px; }
.character-hero .one-liner { color: var(--muted); font-size: 1.05rem; max-width: 720px; }
.character-layout { display: grid; grid-template-columns: minmax(0, var(--reading)) 280px; gap: 56px; align-items: start; }
.character-main { min-width: 0; }
.character-rail { position: sticky; top: calc(var(--header-h) + 24px); display: flex; flex-direction: column; gap: 16px; }
.rail-card { background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-m); padding: 18px; }
.rail-card h2 { font-size: 0.9rem; margin-bottom: 8px; }
.rail-card p, .rail-card li { color: var(--muted); font-size: 0.82rem; }
.exam-callout { background: var(--exam-bg); border: 1px solid var(--exam-border); border-radius: var(--radius-m); padding: 20px 22px; margin: 14px 0 28px; }
.exam-callout .exam-q { font-weight: 600; margin: 8px 0 12px; }
.exam-callout .exam-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.character-body h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.character-body h4 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.character-body .table-scroll th:first-child,
.character-body .table-scroll td:first-child { width: 112px; white-space: nowrap; }
#readerSideToggle { display: none; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--separator); }
.pager a { max-width: 46%; font-size: 0.9rem; }

/* ---------- reader ---------- */
.reader-layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: 48px; width: min(100% - 48px, 1180px); margin-inline: auto; padding-block: 28px 80px; }
.reader-side { position: sticky; top: calc(var(--header-h) + 18px); align-self: start; max-height: calc(100vh - var(--header-h) - 36px); overflow: auto; padding-right: 8px; }
.reader-search { width: 100%; min-height: 42px; border: 1px solid var(--separator-strong); background: var(--surface); border-radius: 10px; padding: 0 12px; font-size: 0.86rem; }
.reader-results { margin-top: 8px; border: 1px solid var(--separator); border-radius: 10px; overflow: hidden; background: var(--surface); }
.reader-results button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 11px; font-size: 0.8rem; color: var(--text); border-bottom: 1px solid var(--separator); }
.reader-results button:last-child { border-bottom: 0; }
.reader-results button:hover { background: var(--surface-2); }
.reader-toc { margin-top: 18px; font-size: 0.82rem; }
.reader-toc details { border-bottom: 1px solid var(--separator); }
.reader-toc summary { cursor: pointer; padding: 9px 0; font-weight: 600; color: var(--text); list-style: none; }
.reader-toc summary::-webkit-details-marker { display: none; }
.reader-toc summary::before { content: "›"; display: inline-block; width: 1.1em; color: var(--muted); transition: transform 140ms var(--ease); }
.reader-toc details[open] summary::before { transform: rotate(90deg); }
.reader-toc a { display: block; padding: 6px 0 6px 1.2em; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; }
.reader-toc a:hover { color: var(--text); }
.reader-toc a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.reader-main { max-width: var(--reading); min-width: 0; }
.reader-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0 18px; border-bottom: 1px solid var(--separator); margin-bottom: 26px; }
.reader-toolbar .spacer { flex: 1; }
.font-controls { display: inline-flex; border: 1px solid var(--separator); border-radius: 999px; overflow: hidden; }
.font-controls button { border: 0; background: transparent; min-height: 36px; padding: 0 11px; font-size: 0.78rem; color: var(--muted); }
.font-controls button.is-active { background: var(--surface-2); color: var(--text); }
.reader-title { font-size: clamp(1.8rem, 3.6vw, 2.6rem); letter-spacing: -0.025em; margin-bottom: 8px; }
.reader-meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 26px; }
.reader-article { font-size: var(--reader-font, 1.06rem); line-height: 1.9; }
.source-para { position: relative; padding-left: 52px; margin: 0 0 1.1em; scroll-margin-top: 90px; }
.source-para .ln { position: absolute; left: 0; top: 0.3em; width: 38px; text-align: right; color: var(--muted); font-family: var(--font-mono); font-size: 0.68rem; opacity: 0.72; }
.source-para.layer-精讲点拨 { background: var(--exam-bg); border-left: 3px solid var(--exam); padding: 10px 14px 10px 52px; border-radius: 0 8px 8px 0; }
.source-para.layer-精讲点拨::before { content: "精讲点拨"; position: absolute; left: 52px; top: -0.7em; font-size: 0.68rem; color: var(--exam); background: var(--exam-bg); padding: 0 4px; }
.source-para.layer-编者注 { border-left: 3px solid var(--separator-strong); padding-left: 52px; }
.source-para.is-target { background: var(--key-bg); border-radius: 6px; }
.source-para.is-target .ln { color: var(--accent); opacity: 1; }
.reader-nav { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--separator); margin-top: 44px; padding-top: 20px; }
.reader-nav a { font-size: 0.88rem; }
.quote-banner { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: var(--radius-s); padding: 10px 14px; font-size: 0.84rem; margin-bottom: 20px; }

/* ---------- exam ---------- */
.exam-layout { display: grid; grid-template-columns: minmax(0, 640px) 300px; gap: 40px; align-items: start; }
.flashcard { background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-l); padding: 28px; }
.flashcard .flash-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.flash-q { font-size: clamp(1.2rem, 2vw, 1.5rem); font-weight: 600; line-height: 1.5; margin-bottom: 18px; }
.flash-a { border-top: 1px solid var(--separator); padding-top: 16px; margin-top: 6px; }
.flash-a ul { margin: 0; padding-left: 1.2em; }
.flash-a li { color: var(--text); font-size: 0.95rem; margin-bottom: 8px; }
.flash-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.progress { color: var(--muted); font-size: 0.8rem; margin-top: 12px; }
.exam-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--header-h) + 24px); }
.exam-list { margin-top: 48px; }
.exam-item { background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-m); padding: 0 18px; margin-bottom: 10px; }
.exam-item summary { cursor: pointer; padding: 14px 0; font-size: 0.94rem; font-weight: 500; }
.exam-item .exam-answer { padding: 0 0 16px; color: var(--muted); font-size: 0.9rem; }
.exam-item .exam-answer ul { margin: 0; padding-left: 1.2em; }

/* ---------- search ---------- */
.search-hero { padding-block: 48px 24px; }
.search-form { display: flex; gap: 8px; max-width: 720px; }
.search-form .input { flex: 1; min-width: 0; }
.result-group { margin: 32px 0; }
.result-group h2 { font-size: 0.82rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px; }
.result-item { display: block; padding: 14px 0; border-top: 1px solid var(--separator); text-decoration: none; color: var(--text); }
.result-item:hover { color: var(--accent); }
.result-title { font-weight: 600; font-size: 0.98rem; margin-bottom: 3px; }
.result-snippet { color: var(--muted); font-size: 0.85rem; line-height: 1.6; }
.result-snippet mark { background: var(--key-bg); color: inherit; padding: 0 2px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------- drawer / toast ---------- */
.drawer-root { position: fixed; inset: 0; z-index: 120; display: flex; justify-content: flex-end; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.32); opacity: 0; transition: opacity 240ms var(--ease); }
.drawer {
  position: relative; width: min(100%, var(--drawer)); height: 100%;
  background: var(--surface); box-shadow: var(--shadow);
  transform: translateX(24px); opacity: 0; transition: transform 260ms var(--ease), opacity 260ms var(--ease);
  display: flex; flex-direction: column;
}
.drawer-root.open .drawer-scrim { opacity: 1; }
.drawer-root.open .drawer { transform: translateX(0); opacity: 1; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--separator); }
.drawer-head h2 { font-size: 1rem; }
.drawer-body { padding: 22px; overflow: auto; }
.drawer-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; color: var(--muted); font-size: 0.78rem; }
.drawer-quote { font-family: var(--font-serif); font-size: 1.08rem; line-height: 1.8; padding-left: 14px; border-left: 3px solid var(--accent); margin-bottom: 20px; }
.drawer-source { border-top: 1px solid var(--separator); padding-top: 16px; }
.drawer-source .ctx-para { position: relative; padding-left: 44px; font-size: 0.92rem; color: var(--muted); }
.drawer-source .ctx-para .ln { position: absolute; left: 0; top: 0.3em; width: 34px; text-align: right; font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted); opacity: .7; }
.drawer-source .ctx-para.hit { color: var(--text); }
.drawer-source mark { background: var(--key-bg); color: inherit; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--separator); }
.drawer-close { width: 40px; height: 40px; border: 0; background: var(--surface-2); border-radius: 999px; font-size: 1.2rem; line-height: 1; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--text); color: var(--bg); border-radius: 999px; padding: 9px 16px; font-size: 0.85rem; z-index: 200; opacity: 0; transition: opacity 160ms var(--ease); pointer-events: none; }
.toast.show { opacity: 1; }

/* ---------- about / footer ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, var(--reading)) 280px; gap: 48px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 24px; }
.site-footer { border-top: 1px solid var(--separator); background: var(--surface); margin-top: 40px; }
.footer-inner { width: min(100% - 48px, var(--content)); margin-inline: auto; padding: 34px 0 46px; display: flex; justify-content: space-between; gap: 28px; flex-wrap: wrap; color: var(--muted); font-size: 0.82rem; }
.footer-brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; margin-bottom: 6px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }

.fold { border-top: 1px solid var(--separator); padding: 4px 0; }
.fold summary { cursor: pointer; padding: 14px 0; font-weight: 600; }
.fold .fold-body { padding-bottom: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .site-nav { display: none; }
  .menu-toggle { display: inline-flex; }
  .mobile-nav { display: block; }
  .character-layout, .about-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .character-rail { position: static; }
  .exam-layout { grid-template-columns: minmax(0, 1fr); }
  .exam-side { position: static; }
  .home-feature { grid-template-columns: 1fr; }
  .version-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .reader-layout { grid-template-columns: 1fr; gap: 20px; }
  .reader-side { position: static; max-height: none; display: none; }
  .reader-side.is-open { display: block; }
  #readerSideToggle { display: inline-flex; }
  .card-grid, .character-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .structure-grid { grid-template-columns: 1fr; }
  .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .container, .narrow, .reader-layout, .header-inner, .footer-inner { width: min(100% - 32px, var(--content)); }
  .page-hero h1, .home-hero h1, .character-hero h1 { font-size: clamp(1.95rem, 8.2vw, 2.6rem); line-height: 1.18; overflow-wrap: anywhere; }
  .home-hero { padding-block: 44px 20px; }
  .page-hero { padding-block: 34px 24px; }
  .card-grid, .card-grid.two, .character-grid, .version-grid { grid-template-columns: 1fr; }
  .feature-two { grid-template-columns: 1fr; }
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .stat { padding: 16px; }
  .doc-section { margin-bottom: 44px; }
  .source-para { padding-left: 0; }
  .source-para .ln { position: static; display: block; width: auto; text-align: left; margin-bottom: 2px; }
  .source-para.layer-精讲点拨, .source-para.layer-编者注 { padding-left: 12px; }
  .character-body .table-scroll th:first-child,
  .character-body .table-scroll td:first-child { width: auto; white-space: normal; }
  .reader-toolbar { gap: 8px; }
  .drawer-root { align-items: flex-end; }
  .drawer { width: 100%; height: min(88vh, 720px); border-radius: 20px 20px 0 0; transform: translateY(24px); }
  .drawer-root.open .drawer { transform: translateY(0); }
  .footer-inner { flex-direction: column; }
  .pager { flex-direction: column; }
  .pager a { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .drawer, .drawer-scrim { transition: none; }
}

@media (prefers-contrast: more) {
  :root { --muted: var(--text); --separator: var(--text); }
}

@media print {
  @page { size: A4; margin: 22mm; }
  .site-header, .site-footer, .reader-side, .reader-toolbar, .reader-nav, .page-hero, .key-strip, .hero-actions, .drawer-root, .toast { display: none !important; }
  body { background: #fff; color: #111; font-size: 11pt; }
  .reader-layout { display: block; width: auto; padding: 0; }
  .reader-main { max-width: none; }
  .source-para { padding-left: 0; }
  .source-para .ln { position: static; display: block; width: auto; text-align: left; }
  a { color: #111; text-decoration: none; }
  .quote-card, .exam-callout, .table-scroll { break-inside: avoid; }
}

/* ---------- expanded visuals: graph / map / causal / review ---------- */
.view-switch { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; margin: 4px 0 18px; }
.view-btn { border: 0; background: transparent; color: var(--muted); min-height: 38px; padding: 0 16px; border-radius: 999px; font-size: 0.86rem; }
.view-btn:hover { color: var(--text); }
.view-btn.is-active { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.78rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--muted); }
.legend-dot.camp-ccp { background: #9e1b32; }
.legend-dot.camp-kmt { background: #2f5d8a; }
.legend-dot.camp-mass { background: #8a5a00; }
.legend-dot.camp-foreign { background: #5b5b63; }
.legend-line { width: 18px; height: 0; border-top: 2px solid var(--separator-strong); display: inline-block; }
.legend-line.interview { border-top-style: dotted; border-color: var(--muted); }
.legend-line.conflict { border-top-style: dashed; border-color: var(--accent); }

.graph-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.graph-legend { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.graph-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.graph-scroll { overflow-x: auto; border: 1px solid var(--separator); border-radius: var(--radius-m); background: var(--surface); }
.journey-svg, #relationGraph { display: block; width: 100%; height: auto; min-width: 720px; }
#relationGraph { min-height: 460px; touch-action: none; }
.graph-note { color: var(--muted); font-size: 0.78rem; margin-top: 10px; }
.graph-panel { background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-m); padding: 20px; min-height: 220px; position: sticky; top: calc(var(--header-h) + 22px); }
.graph-panel-empty p { color: var(--muted); font-size: 0.86rem; }
.graph-panel-kicker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 0.78rem; margin-bottom: 8px; }
.graph-panel h2 { font-size: 1.25rem; margin-bottom: 8px; }
.graph-one { color: var(--muted); font-size: 0.88rem; line-height: 1.65; }
.graph-links { border-top: 1px solid var(--separator); margin-top: 12px; padding-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.graph-links > span { width: 100%; color: var(--muted); font-size: 0.76rem; }
.graph-rel { border: 1px solid var(--separator); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 4px 9px; font-size: 0.74rem; }
.graph-rel em { color: var(--muted); font-style: normal; font-size: 0.68rem; margin-left: 3px; }
.graph-rel:hover { border-color: var(--accent); color: var(--accent); }
.graph-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.graph-edge { stroke: color-mix(in srgb, var(--text) 20%, transparent); stroke-width: 1; }
.graph-edge.kind-interview, .graph-edge.kind-contact { stroke-dasharray: 3 4; }
.graph-edge.kind-conflict { stroke: color-mix(in srgb, var(--accent) 50%, transparent); stroke-dasharray: 5 5; }
.graph-edge.kind-family { stroke: color-mix(in srgb, #8a5a00 50%, transparent); }
.graph-edge.is-dim { opacity: 0.1; }
.graph-edge.is-active { stroke: var(--accent); stroke-width: 1.8; opacity: 1; }
.graph-node { cursor: grab; outline: none; }
.graph-node:focus-visible circle { stroke: var(--accent); stroke-width: 4; }
.graph-node circle { fill: #9e1b32; stroke: var(--surface); stroke-width: 2; }
.graph-node.camp-kmt circle { fill: #2f5d8a; }
.graph-node.camp-mass circle { fill: #8a5a00; }
.graph-node.camp-foreign circle { fill: #5b5b63; }
.graph-node.level-A circle { stroke-width: 3; }
.graph-node .graph-label { fill: var(--text); font-size: 11px; font-weight: 500; opacity: 0; pointer-events: none; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.graph-node.level-A .graph-label, .graph-node.is-label .graph-label { opacity: 1; }
.graph-node.is-dim { opacity: 0.18; }
.graph-node.is-active circle { stroke: var(--accent); stroke-width: 4; }
.graph-node.is-selected circle { stroke: #ffb340; stroke-width: 5; }
.graph-node.is-dragging { cursor: grabbing; }
.graph-node text { user-select: none; }
.graph-panel .badge { margin-right: 2px; }

/* journey map */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 22px; align-items: start; }
.map-scroll { overflow-x: auto; border: 1px solid var(--separator); border-radius: var(--radius-m); background: var(--surface); }
.journey-svg { background: radial-gradient(circle at 65% 38%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 46%), var(--surface); }
.map-grid line { stroke: color-mix(in srgb, var(--text) 7%, transparent); stroke-width: 1; }
.map-province { fill: color-mix(in srgb, var(--muted) 34%, transparent); font-size: 22px; font-weight: 600; letter-spacing: 0.18em; }
.journey-route { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 9 7; opacity: 0.85; animation: route-dash 24s linear infinite; }
.journey-route.ghost { stroke-width: 8; opacity: 0.08; stroke-dasharray: none; animation: none; }
@keyframes route-dash { to { stroke-dashoffset: -160; } }
.map-place { cursor: pointer; outline: none; }
.map-place .map-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.map-place .map-halo { fill: transparent; stroke: transparent; stroke-width: 1.5; }
.map-place:hover .map-halo, .map-place:focus-visible .map-halo, .map-place.is-active .map-halo { stroke: var(--accent); fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.map-place .map-label { fill: var(--text); font-size: 13px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.map-place .map-date { fill: var(--muted); font-size: 10px; font-family: var(--font-mono); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.map-place.kind-start .map-dot, .map-place.kind-end .map-dot { fill: var(--accent); }
.map-place.kind-offroute .map-dot { fill: var(--surface-3); stroke: var(--muted); stroke-dasharray: 2 2; }
.map-place.is-offroute .map-label { fill: var(--muted); }
.map-place.is-offroute { cursor: help; }
.map-note { color: var(--muted); font-size: 0.76rem; margin-top: 10px; line-height: 1.6; }
.map-panel { background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-m); padding: 20px; position: sticky; top: calc(var(--header-h) + 22px); }
.map-panel-kicker { color: var(--accent); font-family: var(--font-mono); font-size: 0.72rem; margin-bottom: 6px; }
.map-panel h2 { font-size: 1.3rem; margin-bottom: 8px; }
.map-panel p { color: var(--muted); font-size: 0.88rem; line-height: 1.65; }
.map-panel .map-cite { margin-top: 12px; }
.map-warn { border-top: 1px solid var(--separator); padding-top: 10px; color: var(--exam); font-size: 0.8rem; }

/* causal scroll timeline */
.causal-layout { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 30px; align-items: start; }
.causal-rail { position: sticky; top: calc(var(--header-h) + 26px); display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.causal-rail-label { color: var(--accent); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; }
.causal-rail strong { font-size: clamp(1.6rem, 3vw, 2.4rem); letter-spacing: -0.03em; color: var(--accent); font-family: var(--font-mono); }
.causal-rail > span:last-child { color: var(--muted); font-size: 0.8rem; line-height: 1.5; border-left: 2px solid var(--separator-strong); padding-left: 12px; }
.causal-list { border-left: 1px solid var(--separator-strong); margin-left: 4px; padding-left: 26px; }
.causal-step { position: relative; padding: 0 0 34px; opacity: 0; transform: translateY(18px); transition: opacity 420ms var(--ease), transform 420ms var(--ease); }
.causal-step::before { content: ""; position: absolute; left: -33px; top: 7px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.causal-step.is-in { opacity: 1; transform: none; }
.causal-step-date { color: var(--accent); font-family: var(--font-mono); font-size: 0.74rem; margin-bottom: 4px; }
.causal-step h3 { font-size: 1.12rem; margin-bottom: 6px; }
.causal-step p { color: var(--muted); font-size: 0.9rem; margin-bottom: 6px; }
.causal-cite { font-size: 0.78rem; }
.causal-hint { color: var(--muted); font-size: 0.76rem; margin: 6px 0 0 200px; }
@media (max-width: 640px) { .causal-hint { margin-left: 0; } }

/* VS cards */
.vs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.vs-card { display: grid; grid-template-columns: 1fr 46px 1fr; align-items: stretch; background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-m); overflow: hidden; }
.vs-side { padding: 18px; display: flex; flex-direction: column; gap: 7px; }
.vs-left { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.vs-right { background: color-mix(in srgb, var(--exam) 7%, var(--surface)); }
.vs-label { color: var(--muted); font-size: 0.7rem; letter-spacing: 0.06em; }
.vs-side strong { font-size: 0.95rem; line-height: 1.45; }
.vs-side p { color: var(--muted); font-size: 0.8rem; margin: 0; }
.vs-badge { display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-weight: 600; font-size: 0.78rem; color: var(--muted); background: var(--surface-2); }

/* review */
.review-cta { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--exam-bg); border: 1px solid var(--exam-border); border-radius: var(--radius-m); padding: 20px 22px; margin: 8px 0 18px; }
.review-cta h2 { font-size: 1.2rem; margin: 8px 0 5px; }
.review-cta p { color: var(--muted); font-size: 0.88rem; margin: 0; }
.review-tabs { margin-bottom: 0; }
.review-card { max-width: var(--reading); background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-l); padding: 28px; }
.review-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.review-q { font-size: clamp(1.15rem, 2vw, 1.45rem); line-height: 1.55; margin-bottom: 18px; }
.review-a { border-top: 1px solid var(--separator); padding-top: 16px; }
.review-a ul { margin: 0 0 10px; padding-left: 1.2em; }
.review-a li { margin-bottom: 8px; font-size: 0.94rem; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.review-note { color: var(--muted); font-size: 0.76rem; margin-top: 22px; }
.progress { color: var(--muted); font-size: 0.78rem; margin-top: 12px; }
.choice-list { display: grid; gap: 9px; }
.choice-item { display: flex; align-items: flex-start; gap: 10px; text-align: left; border: 1px solid var(--separator); background: var(--surface); color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 0.92rem; }
.choice-item:hover { border-color: var(--separator-strong); }
.choice-letter { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 0.72rem; font-weight: 600; }
.choice-item.is-correct { border-color: var(--positive); background: color-mix(in srgb, var(--positive) 9%, var(--surface)); }
.choice-item.is-correct .choice-letter { background: var(--positive); color: #fff; }
.choice-item.is-wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.choice-item.is-wrong .choice-letter { background: var(--danger); color: #fff; }
.choice-item.is-chosen { border-color: var(--accent); }
.feedback { border-radius: 12px; padding: 13px 15px; margin-top: 14px; font-size: 0.88rem; }
.feedback p { margin: 5px 0 0; color: var(--muted); }
.feedback.ok { background: color-mix(in srgb, var(--positive) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--positive) 28%, transparent); }
.feedback.bad { background: var(--exam-bg); border: 1px solid var(--exam-border); }
.fill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.fill-row .input { flex: 1; min-width: 180px; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.match-col h3 { font-size: 0.78rem; color: var(--muted); letter-spacing: 0.08em; margin-bottom: 8px; }
.match-item { display: block; width: 100%; text-align: left; border: 1px solid var(--separator); background: var(--surface); color: var(--text); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 0.85rem; }
.match-item:hover { border-color: var(--separator-strong); }
.match-item.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.match-item.is-matched { border-color: var(--positive); background: color-mix(in srgb, var(--positive) 8%, var(--surface)); color: var(--muted); }
.match-item.is-wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.match-item:disabled { cursor: default; }
.order-selected { display: flex; flex-wrap: wrap; gap: 7px; min-height: 42px; padding: 10px; background: var(--surface-2); border-radius: 10px; margin-bottom: 12px; }
.order-chip { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--separator); font-size: 0.8rem; }
.order-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.order-item { border: 1px solid var(--separator-strong); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 12px; font-size: 0.82rem; }
.order-item:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 1100px) {
  .graph-layout, .map-layout { grid-template-columns: 1fr; }
  .graph-panel, .map-panel { position: static; }
  .causal-layout { grid-template-columns: 120px minmax(0, 1fr); gap: 18px; }
}
@media (max-width: 640px) {
  .vs-grid, .match-grid { grid-template-columns: 1fr; }
  .review-cta { flex-direction: column; align-items: flex-start; }
  .causal-layout { grid-template-columns: 1fr; }
  .causal-rail { position: static; flex-direction: row; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--separator); padding-bottom: 10px; }
  .causal-rail > span:last-child { border-left: 0; padding-left: 0; }
  .causal-list { padding-left: 20px; }
  .causal-step::before { left: -27px; }
  .review-card { padding: 20px; }
  .vs-card { grid-template-columns: 1fr 36px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .journey-route { animation: none; }
  .causal-step { opacity: 1; transform: none; transition: none; }
}
