:root {
  --bg: #0c1114;
  --bg-soft: #141b20;
  --panel: rgba(18, 25, 30, 0.88);
  --panel-strong: rgba(26, 35, 41, 0.96);
  --paper: #ece0ca;
  --paper-dim: #cdbb9b;
  --ink: #171311;
  --steel: #91a5b2;
  --steel-deep: #637887;
  --copper: #c27b3c;
  --copper-bright: #df9e59;
  --ruby: #8f4a57;
  --line: rgba(236, 224, 202, 0.14);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.24);
  --radius: 26px;
  --radius-sm: 16px;
  --max-width: 1260px;
  --body: "Noto Sans SC", sans-serif;
  --display: "Cormorant Garamond", serif;
  --mono: "IBM Plex Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--paper);
  background:
    radial-gradient(circle at top left, rgba(194, 123, 60, 0.18), transparent 32%),
    radial-gradient(circle at 85% 12%, rgba(145, 165, 178, 0.16), transparent 24%),
    linear-gradient(180deg, #11181d 0%, #0b1014 42%, #090d10 100%);
  font-family: var(--body);
  line-height: 1.7;
}

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

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

code {
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(194, 123, 60, 0.14);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.92em;
}

.site-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.4) 0.7px, transparent 0.7px),
    radial-gradient(rgba(255, 255, 255, 0.2) 0.7px, transparent 0.7px);
  background-position: 0 0, 13px 11px;
  background-size: 22px 22px;
  mix-blend-mode: soft-light;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 1.1rem auto 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 17, 20, 0.76);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.brand__crest {
  display: grid;
  place-items: center;
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 50%;
  border: 1px solid rgba(223, 158, 89, 0.4);
  background:
    radial-gradient(circle at 35% 30%, rgba(223, 158, 89, 0.3), transparent 55%),
    linear-gradient(160deg, rgba(194, 123, 60, 0.26), rgba(89, 61, 36, 0.36));
  color: var(--paper);
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
}

.brand__text strong {
  font-size: 0.98rem;
  font-weight: 700;
}

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

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.chapter-nav a {
  padding: 0.48rem 0.8rem;
  border-radius: 999px;
  color: var(--paper-dim);
  font-size: 0.83rem;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.chapter-nav a:hover,
.chapter-nav a.is-active {
  background: rgba(194, 123, 60, 0.16);
  color: var(--paper);
  transform: translateY(-1px);
}

main,
.footer {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 2rem;
  padding: 4.5rem 0 2.5rem;
  align-items: end;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.9rem;
  color: var(--copper-bright);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero h1,
.chapter h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.015em;
}

.hero h1 {
  max-width: 11ch;
  font-size: clamp(3.2rem, 6.6vw, 5.6rem);
  line-height: 0.92;
}

.hero h1 em {
  color: var(--copper-bright);
  font-style: italic;
}

.hero__lede {
  max-width: 62ch;
  margin: 1.5rem 0 0;
  color: rgba(236, 224, 202, 0.84);
  font-size: 1.02rem;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1.7rem 0 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button--primary {
  background: linear-gradient(135deg, var(--copper) 0%, var(--copper-bright) 100%);
  color: #140f0a;
}

.button--ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.hero__stats,
.overview-grid,
.resource-grid,
.signature-grid {
  display: grid;
  gap: 1rem;
}

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

.stat-card,
.overview-panel,
.concept-card,
.step-block,
.resource-panel,
.scoring-card,
.signature-card,
.mini-panel,
.deploy-card {
  position: relative;
  overflow: hidden;
  padding: 1.25rem 1.3rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 35%),
    var(--panel);
  box-shadow: var(--shadow-soft);
}

.stat-card::before,
.overview-panel::before,
.concept-card::before,
.step-block::before,
.resource-panel::before,
.scoring-card::before,
.signature-card::before,
.mini-panel::before,
.deploy-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--copper), transparent 78%);
  opacity: 0.8;
}

