/* ==========================================================================
   红果剧场 · 样式
   ========================================================================== */
:root {
  --bg: #07070b;
  --bg-soft: #0d0d14;
  --card: #14141f;
  --card-2: #1b1b28;
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .14);
  --text: #f4f4f7;
  --muted: #8d8da2;
  --muted-2: #62627a;
  --accent: #ff3b3b;
  --accent-2: #ff8a00;
  --accent-soft: rgba(255, 83, 61, .14);
  --grad: linear-gradient(135deg, #ff3b3b 0%, #ff7a18 100%);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .5);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 62px;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 82% -8%, rgba(255, 74, 60, .16), transparent 62%),
    radial-gradient(700px 400px at 8% 2%, rgba(255, 138, 0, .10), transparent 60%),
    radial-gradient(900px 600px at 50% 108%, rgba(120, 70, 255, .08), transparent 60%);
  pointer-events: none;
}

.hidden { display: none !important; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; }
img { display: block; }
::selection { background: rgba(255, 74, 60, .35); }

/* 播放模式 */
body.watch-mode { overflow: hidden; }
body.watch-mode #topbar, body.watch-mode #tabbar { display: none; }
body.watch-mode .view { padding: 0; }

/* 封面加载失败占位 */
.poster.img-err, .rank-thumb.img-err, .detail-poster.img-err {
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(255, 90, 60, .28), transparent 60%),
    linear-gradient(160deg, #22222f, #12121a);
}

/* 滚动条 */
::-webkit-scrollbar { width: 0; height: 0; }

/* ==========================================================================
   登录
   ========================================================================== */
.login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 100;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 400px at 50% 15%, rgba(255, 74, 60, .22), transparent 65%),
    radial-gradient(500px 380px at 80% 90%, rgba(255, 138, 0, .12), transparent 60%);
  animation: breathe 9s ease-in-out infinite alternate;
}
@keyframes breathe { from { opacity: .65; transform: scale(1); } to { opacity: 1; transform: scale(1.06); } }

.login-card {
  position: relative;
  width: min(380px, 100%);
  padding: 38px 30px 30px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(28, 28, 42, .92), rgba(16, 16, 25, .94));
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(24px);
  text-align: center;
  animation: pop .45s cubic-bezier(.2, .9, .25, 1.1);
}
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }

.logo-mark {
  width: 84px; height: 84px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 26px;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .12), transparent 60%);
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 36px rgba(255, 70, 50, .28);
}
.login-card h1 { margin: 0; font-size: 24px; letter-spacing: 4px; font-weight: 700; }
.login-sub { margin: 8px 0 26px; color: var(--muted); font-size: 13px; letter-spacing: 1px; }

.login-field {
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: border-color .2s, background .2s;
}
.login-field:focus-within { border-color: rgba(255, 90, 60, .55); background: rgba(255, 255, 255, .06); }
.login-field input {
  flex: 1; min-width: 0; height: 100%;
  background: none; border: 0; outline: 0;
  color: var(--text); font-size: 16px; letter-spacing: 1px;
}
.login-field input::placeholder { color: var(--muted-2); }

.btn-primary {
  width: 100%;
  height: 52px;
  margin-top: 16px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 6px;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 12px 30px rgba(255, 80, 45, .32);
  transition: transform .15s, box-shadow .15s, filter .2s;
}
.btn-primary:active { transform: scale(.97); filter: brightness(.92); }

.login-err { min-height: 20px; margin-top: 12px; color: #ff6b5e; font-size: 13px; }
.shake { animation: shake .4s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* ==========================================================================
   顶栏 / 底部导航
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(7, 7, 11, .92), rgba(7, 7, 11, .62));
  backdrop-filter: blur(18px);
  border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-text { font-size: 17px; font-weight: 700; letter-spacing: 2px; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
}
.icon-btn {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  transition: background .2s, transform .15s;
}
.icon-btn:active { transform: scale(.94); background: rgba(255, 255, 255, .09); }

.view {
  min-height: calc(100vh - 58px);
  padding: 6px 0 calc(var(--tab-h) + var(--safe-b) + 26px);
  max-width: 1180px;
  margin: 0 auto;
}
@media (min-width: 900px) {
  .view { padding-bottom: 40px; }
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  width: min(560px, 100%);
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(12, 12, 19, .88);
  backdrop-filter: blur(22px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted-2);
  font-size: 10.5px;
  letter-spacing: .5px;
  transition: color .2s;
}
.tab svg { opacity: .85; }
.tab.active { color: var(--text); }
.tab.active svg { color: var(--accent); opacity: 1; }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .view { padding-bottom: 40px; }
}

