/* ============================================================
   月映 MoonPlay — 设计系统
   ------------------------------------------------------------
   方向：月映 · 冷调夜光
   底色是冷墨（墨蓝黑而不是暖炭），主色是"月光"冷蓝白。
   之所以从原来的暖琥珀换成冷调，有两个理由：
     1) 站名是「月映」，冷调月光才对应得上品牌语义；
     2) 暖炭 + 琥珀是 AI 生成影视站最容易撞车的那一套配色，换掉才有辨识度。
   想回到暖琥珀：只改下面 [data-theme] 里的 --accent / --moon 两个值即可，
   其余全部走令牌，不需要动组件。

   圆角规则（全站统一，不要再随手写别的值）：
     · 面   --r-card 16px   卡片 / 海报 / 面板 / 播放器 / 弹窗 / 缩略图
     · 控件 --r-ctl  10px   按钮 / 输入框 / 下拉 / 选集格 / tab
     · 标签 --r-pill 999px  chip / badge / 热词 / 搜索历史

   动效规范：只用 transform + opacity；不用 window scroll 监听；
   全部受 prefers-reduced-motion 管辖。
   ============================================================ */

/* ------------------------------------------------------------
   1. 令牌
   ------------------------------------------------------------ */
:root {
  /* 圆角 */
  --r-card: 16px;
  --r-ctl: 10px;
  --r-pill: 999px;

  /* 字体：全系统字体栈，不引外链字体
     （原版引了 fonts.googleapis.com，国内网络下会阻塞首屏渲染，
      且与"静态资源全部本地化"的项目约定冲突 —— 已移除） */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* 旧变量名别名 —— admin/ 下的内联样式依赖这些名字，
     改名前请先确认 admin/*.php 已经不引用了 */
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
}

/* ---- 暗色（品牌默认） ---- */
:root[data-theme="dark"] {
  color-scheme: dark;

  --ink-900: #0a0c11;   /* 页面底 */
  --ink-850: #0e1117;
  --ink-800: #12161e;   /* 面板 */
  --ink-750: #171c26;   /* 抬起 */
  --ink-700: #1d2330;
  --line:      #242b38;
  --line-soft: #1a202b;

  --text:       #e7eaf2;
  --text-dim:   #98a1b3;
  --text-faint: #636c7e;

  --accent:     #6c8cf5;
  --accent-hi:  #8fa8f8;
  --accent-dim: #3a4a7d;
  --on-accent:  #080b14;
  --moon:       #dfe7ff;   /* 品牌高光字（站名里的「月」） */

  --red:   #e06c75;
  --green: #7fb98a;

  --veil:   rgba(10, 12, 17, .78);   /* 遮挡层 */
  --shadow: 0 18px 50px rgba(0, 0, 0, .5);
  --glow:   rgba(108, 140, 245, .10);
  --sheen:  rgba(255, 255, 255, .06);
}

/* ---- 亮色 ---- */
:root[data-theme="light"] {
  color-scheme: light;

  --ink-900: #f6f7fa;
  --ink-850: #ffffff;
  --ink-800: #ffffff;
  --ink-750: #f1f3f8;
  --ink-700: #e8ebf2;
  --line:      #dfe3ec;
  --line-soft: #eaeef5;

  --text:       #161a23;
  --text-dim:   #525c6d;
  --text-faint: #858e9f;

  --accent:     #3b5bdb;
  --accent-hi:  #2c47b8;
  --accent-dim: #c3cef2;
  --on-accent:  #ffffff;
  --moon:       #24357f;

  --red:   #c0392b;
  --green: #3f8f57;

  --veil:   rgba(22, 26, 35, .42);
  --shadow: 0 16px 44px rgba(22, 26, 35, .12);
  --glow:   rgba(59, 91, 219, .07);
  --sheen:  rgba(255, 255, 255, .5);
}

