:root {
  color-scheme: dark;
  --bg: #080a13;
  --bg-raised: #131625;
  --bar: rgba(14, 17, 31, 0.78);
  --text: #f6f3ff;
  --muted: #9ba3bc;
  --line: rgba(255, 255, 255, 0.11);
  --cyan: #8a5cff;
  --rose: #00d2ff;
  --heart: #b976ff;
  --gold: #f2bb46;
  --blue: #00d2ff;
  --focus: #ffffff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  --radius-sm: 0.55rem;
  --radius-md: 0.8rem;
  --radius-lg: 1rem;
  --control-h-sm: 2.75rem;
  --control-h-md: 3.25rem;
  --control-h-lg: 4rem;
  --gap-sm: 0.6rem;
  --gap-md: 0.9rem;
  --route-home: #00d2ff;
  --route-library: #58a8ff;
  --route-schedule: #f2bb46;
  --route-anipub: #8a5cff;
  --route-favorites: #b976ff;
  --route-sources: #40dfc2;
  --route-settings: #ff7ab6;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f9;
  --bg-raised: #ffffff;
  --bar: rgba(255, 255, 255, 0.76);
  --text: #101524;
  --muted: #667085;
  --line: rgba(16, 21, 36, 0.13);
  --shadow: 0 24px 70px rgba(27, 37, 66, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 8rem;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
  scrollbar-width: thin;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 0%, rgba(138, 92, 255, 0.2), transparent 28rem),
    radial-gradient(circle at 100% 20%, rgba(0, 210, 255, 0.12), transparent 30rem),
    linear-gradient(180deg, #111426 0%, var(--bg) 32rem);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html,
body {
  background-color: #050710;
}

body[data-theme="light"] {
  background:
    radial-gradient(circle at 14% 0%, rgba(0, 210, 255, 0.16), transparent 28rem),
    radial-gradient(circle at 100% 18%, rgba(181, 122, 255, 0.16), transparent 30rem),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 34rem);
}

body[data-theme="light"]::before {
  background: linear-gradient(90deg, rgba(244, 248, 255, 0.82), transparent 24rem);
}

body[data-theme="light"]::after {
  background:
    linear-gradient(90deg, rgba(244, 248, 255, 0.82) 0%, rgba(244, 248, 255, 0.55) 38%, rgba(244, 248, 255, 0.14) 100%),
    linear-gradient(0deg, rgba(238, 243, 249, 0.92) 0%, rgba(238, 243, 249, 0.42) 46%, transparent 72%),
    radial-gradient(circle at 70% 4%, rgba(0, 210, 255, 0.1), transparent 28rem),
    linear-gradient(135deg, #f8fbff, #e7edf8);
  filter: saturate(1.04) brightness(1);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(8, 10, 19, 0.94), transparent 23rem);
  opacity: 0.8;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8, 10, 19, 0.98) 0%, rgba(8, 10, 19, 0.78) 36%, rgba(8, 10, 19, 0.36) 100%),
    linear-gradient(0deg, var(--bg) 0%, rgba(8, 10, 19, 0.86) 20%, transparent 62%),
    radial-gradient(circle at 70% 4%, rgba(138, 92, 255, 0.12), transparent 28rem),
    linear-gradient(135deg, #101321, #171b2d);
  background-position: center;
  background-size: cover;
  filter: saturate(1.08) brightness(0.6);
  opacity: 0.9;
  transform: none;
}

::-webkit-scrollbar {
  width: 0.34rem;
  height: 0.34rem;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border-radius: 999rem;
  background: rgba(255, 255, 255, 0.15);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

.poster-grid,
.carousel-indicators,
.season-tab-list,
.episode-buttons,
.watch-info,
.main-nav {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.poster-grid::-webkit-scrollbar,
.carousel-indicators::-webkit-scrollbar,
.season-tab-list::-webkit-scrollbar,
.episode-buttons::-webkit-scrollbar,
.watch-info::-webkit-scrollbar,
.main-nav::-webkit-scrollbar {
  display: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.75rem;
  color: #ffffff;
  background:
    radial-gradient(circle at 50% 42%, rgba(59, 130, 246, 0.2), transparent 18rem),
    radial-gradient(circle at 52% 58%, rgba(37, 99, 235, 0.14), transparent 22rem),
    linear-gradient(180deg, #0D1B2A, #081320 96%);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.app-loader::after {
  content: "";
  width: min(16rem, 44vw);
  height: 0.18rem;
  margin-top: 0.45rem;
  border-radius: 999rem;
  background:
    linear-gradient(90deg, rgba(59, 130, 246, 0), rgba(92, 155, 255, 0.95), rgba(59, 130, 246, 0.95), rgba(59, 130, 246, 0));
  background-size: 180% 100%;
  box-shadow: 0 0 1.3rem rgba(59, 130, 246, 0.28);
  animation: loader-fill 1.15s ease-in-out infinite;
}

.app-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── ZenkaiTV app loader ──────────────────────────────────────────────────── */
.loader-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 5.6rem;
  height: 5.6rem;
  border-radius: 1.6rem;
  background: #0D1B2A;
  box-shadow:
    0 1.3rem 2.8rem rgba(0, 0, 0, 0.42),
    0 0 2.4rem rgba(59, 130, 246, 0.3),
    inset 0 0 0 0.08rem rgba(92, 155, 255, 0.22);
  overflow: hidden;
  animation: loader-breathe 2.4s ease-in-out infinite;
}

/* rotating loading ring */
.loader-mark::before {
  content: "";
  position: absolute;
  inset: -0.42rem;
  border-radius: 2rem;
  border: 0.17rem solid rgba(92, 155, 255, 0.14);
  border-top-color: #3B82F6;
  border-right-color: rgba(59, 130, 246, 0.5);
  animation: loader-spin 1.05s linear infinite;
}

/* light sweep across the logo */
.loader-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 40%, rgba(180, 210, 255, 0.42) 50%, transparent 60%);
  transform: translateX(-130%);
  animation: logo-shimmer 3.4s ease-in-out infinite;
  pointer-events: none;
}

.loader-logo {
  position: relative;
  z-index: 1;
  width: 72%;
  height: 72%;
  object-fit: contain;
  filter: drop-shadow(0 0 0.7rem rgba(59, 130, 246, 0.42));
  animation: loader-logo-pulse 2.4s ease-in-out infinite;
}

@keyframes loader-logo-pulse {
  0%, 100% { transform: scale(0.96); }
  50%      { transform: scale(1.05); }
}

.app-loader strong {
  margin-top: 0.1rem;
  font-size: 1.35rem;
  font-weight: 950;
}

.app-loader small {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.86rem;
  font-weight: 800;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 0 0 5.9rem;
  background:
    linear-gradient(180deg, rgba(8, 10, 19, 0) 0%, rgba(8, 10, 19, 0.5) 66%, #050710 100%);
  transition: padding-left 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  grid-template-columns: 1fr;
  align-items: start;
  width: 5.9rem;
  min-height: 100vh;
  padding: 1.2rem 0.55rem;
  background:
    linear-gradient(90deg, rgba(8, 10, 19, 0.48), rgba(8, 10, 19, 0.18) 70%, transparent);
  box-shadow: none;
  backdrop-filter: blur(14px) saturate(1.08);
  animation: topbar-enter 520ms ease both;
  transition: width 360ms cubic-bezier(0.22, 1, 0.36, 1), padding 360ms cubic-bezier(0.22, 1, 0.36, 1), background 260ms ease;
}

.brand {
  display: grid;
  justify-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 0.7rem;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 4.1rem;
  height: 4.1rem;
  border-radius: 1.35rem;
  background: #0D1B2A;
  box-shadow:
    0 1rem 1.8rem rgba(59, 130, 246, 0.22),
    0 0 1.1rem rgba(59, 130, 246, 0.16),
    inset 0 0 0 0.08rem rgba(92, 155, 255, 0.22);
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease,
              width 360ms cubic-bezier(0.22, 1, 0.36, 1), height 360ms cubic-bezier(0.22, 1, 0.36, 1);
  animation: logo-breathe 3.6s ease-in-out infinite;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: -24%;
  z-index: 0;
  background: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.55), rgba(37, 99, 235, 0.32) 55%, transparent 72%);
  opacity: 0.5;
  filter: blur(0.5rem);
  animation: logo-breathe-halo 3.6s ease-in-out infinite;
}

/* Faint light sweep that passes over the icon */
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 38%, rgba(180, 210, 255, 0.35) 50%, transparent 62%);
  transform: translateX(-130%);
  animation: logo-shimmer 6s ease-in-out infinite;
  pointer-events: none;
}

.brand-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  filter: drop-shadow(0 0 0.7rem rgba(59, 130, 246, 0.3));
}

@keyframes logo-breathe {
  0%, 100% {
    box-shadow:
      0 1rem 1.8rem rgba(59, 130, 246, 0.20),
      0 0 1rem rgba(59, 130, 246, 0.14),
      inset 0 0 0 0.08rem rgba(92, 155, 255, 0.22);
  }
  50% {
    box-shadow:
      0 1.1rem 2.1rem rgba(59, 130, 246, 0.34),
      0 0 1.7rem rgba(59, 130, 246, 0.30),
      inset 0 0 0 0.08rem rgba(92, 155, 255, 0.34);
  }
}

@keyframes logo-breathe-halo {
  0%, 100% { opacity: 0.4; transform: scale(0.97); }
  50%      { opacity: 0.7; transform: scale(1.04); }
}

@keyframes logo-shimmer {
  0%, 72%, 100% { transform: translateX(-130%); }
  84%           { transform: translateX(130%); }
}

/* ── Logo reaction synced with the sidebar collapse/expand ─────────────────── */
/* When collapsing, the mark dips left then springs back (follows the slide-in). */
@keyframes logo-react-collapse {
  0%   { transform: translateX(0) scale(1) rotate(0deg); }
  38%  { transform: translateX(-0.18rem) scale(0.8) rotate(-12deg); }
  72%  { transform: translateX(0) scale(1.08) rotate(5deg); }
  100% { transform: translateX(0) scale(1) rotate(0deg); }
}
/* When expanding, it leans out then settles (follows the slide-out). */
@keyframes logo-react-expand {
  0%   { transform: scale(0.9) rotate(0deg); }
  40%  { transform: scale(1.12) rotate(10deg); }
  72%  { transform: scale(0.97) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}
body.is-collapsing .brand-logo {
  animation: logo-react-collapse 600ms cubic-bezier(0.34, 1.4, 0.5, 1);
}
body.is-expanding .brand-logo {
  animation: logo-react-expand 600ms cubic-bezier(0.34, 1.4, 0.5, 1);
}
/* Flare the surrounding glow during the toggle so the motion feels integrated. */
body.is-toggling .brand-mark::before {
  animation: logo-toggle-flare 600ms ease-out;
}
@keyframes logo-toggle-flare {
  0%   { opacity: 0.45; transform: scale(1); }
  40%  { opacity: 0.95; transform: scale(1.18); }
  100% { opacity: 0.45; transform: scale(1); }
}

/* ── Coordinated sidebar open/close: nav items ripple + icons pulse ────────── */
@keyframes nav-item-collapse {
  0%   { opacity: 1; transform: translateX(0); }
  45%  { opacity: 0.55; transform: translateX(-0.32rem) scale(0.95); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes nav-item-expand {
  0%   { opacity: 0.35; transform: translateX(-0.55rem); }
  60%  { opacity: 1; transform: translateX(0.12rem); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes nav-icon-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.2); }
}
body.is-collapsing .main-nav .nav-link { animation: nav-item-collapse 440ms cubic-bezier(0.34, 1.2, 0.5, 1) both; }
body.is-expanding  .main-nav .nav-link { animation: nav-item-expand 480ms cubic-bezier(0.34, 1.3, 0.5, 1) both; }
/* Stagger so the items ripple in sequence (top → bottom) */
body.is-toggling .main-nav .nav-link:nth-child(1) { animation-delay: 0ms; }
body.is-toggling .main-nav .nav-link:nth-child(2) { animation-delay: 35ms; }
body.is-toggling .main-nav .nav-link:nth-child(3) { animation-delay: 70ms; }
body.is-toggling .main-nav .nav-link:nth-child(4) { animation-delay: 105ms; }
body.is-toggling .main-nav .nav-link:nth-child(5) { animation-delay: 140ms; }
body.is-toggling .main-nav .nav-link:nth-child(6) { animation-delay: 175ms; }
body.is-toggling .main-nav .nav-link span { animation: nav-icon-pulse 440ms cubic-bezier(0.34, 1.3, 0.5, 1); }

.brand-screen::before {
  content: "";
  position: absolute;
  display: none;
}

.brand-screen::after {
  content: "";
  position: absolute;
  display: none;
}

.brand-spark {
  position: absolute;
  z-index: 2;
  top: 1.48rem;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #83ffdf;
  box-shadow: 0 0 0.65rem rgba(131, 255, 223, 0.72);
}

.brand-spark-one {
  right: 1.23rem;
}

.brand-spark-two {
  left: 1.23rem;
  background: #ff7adf;
  box-shadow: 0 0 0.65rem rgba(255, 122, 223, 0.72);
}

.brand:is(:hover, :focus-visible, .is-tv-focused) .brand-mark {
  transform: translateY(-0.06rem) scale(1.03);
  box-shadow:
    0 1.15rem 2rem rgba(0, 210, 255, 0.23),
    0 0 1.35rem rgba(255, 79, 216, 0.22),
    inset 0 0 0 0.08rem rgba(255, 255, 255, 0.25);
}

.brand-copy {
  display: none;
  line-height: 1;
}

.brand-copy strong {
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
  letter-spacing: 0;
}

.brand-copy small {
  margin-top: 0.5rem;
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.42rem;
}

.main-nav {
  display: grid;
  align-items: center;
  gap: 0.58rem;
  width: 100%;
  margin-top: 2.2rem;
  min-width: 0;
}

.nav-link,
.chip {
  --nav-accent: var(--cyan);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  width: 100%;
  min-height: 3.35rem;
  padding: 0;
  border-radius: var(--radius-lg);
  color: #aeb6cc;
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.nav-link.is-active {
  color: #ffffff;
  background: color-mix(in srgb, var(--nav-accent) 20%, transparent);
  box-shadow:
    inset 0 0 0 0.08rem color-mix(in srgb, var(--nav-accent) 36%, rgba(255, 255, 255, 0.08)),
    0 0 1.4rem color-mix(in srgb, var(--nav-accent) 16%, transparent);
}

.nav-link:is(:hover, :focus-visible, .is-tv-focused) {
  color: #ffffff;
  background: color-mix(in srgb, var(--nav-accent) 14%, rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 0.08rem color-mix(in srgb, var(--nav-accent) 28%, rgba(255, 255, 255, 0.08));
}

.nav-link {
  flex-direction: column;
  font-size: 0.64rem;
  line-height: 1;
  transition:
    min-height 360ms cubic-bezier(0.22, 1, 0.36, 1),
    font-size 320ms cubic-bezier(0.22, 1, 0.36, 1),
    letter-spacing 320ms cubic-bezier(0.22, 1, 0.36, 1),
    background 180ms ease, color 220ms ease, box-shadow 180ms ease;
}

/* Staggered wave: labels collapse/expand in sequence for a fluid feel */
.main-nav .nav-link:nth-child(1) { transition-delay: 0ms; }
.main-nav .nav-link:nth-child(2) { transition-delay: 24ms; }
.main-nav .nav-link:nth-child(3) { transition-delay: 48ms; }
.main-nav .nav-link:nth-child(4) { transition-delay: 72ms; }
.main-nav .nav-link:nth-child(5) { transition-delay: 96ms; }
.main-nav .nav-link:nth-child(6) { transition-delay: 120ms; }

.nav-link span {
  font-size: 1.42rem;
  transition: font-size 360ms cubic-bezier(0.22, 1, 0.36, 1), transform 360ms cubic-bezier(0.34, 1.3, 0.5, 1), color 180ms ease, filter 180ms ease;
}

.nav-link[data-route="home"] {
  --nav-accent: var(--route-home);
}

.nav-link[data-route="library"] {
  --nav-accent: var(--route-library);
}

.nav-link[data-route="schedule"] {
  --nav-accent: var(--route-schedule);
}

.nav-link[data-route="anipub"] {
  --nav-accent: var(--route-anipub);
}

.nav-link[data-route="favorites"] {
  --nav-accent: var(--route-favorites);
}

.nav-link[data-route="sources"] {
  --nav-accent: var(--route-sources);
}

.nav-link[data-route="settings"] {
  --nav-accent: var(--route-settings);
}

.nav-link:is(.is-active, :hover, :focus-visible, .is-tv-focused) span {
  color: var(--nav-accent);
  filter: drop-shadow(0 0 0.65rem color-mix(in srgb, var(--nav-accent) 44%, transparent));
}

.search-box {
  position: relative;
  display: block;
  grid-row: 3;
  width: 100%;
}

.topbar .search-box {
  display: none;
}

.sidebar-toggle {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 2.55rem;
  margin: 0.55rem 0 0;
  border: 0.08rem solid rgba(178, 186, 255, 0.1);
  border-radius: var(--radius-lg);
  color: rgba(246, 243, 255, 0.82);
  background: rgba(12, 15, 29, 0.72);
  cursor: pointer;
  backdrop-filter: none;
  box-shadow: none;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.sidebar-toggle span {
  font-size: 1.75rem;
  line-height: 1;
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sidebar-toggle:is(:hover, :focus-visible, .is-tv-focused) {
  border-color: rgba(0, 210, 255, 0.24);
  color: #ffffff;
  background: rgba(0, 210, 255, 0.095);
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.035);
}

/* Compact (collapsed) = narrow icon rail. The content + footer slide WITH the
   rail (push-drawer) on a unified easing, so opening/closing feels integrated.
   Default state is compact; expanding widens the rail and pushes content right. */
body.sidebar-collapsed .app-shell {
  padding-left: 4.2rem;
}

body.sidebar-collapsed .topbar {
  width: 4.2rem;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
  background:
    linear-gradient(90deg, rgba(8, 10, 19, 0.42), rgba(8, 10, 19, 0.12) 76%, transparent);
}

body.sidebar-collapsed .bottom-bar {
  margin-left: -4.2rem;
  padding-left: calc(4.2rem + clamp(1.4rem, 3.2vw, 3.4rem));
}

body.sidebar-collapsed .bottom-bar::before {
  left: 4.2rem;
}

body.sidebar-collapsed .brand-mark {
  width: 3.1rem;
  height: 3.1rem;
}

/* The mark itself resizes (width/height), so the logo just fills it — no static
   scale here, which keeps the toggle reaction animation settling cleanly. */
body.sidebar-collapsed .brand-logo {
  transform: scale(1);
}

body.sidebar-collapsed .main-nav {
  gap: 0.5rem;
}

body.sidebar-collapsed .nav-link {
  min-height: 3.35rem;
  font-size: 0;
  gap: 0;
}

body.sidebar-collapsed .nav-link span {
  font-size: 1.62rem;
  transform: translateY(0);
}

/* Chevron rotates 180° when collapsed — smooth via the span's transform transition */
body.sidebar-collapsed .sidebar-toggle span {
  transform: rotate(180deg);
}

.search-box input {
  width: 100%;
  min-height: var(--control-h-lg);
  padding: 0 3.5rem 0 1.25rem;
  border: 0.12rem solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  color: var(--text);
  background: #111026;
  outline: 0;
}

.search-box span:last-child {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: #827b9c;
  font-size: 1.9rem;
}

main {
  flex: 1 0 auto;
  padding: 1.2rem clamp(1.4rem, 3.2vw, 3.4rem) 1.2rem;
  position: relative;
  z-index: 1;
}

.bottom-bar {
  --footer-bleed: 1.55rem;
  --footer-pad-y: clamp(1.45rem, 1.85vw, 1.8rem);
  position: relative;
  isolation: isolate;
  z-index: 1;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-items: center;
  gap: 0.9rem;
  min-height: clamp(7.3rem, 8.8vh, 8.6rem);
  margin: 0 0 calc(-1 * var(--footer-bleed)) -5.9rem;
  padding: var(--footer-pad-y) clamp(1.4rem, 3.2vw, 3.4rem) calc(var(--footer-pad-y) + env(safe-area-inset-bottom)) calc(5.9rem + clamp(1.4rem, 3.2vw, 3.4rem));
  border-top: 0.08rem solid rgba(92, 155, 255, 0.14);
  color: rgba(228, 238, 255, 0.84);
  background:
    radial-gradient(circle at 42% 0%, rgba(59, 130, 246, 0.18), transparent 24rem),
    radial-gradient(circle at 62% 110%, rgba(37, 99, 235, 0.14), transparent 23rem),
    linear-gradient(90deg, rgba(9, 16, 28, 0.96) 0 5.9rem, rgba(9, 16, 28, 0.9) 5.9rem, rgba(9, 16, 28, 0.82) 100%),
    linear-gradient(180deg, rgba(13, 22, 38, 0.94), #070E18 92%, #070E18);
  box-shadow:
    inset 0 0.08rem 0 rgba(255, 255, 255, 0.055),
    inset 0 1rem 2.5rem rgba(0, 210, 255, 0.025),
    0 -1.2rem 3rem rgba(0, 0, 0, 0.14);
  overflow: hidden;
  transition: margin 360ms cubic-bezier(0.22, 1, 0.36, 1), padding 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bottom-bar::before {
  content: "";
  position: absolute;
  left: 5.9rem;
  right: 0;
  top: 0;
  height: 0.12rem;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.45), rgba(92, 155, 255, 0.3), transparent);
  background-size: 180% 100%;
  animation: footer-line-flow 7s ease-in-out infinite;
  pointer-events: none;
}

.bottom-bar::after {
  content: "";
  position: absolute;
  inset: 0 0 calc(-1 * var(--footer-bleed)) 0;
  z-index: 0;
  background:
    linear-gradient(105deg, transparent 0%, transparent 34%, rgba(255, 255, 255, 0.055) 48%, transparent 62%, transparent 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.026), transparent 46%),
    linear-gradient(90deg, rgba(0, 210, 255, 0.055), transparent 34%, transparent 66%, rgba(181, 122, 255, 0.045));
  background-size: 230% 100%, 100% 100%, 100% 100%;
  animation: footer-aurora 11s ease-in-out infinite;
  pointer-events: none;
}

.footer-brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.62rem;
  width: 100%;
  text-align: center;
}

.footer-wordmark {
  display: block;
  width: min(22rem, 56vw);
  max-height: clamp(2.6rem, 4.4vw, 3.6rem);
  object-fit: contain;
  filter:
    drop-shadow(0 0.6rem 1.4rem rgba(0, 0, 0, 0.3))
    drop-shadow(0 0 1.1rem rgba(59, 130, 246, 0.22));
  transition: transform 220ms ease, filter 220ms ease;
}

.footer-wordmark:hover {
  transform: translateY(-0.1rem);
  filter:
    drop-shadow(0 0.8rem 1.7rem rgba(0, 0, 0, 0.34))
    drop-shadow(0 0 1.5rem rgba(59, 130, 246, 0.4));
}

.footer-tagline {
  margin: 0;
  color: rgba(196, 214, 245, 0.66);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.footer-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-dot {
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 999rem;
  background: rgba(92, 155, 255, 0.55);
}

.footer-credit {
  color: rgba(176, 196, 230, 0.56);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.footer-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.95rem;
  padding: 0 0.95rem;
  border: 0.08rem solid rgba(59, 130, 246, 0.28);
  border-radius: 999rem;
  color: rgba(214, 228, 255, 0.82);
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05)),
    rgba(13, 22, 38, 0.42);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: clamp(1.4rem, 3vw, 3rem);
  min-height: clamp(28rem, 56vh, 39rem);
  margin: -1.2rem calc(clamp(1.4rem, 3.2vw, 3.4rem) * -1) -1.5rem;
  padding: 1.2rem clamp(1.4rem, 3.2vw, 3.4rem) 3.2rem;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  height: 8rem;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(8, 10, 19, 0.74) 58%, var(--bg));
}

.hero:has(.carousel-stage.is-loading) {
  min-height: clamp(19rem, 35vh, 25rem);
  margin-bottom: -2.4rem;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--cyan);
  font-size: 0.98rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stremio-search {
  display: block;
  max-width: min(54rem, 100%);
  position: relative;
  z-index: 9;
  margin: 2.7rem 0 1.2rem;
}

.stremio-search input {
  min-height: var(--control-h-lg);
  border-radius: var(--radius-lg);
  background: rgba(7, 9, 19, 0.62);
  backdrop-filter: blur(18px);
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.07), 0 1rem 2.4rem rgba(0, 0, 0, 0.24);
}

