/* ============================================================
   VideoHub 前台样式
   手机竖屏优先；竖屏/横屏都能顺畅选集；播放器吸顶；全屏自动横屏
   ============================================================ */

:root {
  --bg: #0b0d12;
  --bg-2: #11151d;
  --panel: #151a23;
  --panel-2: #1b2130;
  --line: #232a38;
  --line-2: #2e3747;
  --text: #e9eef7;
  --muted: #93a0b6;
  --dim: #6b7789;
  --accent: #4f7cff;
  --accent-2: #7aa2ff;
  --ok: #23c08a;
  --danger: #ff6b6b;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --shadow: 0 18px 44px rgba(0, 0, 0, .45);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  overscroll-behavior-y: none;
}

body.gate-lock,
body.sheet-lock,
body.fs-lock {
  overflow: hidden;
}

button { font-family: inherit; color: inherit; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px max(14px, env(safe-area-inset-left)) 10px max(14px, env(safe-area-inset-right));
  background: rgba(11, 13, 18, .92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: saturate(160%) blur(12px);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.topbar .logo {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #3560d8);
}

.topbar .site {
  font-weight: 650;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .site-sub {
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.topbar .mode {
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px 9px;
  white-space: nowrap;
}

.btn-ghost {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text);
  height: 30px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  font-size: 13px;
  cursor: pointer;
}

.btn-ghost:active { background: var(--panel-2); }

/* 直播入口（跳转 live.php 伪直播页） */
a.btn-ghost.live-entry {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  color: #ff8095;
  border-color: rgba(255, 53, 86, .42);
  background: rgba(255, 53, 86, .10);
  white-space: nowrap;
}
a.btn-ghost.live-entry::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff3556;
  box-shadow: 0 0 6px rgba(255, 53, 86, .8);
  animation: liveEntryPulse 1.4s ease-in-out infinite;
}
a.btn-ghost.live-entry:active { background: rgba(255, 53, 86, .2); }
@keyframes liveEntryPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .25; }
}

/* ---------------- 页面骨架 ---------------- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 14px calc(28px + var(--safe-b));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.stage { min-width: 0; }

/* ---------------- 播放器：手机端吸顶 ---------------- */
.player {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #000;
  border-radius: var(--r-lg);
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
  /* 竖屏时略收缩视觉高度，避免吸顶遮挡过多内容 */
  margin: 0 -14px;
  border-radius: 0;
}

.player .video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: 62vh;
  background: #000;
  object-fit: contain;
  vertical-align: top;
}

/* 播放器交互层 */
.gesture {
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: pan-x pan-y;
}

.hud {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: rgba(0, 0, 0, .66);
  border-radius: 999px;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  pointer-events: none;
}

.center-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  font-size: 24px;
  z-index: 6;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
}

.spinner i {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .25);
  border-top-color: #fff;
  animation: vh-spin .8s linear infinite;
}

@keyframes vh-spin { to { transform: rotate(360deg); } }

/* 控制条 */
.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  padding: 26px 12px calc(8px + var(--safe-b));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .82));
  transition: opacity .2s ease;
}

.player.is-playing:not(.show-ctl) .controls {
  opacity: 0;
  pointer-events: none;
}

.bar {
  position: relative;
  height: 20px;
  margin-bottom: 2px;
  cursor: pointer;
  touch-action: none;
}

.bar-bg,
.bar-buffer,
.bar-played {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 3.5px;
  border-radius: 4px;
}

.bar-bg { right: 0; background: rgba(255, 255, 255, .26); }
.bar-buffer { width: 0; background: rgba(255, 255, 255, .42); }
.bar-played { width: 0; background: var(--accent); }

.thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, .28);
  pointer-events: none;
}

.bar-tip {
  position: absolute;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .8);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

.ctl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.ctl-row .grow { flex: 1; }

