/* =========================================================
   分析師備考站 — static study site
   Warm paper palette, serif display, quiet exam-prep utility
   ========================================================= */

:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --bg-deep: #eee8dc;
  --surface: #fffdf8;
  --surface-2: #faf6ee;
  --ink: #182426;
  --ink-soft: #334246;
  --muted: #667477;
  --line: #ded6c8;
  --line-strong: #c9bfae;
  --accent: #0f5c5c;
  --accent-ink: #0a4444;
  --accent-soft: #e3efeb;
  --gold: #a86d27;
  --gold-soft: #f5ead8;
  --danger: #9a3f35;
  --success: #2f7d4f;
  --shadow-sm: 0 1px 2px rgba(24, 36, 38, 0.05);
  --shadow-md: 0 14px 40px rgba(24, 36, 38, 0.09);
  --shadow-lg: 0 28px 70px rgba(24, 36, 38, 0.16);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Noto Serif TC", "Songti TC", "PMingLiU", "Times New Roman", serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Consolas", "Liberation Mono", monospace;
  --maxw: 1180px;
  --header-h: 72px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1719;
  --bg-deep: #0b1214;
  --surface: #162124;
  --surface-2: #1a282b;
  --ink: #edf3f1;
  --ink-soft: #d3dfdc;
  --muted: #9fb0ad;
  --line: #29393c;
  --line-strong: #3b4e51;
  --accent: #66c9ba;
  --accent-ink: #8ce0d2;
  --accent-soft: #17302e;
  --gold: #e1b06a;
  --gold-soft: #33261a;
  --danger: #e28b7f;
  --success: #7ed69b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.5);
}

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

[hidden] {
  display: none !important;
}

body.search-open {
  overflow: hidden;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 28px);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% -10%, rgba(168, 109, 39, 0.10), transparent 34rem),
    radial-gradient(circle at 96% 4%, rgba(15, 92, 92, 0.10), transparent 38rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 10% -10%, rgba(225, 176, 106, 0.08), transparent 34rem),
    radial-gradient(circle at 96% 4%, rgba(102, 201, 186, 0.08), transparent 38rem),
    var(--bg);
}

::selection {
  background: var(--accent);
  color: #fff;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.28;
  color: var(--ink);
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: 0.02em;
}

h2 {
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

h3 {
  font-size: clamp(1.16rem, 1.8vw, 1.45rem);
}

p {
  color: var(--ink-soft);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ----------------------------- Header ----------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(16px) saturate(1.15);
  transition: border-color 180ms ease, background 180ms ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

.header-inner {
  width: min(100% - 40px, var(--maxw));
  height: var(--header-h);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-serif);
  font-size: 1.22rem;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.18;
}

.brand-text strong {
  font-family: var(--font-serif);
  font-size: 1.03rem;
  letter-spacing: 0.04em;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.main-nav a {
  position: relative;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.91rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease, background 150ms ease;
}

.main-nav a:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.main-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.icon-btn:active {
  transform: translateY(0);
}

.menu-btn {
  display: none;
}

.reading-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 80ms linear;
}

/* ----------------------------- Layout ----------------------------- */

#main {
  min-height: 70vh;
  outline: none;
}

.page {
  width: min(100% - 40px, var(--maxw));
  margin: 0 auto;
  padding: 54px 0 88px;
}

.page > * {
  animation: rise-in 420ms ease both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.lede {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.04rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 22px;
}

.section-heading h2 {
  margin-bottom: 4px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.home-section {
  margin-top: 58px;
}

.home-faq {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.home-faq details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.home-faq summary {
  padding: 12px 14px;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
}

.home-faq details[open] summary {
  border-bottom: 1px solid var(--line);
}

.home-faq p {
  margin: 0;
  padding: 10px 14px 14px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.75;
}

.seo-fallback {
  padding: 34px 0;
}

.seo-fallback h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3rem);
}

.seo-fallback h2 {
  margin: 28px 0 10px;
  font-size: 1.25rem;
}

.seo-fallback h3 {
  margin: 16px 0 4px;
  font-size: 0.95rem;
}

.seo-fallback ul {
  color: var(--ink-soft);
  line-height: 1.9;
}

.seo-fallback li {
  margin-bottom: 6px;
}

.seo-fallback p {
  color: var(--ink-soft);
  line-height: 1.75;
}

/* ----------------------------- static landing pages ----------------------------- */
.landing-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.landing-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  width: min(100% - 40px, var(--maxw));
  margin: 0 auto;
  padding: 14px 0;
}

.landing-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.landing-nav a {
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
}

.landing-nav a:hover {
  color: var(--accent);
}

.landing-page {
  padding: 34px 0 10px;
}

.landing-hero {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-sm);
}

.landing-hero h1 {
  margin: 4px 0 12px;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.landing-hero .lede {
  max-width: none;
  margin-bottom: 0;
}

.landing-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.landing-stats div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.landing-stats strong {
  display: block;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.4rem;
}

.landing-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.landing-section {
  margin-top: 34px;
}

.landing-section > h2 {
  margin: 0 0 12px;
  font-size: 1.45rem;
}

.landing-chapter-list {
  display: grid;
  gap: 10px;
}

.landing-chapter {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.landing-chapter-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.landing-chapter-head > span {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
}

.landing-chapter h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.landing-chapter p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.7;
}

.landing-chapter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.74rem;
}

.landing-chapter-meta a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.landing-chapter-meta a:hover {
  text-decoration: underline;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.landing-item {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

a.landing-item {
  display: block;
  color: inherit;
  text-decoration: none;
}

a.landing-item:hover {
  border-color: var(--accent);
}

.landing-item strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
}

.landing-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.landing-term-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.landing-term {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.landing-term strong {
  display: block;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.55;
}

.landing-term p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.landing-formula-list {
  margin: 0;
  padding-left: 1.3em;
  color: var(--ink-soft);
  line-height: 1.9;
}

.landing-formula-list code {
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.landing-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

.landing-pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.landing-pager a {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.landing-pager a:hover {
  text-decoration: underline;
}

.landing-list,
.landing-steps {
  margin: 0;
  padding-left: 1.3em;
  color: var(--ink-soft);
  line-height: 1.8;
}

.landing-list li,
.landing-steps li {
  margin-bottom: 7px;
}

.landing-footer {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.landing-footer-inner {
  width: min(100% - 40px, var(--maxw));
  margin: 0 auto;
  padding: 26px 0 22px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

.landing-footer-inner p {
  margin: 0 0 8px;
}

.landing-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 10px 0;
}

.landing-footer-links a {
  color: var(--accent);
  text-decoration: none;
}

.landing-footer-links a:hover {
  text-decoration: underline;
}

.landing-footer-copy {
  font-size: 0.72rem;
}

@media (max-width: 680px) {
  .landing-header-inner,
  .landing-footer-inner {
    width: min(100% - 28px, var(--maxw));
  }

  .landing-hero {
    padding: 20px;
  }

  .landing-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .landing-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .landing-term-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .landing-pager {
    flex-direction: column;
  }
}

.page-head {
  padding: 8px 0 34px;
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  margin: 0 0 12px;
  font-size: clamp(2.2rem, 4.4vw, 3.6rem);
}

.page-head .lede {
  margin-bottom: 0;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.text-link:hover {
  gap: 9px;
}

/* ----------------------------- Hero ----------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 32px 0 30px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40px -10% auto;
  height: 520px;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 92, 92, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 92, 92, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 50% 20%, #000 5%, transparent 70%);
}

[data-theme="dark"] .hero::before {
  background-image:
    linear-gradient(rgba(102, 201, 186, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(102, 201, 186, 0.06) 1px, transparent 1px);
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(390px, 0.72fr);
  gap: 54px;
  align-items: center;
}

.hero-copy h1 {
  margin: 0 0 20px;
  font-size: clamp(2.6rem, 5.4vw, 4.65rem);
  line-height: 1.06;
  letter-spacing: 0.015em;
}

.hero-copy h1 em {
  color: var(--accent);
  font-style: normal;
  position: relative;
  white-space: nowrap;
}

.hero-copy h1 em::after {
  content: "";
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: 0.05em;
  height: 0.12em;
  background: var(--gold);
  opacity: 0.32;
  z-index: -1;
}

.hero-copy .lede {
  font-size: 1.09rem;
  line-height: 1.9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-ink);
  color: #fff;
}

[data-theme="dark"] .btn-primary {
  color: #0d1618;
}

[data-theme="dark"] .btn-primary:hover {
  color: #0d1618;
}

.btn-ghost {
  background: transparent;
  box-shadow: none;
}

.btn-small {
  min-height: 38px;
  padding: 0 15px;
  font-size: 0.84rem;
}

.btn[disabled],
.btn.is-done {
  cursor: default;
  opacity: 0.8;
}

.hero-aside {
  position: relative;
}

.exam-card {
  position: relative;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.exam-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 28px;
  right: 28px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 0 0 3px 3px;
}

.exam-card .eyebrow {
  margin-bottom: 14px;
}

.exam-card h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.exam-card > p {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.exam-meta {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exam-meta li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.exam-meta strong {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.stat {
  padding: 18px 20px;
  background: var(--surface);
}

.stat strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.65rem;
  line-height: 1.2;
  color: var(--ink);
}

.stat span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* ----------------------------- Subject cards ----------------------------- */

.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}

.subject-macro {
  --subject-color: #0f5c5c;
  --subject-soft: #e3efeb;
  --accent: #0f5c5c;
  --accent-ink: #0a4444;
  --accent-soft: #e3efeb;
}

.subject-investment {
  --subject-color: #9a5b2b;
  --subject-soft: #f3e8da;
  --accent: #9a5b2b;
  --accent-ink: #713f1d;
  --accent-soft: #f3e8da;
}

.subject-accounting {
  --subject-color: #3f5d7d;
  --subject-soft: #e4ebf3;
  --accent: #3f5d7d;
  --accent-ink: #2c425b;
  --accent-soft: #e4ebf3;
}

.subject-law {
  --subject-color: #7a3e5c;
  --subject-soft: #f1e5eb;
  --accent: #7a3e5c;
  --accent-ink: #5b2943;
  --accent-soft: #f1e5eb;
}

[data-theme="dark"] .subject-macro {
  --subject-color: #66c9ba;
  --subject-soft: #17302e;
  --accent: #66c9ba;
  --accent-ink: #8ce0d2;
  --accent-soft: #17302e;
}

[data-theme="dark"] .subject-investment {
  --subject-color: #e1b06a;
  --subject-soft: #33261a;
  --accent: #e1b06a;
  --accent-ink: #f0c98b;
  --accent-soft: #33261a;
}

[data-theme="dark"] .subject-accounting {
  --subject-color: #9fc3e8;
  --subject-soft: #1a2b3d;
  --accent: #9fc3e8;
  --accent-ink: #bfd9f4;
  --accent-soft: #1a2b3d;
}

[data-theme="dark"] .subject-law {
  --subject-color: #d79ab8;
  --subject-soft: #34202b;
  --accent: #d79ab8;
  --accent-ink: #efbdd4;
  --accent-soft: #34202b;
}

.subject-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 290px;
  padding: 28px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--subject-color);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.subject-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
  border-top-color: var(--subject-color);
}

.subject-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.subject-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--subject-soft);
  color: var(--subject-color);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.subject-card h2 {
  margin: 0 0 10px;
  font-size: 1.7rem;
}

.subject-card > p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.93rem;
}

.subject-card-list {
  display: grid;
  gap: 7px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.subject-card-list li {
  display: flex;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.subject-card-list li::before {
  content: "·";
  color: var(--subject-color);
  font-weight: 900;
}

.subject-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.subject-card-arrow {
  color: var(--subject-color);
  font-weight: 700;
  font-size: 0.86rem;
}

/* ----------------------------- Progress ----------------------------- */

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-track {
  position: relative;
  width: 120px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-deep);
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--subject-color, var(--accent));
  transition: width 300ms ease;
}

.progress-text {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

/* ----------------------------- How to ----------------------------- */

.howto {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.step-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.step-number {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-serif);
  font-size: 0.9rem;
}

.step-card h3 {
  margin: 0 0 7px;
  font-size: 1.08rem;
}

.step-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ----------------------------- Subject page ----------------------------- */

.subject-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 44px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  padding: 18px 0 40px;
  border-bottom: 1px solid var(--line);
}

.subject-hero > * {
  min-width: 0;
  max-width: 100%;
}

.subject-hero .lede {
  max-width: 100%;
}

.subject-hero .lede .inline-math {
  max-width: 100%;
}

.subject-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2.3rem, 4.6vw, 3.8rem);
}