body:not([data-route="home"]) .stremio-search {
  display: none;
}

.library-search {
  max-width: min(52rem, 100%);
  margin: 1rem 0;
}

.library-search input {
  min-height: 3.7rem;
  border-radius: var(--radius-lg);
  background: rgba(7, 9, 19, 0.56);
  backdrop-filter: blur(18px);
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.07), 0 0.8rem 1.8rem rgba(0, 0, 0, 0.16);
}

.source-status {
  position: absolute;
  top: 1.15rem;
  right: clamp(4.5rem, 7vw, 6.6rem);
  z-index: 6;
  display: inline-flex;
  width: auto;
  margin: 0;
  padding: 0.48rem 0.74rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.12);
  border-radius: 999rem;
  color: rgba(246, 243, 255, 0.82);
  background: rgba(17, 16, 38, 0.46);
  font-size: 0.78rem;
  font-weight: 850;
  backdrop-filter: blur(14px);
}

.primary-action,
.secondary-action,
.play-action {
  min-height: var(--control-h-md);
  padding: 0 1.35rem;
  border-radius: var(--radius-md);
  color: #131127;
  background: var(--cyan);
  font-weight: 900;
  cursor: pointer;
}

.secondary-action {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.play-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: fit-content;
  min-width: 9.2rem;
  min-height: 3.35rem;
  overflow: hidden;
  border: 0.08rem solid rgba(255, 255, 255, 0.22);
  border-radius: 999rem;
  color: #f6f3ff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(64, 223, 194, 0.11)),
    rgba(17, 16, 38, 0.38);
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.07), 0 1rem 2rem rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
}

.play-action::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(138, 92, 255, 0.34), rgba(0, 210, 255, 0.32)),
    radial-gradient(circle at 24% 50%, rgba(255, 255, 255, 0.16), transparent 42%);
  opacity: 0;
  transform: scaleX(0.18);
  transform-origin: left;
  transition: opacity 180ms ease, transform 220ms ease;
}

.play-action:is(:hover, :focus-visible, .is-tv-focused) {
  transform: translateY(-0.06rem);
  border-color: rgba(0, 210, 255, 0.42);
  background:
    linear-gradient(135deg, rgba(138, 92, 255, 0.18), rgba(0, 210, 255, 0.13)),
    rgba(17, 16, 38, 0.58);
  box-shadow:
    inset 0 0 0 0.08rem rgba(255, 255, 255, 0.1),
    0 1rem 2rem rgba(0, 0, 0, 0.3),
    0 0 0 0.32rem rgba(0, 210, 255, 0.08);
}

.play-action:is(:hover, :focus-visible, .is-tv-focused)::after {
  opacity: 1;
  transform: scaleX(1);
}

.play-action:is(:hover, :focus-visible, .is-tv-focused) .play-icon {
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 0 1.1rem rgba(0, 210, 255, 0.36), 0 0 0 0.25rem rgba(255, 255, 255, 0.06);
}

.play-icon {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 0 1rem rgba(64, 223, 194, 0.34);
}

.play-icon::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 0.16rem;
  border-top: 0.42rem solid transparent;
  border-bottom: 0.42rem solid transparent;
  border-left: 0.68rem solid #ffffff;
}

.play-action span:last-child {
  position: relative;
  z-index: 1;
}

.primary-action,
.secondary-action,
.play-action {
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-action:focus,
.secondary-action:focus,
.play-action:focus,
.episode-play-inline:focus {
  outline: 0;
}

.primary-action:is(:hover, :focus-visible, .is-tv-focused),
.secondary-action:is(:hover, :focus-visible, .is-tv-focused) {
  transform: translateY(-0.04rem);
  box-shadow: 0 0.5rem 1.1rem rgba(0, 0, 0, 0.22), inset 0 0 0 0.08rem rgba(255, 255, 255, 0.11);
}

.primary-action:is(:focus-visible, .is-tv-focused),
.secondary-action:is(:focus-visible, .is-tv-focused),
.episode-play-inline:is(:focus-visible, .is-tv-focused) {
  box-shadow:
    inset 0 0 0 0.08rem rgba(255, 255, 255, 0.14),
    0 0 0 0.28rem rgba(0, 210, 255, 0.09),
    0 0.5rem 1.1rem rgba(0, 0, 0, 0.22);
}

.thumb-art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 29% 31%, rgba(255, 255, 255, 0.82) 0 6%, transparent 6.4%),
    radial-gradient(circle at 37% 31%, rgba(255, 255, 255, 0.82) 0 6%, transparent 6.4%),
    radial-gradient(circle at 32% 45%, rgba(26, 23, 52, 0.9) 0 15%, transparent 15.4%),
    linear-gradient(135deg, var(--thumb-a), var(--thumb-b));
}

.thumb-art::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  height: 46%;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.52), transparent);
}

.content-band {
  min-height: 100vh;
  margin-top: 0;
  padding: clamp(1rem, 2vw, 1.75rem) 0 4rem;
  scroll-margin-top: 0;
  animation: rise-in 520ms ease both;
}

body[data-route="home"] #latest {
  min-height: auto;
  padding-top: 0;
  position: relative;
  z-index: 8;
}

body:not([data-route="home"]) .content-band {
  padding-top: 0;
}

.content-band:nth-of-type(2) {
  animation-delay: 90ms;
}

.content-band:nth-of-type(3) {
  animation-delay: 140ms;
}

.content-band.is-hidden,
[data-section].is-hidden {
  display: none;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 0.78rem;
  min-height: 3.25rem;
  margin-bottom: 1.05rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.55rem, 2vw, 2.2rem);
  letter-spacing: 0;
}

.hot-dot,
.library-dot,
.calendar-dot,
.favorite-dot,
.source-dot {
  --dot-color: var(--cyan);
  position: relative;
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--dot-color);
  box-shadow:
    0 0 0 0.42rem color-mix(in srgb, var(--dot-color) 16%, transparent),
    0 0 1.2rem color-mix(in srgb, var(--dot-color) 28%, transparent);
  animation: section-dot-glow 2.6s ease-in-out infinite;
}

.hot-dot::before,
.library-dot::before,
.calendar-dot::before,
.anipub-dot::before,
.favorite-dot::before,
.source-dot::before,
.settings-dot::before {
  content: "";
  position: absolute;
  inset: -0.28rem;
  border-radius: 50%;
  border: 0.08rem solid color-mix(in srgb, var(--dot-color) 36%, transparent);
  opacity: 0.72;
}

body:not([data-route="home"]) .section-heading h2 {
  font-size: clamp(1.48rem, 1.9vw, 2rem);
}

.library-dot {
  --dot-color: var(--route-library);
}

.hot-dot {
  --dot-color: var(--route-home);
}

.calendar-dot {
  --dot-color: var(--route-schedule);
}

.anipub-dot {
  --dot-color: var(--route-anipub);
}

.favorite-dot {
  --dot-color: var(--route-favorites);
}

.source-dot {
  --dot-color: var(--route-sources);
}

.settings-dot {
  --dot-color: var(--route-settings);
}

.addon-sections {
  display: grid;
  gap: clamp(1.6rem, 3vw, 2.8rem);
  margin-top: clamp(1rem, 2vw, 1.8rem);
}

.addon-sections[hidden] {
  display: none;
}

.addon-band {
  min-height: auto;
  padding: 0 0 clamp(1rem, 2vw, 1.8rem);
}

.addon-more {
  min-height: var(--control-h-sm);
  margin-top: 0.9rem;
  padding: 0 1rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.12);
  border-radius: 999rem;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 950;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.addon-more:is(:hover, :focus-visible, .is-tv-focused) {
  transform: translateY(-0.04rem);
  border-color: rgba(0, 210, 255, 0.36);
  background: rgba(0, 210, 255, 0.12);
  outline: 0;
  box-shadow: 0 0 0 0.16rem rgba(0, 210, 255, 0.08), 0 0.7rem 1.4rem rgba(0, 0, 0, 0.2);
}

.addon-dot {
  --dot-color: var(--blue);
  position: relative;
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--dot-color);
  box-shadow:
    0 0 0 0.42rem color-mix(in srgb, var(--dot-color) 16%, transparent),
    0 0 1.2rem color-mix(in srgb, var(--dot-color) 28%, transparent);
  animation: section-dot-glow 2.6s ease-in-out infinite;
}

.addon-dot::before {
  content: "";
  position: absolute;
  inset: -0.28rem;
  border: 0.08rem solid color-mix(in srgb, var(--dot-color) 36%, transparent);
  border-radius: 50%;
  opacity: 0.72;
}

.section-heading small {
  align-self: center;
  padding: 0.35rem 0.58rem;
  border-radius: 999rem;
  color: rgba(246, 243, 255, 0.68);
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.72rem;
  font-weight: 900;
}

.rail-shell {
  position: relative;
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) 3rem;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  padding: 0;
}

.poster-grid {
  --rail-gap: clamp(0.65rem, 1vw, 0.95rem);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (6 * var(--rail-gap))) / 7);
  grid-template-rows: repeat(2, auto);
  grid-template-columns: none;
  gap: var(--rail-gap);
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.25rem 0.35rem 1rem;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 0;
  scrollbar-width: none;
}

.poster-grid.is-skeleton-loading {
  grid-auto-flow: column;
  grid-template-rows: repeat(2, auto);
  grid-auto-columns: calc((100% - (6 * var(--rail-gap))) / 7);
  overflow: hidden;
  padding-bottom: 0.4rem;
}

.poster-grid.is-skeleton-loading .show-card > span:not(.thumb-art) {
  min-height: 2.2rem;
}

.rail-arrow {
  position: relative;
  align-self: center;
  justify-self: center;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 2.45rem;
  height: 5.2rem;
  margin-top: 0;
  border: 0.08rem solid rgba(255, 255, 255, 0.12);
  border-radius: 999rem;
  color: #ffffff;
  background: rgba(8, 10, 19, 0.46);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(14px);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.rail-arrow-left {
  grid-column: 1;
}

.rail-arrow-right {
  grid-column: 3;
}

.rail-arrow:is(:hover, :focus-visible, .is-tv-focused) {
  transform: scale(1.04);
  border-color: rgba(0, 210, 255, 0.42);
  background: rgba(0, 210, 255, 0.18);
}

.rail-shell:has(.poster-grid:empty) .rail-arrow {
  display: none;
}

.poster-grid::-webkit-scrollbar {
  display: none;
}

.content-band {
  position: relative;
}

.show-card {
  position: relative;
  display: grid;
  gap: 0.7rem;
  align-content: start;
  min-width: 0;
  max-width: 100%;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-md);
  outline: 0;
  animation: card-rise 480ms ease both;
  animation-delay: calc((var(--card-index, 0) % 12) * 35ms);
  scroll-snap-align: start;
  transition: transform 180ms ease;
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-card .thumb-art,
.carousel-poster-skeleton,
.skeleton-card .show-title,
.skeleton-card .show-meta {
  position: relative;
  overflow: hidden;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
  background-size: 220% 100%;
  animation: skeleton-sheen 1150ms ease-in-out infinite;
}

.skeleton-card .show-title,
.skeleton-card .show-meta {
  display: block;
  border-radius: 999rem;
}

.skeleton-card .show-title {
  width: 82%;
  height: 1.05rem;
}

.skeleton-card .show-meta {
  width: 58%;
  height: 0.78rem;
  margin-top: 0.5rem;
}

.show-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.18rem;
  height: 0.12rem;
  border-radius: 999rem;
  background: linear-gradient(90deg, var(--cyan), var(--rose));
  opacity: 0;
  transform: scaleX(0.25);
  transform-origin: left;
  transition: opacity 180ms ease, transform 220ms ease;
}

