/*
 * 王大头AI 私域在线学习平台 · 基础视觉样式（course.css）
 * 来源：mkpage.py（服务器 /home/ubuntu/video-pages/mkpage.py 的 CSS 常量），复制日期 2026-12-06，未修改原文件。
 *
 * 相对原文件仅做以下三处改动（改动只发生在本文件，原文件未动）：
 *   1. 原文件里的比例占位符改为 var(--aspect)，并在 :root 给出默认值 --aspect: 9 / 16；
 *      M2 渲染课程详情页时按课程实际比例覆盖（例如在 .stage 上写 style="--aspect: 16 / 9"）。
 *   2. 删除 .gallery / .gallery-* 全部规则及其专属注释（V1.0 不做海报画廊）；
 *      保留 .lightbox —— 后台危险操作的 <dialog> 二次确认复用同一外观。
 *   3. 未新增任何选择器；M1 新增组件样式（购买块、课时徽章、错误面板、后台表格等）
 *      全部写在同目录 ui.css，本文件保持可与现网作品页对照的基线。
 *
 * 约束：无外链资源（无 webfont / CDN / 统计脚本），字体全部使用系统字体栈。
 */
    :root {
      --paper: #f4efe6;
      --paper-2: #ebe4d6;
      --ink: #1c1915;
      --ink-soft: rgba(28, 25, 21, 0.62);
      --line: rgba(28, 25, 21, 0.12);
      --moss: #1b6b4a;
      --moss-deep: #0e3b29;
      --shadow: 0 28px 70px rgba(48, 32, 12, 0.16);
      --aspect: 9 / 16;
    }
    * { box-sizing: border-box; }
    html, body { margin: 0; padding: 0; }
    body {
      min-height: 100vh;
      color: var(--ink);
      font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
      background:
        radial-gradient(900px 480px at 8% -10%, rgba(214, 168, 92, 0.28), transparent 60%),
        radial-gradient(700px 420px at 100% 0%, rgba(27, 107, 74, 0.16), transparent 55%),
        var(--paper);
    }
    body::before {
      content: "";
      position: fixed;
      inset: 0;
      pointer-events: none;
      background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.35'/></svg>");
      opacity: 0.05;
      mix-blend-mode: multiply;
    }
    /* ══ 返回总目录导航（2026-12-05 王老师需求）══ */
    .bn-top { position: fixed; top: 0; left: 0; right: 0; z-index: 9998;
      background: rgba(252, 249, 243, .94); backdrop-filter: saturate(1.6) blur(12px);
      border-bottom: 1px solid var(--line); box-shadow: 0 2px 12px rgba(48, 32, 12, .06);
      transition: box-shadow .2s; }
    .bn-top-in { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 11px 0;
      display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
    .bn-back { display: inline-flex; align-items: center; gap: 7px; color: var(--ink);
      text-decoration: none; font-size: 15px; font-weight: 700; line-height: 1;
      padding: 12px 18px; min-height: 44px; border-radius: 999px;
      border: 1px solid var(--line); background: #fff;
      transition: transform .16s, box-shadow .16s; }
    .bn-back:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(48, 32, 12, .12); }
    .bn-back svg { flex: none; }
    .bn-label { font-size: 13.5px; color: rgba(28, 25, 21, .78); line-height: 1.4; }
    .bn-foot { max-width: 1080px; margin: 0 auto; padding: 0 16px 64px; }
    .bn-foot-btn { display: flex; align-items: center; justify-content: center; gap: 10px;
      width: 100%; padding: 16px 24px; border-radius: 14px; background: var(--moss);
      color: #fff; text-decoration: none; font-size: 16px; font-weight: 700;
      box-shadow: 0 10px 26px rgba(27, 107, 74, .24);
      transition: transform .16s, box-shadow .16s, background .16s; }
    .bn-foot-btn:hover { background: #155c3f; transform: translateY(-2px); box-shadow: 0 14px 32px rgba(27, 107, 74, .3); }
    .bn-foot-btn svg { flex: none; opacity: .9; }
    body.bn-padded { padding-top: 64px; }
    @media (max-width: 600px) {
      .bn-top-in { width: calc(100% - 28px); padding: 9px 0; gap: 9px; }
      .bn-back { font-size: 14px; padding: 11px 15px; }
      .bn-label { font-size: 12.5px; flex-basis: 100%; margin-top: 2px; }
      body.bn-padded { padding-top: 92px; }
      .bn-foot { padding-bottom: 44px; }
      .bn-foot-btn { font-size: 15px; padding: 15px 18px; }
    }

    .page { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
    .layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: center; }
    .eyebrow { margin: 0 0 14px; letter-spacing: 0.18em; font-size: 12px; color: var(--moss-deep); }
    h1 {
      margin: 0;
      font-family: "Songti SC", "STSong", "Noto Serif SC", "Palatino Linotype", serif;
      font-weight: 600;
      font-size: clamp(34px, 5vw, 62px);
      line-height: 1.08;
      letter-spacing: -0.03em;
    }
    .lead { max-width: 28em; margin: 18px 0 0; font-size: 17px; line-height: 1.75; color: var(--ink-soft); }
    .facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 0; padding: 0; list-style: none; }
    .facts li {
      padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px;
      background: rgba(255, 252, 246, 0.7); font-size: 13px; letter-spacing: 0.02em;
    }
    .stage {
      position: relative; height: min(78vh, 760px); aspect-ratio: var(--aspect);
      border-radius: 32px; overflow: hidden; background: #111;
      box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
      /* ★ 2026-11-27 防裁切双保险：
         容器比例与视频真实比例不一致时，contain 会留黑边而不是裁切。
         但若 video 元素本身被拉高超出容器，overflow:hidden 仍会切掉底部。
         ⇒ video 高度必须锁死为容器的 100%，由 object-fit 负责留边。 */
    }
    video {
      display: block; width: 100%; height: 100%; max-height: 100%;
      object-fit: contain; background: #000;
    }
    .cover {
      position: absolute; inset: 0; display: grid; place-items: center;
      border: 0; padding: 0; cursor: pointer;
      background: linear-gradient(to top, rgba(12, 10, 8, 0.45), transparent 42%);
    }
    .cover[hidden] { display: none; }
    .play {
      width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center;
      background: rgba(255, 250, 242, 0.94); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    }
    .play svg { margin-left: 4px; }
    .meta-chip {
      position: absolute; left: 16px; bottom: 16px; padding: 6px 10px; border-radius: 999px;
      color: #fff; background: rgba(18, 16, 14, 0.55); backdrop-filter: blur(8px);
      font-size: 12px; letter-spacing: 0.08em;
    }
    .chapters {
      grid-column: 1 / -1; margin: 8px 0 0; padding: 0; list-style: none;
      display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px;
    }
    .chapters button {
      width: 100%; text-align: left; border: 1px solid var(--line);
      background: rgba(255, 252, 246, 0.72); border-radius: 18px; padding: 14px 14px 16px;
      cursor: pointer; color: inherit; font: inherit;
      transition: border-color 0.2s ease, transform 0.2s ease;
    }
    .chapters button:hover { transform: translateY(-2px); }
    .chapters button[aria-current="true"] { border-color: var(--moss); background: #fff; }
    .time { display: block; margin-bottom: 8px; color: var(--moss); font-variant-numeric: tabular-nums; font-size: 12px; letter-spacing: 0.12em; }
    .label { display: block; font-size: 15px; line-height: 1.45; }
    .note, .error { grid-column: 1 / -1; margin: 18px 0 0; font-size: 13px; line-height: 1.6; color: var(--ink-soft); }
    /* 海报点击放大（原生 dialog，无需依赖） */
    .lightbox {
      border: 0; padding: 0; background: transparent; max-width: 92vw; max-height: 92vh;
    }
    .lightbox::backdrop { background: rgba(18, 16, 14, 0.88); }
    .lightbox img { display: block; max-width: 92vw; max-height: 92vh; border-radius: 12px; }
    .error { display: none; color: #8a2e1b; }
    .error.show { display: block; }
    @media (max-width: 860px) {
      .page { width: min(560px, calc(100% - 28px)); padding-top: 22px; }
      .layout { grid-template-columns: 1fr; gap: 22px; }
      /* ★ 2026-11-27：原来写 max-height:74vh，容器高度被视口高度硬卡，
         而 aspect-ratio 仍按 var(--aspect) 推导宽度 → 比例失配 → 底部被裁。
         现在：宽度定、比例定、高度由比例算出；再用 max-height 兜底，
         并让 video 用 contain 留黑边，绝不裁切。 */
      .stage {
        height: auto; width: min(100%, 420px); margin: 0 auto;
        aspect-ratio: var(--aspect); max-height: 82vh;
      }
      .chapters { grid-template-columns: 1fr; gap: 8px; }
      .chapters button { display: flex; align-items: baseline; gap: 12px; padding: 12px 14px; }
      .time { margin: 0; min-width: 3.2em; }
    }
    @media (prefers-reduced-motion: reduce) { .chapters button { transition: none; } }
