:root {
  color-scheme: dark;
  --background: #111111;
  --surface: #1a1a1b;
  --surface-light: #232324;
  --surface-raised: #2b2b2d;
  --card-special: #1a1f37;
  --primary: #4267c2;
  --primary-active: #557ad9;
  --primary-text: #8aa6ef;
  --primary-soft: rgba(66, 103, 194, 0.16);
  --primary-softer: rgba(66, 103, 194, 0.08);
  --mtt-active: #556ed3;
  --mtt-gradient: linear-gradient(272deg, #193375 1%, #5c78c4 84%);
  --input: rgba(255, 255, 255, 0.06);
  --input-active: rgba(255, 255, 255, 0.12);
  --text-high: rgba(255, 255, 255, 0.92);
  --text: rgba(255, 255, 255, 0.8);
  --text-low: rgba(255, 255, 255, 0.52);
  --text-faint: rgba(255, 255, 255, 0.32);
  --outline: rgba(255, 255, 255, 0.08);
  --outline-strong: rgba(255, 255, 255, 0.16);
  --success: #50b24b;
  --header-height: 56px;
  --app-navbar-height: 0px;
  --sticky-top-offset: var(--header-height);
  --rail-width: 380px;
  --shell-gap: 24px;
  --radius-control: 6px;
  --radius-card: 10px;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  /* clip 不会创建滚动容器，保证头部与播放器 sticky 生效 */
  overflow-x: clip;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.is-locked {
  overflow: hidden;
}

button,
input,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  color: inherit;
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

img,
video,
svg {
  display: block;
}

h1,
h2,
p,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary-active);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10000;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-control);
  background: var(--primary);
  color: var(--text-high);
  line-height: 36px;
  text-decoration: none;
  transform: translateY(-56px);
}

.skip-link:focus {
  transform: translateY(0);
}

.icon-button {
  position: relative;
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-low);
}

.icon-button:hover {
  background: var(--input);
  color: var(--text-high);
}

.icon-button:active {
  background: var(--input-active);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.text-button {
  display: inline-flex;
  padding: 0;
  align-items: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: var(--primary-text);
  font-size: 12px;
}

.text-button svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.text-button:hover {
  color: var(--text-high);
}

.progress-track {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--input-active);
}

.progress-track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--primary-active);
  transition: width 0.3s ease;
}

/* ---------- 头部 ---------- */

.app-navbar {
  position: relative;
  z-index: 100;
}

.site-header {
  position: sticky;
  top: var(--app-navbar-height);
  z-index: 100;
  height: var(--header-height);
  border-bottom: 1px solid var(--outline);
  background: rgba(17, 17, 17, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-header__inner {
  display: flex;
  max-width: 1520px;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--shell-gap);
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  color: var(--text-high);
  text-decoration: none;
}

.brand__logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand__name {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.breadcrumb {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 4px;
  padding-left: 16px;
  border-left: 1px solid var(--outline-strong);
  color: var(--text-low);
  font-size: 13px;
  white-space: nowrap;
}

.breadcrumb svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: currentColor;
}

.breadcrumb__course {
  flex: 0 0 auto;
}

.breadcrumb__lesson {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
}

.site-header__actions {
  display: flex;
  margin-left: auto;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.service-link {
  position: relative;
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  text-decoration: none;
}

.service-link::before {
  position: absolute;
  inset: -4px;
  content: "";
}

.service-link:hover {
  background: var(--input);
  color: var(--text-high);
}

.service-link:active {
  background: var(--input-active);
}

.service-link svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.catalog-trigger {
  display: none;
  width: 220px;
  height: 36px;
  padding: 0 8px 0 12px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-control);
  background: var(--input);
  color: var(--text-low);
  font-size: 13px;
}

.catalog-trigger:hover {
  border-color: var(--outline-strong);
  color: var(--text);
}

.catalog-trigger svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
}

.catalog-trigger__label--narrow {
  display: none;
}

.catalog-trigger__kbd {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: auto;
  place-items: center;
  border: 1px solid var(--outline-strong);
  border-radius: 4px;
  color: var(--text-low);
  font-family: inherit;
  font-size: 12px;
}

.header-cta {
  display: inline-flex;
  height: 36px;
  padding: 0 12px 0 14px;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-control);
  background: var(--mtt-gradient);
  color: var(--text-high);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.header-cta:hover {
  opacity: 0.9;
}

.header-cta svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ---------- 主布局 ---------- */

.app-shell {
  display: grid;
  max-width: 1520px;
  margin: 0 auto;
  padding: 20px var(--shell-gap) 48px;
  align-items: start;
  grid-template-areas:
    "player rail"
    "head rail"
    "extras rail";
  grid-template-columns: minmax(0, 1fr) var(--rail-width);
  grid-template-rows: auto auto 1fr;
  column-gap: var(--shell-gap);
}

body.is-app.is-native-navbar-ready {
  --app-navbar-height: calc(44px + var(--app-battery-bar-height, 0px));
  --sticky-top-offset: calc(var(--app-navbar-height) + var(--header-height));
}

body.is-app.is-native-navbar-ready .brand,
body.is-app.is-native-navbar-ready .breadcrumb,
body.is-app.is-native-navbar-ready .header-cta {
  display: none;
}