.ctl {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  height: 32px;
  min-width: 32px;
  padding: 0 4px;
  border-radius: 8px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ctl.text {
  font-size: 13px;
  padding: 0 9px;
  background: rgba(255, 255, 255, .1);
}

.ctl:active { background: rgba(255, 255, 255, .16); }

.time {
  font-size: 12px;
  color: rgba(255, 255, 255, .82);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.time .slash { margin: 0 3px; opacity: .55; }
.time em { font-style: normal; color: #fff; }

.fs-tip {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .68);
  color: #fff;
  font-size: 12px;
  z-index: 9;
  pointer-events: none;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  max-width: 82%;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .8);
  color: #fff;
  font-size: 13px;
  z-index: 10;
  text-align: center;
  pointer-events: none;
}

/* ---------------- 选集面板 ---------------- */
.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 50;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  max-height: 66%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -14px 34px rgba(0, 0, 0, .5);
  padding-bottom: var(--safe-b);

}

.sheet-grip {
  padding: 8px 0 4px;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
}

.sheet-grip span {
  width: 38px;
  height: 4px;
  border-radius: 4px;
  background: var(--line-2);
  display: block;
}

.sheet-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 14px 8px;
}

.sheet-head strong { font-size: 16px; }
.sheet-sub { color: var(--dim); font-size: 12.5px; flex: 1; min-width: 0; }

.sheet-close {
  appearance: none;
  border: 0;
  background: var(--panel-2);
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  flex: 0 0 auto;
  align-self: center;
}

.sheet-tabs {
  display: flex;
  gap: 8px;
  padding: 0 14px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.sheet-tabs::-webkit-scrollbar { display: none; }

.sheet-tabs .tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.sheet-tabs .tab.on {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #3560d8);
}

.sheet-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 10px 12px;
  overscroll-behavior: contain;
}

.sheet-empty {
  padding: 26px 12px;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}

.ep-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 11px 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  overflow: hidden;
}

.ep-row + .ep-row { box-shadow: inset 0 1px 0 var(--line); }

.ep-row:active { background: var(--panel-2); }

.ep-no {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.ep-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ep-name {
  font-size: 15px;
  color: #f2f6fd;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.35;
}

.ep-meta {
  font-size: 12px;
  color: #9aa7bd;
}

.ep-prog {
  position: absolute;
  left: 49px;
  right: 12px;
  bottom: 5px;
  height: 2.5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.ep-prog i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

.ep-row.on {
  background: rgba(79, 124, 255, .13);
}

.ep-row.on .ep-no {
  background: var(--accent);
  color: #fff;
}

.ep-row.on .ep-name { color: #cfdcff; }

/* 横屏：面板改为右侧抽屉，不遮挡整个画面 */
body.landscape .sheet {
  left: auto;
  top: 0;
  width: min(420px, 52%);
  max-height: none;
  border-radius: 16px 0 0 16px;
  border-top: 0;
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 34px rgba(0, 0, 0, .5);
}

body.landscape .sheet-grip { display: none; }

/* ---------------- 视频信息 ---------------- */
.meta { padding: 14px 2px 6px; }

.meta h1 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.4;
}

.v-sub {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.v-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #3560d8);
  color: #fff;
  font-weight: 600;
  min-width: 110px;
}

.btn.block { width: 100%; }

.btn:active { transform: translateY(1px); }

.save-state {
  margin: 12px 0 0;
  color: var(--dim);
  font-size: 12px;
}

/* ---------------- 继续观看 ---------------- */
.continue {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  margin: 6px 0 4px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(79, 124, 255, .16), rgba(79, 124, 255, .04));
  color: var(--text);
  cursor: pointer;
}

.cc-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(79, 124, 255, .22);
  color: #cfdcff;
  font-size: 12px;
}

.cc-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cc-body strong {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-body #cc-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-arrow { color: var(--dim); font-size: 18px; }

/* ---------------- 侧栏 / 课程列表 ---------------- */
.side {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}

.side-head .side-count {
  margin-left: auto;
  color: var(--dim);
  font-size: 12px;
  font-weight: 500;
}

.side-list { padding: 6px 10px 12px; }

/* ---------------- 搜索 ---------------- */
.side-search {
  position: relative;
  padding: 8px 10px 2px;
}

.side-search input {
  box-sizing: border-box;
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 10px;
  color: var(--text);
  font-size: 13.5px;
  padding: 0 30px 0 32px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.side-search input::placeholder { color: var(--dim); }

.side-search input:focus {
  border-color: var(--accent);
  background: var(--panel);
}

.side-search input::-webkit-search-cancel-button { display: none; }

.side-search .ss-icon {
  position: absolute;
  left: 19px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--dim);
  pointer-events: none;
}

.side-search .ss-clear {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--dim);
  font-size: 12px;
  cursor: pointer;
}

