/* ───────────── Tokens ───────────── */
:root {
  --bg: #08080c;
  --bg-2: #101017;
  --surface: #16161f;
  --surface-2: #1e1e2a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f7;
  --muted: #a0a0b2;
  --faint: #6b6b80;
  --accent-1: #7c5cff;
  --accent-2: #ff5c8a;
  --accent: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  --gold: #ffc94d;
  --green: #3ddc84;
  --radius: 10px;
  --radius-lg: 16px;
  --pad: clamp(16px, 4vw, 56px);
  --card-w: clamp(132px, 13vw, 200px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', var(--font);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 2px solid var(--accent-1); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent-1); color: white; }
[hidden] { display: none !important; }

/* ───────────── Buttons ───────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 22px;
  border-radius: 999px;
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: transform 0.2s var(--ease), background 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn-primary { background: #fff; color: #0a0a0f; }
.btn-primary:hover { background: #e8e8ee; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.2); }
.btn-glow {
  background: var(--accent); color: white;
  box-shadow: 0 6px 24px -6px rgba(124, 92, 255, 0.6);
}
.btn-glow:hover { box-shadow: 0 8px 32px -4px rgba(255, 92, 138, 0.65); transform: translateY(-1px); }
.btn-round {
  width: 44px; padding: 0; justify-content: center;
}

/* ───────────── Nav ───────────── */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  height: 72px; padding: 0 var(--pad);
  background: linear-gradient(to bottom, rgba(8, 8, 12, 0.85), transparent);
  transition: background 0.3s, backdrop-filter 0.3s, box-shadow 0.3s;
}
.nav.scrolled {
  background: rgba(8, 8, 12, 0.82);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 1px 0 var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent);
  box-shadow: 0 4px 18px -4px rgba(124, 92, 255, 0.7);
}
.brand-mark svg { width: 16px; height: 16px; fill: white; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }

.search {
  position: relative; display: flex; align-items: center;
  width: min(380px, 40vw); height: 42px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border); border-radius: 999px;
  transition: background 0.2s, border-color 0.2s, width 0.3s var(--ease);
}
.search:focus-within { background: rgba(255, 255, 255, 0.11); border-color: rgba(124, 92, 255, 0.6); }
.search-icon { position: absolute; left: 14px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input {
  flex: 1; height: 100%; min-width: 0;
  padding: 0 40px 0 42px;
  background: none; border: 0; outline: none;
  color: var(--text); font: inherit;
}
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(0.5); }
.search-kbd {
  position: absolute; right: 12px;
  font: 600 11px var(--font); color: var(--faint);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px;
}
.search:focus-within .search-kbd { display: none; }

/* ───────────── Hero ───────────── */
.hero {
  position: relative;
  height: min(88vh, 860px); min-height: 560px;
  overflow: hidden;
  isolation: isolate;
}
.hero-slides, .hero-slide { position: absolute; inset: 0; }
.hero-slide {
  background-size: cover; background-position: center 20%;
  opacity: 0; transform: scale(1.06);
  transition: opacity 1.2s ease, transform 9s linear;
}
.hero-slide.active { opacity: 1; transform: scale(1); }
.hero-shade {
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(90deg, rgba(8, 8, 12, 0.92) 0%, rgba(8, 8, 12, 0.55) 38%, transparent 70%),
    linear-gradient(0deg, var(--bg) 0%, rgba(8, 8, 12, 0.4) 22%, transparent 45%);
}
.hero-content {
  position: absolute; z-index: 2;
  left: var(--pad); bottom: clamp(90px, 16vh, 150px);
  width: min(560px, calc(100% - 2 * var(--pad)));
}
.hero-content.enter > * { animation: rise 0.8s var(--ease) both; }
.hero-content.enter > *:nth-child(2) { animation-delay: 0.08s; }
.hero-content.enter > *:nth-child(3) { animation-delay: 0.16s; }
.hero-content.enter > *:nth-child(4) { animation-delay: 0.24s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 18px;
}
.hero-eyebrow b {
  background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-logo { max-width: min(440px, 80%); max-height: 150px; object-fit: contain; object-position: left bottom; margin-bottom: 20px; filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.6)); }
.hero-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(36px, 5.5vw, 68px); line-height: 1; letter-spacing: -0.03em;
  margin: 0 0 18px; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: #d8d8e2; font-size: 14px; font-weight: 500; }
.meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
.rating { display: inline-flex; align-items: center; gap: 5px; color: var(--gold); font-weight: 700; }
.rating svg { width: 14px; height: 14px; fill: currentColor; }
.badge {
  display: inline-block; padding: 1px 7px;
  border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 4px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.hero-overview {
  margin: 16px 0 28px; color: #d0d0da; font-size: clamp(15px, 1.2vw, 17px); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-dots {
  position: absolute; z-index: 3; right: var(--pad); bottom: clamp(100px, 17vh, 160px);
  display: flex; gap: 8px;
}
.hero-dot {
  position: relative; width: 28px; height: 4px; border-radius: 4px; overflow: hidden;
  background: rgba(255, 255, 255, 0.25); transition: width 0.4s var(--ease), background 0.2s;
}
.hero-dot:hover { background: rgba(255, 255, 255, 0.45); }
.hero-dot.active { width: 56px; }
.hero-dot.active::after {
  content: ''; position: absolute; inset: 0; background: white;
  transform-origin: left; animation: fill var(--hero-ms, 9000ms) linear forwards;
}
.hero.paused .hero-dot.active::after { animation-play-state: paused; }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ───────────── Rows ───────────── */
.rows { position: relative; z-index: 4; margin-top: -90px; padding-bottom: 80px; }
.row { margin-bottom: clamp(28px, 4vw, 44px); }
.row-head { display: flex; align-items: baseline; gap: 12px; padding: 0 var(--pad); margin-bottom: 12px; }
.row-title { font-family: var(--font-display); font-size: clamp(18px, 1.6vw, 22px); font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.row-sub { color: var(--faint); font-size: 13px; font-weight: 500; }
.row-more { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; opacity: 0.8; transition: color 0.2s, opacity 0.2s; }
.row-more:hover { color: var(--text); opacity: 1; }

.rail-wrap { position: relative; }
.rail {
  display: flex; gap: 12px;
  /* overflow-y can't be 'visible' next to a scrolling x-axis (it becomes 'auto'), and
     the Top 10 numerals' text box overflows, so the rail grabbed vertical wheel
     scrolling. Clip it; the padding below leaves room for the hover zoom. */
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
  padding: 14px var(--pad) 22px;
  scroll-snap-type: x proximity; scroll-padding: 0 var(--pad);
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-btn {
  position: absolute; top: 14px; bottom: 22px; z-index: 6;
  width: var(--pad); min-width: 44px;
  display: grid; place-items: center;
  opacity: 0; transition: opacity 0.25s;
}
.rail-btn svg { width: 30px; height: 30px; fill: none; stroke: white; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 6px #000); transition: transform 0.2s; }
.rail-btn:hover svg { transform: scale(1.25); }
.rail-btn.prev { left: 0; background: linear-gradient(90deg, rgba(8, 8, 12, 0.9), transparent); }
.rail-btn.next { right: 0; background: linear-gradient(-90deg, rgba(8, 8, 12, 0.9), transparent); }
.rail-wrap:hover .rail-btn:not([disabled]) { opacity: 1; }
.rail-btn[disabled] { pointer-events: none; }
@media (hover: none) { .rail-btn { display: none; } }

/* ───────────── Cards ───────────── */
.card {
  position: relative; flex: 0 0 var(--card-w);
  aspect-ratio: 2 / 3;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface);
  scroll-snap-align: start;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
  text-align: left; cursor: pointer;
}
.card img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.4s; }
.card img.loaded { opacity: 1; }
.card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); pointer-events: none;
}
.card-info {
  position: absolute; inset: auto 0 0 0; padding: 40px 12px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.6) 55%, transparent);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.3s, transform 0.35s var(--ease);
}
.card-title { font-weight: 700; font-size: 14px; line-height: 1.25; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); font-weight: 500; }
.card-play {
  position: absolute; top: 10px; right: 10px;
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  opacity: 0; transform: scale(0.7); transition: opacity 0.25s, transform 0.3s var(--ease);
}
.card-play svg { width: 14px; height: 14px; fill: #0a0a0f; margin-left: 2px; }
@media (hover: hover) {
  .card:hover, .card:focus-visible { transform: scale(1.07); z-index: 5; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(124, 92, 255, 0.5); }
  .card:hover .card-info, .card:focus-visible .card-info { opacity: 1; transform: none; }
  .card:hover .card-play, .card:focus-visible .card-play { opacity: 1; transform: none; }
}

/* Top 10 variant */
.rail.top10 { gap: 4px; }
.top10-item { position: relative; flex: 0 0 calc(var(--card-w) * 1.55); display: flex; align-items: flex-end; scroll-snap-align: start; }
.top10-num {
  flex: 0 0 auto; width: 52%;
  font-family: var(--font-display); font-weight: 800;
  font-size: calc(var(--card-w) * 1.05); line-height: 0.78; letter-spacing: -0.08em;
  color: var(--bg); -webkit-text-stroke: 3px rgba(255, 255, 255, 0.28);
  text-align: right; margin-right: -14%; user-select: none;
  transition: -webkit-text-stroke-color 0.3s;
}
.top10-item:hover .top10-num { -webkit-text-stroke-color: rgba(167, 139, 255, 0.85); }
.top10-item .card { flex-basis: var(--card-w); }

/* Skeletons */
.skeleton {
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 300% 100%; animation: shimmer 1.6s infinite linear; border-radius: var(--radius);
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skeleton.card { box-shadow: none; }
.skeleton-hero-title { width: 70%; height: 64px; margin-bottom: 20px; }
.skeleton-line { width: 100%; height: 14px; margin-bottom: 10px; border-radius: 6px; }
.skeleton-line.short { width: 60%; }

/* ───────────── Search ───────────── */
.page { padding: 108px var(--pad) 80px; min-height: 100vh; }
.search-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 2.4vw, 30px); margin: 0 0 24px; letter-spacing: -0.01em; }
.search-title span { color: var(--muted); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr)); gap: 20px 14px; }
.grid .card { flex: none; width: 100%; }
.empty { grid-column: 1 / -1; padding: 80px 0; text-align: center; color: var(--muted); }
.empty-icon { font-size: 44px; margin-bottom: 10px; opacity: 0.6; }

