:root {
  --bg: #0f1115;
  --bg2: #161a21;
  --bg3: #1d222b;
  --line: #272d38;
  --txt: #e8ecf2;
  --txt2: #9aa4b2;
  --txt3: #6b7484;
  --brand: #ff5c39;
  --brand2: #ff8a3d;
  --green: #35c46b;
  --radius: 10px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; padding-bottom: calc(58px + var(--sab)); }
a { color: inherit; text-decoration: none; }
img { display: block; }
button, input { font-family: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--sat)) calc(14px + var(--sar)) 10px calc(14px + var(--sal));
  background: rgba(15, 17, 21, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; flex: none; }
.logo i {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  display: grid; place-items: center; font-style: normal;
  font-size: 13px; font-weight: 800; color: #fff;
}
.search { flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 14px; height: 38px; max-width: 460px; }
.search input { flex: 1; background: none; border: 0; outline: 0; color: var(--txt); font-size: 14px; min-width: 0; }
.search input::placeholder { color: var(--txt2); }
.search button { background: none; border: 0; color: var(--txt2); cursor: pointer; padding: 4px; display: grid; place-items: center; }

.nav { display: none; gap: 4px; margin-left: 8px; }
.nav a { padding: 7px 14px; border-radius: 999px; color: var(--txt2); font-size: 14px; white-space: nowrap; }
.nav a.on { background: var(--bg3); color: var(--txt); font-weight: 500; }

main { padding: 0 calc(14px + var(--sar)) 24px calc(14px + var(--sal)); max-width: 1400px; margin: 0 auto; }

.hero { position: relative; margin: 14px 0 22px; border-radius: 14px; overflow: hidden; background: var(--bg2); }
.hero-slides { display: flex; transition: transform .5s cubic-bezier(.4,0,.2,1); }
.hero-slide { position: relative; min-width: 100%; aspect-ratio: 16 / 9; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slide::after { content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(15,17,21,.96) 4%, rgba(15,17,21,.35) 45%, transparent 75%); }
.hero-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 20px; z-index: 2; }
.hero-info h2 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.hero-info p { margin: 0 0 12px; color: var(--txt2); font-size: 13px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 640px; }
.hero-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.hero-play { display: inline-flex; align-items: center; gap: 7px; padding: 9px 22px; border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; font-weight: 600; font-size: 14px; }
.hero-dots { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 6px; z-index: 3; }
.hero-dots b { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.35); cursor: pointer; }
.hero-dots b.on { background: var(--brand); width: 18px; border-radius: 4px; }

.sec { margin-bottom: 26px; }
.sec-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sec-hd h3 { margin: 0; font-size: 17px; font-weight: 600; }
.sec-hd h3::before { content: ''; display: inline-block; width: 3px; height: 15px; border-radius: 2px;
  background: linear-gradient(var(--brand), var(--brand2)); margin-right: 9px; vertical-align: -2px; }
.sec-hd a { color: var(--txt2); font-size: 13px; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(106px, 1fr)); }
.grid.big { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; } }