body.is-app.is-native-navbar-ready .site-header__inner {
  justify-content: flex-end;
  padding-right: 12px;
  padding-left: 12px;
}

body.is-app.is-native-navbar-ready .site-header__actions {
  width: 100%;
  margin-left: 0;
}

body.is-app.is-native-navbar-ready .catalog-trigger {
  display: inline-flex;
  width: 100%;
  max-width: 360px;
  margin-left: auto;
  flex: 1 1 auto;
}

body.is-app.is-native-navbar-ready .catalog-trigger__label--wide {
  display: inline;
}

body.is-app.is-native-navbar-ready .catalog-trigger__label--narrow,
body.is-app.is-native-navbar-ready .catalog-trigger__kbd {
  display: none;
}

body.is-app.is-native-navbar-ready #appNavbar .native-base-navbar {
  --native-navbar-progress: 1 !important;
}

body.is-app.is-native-navbar-ready .app-shell {
  padding-top: calc(20px + var(--app-navbar-height));
}

.player-area {
  position: relative;
  grid-area: player;
  scroll-margin-top: calc(var(--sticky-top-offset) + 16px);
}

.player-area:focus {
  outline: none;
}

.lesson-head {
  grid-area: head;
  padding-top: 16px;
}

.rail {
  grid-area: rail;
}

.lesson-extras {
  grid-area: extras;
}

/* ---------- 视频 ---------- */

.video-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: #000;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.video-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.video-skeleton,
.video-state {
  position: absolute;
  inset: 0;
  display: grid;
  padding: 24px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.video-skeleton {
  pointer-events: none;
  background: radial-gradient(circle at 50% 45%, #1d2436 0, #0b0b0c 70%);
}

.video-skeleton__mark {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-text);
  animation: pulse 1.6s ease-in-out infinite;
}

.video-skeleton__mark svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.video-state {
  background: rgba(10, 10, 10, 0.92);
}

.video-state > svg {
  width: 32px;
  height: 32px;
  fill: var(--text-low);
}

.video-state strong {
  color: var(--text-high);
  font-size: 16px;
  font-weight: 500;
}

.video-state span {
  color: var(--text-low);
  font-size: 13px;
}

.video-state button {
  display: inline-flex;
  height: 36px;
  margin-top: 8px;
  padding: 0 14px;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--primary);
  color: var(--text-high);
}

.video-state button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.resume-card {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  padding: 24px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  background: rgba(8, 8, 9, 0.84);
  text-align: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.resume-card small {
  color: var(--primary-text);
  font-size: 13px;
}

.resume-card strong {
  color: var(--text-high);
  font-size: 18px;
  font-weight: 600;
}

.resume-card__actions {
  display: flex;
  margin-top: 8px;
  gap: 8px;
}

.resume-card__continue,
.resume-card__restart {
  display: inline-flex;
  height: 40px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: var(--radius-control);
  font-size: 14px;
  font-weight: 500;
}

.resume-card__continue {
  background: var(--primary);
  color: var(--text-high);
}

.resume-card__continue:hover {
  background: var(--primary-active);
}

.resume-card__continue svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.resume-card__restart {
  background: var(--input-active);
  color: var(--text);
}

.resume-card__restart:hover {
  color: var(--text-high);
}

.video-play-toggle {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  display: grid;
  width: 64px;
  height: 64px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(12, 12, 13, 0.76);
  color: var(--text-high);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.36);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.video-play-toggle:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: var(--primary);
}

.video-play-toggle:active {
  background: var(--primary-active);
}

.video-play-toggle svg {
  width: 32px;
  height: 32px;
  margin-left: 2px;
  fill: currentColor;
}

@keyframes pulse {
  50% {
    opacity: 0.5;
    transform: scale(0.94);
  }
}

