/* ==========================================================================
   Stream — design system
   Minimal, light and dark. System typography, generous space, glass chrome,
   monochrome actions. Artwork is generated by the server as SVG; the UI stays
   neutral so the artwork carries the colour.
   ========================================================================== */

:root {
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;

  --header-h: 64px;
  --page-pad: clamp(16px, 4vw, 64px);
  --content-max: 1600px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Inter, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --danger: #ff453a;
  --warn: #ff9f0a;
  --ok: #30d158;
}

/* Light ------------------------------------------------------------------ */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-raised: #ffffff;
  --surface: #ffffff;
  --surface-2: #ececf0;
  --surface-3: #e1e1e6;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.15);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #8e8e93;
  --accent: #1d1d1f;
  --accent-ink: #ffffff;
  --tint: #0071e3;
  --glass: rgba(250, 250, 252, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --hover: rgba(0, 0, 0, 0.05);
  --skeleton: #e6e6eb;
  --shadow-lg: 0 24px 60px -28px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 34px -18px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 10px -4px rgba(0, 0, 0, 0.12);
}

/* Dark ------------------------------------------------------------------- */
:root[data-theme="dark"],
.dark-scope,
.hero,
.title-hero,
body[data-view="watch"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-raised: #161617;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --faint: #7c7c82;
  --accent: #f5f5f7;
  --accent-ink: #000000;
  --tint: #2997ff;
  --glass: rgba(22, 22, 23, 0.72);
  --glass-strong: rgba(28, 28, 30, 0.94);
  --hover: rgba(255, 255, 255, 0.07);
  --skeleton: #1c1c1e;
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
  --shadow-md: 0 18px 40px -22px rgba(0, 0, 0, 0.85);
  --shadow-sm: 0 2px 12px -4px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --bg-raised: #161617;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --surface-3: #3a3a3c;
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.18);
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --faint: #7c7c82;
    --accent: #f5f5f7;
    --accent-ink: #000000;
    --tint: #2997ff;
    --glass: rgba(22, 22, 23, 0.72);
    --glass-strong: rgba(28, 28, 30, 0.94);
    --hover: rgba(255, 255, 255, 0.07);
    --skeleton: #1c1c1e;
    --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
    --shadow-md: 0 18px 40px -22px rgba(0, 0, 0, 0.85);
    --shadow-sm: 0 2px 12px -4px rgba(0, 0, 0, 0.6);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

body.is-locked {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.1;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--tint);
  color: #fff;
}

:focus-visible {
  outline: 3px solid var(--tint);
  outline: 3px solid color-mix(in srgb, var(--tint) 70%, transparent);
  outline-offset: 2px;
  border-radius: 8px;
}

#main {
  flex: 1;
  width: 100%;
}

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

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 12px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.site-header.is-solid,
.site-header.is-open {
  border-bottom-color: var(--line);
}

.site-header.is-open {
  background: var(--glass-strong);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
  height: var(--header-h);
  padding: 0 var(--page-pad);
  max-width: var(--content-max);
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
}

.brand-mark svg {
  width: 14px;
  height: 14px;
  margin-left: 2px;
}

.brand-word {
  font-weight: 650;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
}

.main-nav a {
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}

.main-nav a:hover {
  color: var(--text);
}

.main-nav a.is-active {
  color: var(--text);
  background: var(--hover);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--hover);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.theme-toggle .theme-icon {
  display: none;
}

:root[data-theme-pref="auto"] .theme-toggle .theme-icon--auto,
:root[data-theme-pref="light"] .theme-toggle .theme-icon--light,
:root[data-theme-pref="dark"] .theme-toggle .theme-icon--dark,
:root:not([data-theme-pref]) .theme-toggle .theme-icon--auto {
  display: block;
}

.profile-chip {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--surface-2);
  transition: background 0.2s;
}

.profile-chip:hover {
  background: var(--surface-3);
}

.avatar {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
}

