/**
 * assets/css/front.css —— 前台：头部、目录、播放区、作业块、响应式
 *
 * 断点（移动优先）：
 *   手机 <768px 单列（上播放 → 下目录）
 *   平板 768–1024px 单列加宽
 *   PC  >1024px 左目录 / 右播放
 */

/* ---------------- 头部 ---------------- */
.site-header {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 28px 0 24px;
}
.brand {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .5px;
}
.brand-sub {
  margin: 8px 0 0;
  font-size: 14px;
  opacity: .92;
}
.brand-intro {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.7;
  opacity: .85;
  max-width: 720px;
}

/* ---------------- 布局 ---------------- */
.layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 48px;
}

/* ---------------- 播放区 ---------------- */
.player-col { order: 1; }
.catalog-col { order: 2; }

.player-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.player-title {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.player-stage {
  position: relative;
  width: 100%;
  background: #000;
  aspect-ratio: 16 / 9;
}
.player-stage.is-debug::after,
.player-mask {
  content: "";
}
.hs-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
/* 隐藏 webkit 下载按钮（双保险） */
.hs-video::-webkit-media-controls-download-button { display: none !important; }
.hs-video::-webkit-media-controls-enclosure { overflow: hidden; }

.player-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  font-size: 14px;
  padding: 16px;
  text-align: center;
}

/* 失焦遮罩 */
.player-mask {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, .96);
  color: #E5E7EB;
  font-size: 14px;
  z-index: 6;
  text-align: center;
  padding: 20px;
}
.player-mask.is-visible { display: flex; }

/* 反调试威慑提示层 */
.player-stage.is-debug::after {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, .94);
  color: #FCA5A5;
  font-size: 14px;
  z-index: 7;
  content: "检测到开发者工具：本页面仅供个人学习，请勿录制或传播。";
  text-align: center;
  padding: 20px;
}

/* 动态水印 */
.hs-watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}
.hs-watermark__text {
  position: absolute;
  font-size: 13px;
  color: #ffffff;
  opacity: .18;
  white-space: nowrap;
  text-shadow: 0 0 2px rgba(0, 0, 0, .4);
  transition: top .8s ease, left .8s ease, right .8s ease, bottom .8s ease;
}

.player-meta {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--muted-2);
  border-top: 1px solid var(--border);
}

/* ---------------- 目录 ---------------- */
.catalog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.catalog__error { padding: 24px 16px; color: var(--muted-2); text-align: center; }

.chapter { border-bottom: 1px solid var(--border); }
.chapter:last-child { border-bottom: 0; }