.show-card > span:not(.thumb-art) {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

.thumb-art {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 0.08rem solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--thumb-a), var(--thumb-b));
  box-shadow: 0 0.75rem 1.35rem rgba(0, 0, 0, 0.22);
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease, filter 220ms ease;
}

.thumb-art::before {
  transition: opacity 220ms ease, transform 320ms ease;
}

.thumb-art::after {
  transition: opacity 220ms ease;
}

.thumb-backdrop {
  position: absolute;
  inset: -1.2rem;
  z-index: 1;
  width: calc(100% + 2.4rem);
  height: calc(100% + 2.4rem);
  object-fit: cover;
  filter: blur(16px) saturate(1.15);
  opacity: 0.48;
  transform: scale(1.04);
}

.thumb-poster {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  box-shadow: inset 0 -4rem 4rem rgba(0, 0, 0, 0.18);
  transition: transform 320ms ease, filter 320ms ease;
}

.thumb-backdrop + .thumb-poster + .episode-pill {
  z-index: 3;
}

.thumb-art .episode-pill {
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  z-index: 2;
  min-width: 3.1rem;
  padding: 0.26rem 0.52rem;
  border-radius: 0.35rem;
  background: rgba(17, 16, 38, 0.78);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 900;
  text-align: center;
}

.show-title {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  color: #f9f7ff;
  font-size: clamp(0.95rem, 0.9vw, 1.08rem);
  font-weight: 900;
  line-height: 1.12;
  text-shadow: none;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
  transition: color 180ms ease, transform 180ms ease, text-shadow 180ms ease;
}

.show-meta {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: -0.15rem 0 1.2rem;
}

.library-search,
.anipub-search {
  margin-bottom: clamp(1.05rem, 1.6vw, 1.55rem);
}

#anipub .filters,
#library .filters {
  margin-top: 0;
  margin-bottom: clamp(1.65rem, 2.1vw, 2.25rem);
}

#anipub .rail-shell,
#library .rail-shell {
  margin-top: 0.25rem;
}

.chip {
  width: auto;
  min-width: 5.6rem;
  min-height: 2.35rem;
  padding: 0 0.9rem;
  border-radius: 999rem;
  background: rgba(255, 255, 255, 0.075);
  font-size: 0.86rem;
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.06);
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.chip.is-selected {
  color: #131127;
  background: var(--gold);
}

.chip:is(:hover, :focus-visible, .is-tv-focused) {
  transform: translateY(-0.04rem);
  color: #ffffff;
  background: rgba(0, 210, 255, 0.18);
  box-shadow: inset 0 0 0 0.08rem rgba(0, 210, 255, 0.42), 0 0.45rem 1rem rgba(0, 0, 0, 0.18);
}

.schedule-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(12.5rem, 1fr));
  gap: 0.85rem;
  align-items: start;
  overflow: visible;
}

.schedule-day-column {
  min-width: 0;
  border-top: 0.18rem solid rgba(138, 92, 255, 0.52);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 16rem);
}

.schedule-day-column h3 {
  margin: 0;
  padding: 0.82rem 0.2rem 0.7rem;
  color: #dcd6ef;
  font-size: 0.96rem;
  font-weight: 900;
  text-align: center;
}

/* ── Today highlight ─────────────────────────────────────────────────────── */
.schedule-day-column.is-today {
  border-top-color: #5C9BFF;
  background: linear-gradient(180deg, rgba(92, 155, 255, 0.22), transparent 18rem);
  box-shadow: inset 0 0.18rem 0 0 #5C9BFF;
  animation: scheduleTodayPulse 2.4s ease-in-out infinite;
}

.schedule-day-column.is-today h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: #ffffff;
}

.schedule-today-badge {
  padding: 0.1rem 0.5rem;
  border-radius: 999rem;
  background: linear-gradient(135deg, #5C9BFF, #2563EB);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 0 0 rgba(92, 155, 255, 0.55);
  animation: scheduleTodayBadge 2.4s ease-in-out infinite;
}

@keyframes scheduleTodayPulse {
  0%, 100% { box-shadow: inset 0 0.18rem 0 0 #5C9BFF, 0 0 0.6rem rgba(92, 155, 255, 0.12); }
  50%      { box-shadow: inset 0 0.18rem 0 0 #7DB0FF, 0 0 1.4rem rgba(92, 155, 255, 0.42); }
}

@keyframes scheduleTodayBadge {
  0%, 100% { box-shadow: 0 0 0 rgba(92, 155, 255, 0.0); transform: scale(1); }
  50%      { box-shadow: 0 0 0.7rem rgba(92, 155, 255, 0.6); transform: scale(1.06); }
}

.schedule-day-rail {
  display: grid;
  gap: 0.8rem;
}

.schedule-empty {
  font-size: 0.78rem;
  color: rgba(246, 243, 255, 0.3);
  padding: 0.4rem 0;
  margin: 0;
}

.schedule-item {
  display: grid;
  gap: 0.52rem;
  min-width: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease;
}

.schedule-item:is(:hover, :focus-visible, .is-tv-focused) {
  transform: translateY(-0.08rem);
}

.schedule-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 7.5;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0.85rem 1.4rem rgba(0, 0, 0, 0.22);
}

.schedule-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease, filter 220ms ease;
}

.schedule-thumb::after {
  content: "";
  position: absolute;
  inset: 42% 0 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.62), transparent);
}

.schedule-thumb span {
  position: absolute;
  right: 0.45rem;
  bottom: 0.38rem;
  z-index: 1;
  padding: 0.18rem 0.42rem;
  border-radius: 999rem;
  background: rgba(0, 0, 0, 0.52);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 900;
}

.schedule-copy {
  display: grid;
  gap: 0.2rem;
}

.schedule-item:is(:hover, :focus-visible, .is-tv-focused) .schedule-thumb img {
  transform: scale(1.045);
  filter: saturate(1.08) brightness(1.05);
}

.schedule-title {
  display: -webkit-box;
  min-height: 2.4em;
  overflow: hidden;
  color: #f9f7ff;
  font-weight: 900;
  line-height: 1.2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color 180ms ease, text-shadow 180ms ease;
}

.schedule-item:is(:hover, :focus-visible, .is-tv-focused) .schedule-title {
  color: #ffffff;
  text-shadow: 0 0 1rem rgba(0, 210, 255, 0.28);
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(18rem, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.source-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 0.08rem solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035));
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
}

.source-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(138, 92, 255, 0.18), transparent 42%, rgba(0, 210, 255, 0.12));
  opacity: 0;
  transition: opacity 200ms ease;
}

.source-card:is(:hover, :focus-within, .is-enabled) {
  transform: translateY(-0.06rem);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.22);
}

.source-card:is(:hover, :focus-within, .is-enabled)::before {
  opacity: 1;
}

.source-card:active,
.season-card:active,
.episode-button:active,
.schedule-item:active,
.rail-arrow:active,
.primary-action:active,
.secondary-action:active,
.play-action:active {
  transform: scale(0.985);
}

.source-card-feature {
  min-height: 10.4rem;
  border-color: rgba(64, 223, 194, 0.26);
  background:
    radial-gradient(circle at 12% 0%, rgba(138, 92, 255, 0.22), transparent 12rem),
    linear-gradient(135deg, rgba(64, 223, 194, 0.12), rgba(255, 255, 255, 0.045));
}

.source-card > * {
  position: relative;
  z-index: 1;
}

.source-card > div:first-child {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.source-card strong,
.source-card span,
.source-card code {
  display: block;
}

.source-card strong {
  font-size: 1.1rem;
}

.source-card div:first-child span {
  flex: 0 0 auto;
  max-width: 52%;
  padding: 0.35rem 0.55rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.12);
  border-radius: 999rem;
  background: rgba(0, 0, 0, 0.22);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: right;
}

.source-card span,
.source-card p,
.source-card code {
  color: var(--muted);
}

.source-card p {
  margin: 0;
  min-height: 3.7rem;
  line-height: 1.35;
}

.source-card code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.65rem 0.72rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.78rem;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.source-key-field {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.source-key-field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.source-key-field input {
  min-height: 2.65rem;
  padding: 0 0.95rem;
  border: 0.08rem solid rgba(0, 210, 255, 0.16);
  border-radius: 0.85rem;
  color: var(--text);
  background: rgba(8, 10, 19, 0.62);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
}

.source-key-field input:is(:hover, :focus-visible, .is-tv-focused) {
  outline: 0;
  border-color: rgba(0, 210, 255, 0.34);
  background: rgba(0, 210, 255, 0.08);
  box-shadow: 0 0 0 0.14rem rgba(0, 210, 255, 0.08);
}

.source-actions .secondary-action {
  min-height: var(--control-h-sm);
  padding: 0 0.9rem;
}

.source-actions .source-remove-action {
  color: #ffd7ee;
  background: rgba(185, 118, 255, 0.12);
}

.source-actions .source-remove-action:is(:hover, :focus-visible, .is-tv-focused) {
  color: #ffffff;
  background: rgba(185, 118, 255, 0.2);
  box-shadow: inset 0 0 0 0.08rem rgba(185, 118, 255, 0.24), 0 0.55rem 1.1rem rgba(0, 0, 0, 0.22);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(18rem, 0.92fr) minmax(24rem, 1.4fr);
  gap: 0.9rem;
  max-width: 76rem;
  margin-top: 1.2rem;
  padding: 0.8rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  border-radius: 1.35rem;
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 210, 255, 0.09), transparent 18rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.035), var(--shadow);
}

.settings-card {
  display: grid;
  align-content: start;
  gap: 0.85rem;
  min-height: auto;
  padding: 1.05rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.09);
  border-radius: 1rem;
  background:
    linear-gradient(135deg, rgba(17, 20, 34, 0.86), rgba(18, 19, 34, 0.58)),
    rgba(8, 10, 19, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.settings-card-wide {
  grid-column: 1 / -1;
}

.settings-card-legal {
  background:
    radial-gradient(circle at 90% 0%, rgba(242, 187, 70, 0.12), transparent 12rem),
    linear-gradient(135deg, rgba(17, 20, 34, 0.86), rgba(18, 19, 34, 0.58)),
    rgba(8, 10, 19, 0.38);
}

.settings-link {
  min-height: 2.75rem;
  text-decoration: none;
}

.settings-card-head {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 0.2rem;
}

.settings-card strong {
  color: #ffffff;
  font-size: 1.04rem;
}

.settings-card span {
  color: var(--muted);
  font-weight: 800;
}

.settings-icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 0.08rem solid rgba(0, 210, 255, 0.18);
  border-radius: 0.8rem;
  color: #06121d;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 0.8rem 1.4rem rgba(0, 210, 255, 0.12);
  font-size: 1.05rem;
  font-weight: 950;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.settings-segment {
  display: flex;
  flex-wrap: nowrap;            /* keep options on ONE row — never stack/overlap */
  gap: 0.25rem;
  width: 100%;
  justify-self: end;
  padding: 0.3rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  border-radius: 999rem;
  background: rgba(2, 4, 12, 0.38);
}

.settings-choice {
  flex: 1 1 0;                  /* equal widths, allow shrink so they fit inline */
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 0.85rem;
  border: 0.08rem solid transparent;
  border-radius: 999rem;
  color: rgba(246, 243, 255, 0.76);
  background: transparent;
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1;
  white-space: nowrap;
  text-transform: capitalize;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.settings-choice.is-selected,
.settings-choice:is(:hover, :focus-visible, .is-tv-focused) {
  outline: 0;
  color: #ffffff;
  background: linear-gradient(135deg, #5C9BFF, #2563EB);
  box-shadow: 0 0.3rem 0.8rem rgba(37, 99, 235, 0.28);  /* flat within the track */
}

.settings-field {
  display: grid;
  gap: 0.5rem;
}

.settings-field .language-select {
  width: min(100%, 24rem);
  max-width: none;
  min-height: 3.05rem;
  padding: 0 2.4rem 0 1rem;
  border: 0.08rem solid rgba(59, 130, 246, 0.28);
  border-radius: 0.95rem;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.06)),
    rgba(9, 16, 28, 0.7);
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.04);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.settings-field .language-select:focus {
  outline: 0;
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 0.16rem rgba(59, 130, 246, 0.16);
}

.language-select option {
  color: #f6f3ff;
  background: #111426;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  min-height: 3.2rem;
  padding: 0 0.42rem 0 1rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.1);
  border-radius: 0.95rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.settings-toggle b {
  display: inline-grid;
  min-width: 4.4rem;
  min-height: 2.25rem;
  place-items: center;
  padding: 0 0.75rem;
  border-radius: 999rem;
  color: rgba(246, 243, 255, 0.72);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
}

.settings-toggle.is-on b,
.settings-toggle:is(:hover, :focus-visible, .is-tv-focused) b {
  color: #06121d;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
}

.settings-toggle:is(:hover, :focus-visible, .is-tv-focused) {
  outline: 0;
  border-color: rgba(0, 210, 255, 0.24);
  background: rgba(0, 210, 255, 0.09);
  box-shadow: 0 0 0 0.15rem rgba(0, 210, 255, 0.08);
}

.settings-grid:has(.settings-rail) {
  grid-template-columns: minmax(10rem, 14rem) minmax(0, 54rem);
  align-items: start;
  max-width: 86rem;
  min-height: min(42rem, 74vh);
  padding: 0;
  overflow: hidden;
  border-color: rgba(92, 155, 255, 0.1);
  border-radius: 1.2rem;
  background:
    radial-gradient(circle at 88% 0%, rgba(59, 130, 246, 0.18), transparent 24rem),
    linear-gradient(135deg, rgba(11, 18, 30, 0.97), rgba(13, 22, 38, 0.92));
}

.settings-rail {
  position: sticky;
  top: 6rem;
  display: grid;
  align-content: start;
  gap: 0.45rem;
  min-height: min(42rem, 74vh);
  padding: 1rem 0.75rem;
  border-right: 0.08rem solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    rgba(5, 7, 16, 0.36);
}

.settings-rail-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3.3rem;
  padding: 0 1rem;
  border: 0.08rem solid transparent;
  border-radius: 999rem;
  color: rgba(246, 243, 255, 0.58);
  background: transparent;
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  transition: color 150ms, background 150ms, border-color 150ms, transform 200ms cubic-bezier(0.34, 1.3, 0.5, 1), box-shadow 150ms;
}

.settings-rail-item:is(:hover, :focus-visible, .is-tv-focused) {
  outline: 0;
  color: #ffffff;
  border-color: rgba(92, 155, 255, 0.28);
  background: rgba(59, 130, 246, 0.1);
  box-shadow: inset 0 0 0 0.04rem rgba(255, 255, 255, 0.04);
  transform: translateX(0.18rem);
}

.settings-rail-item.is-selected {
  color: #ffffff;
  border-color: rgba(59, 130, 246, 0.5);
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.26), rgba(37, 99, 235, 0.2)),
    rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 0.04rem rgba(92, 155, 255, 0.22), 0 0.5rem 1.2rem rgba(37, 99, 235, 0.16);
}

.settings-version {
  align-self: end;
  margin-top: auto;
  padding: 1rem;
  color: rgba(246, 243, 255, 0.42);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
}

.settings-console {
  display: grid;
  align-content: start;
  gap: 1rem;
  height: min(74vh, 48rem);
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 1.2rem clamp(1rem, 3vw, 2rem) 2rem;
  scrollbar-width: thin;
}

.settings-panel {
  display: grid;
  gap: 0.65rem;
  min-height: min(64vh, 40rem);
  align-content: start;
  padding: 0.95rem 0 1.35rem;
  scroll-margin-top: 1rem;
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel.is-active {
  animation: settingsPanelIn 180ms ease both;
}

.settings-panel-head {
  display: grid;
  grid-template-columns: 2.3rem minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 0.08rem solid rgba(255, 255, 255, 0.07);
}

.settings-panel-head h3 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  line-height: 1.1;
}

.settings-panel-head p {
  margin: 0.18rem 0 0;
  color: rgba(246, 243, 255, 0.52);
  font-size: 0.84rem;
  font-weight: 750;
}

