/* ============================================================
   星影 · 设计系统
   深色为主（影院语境，海报要跳出来），浅色为可选
   色彩：近黑底 + 海报 + 单一金色强调
   字阶：56 / 40 / 20 / 15 / 13 / 11
   ============================================================ */

:root{
  --bg:#07080b;
  --bg-soft:#0b0d12;
  --surface:#101319;
  --surface-2:#151922;
  --line:rgba(255,255,255,.075);
  --line-2:rgba(255,255,255,.14);
  --fg:#f0f2f7;
  --fg-2:#b7bdcc;
  --fg-3:#9aa2b4;
  --gold:#e8b862;
  --gold-soft:rgba(232,184,98,.13);
  --gold-line:rgba(232,184,98,.42);
  --danger:#ff6b6b;
  --ok:#4ade80;

  --r-sm:10px; --r-md:14px; --r-lg:18px;
  --gut:clamp(16px, 3.2vw, 44px);
  --maxw:1440px;
  --ease:cubic-bezier(.22,.61,.36,1);

  --shadow-card:0 18px 40px -18px rgba(0,0,0,.85);
  --shadow-pop:0 30px 70px -25px rgba(0,0,0,.9);
}

html[data-theme="light"]{
  --bg:#f7f8fa;
  --bg-soft:#fff;
  --surface:#fff;
  --surface-2:#f1f3f7;
  --line:rgba(16,20,30,.09);
  --line-2:rgba(16,20,30,.16);
  --fg:#11141b;
  --fg-2:#5a6273;
  --fg-3:#8a91a1;
  --gold:#a8761c;
  --gold-soft:rgba(168,118,28,.12);
  --gold-line:rgba(168,118,28,.4);
  --shadow-card:0 14px 34px -18px rgba(18,24,40,.3);
  --shadow-pop:0 26px 60px -26px rgba(18,24,40,.38);
}