.chapter__head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 16px;
  background: #fff;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-size: 15px;
  color: var(--ink);
}
.chapter__head:hover { background: #FAFAFB; }
.chapter.is-open .chapter__head { background: var(--brand-soft); }
.chapter__no {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--brand);
  font-size: 14px;
}
.chapter__title {
  flex: 1 1 auto;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chapter__icon { color: var(--muted-2); font-size: 14px; }
.chapter__arrow {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 12px;
  transition: transform .15s ease;
}
.chapter.is-open .chapter__arrow { transform: rotate(180deg); }
.chapter__body { padding: 4px 0 8px; }

/* 课时行 */
.lesson { border-top: 1px solid #F1F2F4; }
.lesson-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background .15s;
}
.lesson-row:hover { background: #FAFAFB; }
.lesson-row.is-active { background: var(--brand-soft); }
.lesson-row__play {
  flex: 0 0 auto;
  width: 16px;
  color: var(--brand);
  font-size: 12px;
  text-align: center;
}
.lesson-row__play--empty { visibility: hidden; }
.lesson-row__title {
  flex: 1 1 auto;
  font-size: 14px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lesson-row__no { color: var(--muted-2); margin-right: 6px; font-size: 13px; }
.lesson-row__right { flex: 0 0 auto; }
.lesson-row__dur { font-size: 12px; color: var(--muted-2); }
.lesson-row__count {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  color: var(--brand);
  font-size: 12px;
  line-height: 18px;
}
.lesson-row__badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--muted);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
}

/* 无视频课时（不可点视觉） */
.lesson-row--novideo { cursor: default; }
.lesson-row--novideo:hover { background: transparent; }
.lesson-row--novideo .lesson-row__title { color: var(--muted); }

/* 多视频子条目 */
.lesson-sub { padding: 2px 0 6px; }
.lesson-sub__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 16px 6px 40px;
  cursor: pointer;
}
.lesson-sub__item:hover { background: #FAFAFB; }
.lesson-sub__play { color: var(--brand); font-size: 11px; }
.lesson-sub__title { flex: 1 1 auto; font-size: 13.5px; color: var(--item-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-sub__dur { font-size: 12px; color: var(--muted-2); }

/* 第十四章纯文字清单 */
.text-list { padding: 8px 16px 12px; }
.text-list__item { display: flex; gap: 8px; padding: 6px 0; color: var(--item-text); }
.text-list__no { flex: 0 0 auto; color: var(--brand); font-weight: 600; }
.text-list__content { flex: 1 1 auto; font-size: 14px; line-height: 1.7; }
.text-list__empty { color: var(--muted-2); }

/* 章节作业块（纯展示，无输入/提交） */
.hw-card {
  margin: 8px 16px 12px;
  padding: 12px 14px;
  background: var(--hw-bg);
  border-radius: var(--radius-sm);
  border: 1px solid #DDE7FF;
}
.hw-card__title { color: var(--brand); font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.hw-card__content { color: var(--ink-2); font-size: 14px; line-height: 1.7; }

/* ---------------- 悬浮目录（手机） ---------------- */
.toc-fab {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 50;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}
.toc-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: var(--shadow-lg);
  transform: translateY(110%);
  transition: transform .25s ease;
  padding: 12px 0 24px;
}
.toc-drawer.is-open { transform: translateY(0); }
.toc__title { padding: 8px 20px 12px; font-weight: 700; color: var(--ink); }
.toc__item {
  display: block;
  padding: 12px 20px;
  color: var(--ink-2);
  font-size: 14px;
  border-top: 1px solid #F1F2F4;
}
.toc__item:hover { background: #FAFAFB; }
.toc__close {
  position: absolute;
  right: 14px;
  top: 10px;
}

/* ---------------- 页脚 ---------------- */
.site-footer {
  padding: 20px 16px 32px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.8;
}
.site-footer a { color: var(--muted-2); }

/* ---------------- 预览条（后台预览用） ---------------- */
.preview-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #111827;
  color: #fff;
  padding: 10px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.preview-bar a { color: #93C5FD; }

/* ---------------- 响应式：平板 / PC ---------------- */
@media (min-width: 768px) {
  .player-col { order: 1; }
  .player-card { max-width: 720px; margin: 0 auto; }
  .catalog-col { order: 2; }
}

@media (min-width: 1025px) {
  .layout {
    flex-direction: row-reverse;   /* 左目录 / 右播放 */
    align-items: flex-start;
    gap: 20px;
  }
  .player-col {
    order: 2;
    flex: 1 1 auto;
    position: sticky;
    top: 16px;
  }
  .player-card { max-width: none; margin: 0; }
  .catalog-col {
    order: 1;
    flex: 0 0 420px;
    max-width: 420px;
  }
  .catalog {
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
  .toc-fab { display: none; }
}

/* ==========================================================================
   【授权模块】密码门 / 授权状态条 / 章节锁定
   ========================================================================== */

/* ---------------- 授权状态条 ---------------- */
.lic-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  line-height: 1.5;
}
.lic-bar--ok {
  background: #F0FDF4;
  border-color: #BBF7D0;
  color: #166534;
}
.lic-bar--none {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: #92400E;
}
.lic-bar__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
  background: currentColor;
}
.lic-bar__text {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-all;
}

/* ---------------- 锁定章节 ---------------- */
.chapter--locked .chapter__head {
  background: #F9FAFB;
}
.chapter--locked .chapter__title {
  color: var(--muted-2);
}
.chapter__lock {
  font-size: 12px;
  opacity: .85;
}

/* ---------------- 密码门弹窗 ---------------- */
.lic-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lic-modal[hidden] { display: none; }
.lic-modal__mask {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, .55);
  backdrop-filter: blur(2px);
}
.lic-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px 22px 18px;
}
.lic-modal__close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
}
.lic-modal__close:hover { color: var(--ink); }
.lic-modal__title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.lic-modal__desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted-2);
  line-height: 1.6;
}
.lic-modal__notice {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 13px;
}
.lic-modal__notice[hidden] { display: none; }
.lic-field { margin-bottom: 12px; }
.lic-field__label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.lic-field__opt {
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  color: var(--ink-3, #8a94a6);
  background: rgba(0, 0, 0, 0.05);
  vertical-align: middle;
}
.lic-modal__submit {
  width: 100%;
  margin-top: 4px;
}
.lic-modal__tip {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.lic-modal__err {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: #FEF2F2;
  color: var(--danger);
  font-size: 13px;
}
.lic-modal__err[hidden] { display: none; }
.lic-modal__foot {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
body.is-modal-open { overflow: hidden; }

/* ---------------- 移动端 ---------------- */
@media (max-width: 480px) {
  .lic-modal { padding: 10px; align-items: flex-end; }
  .lic-modal__panel { max-width: none; border-radius: 16px 16px 0 0; padding: 20px 16px 16px; }
  .lic-bar { font-size: 12px; padding: 8px 10px; }
}