/* ───────────── Modal ───────────── */
.modal {
  width: min(960px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  margin: auto; padding: 0;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  opacity: 0; transform: translateY(24px) scale(0.98);
  transition: opacity 0.3s var(--ease), transform 0.35s var(--ease), overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}
.modal[open] { opacity: 1; transform: none; }
@starting-style { .modal[open] { opacity: 0; transform: translateY(24px) scale(0.98); } }
.modal::backdrop { background: rgba(0, 0, 0, 0); backdrop-filter: blur(0); transition: background 0.3s, backdrop-filter 0.3s, overlay 0.3s allow-discrete, display 0.3s allow-discrete; }
.modal[open]::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(6px); }
@starting-style { .modal[open]::backdrop { background: rgba(0, 0, 0, 0); backdrop-filter: blur(0); } }
.modal-body { max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent; }

.modal-close {
  position: absolute; top: 16px; right: 16px; z-index: 5;
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(8, 8, 12, 0.7); backdrop-filter: blur(8px);
  border: 1px solid var(--border); transition: background 0.2s, transform 0.2s;
}
.modal-close:hover { background: rgba(40, 40, 52, 0.9); transform: rotate(90deg); }
.modal-close svg { width: 18px; height: 18px; stroke: white; stroke-width: 2.5; stroke-linecap: round; }

.detail-hero { position: relative; aspect-ratio: 16 / 8; background: #000 center / cover no-repeat; }
.detail-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg-2) 2%, rgba(16, 16, 23, 0.5) 40%, transparent 75%); pointer-events: none; }
.detail-hero iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 2; }
.detail-hero.playing::after { display: none; }
.detail-head { position: absolute; left: 36px; right: 36px; bottom: 24px; z-index: 1; }
.detail-hero.playing .detail-head { display: none; }
.detail-logo { max-width: min(380px, 70%); max-height: 120px; object-fit: contain; object-position: left bottom; margin-bottom: 20px; filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.7)); }
.detail-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(28px, 4vw, 46px); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 18px; }

.detail-main { padding: 8px 36px 36px; }
.detail-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 32px; margin-top: 18px; }
.tagline { font-style: italic; color: var(--muted); margin: 0 0 10px; }
.overview { margin: 0; color: #d6d6e0; line-height: 1.7; font-size: 15.5px; }
.facts { display: grid; gap: 10px; align-content: start; font-size: 14px; }
.facts dt { color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.facts dd { margin: 2px 0 6px; color: #dadae4; }
.facts a { color: var(--gold); text-decoration: none; font-weight: 600; }
.facts a:hover { text-decoration: underline; }

.section-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; margin: 36px 0 14px; }
.cast { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.cast::-webkit-scrollbar { display: none; }
.person { flex: 0 0 92px; text-align: center; }
.person-photo { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; background: var(--surface-2); margin-bottom: 8px; display: grid; place-items: center; color: var(--faint); font-weight: 700; font-size: 22px; border: 2px solid var(--border); }
.person-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.person-role { font-size: 12px; color: var(--faint); line-height: 1.3; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.modal .grid { --card-w: 140px; }

.detail-loading { display: grid; place-items: center; height: 420px; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent-1); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────── Toast ───────────── */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 12px 20px; border-radius: 999px;
  background: rgba(30, 30, 42, 0.92); backdrop-filter: blur(12px);
  border: 1px solid var(--border); box-shadow: 0 12px 40px -10px #000;
  font-weight: 500; font-size: 14px;
  transition: opacity 0.3s, transform 0.35s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ───────────── Nav tabs ───────────── */
.tabs { display: flex; gap: 4px; margin-right: auto; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14.5px;
  transition: color 0.2s, background 0.2s;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.tab.active { color: var(--text); }
.tab.active::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px;
  background: var(--accent);
}
.tab-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-grid; place-items: center;
  background: var(--accent); color: white; font-size: 11px; font-weight: 700;
}

/* ───────────── IMDb pill / type tag ───────────── */
.imdb {
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 700; color: var(--text);
}
.imdb-mark {
  display: inline-block; padding: 0 4px; border-radius: 3px;
  background: #f5c518; color: #000;
  font: 900 10.5px/1.45 var(--font); letter-spacing: -0.02em;
}
.imdb-votes { color: var(--faint); font-weight: 500; font-size: 0.9em; }
.type-tag {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  padding: 2px 7px; border-radius: 5px;
  background: rgba(8, 8, 12, 0.72); backdrop-filter: blur(6px);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #e5e5ee;
}

/* ───────────── My List toggle on cards ───────────── */
.list-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(8, 8, 12, 0.7); backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  opacity: 0; transform: scale(0.8);
  transition: opacity 0.2s, transform 0.25s var(--ease), background 0.2s, border-color 0.2s;
}
.list-btn svg { width: 16px; height: 16px; fill: none; stroke: white; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.list-btn .i-check { display: none; }
.list-btn[aria-pressed="true"] { opacity: 1; transform: none; background: var(--accent-1); border-color: transparent; }
.list-btn[aria-pressed="true"] .i-plus { display: none; }
.list-btn[aria-pressed="true"] .i-check { display: block; }
.list-btn:hover { border-color: white; transform: scale(1.1); }
@media (hover: hover) {
  .card:hover .list-btn, .card:focus-visible .list-btn { opacity: 1; transform: none; }
}
@media (hover: none) { .list-btn { opacity: 1; transform: none; } }
.btn-ghost[aria-pressed="true"] { background: rgba(124, 92, 255, 0.35); border-color: rgba(124, 92, 255, 0.8); }
.btn .i-check { display: none; }
.btn[aria-pressed="true"] .i-plus { display: none; }
.btn[aria-pressed="true"] .i-check { display: block; }
.btn svg.stroke { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* ───────────── Continue Watching (wide cards) ───────────── */
.card.wide { flex-basis: calc(var(--card-w) * 1.7); aspect-ratio: 16 / 9; }
.wide-shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.1) 60%);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 12px 14px 16px;
}
.wide-title { font-weight: 700; font-size: 15px; line-height: 1.25; }
.wide-meta { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.wide-play {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(0.85);
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92); opacity: 0; transition: opacity 0.25s, transform 0.3s var(--ease);
}
.wide-play svg { width: 20px; height: 20px; fill: #0a0a0f; margin-left: 3px; }
.card.wide:hover .wide-play { opacity: 1; transform: translate(-50%, -50%); }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, 0.2); }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 0 2px 2px 0; }
.remove-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(8, 8, 12, 0.7); opacity: 0; transition: opacity 0.2s, background 0.2s;
}
.remove-btn svg { width: 14px; height: 14px; stroke: white; stroke-width: 2.5; stroke-linecap: round; }
.remove-btn:hover { background: rgba(255, 92, 138, 0.85); }
.card.wide:hover .remove-btn, .card.wide:focus-visible .remove-btn { opacity: 1; }
@media (hover: none) { .remove-btn { opacity: 1; } }