/* 播完后的下一集卡片 */
.end-card {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  padding: 16px;
  place-items: center;
  background: rgba(8, 8, 10, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.end-card__body {
  display: grid;
  max-width: 440px;
  justify-items: center;
  gap: 6px;
  text-align: center;
}

.end-card__body small {
  color: var(--primary-text);
  font-size: 13px;
}

.end-card__body strong {
  color: var(--text-high);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

.end-card__countdown {
  min-height: 20px;
  color: var(--text-low);
  font-size: 13px;
}

.end-card__actions {
  display: flex;
  margin-top: 6px;
  gap: 8px;
}

.end-card__play,
.end-card__cancel {
  display: inline-flex;
  height: 40px;
  padding: 0 18px;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius-control);
  font-size: 14px;
  font-weight: 500;
}

.end-card__play {
  background: var(--primary);
  color: var(--text-high);
}

.end-card__play:hover {
  background: var(--primary-active);
}

.end-card__play svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.end-card__cancel {
  background: var(--input-active);
  color: var(--text);
}

.end-card__cancel:hover {
  color: var(--text-high);
}

/* 播完后的盯盘神器引导条：固定在卡片底部，不挤占下一集操作 */
.end-card {
  grid-template-rows: minmax(0, 1fr) auto;
}

.end-card__promo {
  display: flex;
  width: min(100%, 560px);
  min-height: 44px;
  margin-top: 12px;
  padding: 6px 6px 6px 8px;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(138, 166, 239, 0.28);
  border-radius: var(--radius-card);
  background: linear-gradient(90deg, rgba(66, 103, 194, 0.3) 0%, rgba(26, 31, 55, 0.72) 100%);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transition: border-color 0.2s ease, background-color 0.2s ease;
  animation: end-card-promo-in 0.32s ease-out both;
}

.end-card__promo[hidden] {
  display: none;
}

.end-card__promo:hover {
  border-color: rgba(138, 166, 239, 0.5);
}

.end-card__promo-badge {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--mtt-gradient);
  color: var(--text-high);
  font-size: 12px;
  font-weight: 600;
}

.end-card__promo-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.end-card__promo-text--narrow {
  display: none;
}

.end-card__promo-action {
  display: inline-flex;
  height: 32px;
  flex-shrink: 0;
  padding: 0 8px 0 12px;
  align-items: center;
  gap: 2px;
  border-radius: var(--radius-control);
  background: var(--primary);
  color: var(--text-high);
  font-weight: 500;
}

.end-card__promo:hover .end-card__promo-action {
  background: var(--primary-active);
}

.end-card__promo-action svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

@keyframes end-card-promo-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.autoplay-toggle {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  color: var(--text-low);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.autoplay-toggle:hover {
  color: var(--text);
}

.autoplay-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.player-toolbar {
  display: flex;
  min-height: 40px;
  padding: 0 4px 0 8px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--outline);
  border-top: 0;
  border-radius: 0 0 var(--radius-control) var(--radius-control);
  background: var(--surface);
}

.player-toolbar__playback,
.player-toolbar__modes {
  display: flex;
  align-items: center;
  gap: 2px;
}

.player-seek-button,
.playback-rate select {
  height: 36px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-low);
  font-size: 12px;
}

.player-seek-button {
  min-width: 48px;
  padding: 0 8px;
}

.player-seek-button:hover:not(:disabled),
.playback-rate select:hover {
  background: var(--input);
  color: var(--text-high);
}

.player-seek-button:active:not(:disabled) {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.player-seek-button:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
}

.playback-rate {
  display: inline-flex;
  align-items: center;
}

.playback-rate select {
  width: 62px;
  padding: 0 20px 0 8px;
  color-scheme: dark;
  cursor: pointer;
}

.autoplay-toggle__switch {
  position: relative;
  width: 28px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--input-active);
  transition: background-color 0.16s ease;
}

.autoplay-toggle__switch::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-low);
  content: "";
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.autoplay-toggle input:checked + .autoplay-toggle__switch {
  background: var(--primary);
}

.autoplay-toggle input:checked + .autoplay-toggle__switch::after {
  background: var(--text-high);
  transform: translateX(12px);
}

.autoplay-toggle input:focus-visible + .autoplay-toggle__switch {
  outline: 2px solid var(--primary-active);
  outline-offset: 2px;
}

.player-mode-button {
  display: inline-flex;
  height: 36px;
  padding: 0 8px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-low);
  font-size: 12px;
}

.player-mode-button:hover {
  background: var(--input);
  color: var(--text-high);
}

.player-mode-button:active,
.player-mode-button[aria-pressed="true"] {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.player-mode-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.lights-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.82);
  cursor: default;
}

body.is-lights-off .player-area {
  z-index: 151;
}

@media (min-width: 1024px) {
  body.is-wide-mode .app-shell {
    grid-template-areas:
      "player player"
      "head rail"
      "extras rail";
  }

  body.is-wide-mode .player-area {
    margin-bottom: 4px;
  }
}

/* ---------- 本集信息 ---------- */

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text-low);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.course-chip {
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 500;
}

.course-chip:hover {
  background: rgba(66, 103, 194, 0.28);
}

.lesson-meta__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
}

.complete-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--success);
}

.complete-badge svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.lesson-head__title {
  display: flex;
  margin-top: 10px;
  align-items: center;
  gap: 12px;
}

.lesson-head h1 {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-high);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
}

.lesson-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.share-trigger {
  width: auto;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-low);
  font-size: 13px;
}

.share-trigger svg {
  width: 18px;
  height: 18px;
}

.key-points {
  display: flex;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.key-points li {
  display: inline-flex;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 10px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.key-points li::before {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--primary-active);
  content: "";
}

.key-points--text li {
  border-radius: var(--radius-control);
}

.key-points--text li::before {
  display: none;
}

.lesson-navigation {
  display: grid;
  margin-top: 20px;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.nav-card {
  display: flex;
  min-width: 0;
  min-height: 64px;
  padding: 10px 14px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-card);
  background: var(--surface);
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}

.nav-card--next {
  justify-content: flex-end;
  text-align: right;
}

.nav-card:hover:not(:disabled) {
  border-color: var(--outline-strong);
  background: var(--surface-light);
}

.nav-card:disabled {
  cursor: default;
  opacity: 0.4;
}

.nav-card > span {
  display: grid;
  min-width: 0;
}

.nav-card small {
  color: var(--text-low);
  font-size: 12px;
}

.nav-card small.is-cross {
  color: var(--primary-text);
}

.nav-card strong {
  overflow: hidden;
  color: var(--text-high);
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-card svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: var(--text-low);
}

.lesson-extras {
  padding-top: 28px;
}

.learning-note {
  display: flex;
  margin-top: 0;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-faint);
  font-size: 12px;
}