@keyframes settingsPanelIn {
  from {
    opacity: 0;
    transform: translateY(0.35rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-line {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(10rem, auto);
  align-items: center;
  gap: 0.9rem;
  min-height: 3.4rem;
  padding: 0 0.85rem;
  margin: 0 -0.85rem;
  border-radius: 0.85rem;
  color: rgba(246, 243, 255, 0.86);
  font-weight: 850;
  transition: background 180ms ease;
}

.settings-line:hover {
  background: rgba(92, 155, 255, 0.06);
}

.settings-line > span {
  min-width: 0;
  color: rgba(246, 243, 255, 0.78);
}

.settings-select {
  width: min(15rem, 100%);
  max-width: none;
  justify-self: end;
  min-height: 2.55rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
}

.settings-switch {
  justify-self: end;
  position: relative;
  width: 3.25rem;
  height: 1.72rem;
  border: 0;
  border-radius: 999rem;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 0.06rem rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 240ms ease, box-shadow 240ms ease;
}

.settings-switch:is(:hover, :focus-visible, .is-tv-focused) {
  outline: 0;
  box-shadow: inset 0 0 0 0.06rem rgba(92, 155, 255, 0.3);
}

.settings-switch b {
  position: absolute;
  top: 0.24rem;
  left: 0.25rem;
  width: 1.22rem;
  height: 1.22rem;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.35);
  transition: transform 260ms cubic-bezier(0.34, 1.4, 0.5, 1);
}

.settings-switch.is-on {
  background: linear-gradient(135deg, #5C9BFF, #2563EB);
  box-shadow: inset 0 0 0 0.06rem rgba(92, 155, 255, 0.4), 0 0 0.9rem rgba(59, 130, 246, 0.35);
}

.settings-switch.is-on b {
  transform: translateX(1.48rem);
}

.settings-status-pill {
  justify-self: end;
  padding: 0.55rem 0.82rem;
  border-radius: 999rem;
  color: rgba(246, 243, 255, 0.86);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
}

.settings-actions,
.settings-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-start;
  margin-top: 0.3rem;
}

.settings-shortcut-row {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) auto;
  align-items: center;
  min-height: 3rem;
  color: rgba(246, 243, 255, 0.78);
  font-weight: 850;
}

.settings-shortcut-row kbd {
  padding: 0.55rem 0.78rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  border-radius: 0.45rem;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 950;
}

/* ── Settings Rail Icon ──────────────────────────────────────────────── */
.rail-icon {
  display: inline-block;
  width: 1.4em;
  opacity: 0.7;
}

.settings-rail-item.is-selected .rail-icon {
  opacity: 1;
}

/* ── Settings Group Label & Divider ──────────────────────────────────── */
.settings-group-label {
  margin: 0.65rem 0 0.1rem;
  color: rgba(92, 155, 255, 0.85);
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.settings-divider {
  height: 0.08rem;
  margin: 0.5rem 0 0.2rem;
  border: none;
  background: rgba(255, 255, 255, 0.07);
}

.settings-line > span small {
  display: block;
  margin-top: 0.18rem;
  color: rgba(246, 243, 255, 0.42);
  font-size: 0.76rem;
  font-weight: 750;
}

/* ── Volume Slider ────────────────────────────────────────────────────── */
.settings-volume-line.settings-line {
  display: grid;
  gap: 0.55rem;
  min-height: unset;
  padding: 0.6rem 0;
  grid-template-columns: 1fr;
  align-items: start;
}

.settings-volume-label {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.settings-volume-label > span {
  color: rgba(246, 243, 255, 0.78);
  font-weight: 850;
}

.settings-volume-value {
  margin-left: auto;
  color: rgba(0, 210, 255, 0.9);
  font-size: 0.82rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  transition: color 120ms;
}

.settings-volume-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.settings-volume-icon {
  font-size: 1rem;
  opacity: 0.65;
  flex-shrink: 0;
}

.settings-volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 0.38rem;
  border-radius: 999rem;
  outline: none;
  cursor: pointer;
  background: linear-gradient(
    to right,
    var(--cyan) 0%,
    var(--cyan) var(--vol-pct, 10%),
    rgba(255, 255, 255, 0.12) var(--vol-pct, 10%),
    rgba(255, 255, 255, 0.12) 100%
  );
  transition: opacity 160ms;
}

.settings-volume-slider:focus-visible {
  box-shadow: 0 0 0 0.15rem rgba(0, 210, 255, 0.5);
}

.settings-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0.1rem 0.6rem rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 160ms, background 160ms;
}

.settings-volume-slider::-moz-range-thumb {
  width: 1.15rem;
  height: 1.15rem;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0.1rem 0.6rem rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.settings-volume-slider:hover::-webkit-slider-thumb,
.settings-volume-slider:focus::-webkit-slider-thumb {
  background: var(--cyan);
  transform: scale(1.2);
}

.settings-volume-slider:hover::-moz-range-thumb,
.settings-volume-slider:focus::-moz-range-thumb {
  background: var(--cyan);
  transform: scale(1.2);
}

/* ── Settings Sources Tab ─────────────────────────────────────────────── */
.settings-source-summary {
  margin: 0 0 0.4rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(246, 243, 255, 0.58);
  font-size: 0.82rem;
  font-weight: 800;
}

.settings-sources-grid {
  display: grid;
  gap: 0.7rem;
}

/* ── Legal Tab ────────────────────────────────────────────────────────── */
.settings-legal-tabs {
  display: flex;
  gap: 0.45rem;
  padding: 0.3rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  border-radius: 999rem;
  background: rgba(2, 4, 12, 0.38);
  width: fit-content;
  margin-bottom: 0.6rem;
}

.settings-legal-content {
  max-height: 28rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  padding-right: 0.5rem;
}

.settings-legal-section {
  display: grid;
  gap: 0.6rem;
}

.settings-legal-section h4 {
  margin: 0.6rem 0 0.1rem;
  color: rgba(0, 210, 255, 0.85);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-legal-section h4:first-child {
  margin-top: 0;
}

.settings-legal-section p {
  margin: 0;
  color: rgba(246, 243, 255, 0.64);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.65;
}

.settings-legal-section ul {
  margin: 0;
  padding-left: 1.2rem;
  color: rgba(246, 243, 255, 0.6);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.7;
}

.settings-legal-section a {
  color: rgba(0, 210, 255, 0.9);
  text-decoration: none;
}

.settings-legal-section a:hover {
  text-decoration: underline;
}

body[data-theme="light"] .settings-grid {
  border-color: rgba(16, 21, 36, 0.08);
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 210, 255, 0.12), transparent 18rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.46));
}

body[data-theme="light"] .settings-card {
  border-color: rgba(16, 21, 36, 0.1);
  background: rgba(255, 255, 255, 0.74);
}

body[data-theme="light"] .settings-card strong,
body[data-theme="light"] .settings-choice,
body[data-theme="light"] .settings-toggle {
  color: #101524;
}

body[data-theme="light"] .settings-segment,
body[data-theme="light"] .settings-field .language-select,
body[data-theme="light"] .settings-toggle {
  background: rgba(245, 248, 255, 0.78);
}

body[data-theme="light"] .language-select option {
  color: #101524;
  background: #f8fbff;
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 0.001ms !important;
}

body.soft-focus .focusable:focus,
body.soft-focus .is-tv-focused {
  box-shadow: none;
}

.focusable:focus,
.is-tv-focused {
  outline: 0.14rem solid rgba(255, 255, 255, 0.82);
  outline-offset: 0.18rem;
  box-shadow: 0 0 0 0.28rem rgba(0, 210, 255, 0.13);
}

.primary-action.focusable:focus,
.secondary-action.focusable:focus,
.play-action.focusable:focus,
.episode-play-inline.focusable:focus,
.episode-button.focusable:focus,
.detail-tab.focusable:focus,
.season-tab.focusable:focus,
.season-card.focusable:focus {
  outline: 0;
}

.primary-action.focusable:focus,
.secondary-action.focusable:focus,
.episode-play-inline.focusable:focus {
  box-shadow:
    inset 0 0 0 0.08rem rgba(255, 255, 255, 0.12),
    0 0 0 0.18rem rgba(0, 210, 255, 0.08),
    0 0.5rem 1.1rem rgba(0, 0, 0, 0.22);
}

.play-action.focusable:focus {
  box-shadow:
    inset 0 0 0 0.08rem rgba(255, 255, 255, 0.1),
    0 0 0 0.2rem rgba(0, 210, 255, 0.08),
    0 1rem 2rem rgba(0, 0, 0, 0.28);
}

.show-card:focus,
.show-card:focus-visible,
.show-card.is-tv-focused {
  outline: 0;
  box-shadow: none;
}

.show-card:is(:hover, :focus-visible, .is-tv-focused) {
  transform: translateY(-0.16rem);
}

.show-card:is(:hover, :focus-visible, .is-tv-focused)::after {
  opacity: 0.9;
  transform: scaleX(1);
}

.show-card.is-tv-focused .thumb-art,
.show-card:focus-visible .thumb-art,
.show-card:hover .thumb-art {
  transform: translateY(-0.08rem);
  border-color: rgba(0, 210, 255, 0.82);
  box-shadow:
    0 1rem 1.65rem rgba(0, 0, 0, 0.34),
    0 0 0 0.16rem rgba(0, 210, 255, 0.15),
    0 0 1.1rem rgba(0, 210, 255, 0.16);
}

.show-card:is(:hover, :focus-visible, .is-tv-focused) .thumb-poster {
  transform: scale(1.03);
  filter: saturate(1.12) brightness(1.06);
}

.show-card:is(:hover, :focus-visible, .is-tv-focused) .show-title {
  color: #f8fbff;
  transform: none;
  text-shadow:
    0 0.35rem 0.9rem rgba(0, 0, 0, 0.58),
    0 0 0.7rem rgba(0, 210, 255, 0.26);
}

.show-card:is(:hover, :focus-visible, .is-tv-focused) .show-meta {
  color: #dcd6ef;
}

.show-card:is(:hover, :focus-visible, .is-tv-focused) .episode-pill {
  background: rgba(0, 210, 255, 0.92);
  color: #08101b;
}

.show-card:active {
  transform: translateY(-0.04rem) scale(0.985);
}

.show-card:active .thumb-art {
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow: 0 0.55rem 1rem rgba(0, 0, 0, 0.3);
}

.show-card:active .thumb-poster {
  transform: scale(1.012);
  filter: brightness(0.96) saturate(1.04);
}

.show-card:active .show-title {
  color: #ffffff;
  text-shadow: none;
}

.thumb-art,
.show-card,
.show-title,
.show-meta {
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease, filter 220ms ease, color 220ms ease, text-shadow 220ms ease;
}

.watch-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  /* always center the panel both axes */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 2vw, 2rem);
  background: rgba(6, 5, 16, 0.82);
  backdrop-filter: blur(12px);
  animation: overlay-fade 200ms ease both;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.watch-overlay::-webkit-scrollbar {
  display: none;
}

.watch-overlay[hidden] {
  display: none;
}

.watch-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(24rem, 0.8fr) minmax(26rem, 0.9fr);
  align-items: stretch;
  gap: 1.2rem;
  width: min(102rem, 100%);
  /* Explicit height so grid items can use min-height: 0 and scroll correctly */
  height: min(calc(100dvh - clamp(1.5rem, 4vw, 4rem)), 54rem);
  padding: 1rem;
  border: 0.08rem solid var(--line);
  border-radius: 1.15rem;
  background: #101321;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: modal-rise 260ms ease both;
  margin: auto;
}

.close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 999rem;
  color: #ffffff;
  background: rgba(56, 58, 72, 0.92);
  font-size: 1.65rem;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: 0 0.8rem 1.7rem rgba(0, 0, 0, 0.24);
  transition: transform 160ms ease, background 160ms ease;
}

.close-button:is(:hover, :focus-visible) {
  transform: scale(1.04);
  background: rgba(78, 80, 96, 0.96);
  outline: 0;
}

.video-frame {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 0;
  padding: 2rem;
  border-radius: 0.5rem;
  overflow: hidden;
  background: linear-gradient(135deg, #58a8ff, #ef5bb8 48%, #f2bb46);
  background-position: center;
  background-size: cover;
  text-align: center;
}

.video-frame::before {
  content: "";
  position: absolute;
  inset: -2rem;
  z-index: 0;
  background:
    linear-gradient(rgba(12, 10, 28, 0.42), rgba(12, 10, 28, 0.9)),
    var(--watch-bg, none),
    linear-gradient(135deg, #58a8ff, #ef5bb8 48%, #f2bb46);
  background-position: center;
  background-size: cover;
  filter: blur(18px) saturate(1.1);
  transform: scale(1.04);
}

.video-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.08), transparent 19rem),
    linear-gradient(180deg, rgba(17, 16, 38, 0.1), rgba(17, 16, 38, 0.64));
}

.watch-art,
.watch-ready-state,
.source-picker,
.video-frame p,
.video-frame video {
  position: relative;
  z-index: 2;
}

/* Source picker fills the entire video-frame edge-to-edge */
.video-frame:has(.source-picker) {
  padding: 0;
  align-content: stretch;
  place-items: stretch;
}

.video-frame .source-picker {
  height: 100%;
}

/* ── Rich "ready" state shown before an episode is selected ─────────────── */
.watch-ready-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1.5rem 1rem 0.5rem;
}

.watch-ready-poster-wrap {
  width: min(17.5rem, 50%);
  min-width: 11rem;
  aspect-ratio: 2 / 3;
  filter: drop-shadow(0 1.4rem 2.8rem rgba(0, 0, 0, 0.58));
  animation: watchPosterIn 0.35s ease both;
}

@keyframes watchPosterIn {
  from { opacity: 0; transform: translateY(0.6rem) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.watch-ready-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.32rem;
  text-align: center;
  animation: watchPosterIn 0.42s 0.1s ease both;
}

.watch-ready-source {
  display: inline-block;
  padding: 0.18rem 0.7rem;
  border-radius: 2rem;
  background: rgba(59, 130, 246, 0.22);
  color: rgba(160, 195, 255, 0.95);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.watch-ready-hint {
  color: rgba(246, 243, 255, 0.62);
  font-size: 0.84rem;
  font-weight: 700;
  margin: 0;
}

.watch-ready-arrow {
  font-size: 1.3rem;
  color: rgba(138, 92, 255, 0.65);
  animation: watchArrowBounce 1.6s ease-in-out infinite;
  line-height: 1;
}

@keyframes watchArrowBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(5px); }
}
/* ─────────────────────────────────────────────────────────────────────────── */

.watch-art {
  display: grid;
  place-items: center;
  width: min(18rem, 45%);
  min-width: 12rem;
  aspect-ratio: 2 / 3;
  margin-bottom: 1.2rem;
}

.watch-poster,
.watch-poster-placeholder {
  width: 100%;
  height: 100%;
  border: 0.1rem solid rgba(255, 255, 255, 0.22);
  border-radius: 0.5rem;
  object-fit: cover;
  object-position: center top;
  box-shadow: 0 1.8rem 3rem rgba(0, 0, 0, 0.5);
}

.watch-poster-placeholder {
  display: grid;
  place-items: center;
  background: rgba(17, 16, 38, 0.42);
}

.video-frame video,
.video-frame iframe {
  width: 100%;
  height: 100%;
  max-height: 34rem;
  border-radius: 0.45rem;
  background: #05050c;
  border: 0;
}

.video-player-shell {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 0.75rem;
  width: 100%;
}

.direct-player-controls {
  position: relative;
  inset: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.35rem;
  padding: 0.6rem 0.7rem;
  border: 0.08rem solid rgba(0, 210, 255, 0.12);
  border-radius: 0.82rem;
  background:
    linear-gradient(135deg, rgba(18, 22, 39, 0.92), rgba(8, 12, 25, 0.88)),
    rgba(8, 10, 19, 0.86);
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.03);
  pointer-events: auto;
}

.translated-caption {
  position: absolute;
  left: 50%;
  bottom: 4.5rem;
  z-index: 4;
  width: min(88%, 48rem);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: #ffffff;
  background: rgba(5, 5, 12, 0.72);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.32);
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  font-weight: 900;
  line-height: 1.28;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.subtitle-status {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 4;
  max-width: min(80%, 24rem);
  padding: 0.42rem 0.65rem;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(16, 19, 33, 0.74);
  font-size: 0.75rem;
  font-weight: 800;
}

.play-symbol {
  width: 0;
  height: 0;
  margin-bottom: 1.2rem;
  border-top: 2.2rem solid transparent;
  border-bottom: 2.2rem solid transparent;
  border-left: 3.35rem solid #ffffff;
  filter: drop-shadow(0 0.8rem 1.3rem rgba(0, 0, 0, 0.32));
}

.video-frame p {
  max-width: 25rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
}

.watch-info {
  /* min-height: 0 lets the grid item shrink to the panel's height */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  padding: 1rem 1rem 1.5rem 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.watch-info::-webkit-scrollbar {
  display: none;
}

.watch-panel,
.watch-info,
.episode-buttons,
.source-picker-options,
.detail-tabs {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.watch-panel::-webkit-scrollbar,
.watch-info::-webkit-scrollbar,
.episode-buttons::-webkit-scrollbar,
.source-picker-options::-webkit-scrollbar,
.detail-tabs::-webkit-scrollbar {
  display: none;
}

.watch-info h2 {
  max-width: 100%;
  margin: 0 0 0.8rem;
  font-size: clamp(1.35rem, 2vw, 2.05rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.watch-info p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.55;
}

.watch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.cast-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(0, 210, 255, 0.22);
  background:
    linear-gradient(135deg, rgba(0, 210, 255, 0.12), rgba(138, 92, 255, 0.16)),
    rgba(255, 255, 255, 0.08);
}

.cast-action::before {
  content: "";
  width: 0.95rem;
  height: 0.72rem;
  margin-right: 0.42rem;
  border: 0.14rem solid currentColor;
  border-radius: 0.14rem;
  box-shadow: -0.18rem 0.18rem 0 -0.12rem currentColor;
}

.episode-list {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 0.08rem solid rgba(255, 255, 255, 0.1);
}

.detail-pane {
  display: none;
}

.detail-pane.is-active {
  display: block;
}

.detail-pane > span {
  display: block;
  margin-bottom: 0.75rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-tabs,
.season-tab-list {
  display: flex;
  gap: var(--gap-sm);
  margin-bottom: 1rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.detail-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-tab,
.season-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h-sm);
  padding: 0 1rem;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.075);
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.detail-tab:focus,
.season-tab:focus,
.season-card:focus,
.episode-button:focus {
  outline: 0;
}

.season-tab {
  display: grid;
  align-content: center;
  min-width: 8.5rem;
  min-height: var(--control-h-lg);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  text-align: left;
}

.season-tab small {
  color: var(--muted);
  font-size: 0.68rem;
}

.detail-tab:is(:hover, :focus-visible, .is-tv-focused, .is-selected),
.season-tab:is(:hover, :focus-visible, .is-tv-focused, .is-selected) {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(138, 92, 255, 0.32), rgba(0, 210, 255, 0.16));
  box-shadow: 0 0.55rem 1.25rem rgba(0, 0, 0, 0.2), inset 0 0 0 0.08rem rgba(255, 255, 255, 0.13);
}

.detail-tab:is(:focus-visible, .is-tv-focused),
.season-tab:is(:focus-visible, .is-tv-focused) {
  box-shadow:
    inset 0 0 0 0.1rem rgba(0, 210, 255, 0.34),
    0 0 0 0.28rem rgba(0, 210, 255, 0.08),
    0 0.55rem 1.25rem rgba(0, 0, 0, 0.2);
}

.anime-detail-card {
  display: grid;
  grid-template-columns: 5.4rem minmax(0, 1fr);
  gap: var(--gap-md);
  padding: var(--gap-md);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.045);
}

