/* =========================================================
   双曲线研究所 · Hyperbola Atlas
   Visual system: warm paper / deep teal / vermilion
   ========================================================= */

:root {
  --paper: #f3eee4;
  --paper-soft: #f8f4eb;
  --paper-deep: #e9e1d3;
  --panel: #fffdf8;
  --ink: #112f34;
  --ink-soft: #294b4e;
  --muted: #687a76;
  --faint: #9aa8a2;
  --line: rgba(17, 47, 52, 0.14);
  --line-strong: rgba(17, 47, 52, 0.26);
  --accent: #e9593c;
  --accent-deep: #bf4029;
  --accent-soft: #f7d9ce;
  --teal: #0d6f65;
  --teal-soft: #dce9e2;
  --gold: #dfa94e;
  --gold-soft: #f4e5c8;
  --violet: #8a75b3;
  --dark: #0d252a;
  --dark-2: #12353a;
  --dark-3: #183f43;
  --cream: #f5eedf;
  --cream-muted: rgba(245, 238, 223, 0.66);
  --cream-faint: rgba(245, 238, 223, 0.38);
  --display: "Iowan Old Style", "Palatino Linotype", "STZhongsong", "Songti SC", "Noto Serif SC", "SimSun", serif;
  --sans: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --max-width: 1280px;
  --page-pad: clamp(20px, 4vw, 52px);
  --shadow-card: 0 22px 60px rgba(26, 42, 39, 0.07);
  --shadow-dark: 0 34px 90px rgba(4, 17, 19, 0.3);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.22;
  background-image: radial-gradient(rgba(17, 47, 52, 0.16) 0.55px, transparent 0.55px);
  background-size: 5px 5px;
  mix-blend-mode: multiply;
}

::selection {
  background: var(--accent);
  color: #fff9ef;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd {
  margin: 0;
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.14;
  text-wrap: balance;
}