/* ───────────── Browse page ───────────── */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-bottom: 24px; }
.page-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 3.6vw, 44px); letter-spacing: -0.025em; margin: 0; }
.page-sub { color: var(--faint); font-weight: 500; }

.seg {
  display: inline-flex; padding: 4px; gap: 2px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border); border-radius: 999px;
}
.seg button {
  padding: 8px 18px; border-radius: 999px;
  color: var(--muted); font-weight: 600; font-size: 14px;
  transition: color 0.2s, background 0.25s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: #fff; color: #0a0a0f; }
.seg.small button { padding: 6px 13px; font-size: 13px; }

.filters {
  display: grid; gap: 18px;
  padding: 20px 22px; margin-bottom: 30px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.filter-row { display: flex; flex-wrap: wrap; gap: 18px 36px; }
.filter-group { display: grid; gap: 10px; min-width: 0; }
.filter-label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 92%, transparent);
  padding-right: 40px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 7px 15px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
  color: #cfcfda; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.chip:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.chip[aria-checked="true"] { background: var(--accent); border-color: transparent; color: white; box-shadow: 0 4px 16px -6px rgba(124, 92, 255, 0.8); }
.sentinel { height: 1px; }
.load-more { grid-column: 1 / -1; display: flex; justify-content: center; padding: 24px 0; }

/* ───────────── Stream picker ───────────── */
.modal-sm { width: min(760px, calc(100vw - 32px)); }
.source-head { padding: 26px 28px 8px; padding-right: 70px; }
.source-head h2 { font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.source-head p { margin: 0; color: var(--muted); font-size: 14px; }
.source-section { padding: 14px 28px 4px; }
.source-section:last-child { padding-bottom: 28px; }
.source-label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.source-list { display: grid; gap: 8px; }
.source-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border-radius: 12px; text-align: left;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.source-item:hover { background: rgba(124, 92, 255, 0.14); border-color: rgba(124, 92, 255, 0.55); transform: translateY(-1px); }
.source-item[disabled] { opacity: 0.55; pointer-events: none; }
.source-icon { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; background: var(--accent); }
.source-icon svg { width: 18px; height: 18px; fill: white; }
.source-icon.muted { background: var(--surface-2); }
.source-name { font-weight: 600; font-size: 14.5px; word-break: break-all; }
.source-meta { color: var(--faint); font-size: 12.5px; font-weight: 500; }
.source-go { margin-left: auto; font-weight: 700; font-size: 13px; color: var(--text); white-space: nowrap; }
.source-empty { color: var(--faint); font-size: 14px; padding: 6px 0; }
.source-empty code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; color: var(--muted); }

/* Torrent results */
.tfilters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.tfilters .chips { mask-image: none; padding-right: 0; }
.chip span { opacity: 0.6; font-weight: 500; margin-left: 2px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--accent-1); width: 16px; height: 16px; }
.tsearching { display: grid; gap: 8px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.tsearching .bar { height: 3px; border-radius: 3px; background: var(--surface-2); overflow: hidden; position: relative; }
.tsearching .bar::after { content: ''; position: absolute; inset: 0; width: 35%; background: var(--accent); border-radius: 3px; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.tlist { display: grid; gap: 8px; max-height: min(56vh, 560px); overflow-y: auto; margin: 0 -6px; padding: 0 6px 4px; scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent; }
.trow {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--border);
  transition: border-color 0.2s, background 0.2s;
}
.trow:hover { border-color: rgba(124, 92, 255, 0.45); background: rgba(124, 92, 255, 0.07); }
.trow.dim .tmain { opacity: 0.7; }
.tq {
  flex-shrink: 0; min-width: 58px; padding: 5px 0; margin-top: 2px; border-radius: 7px; text-align: center;
  font: 800 12.5px var(--font); letter-spacing: 0.02em; background: var(--surface-2); color: var(--muted);
}
.tq.q-4k { background: linear-gradient(135deg, #ffc94d, #ff8a4d); color: #1a1000; }
.tq.q-1080p { background: var(--accent); color: white; }
.tq.q-720p { background: rgba(124, 92, 255, 0.25); color: #cfc4ff; }
.tmain { flex: 1; min-width: 0; display: grid; gap: 4px; }
.tname { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmeta { color: var(--faint); font-size: 12.5px; font-weight: 500; }
.tbadges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 2px; }
.tbadge { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.tbadge.ok { background: rgba(61, 220, 132, 0.14); color: var(--green); }
.tbadge.warn { background: rgba(255, 201, 77, 0.12); color: var(--gold); }
.tbadge.bad { background: rgba(255, 92, 138, 0.14); color: #ff7aa0; }
.treason { font-size: 12px; color: var(--faint); }
.treason.bad { color: #ff7aa0; }
.tside { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex-shrink: 0; }
.tseeds { color: var(--green); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.tseeds small { color: var(--faint); font-weight: 500; }
.tstream { height: 36px; padding: 0 16px; font-size: 13.5px; }
.tstream svg { width: 15px; height: 15px; }
.tadded { color: var(--green); font-weight: 700; font-size: 13.5px; height: 36px; display: grid; place-items: center; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
.tprog { margin-top: 8px; display: grid; gap: 6px; }
.tprog-bar { height: 5px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.tprog-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.6s var(--ease); }
.tprog-text { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.tprog-hint { color: var(--faint); margin-left: 6px; }
.tnote { padding: 16px 18px; border-radius: 12px; background: rgba(255, 201, 77, 0.06); border: 1px solid rgba(255, 201, 77, 0.2); color: #dcdce6; font-size: 14px; line-height: 1.6; }
.tnote ol { margin: 8px 0; padding-left: 20px; }
.tnote a { color: var(--gold); }
.tnote code, .source-empty code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }
.dev-files summary { cursor: pointer; list-style: none; }
.dev-files summary::before { content: '▸ '; }
.dev-files[open] summary::before { content: '▾ '; }
@media (max-width: 600px) {
  .trow { flex-wrap: wrap; }
  .tside { flex-direction: row; width: 100%; justify-content: space-between; align-items: center; }
}

/* ───────────── Player ───────────── */
body.watching { overflow: hidden; }
body.watching .nav { display: none; }
.watch { position: fixed; inset: 0; z-index: 80; background: #000; }
.watch-shell, .watch .plyr { width: 100%; height: 100%; }
.watch video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.watch .plyr {
  --plyr-color-main: var(--accent-1);
  --plyr-font-family: var(--font);
  --plyr-video-background: #000;
  --plyr-control-radius: 8px;
  --plyr-range-thumb-height: 14px;
  --plyr-range-track-height: 5px;
  --plyr-video-controls-background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}
.watch .plyr__poster { background-size: cover; }
.watch .plyr__control--overlaid { padding: 26px; background: rgba(124, 92, 255, 0.9); box-shadow: 0 10px 40px -8px rgba(124, 92, 255, 0.8); }
.watch .plyr__control--overlaid svg { width: 26px; height: 26px; }
.watch .plyr--video .plyr__controls { padding: 40px 28px 22px; }

.watch-top {
  position: absolute; inset: 0 0 auto 0; z-index: 4;
  display: flex; align-items: center; gap: 16px;
  padding: 22px 28px 60px;
  background: linear-gradient(rgba(0, 0, 0, 0.75), transparent);
  transition: opacity 0.4s, transform 0.4s var(--ease);
  pointer-events: none;
}
.watch-top > * { pointer-events: auto; }
.plyr--hide-controls .watch-top { opacity: 0; transform: translateY(-10px); }
.watch-back {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.15);
  transition: background 0.2s, transform 0.2s;
}
.watch-back:hover { background: rgba(255, 255, 255, 0.22); transform: translateX(-2px); }
.watch-back svg { width: 22px; height: 22px; fill: none; stroke: white; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.watch-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(18px, 2vw, 24px); letter-spacing: -0.01em; line-height: 1.2; }
.watch-sub { color: var(--muted); font-size: 13.5px; font-weight: 500; }

.watch-pill, .watch-notice {
  position: absolute; z-index: 5; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 18px; border-radius: 999px;
  background: rgba(20, 20, 30, 0.85); backdrop-filter: blur(12px);
  border: 1px solid var(--border); box-shadow: 0 10px 30px -10px #000;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  animation: rise 0.5s var(--ease) both;
}
.watch-pill { top: 96px; }
.watch-notice { top: 96px; white-space: normal; max-width: min(640px, calc(100% - 40px)); border-radius: 14px; border-color: rgba(255, 201, 77, 0.35); }
.watch-pill button, .watch-notice button {
  padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.watch-pill button:hover, .watch-notice button:hover { background: rgba(255, 255, 255, 0.26); }

.watch-layer {
  position: absolute; inset: 0; z-index: 6;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(6px);
  animation: rise 0.4s var(--ease) both;
}
.watch-card { text-align: center; max-width: 460px; padding: 24px; }
.watch-card-icon {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--accent); font-size: 28px; color: white;
}
.watch-card h3 { font-family: var(--font-display); font-size: 24px; margin: 0 0 8px; }
.watch-card p { color: var(--muted); margin: 0 0 20px; line-height: 1.6; }
.watch-card .actions { justify-content: center; margin-top: 18px; }

/* Torrent streaming: preparing screen, stats, seek-bar band, buffering pill */
.watch-layer.prep { background: #000; backdrop-filter: none; overflow: hidden; }
.prep-bg { position: absolute; inset: -40px; background: center / cover no-repeat; filter: blur(28px) brightness(0.35) saturate(1.2); transform: scale(1.05); }
.prep-card { position: relative; display: grid; justify-items: center; gap: 14px; width: min(480px, calc(100% - 48px)); text-align: center; }
.prep-logo { max-width: 320px; max-height: 110px; object-fit: contain; margin-bottom: 10px; filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.7)); }
.prep-title { font-family: var(--font-display); font-size: 34px; margin: 0 0 6px; }
.prep-status { font-weight: 600; font-size: 16px; }
.prep-status b { background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.prep-bar { position: relative; width: 100%; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.prep-bar span { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width 0.8s var(--ease); }
.prep-bar.indeterminate span { position: absolute; width: 30% !important; animation: indet 1.3s ease-in-out infinite; }
.prep-detail { color: var(--muted); font-size: 13.5px; font-weight: 500; min-height: 20px; margin-bottom: 8px; }

.watch-stats {
  margin-left: auto; padding: 8px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.watch-stats .ok { color: var(--green); }

.watch .plyr__progress { position: relative; }
.dl-band {
  position: absolute; left: 0; right: 0; top: 50%; z-index: 1;
  height: var(--plyr-range-track-height, 5px); transform: translateY(-50%);
  border-radius: 5px; pointer-events: none; overflow: hidden;
}
.dl-band span { position: absolute; top: 0; bottom: 0; background: rgba(124, 92, 255, 0.55); }
.watch .plyr__progress input[type="range"] { position: relative; z-index: 2; }

.watch-buffer {
  position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 40px);
  padding: 12px 20px; border-radius: 999px;
  background: rgba(10, 10, 16, 0.82); backdrop-filter: blur(12px); border: 1px solid var(--border);
  font-size: 14px; font-weight: 600; text-align: center;
}
@media (max-width: 700px) { .watch-stats { display: none; } }

/* ───────────── Downloads ───────────── */
.dl-speeds { display: flex; gap: 10px; margin-left: auto; }
.dl-speeds span {
  padding: 7px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border);
  font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; color: #dcdce6;
}
.storage {
  padding: 18px 22px; margin-bottom: 22px; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)); border: 1px solid var(--border);
}
.storage:empty { display: none; }
.storage-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 20px; margin-bottom: 12px; color: var(--muted); font-size: 14px; }
.storage-free { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--text); margin-right: 4px; }
.storage-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; font-weight: 500; }
.storage-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-streamer { background: var(--accent); }
.sw-other { background: #4a4a5c; }
.sw-free { background: var(--surface-2); border: 1px solid var(--border); }
.storage-bar { display: flex; height: 10px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.storage-bar span { height: 100%; transition: width 0.6s var(--ease); }
.storage-bar .seg-streamer { background: var(--accent); min-width: 3px; }
.storage-bar .seg-other { background: #4a4a5c; }
.storage-bar.low { box-shadow: 0 0 0 1px rgba(255, 92, 138, 0.6); }
.storage-warn { margin-top: 10px; color: #ff7aa0; font-size: 13px; font-weight: 600; }
.seg button span { opacity: 0.55; font-weight: 500; margin-left: 2px; }
#dl-filter { margin-bottom: 18px; }

.dl-list { display: grid; gap: 10px; }
.dl-row {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 18px 14px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--border);
  transition: border-color 0.2s, background 0.2s;
}
.dl-row:hover { border-color: rgba(124, 92, 255, 0.4); background: rgba(124, 92, 255, 0.05); }
.dl-poster {
  flex-shrink: 0; width: 60px; aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center;
}
.dl-poster img { width: 100%; height: 100%; object-fit: cover; }
.dl-poster svg { width: 26px; height: 26px; color: var(--faint); }
.dl-main { flex: 1; min-width: 0; display: grid; gap: 5px; }
.dl-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.dl-title span { color: var(--faint); font-weight: 600; font-family: var(--font); font-size: 14px; margin-left: 4px; }
.dl-name { color: var(--faint); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: 4px 0 2px; }
.dl-bar span { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width 0.8s var(--ease); }
.dl-row[data-state="seeding"] .dl-bar span { background: var(--green); }
.dl-row[data-state="paused"] .dl-bar span { background: #6b6b80; }
.dl-row[data-state="error"] .dl-bar span { background: #ff5c8a; }
.dl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.dl-meta b { color: var(--text); font-weight: 600; }
.dl-row[data-state="seeding"] .dl-meta b { color: var(--green); }
.dl-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.dl-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dl-play { height: 38px; padding: 0 16px; font-size: 14px; }
.dl-play svg { width: 14px; height: 14px; }
.btn[disabled] { opacity: 0.35; pointer-events: none; box-shadow: none; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border); transition: background 0.2s, border-color 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.15); }
.icon-btn svg { width: 15px; height: 15px; fill: currentColor; }
.icon-btn svg.stroke, .dl-poster svg.stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.danger:hover { background: rgba(255, 92, 138, 0.2); border-color: rgba(255, 92, 138, 0.5); color: #ff9ab6; }

.modal-confirm { width: min(460px, calc(100vw - 32px)); }
.confirm-body { padding: 26px 26px 22px; }
.confirm-body h3 { font-family: var(--font-display); font-size: 21px; margin: 0 0 10px; letter-spacing: -0.01em; word-break: break-word; }
.confirm-body p { color: var(--muted); margin: 0 0 22px; line-height: 1.6; font-size: 14.5px; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-danger { background: #e8406f; color: white; }
.btn-danger:hover { background: #ff5c8a; }
.btn-danger svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-text { color: var(--muted); padding: 0 12px; }
.btn-text:hover { color: var(--text); }
@media (max-width: 700px) {
  .dl-row { flex-wrap: wrap; }
  .dl-actions { width: 100%; justify-content: flex-end; }
  .dl-speeds { margin-left: 0; }
}

/* Player: format badge + audio track menu */
.watch-format {
  margin-left: auto; padding: 7px 12px; border-radius: 999px;
  background: rgba(255, 201, 77, 0.12); border: 1px solid rgba(255, 201, 77, 0.3); color: var(--gold);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.watch-format:not([hidden]) ~ .watch-stats { margin-left: 0; }
.watch-format:not([hidden]) ~ .watch-audio { margin-left: 0; }
.watch-audio { position: relative; margin-left: auto; }
.watch-format:not([hidden]) + .watch-audio { margin-left: 0; }
.watch-audio:not([hidden]) ~ .watch-stats { margin-left: 0; }
.watch-audio-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 13px; font-weight: 600;
}
.watch-audio-btn:hover { background: rgba(255, 255, 255, 0.18); }
.watch-audio-btn svg { width: 16px; height: 16px; fill: currentColor; }
.watch-audio-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; min-width: 260px;
  display: grid; padding: 6px; border-radius: 12px;
  background: rgba(16, 16, 23, 0.96); backdrop-filter: blur(16px); border: 1px solid var(--border);
  box-shadow: 0 20px 50px -10px #000;
}
.watch-audio-menu button {
  display: grid; text-align: left; padding: 9px 12px 9px 32px; border-radius: 8px; font-size: 13.5px; font-weight: 500; position: relative;
}
.watch-audio-menu button:hover { background: rgba(255, 255, 255, 0.08); }
.watch-audio-menu button[aria-checked="true"]::before { content: '✓'; position: absolute; left: 12px; color: var(--accent-1); font-weight: 800; }
.watch-audio-menu small { color: var(--faint); font-size: 12px; }
@media (max-width: 900px) { .watch-format { display: none; } }

/* Player: OpenSubtitles panel */
.watch-online { position: relative; }
.watch-audio:not([hidden]) ~ .watch-online, .watch-format:not([hidden]) ~ .watch-online { margin-left: 0; }
.watch-online:not([hidden]) { margin-left: auto; }
.watch-format:not([hidden]) ~ .watch-online:not([hidden]), .watch-audio:not([hidden]) ~ .watch-online:not([hidden]) { margin-left: 0; }
.watch-online:not([hidden]) ~ .watch-stats { margin-left: 0; }
.online-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; width: min(440px, 90vw);
  border-radius: 14px; background: rgba(16, 16, 23, 0.97); backdrop-filter: blur(16px);
  border: 1px solid var(--border); box-shadow: 0 24px 60px -12px #000; overflow: hidden;
}
.online-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: grid; gap: 10px; font-size: 14px; }
.online-langs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.online-langs .chip { padding: 4px 10px; font-size: 12.5px; }
.online-langs select {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 10px; font: 600 12.5px var(--font);
}
.online-list { max-height: min(50vh, 420px); overflow-y: auto; padding: 6px; display: grid; gap: 4px; scrollbar-width: thin; }
.online-item { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 10px 12px; border-radius: 10px; transition: background 0.15s; }
.online-item:hover { background: rgba(124, 92, 255, 0.12); }
.online-item.loading { opacity: 0.5; pointer-events: none; }
.online-lang { flex-shrink: 0; min-width: 38px; padding: 3px 0; border-radius: 6px; background: var(--surface-2); text-align: center; font: 800 11.5px var(--font); color: var(--muted); }
.online-main { display: grid; gap: 4px; min-width: 0; }
.online-release { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--faint); }
.online-tags .tbadge:not(.ok):not(.warn):not(.bad) { background: var(--surface-2); color: var(--muted); }
.online-note { padding: 14px; color: var(--muted); font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.online-note.small { padding: 6px 12px; font-size: 12px; color: var(--faint); }
.online-foot:empty { display: none; }
.online-foot { padding: 8px 16px 12px; font-size: 12px; color: var(--faint); border-top: 1px solid var(--border); }

/* ───────────── Login ───────────── */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 50% at 20% 20%, rgba(124, 92, 255, 0.25), transparent 70%),
    radial-gradient(50% 50% at 85% 80%, rgba(255, 92, 138, 0.18), transparent 70%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%); padding: 34px 30px 28px; border-radius: 20px;
  background: rgba(22, 22, 31, 0.8); backdrop-filter: blur(20px); border: 1px solid var(--border);
  box-shadow: 0 40px 100px -30px #000;
}
.login-card .brand { margin-bottom: 26px; }
.login-card h1 { font-family: var(--font-display); font-size: 28px; margin: 0 0 20px; letter-spacing: -0.02em; }
#login-form { display: grid; gap: 16px; }
#login-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
#login-form input {
  height: 46px; padding: 0 14px; border-radius: 12px; font: 500 15px var(--font); color: var(--text);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border); outline: none; transition: border-color 0.2s, background 0.2s;
}
#login-form input:focus { border-color: rgba(124, 92, 255, 0.7); background: rgba(255, 255, 255, 0.09); }
#login-form .btn { justify-content: center; margin-top: 6px; height: 48px; }
.login-error { margin: 0; color: #ff7aa0; font-size: 13.5px; font-weight: 600; }
.login-hint { margin: 18px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-hint code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 12px; word-break: break-all; }

/* Nav user menu */
.user-menu { position: relative; }
.user-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--border); font-weight: 800; font-size: 15px; text-transform: uppercase;
}
.user-btn:hover { background: rgba(255, 255, 255, 0.15); }
.user-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px; border-radius: 12px; z-index: 60;
  background: rgba(16, 16, 23, 0.97); border: 1px solid var(--border); box-shadow: 0 20px 50px -10px #000;
}
.user-pop div { padding: 8px 12px; color: var(--muted); font-size: 13px; }
.user-pop b { color: var(--text); }
.user-pop button { width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.user-pop button:hover { background: rgba(255, 92, 138, 0.15); color: #ff9ab6; }

/* ───────────── Series episodes ───────────── */
.episodes { margin-top: 30px; }
.ep-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-bottom: 14px; }
.ep-head .section-title { margin: 0; }
.season-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ep-list { display: grid; gap: 6px; }
.ep-row {
  display: flex; gap: 16px; align-items: flex-start; padding: 10px; border-radius: 12px; cursor: pointer;
  transition: background 0.2s;
}
.ep-row:hover, .ep-row:focus-visible { background: rgba(255, 255, 255, 0.06); }
.ep-row.unaired { opacity: 0.45; cursor: default; }
.ep-row.watched .ep-still img { opacity: 0.55; }
.ep-still { position: relative; flex: 0 0 168px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.ep-still img { width: 100%; height: 100%; object-fit: cover; }
.ep-play {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity 0.2s;
  background: rgba(0, 0, 0, 0.35);
}
.ep-play svg { width: 30px; height: 30px; fill: white; filter: drop-shadow(0 2px 6px #000); }
.ep-row:hover .ep-play { opacity: 1; }
.ep-row.unaired .ep-play { display: none; }
.ep-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ep-title { font-weight: 700; font-size: 15px; }
.ep-num { color: var(--faint); margin-right: 2px; }
.ep-watched { color: var(--green); margin-left: 4px; }
.ep-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--faint); font-size: 12.5px; font-weight: 500; }
.ep-overview { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tbadge.kind { background: rgba(124, 92, 255, 0.18); color: #cfc4ff; }
.next-tag { color: var(--accent-2); font-weight: 800; margin-right: 2px; }
.dl-badge { font-style: normal; font-family: var(--font); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(124, 92, 255, 0.2); color: #cfc4ff; margin-left: 6px; vertical-align: middle; }
.watch-card.upnext { text-align: left; max-width: 520px; }
.upnext-label { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 8px; }
.watch-card.upnext .actions { justify-content: flex-start; }
@media (max-width: 600px) { .ep-still { flex-basis: 120px; } .ep-overview { display: none; } }

/* ───────────── Responsive ───────────── */
@media (max-width: 1100px) {
  .tab { padding: 8px 9px; font-size: 14px; }
  .search { width: min(260px, 30vw); }
}
@media (max-width: 900px) {
  .nav { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 6px; row-gap: 6px; }
  .brand { margin-right: auto; }
  .tabs { order: 3; width: 100%; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .page { padding-top: 130px; }
}
@media (max-width: 760px) {
  .nav { gap: 12px; }
  .brand-name { display: none; }
  .search { width: auto; flex: 1; }
  .search-kbd { display: none; }
  #picker-btn { padding: 0 14px; font-size: 0; gap: 0; }
  #picker-btn span { font-size: 18px; }
  .hero { height: 78vh; min-height: 520px; }
  .hero-shade { background: linear-gradient(0deg, var(--bg) 8%, rgba(8, 8, 12, 0.7) 45%, rgba(8, 8, 12, 0.2) 100%); }
  .hero-dots { left: var(--pad); right: auto; bottom: 64px; }
  .hero-content { bottom: 96px; }
  .rows { margin-top: -40px; }
  .detail-hero { aspect-ratio: 16 / 10; }
  .detail-head { left: 20px; right: 20px; }
  .detail-main { padding: 8px 20px 28px; }
  .detail-grid { grid-template-columns: 1fr; gap: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