.anime-detail-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 0.5rem;
  object-fit: cover;
}

.anime-detail-card h3 {
  margin: 0 0 0.35rem;
}

.anime-detail-card p {
  margin: 0 0 0.5rem;
}

.anime-metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.2rem, 1fr));
  gap: 0.45rem;
  margin: 0.55rem 0 0.65rem;
}

.anime-metadata-item {
  display: grid;
  gap: 0.12rem;
  min-height: 3.1rem;
  padding: 0.48rem 0.58rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.045);
}

.anime-metadata-label {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.anime-metadata-value {
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.18;
}

.anime-aliases {
  display: grid;
  gap: 0.18rem;
  margin: 0 0 0.65rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.28;
}

.season-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: var(--gap-md);
}

.season-card {
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 0.45rem;
  min-height: 11.8rem;
  padding: 0.75rem;
  border-radius: var(--radius-lg);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.055);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.season-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.season-card strong,
.season-card small,
.season-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.season-card small,
.season-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.season-format-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.38rem;
  border-radius: 999rem;
  background: rgba(138, 92, 255, 0.22);
  color: rgba(184, 160, 255, 0.9);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  vertical-align: middle;
  text-transform: uppercase;
}

.season-year {
  margin-left: 0.35rem;
  color: rgba(246, 243, 255, 0.38);
  font-size: 0.65rem;
}

.season-card:is(:hover, :focus-visible, .is-tv-focused, .is-selected) {
  transform: translateY(-0.06rem);
  background: rgba(0, 210, 255, 0.13);
  box-shadow: inset 0 0 0 0.1rem rgba(0, 210, 255, 0.28), 0 0.6rem 1.25rem rgba(0, 0, 0, 0.2);
}

.season-card:is(:focus-visible, .is-tv-focused) {
  box-shadow:
    inset 0 0 0 0.1rem rgba(0, 210, 255, 0.34),
    0 0 0 0.28rem rgba(0, 210, 255, 0.08),
    0 0.6rem 1.25rem rgba(0, 0, 0, 0.2);
}

.season-block {
  margin-top: 0.8rem;
  padding: var(--gap-md);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.045);
}

.season-head {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) auto;
  align-items: center;
  min-height: 4.8rem;
  gap: var(--gap-md);
  margin-bottom: var(--gap-md);
}

.season-poster-mini {
  width: 3.2rem;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 0.6rem 1.1rem rgba(0, 0, 0, 0.35);
}

.season-copy {
  min-width: 0;
}

.season-block h3 {
  margin: 0 0 0.55rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  line-height: 1.1;
}

.season-copy h3 {
  margin-bottom: 0.25rem;
}

.season-copy p,
.season-count {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.season-count {
  padding: 0.35rem 0.55rem;
  border-radius: 999rem;
  background: rgba(255, 255, 255, 0.07);
}

.episode-empty {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.episode-player-card {
  display: grid;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  min-height: 6.2rem;
  padding: var(--gap-md);
  border: 0.08rem solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.06);
}

.episode-player-card strong {
  color: #ffffff;
}

.episode-player-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.via-anipub {
  justify-self: start;
  padding: 0.24rem 0.52rem;
  border-radius: 999rem;
  color: #ffffff;
  background: rgba(185, 118, 255, 0.18);
  border: 0.08rem solid rgba(185, 118, 255, 0.34);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 950;
}

.episode-player-card.is-ready {
  border-color: rgba(0, 210, 255, 0.36);
  background: rgba(0, 210, 255, 0.1);
}

.episode-player-card.is-missing {
  border-color: rgba(242, 187, 70, 0.28);
  background: rgba(242, 187, 70, 0.08);
}

.episode-player-card.is-external {
  border-color: rgba(185, 118, 255, 0.34);
  background: rgba(185, 118, 255, 0.1);
}

.episode-play-inline {
  justify-self: start;
  min-height: var(--control-h-sm);
  padding: 0 0.9rem;
  border-radius: var(--radius-md);
  color: #ffffff;
  background: rgba(138, 92, 255, 0.42);
  font-weight: 900;
  cursor: pointer;
}

.episode-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.25rem, 1fr));
  gap: var(--gap-sm);
  max-height: 18rem;
  overflow: auto;
  padding-right: 0.2rem;
  mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 1.8rem), transparent 100%);
}

.episode-button {
  display: grid;
  align-content: center;
  min-height: var(--control-h-lg);
  padding: 0.55rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.episode-button.is-locked {
  opacity: 0.88;
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.06);
}

.episode-button.is-selected,
.episode-button.is-locked.is-selected {
  opacity: 1;
  border-color: rgba(0, 210, 255, 0.42);
  background: rgba(0, 210, 255, 0.11);
}

.episode-button strong {
  font-size: 1rem;
  line-height: 1;
}

.episode-button small {
  max-width: 100%;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.68rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-button:is(:hover, :focus-visible, .is-tv-focused, .is-selected) {
  transform: translateY(-0.03rem);
  border-color: rgba(0, 210, 255, 0.42);
  background: rgba(0, 210, 255, 0.1);
  box-shadow:
    inset 0 0 0 0.08rem rgba(255, 255, 255, 0.06),
    0 0.45rem 0.9rem rgba(0, 0, 0, 0.18);
}

.episode-button:is(:focus, :focus-visible, .is-tv-focused) {
  outline: 0;
  box-shadow:
    inset 0 0 0 0.08rem rgba(0, 210, 255, 0.26),
    0 0 0 0.16rem rgba(0, 210, 255, 0.06),
    0 0.45rem 0.9rem rgba(0, 0, 0, 0.18);
}

.episode-video-empty {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  gap: 0.75rem;
  max-width: 30rem;
  margin: auto;
  padding: 1.5rem;
  color: #ffffff;
  text-align: center;
}

.episode-video-empty strong {
  font-size: 1.35rem;
}

.episode-video-empty p {
  max-width: 27rem;
}

.episode-video-empty code {
  color: #ffffff;
  font-weight: 900;
}

.episode-video-empty.is-external {
  max-width: 34rem;
}

.embedded-player-container {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 30rem;
  overflow: hidden;
  border: 0.08rem solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  background: #03050c;
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.04);
}

.anipub-embedded {
  display: grid;
  grid-template-rows: auto minmax(24rem, 1fr) auto auto;
  gap: 0.62rem;
  height: auto;
  min-height: 0;
  padding: 0.62rem;
  overflow: visible;
  border-color: rgba(0, 210, 255, 0.16);
  border-radius: 0.9rem;
  background:
    linear-gradient(180deg, rgba(9, 12, 25, 0.95), rgba(6, 8, 18, 0.98)),
    #03050c;
}

.player-server-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.15rem 0.05rem;
}

.player-source-heading {
  flex: 1 0 100%;
  display: grid;
  justify-items: center;
  gap: 0.08rem;
  margin-bottom: 0.18rem;
  color: #ffffff;
  text-align: center;
}

.player-source-heading strong {
  font-size: 0.9rem;
  line-height: 1;
}

.player-source-heading span {
  color: rgba(246, 243, 255, 0.58);
  font-size: 0.72rem;
  font-weight: 850;
}

.player-server-option {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "label"
    "number"
    "source";
  align-items: center;
  justify-items: center;
  gap: 0.12rem;
  min-width: 7rem;
  min-height: 4rem;
  padding: 0.58rem 0.72rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.1);
  border-radius: 0.65rem;
  color: rgba(246, 243, 255, 0.82);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    rgba(40, 35, 72, 0.9);
  box-shadow: inset 0 0 0 0.04rem rgba(255, 255, 255, 0.03);
  cursor: pointer;
  text-align: center;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.player-server-option span {
  grid-area: label;
  color: rgba(246, 243, 255, 0.58);
  font-size: 0.64rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.player-server-option strong {
  grid-area: number;
  max-width: 100%;
  overflow: hidden;
  font-size: 0.94rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-server-option small {
  grid-area: source;
  max-width: 11rem;
  overflow: hidden;
  color: rgba(246, 243, 255, 0.62);
  font-size: 0.62rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-server-option:is(:hover, :focus-visible, .is-tv-focused, .is-selected) {
  outline: 0;
  transform: translateY(-0.04rem);
  border-color: rgba(0, 210, 255, 0.34);
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(34, 215, 255, 0.92), rgba(138, 92, 255, 0.82)),
    rgba(40, 35, 72, 0.92);
  box-shadow: 0 0.7rem 1.45rem rgba(0, 0, 0, 0.24), 0 0 0 0.16rem rgba(0, 210, 255, 0.1);
}

.player-server-option:is(:hover, :focus-visible, .is-tv-focused, .is-selected) small {
  color: rgba(255, 255, 255, 0.78);
}

/* ── Loading hint while addon sources are being fetched ─────────────────── */
.addon-loading-hint {
  padding: 1.2rem 1.5rem;
  color: rgba(246, 243, 255, 0.42);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  animation: addonLoadingPulse 1.4s ease-in-out infinite;
}

@keyframes addonLoadingPulse {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 0.8; }
}

/* Fade-in each addon band as it arrives */
.addon-band {
  animation: addonBandIn 0.38s ease both;
}

@keyframes addonBandIn {
  from { opacity: 0; transform: translateY(0.5rem); }
  to   { opacity: 1; transform: translateY(0); }
}
/* ─────────────────────────────────────────────────────────────────────────── */

/* ── Source picker (shown after ✕ exit button is clicked) ────────────────── */
.source-picker {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  height: 100%;
  min-height: 18rem;
  padding: 0;
  gap: 0;
  overflow: hidden;
  cursor: default;
  user-select: none;
}

/* ── Poster hero strip ───────────────────────────────────────────────── */
.source-picker-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-shrink: 0;
  min-height: 10rem;
  padding: 1.1rem 1.2rem 0.9rem;
  background: linear-gradient(135deg, rgba(20, 10, 38, 0.85), rgba(10, 14, 28, 0.7));
  overflow: hidden;
}

.source-picker-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--watch-bg, none) center / cover no-repeat;
  opacity: 0.22;
  filter: blur(18px) saturate(1.4);
  transform: scale(1.08);
  pointer-events: none;
}

.source-picker-art {
  position: relative;
  flex-shrink: 0;
  width: 4.8rem;
  height: 7rem;
  border-radius: 0.6rem;
  object-fit: cover;
  box-shadow: 0 0.6rem 2rem rgba(0, 0, 0, 0.55);
}

.source-picker-art-placeholder {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.18), rgba(138, 92, 255, 0.14));
  border: 0.08rem solid rgba(255, 255, 255, 0.1);
}

.source-picker-hero-text {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.source-picker-show-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 850;
  line-height: 1.25;
}

.source-picker-ep-label {
  color: rgba(0, 210, 255, 0.85);
  font-size: 0.76rem;
  font-weight: 850;
}

/* ── Heading strip ───────────────────────────────────────────────────── */
.source-picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem 0.5rem;
  border-bottom: 0.08rem solid rgba(255, 255, 255, 0.07);
  color: #fff;
}

.source-picker-heading strong {
  font-size: 0.9rem;
  font-weight: 900;
}

.source-picker-heading span {
  font-size: 0.72rem;
  color: rgba(246, 243, 255, 0.46);
  font-weight: 800;
}

/* ── Options list ────────────────────────────────────────────────────── */
.source-picker-options {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  overflow-y: auto;
  flex: 1;
  align-content: flex-start;
}

/* Base option row — shared by all states */
.source-picker-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.72rem 0.95rem;
  border-radius: 0.72rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  color: rgba(246, 243, 255, 0.9);
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
  text-align: left;
  transition: background 160ms, border-color 160ms, box-shadow 160ms, transform 120ms;
}

/* ── Found: fully playable server ───────────────────────────────────── */
.source-picker-option-found {
  border-color: rgba(0, 210, 255, 0.28);
  background: linear-gradient(130deg, rgba(0, 210, 255, 0.08), rgba(138, 92, 255, 0.1));
  cursor: pointer;
}

.source-picker-option-found:is(:hover, :focus-visible, .is-tv-focused) {
  outline: 0;
  background: linear-gradient(130deg, rgba(34, 215, 255, 0.88), rgba(138, 92, 255, 0.78));
  border-color: transparent;
  color: #06121d;
  box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.3);
  transform: translateY(-0.05rem);
}

.source-picker-option-found:is(:hover, :focus-visible, .is-tv-focused) small,
.source-picker-option-found:is(:hover, :focus-visible, .is-tv-focused) .source-picker-slot-play-icon {
  color: rgba(6, 18, 29, 0.65);
}

.source-picker-option-found:is(:hover, :focus-visible, .is-tv-focused) .source-picker-slot-play-badge {
  background: rgba(6, 18, 29, 0.18);
  color: #06121d;
}

/* ── Checking: lookup still in-flight ───────────────────────────────── */
.source-picker-option-checking {
  opacity: 0.62;
  cursor: default;
  border-color: rgba(255, 255, 255, 0.05);
}

/* ── Unavailable: lookup finished, nothing found ────────────────────── */
.source-picker-option-unavail {
  opacity: 0.32;
  cursor: default;
  border-color: rgba(255, 255, 255, 0.04);
}

/* ── Slot icon (left) ────────────────────────────────────────────────── */
.source-picker-slot-icon {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 900;
}

.source-picker-slot-play-icon {
  color: rgba(0, 210, 255, 0.9);
  background: rgba(0, 210, 255, 0.12);
  font-size: 0.6rem;
}

.source-picker-slot-off-icon {
  color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.source-picker-slot-checking-icon {
  background: rgba(0, 210, 255, 0.07);
}

/* ── Slot body (center) ──────────────────────────────────────────────── */
.source-picker-slot-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.source-picker-slot-body strong {
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-picker-slot-body small {
  color: rgba(246, 243, 255, 0.48);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Play badge (right, found only) ──────────────────────────────────── */
.source-picker-slot-play-badge {
  flex-shrink: 0;
  padding: 0.22rem 0.6rem;
  border-radius: 999rem;
  background: rgba(0, 210, 255, 0.15);
  color: rgba(0, 210, 255, 0.9);
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Spinner ─────────────────────────────────────────────────────────── */
.source-picker-spinner {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border: 0.12rem solid rgba(0, 210, 255, 0.3);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spinnerRotate 700ms linear infinite;
  flex-shrink: 0;
}

@keyframes spinnerRotate {
  to { transform: rotate(360deg); }
}

/* ✕ exit button — always visible, slightly larger than tool buttons */
.vid-exit-button {
  font-size: 1.05rem;
  font-weight: 900;
  min-width: 2.5rem;
  min-height: 2.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: auto;
}

.vid-exit-button:is(:hover, :focus-visible, .is-tv-focused) {
  background: rgba(220, 60, 60, 0.55);
  color: #fff;
}

/* Topbar prev/next buttons: hidden in normal mode, shown in cinema mode */
.vid-topbar-nav {
  display: none;
}
/* ─────────────────────────────────────────────────────────────────────────── */

.player-episode-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  max-width: 44rem;
  /* center the bar horizontally */
  margin-inline: auto;
  min-height: 3.2rem;
  padding: 0.42rem 0.55rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.1);
  border-radius: 999rem;
  background:
    linear-gradient(135deg, rgba(20, 16, 42, 0.94), rgba(10, 12, 24, 0.92));
  box-shadow:
    inset 0 0 0 0.08rem rgba(255, 255, 255, 0.06),
    0 0.5rem 1.6rem rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.player-episode-actions:has(.player-download-action) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 52rem;
}

.player-language-bar {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 3.7rem;
  padding: 0.72rem 0.84rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  border-radius: 0.65rem;
  border-color: rgba(0, 210, 255, 0.14);
  background:
    linear-gradient(135deg, rgba(18, 22, 39, 0.92), rgba(8, 12, 25, 0.88)),
    rgba(8, 10, 19, 0.86);
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.025);
}

.player-nav-action,
.player-download-action,
.player-cast-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  width: 100%;
  min-height: 2.45rem;
  padding: 0 0.9rem;
  border: 0.08rem solid transparent;
  border-radius: 999rem;
  color: rgba(246, 243, 255, 0.88);
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.84rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms, color 150ms, box-shadow 150ms;
}

.player-nav-action span {
  font-size: 1.3rem;
  line-height: 0;
}