h1, h2 {
  font-family: var(--display);
  letter-spacing: -0.035em;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

img, svg {
  display: block;
  max-width: 100%;
}

code, kbd {
  font-family: var(--mono);
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--cream);
  font-size: 13px;
  transform: translateY(-150%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:where(a, button, summary, input, label):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.quiz-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.quiz-option:has(input:focus-visible) .option-letter {
  border-color: var(--accent);
  color: var(--accent);
}

input[type="range"]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

details > summary:focus-visible {
  outline-offset: 2px;
}

/* KaTeX rhythm */
.katex {
  font-size: 1.055em;
}

.katex-display {
  margin: 0.8em 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.16em 0;
  scrollbar-width: thin;
}

.katex-display > .katex {
  white-space: normal;
}

.math {
  font-feature-settings: "ss01";
}

/* =========================================================
   Header / navigation
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  height: 82px;
  padding: 0 var(--page-pad);
  background: rgba(243, 238, 228, 0.87);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.site-header.is-scrolled {
  background: rgba(248, 244, 235, 0.94);
  border-bottom-color: var(--line);
  box-shadow: 0 12px 34px rgba(23, 42, 38, 0.055);
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  height: 2px;
  background: transparent;
  pointer-events: none;
}

#scroll-progress-bar {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.08s linear;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  transition: transform 0.25s ease, background 0.25s ease;
}

.brand:hover .brand-mark {
  transform: rotate(-9deg);
  background: var(--panel);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-copy small {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.2vw, 31px);
  margin-left: auto;
}

.primary-nav a {
  position: relative;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding: 5px 0;
  transition: color 0.2s ease;
}

.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -1px;
  height: 1px;
  background: var(--accent);
  transition: right 0.24s ease;
}

.primary-nav a:hover,
.primary-nav a.is-active {
  color: var(--ink);
}

.primary-nav a:hover::after,
.primary-nav a.is-active::after {
  right: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.header-cta span {
  color: var(--accent);
  font-size: 15px;
}

.header-cta:hover {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 11px 9px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 1px;
  background: var(--ink);
  transition: transform 0.25s ease;
}

.menu-toggle span + span {
  margin-top: 6px;
}

.menu-toggle[aria-expanded="true"] span:first-child {
  transform: translateY(3.5px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-3.5px) rotate(-45deg);
}

.mobile-menu {
  position: fixed;
  z-index: 75;
  inset: 82px 0 0;
  display: none;
  background: var(--paper);
  border-top: 1px solid var(--line);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition: opacity 0.24s ease, transform 0.24s ease, visibility 0.24s;
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mobile-menu-inner {
  padding: 38px var(--page-pad) 30px;
}

.mobile-menu-inner > .eyebrow {
  margin-bottom: 22px;
}

.mobile-menu nav {
  display: flex;
  flex-direction: column;
}

.mobile-menu nav a {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--display);
  font-size: clamp(24px, 6vw, 34px);
  letter-spacing: -0.02em;
}

.mobile-menu nav a span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.mobile-menu-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

body.menu-open {
  overflow: hidden;
}

.noscript-banner {
  position: relative;
  z-index: 2;
  padding: 12px var(--page-pad);
  background: var(--gold-soft);
  border-bottom: 1px solid rgba(166, 122, 50, 0.25);
  color: #6f5324;
  font-size: 12px;
  line-height: 1.6;
}

/* =========================================================
   Shared primitives
   ========================================================= */

.section {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: calc(var(--max-width) + var(--page-pad) * 2);
  margin: 0 auto;
  padding: clamp(76px, 9vw, 122px) var(--page-pad);
}

.section-dark {
  max-width: none;
  width: 100%;
  background:
    radial-gradient(ellipse at 82% 10%, rgba(21, 79, 76, 0.35), transparent 40%),
    radial-gradient(ellipse at 8% 85%, rgba(233, 89, 60, 0.08), transparent 32%),
    var(--dark);
  color: var(--cream);
  overflow: hidden;
}

.section-dark::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(245, 238, 223, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 238, 223, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 80%);
}

.section-dark > * {
  position: relative;
  z-index: 1;
}

.section-tint {
  max-width: none;
  background: var(--paper-deep);
}

.section-tint > .section-heading,
.section-tint > .library-toolbar,
.section-tint > .theorem-grid,
.section-tint > .library-note,
.section-tint > .empty-state {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

.section-heading {
  margin-bottom: clamp(38px, 5vw, 58px);
}

.section-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-kicker span {
  color: var(--accent);
  font-weight: 600;
}

.section-kicker i {
  width: 34px;
  height: 1px;
  background: var(--line-strong);
}

.section-kicker--small {
  margin-bottom: 14px;
  font-size: 9px;
}

.section-heading-row {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.72fr);
  align-items: end;
  gap: clamp(32px, 7vw, 104px);
}

.section-heading h2 {
  font-size: clamp(2.65rem, 5.2vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.section-intro {
  max-width: 520px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
  padding-bottom: 4px;
}

.section-heading--light .section-kicker {
  color: var(--cream-muted);
}

.section-heading--light .section-kicker span {
  color: var(--gold);
}

.section-heading--light .section-kicker i {
  background: rgba(245, 238, 223, 0.24);
}

.section-heading--light .section-intro {
  color: var(--cream-muted);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow span {
  color: var(--accent);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: pointer;
  transition: background 0.22s ease, color 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  background: var(--accent);
  color: #fff9ef;
  border-color: var(--accent);
  box-shadow: 0 12px 26px rgba(191, 64, 41, 0.18);
}

.button-primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.button-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.button-ghost:hover {
  background: var(--panel);
  border-color: var(--ink);
}

.button-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.button-dark:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.play-icon {
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.text-link span {
  color: var(--accent);
  transition: transform 0.2s ease;
}

.text-link:hover {
  color: var(--accent-deep);
  border-color: var(--accent);
}

.text-link:hover span {
  transform: translate(2px, -2px);
}

.reveal {
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js .reveal {
  opacity: 0;
  transform: translateY(22px);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   Hero
   ========================================================= */

.hero {
  position: relative;
  z-index: 1;
  max-width: calc(1360px + var(--page-pad) * 2);
  margin: 0 auto;
  padding: clamp(62px, 8vw, 108px) var(--page-pad) clamp(58px, 7vw, 86px);
  background:
    radial-gradient(ellipse at 73% 32%, rgba(13, 111, 101, 0.075), transparent 32%),
    radial-gradient(ellipse at 12% 82%, rgba(233, 89, 60, 0.055), transparent 32%);
}

.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 8%;
  right: 5%;
  width: 260px;
  height: 260px;
  border: 1px dashed rgba(17, 47, 52, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(420px, 0.84fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: center;
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: clamp(24px, 4vw, 38px);
}

.hero-eyebrow span {
  color: var(--accent);
}

.hero-eyebrow i {
  width: 46px;
  height: 1px;
  background: var(--line-strong);
}

.hero h1 {
  display: flex;
  flex-direction: column;
  margin-left: -0.06em;
  font-size: clamp(4.15rem, 9.2vw, 8.7rem);
  line-height: 0.9;
  letter-spacing: -0.065em;
}

.title-line {
  display: block;
}

.title-line-accent {
  margin-top: clamp(12px, 2vw, 22px);
  font-family: var(--display);
  font-style: normal;
  font-size: clamp(2.25rem, 4.8vw, 4.6rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.055em;
  color: var(--accent);
}

.title-dot {
  color: var(--ink);
}

.hero-lede {
  max-width: 590px;
  margin-top: clamp(27px, 4vw, 39px);
  color: var(--ink-soft);
  font-size: clamp(15px, 1.25vw, 17px);
  line-height: 1.9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.hero-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: clamp(38px, 5vw, 54px) 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.hero-facts > div {
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.hero-facts > div:last-child {
  border-right: 0;
  padding-left: 18px;
}

.hero-facts > div:not(:first-child) {
  padding-left: 18px;
}

.hero-facts dt {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.hero-facts dd {
  margin-top: 5px;
  font-family: var(--display);
  font-size: clamp(20px, 2.1vw, 28px);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero-visual {
  position: relative;
  z-index: 1;
}

.instrument-card {
  position: relative;
  background: linear-gradient(155deg, #14373d 0%, #0b2227 78%);
  color: var(--cream);
  border: 1px solid rgba(245, 238, 223, 0.18);
  box-shadow: 0 42px 100px rgba(7, 27, 30, 0.29), inset 0 1px rgba(255, 255, 255, 0.055);
  overflow: hidden;
}

.instrument-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.055), transparent 28%, transparent 70%, rgba(233, 89, 60, 0.04));
}

.instrument-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 44px;
  padding: 0 17px;
  border-bottom: 1px solid rgba(245, 238, 223, 0.13);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
}

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(245, 238, 223, 0.72);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.live-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(233, 89, 60, 0.13);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(233, 89, 60, 0.11); }
  50% { box-shadow: 0 0 0 7px rgba(233, 89, 60, 0.02); }
}

.instrument-id {
  color: rgba(245, 238, 223, 0.39);
}

.hero-canvas-wrap {
  position: relative;
  height: clamp(380px, 40vw, 510px);
  background:
    radial-gradient(circle at 68% 48%, rgba(233, 89, 60, 0.055), transparent 30%),
    transparent;
}

#hero-canvas {
  width: 100%;
  height: 100%;
}

.hero-eq {
  position: absolute;
  top: 17px;
  right: 19px;
  color: rgba(245, 238, 223, 0.62);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.05em;
}

.hero-floating {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 14px;
  border: 1px solid rgba(245, 238, 223, 0.19);
  background: rgba(8, 29, 33, 0.75);
  backdrop-filter: blur(10px);
}

.hero-floating span {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--gold);
}

.hero-floating strong {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.015em;
  color: var(--cream);
}

.hero-axis-note {
  position: absolute;
  right: 18px;
  bottom: 22px;
  text-align: right;
  font-family: var(--mono);
  font-size: 7.8px;
  letter-spacing: 0.11em;
  line-height: 1.7;
  color: rgba(245, 238, 223, 0.35);
}

.hero-axis-note b {
  font-weight: 400;
  color: rgba(245, 238, 223, 0.63);
}

.instrument-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 17px 14px;
  border-top: 1px solid rgba(245, 238, 223, 0.11);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: rgba(245, 238, 223, 0.38);
}

.hero-stamp {
  position: absolute;
  left: -42px;
  bottom: -38px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 116px;
  height: 116px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--paper);
  color: var(--accent);
  transform: rotate(-11deg);
  box-shadow: 0 14px 34px rgba(17, 47, 52, 0.1);
}

.hero-stamp span {
  font-family: var(--mono);
  font-size: 6.8px;
  letter-spacing: 0.15em;
  line-height: 1.5;
  text-align: center;
}

.hero-stamp strong {
  margin: -1px 0;
  font-family: var(--display);
  font-size: 35px;
  font-weight: 400;
  line-height: 1;
}

.hero-scroll {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: clamp(48px, 7vw, 74px);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
}

.hero-scroll i {
  width: 52px;
  height: 1px;
  background: var(--line-strong);
  transform-origin: left;
  animation: scroll-line 2.4s ease-in-out infinite;
}

@keyframes scroll-line {
  0%, 100% { transform: scaleX(0.35); opacity: 0.4; }
  50% { transform: scaleX(1); opacity: 1; }
}

/* Path strip */
.path-strip {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 17px var(--page-pad);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.36);
}

.path-label {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--accent);
}

.path-items {
  display: flex;
  align-items: center;
  gap: clamp(13px, 2.1vw, 30px);
  min-width: 0;
}

.path-items a {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  font-size: 11px;
  color: var(--ink-soft);
  transition: color 0.2s ease;
}

.path-items a:hover {
  color: var(--accent-deep);
}

.path-items b {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
  color: var(--faint);
}

.path-end {
  margin-left: auto;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--faint);
}

/* =========================================================
   01 · Definition
   ========================================================= */

.definition-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(360px, 0.78fr);
  gap: clamp(26px, 4vw, 52px);
  align-items: stretch;
}

.definition-copy {
  display: flex;
  flex-direction: column;
}

.definition-index {
  margin-bottom: 15px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.lead-copy {
  max-width: 760px;
  font-family: var(--display);
  font-size: clamp(21px, 2.2vw, 28px);
  line-height: 1.72;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.lead-copy strong {
  position: relative;
  color: var(--accent-deep);
  font-weight: 600;
  white-space: nowrap;
}

.lead-copy strong::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px;
  height: 0.34em;
  z-index: -1;
  background: rgba(233, 89, 60, 0.13);
}

.master-formula {
  position: relative;
  margin-top: 28px;
  padding: 26px 28px 23px;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  box-shadow: 0 24px 55px rgba(17, 47, 52, 0.14);
}

.master-formula::after {
  content: "2a";
  position: absolute;
  right: 15px;
  bottom: -28px;
  font-family: var(--display);
  font-size: 138px;
  line-height: 1;
  color: rgba(245, 238, 223, 0.045);
  pointer-events: none;
}

.formula-label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.formula-main {
  position: relative;
  z-index: 1;
  font-size: clamp(17px, 1.9vw, 23px);
}

.formula-main .katex-display {
  margin: 0.38em 0 0.48em;
}

.formula-gloss {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  padding-top: 14px;
  border-top: 1px solid rgba(245, 238, 223, 0.13);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--cream-muted);
}