.subject-hero .lede {
  margin-bottom: 0;
}

.subject-hero-panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--subject-color);
  border-radius: var(--radius);
  background: var(--surface);
}

.subject-hero-panel .progress-wrap {
  margin-bottom: 16px;
}

.subject-hero-panel .progress-track {
  flex: 1;
  width: auto;
}

.subject-hero-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.subject-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.subject-mini-stats strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.25rem;
}

.subject-mini-stats span {
  color: var(--muted);
  font-size: 0.74rem;
}

.ratio-overview {
  min-width: 0;
  margin: 28px 0 8px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.ratio-overview-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.ratio-overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ratio-overview .eyebrow {
  margin-bottom: 5px;
  color: var(--accent);
}

.ratio-overview h2 {
  margin: 0 0 7px;
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
}

.ratio-overview p {
  max-width: 78ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.ratio-groups {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.ratio-group {
  min-width: 0;
}

.ratio-group h3 {
  margin: 0 0 7px;
  color: var(--accent-ink);
  font-size: 0.94rem;
}

.ratio-table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.ratio-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.ratio-table th,
.ratio-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.ratio-table thead th {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.ratio-table tbody th {
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.ratio-table td {
  color: var(--ink-soft);
  line-height: 1.6;
}

.ratio-formula {
  color: var(--accent-ink) !important;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.section-table {
  min-width: 0;
  margin: 18px 0 4px;
}

.section-table-title {
  margin: 0 0 8px;
  color: var(--accent-ink);
  font-size: 0.94rem;
}

.comparison-table {
  min-width: 760px;
}

.comparison-table thead th {
  vertical-align: bottom;
  white-space: normal;
}

.comparison-table tbody th {
  color: var(--accent-ink);
  white-space: normal;
}

.comparison-table tbody td {
  min-width: 110px;
}

.table-mark {
  display: inline-block;
  width: 1.05em;
  margin-right: 5px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  vertical-align: 0.08em;
}

.table-mark.is-negative {
  color: var(--danger);
}

.table-mark.is-positive {
  color: var(--success);
}

.section-table-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.formula-library-block {
  margin-top: 34px;
  min-width: 0;
}

.formula-library-group {
  min-width: 0;
  margin-top: 22px;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.formula-library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}

.formula-library-head h3 {
  margin: 0 0 4px;
  color: var(--accent-ink);
  font-size: 1.02rem;
}

.formula-library-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.formula-library-count {
  flex: 0 0 auto;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.formula-library-table {
  min-width: 820px;
}

.formula-library-table tbody th {
  white-space: normal;
}

.formula-name {
  display: block;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.formula-param,
.formula-vars,
.formula-limit {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.55;
}

.formula-limit {
  color: var(--danger);
}

.formula-library-table .ratio-formula {
  white-space: normal;
}

.formula-library-table .ratio-math {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.formula-library-table .ratio-math::-webkit-scrollbar {
  display: none;
}

.priority-badge.is-a {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.priority-badge.is-b {
  background: var(--gold-soft);
  color: var(--gold);
}

.priority-badge.is-c {
  background: var(--surface-2);
  color: var(--muted);
}

.ratio-math {
  display: inline-block;
  color: var(--accent-ink);
  font-family: var(--font-sans);
}

.ratio-math .katex {
  font-size: 1.04em;
}

.ratio-math .katex-display {
  margin: 0;
}

.ratio-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 0 3px;
  vertical-align: middle;
  line-height: 1.05;
}

.ratio-num {
  padding: 0 3px 1px;
  border-bottom: 1px solid currentColor;
}

.ratio-den {
  padding: 1px 3px 0;
}

.ratio-math sub,
.ratio-math sup {
  font-size: 0.68em;
  line-height: 1;
}

.formula-math {
  white-space: normal;
}

.formula-math .ratio-math {
  font-size: 1rem;
}

.ratio-source {
  color: var(--accent-ink);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.ratio-note,
.ratio-inline-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
}

.ratio-inline {
  margin-top: 18px;
}

.ratio-inline .subheading {
  margin-top: 0;
}

.option-priority {
  min-width: 0;
  margin: 28px 0 8px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.option-priority-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.option-priority .eyebrow {
  margin-bottom: 5px;
  color: var(--gold);
}

.option-priority h2 {
  margin: 0 0 7px;
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
}

.option-priority p {
  max-width: 78ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.priority-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.priority-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.priority-table th,
.priority-table td {
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.priority-table thead th {
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.priority-table tbody td {
  color: var(--ink-soft);
  line-height: 1.6;
}

.priority-table .priority-rank {
  width: 84px;
  color: var(--gold) !important;
  font-family: var(--font-mono);
  font-weight: 800;
}

.option-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 14px;
  margin-top: 16px;
}

.option-card {
  width: 100%;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.option-card.is-lite {
  border-style: dashed;
  background: var(--surface);
}

.option-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.priority-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
}

.option-card h3 {
  margin: 0 0 3px;
  font-size: 1rem;
}

.option-card-goal {
  margin: 0;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
}

.option-card-summary {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.65;
}

.option-definition {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.option-section-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.option-definition p {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.7;
}

.option-definition p:last-child {
  margin-bottom: 0;
}

.option-assumptions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.option-assumptions ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 1.1em;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.65;
}

.option-assumptions li::marker {
  color: var(--gold);
}

.option-formulas {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 8px;
  margin-top: 12px;
}

.option-formula {
  min-width: 0;
  overflow-x: auto;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-deep);
}

.option-formula-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.option-formula .ratio-math {
  font-size: 1rem;
}

.option-variables {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.option-variables-title {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.option-variable-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px 10px;
  margin: 0;
}

.option-variable-list dt {
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: nowrap;
}

.option-variable-list dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.option-note {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.65;
}

.chapter-list {
  display: grid;
  gap: 14px;
  margin-top: 30px;
}

.subject-parts {
  display: grid;
  gap: 34px;
  margin-top: 34px;
}

.part-block {
  display: grid;
  gap: 0;
}

.part-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.part-heading .eyebrow {
  margin-bottom: 4px;
}

.part-heading h2 {
  margin: 0;
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
}

.part-page {
  flex-shrink: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.part-block .chapter-list {
  margin-top: 16px;
}

.subject-chapters-head {
  margin-top: 38px;
  padding-bottom: 4px;
}

.subject-chapters-head .progress-text {
  flex-shrink: 0;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.chapter-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.chapter-row:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}

.chapter-num {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 20px;
  border-right: 1px solid var(--line);
  color: var(--subject-color);
}

.chapter-num strong {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  line-height: 1;
}

.chapter-row h2 {
  margin: 0 0 5px;
  font-size: 1.24rem;
}

.chapter-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.65;
}

.chapter-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  min-width: 165px;
}

.chapter-row-side .section-count {
  color: var(--muted);
  font-size: 0.75rem;
}

.chapter-exam-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
}

.chapter-exam-stat {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: nowrap;
}

.chapter-exam-stat .exam-count,
.chapter-exam-stat .exam-rate {
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.chapter-exam-stat .exam-count {
  color: var(--ink);
}

.chapter-exam-stat .exam-rate {
  color: var(--subject-color, var(--accent));
}

.chapter-exam-sources {
  margin: 18px 0 24px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.chapter-exam-sources-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.chapter-exam-sources-head h2 {
  margin: 3px 0 0;
  font-size: 1.15rem;
}

.chapter-exam-totals {
  display: flex;
  flex-shrink: 0;
  gap: 18px;
}

.chapter-exam-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  line-height: 1.1;
}

.chapter-exam-total strong {
  color: var(--subject-color, var(--accent));
  font-family: var(--font-serif);
  font-size: 1.7rem;
}

.chapter-exam-total span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.chapter-exam-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

.chapter-exam-session-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}

.chapter-exam-session-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.45;
}

.chapter-exam-session-chip strong {
  font-weight: 700;
}

.chapter-exam-session-chip span {
  color: var(--muted);
}

.done-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
}

.done-pill.subtle {
  background: var(--surface-2);
  color: var(--muted);
}

/* ----------------------------- Chapter page ----------------------------- */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 0.82rem;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb span {
  opacity: 0.55;
}

.chapter-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: end;
  min-width: 0;
  max-width: 100%;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.chapter-head > * {
  min-width: 0;
  max-width: 100%;
}

.chapter-head .eyebrow {
  white-space: normal;
}

.chapter-head h1 {
  margin: 0 0 12px;
  font-size: clamp(2.1rem, 4.2vw, 3.4rem);
}

.chapter-head .lede {
  margin-bottom: 0;
}

.chapter-head-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.chapter-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 52px;
  align-items: start;
  margin-top: 38px;
}

.chapter-toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow: auto;
  padding-right: 6px;
  scrollbar-width: thin;
}

.chapter-toc h2 {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.toc-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-list a {
  display: block;
  padding: 8px 12px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.toc-list a:hover {
  color: var(--ink);
  border-left-color: var(--line-strong);
}

.toc-list a.active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.toc-progress {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.toc-progress .progress-track {
  width: 100%;
  margin-bottom: 7px;
}

.chapter-content {
  min-width: 0;
}

.chapter-summary {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.96rem;
}

.chapter-summary strong {
  color: var(--ink);
}

.section-block {
  padding: 36px 0 34px;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.section-block:first-of-type {
  border-top: 0;
  padding-top: 32px;
}

.section-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-kicker::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
}

.section-block h2 {
  margin: 0 0 16px;
  font-size: clamp(1.35rem, 2.2vw, 1.72rem);
}

.section-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.section-body > * {
  min-width: 0;
  max-width: 100%;
}

.section-body p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.9;
}

.subheading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 12px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.subheading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.term-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.term-card {
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.term-card dt {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.5;
}

.term-card dd {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.exam-box {
  margin-top: 22px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 0 12px 12px 0;
  background: var(--gold-soft);
}

.exam-box h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--gold);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.exam-box ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.exam-box li {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.7;
}

.exam-box li::marker {
  color: var(--gold);
}

.memory-card {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 15px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
}

.memory-card .memory-label {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.memory-card p {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.65;
}

.formula {
  display: block;
  margin-top: 16px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.7;
  white-space: nowrap;
}

.formula::before {
  content: "KEY FORMULA  ";
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.formula-katex {
  font-family: var(--font-sans);
  font-size: 1rem;
  white-space: normal;
}

/* KaTeX 全站基準：未包裝的公式也使用與正文一致的字級，
   避免部分區塊吃到 KaTeX 預設 1.21em 而讓下標相對變大。 */
.katex {
  font-size: 1em;
}

.inline-math .katex {
  font-size: 1.06em;
}

.inline-math:not(.is-display) {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  vertical-align: middle;
}

.inline-math:not(.is-display)::-webkit-scrollbar {
  display: none;
}

.inline-math.is-display {
  display: block;
  margin: 0.5em 0;
}

.formula-katex .katex-display {
  margin: 0;
  padding: 2px 0;
}

.formula-katex .katex {
  font-size: 1.04em;
}

.formula-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
  white-space: normal;
}

.katex-fallback {
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  white-space: pre-wrap;
}

.model-diagram {
  margin: 22px 0 4px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.diagram-head {
  margin-bottom: 12px;
}

.diagram-kicker {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.diagram-head h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.08rem;
  line-height: 1.5;
}

.diagram-layout.is-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.diagram-visual,
.diagram-side {
  min-width: 0;
}

.diagram-side .diagram-table {
  max-height: 100%;
}

.diagram-side .diagram-table table {
  font-size: 0.8rem;
}

.diagram-side .diagram-table th,
.diagram-side .diagram-table td {
  padding: 7px 9px;
}

.diagram-canvas {
  padding: 10px 8px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.diagram-canvas::-webkit-scrollbar {
  height: 8px;
}

.diagram-canvas::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line-strong);
}

.diagram-canvas::-webkit-scrollbar-track {
  background: transparent;
}

.diagram-scroll-hint {
  display: none;
}

.diagram-canvas svg {
  width: 100%;
  height: auto;
}

.model-diagram figcaption {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.75;
}

.diagram-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-deep);
  overflow-x: auto;
}

.diagram-formula-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.diagram-formula .ratio-math {
  min-width: 0;
  font-size: 0.95rem;
  white-space: normal;
}

.diagram-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.diagram-table {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.diagram-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.diagram-table caption {
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
}

.diagram-table th,
.diagram-table td {
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.diagram-table th {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.diagram-table td {
  color: var(--ink-soft);
  line-height: 1.6;
}

.diagram-table .diagram-symbol {
  color: var(--accent-ink);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.diagram-note {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

/* ----------------------------- Macro model atlas ----------------------------- */

.model-atlas {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin: 26px 0 4px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.model-atlas .eyebrow {
  margin-bottom: 5px;
  color: var(--accent);
}

.model-atlas h2 {
  margin: 0 0 7px;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
}

.model-atlas p {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.model-atlas .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.model-atlas-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
}

.models-head {
  align-items: start;
}

.models-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.models-summary span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
}

.models-summary strong {
  color: var(--accent-ink);
  font-family: var(--font-serif);
  font-size: 0.96rem;
}

.models-binding {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.models-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.models-jump .eyebrow {
  flex: 1 0 100%;
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
}

.models-jump a {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.models-jump a span {
  color: var(--muted);
  font-size: 0.68rem;
}

.models-jump a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.models-jump a.is-empty {
  opacity: 0.62;
}

.models-list {
  margin-top: 26px;
}

.models-chapter {
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.models-chapter-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.models-chapter-head .eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
}

.models-chapter-head h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 1.9rem);
}

.models-chapter-side {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.models-badge {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.7rem;
  font-weight: 700;
}

.models-entry + .models-entry {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px dashed var(--line);
}

.models-entry-ref {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 9px;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.models-entry-ref .eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
}

.models-entry-ref a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted var(--line-strong);
}

.models-entry-ref a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.models-entry .model-diagram {
  margin-top: 10px;
}

.models-empty {
  margin: 8px 0 0;
  padding: 20px 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.9rem;
}

.models-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.models-foot p {
  margin: 0;
}

.models-foot a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.models-foot a:hover {
  text-decoration: underline;
}

.models-nobel {
  margin-top: 34px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.models-nobel-intro {
  max-width: 78ch;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.75;
}

.nobel-entry-years {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
}

/* ----------------------------- Nobel laureates page ----------------------------- */

.nobel-head {
  align-items: start;
}

.nobel-page .chapter-head-side .btn {
  white-space: nowrap;
}

.nobel-source-note {
  border-left-color: var(--gold);
  background: var(--surface-2);
  color: var(--ink-soft);
}

.nobel-source-note a {
  color: var(--accent);
  font-weight: 700;
}

.nobel-formula-note {
  border-left-color: var(--line-strong);
  background: var(--surface);
}

.nobel-table-section {
  margin-top: 34px;
}

.nobel-section-heading {
  align-items: end;
  margin-bottom: 12px;
}

.nobel-section-heading .eyebrow {
  margin-bottom: 4px;
  color: var(--gold);
}

.nobel-table-hint {
  max-width: 420px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
  text-align: right;
}

.nobel-group-anchor {
  display: block;
  height: 0;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.nobel-year-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 7px;
}

.nobel-year-sequence {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.nobel-year-group-label {
  margin: 0 0 13px;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.55;
}

.nobel-entry-fields {
  display: grid;
  gap: 9px;
  margin: 0;
}

.nobel-entry-fields > div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 9px;
}

.nobel-entry-fields dt {
  padding-top: 2px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.5;
}

.nobel-entry-fields dd {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.nobel-year-link,
.nobel-year-chip {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.nobel-year-link {
  display: inline-flex;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 1rem;
}

.nobel-year-link:hover,
.nobel-year-chip:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  text-decoration: underline;
}

.nobel-laureates {
  color: var(--ink) !important;
  font-weight: 650;
}

.nobel-formula {
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.79rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.nobel-formula sub,
.nobel-formula sup,
.nobel-inline-math sub,
.nobel-inline-math sup,
.ratio-math sub,
.ratio-math sup {
  font-size: 0.68em;
  line-height: 1;
}

.ratio-math sub {
  display: inline-block;
  vertical-align: baseline;
  transform: translateY(0.35em);
}

.ratio-math sup {
  display: inline-block;
  vertical-align: baseline;
  transform: translateY(-0.45em);
}

.nobel-inline-math {
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 1em;
  white-space: nowrap;
}

.nobel-year-figure {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.nobel-year-model-head {
  margin-bottom: 9px;
}

.nobel-year-model-head .eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.64rem;
}

.nobel-year-model-head h3 {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.45;
}

.nobel-group-description {
  max-width: 78ch;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.7;
}

.nobel-year-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 11px;
}

.nobel-year-chip {
  display: inline-flex;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.nobel-year-chip.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.nobel-year-canvas {
  padding: 10px 10px 6px;
}

.nobel-year-figure figcaption {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.7;
}

.nobel-model-details {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.nobel-model-details summary {
  padding: 9px 12px;
  color: var(--accent-ink);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.nobel-model-details[open] summary {
  border-bottom: 1px solid var(--line);
}

.nobel-model-details .diagram-tables {
  margin-top: 0;
  padding: 12px;
}

.nobel-model-details .diagram-note {
  margin: 0;
  border-radius: 0;
}

/* 17 組模型：每組左右 1:1；左方屆別資料與模型圖，右方圖說與變數表。 */
.nobel-year-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.nobel-year-jump-label {
  flex: 0 0 auto;
  min-width: 0;
  cursor: pointer;
}

.nobel-year-jump-label .eyebrow {
  display: block;
  margin: 0 0 3px;
  color: var(--gold);
  font-size: 0.62rem;
}

.nobel-year-jump-label strong {
  display: block;
  font-size: 0.92rem;
}

.nobel-year-jump-field {
  display: flex;
  flex: 1 1 320px;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.nobel-year-jump select {
  flex: 0 1 460px;
  min-width: 0;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.nobel-year-jump select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nobel-year-jump-hint {
  flex: 1 1 220px;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.nobel-year-list {
  display: grid;
  gap: 18px;
}

.nobel-year-list-caption {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.65;
}

.nobel-module {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.nobel-module-figure {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "main caption"
    "main side";
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  align-items: start;
  gap: 12px 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.nobel-year-model-main {
  grid-area: main;
  min-width: 0;
}

.nobel-year-model-side {
  grid-area: side;
  min-width: 0;
}

.nobel-module-figure > figcaption {
  grid-area: caption;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.75;
}

.nobel-year-model-side .nobel-model-details {
  margin-top: 0;
  background: var(--surface-2);
}

.nobel-year-model-side .diagram-tables {
  grid-template-columns: minmax(0, 1fr);
  margin-top: 0;
  padding: 12px;
}

.nobel-module .nobel-year-data {
  position: relative;
  padding: 14px 15px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.nobel-year-data-body {
  min-width: 0;
}

.nobel-module .nobel-year-canvas {
  margin-top: 12px;
}

.nobel-year-chip {
  cursor: pointer;
  line-height: 1.4;
}

.nobel-year-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .nobel-module-figure {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "main"
      "caption"
      "side";
    grid-template-rows: auto auto auto;
    align-content: start;
    gap: 16px;
  }
}

@media (max-width: 680px) {
  .nobel-year-list {
    gap: 14px;
  }

  .nobel-module {
    padding: 14px;
  }

  .nobel-year-jump {
    padding: 12px 14px;
  }

  .nobel-year-jump-field {
    flex-basis: 100%;
  }

  .nobel-year-jump select {
    flex: 1 1 100%;
    width: 100%;
  }

  .nobel-year-jump-label strong {
    font-size: 0.86rem;
  }
}

.nobel-model-jump {
  margin-top: 0;
  margin-bottom: 14px;
}

.model-diagram svg .dg-axis {
  stroke: var(--ink-soft);
  stroke-width: 1.6;
}

.model-diagram svg .dg-curve {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
}

.model-diagram svg .dg-curve-alt {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.6;
}

.model-diagram svg .dg-curve-soft {
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-dasharray: 7 6;
}

.model-diagram svg .dg-guide {
  stroke: var(--line-strong);
  stroke-width: 1.3;
  stroke-dasharray: 5 5;
}

.model-diagram svg .dg-arrow {
  stroke: var(--danger);
  stroke-width: 2;
  fill: none;
}

.model-diagram svg .dg-arrow-head {
  fill: var(--danger);
}

.model-diagram svg .dg-point {
  fill: var(--accent-ink);
}

.model-diagram svg .dg-box,
.model-diagram svg .dg-panel {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1.4;
}

.model-diagram svg .dg-panel {
  fill: var(--surface-2);
  stroke: var(--line);
}

.model-diagram svg .dg-box-accent {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 1.8;
}

.model-diagram svg .dg-box-outcome {
  fill: var(--gold-soft);
  stroke: var(--gold);
  stroke-width: 1.8;
}

.model-diagram svg .dg-label {
  fill: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 15px;
}

.model-diagram svg .dg-label-strong {
  fill: var(--ink);
  font-weight: 700;
}

.model-diagram svg .dg-label-sm {
  fill: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
}

.model-diagram svg .dg-label-xs {
  fill: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
}

.model-diagram svg .dg-label-adjust {
  fill: var(--gold);
  font-weight: 700;
}

.model-diagram svg .dg-label-plus {
  fill: var(--accent);
  font-weight: 700;
}

.model-diagram svg .dg-label-minus {
  fill: var(--danger);
  font-weight: 700;
}

.model-diagram svg .dg-operator {
  fill: var(--ink);
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 700;
}

[data-theme="light"] .model-diagram svg .dg-label-sm,
[data-theme="light"] .model-diagram svg .dg-label-xs {
  fill: #55666a;
}

[data-theme="light"] .model-diagram svg .dg-label-adjust {
  fill: var(--gold);
}

.law-fulltext {
  margin-top: 8px;
}

.law-fulltext-note {
  max-width: 850px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.8;
}

.law-source-list,
.law-external-list {
  display: grid;
  gap: 14px;
}

.law-source {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.law-source-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 16px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.law-source-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.law-source-badge.is-external {
  background: var(--gold-soft);
  color: var(--gold);
}

.law-source-title {
  flex: 1 1 240px;
  min-width: 0;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.5;
}

.law-source-count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  white-space: nowrap;
}

.law-source-body {
  padding: 0 18px 18px;
}

.law-source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 12px 0 10px;
  color: var(--muted);
  font-size: 0.74rem;
}

.law-source-meta a {
  color: var(--accent-ink);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.law-article-list {
  border-top: 1px solid var(--line);
}

.law-chapter-heading {
  margin: 16px 0 4px;
  padding: 7px 10px;
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  color: var(--ink-soft);
  font-size: 0.84rem;
  letter-spacing: 0.04em;
}

.law-article {
  display: grid;
  grid-template-columns: 6.8em minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.law-article:last-child {
  border-bottom: 0;
}

.law-article-no {
  padding-top: 2px;
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.7;
}

.law-article-text {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.95;
  white-space: pre-wrap;
}

.law-empty-note {
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.law-external-card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 0 12px 12px 0;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.law-external-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 8px;
}

.law-external-head h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
}

.law-external-card p {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.8;
}

.law-external-note {
  color: var(--muted) !important;
  font-size: 0.76rem !important;
}

.law-external-link {
  display: inline-block;
  margin-top: 2px;
  color: var(--accent-ink);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.chapter-refs {
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.chapter-refs h2 {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ref-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ref-list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.84rem;
}

.ref-list li::before {
  content: "↗";
  color: var(--accent);
  font-size: 0.8rem;
}

.ref-list a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.ref-list a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.chapter-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 34px;
}

.chapter-nav a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 150ms ease, transform 150ms ease;
}

.chapter-nav a:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  color: var(--ink);
}

.chapter-nav small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chapter-nav strong {
  font-family: var(--font-serif);
  font-size: 1rem;
}

.chapter-nav a.next {
  text-align: right;
  align-items: flex-end;
}

.chapter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

/* ----------------------------- Sources / about ----------------------------- */

.source-group {
  margin-top: 30px;
}

.source-group h2 {
  margin-bottom: 12px;
  font-size: 1.35rem;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-item {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.source-item a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.source-item a:hover {
  color: var(--accent);
}

.source-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.65;
}

.source-item .source-domain {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.notice {
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 0 12px 12px 0;
  background: var(--gold-soft);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.notice strong {
  color: var(--ink);
}

.prose {
  max-width: 780px;
}

.prose h2 {
  margin-top: 34px;
  margin-bottom: 10px;
}

.prose h3 {
  margin-top: 24px;
  margin-bottom: 8px;
}

.prose p,
.prose li {
  font-size: 0.97rem;
}

.prose ul,
.prose ol {
  padding-left: 22px;
}

.prose li {
  margin-bottom: 6px;
}

.prose li::marker {
  color: var(--accent);
}

/* ----------------------------- Search ----------------------------- */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: start center;
  padding: 10vh 20px 20px;
  background: rgba(13, 22, 24, 0.55);
  backdrop-filter: blur(6px);
}

.search-overlay[hidden] {
  display: none;
}

.search-panel {
  width: min(100%, 680px);
  max-height: 78vh;
  overflow: auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: rise-in 220ms ease both;
}

.search-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.search-head h2 {
  margin: 0;
  font-size: 1.5rem;
}

.search-panel input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
}

.search-panel input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.search-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.search-results {
  display: grid;
  gap: 5px;
  margin-top: 16px;
}

.search-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.search-result:hover,
.search-result.is-active {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.result-type {
  min-width: 44px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.64rem;
  font-weight: 800;
  text-align: center;
}

.result-type.term {
  background: var(--gold-soft);
  color: var(--gold);
}

.search-result strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.5;
}

.search-result small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.search-result .result-arrow {
  color: var(--muted);
  font-size: 0.9rem;
}

.search-empty {
  padding: 26px 10px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.search-group-label {
  margin: 14px 2px 4px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.footer-inner {
  width: min(100% - 40px, var(--maxw));
  margin: 0 auto;
  padding: 38px 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
}

.footer-brand {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 0.9rem;
}

.footer-note {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-content: start;
  justify-content: flex-end;
}

.footer-links a {
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-static-links {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.9;
}

.footer-static-links a {
  margin-left: 10px;
  color: var(--accent);
  text-decoration: none;
}

.footer-static-links a:first-of-type {
  margin-left: 6px;
}

.footer-static-links a:hover {
  text-decoration: underline;
}

.footer-copy {
  width: min(100% - 40px, var(--maxw));
  margin: 0 auto;
  padding: 16px 0 26px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 400;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

@media (max-width: 980px) {
  .hero-grid,
  .subject-hero {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .hero-aside {
    max-width: 560px;
  }

  .chapter-layout {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 32px;
  }

  .subject-grid {
    grid-template-columns: 1fr;
  }

  .subject-card {
    min-height: auto;
  }

  .nobel-entry-fields > div {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .nobel-year-canvas {
    overflow-x: auto;
  }
}

@media (max-width: 780px) {
  :root {
    --header-h: 64px;
  }

  .header-inner {
    width: min(100% - 28px, var(--maxw));
    gap: 12px;
  }

  .brand-text small {
    display: none;
  }

  .main-nav {
    position: absolute;
    top: calc(var(--header-h) - 1px);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin: 0;
    padding: 10px 14px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-md);
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav a {
    padding: 11px 12px;
    border-radius: 8px;
  }

  .menu-btn {
    display: grid;
  }

  .hero {
    padding-top: 18px;
  }

  .hero-copy h1 {
    font-size: clamp(2.1rem, 9vw, 3.2rem);
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 28px;
  }

  .hero-grid {
    gap: 24px;
  }

  .page {
    width: min(100% - 28px, var(--maxw));
    padding-top: 34px;
    padding-bottom: 62px;
  }

  .subject-hero {
    padding-bottom: 28px;
  }

  .home-section {
    margin-top: 42px;
  }

  .page-head {
    padding-bottom: 26px;
  }

  .subject-chapters-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-top: 30px;
  }

  .part-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .chapter-row {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 16px;
    padding: 18px;
  }

  .chapter-row-side {
    grid-column: 2;
    flex-wrap: wrap;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px 12px;
    min-width: 0;
    margin-top: 2px;
  }

  .chapter-exam-stats {
    flex-direction: column;
    align-items: flex-start;
    width: auto;
    gap: 2px;
  }

  .chapter-exam-stat {
    white-space: normal;
  }

  .chapter-num {
    padding-right: 12px;
  }

  .chapter-num strong {
    font-size: 1.55rem;
  }

  .chapter-head {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .chapter-head-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .model-atlas {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .model-atlas .btn {
    width: 100%;
    justify-content: center;
  }

  .model-atlas-actions {
    flex-direction: column;
    width: 100%;
  }

  .nobel-head .chapter-head-side {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .nobel-section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .nobel-table-hint {
    max-width: none;
    text-align: left;
  }

  .models-chapter-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .models-chapter-side {
    justify-content: space-between;
    width: 100%;
  }

  .chapter-layout {
    grid-template-columns: 1fr;
    gap: 22px;
    margin-top: 26px;
  }

  .chapter-toc {
    position: relative;
    top: auto;
    max-height: none;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
  }

  .chapter-toc h2 {
    margin-bottom: 8px;
  }

  .toc-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .toc-list a {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.78rem;
  }

  .toc-list a.active {
    border-color: var(--accent);
  }

  .toc-progress {
    display: none;
  }

  .term-grid,
  .source-list {
    grid-template-columns: 1fr;
  }

  .howto {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 18px;
    padding-top: 30px;
  }

  .footer-links {
    justify-content: flex-start;
  }

  .chapter-nav {
    grid-template-columns: 1fr;
  }

  .chapter-nav a.next {
    text-align: left;
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .header-actions {
    gap: 4px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-text strong {
    font-size: 0.94rem;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
  }

  .exam-card {
    padding: 22px;
  }

  .subject-card {
    padding: 22px;
  }

  .chapter-head h1 {
    font-size: 2rem;
  }

  .models-head h1 {
    font-size: 1.95rem;
  }

  .models-summary span {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  .models-jump {
    padding: 14px;
  }

  .models-jump a {
    font-size: 0.74rem;
  }

  .chapter-summary {
    padding: 18px;
  }

  .section-block {
    padding: 28px 0;
  }

  .memory-card {
    flex-direction: column;
    gap: 8px;
  }

  .search-overlay {
    padding: 4vh 10px 10px;
  }

  .search-panel {
    padding: 20px;
  }

  .search-result {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .result-arrow {
    display: none;
  }
}

@media (max-width: 900px) {
  .diagram-layout.is-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .diagram-side {
    order: 2;
  }
}

@media (max-width: 680px) {
  .model-diagram {
    padding: 14px 12px 12px;
  }

  .diagram-tables {
    grid-template-columns: 1fr;
  }

  .diagram-canvas {
    overflow-x: auto;
  }

  .diagram-canvas svg {
    min-width: 460px;
  }

  .diagram-scroll-hint {
    display: block;
    margin: 8px 2px 0;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.5;
    text-align: right;
  }

  .ratio-overview {
    padding: 16px 14px;
  }

  .ratio-overview-head {
    display: block;
  }

  .ratio-overview-head .btn {
    margin-top: 12px;
  }

  .ratio-overview-actions {
    margin-top: 12px;
  }

  .ratio-table {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
  }

  .ratio-table thead {
    display: none;
  }

  .ratio-table,
  .ratio-table tbody,
  .ratio-table tr,
  .ratio-table th,
  .ratio-table td {
    display: block;
    width: 100%;
  }

  .ratio-table tr {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
  }

  .ratio-table tr:first-child {
    border-top: 0;
  }

  .ratio-table tbody th {
    padding: 0 0 4px;
    border: 0;
    font-size: 0.9rem;
    white-space: normal;
  }

  .ratio-table tbody td {
    padding: 2px 0;
    border: 0;
    white-space: normal;
  }

  .ratio-table tbody td::before {
    content: attr(data-label) "：";
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
  }

  .ratio-table .ratio-formula {
    white-space: normal;
  }

  .ratio-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .formula-library-head {
    display: block;
  }

  .formula-library-count {
    display: inline-block;
    margin-top: 8px;
  }

  .formula-library-table {
    min-width: 0;
  }

  .formula-library-table .ratio-math {
    white-space: normal;
  }

  .option-priority {
    padding: 16px 14px;
  }

  .option-priority-head {
    display: block;
  }

  .option-priority-head .btn {
    margin-top: 12px;
  }

  .priority-table {
    font-size: 0.8rem;
  }

  .priority-table th,
  .priority-table td {
    padding: 8px 9px;
  }

  .law-source-head {
    align-items: flex-start;
    padding: 14px;
  }

  .law-source-title {
    flex-basis: calc(100% - 80px);
    font-size: 0.88rem;
  }

  .law-source-count {
    width: 100%;
    padding-left: 2px;
  }

  .law-source-body {
    padding: 0 12px 12px;
  }

  .law-source-meta {
    display: grid;
    gap: 4px;
  }

  .law-chapter-heading {
    padding: 7px 8px;
    font-size: 0.8rem;
  }

  .law-article {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 12px 0;
  }

  .law-article-no {
    padding-top: 0;
    font-size: 0.72rem;
  }

  .law-article-text {
    font-size: 0.86rem;
  }

  .law-external-card {
    padding: 15px 14px;
  }

}

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

@media print {
  .site-header,
  .site-footer,
  .search-overlay,
  .chapter-toc,
  .chapter-actions,
  .chapter-nav,
  .model-atlas,
  .models-jump,
  .models-foot,
  .models-head .chapter-head-side,
  .nobel-head .chapter-head-side,
  .nobel-table-hint,
  .nobel-formula-note,
  .toast {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .page {
    width: 100%;
    padding: 0;
  }

  .chapter-layout {
    display: block;
  }

  .section-block {
    break-inside: avoid;
  }

  .term-card,
  .exam-box,
  .memory-card,
  .model-diagram,
  .nobel-module,
  .models-entry,
  .chapter-summary {
    break-inside: avoid;
  }

  .diagram-scroll-hint {
    display: none !important;
  }

  .diagram-canvas {
    overflow: visible;
  }

  .diagram-canvas svg {
    min-width: 0;
  }

  .nobel-year-figure {
    break-inside: avoid;
  }
}

/* ----------------------------- Macro school evolution ----------------------------- */

.macro-evolution {
  position: relative;
  margin: 30px 0 10px;
  padding: 26px 26px 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 38%);
  box-shadow: var(--shadow-sm);
}

.macro-evolution::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent));
  content: "";
  opacity: 0.8;
}

.macro-evolution-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.macro-evolution-intro {
  min-width: 0;
}

.macro-evolution .eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
}

.macro-evolution h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
}

.macro-evolution-intro > p:last-child {
  max-width: 75ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.evolution-meta {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 290px;
}

.evolution-meta span {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.evolution-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 16px 0 20px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.7rem;
}

.evolution-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-school {
  background: var(--accent);
}

.legend-model {
  border-radius: 2px;
  background: var(--accent-ink);
}

.legend-nobel {
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-soft);
}

.evolution-track {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.evolution-track::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 110px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--gold));
  content: "";
  opacity: 0.35;
}

.evolution-stage {
  position: relative;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  column-gap: 28px;
  padding-bottom: 26px;
}

.evolution-stage:last-child {
  padding-bottom: 0;
}

.evolution-stage::before {
  position: absolute;
  top: 8px;
  left: 110px;
  z-index: 1;
  width: 12px;
  height: 12px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
  content: "";
  transform: translateX(-50%);
}

.evolution-marker {
  padding-top: 1px;
  padding-right: 15px;
  text-align: right;
}

.evolution-year {
  display: block;
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.evolution-period {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.evolution-stage-body {
  min-width: 0;
}

.evolution-stage-head {
  margin-bottom: 12px;
}

.evolution-stage-index {
  display: inline-block;
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.evolution-stage-head h3 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.22rem);
}

.evolution-stage-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.evolution-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  align-items: start;
}

.evolution-card {
  position: relative;
  min-width: 0;
  padding: 17px 17px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.evolution-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  content: "";
  opacity: 0.65;
}

.evolution-card-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.evolution-card-index {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.evolution-card-title {
  min-width: 0;
}

.evolution-card-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  margin-bottom: 1px;
}

.evolution-kind {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.evolution-card-period {
  color: var(--muted);
  font-size: 0.66rem;
}

.evolution-card-title h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
}

.evolution-card-en {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.evolution-founders {
  margin: 11px 0 8px;
  padding: 7px 9px;
  border-left: 3px solid var(--gold);
  border-radius: 0 7px 7px 0;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.evolution-founders span {
  display: inline-block;
  margin-right: 6px;
  color: var(--gold);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.evolution-summary {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.7;
}

.evolution-models,
.evolution-nobels {
  margin-top: 12px;
}

.evolution-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.evolution-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.evolution-model-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  line-height: 1.35;
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.evolution-model-chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.evolution-model-name {
  font-size: 0.78rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.evolution-nobel-list {
  display: grid;
  gap: 6px;
}

.evolution-nobel-chip {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  background: var(--gold-soft);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.evolution-nobel-chip:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.evolution-nobel-year {
  color: var(--gold);
  font-family: var(--font-serif);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
}

.evolution-nobel-body {
  min-width: 0;
}

.evolution-nobel-name {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.evolution-nobel-field {
  display: block;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.4;
}

.evolution-card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 13px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.evolution-card-foot a {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  text-decoration: none;
}

.evolution-card-foot a:hover {
  text-decoration: underline;
}

.evolution-note {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.65;
}

.evolution-note strong {
  color: var(--ink-soft);
}

.evolution-note a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.models-entry {
  position: relative;
}

.models-entry.is-targeted::before {
  position: absolute;
  inset: -10px -8px;
  z-index: 2;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 0 0 4px var(--accent-soft);
  content: "";
  pointer-events: none;
  animation: model-target-fade 2.6s ease-out forwards;
}

@keyframes model-target-fade {
  0%,
  65% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .macro-evolution-head {
    display: block;
  }

  .evolution-meta {
    justify-content: flex-start;
    max-width: none;
    margin-top: 10px;
  }
}

@media (max-width: 780px) {
  .macro-evolution {
    padding: 20px 18px 18px;
  }

  .evolution-track::before {
    top: 8px;
    bottom: 8px;
    left: 7px;
  }

  .evolution-stage {
    grid-template-columns: 1fr;
    column-gap: 0;
    padding-bottom: 22px;
    padding-left: 26px;
  }

  .evolution-stage::before {
    top: 7px;
    left: 7px;
  }

  .evolution-marker {
    margin-bottom: 8px;
    text-align: left;
  }

  .evolution-year {
    font-size: 1.15rem;
  }

  .evolution-period {
    display: inline-block;
    margin-top: 0;
    margin-left: 7px;
  }

  .evolution-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .macro-evolution {
    margin-top: 22px;
    padding: 17px 13px 15px;
    border-radius: var(--radius);
  }

  .macro-evolution h2 {
    font-size: 1.35rem;
  }

  .evolution-legend {
    gap: 7px 12px;
    padding: 7px 0;
  }

  .evolution-card {
    padding: 14px 13px 12px;
  }

  .evolution-card-head {
    gap: 9px;
  }

  .evolution-card-index {
    width: 28px;
    height: 28px;
  }

  .evolution-nobel-chip {
    grid-template-columns: 38px minmax(0, 1fr);
  }
}

/* ----------------------------- Past exam practice ----------------------------- */

.past-exam-page {
  padding-top: 36px;
}

.past-exam-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 38px;
  align-items: center;
  padding: 18px 0 36px;
  border-bottom: 1px solid var(--line);
}

.past-exam-hero-copy h1 {
  margin: 0 0 16px;
  font-size: clamp(2.5rem, 5vw, 4.2rem);
  line-height: 1.06;
}

.past-exam-hero-copy .lede {
  margin-bottom: 0;
}

.past-exam-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.past-exam-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.past-exam-stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.past-exam-stat strong {
  display: block;
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 1.6rem;
  line-height: 1.1;
}

.past-exam-stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.past-exam-filter-shell {
  margin-top: 28px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.past-exam-filter-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.past-exam-filter-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.past-exam-filter-row:last-of-type {
  padding-bottom: 0;
}

.past-exam-filter-label {
  flex: 0 0 52px;
  padding-top: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.past-exam-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.past-exam-chip {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.past-exam-chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.past-exam-chip.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .past-exam-chip.is-active {
  color: #0d1618;
}

.past-exam-session-tools {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.past-exam-select,
.past-exam-search {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
}

.past-exam-select {
  min-width: 190px;
}

.past-exam-search-wrap {
  flex: 1;
  min-width: 190px;
}

.past-exam-search {
  width: 100%;
}

.past-exam-filter-summary {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.past-exam-filter-summary strong {
  color: var(--ink);
}

.past-exam-panel {
  margin-top: 26px;
}

.past-exam-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.past-exam-mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.past-exam-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.past-exam-score {
  color: var(--muted);
  font-size: 0.8rem;
}

.past-exam-score strong {
  color: var(--ink);
}

.past-exam-origin {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  margin: 12px 0 16px;
  padding: 9px 12px;
  border-left: 3px solid var(--subject-color, var(--accent));
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.55;
}

.past-exam-origin-label {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.past-exam-origin a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.past-exam-origin a:hover {
  text-decoration: underline;
}

.past-exam-origin-sep {
  color: var(--muted);
}

.past-exam-origin-meta {
  min-width: 0;
  overflow-wrap: anywhere;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.past-exam-origin.is-unclassified {
  border-left-color: var(--danger);
}

.past-exam-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.past-exam-card-head {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.past-exam-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid var(--subject-color, var(--line));
  border-radius: 999px;
  background: var(--subject-soft, var(--surface-2));
  color: var(--subject-color, var(--ink));
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.past-exam-progress-text {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.past-exam-progress {
  height: 5px;
  margin: 16px 0 22px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-deep);
}

.past-exam-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 180ms ease;
}

.past-exam-stem {
  margin: 0 0 20px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: clamp(1.08rem, 2vw, 1.3rem);
  font-weight: 700;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.past-exam-options {
  display: grid;
  gap: 10px;
}

.past-exam-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.94rem;
  line-height: 1.7;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.past-exam-option:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.past-exam-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.past-exam-option.is-correct {
  border-color: #2f7d5c;
  background: #e6f3ea;
  color: #174b35;
}

.past-exam-option.is-wrong {
  border-color: var(--danger);
  background: #f8e7e4;
  color: #6e2b24;
}

[data-theme="dark"] .past-exam-option.is-correct {
  border-color: #4f9d77;
  background: #17352a;
  color: #b9e8cd;
}

[data-theme="dark"] .past-exam-option.is-wrong {
  border-color: #b45a50;
  background: #3a1d1b;
  color: #f0b7b0;
}

.past-exam-option-letter {
  display: inline-grid;
  flex: 0 0 28px;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.past-exam-option.is-selected .past-exam-option-letter {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.past-exam-option.is-correct .past-exam-option-letter {
  border-color: #2f7d5c;
  background: #2f7d5c;
  color: #fff;
}

.past-exam-option.is-wrong .past-exam-option-letter {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.past-exam-option-text {
  min-width: 0;
}

.past-exam-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-top: 18px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 0 12px 12px 0;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.past-exam-feedback.is-correct {
  border-left-color: #2f7d5c;
  background: #eef7f1;
}

.past-exam-feedback.is-wrong {
  border-left-color: var(--danger);
  background: #fbf0ee;
}

[data-theme="dark"] .past-exam-feedback.is-correct {
  background: #162a22;
}

[data-theme="dark"] .past-exam-feedback.is-wrong {
  background: #2a1a18;
}

.past-exam-feedback strong {
  color: var(--ink);
}

.past-exam-feedback-note {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.8rem;
}

.past-exam-analysis {
  min-width: 0;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.past-exam-analysis-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.past-exam-analysis-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  letter-spacing: 0.03em;
}

.past-exam-analysis-head span {
  color: var(--muted);
  font-size: 0.72rem;
}

.past-exam-analysis-summary {
  margin: 0;
  padding: 13px 16px;
  border-bottom: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.75;
}

.past-exam-analysis-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.past-exam-analysis-list li {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px dashed var(--line);
}

.past-exam-analysis-list li:first-child {
  border-top: 0;
}

.past-exam-analysis-list li.is-correct {
  background: #eef7f1;
}

[data-theme="dark"] .past-exam-analysis-list li.is-correct {
  background: #162a22;
}

.past-exam-analysis-letter {
  display: inline-flex;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.past-exam-analysis-list li.is-correct .past-exam-analysis-letter {
  background: #2f7d5c;
  color: #fff;
}

.past-exam-analysis-body {
  min-width: 0;
}

.past-exam-analysis-tag {
  display: inline-block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.past-exam-analysis-list li.is-correct .past-exam-analysis-tag {
  color: #2f7d5c;
}

[data-theme="dark"] .past-exam-analysis-list li.is-correct .past-exam-analysis-tag {
  color: #8dd6b1;
}

.past-exam-analysis-body p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.past-exam-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.past-exam-source-links {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}

.past-exam-source-links a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.past-exam-source-links a:hover {
  text-decoration: underline;
}

.past-exam-browse-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.past-exam-browse-card {
  min-width: 0;
  width: 100%;
  padding: 22px;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.past-exam-browse-stem {
  margin: 14px 0 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.past-exam-browse-options {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.past-exam-browse-options li {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.past-exam-browse-options li.is-correct {
  background: #e6f3ea;
  color: #174b35;
  box-shadow: inset 0 0 0 1px #2f7d5c;
}

[data-theme="dark"] .past-exam-browse-options li.is-correct {
  background: #17352a;
  color: #b9e8cd;
}

.past-exam-browse-answer {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.86rem;
}

.past-exam-browse-answer span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.past-exam-browse-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 14px;
}

.past-exam-browse-actions .past-exam-source-links {
  flex: 1;
  min-width: 180px;
  margin: 0;
  padding: 0;
  border: 0;
}

.past-exam-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.82rem;
}

.past-exam-browse-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.past-exam-empty {
  padding: 42px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.past-exam-empty h2 {
  margin-top: 0;
}

.past-exam-empty p {
  color: var(--muted);
}

.past-exam-overview {
  margin-top: 48px;
}

.past-exam-year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.past-exam-year-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.past-exam-year-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.past-exam-year-label {
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
}

.past-exam-year-card strong {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.5rem;
}

.past-exam-year-card > span:not(.past-exam-year-label):not(.past-exam-year-counts) {
  color: var(--muted);
  font-size: 0.8rem;
}

.past-exam-year-counts {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.past-exam-notice {
  margin-top: 32px;
}

.past-exam-home-cta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  padding: 30px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--surface) 0%, var(--accent-soft) 100%);
  box-shadow: var(--shadow-sm);
}

.past-exam-home-cta h2 {
  margin: 0 0 8px;
}

.past-exam-home-cta p:not(.eyebrow) {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
}

.past-exam-home-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.past-exam-home-note {
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .past-exam-hero {
    grid-template-columns: 1fr;
  }

  .past-exam-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .past-exam-home-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .past-exam-home-actions {
    align-items: flex-start;
  }
}

@media (max-width: 780px) {
  .past-exam-filter-row {
    flex-direction: column;
    gap: 7px;
  }

  .past-exam-filter-label {
    flex-basis: auto;
    padding-top: 0;
  }

  .past-exam-session-tools {
    width: 100%;
  }

  .past-exam-select,
  .past-exam-search-wrap {
    width: 100%;
    min-width: 0;
  }

  .past-exam-card {
    padding: 20px;
  }

  .past-exam-actions .btn {
    flex: 1 1 auto;
  }

  .past-exam-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .past-exam-toolbar {
    align-items: flex-start;
  }

  .past-exam-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 520px) {
  .past-exam-page {
    padding-top: 24px;
  }

  .past-exam-hero {
    padding-top: 8px;
  }

  .past-exam-hero-copy h1 {
    font-size: 2.5rem;
  }

  .past-exam-filter-shell {
    padding: 16px;
  }

  .past-exam-card {
    padding: 16px;
    border-radius: var(--radius);
  }

  .past-exam-origin {
    margin: 10px 0 14px;
    padding: 8px 10px;
  }

  .past-exam-origin-meta {
  min-width: 0;
  overflow-wrap: anywhere;
    width: 100%;
    margin-left: 0;
    white-space: normal;
  }

  .chapter-exam-sources {
    padding: 16px;
  }

  .chapter-exam-sources-head {
    flex-direction: column;
    gap: 8px;
  }

  .chapter-exam-totals {
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .chapter-exam-total {
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
  }

  .chapter-exam-total span {
    margin-top: 0;
  }

  .past-exam-stem {
    font-size: 1.02rem;
  }

  .past-exam-option {
    padding: 12px;
    font-size: 0.9rem;
  }

  .past-exam-browse-card {
    padding: 16px;
  }

  .past-exam-analysis-head,
  .past-exam-analysis-summary,
  .past-exam-analysis-list li {
    padding-right: 12px;
    padding-left: 12px;
  }

  .past-exam-year-grid {
    grid-template-columns: 1fr;
  }

  .past-exam-home-cta {
    padding: 22px;
  }

  .past-exam-home-actions {
    width: 100%;
  }

  .past-exam-home-actions .btn {
    width: 100%;
  }

  .past-exam-home-note {
    white-space: normal;
  }
}

/* ----------------------------- current events / written exams ----------------------------- */
.macro-current-page,
.written-page {
  padding-top: 34px;
}

.macro-current-hero,
.written-hero {
  padding: 32px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-sm);
}

.macro-current-hero h1,
.written-hero h1 {
  margin: 4px 0 10px;
  font-size: clamp(2rem, 4vw, 3.1rem);
}

.macro-current-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.macro-current-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 26px;
}

.macro-current-card {
  min-width: 0;
  width: 100%;
  padding: 24px;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.macro-current-card-head {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
}

.macro-current-card-head h2 {
  margin: 0;
  font-size: 1.4rem;
}

.macro-current-period {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
}

.macro-current-summary {
  min-width: 0;
  margin-top: 12px;
  color: var(--ink-soft);
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.macro-current-summary p {
  margin: 0 0 10px;
}

.macro-current-formulas {
  min-width: 0;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.macro-current-formulas h3 {
  margin: 0 0 10px;
  font-size: 0.9rem;
}

.macro-current-formula + .macro-current-formula {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.macro-current-formula-name {
  display: block;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.macro-current-formula-math {
  max-width: 100%;
  margin-top: 5px;
  overflow-x: auto;
  color: var(--ink);
  font-size: 0.95rem;
  scrollbar-width: thin;
}

.macro-current-formula-math .katex-display {
  margin: 0;
}

.macro-current-formula p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.macro-current-points {
  min-width: 0;
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  background: var(--surface-2);
}

.macro-current-points h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.macro-current-points ul {
  margin: 0;
  padding-left: 1.2em;
  color: var(--ink-soft);
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.macro-current-points li {
  overflow-wrap: anywhere;
}

.macro-current-sources {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.78rem;
}

.macro-current-sources a {
  color: var(--accent);
  text-decoration: none;
}

.macro-current-sources a:hover {
  text-decoration: underline;
}

.macro-current-references {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.macro-current-references a {
  min-width: 0;
  max-width: 100%;
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.macro-current-references a:hover {
  text-decoration: underline;
}

.macro-current-news {
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  background: var(--surface-2);
}

.macro-current-news h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.macro-current-news ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.macro-current-news li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-areas:
    "rank line"
    ". summary";
  column-gap: 8px;
  row-gap: 3px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.macro-current-news li:first-child {
  padding-top: 0;
  border-top: 0;
}

.macro-current-news-rank {
  grid-area: rank;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.6;
}

.macro-current-news-line {
  display: block;
  grid-area: line;
  min-width: 0;
}

.macro-current-news-meta {
  display: inline;
  margin-right: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.6;
}

.macro-current-news-line strong {
  display: inline;
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.55;
}

.macro-current-news-summary {
  grid-area: summary;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.macro-current-synthesis {
  margin-top: 26px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.macro-current-synthesis-head .eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
}

.macro-current-synthesis-head h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.macro-current-synthesis-head p:not(.eyebrow) {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.75;
}

.macro-current-synthesis-themes {
  margin-top: 18px;
}

.macro-current-synthesis-essays {
  margin-top: 20px;
}

.macro-current-synthesis-essays h4 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.macro-top20-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.macro-top20-theme {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.macro-top20-theme-priority {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.macro-top20-theme h4 {
  margin: 4px 0;
  font-size: 0.92rem;
}

.macro-top20-theme p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.65;
}

.macro-top20-essay-list {
  display: grid;
  gap: 10px;
}

.macro-top20-essay {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  background: var(--surface-2);
}

.macro-top20-essay-num {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.macro-top20-essay h4 {
  margin: 4px 0 6px;
  font-size: 0.92rem;
  line-height: 1.55;
}

.macro-top20-essay p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.7;
}

.macro-top20-essay p strong {
  color: var(--accent);
}

.macro-top20-note {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.7;
}

.macro-top20-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.74rem;
}

.macro-top20-refs a {
  color: var(--accent);
  text-decoration: none;
}

.macro-top20-refs a:hover {
  text-decoration: underline;
}

.macro-current-section-head {
  margin-top: 30px;
}

.macro-current-section-head .eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
}

.macro-current-section-head h2 {
  margin: 0;
  font-size: 1.5rem;
}

@media (max-width: 680px) {
  .macro-current-news {
    padding: 12px 14px;
  }

  .macro-current-news li {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .macro-current-synthesis {
    padding: 16px;
  }

  .macro-top20-theme-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .macro-top20-essay {
    padding: 12px 14px;
  }
}

.forecast-page {
  padding-top: 34px;
}

.forecast-hero {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-sm);
}

.forecast-hero h1 {
  margin: 4px 0 10px;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.forecast-hero .lede {
  max-width: none;
}

.forecast-count-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.forecast-extras {
  padding-top: 4px;
}

.forecast-disclaimer {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.forecast-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.forecast-tab {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.forecast-tab:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.forecast-tab.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.forecast-directions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.forecast-direction {
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.forecast-direction h2 {
  margin: 0 0 6px;
  font-size: 0.98rem;
}

.forecast-direction p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.forecast-section {
  margin-top: 32px;
}

.forecast-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 14px;
}

.forecast-section-head h2 {
  margin: 0 0 4px;
  font-size: 1.45rem;
}

.forecast-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.forecast-section-head > span {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
}

.forecast-question-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.forecast-question {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.forecast-question summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 13px 15px;
  cursor: pointer;
  list-style: none;
}

.forecast-question summary::-webkit-details-marker {
  display: none;
}

.forecast-question[open] {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.forecast-question-num {
  flex: 0 0 30px;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
}

.forecast-question-title {
  flex: 1 1 260px;
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.forecast-chip {
  flex: 0 1 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.68rem;
  white-space: normal;
}

.forecast-level {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.forecast-level.is-advanced {
  border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
  background: color-mix(in srgb, var(--gold) 12%, var(--surface));
  color: var(--accent-ink);
}

.forecast-level-block {
  margin-top: 18px;
}

.forecast-level-block:first-of-type {
  margin-top: 0;
}

.forecast-level-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.forecast-level-head h3 {
  margin: 0;
  font-size: 1rem;
}

.forecast-level-head span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
}

.forecast-question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

.forecast-question-meta strong {
  color: var(--ink-soft);
}

.forecast-question-meta a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.forecast-question-meta a:hover {
  text-decoration: underline;
}

.forecast-exam-tip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 0;
}

.forecast-exam-tip > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.forecast-exam-tip strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 0.78rem;
}

.forecast-exam-tip p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .forecast-exam-tip {
    grid-template-columns: minmax(0, 1fr);
  }
}

.forecast-priority {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.forecast-priority.is-top {
  background: #fbe9e7;
  color: #a33a2b;
}

.forecast-priority.is-high {
  background: #fdf3d9;
  color: #8a6417;
}

.forecast-priority.is-mid {
  background: #e9f1f7;
  color: #32627f;
}

[data-theme="dark"] .forecast-priority.is-top {
  background: #3a221f;
  color: #f2a494;
}

[data-theme="dark"] .forecast-priority.is-high {
  background: #352d1c;
  color: #e8c979;
}

[data-theme="dark"] .forecast-priority.is-mid {
  background: #1d2d38;
  color: #a9d6ee;
}

.forecast-question-body {
  padding: 0 15px 16px;
  border-top: 1px dashed var(--line);
}

.forecast-scenario {
  margin: 13px 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.forecast-ask {
  padding: 12px 14px;
  border-left: 3px solid var(--line-strong);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
}

.forecast-ask h4 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.82rem;
}

.forecast-ask ul {
  margin: 0;
  padding-left: 1.2em;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.75;
}

.forecast-ask li {
  overflow-wrap: anywhere;
}

.forecast-focus {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.forecast-focus strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
}

.forecast-focus p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.forecast-question-formulas {
  min-width: 0;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.forecast-question-formulas summary {
  padding: 10px 12px;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.forecast-question-formulas[open] summary {
  border-bottom: 1px solid var(--line);
}

.forecast-question-formula-list {
  min-width: 0;
  padding: 10px 12px;
}

.forecast-question-formula + .forecast-question-formula {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.forecast-question-formula-name {
  display: block;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
}

.forecast-question-formula .forecast-formula-math {
  margin-top: 4px;
}

.forecast-question-formula p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.forecast-answer {
  margin-top: 12px;
  border-top: 1px dashed var(--line);
}

.forecast-answer summary {
  padding: 10px 0 2px;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.forecast-answer-body {
  padding: 4px 0 2px;
}

.forecast-answer-body p {
  margin: 0 0 9px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.forecast-answer-body p:last-child {
  margin-bottom: 0;
}

.forecast-integrated-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.forecast-integrated-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.forecast-integrated-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.forecast-integrated-head > span {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
}

.forecast-integrated-head h3 {
  flex: 1 1 180px;
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.forecast-integrated-head em {
  font-style: normal;
}

.forecast-integrated-card ol {
  margin: 12px 0 0;
  padding-left: 1.25em;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.7;
}

.forecast-integrated-card li {
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}

.forecast-why {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.forecast-why strong {
  color: var(--accent);
}

.forecast-formula-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.forecast-formula-group {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.forecast-formula-group h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.forecast-formula-list {
  margin: 0;
}

.forecast-formula-list > div {
  padding: 9px 0;
  border-top: 1px dashed var(--line);
}

.forecast-formula-list > div:first-child {
  padding-top: 0;
  border-top: 0;
}

.forecast-formula-list dt {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.forecast-formula-list dd {
  margin: 4px 0 0;
}

.forecast-formula-math {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  color: var(--ink-soft);
  font-size: 0.9rem;
  scrollbar-width: thin;
}

.forecast-formula-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.forecast-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.forecast-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  font-size: 0.84rem;
  line-height: 1.65;
}

.forecast-table th,
.forecast-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.forecast-table th {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.forecast-table tr:last-child td {
  border-bottom: 0;
}

.forecast-table td {
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.forecast-sensitivity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.forecast-sensitivity-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.forecast-sensitivity-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.forecast-sensitivity-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.forecast-sensitivity-table {
  min-width: 620px;
}

.forecast-sensitivity-table td.is-base {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent-ink);
  font-weight: 850;
}

.forecast-sensitivity-table tr.is-base-row th,
.forecast-sensitivity-table tr.is-base-row td {
  background: color-mix(in srgb, var(--gold) 10%, var(--surface));
}

.forecast-sensitivity-notes {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.7;
}

.forecast-sensitivity-notes li + li {
  margin-top: 6px;
}

.forecast-strategy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.forecast-strategy-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.forecast-strategy-card > span {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
}

.forecast-strategy-card h3 {
  margin: 5px 0 6px;
  font-size: 0.98rem;
}

.forecast-strategy-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .forecast-directions,
  .forecast-strategy-grid {
    grid-template-columns: 1fr;
  }

  .forecast-integrated-grid,
  .forecast-formula-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .forecast-page {
    padding-top: 22px;
  }

  .forecast-hero {
    padding: 22px 18px;
  }

  .forecast-section-head h2 {
    font-size: 1.25rem;
  }

  .forecast-question summary,
  .forecast-question-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .forecast-question-title {
    flex-basis: 100%;
    order: 3;
  }

  .forecast-question-num {
    flex-basis: 24px;
  }

  .forecast-chip {
    font-size: 0.64rem;
  }

  .forecast-integrated-card,
  .forecast-formula-group,
  .forecast-strategy-card {
    padding: 13px;
  }
}

.home-cta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.home-cta-grid .subject-written-cta {
  height: 100%;
  margin: 0;
}

.subject-cta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.subject-cta-grid .subject-written-cta {
  height: 100%;
  margin: 0;
}

@media (min-width: 1101px) {
  .subject-cta-grid .subject-written-cta {
    align-items: flex-start;
    flex-direction: column;
  }

  .subject-cta-grid .subject-written-cta-arrow {
    align-self: flex-end;
  }
}

@media (max-width: 1100px) {
  .subject-cta-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .home-cta-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.macro-current-cta,
.subject-written-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.macro-current-cta:hover,
.subject-written-cta:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
  color: var(--ink);
}

.macro-current-cta h2,
.subject-written-cta strong {
  display: block;
  margin: 2px 0 4px;
  font-size: 1.2rem;
}

.macro-current-cta p,
.subject-written-cta span {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.macro-current-cta-arrow,
.subject-written-cta-arrow {
  flex-shrink: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.86rem;
}

.subject-written-cta-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
}

.model-atlas-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 10px 0 4px;
}

.model-atlas-links .text-link {
  color: var(--accent);
  font-size: 0.84rem;
}

.written-filter-shell {
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.written-filter-shell .past-exam-filter-row {
  margin-bottom: 10px;
}

.written-filter-summary {
  color: var(--muted);
  font-size: 0.82rem;
}

.written-list {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.written-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.written-kind,
.written-reference {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
}

.written-kind {
  background: var(--surface-2);
  color: var(--muted);
}

.written-reference {
  background: var(--gold-soft);
  color: var(--gold);
}

.written-stem {
  margin: 14px 0 0;
  font-size: 1.08rem;
  line-height: 1.75;
}

.written-stem-body {
  display: block;
  min-width: 0;
}

.written-stem-body > * + * {
  margin-top: 10px;
}

.written-stem-p,
.written-stem-note {
  margin: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.written-stem-p .inline-math,
.written-stem-p .inline-math .katex,
.written-stem-p .inline-math .katex-html,
.written-table th .inline-math,
.written-table td .inline-math,
.written-table th .inline-math .katex,
.written-table td .inline-math .katex {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.written-stem-p.is-sub {
  padding-left: 14px;
  border-left: 2px solid var(--line);
}

.written-stem-list {
  margin: 0;
  padding-left: 24px;
  display: grid;
  gap: 6px;
}

.written-stem-list li {
  padding-left: 2px;
}

.written-stem-formula {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
}

.written-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.written-table-caption {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.written-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.6;
}

.written-table.is-compact {
  min-width: 0;
}

.written-table th,
.written-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.written-table thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.written-table tbody tr:last-child th,
.written-table tbody tr:last-child td {
  border-bottom: 0;
}

.written-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.written-table-note {
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}

@media (max-width: 680px) {
  .written-table {
    min-width: 440px;
  }

  .written-table.is-compact {
    min-width: 0;
  }

  .written-stem-p.is-sub {
    padding-left: 10px;
  }
}

.written-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 14px;
}

.written-answer {
  margin-top: 16px;
  padding: 16px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-soft);
  line-height: 1.85;
}

.written-answer p {
  margin: 0 0 10px;
}

.written-answer-block {
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}

.written-answer-note {
  color: var(--muted);
  font-size: 0.76rem;
}

.written-answer-table-wrap {
  max-width: 100%;
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.written-answer-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.82rem;
  line-height: 1.55;
}

.written-answer-table th,
.written-answer-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.written-answer-table th {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
}

.written-answer-table tr:last-child td {
  border-bottom: 0;
}

.past-exam-origin-current {
  color: var(--gold) !important;
}

@media (max-width: 680px) {
  .macro-current-hero,
  .written-hero {
    padding: 22px;
  }

  .macro-current-card,
  .written-card {
    padding: 18px;
  }

  .macro-current-cta,
  .subject-written-cta {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .macro-current-cta-arrow,
  .subject-written-cta-arrow {
    align-self: flex-end;
  }
}

/* ----------------------------- worked exam solutions ----------------------------- */
.section-solutions {
  min-width: 0;
  max-width: 100%;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 92, 92, 0.06), transparent 45%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.section-solutions .subheading {
  margin-top: 0;
}

.section-solutions .subheading:not(:first-child) {
  margin-top: 26px;
}

.solution-focus {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.85;
}

.solution-strategy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding-left: 1.35rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.8;
}

.solution-strategy li::marker {
  color: var(--accent);
  font-weight: 800;
}

.worked-examples {
  display: grid;
  gap: 10px;
}

.worked-example {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  overflow: hidden;
}

.worked-example[open] {
  border-color: var(--line-strong);
  background: var(--surface);
}

.worked-example-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.worked-example-summary::-webkit-details-marker {
  display: none;
}

.worked-example-summary::after {
  content: "＋";
  margin-left: auto;
  color: var(--accent);
  font-weight: 800;
}

.worked-example[open] .worked-example-summary::after {
  content: "－";
}

.worked-example-number,
.worked-example-kind {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.worked-example-number {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.worked-example-kind {
  color: var(--gold);
  background: var(--gold-soft);
}

.worked-example-title {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.worked-example-body {
  min-width: 0;
  max-width: 100%;
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.worked-example-stem {
  margin: 14px 0 12px;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.8;
}

.worked-example-options {
  display: grid;
  gap: 5px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.worked-example-options li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.65;
}

.worked-example-options li.is-correct {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.worked-example-letter {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 800;
}

.worked-example-answer {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 0 7px 7px 0;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.7;
}

.worked-example-steps h4 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 0.84rem;
}

.worked-example-steps ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 1.35rem;
  color: var(--ink-soft);
  font-size: 0.89rem;
  line-height: 1.8;
}

.worked-example-steps li::marker {
  color: var(--accent);
  font-weight: 800;
}

.worked-example-note,
.worked-example-trap {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.7;
}

.worked-example-note {
  background: var(--bg-deep);
}

.worked-example-trap {
  border: 1px dashed var(--line-strong);
  background: transparent;
}

.worked-example-note strong,
.worked-example-trap strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 0.76rem;
}

.worked-example-note p,
.worked-example-trap p {
  margin: 0;
  color: var(--ink-soft);
}

.worked-example-reference {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.worked-example-reference summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.worked-example-reference-body {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.8;
}

.worked-example-reference-body p {
  margin: 0 0 8px;
}

.worked-example-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}

.worked-example-footer .text-link {
  font-size: 0.78rem;
}

@media (max-width: 560px) {
  .section-solutions {
    padding: 15px;
  }

  .worked-example-summary {
    align-items: flex-start;
  }

  .worked-example-title {
    flex: 1 1 100%;
    order: 3;
  }

  .worked-example-summary::after {
    order: 2;
  }
}

/* ----------------------------- section-level exam sources ----------------------------- */
.section-exam-sources {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-2);
}

.section-exam-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.78rem;
}

.section-exam-head strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.section-exam-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
  text-align: right;
}

.section-exam-stats strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.section-exam-link.is-written {
  border-style: dashed;
}

.section-exam-link.is-written strong {
  color: var(--gold);
}

.section-exam-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.section-exam-link {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.45;
  text-decoration: none;
  transition: border-color 150ms ease, color 150ms ease;
}

.section-exam-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.section-exam-link strong {
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 520px) {
  .section-exam-sources {
    padding: 12px;
  }

  .section-exam-head {
    flex-wrap: wrap;
  }

  .section-exam-stats {
    width: 100%;
    text-align: left;
  }

  .section-exam-link {
    max-width: 100%;
  }
}

.written-answer-math {
  font-size: 1em;
}

.written-answer-math .katex {
  font-size: 1.08em;
}

.written-answer-math.is-display {
  display: block;
  margin: 0.65em 0;
}

.written-answer-math.is-display .katex-display {
  margin: 0;
}

.written-card,
.written-answer,
.written-answer-math.is-display {
  min-width: 0;
  max-width: 100%;
}

.written-answer-math.is-display {
  overflow-x: auto;
  overflow-y: hidden;
}

.written-stem {
  overflow-wrap: anywhere;
}

.written-answer-math:not(.is-display) {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  vertical-align: middle;
}

.written-answer-math:not(.is-display)::-webkit-scrollbar {
  display: none;
}

.written-answer p {
  overflow-wrap: anywhere;
}


/* 內容區表格在窄螢幕只讓表格本身水平滑動，避免撐開整頁。 */
.written-answer-table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

/* 多部分題組 */
.forecast-level.is-series {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-ink);
}

.forecast-series-parts {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.forecast-series-part {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.forecast-part-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.forecast-part-head h4 {
  flex: 1 1 220px;
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  overflow-wrap: anywhere;
}

.forecast-part-label {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.forecast-series-part .forecast-scenario {
  margin-top: 0;
}

.forecast-series-part .forecast-ask,
.forecast-series-part .forecast-focus {
  margin-top: 10px;
}

.forecast-series-part .forecast-answer {
  margin-top: 10px;
}

/* 路由分包載入提示 */
html.is-routing body {
  cursor: progress;
}

.route-loader {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1200;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  font-size: 0.8rem;
  font-weight: 700;
}

.past-exam-analysis-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.6;
}

.past-exam-analysis-notice .btn {
  flex: 0 0 auto;
}

.forecast-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.forecast-filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.forecast-filter-bar input,
.forecast-filter-bar select {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
}

.forecast-filter-search {
  flex: 1 1 220px;
  min-width: 0;
}

.forecast-filter-search input {
  width: 100%;
}

.forecast-filter-count {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
}

.forecast-question[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .forecast-filter-bar {
    align-items: stretch;
  }

  .forecast-filter-bar label {
    flex: 1 1 calc(50% - 6px);
  }

  .forecast-filter-search {
    flex-basis: 100%;
  }

  .forecast-filter-count {
    flex-basis: 100%;
    margin-left: 0;
  }
}

.search-past-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.search-past-action .btn {
  flex: 0 0 auto;
}