.player-nav-action small {
  display: inline-grid;
  place-items: center;
  min-width: 1.45rem;
  min-height: 1.45rem;
  padding: 0 0.28rem;
  border-radius: 999rem;
  color: #06121d;
  background: linear-gradient(135deg, #22d7ff, #f2bb46);
  font-size: 0.7rem;
}

.player-nav-action:is(:hover, :focus-visible, .is-tv-focused),
.player-download-action:is(:hover, :focus-visible, .is-tv-focused),
.player-cast-action:is(:hover, :focus-visible, .is-tv-focused) {
  outline: 0;
  color: #06121d;
  background: linear-gradient(135deg, #22d7ff, #f2bb46);
  box-shadow: 0 0.55rem 1.25rem rgba(0, 210, 255, 0.16);
}

.player-nav-action:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.player-download-action:disabled {
  display: none;
}

.player-nav-action.is-list {
  min-width: 0;
}

.player-download-action {
  color: #06121d;
  background: linear-gradient(135deg, #22d7ff, #58a8ff);
}

.player-cast-action {
  width: auto;
  min-width: 4.8rem;
}

.vidstream-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "stage"
    "actions";
  gap: 0.9rem;
  align-items: start;
  padding: 0.8rem;
  border: 0.08rem solid rgba(0, 210, 255, 0.16);
  border-radius: 1rem;
  background:
    radial-gradient(circle at 88% 8%, rgba(138, 92, 255, 0.14), transparent 19rem),
    linear-gradient(135deg, rgba(8, 11, 24, 0.96), rgba(12, 14, 29, 0.92));
  box-shadow:
    inset 0 0 0 0.08rem rgba(255, 255, 255, 0.035),
    0 1.1rem 2.4rem rgba(0, 0, 0, 0.24);
}

.vidstream-player .player-episode-actions {
  grid-area: actions;
}

.player-stream-toolbar {
  display: none;
}

.player-stream-toolbar {
  grid-area: prefs;
  grid-template-columns: auto minmax(10rem, 13rem) minmax(10rem, 13rem);
  align-items: center;
  gap: 0.68rem;
  width: 100%;
  padding: 0.62rem;
  border: 0.08rem solid rgba(0, 210, 255, 0.14);
  border-radius: 0.78rem;
  background:
    linear-gradient(135deg, rgba(17, 22, 41, 0.9), rgba(12, 14, 29, 0.86)),
    rgba(13, 16, 31, 0.9);
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.025);
}

.player-stream-toolbar .source-badge {
  justify-self: start;
  white-space: nowrap;
}

.player-stream-toolbar .language-selector {
  justify-content: end;
  width: 100%;
  max-width: none;
  padding: 0;
  background: transparent;
  border: 0;
}

.player-stream-toolbar .language-select {
  width: min(100%, 13rem);
  max-width: 13rem;
  min-height: 2.55rem;
}

.vid-player-stage {
  grid-area: stage;
  position: relative;
  display: block;
  min-height: clamp(20rem, 44vw, 35rem);
  overflow: hidden;
  border-radius: 0.65rem;
  background: #000000;
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.05);
}

.vidstream-player .subtitle-status {
  display: none;
}

.video-frame .vid-player-stage video,
.video-frame .vid-player-stage iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 0;
  max-height: none;
  border-radius: 0;
  object-fit: contain;
}

.video-frame .vid-player-stage .apk-video-frame {
  border: 0;
  background: #000000;
}

.vidstream-player.fit-cover .vid-player-stage > video {
  object-fit: cover;
}

.vidstream-player.fit-fill .vid-player-stage > video {
  object-fit: fill;
}

.vidstream-player.fit-cover .vid-player-stage > iframe,
.vidstream-player.fit-fill .vid-player-stage > iframe {
  object-fit: fill;
}

.vid-topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.8rem;
  align-items: center;
  gap: 0.55rem;
  min-height: 3.7rem;
  padding: 0.55rem 0.75rem 2.4rem;
  color: #ffffff;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent);
  pointer-events: none;
}

/* iframe mode: solid topbar — title centered, no left-padding compensation */
.vidstream-player.is-iframe .vid-topbar strong {
  padding-left: 0;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.92);
}

.vid-topbar strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.98rem;
  font-weight: 850;
  padding-left: 2.8rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vid-icon-button,
.vid-tool-button {
  display: inline-grid;
  place-items: center;
  min-width: 2.35rem;
  min-height: 2.35rem;
  border: 0;
  border-radius: 999rem;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
  pointer-events: auto;
}

.vid-icon-button:is(:hover, :focus-visible, .is-tv-focused),
.vid-tool-button:is(:hover, :focus-visible, .is-tv-focused) {
  outline: 0;
  color: #ffffff;
  background: rgba(138, 92, 255, 0.38);
  box-shadow: 0 0 0 0.14rem rgba(138, 92, 255, 0.12);
}

.vid-icon-button:disabled,
.vid-tool-button:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  pointer-events: none;
}

.vid-loader {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  gap: 0.6rem;
  color: rgba(246, 243, 255, 0.8);
  background: radial-gradient(circle at center, rgba(16, 14, 36, 0.54), rgba(0, 0, 0, 0.84));
  font-weight: 900;
}

.vid-loader[hidden] {
  display: none;
}

.vid-loader .play-symbol {
  margin: 0;
  transform: scale(0.42);
}

.player-inline-prefs {
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 4.8rem;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.46rem;
  pointer-events: none;
}

.player-inline-prefs > * {
  pointer-events: auto;
}

.player-inline-prefs .language-select {
  min-height: 2.35rem;
  max-width: 13rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.12);
  background: rgba(22, 24, 40, 0.88);
  box-shadow: 0 0.6rem 1.4rem rgba(0, 0, 0, 0.18);
}

.vid-controls {
  position: absolute;
  inset: auto 0 0;
  z-index: 6;
  display: grid;
  gap: 0.55rem;
  padding: 0.55rem 0.75rem 0.72rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.18), transparent);
}

.vid-seek {
  width: 100%;
  height: 0.35rem;
  accent-color: #8a5cff;
  cursor: pointer;
}

.vid-control-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.vid-spacer {
  flex: 1 1 auto;
}

.vid-time {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.vid-panel {
  position: absolute;
  right: 0.75rem;
  bottom: 4.5rem;
  z-index: 7;
  display: grid;
  gap: 0.7rem;
  width: min(20rem, calc(100% - 1.5rem));
  max-height: min(24rem, 70vh);
  overflow: auto;
  padding: 1rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  border-radius: 0.85rem;
  color: #ffffff;
  background: rgba(16, 14, 36, 0.96);
  box-shadow: 0 1.2rem 2.8rem rgba(0, 0, 0, 0.42);
}

.vid-panel[hidden] {
  display: none;
}

.vid-panel p {
  margin: 0;
  color: rgba(246, 243, 255, 0.62);
  font-size: 0.86rem;
}

.vid-panel-grid {
  display: grid;
  gap: 0.45rem;
}

.vid-panel-choice {
  min-height: 2.35rem;
  padding: 0 0.8rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  border-radius: 0.6rem;
  color: rgba(246, 243, 255, 0.86);
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-weight: 850;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.vid-panel-choice:is(:hover, :focus-visible, .is-tv-focused) {
  outline: 0;
  color: #ffffff;
  background: rgba(138, 92, 255, 0.34);
}

.vidstream-player.is-iframe {
  grid-template-rows: 1fr auto;
  height: 100%;
  min-height: 0;
  padding: 0.5rem;
}

.vidstream-player.is-iframe .vid-player-stage {
  /* Fill the video-frame area instead of forcing a fixed min-height */
  flex: 1;
  min-height: clamp(14rem, 28vh, 22rem);
  /* Black topbar + iframe stacked vertically */
  display: flex;
  flex-direction: column;
}

/* Opaque black info bar above the iframe */
.vidstream-player.is-iframe .vid-topbar {
  order: -1;
  position: relative;
  inset: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.95);
  border-bottom: 0.06rem solid rgba(255, 255, 255, 0.13);
  min-height: 2.8rem;
  padding: 0.4rem 3rem;
  pointer-events: auto;
}

/* iframe fills remaining space after topbar */
.vidstream-player.is-iframe .vid-player-stage > iframe {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
}

.vidstream-player.is-iframe .player-inline-prefs {
  bottom: 0.8rem;
}

body.player-cinema-open {
  overflow: hidden;
}

/*
 * CRITICAL FIX — containing-block isolation
 * ─────────────────────────────────────────
 * .watch-overlay has backdrop-filter which makes it the containing block
 * for ALL position:fixed descendants.  .watch-panel (inside the overlay)
 * has overflow:hidden, so .vidstream-player.is-cinema { position:fixed }
 * gets clipped to the watch-panel rectangle — never full-viewport.
 *
 * Solution: remove the backdrop-filter when cinema is active so that
 * position:fixed is relative to the true viewport, which overflow:hidden
 * on any ancestor cannot clip.
 */
body.player-cinema-open .watch-overlay {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: hidden;
  /* Kill the entrance animation so it doesn't re-fire on fullscreen toggle */
  animation: none !important;
}

/* Suppress panel re-animation during fullscreen transition */
body.player-cinema-open .watch-panel {
  animation: none !important;
}

/* ── Embedded-player mode (iframe, no full-viewport cinema) ─────────────────
   Kills the backdrop-filter so the iframe's own fullscreen request
   doesn't have to traverse expensive compositor layers. */
body.has-embedded-player .watch-overlay {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  animation: none !important;
}
body.has-embedded-player .watch-panel {
  animation: none !important;
}

/* Make the video-frame stretch to fill its grid cell so the iframe uses
   all available vertical space instead of shrinking to min-height. */
body.has-embedded-player .video-frame {
  align-self: stretch;
  align-content: stretch;
  place-items: stretch;
}

/* Hide the overlay's outer × when cinema is active — the in-player vid-exit-button serves as close */
body.player-cinema-open .close-button {
  display: none;
}

/* Native fullscreen: zero-latency backdrop, no transition flash */
/* Instant fullscreen — no fade-in, no compositor overhead */
::backdrop {
  background: #000;
  animation: none !important;
  transition: none !important;
}
:fullscreen,
:-webkit-full-screen {
  animation: none !important;
  transition: none !important;
}
:fullscreen .watch-panel,
:fullscreen .watch-overlay,
:-webkit-full-screen .watch-panel,
:-webkit-full-screen .watch-overlay {
  animation: none !important;
  transition: none !important;
  backdrop-filter: none !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   Cinema mode — full-screen overlay
   ══════════════════════════════════════════════════════════════════════════
   The cinema container is position:fixed; inset:0 on the true viewport
   (backdrop-filter is disabled on .watch-overlay when cinema is open,
   so there is no re-rooted containing block that could clip this element).

   The stage is position:absolute; inset:0 — relative to the cinema
   container, which is now the true viewport rectangle.  This avoids any
   double-fixed complexity and works correctly in native fullscreen too.
   ══════════════════════════════════════════════════════════════════════════ */

.vidstream-player.is-cinema {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10050;
  display: block;
  width: min(92vw, 96rem);
  height: min(78vh, 54rem);
  padding: 0;
  border: 0.08rem solid rgba(255, 255, 255, 0.16);
  border-radius: 1rem;
  background: #000;
  overflow: hidden;
  transform: translate(-50%, -50%);
  box-shadow: 0 1.4rem 5rem rgba(0, 0, 0, 0.62), 0 0 0 999rem rgba(2, 2, 8, 0.72);
  transition: none;
}

/* Stage: fills the cinema container via position:absolute */
.vidstream-player.is-cinema .vid-player-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  min-height: 0;
  overflow: hidden;
  border-radius: inherit;
  background: #000;
}

/* Media: stretches to fill the entire stage */
.vidstream-player.is-cinema .vid-player-stage > video,
.vidstream-player.is-cinema .vid-player-stage > iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: contain;
  border-radius: inherit;
  background: #000;
  z-index: 1;
  flex: none;
}

.vidstream-player.is-cinema.is-popup-message .episode-video-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: clamp(2rem, 5vw, 4rem);
  background:
    radial-gradient(circle at 50% 42%, rgba(138, 92, 255, 0.2), transparent 19rem),
    linear-gradient(180deg, rgba(7, 8, 18, 0.86), rgba(0, 0, 0, 0.94));
}

.vidstream-player.is-cinema.is-popup-message .episode-video-empty p {
  max-width: min(36rem, 78vw);
  margin: 0;
  color: rgba(246, 243, 255, 0.72);
  font-weight: 800;
  line-height: 1.45;
}

.vidstream-player.is-cinema.is-source-picker .source-picker {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding-top: 4.2rem;
  border-radius: inherit;
}

.vidstream-player.is-cinema.is-source-picker .source-picker-options {
  min-height: 0;
}

.vidstream-player.is-cinema.fit-cover .vid-player-stage > video {
  object-fit: cover;
}

.vidstream-player.is-cinema.fit-fill .vid-player-stage > video {
  object-fit: fill;
}

.vidstream-player.is-cinema.fit-cover .vid-player-stage > iframe,
.vidstream-player.is-cinema.fit-fill .vid-player-stage > iframe {
  object-fit: fill;
}

/* ── Topbar: gradient bar pinned to the top of the stage ── */
.vidstream-player.is-cinema .vid-topbar {
  position: absolute;
  inset: 0 0 auto;         /* top:0  left:0  right:0  bottom:auto */
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3.5rem;
  /* right padding leaves room for the ✕ button (~3.4 rem wide) */
  padding: 0.8rem 4rem 3.5rem 1rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.88) 0%, transparent 100%);
  border-bottom: 0;
  pointer-events: none;    /* click-through to video */
}

/* Re-enable pointer events for interactive controls inside the topbar */
.vidstream-player.is-cinema .vid-topbar > * {
  pointer-events: auto;
}

/* Episode title: grows to fill the topbar, clips overflow */
.vidstream-player.is-cinema .vid-topbar strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 0;
  text-align: left;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.95);
}

/* Show Prev / Next nav buttons only in cinema (hidden by default) */
.vidstream-player.is-cinema .vid-topbar-nav {
  display: inline-grid;
  flex-shrink: 0;
}

/* ── ✕ button: pinned to the very top-right of the stage ── */
.vidstream-player.is-cinema .vid-exit-button {
  position: absolute;
  inset: auto;             /* clear any inherited inset */
  top: 0.8rem;
  right: 0.85rem;
  z-index: 12;
  pointer-events: auto;
  width: 3rem;
  height: 3rem;
  min-width: 0;
  min-height: 0;
  border-radius: 999rem;
  background: rgba(56, 58, 72, 0.86);
  border: 0;
  font-size: 1.4rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.vidstream-player.is-cinema .vid-exit-button:is(:hover, :focus-visible, .is-tv-focused) {
  background: rgba(200, 35, 35, 0.75);
  border-color: rgba(255, 80, 80, 0.4);
  color: #fff;
  box-shadow: 0 0 0 0.18rem rgba(200, 35, 35, 0.25);
}

/* ── Controls bar: gradient bar pinned to the bottom of the stage ── */
.vidstream-player.is-cinema .vid-controls {
  position: absolute;
  inset: auto 0 0;
  z-index: 10;
  padding-bottom: max(0.72rem, env(safe-area-inset-bottom));
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.9)  0%,
    rgba(0, 0, 0, 0.55) 50%,
    transparent         100%
  );
}

/* ── Episode actions bar: hidden in cinema ──
   Navigation is in the topbar (⏮ ⏭) and vid-controls (⏮ ⏭). */
.vidstream-player.is-cinema .player-episode-actions {
  display: none;
}

/* Fullscreen button active state — highlight while in native fullscreen */
:fullscreen [data-player-fullscreen],
:-webkit-full-screen [data-player-fullscreen] {
  color: var(--cyan);
  opacity: 1;
}

.player-controls-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem 1rem 2.5rem;
  background: linear-gradient(180deg, rgba(3, 5, 12, 0.92), rgba(3, 5, 12, 0));
  pointer-events: none;
}

.video-player-shell .direct-player-controls {
  position: relative;
  inset: auto;
  padding: 0.6rem 0.7rem;
  background:
    linear-gradient(135deg, rgba(18, 22, 39, 0.92), rgba(8, 12, 25, 0.88)),
    rgba(8, 10, 19, 0.86);
  pointer-events: auto;
}

.anipub-embedded .player-controls-bar {
  position: relative;
  inset: auto;
  display: grid;
  grid-template-columns: minmax(13rem, 1fr) auto auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.54rem 0.62rem;
  border: 0.08rem solid rgba(0, 210, 255, 0.12);
  border-radius: 0.8rem;
  background:
    linear-gradient(135deg, rgba(18, 22, 39, 0.9), rgba(8, 12, 25, 0.82)),
    rgba(8, 10, 19, 0.82);
  box-shadow:
    inset 0 0 0 0.08rem rgba(255, 255, 255, 0.03),
    0 0.7rem 1.25rem rgba(0, 0, 0, 0.18);
  backdrop-filter: none;
  pointer-events: auto;
}

.episode-info,
.language-selector,
.close-embedded {
  pointer-events: auto;
}

.episode-info {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.5rem;
  color: #ffffff;
  text-align: left;
}

.episode-info strong {
  overflow: hidden;
  max-width: min(31rem, 42vw);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-badge {
  flex: 0 0 auto;
  padding: 0.2rem 0.56rem;
  border: 0.08rem solid rgba(0, 210, 255, 0.24);
  border-radius: 999rem;
  color: #06121d;
  background: linear-gradient(135deg, #22d7ff, #f2bb46);
  font-size: 0.64rem;
  font-weight: 950;
  letter-spacing: 0;
}

.player-default-badge {
  flex: 0 0 auto;
  padding: 0.2rem 0.55rem;
  border: 0.08rem solid rgba(181, 122, 255, 0.22);
  border-radius: 999rem;
  color: rgba(246, 243, 255, 0.76);
  background: rgba(181, 122, 255, 0.12);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0;
}

.language-selector {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.38rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.1);
  border-radius: 999rem;
  background: rgba(8, 10, 19, 0.72);
  box-shadow: 0 0.75rem 1.4rem rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(1rem);
}

.anipub-embedded .language-selector {
  flex: 0 0 auto;
  justify-content: flex-end;
  max-width: none;
  gap: 0.4rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.language-select {
  min-height: 2rem;
  max-width: 10.5rem;
  padding: 0 0.74rem;
  border: 0;
  border-radius: 999rem;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}

.anipub-embedded .language-select {
  min-height: 2.15rem;
  width: 10.6rem;
  max-width: 10.6rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.1);
  color: rgba(246, 243, 255, 0.94);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)),
    rgba(28, 31, 48, 0.92);
  box-shadow: inset 0 0 0 0.04rem rgba(255, 255, 255, 0.04);
}

