/* Workbuddy 课程站 · 响应式样式
   设计：暖纸张底色 + 墨色正文 + 陶土红强调；标题用衬线，正文用系统无衬线。 */

:root {
  --paper: #f7f3ec;
  --paper-2: #efe7da;
  --card: #fffdf9;
  --ink: #1d1a16;
  --ink-2: #453f37;
  --muted: #7c7365;
  --line: #e4d9c8;
  --line-2: #d7c9b4;
  --accent: #c2502f;
  --accent-2: #a33f22;
  --accent-soft: #f5e0d7;
  --green: #2f5d50;
  --green-soft: #deeae4;
  --shadow-sm: 0 1px 2px rgba(60, 45, 25, .06), 0 4px 12px rgba(60, 45, 25, .05);
  --shadow: 0 10px 30px rgba(60, 45, 25, .09);
  --radius: 16px;
  --radius-lg: 22px;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --maxw: 1120px;
}

html[data-theme="dark"] {
  --paper: #141210;
  --paper-2: #1b1815;
  --card: #1c1916;
  --ink: #f3ede3;
  --ink-2: #cfc6b8;
  --muted: #9a9082;
  --line: #322c24;
  --line-2: #453d32;
  --accent: #e8825d;
  --accent-2: #f09b79;
  --accent-soft: #3a2419;
  --green: #8fc3ae;
  --green-soft: #1e2e28;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --paper: #141210; --paper-2: #1b1815; --card: #1c1916;
    --ink: #f3ede3; --ink-2: #cfc6b8; --muted: #9a9082;
    --line: #322c24; --line-2: #453d32;
    --accent: #e8825d; --accent-2: #f09b79; --accent-soft: #3a2419;
    --green: #8fc3ae; --green-soft: #1e2e28;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
@media (max-width: 720px) { body { padding-bottom: 76px; } }

img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.skip {
  position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff;
  padding: 10px 16px; border-radius: 0 0 10px 0; z-index: 100;
}
.skip:focus { left: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent); color: #fffdf9; font-family: var(--serif); font-size: 18px;
}
.brand-text em { font-style: normal; color: var(--muted); font-weight: 500; margin-left: 6px; font-size: 13px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  padding: 8px 12px; border-radius: 999px; color: var(--muted);
  font-size: 14.5px; transition: background .18s, color .18s;
}
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
@media (max-width: 720px) { .nav { display: none; } }
.topbar-actions { display: flex; gap: 6px; margin-left: auto; }
.nav + .topbar-actions { margin-left: 0; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid transparent;
  background: transparent; display: grid; place-items: center; color: var(--ink-2);
}
.icon-btn:hover { background: var(--paper-2); border-color: var(--line); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 首页 hero ---------- */
.hero { padding: 56px 0 30px; position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 240px at 88% -10%, var(--accent-soft), transparent 70%),
    radial-gradient(520px 220px at 0% 10%, var(--green-soft), transparent 72%);
  opacity: .75; z-index: -1;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); font-weight: 650;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--accent); border-radius: 2px; }
h1.hero-title {
  font-family: var(--serif); font-size: clamp(34px, 5.4vw, 60px); line-height: 1.14;
  letter-spacing: -.02em; margin: 14px 0 6px; font-weight: 700;
}
h1.hero-title em { font-style: normal; color: var(--accent); }
.hero-sub { font-size: clamp(15px, 1.6vw, 18px); color: var(--ink-2); max-width: 620px; margin: 10px 0 0; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--card);
  font-weight: 600; font-size: 15px; transition: transform .16s, box-shadow .16s, background .16s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fffdf9; }
.btn-primary:hover { background: var(--accent-2); }