.side-search .ss-clear:active { color: var(--text); }

.side-search + .side-list { padding-top: 10px; }

.col-block { padding: 8px 2px; }
.col-block + .col-block { border-top: 1px solid var(--line); }

.col-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.col-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-count { color: var(--dim); font-size: 12px; flex: 0 0 auto; }

.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 7px;
}

.ep-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  height: 32px;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ep-chip.on {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #3560d8);
  color: #fff;
}

/* ---------------- 手机号入口 ---------------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px 16px calc(20px + var(--safe-b));
  background: radial-gradient(120% 90% at 50% 0%, rgba(79, 124, 255, .18), rgba(6, 8, 12, .94));
  backdrop-filter: blur(6px);
  overflow-y: auto;
}

.gate-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 20px 22px;
  box-shadow: var(--shadow);
  animation: vh-pop .22s ease;
}

@keyframes vh-pop {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.gate-logo {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #3560d8);
  margin-bottom: 14px;
}

.gate-card h2 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 650;
}

.gate-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.gate-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  transition: border-color .18s;
}

.field:focus-within { border-color: var(--accent); }

.field-prefix {
  color: var(--muted);
  font-size: 14px;
  flex: 0 0 auto;
  padding-right: 8px;
  border-right: 1px solid var(--line);
}

.field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  letter-spacing: 1px;
}

.field input::placeholder { color: var(--dim); letter-spacing: 0; }

.gate-card .btn.primary {
  height: 48px;
  margin-top: 12px;
  font-size: 15px;
}

.gate-err {
  margin-top: 10px;
  color: var(--danger);
  font-size: 12.5px;
}

.gate-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 12px;
  color: var(--dim);
  font-size: 12px;
}

.gate-divider::before,
.gate-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.skip {
  appearance: none;
  width: 100%;
  height: 46px;
  border-radius: var(--r-md);
  border: 1px dashed var(--line-2);
  background: transparent;
  color: #b9cbff;
  font-size: 14px;
  cursor: pointer;
}

.skip:active { background: rgba(79, 124, 255, .1); }

.gate-tip {
  margin: 10px 0 0;
  color: var(--dim);
  font-size: 11.5px;
  text-align: center;
}

/* 错误抖动 */
.shake { animation: vh-shake .32s ease; }

@keyframes vh-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---------------- 全屏 ----------------
   ⚠️ 关键：这里不能写成「:fullscreen, :-webkit-full-screen, :-moz-full-screen, .pseudo-fs」这种
   并列选择器列表。只要浏览器不认识列表中任意一个伪类（Chromium 不认识 :-moz-full-screen，
   老内核不认识 :fullscreen），整组规则会被静默丢弃，全屏样式完全不生效——表现就是
   微信里点全屏后画面没铺满、仍是竖屏窄条。
   所以全屏样式统一由纯类 .is-fs / .pseudo-fs 驱动，JS 在原生全屏与伪全屏时都会加这两个类。 */
.player.pseudo-fs,
.player.is-fs {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border-radius: 0;
  z-index: 200;
  background: #000;
}

.player.pseudo-fs .video,
.player.is-fs .video {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  object-fit: contain;
}

.player.pseudo-fs .controls,
.player.is-fs .controls {
  padding-bottom: calc(12px + var(--safe-b));
}

.player.pseudo-fs .sheet,
.player.is-fs .sheet {
  max-height: 100%;
}

/* ---------------- 横屏（页面内，非全屏） ----------------
   ⚠️ 必须排除全屏态（pseudo-fs / is-fs），否则这两条选择器权重高于全屏规则，
   会把全屏画面压回 56vh 高度，导致横屏观看时画面缩成中间一条、两侧大片黑边。 */
body.landscape .player:not(.pseudo-fs):not(.is-fs) {
  margin: 0 -14px;
  border-radius: 0;
}

body.landscape .player:not(.pseudo-fs):not(.is-fs) .video {
  aspect-ratio: auto;
  width: 100%;
  height: auto;
  max-height: 88vh;
}

body.landscape .page {
  padding-left: 14px;
  padding-right: 14px;
}

