/* =========================================================
   难题档案 · The Hard Problem Archive
   A small museum of computing's enduring problems.
   ========================================================= */

:root {
  --ink: #08111d;
  --ink-2: #0b1523;
  --ink-3: #0a1320;
  --paper: #f0ebdf;
  --paper-dim: #a9a79f;
  --amber: #d8a35c;
  --amber-bright: #f0c17d;
  --cyan: #83a8a6;
  --line: rgba(240, 235, 223, 0.14);
  --line-soft: rgba(240, 235, 223, 0.07);
  --shell: 1440px;
  --gutter: clamp(20px, 4vw, 64px);
  --grid-gap: clamp(18px, 2vw, 32px);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Consolas", "Liberation Mono", monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  background: var(--ink);
  overflow-x: clip;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(ellipse at 16% 3%, rgba(216, 163, 92, 0.08), transparent 34rem),
    radial-gradient(ellipse at 92% 26%, rgba(131, 168, 166, 0.055), transparent 30rem),
    var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body::before {
  background-image:
    linear-gradient(rgba(240, 235, 223, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 235, 223, 0.04) 1px, transparent 1px);
  background-size: 76px 76px;
  opacity: 0.26;
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 55%, transparent 100%);
}

body::after {
  background-image: repeating-radial-gradient(
    circle at 17% 23%,
    rgba(255, 255, 255, 0.025) 0,
    rgba(255, 255, 255, 0.025) 0.5px,
    transparent 0.5px,
    transparent 3px
  );
  opacity: 0.22;
  mix-blend-mode: soft-light;
}

main,
.site-header,
.site-footer,
.chapter-rail,
.menu-panel {
  position: relative;
  z-index: 1;
}

::selection {
  background: var(--amber);
  color: var(--ink);
}

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

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

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p,
dl,
dd,
figure,
blockquote,
ol {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

code {
  padding: 0.08em 0.36em;
  border: 1px solid rgba(216, 163, 92, 0.2);
  background: rgba(216, 163, 92, 0.055);
  color: var(--amber-bright);
  font-family: var(--mono);
  font-size: 0.84em;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--amber-bright);
  outline-offset: 4px;
}

.shell {
  width: min(calc(100% - 2 * var(--gutter)), var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 0.8rem 1rem;
  background: var(--amber);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  transform: translateY(-160%);
  transition: transform 180ms var(--ease);
}

.skip-link:focus {
  transform: none;
}

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

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  padding-inline: var(--gutter);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(8, 17, 29, 0.84);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 44px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 26px;
  border: 1px solid rgba(216, 163, 92, 0.55);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
}

.brand__name {
  font-family: var(--serif);
  font-size: 1.02rem;
  letter-spacing: 0.06em;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2rem);
}

.header__count {
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
}

.header__index-link {
  position: relative;
  padding-block: 0.35rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.header__index-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 220ms var(--ease);
}

.header__index-link:hover::after,
.header__index-link:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

.menu-toggle {
  display: none;
  min-width: 64px;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  transition: border-color 180ms, color 180ms;
}

.menu-toggle:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.reading-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: rgba(240, 235, 223, 0.05);
}

#reading-progress {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

/* ---------------------------------------------------------
   Chapter rail
   --------------------------------------------------------- */

/* 调整:120 章后左轨收敛为「五卷锚点 Ⅰ–Ⅴ + 当前章号读数」的紧凑雷达——
   不再逐章列点:目录抽屉承担逐章导航,左轨只承担卷级跳转与位置读数 */
.chapter-rail {
  position: fixed;
  left: 16px;
  top: 50%;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  transform: translateY(-50%);
  padding: 12px 0;
}

.chapter-rail a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 50%;
  color: rgba(240, 235, 223, 0.42);
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  transition: color 200ms, border-color 200ms, background-color 200ms;
}

.chapter-rail a:hover,
.chapter-rail a:focus-visible,
.chapter-rail a.is-active {
  color: var(--amber);
}

.chapter-rail a.is-active {
  border-color: rgba(216, 163, 92, 0.35);
  background: rgba(216, 163, 92, 0.05);
}

.chapter-rail a[aria-current="true"] {
  color: var(--amber-bright);
}

.chapter-rail__now {
  margin-top: 3px;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  border-top: 1px solid var(--line-soft);
  padding-top: 9px;
  transition: color 200ms;
}

.chapter-rail__now.is-live {
  color: var(--amber-bright);
}

/* ---------------------------------------------------------
   Mobile menu
   --------------------------------------------------------- */

.menu-panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.15rem;
  padding: 100px var(--gutter) 48px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(ellipse at 80% 10%, rgba(216, 163, 92, 0.12), transparent 28rem),
    linear-gradient(160deg, var(--ink-2), var(--ink) 65%);
  animation: menu-in 380ms var(--ease) both;
}

.menu-panel__label {
  margin-bottom: 1.5rem;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
}

/* 调整:目录里的学科卷分隔小标 */
.menu-panel__label--volume {
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  color: var(--paper-dim);
  font-size: 0.58rem;
  border-top: 1px solid var(--line-soft);
}

.menu-panel a {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--serif);
  font-size: clamp(1.5rem, 5vw, 2.15rem);
  letter-spacing: 0.01em;
  transition: color 180ms, padding-left 220ms var(--ease);
}