.learning-note svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  flex: 0 0 auto;
  fill: currentColor;
}

/* ---------- 右侧课程栏 ---------- */

.rail {
  position: sticky;
  top: calc(var(--sticky-top-offset) + 20px);
  display: flex;
  /* 不让长目录参与网格轨道计算，最终高度跟随左侧三行内容。 */
  height: 0;
  min-height: 100%;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--outline);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.rail__tabs {
  display: grid;
  margin: 8px;
  padding: 3px;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  border-radius: 8px;
  background: var(--background);
}

.rail__tab {
  display: inline-flex;
  height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-low);
  font-size: 13px;
  font-weight: 500;
}

.rail__tab:hover {
  color: var(--text);
}

.rail__tab[aria-selected="true"] {
  background: var(--surface-raised);
  color: var(--text-high);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.rail__tab-count {
  min-width: 20px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--input-active);
  font-size: 11px;
  line-height: 18px;
}

.course-panel,
.catalog-panel,
.transcript-panel {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--outline-strong) transparent;
}

.course-panel,
.catalog-panel,
.transcript-panel {
  display: none;
}

.rail[data-tab="course"] .course-panel,
.rail[data-tab="catalog"] .catalog-panel,
.rail[data-tab="transcript"] .transcript-panel {
  display: block;
}

.sheet-backdrop,
.catalog-panel__handle,
.catalog-panel__close {
  display: none;
}

/* 本专题 */
.course-card {
  margin: 0 8px;
  padding: 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(66, 103, 194, 0.22), rgba(66, 103, 194, 0.05) 60%), var(--surface-light);
}

.course-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.course-card__eyebrow {
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 500;
}

.course-card h2 {
  margin-top: 4px;
  color: var(--text-high);
  font-size: 17px;
  font-weight: 600;
}

.course-card p {
  margin-top: 4px;
  color: var(--text-low);
  font-size: 12px;
  line-height: 1.6;
}

.course-card__progress {
  display: flex;
  margin-top: 12px;
  align-items: center;
  gap: 10px;
}

.course-card__progress .progress-track {
  flex: 1 1 auto;
}

.course-card__progress > span {
  flex: 0 0 auto;
  color: var(--text-low);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.lesson-list {
  display: grid;
  padding: 8px;
  gap: 2px;
}

.lesson-row {
  display: grid;
  width: 100%;
  padding: 8px;
  align-items: center;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  transition: background 0.15s;
}

.lesson-row:hover {
  background: var(--input);
}

.lesson-row.is-active {
  background: var(--primary-soft);
}

.lesson-row__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-raised);
}

.lesson-row__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lesson-row__thumb::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: calc(var(--p, 0) * 100%);
  height: 3px;
  background: var(--primary-active);
  content: "";
}

.lesson-row__duration {
  position: absolute;
  right: 4px;
  bottom: 6px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--text-high);
  font-size: 11px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

.lesson-row__playing {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(10, 14, 28, 0.6);
}

.lesson-row.is-active .lesson-row__playing {
  display: grid;
}

.equalizer {
  display: flex;
  height: 16px;
  align-items: flex-end;
  gap: 2px;
}

.equalizer i {
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: var(--text-high);
  animation: equalize 0.9s ease-in-out infinite;
  transform-origin: bottom;
}

.equalizer i:nth-child(2) {
  animation-delay: -0.3s;
}

.equalizer i:nth-child(3) {
  animation-delay: -0.6s;
}

.is-paused .equalizer i {
  animation-play-state: paused;
}

@keyframes equalize {
  0%,
  100% {
    transform: scaleY(0.3);
  }

  50% {
    transform: scaleY(1);
  }
}

.lesson-row__copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.lesson-row__title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.lesson-row.is-active .lesson-row__title {
  color: var(--text-high);
}

.lesson-row__status {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-faint);
  font-size: 12px;
}

.lesson-row__status svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.lesson-row__status.is-done {
  color: var(--success);
}

.lesson-row__status.is-partial {
  color: var(--text-low);
}

.lesson-row.is-active .lesson-row__status {
  color: var(--primary-text);
}

.next-course {
  display: flex;
  width: calc(100% - 16px);
  margin: 0 8px 8px;
  padding: 12px 14px;
  align-items: center;
  gap: 12px;
  border: 1px dashed var(--outline-strong);
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.next-course:hover {
  border-color: var(--primary);
  background: var(--primary-softer);
}

.next-course > span {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
}

.next-course small {
  color: var(--text-low);
  font-size: 12px;
}

.next-course strong {
  color: var(--text-high);
  font-size: 14px;
  font-weight: 500;
}

.next-course em {
  color: var(--text-low);
  font-size: 12px;
  font-style: normal;
}

.next-course svg {
  width: 20px;
  height: 20px;
  fill: var(--text-low);
}

/* 字幕文稿 */
.transcript-panel {
  position: relative;
  padding: 0 8px 12px;
  scroll-padding-block: 56px 20px;
}

.transcript-panel__header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  min-height: 48px;
  padding: 6px 6px 8px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--outline);
  background: var(--surface);
}