body.landscape .meta { padding-top: 10px; }

/* ---------------- 大屏 ---------------- */
@media (min-width: 900px) {
  .page {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    padding: 20px 20px 40px;
    align-items: start;
  }

  .player {
    position: relative;
    top: auto;
    margin: 0;
    border-radius: var(--r-lg);
  }

  .player .video { max-height: 60vh; }

  .sheet {
    position: absolute;
  }

  .meta { padding-top: 16px; }

  .meta h1 { font-size: 20px; }

  .side { position: sticky; top: 68px; max-height: calc(100vh - 92px); display: flex; flex-direction: column; }

  .side-list { overflow-y: auto; }
}

@media (max-width: 899px) {
  /* 手机/平板：单列，侧栏折叠为播放器下方的选集入口 */
  .side { margin-top: 4px; }
  .topbar .site-sub { display: none; }
  .v-actions .btn { flex: 1; }
  .meta h1 { font-size: 16.5px; }

  /* 竖屏以视频为主：标题/按钮/提示整体压缩，不抢视频的视觉空间 */
  body.portrait .meta { padding: 10px 2px 2px; }
  body.portrait .meta h1 {
    font-size: 15px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
  }
  body.portrait .v-sub { margin: 0 0 8px; font-size: 12px; }
  body.portrait .v-actions { gap: 7px; }
  body.portrait .v-actions .btn { height: 36px; padding: 0 10px; font-size: 13.5px; min-width: 0; }
  body.portrait .save-state { margin-top: 6px; font-size: 11.5px; }
  body.portrait .continue { margin-top: 6px; }
}

@media (max-width: 380px) {
  .topbar .mode { display: none; }
  .ep-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
}

/* ============================================================
   状态类与过渡（与 app.js 的 class 切换严格对应）
   ============================================================ */

/* 原生全屏与伪全屏的 .is-fs 样式已统一在上方「全屏」段定义，此处不再重复 */

/* toast */
.toast {
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 手势 HUD */
.hud {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.96);
  transition: opacity .15s ease, transform .15s ease;
}

.hud.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* 进度条悬浮时间 */
.bar-tip {
  opacity: 0;
  transition: opacity .14s ease;
}

.bar-tip.show { opacity: 1; }

/* 进度条拖拽中：加大触感反馈 */
.bar.dragging .thumb {
  width: 16px;
  height: 16px;
  margin-left: -8px;
  box-shadow: 0 0 0 5px rgba(79, 124, 255, .3);
}

.bar.dragging .bar-played { background: var(--accent-2); }

/* 选集面板 */
.sheet {
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.22, .61, .36, 1);
}

.sheet.show { transform: translateY(0); }

/* 拖拽跟手时关闭过渡，避免迟滞 */
.sheet.dragging { transition: none; }

.sheet-mask {
  opacity: 0;
  transition: opacity .2s ease;
}

.sheet-mask.show { opacity: 1; }

/* 手机号弹窗 */
.gate {
  opacity: 0;
  transition: opacity .2s ease;
}

.gate.show { opacity: 1; }