.menu-panel a span {
  width: 2rem;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}

.menu-panel a:hover,
.menu-panel a:focus-visible {
  padding-left: 0.45rem;
  color: var(--amber-bright);
}

.menu-panel a.is-active,
.menu-panel a[aria-current="true"] {
  padding-left: 0.75rem;
  color: var(--amber-bright);
  box-shadow: inset 2px 0 0 var(--amber);
}

.menu-panel a.is-active span,
.menu-panel a[aria-current="true"] span {
  color: var(--amber-bright);
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-18px); }
  to { opacity: 1; transform: none; }
}

body.menu-open {
  overflow: hidden;
}

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

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding-top: 76px;
  border-bottom: 1px solid var(--line);
}

.hero::after {
  content: "";
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber) 25%, var(--amber) 75%, transparent);
  opacity: 0.5;
}

.hero__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: center;
  gap: var(--grid-gap);
  flex: 1;
  padding-block: clamp(4rem, 9vh, 8rem) clamp(2rem, 4vh, 4rem);
}

.hero__content {
  position: relative;
  z-index: 2;
  grid-column: 1 / 9;
  min-width: 0;
}

.hero__eyebrow {
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: clamp(0.58rem, 0.75vw, 0.7rem);
  letter-spacing: 0.14em;
  line-height: 1.7;
}

.hero__title {
  margin-top: clamp(1.5rem, 3.5vh, 3rem);
  font-size: clamp(4.5rem, 12.2vw, 10.5rem);
  line-height: 0.82;
  letter-spacing: -0.055em;
}

.hero__title-line {
  display: block;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}

.hero__title-accent {
  color: var(--amber);
}

.hero__title-en {
  margin-top: clamp(2rem, 4vh, 3rem);
  padding-bottom: 0;
  margin-bottom: 0;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: clamp(0.62rem, 0.9vw, 0.78rem);
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: 0.2em;
}