.transcript-panel__header > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.transcript-panel__header strong {
  color: var(--text-high);
  font-size: 14px;
  font-weight: 600;
}

.transcript-panel__header span {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transcript-follow {
  height: 32px;
  padding: 0 8px;
  flex: 0 0 auto;
  border-radius: var(--radius-control);
  color: var(--primary-text);
  font-size: 12px;
}

.transcript-follow:hover {
  background: var(--input);
}

.transcript-status {
  display: grid;
  min-height: 180px;
  padding: 28px 16px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.transcript-status[hidden] {
  display: none;
}

.transcript-status strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.transcript-status > span {
  max-width: 248px;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.6;
}

.transcript-retry {
  display: inline-flex;
  height: 36px;
  margin-top: 4px;
  padding: 0 12px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
}

.transcript-retry:hover {
  background: var(--primary-active);
}

.transcript-retry svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.transcript-list {
  display: grid;
  margin: 0;
  padding: 8px 0 12px;
  list-style: none;
  gap: 2px;
}

.transcript-list[hidden] {
  display: none;
}

.transcript-cue {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 52px;
  padding: 8px 10px 8px 42px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-low);
  text-align: left;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.transcript-cue::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 2px;
  border-radius: 1px;
  background: transparent;
  content: "";
}

.transcript-cue:hover {
  background: var(--input);
  color: var(--text);
}

.transcript-cue[aria-current="true"] {
  background: rgba(66, 103, 194, 0.18);
  color: var(--text-high);
}

.transcript-cue[aria-current="true"]::before {
  background: var(--primary);
}

.transcript-cue__time {
  position: absolute;
  top: 10px;
  left: 8px;
  color: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
}

.transcript-cue[aria-current="true"] .transcript-cue__time {
  color: var(--primary-text);
}

.transcript-cue__text {
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-line;
}

/* 全部课程 */
.catalog-panel {
  padding: 0 8px 8px;
}

.catalog-panel__header {
  display: flex;
  padding: 4px 6px 0;
  align-items: center;
  justify-content: space-between;
}

.catalog-panel__header > div {
  display: grid;
}

.catalog-panel__header strong {
  color: var(--text-high);
  font-size: 15px;
  font-weight: 600;
}

.catalog-panel__header span {
  color: var(--text-low);
  font-size: 12px;
}

.overall-progress {
  display: grid;
  margin: 12px 6px 0;
  gap: 6px;
}

.overall-progress__text {
  display: flex;
  justify-content: space-between;
  color: var(--text-low);
  font-size: 12px;
}

.overall-progress__text strong {
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.search-box {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  height: 40px;
  margin: 12px 0 8px;
  padding: 0 4px 0 12px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-control);
  background: var(--surface-light);
  box-shadow: 0 -8px 0 var(--surface);
}

.search-box:focus-within {
  border-color: var(--primary);
}

.search-box > svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: var(--text-low);
}

.search-box input {
  min-width: 0;
  flex: 1 1 auto;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-high);
  font-size: 14px;
}

.search-box input::placeholder {
  color: var(--text-faint);
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-box button {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-low);
}

.search-box button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.course-tree {
  display: grid;
  gap: 2px;
}

.course-group {
  border-radius: 8px;
}

.course-group.is-open {
  background: var(--background);
}