.formula-gloss b {
  color: var(--cream);
  font-weight: 500;
}

.definition-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.note-item {
  display: flex;
  gap: 13px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.note-num {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--accent);
}

.note-item p {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.8;
}

.note-item strong {
  color: var(--ink);
  font-weight: 600;
}

.reality-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
  margin-top: 27px;
  padding: 18px 20px;
  background: linear-gradient(100deg, rgba(223, 169, 78, 0.14), rgba(223, 169, 78, 0.045));
  border-left: 2px solid var(--gold);
}

.reality-label {
  flex: 0 0 auto;
  max-width: 78px;
  font-family: var(--mono);
  font-size: 7.5px;
  line-height: 1.55;
  letter-spacing: 0.09em;
  color: #a5792e;
}

.reality-note p {
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-soft);
}

.diagram-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  min-height: 100%;
}

.diagram-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.diagram-card-head span:first-child {
  color: var(--accent);
}

.diagram {
  flex: 1;
  min-height: 330px;
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(17, 47, 52, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(17, 47, 52, 0.045) 1px, transparent 1px),
    #fbf8f0;
  background-size: 26px 26px;
}

.diagram svg {
  width: 100%;
  height: 100%;
  min-height: 300px;
  overflow: visible;
}

.diagram-card figcaption {
  padding: 15px 18px 17px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.8;
}

/* Standard forms */
.standard-forms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(250px, 0.86fr);
  gap: 18px;
  margin-top: clamp(46px, 6vw, 72px);
}

.equation-card {
  position: relative;
  padding: 25px 26px 23px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
}

.equation-card::after {
  content: "";
  position: absolute;
  top: 19px;
  right: 19px;
  width: 32px;
  height: 32px;
  border-top: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  opacity: 0.6;
}

.equation-card--dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.equation-card--dark::after {
  border-color: rgba(245, 238, 223, 0.35);
}

.equation-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.equation-tag {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.13em;
  color: var(--muted);
}

.equation-card--dark .equation-tag {
  color: var(--cream-muted);
}

.equation-pill {
  padding: 3px 8px;
  border: 1px solid var(--line);
  font-size: 9px;
  color: var(--muted);
}

.equation-card--dark .equation-pill {
  border-color: rgba(245, 238, 223, 0.2);
  color: var(--cream-muted);
}

.equation-display {
  margin: 20px 0 16px;
  font-size: clamp(18px, 2vw, 23px);
}

.equation-display .katex-display {
  margin: 0;
}

.equation-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 20px;
  margin: 0;
  padding: 15px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.equation-card--dark .equation-list {
  border-top-color: rgba(245, 238, 223, 0.14);
}

.equation-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 10.5px;
}

.equation-list span {
  color: var(--muted);
}

.equation-card--dark .equation-list span {
  color: var(--cream-muted);
}

.equation-list b {
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}

.equation-card--dark .equation-list b {
  color: var(--cream);
}

.abc-card {
  display: flex;
  flex-direction: column;
  padding: 25px 24px 20px;
  background: var(--gold-soft);
  border: 1px solid rgba(166, 122, 50, 0.18);
}

.abc-card h3 {
  margin-top: 10px;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.03em;
}

.abc-figure {
  width: 100%;
  height: 132px;
  margin: 16px 0 4px;
  color: var(--ink);
}

.abc-caption {
  color: #6e5c3d;
  font-size: 11px;
  line-height: 1.75;
}

.abc-chip {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 15px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #8b672c;
}

/* Perspectives */
.perspective-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: clamp(48px, 6vw, 72px);
  border-top: 1px solid var(--line);
}

.perspective-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px clamp(20px, 3vw, 36px) 24px;
  border-right: 1px solid var(--line);
  min-height: 290px;
}

.perspective-card:first-child {
  padding-left: 0;
}

.perspective-card:last-child {
  border-right: 0;
}

.perspective-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.11em;
  color: var(--muted);
}

.perspective-top span {
  color: var(--accent);
}

.perspective-top b {
  font-weight: 400;
}

.perspective-card h3 {
  margin-top: 22px;
  font-family: var(--display);
  font-size: clamp(23px, 2.4vw, 30px);
  letter-spacing: -0.04em;
}

.perspective-card p {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--muted);
}

.perspective-formula {
  margin: 17px 0;
  font-size: 14px;
  color: var(--ink);
}

.perspective-formula .katex-display {
  margin: 0;
}

.mini-note {
  margin-top: auto;
  font-size: 10px;
  color: var(--muted);
}

.perspective-card .text-link {
  margin-top: auto;
}

/* =========================================================
   02 · Explorer / main lab
   ========================================================= */

.explorer {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(338px, 0.73fr);
  border: 1px solid rgba(245, 238, 223, 0.17);
  background: #0a2025;
  box-shadow: var(--shadow-dark);
  overflow: hidden;
}

.explorer-canvas-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid rgba(245, 238, 223, 0.13);
}

.explorer-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  min-height: 49px;
  padding: 0 19px;
  border-bottom: 1px solid rgba(245, 238, 223, 0.12);
}

.live-label--light {
  color: rgba(245, 238, 223, 0.68);
}

.graph-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.graph-mode {
  margin-right: 7px;
  color: rgba(245, 238, 223, 0.36);
  font-family: var(--mono);
  font-size: 7.8px;
  letter-spacing: 0.11em;
}

.graph-btn {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(245, 238, 223, 0.19);
  background: transparent;
  color: rgba(245, 238, 223, 0.78);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.graph-btn:hover {
  background: rgba(245, 238, 223, 0.08);
  border-color: rgba(245, 238, 223, 0.38);
}

.graph-btn--reset {
  font-size: 8px;
  letter-spacing: 0.06em;
}

.explorer-canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  height: auto;
  min-height: clamp(430px, 42vw, 600px);
  touch-action: pan-y;
}

#explorer-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#explorer-canvas:active {
  cursor: grabbing;
}

.canvas-hint {
  position: absolute;
  left: 18px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: rgba(7, 25, 29, 0.72);
  border: 1px solid rgba(245, 238, 223, 0.12);
  color: rgba(245, 238, 223, 0.63);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.drag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(233, 89, 60, 0.15);
}

.canvas-coordinates {
  position: absolute;
  right: 18px;
  bottom: 18px;
  color: rgba(245, 238, 223, 0.32);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.explorer-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid rgba(245, 238, 223, 0.1);
  color: rgba(245, 238, 223, 0.47);
  font-family: var(--mono);
  font-size: 7.6px;
  letter-spacing: 0.04em;
}

.explorer-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.explorer-legend i {
  display: block;
  width: 13px;
  height: 2px;
}

.explorer-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 23px;
  background: #0e292e;
}

.control-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-kicker {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--gold);
}

.axis-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid rgba(245, 238, 223, 0.16);
}

.axis-switch button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid rgba(245, 238, 223, 0.13);
  background: transparent;
  color: rgba(245, 238, 223, 0.52);
  font-size: 10px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.axis-switch button:last-child {
  border-right: 0;
}

.axis-switch button.is-active {
  background: rgba(245, 238, 223, 0.1);
  color: var(--cream);
}