.stat-card__label {
  display: inline-block;
  margin-bottom: 0.5rem;
  color: var(--steel);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.stat-card strong,
.overview-panel h3,
.concept-card h3,
.step-block h3,
.resource-panel h3,
.scoring-card h3,
.signature-card h3,
.mini-panel h3,
.deploy-card h3 {
  display: block;
  margin: 0 0 0.55rem;
  font-size: 1.04rem;
}

.hero__visual {
  position: relative;
  display: grid;
  gap: 1rem;
}

.hero-figure {
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(236, 224, 202, 0.16);
  border-radius: calc(var(--radius) + 4px);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.hero-figure img {
  aspect-ratio: 1.24 / 1;
  object-fit: cover;
}

.hero-figure figcaption,
.figure-card figcaption {
  padding: 0.95rem 1rem 1rem;
  color: var(--paper-dim);
  font-size: 0.9rem;
}

.hero__overlay-card {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  width: min(22rem, calc(100% - 2rem));
  padding: 1rem 1rem 1.1rem;
  border: 1px solid rgba(236, 224, 202, 0.16);
  border-radius: 20px;
  background: rgba(11, 15, 19, 0.84);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
}

.hero__overlay-card span {
  display: inline-block;
  margin-bottom: 0.55rem;
  color: var(--copper-bright);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero__overlay-card ol {
  margin: 0;
  padding-left: 1.1rem;
}

.chapter {
  padding: 2.4rem 0;
}

.chapter__heading {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1.6rem;
}

.chapter__index {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  border: 1px solid rgba(194, 123, 60, 0.36);
  background: radial-gradient(circle at 40% 35%, rgba(194, 123, 60, 0.28), rgba(23, 19, 17, 0.2) 70%);
  color: var(--paper);
  font-family: var(--display);
  font-size: 1.4rem;
}

.chapter h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.02;
}

.overview-grid,
.resource-grid,
.signature-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.concept-layout,
.setup-grid,
.scoring-layout,
.figure-duo {
  display: grid;
  gap: 1.2rem;
}

.concept-layout {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: start;
}

.concept-list {
  display: grid;
  gap: 1rem;
}

.figure-stack {
  display: grid;
  gap: 1rem;
}

.figure-card {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.figure-card img {
  width: 100%;
  object-fit: cover;
}

.figure-card--full img,
.figure-card--wide img {
  max-height: 480px;
}

.setup-grid {
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  align-items: start;
}

.setup-steps {
  display: grid;
  gap: 1rem;
}

.step-block span {
  display: inline-flex;
  margin-bottom: 0.45rem;
  color: var(--copper-bright);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.timeline {
  position: relative;
  display: grid;
  gap: 1rem;
  padding-left: 1rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 1px;
  background: linear-gradient(180deg, rgba(194, 123, 60, 0.8), rgba(194, 123, 60, 0.12));
}

.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding-left: 0.25rem;
}

.timeline__marker {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-top: 0.12rem;
  border-radius: 50%;
  background: var(--copper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
}

.timeline__item h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.action-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.action-index a {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--paper-dim);
}

.action-index a:hover {
  color: var(--paper);
  border-color: rgba(194, 123, 60, 0.4);
}

.action-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  gap: 1.2rem;
  align-items: stretch;
  margin-bottom: 1.4rem;
}

.action-panel--reverse {
  grid-template-columns: minmax(0, 1.14fr) minmax(0, 0.86fr);
}

.action-panel--reverse .action-panel__figure {
  order: 2;
}

.action-panel--reverse .action-panel__body {
  order: 1;
}

.action-panel__figure,
.action-panel__body {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.action-panel__figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.action-panel__body {
  padding: 1.45rem 1.45rem 1.55rem;
}

.action-panel__header h3 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.55rem, 2.7vw, 2.1rem);
  line-height: 1.08;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.tag-row li {
  padding: 0.42rem 0.78rem;
  border-radius: 999px;
  background: rgba(145, 165, 178, 0.12);
  color: var(--steel);
  font-size: 0.88rem;
}

.dense-list {
  margin: 0;
  padding-left: 1.1rem;
}

.dense-list li + li {
  margin-top: 0.42rem;
}

.callout {
  margin: 1.1rem 0 0;
  padding: 0.95rem 1rem;
  border-left: 3px solid var(--copper);
  border-radius: 0 16px 16px 0;
  background: rgba(194, 123, 60, 0.08);
  color: rgba(236, 224, 202, 0.9);
}

.mini-panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.mini-panel ul {
  margin: 0.8rem 0 0;
  padding-left: 1.1rem;
}

.resource-grid,
.signature-grid {
  margin-bottom: 1.2rem;
}

.scoring-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1.2rem;
}

.figure-duo {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1.1rem 0;
}

.rule-block {
  position: relative;
  overflow: hidden;
  padding: 1.25rem 1.3rem 1.35rem;
  margin-bottom: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 35%),
    var(--panel);
  box-shadow: var(--shadow-soft);
}

.rule-block::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--copper), transparent 78%);
  opacity: 0.8;
}

.rule-block--accent {
  border-color: rgba(194, 123, 60, 0.22);
}

.rule-block h3 {
  margin: 0 0 0.7rem;
  font-size: 1.15rem;
  color: var(--paper);
}