.hero__bottom {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  max-width: 720px;
  margin-top: clamp(2.25rem, 5vh, 4rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.hero__lede {
  max-width: 48ch;
  color: var(--paper-dim);
  font-size: clamp(0.92rem, 1.1vw, 1.04rem);
  line-height: 1.9;
}

.hero__issue {
  flex: none;
  color: rgba(240, 235, 223, 0.6);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.hero__visual {
  position: relative;
  grid-column: 9 / 13;
  min-width: 0;
  transform: translateX(1.5rem);
}

.hero-map {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.hero-map__orbit {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.hero-map__orbit--inner {
  stroke-dasharray: 2 9;
  opacity: 0.55;
}

.hero-map__line {
  fill: none;
  stroke: rgba(216, 163, 92, 0.38);
  stroke-width: 1;
  stroke-dashoffset: 0;
}

.hero-map__line--dashed {
  stroke: rgba(240, 235, 223, 0.14);
  stroke-dasharray: 0.006 0.014;
  stroke-dashoffset: 0;
}

.hero-map__node {
  fill: var(--amber);
  opacity: 0.9;
  transform-box: fill-box;
  transform-origin: center;
}

.hero-map__label,
.hero-map__core-label {
  fill: var(--paper-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.hero-map__core {
  fill: var(--amber-bright);
  filter: drop-shadow(0 0 10px rgba(240, 193, 125, 0.6));
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(calc(100% - 2 * var(--gutter)), var(--shell));
  margin-inline: auto;
  padding: 1.25rem 0 1.5rem;
  border-top: 1px solid var(--line);
}

.hero__stats > div {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding-left: clamp(1rem, 2.5vw, 2.5rem);
}

.hero__stats > div:first-child {
  padding-left: 0;
}

.hero__stats > div + div {
  border-left: 1px solid var(--line-soft);
}

.hero__stats dt {
  color: var(--amber);
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1;
}

.hero__stats dd {
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.08em;
}

.hero__scroll {
  position: absolute;
  right: calc(var(--gutter) + 0.25rem);
  bottom: 1.35rem;
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 44px;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.13em;
  writing-mode: vertical-rl;
}

.hero__scroll i {
  width: 1px;
  height: 48px;
  background: linear-gradient(var(--amber), transparent);
  animation: scroll-line 2.4s ease-in-out infinite;
}

@keyframes scroll-line {
  0%, 100% { transform: scaleY(0.35); transform-origin: top; opacity: 0.45; }
  50% { transform: scaleY(1); transform-origin: top; opacity: 1; }
}

/* Hero entrance */

.hero__title-line {
  opacity: 1;
  transform: none;
}

.js .hero__title-line {
  animation: title-in 950ms var(--ease) both;
}

.js .hero__title-line:nth-child(2) {
  animation-delay: 90ms;
}

.js .hero__title-line:nth-child(3) {
  animation-delay: 180ms;
}

.js .hero-map__line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: hero-line 1.8s var(--ease) 350ms forwards;
}

.js .hero-map__line--dashed {
  stroke-dasharray: 0.006 0.014;
  stroke-dashoffset: 0;
  animation: hero-fade 1.4s ease 900ms both;
}

.js .hero-map__node {
  opacity: 0;
  transform: scale(0.55);
  animation: node-in 800ms var(--ease) forwards;
  animation-delay: calc(420ms + var(--i) * 40ms);
}

@keyframes title-in {
  0% { opacity: 0; transform: translateY(115%); }
  100% { opacity: 1; transform: none; }
}

@keyframes hero-line {
  to { stroke-dashoffset: 0; }
}

@keyframes hero-fade {
  from { opacity: 0; }
  to { opacity: 0.7; }
}

@keyframes node-in {
  0% { opacity: 0; transform: scale(0.55); }
  100% { opacity: 0.9; transform: scale(1); }
}

/* ---------------------------------------------------------
   Index
   --------------------------------------------------------- */

.index-section {
  position: relative;
  padding-block: clamp(6rem, 11vw, 10rem);
  border-bottom: 1px solid var(--line);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.15em;
  line-height: 1.6;
}

.section-label::before {
  content: "";
  width: 34px;
  height: 1px;
  background: var(--amber);
  opacity: 0.8;
}

.section-head__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr);
  align-items: end;
  gap: clamp(2rem, 6vw, 7rem);
  margin-top: 1.75rem;
}

.section-title {
  font-size: clamp(2.8rem, 6vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.section-intro {
  max-width: 42ch;
  padding-bottom: 0.35rem;
  color: var(--paper-dim);
  font-size: 0.96rem;
  line-height: 1.85;
}

.index-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-top: clamp(3rem, 6vw, 5rem);
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-button {
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  transition: color 180ms, border-color 180ms, background-color 180ms;
}

.filter-button:hover {
  border-color: rgba(216, 163, 92, 0.55);
  color: var(--amber-bright);
}

.filter-button[aria-pressed="true"] {
  border-color: var(--amber);
  background: var(--amber);
  color: var(--ink);
}

.filter-count {
  flex: none;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
}

.filter-count [data-count] {
  color: var(--amber);
}

.index-list {
  padding: 0;
  list-style: none;
}

.index-row {
  display: grid;
  grid-template-columns: 56px minmax(220px, 1.55fr) minmax(160px, 0.9fr) minmax(100px, 0.55fr) minmax(120px, 0.6fr) 36px;
  align-items: center;
  gap: clamp(1rem, 2vw, 2rem);
  min-height: 106px;
  padding: 1.2rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  transition: background-color 220ms, color 220ms, padding-left 240ms var(--ease);
}

.index-row:hover,
.index-row:focus-visible {
  padding-left: 1.4rem;
  background: rgba(216, 163, 92, 0.055);
}

.index-row__number {
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.index-row__name {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.index-row__title {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 1.8vw, 1.7rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  transition: color 200ms;
}

.index-row__hook {
  color: var(--paper-dim);
  font-size: 0.78rem;
  line-height: 1.6;
}

.index-row__en {
  color: rgba(240, 235, 223, 0.55);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-transform: uppercase;
}

.index-row__field {
  color: var(--paper-dim);
  font-size: 0.78rem;
}

.index-row__status {
  justify-self: start;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.57rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.index-row__arrow {
  justify-self: end;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 1rem;
  transition: color 200ms, transform 260ms var(--ease);
}

.index-row:hover .index-row__title,
.index-row:focus-visible .index-row__title,
.index-row:hover .index-row__arrow,
.index-row:focus-visible .index-row__arrow {
  color: var(--amber-bright);
}

.index-row:hover .index-row__arrow,
.index-row:focus-visible .index-row__arrow {
  transform: translate(3px, -3px);
}

/* ---------------------------------------------------------
   Shared section reveal
   --------------------------------------------------------- */

[data-reveal] {
  opacity: 1;
  transform: none;
}

.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 760ms var(--ease),
    transform 760ms var(--ease);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ---------------------------------------------------------
   Responsive base (header / hero / index)
   --------------------------------------------------------- */

@media (max-width: 1199px) {
  .chapter-rail {
    display: none;
  }
}

@media (max-width: 1024px) {
  .hero__content {
    grid-column: 1 / 9;
  }

  .hero__visual {
    grid-column: 9 / 13;
    opacity: 0.85;
  }

  .index-row {
    grid-template-columns: 48px minmax(200px, 1.5fr) minmax(140px, 0.8fr) minmax(100px, 0.6fr) 34px;
  }

  .index-row__field {
    display: none;
  }
}

@media (max-width: 960px) {
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .header__index-link {
    display: none;
  }

  .hero {
    padding-top: 68px;
  }

  .hero__grid {
    grid-template-columns: 1fr;
    align-items: end;
    padding-block: clamp(3rem, 9vh, 6rem) 2rem;
  }

  .hero__content,
  .hero__visual {
    grid-column: 1 / -1;
  }

  .hero__title {
    font-size: clamp(4.2rem, 17vw, 8.5rem);
  }

  .hero__visual {
    position: absolute;
    top: 16%;
    right: -12%;
    width: min(60vw, 440px);
    opacity: 0.28;
    transform: none;
  }

  .hero__bottom {
    max-width: none;
  }

  .hero__stats {
    padding-bottom: 2.5rem;
  }

  .section-head__row {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .section-intro {
    max-width: 54ch;
  }

  .index-row {
    grid-template-columns: 40px minmax(0, 1fr) auto 30px;
    gap: 1rem;
    min-height: 96px;
  }

  .index-row__en,
  .index-row__field {
    display: none;
  }

  .index-row__status {
    font-size: 0.55rem;
  }
}

@media (max-width: 640px) {
  .site-header {
    height: 64px;
  }

  .header__count {
    display: none;
  }

  .brand__name {
    font-size: 0.92rem;
  }

  .hero {
    padding-top: 64px;
  }

  .hero__grid {
    padding-block: 2.6rem 1.5rem;
  }

  .hero__title {
    margin-top: 1.5rem;
    font-size: clamp(3.7rem, 19vw, 5.4rem);
    line-height: 0.88;
  }

  .hero__title-en {
    margin-top: 1.4rem;
    font-size: 0.56rem;
    letter-spacing: 0.16em;
  }

  .hero__bottom {
    display: block;
    margin-top: 2.2rem;
    padding-top: 1rem;
  }

  .hero__lede {
    font-size: 0.86rem;
  }

  .hero__issue {
    margin-top: 1rem;
  }

  .hero__visual {
    top: 13%;
    right: -26%;
    width: min(86vw, 380px);
    opacity: 0.2;
  }

  .hero__stats {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 1rem 0 3.2rem;
  }

  .hero__stats > div {
    padding-left: 0;
  }

  .hero__stats > div + div {
    padding-top: 0.75rem;
    border-top: 1px solid var(--line-soft);
    border-left: 0;
  }

  .hero__stats dt {
    font-size: 1.55rem;
  }

  .hero__scroll {
    right: var(--gutter);
    bottom: 1rem;
    writing-mode: horizontal-tb;
  }

  .hero__scroll i {
    width: 34px;
    height: 1px;
    background: linear-gradient(90deg, var(--amber), transparent);
    animation: none;
  }

  .section-title {
    font-size: clamp(2.5rem, 13vw, 3.6rem);
  }

  .index-tools {
    align-items: flex-start;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2.5rem;
  }

  .filter-list {
    flex-wrap: nowrap;
    width: 100%;
    padding-bottom: 0.35rem;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .filter-button {
    flex: none;
  }

  .filter-count {
    align-self: flex-end;
  }

  .index-row {
    grid-template-columns: 32px minmax(0, 1fr) 26px;
    grid-template-rows: auto auto;
    gap: 0.35rem 1rem;
    min-height: 96px;
    padding-inline: 0.25rem;
  }

  .index-row__number {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: center;
  }

  .index-row__name {
    grid-column: 2;
    grid-row: 1;
  }

  .index-row__status {
    display: inline-block;
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    margin-top: 0;
    padding: 0.2rem 0.45rem;
    font-size: 0.52rem;
  }

  .index-row__arrow {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
  }

  .index-row__hook {
    font-size: 0.72rem;
  }

  .index-row__title {
    font-size: 1.22rem;
  }

  .index-row:hover,
  .index-row:focus-visible {
    padding-left: 0.6rem;
  }
}

/* ---------------------------------------------------------
   Reduced motion
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }

  .draw-path {
    stroke-dashoffset: 0 !important;
  }

  .diagram-node {
    opacity: 1 !important;
    transform: none !important;
  }

  .hero__scroll i {
    animation: none;
  }
}

/* ---------------------------------------------------------
   No-JS fallback
   --------------------------------------------------------- */

html:not(.js) .filter-list,
html:not(.js) .menu-toggle,
html:not(.js) .route__toggle,
html:not(.js) .diagram-switch {
  display: none;
}

/* ---------------------------------------------------------
   Chapters
   --------------------------------------------------------- */

.chapter {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--grid-gap);
  width: min(calc(100% - 2 * var(--gutter)), var(--shell));
  margin-inline: auto;
  padding-block: clamp(7rem, 13vw, 13rem);
  border-top: 1px solid var(--line);
  scroll-margin-top: 96px;
}

#p-vs-np,
#cap,
#race {
  background:
    linear-gradient(180deg, rgba(240, 235, 223, 0.015), transparent 24%, transparent 76%, rgba(240, 235, 223, 0.012));
}

.chapter::before {
  content: attr(data-index);
  position: absolute;
  top: 0.02em;
  right: -0.04em;
  z-index: 0;
  color: rgba(240, 235, 223, 0.026);
  font-family: var(--serif);
  font-size: clamp(12rem, 27vw, 27rem);
  font-weight: 500;
  line-height: 0.72;
  letter-spacing: -0.07em;
  pointer-events: none;
  user-select: none;
}

.chapter__meta {
  position: sticky;
  top: 120px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: start;
  grid-column: 1 / 4;
  gap: 0.8rem;
}

.chapter__meta::before {
  content: "";
  width: 36px;
  height: 1px;
  margin-bottom: 0.6rem;
  background: var(--amber);
  opacity: 0.75;
}

.chapter__number {
  color: var(--amber);
  font-family: var(--serif);
  font-size: clamp(3.2rem, 6vw, 6rem);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.chapter__category,
.chapter__status {
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.09em;
  line-height: 1.5;
}

.chapter__status {
  margin-top: 0.35rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
}

.chapter__body {
  position: relative;
  z-index: 1;
  grid-column: 5 / 13;
  min-width: 0;
}

.chapter__en {
  color: var(--amber);
  font-family: var(--mono);
  font-size: clamp(0.6rem, 0.8vw, 0.7rem);
  letter-spacing: 0.15em;
  line-height: 1.6;
}

.chapter__title {
  margin-top: clamp(1rem, 2vw, 1.6rem);
  font-size: clamp(2.8rem, 6vw, 5.6rem);
  line-height: 0.94;
  letter-spacing: -0.045em;
}

.chapter__question {
  max-width: 35ch;
  margin-top: clamp(1.4rem, 2.5vw, 2rem);
  font-size: clamp(1.08rem, 1.45vw, 1.38rem);
  line-height: 1.65;
  color: rgba(240, 235, 223, 0.88);
}

.difficulty,
.paths {
  margin-top: clamp(3.5rem, 7vw, 6rem);
}

.difficulty h3,
.paths h3 {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.13em;
  line-height: 1.6;
}

.difficulty h3::before,
.paths h3::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--amber);
  opacity: 0.8;
}

.difficulty > p {
  max-width: 62ch;
  margin-top: 1.25rem;
  color: rgba(240, 235, 223, 0.8);
  font-size: 1rem;
  line-height: 1.95;
}

.paths .route-grid {
  margin-top: 1.5rem;
}

/* ---------------------------------------------------------
   Diagrams
   --------------------------------------------------------- */

.diagram {
  position: relative;
  margin-top: clamp(2.2rem, 4vw, 3.2rem);
  padding: 1.4rem 0 1.25rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.diagram-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.diagram-svg text {
  font-family: var(--mono);
}

.diagram__caption {
  max-width: 70ch;
  margin-top: 1rem;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1.75;
  letter-spacing: 0.015em;
}

.diagram__caption::before {
  content: "FIG. ";
  color: var(--amber);
}

.diagram-switch {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}

.diagram-switch button {
  min-height: 44px;
  padding: 0.35rem 0.72rem;
  border: 1px solid var(--line);
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.05em;
  transition: color 180ms, border-color 180ms, background-color 180ms;
}

.diagram-switch button:hover {
  border-color: rgba(216, 163, 92, 0.55);
  color: var(--amber-bright);
}

.diagram-switch button[aria-pressed="true"] {
  border-color: rgba(216, 163, 92, 0.6);
  background: rgba(216, 163, 92, 0.08);
  color: var(--amber);
}

.diagram-kicker {
  fill: var(--paper-dim);
  font-size: 10px;
  letter-spacing: 0.13em;
}

.diagram-label {
  fill: var(--paper);
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: -0.01em;
}

.diagram-copy {
  fill: var(--paper-dim);
  font-size: 13px;
  letter-spacing: 0.015em;
}

.diagram-note {
  fill: var(--amber);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.diagram-symbol {
  fill: var(--amber);
  font-family: var(--serif);
  font-size: 36px;
}

.diagram-version {
  fill: var(--amber);
  font-size: 15px;
  letter-spacing: 0.04em;
}

.diagram-version.is-stale {
  fill: var(--amber-bright);
}

.diagram-frame {
  fill: rgba(240, 235, 223, 0.014);
  stroke: var(--line);
  stroke-width: 1;
}

.diagram-frame--offset {
  stroke: rgba(216, 163, 92, 0.34);
}

.diagram-frame.is-stale {
  fill: rgba(216, 163, 92, 0.035);
  stroke: rgba(216, 163, 92, 0.55);
  stroke-dasharray: 4 5;
}

.diagram-edge {
  stroke: var(--line);
  stroke-width: 1;
}

.diagram-guide {
  fill: none;
  stroke: rgba(240, 235, 223, 0.3);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.diagram-message {
  fill: none;
  stroke: rgba(216, 163, 92, 0.58);
  stroke-width: 1.2;
  stroke-dasharray: 5 5;
}

.diagram-divider {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 4 7;
}

.diagram-node {
  fill: var(--ink-2);
  stroke: var(--amber);
  stroke-width: 1.4;
}

.diagram-node.is-highlight {
  fill: var(--amber);
  stroke: var(--amber-bright);
  stroke-width: 2;
}

.diagram-node.is-faulty {
  fill: rgba(216, 163, 92, 0.13);
  stroke: var(--amber);
  stroke-dasharray: 4 4;
}

.diagram-halo {
  fill: none;
  stroke: rgba(216, 163, 92, 0.4);
  stroke-width: 1;
  stroke-dasharray: 4 7;
}

.diagram-node-label {
  fill: var(--paper);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.diagram-node-label.is-faulty {
  fill: var(--amber-bright);
}

.diagram-check {
  fill: rgba(131, 168, 166, 0.08);
  stroke: var(--cyan);
  stroke-width: 1.4;
}

.diagram-checkmark {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.timeline-block {
  fill: rgba(240, 235, 223, 0.035);
  stroke: var(--line);
  stroke-width: 1;
}

.timeline-block.is-conflict {
  fill: rgba(216, 163, 92, 0.075);
  stroke: rgba(216, 163, 92, 0.8);
  stroke-dasharray: 4 4;
}

.lock-frame {
  fill: rgba(131, 168, 166, 0.03);
  stroke: rgba(131, 168, 166, 0.32);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.counter-box {
  fill: rgba(216, 163, 92, 0.045);
  stroke: rgba(216, 163, 92, 0.45);
  stroke-width: 1;
}

.stale-badge {
  fill: rgba(216, 163, 92, 0.12);
  stroke: rgba(216, 163, 92, 0.45);
  stroke-width: 1;
}

.stale-badge__text {
  fill: var(--amber-bright);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.draw-path {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dashoffset: 0;
}

.js .draw-path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.6s var(--ease);
}

.diagram.is-visible .draw-path {
  stroke-dashoffset: 0;
}

.draw-path.is-highlight {
  stroke: var(--amber-bright);
  stroke-width: 2.2;
}

.js .diagram-node {
  opacity: 0.35;
  transform: scale(0.8);
  transform-box: fill-box;
  transform-origin: center;
  transition:
    opacity 550ms var(--ease),
    transform 650ms var(--ease);
}

.diagram.is-visible .diagram-node {
  opacity: 1;
  transform: none;
}

/* CAP mode */

.cap-edge {
  stroke: var(--line);
  stroke-width: 1.5;
  stroke-linecap: round;
  transition: stroke 300ms var(--ease), stroke-width 300ms var(--ease);
}

.cap-edge--ca {
  stroke: rgba(240, 235, 223, 0.25);
  stroke-dasharray: 4 6;
}

.cap-visual[data-mode="cp"] .cap-edge--cp {
  stroke: var(--amber-bright);
  stroke-width: 2.5;
}

.cap-visual[data-mode="cp"] .cap-edge--ap {
  stroke: rgba(240, 235, 223, 0.1);
}

.cap-visual[data-mode="ap"] .cap-edge--ap {
  stroke: var(--cyan);
  stroke-width: 2.5;
}

.cap-visual[data-mode="ap"] .cap-edge--cp {
  stroke: rgba(240, 235, 223, 0.1);
}

.cap-crack {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cap-partition {
  fill: none;
  stroke: rgba(216, 163, 92, 0.38);
  stroke-width: 1;
  stroke-dasharray: 3 6;
}

.cap-note {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin-top: 0.75rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--amber);
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1.7;
}

.cap-note::before {
  content: "NOTE";
  flex: none;
  color: var(--amber);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
}

/* ---------------------------------------------------------
   Route cards
   --------------------------------------------------------- */

.route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.route {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 286px;
  padding: clamp(1.25rem, 2.2vw, 1.9rem);
  transition: background-color 220ms;
}

.route + .route {
  border-left: 1px solid var(--line);
}

.route:hover {
  background: rgba(216, 163, 92, 0.035);
}

.route__letter {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(216, 163, 92, 0.6);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
}

.route__title {
  margin-top: 1.2rem;
  font-size: clamp(1.26rem, 1.7vw, 1.55rem);
  line-height: 1.25;
}

.route__desc {
  margin-top: 0.7rem;
  color: var(--paper-dim);
  font-size: 0.87rem;
  line-height: 1.8;
}

.route__toggle {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: auto;
  padding: 1.25rem 0 0.3rem;
  border-bottom: 1px solid rgba(216, 163, 92, 0.28);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  transition: color 180ms, border-color 180ms;
}

.route__toggle:hover {
  border-color: var(--amber);
  color: var(--amber-bright);
}

.route__cost {
  width: 100%;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition:
    grid-template-rows 350ms var(--ease),
    opacity 280ms var(--ease);
}

.route__cost p {
  min-height: 0;
  margin-top: 0.55rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line-soft);
  color: rgba(240, 235, 223, 0.88);
  font-size: 0.81rem;
  line-height: 1.7;
}

.route__cost p::before {
  content: "代价 / COST";
  display: block;
  margin-bottom: 0.35rem;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.1em;
}

.js .route__cost {
  grid-template-rows: 0fr;
  opacity: 0;
}

.route.is-open .route__cost {
  grid-template-rows: 1fr;
  opacity: 1;
}

.reality {
  max-width: 64ch;
  margin-top: clamp(3.2rem, 6vw, 5rem);
  padding: 0.25rem 0 0.25rem 1.4rem;
  border-left: 2px solid var(--amber);
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1.45vw, 1.28rem);
  line-height: 1.8;
  color: var(--paper);
}

.reality span {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
}

/* ---------------------------------------------------------
   Interlude
   --------------------------------------------------------- */

.interlude {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 70vh;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 12% 50%, rgba(216, 163, 92, 0.075), transparent 32rem),
    linear-gradient(180deg, rgba(11, 21, 35, 0.72), rgba(8, 17, 29, 0.5));
}

.interlude::before {
  content: "“";
  position: absolute;
  top: 50%;
  left: clamp(1rem, 5vw, 5rem);
  transform: translateY(-55%);
  color: rgba(216, 163, 92, 0.1);
  font-family: var(--serif);
  font-size: clamp(14rem, 30vw, 30rem);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.interlude__inner {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 2 * var(--gutter)), 1000px);
  margin-inline: auto;
  transform: translate3d(0, var(--interlude-shift, 0px), 0);
  will-change: transform;
}

.interlude__label {
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.15em;
}

.interlude__quote {
  max-width: 19ch;
  margin-top: 1.6rem;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4.5vw, 4rem);
  line-height: 1.35;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

/* ---------------------------------------------------------
   Closing
   --------------------------------------------------------- */

.closing {
  padding-block: clamp(7rem, 12vw, 12rem);
  border-top: 1px solid var(--line);
}

.closing__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
  align-items: end;
  gap: clamp(3rem, 8vw, 9rem);
  margin-top: clamp(2.5rem, 5vw, 4.5rem);
}

.closing__title {
  font-size: clamp(4rem, 10vw, 9rem);
  line-height: 0.84;
  letter-spacing: -0.055em;
}

.closing__content {
  max-width: 54ch;
  padding-bottom: 0.55rem;
}

.closing__content p {
  color: var(--paper-dim);
  font-size: clamp(0.98rem, 1.25vw, 1.12rem);
  line-height: 1.9;
}

.closing__link {
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
  min-height: 44px;
  margin-top: 2rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(216, 163, 92, 0.4);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  transition: color 180ms, border-color 180ms;
}

.closing__link span {
  transition: transform 240ms var(--ease);
}

.closing__link:hover {
  border-color: var(--amber);
  color: var(--amber-bright);
}

.closing__link:hover span {
  transform: translate(-3px, -3px);
}

/* ---------------------------------------------------------
   References & footer
   --------------------------------------------------------- */

.references {
  padding-block: clamp(6rem, 10vw, 9rem);
  border-top: 1px solid var(--line);
}

.section-head--references {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}

.references__list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.references__list li {
  border-bottom: 1px solid var(--line-soft);
}

.references__list li:nth-child(odd) {
  border-right: 1px solid var(--line-soft);
}

.references__list a {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 22px;
  align-items: start;
  gap: 1rem;
  height: 100%;
  padding: clamp(1.2rem, 2vw, 1.7rem);
  transition: background-color 200ms;
}

.references__list a:hover,
.references__list a:focus-visible {
  background: rgba(216, 163, 92, 0.05);
}

.references__index {
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
}

.references__list a > span:nth-child(2) {
  color: var(--paper-dim);
  font-size: 0.79rem;
  line-height: 1.75;
  transition: color 200ms;
}

.references__list a:hover > span:nth-child(2),
.references__list a:focus-visible > span:nth-child(2) {
  color: var(--paper);
}

.references__arrow {
  justify-self: end;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
  transition: color 200ms, transform 200ms var(--ease);
}

.references__list a:hover .references__arrow,
.references__list a:focus-visible .references__arrow {
  color: var(--amber-bright);
  transform: translate(2px, -2px);
}

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

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.5rem;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
}

.site-footer__note {
  color: rgba(240, 235, 223, 0.55);
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--paper-dim);
  transition: color 180ms;
}

.site-footer a:hover {
  color: var(--amber);
}

/* ---------------------------------------------------------
   Chapter responsive
   --------------------------------------------------------- */

@media (max-width: 1100px) {
  .chapter {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .chapter__meta {
    grid-column: 1 / 3;
  }

  .chapter__body {
    grid-column: 4 / 11;
  }
}

@media (max-width: 960px) {
  .chapter {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding-block: clamp(5.5rem, 12vw, 8rem);
    scroll-margin-top: 82px;
  }

  .chapter::before {
    top: 1rem;
    font-size: clamp(10rem, 36vw, 20rem);
  }

  .chapter__meta {
    position: static;
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.75rem 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
  }

  .chapter__meta::before {
    display: none;
  }

  .chapter__number {
    font-size: 2.8rem;
  }

  .chapter__status {
    margin-top: 0;
  }

  .chapter__body {
    grid-column: 1 / -1;
  }

  .chapter__question {
    max-width: 44ch;
  }

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

  .route {
    min-height: 0;
  }

  .route + .route {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .diagram-switch {
    justify-content: flex-start;
  }

  .closing__grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .closing__content {
    max-width: 58ch;
  }

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

  .references__list li:nth-child(odd) {
    border-right: 0;
  }
}

@media (max-width: 640px) {
  .chapter {
    gap: 2rem;
    padding-block: 5rem;
  }

  .chapter::before {
    display: none;
  }

  .chapter__number {
    font-size: 2.3rem;
  }

  .chapter__title {
    font-size: clamp(2.5rem, 12vw, 3.6rem);
  }

  .chapter__question {
    margin-top: 1.2rem;
    font-size: 1rem;
    line-height: 1.75;
  }

  .difficulty,
  .paths {
    margin-top: 3.2rem;
  }

  .difficulty > p {
    font-size: 0.94rem;
    line-height: 1.9;
  }

  .diagram {
    margin-top: 2.2rem;
    padding-block: 1rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .diagram::before {
    content: "← 左右滑动查看完整图示 →";
    display: block;
    position: sticky;
    left: 0;
    width: max-content;
    margin-bottom: 0.55rem;
    color: var(--amber);
    font-family: var(--mono);
    font-size: 0.55rem;
    letter-spacing: 0.05em;
  }

  .diagram > .diagram-svg {
    width: 640px;
    max-width: none;
  }

  .diagram--cap {
    overflow: visible;
  }

  .cap-visual {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .cap-visual .diagram-svg {
    width: 640px;
    max-width: none;
  }

  .diagram__caption {
    position: sticky;
    left: 0;
    width: calc(100vw - 2 * var(--gutter));
    max-width: none;
    font-size: 0.61rem;
  }

  .cap-note {
    position: sticky;
    left: 0;
    width: calc(100vw - 2 * var(--gutter));
    max-width: none;
  }

  .diagram-switch {
    flex-wrap: wrap;
  }

  .route {
    padding: 1.35rem 0;
  }

  .reality {
    padding-left: 1.1rem;
    font-size: 1.02rem;
  }

  .interlude {
    min-height: 60vh;
    padding-block: 5rem;
  }

  .interlude::before {
    left: 0.5rem;
    font-size: 13rem;
  }

  .interlude__quote {
    font-size: clamp(1.8rem, 9vw, 2.6rem);
    line-height: 1.45;
  }

  .closing {
    padding-block: 5.5rem;
  }

  .closing__title {
    font-size: clamp(3.8rem, 21vw, 6rem);
  }

  .references {
    padding-block: 5rem;
  }

  .section-head--references {
    display: block;
  }

  .references__list a {
    grid-template-columns: 22px minmax(0, 1fr) 18px;
    gap: 0.75rem;
    padding: 1rem 0.25rem;
  }

  .references__list a > span:nth-child(2) {
    font-size: 0.72rem;
  }

  .site-footer__inner {
    flex-wrap: wrap;
    row-gap: 0.6rem;
    padding-block: 1.2rem;
  }

  .site-footer__note {
    order: 3;
    width: 100%;
    font-size: 0.54rem;
  }
}

/* Coarse pointers always show the cost; no hover required. */

@media (hover: none), (pointer: coarse) {
  .route__toggle {
    display: none;
  }

  .js .route__cost {
    grid-template-rows: 1fr;
    opacity: 1;
  }
}

/* No-JS fallback for collapsed content */

html:not(.js) .route__cost {
  grid-template-rows: 1fr;
  opacity: 1;
}

/* ------------------------------------------------------------------
   调整:横向扩展新增「卷」分隔层(哲学 / 物理 / 化学 / 历史四大类)
   ------------------------------------------------------------------ */

.volume {
  margin-top: clamp(4.5rem, 9vw, 8rem);
  border-top: 1px solid rgba(240, 235, 223, 0.13);
  background: linear-gradient(170deg, rgba(11, 21, 35, 0.5), rgba(8, 17, 29, 0) 75%);
}

.volume__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: clamp(1.2rem, 4vw, 3.4rem);
  padding-top: clamp(1.7rem, 3.6vw, 3rem);
  padding-bottom: clamp(1.9rem, 4vw, 3.4rem);
}

.volume__num {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6.5vw, 5rem);
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--amber);
  white-space: nowrap;
}

.volume__kicker {
  margin: 0 0 0.7rem;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.volume__title {
  margin: 0 0 0.8rem;
  font-family: var(--serif);
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.06;
  color: var(--paper);
}

.volume__desc {
  margin: 0;
  max-width: 46rem;
  font-size: 0.98rem;
  line-height: 1.75;
  color: var(--paper-dim);
}

/* 卷内「问题域」筛选在非计算机卷时置灰(轻提示,不阻断交互) */

.filter-list--domain[data-inactive] {
  opacity: 0.38;
}

/* ------------------------------------------------------------------
   调整:难题索引按学科卷分组展示(与卷首分隔同一视觉语言)
   ------------------------------------------------------------------ */

.index-group {
  margin-top: 2.4rem;
}

.index-group:first-of-type {
  margin-top: 0;
}

.index-group__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 1.3rem;
  row-gap: 0.25rem;
  padding: 0 6px 0.85rem;
  border-bottom: 1px solid rgba(240, 235, 223, 0.13);
}

.index-group__label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.32em;
  color: var(--amber);
}

.index-group__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.28rem;
  letter-spacing: 0.04em;
  color: var(--paper);
}

.index-group__meta {
  margin: 0 0 0 auto;
  font-size: 0.78rem;
  color: var(--paper-dim);
}

.index-group .index-list {
  margin-top: 0.55rem;
}

.index-group[hidden] {
  display: none;
}

@media (max-width: 860px) {
  .index-group__meta {
    width: 100%;
    margin: 0;
  }
}

@media (max-width: 860px) {
  .volume__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .volume__desc {
    font-size: 0.92rem;
  }
}

/* ------------------------------------------------------------------
   扩编五:右侧常驻「回到顶部」悬浮钮
   (滚动半屏后出现;页脚原生「回到顶部」可见时让位;目录抽屉打开时收起)
   ------------------------------------------------------------------ */

.to-top {
  position: fixed;
  right: clamp(14px, 2.6vw, 34px);
  bottom: clamp(14px, 3.6vh, 34px);
  z-index: 60;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(10, 19, 32, 0.82);
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  pointer-events: none;
  transition:
    opacity 280ms var(--ease),
    transform 280ms var(--ease),
    visibility 280ms,
    color 200ms,
    border-color 200ms;
}

.to-top:hover,
.to-top:focus-visible {
  color: var(--amber);
  border-color: rgba(216, 163, 92, 0.45);
}

.to-top.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

body.menu-open .to-top {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 960px) {
  .to-top {
    width: 40px;
    height: 40px;
    right: 12px;
    bottom: 12px;
  }
}

/* 第三轮:卷分隔区补 id 供左轨五锚点直达;跳转落点给 96px 顶栏余量 */
.volume {
  scroll-margin-top: 96px;
}

/* 第四轮:超长距跳转转场——淡出→瞬时落位→淡回。
   原生 scroll-behavior:smooth 会把数十万 px 压进几百毫秒,读感即「页面快闪掠过」;
   距离经 script.js initSmoothJumps 甄别,近距仍走原生平滑,远距走本转场 */
#main {
  transition: opacity 300ms var(--ease);
}

#main.warp-out {
  opacity: 0;
  transition: opacity 170ms var(--ease);
}
