:root {
  --navy: #000A46;
  --navy2: #121E6E;
  --royal: #0831C2;
  --blue: #2962FF;
  --cyan: #40C4FF;
  --green: #5FB035;
  --lime: #5EED67;
  --amber: #F2A900;
  --red: #D93025;
  --ink: #141A3A;
  --muted: #5B6280;
  --line: #E3E6EF;
  --soft: #F4F6FB;
  --white: #fff;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 10, 70, .08);
  --font: Figtree, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--soft);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--royal); }
img, svg { max-width: 100%; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: #EEF1FA; padding: 1px 6px; border-radius: 6px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 24px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .logo { height: 34px; display: block; }
.topbar .course-name { font-weight: 700; color: var(--navy); text-decoration: none; white-space: nowrap; }
.topbar .crumb { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .progress-pill {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.progress-bar { width: 120px; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress-bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--lime)); transition: width .4s; }
.read-progress { position: fixed; top: 60px; left: 0; height: 3px; width: 0; background: var(--green); z-index: 49; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--navy) url("gs-cover-vis.png") center / cover no-repeat;
  color: #fff; padding: 56px 24px 64px;
}
.hero-inner { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; }
.hero .kicker { display: inline-block; font-size: 13px; letter-spacing: .08em; padding: 4px 12px; border-radius: 99px; background: rgba(255, 255, 255, .14); }
.hero h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.25; margin: 16px 0 12px; }
.hero p.lead { font-size: 18px; max-width: 720px; color: #D9E1FF; margin: 0; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero .meta span { font-size: 14px; padding: 6px 14px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .3); background: rgba(0, 10, 70, .35); }

/* ---------- Layout ---------- */
.layout { max-width: 1120px; margin: 0 auto; padding: 32px 24px 80px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; }
.toc { position: sticky; top: 84px; align-self: start; font-size: 14px; }
.toc h4 { margin: 0 0 10px; font-size: 12px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.toc a { display: block; padding: 7px 12px; border-left: 3px solid var(--line); color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--navy); }
.toc a.active { border-color: var(--green); color: var(--navy); font-weight: 600; background: #fff; }
main { min-width: 0; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  .topbar .crumb, .progress-bar { display: none; }
}

/* ---------- Sections ---------- */
section.lesson {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 36px 40px; margin-bottom: 28px;
}
@media (max-width: 640px) { section.lesson { padding: 24px 20px; } }
section.lesson > h2 { font-size: 26px; margin: 0 0 6px; color: var(--navy); line-height: 1.35; }
section.lesson > h2 .num { display: inline-block; min-width: 40px; color: var(--green); }
section.lesson > .sub { color: var(--muted); margin: 0 0 20px; }
section.lesson h3 { font-size: 19px; color: var(--navy); margin: 28px 0 8px; }
section.lesson > h4 { font-size: 16px; color: var(--royal); margin: 22px 0 6px; }
section.lesson p { margin: 10px 0; }
section.lesson ul, section.lesson ol { padding-left: 22px; }
section.lesson li { margin: 4px 0; }
.key { color: var(--royal); font-weight: 700; }
.hl { background: linear-gradient(transparent 60%, #D7F5C6 60%); }

/* ---------- Goal list ---------- */
.goals { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
.goals li { background: var(--soft); border-radius: 12px; padding: 14px 16px 14px 48px; position: relative; margin: 0; line-height: 1.55; }
.goals li::before { content: counter(goal); counter-increment: goal; position: absolute; left: 14px; top: 13px; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 13px; display: grid; place-items: center; }
.goals { counter-reset: goal; }

/* ---------- Callouts ---------- */
.callout { border-radius: 12px; padding: 16px 20px 16px 56px; margin: 18px 0; position: relative; line-height: 1.7; }
.callout::before { position: absolute; left: 18px; top: 15px; font-size: 22px; line-height: 1; }
.callout > b:first-child { display: block; margin-bottom: 2px; }
.callout.analogy { background: #EEF4FF; } .callout.analogy::before { content: "💡"; }
.callout.work { background: #EEF8E8; } .callout.work::before { content: "🧬"; }
.callout.warn { background: #FFF6E0; } .callout.warn::before { content: "⚠️"; }
.callout.fact { background: #F1F0FF; } .callout.fact::before { content: "📌"; }
details.deep { border: 1px dashed #B9C3E6; border-radius: 12px; padding: 0 18px; margin: 18px 0; background: #FAFBFF; }
details.deep summary { cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--royal); list-style: none; }
details.deep summary::-webkit-details-marker { display: none; }
details.deep summary::before { content: "＋ 深入一点："; }
details.deep[open] summary::before { content: "－ 深入一点："; }
details.deep > div { padding-bottom: 14px; }
details.deep summary::after { content: "选读，不考"; margin-left: 10px; font-size: 12px; font-weight: 500; color: var(--muted); background: #EEF1FA; border-radius: 999px; padding: 2px 8px; }

/* ---------- Section takeaways ---------- */
.takeaways { border: 1.5px solid #CFE6C2; background: #F6FBF2; border-radius: 14px; padding: 16px 20px 10px; margin: 26px 0 6px; }
.takeaways h4 { margin: 0 0 8px; font-size: 15px; color: #3C7F1C; }
.takeaways h4::before { content: "✅ "; }
.takeaways ul { margin: 0; padding-left: 20px; }
.takeaways li { margin: 0 0 6px; line-height: 1.65; }

/* ---------- Figures ---------- */
figure.fig { margin: 22px 0; background: var(--soft); border-radius: 14px; padding: 20px; }
figure.fig svg { display: block; margin: 0 auto; height: auto; }
figure.fig figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; text-align: center; }
.fig-hint { font-size: 13px; color: var(--blue); text-align: center; margin-top: 6px; }

/* ---------- Grid cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 16px 0; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: #fff; }
.card h4 { margin: 0 0 6px; color: var(--navy); font-size: 16px; }
.card p { margin: 0; font-size: 15px; color: #39405E; }
.card .tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #E8EEFF; color: var(--royal); margin-bottom: 8px; }
.card.green .tag { background: #E6F5DD; color: #3C7F1C; }

/* ---------- Compare table ---------- */
table.compare { width: 100%; border-collapse: separate; border-spacing: 0; margin: 16px 0; font-size: 15px; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); }
table.compare th, table.compare td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
table.compare thead th { background: var(--navy); color: #fff; font-weight: 600; }
table.compare tbody th { background: var(--soft); color: var(--navy); width: 22%; }
table.compare tr:last-child td, table.compare tr:last-child th { border-bottom: 0; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 18px 0; }
.stat { border-radius: 12px; padding: 18px; color: #fff; background: var(--navy); }
.stat:nth-child(2) { background: var(--royal); } .stat:nth-child(3) { background: var(--blue); } .stat:nth-child(4) { background: var(--green); }
.stat b { display: block; font-size: 24px; line-height: 1.25; white-space: nowrap; }
.stat span { font-size: 13px; opacity: .9; }
.source { font-size: 13px; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 15px; font-weight: 600; border: 0; border-radius: 10px; padding: 9px 18px; cursor: pointer; background: var(--royal); color: #fff; text-decoration: none; transition: transform .1s, background .2s; }
.btn:hover { background: var(--blue); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: #fff; color: var(--royal); border: 1px solid #C9D3F5; }
.btn.ghost:hover { background: #F0F4FF; }
.btn.green { background: var(--green); } .btn.green:hover { background: #4E9A29; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Interactive box ---------- */
.lab { border: 2px solid #D4DDF9; border-radius: 16px; padding: 20px 22px; margin: 22px 0; background: linear-gradient(180deg, #F7F9FF, #fff); }
.lab > .lab-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.lab > .lab-title::before { content: "互动"; font-size: 12px; font-weight: 600; color: #fff; background: var(--blue); border-radius: 6px; padding: 2px 8px; }
.lab > .lab-desc { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.lab input[type=text], .lab textarea, .lab select { font: inherit; font-family: var(--mono); border: 1px solid #C9D3F5; border-radius: 10px; padding: 9px 12px; width: 100%; background: #fff; }
.lab input[type=range] { width: 100%; accent-color: var(--royal); }
.output { background: var(--navy); color: #E6ECFF; border-radius: 10px; padding: 14px 16px; font-family: var(--mono); font-size: 14px; line-height: 1.7; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin-top: 12px; }

/* ---------- Hotspot figure ---------- */
.hotspot { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 760px) { .hotspot { grid-template-columns: 1fr; } }
.hotspot svg [data-spot] { cursor: pointer; transition: filter .2s, opacity .2s; }
.hotspot svg [data-spot]:hover { filter: brightness(1.12) drop-shadow(0 0 4px rgba(41, 98, 255, .6)); }
.hotspot svg [data-spot].on { filter: drop-shadow(0 0 6px rgba(95, 176, 53, .95)); }
.hotspot .spot-panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; min-height: 180px; }
.hotspot .spot-panel h4 { margin: 0 0 6px; color: var(--navy); font-size: 18px; }
.hotspot .spot-panel p { margin: 6px 0; font-size: 15px; }
.hotspot .spot-panel .empty { color: var(--muted); }
.hotspot .spot-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.hotspot .spot-chips button { font: inherit; font-size: 13px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 3px 10px; cursor: pointer; color: var(--muted); }
.hotspot .spot-chips button.seen { border-color: var(--green); color: #3C7F1C; background: #F0F9EA; }

/* ---------- Flip cards ---------- */
.flips { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 16px 0; }
.flip { perspective: 900px; height: 150px; cursor: pointer; }
.flip > div { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flip.flipped > div { transform: rotateY(180deg); }
.flip .front, .flip .back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; }
.flip .front { background: var(--navy); color: #fff; align-items: center; text-align: center; font-weight: 700; font-size: 18px; line-height: 1.35; }
.flip .front small { display: block; font-weight: 400; font-size: 12px; opacity: .7; margin-top: 6px; }
.flip .back { background: #fff; border: 2px solid var(--green); transform: rotateY(180deg); font-size: 14px; line-height: 1.6; color: var(--ink); overflow: auto; }

/* ---------- Quiz ---------- */
.quiz { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin: 16px 0; background: #fff; }
.quiz .q { font-weight: 600; margin: 0 0 12px; }
.quiz .q::before { content: "Q" counter(quiz) "  "; counter-increment: quiz; color: var(--green); font-weight: 800; }
.quiz-set { counter-reset: quiz; }
.quiz .opts { display: grid; gap: 8px; }
.quiz .opts button { font: inherit; text-align: left; border: 1px solid #D5DCF0; background: #fff; border-radius: 10px; padding: 10px 14px; cursor: pointer; transition: background .15s, border-color .15s; line-height: 1.5; color: var(--ink); }
.quiz .opts button:hover:not(:disabled) { background: #F2F5FF; border-color: var(--blue); }
.quiz .opts button.right { background: #EAF7E2; border-color: var(--green); }
.quiz .opts button.wrong { background: #FDECEA; border-color: var(--red); }
.quiz .opts button:disabled { cursor: default; }
.quiz .explain { display: none; margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--soft); font-size: 15px; }
.quiz.done .explain { display: block; }
.quiz .explain b.ok { color: #3C7F1C; } .quiz .explain b.no { color: var(--red); }
.quiz .explain .review { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); }
.quiz .explain .review a { color: var(--royal); font-weight: 600; text-decoration: none; }
.quiz .explain .review a:hover { text-decoration: underline; }
.quiz-score { display: none; margin-top: 14px; padding: 16px 20px; border-radius: 12px; background: var(--navy); color: #fff; font-weight: 600; }
.quiz-score.show { display: block; }

/* ---------- Sort game ---------- */
.sortgame ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; counter-reset: sg; }
.sortgame li { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #D5DCF0; border-radius: 10px; padding: 9px 12px; margin: 0; }
.sortgame li::before { counter-increment: sg; content: counter(sg); width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--soft); color: var(--navy); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.sortgame li span { flex: 1; }
.sortgame li button { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 32px; height: 30px; cursor: pointer; color: var(--navy); }
.sortgame li button:hover { background: #F0F4FF; }
.sortgame li.ok { border-color: var(--green); background: #F0F9EA; }
.sortgame li.bad { border-color: var(--red); background: #FDF0EF; }
.sortgame .result, .classify .result { margin-top: 12px; font-weight: 600; }

/* ---------- Classify game ---------- */
.classify .pool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 44px; padding: 10px; border-radius: 12px; background: var(--soft); margin-bottom: 12px; }
.classify .chip { font: inherit; font-size: 14px; border: 1px solid #C9D3F5; background: #fff; border-radius: 99px; padding: 5px 14px; cursor: pointer; color: var(--ink); }
.classify .chip.sel { background: var(--royal); color: #fff; border-color: var(--royal); }
.classify .chip.ok { border-color: var(--green); background: #EAF7E2; }
.classify .chip.bad { border-color: var(--red); background: #FDECEA; }
.classify .buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.classify .bucket { border: 2px dashed #C9D3F5; border-radius: 12px; padding: 10px; min-height: 110px; cursor: pointer; transition: background .15s; }
.classify .bucket:hover { background: #F5F8FF; }
.classify .bucket h5 { margin: 0 0 8px; font-size: 15px; color: var(--navy); }
.classify .bucket .items { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Stepper ---------- */
.stepper .stage { background: var(--soft); border-radius: 14px; padding: 16px; }
.stepper .steps-text { margin-top: 14px; min-height: 96px; }
.stepper .step { display: none; }
.stepper .step.on { display: block; animation: fadeIn .35s; }
.stepper .step h4 { margin: 0 0 4px; color: var(--navy); }
.stepper .controls { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.stepper .dots { display: flex; gap: 6px; flex: 1; justify-content: center; }
.stepper .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); cursor: pointer; }
.stepper .dots i.on { background: var(--green); width: 22px; border-radius: 99px; }
[data-step-show] { transition: opacity .4s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Tabs ---------- */
.tabs .tab-btns { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs .tab-btns button { font: inherit; border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs .tab-btns button.on { color: var(--navy); font-weight: 700; border-color: var(--green); }
.tabs .tab-panel { display: none; }
.tabs .tab-panel.on { display: block; animation: fadeIn .3s; }

/* ---------- Module footer ---------- */
.complete-box { text-align: center; padding: 34px 24px; background: linear-gradient(135deg, var(--navy), var(--royal)); color: #fff; border-radius: var(--radius); }
.complete-box h3 { color: #fff !important; margin-top: 0 !important; }
.complete-box .btn { background: var(--lime); color: var(--navy); }
.complete-box .btn.done { background: #fff; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.pager a { flex: 1; text-decoration: none; background: #fff; border-radius: 12px; padding: 14px 18px; box-shadow: var(--shadow); color: var(--navy); }
.pager a small { display: block; color: var(--muted); }
.pager a.next { text-align: right; }
.resources li { margin: 8px 0; }

/* ---------- Home page ---------- */
.home-wrap { max-width: 1120px; margin: 0 auto; padding: 32px 24px 80px; }
.path { position: relative; display: grid; gap: 18px; }
.mod-card { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 18px; align-items: center; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 22px; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; border-left: 6px solid var(--line); }
.mod-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0, 10, 70, .12); }
.mod-card.done { border-left-color: var(--green); }
.mod-card .mod-icon { width: 96px; height: 76px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; }
.mod-card h3 { margin: 0; color: var(--navy); font-size: 19px; }
.mod-card p { margin: 4px 0 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.mod-card .wk { font-size: 13px; color: var(--royal); font-weight: 600; }
.mod-card .status { font-size: 13px; padding: 4px 12px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.mod-card.done .status { background: #EAF7E2; color: #3C7F1C; }
.stage-label { margin: 26px 0 4px; font-size: 13px; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
@media (max-width: 640px) { .mod-card { grid-template-columns: 1fr; } .mod-card .mod-icon { display: none; } }

@media print {
  .topbar, .toc, .read-progress, .pager, .complete-box { display: none; }
  .layout { display: block; }
  section.lesson { box-shadow: none; break-inside: avoid-page; }
}
