/* 极客中医课程 · 深色终端美学 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0b1220;
  --bg-soft: #101a2e;
  --panel: #141f36;
  --panel-2: #1a2745;
  --line: rgba(122, 240, 190, .14);
  --ink: #e8eef8;
  --muted: #8fa1bd;
  --green: #4ade80;
  --cyan: #22d3ee;
  --gold: #fbbf24;
  --red: #f87171;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(34, 211, 238, .08), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(74, 222, 128, .06), transparent 55%),
    var(--bg);
  color: var(--ink);
  line-height: 1.75;
  min-height: 100vh;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--green); color: #052012;
  padding: 8px 16px; border-radius: 0 0 8px 0; z-index: 99; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: rgba(11, 18, 32, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 800; letter-spacing: .12em; font-size: 13px; }
.brand img { width: 26px; height: 26px; border-radius: 6px; }

.lang-switch { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-left: auto; }
.lang-switch button {
  font-family: var(--mono); font-size: 12px; padding: 7px 14px; border: none; cursor: pointer;
  background: transparent; color: var(--muted); transition: all .2s;
}
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button.active { background: var(--green); color: #052012; font-weight: 700; }

.top-progress { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.top-progress i { display: block; width: 110px; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.top-progress b { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--green), var(--cyan)); transition: width .5s; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 40px; align-items: center;
  padding: clamp(40px, 8vh, 90px) clamp(16px, 5vw, 64px) 40px;
  max-width: 1200px; margin: 0 auto;
}
.eyebrow { font-family: var(--mono); font-size: 13px; color: var(--green); letter-spacing: .06em; margin-bottom: 14px; }
.prompt { color: var(--cyan); }
.cursor { display: inline-block; width: 9px; height: 16px; background: var(--green); vertical-align: -2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero h1 { font-size: clamp(34px, 6vw, 58px); line-height: 1.15; letter-spacing: .01em; margin-bottom: 14px; }
.hero-lead { color: var(--muted); font-size: clamp(15px, 2vw, 18px); max-width: 34em; margin-bottom: 26px; }

.hero-stats { display: flex; gap: clamp(18px, 3vw, 38px); margin-bottom: 30px; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-family: var(--mono); font-size: 30px; color: var(--cyan); line-height: 1.2; }
.hero-stats span { font-size: 12px; color: var(--muted); }

.hero-actions { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.primary-action {
  display: inline-block; background: var(--green); color: #052012; font-weight: 800;
  padding: 13px 28px; border-radius: 12px; text-decoration: none; font-size: 16px;
  box-shadow: 0 6px 24px rgba(74, 222, 128, .25); transition: transform .15s;
}
.primary-action:hover { transform: translateY(-2px); }
.text-action { background: none; border: none; color: var(--cyan); font-size: 15px; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }

.hero-art { display: flex; justify-content: center; }
.model-card {
  background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 22px 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4), inset 0 0 40px rgba(74, 222, 128, .03);
  width: min(360px, 100%);
}
.model-head, .model-foot {
  font-family: var(--mono); font-size: 13px; color: var(--green);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  letter-spacing: .04em;
}
.model-head span, .model-foot span { color: rgba(74, 222, 128, .5); flex: 1; }
.model-head span:first-child, .model-foot span:first-child { text-align: left; }
.model-head span:last-child, .model-foot span:last-child { text-align: right; }
.wuxing-svg { display: block; width: 100%; height: auto; margin: 6px 0 2px; }
.model-legend {
  display: flex; justify-content: center; gap: 22px;
  font-family: var(--mono); font-size: 12px; margin-bottom: 8px;
}
.lg-gen { color: var(--green); }
.lg-ke { color: var(--red); }
.model-legend b { font-family: var(--sans); font-weight: 600; }
.ascii {
  font-family: var(--mono); font-size: clamp(10px, 1.3vw, 13px); line-height: 1.5;
  color: var(--green); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4), inset 0 0 40px rgba(74, 222, 128, .03);
  overflow-x: auto; max-width: 100%;
}

/* ---------- 免责声明 ---------- */
.disclaimer {
  display: flex; gap: 14px; align-items: flex-start;
  max-width: 1100px; margin: 0 auto 30px;
  padding: 16px 22px;
  margin-left: clamp(16px, calc((100vw - 1100px) / 2), auto); margin-right: clamp(16px, calc((100vw - 1100px) / 2), auto);
  background: rgba(251, 191, 36, .06);
  border: 1px solid rgba(251, 191, 36, .25); border-radius: 14px;
  color: #e5d5a3; font-size: 14px;
}
.disc-icon { font-size: 18px; color: var(--gold); line-height: 1.4; }