/* ==========================================================================
   通用块
   ========================================================================== */
.section { margin-top: 26px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 16px;
  margin-bottom: 12px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .5px;
}
.section-title::before {
  content: "";
  width: 4px; height: 16px;
  border-radius: 3px;
  background: var(--grad);
}
.section-more { color: var(--muted); font-size: 12.5px; }

/* 横向轨道 */
.rail {
  display: flex;
  gap: 12px;
  padding: 2px 16px 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.rail > * { scroll-snap-align: start; }
@media (min-width: 900px) {
  .rail { flex-wrap: wrap; overflow: visible; }
}

/* 封面卡片 */
.cover-card {
  flex: 0 0 128px;
  width: 128px;
  animation: fadeUp .5s both;
}
@media (min-width: 900px) {
  .cover-card { flex: 0 0 150px; width: 150px; }
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.poster {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 15px;
  overflow: hidden;
  background: linear-gradient(160deg, #1d1d2c, #101017);
  border: 1px solid var(--line);
  transition: transform .25s cubic-bezier(.2, .8, .3, 1), box-shadow .25s, border-color .25s;
}
.poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .45s ease, transform .45s ease;
}
.poster img.loaded { opacity: 1; }
.poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(4, 4, 8, .72));
}
.poster:hover, .cover-card:active .poster {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, .2);
  box-shadow: 0 18px 34px rgba(0, 0, 0, .55);
}
.ep-badge {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .14);
}
.play-badge {
  position: absolute;
  right: 8px; bottom: 8px;
  z-index: 2;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 6px 18px rgba(255, 70, 40, .45);
  opacity: 0;
  transform: scale(.8);
  transition: opacity .2s, transform .25s;
}
.poster:hover .play-badge { opacity: 1; transform: none; }
.cover-title {
  margin: 8px 2px 0;
  font-size: 13px;
  line-height: 1.35;
  color: #e9e9f1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cover-meta { margin: 3px 2px 0; font-size: 11px; color: var(--muted-2); }

/* 排行榜 */
.rank-list { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  transition: background .2s, transform .2s;
}
.rank-row:active { transform: scale(.99); background: rgba(255, 255, 255, .05); }
.rank-no {
  width: 34px;
  text-align: center;
  font-size: 19px;
  font-weight: 800;
  font-style: italic;
  color: var(--muted-2);
  flex: 0 0 34px;
}
.rank-row:nth-child(1) .rank-no { color: #ffd447; text-shadow: 0 0 18px rgba(255, 212, 71, .5); }
.rank-row:nth-child(2) .rank-no { color: #cfd6e4; }
.rank-row:nth-child(3) .rank-no { color: #e0905a; }
.rank-thumb {
  width: 56px; height: 74px;
  flex: 0 0 56px;
  border-radius: 10px;
  overflow: hidden;
  background: #1a1a26;
}
.rank-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rank-info { min-width: 0; flex: 1; }
.rank-title { font-size: 14px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-sub { margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.rank-score { flex: 0 0 auto; font-size: 12px; color: #ffb357; }

/* ==========================================================================
   首页 Hero
   ========================================================================== */
.hero {
  position: relative;
  margin: 10px 16px 4px;
  height: clamp(320px, 52vw, 430px);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #12121b;
  box-shadow: var(--shadow);
}
.hero-bg {
  position: absolute;
  inset: -30px;
  background-size: cover;
  background-position: center 22%;
  filter: blur(26px) saturate(1.15);
  transform: scale(1.12);
  opacity: .55;
}
.hero-img {
  position: absolute;
  right: 0;
  bottom: 0;
  height: 100%;
  width: 62%;
  object-fit: cover;
  object-position: top center;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 42%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 42%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 7, 11, .92) 0%, rgba(7, 7, 11, .55) 46%, rgba(7, 7, 11, .1) 78%),
    linear-gradient(0deg, rgba(7, 7, 11, .95), transparent 45%);
}
.hero-content {
  position: absolute;
  z-index: 2;
  left: 0; bottom: 0;
  width: 100%;
  padding: 22px;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 1px;
  color: #ffd9cf;
  background: rgba(255, 74, 60, .18);
  border: 1px solid rgba(255, 100, 70, .35);
  backdrop-filter: blur(6px);
}
.hero h2 {
  margin: 12px 0 8px;
  max-width: 76%;
  font-size: clamp(21px, 4.6vw, 30px);
  line-height: 1.25;
  letter-spacing: .5px;
  text-shadow: 0 4px 26px rgba(0, 0, 0, .6);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero p {
  margin: 0 0 16px;
  max-width: 66%;
  font-size: 13px;
  line-height: 1.6;
  color: #c4c4d4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: flex; gap: 10px; align-items: center; }
.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 13px;
  font-weight: 700;
  font-size: 14.5px;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 12px 28px rgba(255, 74, 40, .38);
  transition: transform .15s, filter .2s;
}
.btn-play:active { transform: scale(.96); filter: brightness(.92); }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border-radius: 13px;
  font-size: 13.5px;
  color: #e6e6ef;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(8px);
}
@media (max-width: 640px) {
  .hero-img { width: 100%; opacity: .5; }
  .hero h2, .hero p { max-width: 100%; }
}

/* ==========================================================================
   搜索
   ========================================================================== */
.search-wrap { padding: 8px 16px 0; }
.search-bar {
  position: sticky;
  top: 58px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 16px;
  border-radius: 15px;
  background: rgba(20, 20, 31, .94);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(16px);
  color: var(--muted);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
}
.search-bar input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 15.5px;
}
.search-bar input::placeholder { color: var(--muted-2); }
.search-clear { color: var(--muted-2); padding: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; }
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: #d7d7e2;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  transition: background .2s, border-color .2s;
}
.chip:active { background: var(--accent-soft); border-color: rgba(255, 90, 60, .5); }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 14px 12px;
  padding: 16px;
}
@media (min-width: 700px) {
  .result-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
}
.result-grid .cover-card { width: auto; flex: none; }

.hint {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.8;
}
.hint .big { font-size: 34px; margin-bottom: 10px; opacity: .5; }

/* ==========================================================================
   详情
   ========================================================================== */
.detail-bg {
  position: relative;
  height: 250px;
  overflow: hidden;
}
.detail-bg .blur {
  position: absolute;
  inset: -40px;
  background-size: cover;
  background-position: center;
  filter: blur(34px) saturate(1.1);
  opacity: .5;
  transform: scale(1.1);
}
.detail-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 7, 11, .35), rgba(7, 7, 11, .96) 78%);
}
.detail-main {
  position: relative;
  display: flex;
  gap: 18px;
  margin-top: -150px;
  padding: 0 18px;
  z-index: 2;
}
.detail-poster {
  width: 132px;
  flex: 0 0 132px;
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: 0 22px 48px rgba(0, 0, 0, .6);
  background: #16161f;
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { min-width: 0; padding-top: 4px; }
.detail-info h1 {
  margin: 0 0 10px;
  font-size: clamp(19px, 3.6vw, 26px);
  line-height: 1.3;
}
.detail-stats { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.stat-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  color: #d3d3e2;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
}
.stat-chip.accent { color: #ffc9a8; background: var(--accent-soft); border-color: rgba(255, 100, 60, .3); }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.detail-desc {
  margin: 20px 18px 0;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  color: #b9b9c9;
  font-size: 13.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: -webkit-line-clamp .2s;
}
.detail-desc.open { -webkit-line-clamp: unset; max-height: none; }
.desc-toggle {
  display: block;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 12.5px;
}

.ep-section { margin-top: 24px; }
.ep-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  margin-bottom: 12px;
}
.ep-head h3 { margin: 0; font-size: 15.5px; letter-spacing: .5px; }
.ep-head .count { color: var(--muted); font-size: 12px; }
.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 10px;
  padding: 0 18px;
}
.ep-btn {
  position: relative;
  height: 46px;
  border-radius: 11px;
  font-size: 13.5px;
  color: #d9d9e5;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  transition: background .18s, border-color .18s, transform .12s;
}
.ep-btn:active { transform: scale(.94); }
.ep-btn.playing { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 8px 22px rgba(255, 74, 40, .35); }
.ep-btn.locked { color: var(--muted-2); background: rgba(255, 255, 255, .02); }
.ep-btn .dot {
  position: absolute;
  top: 6px; right: 7px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #4bd67d;
}
.ep-btn .ep-sub { display: block; font-size: 9.5px; color: var(--muted-2); margin-top: 2px; }