.rule-block h4 {
  margin: 1.1rem 0 0.5rem;
  font-size: 0.98rem;
  color: var(--copper-bright);
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.rule-block p {
  margin: 0.5rem 0;
}

.rule-block ul,
.rule-block ol {
  margin: 0.5rem 0;
  padding-left: 1.3rem;
}

.rule-block ul ul,
.rule-block ol ol,
.rule-block ul ol,
.rule-block ol ul {
  margin: 0.25rem 0;
}

.rule-block li + li {
  margin-top: 0.3rem;
}

.rule-block a {
  color: var(--copper-bright);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.sub-heading {
  margin: 1.6rem 0 0.8rem;
  font-size: 1.05rem;
  color: var(--paper);
}

.table-wrap {
  overflow-x: auto;
  margin: 0.8rem 0 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.rules-table th,
.rules-table td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.rules-table thead th {
  background: rgba(194, 123, 60, 0.12);
  color: var(--copper-bright);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rules-table tbody tr:last-child td {
  border-bottom: none;
}

.rules-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.rules-table--compact {
  font-size: 0.92rem;
}

.rules-table--compact th,
.rules-table--compact td {
  padding: 0.55rem 0.9rem;
}

.figure-card--wide {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

/* ---- 折叠面板 ---- */
.collapsible {
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  overflow: hidden;
}

.collapsible__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.9rem 1.2rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--paper);
  list-style: none;
  user-select: none;
  transition: background 180ms ease;
}

.collapsible__trigger::-webkit-details-marker {
  display: none;
}

.collapsible__trigger:hover {
  background: rgba(194, 123, 60, 0.08);
}

.collapsible__icon {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--copper-bright);
  border-bottom: 2px solid var(--copper-bright);
  transform: rotate(45deg);
  transition: transform 200ms ease;
  flex-shrink: 0;
  margin-left: 0.8rem;
}

.collapsible[open] > .collapsible__trigger .collapsible__icon {
  transform: rotate(-135deg);
}

.collapsible__body {
  padding: 0 1.2rem 1rem;
}

.collapsible__body .table-wrap {
  margin-top: 0;
}

/* ---- 目录按钮（仅移动端显示） ---- */
.toc-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 180ms ease;
}

.toc-toggle:hover {
  background: rgba(194, 123, 60, 0.14);
}

/* ---- 侧边目录抽屉 ---- */
.toc-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 260ms ease;
}

.toc-backdrop.is-open {
  display: block;
  opacity: 1;
}

.toc-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  width: min(18rem, 82vw);
  height: 100dvh;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(18, 25, 30, 0.98), rgba(12, 17, 20, 0.98));
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-overflow-scrolling: touch;
}

.toc-drawer.is-open {
  transform: translateX(0);
}

.toc-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.toc-drawer__header strong {
  font-size: 1.05rem;
  color: var(--paper);
}

.toc-drawer__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 180ms ease;
}

.toc-drawer__close:hover {
  background: rgba(194, 123, 60, 0.14);
}

.toc-drawer__list {
  margin: 0;
  padding: 0.8rem 0 2rem;
  list-style: none;
}

.toc-drawer__list ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-drawer__list li {
  margin: 0;
}

.toc-link {
  display: block;
  padding: 0.55rem 1.2rem;
  font-size: 0.92rem;
  color: var(--paper-dim);
  transition: color 140ms ease, background 140ms ease;
}

.toc-link:hover {
  color: var(--paper);
  background: rgba(194, 123, 60, 0.1);
}

.toc-drawer__list ul .toc-link {
  padding-left: 2.2rem;
  font-size: 0.84rem;
  color: var(--steel-deep);
}

.toc-drawer__list ul .toc-link:hover {
  color: var(--paper);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0 3rem;
  color: rgba(236, 224, 202, 0.7);
  font-size: 0.92rem;
}

.footer a {
  color: var(--copper-bright);
}

.js-ready .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 420ms ease, transform 420ms ease;
}

.js-ready .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .topbar {
    border-radius: 28px;
  }

  .chapter-nav {
    display: none;
  }

  .hero,
  .concept-layout,
  .setup-grid,
  .action-panel,
  .action-panel--reverse,
  .scoring-layout,
  .figure-duo {
    grid-template-columns: 1fr;
  }

  .action-panel--reverse .action-panel__figure,
  .action-panel--reverse .action-panel__body {
    order: initial;
  }

  .hero__stats,
  .mini-panels,
  .overview-grid,
  .resource-grid,
  .signature-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: 14ch;
  }
}

@media (max-width: 720px) {
  body {
    line-height: 1.62;
  }

  .topbar,
  main,
  .footer {
    width: min(calc(100% - 1.2rem), var(--max-width));
  }

  .topbar {
    padding: 0.8rem 1rem;
  }

  .chapter-nav {
    display: none;
  }

  .toc-toggle {
    display: flex;
  }

  .hero {
    padding-top: 2.8rem;
  }

  .hero h1 {
    font-size: clamp(2.7rem, 13vw, 4.1rem);
  }

  .hero__overlay-card {
    position: static;
    width: auto;
  }

  .chapter {
    padding: 1.8rem 0;
  }

  .chapter__heading {
    gap: 0.8rem;
  }

  .chapter__index {
    width: 2.85rem;
    height: 2.85rem;
    font-size: 1.2rem;
  }

  .action-panel__body,
  .stat-card,
  .overview-panel,
  .concept-card,
  .step-block,
  .resource-panel,
  .scoring-card,
  .signature-card,
  .mini-panel,
  .deploy-card,
  .rule-block {
    padding-inline: 1rem;
  }

  .collapsible__trigger {
    padding: 0.75rem 1rem;
    font-size: 0.92rem;
  }

  .collapsible__body {
    padding: 0 0.8rem 0.8rem;
  }

  .figure-card--full img,
  .figure-card--wide img {
    max-height: 260px;
  }

  .timeline {
    padding-left: 0.2rem;
  }

  .timeline::before {
    left: 0.95rem;
  }
}
