:root {
  --bg1: #eef8ef;
  --bg2: #f8fbef;
  --card: #ffffff;
  --soft-card: #f4fbf5;
  --ink: #1d3025;
  --muted: #5c7566;
  --line: #d9eadc;
  --green: #2f9e44;
  --deep: #0b6b3a;
  --mint: #12b886;
  --lime: #94d82d;
  --orange: #f08c00;
  --red: #e03131;
  --shadow: 0 14px 36px rgba(20, 105, 56, 0.12);
}

[data-theme="dark"] {
  --bg1: #0d1711;
  --bg2: #142119;
  --card: #18261e;
  --soft-card: #122017;
  --ink: #e8f5eb;
  --muted: #a9c2b0;
  --line: #2b4735;
  --green: #69db7c;
  --deep: #8ce99a;
  --mint: #38d9a9;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(148, 216, 45, .24), transparent 25%),
    radial-gradient(circle at 92% 10%, rgba(18, 184, 134, .18), transparent 28%),
    linear-gradient(135deg, var(--bg1), var(--bg2));
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.85;
}

a { color: inherit; text-decoration: none; }
.progress-bar { position: fixed; top: 0; left: 0; height: 4px; width: 0; z-index: 100; background: linear-gradient(90deg, var(--green), var(--mint), var(--lime)); }
.menu-toggle { display: none; position: fixed; top: 14px; left: 14px; z-index: 40; width: 44px; height: 44px; border: 0; border-radius: 14px; color: #fff; background: linear-gradient(135deg, var(--deep), var(--mint)); font-size: 20px; box-shadow: var(--shadow); }
.backdrop { display: none; }
.layout { display: grid; grid-template-columns: 276px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 16px;
  color: #fff;
  background: linear-gradient(160deg, #064d2a, #2f9e44 58%, #94d82d);
  box-shadow: 8px 0 28px rgba(11, 107, 58, .18);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.brand-icon { font-size: 34px; }
.brand b { display: block; font-size: 18px; line-height: 1.3; }
.brand span { display: block; font-size: 12px; opacity: .86; }
.subject-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}
.subject-switch a {
  flex: 1 1 auto;
  min-width: 58px;
  padding: 7px 8px;
  border-radius: 11px;
  color: #fff;
  background: rgba(255,255,255,.14);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  transition: .18s ease;
}
.subject-switch a:hover { background: rgba(255,255,255,.28); transform: translateY(-1px); }
.subject-switch a.active { color: #0b6b3a; background: #fff; box-shadow: 0 6px 14px rgba(0,0,0,.12); }
.side-link,
.theme-btn {
  display: block;
  width: 100%;
  margin: 7px 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: rgba(255,255,255,.14);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition: .18s ease;
}
.side-link:hover,
.theme-btn:hover { background: rgba(255,255,255,.28); transform: translateX(3px); }
.side-link.active { color: #0b6b3a; background: #fff; }
.toc-title { margin: 18px 4px 8px; font-size: 12px; opacity: .82; }
.nav-list { list-style: none; display: grid; gap: 6px; }
.nav-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 13px;
  color: rgba(255,255,255,.92);
  background: rgba(255,255,255,.10);
  cursor: pointer;
  transition: .18s ease;
}
.nav-item:hover { background: rgba(255,255,255,.22); transform: translateX(2px); }
.nav-item.active { color: #0b6b3a; background: #fff; box-shadow: 0 8px 18px rgba(0,0,0,.14); }
.nav-ico { font-size: 18px; text-align: center; }
.nav-text b { display: block; font-size: 13.5px; line-height: 1.35; }
.nav-text small { display: block; font-size: 11.5px; line-height: 1.35; opacity: .86; }
.sb-foot { margin-top: 14px; font-size: 11px; opacity: .82; text-align: center; }

.content { padding: 42px clamp(18px, 5vw, 64px) 76px; }
.page { max-width: 1040px; margin: 0 auto; }
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(30px, 6vw, 56px);
  border: 1px solid rgba(47,158,68,.18);
  border-radius: 34px;
  background: linear-gradient(135deg, rgba(255,255,255,.88), rgba(226,252,232,.75));
  box-shadow: var(--shadow);
}
[data-theme="dark"] .hero { background: linear-gradient(135deg, rgba(24,38,30,.96), rgba(18,54,34,.78)); }
.hero::after { content: "BIO"; position: absolute; right: -16px; bottom: -50px; color: rgba(47,158,68,.10); font-size: 126px; font-weight: 900; letter-spacing: 7px; }
.hero.is-hidden { display: none; }
.kicker { color: var(--deep); font-weight: 900; letter-spacing: 2px; font-size: 13px; }
.hero h1 { margin: 8px 0 12px; font-size: clamp(30px, 6vw, 48px); line-height: 1.18; }
.hero p { max-width: 780px; color: var(--muted); font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.chip { padding: 7px 12px; border-radius: 999px; color: var(--deep); background: rgba(47,158,68,.11); font-size: 13px; font-weight: 900; }

.chapter { display: none; animation: fadeUp .32s ease both; }
.chapter.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.chapter-head { display: flex; align-items: center; gap: 16px; margin: 0 0 22px; padding: 20px 24px; border-radius: 24px; background: linear-gradient(120deg, var(--ch, var(--green)), #0b6b3a); box-shadow: var(--shadow); }
.chapter-progress {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 999px;
  color: #fff;
  background: rgba(255,255,255,.18);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.chapter-emoji { width: 58px; height: 58px; display: grid; place-items: center; flex: none; border-radius: 18px; background: rgba(255,255,255,.88); font-size: 30px; }
.chapter-label { color: rgba(255,255,255,.96); font-size: 12px; font-weight: 900; letter-spacing: 1.4px; text-transform: uppercase; text-shadow: 0 1px 6px rgba(0,0,0,.24); }
.chapter-title { color: #fff; font-size: clamp(22px, 4vw, 30px); line-height: 1.28; text-shadow: 0 2px 12px rgba(0,0,0,.32); }
.grade-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.grade-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 999px;
  color: #fff;
  background: rgba(255,255,255,.18);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  text-shadow: 0 1px 6px rgba(0,0,0,.25);
}
.grade-badge.scope { background: rgba(11,107,58,.32); }
.chapter-body { padding: clamp(20px, 4vw, 34px); border: 1px solid var(--line); border-radius: 26px; background: var(--card); box-shadow: var(--shadow); }
.chapter-body h2 { margin: 26px 0 14px; padding-left: 13px; border-left: 6px solid var(--green); color: var(--deep); font-size: 22px; }
.chapter-body h2:first-child { margin-top: 0; }
.chapter-body h3 { margin: 20px 0 8px; color: var(--deep); font-size: 18px; }
.chapter-body p { margin: 10px 0; color: var(--muted); }
.chapter-body ul,
.chapter-body ol { margin: 10px 0; padding-left: 24px; color: var(--muted); }
.chapter-body li { margin: 6px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin: 14px 0; }
.card,
.note,
.qa details {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--soft-card);
  box-shadow: 0 8px 20px rgba(31,111,70,.07);
}
.card { padding: 18px; }
.card h3 { margin-top: 0; }
.visual {
  margin: 18px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 12% 12%, rgba(148,216,45,.16), transparent 30%),
    var(--soft-card);
  box-shadow: 0 10px 28px rgba(31,111,70,.08);
}
.visual-title { margin-bottom: 14px; color: var(--deep); font-size: 17px; font-weight: 900; }
.fig-caption {
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
  text-align: center;
}
.mindmap { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: center; }
.mind-center {
  min-height: 150px;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 50%;
  color: #fff;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.42), transparent 45%), linear-gradient(135deg, var(--deep), var(--mint));
  box-shadow: var(--shadow);
  text-align: center;
  font-weight: 900;
}
.mind-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.mind-branch {
  position: relative;
  padding: 12px 14px 12px 18px;
  border-left: 5px solid var(--bc, var(--green));
  border-radius: 0 16px 16px 0;
  background: var(--card);
  color: var(--muted);
}
.mind-branch b { display: block; margin-bottom: 3px; }
.flow { display: grid; gap: 10px; }
.flow-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: stretch; }
.flow-step {
  position: relative;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--muted);
  box-shadow: 0 6px 16px rgba(31,111,70,.06);
}
.flow-step b { display: block; color: var(--deep); }
.flow-arrow {
  display: grid;
  place-items: center;
  color: var(--deep);
  font-size: 24px;
  font-weight: 900;
}
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.compare-card {
  padding: 18px;
  border-radius: 22px;
  color: var(--muted);
  background: var(--card);
  border-top: 6px solid var(--cc, var(--green));
  box-shadow: 0 8px 20px rgba(31,111,70,.08);
}
.compare-card h3 { color: var(--deep); }
.svg-wrap {
  overflow-x: auto;
  padding: 10px;
  border-radius: 18px;
  background: var(--card);
}
.bio-svg { width: 100%; min-width: 680px; height: auto; }
.no-scroll-svg { overflow-x: hidden; }
.compact-svg { min-width: 0; max-width: 100%; }
.svg-node { fill: var(--card); stroke: var(--green); stroke-width: 2; }
.svg-node-strong { fill: var(--green); stroke: var(--deep); stroke-width: 2; }
.svg-text { fill: var(--ink); font-size: 16px; font-weight: 800; text-anchor: middle; dominant-baseline: middle; }
.svg-small { fill: var(--muted); font-size: 13px; text-anchor: middle; dominant-baseline: middle; }
.svg-line { stroke: var(--deep); stroke-width: 2; fill: none; marker-end: url(#arrow); }
.svg-white { fill: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.28); }
.cell-diagram { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 18px; align-items: center; }
.legend { display: grid; gap: 9px; }
.legend-item { display: flex; gap: 9px; align-items: flex-start; color: var(--muted); }
.legend-dot { width: 14px; height: 14px; margin-top: 8px; border-radius: 50%; background: var(--dot, var(--green)); flex: none; }
.timeline { display: grid; gap: 12px; counter-reset: step; }
.timeline-item {
  position: relative;
  padding: 14px 16px 14px 54px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--muted);
}
.timeline-item::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--deep), var(--mint));
  font-weight: 900;
}
.note { padding: 16px 18px; margin: 16px 0; border-left: 6px solid var(--orange); background: linear-gradient(120deg, rgba(255,243,191,.72), var(--card)); color: var(--muted); }
[data-theme="dark"] .note { background: linear-gradient(120deg, rgba(102,70,0,.26), var(--card)); }
.trap { border-left-color: var(--red); }
.key { border-left-color: var(--green); }
.table-wrap { overflow-x: auto; margin: 16px 0; border-radius: 18px; box-shadow: 0 8px 22px rgba(31,111,70,.08); }
.scroll-hint {
  display: none;
  position: sticky;
  left: 0;
  width: max-content;
  margin: 0 0 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--deep);
  background: rgba(47,158,68,.11);
  font-size: 12px;
  font-weight: 900;
}
table { width: 100%; min-width: 720px; border-collapse: collapse; background: var(--card); }
th { padding: 12px 14px; color: #fff; text-align: left; background: linear-gradient(120deg, #0b6b3a, #12b886); }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--muted); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.formula,
strong { color: var(--deep); font-weight: 900; }
code { padding: 2px 7px; border-radius: 7px; color: var(--deep); background: rgba(47,158,68,.12); font-family: Consolas, monospace; }
.qa { display: grid; gap: 12px; margin-top: 12px; }
.qa details { padding: 15px 18px; }
.qa summary { cursor: pointer; color: var(--deep); font-weight: 900; }
.qa p { margin-top: 10px; }
.problem {
  margin: 16px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 8px 20px rgba(31,111,70,.07);
}
.problem:hover,
.problem:focus-within {
  border-color: rgba(47,158,68,.38);
  box-shadow: 0 12px 28px rgba(31,111,70,.11);
}
.problem-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(120deg, var(--deep), var(--mint));
  font-size: 13px;
  font-weight: 900;
}
.question { color: var(--ink); font-weight: 800; }
.choices { display: grid; gap: 8px; margin: 12px 0; color: var(--muted); }
.choice {
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--soft-card);
  border: 1px solid var(--line);
}
.choice:hover { border-color: rgba(47,158,68,.34); background: rgba(47,158,68,.08); }
.answer-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--soft-card);
  overflow: hidden;
}
.answer-box[open] { border-color: rgba(47,158,68,.42); box-shadow: 0 8px 22px rgba(31,111,70,.08); }
.answer-box summary {
  padding: 13px 16px;
  cursor: pointer;
  color: var(--deep);
  font-weight: 900;
  background: rgba(47,158,68,.08);
}
.answer-box summary::marker { color: var(--green); }
.answer-content { padding: 14px 16px; color: var(--muted); }
.answer-content p { margin: 8px 0; }
.analysis-list { margin: 8px 0; padding-left: 22px; color: var(--muted); }
.analysis-list li { margin: 5px 0; }