.course-toggle {
  display: grid;
  width: 100%;
  padding: 10px;
  align-items: center;
  grid-template-columns: 28px minmax(0, 1fr) auto 16px;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.course-toggle:hover {
  background: var(--input);
}

.course-number {
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.course-group.has-active .course-number {
  color: var(--primary-text);
}

.course-toggle__copy {
  display: grid;
  min-width: 0;
}

.course-toggle__copy strong {
  overflow: hidden;
  color: var(--text-high);
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-toggle__copy small {
  color: var(--text-low);
  font-size: 12px;
}

.course-ring {
  --ring: 0;
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--primary-active) calc(var(--ring) * 1turn), var(--input-active) 0);
  color: var(--text-low);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.course-ring::before {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.course-group.is-open .course-ring::before {
  background: var(--background);
}

.course-ring span {
  position: relative;
}

.course-ring.is-done {
  background: var(--success);
}

.course-ring.is-done span {
  color: var(--success);
}

.course-toggle__arrow {
  width: 16px;
  height: 16px;
  fill: var(--text-low);
  transition: transform 0.2s;
}

.course-group.is-open .course-toggle__arrow {
  transform: rotate(180deg);
}

.course-group .tree-lessons {
  display: none;
  padding: 0 6px 6px 44px;
}

.course-group.is-open .tree-lessons {
  display: grid;
}

.tree-lesson {
  display: grid;
  width: 100%;
  min-height: 40px;
  padding: 8px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.tree-lesson:hover {
  background: var(--input);
}

.tree-lesson.is-active {
  background: var(--primary-soft);
  color: var(--text-high);
}

.tree-lesson__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-lesson__meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tree-lesson__meta svg {
  width: 14px;
  height: 14px;
  fill: var(--success);
}

.tree-lesson:not(.is-done) .tree-lesson__meta svg {
  display: none;
}

.tree-lesson mark,
.course-toggle__copy mark {
  border-radius: 2px;
  background: rgba(255, 196, 0, 0.24);
  color: inherit;
}

.empty-search {
  display: grid;
  padding: 32px 16px;
  gap: 4px;
  color: var(--text-low);
  font-size: 13px;
  text-align: center;
}

.empty-search strong {
  color: var(--text);
  font-weight: 500;
}

.bottom-actions {
  display: none;
}

.bottom-actions__inner {
  display: flex;
  gap: 8px;
}

.action-button {
  display: inline-flex;
  min-width: 0;
  flex: 1 1 auto;
  height: 46px;
  padding: 0 16px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--mtt-gradient);
  color: var(--text-high);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.action-button:active {
  background: var(--mtt-active);
}

.action-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.action-button[hidden] {
  display: none;
}

/* App 内底部栏：分享为次要操作，体验盯盘神器为主操作 */
.action-button--secondary {
  flex: 0 0 auto;
  padding: 0 18px;
  border: 1px solid var(--outline-strong);
  background: var(--surface-light);
  color: var(--text);
}

.action-button--secondary:active {
  background: var(--surface-raised);
}

.action-button--secondary svg {
  width: 18px;
  height: 18px;
}

#app-intro-btn svg {
  width: 18px;
  height: 18px;
  margin-left: -4px;
}

/* ---------- 分享面板 ---------- */

.share-sheet {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  padding: 16px;
  place-items: center;
}

.share-sheet[hidden] {
  display: none;
}

.share-sheet__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.64);
  cursor: default;
}

.share-sheet__panel {
  position: relative;
  width: min(392px, 100%);
  overflow: visible;
  border: 1px solid var(--outline-strong);
  border-radius: var(--radius-card);
  background: var(--surface-light);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

.share-sheet__header {
  display: flex;
  min-height: 60px;
  padding: 8px 8px 8px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--outline);
}

.share-sheet__header > div {
  display: grid;
  gap: 2px;
}

.share-sheet__header strong {
  color: var(--text-high);
  font-size: 15px;
  font-weight: 600;
}

.share-sheet__header span {
  color: var(--text-faint);
  font-size: 12px;
}

.share-options {
  --share-icon-color: #7fa2fa;
  display: grid;
  padding: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.share-options .social-share {
  display: contents;
}

.share-option,
.share-options .social-share .social-share-icon {
  display: grid;
  min-width: 0;
  min-height: 76px;
  width: auto;
  height: auto;
  margin: 0;
  padding: 8px 4px;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-low);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.5;
  text-decoration: none;
}

.share-options .social-share .social-share-icon {
  background-image: linear-gradient(var(--input), var(--input));
  background-position: center 8px;
  background-repeat: no-repeat;
  background-size: 40px 40px;
}

.share-option:hover,
.share-options .social-share .social-share-icon:hover {
  background-color: var(--input);
  color: var(--text-high);
}

.share-option:active,
.share-options .social-share .social-share-icon:active {
  background-color: var(--input-active);
}

.share-options .social-share .social-share-icon::before {
  width: 40px;
  height: 40px;
  background-color: var(--share-icon-color);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 24px 24px;
  mask-size: 24px 24px;
  content: "";
}

.share-options .social-share .social-share-icon::after {
  color: currentColor;
  content: attr(data-share-label);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 18px;
}

.share-options .social-share .icon-qq::before {
  -webkit-mask-image: url("https://cdn.jin10.com/assets/img/newsite/icons/qq_active.png");
  mask-image: url("https://cdn.jin10.com/assets/img/newsite/icons/qq_active.png");
}

.share-options .social-share .icon-weibo::before {
  -webkit-mask-image: url("https://cdn.jin10.com/assets/img/newsite/icons/weibo_active.png");
  mask-image: url("https://cdn.jin10.com/assets/img/newsite/icons/weibo_active.png");
}

.share-options .social-share .icon-wechat::before {
  -webkit-mask-image: url("https://cdn.jin10.com/assets/img/newsite/icons/wechat_active.png");
  mask-image: url("https://cdn.jin10.com/assets/img/newsite/icons/wechat_active.png");
}

.share-options .social-share .icon-wechat .wechat-qrcode {
  top: auto;
  bottom: calc(100% + 12px);
  left: 50%;
  width: 176px;
  height: auto;
  min-height: 220px;
  padding: 12px;
  transform: translateX(-50%);
  border: 1px solid var(--outline-strong);
  border-radius: var(--radius-card);
  background: var(--surface-light);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
  color: var(--text);
}

.share-options .social-share .icon-wechat.is-wechat-open .wechat-qrcode {
  display: block;
}

.share-options .social-share .icon-wechat .wechat-qrcode h4 {
  height: 20px;
  background: transparent;
  color: var(--text-high);
  font-family: var(--font-ui);
  line-height: 20px;
}

.share-options .social-share .icon-wechat .wechat-qrcode .qrcode {
  width: 112px;
  margin: 8px auto;
  padding: 6px;
  border-radius: 4px;
  background: #ffffff;
}

.share-options .social-share .icon-wechat .wechat-qrcode .help {
  font-family: var(--font-ui);
}

.share-options .social-share .icon-wechat .wechat-qrcode .help p {
  margin: 0;
  color: var(--text-low);
  line-height: 16px;
}

.share-options .social-share .icon-wechat .wechat-qrcode::after {
  border-top-color: var(--surface-light);
}

.share-option__icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 4px;
  background: var(--input);
  line-height: 1;
}