/* Search panel ------------------------------------------------------------ */

.search-panel {
  position: absolute;
  top: calc(var(--header-h) + 6px);
  right: var(--page-pad);
  left: var(--page-pad);
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 14px;
}

.search-panel[hidden] {
  display: none;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 0 16px;
  height: 52px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.search-field svg {
  width: 19px;
  height: 19px;
  color: var(--faint);
  flex-shrink: 0;
}

.search-field input {
  flex: 1;
  height: 100%;
  border: 0;
  background: none;
  outline: none;
  font-size: 17px;
}

.search-field input::placeholder {
  color: var(--faint);
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.ghost-btn {
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
  transition: color 0.2s;
}

.ghost-btn:hover {
  color: var(--text);
}

.search-results {
  margin-top: 8px;
  max-height: min(64vh, 560px);
  overflow-y: auto;
  padding: 6px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.search-results:empty {
  display: none;
}

.search-hit {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  border-radius: 11px;
  transition: background 0.15s;
}

.search-hit:hover,
.search-hit.is-selected {
  background: var(--hover);
}

.search-hit img {
  width: 40px;
  height: 60px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.search-hit-body {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.search-hit-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-hit-meta {
  font-size: 13px;
  color: var(--muted);
}

.search-hint {
  padding: 18px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.search-hint strong {
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Layout helpers
   -------------------------------------------------------------------------- */

.page {
  padding: calc(var(--header-h) + clamp(28px, 4vw, 48px)) var(--page-pad) 80px;
  max-width: var(--content-max);
  margin: 0 auto;
  animation: page-in 0.5s var(--ease) both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.page-title {
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.page-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
  max-width: 60ch;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

/* Buttons ----------------------------------------------------------------- */

.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 22px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.2s var(--ease), background 0.2s, opacity 0.2s, color 0.2s;
}

.btn:hover {
  --btn-bg: var(--surface-3);
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-ink);
}

.btn--primary:hover {
  --btn-bg: var(--accent);
  opacity: 0.86;
}

.btn--ghost {
  --btn-bg: var(--hover);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero .btn--ghost,
.title-hero .btn--ghost {
  --btn-bg: rgba(255, 255, 255, 0.16);
  --btn-fg: #fff;
}

.hero .btn--ghost:hover,
.title-hero .btn--ghost:hover {
  --btn-bg: rgba(255, 255, 255, 0.26);
}

.btn--icon {
  width: 44px;
  padding: 0;
}

.btn--sm {
  height: 36px;
  padding: 0 16px;
  font-size: 13.5px;
}

.btn--danger {
  --btn-fg: var(--danger);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Chips ------------------------------------------------------------------- */

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 15px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.18s var(--ease), color 0.18s;
}

.chip:hover {
  background: var(--surface-3);
}

.chip.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.chip .count {
  font-size: 12px;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.title-hero .chip {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.title-hero .chip:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* Meta -------------------------------------------------------------------- */

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.meta-row > * + *::before {
  content: "·";
  margin: 0 8px;
  opacity: 0.6;
}

.meta-row > * + .age-badge::before {
  content: none;
}

.meta-row > .age-badge {
  margin: 0 10px;
}

.meta-row > .age-badge:first-child {
  margin-left: 0;
}

.meta-row > .age-badge + *::before {
  content: none;
}

.rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
}

.rating svg {
  width: 13px;
  height: 13px;
}

.age-badge {
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid currentColor;
  font-size: 11px;
  font-weight: 650;
  line-height: 18px;
  letter-spacing: 0.02em;
}

.tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Hero (inset, rounded — reads well on both themes)
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  max-width: var(--content-max);
  margin: calc(var(--header-h) + 20px) auto 0;
  padding: 0 var(--page-pad);
  color: var(--text);
  background: transparent;
}

.hero-frame,
.hero > .hero-inner {
  position: relative;
}

.hero-bg {
  position: absolute;
  inset: 0 var(--page-pad);
  z-index: 0;
  border-radius: var(--radius-xl);
  background-color: #111;
  background-size: cover;
  background-position: center;
  transition: background-image 0.6s ease;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
}

/* Photos from a remote source need a flat scrim to keep the text legible. */
.hero.has-photo .hero-bg::after {
  background: rgba(0, 0, 0, 0.42);
}

.hero-inner {
  position: relative;
  z-index: 1;
  min-height: clamp(440px, 64vh, 680px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(28px, 4.5vw, 64px);
}

.hero-content {
  max-width: 640px;
  animation: hero-in 0.7s var(--ease) both;
}

@keyframes hero-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
}

.hero-kicker svg {
  width: 12px;
  height: 12px;
}

.hero-title {
  font-size: clamp(2.4rem, 5.6vw, 4.75rem);
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 1;
  text-wrap: balance;
}

.hero-meta {
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.78);
}

.hero-desc {
  margin-top: 14px;
  max-width: 52ch;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(15px, 1.15vw, 17px);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.hero-thumbs {
  position: absolute;
  right: clamp(28px, 4.5vw, 64px);
  bottom: clamp(32px, 4.5vw, 68px);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-thumb {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  transition: width 0.35s var(--ease), background 0.25s;
}

.hero-thumb img {
  display: none;
}

.hero-thumb:hover {
  background: rgba(255, 255, 255, 0.7);
}

.hero-thumb.is-active {
  width: 26px;
  background: #fff;
}

/* --------------------------------------------------------------------------
   Rows / cards
   -------------------------------------------------------------------------- */

.home-view {
  padding-bottom: 40px;
}

.row {
  margin-top: clamp(32px, 4vw, 52px);
  position: relative;
}

.row-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 14px;
  padding: 0 var(--page-pad);
  max-width: var(--content-max);
}

.row-title {
  font-size: clamp(1.2rem, 1.7vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.row-sub {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.row-more {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 14px;
  font-weight: 500;
  color: var(--tint);
  white-space: nowrap;
}

.row-more::after {
  content: "›";
  font-size: 18px;
  line-height: 1;
  margin-left: 3px;
}

.row-more:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.row-viewport {
  position: relative;
}

.row-scroller {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 6px var(--page-pad) 22px;
  max-width: var(--content-max);
  margin: 0 auto;
  scroll-padding-left: var(--page-pad);
}

.row-scroller::-webkit-scrollbar {
  display: none;
}

.row-arrow {
  position: absolute;
  top: calc(50% - 30px);
  z-index: 4;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
  color: var(--text);
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.22s, transform 0.2s var(--ease);
}

.row-arrow svg {
  width: 20px;
  height: 20px;
}

.row-arrow:hover {
  transform: translateY(-50%) scale(1.06);
}

.row-arrow--prev {
  left: max(8px, calc(var(--page-pad) - 22px));
}

.row-arrow--next {
  right: max(8px, calc(var(--page-pad) - 22px));
}

.row-viewport:hover .row-arrow:not([hidden]) {
  opacity: 1;
}

.row-arrow[hidden] {
  display: none;
}

/* Card -------------------------------------------------------------------- */

.card {
  --card-w: clamp(250px, 23vw, 340px);
  position: relative;
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-art {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card:hover .card-art,
.card:focus-within .card-art {
  transform: scale(1.035);
  box-shadow: var(--shadow-lg);
}

.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.card-badge[style*="right"] {
  display: none;
}

.card-badge--accent {
  background: rgba(255, 255, 255, 0.92);
  color: #000;
}

.card-rank {
  position: absolute;
  right: 14px;
  top: 6px;
  z-index: 2;
  font-size: 54px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.card-play {
  display: none;
}

.card-save {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s, transform 0.25s var(--ease), background 0.2s, color 0.2s;
}

.card-save svg {
  width: 15px;
  height: 15px;
}

.card:hover .card-save,
.card:focus-within .card-save,
.card-save.is-saved {
  opacity: 1;
  transform: scale(1);
}

.card-save:hover {
  background: rgba(0, 0, 0, 0.62);
}

.card-save.is-saved {
  background: #fff;
  color: #000;
}

.card-progress {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  height: 4px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.3);
}

.card-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #fff;
}

.card-progress ~ .card-save {
  bottom: 24px;
}

.card-body {
  display: grid;
  gap: 1px;
  padding: 0 2px;
}

/* The artwork already prints the title: keep it for assistive tech only. */
.card-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.card--plain .card-name {
  position: static;
  width: auto;
  height: auto;
  clip: auto;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-meta {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-episode {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.card--wide {
  --card-w: clamp(270px, 26vw, 380px);
}

/* --------------------------------------------------------------------------
   Browse
   -------------------------------------------------------------------------- */

.filters {
  display: grid;
  gap: 14px;
  padding: 4px 0 26px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.filters-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  min-width: 64px;
}

.select {
  appearance: none;
  height: 36px;
  padding: 0 34px 0 14px;
  border-radius: 999px;
  border: 0;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center / 15px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 30px 20px;
}

.grid .card {
  --card-w: 100%;
  width: 100%;
  flex: none;
}

.grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.load-more {
  display: grid;
  place-items: center;
  margin-top: 40px;
}

/* --------------------------------------------------------------------------
   Title page
   -------------------------------------------------------------------------- */

.title-page {
  padding-bottom: 80px;
  animation: page-in 0.5s var(--ease) both;
}

.title-hero {
  position: relative;
  max-width: var(--content-max);
  margin: calc(var(--header-h) + 20px) auto 0;
  padding: 0 var(--page-pad);
  color: var(--text);
}

.title-hero-bg {
  position: absolute;
  inset: 0 var(--page-pad);
  z-index: 0;
  border-radius: var(--radius-xl);
  background-color: #111;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.title-hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
}

.title-hero.has-photo .title-hero-bg::after {
  background: rgba(0, 0, 0, 0.42);
}

.title-hero-inner {
  position: relative;
  z-index: 1;
  min-height: clamp(400px, 56vh, 600px);
  display: flex;
  align-items: flex-end;
  padding: clamp(28px, 4.5vw, 60px);
}

.title-poster {
  display: none;
}

.title-info {
  max-width: 720px;
}

.title-info .eyebrow {
  color: rgba(255, 255, 255, 0.75);
}

.title-name {
  font-size: clamp(2.3rem, 5vw, 4.25rem);
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 1;
  text-wrap: balance;
}

.title-original {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 15px;
}

.title-tagline {
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.title-meta {
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.75);
}

.title-genres {
  margin-top: 16px;
}

.title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.title-body {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(32px, 4vw, 52px) var(--page-pad) 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

.synopsis {
  color: var(--text);
  font-size: 17px;
  line-height: 1.6;
  max-width: 68ch;
}

.synopsis.is-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-btn {
  color: var(--tint);
  font-size: 14px;
  font-weight: 500;
  margin-top: 8px;
}

.link-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.side-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}

.side-card h3 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.side-card > p {
  color: var(--faint) !important;
}

.detail-list {
  display: grid;
  gap: 0;
  font-size: 14px;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-list div:first-child {
  padding-top: 0;
}

.detail-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  text-align: right;
  color: var(--text);
  font-weight: 500;
}

.cast-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.cast-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13.5px;
}

.cast-chip strong {
  font-weight: 600;
}

.cast-chip em {
  font-style: normal;
  color: var(--muted);
  font-size: 12.5px;
}

/* Episodes ---------------------------------------------------------------- */

.seasons {
  margin-top: clamp(36px, 4vw, 52px);
}

.season-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.season-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}

.season-tab {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.2s var(--ease);
}

.season-tab:hover {
  color: var(--text);
}

.season-tab.is-active {
  background: var(--bg-raised);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.episode-list {
  display: grid;
  gap: 6px;
}

.episode {
  display: grid;
  grid-template-columns: 36px 200px minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 2vw, 22px);
  padding: 12px;
  border-radius: var(--radius-lg);
  transition: background 0.2s;
}

.episode:hover {
  background: var(--hover);
}

.episode-index {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.episode.is-current .episode-index {
  color: var(--text);
}

.episode-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
}

.episode-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.episode-thumb .play-mini {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  background: rgba(0, 0, 0, 0.18);
  transition: opacity 0.2s;
}

.episode-thumb .play-mini span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #000;
}

.episode-thumb .play-mini svg {
  width: 15px;
  height: 15px;
  margin-left: 2px;
}

.episode:hover .play-mini {
  opacity: 1;
}

.episode-body {
  min-width: 0;
}

.episode-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.episode-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.episode-foot {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-size: 12.5px;
  font-weight: 500;
}

.episode-foot .bar {
  width: 92px;
  height: 4px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}

.episode-foot .bar span {
  display: block;
  height: 100%;
  background: var(--text);
}

.episode-action {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  transition: background 0.2s, color 0.2s, transform 0.2s var(--ease);
}

.episode-action:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.episode-action svg {
  width: 16px;
  height: 16px;
  margin-left: 2px;
}

.movie-cta {
  margin-top: 36px;
  padding: clamp(22px, 3vw, 32px);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.movie-cta h3 {
  font-size: clamp(1.15rem, 1.7vw, 1.4rem);
}

.movie-cta p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   Watch / player
   -------------------------------------------------------------------------- */

body[data-view="watch"] .site-header,
body[data-view="watch"] .site-footer {
  display: none;
}

body[data-view="watch"] {
  background: #000;
}

.watch {
  min-height: 100dvh;
  background: #000;
  display: flex;
  flex-direction: column;
}

.watch-stage {
  position: relative;
  background: #000;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  background: #000;
  overflow: hidden;
  user-select: none;
}

.player.is-idle {
  cursor: none;
}

.player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.player-top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px clamp(16px, 3vw, 34px);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  transition: opacity 0.3s, transform 0.3s var(--ease);
}

.player.is-idle .player-top {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.player-back {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  backdrop-filter: blur(8px);
  transition: background 0.2s;
}

.player-back:hover {
  background: rgba(255, 255, 255, 0.2);
}

.player-back svg {
  width: 20px;
  height: 20px;
}

.player-titles {
  min-width: 0;
}

.player-titles h1 {
  font-size: clamp(15px, 1.5vw, 19px);
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-titles p {
  margin-top: 2px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-center {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.big-play {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  pointer-events: auto;
  transition: transform 0.25s var(--ease), background 0.2s, opacity 0.25s;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.9);
}

.big-play:hover {
  transform: scale(1.06);
  background: rgba(255, 255, 255, 0.2);
}

.big-play svg {
  width: 32px;
  height: 32px;
  margin-left: 4px;
}

.player.is-playing .big-play {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

.player-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.player-controls {
  position: absolute;
  inset: auto 0 0;
  z-index: 6;
  padding: 16px clamp(14px, 3vw, 30px) clamp(14px, 2.4vw, 22px);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  transition: opacity 0.3s, transform 0.3s var(--ease);
}

.player.is-idle .player-controls {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

.timeline {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.timeline-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.24);
  overflow: hidden;
  transition: height 0.18s var(--ease);
}

.timeline:hover .timeline-track {
  height: 7px;
}

.timeline-buffer {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(255, 255, 255, 0.34);
  width: 0;
}

.timeline-played {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--accent);
}

.timeline-played::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%) scale(0);
  transition: transform 0.16s var(--ease);
}

.timeline:hover .timeline-played::after {
  transform: translateY(-50%) scale(1);
}

.timeline-tip {
  position: absolute;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(8, 9, 13, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.timeline:hover .timeline-tip {
  opacity: 1;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1vw, 12px);
  margin-top: 6px;
}

.ctrl {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.88);
  transition: background 0.18s, color 0.18s;
  flex-shrink: 0;
}

.ctrl:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.ctrl svg {
  width: 21px;
  height: 21px;
}

.ctrl--sm svg {
  width: 19px;
  height: 19px;
}

.ctrl.is-active {
  color: var(--accent);
}

.ctrl-time {
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0 4px;
}

.ctrl-time .sep {
  opacity: 0.45;
  margin: 0 2px;
}

.spacer {
  flex: 1;
}

.volume {
  display: flex;
  align-items: center;
  gap: 4px;
}

.volume-slider {
  width: 0;
  opacity: 0;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.3);
  transition: width 0.25s var(--ease), opacity 0.25s;
  cursor: pointer;
}

.volume:hover .volume-slider,
.volume-slider:focus-visible {
  width: 86px;
  opacity: 1;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 0;
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.ctrl-badge {
  position: relative;
}

.ctrl-badge[data-active="true"]::after {
  content: "";
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* Player menus ------------------------------------------------------------ */

.menu-anchor {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  min-width: 210px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 14, 20, 0.97);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.95);
  animation: menu-in 0.18s var(--ease) both;
  z-index: 10;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.menu[hidden] {
  display: none;
}

.menu-title {
  padding: 6px 10px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.86);
  text-align: left;
  transition: background 0.15s;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.menu-item.is-active {
  color: var(--accent);
  font-weight: 600;
}

.menu-item small {
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
}

.menu-check {
  width: 14px;
  height: 14px;
  opacity: 0;
}

.menu-item.is-active .menu-check {
  opacity: 1;
}

/* Next episode / end card ------------------------------------------------ */

.end-card {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  animation: fade-in 0.4s var(--ease) both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.end-card-inner {
  width: min(560px, calc(100vw - 40px));
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(14, 16, 22, 0.96);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.end-card-inner h2 {
  font-size: 20px;
  margin-bottom: 6px;
}

.end-card-inner p {
  color: var(--muted);
  font-size: 13.5px;
}

.end-card-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.countdown {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

/* Player states ---------------------------------------------------------- */

.player-error {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #000;
  text-align: center;
}

.player-error-inner {
  max-width: 460px;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.player-error h2 {
  font-size: 20px;
}

.player-error p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.player-error code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
}

.next-banner {
  position: absolute;
  right: clamp(16px, 3vw, 34px);
  bottom: 116px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 12, 17, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-md);
  animation: menu-in 0.3s var(--ease) both;
}

.next-banner img {
  width: 96px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
}

.next-banner .label {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.next-banner .name {
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 3px;
  max-width: 26ch;
}

/* Watch meta under the player --------------------------------------------- */

.watch-info {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(24px, 3vw, 40px) var(--page-pad) 64px;
  display: grid;
  gap: 16px;
  color: var(--text);
}

.watch-info-head {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.watch-info h2 {
  font-size: clamp(1.3rem, 2vw, 1.75rem);
}

.watch-info .desc {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 70ch;
}

.watch-episodes {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 8px;
  scrollbar-width: none;
}

.watch-episodes::-webkit-scrollbar {
  display: none;
}

.ep-pill {
  display: grid;
  gap: 2px;
  min-width: 150px;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
  text-align: left;
}

.ep-pill:hover {
  background: var(--surface-2);
  color: var(--text);
}

.ep-pill.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.ep-pill strong {
  font-size: 12px;
  font-weight: 650;
}

/* --------------------------------------------------------------------------
   States: skeleton, empty, error
   -------------------------------------------------------------------------- */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--skeleton);
  border-radius: var(--radius);
}

.skeleton {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

.skeleton-card {
  aspect-ratio: 16 / 9;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  margin-top: 10px;
}

.empty {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: clamp(52px, 9vw, 110px) 20px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
}

.empty-icon svg {
  width: 26px;
  height: 26px;
}

.empty h2 {
  font-size: 22px;
}

.empty p {
  color: var(--muted);
  font-size: 15px;
  max-width: 46ch;
}

.empty .btn {
  margin-top: 8px;
}

.error-box {
  margin: 90px auto;
  max-width: 520px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}

.error-box h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.error-box p {
  color: var(--muted);
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 200;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  justify-self: center;
  animation: toast-in 0.32s var(--ease) both;
  pointer-events: auto;
}

.toast.is-leaving {
  animation: toast-out 0.25s var(--ease) both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}

.toast--error .toast-dot {
  background: var(--danger);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 48px;
  color: var(--muted);
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 32px var(--page-pad) 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 32px;
  font-size: 13px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand .brand-word {
  font-size: 15px;
  color: var(--text);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-note {
  flex-basis: 100%;
  color: var(--faint);
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1000px) {
  .title-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .episode {
    grid-template-columns: 30px 160px minmax(0, 1fr) auto;
  }
}

@media (max-width: 820px) {
  :root {
    --header-h: 58px;
  }

  .main-nav a {
    padding: 6px 10px;
  }

  .main-nav a[data-nav="watchlist"] {
    display: none;
  }

  .hero,
  .title-hero {
    margin-top: calc(var(--header-h) + 12px);
  }

  .hero-inner {
    min-height: 68vh;
    padding: 24px 22px 54px;
  }

  .hero-thumbs {
    left: 22px;
    right: auto;
    bottom: 24px;
  }

  .hero-desc {
    -webkit-line-clamp: 2;
  }

  .title-hero-inner {
    min-height: 60vh;
    padding: 24px 22px 28px;
  }

  .episode {
    grid-template-columns: 120px minmax(0, 1fr);
    padding: 10px;
  }

  .episode-index,
  .episode-action {
    display: none;
  }

  .search-panel {
    left: 10px;
    right: 10px;
  }

  .next-banner {
    left: 16px;
    right: 16px;
    bottom: 104px;
  }

  .next-banner .name {
    max-width: none;
  }

  .player-controls {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 560px) {
  .brand-word {
    display: none;
  }

  .main-nav {
    font-size: 13.5px;
  }

  .card {
    --card-w: 78vw;
  }

  .card--wide {
    --card-w: 80vw;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hero-actions .btn,
  .title-actions .btn {
    flex: 1;
  }

  .hero-actions .btn--icon,
  .title-actions .btn--icon {
    flex: 0 0 44px;
  }

  .title-actions .btn--primary {
    flex: 1 1 100%;
  }

  .row-arrow {
    display: none;
  }

  .episode {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
  }

  .episode-desc {
    -webkit-line-clamp: 2;
    font-size: 13px;
  }
}

@media (hover: none) {
  .card-save {
    opacity: 1;
    transform: none;
  }

  .row-arrow {
    display: none !important;
  }
}

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

/* --------------------------------------------------------------------------
   Component glue
   -------------------------------------------------------------------------- */

[hidden] {
  display: none !important;
}

.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.btn.is-saved {
  --btn-fg: var(--text);
}

.hero .btn.is-saved,
.title-hero .btn.is-saved {
  --btn-bg: #fff;
  --btn-fg: #000;
}

.pager-line {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 300;
  height: 2px;
  width: 0;
  background: var(--tint);
  transition: width 0.3s var(--ease), opacity 0.3s;
  opacity: 0;
}

.pager-line.is-loading {
  opacity: 1;
  animation: pager 1.4s ease-in-out infinite;
}

@keyframes pager {
  0% {
    width: 0;
    transform: translateX(0);
  }
  60% {
    width: 70%;
    transform: translateX(10%);
  }
  100% {
    width: 92%;
    transform: translateX(4%);
  }
}

.search-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 600px;
  margin-top: 4px;
  padding: 5px 5px 5px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.search-inline svg {
  color: var(--faint);
  flex-shrink: 0;
}

.search-inline input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 0;
  background: none;
  outline: none;
  font-size: 16px;
}

.search-inline input::placeholder {
  color: var(--faint);
}

/* --------------------------------------------------------------------------
   Admin panel
   -------------------------------------------------------------------------- */

.admin {
  max-width: 880px;
}

.admin-grid {
  display: grid;
  gap: 20px;
}

.panel {
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.panel-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  max-width: 60ch;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label,
.field .label {
  font-size: 13.5px;
  font-weight: 600;
}

.field .hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.input,
.field select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus,
.field select:focus {
  border-color: var(--tint);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tint) 18%, transparent);
}

.input--mono {
  font-family: var(--mono);
  font-size: 13.5px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.segmented {
  display: inline-flex;
  justify-self: start;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: var(--surface-2);
}

.segmented label {
  position: relative;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: block;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.2s var(--ease);
}

.segmented input:checked + span {
  background: var(--bg-raised);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.segmented input:focus-visible + span {
  outline: 3px solid var(--tint);
  outline: 3px solid color-mix(in srgb, var(--tint) 60%, transparent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.stat {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg);
}

.stat dt {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.stat dd {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}

.pill--ok::before {
  background: var(--ok);
}

.pill--warn::before {
  background: var(--warn);
}

.pill--error::before {
  background: var(--danger);
}

.notice {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

.notice--ok {
  box-shadow: inset 3px 0 0 var(--ok);
}

.notice--error {
  box-shadow: inset 3px 0 0 var(--danger);
}

.notice ul {
  margin-top: 6px;
  padding-left: 18px;
  list-style: disc;
  color: var(--muted);
}

.login-card {
  max-width: 400px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   TV mode (html.tv): remote-control navigation, viewed from the sofa.
   Focus must be unmistakable at 3 metres; hover affordances are useless.
   -------------------------------------------------------------------------- */

.tv body {
  font-size: 18px;
}

.tv {
  --page-pad: 64px;
  --header-h: 72px;
}

.tv :focus,
.tv :focus-visible {
  outline: none;
}

.tv .btn:focus,
.tv .chip:focus,
.tv .season-tab:focus,
.tv .main-nav a:focus,
.tv .icon-btn:focus,
.tv .profile-chip:focus,
.tv .brand:focus,
.tv .row-more:focus,
.tv .link-btn:focus,
.tv .ep-pill:focus,
.tv .hero-thumb:focus,
.tv .select:focus,
.tv .footer-links a:focus,
.tv .ctrl:focus,
.tv .player-back:focus,
.tv .menu-item:focus {
  outline: 4px solid var(--text);
  outline-offset: 4px;
  border-radius: 999px;
  transform: scale(1.06);
  transition: transform 0.18s var(--ease), outline-offset 0.18s;
}

.tv .player .ctrl:focus,
.tv .player-back:focus {
  outline-color: #fff;
}

.tv .menu-item:focus {
  border-radius: 10px;
  transform: none;
  background: rgba(255, 255, 255, 0.14);
}

.tv .card:focus-within .card-art {
  transform: scale(1.07);
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 8px var(--text), var(--shadow-lg);
}

.tv .card:focus-within .card-meta {
  color: var(--text);
}

.tv .row-scroller {
  padding-top: 16px;
  padding-bottom: 30px;
}

.tv .episode:focus-within {
  background: var(--hover);
  box-shadow: inset 0 0 0 3px var(--text);
}

.tv .episode:focus-within .play-mini {
  opacity: 1;
}

.tv .search-hit:focus {
  background: var(--hover);
  box-shadow: inset 0 0 0 3px var(--text);
}

.tv .row-arrow,
.tv .card-save,
.tv .episode-action,
.tv .skip-link {
  display: none !important;
}

.tv .hero-inner {
  min-height: 70vh;
}

.tv .player.is-idle :focus {
  outline-color: transparent;
}