/* 手机端：顶栏随内容滚出，播放器吸顶时占满屏幕顶部 */
@media (max-width: 899px) {
  .topbar { position: relative; }

  .player {
    top: 0;
    margin-left: -14px;
    margin-right: -14px;
    border-radius: 0;
  }

  body.landscape .player:not(.pseudo-fs):not(.is-fs) { margin-left: -14px; margin-right: -14px; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ================= 播放中「加微信引导」浮层 ================= */
/* 挂在 body 直下（不入 .player），position: fixed 保证伪全屏 / 原生全屏都可见 */
.promo-mask {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 24px calc(30px + var(--safe-b, 0px));
  background: rgba(6, 9, 16, .66);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .2s ease;
  overscroll-behavior: contain;
}

.promo-mask[hidden] { display: none !important; }
.promo-mask.show { opacity: 1; }

.promo-card {
  position: relative;
  width: min(360px, calc(100vw - 48px));
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 22px 20px 16px;
  border-radius: 20px;
  background: #fff;
  color: #141a24;
  box-shadow: 0 26px 60px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .16);
  text-align: center;
  opacity: 0;
  transform: translateY(24px);
  transition: transform .42s cubic-bezier(.16, 1, .3, 1), opacity .42s ease;
}

.promo-card.show {
  opacity: 1;
  transform: translateY(0);
}

/* 关闭时反向更快（200ms） */
.promo-mask:not(.show) .promo-card { transition-duration: .2s; }

.promo-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9aa3b5;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.promo-close:hover { background: #f1f3f9; color: #4a5468; }

.promo-title {
  margin: 2px 0 8px;
  padding: 0 26px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
  color: #141a24;
}

.promo-text {
  margin: 0 0 14px;
  font-size: 14.5px;
  line-height: 1.7;
  color: #4b5568;
  word-break: break-word;
}

.promo-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
}

.promo-qr[hidden] { display: none !important; }

.promo-qr img {
  width: 168px;
  height: 168px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e8ebf3;
}

.promo-qr-tip {
  font-size: 11.5px;
  color: #8d97a9;
}

.promo-wechat {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 11px 12px;
  border: 1px dashed #c9d2e6;
  border-radius: 12px;
  background: #f4f6fb;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.promo-wechat[hidden] { display: none !important; }

.promo-wechat:active { background: #eaeefa; }

.promo-wechat-label {
  font-size: 11px;
  letter-spacing: .06em;
  color: #8d97a9;
}

.promo-wechat strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 18px;
  letter-spacing: .04em;
  color: #171f2e;
  word-break: break-all;
}

.promo-copy {
  width: 100%;
  margin-top: 12px;
}

.promo-copy[hidden] { display: none !important; }

.promo-tip {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: #98a1b3;
}

.promo-tip.ok {
  color: #12a06a;
  font-weight: 600;
}

/* 横屏 / 大屏：居中偏下，不要贴边 */
@media (min-height: 560px) {
  .promo-mask { align-items: center; padding-bottom: 24px; }
}

/* 减少动效：去掉位移，只保留极短淡入 */
@media (prefers-reduced-motion: reduce) {
  .promo-mask { transition-duration: .12s !important; }
  .promo-card {
    transform: none !important;
    transition-duration: .12s !important;
  }
  .promo-card.show { transform: none !important; }
}

/* ============================================================
   商业化改版 · 播放器控件放大与触控热区（移动端优先）
   说明：本节为「覆盖式」追加，选择器权重高于原有控件样式，
        不删除旧规则，便于随时回退。
   ============================================================ */
:root {
  --ctl-size: 44px;      /* 次级控件最小触控区 */
  --ctl-main: 48px;      /* 桌面主播放按钮 */
  --ctl-main-m: 56px;    /* 移动端主播放按钮 */
  --bar-h: 28px;         /* 进度条点击热区高度 */
  --bar-visual: 6px;     /* 进度条视觉高度 */
}

/* 底部控件栏：加大内边距 + iPhone 安全区 + 半透明黑底模糊 */
.player .controls {
  padding: 30px 14px calc(10px + var(--safe-b, env(safe-area-inset-bottom, 0px)));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .52) 38%, rgba(0, 0, 0, .86) 100%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.player .ctl-row { gap: 10px; }

/* 主播放按钮：圆形、高对比、桌面 48px */
.player .ctl.ctl-main {
  width: var(--ctl-main);
  height: var(--ctl-main);
  min-width: var(--ctl-main);
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
  transition: transform .12s ease, background .16s ease;
}

.player .ctl.ctl-main:active { transform: scale(.95); background: rgba(0, 0, 0, .6); }

/* 次级按钮：热区 ≥44×44，间距 ≥8px */
.player .ctl {
  height: var(--ctl-size);
  min-width: var(--ctl-size);
  padding: 0 10px;
  border-radius: 12px;
  font-size: 19px;
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.player .ctl.text {
  min-width: 56px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
}

.player .ctl:active { background: rgba(255, 255, 255, .22); }

/* 进度条：视觉 6px，热区 28px */
.player .bar { height: var(--bar-h); margin-bottom: 4px; }

.player .bar-bg,
.player .bar-buffer,
.player .bar-played {
  height: var(--bar-visual);
  border-radius: 999px;
}

.player .bar-played { background: var(--accent, #4c7dff); }

.player .thumb {
  width: 14px;
  height: 14px;
  margin-left: -7px;
  box-shadow: 0 0 0 4px rgba(76, 125, 255, .32);
}

.player .bar.dragging .thumb {
  width: 18px;
  height: 18px;
  margin-left: -9px;
  box-shadow: 0 0 0 6px rgba(76, 125, 255, .36);
}

.player .bar-tip { bottom: 30px; font-size: 12.5px; }

/* 时间文字与控件基线对齐 */
.player .time { font-size: 13.5px; }
.player .time em { font-weight: 600; }

/* 中央大播放按钮 */
.player .center-btn {
  width: 76px;
  height: 76px;
  font-size: 28px;
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

/* 全屏（伪全屏 / 原生全屏）同样放大 */
.player.pseudo-fs .controls,
.player.is-fs .controls {
  padding: 40px 20px calc(18px + env(safe-area-inset-bottom, 0px));
}

.player.pseudo-fs .ctl,
.player.is-fs .ctl { height: 48px; min-width: 48px; }

.player.pseudo-fs .ctl.ctl-main,
.player.is-fs .ctl.ctl-main {
  width: 56px;
  height: 56px;
  min-width: 56px;
  font-size: 22px;
}

/* 移动端：主按钮 ≥56px，控件热区 ≥44px */
@media (max-width: 899px) {
  .player .controls { padding: 26px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }

  .player .ctl.ctl-main {
    width: var(--ctl-main-m);
    height: var(--ctl-main-m);
    min-width: var(--ctl-main-m);
    font-size: 24px;
  }

  .player .ctl-row { gap: 10px; }
}

/* 播放器下方主操作按钮同步加大 */
.v-actions .btn {
  height: 48px;
  font-size: 15px;
  border-radius: 12px;
}

/* ---------------- 播放中全屏广告 ---------------- */
.ad-mask {
  position: fixed;
  inset: 0;
  z-index: 600; /* 高于加微信引导浮层(400)与选集面板 */
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 6, 12, .94);
  opacity: 0;
  transition: opacity .22s ease;
  overscroll-behavior: contain;
}

.ad-mask[hidden] { display: none !important; }
.ad-mask.show { opacity: 1; }

.ad-box {
  position: relative;
  max-width: min(560px, 94vw);
}

.ad-img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 86vh;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}

.ad-link { display: block; -webkit-tap-highlight-color: transparent; }

.ad-close,
.ad-skip {
  position: absolute;      /* 贴在广告图右上角（.ad-box 相对定位） */
  top: 10px;
  right: 10px;
  z-index: 3;
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .45);
  background: rgba(0, 0, 0, .62);
  color: rgba(255, 255, 255, .82);
  font-size: 13px;
  line-height: 1;
  cursor: not-allowed;
  -webkit-tap-highlight-color: transparent;
}

.ad-skip.ready {
  cursor: pointer;
  color: #fff;
  font-weight: 600;
  background: rgba(79, 124, 255, .92);
  border-color: transparent;
}

.ad-skip.ready:active { background: rgba(53, 96, 216, .95); }

/* ============================================================
   控制条瘦身与自动隐藏修正
   - 修按钮过大导致的横向溢出（选集折行 / 全屏按钮被挤出屏幕）
   - 暂停状态控制条 4 秒后也自动隐藏，不再一直挡画面
   - 视频区与顶栏之间留少量呼吸感（吸顶后仍贴顶，保证观看面积）
   ============================================================ */
:root {
  --ctl-size: 36px;      /* 次级控件高度 */
  --ctl-main: 40px;      /* 主播放按钮（桌面） */
  --ctl-main-m: 40px;    /* 主播放按钮（移动端） */
  --bar-h: 26px;         /* 进度条热区 */
}

.player .ctl-row { gap: 5px; }

.player .ctl.ctl-main {
  width: var(--ctl-main);
  height: var(--ctl-main);
  min-width: var(--ctl-main);
  border-radius: 50%;
  font-size: 15px;
}

.player .ctl {
  height: var(--ctl-size);
  min-width: var(--ctl-size);
  padding: 0 7px;
  border-radius: 9px;
  font-size: 16px;
  white-space: nowrap;   /* 「选集」不再折行 */
  flex: 0 0 auto;
}

.player .ctl.text {
  min-width: 0;
  padding: 0 10px;
  font-size: 12.5px;
}

.player .time { font-size: 11.5px; }

.player .controls {
  padding: 20px 10px calc(6px + var(--safe-b, env(safe-area-inset-bottom, 0px)));
}

.player .center-btn {
  width: 56px;
  height: 56px;
  font-size: 21px;
}

.player.pseudo-fs .ctl,
.player.is-fs .ctl { height: 40px; min-width: 40px; }

.player.pseudo-fs .ctl.ctl-main,
.player.is-fs .ctl.ctl-main {
  width: 46px;
  height: 46px;
  min-width: 46px;
  font-size: 17px;
}

/* 暂停时也允许自动隐藏：openVideo 后播放器带 .started，
   show-ctl 被 JS 定时移除后（4 秒无操作）控制条淡出 */
.player.started:not(.show-ctl) .controls {
  opacity: 0;
  pointer-events: none;
}

/* 手机：视频区稍微下移，不顶着状态栏/顶栏；吸顶后仍贴顶 */
@media (max-width: 899px) {
  .page { padding-top: 10px; }
  .player { margin-top: 8px; }
}

/* ============================================================
   二次打磨：去毛玻璃遮挡 + 竖屏版式重排
   ============================================================ */

/* 1) 控制条不再带 backdrop 模糊：毛玻璃会把控制条上方的视频底部
      整块糊掉（用户反馈"遮罩模糊挡视频"）。改为更浅的单向渐变。 */
.player .controls {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .55) 100%);
  padding-top: 16px;
}

/* 按钮自身的毛玻璃也去掉，只保留半透明底色 */
.player .ctl,
.player .ctl.ctl-main {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(0, 0, 0, .42);
}

.player .center-btn {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(0, 0, 0, .35);
}

/* 2) 竖屏版式重排：标题 / 操作按钮在视频上方（"上面放点别的东西"），
      视频整体下移居中偏上，课程列表仍在最下。横屏与桌面保持原版式。 */
@media (max-width: 899px) {
  body.portrait .stage { display: flex; flex-direction: column; }

  body.portrait .stage .meta {
    order: 1;
    margin: 12px 2px 0;
  }

  body.portrait .stage .player {
    order: 2;
    margin-top: 10px;
  }

  body.portrait .stage .continue {
    order: 3;
    margin-top: 10px;
  }
}

/* ================= 弹窗广告（推广卡） =================
   由 app.js 的 camp 模块动态创建，这里只管样式。
   层级高于播放器与 promo 浮层，全屏时会被挂进全屏元素内部。 */
.camp-mask {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 10, 16, .82);
  opacity: 0;
  transition: opacity .2s ease;
}
.camp-mask[hidden] { display: none; }
.camp-mask.show { opacity: 1; }

