:root {
  --navy: #123A5A;
  --navy-2: #1B4E75;
  --navy-3: #2A6895;
  --orange: #E8833A;
  --orange-soft: #FDF1E7;
  --blue-soft: #E6F1FB;
  --bg: #F4F6F8;
  --card: #FFFFFF;
  --line: #DCE3EA;
  --line-soft: #EDF1F5;
  --text: #1F2A35;
  --muted: #6B7A89;
  --faint: #8A96A3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(18, 58, 90, .06), 0 8px 24px rgba(18, 58, 90, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font-family: inherit; font-size: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: #B5D4F4; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: var(--navy);
  color: #fff;
  position: relative;
  z-index: 40;
}

.menu-btn {
  display: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  align-items: center;
  justify-content: center;
  flex: none;
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.logo {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; font-weight: 500; letter-spacing: .3px; }
.brand-text small { font-size: 10px; color: #A9C0D4; letter-spacing: .2px; }

.search-wrap { position: relative; flex: 1; min-width: 0; max-width: 460px; margin-left: auto; }
.search-wrap input {
  width: 100%;
  height: 36px;
  padding: 0 56px 0 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: background .15s, border-color .15s;
}
.search-wrap input::placeholder { color: #A9C0D4; }
.search-wrap input:focus { background: #fff; color: var(--text); border-color: #fff; }
.search-wrap input:focus::placeholder { color: var(--faint); }
.search-ico {
  position: absolute; left: 11px; top: 10px; width: 16px; height: 16px;
  pointer-events: none; opacity: .75;
}
.search-wrap input:focus ~ .search-ico { opacity: .5; filter: invert(0); }
.search-kbd {
  position: absolute; right: 10px; top: 9px;
  font-size: 11px; color: #A9C0D4;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 4px; padding: 0 5px; line-height: 16px;
}
.search-wrap input:focus ~ .search-kbd { display: none; }

.topbar-meta { font-size: 12px; color: #A9C0D4; flex: none; }

/* 搜索结果面板 */
.search-panel {
  position: absolute;
  top: 44px; left: 0; right: 0;
  max-height: min(70vh, 520px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  color: var(--text);
  z-index: 60;
}
.sp-group { padding: 6px 0 2px; }
.sp-group-title {
  font-size: 11px; color: var(--faint); padding: 4px 10px 6px;
  display: flex; gap: 6px; align-items: center;
}
.sp-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  font-size: 13px;
}
.sp-item:hover, .sp-item.active { background: var(--blue-soft); }
.sp-no { font-size: 11px; color: var(--orange); font-weight: 500; width: 22px; flex: none; }
.sp-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-meta { font-size: 11px; color: var(--faint); flex: none; }
.sp-empty { padding: 18px 12px; font-size: 13px; color: var(--faint); text-align: center; }
.sp-tip { padding: 8px 10px; font-size: 11px; color: var(--faint); border-top: 1px solid var(--line-soft); margin-top: 4px; }
mark { background: #FCE0C4; color: #8A4A12; border-radius: 2px; padding: 0 1px; }

/* ---------- 字体分级体系 ----------
   L1 页面主标题 .band h1        24px / 600
   L2 区块标题   .sect-title     14px / 600 + 橙色竖条
   L3 卡片标题   h2 / h3 / mcard 17-18px / 600
   L4 正文       body / 列表     13-14px / 400
   L5 辅助说明   .lesson-meta 等 12px / 400 (muted)
   L6 角注       .l-no / 徽标    11px
------------------------------------*/

/* ---------- 主体 ---------- */
.app {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  height: calc(100% - 58px);
}

.sidebar {
  background: var(--card);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 12px 10px 40px;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #D4DCE4; border-radius: 4px; }

.sb-head {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 6px 10px;
  font-size: 11px; color: var(--faint); letter-spacing: .5px;
}
.sb-head b { color: var(--text); font-size: 12px; font-weight: 500; letter-spacing: 0; }

.machine { margin-bottom: 6px; }
.machine-btn {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 8px; border: 0; background: transparent; border-radius: 8px;
  text-align: left; color: var(--text);
}
.machine-btn:hover { background: var(--line-soft); }
.machine-btn .chev { width: 12px; height: 12px; color: var(--faint); transition: transform .18s; flex: none; }
.machine.open .machine-btn .chev { transform: rotate(90deg); }
.machine-btn .m-name { font-size: 13px; font-weight: 500; flex: 1; }
.machine-btn .m-count { font-size: 11px; color: var(--faint); }

.m-progress {
  height: 3px; border-radius: 2px; background: var(--line-soft);
  margin: 0 8px 6px; overflow: hidden;
}
.m-progress i { display: block; height: 100%; background: var(--navy-3); border-radius: 2px; }

.machine-body { display: none; padding-left: 6px; }
.machine.open .machine-body { display: block; }

.group-title {
  font-size: 11px; color: var(--faint);
  padding: 8px 8px 4px; display: flex; align-items: center; gap: 6px;
}
.group-title::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft);
}

.lesson {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 8px; border-radius: 7px; cursor: pointer;
  font-size: 13px; color: var(--text);
}
.lesson:hover { background: var(--line-soft); }
.lesson.active { background: var(--blue-soft); }
.lesson.active .l-title { color: var(--navy-2); font-weight: 500; }
.l-no { font-size: 11px; color: var(--faint); width: 18px; flex: none; font-variant-numeric: tabular-nums; }
.lesson.active .l-no { color: var(--navy-3); }
.l-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l-badge {
  font-size: 10px; padding: 0 5px; border-radius: 3px; flex: none;
  background: var(--orange-soft); color: #A9561B; line-height: 16px;
}
.l-done { width: 13px; height: 13px; color: #1D9E75; flex: none; }

/* ---------- 舞台 ---------- */
.stage { overflow-y: auto; padding: 16px 20px 60px; }
.stage::-webkit-scrollbar { width: 10px; }
.stage::-webkit-scrollbar-thumb { background: #D4DCE4; border-radius: 5px; }
.stage-inner { max-width: 1080px; margin: 0 auto; }

/* 页头导航：返回按钮 + 面包屑 */
.page-nav { display: flex; align-items: center; gap: 12px; padding: 0 2px 12px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 12px 0 9px; flex: none;
  border-radius: 8px; border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; color: var(--text);
  transition: border-color .12s, background .12s;
}
.back-btn:hover { border-color: #C3CDD7; background: #FAFBFC; }
.back-btn svg { color: var(--muted); }
.crumbs {
  font-size: 12px; color: var(--faint);
  display: flex; gap: 7px; align-items: center;
  min-width: 0; overflow: hidden; white-space: nowrap;
}
.crumbs a:hover { color: var(--navy-3); }
.crumbs .cur { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: #C4CDD6; }

/* 渐变横幅：衔接深色顶栏与浅色内容区 */
.band {
  background: linear-gradient(130deg, #0F3350 0%, #17466B 58%, #215C85 100%);
  border-radius: 14px;
  color: #fff;
  padding: 24px 26px 22px;
  position: relative; overflow: hidden;
  box-shadow: 0 10px 28px rgba(18, 58, 90, .18);
}
.band::before {
  content: ""; position: absolute; right: -70px; top: -90px;
  width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .12), transparent);
  pointer-events: none;
}
.band::after {
  content: ""; position: absolute; left: 38%; bottom: -110px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(232, 131, 58, .18), transparent);
  pointer-events: none;
}
.band h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: .3px; position: relative; }
.band .b-sub { margin-top: 5px; font-size: 13px; color: #A9C0D4; position: relative; }
.band-stats { display: flex; gap: 30px; margin-top: 18px; flex-wrap: wrap; position: relative; }
.band-stat b { font-size: 21px; font-weight: 600; display: block; line-height: 1.25; font-variant-numeric: tabular-nums; }
.band-stat span { font-size: 11px; color: #A9C0D4; letter-spacing: .4px; }

/* 继续观看（白卡，压在横幅下） */
.continue {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 16px; cursor: pointer;
  box-shadow: var(--shadow);
}
.continue .c-label { font-size: 11px; color: var(--orange); font-weight: 600; letter-spacing: .4px; }
.continue .c-title { font-size: 14px; font-weight: 600; margin-top: 1px; }
.continue .c-go {
  margin-left: auto; font-size: 12px; background: var(--navy);
  color: #fff; border-radius: 7px; padding: 6px 14px; flex: none;
}

/* 区块标题（L2）：橙色竖条 + 主文字 + 计数 */
.sect-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin: 26px 0 12px;
  display: flex; align-items: center; gap: 9px;
  letter-spacing: .2px;
}
.sect-title::before { content: ""; width: 4px; height: 15px; border-radius: 2px; background: var(--orange); flex: none; }
.sect-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sect-title .cnt { font-size: 11px; color: var(--faint); font-weight: 400; flex: none; letter-spacing: 0; }

/* 首页机型卡片 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 14px; margin-top: 4px; }
.mcard {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 16px 14px; text-align: left; cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 1px 2px rgba(18, 58, 90, .04);
}
.mcard:hover { border-color: var(--navy-3); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(18, 58, 90, .10); }
.mcard .mc-top { display: flex; align-items: center; gap: 10px; }
.mcard .mc-ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.mcard h3 { margin: 0; font-size: 15px; font-weight: 600; }
.mcard .mc-desc { font-size: 12px; color: var(--muted); min-height: 20px; margin-top: 4px; }
.mcard .mc-foot { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--faint); margin-top: 8px; }
.mcard .mc-bar { flex: 1; height: 3px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.mcard .mc-bar i { display: block; height: 100%; background: var(--navy-3); }

/* 播放器（课程卡片上半部） */
.lesson-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-top: 2px;
}
.player {
  background: radial-gradient(120% 170% at 50% -10%, #1C4666 0%, #10293C 58%, #0C1B26 100%);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  height: min(60vh, 540px);
  overflow: hidden;
}
.player video {
  height: 100%; width: auto; max-width: 100%;
  display: block; background: transparent; outline: none;
}
.player.landscape video { width: 100%; height: auto; }
.player-hint {
  position: absolute; left: 14px; bottom: 12px;
  font-size: 11px; color: rgba(255, 255, 255, .5);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
.next-tip {
  position: absolute; right: 14px; bottom: 14px;
  display: none; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .95); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
.next-tip.show { display: flex; }
.next-tip button {
  border: 0; background: var(--navy); color: #fff; border-radius: 6px;
  padding: 4px 10px; font-size: 12px;
}

/* 课程卡片信息区（播放器下方） */
.lesson-info {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px 15px;
}
.li-main { min-width: 0; }
.li-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.lesson-info h2 {
  margin: 0; font-size: 19px; font-weight: 600; line-height: 1.35;
  letter-spacing: .2px; color: var(--text);
}
.lesson-info h2 .no { color: var(--orange); margin-right: 8px; font-variant-numeric: tabular-nums; }
.lesson-meta { font-size: 12px; color: var(--faint); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.lesson-meta .sep { color: var(--line); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 9px; border-radius: 20px;
  background: var(--blue-soft); color: var(--navy-2); flex: none;
  line-height: 18px; font-weight: 500;
}
.chip.orange { background: var(--orange-soft); color: #A9561B; }
.chip.plain { background: var(--line-soft); color: var(--muted); font-weight: 400; }
.chip.done { background: #E4F5EE; color: #177A58; }

.lesson-actions { margin-left: auto; display: flex; gap: 8px; flex: none; }
.btn {
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px;
  transition: border-color .12s, background .12s;
}
.btn:hover { border-color: #C3CDD7; background: #FAFBFC; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.primary.is-done { background: #1D9E75; border-color: #1D9E75; }
.btn[disabled] { opacity: .4; cursor: default; }

/* 分集切换（卡片底部条） */
.clips {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--line-soft);
  background: #FBFCFD;
}
.clip-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 7px 14px; font-size: 12.5px; color: var(--text);
  display: inline-flex; align-items: center; gap: 8px;
  transition: border-color .12s, background .12s;
}
.clip-btn:hover { border-color: #C3CDD7; }
.clip-btn.active { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 500; }
.clip-btn .dot {
  width: 6px; height: 6px; border-radius: 50%; background: #C3CDD7; flex: none;
}
.clip-btn.active .dot { background: var(--orange); }
.clip-btn .cd { opacity: .55; font-size: 11.5px; font-variant-numeric: tabular-nums; }

.sect-title {
  font-size: 12px; color: var(--faint); margin: 26px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.sect-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 8px; }
.rel-item {
  display: flex; align-items: center; gap: 9px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; font-size: 13px; cursor: pointer;
}
.rel-item:hover { border-color: #C3CDD7; }
.rel-item .r-no { font-size: 11px; color: var(--orange); font-weight: 500; flex: none; }
.rel-item .r-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-item .r-d { font-size: 11px; color: var(--faint); flex: none; }
.rel-item.now { border-color: var(--navy-3); background: var(--blue-soft); }

/* 使用提示 */
.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-top: 4px; }
.tip { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; }
.tip b { font-size: 13px; font-weight: 600; display: block; margin-bottom: 4px; }
.tip span { font-size: 12px; color: var(--muted); line-height: 1.6; }

.empty { text-align: center; color: var(--faint); font-size: 13px; padding: 60px 0; }

/* ---------- 响应式 ---------- */
.scrim { display: none; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .menu-btn { display: flex; }
  .brand-text small { display: none; }
  .topbar-meta { display: none; }
  .sidebar {
    position: fixed; top: 58px; bottom: 0; left: 0; width: 84vw; max-width: 320px;
    z-index: 50; transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .18);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim {
    display: block; position: fixed; inset: 58px 0 0 0;
    background: rgba(12, 27, 38, .35); z-index: 45;
  }
  .stage { padding: 12px 12px 48px; }
  .player { height: 48vh; }
  .band { padding: 18px 16px 16px; border-radius: 12px; }
  .band h1 { font-size: 19px; }
  .band-stats { gap: 18px; margin-top: 14px; }
  .band-stat b { font-size: 17px; }
  .page-nav { padding-bottom: 10px; }
  .crumbs { display: none; }
  .lesson-info { flex-wrap: wrap; padding: 12px 14px 13px; gap: 10px; }
  .lesson-info h2 { font-size: 17px; }
  .lesson-actions { margin-left: 0; width: 100%; }
  .lesson-actions .btn { flex: 1; justify-content: center; }
  .clips { padding: 10px 14px 12px; }
  .search-wrap { max-width: none; }
  .hero h1 { font-size: 20px; }
  .hero-stats { gap: 16px; }
  .lesson-head h2 { font-size: 17px; }
}

@media (max-width: 520px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .brand-text strong { font-size: 13px; }
  .search-wrap input { padding-left: 32px; padding-right: 12px; }
  .search-kbd { display: none !important; }
  .player { height: 42vh; }
  .lesson-actions { gap: 6px; }
  .lesson-actions .btn { padding: 0 8px; font-size: 12px; }
  .cards { grid-template-columns: 1fr; }
  .related { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .sidebar, .scrim, .player { display: none; }
  .app { display: block; height: auto; }
  body { overflow: visible; background: #fff; }
}

/* ---------- 视频加载遮罩 ---------- */
.player { position: relative; }
.vloading {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: rgba(13, 27, 42, .82);
  transition: opacity .25s ease;
}
.vloading.hide { opacity: 0; pointer-events: none; }
.vl-box { text-align: center; color: #e8eef4; }
.vl-spin {
  width: 38px; height: 38px; margin: 0 auto 12px;
  border: 3px solid rgba(255,255,255,.25); border-top-color: #fff;
  border-radius: 50%; animation: vlspin 1s linear infinite;
}
@keyframes vlspin { to { transform: rotate(360deg); } }
.vl-txt { font-size: 14px; letter-spacing: .05em; }
.vloading.err .vl-spin { display: none; }
.vl-retry {
  margin-top: 10px; padding: 6px 18px; font-size: 14px;
  color: #fff; background: #e8590c; border: none; border-radius: 6px; cursor: pointer;
}
.vl-retry:active { opacity: .85; }