.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin: 40px 0 8px;
}
.stat { background: var(--card); padding: 16px 18px; }
.stat b { display: block; font-family: var(--serif); font-size: clamp(20px, 2.6vw, 26px); letter-spacing: -.01em; }
.stat span { font-size: 12.5px; color: var(--muted); }
@media (max-width: 620px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 区块 ---------- */
.section { padding: 44px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-title { font-family: var(--serif); font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; letter-spacing: -.01em; margin: 0; }
.section-desc { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.link-more { color: var(--accent); font-size: 14px; font-weight: 600; white-space: nowrap; }
.link-more:hover { text-decoration: underline; }

/* ---------- 课程卡 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.lesson-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 20px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.lesson-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.lesson-card .num {
  font-family: var(--serif); font-size: 15px; color: var(--accent); font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.lesson-card .num::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.lesson-card h3 { font-size: 18.5px; line-height: 1.35; margin: 0; letter-spacing: -.01em; }
.lesson-card p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.65; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; }
.chip {
  display: inline-flex; white-space: nowrap; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; background: var(--paper-2); color: var(--ink-2);
  font-size: 12px; font-variant-numeric: tabular-nums;
}
.chip.accent { background: var(--accent-soft); color: var(--accent-2); }
.chip.green { background: var(--green-soft); color: var(--green); }
.done-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-left: auto; }
.lesson-card .keynodes { font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 9px; }

/* ---------- 首页路径 ---------- */
.path { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.path-card { padding: 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.path-card h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 19px; }
.path-card p { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); }
.path-links { display: flex; flex-wrap: wrap; gap: 6px; }
.path-links a { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--paper-2); }
.path-links a:hover { background: var(--accent-soft); color: var(--accent-2); }
@media (max-width: 860px) { .path { grid-template-columns: 1fr; } }

/* ---------- 课程详情 ---------- */
.lesson-head { padding-top: 30px; padding-bottom: 10px; }
.crumbs { font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.crumbs a:hover { color: var(--accent); }
.lesson-title { font-family: var(--serif); font-size: clamp(26px, 4vw, 40px); line-height: 1.2; margin: 0 0 10px; letter-spacing: -.02em; }
.lesson-lead { color: var(--ink-2); max-width: 760px; margin: 0 0 18px; font-size: 15.5px; }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(0, .82fr); gap: 26px; align-items: start; padding-bottom: 60px; max-width: 1280px; }
@media (max-width: 980px) { .lesson-layout { grid-template-columns: 1fr; } }

.player-wrap { position: sticky; top: 78px; }
@media (max-width: 980px) { .player-wrap { position: static; } }
.player-card { background: #000; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.player-card video { width: 100%; aspect-ratio: 16 / 9; background: #000; }
.player-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); font-size: 13px; color: var(--muted); }
.player-bar .now { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.outline { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.outline-head { padding: 18px 20px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.outline-head h2 { margin: 0; font-size: 16px; font-family: var(--serif); }
.group { padding: 16px 20px 6px; }
.group h3 {
  font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 10px; font-weight: 650;
}
.point { display: flex; gap: 12px; padding: 9px 0; border-top: 1px dashed var(--line); }
.point:first-of-type { border-top: 0; }
.point .t {
  flex: none; width: 54px; text-align: center; font-family: var(--mono); font-size: 12.5px;
  padding: 2px 0; border-radius: 7px; background: var(--paper-2); color: var(--ink-2);
  border: 1px solid var(--line); font-variant-numeric: tabular-nums;
  align-self: flex-start; margin-top: 2px;
}
.point .t:hover { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent-soft); }
.point .t.plain { background: transparent; border-color: transparent; color: var(--line-2); }
.point p { margin: 0; font-size: 14.5px; line-height: 1.68; color: var(--ink-2); }
.point .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.point .tags a { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--green-soft); color: var(--green); }

.transcript-toggle { border-top: 1px solid var(--line); }
.transcript-toggle summary {
  padding: 14px 20px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2);
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.transcript-toggle summary::after { content: "展开"; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.transcript-toggle[open] summary::after { content: "收起"; }
.transcript-body { max-height: 420px; overflow: auto; padding: 0 20px 18px; }
.tr-line { display: flex; gap: 12px; padding: 5px 0; font-size: 13.5px; color: var(--ink-2); }
.tr-line .t { flex: none; font-family: var(--mono); font-size: 12px; color: var(--muted); padding-top: 2px; }
.tr-line:hover { background: var(--paper-2); border-radius: 6px; }

.lesson-nav { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 60px; }
.lesson-nav a { flex: 1; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); font-size: 14px; }
.lesson-nav a:hover { border-color: var(--accent); color: var(--accent); }
.lesson-nav .next { text-align: right; }
.lesson-nav span { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- 知识卡 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.filters button {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); font-size: 13px; color: var(--ink-2);
}
.filters button.on { background: var(--accent); border-color: var(--accent); color: #fffdf9; font-weight: 600; }
.knowledge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.kcard { padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 8px; }
.kcard:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.kcard .top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.kcard .t { font-family: var(--mono); background: var(--paper-2); padding: 1px 7px; border-radius: 6px; color: var(--ink-2); }
.kcard p { margin: 0; font-size: 14.5px; color: var(--ink); line-height: 1.65; }
.kcard .tags { display: flex; flex-wrap: wrap; gap: 5px; }
.kcard .tags span { cursor: pointer; font-size: 11.5px; color: var(--green); background: var(--green-soft); padding: 1px 7px; border-radius: 999px; }
mark { background: var(--accent-soft); color: var(--accent-2); padding: 0 2px; border-radius: 3px; }

/* ---------- 提示词 ---------- */
.prompt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.prompt-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.prompt-card h3 { margin: 0; font-size: 15px; font-family: var(--serif); }
.prompt-card pre {
  margin: 0; padding: 12px 14px; background: var(--paper-2); border-radius: 10px;
  font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-word; color: var(--ink);
  border: 1px solid var(--line);
}
.prompt-card .ref { font-size: 12px; color: var(--muted); }
.copy-btn { align-self: flex-start; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-size: 12.5px; }
.copy-btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-2); }

/* ---------- 文字稿 ---------- */
.searchbar { display: flex; gap: 10px; margin: 16px 0 24px; }
.searchbar input {
  flex: 1; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font: inherit; color: var(--ink);
}
.searchbar input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.tr-block { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 12px; overflow: hidden; }
.tr-block > summary { padding: 14px 18px; cursor: pointer; display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 15px; list-style: none; }
.tr-block > summary::after { content: "+"; margin-left: auto; color: var(--muted); }
.tr-block[open] > summary::after { content: "−"; }
.tr-block .body { padding: 4px 18px 18px; }

/* ---------- 页脚 / 底栏 ---------- */
.foot { border-top: 1px solid var(--line); padding: 28px 0 34px; margin-top: 40px; background: var(--paper-2); }
.foot-in p { margin: 4px 0; font-size: 13px; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; display: none;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; display: grid; place-items: center; gap: 3px; padding: 8px 0 10px; font-size: 11px; color: var(--muted); }
.tabbar a.active { color: var(--accent); }
.tabbar svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
@media (max-width: 720px) { .tabbar { display: flex; } }

/* ---------- 搜索弹层 ---------- */
[hidden] { display: none !important; }
.search-modal { position: fixed; inset: 0; z-index: 90; background: rgba(20, 15, 10, .45); backdrop-filter: blur(4px); display: grid; place-items: start center; padding: 12vh 16px 0; }
.search-box { width: min(640px, 100%); background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 18px; border: 1px solid var(--line); }
.search-box input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper-2); font: inherit; color: var(--ink); }
.search-box input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.search-hint { font-size: 12px; margin-top: 8px; }
.search-results { margin-top: 10px; max-height: 52vh; overflow: auto; }
.sr-item { display: flex; gap: 10px; padding: 9px 8px; border-radius: 10px; align-items: baseline; }
.sr-item:hover { background: var(--paper-2); }
.sr-item .t { font-family: var(--mono); font-size: 12px; color: var(--accent); flex: none; }
.sr-item .lbl { font-size: 11.5px; color: var(--muted); flex: none; }
.sr-item .txt { font-size: 14px; color: var(--ink-2); }