.range-control {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.range-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.range-label label {
  color: rgba(245, 238, 223, 0.63);
  font-size: 11px;
}

.range-label label i {
  font-family: var(--display);
  font-size: 15px;
  color: var(--cream);
}

.range-label output {
  min-width: 42px;
  text-align: right;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
}

input[type="range"] {
  --fill: 50%;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(to right, var(--accent) 0 var(--fill), rgba(245, 238, 223, 0.19) var(--fill) 100%);
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: rgba(245, 238, 223, 0.19);
}

input[type="range"]::-moz-range-progress {
  height: 2px;
  background: var(--accent);
}

input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -5.5px;
  border: 2px solid #0e292e;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 1px rgba(245, 238, 223, 0.6);
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 2px solid #0e292e;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 1px rgba(245, 238, 223, 0.6);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  color: rgba(245, 238, 223, 0.28);
  font-family: var(--mono);
  font-size: 7px;
}

.range-control--point {
  padding-top: 2px;
}

.layer-panel {
  padding-top: 15px;
  border-top: 1px solid rgba(245, 238, 223, 0.13);
}

.layer-title {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  color: rgba(245, 238, 223, 0.36);
}

.layer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 10px;
  margin-top: 10px;
}

.layer-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  color: rgba(245, 238, 223, 0.58);
  font-size: 9.5px;
  cursor: pointer;
  user-select: none;
}

.layer-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.tick {
  position: relative;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(245, 238, 223, 0.29);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.layer-toggle input:checked + .tick {
  background: rgba(245, 238, 223, 0.85);
  border-color: rgba(245, 238, 223, 0.85);
}

.layer-toggle input:checked + .tick::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 4px;
  height: 7px;
  border-right: 1px solid var(--dark);
  border-bottom: 1px solid var(--dark);
  transform: rotate(40deg);
}

.layer-toggle input:focus-visible + .tick {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.layer-toggle em {
  width: 8px;
  height: 2px;
  flex: 0 0 auto;
}

.readout-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgba(245, 238, 223, 0.12);
  border: 1px solid rgba(245, 238, 223, 0.12);
}

.readout-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  background: #102d32;
}

.readout-row span {
  color: rgba(245, 238, 223, 0.42);
  font-size: 8.5px;
}

.readout-row strong {
  color: var(--cream);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
}

.readout-row--accent strong {
  color: var(--gold);
}

.e-meter {
  padding-top: 15px;
  border-top: 1px solid rgba(245, 238, 223, 0.13);
}

.e-meter-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.09em;
  color: rgba(245, 238, 223, 0.38);
}

.e-meter-head span:last-child {
  color: var(--gold);
}

.e-track {
  position: relative;
  height: 16px;
  margin-top: 9px;
  border-top: 1px solid rgba(245, 238, 223, 0.18);
}

.e-track::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, rgba(127, 168, 163, 0.4), var(--accent));
}

.e-track i {
  position: absolute;
  top: -4px;
  left: 10%;
  width: 2px;
  height: 7px;
  background: var(--cream);
  box-shadow: 0 0 0 2px rgba(13, 37, 42, 0.7);
  transition: left 0.12s linear;
}

.e-stop {
  position: absolute;
  top: 7px;
  transform: translateX(-50%);
  color: rgba(245, 238, 223, 0.3);
  font-family: var(--mono);
  font-size: 6.5px;
  font-weight: 400;
}

.e-stop:first-of-type {
  transform: translateX(0);
}

.e-stop:last-of-type {
  transform: translateX(-100%);
}

.e-meter p {
  margin-top: 3px;
  color: rgba(245, 238, 223, 0.36);
  font-size: 8.5px;
  line-height: 1.6;
}

.identity-card {
  margin-top: auto;
  padding: 13px 14px;
  border: 1px solid rgba(233, 89, 60, 0.3);
  background: linear-gradient(135deg, rgba(233, 89, 60, 0.1), rgba(233, 89, 60, 0.025));
}

.identity-label {
  display: block;
  margin-bottom: 3px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.identity-card .identity-formula {
  color: rgba(245, 238, 223, 0.82);
  font-size: 12px;
}

.identity-card .identity-formula .katex-display {
  margin: 2px 0 4px;
}

.identity-value {
  color: rgba(245, 238, 223, 0.48);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.03em;
}

.identity-card b {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
}

.explorer-footnotes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 21px;
  color: var(--cream-muted);
  font-size: 11px;
  line-height: 1.75;
}

.explorer-footnotes p {
  padding-left: 16px;
  border-left: 1px solid rgba(245, 238, 223, 0.18);
}

.explorer-footnotes span {
  display: block;
  margin-bottom: 3px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.13em;
  color: var(--gold);
}

/* =========================================================
   03 · Properties
   ========================================================= */

.property-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.property-card {
  position: relative;
  min-height: 286px;
  padding: 23px 22px 21px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.32);
  transition: background 0.25s ease, transform 0.25s ease;
}

.property-card:hover {
  background: var(--panel);
  transform: translateY(-3px);
}

.property-index {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.property-icon {
  position: absolute;
  right: 20px;
  top: 19px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: var(--display);
  font-size: 18px;
  color: var(--accent);
}

.property-card h3 {
  margin-top: 25px;
  font-family: var(--display);
  font-size: 23px;
  letter-spacing: -0.03em;
}

.property-card p {
  margin-top: 9px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.8;
}

.property-formula {
  margin-top: auto;
  padding-top: 16px;
  font-size: 11px;
  color: var(--ink-soft);
}

.property-formula .katex-display {
  margin: 0;
}

.property-card--accent {
  background: var(--ink);
  color: var(--cream);
}

.property-card--accent:hover {
  background: var(--ink);
}

.property-card--accent .property-index,
.property-card--accent p {
  color: var(--cream-muted);
}

.property-card--accent .property-icon {
  border-color: rgba(245, 238, 223, 0.25);
  color: var(--gold);
}

.property-card--accent .property-formula {
  color: var(--cream);
}

.property-card--teal {
  background: var(--teal);
  color: var(--cream);
}

.property-card--teal:hover {
  background: var(--teal);
}

.property-card--teal .property-index,
.property-card--teal p {
  color: rgba(245, 238, 223, 0.67);
}

.property-card--teal .property-icon {
  border-color: rgba(245, 238, 223, 0.27);
  color: var(--gold);
}

.property-card--teal .property-formula {
  color: var(--cream);
}

.compare-block {
  display: grid;
  grid-template-columns: minmax(0, 0.64fr) minmax(0, 1.36fr);
  gap: clamp(30px, 6vw, 86px);
  align-items: start;
  margin-top: clamp(50px, 7vw, 90px);
  padding-top: clamp(38px, 5vw, 54px);
  border-top: 1px solid var(--line);
}

.compare-intro h3 {
  max-width: 330px;
  margin-top: 20px;
  font-family: var(--display);
  font-size: clamp(29px, 3.5vw, 43px);
  letter-spacing: -0.05em;
  line-height: 1.03;
}

.compare-intro p {
  max-width: 360px;
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.9;
}

.compare-table-wrap {
  border: 1px solid var(--line);
  background: var(--panel);
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  text-align: left;
}

.compare-table th {
  padding: 14px 17px;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(17, 47, 52, 0.035);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.compare-table th:nth-child(3) {
  color: var(--accent-deep);
}

.compare-table td {
  padding: 14px 17px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-soft);
}

.compare-table tr:last-child td {
  border-bottom: 0;
}

.compare-table td:first-child {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.compare-table td:nth-child(2) {
  color: var(--muted);
}

.compare-table td:nth-child(3) {
  color: var(--ink);
  background: rgba(233, 89, 60, 0.035);
}

.quote-callout {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-top: clamp(60px, 8vw, 108px);
  padding: 28px 30px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.quote-mark {
  font-family: var(--display);
  font-size: 88px;
  line-height: 0.6;
  color: var(--accent);
  opacity: 0.58;
}

.quote-callout p {
  font-family: var(--display);
  font-size: clamp(20px, 2.6vw, 30px);
  line-height: 1.5;
  letter-spacing: -0.025em;
}

.quote-source {
  align-self: end;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.7;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: right;
}

/* =========================================================
   04 · Theorem library
   ========================================================= */

.library-toolbar,
.problem-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 27px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.chip:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 310px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 253, 248, 0.55);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.search-field:focus-within {
  border-color: var(--ink);
  background: var(--panel);
}

.search-icon {
  flex: 0 0 auto;
  font-family: var(--display);
  font-size: 19px;
  line-height: 1;
  color: var(--accent);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
}

.search-field input::placeholder {
  color: var(--faint);
}

.search-field kbd {
  flex: 0 0 auto;
  padding: 1px 5px;
  border: 1px solid var(--line);
  font-size: 8px;
  color: var(--muted);
}

.theorem-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
  align-items: start;
}

.theorem-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 25px 25px 22px;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  box-shadow: 0 14px 38px rgba(26, 42, 39, 0.035);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.theorem-card:hover {
  background: var(--panel);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.theorem-card.is-highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(233, 89, 60, 0.13), 0 18px 48px rgba(26, 42, 39, 0.09);
}

.theorem-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 25px;
  width: 53px;
  height: 2px;
  background: var(--accent);
}