/* 没有 data-theme 时（JS 未执行）跟随系统 */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --ink-900: #f6f7fa; --ink-850: #ffffff; --ink-800: #ffffff;
    --ink-750: #f1f3f8; --ink-700: #e8ebf2;
    --line: #dfe3ec; --line-soft: #eaeef5;
    --text: #161a23; --text-dim: #525c6d; --text-faint: #858e9f;
    --accent: #3b5bdb; --accent-hi: #2c47b8; --accent-dim: #c3cef2;
    --on-accent: #ffffff; --moon: #24357f;
    --red: #c0392b; --green: #3f8f57;
    --veil: rgba(22, 26, 35, .42);
    --shadow: 0 16px 44px rgba(22, 26, 35, .12);
    --glow: rgba(59, 91, 219, .07);
    --sheen: rgba(255, 255, 255, .5);
  }
}

/* 旧变量名映射 —— admin/ 与历史样式靠这些继续工作 */
:root {
  --bg:         var(--ink-900);
  --bg-raised:  var(--ink-750);
  --bg-panel:   var(--ink-800);
  --amber:      var(--accent);
  --amber-hi:   var(--accent-hi);
  --amber-dim:  var(--accent-dim);
  --radius:     var(--r-card);
  --radius-sm:  var(--r-ctl);
}

/* ------------------------------------------------------------
   2. 基础
   ------------------------------------------------------------ */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 460px at 50% -200px, var(--glow), transparent 62%),
    var(--ink-900);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }

::selection { background: var(--accent-dim); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* hidden 必须永远生效：
   历史 bug —— .player-fallback / .gesture-tip / .pctrl-speed-menu 的
   display:grid|flex 会盖掉 hidden，导致透明层挡住视频、空气泡常驻 */
[hidden] { display: none !important; }

.wrap { width: min(1240px, calc(100% - 40px)); margin: 0 auto; }
.page { flex: 1; padding-bottom: 88px; }

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

/* ------------------------------------------------------------
   3. 图标
   ------------------------------------------------------------ */
.ico {
  width: 1.15em; height: 1.15em;
  display: inline-block;
  vertical-align: -.18em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.ico--solid { fill: currentColor; stroke: none; }

/* ------------------------------------------------------------
   4. 页头
   ------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  /* 先给不透明底色兜底：color-mix() 在旧内核上整条声明会失效，
     如果不垫一层，页头背景会直接变透明 */
  background: var(--ink-900);
  background: color-mix(in srgb, var(--ink-900) 88%, transparent);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(14px) saturate(150%);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 68px;    /* 页头高度上限 80px */
}

.brand { display: flex; align-items: baseline; gap: 9px; flex-shrink: 0; }
.brand-cn {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .22em;
  line-height: 1;
  color: var(--text);
}
.brand-cn em { font-style: normal; color: var(--moon); }
.brand-en {
  font-size: 10px;
  letter-spacing: .3em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
  min-width: 0;
}
.nav a {
  padding: 7px 13px;
  border-radius: var(--r-ctl);
  color: var(--text-dim);
  font-size: 14px;
  white-space: nowrap;
  transition: color .18s ease-out, background-color .18s ease-out;
}
.nav a:hover { color: var(--text); background: var(--ink-750); }
.nav a.on { color: var(--text); background: var(--ink-750); }
.nav a.on::after {
  content: "";
  display: block;
  height: 2px;
  margin: 5px -13px -7px;
  border-radius: 2px;
  background: var(--accent);
}
.nav-user { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.nav-admin { display: grid; place-items: center; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  flex-shrink: 0;
  border: 0;
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--text-dim);
  transition: color .18s ease-out, background-color .18s ease-out;
}
.icon-btn:hover { color: var(--text); background: var(--ink-750); }
.icon-btn .ico { width: 18px; height: 18px; }

.header-tail { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.quick-search { display: flex; }
.quick-search input {
  width: 190px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--ink-750);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .18s ease-out, width .22s ease-out, background-color .18s ease-out;
}
.quick-search input::placeholder { color: var(--text-faint); }
.quick-search input:focus {
  width: 240px;
  border-color: var(--accent);
  background: var(--ink-800);
}

/* ------------------------------------------------------------
   5. 基础控件
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--ink-750);
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;      /* CTA 不允许换行 */
  transition: border-color .18s ease-out, background-color .18s ease-out,
              transform .12s ease-out, color .18s ease-out;
}
.btn:hover { border-color: var(--text-faint); background: var(--ink-700); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.btn.primary:hover { background: var(--accent-hi); border-color: transparent; }
.btn.ghost-danger { background: transparent; color: var(--text-dim); }
.btn.ghost-danger:hover { color: var(--red); border-color: var(--red); background: transparent; }

.chip {
  padding: 3px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}
.chip.gold { color: var(--accent-hi); border-color: var(--accent-dim); }

/* 分段控件（选集 / 换源、收藏 / 记录、线路切换共用） */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button,
.play-group-btn,
.side-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--ink-750);
  color: var(--text-dim);
  font-size: 13px;
  transition: color .15s ease-out, border-color .15s ease-out,
              background-color .15s ease-out, transform .12s ease-out;
}
.seg button:hover,
.play-group-btn:hover,
.side-tab:hover { color: var(--text); border-color: var(--text-faint); }
.seg button:active,
.play-group-btn:active,
.side-tab:active { transform: translateY(1px); }
.seg button.on,
.play-group-btn.on,
.side-tab.on {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
/* 危险动作（清空记录之类）只染字色，不做成红色实心按钮抢视线 */
.is-danger { color: var(--red); }
.is-danger:hover { color: var(--red); border-color: var(--red); }

/* ------------------------------------------------------------
   6. 首页 Hero（居中单栏）
   ------------------------------------------------------------ */
.hero {
  padding: 64px 0 52px;      /* 顶部内边距 ≤ 96px，内容不悬空 */
  text-align: center;
}

.hero-copy {
  max-width: 620px;
  margin: 0 auto;
}
.hero h1 {
  margin: 0 0 26px;
  font-size: clamp(30px, 4.2vw, 50px);
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -.01em;
}
.hero h1 em { font-style: normal; color: var(--moon); }

.big-search {
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--ink-800);
  transition: border-color .2s ease-out, box-shadow .2s ease-out;
}
.big-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--glow);
}
.big-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 12px 16px;
  color: var(--text);
  outline: none;
}
.big-search input::placeholder { color: var(--text-faint); }
.big-search button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  padding: 0 22px;
  border-radius: calc(var(--r-ctl) - 3px);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  white-space: nowrap;
  transition: background-color .15s ease-out, transform .12s ease-out;
}
.big-search button:hover { background: var(--accent-hi); }
.big-search button:active { transform: translateY(1px); }

.hot-words {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-faint);
}
.hot-words a {
  padding: 4px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  color: var(--text-dim);
  transition: color .15s ease-out, border-color .15s ease-out;
}
.hot-words a:hover { color: var(--accent-hi); border-color: var(--accent-dim); }

/* ------------------------------------------------------------
   7. 区块与影片网格
   ------------------------------------------------------------ */
.section { margin-top: 54px; }

/* 区块标题只有两种形态，不要再生第三种：
   .section-head  竖排 —— 标题 + 说明（说明紧贴标题下方，不做右上角浮空小字）
   .toolbar       横排 —— 标题 + 右侧操作控件（源切换 tab 之类） */
.section-head {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 20px;
}
.section-head h2,
.toolbar h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .04em;
}
.section-head .sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-faint);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.toolbar .tabs,
.toolbar .play-groups { margin-left: auto; }

.toolbar .sub { font-size: 12.5px; color: var(--text-faint); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }

.tabs button {
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  transition: color .15s ease-out, border-color .15s ease-out, background-color .15s ease-out;
}
.tabs button:hover { color: var(--text); border-color: var(--text-faint); }
.tabs button.on {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
/* 健康检查异常的源：红边 + 一个小圆点（这里的小圆点承载真实状态，不是装饰） */
.tabs button.unhealthy { border-color: var(--red); color: var(--red); }
.tabs button.unhealthy.on { color: var(--on-accent); background: var(--red); border-color: var(--red); }
.tabs button .dot {
  display: inline-block;
  width: 5px; height: 5px;
  margin-left: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 26px 18px;
}

/* ---- 海报卡片 ---- */
.card { display: block; }
.card .poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--ink-800);
  border: 1px solid var(--line-soft);
  transition: transform .28s cubic-bezier(.16, 1, .3, 1),
              border-color .28s ease-out, box-shadow .28s ease-out;
}
.card:hover .poster {
  transform: translateY(-5px);
  border-color: var(--accent-dim);
  box-shadow: var(--shadow);
}
.card .poster img { width: 100%; height: 100%; object-fit: cover; }
.card .poster .placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--text-faint);
}
/* 海报上只保留一个角标：更新状态（完结 / HD / 集数），这是内容不是装饰 */
.card .remarks {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: var(--veil);
  color: var(--text);
  font-size: 11px;
  backdrop-filter: blur(6px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card .title {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card:hover .title { color: var(--accent-hi); }
.card .meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 可换源数量：用间距而不是第二个「·」分隔，保持一行最多一个间隔符 */
.card .meta .src-count { margin-left: 7px; color: var(--accent); }

/* ------------------------------------------------------------
   8. 加载 / 空态 / 错误
   ------------------------------------------------------------ */
/* 骨架屏：形状与最终卡片一致，避免"转圈 → 内容"的跳动 */
.skel-card { display: block; }
.skel-poster {
  aspect-ratio: 2 / 3;
  border-radius: var(--r-card);
  background: var(--ink-800);
  border: 1px solid var(--line-soft);
}
.skel-line {
  height: 11px;
  margin-top: 10px;
  border-radius: var(--r-pill);
  background: var(--ink-800);
}
.skel-line.short { width: 55%; height: 9px; margin-top: 6px; }

.shimmer { position: relative; overflow: hidden; }
.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--sheen), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

.loading {
  padding: 56px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}
.loading .reel {
  display: inline-block;
  width: 22px; height: 22px;
  margin-right: 10px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -6px;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  padding: 64px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
}
.grid .empty,
.record-list .empty {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}
/* 空态用一个大字做视觉锚点（映 / 心 / 痕 / 憾），是这个站的固定语言 */
.empty .empty-icon {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-faint);
  opacity: .55;
  margin-bottom: 14px;
}
.empty .hint { margin-top: 8px; font-size: 12.5px; color: var(--text-faint); opacity: .85; }
.empty .hint a { color: var(--accent); }
.empty .hint a:hover { color: var(--accent-hi); }

/* ------------------------------------------------------------
   9. 搜索页
   ------------------------------------------------------------ */
.search-hero { padding-top: 34px; }
.search-hero .big-search { margin: 0 auto; }
.big-search--slim { max-width: 560px; }
.big-search--slim input { padding: 11px 16px; font-size: 14px; }
.big-search--slim button { padding: 0 20px; font-size: 14px; }

.search-history { max-width: 560px; margin: 20px auto 0; }
.sh-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-faint);
}
.sh-head button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0; background: none; padding: 0;
  color: var(--text-faint); font-size: 12px;
}
.sh-head button .ico { width: 1em; height: 1em; }
.sh-head button:hover { color: var(--red); }
.sh-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px 3px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--ink-750);
}
.sh-item .sh-kw {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
  font-size: 13px;
}
.sh-item .sh-kw:hover { color: var(--accent-hi); }
.sh-item .sh-del {
  border: 0; background: none; padding: 0 4px;
  color: var(--text-faint); font-size: 15px; line-height: 1;
}
.sh-item .sh-del:hover { color: var(--red); }

