
/* ===== styles.css ===== */
:root {
  color-scheme: dark;
  --bg: #0b0b0b;
  --bg-soft: #141414;
  --panel: #1c1c1c;
  --panel-2: #292929;
  --line: rgba(255,255,255,.12);
  --line-strong: rgba(255,255,255,.24);
  --text: #f5f5f5;
  --muted: #bdbdbd;
  --muted-2: #a3a3a3;
  --red: #9f4049;
  --accent-soft: #c1858a;
  --red-dark: #78323b;
  --green: #46d369;
  --danger: #ff6b6b;
  --warning: #f5c451;
  --shadow: 0 24px 70px rgba(0,0,0,.62);
  --page-pad: clamp(22px, 4vw, 64px);
  --header-h: 68px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.hidden { display: none !important; }

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 70;
  height: var(--header-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 34px;
  padding: 0 var(--page-pad);
  background: linear-gradient(180deg, rgba(0,0,0,.88), rgba(0,0,0,.34) 68%, transparent);
  transition: background .25s ease, box-shadow .25s ease;
}
.topbar.scrolled { background: rgba(9,9,9,.96); box-shadow: 0 1px 0 rgba(255,255,255,.05); }
.brand { display: inline-flex; align-items: center; gap: 7px; color: var(--text); text-decoration: none; letter-spacing: -.035em; line-height: 1; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; flex: none; width: 28px; height: 28px; color: var(--red); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-word { font-size: clamp(22px, 2vw, 30px); font-weight: 950; }
.brand-tv { margin-left: 4px; font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.nav-tabs { display: flex; align-items: center; gap: 22px; }
.nav-tab { padding: 8px 0; border: 0; background: transparent; color: #d2d2d2; font-size: 14px; cursor: pointer; transition: color .18s ease, opacity .18s ease; }
.nav-tab svg { display: none; }
.nav-tab:hover, .nav-tab.active { color: #fff; }
.nav-tab.active { font-weight: 700; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.icon-button { width: 39px; height: 39px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; cursor: pointer; transition: background .18s ease, transform .18s ease; }
.icon-button:hover { background: rgba(255,255,255,.12); transform: scale(1.04); }
.icon-button svg { width: 22px; height: 22px; }

.top-search {
  position: absolute;
  top: 50%;
  right: var(--page-pad);
  width: min(560px, calc(100vw - var(--page-pad) * 2));
  height: 46px;
  display: grid;
  grid-template-columns: 24px minmax(0,1fr) auto auto;
  align-items: center;
  gap: 9px;
  padding: 0 8px 0 13px;
  border: 1px solid rgba(255,255,255,.36);
  border-radius: 4px;
  background: rgba(9,9,9,.96);
  box-shadow: 0 16px 36px rgba(0,0,0,.44);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(18px) scale(.98);
  transition: opacity .18s ease, transform .18s ease;
}
.search-open .top-search { opacity: 1; pointer-events: auto; transform: translateY(-50%) translateX(0) scale(1); }
.search-open .topbar > .brand, .search-open .topbar > .nav-tabs, .search-open .topbar > .top-actions { opacity: 0; pointer-events: none; }
.top-search > svg { width: 21px; height: 21px; color: #ddd; }
.top-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; font-size: 15px; }
.top-search input::placeholder { color: #8e8e8e; }
.search-submit { height: 34px; padding: 0 15px; border: 0; border-radius: 3px; background: #fff; color: #111; font-size: 13px; font-weight: 800; cursor: pointer; }
.search-close { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #aaa; font-size: 25px; line-height: 1; cursor: pointer; }
.search-close:hover { background: rgba(255,255,255,.1); color: #fff; }

main { width: 100%; }
.source-pills { display: none !important; }

.home-sections { position: relative; z-index: 5; margin-top: -94px; padding: 0 0 76px; }
.catalog-section { position: relative; margin: 0 0 38px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 var(--page-pad); margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: clamp(19px, 1.8vw, 26px); line-height: 1.15; letter-spacing: -.025em; }
.eyebrow { display: none; }
.muted { color: var(--muted); font-size: 13px; }
.row-controls { display: flex; gap: 7px; opacity: 0; transform: translateX(6px); transition: opacity .18s ease, transform .18s ease; }
.catalog-section:hover .row-controls { opacity: 1; transform: translateX(0); }
.row-control { width: 35px; height: 35px; border: 1px solid rgba(255,255,255,.18); border-radius: 4px; background: rgba(0,0,0,.66); color: #fff; font-size: 23px; line-height: 1; cursor: pointer; }
.row-control:hover { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.16); }
.media-row { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(190px, 19vw, 300px); gap: 7px; overflow-x: auto; overflow-y: visible; padding: 16px var(--page-pad) 34px; margin-top: -16px; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-inline: contain; }
.media-row::-webkit-scrollbar { display: none; }
.media-row .media-card { scroll-snap-align: start; }
.content-section { min-height: 68vh; padding: calc(var(--header-h) + 34px) var(--page-pad) 90px; }
.results-heading { padding: 0; margin-bottom: 22px; }
.media-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 30px 8px; }

.media-card { position: relative; min-width: 0; border: 0; border-radius: 4px; background: var(--panel); transform-origin: center; transition: transform .22s cubic-bezier(.2,.75,.2,1), box-shadow .22s ease; }
.media-card:hover { z-index: 9; transform: scale(1.075); box-shadow: 0 20px 46px rgba(0,0,0,.72); }
.media-card:has(> button:focus-visible) { z-index: 9; }
.card-action { position: absolute; inset: 0; z-index: 5; margin: 0; padding: 0; border: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.poster { position: relative; aspect-ratio: 16/9; overflow: hidden; border-radius: 4px; background: linear-gradient(135deg,#242424,#101010); }
.poster::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(180deg, transparent, rgba(0,0,0,.9)); pointer-events: none; }
.poster img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s ease, filter .35s ease; }
.media-card:hover .poster img { transform: scale(1.04); filter: saturate(1.08) contrast(1.03); }
.poster-fallback { width: 100%; height: 100%; display: grid; place-items: center; color: rgba(255,255,255,.72); background: radial-gradient(circle at 50% 40%,#333,#121212 72%); font-size: 42px; font-weight: 900; }
.card-overlay { position: absolute; inset: auto 0 0; z-index: 2; padding: 40px 12px 11px; transition: padding .2s ease; }
.card-overlay strong { display: block; overflow: hidden; color: #fff; font-size: 14px; font-weight: 800; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 2px 8px #000; }
.card-meta { display: flex; align-items: center; gap: 7px; max-height: 0; margin-top: 0; overflow: hidden; color: #d2d2d2; font-size: 10px; opacity: 0; transition: max-height .2s ease, opacity .2s ease, margin .2s ease; white-space: nowrap; }
.media-card:hover .card-meta { max-height: 24px; margin-top: 7px; opacity: 1; }
.card-meta .match { color: #f4c75b; font-weight: 800; }
.badge, .rating { position: absolute; z-index: 3; left: 9px; top: 9px; max-width: calc(100% - 54px); overflow: hidden; padding: 4px 7px; border-radius: 3px; color: #fff; background: rgba(0,0,0,.72); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; backdrop-filter: blur(7px); }
.rating { color: #ffd76a; }
.favorite-button { position: absolute; z-index: 6; top: 8px; right: 8px; width: 32px; height: 32px; border: 1px solid rgba(255,255,255,.6); border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; backdrop-filter: blur(7px); }
.favorite-button:hover { background: #fff; color: #111; }
.favorite-button.active { border-color: var(--red); background: var(--red); color: #fff; }
.card-copy { display: none; }

.notice { position: fixed; z-index: 90; top: calc(var(--header-h) + 14px); right: var(--page-pad); width: min(440px, calc(100vw - var(--page-pad) * 2)); padding: 12px 14px; border: 1px solid rgba(245,196,81,.28); border-radius: 4px; background: rgba(37,31,13,.94); color: #f7dda0; box-shadow: 0 16px 40px rgba(0,0,0,.45); font-size: 13px; backdrop-filter: blur(14px); }
.notice.error { border-color: rgba(255,107,107,.28); background: rgba(47,19,22,.95); color: #ffd1d1; }
.empty-state { max-width: 520px; margin: 58px auto; padding: 52px 30px; text-align: center; border: 1px solid var(--line); border-radius: 6px; background: #121212; }
.empty-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto; border-radius: 4px; background: var(--red); color: #fff; font-size: 33px; font-weight: 950; }
.empty-state h3 { margin: 18px 0 8px; }
.empty-state p { color: var(--muted); line-height: 1.65; }
.skeleton { aspect-ratio: 16/9; border-radius: 4px; background: linear-gradient(105deg,#171717 8%,#292929 18%,#171717 33%); background-size: 200% 100%; animation: shine 1.25s linear infinite; }
@keyframes shine { to { background-position-x: -200%; } }

::backdrop { background: rgba(0,0,0,.82); backdrop-filter: blur(5px); }
dialog { color: var(--text); }
.sheet { width: min(1000px, calc(100% - 24px)); max-height: 92vh; padding: 0; overflow: auto; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: #181818; box-shadow: var(--shadow); }
/* Detail view is a real full-screen page, not a constrained desktop dialog.
   Resetting max-width is important because browsers ship a default dialog max-width. */
#detailDialog.sheet {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: #141414;
  box-shadow: none;
  overscroll-behavior: contain;
}
#detailDialog::backdrop { background: #141414; }
.sheet-close { position: relative; z-index: 10; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(24,24,24,.94); color: #fff; font-size: 25px; line-height: 1; cursor: pointer; }
.sheet>.sheet-close { position: sticky; top: 14px; float: right; margin: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.38); }
.detail-backdrop { height: 410px; margin-bottom: -246px; background-position: center 20%; background-size: cover; opacity: .64; mask-image: linear-gradient(to bottom,#000 42%,transparent 100%); }
.detail-hero { position: relative; display: grid; grid-template-columns: 205px minmax(0,1fr); gap: 28px; align-items: end; padding: 42px; }
.detail-poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 5px; background: #232323; box-shadow: 0 18px 42px rgba(0,0,0,.58); }
.detail-copy h2 { margin: 0 0 14px; font-size: clamp(31px,4.6vw,55px); line-height: 1; letter-spacing: -.04em; }
.detail-copy p { max-width: 680px; color: #ddd; line-height: 1.65; }
.detail-copy small { display: block; margin-top: 7px; color: #999; }
.detail-meta, .source-choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 11px 0; }
.detail-meta span, .source-choice { padding: 6px 9px; border: 1px solid var(--line); border-radius: 3px; color: #ccc; background: rgba(0,0,0,.34); font-size: 12px; }
.detail-meta span:first-child { color: var(--green); border-color: rgba(70,211,105,.35); }
.source-choice { cursor: pointer; }
.source-choice:hover { border-color: #fff; }
.source-choice.active { border-color: transparent; background: #fff; color: #111; }
.episode-block { padding: 0 42px 34px; }
.episode-block h3 { margin: 0 0 14px; font-size: 20px; }
.episodes { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 8px; }
.episode { min-height: 44px; overflow: hidden; border: 1px solid var(--line); border-radius: 3px; background: #242424; cursor: pointer; text-overflow: ellipsis; white-space: nowrap; }
.episode:hover { border-color: #fff; background: #333; }
.episode i { margin-left: 5px; color: var(--green); font-size: 9px; font-style: normal; }

.player-dialog { width: min(1180px,calc(100% - 18px)); max-height: calc(100dvh - 18px); overflow: hidden; padding: 0; border: 1px solid rgba(255,255,255,.15); border-radius: 9px; background: #070707; box-shadow: var(--shadow); }
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 10px 12px 10px 18px; background: linear-gradient(180deg,#111,#090909); }
.player-title-wrap { display: flex; flex-direction: column; min-width: 0; }
.player-head strong, .player-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-head strong { font-size: 15px; }
.player-head span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.video-shell { position: relative; isolation: isolate; aspect-ratio: 16/9; overflow: hidden; outline: 0; background: #000; user-select: none; }
.video-shell video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.player-loading { position: absolute; z-index: 4; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; color: rgba(255,255,255,.82); background: radial-gradient(circle at center,rgba(20,20,20,.2),rgba(0,0,0,.58)); font-size: 13px; pointer-events: none; }
.player-spinner { width: 38px; height: 38px; border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: player-spin .72s linear infinite; }
@keyframes player-spin { to { transform: rotate(360deg); } }
.center-play { position: absolute; z-index: 5; left: 50%; top: 50%; width: 70px; height: 70px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.38); border-radius: 50%; background: rgba(12,12,12,.72); box-shadow: 0 10px 32px rgba(0,0,0,.45); transform: translate(-50%,-50%); cursor: pointer; backdrop-filter: blur(10px); }
.center-play:hover { background: rgba(255,255,255,.92); color: #111; transform: translate(-50%,-50%) scale(1.06); }
.center-play svg { width: 34px; height: 34px; margin-left: 3px; }
.player-gesture { position: absolute; z-index: 8; left: 50%; top: 43%; min-width: 176px; max-width: min(78vw, 420px); display: grid; gap: 5px; padding: 11px 15px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(8,8,8,.82); color: #fff; text-align: center; transform: translate(-50%,-50%); pointer-events: none; contain: layout paint; }
.player-gesture strong { font-size: 14px; font-weight: 800; line-height: 1.25; }
.player-gesture small { overflow: hidden; color: rgba(255,255,255,.72); font-size: 11px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.player-gesture-meter { height: 4px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.18); }
.player-gesture-meter i { display: block; height: 100%; border-radius: inherit; background: #fff; transform-origin: left center; }
.player-tap-ripple { position: absolute; z-index: 6; width: 82px; height: 82px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.68); border-radius: 50%; background: rgba(0,0,0,.28); color: #fff; font-size: 17px; font-weight: 900; transform: translate(-50%,-50%) scale(.55); pointer-events: none; animation: cactus-tap-ripple .72s cubic-bezier(.2,.75,.2,1) forwards; }
.player-tap-ripple-left { margin-left: -12px; }
.player-tap-ripple-right { margin-left: 12px; }
@keyframes cactus-tap-ripple { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.45); } 22% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.25); } }
.player-message { position: absolute; z-index: 10; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; padding: 30px; text-align: center; color: #ffd1d1; background: rgba(0,0,0,.88); }
.player-message span { max-width: 720px; line-height: 1.7; }
.player-message button { min-height: 40px; padding: 0 18px; border: 0; border-radius: 4px; background: #fff; color: #111; font-weight: 800; cursor: pointer; }
.player-controls { position: absolute; z-index: 7; right: 0; bottom: 0; left: 0; padding: 56px 16px 13px; opacity: 0; background: linear-gradient(180deg,transparent,rgba(0,0,0,.18) 22%,rgba(0,0,0,.92)); transform: translateY(8px); transition: opacity .2s ease,transform .2s ease; pointer-events: none; }
.video-shell.controls-visible .player-controls { opacity: 1; transform: none; pointer-events: auto; }
.player-progress-wrap { position: relative; height: 18px; display: flex; align-items: center; }
.player-progress-track { position: absolute; right: 0; left: 0; height: 4px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.25); transition: height .15s ease; }
.player-progress-wrap:hover .player-progress-track,
.player-progress-wrap:focus-within .player-progress-track { height: 6px; }
.player-buffered,.player-played { position: absolute; top: 0; bottom: 0; left: 0; width: 0; }
.player-buffered { background: rgba(255,255,255,.48); }
.player-played { background: var(--red); }
.player-progress-wrap input { position: absolute; z-index: 2; inset: 0; width: 100%; height: 18px; margin: 0; opacity: 0; cursor: pointer; }
.player-control-row,.player-control-left,.player-control-right { display: flex; align-items: center; }
.player-control-row { justify-content: space-between; gap: 14px; min-width: 0; }
.player-control-left,.player-control-right { gap: 7px; }
.player-control-button { min-width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer; }
.player-control-button:hover { background: rgba(255,255,255,.15); }
.player-control-button svg { width: 24px; height: 24px; }
.player-text-button { width: auto; padding: 0 9px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.player-volume { width: 82px; accent-color: #fff; cursor: pointer; }
.player-time { margin-left: 2px; color: rgba(255,255,255,.92); font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
.player-time i { margin: 0 5px; color: rgba(255,255,255,.48); font-style: normal; }
.player-select-wrap select { height: 32px; max-width: 96px; padding: 0 25px 0 8px; border: 1px solid rgba(255,255,255,.25); border-radius: 4px; color: #fff; background: rgba(0,0,0,.55); font-size: 11px; cursor: pointer; }
.player-tools { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 11px 16px 13px; border-top: 1px solid rgba(255,255,255,.06); background: #0d0d0d; }
.player-tools label { color: var(--muted); font-size: 12px; }
.player-tools select { margin-left: 7px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 3px; color: #fff; background: #222; }
.player-shortcuts { margin-left: auto; color: #777; font-size: 10px; white-space: nowrap; }
.file-button { display: inline-flex; align-items: center; min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px; color: #fff !important; cursor: pointer; }
.file-button:hover { border-color: rgba(255,255,255,.55); }
.file-button input { display: none; }
.video-shell:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; background: #000; }
.video-shell:fullscreen .player-controls { padding-right: max(22px,env(safe-area-inset-right)); padding-bottom: max(18px,env(safe-area-inset-bottom)); padding-left: max(22px,env(safe-area-inset-left)); }

.settings-dialog, .auth-dialog { width: min(520px,calc(100% - 24px)); padding: 0; border: 1px solid var(--line); border-radius: 7px; background: #181818; box-shadow: var(--shadow); }
.settings-dialog>.sheet-close { float: right; margin: 14px; }
.settings-copy { padding: 32px; }
.settings-copy h2 { margin: 0 0 22px; font-size: 32px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 0; border-top: 1px solid var(--line); }
.setting-row span { display: flex; flex-direction: column; gap: 5px; }
.setting-row small { color: var(--muted); }
.setting-row input { width: 44px; height: 24px; accent-color: var(--red); }
.privacy-note { margin-top: 18px; padding: 14px; border-left: 3px solid var(--red); background: #232323; color: var(--muted); font-size: 12px; line-height: 1.65; }
.auth-dialog { padding: 28px; }
.auth-form, .admin-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label, .admin-form label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 13px; }
.auth-form input, .admin-form input, .admin-form textarea, .admin-form select { width: 100%; padding: 12px; outline: 0; border: 1px solid var(--line); border-radius: 4px; color: #fff; background: #242424; }
.auth-form input:focus, .admin-form input:focus, .admin-form textarea:focus { border-color: #fff; }
.form-message { min-height: 20px; color: var(--danger); font-size: 13px; }
.primary-button { min-height: 44px; padding: 0 22px; border: 0; border-radius: 4px; background: var(--red); color: #fff; font-weight: 800; cursor: pointer; }
.primary-button:hover { background: var(--red-dark); }
.secondary-button, .account-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.08); color: #fff; text-decoration: none; cursor: pointer; }
.secondary-button:hover, .account-button:hover { background: rgba(255,255,255,.16); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; padding: 13px 17px; border-left: 3px solid var(--green); border-radius: 3px; background: #242424; box-shadow: var(--shadow); }
.toast.error { border-left-color: var(--danger); color: #ffd1d1; }

footer { display: flex; justify-content: space-between; gap: 30px; width: calc(100% - var(--page-pad) * 2); margin: 0 var(--page-pad); padding: 28px 0 44px; border-top: 1px solid var(--line); color: #666; font-size: 11px; }
.footer-link { color: #777; text-decoration: none; }
.footer-link:hover { color: #fff; }

.compact-view .content-section { padding-top: calc(var(--header-h) + 32px); }

.admin-main { width: min(1180px,calc(100% - 36px)); margin: 110px auto 90px; }
.admin-hero { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.admin-hero h1 { margin: 0; font-size: 48px; letter-spacing: -.04em; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.admin-tab { padding: 10px 14px; border: 1px solid var(--line); border-radius: 4px; background: #1c1c1c; cursor: pointer; }
.admin-tab.active { border-color: var(--red); background: var(--red); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.admin-grid { display: grid; grid-template-columns: 380px 1fr; gap: 20px; }
.admin-card { padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: #151515; }
.admin-card h2, .admin-card h3 { margin-top: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 9px !important; }
.check-row input { width: auto !important; accent-color: var(--red); }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 4px; background: #1d1d1d; }
.admin-item strong { display: block; }
.admin-item small { display: block; margin-top: 5px; color: var(--muted); word-break: break-all; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.mini-button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 3px; background: #282828; cursor: pointer; }
.mini-button:hover { border-color: #fff; }
.mini-button.danger { color: #ffb5b5; border-color: rgba(255,119,119,.35); }
.health-ok { color: var(--green); }
.health-bad { color: var(--danger); }
.code-note { padding: 12px; border-left: 3px solid var(--red); background: #0d0d0d; color: #bbb; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

@media (hover: none) {
  .card-meta { max-height: 24px; margin-top: 6px; opacity: 1; }
  .media-card:hover { transform: none; box-shadow: none; }
}

@media (max-width: 1120px) {
  .media-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .episodes { grid-template-columns: repeat(4,minmax(0,1fr)); }
}

@media (max-width: 820px) {
  :root { --page-pad: 20px; --header-h: 60px; }
  .topbar { grid-template-columns: auto 1fr auto; gap: 18px; }
  .nav-tabs { gap: 14px; }
  .nav-tab { font-size: 13px; }
  .home-sections { margin-top: -75px; }
  .media-row { grid-auto-columns: clamp(210px,35vw,280px); }
  .media-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .row-controls { display: none; }
  .detail-backdrop { height: 290px; margin-bottom: -180px; }
  .detail-hero { grid-template-columns: 125px minmax(0,1fr); gap: 18px; padding: 24px; }
  .detail-copy h2 { font-size: 32px; }
  .detail-copy p { grid-column: 1/-1; }
  .episode-block { padding: 0 24px 28px; }
  footer { padding-bottom: 86px; }
}

@media (max-width: 660px) {
  :root { --page-pad: 16px; }
  .topbar { grid-template-columns: 1fr auto; gap: 10px; }
  .nav-tabs { position: fixed; left: 50%; bottom: max(11px,env(safe-area-inset-bottom)); z-index: 80; transform: translateX(-50%); gap: 3px; padding: 5px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(18,18,18,.94); box-shadow: 0 12px 32px rgba(0,0,0,.54); backdrop-filter: blur(14px); }
  .nav-tab { padding: 9px 11px; font-size: 12px; }
  .nav-tab.active { border-radius: 4px; background: #fff; color: #111; }
  .top-actions { grid-column: 2; }
  .top-search { right: 10px; width: calc(100vw - 20px); }
  .search-open .topbar > .nav-tabs { opacity: 1; pointer-events: auto; }
  .home-sections { margin-top: -66px; padding-bottom: 88px; }
  .media-row { grid-auto-columns: clamp(205px,72vw,290px); }
  .media-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .notice { top: calc(var(--header-h) + 8px); right: 12px; width: calc(100vw - 24px); }
  .detail-hero { grid-template-columns: 94px minmax(0,1fr); padding: 18px; }
  .detail-copy h2 { font-size: 25px; }
  .episode-block { padding: 0 18px 24px; }
  .episodes { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .player-tools { align-items: flex-start; flex-direction: column; }
  .form-row, .admin-item { grid-template-columns: 1fr; }
  .admin-hero { align-items: flex-start; flex-direction: column; }
  .admin-hero h1 { font-size: 38px; }
  footer { flex-direction: column; gap: 9px; }
}

@media (max-width: 420px) {
  .brand-tv { display: none; }
  .nav-tabs { width: max-content; }
  .search-submit { display: none; }
  .top-search { grid-template-columns: 22px minmax(0,1fr) auto; }
  .content-section { padding-left: 12px; padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Touch layout */
@media (max-width: 1024px) and (hover: none) {
  :root {
    --page-pad: 18px;
    --header-h: 56px;
    --shadow: 0 14px 38px rgba(0,0,0,.46);
  }

  html { scroll-behavior: auto; }
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
    -webkit-tap-highlight-color: transparent;
  }
  button, a { touch-action: manipulation; }

  .topbar {
    height: var(--header-h);
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding: 0 var(--page-pad);
    background: linear-gradient(180deg, rgba(0,0,0,.9), rgba(0,0,0,.36) 74%, transparent);
  }
  .topbar.scrolled { background: rgba(8,8,8,.98); }
  .brand-word { font-size: 24px; }
  .brand-tv { display: none; }
  .top-actions { grid-column: 3; }
  .icon-button { width: 38px; height: 38px; }
  .icon-button:hover { background: transparent; transform: none; }

  .nav-tabs {
    position: fixed;
    inset: auto 0 0;
    z-index: 85;
    width: 100%;
    height: calc(60px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 0;
    padding: 4px 8px env(safe-area-inset-bottom);
    border: 0;
    border-top: 1px solid rgba(255,255,255,.08);
    border-radius: 0;
    background: #080808;
    box-shadow: 0 -8px 24px rgba(0,0,0,.35);
    transform: none;
    backdrop-filter: none;
  }
  .nav-tab {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    color: #777;
    font-size: 10px;
    line-height: 1.1;
  }
  .nav-tab svg { display: block; width: 21px; height: 21px; }
  .nav-tab.active { border-radius: 0; background: transparent; color: #fff; }

  .top-search {
    position: fixed;
    inset: 0 0 auto;
    width: 100%;
    height: var(--header-h);
    grid-template-columns: 23px minmax(0,1fr) auto;
    padding: 0 12px;
    border: 0;
    border-bottom: 1px solid rgba(255,255,255,.1);
    border-radius: 0;
    background: #0a0a0a;
    box-shadow: none;
    transform: translateY(-100%);
  }
  .search-open .top-search { transform: translateY(0); }
  .search-open .topbar > .nav-tabs { opacity: 1; pointer-events: auto; }
  .search-submit { display: none; }
  .search-close { justify-self: end; }


  .home-sections { margin-top: -48px; padding-bottom: 28px; }
  .catalog-section {
    margin-bottom: 25px;
    content-visibility: visible;
  }
  .section-heading { padding: 0 var(--page-pad); margin-bottom: 8px; }
  .section-heading h2 { font-size: 20px; }
  .row-controls { display: none; }
  .media-row {
    grid-auto-columns: min(22vw, 176px);
    gap: 9px;
    margin: 0;
    padding: 4px var(--page-pad) 13px;
    scroll-padding-left: var(--page-pad);
    scroll-snap-type: x mandatory;
  }
  .media-card {
    border-radius: 5px;
    background: transparent;
    transition: none;
    contain: none;
  }
  .media-card:hover { transform: none; box-shadow: none; }
  .poster { aspect-ratio: 2/3; border-radius: 5px; }
  .poster picture { display: contents; }
  .poster::after { inset: 56% 0 0; background: linear-gradient(180deg, transparent, rgba(0,0,0,.88)); }
  .poster img { transition: none; }
  .card-overlay { padding: 48px 8px 8px; }
  .card-overlay strong {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.22;
    white-space: normal;
    text-overflow: clip;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .card-meta { max-height: 18px; margin-top: 4px; opacity: 1; font-size: 9px; }
  .badge, .rating { left: 6px; top: 6px; padding: 3px 5px; font-size: 9px; backdrop-filter: none; }
  .favorite-button { top: 6px; right: 6px; width: 29px; height: 29px; backdrop-filter: none; }

  .content-section { padding: calc(var(--header-h) + 22px) var(--page-pad) 88px; }
  .results-heading { margin-bottom: 15px; }
  .results-heading h2 { font-size: 24px; }
  .media-grid { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 20px 9px; }
  .media-grid .poster { aspect-ratio: 2/3; }
  .skeleton { aspect-ratio: 2/3; animation-duration: 1.7s; }
  .notice { top: calc(var(--header-h) + 8px); right: 10px; width: calc(100vw - 20px); backdrop-filter: none; }

  ::backdrop { backdrop-filter: none; }
  .sheet {
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .sheet > .sheet-close { top: 8px; margin: 8px; }
  .detail-backdrop { height: 38vh; min-height: 280px; margin-bottom: -180px; }
  .detail-hero { grid-template-columns: 120px minmax(0,1fr); gap: 18px; padding: 24px 22px; }
  .detail-copy h2 { font-size: 34px; }
  .detail-copy p { grid-column: 1/-1; margin-bottom: 0; font-size: 14px; }
  .episode-block { padding: 0 22px 28px; }
  .episodes { grid-template-columns: repeat(4,minmax(0,1fr)); }

  .player-dialog {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .player-dialog[open] { display: flex; flex-direction: column; }
  .player-head { padding: max(10px, env(safe-area-inset-top)) 14px 10px; }
  .video-shell { flex: 0 0 auto; }
  .player-tools { flex-wrap: wrap; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

  .settings-dialog {
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    margin: 0;
    border-width: 1px 0 0;
    border-radius: 16px 16px 0 0;
  }
  .settings-copy { padding: 26px 22px calc(28px + env(safe-area-inset-bottom)); }
  .settings-copy h2 { font-size: 28px; }

  .toast { left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); }
  footer { display: none; }
}

@media (max-width: 700px) {
  :root { --page-pad: 13px; --header-h: 52px; }
  .topbar { padding: 0 var(--page-pad); }
  .brand-word { font-size: 21px; }
  .top-actions { gap: 0; }
  .icon-button { width: 36px; height: 36px; }


  .home-sections { margin-top: -39px; }
  .catalog-section { margin-bottom: 20px; contain-intrinsic-size: 230px; }
  .section-heading h2 { font-size: 18px; }
  .media-row { grid-auto-columns: min(31vw, 145px); gap: 7px; padding-bottom: 10px; }
  .card-overlay { padding: 42px 7px 7px; }
  .card-overlay strong { font-size: 11px; }
  .card-meta { gap: 5px; font-size: 8px; }

  .content-section { padding-left: 10px; padding-right: 10px; }
  .media-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 17px 7px; }
  .results-heading { padding: 0 3px; }
  .results-heading h2 { font-size: 21px; }
  .result-count { font-size: 11px; }

  .detail-backdrop { height: 34vh; min-height: 230px; margin-bottom: -145px; }
  .detail-hero { grid-template-columns: 88px minmax(0,1fr); gap: 13px; padding: 18px 15px; }
  .detail-copy h2 { margin-bottom: 8px; font-size: 25px; }
  .detail-meta, .source-choices { gap: 5px; margin: 7px 0; }
  .detail-meta span, .source-choice { padding: 5px 7px; font-size: 10px; }
  .detail-copy p { font-size: 13px; line-height: 1.55; }
  .detail-copy small { font-size: 11px; }
  .episode-block { padding: 0 15px 22px; }
  .episode-block h3 { font-size: 17px; }
  .episodes { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
  .episode { min-height: 40px; font-size: 12px; }

  .player-head { padding-left: 12px; padding-right: 8px; }
  .video-shell { aspect-ratio: 16/9; }
  .player-message { padding: 22px; font-size: 13px; }
  .player-tools { gap: 10px; padding: 12px 12px calc(74px + env(safe-area-inset-bottom)); }
  .settings-copy { padding-left: 18px; padding-right: 18px; }
  .settings-copy h2 { font-size: 25px; }
  .setting-row { padding: 15px 0; }
  .empty-state { margin: 30px 8px; padding: 34px 20px; border: 0; }
}

@media (max-width: 390px) {
  .media-row { grid-auto-columns: 32.5vw; }
  .media-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .card-meta span:not(:first-child) { display: none; }
}

/* v0.2.7 mobile detail */
.detail-masthead {
  position: relative;
  height: min(52vw, 430px);
  min-height: 300px;
  overflow: hidden;
  background: radial-gradient(ellipse at 34% 14%, #33282b, #141414 75%);
}
.detail-cover,
.detail-cover-fallback {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 24%;
}
.detail-cover-fallback {
  display: grid;
  place-items: center;
  color: var(--red);
  font-size: 90px;
  font-weight: 900;
}
.detail-masthead-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,.35), transparent 58%),
    linear-gradient(180deg, transparent 44%, #181818 100%);
}
.detail-main {
  position: relative;
  z-index: 2;
  width: min(920px, calc(100% - 64px));
  margin: -92px auto 0;
  padding: 0 0 44px;
}
.detail-title-row {
  display: flex;
  align-items: flex-end;
  gap: 22px;
}
.detail-thumb {
  width: 132px;
  aspect-ratio: 2/3;
  object-fit: cover;
  flex: 0 0 auto;
  border-radius: 6px;
  background: #222;
  box-shadow: 0 12px 34px rgba(0,0,0,.45);
}
.detail-title-copy { min-width: 0; padding-bottom: 6px; }
.detail-title-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: .98;
  letter-spacing: -.045em;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0;
}
.detail-meta span {
  padding: 0;
  border: 0;
  background: transparent;
  color: #c8c8c8;
  font-size: 13px;
}
.detail-meta span:first-child { color: var(--green); }
.detail-primary-play {
  min-width: 180px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 22px 0 0 154px;
  padding: 0 22px;
  border: 0;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font-weight: 800;
  cursor: pointer;
}
.detail-primary-play svg { width: 21px; height: 21px; }
.detail-source-bar {
  display: grid;
  grid-template-columns: 52px minmax(0,1fr);
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.09);
}
.detail-source-bar > span { color: #8e8e8e; font-size: 12px; }
.detail-source-bar .source-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
.source-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: #242424;
  color: #ddd;
  font-size: 12px;
}
.source-choice small { color: #8b8b8b; font-size: 10px; }
.source-choice.active { border-color: #fff; background: #fff; color: #111; }
.source-choice.active small { color: #555; }
.detail-overview-wrap { margin-top: 22px; }
.detail-overview {
  max-width: 760px;
  margin: 0;
  color: #d1d1d1;
  font-size: 15px;
  line-height: 1.7;
}
.detail-overview.collapsed {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}
.detail-more {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #aaa;
  font-size: 13px;
  cursor: pointer;
}
.detail-credits {
  margin-top: 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.detail-credits summary {
  padding: 14px 0;
  color: #b9b9b9;
  font-size: 13px;
  cursor: pointer;
}
.detail-credits p {
  margin: 0 0 10px;
  color: #aaa;
  font-size: 13px;
  line-height: 1.55;
}
.detail-credits p:last-child { margin-bottom: 16px; }
.detail-credits p span { display: inline-block; width: 46px; color: #666; }
.detail-main .episode-block { padding: 26px 0 0; }
.detail-lookup-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  background: rgba(255,255,255,.07);
  color: #ddd;
  font-size: 14px;
}
.detail-lookup-spinner {
  width: 15px;
  height: 15px;
  flex: none;
  border: 2px solid rgba(255,255,255,.22);
  border-top-color: #eee;
  border-radius: 50%;
  animation: detail-lookup-spin .8s linear infinite;
}
@keyframes detail-lookup-spin { to { transform: rotate(1turn); } }
.detail-episode-placeholder {
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 6px;
  background: linear-gradient(105deg, #232323 12%, #303030 48%, #232323 88%);
  background-size: 220% 100%;
  animation: shine 1.7s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .detail-lookup-spinner, .detail-episode-placeholder { animation: none; }
}
.performance-lite .detail-episode-placeholder { animation: none; }
.episode-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.episode-heading h3 { margin: 0; font-size: 20px; }
.episode-heading span { color: #737373; font-size: 12px; }
.detail-main .episodes { grid-template-columns: repeat(6, minmax(0,1fr)); gap: 8px; }
.detail-main .episode {
  min-height: 42px;
  padding: 0 8px;
  border-color: rgba(255,255,255,.11);
  border-radius: 5px;
  background: #242424;
  color: #eee;
  font-size: 13px;
}

@media (max-width: 700px) {
  .sheet { background: #141414; overscroll-behavior: contain; }
  .sheet > .sheet-close {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    float: none;
    width: 40px;
    height: 40px;
    margin: 0;
    background: rgba(18,18,18,.82);
    box-shadow: none;
  }
  .detail-masthead {
    height: 58vw;
    min-height: 205px;
    max-height: 265px;
  }
  .detail-cover { object-position: center 22%; }
  .detail-masthead-shade {
    background: linear-gradient(180deg, rgba(0,0,0,.05) 25%, rgba(20,20,20,.18) 56%, #141414 100%);
  }
  .detail-main {
    width: 100%;
    margin: -34px 0 0;
    padding: 0 14px calc(34px + env(safe-area-inset-bottom));
  }
  .detail-title-row { display: block; }
  .detail-thumb { display: none; }
  .detail-title-copy { padding: 0; }
  .detail-title-copy h2 {
    margin: 0 0 10px;
    padding-right: 46px;
    font-size: clamp(27px, 8vw, 34px);
    line-height: 1.05;
  }
  .detail-meta { gap: 6px 10px; }
  .detail-meta span { font-size: 11px; }
  .detail-primary-play {
    width: 100%;
    min-height: 44px;
    margin: 17px 0 0;
    border-radius: 4px;
    font-size: 14px;
  }
  .detail-source-bar {
    display: block;
    margin-top: 18px;
    padding-top: 15px;
  }
  .detail-source-bar > span { display: block; margin-bottom: 9px; }
  .detail-source-bar .source-choices {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }
  .detail-source-bar .source-choices::-webkit-scrollbar { display: none; }
  .source-choice { flex: 0 0 auto; min-height: 32px; padding: 0 11px; }
  .detail-overview-wrap { margin-top: 18px; }
  .detail-overview { font-size: 13px; line-height: 1.62; }
  .detail-overview.collapsed { -webkit-line-clamp: 3; }
  .detail-more { font-size: 12px; }
  .detail-credits { margin-top: 15px; }
  .detail-credits summary { padding: 13px 0; font-size: 12px; }
  .detail-credits p { font-size: 12px; }
  .detail-main .episode-block { padding-top: 22px; }
  .episode-heading { margin-bottom: 10px; }
  .episode-heading h3 { font-size: 18px; }
  .detail-main .episodes { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; }
  .detail-main .episode {
    min-width: 0;
    min-height: 39px;
    padding: 0 4px;
    font-size: 11px;
  }
}

@media (max-width: 390px) {
  .detail-main { padding-left: 12px; padding-right: 12px; }
  .detail-main .episodes { grid-template-columns: repeat(4,minmax(0,1fr)); }
}

/* Tablet landscape: preserve portrait artwork inside cinematic cards. */
@media (orientation: landscape) and (min-width: 821px) and (max-width: 1600px) and (any-pointer: coarse) {
  .media-row {
    grid-auto-columns: clamp(210px, 18.5vw, 280px);
    gap: 8px;
  }

  .poster picture {
    display: block;
    width: 100%;
    height: 100%;
  }

  .poster-portrait-source {
    isolation: isolate;
    background: #111;
  }

  .poster-portrait-source::before {
    content: "";
    position: absolute;
    inset: -14px;
    z-index: 0;
    background-image: var(--poster-ambient);
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    filter: blur(16px) brightness(.5) saturate(.82);
    opacity: .86;
    transform: scale(1.12);
    pointer-events: none;
  }

  .poster-portrait-source picture,
  .poster-portrait-source > img {
    position: relative;
    z-index: 1;
  }

  .poster-portrait-source img {
    object-fit: contain;
    object-position: center;
    filter: drop-shadow(0 0 15px rgba(0,0,0,.58));
    transform: none;
  }

  .media-card:hover .poster-portrait-source img {
    filter: drop-shadow(0 0 15px rgba(0,0,0,.58));
    transform: none;
  }

  .poster-portrait-source::after {
    z-index: 2;
    inset: 42% 0 0;
  }

  .poster-portrait-source .card-overlay,
  .poster-portrait-source .badge,
  .poster-portrait-source .rating {
    z-index: 3;
  }
}



/* v0.3.0 player responsive refinements */
@media (max-width: 900px) {
  .player-shortcuts { display: none; }
  .player-volume { width: 66px; }
}

@media (max-width: 700px) {
  .player-dialog { inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .player-dialog[open] { display: flex; flex-direction: column; }
  .player-head { min-height: 52px; padding: max(8px,env(safe-area-inset-top)) 8px 8px 12px; }
  .player-head strong { font-size: 14px; }
  .video-shell { flex: 0 0 auto; aspect-ratio: 16/9; }
  .player-controls { padding: 42px 8px 7px; }
  .player-control-row { gap: 4px; }
  .player-control-left,.player-control-right { gap: 1px; }
  .player-control-button { min-width: 34px; width: 34px; height: 34px; }
  .player-control-button svg { width: 21px; height: 21px; }
  .player-volume,.player-text-button { display: none; }
  .player-time { font-size: 10px; }
  .player-time i,.player-time #playerDuration { display: none; }
  .player-select-wrap select { max-width: 72px; height: 30px; padding-left: 6px; padding-right: 20px; font-size: 10px; }
  .center-play { width: 58px; height: 58px; backdrop-filter: none; }
  .center-play svg { width: 29px; height: 29px; }
  .player-tools { align-items: flex-start; flex-direction: column; flex: 1 1 auto; gap: 10px; min-height: 0; padding: 13px 12px calc(74px + env(safe-area-inset-bottom)); overflow-y: auto; }
}

@media (max-width: 900px) and (orientation: landscape) {
  .player-dialog { inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .player-dialog[open] { display: flex; flex-direction: column; }
  .player-head,.player-tools { display: none; }
  .video-shell { flex: 1 1 auto; width: 100%; height: 100dvh; aspect-ratio: auto; }
  .player-controls { padding-right: max(14px,env(safe-area-inset-right)); padding-bottom: max(8px,env(safe-area-inset-bottom)); padding-left: max(14px,env(safe-area-inset-left)); }
}

@media (prefers-reduced-motion: reduce) {
  .player-controls,.center-play { transition: none; }
  .player-spinner { animation-duration: 1.2s; }
}

/* v0.4.0: category navigation, result filters and playback failover */
.category-nav {
  position: relative;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -54px 0 24px;
  padding: 0 var(--page-pad) 4px;
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
}
.category-nav::-webkit-scrollbar { display: none; }
.category-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(22,22,22,.82);
  color: #ddd;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(10px);
}
.category-chip:hover,
.category-chip.active { border-color: #fff; background: #fff; color: #111; }

.result-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin: -6px 0 24px;
  padding: 0;
}
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.filter-label { color: #777; font-size: 11px; }
.filter-chip,
.filter-select {
  min-height: 34px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  background: #1d1d1d;
  color: #d7d7d7;
  font-size: 12px;
}
.filter-chip { padding: 0 12px; cursor: pointer; }
.filter-chip:hover,
.filter-chip.active { border-color: #fff; background: #fff; color: #111; }
.filter-select { padding: 0 30px 0 12px; cursor: pointer; }
.load-more {
  min-width: 170px;
  min-height: 43px;
  display: block;
  margin: 32px auto 0;
  padding: 0 20px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  background: #1c1c1c;
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}
.load-more:hover { border-color: #fff; background: #292929; }

.player-skip-button { font-size: 16px; line-height: 1; }
.player-skip-button:disabled,
.player-source-switch:disabled { opacity: .35; cursor: not-allowed; }
.player-source-switch {
  border-color: rgba(255,255,255,.2);
  background: #1b1b1b;
}
.playback-status {
  max-width: 280px;
  overflow: hidden;
  color: #8f8f8f;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.playback-status.switching { color: var(--warning); }
.playback-status.ready { color: var(--green); }

.next-episode-prompt {
  position: absolute;
  z-index: 7;
  right: 18px;
  bottom: 82px;
  width: min(330px, calc(100% - 36px));
  padding: 17px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  background: rgba(18,18,18,.94);
  box-shadow: 0 18px 45px rgba(0,0,0,.58);
  backdrop-filter: blur(12px);
}
.next-episode-prompt strong,
.next-episode-prompt span { display: block; }
.next-episode-prompt strong { font-size: 15px; }
.next-episode-prompt span { margin-top: 6px; color: #bdbdbd; font-size: 12px; line-height: 1.5; }
.next-episode-prompt > div { display: flex; gap: 8px; margin-top: 13px; }
.next-episode-prompt button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 4px;
  background: #292929;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.next-episode-prompt button:first-child { border-color: #fff; background: #fff; color: #111; font-weight: 800; }

.episode.is-current { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.source-choice.is-failed { opacity: .5; }

@media (max-width: 700px) {
  .category-nav { margin-top: -40px; padding-right: 12px; padding-left: 12px; }
  .category-chip { min-height: 33px; padding: 0 12px; font-size: 12px; backdrop-filter: none; }
  .result-filters { gap: 8px; margin-bottom: 18px; }
  .filter-group { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .filter-group::-webkit-scrollbar { display: none; }
  .filter-chip { flex: 0 0 auto; }
  .filter-label { display: none; }
  .playback-status { max-width: calc(100vw - 24px); white-space: normal; }
  .next-episode-prompt { right: 12px; bottom: 68px; width: calc(100% - 24px); }
}

@media (max-width: 520px) {
  .player-skip-button { display: none; }
  .player-source-switch { width: 100%; justify-content: center; }
}

.category-nav:not(.hidden) + .home-sections { margin-top: -12px; }
.compact-view .category-nav { margin: 18px 0 16px; }
.compact-view .category-nav:not(.hidden) ~ .content-section { padding-top: 18px; }

/* v0.5.0 Turbo: low-end devices render only what is near the viewport. */
.catalog-section {
  content-visibility: auto;
  contain: layout style;
  contain-intrinsic-size: 300px;
}
.catalog-section.is-visible { content-visibility: visible; }
.media-card {
  content-visibility: auto;
  contain: layout style;
  contain-intrinsic-size: 180px 270px;
}
.poster img[data-src] { opacity: 0; }
.poster img[src] { opacity: 1; }
.episode-block {
  content-visibility: auto;
  contain: layout style;
  contain-intrinsic-size: 260px;
}
.episode-more {
  min-height: 38px;
  margin-top: 12px;
  padding: 0 15px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 4px;
  background: #202020;
  color: #eee;
  cursor: pointer;
}

/* A static backdrop is dramatically cheaper than dozens of live blur layers. */
@media (orientation: landscape) and (min-width: 821px) and (max-width: 1600px) and (any-pointer: coarse) {
  .poster-portrait-source::before { display: none !important; }
  .poster-portrait-source { background: linear-gradient(135deg, #191919, #080808); }
  .poster-portrait-source img,
  .media-card:hover .poster-portrait-source img {
    filter: none;
    transform: none;
  }
}

/* Automatic lightweight rendering profile for save-data, reduced-motion and weak CPUs/RAM. */
.performance-lite { scroll-behavior: auto; }
.performance-lite *,
.performance-lite *::before,
.performance-lite *::after { scroll-behavior: auto !important; }
.performance-lite .hero-backdrop,
.performance-lite .hero.poster-mode .hero-backdrop {
  filter: none !important;
  transform: none !important;
}
.performance-lite .hero-artwork::before,
.performance-lite .poster-portrait-source::before { display: none !important; }
.performance-lite :is(.hero-button-secondary,.badge,.rating,.favorite-button,.notice,.center-play,.nav-tabs,.category-chip,.next-episode-prompt),
.performance-lite ::backdrop { backdrop-filter: none !important; }
.performance-lite :is(.media-card,.poster img,.hero-button,.nav-tab,.filter-chip,.category-chip) { transition: none !important; }
.performance-lite .media-card:hover {
  transform: none !important;
  box-shadow: none !important;
}
.performance-lite .skeleton { animation: none !important; background: #202020; }
.performance-lite .topbar.scrolled { box-shadow: none; }
.performance-lite .hero-vignette { background: linear-gradient(180deg, rgba(0,0,0,.05), transparent 46%, #090909 100%); }

@media (max-width: 1024px), (hover: none) {
  .catalog-section {
    content-visibility: auto;
    contain: layout style;
    contain-intrinsic-size: 250px;
  }
  .catalog-section.is-visible { content-visibility: visible; }
  .media-card {
    content-visibility: auto;
    contain: layout style;
  }
}

/* v0.6.0 resilient player */
.player-dialog.dialog-fallback-open,
.sheet.dialog-fallback-open,
.settings-dialog.dialog-fallback-open { display: block; position: fixed; z-index: 1000; }
.player-control-button:focus-visible,
.player-select-wrap select:focus-visible,
.player-tools button:focus-visible,
.player-tools select:focus-visible,
.player-tools input:focus-visible,
.video-shell:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(109,255,154,.42);
}
.player-control-button.active { background: rgba(109,255,154,.22); color: var(--green); }
.player-tools-toggle { display: none; }
.player-diagnostics-panel {
  position: absolute;
  z-index: 9;
  top: 14px;
  left: 14px;
  max-width: min(360px, calc(100% - 28px));
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  background: rgba(0,0,0,.78);
  color: #e8e8e8;
  font: 11px/1.65 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  white-space: pre-wrap;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

@media (max-width: 700px) {
  .player-tools-toggle { display: grid; }
  .player-control-right { min-width: 0; }
  .player-control-right .player-select-wrap:not(.hidden) { max-width: 76px; }
  .player-skip-button { display: grid !important; min-width: 31px; width: 31px; }
  .player-diagnostics-panel { top: 8px; left: 8px; max-width: calc(100% - 16px); padding: 9px 10px; font-size: 9px; backdrop-filter: none; }
}

@media (max-width: 900px) and (orientation: landscape) {
  .player-dialog { position: relative; height: 100vh; height: 100dvh; overflow: hidden; }
  .player-dialog .player-head {
    position: absolute;
    z-index: 12;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    min-height: 48px;
    padding: max(6px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) 6px max(10px,env(safe-area-inset-left));
    border: 0;
    background: linear-gradient(180deg,rgba(0,0,0,.76),transparent);
    pointer-events: none;
  }
  .player-dialog .player-head .player-title-wrap { opacity: 0; }
  .player-dialog .player-head .sheet-close { display: grid; pointer-events: auto; background: rgba(0,0,0,.58); }
  .player-dialog .player-tools {
    position: absolute;
    z-index: 13;
    top: max(52px,calc(env(safe-area-inset-top) + 46px));
    right: max(10px,env(safe-area-inset-right));
    bottom: auto;
    left: auto;
    width: min(330px,calc(100% - 20px));
    max-height: calc(100vh - 116px);
    max-height: calc(100dvh - 116px);
    display: none;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: 13px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px;
    background: rgba(13,13,13,.96);
    box-shadow: 0 18px 48px rgba(0,0,0,.55);
  }
  .player-dialog.tools-open .player-tools { display: flex; }
  .player-dialog .player-tools label,
  .player-dialog .player-tools select,
  .player-dialog .player-source-switch { width: 100%; }
  .player-dialog .video-shell { height: 100vh; height: 100dvh; }
  .player-tools-toggle { display: grid; }
}

/* v0.6.1 mobile/fullscreen player controls */
.player-tools-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.player-tools-head strong { font-size: 14px; }
.player-tools-head button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.player-lock-button {
  position: absolute;
  z-index: 15;
  top: 50%;
  left: max(12px,env(safe-area-inset-left));
  width: 42px;
  height: 42px;
  display: none;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  background: rgba(0,0,0,.58);
  color: #fff;
  opacity: 0;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity .18s ease,background .18s ease;
  backdrop-filter: blur(8px);
}
.player-lock-button svg { width: 22px; height: 22px; }
.player-lock-button:active { background: rgba(255,255,255,.22); }
.player-dialog.player-locked .player-head { opacity: 0 !important; pointer-events: none !important; }
.player-dialog.player-locked .player-tools { display: none !important; }
.video-shell.controls-locked .player-controls,
.video-shell.controls-locked .center-play,
.video-shell.controls-locked .player-gesture,
.video-shell.controls-locked .player-diagnostics-panel {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
.video-shell.controls-locked .player-lock-button {
  display: grid !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.player-dialog:fullscreen,
.player-dialog.is-fullscreen {
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #000;
}
.player-dialog:fullscreen .video-shell,
.player-dialog.is-fullscreen .video-shell {
  flex: 1 1 auto;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  aspect-ratio: auto;
}
.player-dialog:fullscreen .player-head,
.player-dialog.is-fullscreen .player-head {
  position: absolute;
  z-index: 14;
  top: 0;
  right: 0;
  left: 0;
  min-height: 52px;
  padding: max(7px,env(safe-area-inset-top)) max(9px,env(safe-area-inset-right)) 7px max(12px,env(safe-area-inset-left));
  border: 0;
  background: linear-gradient(180deg,rgba(0,0,0,.78),transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.player-dialog:fullscreen.controls-visible .player-head,
.player-dialog.is-fullscreen.controls-visible .player-head {
  opacity: 1;
}
.player-dialog:fullscreen .player-head .sheet-close,
.player-dialog.is-fullscreen .player-head .sheet-close {
  pointer-events: auto;
  background: rgba(0,0,0,.58);
}
.player-dialog:fullscreen .player-title-wrap,
.player-dialog.is-fullscreen .player-title-wrap { opacity: 0; }
.player-dialog:fullscreen .player-lock-button,
.player-dialog.is-fullscreen .player-lock-button { display: grid; }
.player-dialog:fullscreen.controls-visible .player-lock-button,
.player-dialog.is-fullscreen.controls-visible .player-lock-button {
  opacity: 1;
  pointer-events: auto;
}
.player-dialog:fullscreen .player-tools,
.player-dialog.is-fullscreen .player-tools {
  position: absolute;
  z-index: 16;
  top: max(58px,calc(env(safe-area-inset-top) + 50px));
  right: max(10px,env(safe-area-inset-right));
  bottom: auto;
  left: auto;
  width: min(340px,calc(100% - 20px));
  max-height: calc(100vh - 126px);
  max-height: calc(100dvh - 126px);
  display: none;
  align-items: stretch;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 13px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 9px;
  background: rgba(13,13,13,.96);
  box-shadow: 0 18px 48px rgba(0,0,0,.55);
}
.player-dialog:fullscreen.tools-open .player-tools,
.player-dialog.is-fullscreen.tools-open .player-tools { display: flex; }
.player-dialog:fullscreen .player-tools-head,
.player-dialog.is-fullscreen .player-tools-head { display: flex; }
.player-dialog:fullscreen .player-tools label,
.player-dialog:fullscreen .player-tools select,
.player-dialog:fullscreen .player-source-switch,
.player-dialog.is-fullscreen .player-tools label,
.player-dialog.is-fullscreen .player-tools select,
.player-dialog.is-fullscreen .player-source-switch { width: 100%; }

@media (max-width: 700px) {
  .player-dialog { position: fixed; }
  .player-control-row { width: 100%; gap: 2px; }
  .player-control-left { flex: 1 1 auto; min-width: 0; gap: 0; }
  .player-control-right { flex: 0 0 auto; min-width: 0; gap: 0; }
  .player-control-button { flex: 0 0 34px; }
  #playerDiagnostics,
  #playerPip { display: none !important; }
  #playerToolsToggle,
  #playerFullscreen { display: grid !important; flex: 0 0 34px; }
  .player-control-right .player-select-wrap { flex: 0 1 66px; min-width: 0; }
  .player-control-right .player-select-wrap select { width: 100%; max-width: 66px; }
  .player-audio-wrap,
  .player-embedded-subtitle-wrap { display: none !important; }
  .player-time { max-width: 42px; overflow: hidden; text-overflow: clip; }

  .player-dialog .player-tools {
    position: absolute;
    z-index: 16;
    right: 10px;
    bottom: max(12px,env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
    max-height: min(58vh,460px);
    display: none;
    align-items: stretch;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: 13px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px;
    background: rgba(13,13,13,.97);
    box-shadow: 0 18px 48px rgba(0,0,0,.58);
  }
  .player-dialog.tools-open .player-tools { display: flex; }
  .player-dialog .player-tools-head { display: flex; }
  .player-dialog .player-tools label,
  .player-dialog .player-tools select,
  .player-dialog .player-source-switch { width: 100%; }
}

@media (max-width: 380px) {
  .player-quality-wrap,
  .player-time { display: none !important; }
}

@media (max-width: 900px) and (orientation: landscape) {
  .player-dialog .player-head {
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }
  .player-dialog.controls-visible .player-head { opacity: 1; }
  .player-dialog .player-lock-button { display: grid; }
  .player-dialog.controls-visible .player-lock-button {
    opacity: 1;
    pointer-events: auto;
  }
  .player-dialog .player-tools-head { display: flex; }
}

/* v0.6.2 tablet layout and deliberate-touch player gestures */
.player-brightness-shade {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .06s linear;
}

@media (pointer: coarse) {
  .video-shell video {
    touch-action: none;
    -webkit-touch-callout: none;
  }
  .player-gesture {
    min-width: 104px;
    padding: 10px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 750;
    letter-spacing: .01em;
  }
}

/* Locked mode no longer leaves the unlock button floating over the movie.
   A deliberate tap reveals it together with the controls-visible state. */
.video-shell.controls-locked .player-lock-button {
  display: grid !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
.player-dialog.controls-visible .video-shell.controls-locked .player-lock-button {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Portrait artwork is shown as an actual poster on tablets instead of being
   placed inside a cinematic 16:9 box followed by a large intrinsic blank area. */
@media (min-width: 700px) and (max-width: 1600px) and (any-pointer: coarse) {
  .catalog-section,
  .catalog-section.is-visible,
  .media-card {
    content-visibility: visible;
    contain: none;
    contain-intrinsic-size: auto;
  }
  .media-card {
    align-self: start;
    overflow: hidden;
    border-radius: 8px;
    background: transparent;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
  }
  .poster,
  .media-grid .poster {
    aspect-ratio: 2 / 3;
    border-radius: 8px;
  }
  .poster picture,
  .poster-portrait-source picture {
    display: contents;
  }
  .poster-portrait-source::before { display: none !important; }
  .poster-portrait-source {
    background: linear-gradient(145deg,#202020,#090909);
  }
  .poster-portrait-source img,
  .media-card:hover .poster-portrait-source img,
  .poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: none;
    transform: none;
  }
  .poster::after,
  .poster-portrait-source::after {
    inset: 54% 0 0;
    background: linear-gradient(180deg,transparent,rgba(0,0,0,.9));
  }
  .card-overlay { padding: 58px 10px 10px; }
  .card-overlay strong {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    text-overflow: clip;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .card-meta {
    max-height: 20px;
    margin-top: 5px;
    opacity: 1;
  }
}

@media (orientation: landscape) and (min-width: 821px) and (max-width: 1600px) and (any-pointer: coarse) {
  :root {
    --page-pad: clamp(26px,3vw,44px);
    --header-h: 64px;
  }
  body { padding-bottom: 0; }
  .topbar {
    height: var(--header-h);
    grid-template-columns: auto minmax(0,1fr) auto;
    gap: 30px;
    padding: 0 var(--page-pad);
  }
  .brand-word { font-size: 27px; }
  .brand-tv { display: inline; }
  .nav-tabs {
    position: static;
    inset: auto;
    width: auto;
    height: auto;
    display: flex;
    grid-template-columns: none;
    justify-self: start;
    gap: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
  }
  .nav-tab {
    display: inline-flex;
    flex-direction: row;
    gap: 0;
    padding: 8px 0;
    color: #aaa;
    font-size: 14px;
  }
  .nav-tab svg { display: none; }
  .nav-tab.active { background: transparent; color: #fff; }
  .home-sections {
    margin-top: -66px;
    padding-bottom: 54px;
  }
  .catalog-section { margin-bottom: 30px; }
  .section-heading {
    margin-bottom: 12px;
    padding: 0 var(--page-pad);
  }
  .section-heading h2 { font-size: clamp(21px,2vw,27px); }
  .media-row {
    grid-auto-columns: clamp(150px,15vw,220px);
    gap: 12px;
    margin: 0;
    padding: 6px var(--page-pad) 23px;
    scroll-padding-left: var(--page-pad);
    scroll-snap-type: x mandatory;
  }
  .card-overlay strong { font-size: 14px; line-height: 1.25; }
  .card-meta { font-size: 10px; }
  .badge,
  .rating { left: 8px; top: 8px; padding: 4px 6px; font-size: 10px; }
  .media-grid {
    grid-template-columns: repeat(auto-fill,minmax(150px,1fr));
    gap: 24px 12px;
  }
  .category-nav { padding-right: var(--page-pad); padding-left: var(--page-pad); }
}

@media (min-width: 700px) and (max-width: 1600px) and (any-pointer: coarse) {
  .player-tools-toggle { display: grid; }
  .player-dialog .player-lock-button { display: grid; }
  .player-dialog.controls-visible .player-lock-button {
    opacity: 1;
    pointer-events: auto;
  }
  .player-dialog .player-tools {
    position: absolute;
    z-index: 16;
    right: max(14px,env(safe-area-inset-right));
    bottom: max(76px,calc(env(safe-area-inset-bottom) + 68px));
    left: auto;
    width: min(350px,calc(100% - 28px));
    max-height: min(58vh,470px);
    display: none;
    align-items: stretch;
    flex-direction: column;
    gap: 11px;
    min-height: 0;
    padding: 14px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px;
    background: rgba(13,13,13,.97);
    box-shadow: 0 20px 52px rgba(0,0,0,.62);
  }
  .player-dialog.tools-open .player-tools { display: flex; }
  .player-dialog .player-tools-head { display: flex; }
  .player-dialog .player-tools label,
  .player-dialog .player-tools select,
  .player-dialog .player-source-switch { width: 100%; }
}

/* v1.0.0 Cactus Player 2.0: deep buffer, low-jank gestures, and playback-first controls. */
.video-shell:not(.controls-visible) .center-play {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.center-play { transition: opacity .16s ease, transform .16s ease, background .16s ease; }
@media (pointer: coarse) {
  .video-shell video { touch-action: none; }
  .player-controls { transition-duration: .16s; }
  .player-gesture { backdrop-filter: none; box-shadow: 0 5px 22px rgba(0,0,0,.32); }
}

/* Cactus Performance Core v1.1 */
.personalized-section .section-heading h2::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 9px;
  border-radius: 50%;
  background: var(--accent, #e50914);
  vertical-align: middle;
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent, #e50914) 72%, transparent);
}
.recommend-reason {
  position: absolute;
  z-index: 3;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(5,5,5,.76);
  color: rgba(255,255,255,.9);
  font-size: 10px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(5px);
}
.card-overlay + .watch-progress,
.watch-progress {
  position: absolute;
  z-index: 5;
  left: 7px;
  right: 7px;
  bottom: 5px;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.26);
  pointer-events: none;
}
.watch-progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent, #e50914);
}
.media-card:has(.watch-progress) .recommend-reason { bottom: 13px; }
@media (pointer: coarse), (max-width: 760px) {
  .recommend-reason {
    left: 6px;
    bottom: 7px;
    max-width: calc(100% - 12px);
    font-size: 9px;
    backdrop-filter: none;
  }
  .media-card:has(.watch-progress) .recommend-reason { bottom: 12px; }
}
@supports not selector(:has(*)) {
  .recommend-reason { bottom: 12px; }
}

/* v1.1.3 gesture lifecycle: live controls, deterministic fade-out, and top-mounted boost hint. */
.player-gesture {
  opacity: 1;
  transition: opacity .17s ease, transform .17s ease;
  will-change: opacity, transform;
}
.player-gesture.is-fading {
  opacity: 0;
  transform: translate(-50%, calc(-50% - 6px));
}
.player-gesture[data-kind="boost"] {
  top: max(16px, calc(env(safe-area-inset-top, 0px) + 12px));
  min-width: 0;
  max-width: min(72vw, 260px);
  gap: 2px;
  padding: 7px 12px;
  border-color: rgba(255,255,255,.08);
  border-radius: 999px;
  background: rgba(0,0,0,.42);
  color: rgba(255,255,255,.8);
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  opacity: .82;
  transform: translateX(-50%);
}
.player-gesture[data-kind="boost"] strong { font-size: 12px; font-weight: 750; }
.player-gesture[data-kind="boost"] small { color: rgba(255,255,255,.52); font-size: 9px; }
.player-gesture[data-kind="boost"] .player-gesture-meter { display: none; }
.player-gesture[data-kind="boost"].is-fading {
  opacity: 0;
  transform: translate(-50%, -5px);
}
@media (pointer: coarse) {
  .player-gesture[data-kind="brightness"],
  .player-gesture[data-kind="volume"] {
    min-width: 132px;
    background: rgba(8,8,8,.7);
  }
}


/* v1.3.2 search-grid containment and browser-cache control. */
.content-section,
.results-heading,
.result-filters,
.media-grid {
  min-width: 0;
  max-width: 100%;
}
.results-heading > *,
.result-filters > *,
.media-grid > .media-card { min-width: 0; }
.media-grid {
  width: 100%;
  overflow: visible;
}
.media-grid > .media-card {
  width: 100%;
  max-width: 100%;
}
.settings-cache-button {
  width: 100%;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0;
  padding: 16px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.settings-cache-button > span:first-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.settings-cache-button small {
  color: var(--muted);
  line-height: 1.45;
}
.settings-cache-button-label {
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 4px;
  background: rgba(255,255,255,.08);
  font-size: 12px;
  font-weight: 750;
}
.settings-cache-button:hover .settings-cache-button-label,
.settings-cache-button:focus-visible .settings-cache-button-label {
  border-color: #fff;
  background: rgba(255,255,255,.16);
}
.settings-cache-button:disabled { cursor: wait; opacity: .58; }

@media (any-pointer: coarse) {
  .topbar,
  .content-section {
    padding-left: max(var(--page-pad), env(safe-area-inset-left));
    padding-right: max(var(--page-pad), env(safe-area-inset-right));
  }
}

/* The previous touch rule forced four tracks through portrait tablet widths.
   On some Chromium/Brave builds the visual viewport is narrower than the
   layout viewport, so the fourth card and the settings icon were clipped. */
@media (orientation: portrait) and (min-width: 701px) and (max-width: 1100px) and (any-pointer: coarse) {
  .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .result-filters { overflow: hidden; }
  .filter-group { min-width: 0; max-width: 100%; }
}

@media (max-width: 520px) {
  .settings-cache-button { align-items: flex-start; }
  .settings-cache-button-label { margin-top: 1px; }
}

/* CactusTV opening ident. The home remains laid out behind the modal. */
html:has(.cactus-intro[open]) { scrollbar-color: #000 #000; }
.cactus-intro:not([open]) { display: none; }
.cactus-intro[open] {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  background: #000;
  isolation: isolate;
}
.cactus-intro::backdrop { background: transparent; }
.cactus-intro-scene {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.cactus-intro-lockup {
  display: grid;
  justify-items: center;
  gap: clamp(12px, 2.75vmin, 24px);
  margin-bottom: min(7vh, 64px);
  position: relative;
  /* Move the lockup 10 units on a 360-unit vertical axis. */
  inset-block-start: calc(-100% / 36);
  color: #aa0711;
}
.cactus-intro-mark {
  display: block;
  width: calc(clamp(56px, 14vmin, 112px) * .8);
  height: auto;
  animation: cactus-intro-rise 560ms 60ms cubic-bezier(.22,.61,.36,1) both;
}
.cactus-intro-word {
  display: grid;
  grid-template-columns: .53em .54em .53em .48em .54em .50em .48em .54em;
  justify-items: center;
  gap: .035em;
  font-family: Arial, sans-serif;
  font-size: calc(clamp(48px, min(15vw, 28vh), 142px) * .85);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}
.cactus-intro-word span {
  width: .88em;
  text-align: center;
  /* Each pair shares a height and delay. The outer letters extend the baseline arc. */
  scale: .74 var(--height, 1.13);
  rotate: var(--tilt, 0deg);
  transform-origin: center 30%;
  animation: cactus-intro-letter 490ms var(--delay, 300ms) cubic-bezier(.22,.61,.36,1) both;
}
.cactus-intro-word span:nth-child(-n+4) { --entry-x: .16em; --clip-left: 100%; --clip-right: 0%; }
.cactus-intro-word span:nth-child(n+5) { --entry-x: -.16em; --clip-left: 0%; --clip-right: 100%; }
.cactus-intro-word span:is(:nth-child(3), :nth-child(6)) { --delay: 405ms; --height: 1.16; }
.cactus-intro-word span:is(:nth-child(2), :nth-child(7)) { --delay: 510ms; --height: 1.21; }
.cactus-intro-word span:is(:first-child, :last-child) { --delay: 615ms; --height: 1.28; }
.cactus-intro-word span:first-child { --tilt: -3.2deg; }
.cactus-intro-word span:nth-child(2) { --tilt: -2deg; }
.cactus-intro-word span:nth-child(3) { --tilt: -1deg; }
.cactus-intro-word span:nth-child(6) { --tilt: 1deg; }
.cactus-intro-word span:nth-child(7) { --tilt: 2deg; }
.cactus-intro-word span:last-child { --tilt: 3.2deg; }
.cactus-intro.is-returning { animation: cactus-intro-cover 260ms ease-in-out both; }
.cactus-intro.is-leaving { animation: cactus-intro-out 520ms ease-in-out both; }
.cactus-intro.is-leaving .cactus-intro-lockup { animation: cactus-intro-brand-out 340ms ease-in-out both; }

@keyframes cactus-intro-cover { from { opacity: 0; } to { opacity: 1; } }
@keyframes cactus-intro-rise {
  from { opacity: 0; transform: translateY(clamp(6px, 1.25vmin, 12px)); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cactus-intro-letter {
  from {
    opacity: 0;
    transform: translateX(var(--entry-x));
    clip-path: inset(-25% var(--clip-right) -25% var(--clip-left));
  }
  78%, to { clip-path: inset(-25% -12%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes cactus-intro-brand-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes cactus-intro-out {
  0%, 18% { opacity: 1; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cactus-intro[open], .cactus-intro * { animation: none !important; transition: none !important; }
}



/* ===== assets/v4.css ===== */
/* Legacy shared component styles. Cinema layout lives in v5-redesign.css. */

:root {
  /* 动效 token：全局统一 180–220ms cubic-bezier */
  --v4-ease: cubic-bezier(.2, .75, .2, 1);
  --v4-ease-out: cubic-bezier(.16, 1, .3, 1);
  --v4-dur: 200ms;
  --v4-dur-fast: 180ms;
  --v4-dur-slow: 220ms;
  /* 圆角 / 阴影 / 玻璃 */
  --v4-radius: 8px;
  --v4-radius-sm: 6px;
  --v4-shadow-card: 0 18px 40px rgba(0, 0, 0, .62);
  --v4-shadow-hover: 0 24px 54px rgba(0, 0, 0, .78);
  --v4-glass: rgba(13, 13, 13, .86);
  --v4-glass-strong: rgba(10, 10, 10, .94);
  --v4-line: rgba(255, 255, 255, .1);
  --v4-line-strong: rgba(255, 255, 255, .22);
  /* 骨架 shimmer */
  --v4-skeleton-a: #141414;
  --v4-skeleton-b: #242424;
  --v4-skeleton-bg: linear-gradient(100deg, var(--v4-skeleton-a) 18%, var(--v4-skeleton-b) 40%, var(--v4-skeleton-a) 62%);
  /* 移动端底部导航高度（不含 safe-area） */
  --v4-tabbar-h: 58px;
}

/* 角标统一：评分★ / 集数 / 源数量 用同一规格（app.js 负责“三选一”取值） */
body .poster .badge,
body .poster .rating {
  left: 8px;
  top: 8px;
  max-width: calc(100% - 56px);
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: rgba(0, 0, 0, .66);
  color: #fff;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: .01em;
  backdrop-filter: blur(8px);
}
body .poster .rating {
  color: #ffd76a;
}
@media (pointer: coarse) {
  body .poster .badge,
  body .poster .rating {
    font-size: 9.5px;
    padding: 3px 6px;
    backdrop-filter: none;
  }
}
body .watch-progress {
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 3px;
  background: rgba(255, 255, 255, .24);
}
body .watch-progress > i {
  background: linear-gradient(90deg, var(--red), #ff4a52);
}

/* ============================================================================
   2. 骨架屏：首页 / 搜索 / 详情三处统一 shimmer。
   尺寸与真实卡片一致（2:3 竖版），避免内容到达时的 CLS。
   ============================================================================ */
body .skeleton {
  aspect-ratio: 2 / 3;
  border-radius: var(--v4-radius);
  background: var(--v4-skeleton-bg);
  background-size: 220% 100%;
  animation: v4-shimmer 1.5s linear infinite;
}
@keyframes v4-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}
/* 图片失败占位增强：标题首字 + 径向渐变，保证不会出现纯黑大块 */
body .poster-fallback,
body .detail-cover-fallback,
body .detail-thumb-fallback {
  background:
    radial-gradient(120% 90% at 50% 14%, #2e2e2e 0%, #171717 52%, #0d0d0d 100%);
  color: rgba(255, 255, 255, .74);
  font-weight: 900;
  letter-spacing: -.02em;
}
body .poster-fallback {
  font-size: 42px;
}
@media (max-width: 700px) {
  body .poster-fallback {
    font-size: 34px;
  }
}

/* 首页首屏：分类行还没渲染出来时先放一条骨架，避免 Hero 下方出现空白断层 */
#homeSections:empty {
  min-height: 232px;
}
#homeSections:empty::before {
  content: "";
  display: block;
  height: 168px;
  margin: 22px var(--page-pad) 0;
  border-radius: 12px;
  background: var(--v4-skeleton-bg);
  background-size: 220% 100%;
  opacity: .55;
  animation: v4-shimmer 1.7s linear infinite;
}

/* 搜索骨架：#skeletons 与 #mediaGrid 同网格，这里只统一尺寸/圆角 */
body #skeletons .skeleton {
  aspect-ratio: 2 / 3;
}

/* 详情弹层骨架：openDetail 期间 app.js 会写入 .empty-state（无 h3 = 加载态），
   用 :has 精确命中，不污染“加载失败”态；不支持 :has 的浏览器保持原文案。 */
@supports selector(:has(*)) {
  #detailContent > .empty-state:not(:has(h3)) {
    position: relative;
    max-width: none;
    margin: 0;
    padding: 0 0 42px;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-align: center;
    overflow: hidden;
  }
  #detailContent > .empty-state:not(:has(h3)) .empty-icon {
    display: none;
  }
  #detailContent > .empty-state:not(:has(h3))::before {
    content: "";
    display: block;
    height: min(38vw, 320px);
    min-height: 200px;
    background: var(--v4-skeleton-bg);
    background-size: 220% 100%;
    animation: v4-shimmer 1.7s linear infinite;
  }
  #detailContent > .empty-state:not(:has(h3))::after {
    content: "";
    display: block;
    width: min(880px, calc(100% - 48px));
    height: 190px;
    margin: -64px auto 0;
    border-radius: 12px;
    background: var(--v4-skeleton-bg);
    background-size: 220% 100%;
    animation: v4-shimmer 1.7s linear infinite;
  }
  #detailContent > .empty-state:not(:has(h3)) p {
    position: relative;
    z-index: 1;
    width: fit-content;
    margin: -58px auto 0;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .6);
    color: #bdbdbd;
    font-size: 12px;
  }
}

/* ============================================================================
   3. 首页「继续观看」(#heroContinue)：海报下方的独立卡片
   ============================================================================ */
#heroContinue[hidden] {
  display: none !important;
}
body.compact-view #heroContinue {
  display: none !important;
}
.v4-continue-card {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  background: var(--v4-glass);
  color: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 16px 42px rgba(0, 0, 0, .52);
  backdrop-filter: blur(16px) saturate(140%);
  transition: transform var(--v4-dur) var(--v4-ease),
    background var(--v4-dur) var(--v4-ease),
    border-color var(--v4-dur) var(--v4-ease);
}
.v4-continue-card:hover,
.v4-continue-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, .34);
  background: rgba(20, 20, 20, .9);
}
.v4-continue-card:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
.v4-continue-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 56px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--v4-radius-sm);
  background: radial-gradient(120% 90% at 50% 18%, #2c2c2c, #111 76%);
  color: rgba(255, 255, 255, .72);
  font-size: 17px;
  font-weight: 900;
}
.v4-continue-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.v4-continue-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.v4-continue-kicker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #ff5a63;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: .1em;
}
.v4-continue-kicker::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.v4-continue-title {
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v4-continue-meta {
  overflow: hidden;
  color: #b6b6b6;
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v4-continue-progress {
  position: relative;
  height: 3px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
}
.v4-continue-progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), #ff5a63);
  transition: width var(--v4-dur-slow) var(--v4-ease-out);
}
.v4-continue-play {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #111;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.v4-continue-play svg {
  width: 18px;
  height: 18px;
  margin-left: 1px;
}
@media (max-width: 899px), (hover: none) {
  .v4-continue-card {
    min-height: 60px;
  }
}
@media (max-width: 520px) {
  .v4-continue-thumb {
    width: 34px;
    height: 48px;
  }
  .v4-continue-title {
    font-size: 12.5px;
  }
  .v4-continue-meta {
    font-size: 10.5px;
  }
  .v4-continue-play {
    width: 34px;
    height: 34px;
  }
}
@media (min-width: 900px) and (max-width: 1100px) {
  .v4-continue-thumb {
    display: none;
  }
}

/* ============================================================================
   4. 分类 chips：选中态加强；移动端横向滚动 + 两端渐隐
   ============================================================================ */
body .category-chip {
  min-height: 38px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, .16);
  background: rgba(20, 20, 20, .78);
  color: #d6d6d6;
  font-weight: 600;
  transition: color var(--v4-dur-fast) var(--v4-ease),
    background var(--v4-dur-fast) var(--v4-ease),
    border-color var(--v4-dur-fast) var(--v4-ease),
    box-shadow var(--v4-dur-fast) var(--v4-ease);
}
body .category-chip:hover {
  border-color: rgba(255, 255, 255, .42);
  background: rgba(255, 255, 255, .12);
  color: #fff;
}
body .category-chip.active {
  border-color: var(--red);
  background: linear-gradient(180deg, #f6121d 0%, #c40811 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(229, 9, 20, .26);
}
body .filter-chip.active {
  border-color: rgba(229, 9, 20, .7);
  background: rgba(229, 9, 20, .18);
  color: #fff;
}
@media (max-width: 900px), (pointer: coarse) {
  body .category-nav {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent 100%);
  }
  body .category-chip {
    min-height: 40px;
    font-size: 12.5px;
  }
}
@media (pointer: coarse) {
  body .category-chip,
  body .filter-chip,
  body .source-choice {
    min-height: 44px;
  }
}

/* ============================================================================
   5. 详情弹层增强（桌面保留居中弹层；≤1024 触屏已是全屏，见 styles.css）
   海报/评分/类型/简介折叠/剧集网格在移动端更紧凑，触摸目标 ≥44px。
   ============================================================================ */
body .detail-title-copy h2 {
  text-wrap: balance;
}
body .detail-primary-play {
  transition: transform var(--v4-dur-fast) var(--v4-ease),
    background var(--v4-dur-fast) var(--v4-ease);
}
body .detail-primary-play:hover {
  background: #f2f2f2;
  transform: translateY(-1px);
}
body .detail-more {
  min-height: 32px;
  padding: 0 2px;
  color: #b9b9b9;
  font-weight: 600;
}
body .detail-more:hover {
  color: #fff;
}
body .detail-main .episode {
  transition: border-color var(--v4-dur-fast) var(--v4-ease),
    background var(--v4-dur-fast) var(--v4-ease),
    transform var(--v4-dur-fast) var(--v4-ease);
}
body .detail-main .episode:hover {
  border-color: rgba(255, 255, 255, .6);
  background: #303030;
}
body .episode.is-current {
  border-color: var(--green);
}

@media (max-width: 700px) {
  body #detailDialog.sheet {
    height: 100dvh;
  }
  body .detail-masthead {
    max-height: 240px;
  }
  body .detail-main {
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
  }
  body .detail-title-copy h2 {
    padding-right: 52px;
    letter-spacing: -.03em;
  }
  body .detail-meta {
    gap: 6px;
  }
  body .detail-meta span {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 999px;
    background: rgba(255, 255, 255, .05);
    color: #cfcfcf;
    font-size: 11px;
  }
  body .detail-meta span:first-child {
    border-color: rgba(70, 211, 105, .3);
    background: rgba(70, 211, 105, .12);
    color: var(--green);
  }
  body .detail-primary-play {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    margin: 16px 0 0;
  }
  body .detail-source-bar {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
  }
  body .detail-overview-wrap {
    margin-top: 16px;
  }
  body .detail-overview {
    font-size: 13.5px;
    line-height: 1.62;
  }
  body .detail-overview.collapsed {
    -webkit-line-clamp: 3;
  }
  body .detail-main .episodes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  body .detail-main .episode {
    min-height: 44px;
    padding: 0 4px;
    font-size: 12px;
  }
  body .episode-heading h3 {
    font-size: 17px;
  }
  body .detail-main .episode-block {
    padding-top: 20px;
  }
}
@media (max-width: 390px) {
  body .detail-main .episodes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ============================================================================
   7. 搜索联想下拉 (#searchSuggest) + 搜索历史/热搜 (#searchRecent)
   #searchSuggest 绝对定位挂在 .top-search 下（桌面 .top-search 是 absolute，
   移动端是 fixed，均能作为包含块）；纯 overlay，不占文档流 → 无 CLS。
   ============================================================================ */
#searchSuggest {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 9;
  max-height: min(62vh, 460px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  background: rgba(13, 13, 13, .97);
  box-shadow: 0 26px 64px rgba(0, 0, 0, .68);
  backdrop-filter: blur(18px) saturate(140%);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .22) transparent;
  animation: v4-drop-in var(--v4-dur-fast) var(--v4-ease-out);
}
#searchSuggest[hidden] {
  display: none !important;
}
@keyframes v4-drop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
#searchSuggest::-webkit-scrollbar {
  width: 8px;
}
#searchSuggest::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
}
.v4-suggest-section {
  margin: 0 0 6px;
  padding: 0;
}
.v4-suggest-section:last-child {
  margin-bottom: 0;
}
.v4-suggest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 4px;
  color: #8b8b8b;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
}
.v4-suggest-clear {
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: transparent;
  color: #9a9a9a;
  font-size: 11px;
  cursor: pointer;
  transition: color var(--v4-dur-fast) var(--v4-ease),
    border-color var(--v4-dur-fast) var(--v4-ease);
}
.v4-suggest-clear:hover {
  border-color: rgba(255, 255, 255, .36);
  color: #fff;
}
.v4-suggest-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.v4-suggest-item {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 5px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #e8e8e8;
  text-align: left;
  cursor: pointer;
  transition: background var(--v4-dur-fast) var(--v4-ease);
}
.v4-suggest-item:hover,
.v4-suggest-item.is-active {
  background: rgba(255, 255, 255, .09);
}
.v4-suggest-item.is-active .v4-suggest-title {
  color: #fff;
}
.v4-suggest-thumb {
  flex: 0 0 auto;
  width: 34px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 5px;
  background: radial-gradient(120% 90% at 50% 18%, #2c2c2c, #111 76%);
  color: rgba(255, 255, 255, .66);
  font-size: 15px;
  font-weight: 900;
}
.v4-suggest-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.v4-suggest-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.v4-suggest-title {
  overflow: hidden;
  color: #e6e6e6;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v4-suggest-meta {
  overflow: hidden;
  color: #8f8f8f;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v4-suggest-enter {
  flex: 0 0 auto;
  color: #757575;
  font-size: 11px;
}
.v4-suggest-search-hint {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 7px;
  background: rgba(255, 255, 255, .03);
  color: #d4d4d4;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
}
.v4-suggest-search-hint:hover,
.v4-suggest-search-hint.is-active {
  border-color: rgba(255, 255, 255, .24);
  background: rgba(255, 255, 255, .08);
  color: #fff;
}
.v4-suggest-search-hint strong {
  color: #fff;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v4-suggest-search-hint svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: #9a9a9a;
}
.v4-recent-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.v4-recent-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #dcdcdc;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.v4-recent-main:hover,
.v4-recent-main.is-active {
  background: rgba(255, 255, 255, .09);
  color: #fff;
}
.v4-recent-main svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: #7d7d7d;
}
.v4-recent-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v4-recent-remove {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #6f6f6f;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.v4-recent-remove:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}
.v4-hot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 6px 6px;
}
.v4-hot-chip {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: #d2d2d2;
  font-size: 12px;
  cursor: pointer;
  transition: color var(--v4-dur-fast) var(--v4-ease),
    border-color var(--v4-dur-fast) var(--v4-ease),
    background var(--v4-dur-fast) var(--v4-ease);
}
.v4-hot-chip:hover,
.v4-hot-chip.is-active {
  border-color: rgba(255, 255, 255, .32);
  background: rgba(255, 255, 255, .1);
  color: #fff;
}
.v4-suggest-empty {
  padding: 14px 10px;
  color: #8c8c8c;
  font-size: 12px;
  text-align: center;
}
@media (max-width: 700px) {
  #searchSuggest {
    top: calc(100% + 1px);
    right: -1px;
    left: -1px;
    max-height: min(64vh, 430px);
    padding: 6px;
    border-radius: 0 0 12px 12px;
    border-top: 0;
    background: rgba(10, 10, 10, .99);
  }
  .v4-hot-chip,
  .v4-recent-main,
  .v4-suggest-item {
    min-height: 44px;
  }
  .v4-recent-remove {
    width: 44px;
    height: 44px;
  }
}
@media (hover: none) {
  #searchSuggest {
    backdrop-filter: none;
  }
}

/* ============================================================================
   8. 页脚合规入口 (#legalFooter)：由 v4-ui.js 注入到现有 footer 之后
   与 pages 的 pwa.js 协作：pwa.js 可把「安装到桌面」按钮插到本容器内。
   ============================================================================ */
#legalFooter {
  width: calc(100% - var(--page-pad) * 2);
  margin: 0 var(--page-pad);
  padding: 16px 0 30px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  color: #6f6f6f;
  font-size: 11.5px;
  line-height: 1.6;
}
#legalFooter[hidden] {
  display: none !important;
}
.v4-legal-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}
.v4-legal-links li {
  display: inline-flex;
}
.v4-legal-links a,
.v4-legal-links button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: #8f8f8f;
  font-size: 11.5px;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--v4-dur-fast) var(--v4-ease);
}
.v4-legal-links a:hover,
.v4-legal-links a:focus-visible,
.v4-legal-links button:hover,
.v4-legal-links button:focus-visible {
  color: #fff;
}
.v4-legal-version {
  margin-left: auto;
  color: #5d5d5d;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.v4-legal-version-item {
  margin-left: auto;
}
.v4-legal-version-item .v4-legal-version {
  margin-left: 0;
}
.v4-legal-note {
  max-width: 860px;
  margin: 0;
  color: #5d5d5d;
  font-size: 11px;
  line-height: 1.65;
}
.v4-legal-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.v4-legal-actions:empty {
  display: none;
}
@media (pointer: coarse) {
  .v4-legal-links a,
  .v4-legal-links button {
    min-height: 44px;
    font-size: 12.5px;
    color: #9a9a9a;
  }
  #legalFooter {
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
}
@media (max-width: 660px) {
  .v4-legal-version {
    margin-left: 0;
  }
  .v4-legal-version-item {
    margin-left: 0;
  }
}

/* ============================================================================
   9. 动效降级：prefers-reduced-motion / .performance-lite / 触屏
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  #heroContinue,
  #heroContinue *,
  #mobileTabbar,
  #mobileTabbar *,
  #searchSuggest,
  .v4-suggest-item,
  .v4-hot-chip,
  #legalFooter,
  #legalFooter *,
  body .media-card,
  body .media-card::after,
  body .media-card .poster,
  body .media-card .poster img {
    animation: none !important;
    transition: none !important;
  }
  body .media-card:hover,
  body .media-card:focus-visible,
  body .media-card:hover .poster img,
  .v4-continue-card:hover {
    transform: none;
  }
  #homeSections:empty::before {
    animation: none !important;
    opacity: .4;
  }
}
.performance-lite #mobileTabbar.v4-tabbar {
  backdrop-filter: none;
  background: #0b0b0b;
}
.performance-lite .v4-continue-card {
  backdrop-filter: none;
  background: rgba(12, 12, 12, .94);
}
.performance-lite #searchSuggest {
  backdrop-filter: none;
  background: #101010;
  animation: none;
}
.performance-lite body .media-card::after {
  transition: none;
}
.performance-lite body .media-card:hover {
  transform: none;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .6);
}
.performance-lite .v4-tab {
  transition: none;
}

/* ============================================================================
   10. 三档验收微调：1440×900 / 1024×768 / 390×844
   ============================================================================ */
@media (min-width: 1200px) {
  body .card-overlay strong {
    font-size: 14.5px;
  }
}
@media (max-width: 390px) {
  .v4-continue-meta {
    max-width: 100%;
  }
}

/* 2) 首页骨架与真实海报墙同尺寸（2:3），避免骨架→真实内容替换时整页跳动 */
.home-skeleton-row-cards { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(138px, 13.2vw, 196px); gap: 10px; overflow: hidden; }
.home-skeleton-row-cards .skeleton { aspect-ratio: 2 / 3; border-radius: 6px; }
.home-skeleton-row .skeleton-title { width: clamp(120px, 12vw, 180px); height: 20px; aspect-ratio: auto; border-radius: 4px; }
.home-skeleton-row .section-heading { min-height: 34px; }
#categoryNav .category-chip.is-placeholder { opacity: .35; pointer-events: none; }

/* 3) 播放器：移动端也允许打开诊断/复制（原 styles.css 在 <700px 隐藏该按钮） */
@media (max-width: 700px) {
  #playerDiagnostics { display: inline-flex !important; }
}

/* 4) 卡片角标与图片兜底统一 */
.media-card .update-badge { top: auto; bottom: 8px; left: 8px; background: rgba(70, 211, 105, .92); color: #04160a; }
.media-card .poster-fallback { display: grid; place-items: center; width: 100%; height: 100%; font-size: 34px; font-weight: 900; color: rgba(255,255,255,.34); background: linear-gradient(135deg, #1a1a1a, #101010); }
.detail-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.detail-badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); font-size: 12px; font-weight: 700; color: #e8e8e8; }
.detail-badge.clean-badge { background: rgba(70, 211, 105, .16); border-color: rgba(70, 211, 105, .42); color: #9df3b6; }
.detail-badge.update-badge { background: rgba(229, 9, 20, .16); border-color: rgba(229, 9, 20, .42); color: #ffb3b8; }
.detail-badge.subtle-badge { opacity: .72; font-weight: 600; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0 4px; }
.detail-favorite-button { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid rgba(255,255,255,.24); background: rgba(255,255,255,.08); color: #fff; font-weight: 700; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.detail-favorite-button:hover { background: rgba(255,255,255,.16); transform: translateY(-1px); }
.detail-favorite-button.active { border-color: rgba(229, 9, 20, .6); background: rgba(229, 9, 20, .18); color: #ffd7d9; }
.detail-skeleton { padding: 24px; display: grid; gap: 14px; }
.detail-skeleton .skeleton-cover { width: 100%; height: clamp(180px, 32vh, 320px); border-radius: 12px; }
.detail-skeleton .skeleton-line { width: 70%; height: 18px; border-radius: 6px; }
.detail-skeleton .skeleton-line.short { width: 40%; }
.setting-group { margin: 22px 0; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }
.setting-group h3 { margin: 0 0 12px; font-size: 15px; letter-spacing: .02em; color: #f0f0f0; }
.setting-hint { margin: 10px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--muted, #b3b3b3); }
.setting-hint.ok { color: #9df3b6; }
.setting-hint.error { color: #ffb3b8; }
.setting-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.migrate-panel { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.migrate-panel input { flex: 1 1 160px; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #fff; letter-spacing: .18em; text-transform: uppercase; }
.setting-links { display: flex; flex-wrap: wrap; gap: 14px; }
.setting-links a { color: #d7d7d7; text-decoration: underline; text-underline-offset: 3px; }
.setting-links a:hover { color: #fff; }
.setting-row-number input { width: 92px; min-height: 36px; text-align: center; }
.empty-state .empty-retry { margin-top: 14px; }

/* ============================================================================
   V4.0 集成补丁 2（lead 维护）：首屏 CLS 消除 / hidden 属性兜底
   ============================================================================ */

/* A) 首屏骨架期间为下方内容预留高度：
    footer 一开始就在视口之外，之后内容填充不会把已渲染元素顶掉 → 不再产生 CLS。 */
body.home-loading #categoryNav {
  display: block !important;
  visibility: hidden;
  min-height: 42px;
  padding: 0;
}
body.home-loading #homeSections {
  min-height: 1180px;
}
@media (max-width: 900px) {
  body.home-loading #homeSections { min-height: 980px; }
}
@media (max-width: 520px) {
  body.home-loading #homeSections { min-height: 900px; }
}

/* B) hidden 属性兜底：v4-ui.js 只切 el.hidden，若该元素 CSS 自带 display 会覆盖原生 hidden */
#heroContinue[hidden],
#searchSuggest[hidden],
#searchRecent[hidden],
#v4SuggestList[hidden],
#mobileTabbar[hidden] { display: none !important; }

/* C) 分类 chips 占位高度与真实 chips 一致（骨架期不跳动） */
#categoryNav .category-chip.is-placeholder { min-height: 34px; min-width: 64px; }

#v5Banners[hidden], #v5Specials[hidden] { display: none !important; }

/* ============================================================================
   V5 集成补丁 5：搜索/片单等 compact-view 视图 —— 折叠 Hero 空白 + 修正跳转链接
   背景：V4 为消除 CLS 用 !important 固定了 .hero 高度，导致搜索页
        .compact-view 只隐藏了 Hero 内容却保留 558px 高黑块（用户反馈）。
   ============================================================================ */
/* 搜索/片单视图内容区顶到固定头部下方即可（保留安全间距） */
body.compact-view #resultsSection { padding-top: calc(var(--header-h) + 26px); }
body.compact-view #homeSections { padding-top: 0; }

/* 「跳到主内容」无障碍链接：平时隐藏，键盘聚焦时才出现 */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 2000;
  padding: 10px 16px;
  border-radius: 10px;
  background: #151515;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  border: 1px solid rgba(255,255,255,.18);
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 16px;
  outline: 2px solid var(--red, #e50914);
  outline-offset: 2px;
}

/* ============================================================================
   V5 集成补丁 6：详情弹层「播放 / 收藏」按钮行对齐与样式统一
   问题：.detail-primary-play 自带 margin:22px 0 0 154px（用于单独成行），放进
        .detail-actions flex 行后垂直错位、圆角/尺寸与收藏按钮不一致。
   方案：容器统一左缩进（对齐标题文字列），按钮同高同圆角、统一间距；移动端占满。
   ============================================================================ */
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 20px 0 6px;
  padding-left: 154px; /* 与海报 132px + 间距 22px 的文字列对齐 */
}
.detail-actions .detail-primary-play {
  margin: 0;
  min-width: 200px;
  height: 46px;
  min-height: 46px;
  padding: 0 24px;
  border-radius: 6px;
  background: #fff;
  color: #111;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.detail-actions .detail-primary-play:hover { background: #ececec; }
.detail-actions .detail-favorite-button {
  height: 46px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.26);
  background: rgba(255,255,255,.06);
  color: #f2f2f2;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
}
.detail-actions .detail-favorite-button:hover {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.38);
}
.detail-actions .detail-favorite-button.active {
  border-color: rgba(229,9,20,.62);
  background: rgba(229,9,20,.16);
  color: #ff8b90;
}
.detail-actions .detail-favorite-button.active:hover {
  background: rgba(229,9,20,.24);
}
.detail-actions .detail-primary-play svg,
.detail-actions .detail-favorite-button > span[aria-hidden] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex: 0 0 auto;
}
.detail-actions .detail-primary-play svg { width: 20px; height: 20px; }
.detail-actions .detail-favorite-button > span[aria-hidden] { font-size: 16px; }

@media (max-width: 900px) {
  .detail-actions { padding-left: 0; }
}
@media (max-width: 700px) {
  .detail-actions {
    flex-wrap: nowrap;
    gap: 10px;
    margin: 14px 0 2px;
    padding-left: 0;
  }
  .detail-actions .detail-favorite-button { flex: 0 0 auto; }
  .detail-actions .detail-primary-play {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 16px;
    font-size: 15px;
  }
  .detail-actions .detail-favorite-button { padding: 0 14px; font-size: 14px; }
}



/* ===== assets/v5-content.css ===== */
/* =============================================================================
 * v5-content.css — 放映厅 V5 内容运营层（首页 Banner / 专题 / 专题弹层）
 * 依赖：仅 styles.css 的 CSS 变量（--bg/--panel/--line/--red/--muted/--page-pad…）；
 *      不引外链/字体/CDN，不改 v4.css、styles.css。
 * 容器：lead 在 index.html 预留 #v5Banners / #v5Specials 时直接复用（本文件不关心位置）；
 *      未预留时 v5-content.js 会自建 .v5-ops 包裹层插到 Hero 之后。
 * 结构：
 *   .v5-ops（可选包裹层）
 *     #v5Banners  .v5-banner-row > .v5-banner（横滑，16:7 大卡）
 *     #v5Specials .v5-ops-head + .v5-special-row > .v5-special-card（横排专题）
 *   #v5SpecialDialog（专题弹层，自建 dialog）
 * 断点：默认桌面 / 1024 / 768 / 640（手机全屏弹层）
 * ========================================================================== */

/* ---------------------------------------------------------------------------
 * 1. 运营层外壳与首页布局校正
 *    JS 渲染成功后才给 body 加 .v5-ops-active：
 *    首页分区原本靠负边距叠在 Hero 上，运营层插进来后需要把负边距归零，
 *    否则第一排卡片会压到 Banner 上（只影响运营层存在时的首页）。
 * ------------------------------------------------------------------------ */
.v5-ops {
  position: relative;
  z-index: 6;
  padding: 10px 0 8px;
  margin: 0 0 18px;
}

/* 运营层可见时把首页负边距归零：用「兄弟节点 + :not([hidden])」静态条件，
   避免运行时切换 body class 引起布局位移（CLS）。 */
#v5Banners:not([hidden]) ~ #categoryNav,
#v5Banners:not([hidden]) ~ #homeSections { margin-top: 0; }

/* 非首页视图（搜索 / 片单等）：运营层隐藏，不挤压结果区 */
body.v5-ops-view-hidden #v5Banners,
body.v5-ops-view-hidden #v5Specials,
body.v5-ops-view-hidden .v5-ops { display: none !important; }

#v5Banners,
#v5Specials {
  position: relative;
  display: block;
  min-height: 0;
}

/* lead 在 index.html 预留的静态容器：自身负责上下间距（JS 自建 .v5-ops 包裹层时由包裹层负责） */
#v5Banners { margin: 8px 0 0; }
#v5Specials { margin: 0 0 26px; }
.v5-ops #v5Banners { margin-top: 0; }
.v5-ops #v5Specials { margin-bottom: 0; }

#v5Banners[hidden],
#v5Specials[hidden],
.v5-banner-row[hidden] { display: none !important; }

/* ---------------------------------------------------------------------------
 * 2. 通用：分区标题 / 横滑轨道 / 空态
 * ------------------------------------------------------------------------ */
.v5-ops-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 0 var(--page-pad);
  margin: 18px 0 10px;
}

.v5-ops-head h2 {
  margin: 0;
  font-size: clamp(18px, 1.7vw, 24px);
  line-height: 1.15;
  letter-spacing: -.02em;
}

.v5-ops-head span {
  color: var(--muted);
  font-size: 12px;
}

.v5-scroller {
  display: flex;
  gap: 10px;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px var(--page-pad) 12px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.v5-scroller::-webkit-scrollbar { display: none; }
.v5-scroller > * { scroll-snap-align: start; }

/* 加载骨架（首页 40s 缓存失效 / 首屏等待时占位，避免内容跳动） */
.v5-skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(100deg, #141414 18%, #242424 40%, #141414 62%);
  background-size: 220% 100%;
  animation: v5-shimmer 1.4s ease-in-out infinite;
}

@keyframes v5-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -40% 0; }
}

/* ---------------------------------------------------------------------------
 * 3. Banner 横滑条
 * ------------------------------------------------------------------------ */
.v5-banner {
  position: relative;
  flex: 0 0 clamp(300px, 42vw, 620px);
  aspect-ratio: 16 / 7;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  scroll-snap-align: start;
  box-shadow: 0 16px 38px rgba(0, 0, 0, .45);
  transition: transform .22s cubic-bezier(.2, .75, .2, 1), box-shadow .22s ease;
  -webkit-tap-highlight-color: transparent;
}

.v5-banner:hover,
.v5-banner:focus-visible { transform: scale(1.02); box-shadow: 0 22px 52px rgba(0, 0, 0, .62); outline: none; }
.v5-banner:focus-visible { box-shadow: 0 0 0 2px var(--red), 0 22px 52px rgba(0, 0, 0, .62); }

.v5-banner > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: var(--panel);
}

.v5-banner-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .86) 0%, rgba(0, 0, 0, .5) 42%, rgba(0, 0, 0, .06) 74%),
    linear-gradient(180deg, rgba(0, 0, 0, .08) 40%, rgba(0, 0, 0, .58) 100%);
  pointer-events: none;
}

.v5-banner-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: clamp(14px, 1.6vw, 22px);
  pointer-events: none;
}

.v5-banner-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}

.v5-banner-title {
  font-size: clamp(17px, 1.6vw, 26px);
  line-height: 1.15;
  letter-spacing: -.02em;
  font-weight: 900;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .7);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.v5-banner-subtitle {
  color: rgba(255, 255, 255, .82);
  font-size: clamp(12px, 1vw, 14px);
  line-height: 1.45;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .7);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.v5-banner-cta {
  margin-top: 2px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  opacity: .9;
}

.v5-banner-cta::after { content: " ›"; }

.v5-banner.is-broken .v5-banner-shade { background: linear-gradient(90deg, #1c1c1c, #101010); }

/* ---------------------------------------------------------------------------
 * 4. 专题横排卡片
 * ------------------------------------------------------------------------ */
.v5-special-card {
  position: relative;
  flex: 0 0 clamp(220px, 24vw, 320px);
  aspect-ratio: 16 / 9;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform .2s cubic-bezier(.2, .75, .2, 1), border-color .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.v5-special-card:hover,
.v5-special-card:focus-visible { transform: translateY(-2px); border-color: var(--line-strong); outline: none; }
.v5-special-card:focus-visible { box-shadow: 0 0 0 2px var(--red); }

.v5-special-card > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: var(--panel);
}

.v5-special-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .04) 34%, rgba(0, 0, 0, .82) 100%);
  pointer-events: none;
}

.v5-special-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  pointer-events: none;
}

.v5-special-title {
  font-size: clamp(14px, 1.15vw, 17px);
  font-weight: 800;
  line-height: 1.25;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .72);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.v5-special-meta {
  color: rgba(255, 255, 255, .72);
  font-size: 11px;
}

.v5-special-card.is-broken::after { background: linear-gradient(180deg, #1b1b1b, #0e0e0e); }

/* ---------------------------------------------------------------------------
 * 5. 专题弹层（dialog）
 * ------------------------------------------------------------------------ */
.v5-special-dialog {
  width: min(1040px, calc(100% - 28px));
  max-height: 90vh;
  padding: 0;
  overflow: hidden auto;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  background: #141414;
  color: var(--text);
  box-shadow: var(--shadow, 0 24px 70px rgba(0, 0, 0, .62));
  overscroll-behavior: contain;
}

#v5SpecialDialog::backdrop {
  background: rgba(0, 0, 0, .84);
  backdrop-filter: blur(6px);
}

.v5-dialog-close {
  position: sticky;
  top: 12px;
  z-index: 12;
  float: right;
  width: 38px;
  height: 38px;
  margin: 12px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  background: rgba(24, 24, 24, .92);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.v5-dialog-close:hover { background: rgba(50, 50, 50, .96); }

.v5-dialog-head {
  padding: 26px var(--page-pad, 28px) 14px;
}

.v5-dialog-head h2 {
  margin: 0;
  font-size: clamp(21px, 2.2vw, 30px);
  line-height: 1.18;
  letter-spacing: -.02em;
  padding-right: 46px;
}

.v5-dialog-desc {
  margin: 10px 0 0;
  max-width: 760px;
  color: var(--muted, #b3b3b3);
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-line;
}

.v5-dialog-count {
  display: inline-block;
  margin-top: 12px;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .08);
  color: #d8d8d8;
  font-size: 11.5px;
  font-weight: 700;
}

.v5-special-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 14px 12px;
  padding: 18px var(--page-pad, 28px) 30px;
}

.v5-film-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.v5-film-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: linear-gradient(135deg, #242424, #101010);
}

.v5-film-poster img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .28s ease, opacity .2s ease;
}

.v5-film-card:hover .v5-film-poster img,
.v5-film-card:focus-visible .v5-film-poster img { transform: scale(1.05); }

.v5-film-card:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 6px; }

.v5-film-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .66);
  font-size: 26px;
  font-weight: 900;
}

.v5-film-name {
  font-size: 12.5px;
  line-height: 1.35;
  color: #e6e6e6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.v5-film-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 2;
  max-width: calc(100% - 12px);
  overflow: hidden;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .72);
  color: #ffd76a;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 空态 / 加载态在网格里横跨整行 */
.v5-special-grid > .v5-dialog-empty,
.v5-special-grid > .v5-dialog-loading { grid-column: 1 / -1; }

.v5-dialog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 20px 44px;
  color: var(--muted, #b3b3b3);
  text-align: center;
}

.v5-dialog-empty strong { color: #fff; font-size: 15px; }
.v5-dialog-empty span { font-size: 12.5px; line-height: 1.55; }

/* 弹层加载骨架 */
.v5-dialog-loading {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 14px 12px;
  padding: 18px var(--page-pad, 28px) 34px;
}

.v5-dialog-loading .v5-skeleton { aspect-ratio: 2 / 3; }

body.v5-dialog-open { overflow: hidden; }

/* ---------------------------------------------------------------------------
 * 6. 响应式
 * ------------------------------------------------------------------------ */
@media (max-width: 1024px) {
  .v5-ops { margin-bottom: 14px; }
  .v5-banner { flex-basis: clamp(280px, 58vw, 520px); }
  .v5-special-card { flex-basis: clamp(200px, 34vw, 280px); }
}

@media (max-width: 768px) {
  #v5Banners { margin-top: 4px; }
  #v5Specials { margin-bottom: 18px; }
  .v5-ops-head { margin: 14px 0 8px; }
  .v5-scroller { gap: 8px; padding-bottom: 10px; }
  .v5-banner { flex-basis: min(76vw, 460px); aspect-ratio: 16 / 8; border-radius: 7px; }
  .v5-special-card { flex-basis: min(56vw, 300px); }
  .v5-special-grid { grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 12px 9px; }
  .v5-dialog-loading { grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 12px 9px; }
}

@media (max-width: 640px) {
  .v5-ops { padding-top: 6px; }
  .v5-banner { flex-basis: 84vw; aspect-ratio: 16 / 9; }
  .v5-special-card { flex-basis: 62vw; }
  .v5-dialog-head { padding: 22px 16px 10px; }

  /* 手机端专题弹层全屏，风格与详情弹层一致 */
  .v5-special-dialog {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .v5-special-dialog[open] { display: block; }
  .v5-dialog-close { position: fixed; top: 10px; right: 10px; margin: 0; }
  .v5-dialog-desc { font-size: 13px; }

  .v5-special-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 12px 8px;
    padding: 14px 16px 40px;
  }

  .v5-film-name { font-size: 12px; }
}

@media (max-width: 390px) {
  .v5-banner { flex-basis: 88vw; }
  .v5-special-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 低性能模式 / 减少动态效果：与 styles.css 的 .performance-lite 保持一致 */
.performance-lite .v5-banner,
.performance-lite .v5-special-card,
.performance-lite .v5-film-poster img { transition: none !important; }
.performance-lite .v5-banner:hover,
.performance-lite .v5-special-card:hover { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .v5-banner,
  .v5-special-card,
  .v5-film-poster img,
  .v5-skeleton { transition: none !important; animation: none !important; }
}


/* ===== assets/v5-commercial.css ===== */
/* 商业展示组件、页脚和播放器集成。 */

/* ================= V5 播放器布局健壮性（短窗口/缩放不再需要） ================= */
html.player-open, html.player-open body { overflow: hidden !important; }
@media (min-width: 901px) {
  .player-dialog {
    width: min(1180px, calc(100% - 18px), calc((100dvh - 156px) * 16 / 9));
    max-height: calc(100dvh - 16px);
  }
  .player-dialog[open] { display: flex; flex-direction: column; }
  .player-dialog > .player-head { flex: 0 0 auto; }
  .player-dialog > .video-shell { flex: 1 1 auto; width: 100%; min-height: 0; max-height: none; }
  .player-dialog > .player-tools { flex: 0 0 auto; max-height: 22vh; overflow-y: auto; }
}

/* ================= V12 商业广告 / 页脚 / 同意条 ================= */
.ad-slot { position: relative; margin: 0 var(--page-pad) 26px; border: 1px dashed rgba(255,255,255,.14); border-radius: 8px; background: rgba(255,255,255,.02); }
.ad-slot[hidden] { display: none !important; }
.ad-slot.is-active { display: block; padding: 14px; text-align: center; }
.ad-slot-label { position: absolute; top: 4px; left: 8px; color: rgba(255,255,255,.36); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; }
.ad-slot-hero { margin-top: 4px; }
.ad-slot-infeed { margin: 2px var(--page-pad) 30px; }
.ad-slot-player { margin: 0; border-radius: 0; border: 0; border-top: 1px solid rgba(255,255,255,.08); background: #0b0b0b; }
.ad-slot-player.is-active { padding: 10px 14px; }
.ad-slot-player .ad-slot-label { left: 14px; top: 2px; }
.ad-slot-body { display: flex; justify-content: center; align-items: center; min-height: 60px; overflow: hidden; }
.ad-slot-body img { max-width: 100%; height: auto; }
@media (max-width: 700px) { .ad-slot { margin-left: 14px; margin-right: 14px; } .ad-slot-infeed { margin-left: 14px; margin-right: 14px; } }

/* 页脚 4 栏 */
.site-footer { margin-top: 40px; padding: 38px var(--page-pad) 26px; border-top: 1px solid rgba(255,255,255,.09); background: #050505; }
.footer-grid { display: grid; grid-template-columns: minmax(0,1.5fr) repeat(3, minmax(0,1fr)); gap: 32px; max-width: 1280px; margin: 0 auto; }
.footer-brand p { margin: 12px 0 0; max-width: 420px; color: #8b8b8b; font-size: 12.5px; line-height: 1.8; }
.footer-brand .footer-note { color: #6f6f6f; font-size: 11.5px; }
.footer-logo { display: inline-flex; align-items: center; text-decoration: none; }
.footer-logo .brand-word { font-size: 22px; }
.footer-col { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.footer-col h3 { margin: 0 0 4px; color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.footer-col a { color: #9a9a9a; font-size: 12.5px; text-decoration: none; }
.footer-col a:hover { color: #fff; }
.footer-col p { margin: 0; color: #9a9a9a; font-size: 12.5px; overflow-wrap: anywhere; }
.footer-col .footer-muted, .footer-muted { color: #5f5f5f; font-size: 11.5px; }
.site-footer .legal-footer { margin-top: 8px; }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 22px; max-width: 1280px; margin: 26px auto 0; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.06); color: #6b6b6b; font-size: 11.5px; }
@media (max-width: 960px) { .footer-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* Cookie / 广告同意条 */
.ad-consent { position: fixed; left: 50%; bottom: 18px; z-index: 95; width: min(720px, calc(100% - 28px)); transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 14px 18px; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; background: rgba(16,16,16,.97); box-shadow: 0 18px 60px rgba(0,0,0,.6); backdrop-filter: blur(10px); }
.ad-consent p { flex: 1 1 320px; margin: 0; color: #cfcfcf; font-size: 12.5px; line-height: 1.7; }
.ad-consent-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.ad-consent-actions a { color: #a5a5a5; font-size: 12px; }
.ad-consent-actions button { min-height: 34px; padding: 0 16px; border: 0; border-radius: 6px; background: #fff; color: #111; font-size: 12.5px; font-weight: 800; cursor: pointer; }
@media (max-width: 620px) { .ad-consent { bottom: 12px; padding: 12px 14px; } }

/* 关闭的播放器弹层绝不能参与布局（避免页脚下方出现幽灵面板） */
.player-dialog:not([open]),
.player-dialog[hidden] { display: none !important; }
.site-footer .cactus-install-slot { margin: 14px 0 0 !important; justify-content: flex-start !important; }
/* 商业页脚：旧移动端样式会隐藏 footer，这里恢复并给底部固定导航留空间 */
footer.site-footer { display: block !important; width: 100%; margin: 40px 0 0; padding: 32px var(--page-pad) 26px; }
@media (max-width: 760px), (max-width: 1024px) and (hover: none) {
  footer.site-footer { margin-top: 22px; padding: 16px var(--page-pad); }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .footer-brand { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
  .footer-logo .brand-word { font-size: 18px; }
  .footer-brand p { flex-basis: 100%; margin: 0; line-height: 1.5; }
  .site-footer .cactus-install-slot { margin: 0 !important; order: -1; }
  .footer-brand .footer-logo { order: -2; }
  .footer-col { flex-flow: row wrap; align-items: center; gap: 0 14px; }
  .footer-col h3, .footer-contact .footer-muted { display: none; }
  .footer-col a { display: inline-flex; align-items: center; min-height: 34px; }
  .footer-bottom { justify-content: flex-start; gap: 4px 14px; margin-top: 8px; padding-top: 9px; }
}
/* ================= ArtPlayer 播放器 UI ================= */
.art-shell { position: relative; }
.art-player-mount { position: absolute; inset: 0; width: 100%; height: 100%; }
.art-player-mount .art-video-player { width: 100%; height: 100%; }
.art-error-overlay { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 28px; text-align: center; background: rgba(0,0,0,.88); }
.art-error-overlay.hidden { display: none !important; }
.art-error-overlay strong { font-size: 18px; color: #ffd1d1; }
.art-error-overlay p { max-width: 720px; margin: 0; color: #cfcfcf; font-size: 13px; line-height: 1.7; }
.art-error-overlay button { min-height: 40px; padding: 0 20px; border: 0; border-radius: 6px; background: #fff; color: #111; font-weight: 800; cursor: pointer; }
.player-tools { flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.player-tools label { display: inline-flex; align-items: center; gap: 8px; }
.player-tools label select { min-height: 32px; }
.player-tools .player-select-wrap { display: inline-flex; }
.player-tools .file-button { min-height: 34px; }



/* ===== assets/v5-redesign.css ===== */
/* CactusTV cinema. Shared tokens and brand live in styles.css. */
.cinema-home {
  --shelf-columns: 6;
  --shelf-gap: clamp(8px, .7vw, 14px);
  --tabbar-space: 0px;
}
@media (min-width: 1440px) { .cinema-home { --shelf-columns: 7; } }
@media (min-width: 2000px) { .cinema-home { --shelf-columns: 8; } }
@media (max-width: 1199px) { .cinema-home { --shelf-columns: 5; } }
@media (max-width: 959px) { .cinema-home { --shelf-columns: 4; } }
@media (orientation: landscape) {
  @media (min-height: 480px), (hover: hover) {
    @media (width > 760px) { .cinema-home .media-row { --shelf-card-max: 174px; --shelf-columns: 5; } }
    @media (min-width: 960px) { .cinema-home .media-row { --shelf-columns: 6; } }
    @media (min-width: 1200px) { .cinema-home .media-row { --shelf-columns: 7; } }
    @media (min-width: 1440px) { .cinema-home .media-row { --shelf-columns: 8; } }
  }
}
.cinema-home .topbar {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(22px, 3.4vw, 56px);
  background: linear-gradient(180deg, rgba(8,8,8,.92), rgba(8,8,8,.42) 72%, transparent);
}
.cinema-home .topbar.scrolled,
.cinema-home.search-open .topbar { background: rgba(11,11,11,.98); }
.cinema-home .top-actions .icon-button { width: 44px; height: 44px; }
.cinema-home .nav-tabs { gap: clamp(14px, 2vw, 28px); }
.cinema-home .topbar .nav-tab { position: relative; color: var(--muted); white-space: nowrap; }
.cinema-home .topbar .nav-tab:hover,
.cinema-home .topbar .nav-tab.active { color: var(--text); }

/* The backdrop and portrait layouts reserve the same space on desktop. */
.cinema-home .hero {
  position: relative;
  isolation: isolate;
  overflow: clip;
  height: auto;
  min-height: clamp(310px, 44svh, 390px);
  max-height: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: radial-gradient(ellipse at 78% 38%, #252525, transparent 56%), var(--bg);
}
.cinema-home .hero-backdrop {
  position: absolute;
  z-index: -3;
  display: block;
  inset: 0 0 0 auto;
  width: min(88%, 1600px);
  height: 100%;
  object-fit: cover;
  object-position: center 31%;
  transform: none;
  transition: opacity .28s ease;
}
.cinema-home .hero-backdrop[hidden] { display: none; }
.cinema-home .hero-vignette {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, var(--bg) 3%, rgba(11,11,11,.88) 24%, rgba(11,11,11,.22) 68%, rgba(11,11,11,.08)),
    linear-gradient(0deg, var(--bg) 1%, rgba(11,11,11,.66) 20%, transparent 63%);
  pointer-events: none;
}
.cinema-home .hero-poster-backdrop { display: none; }
@media (width > 760px) {
  .cinema-home .hero.poster-mode .hero-poster-backdrop:not([hidden]) {
    position: absolute;
    z-index: -3;
    inset: 0 0 0 auto;
    display: block;
    width: min(57%, 1060px);
    height: 100%;
    object-fit: cover;
    object-position: center 58%;
    filter: blur(10px) saturate(.84) brightness(.88);
    transform: scale(1.06);
    mask-image: linear-gradient(90deg, transparent, #000 36%);
    pointer-events: none;
  }
  .cinema-home .hero.poster-mode .hero-vignette {
    z-index: -2;
    background: linear-gradient(90deg, var(--bg) 28%, rgba(11,11,11,.84) 45%, rgba(11,11,11,.25) 74%, rgba(11,11,11,.12)),
      linear-gradient(0deg, var(--bg), rgba(11,11,11,.18) 26%, transparent 58%);
  }
}
.cinema-home .hero-artwork { display: none; }
.cinema-home .hero.poster-mode .hero-artwork {
  position: absolute;
  z-index: -2;
  display: block;
  aspect-ratio: 2 / 3;
  pointer-events: none;
  top: 50%;
  right: clamp(64px, 12vw, 230px);
  width: clamp(180px, min(23vw, 38vh), 340px);
  height: auto;
  transform: translateY(-47%);
  opacity: 0;
  transition: opacity .28s ease;
}
.cinema-home .hero.poster-mode .hero-artwork.artwork-ready:not(.artwork-failed) { opacity: 1; }
.cinema-home .hero-artwork::before { content: none; }
.cinema-home .hero-artwork img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,.54);
}
.cinema-home .hero-content {
  min-height: 0;
  display: flex;
  align-items: flex-end;
  padding: calc(var(--header-h) + 54px) var(--page-pad) 16px;
}
.cinema-home .hero-copy { width: min(100%, 560px, 49vw); max-height: none; overflow: visible; }
.cinema-home .hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: #f1f1f1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}
.cinema-home .hero-kicker-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-soft); }
.cinema-home .hero h1 {
  display: -webkit-box;
  max-width: none;
  margin: 0;
  overflow: hidden;
  font-size: clamp(40px, 5.2vw, 78px);
  font-weight: 850;
  line-height: 1.09;
  letter-spacing: -.037em;
  overflow-wrap: anywhere;
  text-wrap: initial;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.cinema-home .hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; color: #eee8ee; font-size: 13px; font-weight: 700; }
.cinema-home .hero-meta:empty { display: none; }
.cinema-home .hero-meta span { display: inline-flex; align-items: center; gap: 8px; }
.cinema-home .hero-meta span:not(:last-child)::after { content: ''; width: 4px; height: 4px; border-radius: 50%; background: #a5a5a5; }
.cinema-home .hero-meta span:first-child { color: #d4c2a5; }
.cinema-home #heroOverview:not(:empty) {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  margin: 12px 0 0;
  color: #dedede;
  font-size: clamp(14px, 1.1vw, 16px);
  line-height: 1.65;
  -webkit-line-clamp: 2;
}
.cinema-home .hero-actions { display: flex; gap: 9px; width: auto; margin-top: 21px; }
.cinema-home .hero-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 46px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 760;
  cursor: pointer;
}
.cinema-home .hero-button svg { width: 18px; height: 18px; flex-shrink: 0; }
.cinema-home .hero-button:hover { transform: none; opacity: 1; }
.cinema-home .hero-button-primary { color: #141414; background: #f5f5f5; }
.cinema-home .hero-button-primary:hover { background: #e4e4e4; }
.cinema-home .hero-button-secondary { border-color: var(--line-strong); background: rgba(30,30,30,.86); backdrop-filter: none; }
.cinema-home .hero-button-secondary:hover { background: #383838; }
.cinema-home .hero-carousel {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 var(--page-pad) 16px;
  position: relative;
  z-index: 2;
}
.hero-dots:not([hidden]), .hero-carousel-controls:not([hidden]) { display: flex; align-items: center; }
.hero-dot { display: grid; place-items: center; width: 24px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.hero-dot::before { content: ''; width: 7px; height: 7px; border-radius: 100px; background: #a5a5a5; }
.hero-dot.is-active::before { width: 17px; background: var(--accent-soft); }
.hero-dot[data-pending]::before { width: 12px; background: transparent; border: 1px solid #fff; }
.hero-dot:hover::before { background: #fff; }
.hero-dot, .hero-carousel-controls button { touch-action: manipulation; }
.hero-carousel-controls { gap: 4px; }
.hero-carousel-controls button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(26,26,26,.82);
  cursor: pointer;
}
.hero-carousel-controls button:hover { background: #373737; }
.hero-carousel-controls svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#heroPause[aria-pressed='false'] .hero-resume-icon, #heroPause[aria-pressed='true'] .hero-pause-icon { display: none; }
.cinema-home .hero-copy { transition: opacity .28s ease; }
.cinema-home .hero-fading :is(.hero-copy, .hero-backdrop, .hero-artwork) { opacity: 0; }
.cinema-home .hero.poster-mode.hero-fading .hero-artwork.artwork-ready { opacity: 0; }
.cinema-home.compact-view .hero { display: none; }
.cinema-home.compact-view #categoryNav:not(.hidden) { padding-top: calc(var(--header-h) + 14px); }

@media (width > 760px) {
  .cinema-home { --header-h: 60px; }
  .cinema-home .hero.poster-mode .hero-artwork {
    z-index: -1;
    top: auto;
    bottom: 20px;
    right: clamp(40px, 10vw, 200px);
    height: min(268px, calc(100% - var(--header-h) - 28px));
    width: auto;
    transform: none;
  }
  .cinema-home .hero-content { padding: calc(var(--header-h) + 10px) var(--page-pad) 4px; }
  .cinema-home .hero-copy { width: min(100%, 560px, 51vw); }
  .cinema-home .hero-kicker { margin-bottom: 6px; }
  .cinema-home .hero h1 { font-size: clamp(32px, min(4vw, 6svh), 52px); }
  .cinema-home .hero-meta { margin-top: 8px; }
  .cinema-home #heroOverview:not(:empty) { margin-top: 7px; font-size: 14px; line-height: 1.5; }
  .cinema-home .hero-actions { margin-top: 12px; }
  .cinema-home .hero-button { min-height: 44px; }
  .cinema-home .hero-carousel { min-height: 56px; padding-bottom: 6px; }
}
@media (width > 760px) and (orientation: landscape) and (min-height: 480px),
       (width > 760px) and (orientation: landscape) and (hover: hover) {
  .cinema-home .hero.poster-mode .hero-artwork { height: min(228px, calc(100% - var(--header-h) - 28px)); }
}
@media (width > 760px) and (max-height: 700px) {
  .cinema-home #heroOverview:not(:empty) { -webkit-line-clamp: 1; }
}

/* A single treatment for loading, catalogue, and search cards. */
.cinema-home .home-sections { margin: 0; padding-bottom: 24px; }
.cinema-home #categoryNav { gap: 8px; margin: 0 0 26px; padding: 5px var(--page-pad); mask-image: none; }
.cinema-home :is(.category-chip, .filter-chip) { border-radius: 7px; background: #1d1d1d; color: #ddd; }
.cinema-home :is(.category-chip, .filter-chip):hover { background: #292929; color: #fff; }
.cinema-home :is(.category-chip, .filter-chip).active { border-color: #e7e7e7; background: #f0f0f0; color: #141414; box-shadow: none; }
.cinema-home .catalog-section { margin-bottom: clamp(23px, 3vw, 44px); }
.cinema-home .section-heading { min-height: 36px; margin: 0 0 10px; }
.cinema-home .section-heading h2 { font-size: clamp(20px, 2vw, 28px); font-weight: 800; letter-spacing: -.022em; }
.cinema-home .section-heading .eyebrow { display: none; }
.cinema-home .row-controls { opacity: 1; transform: none; }
.cinema-home .row-controls[hidden] { display: none; }
.cinema-home .row-control { width: 44px; height: 44px; border-radius: 50%; background: var(--panel); }
.cinema-home .row-control:hover:not(:disabled) { background: var(--panel-2); }
.cinema-home .row-control:disabled { opacity: .32; cursor: default; }
.cinema-home .media-row {
  --shelf-card: calc((100% - (var(--shelf-columns) - 1) * var(--shelf-gap)) / var(--shelf-columns));
  grid-auto-columns: min(var(--shelf-card), var(--shelf-card-max, 100%));
  gap: var(--shelf-gap);
  margin: 0;
  padding: 5px var(--page-pad) 12px;
  scroll-padding-inline: var(--page-pad);
  scroll-snap-type: inline proximity;
}
.cinema-home .media-card { border-radius: 8px; background: transparent; box-shadow: none; transform: none; }
.cinema-home .card-action:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cinema-home .media-card .poster { aspect-ratio: 2 / 3; border-radius: 8px; background: #211d25; }
.cinema-home .media-card .poster::after { content: none; }
.cinema-home .media-card .poster img { border-radius: inherit; transform: none; filter: none; }
.cinema-home .media-card.is-loading .poster { background: var(--v4-skeleton-bg); background-size: 220% 100%; animation: v4-shimmer 1.5s linear infinite; }
.cinema-home .media-card .card-overlay { display: none; }
.cinema-home .card-caption { display: block; min-height: 43px; padding-top: 9px; text-align: left; }
.cinema-home .card-caption-title, .cinema-home .card-caption-meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cinema-home .card-caption-title { color: #f3eef4; font-size: clamp(12px, 1.1vw, 15px); font-weight: 720; }
.cinema-home .card-caption-meta { margin-top: 4px; color: var(--muted); font-size: 11px; }
.cinema-home .card-play {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 50%;
  background: #17141a;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity .18s ease;
}
.cinema-home .card-play span { width: 0; height: 0; margin-left: 3px; border: 7px solid transparent; border-right: 0; border-left: 11px solid #fff; }
.cinema-home .media-card:has(> .card-action:focus-visible) .card-play { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .cinema-home .media-card:hover .card-play { opacity: 1; }
  .cinema-home .media-card:hover .poster { outline: 1px solid #817883; outline-offset: -1px; }
  .cinema-home .topbar .nav-tab.active::after {
    content: '';
    position: absolute;
    inset: auto 0 1px;
    height: 2px;
    border-radius: 3px;
    background: var(--accent-soft);
  }
}
.cinema-home .media-card .rank-index {
  position: absolute;
  z-index: 4;
  top: 7px;
  left: 7px;
  display: grid;
  place-items: center;
  min-width: 27px;
  min-height: 25px;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(19,19,19,.95);
  color: #f4f4f4;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.cinema-home .is-ranked .media-card :is(.badge, .rating):not(.update-badge) { left: auto; right: 7px; }
.cinema-home .media-card .update-badge { background: #242424; color: #fff; }
.cinema-home .home-skeleton-row .media-row { padding-bottom: 55px; }
.cinema-home .site-footer { background: var(--bg-soft); }
.cinema-home:not([data-home-route]) footer.site-footer { display: none !important; }
.cinema-home .home-resume {
  max-width: 500px;
  margin: 0 var(--page-pad) 16px;
}
.cinema-home .home-resume .v4-continue-card {
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: none;
  backdrop-filter: none;
  transform: none;
}
.cinema-home .home-resume .v4-continue-card:hover { border-color: var(--line-strong); }
.cinema-home .home-resume .v4-continue-thumb { width: 34px; height: 49px; }
.cinema-home .home-resume .v4-continue-kicker { color: var(--muted); letter-spacing: 0; }
.cinema-home .home-resume .v4-continue-kicker::before { display: none; }
.cinema-home .home-resume .v4-continue-progress > i { background: var(--red); }
.cinema-home .home-resume .v4-continue-play { width: 30px; height: 30px; box-shadow: none; }

/* Dialogs and overlays keep the existing fullscreen / lock control rules. */
.cinema-home #detailDialog.sheet { background: var(--bg-soft); }
.cinema-home #detailDialog::backdrop { background: rgba(8,8,8,.78); }
.cinema-home #detailDialog .detail-backdrop { opacity: .78; background-position: center 28%; }
.cinema-home #detailDialog :is(.detail-hero, .episode-block) { max-width: 1160px; margin-inline: auto; }
.cinema-home .detail-copy h2 { letter-spacing: -.027em; }
.cinema-home .detail-copy p { color: #d6d6d6; }
.cinema-home :is(.source-choice.active, .episode.active, .episode.is-current) { border-color: #dedede; background: #f0f0f0; color: #141414; box-shadow: none; }
.cinema-home .player-dialog:not(.is-fullscreen):not(:fullscreen), .cinema-home .settings-dialog { background: var(--bg-soft); }
.cinema-home .player-head { border-bottom: 1px solid var(--line); }
.cinema-home .player-title-wrap strong { font-weight: 760; }
.cinema-home .player-tools :is(select, .file-button) { border-radius: 6px; }
.cinema-home .next-episode-prompt {
  z-index: 42;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(62px + env(safe-area-inset-bottom));
  width: min(330px, calc(100% - 28px));
  border-radius: 10px;
  background: #212121;
  box-shadow: 0 12px 34px rgba(0,0,0,.5);
  backdrop-filter: none;
}
.cinema-home .next-episode-prompt button { min-height: 42px; border-radius: 6px; }
.cinema-home .next-episode-prompt button:first-child { border-color: var(--red); background: var(--red); color: #fff; }
.cinema-home #settingsDialog .setting-group:first-of-type { margin-top: 14px; }

#mobileTabbar { display: none; }
@media (min-width: 1025px), (min-width: 761px) and (hover: hover) {
  .cinema-home .nav-tabs { justify-self: start; }
}
@media (max-width: 760px), (max-width: 1024px) and (hover: none) {
  .cinema-home {
    --tabbar-space: calc(56px + env(safe-area-inset-bottom));
    --shelf-columns: 4;
    --shelf-gap: 9px;
    padding-bottom: var(--tabbar-space);
  }
  .cinema-home .topbar { grid-template-columns: minmax(0,1fr) auto; column-gap: 9px; }
  .cinema-home .top-actions { grid-column: 2; }
  .cinema-home .topbar .nav-tabs, .cinema-home.v4-tabbar-active #mobileTabbar.v4-tabbar {
    position: fixed;
    inset: auto 0 0;
    z-index: 86;
    width: 100%;
    height: var(--tabbar-space);
    transform: none;
    display: grid;
    grid-template: 1fr / none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0,1fr);
    align-items: stretch;
    gap: 2px;
    padding: 3px max(5px, env(safe-area-inset-right)) calc(3px + env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: #111;
    box-shadow: 0 -8px 24px rgba(0,0,0,.36);
    opacity: 1;
    pointer-events: auto;
    backdrop-filter: none;
  }
  .cinema-home.v4-tabbar-active .topbar .nav-tabs { display: none; }
  .cinema-home :is(.topbar .nav-tab, #mobileTabbar .v4-tab) {
    min-width: 0;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 2px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #bdbdbd;
    font-size: 11px;
    font-weight: 630;
    line-height: 1.15;
    text-decoration: none;
  }
  .cinema-home :is(.topbar .nav-tab.active, #mobileTabbar .v4-tab.is-active) { color: #fff; background: #242424; }
  .cinema-home :is(.topbar .nav-tab.active, #mobileTabbar .v4-tab.is-active) svg { color: var(--accent-soft); }
  .cinema-home :is(.topbar .nav-tab, #mobileTabbar .v4-tab) svg { display: block; width: 20px; height: 20px; }
  .cinema-home #mobileTabbar[hidden] { display: none; }
  .cinema-home :is(.toast, .ad-consent) { bottom: calc(12px + var(--tabbar-space)); }
}
@media (max-width: 760px) {
  .cinema-home { --shelf-columns: 3; --shelf-gap: 8px; --page-pad: clamp(12px,4vw,24px); --header-h: 56px; }
  .cinema-home .hero {
    min-height: clamp(282px, 46svh, 375px);
    margin: calc(var(--header-h) + 4px) var(--page-pad) 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    justify-content: flex-end;
    touch-action: pan-y;
    background: radial-gradient(ellipse at 50% 17%, #333, #141414 72%);
  }
  .cinema-home .hero-backdrop,
  .cinema-home .hero.poster-mode .hero-artwork {
    inset: 0;
    width: 100%;
    height: 100%;
    transform: none;
  }
  .cinema-home .hero-backdrop { object-position: center 28%; }
  .cinema-home .hero-artwork img { border: 0; border-radius: 0; box-shadow: none; object-position: center 33%; }
  .cinema-home .hero .hero-vignette,
  .cinema-home .hero.poster-mode .hero-vignette {
    inset: 0;
    background: linear-gradient(0deg, #0b0b0b 1%, rgba(11,11,11,.88) 23%, rgba(11,11,11,.22) 59%, transparent 80%);
  }
  .cinema-home .hero-content { justify-content: center; padding: 64px 12px 0; }
  .cinema-home .hero-copy { width: min(100%, 460px); text-align: center; }
  .cinema-home .hero h1 { font-size: clamp(25px, 7vw, 37px); text-shadow: 0 2px 12px #000; }
  .cinema-home .hero-kicker { margin-bottom: 6px; }
  .cinema-home .hero-meta { justify-content: center; margin-top: 6px; }
  .cinema-home #heroOverview:not(:empty) { display: none; }
  .cinema-home .hero-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 14px; }
  .cinema-home .hero-button { min-height: 44px; padding-inline: 6px; gap: 5px; font-size: 13px; white-space: nowrap; }
  .cinema-home .hero-carousel { justify-content: space-between; gap: 0; min-height: 59px; padding: 0 7px 5px 10px; }
  .hero-dot { width: clamp(18px,5.8vw,27px); }
  .hero-carousel-controls { gap: 0; }
  .cinema-home .hero-carousel-controls button { border-color: transparent; background: transparent; }
  .cinema-home #categoryNav { margin-bottom: 10px; }
  .cinema-home .catalog-section { content-visibility: visible; margin-bottom: 16px; }
  .cinema-home .section-heading { gap: 6px; min-height: 44px; margin-bottom: 3px; }
  .cinema-home .section-heading h2 { font-size: 19px; }
  .cinema-home .row-control { background: transparent; border-color: transparent; }
  .cinema-home .media-card .card-caption { min-height: 38px; padding-top: 7px; }
  .cinema-home .content-section { padding-inline: var(--page-pad); }
  .cinema-home .detail-copy h2 { font-size: clamp(21px, 6vw, 34px); }
  .cinema-home .player-head { border-color: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .cinema-home :is(.hero-copy, .hero-backdrop, .hero-artwork, .card-play) { transition: none; }
  .cinema-home .media-card.is-loading .poster { animation: none; }
  .cinema-home .hero-fading :is(.hero-copy, .hero-backdrop) { opacity: 1; }
  .cinema-home .hero.poster-mode.hero-fading .hero-artwork.artwork-ready:not(.artwork-failed) { opacity: 1; }
}
.cinema-home.performance-lite .media-card.is-loading .poster,
html.performance-lite .cinema-home .media-card.is-loading .poster { animation: none; }

/* Rankings page */
/* =========================================================================
 * rank.html 私有样式（只用 styles.css 的 CSS 变量；类名统一 v5r- 前缀，不污染主站）
 * 依赖：/api/rank?type=hot|rated|new（lib/content.js 提供，30 分钟服务端缓存）
 * 跳转：卡片 = <a href="/#q=片名">，依赖主站 app.js 支持 location.hash 的 #q= 自动搜索
 * ====================================================================== */
.v5r-body { padding-top: 0; }

.v5r-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
  padding: 0 var(--page-pad);
  background: linear-gradient(180deg, rgba(0, 0, 0, .92), rgba(0, 0, 0, .66));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.v5r-topnav { display: flex; align-items: center; gap: 18px; }
.v5r-topnav a { color: #cfcfcf; font-size: 13.5px; text-decoration: none; }
.v5r-topnav a:hover { color: #fff; }
.v5r-topnav a[aria-current="page"] { color: #fff; font-weight: 800; }

.v5r-main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 26px var(--page-pad) 64px;
}

.v5r-head h1 {
  margin: 0;
  font-size: clamp(26px, 3.4vw, 44px);
  line-height: 1.08;
  letter-spacing: -.03em;
  font-weight: 900;
}

.v5r-head p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

/* ---- 三个 Tab ---- */
.v5r-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 20px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.v5r-tabs::-webkit-scrollbar { display: none; }

.v5r-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(24, 24, 24, .9);
  color: #d6d6d6;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.v5r-tab:hover { color: #fff; border-color: var(--line-strong); }
.v5r-tab.is-active { background: var(--red); border-color: var(--red); color: #fff; }
.v5r-tab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---- 网格卡片 ---- */
.v5r-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 22px 14px;
}

.v5r-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.v5r-poster {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: linear-gradient(135deg, #242424, #101010);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .34);
  transition: transform .22s cubic-bezier(.2, .75, .2, 1), box-shadow .22s ease;
}

.v5r-card:hover .v5r-poster { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(0, 0, 0, .6); }
.v5r-card:focus-visible { outline: none; }
.v5r-card:focus-visible .v5r-poster { box-shadow: 0 0 0 2px var(--red); }

.v5r-poster img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .3s ease;
}

.v5r-card:hover .v5r-poster img { transform: scale(1.05); }

.v5r-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .7);
  font-size: 34px;
  font-weight: 900;
}

.v5r-rating {
  position: absolute;
  left: 7px;
  top: 7px;
  z-index: 2;
  max-width: calc(100% - 14px);
  overflow: hidden;
  padding: 3px 7px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .74);
  color: #ffd76a;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v5r-name {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  color: #f0f0f0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.v5r-meta { color: var(--muted-2, #777); font-size: 11.5px; }

/* ---- 骨架 / 空态 / 提示 ---- */
.v5r-skeleton {
  border-radius: 6px;
  background: linear-gradient(100deg, #141414 18%, #242424 40%, #141414 62%);
  background-size: 220% 100%;
  animation: v5r-shimmer 1.4s ease-in-out infinite;
}

.v5r-skeleton-card { display: flex; flex-direction: column; gap: 8px; }
.v5r-skeleton-card .v5r-skeleton:first-child { aspect-ratio: 2 / 3; }
.v5r-skeleton-card .v5r-skeleton:last-child { height: 14px; width: 78%; }

@keyframes v5r-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -40% 0; }
}

.v5r-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 68px 20px 76px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(20, 20, 20, .6);
  text-align: center;
}

.v5r-empty strong { font-size: 16px; }
.v5r-empty span { max-width: 420px; color: var(--muted); font-size: 13px; line-height: 1.6; }

.v5r-retry {
  margin-top: 4px;
  min-height: 38px;
  padding: 0 20px;
  border: 0;
  border-radius: 5px;
  background: var(--red);
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}

.v5r-retry:hover { background: var(--red-dark); }
.v5r-retry:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.v5r-note {
  margin: 30px 0 0;
  color: var(--muted-2, #777);
  font-size: 12px;
  line-height: 1.6;
}

.v5r-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px var(--page-pad) 34px;
  border-top: 1px solid var(--line);
  color: var(--muted-2, #777);
  font-size: 12px;
}

.v5r-foot nav { display: flex; gap: 16px; }
.v5r-foot a { color: #b9b9b9; text-decoration: none; }
.v5r-foot a:hover { color: #fff; }
.v5r-foot p { width: 100%; margin: 0; }

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

/* ---- 响应式 ---- */
@media (max-width: 1024px) {
  .v5r-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 18px 12px; }
}

@media (max-width: 768px) {
  .v5r-main { padding-top: 18px; padding-bottom: 46px; }
  .v5r-tabs { margin: 18px 0 16px; }
  .v5r-tab { min-height: 36px; padding: 0 16px; font-size: 13px; }
  .v5r-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 10px; }
  .v5r-name { font-size: 12.5px; }
  .v5r-poster { border-radius: 5px; }
  .v5r-foot { justify-content: center; text-align: center; }
  .v5r-foot nav { justify-content: center; }
}

@media (max-width: 390px) {
  .v5r-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .v5r-poster,
  .v5r-poster img,
  .v5r-skeleton { transition: none !important; animation: none !important; }
}

/* Shared auditorium styling for live and rankings. */
body.lv-body { background: var(--bg); }
.lv-body .lv-header, .v5r-body .v5r-top { background: rgba(11,11,11,.97); border-bottom: 1px solid var(--line); backdrop-filter: none; }
.lv-body .lv-brand { align-items: center; color: var(--text); }
.lv-body .lv-brand-live { background: #242424; color: #f5f5f5; }
.lv-body .lv-hero, .v5r-head {
  margin: 16px 0 24px;
  padding: clamp(22px, 4vw, 54px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(120deg, #242424, #161616 62%);
}
.lv-body .lv-eyebrow { color: var(--accent-soft); }
.lv-body .lv-hero h1, .v5r-head h1 { font-weight: 840; letter-spacing: -.033em; }
.lv-body .lv-chip, .v5r-tab { min-height: 44px; border-radius: 7px; background: var(--panel); }
.lv-body .lv-chip.active, .v5r-tab.is-active { border-color: #e7e7e7; background: #f0f0f0; color: #141414; }
.lv-body .lv-chip.active .lv-chip-count { color: #494949; }
.lv-body .lv-card { box-shadow: none; }
.lv-body .lv-card:hover, .lv-body .lv-card:active { transform: none; box-shadow: none; }
.v5r-body .v5r-topnav a[aria-current='page'] { color: var(--accent-soft); }
.v5r-body .v5r-topnav a { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 430px) {
  .lv-body .lv-chips-wrap { margin-inline: -14px; padding-inline: 14px; }
}
@media (max-width: 600px) {
  .lv-body .brand-mark, .v5r-body .brand-mark { width: 25px; height: 25px; }
  .lv-body .lv-brand-live { display: none; }
  .v5r-body .v5r-topnav { gap: 10px; }
}

/* ===== assets/v5-player.css ===== */
/* CactusTV 移动端播放页（视频下方内容 + 手势 HUD） */
.player-watch { display: none; }
.player-tools-close { display: none; }

/* Keep modal and video overlays cheap to composite over moving frames. */
.player-dialog::backdrop { background: rgba(0,0,0,.88); backdrop-filter: none; }
html.player-open #detailDialog::backdrop { backdrop-filter: none; }

/* ---------- 手势 HUD / 双击涟漪 ---------- */
.art-video-player { touch-action: none; }
.art-touch-hud {
  position: absolute;
  z-index: 20;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 168px;
  max-width: min(78%, 380px);
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 13px;
  background: rgba(12,12,12,.92);
  color: #fff;
  text-align: left;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 14px 38px rgba(0,0,0,.45);
}
.art-touch-hud[hidden] { display: none !important; }
.art-touch-hud.is-top {
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  min-width: 0;
  max-width: min(86%, 340px);
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(8,8,8,.86);
  transform: translateX(-50%);
  box-shadow: 0 6px 18px rgba(0,0,0,.28);
}
.art-touch-hud.is-top .art-touch-hud-icon { min-width: 16px; font-size: 15px; }
.art-touch-hud.is-top .art-touch-hud-copy { flex-direction: row; align-items: center; gap: 6px; }
.art-touch-hud.is-top .art-touch-hud-copy strong { font-size: 12px; }
.art-touch-hud.is-top .art-touch-hud-copy small { font-size: 10.5px; }
.art-touch-hud.is-top .art-touch-hud-meter { position: static; width: 58px; height: 3px; margin-left: 4px; flex: 0 0 auto; }
.art-touch-hud.is-faint {
  opacity: .42;
  border-color: transparent;
  background: rgba(0,0,0,.28);
  box-shadow: none;
  padding: 5px 10px;
  backdrop-filter: none;
}
.art-touch-hud.is-faint .art-touch-hud-icon { display: none; }
.art-touch-hud.is-faint .art-touch-hud-copy strong { color: rgba(255,255,255,.9); font-size: 11px; font-weight: 600; }
.art-touch-hud.is-faint .art-touch-hud-copy small { display: none; }
.art-touch-hud.is-faint .art-touch-hud-meter { display: none; }
.art-touch-hud-icon { min-width: 22px; font-size: 20px; line-height: 1; text-align: center; }
.art-touch-hud-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.art-touch-hud-copy strong { overflow: hidden; font-size: 15px; font-weight: 800; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.art-touch-hud-copy small { color: rgba(255,255,255,.68); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.art-touch-hud-meter { position: absolute; right: 12px; bottom: 7px; left: 12px; height: 3px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.16); }
.art-touch-hud-meter[hidden] { display: none; }
.art-touch-hud-meter b { display: block; width: 100%; height: 100%; border-radius: inherit; background: #fff; transform: scaleX(0); transform-origin: left center; transition: transform .05s linear; }
.art-touch-ripples { position: absolute; z-index: 19; inset: 0; overflow: hidden; pointer-events: none; }
.art-touch-ripple {
  position: absolute;
  top: 50%;
  padding: 10px 19px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(0,0,0,.82);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .01em;
  transform: translateY(-50%);
  animation: art-touch-ripple .62s ease-out both;
}
.art-touch-ripple.is-left { left: 9%; }
.art-touch-ripple.is-right { right: 9%; }
@keyframes art-touch-ripple {
  0% { opacity: 0; scale: .82; }
  20% { opacity: 1; }
  100% { opacity: 0; scale: 1.12; }
}

/* ---------- 移动端播放页布局 ---------- */
@media (max-width: 700px) {
  .player-dialog[open] {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 0;
    background: #0a0a0a;
    scroll-behavior: smooth;
  }
  .player-dialog > .player-head {
    position: sticky;
    z-index: 40;
    top: 0;
    flex: 0 0 auto;
    height: 0;
    min-height: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    pointer-events: none;
    backdrop-filter: none;
  }
  .player-dialog > .player-head .player-title-wrap { display: none; }
  .player-dialog > .player-head .sheet-close {
    position: absolute;
    top: max(8px, env(safe-area-inset-top));
    right: 10px;
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,.76);
    pointer-events: auto;
  }
  .player-dialog > .video-shell {
    position: sticky;
    z-index: 30;
    top: 0;
    flex: 0 0 auto;
    aspect-ratio: 16 / 9;
    width: 100%;
    background: #000;
    box-shadow: 0 18px 38px rgba(0,0,0,.5);
  }
  .player-dialog > .player-watch {
    position: relative;
    z-index: 20;
    display: block;
    flex: 0 0 auto;
    padding: 16px 16px calc(30px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #0a0a0a 0%, #0d0d0d 46%, #090909 100%);
  }

  /* 标题与信息 */
  .watch-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
  .watch-title-copy { min-width: 0; }
  .watch-title-copy h2 { margin: 0; color: #fff; font-size: 20px; font-weight: 800; line-height: 1.22; letter-spacing: -.02em; }
  .watch-now { margin: 7px 0 0; color: #c9c9c9; font-size: 13px; line-height: 1.4; }
  .watch-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
  .watch-meta span { padding: 4px 8px; border: 1px solid rgba(255,255,255,.1); border-radius: 5px; color: #a7a7a7; font-size: 10.5px; line-height: 1.2; }
  .watch-meta .watch-rating { border-color: rgba(229,9,20,.35); color: #ff8b8b; }

  /* 操作按钮 */
  .watch-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 7px; margin-top: 14px; }
  .watch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    min-height: 40px;
    padding: 0 5px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 8px;
    background: rgba(255,255,255,.055);
    color: #e6e6e6;
    font-size: 11.5px;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
  }
  .watch-btn:active { background: rgba(255,255,255,.14); }
  .watch-btn:disabled { opacity: .34; pointer-events: none; }
  .watch-btn.is-active { border-color: rgba(229,9,20,.45); background: rgba(229,9,20,.13); color: #ff9a9a; }
  .watch-btn.watch-favorite span { font-size: 14px; }
  .watch-btn.watch-settings { border-color: rgba(255,255,255,.2); }
  .watch-gesture-tip {
    margin-top: 11px;
    padding: 8px 10px;
    border-radius: 7px;
    background: rgba(255,255,255,.035);
    color: #737373;
    font-size: 10.5px;
    line-height: 1.5;
  }

  /* 线路 */
  .watch-lines { display: flex; gap: 8px; margin: 16px 0 0; overflow-x: auto; scrollbar-width: none; }
  .watch-lines::-webkit-scrollbar { display: none; }
  .watch-line { flex: 0 0 auto; min-height: 34px; padding: 0 13px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: transparent; color: #a8a8a8; font-size: 12px; cursor: pointer; }
  .watch-line.is-current { border-color: #dedede; background: #f0f0f0; color: #151515; font-weight: 750; }

  /* 选集 */
  .watch-episodes { margin-top: 20px; }
  .watch-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
  .watch-section-head h3 { margin: 0; color: #fff; font-size: 16px; font-weight: 780; letter-spacing: -.01em; }
  .watch-section-head span { color: #6d6d6d; font-size: 11px; }
  .watch-episode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 7px; }
  .watch-episode {
    min-width: 0;
    min-height: 39px;
    overflow: hidden;
    padding: 0 6px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 7px;
    background: rgba(255,255,255,.045);
    color: #cfcfcf;
    font-size: 11.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
  }
  .watch-episode:active { background: rgba(255,255,255,.12); }
  .watch-episode.is-current { border-color: #f0f0f0; background: #f0f0f0; color: #151515; font-weight: 800; }
  .watch-empty { margin: 0; color: #777; font-size: 12px; }
  .watch-more { margin-top: 11px; padding: 0; border: 0; background: transparent; color: #8f8f8f; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

  /* 简介 */
  .watch-overview-wrap { margin-top: 22px; padding-top: 17px; border-top: 1px solid rgba(255,255,255,.07); }
  .watch-overview-wrap h3 { margin: 0 0 9px; color: #fff; font-size: 15px; font-weight: 780; }
  .watch-overview { display: block; margin: 0; overflow: hidden; color: #9e9e9e; font-size: 12.5px; line-height: 1.8; }
  .watch-overview.is-collapsed { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
  .watch-overview-wrap .watch-more { margin-top: 8px; }

  /* 工具面板不再绝对定位到底部，改为可滚动弹层内铺满（保留原有 DOM 兼容） */
  .player-dialog .player-tools { z-index: 45; }
  .player-tools-close { display: grid; place-items: center; }
  .player-dialog.tools-open .player-tools { display: flex; }
}

/* 横屏与全屏：不要显示播放页内容 */
@media (max-width: 900px) and (orientation: landscape) {
  .player-dialog > .player-watch { display: none !important; }
  .player-dialog > .video-shell { position: relative; top: auto; }
  .player-dialog[open] { overflow: hidden; }
}
.player-dialog:fullscreen > .player-watch,
.player-dialog.is-fullscreen > .player-watch { display: none !important; }
.player-dialog:fullscreen > .player-head,
.player-dialog.is-fullscreen > .player-head { position: absolute; }
.player-dialog:fullscreen > .video-shell,
.player-dialog.is-fullscreen > .video-shell { position: relative; top: auto; }

/* 移动端 ArtPlayer 控件更贴近手指 */
@media (max-width: 700px) {
  .art-video-player .art-bottom { padding: 0 8px calc(7px + env(safe-area-inset-bottom)); }
  .art-video-player .art-control { width: 40px !important; height: 40px; }
  .art-video-player .art-control svg { width: 22px; height: 22px; }
  .art-video-player .art-control-volume,
  .art-video-player .art-control-pip,
  .art-video-player .art-control-fullscreenWeb,
  .art-video-player .art-control-thumbnails { display: none !important; }
  .art-video-player .art-control-time { width: auto !important; min-width: 84px; font-size: 11px; }
  .art-video-player .art-progress { padding: 0 4px; }
  .art-video-player .art-control-progress { padding: 0 4px; }
  .art-video-player .art-layer-auto-playback { display: none !important; }
  .art-video-player .art-mask { border-radius: 0; }
}