*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; min-height:100vh;
  background:var(--bg);
  color:var(--fg);
  font:15px/1.6 "Noto Sans SC",-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  display:flex; flex-direction:column;
  transition:background .3s var(--ease), color .3s var(--ease);
}
a{color:inherit;text-decoration:none}
img{display:block;max-width:100%}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
input{font:inherit;color:inherit}
svg{width:1.15em;height:1.15em;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
svg [fill]{stroke:none}
::selection{background:var(--gold-soft);color:var(--fg)}

*::-webkit-scrollbar{width:10px;height:10px}
*::-webkit-scrollbar-thumb{background:var(--line-2);border-radius:99px;border:3px solid transparent;background-clip:padding-box}
*::-webkit-scrollbar-track{background:transparent}

/* ============================ 顶栏 ============================ */
.bar{
  position:sticky; top:0; z-index:30;
  display:flex; align-items:center; gap:clamp(12px,2vw,28px);
  height:66px; padding:0 var(--gut);
  background:color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter:blur(20px) saturate(160%);
  border-bottom:1px solid transparent;
  transition:border-color .25s var(--ease), background .25s var(--ease);
}
.bar.stuck{border-bottom-color:var(--line); background:color-mix(in srgb, var(--bg) 92%, transparent)}

.wordmark{
  display:flex; align-items:center; gap:9px;
  font-weight:800; font-size:17px; letter-spacing:.14em; white-space:nowrap;
}
.wordmark svg{width:19px;height:19px;color:var(--gold);fill:currentColor;stroke:none}

.bar-search{
  flex:1; max-width:420px; display:flex; align-items:center; gap:9px;
  height:38px; padding:0 14px;
  background:var(--surface); border:1px solid var(--line); border-radius:99px;
  transition:border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.bar-search[hidden]{display:none}
.bar-search:focus-within{border-color:var(--gold-line); box-shadow:0 0 0 3px var(--gold-soft)}
.bar-search .i{color:var(--fg-3); flex:none; width:16px;height:16px}
.bar-search input{flex:1; min-width:0; border:0; background:none; outline:none; font-size:14px}
.bar-search input::placeholder{color:var(--fg-3)}

.bar-nav{margin-left:auto; display:flex; align-items:center; gap:clamp(10px,1.6vw,22px)}
.bar-nav a{
  font-size:14px; color:var(--fg-2); padding:6px 2px; position:relative;
  transition:color .2s var(--ease);
}
.bar-nav a:hover{color:var(--fg)}
.bar-nav a.active{color:var(--fg)}
.bar-nav a.active::after{
  content:""; position:absolute; left:0; right:0; bottom:-6px; height:2px;
  background:var(--gold); border-radius:2px;
}
.theme-btn{
  width:36px;height:36px; display:grid; place-items:center; border-radius:50%;
  border:1px solid var(--line); color:var(--fg-2);
  transition:color .2s, border-color .2s, transform .2s var(--ease);
}
.theme-btn:hover{color:var(--gold); border-color:var(--gold-line); transform:rotate(-12deg)}
.theme-btn .sun{display:none}
html[data-theme="light"] .theme-btn .sun{display:block}
html[data-theme="light"] .theme-btn .moon{display:none}

/* ============================ 主区 ============================ */
main{flex:1; width:100%; max-width:var(--maxw); margin:0 auto; padding:0 var(--gut) 72px}
.foot{
  display:flex; gap:16px; justify-content:space-between; flex-wrap:wrap;
  max-width:var(--maxw); width:100%; margin:0 auto;
  padding:22px var(--gut) 40px;
  font-size:12px; color:var(--fg-3); border-top:1px solid var(--line);
}

/* ============================ 首页 Hero ============================ */
.hero{
  position:relative; padding:clamp(44px,7vh,84px) 0 clamp(18px,2.4vh,30px);
  text-align:center;
}
.hero::before{
  content:""; position:absolute; left:50%; top:-90px; width:min(780px,96vw); height:400px;
  transform:translateX(-50%); pointer-events:none; z-index:-1;
  background:radial-gradient(58% 58% at 50% 42%, var(--gold-soft), transparent 72%);
  filter:blur(8px);
}
.hero .kicker{
  display:inline-flex; align-items:center; gap:8px;
  font-size:11.5px; letter-spacing:.18em; text-transform:uppercase;
  color:var(--gold); padding:6px 13px; border-radius:99px;
  border:1px solid var(--gold-line); background:var(--gold-soft);
  margin-bottom:22px;
}
.hero h1{
  margin:0 0 14px;
  font-size:clamp(29px,5.2vw,54px); line-height:1.1; letter-spacing:-.025em; font-weight:800;
}
.hero h1 em{font-style:normal; color:var(--gold)}
.hero .lede{margin:0 auto; max-width:520px; color:var(--fg-2); font-size:clamp(13.5px,1.5vw,16px)}

.hero-search{
  display:flex; align-items:center; gap:12px;
  max-width:640px; margin:clamp(24px,3.6vh,38px) auto 0; padding:0 8px 0 20px; height:60px;
  background:var(--surface); border:1px solid var(--line-2); border-radius:99px;
  box-shadow:var(--shadow-card);
  transition:border-color .22s var(--ease), box-shadow .22s var(--ease), transform .22s var(--ease);
}
.hero-search:focus-within{
  border-color:var(--gold-line); transform:translateY(-1px);
  box-shadow:0 24px 60px -24px rgba(0,0,0,.85), 0 0 0 4px var(--gold-soft);
}
.hero-search .i{color:var(--fg-3); flex:none; width:19px;height:19px}
.hero-search input{flex:1; min-width:0; border:0; background:none; outline:none; font-size:16px}
.hero-search input::placeholder{color:var(--fg-3)}
.hero-search .go{
  flex:none; height:44px; padding:0 22px; border-radius:99px;
  background:var(--gold); color:#14100a; font-weight:700; font-size:14.5px;
  transition:filter .2s var(--ease), transform .2s var(--ease);
}
.hero-search .go:hover{filter:brightness(1.08); transform:scale(1.02)}

.hints{display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin-top:18px}
.hints a{
  font-size:13px; color:var(--fg-2); padding:6px 14px; border-radius:99px;
  border:1px solid var(--line); background:var(--surface);
  transition:color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.hints a:hover{color:var(--fg); border-color:var(--line-2); background:var(--surface-2)}

/* ============================ 片单行 ============================ */
.row{margin-top:clamp(32px,4.6vh,52px)}
.row-head{display:flex; align-items:baseline; justify-content:space-between; gap:16px; margin-bottom:16px}
.row-head h2{
  margin:0; font-size:clamp(17px,1.9vw,20px); font-weight:700; letter-spacing:-.01em;
  display:flex; align-items:center; gap:10px;
}
.row-head h2::before{content:""; width:3px; height:17px; border-radius:2px; background:var(--gold)}
.row-head .count{font-size:12.5px; color:var(--fg-3); font-weight:400; letter-spacing:0}
.row-head .more{font-size:13px; color:var(--fg-3); transition:color .2s}
.row-head .more:hover{color:var(--gold)}

.rail-wrap{position:relative}
.rail-wrap::after{
  content:""; position:absolute; top:0; right:0; bottom:10px; width:72px; pointer-events:none;
  background:linear-gradient(90deg, transparent, var(--bg) 88%);
  opacity:0; transition:opacity .25s var(--ease);
}
.rail-wrap.more-right::after{opacity:1}
.rail{
  display:grid; grid-auto-flow:column;
  grid-auto-columns:clamp(132px,13.2vw,172px);
  gap:clamp(10px,1.4vw,18px);
  overflow-x:auto; overscroll-behavior-x:contain;
  scroll-snap-type:x proximity;
  padding:2px 0 6px;
}
.rail::-webkit-scrollbar{height:0}
.rail > *{scroll-snap-align:start}

.rail-btn{
  position:absolute; top:calc(50% - 34px); z-index:2;
  width:40px;height:40px; border-radius:50%; display:grid; place-items:center;
  background:color-mix(in srgb, var(--surface) 88%, transparent);
  border:1px solid var(--line-2); color:var(--fg); backdrop-filter:blur(10px);
  box-shadow:0 10px 26px -12px rgba(0,0,0,.9);
  opacity:0; pointer-events:none;
  transition:opacity .2s var(--ease), transform .2s var(--ease), background .2s;
}
.rail-btn.left{left:-8px}
.rail-btn.right{right:-8px}
.rail-btn:hover{background:var(--surface-2); transform:scale(1.06)}
.rail-wrap:hover .rail-btn{opacity:1; pointer-events:auto}
.rail-wrap.at-start .rail-btn.left,
.rail-wrap.at-end .rail-btn.right{opacity:0 !important; pointer-events:none !important}

/* ============================ 海报卡 ============================ */
.card{position:relative; display:block; border-radius:var(--r-md); transition:transform .26s var(--ease); will-change:transform}
.card:hover{transform:translateY(-5px)}
.card:focus-visible{outline:2px solid var(--gold); outline-offset:3px}

.poster{
  position:relative; aspect-ratio:2/3; border-radius:var(--r-md); overflow:hidden;
  background:var(--surface-2); box-shadow:var(--shadow-card);
  outline:1px solid var(--line);
  transition:box-shadow .26s var(--ease), outline-color .26s var(--ease);
}
.card:hover .poster{box-shadow:var(--shadow-pop); outline-color:var(--line-2)}
.poster img{
  width:100%; height:100%; object-fit:cover; background:var(--surface-2);
  filter:brightness(.94) saturate(.97);
  transition:transform .45s var(--ease), filter .3s var(--ease);
}
.card:hover .poster img{transform:scale(1.045); filter:none}

.poster .score{
  position:absolute; top:8px; right:8px;
  display:inline-flex; align-items:center; gap:3px;
  font-size:11.5px; font-weight:700; letter-spacing:.01em;
  padding:3px 8px 3px 6px; border-radius:7px;
  background:rgba(6,7,10,.68); color:#f2cf8f;
  backdrop-filter:blur(8px); border:1px solid rgba(255,255,255,.08);
}
.poster .score::before{content:"★"; font-size:9.5px; opacity:.9}
.poster .src{
  position:absolute; top:8px; left:8px;
  font-size:10.5px; letter-spacing:.04em; padding:3px 7px; border-radius:7px;
  background:rgba(8,9,12,.66); color:rgba(255,255,255,.88);
  backdrop-filter:blur(6px); opacity:0; transform:translateY(-3px);
  transition:opacity .22s var(--ease), transform .22s var(--ease);
}
.card:hover .poster .src{opacity:1; transform:none}
.poster .ep-tag{
  position:absolute; left:0; right:0; bottom:0;
  padding:24px 9px 8px; font-size:11.5px; color:rgba(255,255,255,.92);
  background:linear-gradient(transparent, rgba(0,0,0,.78));
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  opacity:0; transition:opacity .22s var(--ease);
}
.card:hover .poster .ep-tag{opacity:1}

.card-title{
  margin:10px 2px 0; font-size:13.5px; font-weight:600; line-height:1.35;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.card-sub{
  margin:3px 2px 0; font-size:11.5px; color:var(--fg-3);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* ============================ 搜索结果页 ============================ */
.res-head{padding:clamp(28px,4.5vh,50px) 0 0}
.res-back{
  display:inline-flex; align-items:center; gap:6px; font-size:13px; color:var(--fg-3);
  margin-bottom:16px; transition:color .2s;
}
.res-back:hover{color:var(--gold)}
.res-head h1{
  margin:0; font-size:clamp(25px,3.8vw,38px); font-weight:800; letter-spacing:-.025em; line-height:1.15;
  word-break:break-word;
}
.res-meta{margin-top:10px; font-size:13px; color:var(--fg-3); display:flex; gap:8px; flex-wrap:wrap; align-items:center}

.chips{display:flex; gap:8px; flex-wrap:wrap; margin-top:18px}
.chip{
  display:inline-flex; align-items:center; gap:7px;
  font-size:12.5px; padding:5px 12px; border-radius:99px;
  border:1px solid var(--line); background:var(--surface); color:var(--fg-2);
}
.chip .dot{width:6px;height:6px;border-radius:50%;background:var(--ok);flex:none}
.chip.bad{color:var(--fg-3); border-style:dashed}
.chip.bad .dot{background:var(--danger)}
.chip b{font-weight:600; color:var(--fg)}

.grid{
  display:grid; gap:clamp(16px,2vw,28px) clamp(10px,1.4vw,18px);
  grid-template-columns:repeat(auto-fill,minmax(140px,1fr));
  margin-top:clamp(24px,3.6vh,38px);
}

/* 骨架屏 */
.skel-poster{
  aspect-ratio:2/3; border-radius:var(--r-md);
  background:linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size:220% 100%; animation:shimmer 1.35s var(--ease) infinite;
}
.skel-line{
  height:11px; border-radius:6px; margin-top:10px;
  background:linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size:220% 100%; animation:shimmer 1.35s var(--ease) infinite;
}
.skel-line.short{width:55%}
@keyframes shimmer{from{background-position:120% 0}to{background-position:-40% 0}}

/* 空/错状态 */
.state{grid-column:1/-1; text-align:center; padding:clamp(44px,8vh,84px) 16px; color:var(--fg-3)}
.state .ic{
  width:52px;height:52px;margin:0 auto 16px; border-radius:50%;
  display:grid; place-items:center; border:1px solid var(--line); color:var(--fg-3);
}
.state .ic svg{width:22px;height:22px}
.state strong{display:block; font-size:15.5px; color:var(--fg); margin-bottom:6px; font-weight:600}
.state p{margin:0; font-size:13.5px}

/* 记录页 */
.hist-wrap{max-width:760px}
.hist-block{margin-top:clamp(28px,4vh,42px)}
.hist-block h2{
  font-size:17px; margin:0 0 14px; display:flex; align-items:center; gap:10px;
}
.hist-block h2::before{content:""; width:3px; height:16px; border-radius:2px; background:var(--gold)}
.hist-block .clr{margin-left:auto; font-size:12.5px; color:var(--fg-3)}
.hist-block .clr:hover{color:var(--danger)}
.hist-row{
  display:flex; align-items:center; gap:14px;
  padding:13px 16px; border:1px solid var(--line); border-radius:var(--r-md);
  background:var(--surface); margin-bottom:9px;
  transition:border-color .2s var(--ease), background .2s var(--ease);
}
.hist-row:hover{border-color:var(--line-2); background:var(--surface-2)}
.hist-row .t{font-weight:600; font-size:14.5px}
.hist-row .s{font-size:12.5px; color:var(--fg-3); margin-top:2px}
.hist-row .act{
  margin-left:auto; flex:none; font-size:12.5px; padding:6px 13px; border-radius:99px;
  border:1px solid var(--gold-line); color:var(--gold);
}
.hist-row .act:hover{background:var(--gold-soft)}

/* ============================ 播放层 ============================ */
.player{
  position:fixed; inset:0; z-index:80; background:var(--bg);
  display:flex; flex-direction:column;
  animation:fadeUp .28s var(--ease);
}
.player[hidden]{display:none}
@keyframes fadeUp{from{opacity:0; transform:translateY(10px)}to{opacity:1;transform:none}}

.player-bar{
  display:flex; align-items:center; gap:14px;
  padding:14px var(--gut); border-bottom:1px solid var(--line);
  background:color-mix(in srgb, var(--bg) 88%, transparent);
}
.ghost-btn{
  flex:none; width:38px;height:38px; border-radius:50%;
  display:grid; place-items:center; border:1px solid var(--line); color:var(--fg-2);
  transition:color .2s, border-color .2s, background .2s;
}
.ghost-btn:hover{color:var(--fg); border-color:var(--line-2); background:var(--surface)}
.player-meta{min-width:0}
.player-meta h2{
  margin:0; font-size:16.5px; font-weight:700; letter-spacing:-.01em;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.player-meta p{
  margin:2px 0 0; font-size:12.5px; color:var(--fg-3);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.player-stage{position:relative; flex:1; min-height:0; background:#000; display:grid; place-items:center}
.player-stage video{width:100%; height:100%; max-height:100%; background:#000; outline:none}
.stage-tip{
  position:absolute; left:50%; bottom:16px; transform:translateX(-50%);
  max-width:min(92%,720px); padding:9px 16px; border-radius:99px;
  background:rgba(8,9,12,.84); backdrop-filter:blur(8px);
  font-size:12.5px; color:#e7ecf5; text-align:center;
}
.stage-tip[hidden]{display:none}

.player-lower{
  border-top:1px solid var(--line); background:var(--bg-soft);
  padding:14px var(--gut) calc(16px + env(safe-area-inset-bottom));
  max-height:42vh; overflow:auto;
}
.routes{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px}
.route-tab{
  font-size:12.5px; padding:6px 14px; border-radius:99px;
  border:1px solid var(--line); color:var(--fg-2); background:var(--surface);
  transition:all .18s var(--ease);
}
.route-tab:hover{border-color:var(--line-2); color:var(--fg)}
.route-tab.on{background:var(--gold); border-color:var(--gold); color:#14100a; font-weight:700}
.episodes{display:flex; flex-wrap:wrap; gap:7px}
.ep{
  font-size:12.5px; padding:7px 13px; border-radius:var(--r-sm);
  border:1px solid var(--line); background:var(--surface); color:var(--fg-2);
  max-width:190px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  transition:all .16s var(--ease);
}
.ep:hover{border-color:var(--line-2); color:var(--fg)}
.ep.on{background:var(--gold-soft); border-color:var(--gold-line); color:var(--gold); font-weight:600}

/* ============================ 响应式 ============================ */
@media (max-width:820px){
  .bar{height:58px}
  .wordmark span{display:none}
  .bar-search{max-width:none}
  .grid{grid-template-columns:repeat(auto-fill,minmax(108px,1fr)); gap:16px 10px}
  .card-title{font-size:12.5px}
  .card-sub{font-size:11px}
  .hero-search{height:54px}
  .hero-search .go{height:40px; padding:0 16px}
  .rail{grid-auto-columns:40vw}
  .player-lower{max-height:38vh}
}
@media (max-width:480px){
  .grid{grid-template-columns:repeat(2,1fr)}
  .hero h1{font-size:26px}
  .hero .lede{font-size:13.5px}
}

@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms !important; transition-duration:.01ms !important}
}