.system-page .hero {
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(232,245,233,.82)),
    repeating-linear-gradient(45deg, rgba(47,158,68,.08) 0 2px, transparent 2px 16px);
}
.system-page .chapter-body {
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(244,251,245,.96));
}
[data-theme="dark"] .system-page .chapter-body {
  background: linear-gradient(180deg, rgba(24,38,30,.98), rgba(18,32,23,.98));
}
.system-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.system-tile {
  position: relative;
  min-height: 136px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(244,251,245,.9));
  box-shadow: 0 8px 20px rgba(31,111,70,.07);
  overflow: hidden;
}
[data-theme="dark"] .system-tile {
  background: linear-gradient(135deg, rgba(24,38,30,.98), rgba(18,32,23,.98));
}
.system-tile::after {
  content: attr(data-code);
  position: absolute;
  right: 10px;
  bottom: -10px;
  color: rgba(47,158,68,.11);
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
}
.system-tile b {
  display: block;
  color: var(--deep);
  font-size: 16px;
}
.system-tile span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}
.coverage-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.coverage-item {
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--deep);
  background: rgba(47,158,68,.1);
  border: 1px solid var(--line);
  font-weight: 900;
  text-align: center;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.study-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--deep);
  background: rgba(47,158,68,.1);
  font-size: 12px;
  font-weight: 900;
}
.study-tag.must { color: #fff; background: linear-gradient(120deg, var(--deep), var(--mint)); border-color: transparent; }
.study-tag.warn { color: #7a3d00; background: rgba(240,140,0,.14); border-color: rgba(240,140,0,.28); }
[data-theme="dark"] .study-tag.warn { color: #ffd8a8; }
.memory-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.memory-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px dashed var(--green);
  background: var(--card);
  color: var(--muted);
}
.memory-card b {
  display: block;
  margin-bottom: 5px;
  color: var(--deep);
}
.chapter-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.chapter-nav button { border: 0; border-radius: 999px; padding: 11px 18px; color: #fff; background: linear-gradient(120deg, var(--deep), var(--mint)); font: inherit; font-weight: 900; cursor: pointer; box-shadow: var(--shadow); }
.chapter-nav button:disabled { opacity: .38; cursor: default; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 24px; }
.home-card { display: flex; min-height: 188px; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); transition: .2s ease; }
.home-card:hover,
.home-card:focus-visible { transform: translateY(-6px); border-color: rgba(47,158,68,.42); outline: 0; box-shadow: 0 18px 40px rgba(20,105,56,.16); }
.home-card .icon { font-size: 32px; }
.home-card h3 { margin: 8px 0 8px; color: var(--deep); }
.home-card p { color: var(--muted); font-size: 14px; }
.section { margin-top: 34px; padding: clamp(20px, 4vw, 30px); border: 1px solid var(--line); border-radius: 28px; background: rgba(255,255,255,.54); box-shadow: 0 10px 28px rgba(31,111,70,.07); }
[data-theme="dark"] .section { background: rgba(24,38,30,.68); }
.section h2 { margin-bottom: 8px; color: var(--deep); font-size: 24px; }
.section > p { color: var(--muted); }
.footer { margin-top: 48px; color: var(--muted); font-size: 13px; text-align: center; }
.to-top {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 45;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--deep), var(--mint));
  box-shadow: 0 10px 24px rgba(11,107,58,.32);
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(10px) scale(.72);
  pointer-events: none;
  transition: .22s ease;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { transform: translateY(-2px); }

@media (max-width: 860px) {
  .menu-toggle { display: block; }
  .layout { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(86vw, 310px); transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: none; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.36); z-index: 25; }
  .content { padding: 72px 14px 56px; }
  .chapter-head { align-items: flex-start; padding: 18px; }
  .chapter-progress { margin-left: 0; align-self: center; }
  .chapter-emoji { width: 50px; height: 50px; font-size: 26px; }
  .chapter-nav { flex-direction: column; }
  .scroll-hint { display: block; }
  .to-top { right: 14px; bottom: 16px; width: 42px; height: 42px; }
  .mindmap,
  .cell-diagram { grid-template-columns: 1fr; }
  .mind-center { border-radius: 24px; min-height: auto; }
}