/* ---------- 课程 ---------- */
.course { max-width: 1100px; margin: 0 auto; padding: 10px clamp(16px, 4vw, 32px) 60px; }

.module { margin-bottom: 46px; }
.module-head { margin-bottom: 18px; }
.module-code { font-family: var(--mono); font-size: 12px; color: var(--cyan); letter-spacing: .14em; }
.module-head h2 { font-size: clamp(22px, 3.4vw, 30px); margin: 6px 0 6px; }
.module-head h2 .m-icon { margin-right: 10px; }
.module-intro { color: var(--muted); font-size: 15px; max-width: 46em; }
.module-progress { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; }
.module-progress b { color: var(--green); }

.lesson-list { display: flex; flex-direction: column; gap: 12px; }

.lesson {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; transition: border-color .2s;
}
.lesson.open { border-color: rgba(34, 211, 238, .4); }
.lesson.done .lesson-no { color: var(--green); }

.lesson-toggle {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px 20px; background: none; border: none; cursor: pointer;
  color: var(--ink); text-align: left; font-family: inherit;
}
.lesson-toggle:hover { background: rgba(255, 255, 255, .02); }
.lesson-no { font-family: var(--mono); font-size: 13px; color: var(--muted); min-width: 44px; }
.lesson-titles { flex: 1; min-width: 0; }
.lesson-titles strong { display: block; font-size: 16.5px; line-height: 1.4; }
.lesson-titles small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.lesson-state { font-family: var(--mono); font-size: 15px; color: var(--muted); transition: transform .25s; }
.lesson.open .lesson-state { transform: rotate(90deg); color: var(--cyan); }

.lesson-body { display: none; padding: 4px 22px 24px; }
.lesson.open .lesson-body { display: block; }

.hook {
  font-family: var(--mono); font-size: 13.5px; color: var(--gold);
  background: rgba(251, 191, 36, .07); border-left: 3px solid var(--gold);
  padding: 10px 14px; border-radius: 0 8px 8px 0; margin-bottom: 18px;
}
.hook .h-en { display: block; color: rgba(229, 213, 163, .75); margin-top: 4px; }