.camp-card {
  width: 100%;
  max-width: 380px;
  max-height: 88vh;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 22px 20px 18px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  transform: translateY(10px) scale(.97);
  transition: transform .22s cubic-bezier(.2, .8, .3, 1);
  text-align: left;
}
.camp-mask.show .camp-card { transform: none; }

.camp-tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef1f7;
  color: #6b7488;
  font-size: 11px;
  letter-spacing: .5px;
}

.camp-title {
  margin: 0 0 8px;
  color: #1a1f2b;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 700;
}

.camp-text {
  margin: 0 0 14px;
  color: #454c5c;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.camp-media {
  margin: 0 0 14px;
  border-radius: 12px;
  overflow: hidden;
  background: #f3f5f9;
}
.camp-media[hidden] { display: none; }
.camp-video {
  display: block;
  width: 100%;
  max-height: 46vh;
  object-fit: contain;
  background: #000;
}

.camp-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.camp-yes,
.camp-no {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 16px;
  border: 0;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.camp-yes {
  background: linear-gradient(135deg, #2f6bff, #1f4fd8);
  color: #fff;
  box-shadow: 0 8px 18px rgba(47, 107, 255, .28);
}
.camp-yes:active { transform: translateY(1px); }
.camp-no {
  background: #f2f4f8;
  color: #5b6479;
}

.camp-hint {
  margin: 10px 0 0;
  color: #98a0b3;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 380px) {
  .camp-card { padding: 18px 16px 14px; }
  .camp-title { font-size: 16px; }
}