/* ---------- 杂项 ---------- */
.note { padding: 16px 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.note h3 { margin: 0 0 8px; font-size: 15px; font-family: var(--serif); }
.prose p { margin: 0 0 12px; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }
@media (max-width: 720px) {
  .filters {
    flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin-right: -20px; padding-right: 20px;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: none; }
  .lesson-card h3 { font-size: 17.5px; }
  .player-card video { border-radius: 0; }
  .outline { border-radius: 18px; }
  .hero { padding-top: 38px; }
  .section { padding: 34px 0; }
  .lesson-title { font-size: 30px; }
}

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

/* ---------- 观看状态：当前 / 已看 / 未看 ---------- */
.point {
  position: relative;
  border-radius: 10px;
  transition: background .2s ease, box-shadow .2s ease;
}
.point .point-main { flex: 1; min-width: 0; }
.point .state {
  flex: none; width: 18px; height: 18px; margin-top: 4px; border-radius: 50%;
  border: 1.5px dashed var(--line-2); display: grid; place-items: center;
}
.point .state::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.point.is-current {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
  padding-left: 10px; margin-left: -10px;
}
.point.is-current .state { border-style: solid; border-color: var(--accent); }
.point.is-current .state::after { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.point.is-done .state { border-style: solid; border-color: var(--green); }
.point.is-done .state::after {
  content: ""; width: 8px; height: 4px; border-left: 1.6px solid var(--green);
  border-bottom: 1.6px solid var(--green); background: none; border-radius: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}
.point.is-done .t:not(.plain) { background: var(--green-soft); color: var(--green); border-color: transparent; }
.point.is-current .t.plain, .point.is-done .t.plain { background: transparent; border-color: transparent; }
.point.is-done .point-main p { color: var(--muted); }
.point.is-todo .point-main p { color: var(--ink-2); }
.point.is-current .point-main p { color: var(--ink); }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: .45; } }

