:root {
  --paper: #f6f1e7;
  --paper-2: #efe7d7;
  --card: #fffdf8;
  --ink: #1d1b18;
  --ink-2: #4a453d;
  --muted: #847b6d;
  --line: #e3d9c6;
  --line-2: #d4c8b1;
  --red: #a8322a;
  --red-hover: #8f2a23;
  --red-soft: #f4e3dd;
  --green: #2f6b4f;
  --green-soft: #e1eee6;
  --amber: #9a6b16;
  --amber-soft: #f5ead2;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 8px 24px rgba(60, 40, 20, .06);
  --serif: "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14120f;
    --paper-2: #1b1814;
    --card: #1f1c17;
    --ink: #eee7d8;
    --ink-2: #cbc2b0;
    --muted: #918877;
    --line: #322d25;
    --line-2: #423b31;
    --red: #d65d4d;
    --red-hover: #e2715f;
    --red-soft: #3a211c;
    --green: #6fb38f;
    --green-soft: #1d2f25;
    --amber: #d9a64a;
    --amber-soft: #33281a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.35; margin: 0; letter-spacing: .01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--red-soft); }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.serif { font-family: var(--serif); }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.seal {
  flex: none; width: 34px; height: 34px; border-radius: 6px;
  background: var(--red); color: #fff8ef;
  display: grid; place-items: center;
  font: 700 19px/1 var(--serif);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18);
}
.brand-name { font: 700 18px/1.2 var(--serif); white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-size: 14px; white-space: nowrap; max-width: 8em; overflow: hidden; text-overflow: ellipsis; }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav .btn { margin-left: 6px; }
@media (max-width: 640px) {
  .brand-sub, .nav .hide-sm { display: none; }
  .nav a { padding: 6px 6px; }
  .topbar .wrap { gap: 8px; }
}