/* 次级说明文字（例如"以下源暂时无响应"） */
.note-soft {
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-faint);
}

/* ------------------------------------------------------------
   10. 详情页
   ------------------------------------------------------------ */
.detail-hero {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 36px;
  padding: 44px 0 8px;
}
.detail-poster {
  aspect-ratio: 2 / 3;
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--ink-800);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }

.detail-info { min-width: 0; padding-top: 4px; }
.detail-info h1 {
  margin: 0 0 14px;
  font-size: clamp(24px, 3.2vw, 33px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.005em;
}
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.info-line { margin: 5px 0; font-size: 13px; color: var(--text-dim); }
.info-line b { margin-right: 8px; color: var(--text-faint); font-weight: 500; }

.desc {
  margin: 16px 0 0;
  max-width: 64ch;
  font-size: 14px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.desc.open { -webkit-line-clamp: unset; }
.desc-toggle {
  margin-top: 8px;
  border: 0; background: none; padding: 0;
  color: var(--accent);
  font-size: 12.5px;
}
.desc-toggle:hover { color: var(--accent-hi); }

.detail-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.play-panel { margin-top: 44px; }
.play-groups { margin-bottom: 0; }
.episodes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  gap: 9px;
}
.episodes a {
  padding: 9px 6px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-ctl);
  background: var(--ink-750);
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .15s ease-out, border-color .15s ease-out, background-color .15s ease-out;
}
.episodes a:hover { color: var(--text); border-color: var(--text-faint); }
.episodes a.played { color: var(--text-faint); }
.episodes a.current {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

/* 换源 */
.switch-panel { margin-top: 40px; }
.switch-list { display: flex; flex-direction: column; gap: 10px; }
.switch-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  background: var(--ink-800);
  transition: border-color .18s ease-out, transform .12s ease-out;
}
.switch-item:hover { border-color: var(--accent-dim); }
.switch-item:active { transform: translateY(1px); }
.switch-item .src-name { min-width: 76px; color: var(--accent-hi); font-size: 13px; }
.switch-item .v-name { font-size: 14px; }
.switch-item .v-meta { font-size: 12px; color: var(--text-faint); }
.switch-item .go { margin-left: auto; color: var(--text-faint); font-size: 12px; }

/* ------------------------------------------------------------
   11. 播放页
   ------------------------------------------------------------ */
.player-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding-top: 28px;
}
.player-main { flex: 1; min-width: 0; }
.player-box {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
  background: #000;
}
.player-box video { width: 100%; height: 100%; background: #000; touch-action: none; }
.player-box.idle { cursor: none; }

.player-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* --- 自定义控制条 --- */
.pctrl {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  padding: 34px 14px 8px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .85));
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease-out;
}
.player-box.show-ctrl .pctrl,
.player-box.paused .pctrl { opacity: 1; pointer-events: auto; }

.pctrl-progress {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .22);
  cursor: pointer;
  transition: height .15s ease-out;
}
.pctrl-progress:hover { height: 7px; }
.pctrl-buffer,
.pctrl-played {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: 2px;
}
.pctrl-buffer { background: rgba(255, 255, 255, .32); }
.pctrl-played { background: var(--accent); }
.pctrl-dot {
  position: absolute;
  right: -6px; top: 50%;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%) scale(0);
  transition: transform .15s ease-out;
}
.pctrl-progress:hover .pctrl-dot { transform: translateY(-50%) scale(1); }