.tr-line { border-radius: 6px; transition: background .2s ease; }
.tr-line.is-current { background: var(--accent-soft); box-shadow: inset 2px 0 var(--accent); }
.tr-line.is-current .t { color: var(--accent); }
.tr-line.is-done { opacity: .62; }
.tr-line.is-done .t::after { content: " ✓"; color: var(--green); font-size: 10px; }

/* 进度条 */
.mini-bar { display: inline-block; width: 56px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.mini-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.follow-btn {
  margin-left: auto; padding: 4px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
}
.follow-btn.on { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent-soft); font-weight: 600; }
.follow-btn::before { content: "○ "; }
.follow-btn.on::before { content: "● "; }
.player-bar .watch { color: var(--green); font-variant-numeric: tabular-nums; font-weight: 600; }
.player-bar .watch.is-zero { color: var(--muted); font-weight: 500; }

.lesson-card .lprog { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.lesson-card .lprog i { display: block; height: 100%; background: var(--accent); }

.kcard.is-done { border-color: var(--green-soft); background: color-mix(in srgb, var(--green-soft) 28%, var(--card)); }
.kcard .kbadge {
  margin-left: auto; font-size: 10.5px; padding: 1px 6px; border-radius: 999px;
  background: var(--green-soft); color: var(--green); font-weight: 600;
}
.kcard .top { flex-wrap: wrap; }

/* 桌面：大纲成为独立滚动区，跟随播放时只在卡片内滚动 */
@media (min-width: 981px) {
  .outline { max-height: calc(100vh - 108px); overflow: auto; position: sticky; top: 78px; scrollbar-width: thin; }
  .outline-head { position: sticky; top: 0; z-index: 3; background: var(--card); }
}
/* 移动端同样在卡片内滚动，当前要点贴顶，不劫持页面滚动 */
@media (max-width: 980px) {
  .outline {
    position: static; overflow: auto; max-height: 62vh;
    scrollbar-width: thin; -webkit-overflow-scrolling: touch;
  }
  .outline-head { position: sticky; top: 0; z-index: 3; background: var(--card); }
  .follow-btn { display: inline-block; }

}
.player-bar .resume-hint { color: var(--accent-2); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.legend {
  display: flex; align-items: center; gap: 8px; padding: 10px 20px;
  border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted);
}
.legend .lg { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.legend .lg-cur { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.legend .lg-done { background: var(--green); }
.legend .lg-todo { border: 1.5px dashed var(--line-2); }
.legend .lg-note { margin-left: auto; opacity: .8; }
.group.has-current > h3 { color: var(--accent); }
.group.has-current > h3::after { content: " ▸ 正在讲"; font-size: 10px; letter-spacing: 0; color: var(--accent); }
.group.all-done > h3::after { content: " ✓"; color: var(--green); }

/* ---------- 剧场模式（视频铺满视口） ---------- */
body.theater { overflow: hidden; }
body.theater .topbar,
body.theater .foot,
body.theater .tabbar,
body.theater .lesson-head,
body.theater .lesson-nav,
body.theater .outline { display: none !important; }
body.theater .lesson-layout { display: block; max-width: none; padding: 0; margin: 0; }
body.theater .player-wrap { position: fixed; inset: 0; z-index: 200; background: #000; }
body.theater .player-card {
  position: absolute; inset: 0; border: 0; border-radius: 0; box-shadow: none;
  display: flex; align-items: center; justify-content: center; background: #000;
}
body.theater .player-card video {
  width: 100%; height: 100%; max-height: 100dvh; aspect-ratio: auto; object-fit: contain; border-radius: 0;
}
body.theater .player-bar { display: none; }
body.theater .hud { display: flex; }
.hud {
  display: none; position: fixed; inset: 0; z-index: 210; pointer-events: none;
  flex-direction: column; justify-content: space-between;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 22%, transparent 70%, rgba(0,0,0,.65));
  transition: opacity .25s ease;
}
body.theater.idle .hud { opacity: 0; }
.hud-top, .hud-bottom { display: flex; align-items: center; gap: 12px; padding: 18px 22px; color: #fff; pointer-events: none; }
.hud-top { justify-content: space-between; }
.hud-title { font-size: 13px; letter-spacing: .04em; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.hud-mini { display: none; }
.hud-portrait { display: none; }
.hud-actions { display: flex; gap: 8px; pointer-events: auto; }
.hud-btn {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); color: #fff;
  border-radius: 999px; padding: 7px 14px; font-size: 13px; backdrop-filter: blur(6px);
}
.hud-btn:hover { background: rgba(255,255,255,.26); }
.hud-bottom { flex-wrap: wrap; row-gap: 8px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
@media (max-width: 720px) {
  .hud-top { padding: 10px 12px; gap: 8px; }
  .hud-title { max-width: 40vw; font-size: 12px; }
  .hud-actions { gap: 6px; }
  .hud-btn { padding: 6px 10px; font-size: 12px; }
  .hud-full { display: none; }
  .hud-mini { display: inline; }
  .hud-bottom { padding: 10px 14px calc(20px + env(safe-area-inset-bottom)); }
}
@media (orientation: portrait) and (max-width: 720px) {
  .hud-portrait { display: inline; opacity: .75; }
}
.hud-time { font-family: var(--mono); font-size: 13px; color: #ffd9c9; flex: none; }
.hud-text {
  flex: 1; min-width: 220px; font-size: 14px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hud-bar { flex-basis: 100%; height: 3px; border-radius: 2px; background: rgba(255,255,255,.22); overflow: hidden; }
.hud-bar i { display: block; height: 100%; width: 0; background: #e8825d; }
@media (max-width: 720px) {
  .hud-text { font-size: 12.5px; -webkit-line-clamp: 2; }
  .hud-top, .hud-bottom { padding: 14px 16px; }
  body.theater .player-card video { max-height: 100dvh; }
}
.hud-play {
  flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center;
  font-size: 14px; pointer-events: auto; backdrop-filter: blur(6px);
}
.hud-play:hover { background: rgba(255,255,255,.3); }
.hud-bar { cursor: pointer; pointer-events: auto; }
.hud-bar::before { content: ""; display: block; }
.hud-bar { height: 4px; }
.hud-bar:hover { height: 6px; }
.hud-time { white-space: nowrap; }

@media (max-width: 720px) {
  .player-bar { flex-wrap: wrap; row-gap: 4px; padding: 9px 12px; }
  .player-bar .bar-hint { display: none; }
  .lesson-head .card-meta .chip { font-size: 11.5px; padding: 3px 8px; }
  .lesson-head .card-meta .btn { padding: 6px 12px; font-size: 12.5px; }
  .hud-play { width: 34px; height: 34px; }
}

/* ---------- 首页：新手引导条 ---------- */
.beginner-band {
  display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 20px; align-items: center;
  padding: 22px 24px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent-soft), transparent 62%), var(--card);
  border: 1px solid var(--line);
}
.beginner-band h2 { font-family: var(--serif); font-size: clamp(19px, 2.2vw, 24px); margin: 6px 0 8px; }
.beginner-band p { margin: 0; color: var(--ink-2); font-size: 14px; }
.bb-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.bb-steps span { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); }
@media (max-width: 980px) {
  .beginner-band { grid-template-columns: 1fr; }
  .beginner-band .btn { justify-self: start; }
}

/* ---------- 入门指南 ---------- */
.guide-head { padding-top: 30px; }
.guide-layout { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 34px; padding-bottom: 70px; }
.guide-toc {
  position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 110px);
  overflow: auto; padding-right: 8px;
}
.toc-title { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.guide-toc a {
  display: block; padding: 6px 10px; border-radius: 8px; font-size: 13px;
  color: var(--ink-2); border-left: 2px solid transparent; line-height: 1.45;
}
.guide-toc a:hover { background: var(--paper-2); color: var(--ink); border-left-color: var(--accent); }
.guide-body { max-width: 760px; min-width: 0; }
.g-section { padding: 8px 0 26px; border-bottom: 1px dashed var(--line); margin-bottom: 18px; scroll-margin-top: 84px; }
.guide-body a {
  color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.guide-body a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.g-section:last-child { border-bottom: 0; }
.g-title { font-family: var(--serif); font-size: clamp(20px, 2.4vw, 26px); margin: 8px 0 14px; letter-spacing: -.01em; }
.g-h3 { font-size: 15.5px; margin: 20px 0 8px; color: var(--ink); }
.g-p { margin: 8px 0; color: var(--ink-2); font-size: 14.8px; line-height: 1.75; }
.g-ul, .g-ol { margin: 8px 0 12px; padding-left: 22px; color: var(--ink-2); font-size: 14.8px; line-height: 1.75; }
.g-ul li, .g-ol li { margin: 4px 0; }
.g-note {
  margin: 12px 0; padding: 12px 16px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 10px 10px 0; font-size: 14px; color: var(--ink);
}
.g-prompt {
  margin: 12px 0 16px; padding: 14px 16px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 10px;
}
.g-prompt pre {
  margin: 0; font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-word;
  color: var(--ink); line-height: 1.7;
}
.g-code { padding: 12px 16px; background: var(--paper-2); border-radius: 10px; font-size: 13px; overflow: auto; }
@media (max-width: 980px) {
  .guide-layout { grid-template-columns: 1fr; gap: 12px; }
  .guide-toc {
    position: static; max-height: none; display: flex; gap: 8px; overflow-x: auto;
    padding: 4px 0 10px; scrollbar-width: none;
  }
  .guide-toc .toc-title { display: none; }
  .guide-toc a { white-space: nowrap; border: 1px solid var(--line); border-left-width: 1px; background: var(--card); }
}
@media print {
  .topbar, .tabbar, .foot, .guide-toc, .guide-head .btn, .guide-head .crumbs { display: none !important; }
  .guide-layout { display: block; }
  .guide-body { max-width: none; }
  .g-section { break-inside: avoid; }
}
.g-intro { padding: 4px 0 18px; border-bottom: 1px dashed var(--line); }
.g-intro .g-note { margin-top: 0; }
.prompt-card .tags { display: flex; flex-wrap: wrap; gap: 5px; }
.prompt-card .tags span {
  font-size: 11.5px; padding: 1px 7px; border-radius: 999px;
  background: var(--green-soft); color: var(--green);
}
.prompt-card .ref .chip { margin-left: 4px; }
.g-sub { margin: 6px 0 2px; padding-left: 18px; font-size: 14.2px; }
.g-sub li { margin: 3px 0; color: var(--ink-2); }
.guide-body code {
  font-family: var(--mono); font-size: .92em; background: var(--paper-2);
  padding: 1px 5px; border-radius: 4px; color: var(--ink);
}
.g-table-wrap { overflow-x: auto; max-width: 100%; margin: 14px 0 18px; border: 1px solid var(--line); border-radius: 12px; }
.g-table { width: 100%; border-collapse: collapse; font-size: 13.8px; min-width: 520px; }
.g-table th, .g-table td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.g-table th { background: var(--paper-2); font-weight: 650; color: var(--ink); white-space: nowrap; }
.g-table tbody tr:last-child td { border-bottom: 0; }
.g-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--paper-2) 45%, transparent); }
.g-table td:first-child { font-weight: 600; color: var(--ink); }