.theorem-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.theorem-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.11em;
  color: var(--teal);
  text-transform: uppercase;
}

.theorem-category::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--teal);
}

.theorem-number {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--faint);
}

.theorem-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
  margin-top: 18px;
}

.theorem-title-row h3 {
  font-family: var(--display);
  font-size: clamp(23px, 2.3vw, 29px);
  letter-spacing: -0.035em;
}

.theorem-index {
  font-family: var(--display);
  font-size: 29px;
  line-height: 1;
  color: var(--accent-soft);
}

.theorem-summary {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.theorem-formula {
  margin-top: 17px;
  padding: 16px 18px;
  background: rgba(17, 47, 52, 0.035);
  border-left: 2px solid var(--gold);
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--ink-soft);
  overflow-x: auto;
}

.theorem-formula .katex-display {
  margin: 0.42em 0;
}

.theorem-formula p {
  margin: 0.35em 0;
}

.theorem-note {
  margin-top: 13px;
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.75;
}

.theorem-details {
  margin-top: 17px;
  border-top: 1px solid var(--line);
}

.theorem-details summary,
.solution-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 0 1px;
  list-style: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  transition: color 0.2s ease;
}

.theorem-details summary::-webkit-details-marker,
.solution-details summary::-webkit-details-marker {
  display: none;
}

.theorem-details summary::after,
.solution-details summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  transition: transform 0.2s ease, background 0.2s ease;
}

.theorem-details[open] summary::after,
.solution-details[open] summary::after {
  content: "−";
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.theorem-details summary:hover,
.solution-details summary:hover {
  color: var(--accent-deep);
}

.theorem-proof {
  min-width: 0;
  overflow-x: auto;
  padding-top: 8px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.9;
}

.theorem-proof .katex-display {
  margin: 0.6em 0;
}

.theorem-tags,
.problem-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 15px;
}

.tag {
  padding: 3px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.03em;
}

.library-note {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 27px;
  padding: 17px 20px;
  border: 1px solid rgba(17, 47, 52, 0.14);
  background: rgba(255, 253, 248, 0.35);
}

.library-note-label {
  flex: 0 0 auto;
  padding-right: 18px;
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.11em;
  color: var(--accent-deep);
}

.library-note p {
  flex: 1;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.library-note .text-link {
  flex: 0 0 auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 70px 20px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 12px;
}

.empty-state span {
  font-family: var(--display);
  font-size: 42px;
  line-height: 1;
  color: var(--accent);
}

/* =========================================================
   05 · Problems
   ========================================================= */

.error-radar {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0;
  margin-bottom: clamp(38px, 5vw, 52px);
  border: 1px solid var(--line);
  background: var(--panel);
}

.error-radar-head {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--gold-soft);
}

.error-radar-head span {
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: -0.03em;
  color: #765527;
}

.error-radar-head small {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.13em;
  color: #987334;
}

.error-radar-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.error-radar-items p {
  display: flex;
  gap: 10px;
  padding: 17px 15px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.error-radar-items p:last-child {
  border-right: 0;
}

.error-radar-items b {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--accent);
}

.problem-toolbar {
  align-items: flex-end;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.problem-toolbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.problem-count {
  white-space: nowrap;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.search-field--small {
  flex-basis: 148px;
  height: 34px;
}

.problem-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
  align-items: start;
}

.problem-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 23px 24px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(26, 42, 39, 0.035);
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.problem-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 18px 48px rgba(26, 42, 39, 0.07);
}

.problem-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 24px;
  width: 42px;
  height: 2px;
  background: var(--teal);
}

.problem-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.problem-meta {
  display: flex;
  align-items: center;
  gap: 9px;
}

.problem-category {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  color: var(--teal);
}

.problem-difficulty {
  display: flex;
  align-items: center;
  gap: 3px;
}

.problem-difficulty i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line-strong);
}

.problem-difficulty i.on {
  background: var(--accent);
}

.problem-number {
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--faint);
}

.problem-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
}

.problem-title-row h3 {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.025em;
}

.problem-title-row .problem-mark {
  font-family: var(--display);
  font-size: 23px;
  color: var(--accent-soft);
}

.problem-question {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.85;
}

.problem-question .katex-display {
  margin: 0.52em 0;
}

.problem-hint {
  display: flex;
  gap: 9px;
  margin-top: 13px;
  padding: 8px 10px;
  background: rgba(13, 111, 101, 0.055);
  border-left: 2px solid rgba(13, 111, 101, 0.35);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.problem-hint span {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.06em;
  color: var(--teal);
}

.solution-details {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.solution-details summary {
  padding-bottom: 1px;
}

.solution-body {
  min-width: 0;
  overflow-x: auto;
  padding-top: 9px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.9;
}

.solution-body .katex-display {
  margin: 0.55em 0;
}

.solution-steps {
  margin: 0;
  padding-left: 20px;
}

.solution-steps > li {
  padding-left: 4px;
  margin-bottom: 7px;
}

.solution-steps > li::marker {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
}

.solution-note {
  margin-top: 12px;
  padding: 9px 11px;
  background: rgba(223, 169, 78, 0.1);
  border-left: 2px solid var(--gold);
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.75;
}

.problem-answer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 13px;
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--ink);
  color: var(--cream);
}

.problem-answer span {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.11em;
  color: var(--gold);
}

.problem-answer p {
  color: var(--cream);
  font-size: 12px;
  text-align: right;
}

.problem-answer .katex {
  color: var(--cream);
}

.problem-footer-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  margin-top: clamp(42px, 6vw, 66px);
  padding-top: 28px;
  border-top: 1px solid var(--line-strong);
}

.problem-footer-note p {
  max-width: 730px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.85;
}

.problem-footer-note strong {
  color: var(--ink);
  font-weight: 600;
}

/* =========================================================
   06 · Experiments
   ========================================================= */