.pctrl-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  color: #fff;
}
.pctrl-buttons button {
  display: grid;
  place-items: center;
  padding: 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: rgba(255, 255, 255, .88);
  transition: color .15s ease-out, background-color .15s ease-out;
}
.pctrl-buttons button:hover { color: #fff; background: rgba(255, 255, 255, .14); }
.pctrl-buttons svg { width: 21px; height: 21px; fill: currentColor; display: block; }
.pctrl-time {
  margin: 0 8px;
  color: rgba(255, 255, 255, .85);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pctrl-spacer { flex: 1; }

.pctrl-vol { display: flex; align-items: center; gap: 2px; }
.pctrl-vol input[type="range"] { width: 74px; accent-color: var(--accent); cursor: pointer; }

.pctrl-speed { position: relative; }
.pctrl-speed > button { font-size: 12.5px; font-weight: 600; min-width: 46px; }
#cSkipI, #cSkipO, #cSkipC { min-width: 0; padding: 6px 8px; font-size: 12px; font-weight: 600; }
#cSkipC { font-size: 13px; }

.pctrl-speed-menu {
  position: absolute;
  right: 0; bottom: 42px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 72px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--r-ctl);
  background: rgba(12, 14, 20, .95);
  backdrop-filter: blur(8px);
}
.pctrl-speed-menu[hidden] { display: none; }
.pctrl-speed-menu button {
  justify-content: center;
  padding: 7px 12px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .82);
}
.pctrl-speed-menu button.on { color: var(--accent-hi); font-weight: 700; }

.pctrl-flash {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}
.pctrl-flash span {
  display: grid;
  place-items: center;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
}
.pctrl-flash svg { width: 32px; height: 32px; fill: #fff; }
.pctrl-flash.flash { animation: flashfade .55s ease-out forwards; }
@keyframes flashfade { from { opacity: 1; } to { opacity: 0; } }

/* 浮动「跳过片头」 */
.skip-intro-btn {
  position: absolute;
  right: 18px; bottom: 88px;
  z-index: 7;
  padding: 9px 18px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: var(--r-ctl);
  background: rgba(0, 0, 0, .74);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: background-color .15s ease-out, border-color .15s ease-out;
}
.skip-intro-btn:hover { background: rgba(0, 0, 0, .9); border-color: #fff; }

/* 移动端手势提示 */
.gesture-tip {
  position: absolute;
  top: 50%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 108px;
  padding: 12px 16px;
  border-radius: var(--r-card);
  background: rgba(0, 0, 0, .7);
  color: #fff;
  pointer-events: none;
  backdrop-filter: blur(6px);
  transform: translateY(-50%);
}
.gesture-tip.side-left { left: 24px; }
.gesture-tip.side-right { right: 24px; }
.gesture-tip.side-center { left: 50%; transform: translate(-50%, -50%); }
.gesture-tip .g-icon { font-size: 20px; line-height: 1.2; }
.gesture-tip .g-big { font-size: 15px; font-weight: 700; white-space: nowrap; }
.gesture-tip .g-sub { font-size: 11.5px; color: rgba(255, 255, 255, .68); white-space: nowrap; }

.player-meta { padding: 18px 2px 0; }
.player-meta h1 { margin: 0 0 8px; font-size: 21px; font-weight: 700; letter-spacing: .01em; }
.player-meta .now-playing { font-size: 13px; color: var(--accent-hi); }
.player-ops { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.player-ops .btn { padding: 8px 16px; font-size: 13px; }

/* --- 侧栏 --- */
.ep-sidebar {
  width: 304px;
  flex-shrink: 0;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  background: var(--ink-800);
}
.ep-sidebar h3 {
  position: sticky;
  top: -16px;
  margin: 0 0 12px;
  padding: 6px 0;
  background: var(--ink-800);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
}
.ep-sidebar .episodes { grid-template-columns: repeat(3, 1fr); }

.side-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.side-tab { flex: 1; padding: 8px 0; text-align: center; }

/* 换源 */
.alts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.alts-speed-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  transition: background-color .15s ease-out, color .15s ease-out;
}
.alts-speed-btn:hover { background: var(--accent); color: var(--on-accent); }
.alts-speed-btn:disabled { opacity: .55; cursor: wait; }
.alt-list { display: flex; flex-direction: column; gap: 8px; }
.alts-loading { padding: 14px 2px; color: var(--text-faint); font-size: 12.5px; }
.alt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--ink-750);
}
.alt-info b { display: block; font-size: 13px; }
.alt-meta { font-size: 11.5px; color: var(--text-faint); }
.alt-act { display: flex; align-items: center; gap: 8px; }
.spd {
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  white-space: nowrap;
}
.spd.unk { background: var(--ink-700); color: var(--text-faint); }
.spd.g { background: var(--ink-700); background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.spd.y { background: var(--ink-700); background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-hi); }
.spd.r { background: var(--ink-700); background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.alt-go {
  padding: 4px 14px;
  border: 1px solid var(--green);
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--green);
  font-size: 12px;
  transition: background-color .15s ease-out, color .15s ease-out;
}
.alt-go:hover { background: var(--green); color: var(--on-accent); }
.alts-tip { margin-top: 14px; font-size: 11.5px; line-height: 1.7; color: var(--text-faint); }