.language-select:is(:hover, :focus-visible, .is-tv-focused) {
  outline: 0;
  border-color: rgba(0, 210, 255, 0.28);
  background:
    linear-gradient(135deg, rgba(0, 210, 255, 0.16), rgba(181, 122, 255, 0.12)),
    rgba(18, 22, 39, 0.95);
  box-shadow: 0 0 0 0.12rem rgba(0, 210, 255, 0.1), inset 0 0 0 0.04rem rgba(255, 255, 255, 0.06);
}

.close-embedded {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.player-dock-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.36rem;
}

.player-source-strip {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 0.32rem;
  min-width: 0;
  padding: 0.14rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  border-radius: 999rem;
  background: rgba(255, 255, 255, 0.045);
}

.player-source-choice {
  min-height: 2rem;
  max-width: 8.5rem;
  padding: 0 0.72rem;
  overflow: hidden;
  border: 0.08rem solid transparent;
  border-radius: 999rem;
  color: rgba(246, 243, 255, 0.8);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.player-source-choice:is(:hover, :focus-visible, .is-tv-focused, .is-selected) {
  outline: 0;
  border-color: rgba(0, 210, 255, 0.22);
  color: #06121d;
  background: linear-gradient(135deg, #22d7ff, #f2bb46);
}

.anipub-embedded .close-embedded {
  width: auto;
  height: auto;
  min-height: 2.15rem;
  padding: 0 0.76rem;
  border-radius: 999rem;
  background: rgba(255, 255, 255, 0.075);
  font-size: 0.76rem;
  font-weight: 950;
}

.close-embedded:is(:hover, :focus-visible, .is-tv-focused) {
  transform: translateY(-0.03rem);
  outline: 0;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 0.16rem rgba(0, 210, 255, 0.12);
}

.anipub-embedded .close-embedded:is(:hover, :focus-visible, .is-tv-focused) {
  color: #06121d;
  background: linear-gradient(135deg, #22d7ff, #b57aff);
  box-shadow: 0 0 0 0.14rem rgba(0, 210, 255, 0.14), 0 0.7rem 1.4rem rgba(0, 210, 255, 0.16);
}

.iframe-wrapper {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #000000;
}

.anipub-embedded .iframe-wrapper {
  position: relative;
  inset: auto;
  min-height: 31rem;
  overflow: hidden;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  border-radius: 0.74rem;
  background: #000000;
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.24);
}

.embedded-iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 30rem;
  border: 0;
  background: #000000;
}

.anipub-embedded .embedded-iframe {
  min-height: 30rem;
  max-height: none;
  border-radius: 0;
}

.player-tip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 2.4rem 1rem 0.85rem;
  color: rgba(246, 243, 255, 0.76);
  background: linear-gradient(0deg, rgba(3, 5, 12, 0.9), rgba(3, 5, 12, 0));
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
}

.player-tip span {
  pointer-events: auto;
}

.custom-toast {
  /* Center the toast in the viewport so it's always visible regardless of
     what is open underneath (main page, watch overlay, cinema mode, etc.).
     Previously bottom: 5rem landed inside the video player area visually. */
  position: fixed;
  left: 50%;
  top: 50%;
  bottom: auto;
  z-index: 10000;
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.8rem 1.15rem;
  transform: translate(-50%, -50%);
  border: 0.08rem solid rgba(0, 210, 255, 0.24);
  border-radius: 999rem;
  color: #ffffff;
  background: rgba(8, 10, 19, 0.92);
  box-shadow: 0 1rem 2.4rem rgba(0, 0, 0, 0.48);
  font-weight: 900;
  text-align: center;
  backdrop-filter: blur(1rem);
  animation: slide-up 220ms ease both;
}

.custom-toast.fade-out {
  opacity: 0;
  transition: opacity 220ms ease;
}

.update-banner {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: min(52rem, calc(100vw - 2rem));
  padding: 0.75rem;
  border: 0.08rem solid rgba(0, 210, 255, 0.2);
  border-radius: 1rem;
  color: var(--text);
  background: linear-gradient(135deg, rgba(18, 22, 39, 0.96), rgba(9, 13, 28, 0.94));
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.32);
  transform: translateX(-50%);
}

.update-banner span {
  font-weight: 900;
}

.update-banner button {
  min-height: 2.25rem;
  padding: 0 0.82rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.11);
  border-radius: 999rem;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
  cursor: pointer;
}

.update-banner button:is(:hover, :focus-visible, .is-tv-focused),
.update-banner.is-loading button:first-of-type {
  color: #06121d;
  background: linear-gradient(135deg, #22d7ff, #f2bb46);
}

.episode-video-empty.is-loading .play-symbol {
  animation: player-spin 900ms linear infinite;
}

@keyframes player-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    /* start slightly below center and rise into position */
    transform: translate(-50%, calc(-50% + 1.2rem));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes footer-aurora {
  0%,
  100% {
    background-position: 0% 50%, center, center;
    opacity: 0.78;
  }
  50% {
    background-position: 100% 50%, center, center;
    opacity: 1;
  }
}

@keyframes footer-line-flow {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes footer-dot-pulse {
  0%,
  100% {
    transform: scale(0.92);
    box-shadow:
      0 0 0 0.36rem rgba(0, 210, 255, 0.07),
      0 0 1rem rgba(0, 210, 255, 0.24);
  }
  50% {
    transform: scale(1.08);
    box-shadow:
      0 0 0 0.5rem rgba(242, 187, 70, 0.08),
      0 0 1.45rem rgba(0, 210, 255, 0.38);
  }
}

@keyframes logo-halo-spin {
  to {
    transform: rotate(360deg);
  }
}

.cast-message {
  max-width: 34rem;
}

.cast-mini-poster {
  width: 5.2rem;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 0.9rem 1.6rem rgba(0, 0, 0, 0.36);
}

.cast-toast {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  z-index: 4;
  transform: translateX(-50%);
  width: min(28rem, calc(100% - 2rem));
  padding: 0.75rem 1rem;
  border: 0.08rem solid rgba(0, 210, 255, 0.28);
  border-radius: 999rem;
  color: #ffffff;
  text-align: center;
  font-weight: 900;
  background: rgba(12, 13, 28, 0.82);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(1rem);
}

.iframe-cast-guide {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.72rem;
  padding: 0.82rem;
  border: 0.08rem solid rgba(0, 210, 255, 0.22);
  border-radius: 1rem;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(17, 20, 38, 0.94), rgba(8, 11, 24, 0.9)),
    rgba(8, 10, 19, 0.92);
  box-shadow: 0 1rem 2.2rem rgba(0, 0, 0, 0.36), inset 0 0 0 0.08rem rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(1rem);
}

.iframe-cast-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.8rem;
  color: #06121d;
  background: linear-gradient(135deg, #22d7ff, #f2bb46);
  font-weight: 950;
}

.iframe-cast-guide strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 950;
}

.iframe-cast-guide p {
  margin: 0.12rem 0 0;
  color: rgba(246, 243, 255, 0.72);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.25;
}

.iframe-cast-guide button {
  min-height: 2.3rem;
  padding: 0 0.88rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.12);
  border-radius: 999rem;
  color: rgba(246, 243, 255, 0.94);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
  cursor: pointer;
}