.experiment {
  padding: 0;
  border: 1px solid rgba(245, 238, 223, 0.16);
  background: rgba(16, 44, 49, 0.58);
  backdrop-filter: blur(5px);
  box-shadow: 0 26px 70px rgba(4, 17, 19, 0.13);
}

.experiment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 21px;
  border-bottom: 1px solid rgba(245, 238, 223, 0.12);
}

.experiment-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.experiment-no {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.experiment-head h3 {
  font-family: var(--display);
  font-size: clamp(23px, 2.7vw, 31px);
  font-weight: 400;
  letter-spacing: -0.03em;
}

.experiment-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--cream-muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
}

.experiment-badge i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 111, 101, 0.2);
}

.experiment-body--split {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(290px, 0.82fr);
}

.experiment-canvas {
  position: relative;
  min-height: 390px;
  background: #0a2025;
}

.experiment-body--split .experiment-canvas {
  border-right: 1px solid rgba(245, 238, 223, 0.12);
}

.experiment-canvas canvas {
  width: 100%;
  height: 100%;
  min-height: 390px;
}

.experiment-caption {
  position: absolute;
  left: 16px;
  bottom: 14px;
  color: rgba(245, 238, 223, 0.35);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.experiment-side {
  display: flex;
  flex-direction: column;
  gap: 17px;
  padding: 22px;
}

.mini-range {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mini-range .range-label label {
  font-size: 10px;
}

.mini-range .range-label label i {
  font-size: 14px;
}

.mini-range .range-label output {
  font-size: 10px;
}

.readout-panel--light {
  background: rgba(245, 238, 223, 0.12);
  border-color: rgba(245, 238, 223, 0.12);
}

.readout-panel--light .readout-row {
  background: rgba(9, 30, 34, 0.65);
  padding: 8px 9px;
}

.readout-panel--light .readout-row span {
  color: rgba(245, 238, 223, 0.4);
}

.readout-panel--light .readout-row strong {
  font-size: 10px;
}

.readout-panel--light .readout-row--accent {
  background: rgba(233, 89, 60, 0.1);
}

.readout-panel--light .readout-row--accent strong {
  color: var(--gold);
}

.formula-strip {
  padding: 12px 13px;
  border: 1px solid rgba(245, 238, 223, 0.14);
  background: rgba(245, 238, 223, 0.035);
  color: var(--cream);
  font-size: 11px;
}

.formula-strip .katex-display {
  margin: 0;
}

.formula-strip .katex {
  font-size: 1.05em;
  color: var(--cream);
}

.experiment-note {
  margin-top: -4px;
  color: rgba(245, 238, 223, 0.36);
  font-size: 9px;
  line-height: 1.7;
}

.experiment-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.experiment-row .experiment-canvas {
  min-height: 300px;
  border-bottom: 1px solid rgba(245, 238, 223, 0.12);
}

.experiment-row .experiment-canvas canvas {
  min-height: 300px;
}

.experiment-controls {
  padding: 17px 21px 11px;
}

.mini-readout-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 21px;
  border-top: 1px solid rgba(245, 238, 223, 0.12);
  border-bottom: 1px solid rgba(245, 238, 223, 0.12);
}

.mini-readout-row > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 10px 0;
  border-right: 1px solid rgba(245, 238, 223, 0.1);
}

.mini-readout-row > div:last-child {
  padding-left: 13px;
  border-right: 0;
}

.mini-readout-row span {
  color: rgba(245, 238, 223, 0.38);
  font-size: 8px;
}

.mini-readout-row strong {
  color: var(--cream);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
}

.formula-strip--compact {
  margin: 14px 21px 20px;
}

.lab-footnote {
  margin-top: 24px;
  text-align: right;
  color: rgba(245, 238, 223, 0.35);
  font-size: 9px;
}

/* =========================================================
   07 · Cheatsheet & quiz
   ========================================================= */

.cheat-sheet {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-card);
}

.cheat-sheet::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(17, 47, 52, 0.075);
  pointer-events: none;
}

.sheet-head {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 27px 30px 22px;
  border-bottom: 1px solid var(--line-strong);
}

.sheet-kicker {
  display: block;
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.sheet-head h3 {
  font-family: var(--display);
  font-size: clamp(31px, 4vw, 45px);
  letter-spacing: -0.045em;
}

.button-print {
  min-height: 39px;
  font-size: 10px;
}

.sheet-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sheet-cell {
  min-height: 205px;
  padding: 19px 19px 17px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.sheet-cell:nth-child(4n) {
  border-right: 0;
}

.sheet-cell:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.sheet-no {
  display: block;
  margin-bottom: 13px;
  font-family: var(--mono);
  font-size: 8px;
  color: var(--accent);
}

.sheet-cell h4 {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: -0.02em;
}

.sheet-cell p {
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-soft);
}

.sheet-cell .katex-display {
  margin: 0.35em 0;
  font-size: 0.92em;
}

.sheet-cell small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.7;
}

.sheet-cell--accent {
  background: var(--gold-soft);
}

.sheet-cell--accent .sheet-no {
  color: #9c712e;
}

.sheet-cell--accent ul {
  margin: 9px 0 0;
  padding-left: 15px;
  color: #6f5a36;
  font-size: 9.5px;
  line-height: 1.9;
}

.sheet-cell--accent li::marker {
  color: #b78132;
}

.quiz-block {
  margin-top: 25px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.42);
}

.quiz-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 25px 27px 19px;
  border-bottom: 1px solid var(--line);
}

.quiz-head h3 {
  font-family: var(--display);
  font-size: clamp(27px, 3.2vw, 37px);
  letter-spacing: -0.04em;
}

.quiz-head > p {
  max-width: 300px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.75;
}

.quiz-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.quiz-question {
  padding: 21px 23px 19px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quiz-question:nth-child(2n) {
  border-right: 0;
}

.quiz-question:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.quiz-question--last {
  grid-column: span 2;
  border-right: 0;
}

.quiz-q-head {
  display: flex;
  gap: 9px;
  align-items: baseline;
  margin-bottom: 12px;
}

.quiz-q-head span {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--accent);
}

.quiz-q-text {
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.8;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 13px;
}

.quiz-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.45);
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.quiz-option:hover {
  border-color: var(--line-strong);
  background: var(--panel);
}

.quiz-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-letter {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8px;
  color: var(--muted);
}

.quiz-option.is-selected {
  border-color: var(--ink);
  background: rgba(17, 47, 52, 0.04);
  color: var(--ink);
}

.quiz-option.is-selected .option-letter {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.quiz-option.is-correct {
  border-color: var(--teal);
  background: rgba(13, 111, 101, 0.08);
  color: var(--teal);
}

.quiz-option.is-correct .option-letter {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--cream);
}

.quiz-option.is-wrong {
  border-color: var(--accent);
  background: rgba(233, 89, 60, 0.07);
  color: var(--accent-deep);
}

.quiz-option.is-wrong .option-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--cream);
}

.quiz-option.is-disabled {
  cursor: default;
}

.quiz-explanation {
  display: none;
  margin-top: 10px;
  padding: 9px 11px;
  background: rgba(223, 169, 78, 0.1);
  border-left: 2px solid var(--gold);
  color: var(--ink-soft);
  font-size: 9.5px;
  line-height: 1.75;
}

.quiz-explanation.is-visible {
  display: block;
}

.quiz-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 23px;
  border-top: 1px solid var(--line);
}

.quiz-actions .button {
  min-height: 40px;
  font-size: 11px;
}

.quiz-score {
  margin-left: auto;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
}