/* ---------- 按钮与表单 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); cursor: pointer;
  text-decoration: none; font-size: 14px; line-height: 1.3; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff8ef; }
.btn-primary:hover { background: var(--red-hover); border-color: var(--red-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--paper-2); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 13px 26px; font-size: 16px; border-radius: 10px; }
.btn-danger { color: var(--red); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--card);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; min-height: 90px; line-height: 1.6; }
.input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--red); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 20px; white-space: nowrap;
  background: var(--paper-2); color: var(--ink-2);
}
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 8px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 200; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 15, 10, .45); z-index: 100;
  display: grid; place-items: center; padding: 16px;
}
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; padding: 24px; }
.modal h3 { font-size: 20px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 72px; padding: 28px 0 40px; color: var(--muted); font-size: 13px; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ---------- 首页 ---------- */
.hero { position: relative; padding: 72px 0 56px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 300px at 85% 10%, var(--red-soft), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 47px, color-mix(in srgb, var(--line) 50%, transparent) 47px 48px);
  opacity: .7;
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.hero .wrap { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--red); font-size: 14px; letter-spacing: .15em; margin-bottom: 18px; }
.eyebrow::before { content: ""; width: 24px; height: 1px; background: currentColor; }
.hero h1 { font-size: clamp(32px, 5.4vw, 56px); line-height: 1.22; letter-spacing: .02em; }
.hero h1 em { font-style: normal; color: var(--red); }
.hero .lead { margin-top: 20px; font-size: 17px; color: var(--ink-2); max-width: 36em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.vertical {
  writing-mode: vertical-rl; font: 600 22px/1.9 var(--serif); letter-spacing: .5em;
  color: var(--ink-2); border-left: 1px solid var(--line-2); padding-left: 22px; white-space: nowrap;
}
.vertical b { color: var(--red); font-weight: 700; }
@media (max-width: 760px) { .hero .wrap { grid-template-columns: 1fr; } .vertical { display: none; } .hero { padding: 48px 0 40px; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { padding: 22px 8px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b { display: block; font: 700 30px/1.2 var(--serif); }
.stat span { font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } .stat:nth-child(3) { border-left: 0; } .stat:nth-child(n+3) { border-top: 1px solid var(--line); } }

.section { padding-top: 72px; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.section-head h2 { font-size: 30px; }
.section-head p { color: var(--muted); }

.module { display: grid; grid-template-columns: 88px 1fr; gap: 8px 24px; padding: 28px 0; border-top: 1px solid var(--line); }
.module-no { font: 700 44px/1 var(--serif); color: var(--red); opacity: .9; }
.module h3 { font-size: 22px; }
.module-intro { color: var(--muted); margin-top: 4px; }
.lesson-list { grid-column: 2; margin: 12px 0 0; padding: 0; list-style: none; }
.lesson-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 12px; margin: 0 -12px; border-radius: 8px; text-decoration: none;
}
.lesson-row:hover { background: var(--paper-2); }
.lesson-no { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.lesson-title { font-weight: 600; }
.lesson-sum { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.lesson-meta { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.lesson-row.is-coming .lesson-title { color: var(--ink-2); }
.module-toggle { grid-column: 2; justify-self: start; margin-top: 4px; }
@media (max-width: 640px) {
  .module { grid-template-columns: 1fr; }
  .module-no { font-size: 32px; }
  .lesson-list, .module-toggle { grid-column: 1; }
  .lesson-row { grid-template-columns: 1fr auto; }
  .lesson-no { display: none; }
  .lesson-meta { flex-direction: column; align-items: flex-end; }
}

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plan { padding: 28px 24px; position: relative; display: flex; flex-direction: column; gap: 10px; }
.plan.is-hl { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), var(--shadow); }
.plan-badge { position: absolute; top: -11px; left: 24px; background: var(--red); color: #fff8ef; font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.plan h3 { font-size: 20px; }
.price { font: 700 40px/1 var(--serif); }
.price small { font-size: 18px; margin-right: 2px; }
.price span { font: 400 14px var(--sans); color: var(--muted); margin-left: 6px; }
.plan ul { margin: 6px 0 12px; padding: 0; list-style: none; color: var(--ink-2); font-size: 14px; display: grid; gap: 6px; }
.plan li::before { content: "✓"; color: var(--green); margin-right: 8px; }
.plan .btn { margin-top: auto; }

.buy { margin-top: 20px; padding: 24px; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.buy h3 { font-size: 18px; margin-bottom: 6px; }
.buy p { color: var(--ink-2); white-space: pre-line; }
.buy img { width: 140px; height: 140px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
@media (max-width: 640px) { .buy { grid-template-columns: 1fr; } }

/* 单讲购买：首页横条 + 播放页弹窗里的会员对比 */
.single { margin-top: 16px; padding: 20px 24px; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; }
.single h3 { font-size: 17px; }
.single .price { font-size: 28px; }
.single p { color: var(--ink-2); font-size: 14px; flex: 1; min-width: 220px; }
.upsell { background: var(--red-soft); color: var(--ink); border-radius: 8px; padding: 12px 14px; font-size: 14px; margin: 12px 0; }
.upsell b { color: var(--red); }
.buy-steps { margin: 8px 0 4px; padding-left: 20px; color: var(--ink-2); font-size: 14px; display: grid; gap: 6px; }

.about { padding: 32px; }
.about-text { white-space: pre-line; color: var(--ink-2); font-size: 16px; max-width: 46em; }
.about-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.about-points b { display: block; font: 700 24px/1.3 var(--serif); color: var(--red); }
.about-points span { font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .about { padding: 24px; } .about-points { grid-template-columns: 1fr; gap: 12px; } }

.faq details { border-top: 1px solid var(--line); padding: 16px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin-top: 10px; color: var(--ink-2); }

/* ---------- 课程播放页 ---------- */
.lesson-page { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; padding-top: 24px; }
@media (max-width: 960px) { .lesson-page { grid-template-columns: minmax(0, 1fr); } }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--red); }

.player { position: relative; aspect-ratio: 16 / 9; background: #0e0c0a; border-radius: var(--radius); overflow: hidden; }
.player video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.player:focus { outline: none; }
.player.is-fs { aspect-ratio: auto; width: 100vw; height: 100vh; border-radius: 0; }
.player.pseudo-fs { position: fixed; inset: 0; z-index: 1000; }
.player-overlay { z-index: 5; }

/* 自定义控制栏 */
.pc-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 28px 14px 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, .75), transparent); color: #fff;
  opacity: 0; transition: opacity .25s;
}
.player.show-ui .pc-bar, .player.is-paused .pc-bar { opacity: 1; }
.player.has-controls:not(.show-ui):not(.is-paused) { cursor: none; }
.pc-track { position: relative; height: 16px; cursor: pointer; touch-action: none; }
.pc-track::before, .pc-buf, .pc-played { content: ""; position: absolute; left: 0; top: 6px; height: 4px; border-radius: 2px; }
.pc-track::before { right: 0; background: rgba(255, 255, 255, .25); }
.pc-buf { background: rgba(255, 255, 255, .4); width: 0; }
.pc-played { background: var(--red); width: 0; }
.pc-track:hover::before, .pc-track:hover .pc-buf, .pc-track:hover .pc-played { top: 5px; height: 6px; }
.pc-knob { position: absolute; top: 2px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .15s; }
.pc-track:hover .pc-knob { transform: scale(1); }
.pc-tip { position: absolute; bottom: 20px; transform: translateX(-50%); background: rgba(0, 0, 0, .8); padding: 2px 6px; border-radius: 4px; font-size: 12px; opacity: 0; pointer-events: none; white-space: nowrap; }
.pc-track:hover .pc-tip { opacity: 1; }
.pc-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; position: relative; }
.pc-btn { background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; display: grid; place-items: center; border-radius: 6px; opacity: .9; }
.pc-btn:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.pc-time { font-size: 13px; font-variant-numeric: tabular-nums; margin-left: 4px; }
.pc-spacer { flex: 1; }
.pc-rate { font-size: 13px; padding: 6px 10px; }
.pc-rates { position: absolute; right: 120px; bottom: 44px; display: none; flex-direction: column; background: rgba(20, 18, 15, .92); border-radius: 8px; padding: 4px; }
.pc-rates.open { display: flex; }
.pc-rates button { background: none; border: 0; color: #fff; padding: 6px 18px; cursor: pointer; border-radius: 4px; font-size: 13px; }
.pc-rates button:hover { background: rgba(255, 255, 255, .15); }
.pc-vol { width: 80px; accent-color: #fff; }
@media (hover: none) { .pc-vol { display: none; } .pc-rates { right: 60px; } }
.pc-big {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3;
  width: 68px; height: 68px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(168, 50, 42, .9); color: #fff; display: grid; place-items: center;
}
.pc-big svg { width: 32px; height: 32px; margin-left: 4px; }
.player.started .pc-big { display: none; }
.player-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
  background: radial-gradient(ellipse at center, rgba(20, 15, 10, .82), rgba(10, 8, 6, .95)); color: #f2ebdd;
}
.player-overlay h3 { font-size: 24px; margin-bottom: 8px; color: #fff8ef; }
.player-overlay p { color: #cfc5b3; margin-bottom: 20px; }
.player-overlay .actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.player-overlay .btn:not(.btn-primary) { background: transparent; color: #f2ebdd; border-color: rgba(255, 255, 255, .35); }
.watermark {
  position: absolute; pointer-events: none; user-select: none; color: rgba(255, 255, 255, .28);
  font-size: 13px; text-shadow: 0 0 2px rgba(0, 0, 0, .4); transition: top 1.5s, left 1.5s; white-space: nowrap; z-index: 2;
}
.watermark { transform: translateZ(0); }
.watermark.is-static { color: rgba(255, 255, 255, .45); text-shadow: 0 0 2px rgba(0, 0, 0, .35); transition: none; }
.trial-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 10px 14px; margin-bottom: 12px; border-radius: 8px; background: var(--amber-soft); color: var(--amber); font-size: 14px;
}
/* 《人工智能生成合成内容标识办法》要求的播放器周边显式标识 */
.ai-note { margin: 8px 2px 0; font-size: 12.5px; color: var(--muted); }
.lesson-head { margin-top: 20px; }
.lesson-head h1 { font-size: 26px; }
.lesson-head .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.lesson-summary { margin-top: 16px; color: var(--ink-2); font-size: 16px; }
.block { margin-top: 28px; }
.block h2 { font-size: 18px; margin-bottom: 12px; }
.files { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.file-icon { flex: none; width: 36px; height: 36px; border-radius: 8px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font: 700 12px var(--sans); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }
.pager a { padding: 14px 16px; text-decoration: none; }
.pager a:hover { border-color: var(--line-2); }
.pager small { display: block; color: var(--muted); font-size: 12px; }
.pager .next { text-align: right; }

.side { align-self: start; position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; padding: 8px; }
.side h3 { font-size: 15px; padding: 10px 10px 6px; }
.side a { display: flex; gap: 10px; padding: 8px 10px; border-radius: 6px; text-decoration: none; font-size: 14px; color: var(--ink-2); }
.side a:hover { background: var(--paper-2); }
.side a.active { background: var(--red-soft); color: var(--red); font-weight: 600; }
.side a .n { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; width: 2em; }
.side a.active .n { color: inherit; }
@media (max-width: 960px) { .side { position: static; max-height: none; } }

/* ---------- 登录 / 个人中心 ---------- */
.auth { max-width: 420px; margin: 56px auto; padding: 32px 28px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--paper-2); border-radius: 10px; margin-bottom: 24px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--ink-2); }
.tabs button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.form { display: grid; gap: 16px; }
.form-error { color: var(--red); font-size: 13px; min-height: 1em; }

.me-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 24px; }
.me-grid .card { padding: 24px; }
.me-grid h2 { font-size: 18px; margin-bottom: 14px; }
.member-status { font: 700 26px/1.3 var(--serif); }
.session { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.session:first-of-type { border-top: 0; }
.continue { display: grid; gap: 6px; }
.continue a { display: flex; justify-content: space-between; gap: 12px; text-decoration: none; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }

.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