.card { display: block; }
.card .ph { position: relative; border-radius: 8px; overflow: hidden; background: var(--bg3); aspect-ratio: 2 / 3; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.card:active .ph img { transform: scale(1.05); }
.card .score { position: absolute; left: 6px; top: 6px; padding: 2px 6px; border-radius: 5px;
  font-size: 11px; font-weight: 700; color: #fff; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }
.card .note { position: absolute; right: 6px; bottom: 6px; padding: 2px 6px; border-radius: 5px;
  font-size: 11px; color: #fff; background: rgba(0,0,0,.55); }
.card .nm { margin-top: 7px; font-size: 13px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .sub { margin-top: 2px; font-size: 11px; color: var(--txt2); }

.row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.row::-webkit-scrollbar { height: 0; }
.row .card { flex: none; width: 108px; scroll-snap-align: start; }
@media (min-width: 640px) { .row .card { width: 132px; } }

.bar { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; }
.bar::-webkit-scrollbar { height: 0; }
.bar a { flex: none; padding: 7px 16px; border-radius: 999px; background: var(--bg2);
  border: 1px solid var(--line); color: var(--txt2); font-size: 13px; }
.bar a.on { background: linear-gradient(135deg, var(--brand), var(--brand2)); border-color: transparent;
  color: #fff; font-weight: 600; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 26px 0 8px; color: var(--txt2); }
.pager button { padding: 9px 22px; border-radius: 999px; background: var(--bg3); border: 1px solid var(--line);
  color: var(--txt); font-size: 14px; cursor: pointer; }
.pager button:disabled { opacity: .35; cursor: not-allowed; }

.hero-detail { position: relative; margin: 14px 0 18px; border-radius: 14px; overflow: hidden; }
.hero-detail .bg { position: absolute; inset: 0; }
.hero-detail .bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(26px) saturate(1.3); transform: scale(1.15); opacity: .5; }
.hero-detail .bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(15,17,21,.55), var(--bg) 92%); }
.detail-in { position: relative; display: flex; gap: 16px; padding: 22px 20px; }
.detail-in .poster { width: 108px; flex: none; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.5); aspect-ratio: 2/3; }
.detail-in .poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-in .meta { min-width: 0; }
.detail-in h1 { margin: 0 0 8px; font-size: 21px; font-weight: 700; }
.detail-in .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.detail-in .tags span { padding: 3px 9px; border-radius: 6px; background: rgba(255,255,255,.08); font-size: 12px; color: var(--txt2); }
.detail-in .desc { color: var(--txt2); font-size: 13px; line-height: 1.65; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.detail-in .desc.open { -webkit-line-clamp: unset; }

.player-wrap { background: #000; border-radius: 12px; overflow: hidden; position: relative; }
.player-wrap video { width: 100%; max-height: 76vh; display: block; background: #000; object-fit: contain; }
.player-tip { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 14px;
  background: rgba(0,0,0,.75); text-align: center; padding: 20px; line-height: 1.7; z-index: 3; }

/* 播放器控制层 */
.pv-layer { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column;
  transition: opacity .22s; }
.pv-layer.hide { opacity: 0; pointer-events: none; }
.pv-big { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 66px; height: 66px; border: 0; border-radius: 50%; padding: 0; cursor: pointer;
  background: rgba(0,0,0,.5); color: #fff; display: grid; place-items: center;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.pv-big svg { width: 30px; height: 30px; fill: currentColor; margin-left: 3px; }
.pv-ctl { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 8px 10px 10px;
  background: linear-gradient(to top, rgba(0,0,0,.78), rgba(0,0,0,.25) 70%, transparent); }
.pv-btn { flex: none; width: 34px; height: 34px; padding: 0; border: 0; background: transparent;
  color: #fff; cursor: pointer; display: grid; place-items: center; }
.pv-btn svg { width: 22px; height: 22px; fill: currentColor; }
.pv-time { flex: none; color: #fff; font-size: 12px; opacity: .92; font-variant-numeric: tabular-nums; }
.pv-seek { position: relative; flex: 1; height: 26px; cursor: pointer; touch-action: none; }
.pv-seek::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 3px;
  transform: translateY(-50%); border-radius: 2px; background: rgba(255,255,255,.26); }
.pv-buf, .pv-cur { position: absolute; left: 0; top: 50%; height: 3px; transform: translateY(-50%);
  border-radius: 2px; width: 0; }
.pv-buf { background: rgba(255,255,255,.42); }
.pv-cur { background: var(--brand); }
.pv-knob { position: absolute; top: 50%; left: 0; width: 12px; height: 12px; border-radius: 50%;
  background: var(--brand); transform: translate(-50%,-50%); box-shadow: 0 0 6px rgba(0,0,0,.5); }
/* 全屏态：标准 Fullscreen API（:fullscreen）+ CSS 伪全屏（.fs）双轨 */
.player-wrap.fs, .player-wrap:fullscreen, .player-wrap:-webkit-full-screen {
  position: fixed; inset: 0; z-index: 999; border-radius: 0; height: 100%; width: 100%; }
.player-wrap.fs video, .player-wrap:fullscreen video, .player-wrap:-webkit-full-screen video {
  height: 100%; max-height: none; width: 100%; object-fit: contain; }
html.fs-lock, html.fs-lock body { overflow: hidden; height: 100%; }
.player-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg2); flex-wrap: wrap; }
.player-bar .q { padding: 6px 14px; border-radius: 8px; background: var(--bg3); border: 1px solid var(--line);
  color: var(--txt2); font-size: 13px; cursor: pointer; }
.player-bar .q.on { background: var(--brand); border-color: transparent; color: #fff; font-weight: 600; }
.player-bar .q.lock { opacity: .45; }
.player-bar .sp { flex: 1; }
.player-bar .nav-b { padding: 6px 14px; border-radius: 8px; background: var(--bg3); border: 1px solid var(--line); color: var(--txt); font-size: 13px; cursor: pointer; }

.eps { margin-top: 18px; }
.eps-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.eps-hd h3 { margin: 0; font-size: 16px; font-weight: 600; }
.eps-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.eps-list a { padding: 10px 4px; text-align: center; border-radius: 8px; background: var(--bg2);
  border: 1px solid var(--line); font-size: 13px; color: var(--txt2); }
.eps-list a.on { background: linear-gradient(135deg, var(--brand), var(--brand2)); border-color: transparent; color: #fff; font-weight: 600; }

.empty { text-align: center; padding: 70px 20px; color: var(--txt2); }
.empty b { display: block; font-size: 40px; margin-bottom: 12px; opacity: .35; }
.empty .retry { display: inline-block; margin-top: 18px; padding: 8px 26px; border: 1px solid #3a3f4a; border-radius: 20px; color: var(--txt1); cursor: pointer; }
.empty .retry:active { background: #23262e; }

.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex;
  background: rgba(22,26,33,.97); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding-bottom: var(--sab); }
.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 9px; color: var(--txt2); font-size: 11px; }
.bottom a svg { width: 21px; height: 21px; }
.bottom a.on { color: var(--brand); }

.loading { display: grid; place-items: center; padding: 60px 0; color: var(--txt2); }
.spin { width: 26px; height: 26px; border: 2.5px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

@media (min-width: 900px) {
  .nav { display: flex; }
  .bottom { display: none; }
  body { padding-bottom: 24px; }
  .detail-in .poster { width: 140px; }
  .detail-in h1 { font-size: 26px; }
}