.iframe-cast-guide button:is(:hover, :focus-visible, .is-tv-focused) {
  outline: 0;
  color: #06121d;
  background: linear-gradient(135deg, #22d7ff, #f2bb46);
  box-shadow: 0 0.6rem 1.4rem rgba(0, 210, 255, 0.16);
}

.external-play-button {
  min-height: var(--control-h-md);
  padding: 0 1.15rem;
  border-radius: 999rem;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(138, 92, 255, 0.86), rgba(0, 210, 255, 0.62)),
    rgba(255, 255, 255, 0.08);
  box-shadow: 0 0.75rem 1.4rem rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  font-weight: 950;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.external-play-button:is(:hover, :focus-visible, .is-tv-focused) {
  transform: translateY(-0.04rem);
  filter: brightness(1.08);
  outline: 0;
  box-shadow:
    0 0 0 0.16rem rgba(0, 210, 255, 0.18),
    0 0.9rem 1.7rem rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.external-confirm,
.external-error {
  display: grid;
  gap: 0.8rem;
  width: min(100%, 32rem);
  padding: 1rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(8, 10, 19, 0.72);
}

.external-confirm[hidden],
.external-error[hidden] {
  display: none;
}

.external-confirm p,
.external-error p {
  margin: 0;
  color: rgba(246, 243, 255, 0.82);
  font-weight: 750;
}

.external-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

@media (max-width: 1150px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .app-shell {
    padding-top: 14.5rem;
  }

  .main-nav {
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .poster-grid {
    grid-template-columns: repeat(4, minmax(9.5rem, 1fr));
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .today-carousel {
    grid-template-columns: 3.2rem minmax(0, 1fr) 3.2rem;
  }

.schedule-list {
    grid-template-columns: 1fr;
  }

  .source-list {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid:has(.settings-rail) {
    grid-template-columns: 1fr;
  }

  .settings-rail {
    position: relative;
    top: auto;
    grid-auto-flow: column;
    grid-auto-columns: minmax(8rem, 1fr);
    min-height: auto;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 0.08rem solid rgba(255, 255, 255, 0.06);
  }

  .settings-version {
    display: none;
  }

  .settings-console {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 1rem;
  }

  .app-shell {
    padding-top: 14.5rem;
  }

  main {
    padding: 1.5rem 1rem 3rem;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 31rem;
  }

  .today-carousel {
    grid-template-columns: 1fr;
  }

  .carousel-stage {
    grid-template-columns: minmax(8rem, 12rem) 1fr;
    min-height: 20rem;
    padding: 0.9rem;
  }

  .poster-grid {
    grid-template-columns: repeat(2, minmax(8.5rem, 1fr));
  }

  .watch-panel {
    grid-template-columns: 1fr;
    width: 100%;
    height: auto;
    max-height: calc(100dvh - 1.5rem);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .watch-info {
    overflow-y: visible;
    padding: 0.5rem 0.5rem 1rem 0.5rem;
  }

  .player-controls-bar {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.85rem;
    background: rgba(3, 5, 12, 0.9);
  }

  .anipub-embedded .player-controls-bar {
    inset: auto;
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 0.62rem;
    border-radius: 1rem;
    background:
      linear-gradient(135deg, rgba(18, 20, 35, 0.88), rgba(7, 11, 23, 0.78)),
      rgba(8, 10, 19, 0.74);
  }

  .episode-info strong {
    max-width: calc(100vw - 8rem);
  }

  .anipub-embedded .episode-info {
    flex-wrap: wrap;
  }

  .language-selector {
    justify-content: flex-start;
    border-radius: 1.1rem;
  }

  .anipub-embedded .language-selector {
    justify-content: stretch;
    max-width: none;
  }

  .anipub-embedded .language-select {
    flex: 1 1 9.5rem;
    width: auto;
    max-width: none;
  }

  .player-episode-actions {
    overflow-x: auto;
    padding-bottom: 0.65rem;
  }

  .vidstream-player,
  .vidstream-player.is-iframe {
    grid-template-columns: 1fr;
    grid-template-areas:
      "stage"
      "actions";
    padding: 0.58rem;
  }

  .vid-player-stage,
  .video-frame .vid-player-stage video,
  .video-frame .vid-player-stage iframe,
  .vidstream-player.is-iframe .vid-player-stage {
    min-height: min(62vw, 26rem);
  }

  .player-inline-prefs {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    margin: 0.65rem;
    padding: 0.55rem;
    border-radius: 0.9rem;
    background: rgba(8, 10, 19, 0.66);
  }

  .player-stream-toolbar {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .player-stream-toolbar .language-selector {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .player-stream-toolbar .language-select {
    flex: 1 1 10rem;
    width: 100%;
    max-width: none;
  }

  .player-episode-actions,
  .player-episode-actions:has(.player-download-action:not(:disabled)) {
    grid-template-columns: 1fr;
  }

  /* cinema mode is already fully absolute-positioned — no responsive overrides needed */

  .vid-controls {
    padding-bottom: max(0.72rem, env(safe-area-inset-bottom));
  }

  .vid-control-row {
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }

  .settings-line {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .settings-select,
  .settings-switch,
  .settings-status-pill {
    justify-self: start;
  }

  .player-nav-action,
  .player-download-action,
  .player-cast-action {
    flex: 0 0 auto;
  }

  .player-language-bar {
    grid-template-columns: 1fr;
    align-items: flex-start;
    overflow: visible;
  }

  .player-tip {
    flex-wrap: wrap;
  }
}
.today-carousel {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0;
  min-width: 0;
}

.carousel-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr;
  align-items: center;
  gap: 0;
  min-height: clamp(31rem, 66vh, 46rem);
  height: auto;
  padding: clamp(2rem, 5vw, 5.5rem) clamp(1.6rem, 5vw, 5.5rem) 6.2rem;
  border-radius: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
  animation: carousel-enter 520ms ease both;
}

.carousel-stage.is-loading {
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-height: clamp(31rem, 66vh, 46rem);
  gap: 0;
  cursor: default;
}

.carousel-stage::before {
  display: none;
  content: none;
}

.carousel-stage:is(:hover, :focus-visible, .is-tv-focused) {
  box-shadow:
    inset 0 0 0 0.08rem rgba(255, 255, 255, 0.04);
  transform: none;
}

.carousel-backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #58a8ff, #ef5bb8 52%, #f2bb46);
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 1;
  filter: saturate(1.12) contrast(1.06) brightness(0.82);
  transform: scale(1.002);
  transition: opacity 280ms ease, transform 420ms ease, filter 420ms ease;
}

.carousel-backdrop.has-banner {
  background-position: center center;
  background-size: cover;
  image-rendering: auto;
}

.carousel-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 78% 34%, rgba(255, 255, 255, 0.06), transparent 22rem),
    linear-gradient(90deg, rgba(8, 10, 19, 0.96) 0%, rgba(8, 10, 19, 0.8) 30%, rgba(8, 10, 19, 0.3) 60%, rgba(8, 10, 19, 0.08) 100%),
    linear-gradient(0deg, var(--bg) 0%, rgba(8, 10, 19, 0.56) 14%, transparent 54%),
    linear-gradient(180deg, rgba(8, 10, 19, 0.1) 0%, transparent 35%);
}

.hero-motion {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  display: none;
  opacity: 0;
}

.hero-motion span {
  position: absolute;
  width: 18rem;
  height: 0.12rem;
  border-radius: 999rem;
  background: linear-gradient(90deg, transparent, rgba(64, 223, 194, 0.56), transparent);
  filter: blur(0.04rem);
  animation: hero-light-streak 5.8s ease-in-out infinite;
}

.hero-motion span:nth-child(1) {
  top: 26%;
  left: -20rem;
}

.hero-motion span:nth-child(2) {
  top: 48%;
  left: -25rem;
  animation-delay: 1.7s;
  background: linear-gradient(90deg, transparent, rgba(239, 91, 184, 0.5), transparent);
}

.hero-motion span:nth-child(3) {
  top: 68%;
  left: -18rem;
  animation-delay: 3.1s;
  background: linear-gradient(90deg, transparent, rgba(245, 227, 107, 0.42), transparent);
}

.carousel-info {
  position: relative;
  z-index: 2;
}

.carousel-poster-wrap {
  display: none;
}

.carousel-poster-wrap::before {
  content: "";
  position: absolute;
  inset: -1rem;
  z-index: 0;
  border-radius: 1.25rem;
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 210, 255, 0.28), transparent 64%),
    linear-gradient(135deg, rgba(138, 92, 255, 0.3), rgba(0, 210, 255, 0.24));
  filter: blur(20px);
  opacity: 0.78;
}

.carousel-poster-wrap::after {
  content: "";
  position: absolute;
  inset: -0.32rem;
  z-index: 2;
  padding: 0.12rem;
  border-radius: 1.05rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.54), rgba(0, 210, 255, 0.72) 38%, rgba(138, 92, 255, 0.58));
  opacity: 0.62;
  pointer-events: none;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.carousel-poster {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  border: 0.1rem solid rgba(255, 255, 255, 0.32);
  border-radius: 0.9rem;
  object-fit: cover;
  object-position: center top;
  image-rendering: auto;
  box-shadow:
    0 2.4rem 4.4rem rgba(0, 0, 0, 0.62),
    0 0 0 0.08rem rgba(255, 255, 255, 0.12),
    inset 0 0 0 0.08rem rgba(255, 255, 255, 0.12);
  filter: saturate(1.12) contrast(1.08) brightness(1.02);
  transition: transform 320ms ease, filter 320ms ease;
}

.carousel-stage:is(:hover, :focus-visible, .is-tv-focused) .carousel-poster {
  transform: scale(1.035);
  filter: saturate(1.18) contrast(1.1) brightness(1.05);
}

.carousel-stage.is-loading:is(:hover, :focus-visible, .is-tv-focused) .carousel-poster {
  transform: none;
}

.carousel-stage.is-loading .carousel-poster-wrap {
  align-self: center;
  justify-self: end;
  width: min(100%, 23rem);
  opacity: 0.72;
  transform: none;
}

.carousel-stage.is-loading .carousel-poster-wrap::before {
  inset: -0.55rem;
  filter: blur(12px);
  opacity: 0.42;
}

.carousel-stage.is-loading .carousel-poster-wrap::after {
  border-radius: 0.82rem;
  opacity: 0.38;
}

.carousel-stage.is-loading .carousel-poster-skeleton {
  width: 100%;
  height: 100%;
  border-radius: 0.9rem;
  border: 0.1rem solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 2.4rem 4.4rem rgba(0, 0, 0, 0.52),
    0 0 0 0.08rem rgba(0, 210, 255, 0.08);
}

.carousel-stage.is-loading .carousel-info {
  align-self: center;
  justify-self: start;
  max-width: min(27rem, 58vw);
  padding-left: 0;
  transform: translateY(0);
}

.carousel-stage.is-loading .carousel-info h2 {
  font-size: clamp(1.55rem, 2.6vw, 2.6rem);
}

.carousel-stage.is-loading .carousel-info p:not(.eyebrow) {
  max-width: 30rem;
}

.carousel-stage.is-loading .carousel-meta-line {
  width: fit-content;
}

.carousel-stage.is-loading .play-action {
  display: none;
}

.carousel-stage.is-loading .carousel-indicators {
  display: none;
}

.carousel-stage:is(:hover, :focus-visible, .is-tv-focused) .carousel-poster-wrap::before {
  opacity: 0.95;
  filter: blur(22px);
}

.carousel-info {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  align-self: center;
  grid-template-rows: auto auto auto auto auto;
  gap: 0.85rem;
  padding-top: 0.15rem;
  min-width: 0;
  max-width: min(46rem, 62vw);
  height: auto;
  max-height: none;
  padding: 0;
  transition: transform 300ms ease, opacity 250ms ease;
}

.carousel-info h2 {
  align-self: start;
  min-height: 0;
  margin: 0;
  padding-bottom: 0.18rem;
  font-size: clamp(1.55rem, 3.1vw, 3.1rem);
  line-height: 1;
  letter-spacing: 0;
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-shadow: 0 1rem 2.2rem rgba(0, 0, 0, 0.46);
  transition: color 220ms ease, text-shadow 220ms ease, transform 220ms ease;
}

.carousel-stage:is(:hover, :focus-visible, .is-tv-focused) .carousel-info h2 {
  color: #ffffff;
  transform: translateY(-0.12rem);
  text-shadow: 0 1rem 2.4rem rgba(0, 0, 0, 0.58), 0 0 1.4rem rgba(64, 223, 194, 0.18);
}

.carousel-info p:not(.eyebrow) {
  position: relative;
  display: -webkit-box;
  max-width: 40rem;
  margin: 0;
  overflow: hidden;
  color: #e2def0;
  font-size: clamp(1.05rem, 1.3vw, 1.24rem);
  line-height: 1.5;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  mask-image: linear-gradient(180deg, #000 72%, transparent 100%);
}

.carousel-meta-line {
  display: block;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  font-weight: 900;
}

.carousel-stage.is-changing .carousel-info {
  animation: carousel-slide-next 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.carousel-stage.is-changing.is-prev .carousel-info {
  animation-name: carousel-slide-prev;
}

.carousel-stage.is-changing .carousel-backdrop {
  animation: none;
}

.carousel-indicators {
  position: absolute;
  left: clamp(2rem, 5vw, 5.2rem);
  right: clamp(2rem, 5vw, 5.2rem);
  bottom: 1.45rem;
  z-index: 4;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  overflow-x: auto;
  padding: 0.25rem 0;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, transparent 0, #000 1rem, #000 calc(100% - 1rem), transparent 100%);
}

.carousel-indicators::-webkit-scrollbar {
  display: none;
}

.carousel-dot {
  flex: 0 0 auto;
  width: 4rem;
  height: 2.55rem;
  padding: 0;
  overflow: hidden;
  border: 0.1rem solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
  opacity: 0.72;
}

.carousel-dot img,
.carousel-dot span {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-dot span {
  background: linear-gradient(135deg, var(--cyan), var(--rose));
}

.carousel-dot:is(:hover, :focus-visible, .is-tv-focused, .is-selected) {
  transform: translateY(-0.06rem);
  border-color: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0.55rem 1.1rem rgba(0, 0, 0, 0.28), 0 0 0 0.14rem rgba(0, 210, 255, 0.16);
  opacity: 1;
}

@keyframes carousel-slide-next {
  0% {
    opacity: 0.2;
    transform: translateX(2.2rem) scale(0.96);
    filter: blur(4px);
  }
  58% {
    opacity: 1;
    transform: translateX(-0.32rem) scale(1.01);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0);
  }
}

@keyframes carousel-slide-prev {
  0% {
    opacity: 0.2;
    transform: translateX(-2.2rem) scale(0.96);
    filter: blur(4px);
  }
  58% {
    opacity: 1;
    transform: translateX(0.32rem) scale(1.01);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0);
  }
}

@keyframes backdrop-drift {
  0% {
    opacity: 0.55;
    transform: scale(1.08);
  }
  100% {
    opacity: 0.94;
    transform: scale(1.04);
  }
}

@keyframes hero-backdrop-pan {
  0% {
    background-position: 48% 50%;
    transform: scale(1.005);
  }
  100% {
    background-position: 52% 50%;
    transform: scale(1.035);
  }
}

@keyframes hero-light-streak {
  0%, 18% {
    transform: translateX(0);
    opacity: 0;
  }
  36% {
    opacity: 1;
  }
  72%, 100% {
    transform: translateX(calc(100vw + 30rem));
    opacity: 0;
  }
}

@keyframes ambient-sweep {
  0% {
    transform: translate3d(-2%, -1%, 0) scale(1);
  }
  100% {
    transform: translate3d(2%, 1%, 0) scale(1.04);
  }
}

@keyframes topbar-enter {
  0% {
    opacity: 0;
    transform: translateY(-1rem);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise-in {
  0% {
    opacity: 0;
    transform: translateY(1rem);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loader-fill {
  0% {
    background-position: 120% 50%;
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
  100% {
    background-position: -60% 50%;
    opacity: 0.45;
  }
}

@keyframes loader-breathe {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.035);
    filter: brightness(1.12);
  }
}

@keyframes neko-ear-twitch {
  0%,
  72%,
  100% {
    transform: rotate(0deg) scale(1);
  }
  78% {
    transform: rotate(-2deg) scale(1.015);
  }
  84% {
    transform: rotate(2deg) scale(1.015);
  }
  90% {
    transform: rotate(0deg) scale(1);
  }
}

@keyframes section-dot-glow {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.04);
    filter: brightness(1.12);
  }
}

@keyframes card-rise {
  0% {
    opacity: 0;
    transform: translateY(0.8rem) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes skeleton-sheen {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

@keyframes carousel-enter {
  0% {
    opacity: 0;
    transform: translateY(1.2rem) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes overlay-fade {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes modal-rise {
  0% {
    opacity: 0;
    transform: translateY(1.2rem) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes play-pulse {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

@keyframes poster-float {
  0%, 100% {
    transform: translateY(0) rotate(-0.25deg);
  }
  50% {
    transform: translateY(-0.55rem) rotate(0.25deg);
  }
}

@keyframes poster-aura {
  0% {
    opacity: 0.55;
    transform: scale(0.98);
  }
  100% {
    opacity: 0.9;
    transform: scale(1.04);
  }
}

@keyframes poster-border-flow {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(40deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 1150px) {
  .hero {
    min-height: auto;
  }

  .hero h1 {
    min-height: 0;
  }

  .carousel-stage {
    height: 30rem;
  }
}

@media (max-width: 760px) {
  .carousel-stage {
    grid-template-columns: 1fr;
    height: 30rem;
  }

  .carousel-info {
    max-width: 100%;
    padding-bottom: 1.8rem;
  }

  .source-status {
    right: 1.4rem;
  }

  .carousel-info h2 {
    font-size: 1.85rem;
    line-height: 1;
  }

  .carousel-poster-wrap {
    display: none;
  }
}

@media (max-width: 1150px) {
  .app-shell {
    padding: 0 0 0 5.35rem;
  }

  .topbar {
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    width: 5.35rem;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    padding: 1rem 0.7rem;
  }

  .main-nav {
    display: grid;
    overflow: visible;
    padding-bottom: 0;
  }

  .poster-grid {
    grid-auto-flow: column;
    grid-auto-columns: clamp(10.5rem, 24vw, 14rem);
    grid-template-columns: none;
  }

  .rail-shell .poster-grid {
    grid-auto-columns: calc((100% - (3 * var(--rail-gap))) / 4);
  }

  .today-carousel {
    grid-template-columns: 1fr;
  }

  .carousel-stage {
    height: auto;
    min-height: 30rem;
    padding-bottom: 5.8rem;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding-left: 5rem;
    padding-top: 0;
  }

  main {
    padding: 1rem 0.8rem 1.5rem;
  }

  .bottom-bar,
  body.sidebar-collapsed .bottom-bar {
    margin-left: -5rem;
    margin-bottom: calc(-1 * var(--footer-bleed));
    padding-left: calc(5rem + 0.8rem);
    padding-right: 0.8rem;
    padding-top: 1.65rem;
    padding-bottom: calc(1.65rem + env(safe-area-inset-bottom));
  }

  .footer-status {
    max-width: 70vw;
    text-align: center;
  }

  .bottom-bar::before,
  body.sidebar-collapsed .bottom-bar::before {
    left: 5rem;
  }

  .topbar {
    width: 5rem;
  }

  .nav-link {
    min-height: 4rem;
    font-size: 0.62rem;
  }

  .carousel-stage {
    min-height: 31rem;
    padding: 2rem 1.2rem 5.7rem;
  }
}

/* Final TV layout polish: keep library filters compact and blended. */
#library {
  padding-top: 0;
}

#library .section-heading {
  gap: 0.75rem;
  min-height: 3.25rem;
  margin-bottom: 0;
}

#library .section-heading h2 {
  font-size: clamp(1.35rem, 1.7vw, 1.9rem);
}

#library .library-dot {
  width: 1.1rem;
  height: 1.1rem;
  box-shadow: 0 0 0 0.42rem rgba(64, 223, 194, 0.12);
}

#library .filters {
  display: inline-flex;
  flex-wrap: wrap;
  width: auto;
  max-width: min(42rem, calc(100vw - 10rem));
  gap: 0.45rem;
  margin: 0 0 1rem;
  padding: 0.32rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.08);
  border-radius: 999rem;
  background: rgba(8, 10, 19, 0.34);
  box-shadow: inset 0 0 0 0.08rem rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(16px);
}

#library .filters .chip {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 2.05rem;
  padding: 0 0.85rem;
  border-radius: 999rem;
  color: rgba(246, 243, 255, 0.72);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: none;
}

#library .filters .chip.is-selected {
  color: #09101b;
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.96), rgba(242, 187, 70, 0.92));
}

#library .filters .chip:is(:hover, :focus-visible, .is-tv-focused) {
  transform: none;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 0.08rem rgba(0, 210, 255, 0.24);
}

#library .poster-grid {
  padding-top: 0.1rem;
}

@media (max-width: 760px) {
  #library .filters {
    max-width: calc(100vw - 7rem);
    border-radius: var(--radius-lg);
  }
}

/* Poster rails use two rows everywhere, like a TV streaming shelf. */
.rail-shell .poster-grid {
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (6 * var(--rail-gap))) / 7);
  grid-template-columns: none;
  grid-template-rows: repeat(2, auto);
  grid-column: 2;
  grid-row: 1;
}

/* Responsive column counts — must come AFTER the base rule above */
@media (max-width: 1150px) {
  .rail-shell .poster-grid {
    grid-auto-columns: calc((100% - (6 * var(--rail-gap))) / 7);
  }
}

@media (max-width: 760px) {
  .rail-shell {
    grid-template-columns: 2.4rem minmax(0, 1fr) 2.4rem;
    gap: 0.45rem;
  }

  .rail-shell .poster-grid {
    grid-auto-columns: calc((100% - (6 * var(--rail-gap))) / 7);
  }

  .rail-arrow {
    width: 2rem;
    height: 4rem;
    margin-top: 0;
  }
}

/* Use the full right side of the screen; arrows float over the rails. */
.rail-shell {
  margin-left: 0;
  margin-right: 0;
  padding: 0;
}

.rail-shell .poster-grid {
  padding-left: 0;
  padding-right: 0;
}

.rail-arrow-left {
  grid-column: 1;
}

.rail-arrow-right {
  grid-column: 3;
}

#library .rail-shell,
#favorites .rail-shell {
  margin-left: 0;
  margin-right: 0;
}

@media (max-width: 760px) {
  .rail-shell,
  #library .rail-shell,
  #favorites .rail-shell {
    margin-left: 0;
    margin-right: 0;
    padding: 0;
  }

  .rail-arrow-left {
    grid-column: 1;
  }

  .rail-arrow-right {
    grid-column: 3;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   Modern micro-interactions & reveals (ZenkaiTV)
   A cohesive motion layer — all covered by body.reduce-motion (instant) and
   built on transform/opacity for smooth, GPU-friendly animation.
   ════════════════════════════════════════════════════════════════════════════ */

@keyframes pop-in {
  0%   { opacity: 0; transform: translateY(0.7rem) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fade-slide {
  0%   { opacity: 0; transform: translateY(0.85rem); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── Detail-tab panes reveal when switched (display:none → block replays) ──── */
.detail-pane.is-active {
  animation: fade-slide 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Episode buttons: gentle staggered pop-in + springy hover ─────────────── */
.episode-buttons .episode-button {
  animation: pop-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.episode-buttons .episode-button:nth-child(1)  { animation-delay: 20ms; }
.episode-buttons .episode-button:nth-child(2)  { animation-delay: 40ms; }
.episode-buttons .episode-button:nth-child(3)  { animation-delay: 60ms; }
.episode-buttons .episode-button:nth-child(4)  { animation-delay: 80ms; }
.episode-buttons .episode-button:nth-child(5)  { animation-delay: 100ms; }
.episode-buttons .episode-button:nth-child(6)  { animation-delay: 120ms; }
.episode-buttons .episode-button:nth-child(7)  { animation-delay: 140ms; }
.episode-buttons .episode-button:nth-child(8)  { animation-delay: 160ms; }
.episode-buttons .episode-button:nth-child(n+9){ animation-delay: 180ms; }
.episode-button {
  transition: transform 200ms cubic-bezier(0.34, 1.3, 0.5, 1), border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.episode-button:is(:hover, :focus-visible, .is-tv-focused):not(.is-locked) {
  transform: translateY(-0.14rem) scale(1.03);
}
.episode-button:active { transform: scale(0.96); }

/* ── Season cards: staggered reveal ───────────────────────────────────────── */
.season-card-grid .season-card {
  animation: pop-in 460ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.season-card-grid .season-card:nth-child(2) { animation-delay: 70ms; }
.season-card-grid .season-card:nth-child(3) { animation-delay: 140ms; }
.season-card-grid .season-card:nth-child(4) { animation-delay: 210ms; }
.season-card-grid .season-card:nth-child(n+5) { animation-delay: 280ms; }

/* ── Nav links: lift + icon bounce + press ────────────────────────────────── */
.main-nav .nav-link {
  transition:
    min-height 360ms cubic-bezier(0.22, 1, 0.36, 1),
    font-size 320ms cubic-bezier(0.22, 1, 0.36, 1),
    letter-spacing 320ms cubic-bezier(0.22, 1, 0.36, 1),
    background 180ms ease, color 220ms ease, box-shadow 220ms ease,
    transform 240ms cubic-bezier(0.34, 1.3, 0.5, 1);
}
.main-nav .nav-link:is(:hover, :focus-visible, .is-tv-focused) {
  transform: translateY(-0.1rem);
}
body.sidebar-collapsed .main-nav .nav-link:is(:hover, :focus-visible, .is-tv-focused) {
  transform: scale(1.08);
}
.nav-link:is(:hover, :focus-visible, .is-tv-focused) span {
  transform: translateY(-0.12rem) scale(1.08);
}
.nav-link:active { transform: scale(0.96); }

/* ── Genre chips & filters: lift + press ──────────────────────────────────── */
.chip {
  transition: transform 200ms cubic-bezier(0.34, 1.3, 0.5, 1), background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}
.chip:is(:hover, :focus-visible, .is-tv-focused) { transform: translateY(-0.12rem) scale(1.04); }
.chip:active { transform: scale(0.95); }

/* ── Search boxes: focus glow + subtle lift ───────────────────────────────── */
.search-box input {
  transition: border-color 220ms ease, box-shadow 260ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1), background 220ms ease;
}
.search-box input:focus {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 0.18rem rgba(59, 130, 246, 0.16), 0 0.8rem 1.8rem rgba(0, 0, 0, 0.24);
  transform: translateY(-0.08rem);
}

/* ── Source-picker options: stagger in + hover slide ──────────────────────── */
.source-picker-options .source-picker-option {
  animation: fade-slide 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.source-picker-options .source-picker-option:nth-child(2) { animation-delay: 50ms; }
.source-picker-options .source-picker-option:nth-child(3) { animation-delay: 100ms; }
.source-picker-options .source-picker-option:nth-child(4) { animation-delay: 150ms; }
.source-picker-options .source-picker-option:nth-child(n+5) { animation-delay: 200ms; }
.source-picker-option-found {
  transition: transform 200ms cubic-bezier(0.34, 1.3, 0.5, 1), background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.source-picker-option-found:is(:hover, :focus-visible, .is-tv-focused) {
  transform: translateX(0.25rem);
}

/* ── Detail tabs & season tabs: press feedback ────────────────────────────── */
.detail-tab, .season-tab {
  transition: transform 200ms cubic-bezier(0.34, 1.3, 0.5, 1), background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}
.detail-tab:is(:hover, :focus-visible, .is-tv-focused),
.season-tab:is(:hover, :focus-visible, .is-tv-focused) {
  transform: translateY(-0.1rem);
}
.detail-tab:active, .season-tab:active { transform: scale(0.97); }

/* ── Genre/section headings: dot pulse already exists; lift the heading in ── */
.section-heading h2 {
  animation: fade-slide 480ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Favorite / secondary action buttons: press feedback ──────────────────── */
.secondary-action {
  transition: transform 200ms cubic-bezier(0.34, 1.3, 0.5, 1), background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}
.secondary-action:is(:hover, :focus-visible, .is-tv-focused) { transform: translateY(-0.1rem); }
.secondary-action:active { transform: scale(0.96); }