.quiz-score strong {
  color: var(--accent);
  font-size: 18px;
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  position: relative;
  z-index: 1;
  padding: 48px var(--page-pad) 20px;
  background: var(--dark);
  color: var(--cream);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 0.8fr;
  gap: 40px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-bottom: 35px;
  border-bottom: 1px solid rgba(245, 238, 223, 0.14);
}

.footer-brand {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}

.footer-brand .brand-mark {
  border-color: rgba(245, 238, 223, 0.22);
  color: var(--accent);
}

.footer-brand strong {
  display: block;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 400;
}

.footer-brand small {
  display: block;
  margin-top: 3px;
  color: var(--cream-muted);
  font-size: 9px;
}

.footer-note {
  max-width: 450px;
  color: var(--cream-muted);
  font-size: 10px;
  line-height: 1.9;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
}

.footer-links a {
  color: var(--cream-muted);
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--gold);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-top: 17px;
  color: rgba(245, 238, 223, 0.3);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1180px) {
  .primary-nav {
    gap: 15px;
  }

  .primary-nav a {
    font-size: 12px;
  }

  .header-cta {
    display: none;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(370px, 0.8fr);
    gap: 38px;
  }

  .hero h1 {
    font-size: clamp(4rem, 9vw, 7.2rem);
  }

  .standard-forms {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .abc-card {
    grid-column: span 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    grid-template-rows: auto auto 1fr;
    column-gap: 30px;
    align-items: center;
  }

  .abc-card .abc-figure {
    grid-column: 2;
    grid-row: 1 / span 3;
    height: 150px;
    margin: 0;
  }

  .abc-card .abc-chip {
    margin-top: 5px;
  }

  .property-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .property-card {
    min-height: 245px;
  }

  .explorer {
    grid-template-columns: minmax(0, 1.38fr) minmax(320px, 0.72fr);
  }

  .explorer-canvas-wrap {
    height: auto;
    min-height: clamp(420px, 45vw, 540px);
  }
}

@media (max-width: 980px) {
  html {
    scroll-padding-top: 76px;
  }

  .site-header {
    height: 70px;
  }

  .primary-nav {
    display: none;
  }

  .menu-toggle {
    display: block;
  }

  .mobile-menu {
    display: block;
    top: 70px;
  }

  .header-actions {
    margin-left: auto;
  }

  .hero {
    padding-top: 48px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .hero-copy {
    max-width: 760px;
  }

  .hero h1 {
    font-size: clamp(4rem, 12vw, 7rem);
  }

  .hero-visual {
    width: min(100%, 680px);
    margin-left: auto;
  }

  .hero-stamp {
    left: auto;
    right: -18px;
  }

  .hero-scroll {
    margin-top: 42px;
  }

  .path-strip {
    gap: 16px;
    overflow: hidden;
  }

  .path-items {
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .path-items::-webkit-scrollbar {
    display: none;
  }

  .path-end {
    display: none;
  }

  .section-heading-row {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .section-heading h2 {
    font-size: clamp(2.7rem, 7vw, 4.3rem);
  }

  .section-intro {
    max-width: 620px;
  }

  .definition-grid {
    grid-template-columns: 1fr;
  }

  .definition-copy {
    max-width: 820px;
  }

  .diagram-card {
    min-height: 440px;
  }

  .diagram {
    min-height: 350px;
  }

  .explorer {
    grid-template-columns: 1fr;
  }

  .explorer-canvas-panel {
    border-right: 0;
    border-bottom: 1px solid rgba(245, 238, 223, 0.13);
  }

  .explorer-canvas-wrap {
    height: min(62vw, 560px);
    min-height: 400px;
    flex: none;
  }

  .explorer-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 26px;
    padding: 25px;
  }

  .control-head,
  .layer-panel,
  .identity-card {
    grid-column: span 2;
  }

  .layer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .e-meter {
    grid-column: span 2;
    padding-top: 0;
    border-top: 0;
  }

  .readout-panel {
    align-self: start;
  }

  .identity-card {
    margin-top: 0;
  }

  .compare-block {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .compare-intro p {
    max-width: 620px;
  }

  .theorem-grid,
  .problem-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .error-radar {
    grid-template-columns: 130px minmax(0, 1fr);
  }

  .error-radar-items {
    grid-template-columns: 1fr;
  }

  .error-radar-items p {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .error-radar-items p:last-child {
    border-bottom: 0;
  }

  .experiment-body--split {
    grid-template-columns: 1fr;
  }

  .experiment-body--split .experiment-canvas {
    border-right: 0;
    border-bottom: 1px solid rgba(245, 238, 223, 0.12);
  }

  .experiment-canvas {
    min-height: 360px;
  }

  .experiment-canvas canvas {
    min-height: 360px;
  }

  .experiment-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .experiment-side .readout-panel {
    grid-column: span 2;
  }

  .experiment-side .formula-strip {
    grid-column: span 2;
  }

  .experiment-note {
    grid-column: span 2;
  }

  .experiment-row {
    grid-template-columns: 1fr;
  }

  .experiment-row .experiment-canvas {
    min-height: 350px;
  }

  .experiment-row .experiment-canvas canvas {
    min-height: 350px;
  }

  .sheet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sheet-cell:nth-child(2n) {
    border-right: 0;
  }

  .sheet-cell:nth-child(4n) {
    border-right: 0;
  }

  .sheet-cell:nth-last-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }

  .sheet-cell:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .quiz-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .quiz-question,
  .quiz-question:nth-child(2n) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .quiz-question--last {
    grid-column: auto;
  }

  .quiz-question:last-child {
    border-bottom: 0;
  }

  .footer-grid {
    grid-template-columns: 1fr 1.3fr;
  }

  .footer-links {
    grid-column: span 2;
    flex-direction: row;
    justify-content: flex-start;
    gap: 18px;
    align-items: center;
  }
}

@media (max-width: 720px) {
  .site-header {
    padding: 0 18px;
  }

  .brand-copy strong {
    font-size: 13px;
  }

  .brand-copy small {
    font-size: 7.5px;
  }

  .hero {
    padding: 38px 18px 50px;
  }

  .hero::after {
    display: none;
  }

  .hero h1 {
    font-size: clamp(3.65rem, 18vw, 5.7rem);
  }

  .title-line-accent {
    font-size: clamp(2.05rem, 10vw, 3.2rem);
  }

  .hero-lede {
    font-size: 14px;
    line-height: 1.85;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .button {
    width: 100%;
  }

  .hero-facts {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 0;
  }

  .hero-facts > div {
    padding-right: 12px;
  }

  .hero-facts > div:nth-child(2n) {
    border-right: 0;
    padding-left: 18px;
  }

  .hero-facts > div:nth-child(3),
  .hero-facts > div:nth-child(4) {
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .hero-facts > div:nth-child(3) {
    padding-left: 0;
  }

  .hero-facts > div:nth-child(4) {
    padding-left: 18px;
  }

  .hero-canvas-wrap {
    height: 330px;
  }

  .hero-eq {
    top: 12px;
    right: 12px;
    font-size: 8px;
  }

  .hero-floating {
    left: 12px;
    bottom: 12px;
    padding: 9px 11px;
  }

  .hero-floating strong {
    font-size: 13px;
  }

  .hero-axis-note {
    display: none;
  }

  .hero-stamp {
    width: 88px;
    height: 88px;
    right: -8px;
    bottom: -24px;
  }

  .hero-stamp strong {
    font-size: 26px;
  }

  .hero-stamp span {
    font-size: 5.6px;
  }

  .instrument-bar {
    padding: 0 12px;
  }

  .instrument-id {
    font-size: 7px;
  }

  .instrument-foot {
    flex-direction: column;
    gap: 3px;
    padding: 11px 12px;
  }

  .hero-scroll {
    margin-top: 34px;
  }

  .path-strip {
    padding: 14px 18px;
  }

  .path-label {
    display: none;
  }

  .path-items {
    gap: 17px;
  }

  .section {
    padding: 64px 18px;
  }

  .section-tint {
    padding-left: 18px;
    padding-right: 18px;
  }

  .section-heading {
    margin-bottom: 30px;
  }

  .section-kicker {
    margin-bottom: 13px;
    font-size: 8.5px;
  }

  .section-heading h2 {
    font-size: clamp(2.45rem, 12vw, 3.3rem);
  }

  .section-intro {
    font-size: 13px;
    line-height: 1.8;
  }

  .lead-copy {
    font-size: 19px;
    line-height: 1.75;
  }

  .master-formula {
    padding: 20px 18px;
  }

  .definition-notes {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .reality-note {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 15px 16px;
  }

  .reality-label {
    max-width: none;
  }

  .diagram-card {
    min-height: 360px;
  }

  .diagram {
    min-height: 285px;
    padding: 5px;
  }

  .diagram svg {
    min-height: 280px;
  }

  .diagram-card figcaption {
    padding: 12px 14px;
    font-size: 10.5px;
  }

  .standard-forms {
    grid-template-columns: 1fr;
    margin-top: 38px;
  }

  .abc-card {
    grid-column: auto;
    display: flex;
    padding: 20px;
  }

  .abc-card .abc-figure {
    width: 100%;
    height: 128px;
    margin: 12px 0 3px;
  }

  .equation-card {
    padding: 20px;
  }

  .equation-display {
    margin: 15px 0 12px;
  }

  .perspective-grid {
    grid-template-columns: 1fr;
    margin-top: 38px;
  }

  .perspective-card {
    min-height: 0;
    padding: 22px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .perspective-card:last-child {
    border-bottom: 0;
  }

  .perspective-card h3 {
    margin-top: 14px;
  }

  .explorer-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
  }

  .graph-actions {
    width: 100%;
  }

  .graph-mode {
    margin-right: auto;
  }

  .explorer-canvas-wrap {
    height: 375px;
    min-height: 0;
    flex: none;
  }

  .explorer-legend {
    gap: 8px 12px;
    padding: 11px 13px;
    font-size: 7px;
  }

  .explorer-controls {
    display: flex;
    flex-direction: column;
    gap: 19px;
    padding: 20px 17px;
  }

  .layer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .readout-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .explorer-footnotes {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .property-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .property-card {
    min-height: 0;
    padding: 20px;
  }

  .property-card h3 {
    margin-top: 19px;
  }

  .property-formula {
    padding-top: 12px;
  }

  .compare-block {
    margin-top: 45px;
    padding-top: 32px;
  }

  .compare-table th,
  .compare-table td {
    padding: 12px 13px;
  }

  .quote-callout {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 52px;
    padding: 22px 0;
  }

  .quote-mark {
    font-size: 56px;
  }

  .quote-callout p {
    font-size: 19px;
  }

  .quote-source {
    text-align: left;
  }

  .library-toolbar,
  .problem-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 13px;
  }

  .filter-chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .filter-chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex: 0 0 auto;
  }

  .search-field {
    flex-basis: auto;
    width: 100%;
  }

  .theorem-card,
  .problem-card {
    padding: 20px 18px;
  }

  .theorem-card::before,
  .problem-card::before {
    left: 18px;
  }

  .theorem-title-row h3 {
    font-size: 23px;
  }

  .theorem-formula {
    padding: 13px 12px;
    font-size: 11.5px;
  }

  .theorem-proof {
    font-size: 11px;
  }

  .library-note {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
  }

  .library-note-label {
    padding-right: 0;
    border-right: 0;
  }

  .error-radar {
    grid-template-columns: 1fr;
  }

  .error-radar-head {
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px 15px;
  }

  .error-radar-head span {
    font-size: 20px;
  }

  .error-radar-head small {
    margin-top: 0;
  }

  .error-radar-items p {
    padding: 13px 15px;
  }

  .problem-toolbar-right {
    justify-content: space-between;
  }

  .search-field--small {
    flex: 1;
    width: auto;
  }

  .problem-title-row h3 {
    font-size: 20px;
  }

  .problem-question {
    font-size: 12px;
  }

  .problem-footer-note {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    margin-top: 42px;
  }

  .problem-footer-note .button {
    width: 100%;
  }

  .experiment-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
    padding: 15px 16px;
  }

  .experiment-head > div:first-child {
    gap: 10px;
    flex-direction: column;
  }

  .experiment-head h3 {
    font-size: 25px;
  }

  .experiment-canvas,
  .experiment-body--split .experiment-canvas,
  .experiment-row .experiment-canvas {
    min-height: 300px;
  }

  .experiment-canvas canvas,
  .experiment-body--split .experiment-canvas canvas,
  .experiment-row .experiment-canvas canvas {
    min-height: 300px;
  }

  .experiment-side {
    display: flex;
    padding: 18px 16px;
    gap: 15px;
  }

  .experiment-controls {
    padding: 14px 16px 9px;
  }

  .mini-readout-row {
    margin: 0 16px;
  }

  .formula-strip--compact {
    margin: 12px 16px 16px;
  }

  .lab-footnote {
    text-align: left;
    line-height: 1.7;
  }

  .sheet-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
    padding: 20px 18px 16px;
  }

  .sheet-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sheet-cell,
  .sheet-cell:nth-child(2n),
  .sheet-cell:nth-child(4n),
  .sheet-cell:nth-last-child(-n + 2) {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 16px 18px;
  }

  .sheet-cell:last-child {
    border-bottom: 0;
  }

  .quiz-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 20px 18px 15px;
  }

  .quiz-question {
    padding: 17px 18px;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

  .quiz-actions {
    flex-wrap: wrap;
    padding: 15px 18px;
  }

  .quiz-score {
    flex-basis: 100%;
    margin-left: 0;
    text-align: right;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .footer-links {
    grid-column: auto;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 6px;
  }

  .site-footer {
    padding-top: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

/* =========================================================
   Print
   ========================================================= */

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  body {
    background: #fff;
    color: #111;
    font-size: 10pt;
  }

  body::before,
  .site-header,
  .scroll-progress,
  .mobile-menu,
  .hero,
  .path-strip,
  .section-dark,
  .site-footer,
  .quiz-block,
  .section-heading,
  .problem-footer-note,
  .button-print,
  .skip-link {
    display: none !important;
  }

  .section {
    display: none;
  }

  #cheatsheet {
    display: block !important;
    padding: 0;
    max-width: none;
  }

  .cheat-sheet {
    display: block !important;
    border: 0;
    box-shadow: none;
  }

  .sheet-head {
    padding: 0 0 10mm;
  }

  .sheet-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .sheet-cell {
    min-height: 0;
    padding: 6mm;
    border-color: #ddd;
    break-inside: avoid;
  }

  .sheet-cell:nth-child(2n) {
    border-right: 0;
  }

  .sheet-cell:nth-child(4n) {
    border-right: 0;
  }

  .sheet-cell:nth-last-child(-n + 4) {
    border-bottom: 1px solid #ddd;
  }

  .sheet-cell:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .sheet-cell--accent {
    background: #f4f4f4 !important;
  }

  .katex {
    color: #111 !important;
  }
}