.share-option__icon--copy {
  color: var(--share-icon-color);
}

.share-option__icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.toast {
  position: fixed;
  top: calc(var(--sticky-top-offset) + 16px);
  left: 50%;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid rgba(85, 122, 217, 0.65);
  border-radius: var(--radius-control);
  background: rgba(35, 35, 36, 0.98);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(66, 103, 194, 0.18);
  color: var(--text-high);
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast::before {
  content: "\2713";
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.toast[data-tone="error"]::before {
  content: "!";
  background: #d95757;
}


/* ---------- 响应式 ---------- */

@media (max-width: 1279px) {
  :root {
    --rail-width: 340px;
    --shell-gap: 20px;
  }

  .lesson-row {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .catalog-trigger {
    width: auto;
  }

  .catalog-trigger__kbd {
    display: none;
  }
}

@media (max-width: 1023px) {
  .catalog-trigger {
    display: inline-flex;
  }

  .breadcrumb {
    display: none;
  }

  .catalog-trigger__label--wide {
    display: none;
  }

  .catalog-trigger__label--narrow {
    display: inline;
  }

  .app-shell {
    grid-template-areas:
      "player"
      "head"
      "rail"
      "extras";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  .rail {
    position: static;
    height: auto;
    max-height: none;
    min-height: 0;
    margin-top: 24px;
    overflow: visible;
  }

  .rail__tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rail[data-tab="course"] .course-panel {
    display: block;
    overflow: visible;
    padding-top: 8px;
  }

  .rail[data-tab="transcript"] .transcript-panel {
    display: block;
    max-height: min(70dvh, 640px);
    overflow-y: auto;
  }

  .rail[data-tab="catalog"] .catalog-panel {
    display: block;
    max-height: min(70dvh, 640px);
    overflow-y: auto;
  }

  /* 顶部导航入口仍使用课程抽屉，底部页签保持内联。 */
  .rail.is-sheet-open .catalog-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    display: block;
    width: min(420px, 100%);
    max-height: none;
    padding: 12px 12px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border-left: 1px solid var(--outline);
    background: var(--surface);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.4);
  }

  .rail.is-sheet-open .sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: block;
    background: rgba(0, 0, 0, 0.6);
  }

  .rail.is-sheet-open .catalog-panel__close {
    display: inline-grid;
  }

  .search-box {
    box-shadow: 0 -12px 0 var(--surface);
  }
}

@media (max-width: 767px) {
  :root {
    --header-height: 48px;
    --shell-gap: 16px;
  }

  .site-header__inner {
    padding: 0 8px 0 12px;
    gap: 8px;
  }

  .brand {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .brand__logo {
    width: 28px;
    height: 28px;
  }

  .brand__name {
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
  }

  .site-header__actions {
    min-width: 0;
    flex: 0 0 auto;
    gap: 4px;
  }

  .service-link {
    width: 44px;
    height: 44px;
  }

  .header-cta {
    display: none;
  }

  .share-trigger {
    width: 36px;
    padding: 0;
  }

  .share-trigger span {
    display: none;
  }

  .rail[data-tab="transcript"] .transcript-panel {
    max-height: none;
    overflow-y: visible;
    overscroll-behavior-y: auto;
  }

  .transcript-panel__header {
    /* 播放器在手机端吸顶，字幕操作栏应始终停在播放器下方。 */
    top: calc(var(--sticky-top-offset) + 56.25vw + 44px);
  }

  .catalog-trigger {
    min-width: 44px;
    height: 44px;
    padding: 0 8px;
    border: 0;
    background: transparent;
    color: var(--text);
  }

  .app-shell {
    padding: 0 0 calc(80px + env(safe-area-inset-bottom));
  }

  body.is-app.is-native-navbar-ready .app-shell {
    padding-top: var(--app-navbar-height);
  }

  .player-area {
    position: sticky;
    top: var(--sticky-top-offset);
    z-index: 50;
    scroll-margin-top: var(--sticky-top-offset);
  }

  .video-stage {
    border-radius: 0;
    box-shadow: none;
  }

  .player-toolbar {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    gap: 2px;
    padding-left: 8px;
    padding-right: 8px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .autoplay-toggle {
    min-height: 44px;
  }

  .player-mode-button {
    min-width: 44px;
    min-height: 44px;
    padding: 0 6px;
  }

  .player-mode-button span {
    display: none;
  }

  .player-toolbar__playback {
    gap: 0;
  }

  .player-seek-button {
    min-width: 42px;
    height: 44px;
    padding: 0 4px;
  }

  .playback-rate select {
    width: 56px;
    height: 44px;
    padding-right: 22px;
    padding-left: 6px;
    -webkit-appearance: none;
    appearance: none;
  }

  .playback-rate {
    position: relative;
    padding-right: 4px;
  }

  .playback-rate::after {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 5px;
    height: 5px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    color: var(--text-faint);
    content: "";
    pointer-events: none;
    transform: translateY(-70%) rotate(45deg);
  }

  .video-play-toggle {
    width: 52px;
    height: 52px;
  }

  .video-play-toggle svg {
    width: 28px;
    height: 28px;
  }

  .resume-card {
    padding: 16px;
  }

  .resume-card strong {
    font-size: 16px;
  }

  .resume-card__continue,
  .resume-card__restart {
    height: 44px;
    padding: 0 14px;
  }

  .end-card__body strong {
    font-size: 15px;
  }

  .end-card__play,
  .end-card__cancel {
    height: 36px;
    padding: 0 14px;
  }

  .end-card {
    padding: 10px 12px;
  }

  .end-card__promo {
    min-height: 36px;
    margin-top: 6px;
    padding: 4px 4px 4px 6px;
    gap: 8px;
    font-size: 12px;
  }

  .end-card__promo-badge {
    padding: 2px 6px;
    font-size: 11px;
  }

  .end-card__promo-text--wide {
    display: none;
  }

  .end-card__promo-text--narrow {
    display: inline;
  }

  .end-card__promo-action {
    height: 28px;
    padding: 0 6px 0 10px;
  }

  .lesson-head {
    padding: 14px 16px 0;
  }

  .lesson-head__title {
    margin-top: 8px;
  }

  .lesson-head h1 {
    font-size: 18px;
  }

  .key-points {
    gap: 6px;
  }

  .key-points li {
    min-height: 28px;
    padding: 4px 10px;
    font-size: 12px;
  }

  .lesson-navigation {
    margin-top: 16px;
    gap: 8px;
  }

  .nav-card {
    min-height: 58px;
    padding: 8px 10px;
    gap: 6px;
  }

  .nav-card strong {
    font-size: 13px;
  }

  .nav-card svg {
    width: 16px;
    height: 16px;
  }

  .rail {
    margin-top: 20px;
    border-width: 1px 0;
    border-radius: 0;
    /* 跳转到本专题时避开吸顶的播放器 */
    scroll-margin-top: calc(var(--sticky-top-offset) + 56.25vw + 44px);
  }

  .course-card {
    margin: 0 8px;
  }

  .lesson-row {
    min-height: 64px;
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .rail[data-tab="catalog"] .catalog-panel {
    max-height: none;
    overflow-y: visible;
  }

  .rail.is-sheet-open .catalog-panel {
    top: auto;
    left: 0;
    width: 100%;
    max-height: 88dvh;
    padding-top: 0;
    overflow-y: auto;
    border: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
  }

  .rail.is-sheet-open .catalog-panel__handle {
    position: sticky;
    top: 0;
    z-index: 3;
    display: block;
    height: 20px;
    margin: 0 -12px;
    background: var(--surface);
  }

  .rail.is-sheet-open .catalog-panel__handle::before {
    display: block;
    width: 36px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 2px;
    background: var(--outline-strong);
    content: "";
  }

  .rail.is-sheet-open .search-box {
    top: 20px;
  }

  .lesson-extras {
    padding: 24px 16px 0;
  }

  .bottom-actions {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    display: block;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--outline);
    background: rgba(17, 17, 17, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .share-sheet {
    padding: 0;
    place-items: end stretch;
  }

  .share-sheet__panel {
    width: 100%;
    padding-bottom: env(safe-area-inset-bottom);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
  }

  .toast {
    top: calc(var(--sticky-top-offset) + 12px);
    right: 12px;
    left: 12px;
    max-width: none;
    transform: none;
  }

}

@media (max-width: 359px) {
  .site-header__inner {
    padding-right: 4px;
    padding-left: 8px;
  }

  .brand {
    gap: 6px;
  }

  .catalog-trigger__label {
    display: none;
  }

  .autoplay-toggle__label {
    display: none;
  }

  .app-shell {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .action-button {
    height: 44px;
  }

  .bottom-actions {
    padding-top: 4px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
  }
}

/* 移动端宽屏：页面内强制横向展示，不触发视频原生全屏。 */
@media (max-width: 1023px) {
  html.is-wide-mode,
  body.is-wide-mode {
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.is-wide-mode .player-area {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1000;
    display: block;
    width: 100vw;
    height: 100vh;
    width: 100dvw;
    height: 100dvh;
    margin: 0;
    background: #000;
    transform: translate(-50%, -50%);
  }

  body.is-wide-mode .video-stage {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }

  body.is-wide-mode .player-toolbar {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 3;
    border: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
  }

  body.is-wide-mode .player-toolbar,
  body.is-wide-mode .player-mode-button,
  body.is-wide-mode .autoplay-toggle {
    color: rgba(255, 255, 255, 0.9);
  }
}

@media (max-width: 1023px) and (orientation: portrait) {
  body.is-wide-mode .player-area {
    width: 100vh;
    height: 100vw;
    width: 100dvh;
    height: 100dvw;
    transform: translate(-50%, -50%) rotate(90deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