/* ------------------------------------------------------------
   12. 我的
   ------------------------------------------------------------ */
.account-bar { margin-bottom: 24px; }
.acct-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  background: var(--ink-800);
}
.acct-name { font-size: 15px; font-weight: 600; }
.acct-sub { margin-top: 3px; font-size: 12px; color: var(--text-faint); }
.acct-ops { display: flex; gap: 8px; flex-shrink: 0; }
.acct-ops .btn { padding: 7px 15px; font-size: 13px; }

.mine-tabs { display: flex; align-items: center; gap: 10px; margin: 34px 0 22px; }
.mine-tabs .spacer { flex: 1; }

.record-list { display: flex; flex-direction: column; gap: 12px; }
.record-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  background: var(--ink-800);
  transition: border-color .18s ease-out;
}
.record-item:hover { border-color: var(--accent-dim); }
.record-item .thumb {
  width: 60px;
  flex-shrink: 0;
  aspect-ratio: 2 / 3;
  border-radius: var(--r-ctl);
  overflow: hidden;
  background: var(--ink-750);
}
.record-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.record-item .r-body { min-width: 0; }
.record-item .r-name { font-size: 15px; font-weight: 600; }
.record-item .r-name:hover { color: var(--accent-hi); }
.record-item .r-meta { margin-top: 3px; font-size: 12px; color: var(--text-faint); }
.record-item .r-ops { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }
.record-item .r-ops .btn { padding: 6px 14px; font-size: 12px; }
/* 同一部影视的其它采集源（可在卡片上就地切换续看） */
.record-item .r-src { margin-top: 7px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.record-item .r-src .tag-label { font-size: 11px; color: var(--text-faint); }
.record-item .r-src .src-tag {
  font-size: 11px;
  line-height: 1.7;
  padding: 1px 9px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  color: var(--text-faint);
  transition: color .16s ease-out, border-color .16s ease-out;
}
.record-item .r-src a.src-tag:hover { color: var(--accent-hi); border-color: var(--accent-dim); }

/* ------------------------------------------------------------
   13. 登录 / 注册弹窗
   ------------------------------------------------------------ */
.auth-mask {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--veil);
  backdrop-filter: blur(4px);
}
.auth-modal {
  position: relative;
  width: min(400px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--ink-800);
  box-shadow: var(--shadow);
}
.auth-close {
  position: absolute;
  right: 10px; top: 10px;
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border: 0;
  border-radius: var(--r-ctl);
  background: none;
  color: var(--text-faint);
  line-height: 1;
  transition: color .15s ease-out, background-color .15s ease-out;
}
.auth-close .ico { width: 17px; height: 17px; }
.auth-close:hover { color: var(--text); background: var(--ink-750); }
.auth-title { margin: 0 0 18px; font-size: 18px; font-weight: 700; letter-spacing: .04em; }
.auth-tabs { display: flex; gap: 6px; }
.auth-tabs button {
  flex: 1;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
}
.auth-tabs button.on {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.auth-form label {
  display: block;
  margin: 16px 0 6px;
  font-size: 12px;
  color: var(--text-dim);
}
.auth-form input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--ink-750);
  color: var(--text);
  outline: none;
  transition: border-color .18s ease-out;
}
.auth-form input::placeholder { color: var(--text-faint); }
.auth-form input:focus { border-color: var(--accent); }
.auth-submit { width: 100%; margin-top: 24px; }
.auth-err {
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid var(--red);
  border-radius: var(--r-ctl);
  color: var(--red);
  font-size: 12.5px;
}
.auth-tip { margin: 16px 0 0; font-size: 12px; line-height: 1.7; color: var(--text-faint); }

