:root {
  color-scheme: light;
  --ink: #10211b;
  --ink-soft: #53645d;
  --ink-faint: #7d8b85;
  --paper: #f2f0e9;
  --paper-2: #e9e6dc;
  --surface: #fbfaf6;
  --surface-raised: #fffefa;
  --line: rgba(16, 33, 27, .14);
  --line-strong: rgba(16, 33, 27, .26);
  --forest: #0a211a;
  --forest-2: #11342a;
  --lime: #c9ff66;
  --lime-deep: #7fb313;
  --coral: #ff8066;
  --sky: #80cfff;
  --violet: #a58cff;
  --yellow: #ffc857;
  --shadow: 0 24px 70px rgba(22, 34, 28, .10);
  --shadow-soft: 0 10px 30px rgba(22, 34, 28, .07);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --mono: "DM Mono", "SFMono-Regular", Consolas, monospace;
  --sans: Manrope, "Noto Sans SC", "PingFang SC", sans-serif;
  --topbar-h: 72px;
  --sidebar-w: 282px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eef5ef;
  --ink-soft: #a9b9b0;
  --ink-faint: #7e9287;
  --paper: #07140f;
  --paper-2: #0c1d16;
  --surface: #0e2119;
  --surface-raised: #13291f;
  --line: rgba(224, 244, 231, .12);
  --line-strong: rgba(224, 244, 231, .22);
  --forest: #050d0a;
  --forest-2: #10271e;
  --lime-deep: #c9ff66;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, .2);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--sky) 68%, transparent);
  outline-offset: 3px;
}
::selection { color: #081713; background: var(--lime); }

.grain {
  position: fixed;
  inset: 0;
  z-index: 1000;
  opacity: .035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}
.skip-link {
  position: fixed;
  z-index: 1200;
  top: 8px;
  left: 12px;
  transform: translateY(-150%);
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--lime);
  color: #07140f;
  font-weight: 800;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Global shell */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 200;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  color: #edf7ef;
  background: rgba(7, 23, 17, .94);
  border-bottom: 1px solid rgba(255, 255, 255, .10);
  backdrop-filter: blur(18px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 8px;
  border: 1px solid rgba(201, 255, 102, .35);
  border-radius: 10px;
  background: rgba(201, 255, 102, .08);
}
.brand-mark i { width: 4px; border-radius: 4px 4px 1px 1px; background: var(--lime); }
.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 18px; }
.brand-mark i:nth-child(3) { height: 13px; background: var(--coral); }
.brand b { display: block; font-size: 14px; letter-spacing: .08em; line-height: 1; }
.brand small { display: block; margin-top: 5px; color: #91a39a; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.search-trigger, .icon-button, .home-link {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 11px;
  color: #dfe9e2;
  background: rgba(255, 255, 255, .055);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.search-trigger:hover, .icon-button:hover, .home-link:hover {
  border-color: rgba(201, 255, 102, .4);
  background: rgba(201, 255, 102, .08);
}
.search-trigger { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px; font-size: 12px; }
.search-trigger > span:first-child { color: var(--lime); font-size: 19px; line-height: 1; transform: rotate(-12deg); }
kbd {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 5px;
  color: #94a59c;
  background: rgba(0, 0, 0, .12);
  font-family: var(--mono);
  font-size: 9px;
  box-shadow: none;
}
.icon-button { width: 38px; padding: 0; font-size: 18px; }
.home-link { display: inline-flex; align-items: center; padding: 0 12px; font-family: var(--mono); font-size: 11px; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); padding-top: var(--topbar-h); }
.sidebar {
  position: fixed;
  inset: var(--topbar-h) auto 0 0;
  z-index: 100;
  width: var(--sidebar-w);
  padding: 26px 18px 22px;
  overflow-y: auto;
  color: #dce8df;
  background: var(--forest);
  border-right: 1px solid rgba(255, 255, 255, .08);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .16) transparent;
}
.side-intro { padding: 0 10px 20px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  color: var(--lime-deep);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; }
.side-intro p { margin: 10px 0 0; color: #93a69c; font-size: 12px; line-height: 1.6; }
.progress-card { margin: 18px 8px 14px; }
.progress-copy { display: flex; align-items: center; justify-content: space-between; color: #91a39a; font-size: 10px; }
.progress-copy b { color: var(--lime); font-family: var(--mono); font-weight: 500; }
.progress-track { height: 3px; margin-top: 8px; overflow: hidden; border-radius: 5px; background: rgba(255, 255, 255, .1); }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--lime), var(--coral)); transition: width .35s ease; }
.chapter-nav { display: grid; gap: 3px; }
.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr 15px;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #98aaa1;
  text-decoration: none;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.nav-item:hover { color: #eef6f0; background: rgba(255, 255, 255, .055); }
.nav-item.active { color: #fff; border-color: rgba(201, 255, 102, .18); background: rgba(201, 255, 102, .09); }
.nav-num { font-family: var(--mono); color: #63786d; font-size: 9px; }
.nav-item.active .nav-num { color: var(--lime); }
.nav-copy { min-width: 0; }
.nav-copy b { display: block; overflow: hidden; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.nav-copy small { display: block; overflow: hidden; margin-top: 1px; color: #657a6f; font-size: 8px; letter-spacing: .03em; text-overflow: ellipsis; white-space: nowrap; }
.nav-item.active .nav-copy small { color: #8fa399; }
.nav-check {
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border: 1px solid #40574b;
  border-radius: 50%;
  color: transparent;
  font-size: 8px;
}
.nav-item.done .nav-check { color: #081713; border-color: var(--lime); background: var(--lime); }
.side-note { display: flex; align-items: center; gap: 8px; margin: 18px 10px 0; color: #6e8378; font-size: 9px; }
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 0 rgba(255, 128, 102, .5); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(255, 128, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 128, 102, 0); } }

main { min-width: 0; grid-column: 2; }
#view { min-height: calc(100vh - var(--topbar-h)); }
.page { animation: page-in .38s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Home */
.home-hero {
  position: relative;
  min-height: 660px;
  padding: 72px clamp(28px, 6vw, 92px) 64px;
  overflow: hidden;
  color: #edf6ef;
  background:
    radial-gradient(circle at 82% 14%, rgba(201, 255, 102, .13), transparent 26%),
    radial-gradient(circle at 70% 82%, rgba(128, 207, 255, .11), transparent 28%),
    var(--forest);
}
.hero-grid {
  position: absolute;
  inset: 0;
  opacity: .17;
  background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}
.home-hero::after {
  content: "";
  position: absolute;
  right: -170px;
  top: 55px;
  width: 510px;
  height: 510px;
  border: 1px solid rgba(201, 255, 102, .13);
  border-radius: 50%;
  box-shadow: 0 0 0 80px rgba(201, 255, 102, .025), 0 0 0 160px rgba(201, 255, 102, .018);
}
.hero-content { position: relative; z-index: 2; max-width: 980px; }
.hero-kicker { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; color: var(--lime); font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.hero-kicker span { padding: 5px 9px; border: 1px solid rgba(201, 255, 102, .25); border-radius: 99px; background: rgba(201, 255, 102, .06); }
.hero-title { max-width: 820px; margin: 0; font-size: clamp(48px, 7.2vw, 94px); font-weight: 800; letter-spacing: -.065em; line-height: .96; }
.hero-title em { color: var(--lime); font-family: Georgia, serif; font-weight: 400; }
.hero-lead { max-width: 640px; margin: 28px 0 0; color: #9fb2a8; font-size: clamp(15px, 1.5vw, 19px); line-height: 1.8; }
.hero-lead strong { color: #f0f8f2; font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 34px; }
.primary-button, .secondary-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.primary-button { color: #081713; background: var(--lime); box-shadow: 0 12px 32px rgba(201, 255, 102, .16); }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(201, 255, 102, .22); }
.secondary-button { color: #e7f1ea; border-color: rgba(255, 255, 255, .15); background: rgba(255, 255, 255, .045); }
.secondary-button:hover { border-color: rgba(255, 255, 255, .28); background: rgba(255,255,255,.075); }
.hero-tape {
  position: absolute;
  z-index: 3;
  right: -44px;
  bottom: 32px;
  width: min(48vw, 590px);
  transform: rotate(-3deg);
  border: 1px solid rgba(201,255,102,.21);
  border-radius: 19px;
  background: rgba(6, 19, 14, .72);
  box-shadow: 0 28px 70px rgba(0,0,0,.3);
  backdrop-filter: blur(12px);
}
.tape-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 15px; border-bottom: 1px solid rgba(255,255,255,.08); color: #89a097; font-family: var(--mono); font-size: 9px; }
.live-pill { display: inline-flex; align-items: center; gap: 5px; color: var(--lime); }
.live-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.hero-chart { width: 100%; height: 175px; display: block; }
.tape-foot { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgba(255,255,255,.08); }
.ticker-stat { padding: 10px 14px; border-right: 1px solid rgba(255,255,255,.08); }
.ticker-stat:last-child { border-right: 0; }
.ticker-stat small { display: block; color: #688077; font-family: var(--mono); font-size: 8px; }
.ticker-stat b { display: block; margin-top: 2px; color: #dcebe1; font-family: var(--mono); font-size: 11px; }

.section-wrap { max-width: 1240px; margin: 0 auto; padding: 80px clamp(24px, 5vw, 72px); }
.section-heading { display: grid; grid-template-columns: 1fr minmax(260px, 440px); align-items: end; gap: 40px; margin-bottom: 34px; }
.section-heading h2 { margin: 10px 0 0; font-size: clamp(34px, 4.5vw, 58px); letter-spacing: -.045em; line-height: 1.05; }
.section-heading p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.home-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.home-stat { padding: 24px 20px; border-right: 1px solid var(--line); }
.home-stat:last-child { border-right: 0; }
.home-stat b { display: block; font-family: var(--mono); font-size: 27px; letter-spacing: -.04em; }
.home-stat span { color: var(--ink-soft); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.chapter-roadmap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 38px; }
.chapter-card {
  position: relative;
  min-height: 225px;
  overflow: hidden;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.chapter-card::after { content: ""; position: absolute; right: -28px; bottom: -45px; width: 120px; height: 120px; border: 1px solid color-mix(in srgb, var(--card-accent) 34%, transparent); border-radius: 50%; box-shadow: 0 0 0 25px color-mix(in srgb, var(--card-accent) 4%, transparent); }
.chapter-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--card-accent) 50%, var(--line)); box-shadow: var(--shadow); }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.chapter-number { color: var(--card-accent); font-family: var(--mono); font-size: 10px; letter-spacing: .14em; }
.card-status { display: grid; width: 21px; height: 21px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: transparent; font-size: 10px; }
.chapter-card.done .card-status { color: #07140f; border-color: var(--lime); background: var(--lime); }
.chapter-card h3 { max-width: 88%; margin: 29px 0 8px; font-size: 20px; letter-spacing: -.025em; line-height: 1.28; }
.chapter-card p { max-width: 88%; margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.card-tags { position: absolute; left: 21px; bottom: 18px; display: flex; flex-wrap: wrap; gap: 5px; }
.card-tags span { padding: 3px 7px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink-faint); font-family: var(--mono); font-size: 8px; }
.learning-path { padding-top: 0; }
.path-line { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 30px; }
.path-stage { position: relative; padding: 26px 22px; border-top: 1px solid var(--line-strong); }
.path-stage::before { content: ""; position: absolute; top: -5px; left: 22px; width: 9px; height: 9px; border-radius: 50%; background: var(--stage-color); box-shadow: 0 0 0 5px var(--paper); }
.path-stage small { color: var(--stage-color); font-family: var(--mono); font-size: 9px; letter-spacing: .1em; }
.path-stage h3 { margin: 8px 0 5px; font-size: 16px; }
.path-stage p { margin: 0; color: var(--ink-soft); font-size: 11px; }
.about-book { background: var(--forest); color: #edf6ef; }
.about-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(40px, 8vw, 110px); align-items: center; }
.book-object { position: relative; min-height: 360px; display: grid; place-items: center; perspective: 900px; }
.book-cover { position: relative; width: min(280px, 70%); aspect-ratio: .72; padding: 32px 27px; transform: rotateY(-11deg) rotateZ(-2deg); border-radius: 3px 14px 14px 3px; color: #081713; background: var(--lime); box-shadow: -10px 12px 0 #5d7e1e, -28px 34px 70px rgba(0,0,0,.38); }
.book-cover::before { content: ""; position: absolute; inset: 0 auto 0 15px; width: 1px; background: rgba(8,23,17,.18); box-shadow: 4px 0 9px rgba(8,23,17,.1); }
.book-cover small { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: .13em; text-transform: uppercase; }
.book-cover strong { display: block; margin-top: 36px; font-size: clamp(24px, 3vw, 38px); letter-spacing: -.05em; line-height: 1; }
.book-cover span { position: absolute; left: 27px; bottom: 28px; font-family: var(--mono); font-size: 10px; }
.about-copy .eyebrow { color: var(--lime); }
.about-copy h2 { margin: 13px 0 19px; font-size: clamp(34px, 4vw, 55px); letter-spacing: -.045em; line-height: 1.05; }
.about-copy > p { color: #9eb0a6; font-size: 14px; }
.principles { display: grid; gap: 13px; margin-top: 28px; }
.principle { display: grid; grid-template-columns: 28px 1fr; gap: 11px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.1); }
.principle b { color: var(--lime); font-family: var(--mono); font-size: 10px; }
.principle p { margin: 0; color: #c8d5cd; font-size: 12px; }
.site-footer { display: flex; justify-content: space-between; gap: 25px; padding: 34px clamp(24px, 5vw, 72px); border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 10px; }
.site-footer a { color: var(--ink-soft); }

/* Chapter page */
.chapter-page { --accent: var(--lime-deep); }
.chapter-masthead {
  position: relative;
  min-height: 430px;
  padding: 64px clamp(28px, 6vw, 90px) 54px;
  overflow: hidden;
  color: #eef7f0;
  background: var(--forest);
}
.chapter-masthead::after { content: attr(data-num); position: absolute; right: clamp(20px, 6vw, 90px); top: -45px; color: transparent; font-family: var(--mono); font-size: clamp(190px, 28vw, 340px); font-weight: 500; line-height: 1; -webkit-text-stroke: 1px rgba(255,255,255,.08); pointer-events: none; }
.chapter-crumbs { position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; color: #789087; font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.chapter-crumbs a { color: #a8b9b0; text-decoration: none; }
.chapter-crumbs i { width: 17px; height: 1px; background: #51665d; }
.masthead-copy { position: relative; z-index: 2; max-width: 760px; margin-top: 54px; }
.chapter-label { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.chapter-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 13%, transparent); }
.chapter-masthead h1 { max-width: 730px; margin: 17px 0 13px; font-size: clamp(42px, 6vw, 76px); letter-spacing: -.06em; line-height: 1; }
.chapter-masthead .en-title { max-width: 580px; margin: 0; color: #879b90; font-family: var(--mono); font-size: 11px; letter-spacing: .04em; }
.masthead-meta { position: absolute; z-index: 2; left: clamp(28px, 6vw, 90px); right: clamp(28px, 6vw, 90px); bottom: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 19px; color: #82978c; font-size: 9px; }
.masthead-meta span { display: inline-flex; align-items: center; gap: 6px; }
.masthead-meta b { color: #dce9e1; font-family: var(--mono); font-weight: 400; }
.chapter-body { max-width: 1120px; margin: 0 auto; padding: 58px clamp(24px, 5vw, 70px) 90px; }
.chapter-intro { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(250px, .75fr); gap: 50px; align-items: start; }
.lead-copy { margin: 0; font-size: clamp(18px, 2vw, 23px); font-weight: 500; letter-spacing: -.015em; line-height: 1.75; }
.lead-copy strong { color: var(--accent); font-weight: 700; }
.goal-card { padding: 21px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-soft); }
.goal-card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 13px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.goal-card h2::before { content: "↳"; color: var(--accent); font-family: var(--mono); }
.goal-card ul { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.goal-card li { position: relative; padding-left: 17px; color: var(--ink-soft); font-size: 11px; }
.goal-card li::before { content: ""; position: absolute; left: 0; top: .7em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.reading-section { margin-top: 78px; }
.section-label { display: flex; align-items: center; gap: 10px; color: var(--accent); font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.reading-section > h2 { max-width: 700px; margin: 16px 0 13px; font-size: clamp(30px, 4vw, 47px); letter-spacing: -.045em; line-height: 1.08; }
.section-deck { max-width: 750px; margin: 0 0 30px; color: var(--ink-soft); font-size: 13px; }
.concept-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.concept-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.concept-index { color: var(--accent); font-family: var(--mono); font-size: 9px; }
.concept-card h3 { margin: 16px 0 8px; font-size: 17px; letter-spacing: -.02em; }
.concept-card p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.concept-card .micro-example { margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--line); color: var(--ink-faint); font-family: var(--mono); font-size: 9px; line-height: 1.6; }
.equation-stack { display: grid; gap: 12px; }
.equation-card { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.equation { display: grid; min-height: 112px; place-items: center; padding: 20px; color: var(--ink); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); border-right: 1px solid var(--line); font-family: Georgia, "Times New Roman", serif; font-size: clamp(18px, 2.2vw, 25px); line-height: 1.35; text-align: center; white-space: nowrap; overflow-x: auto; overflow-y: hidden; }
.equation sup, .equation sub { font-size: .6em; }
.equation-note { padding: 19px 21px; }
.equation-note b { display: block; margin-bottom: 5px; font-size: 13px; }
.equation-note p { margin: 0; color: var(--ink-soft); font-size: 11px; }
.math-guide { grid-column: 1 / -1; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 2%, var(--surface)); }
.math-guide-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 17px; color: var(--accent); font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.math-toggle { padding: 6px 9px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 7px; color: var(--accent); background: var(--surface); font-family: var(--mono); font-size: 9px; cursor: pointer; }
.math-toggle:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.math-detail-grid { display: none; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; padding: 0 17px 17px; }
.math-guide.open .math-detail-grid { display: grid; }
.math-detail { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.math-detail span { display: block; margin-bottom: 6px; color: var(--accent); font-family: var(--mono); font-size: 9px; font-weight: 700; }
.math-detail p { margin: 0; color: var(--ink-soft); font-size: 10px; line-height: 1.65; }
.explanation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.explanation-card { display: grid; grid-template-columns: 34px 1fr; gap: 12px; min-height: 190px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.explanation-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); font-family: var(--mono); font-size: 11px; font-weight: 700; }
.explanation-card span { color: var(--accent); font-family: var(--mono); font-size: 8px; letter-spacing: .1em; }
.explanation-card h3 { margin: 9px 0 9px; font-size: 14px; letter-spacing: -.02em; }
.explanation-card p { margin: 0; color: var(--ink-soft); font-size: 10px; line-height: 1.75; }
.topic-map { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-pill { padding: 8px 11px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink-soft); background: var(--surface); font-size: 10px; }
.topic-pill.major { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 44%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); font-weight: 700; }
.workflow { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.workflow-step { position: relative; min-height: 170px; padding: 21px; border-right: 1px solid var(--line); }
.workflow-step:last-child { border-right: 0; }
.workflow-step b { display: block; color: var(--accent); font-family: var(--mono); font-size: 9px; }
.workflow-step h3 { margin: 24px 0 8px; font-size: 14px; }
.workflow-step p { margin: 0; color: var(--ink-soft); font-size: 10px; }
.pitfall-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pitfall { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 17px; border: 1px solid color-mix(in srgb, var(--coral) 28%, var(--line)); border-radius: var(--radius-md); background: color-mix(in srgb, var(--coral) 4%, var(--surface)); }
.pitfall > b { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; color: var(--coral); background: color-mix(in srgb, var(--coral) 10%, transparent); font-family: var(--mono); font-size: 11px; }
.pitfall h3 { margin: 0 0 4px; font-size: 12px; }
.pitfall p { margin: 0; color: var(--ink-soft); font-size: 10px; }

/* Labs and charts */
.lab-card { position: relative; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line)); border-radius: var(--radius-xl); background: var(--surface-raised); box-shadow: var(--shadow); }
.lab-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 25px 19px; border-bottom: 1px solid var(--line); }
.lab-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); font-family: var(--mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.lab-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
.lab-head h3 { margin: 8px 0 4px; font-size: 20px; letter-spacing: -.025em; }
.lab-head p { max-width: 620px; margin: 0; color: var(--ink-soft); font-size: 11px; }
.reset-button { flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-soft); background: var(--surface); font-family: var(--mono); font-size: 9px; cursor: pointer; }
.reset-button:hover { color: var(--ink); border-color: var(--line-strong); }
.lab-controls { display: flex; flex-wrap: wrap; gap: 15px 25px; padding: 17px 25px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 3%, var(--surface)); }
.control { min-width: 150px; flex: 1; max-width: 240px; }
.control-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; color: var(--ink-soft); font-size: 9px; }
.control-label output { color: var(--accent); font-family: var(--mono); }
.control input[type="range"] { width: 100%; height: 3px; appearance: none; border-radius: 99px; background: var(--line-strong); outline: none; }
.control input[type="range"]::-webkit-slider-thumb { width: 14px; height: 14px; appearance: none; border: 3px solid var(--surface-raised); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 65%, transparent); cursor: grab; }
.control select { width: 100%; padding: 7px 27px 7px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); font-size: 10px; cursor: pointer; }
.chart-stage { position: relative; min-height: 360px; padding: 18px 18px 5px; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chart-panel { position: relative; min-width: 0; padding: 12px 10px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.chart-panel.wide { grid-column: 1 / -1; }
.chart-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 21px; padding: 0 6px; color: var(--ink-soft); font-size: 9px; }
.chart-title b { color: var(--ink); font-family: var(--mono); font-weight: 500; }
.chart { display: block; width: 100%; height: 220px; overflow: visible; }
.chart.short { height: 175px; }
.chart text { fill: var(--ink-faint); font-family: var(--mono); font-size: 8px; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .zero-line { stroke: var(--line-strong); stroke-dasharray: 3 3; }
.chart .axis-line { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .series-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart .series-line.secondary { stroke: var(--coral); }
.chart .series-line.tertiary { stroke: var(--sky); }
.chart .series-area { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.chart .dot { fill: var(--accent); }
.chart .bar { fill: color-mix(in srgb, var(--accent) 56%, transparent); }
.chart .bar.tail { fill: var(--coral); }
.chart .confidence { fill: color-mix(in srgb, var(--sky) 11%, transparent); }
.chart-tooltip { position: absolute; z-index: 8; pointer-events: none; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface-raised); box-shadow: var(--shadow-soft); font-family: var(--mono); font-size: 8px; opacity: 0; transform: translate(-50%, -115%); transition: opacity .1s ease; white-space: nowrap; }
.lab-metrics { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.metric { min-height: 72px; padding: 13px 17px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric small { display: block; color: var(--ink-faint); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.metric b { display: block; margin-top: 4px; color: var(--ink); font-family: var(--mono); font-size: 14px; font-weight: 500; }

/* Code */
.code-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #091812; box-shadow: var(--shadow-soft); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.09); color: #7e9589; font-size: 9px; }
.code-dots { display: flex; gap: 5px; }
.code-dots i { width: 7px; height: 7px; border-radius: 50%; background: #3b5146; }
.code-dots i:nth-child(1) { background: var(--coral); }
.code-dots i:nth-child(2) { background: var(--yellow); }
.code-dots i:nth-child(3) { background: #75db9b; }
.copy-code { padding: 5px 8px; border: 1px solid rgba(255,255,255,.1); border-radius: 7px; color: #8fa398; background: rgba(255,255,255,.04); font-family: var(--mono); font-size: 8px; cursor: pointer; }
.copy-code:hover { color: var(--lime); border-color: rgba(201,255,102,.28); }
pre { margin: 0; padding: 22px; overflow-x: auto; color: #c8d9cf; background: transparent; font-family: var(--mono); font-size: 11px; line-height: 1.75; tab-size: 4; }
code .kw { color: #d2a8ff; }
code .fn { color: #80cfff; }
code .str { color: #c9ff66; }
code .num { color: #ffb192; }
code .com { color: #61796c; }
.code-note { padding: 13px 18px; border-top: 1px solid rgba(255,255,255,.08); color: #70877a; font-size: 9px; }
.code-note code { color: #a9beb2; font-family: var(--mono); }

.mark-complete { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 74px; padding: 25px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.mark-complete h2 { margin: 0 0 4px; font-size: 18px; }
.mark-complete p { margin: 0; color: var(--ink-soft); font-size: 10px; }
.complete-button { flex: 0 0 auto; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 11px; color: var(--ink); background: transparent; font-size: 10px; font-weight: 700; cursor: pointer; }
.complete-button.done { color: #07140f; border-color: var(--lime); background: var(--lime); }
.chapter-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.page-link { min-height: 92px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); text-decoration: none; transition: border-color .18s ease, transform .18s ease; }
.page-link:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.page-link.next { text-align: right; }
.page-link small { color: var(--ink-faint); font-family: var(--mono); font-size: 8px; text-transform: uppercase; }
.page-link b { display: block; margin-top: 7px; font-size: 12px; }

/* Search */
.search-modal[hidden] { display: none; }
.search-modal { position: fixed; inset: 0; z-index: 900; display: grid; place-items: start center; padding: 13vh 20px 20px; }
.search-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(3, 12, 8, .72); backdrop-filter: blur(7px); cursor: default; }
.search-panel { position: relative; width: min(630px, 100%); overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; color: #e8f2eb; background: #0b1e16; box-shadow: 0 30px 100px rgba(0,0,0,.45); }
.search-field { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 9px; padding: 13px 15px; border-bottom: 1px solid rgba(255,255,255,.09); }
.search-field > span { color: var(--lime); font-size: 22px; }
.search-field input { width: 100%; border: 0; outline: 0; color: #eff7f1; background: transparent; font-size: 14px; }
.search-field input::placeholder { color: #63796e; }
.search-results { max-height: min(55vh, 520px); overflow-y: auto; padding: 8px; }
.search-empty { padding: 34px 20px; color: #70867a; text-align: center; font-size: 11px; }
.search-result { display: grid; grid-template-columns: 31px 1fr auto; align-items: center; gap: 10px; padding: 11px; border-radius: 11px; color: #cbd9d1; text-decoration: none; }
.search-result:hover, .search-result:focus { background: rgba(201,255,102,.07); outline: none; }
.search-result .result-num { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid rgba(255,255,255,.1); border-radius: 8px; color: var(--lime); font-family: var(--mono); font-size: 8px; }
.search-result b { display: block; font-size: 11px; }
.search-result small { display: block; margin-top: 2px; color: #70867a; font-size: 9px; }
.search-result > small { margin: 0; font-family: var(--mono); }
.toast { position: fixed; z-index: 1000; right: 22px; bottom: 22px; padding: 10px 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; color: #e7f2ea; background: #0a1d15; box-shadow: var(--shadow); font-size: 10px; opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: none; }
.noscript { margin: 30px; padding: 20px; border: 1px solid var(--coral); border-radius: 14px; background: var(--surface); }

/* Responsive */
@media (max-width: 1080px) {
  :root { --sidebar-w: 234px; }
  .chapter-roadmap { grid-template-columns: repeat(2, 1fr); }
  .hero-tape { width: 52vw; }
  .workflow { grid-template-columns: repeat(2, 1fr); }
  .workflow-step:nth-child(2) { border-right: 0; }
  .workflow-step:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 820px) {
  :root { --topbar-h: 62px; }
  .topbar { padding: 0 15px; }
  .brand small, .search-trigger span:nth-child(2), .search-trigger kbd, .home-link { display: none; }
  .search-trigger { width: 38px; padding: 0; justify-content: center; }
  .app-shell { display: block; padding-top: var(--topbar-h); }
  .sidebar { position: sticky; top: var(--topbar-h); inset-inline: 0; width: 100%; height: 52px; display: flex; align-items: center; padding: 6px 10px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.1); }
  .side-intro, .progress-card, .side-note { display: none; }
  .chapter-nav { display: flex; gap: 5px; }
  .nav-item { flex: 0 0 auto; grid-template-columns: auto; min-width: 41px; min-height: 38px; padding: 5px 10px; text-align: center; }
  .nav-copy, .nav-check { display: none; }
  .nav-num { font-size: 9px; }
  main { grid-column: auto; }
  .home-hero { min-height: 730px; padding-top: 50px; }
  .hero-title { font-size: clamp(47px, 12vw, 72px); }
  .hero-tape { right: -22px; bottom: 27px; width: 83vw; }
  .section-heading { grid-template-columns: 1fr; gap: 18px; }
  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .home-stat:nth-child(2) { border-right: 0; }
  .home-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .path-line { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; }
  .book-object { min-height: 310px; }
  .chapter-intro { grid-template-columns: 1fr; gap: 26px; }
  .equation-card { grid-template-columns: 1fr; }
  .equation { border-right: 0; border-bottom: 1px solid var(--line); }
  .math-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .concept-grid, .pitfall-list, .explanation-grid { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-panel.wide { grid-column: auto; }
  .lab-metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 560px) {
  .home-hero { min-height: 690px; padding: 40px 22px 44px; }
  .hero-kicker { margin-bottom: 18px; font-size: 9px; }
  .hero-title { font-size: clamp(44px, 14vw, 64px); }
  .hero-lead { margin-top: 21px; font-size: 14px; }
  .hero-actions { margin-top: 24px; }
  .primary-button, .secondary-button { min-height: 43px; padding-inline: 14px; font-size: 10px; }
  .hero-tape { width: 94vw; bottom: 18px; }
  .hero-chart { height: 128px; }
  .tape-foot { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ticker-stat { padding: 8px; }
  .ticker-stat b { font-size: 9px; }
  .section-wrap { padding: 58px 20px; }
  .chapter-roadmap { grid-template-columns: 1fr; }
  .home-stats { margin-inline: -20px; }
  .home-stat { padding: 17px 18px; }
  .path-line { grid-template-columns: 1fr; }
  .path-stage { border-top: 1px solid var(--line-strong); }
  .site-footer { flex-direction: column; }
  .chapter-masthead { min-height: 390px; padding: 42px 22px; }
  .masthead-copy { margin-top: 45px; }
  .chapter-masthead h1 { font-size: 42px; }
  .masthead-meta { left: 22px; right: 22px; bottom: 21px; gap: 10px; }
  .chapter-body { padding: 43px 20px 70px; }
  .reading-section { margin-top: 60px; }
  .math-detail-grid { grid-template-columns: 1fr; }
  .explanation-card { min-height: 0; }
  .workflow { grid-template-columns: 1fr; }
  .workflow-step { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .workflow-step:last-child { border-bottom: 0; }
  .lab-head { padding: 18px; }
  .lab-controls { padding: 15px 18px; }
  .control { min-width: 120px; max-width: none; }
  .chart-stage { min-height: 320px; padding: 10px; }
  .chart { height: 190px; }
  .mark-complete { align-items: flex-start; flex-direction: column; }
  .chapter-pagination { grid-template-columns: 1fr; }
  .page-link.next { text-align: left; }
}

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