.lesson-body .para { margin-bottom: 14px; font-size: 15.5px; }
.para-en { color: #b7c5db; font-size: 14.5px; }
.mode-both .para-pair { margin-bottom: 20px; }
.mode-both .para-pair .para { margin-bottom: 6px; }
.mode-both .para-en { border-left: 2px solid var(--line); padding-left: 12px; }

.points { margin: 18px 0; display: flex; flex-direction: column; gap: 8px; }
.point {
  display: flex; gap: 10px; align-items: baseline;
  font-size: 14.5px; background: var(--bg-soft); border-radius: 10px; padding: 10px 14px;
}
.point::before { content: '▸'; color: var(--green); font-family: var(--mono); }
.point small { display: block; color: var(--muted); }

.quote {
  background: var(--panel-2); border-radius: 12px; padding: 16px 18px; margin: 18px 0 6px;
  border: 1px solid rgba(34, 211, 238, .18);
}
.quote-zh { font-size: 16px; font-weight: 600; color: #d9f3ff; }
.quote-src { font-family: var(--mono); font-size: 12px; color: var(--cyan); margin-top: 6px; }
.quote-en { font-size: 13.5px; color: var(--muted); margin-top: 8px; font-style: italic; }
.quote-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.quote-label { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: var(--cyan); }
.speak-btn {
  background: none; border: 1px solid var(--line); color: var(--cyan); border-radius: 8px;
  padding: 4px 10px; cursor: pointer; font-size: 14px;
}
.speak-btn:hover { border-color: var(--cyan); }

.reading-card {
  background: rgba(34, 211, 238, .05); border: 1px solid rgba(34, 211, 238, .22);
  border-radius: 12px; padding: 16px 18px; margin: 18px 0 6px;
}
.reading-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.reading-label { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--cyan); }
.reading-src { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.reading-card strong { display: block; font-size: 15.5px; margin-bottom: 6px; }
.reading-card p { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.read-btn {
  background: none; border: 1px solid rgba(34, 211, 238, .4); color: var(--cyan);
  font-size: 13.5px; font-weight: 700; padding: 8px 16px; border-radius: 9px; cursor: pointer;
  transition: all .2s;
}
.read-btn:hover { background: rgba(34, 211, 238, .1); }

/* ---------- 阅读器 ---------- */
.reader {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 8, 16, .8); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(0px, 3vw, 40px);
}
.reader[hidden] { display: none; }
.reader-panel {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 18px;
  width: min(760px, 100%); max-height: min(88vh, 100%);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
.reader-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 20px 24px 14px; border-bottom: 1px solid var(--line);
}
.reader-meta { font-family: var(--mono); font-size: 12px; color: var(--cyan); margin-bottom: 4px; }
.reader-top h2 { font-size: clamp(17px, 2.6vw, 22px); line-height: 1.4; }
.reader-close {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 15px; flex-shrink: 0;
}
.reader-close:hover { color: var(--ink); border-color: var(--cyan); }
.reader-scroll { overflow-y: auto; padding: 18px 24px 24px; }
.reader-blurb {
  font-size: 13.5px; color: var(--gold); background: rgba(251, 191, 36, .07);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 18px;
}
.reader-body p { margin-bottom: 12px; font-size: 15.5px; line-height: 1.9; }
.reader-body img.art-img { display: block; max-width: 100%; height: auto; margin: 8px auto 14px; border-radius: 10px; background: var(--panel-2); min-height: 40px; }
.reader-footer {
  margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--line);
  font-size: 12.5px; color: var(--muted);
}
.reader-footer a { color: var(--cyan); display: inline-block; margin-top: 8px; }

.done-btn {
  margin-top: 16px; width: 100%;
  background: transparent; border: 1px dashed rgba(74, 222, 128, .5); color: var(--green);
  font-family: var(--mono); font-size: 13.5px; font-weight: 700;
  padding: 12px; border-radius: 10px; cursor: pointer; transition: all .2s;
}
.done-btn:hover { background: rgba(74, 222, 128, .08); }
.done-btn.is-done { background: rgba(74, 222, 128, .12); border-style: solid; }

/* ---------- 结尾 ---------- */
.finish-note {
  max-width: 1100px; margin: 0 auto; padding: 30px clamp(16px, 4vw, 32px) 70px;
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 30px; align-items: center;
}
.finish-note h2 { font-size: clamp(20px, 3vw, 27px); margin-top: 6px; line-height: 1.4; }
.finish-note > p { color: var(--muted); font-size: 14.5px; }

footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px clamp(16px, 4vw, 40px);
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
footer button { background: none; border: none; color: var(--muted); cursor: pointer; font-family: var(--mono); font-size: 12px; text-decoration: underline; }
footer button:hover { color: var(--red); }

/* ---------- 文库页 ---------- */
.lib-back { color: var(--cyan); text-decoration: none; font-size: 13.5px; white-space: nowrap; }
.lib-search {
  margin-left: auto; width: min(340px, 44vw);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font-size: 14px; padding: 9px 14px; font-family: inherit;
}
.lib-search:focus { outline: none; border-color: var(--cyan); }
.lib-hero { padding-bottom: 20px; grid-template-columns: 1fr; }
.lib-main { padding-top: 0; }
.lib-back-btn { margin-bottom: 14px; }

.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.shelf-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 16px; cursor: pointer; text-align: left; color: var(--ink);
  display: flex; flex-direction: column; gap: 6px; transition: all .2s; font-family: inherit;
}
.shelf-card:hover { border-color: rgba(34, 211, 238, .45); transform: translateY(-2px); }
.shelf-icon { font-size: 24px; }
.shelf-card strong { font-size: 15.5px; line-height: 1.4; }
.shelf-card small { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.art-list { display: flex; flex-direction: column; gap: 6px; }
.art-row {
  display: flex; gap: 14px; align-items: baseline; width: 100%;
  background: var(--panel); border: 1px solid transparent; border-radius: 10px;
  padding: 11px 14px; cursor: pointer; text-align: left; color: var(--ink); font-family: inherit;
}
.art-row:hover { border-color: rgba(34, 211, 238, .35); }
.art-date { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.art-title { font-size: 14.5px; line-height: 1.5; }
.art-series { display: inline-block; margin-left: 8px; color: var(--cyan); font-size: 11.5px; }
.loading { color: var(--muted); }

.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.pager button {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  min-width: 34px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-family: var(--mono); font-size: 12.5px;
}
.pager button.cur { background: var(--green); color: #052012; font-weight: 700; border-color: transparent; }
.lib-course-link { color: var(--cyan); text-decoration: none; }

/* ---------- 语言模式可见性 ---------- */
.mode-zh .only-en { display: none !important; }
.mode-en .only-zh { display: none !important; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 26px; padding-top: 34px; }
  .hero-art { order: -1; }
  .finish-note { grid-template-columns: 1fr; gap: 14px; }
  .top-progress i { width: 64px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
}
@media (max-width: 480px) {
  .lesson-toggle { padding: 14px 14px; gap: 10px; }
  .lesson-body { padding: 2px 14px 18px; }
  .top-progress span { display: none; }
}