/* ------------------------------------------------------------
   14. Toast / 页脚
   ------------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  z-index: 200;
  padding: 10px 22px;
  border: 1px solid var(--accent-dim);
  border-radius: var(--r-pill);
  background: var(--ink-800);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  animation: toast-in .22s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.site-footer {
  padding: 30px 0 36px;
  border-top: 1px solid var(--line-soft);
  background: var(--ink-850);
}
.footer-brand {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--text-dim);
}
.footer-note { margin: 0; font-size: 12px; line-height: 1.8; color: var(--text-faint); }
/* ICP 备案号（config('site.icp') 为空时整行不渲染）；按国内惯例不抢视觉，hover 才提亮 */
.footer-icp {
  display: inline-block;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-faint);
  transition: color .15s ease-out;
}
.footer-icp:hover { color: var(--text-dim); }

/* ------------------------------------------------------------
   15. 动效
   ------------------------------------------------------------ */
/* 滚动显现：用 IntersectionObserver 加 .in，不用 scroll 监听
   初始 opacity:0 只在 .js 下生效 —— 脚本挂掉时内容照常可见 */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s cubic-bezier(.16, 1, .3, 1),
              transform .6s cubic-bezier(.16, 1, .3, 1);
}
.js .reveal.in { opacity: 1; transform: none; }

/* 首屏入场：只作用于 Hero，错开出现 */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * {
    animation: rise-in .7s cubic-bezier(.16, 1, .3, 1) both;
  }
  .hero-copy > *:nth-child(1) { animation-delay: .04s; }
  .hero-copy > *:nth-child(2) { animation-delay: .12s; }
  .hero-copy > *:nth-child(3) { animation-delay: .20s; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .shimmer::after { display: none; }
}

/* ------------------------------------------------------------
   16. 响应式
   ------------------------------------------------------------ */
@media (max-width: 1100px) {
  .quick-search { display: none; }
}

@media (max-width: 980px) {
  .hero { padding: 44px 0 36px; }

  .detail-hero { grid-template-columns: 168px minmax(0, 1fr); gap: 24px; }

  .player-layout { flex-direction: column; }
  .ep-sidebar { width: 100%; max-height: 340px; }
}

@media (max-width: 860px) {
  .detail-hero { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .detail-poster { width: 176px; }
}

@media (max-width: 720px) {
  .wrap { width: calc(100% - 28px); }
  /* 窄屏导航横向滚动，保证不换行 */
  .nav {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .header-inner { gap: 10px; }
  .brand-en { display: none; }
  .section-head { flex-wrap: wrap; }
  .section-head .line { display: none; }
}

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 20px 12px; }
  .pctrl-vol input[type="range"] { display: none; }
  .pctrl-speed { display: none; }
  .record-item { flex-wrap: wrap; }
  .record-item .r-ops { margin-left: 0; width: 100%; }
}

/* ------------------------------------------------------------
   17. 后台兼容层
   后台（admin/*.php）自带内联样式、且不在本次改造范围内。
   下面这些选择器是它仍在使用的，删掉会让后台视觉缺一块。
   ------------------------------------------------------------ */
.filmstrip {
  height: 12px;
  border-bottom: 1px solid var(--line-soft);
  background:
    repeating-linear-gradient(90deg,
      transparent 0 10px,
      var(--line) 10px 20px) center / 100% 5px no-repeat,
    var(--ink-750);
}