/* ==========================================================================
   播放页
   ========================================================================== */
.watch {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #000;
  display: flex;
  flex-direction: column;
}
.watch-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.watch-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.watch-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 14px 26px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .72), transparent);
  transition: opacity .3s;
}
.watch-top .back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .1); backdrop-filter: blur(8px); }
.watch-title { min-width: 0; flex: 1; }
.watch-title .t { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-title .s { font-size: 11.5px; color: rgba(255, 255, 255, .6); margin-top: 2px; }
.watch-top .spacer { flex: 1; }

.watch-bottom {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 30px 14px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(0, 0, 0, .78), transparent);
}
.watch-bottom .pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 13px;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(10px);
}
.watch-bottom .pill.primary { background: var(--grad); border-color: transparent; font-weight: 600; }

.prepare {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: rgba(3, 3, 6, .82);
  backdrop-filter: blur(10px);
  padding: 24px;
}
.prepare-card {
  width: min(340px, 100%);
  padding: 28px 24px;
  border-radius: 22px;
  text-align: center;
  background: rgba(22, 22, 33, .92);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.spinner {
  width: 54px; height: 54px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .1);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.prepare-title { font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.prepare-sub { margin-top: 8px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.progress {
  height: 6px;
  margin-top: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .08);
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--grad);
  transition: width .4s ease;
}
.prepare .err { color: #ff6b5e; font-size: 12.5px; margin-top: 14px; line-height: 1.6; }
.prepare .retry { margin-top: 16px; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  max-height: 68vh;
  padding: 20px 16px max(20px, env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: #12121b;
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .6);
  transform: translateY(102%);
  transition: transform .32s cubic-bezier(.2, .8, .3, 1);
  overflow-y: auto;
}
.sheet.open { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { margin: 0; font-size: 16px; }
.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 9px;
}
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

/* ==========================================================================
   片库
   ========================================================================== */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px 12px;
  padding: 16px;
}
.lib-card { position: relative; border-radius: 16px; overflow: hidden; background: var(--card); border: 1px solid var(--line); }
.lib-card .poster { border-radius: 0; border: 0; }
.lib-card .lib-info { padding: 10px 10px 12px; }
.lib-title { font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-sub { margin-top: 5px; font-size: 11px; color: var(--muted); }
.lib-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, .08);
}
.lib-progress > i { display: block; height: 100%; background: var(--grad); }

/* ==========================================================================
   骨架 / Toast / 其它
   ========================================================================== */
.skeleton { position: relative; overflow: hidden; background: rgba(255, 255, 255, .045); border-radius: var(--radius-sm); }
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
  animation: shimmer 1.25s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-card { flex: 0 0 128px; }
.sk-poster { aspect-ratio: 3 / 4; border-radius: 15px; }
.sk-line { height: 11px; margin-top: 9px; border-radius: 6px; }
.sk-line.short { width: 62%; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 26px);
  transform: translate(-50%, 16px);
  z-index: 200;
  max-width: min(86vw, 420px);
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 13px;
  color: #fff;
  background: rgba(30, 30, 44, .95);
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.fade-in { animation: fadeUp .35s both; }

/* 顶部返回（详情） */
.page-back {
  position: absolute;
  top: 12px; left: 14px;
  z-index: 5;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .4);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(10px);
}

@media (max-width: 380px) {
  .cover-card { flex-basis: 112px; width: 112px; }
  .rail { gap: 10px; }
  .result-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px 10px; }
}
