@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700;800;900&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: dark;
  --bg: #070e1e;
  --bg-base: #050c19;
  --surface: rgba(13, 22, 46, 0.45);
  --surface-strong: rgba(17, 30, 62, 0.65);
  --surface-raised: rgba(22, 38, 79, 0.8);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #ffffff;
  --muted: #8892b0;
  --soft: #a8b2d1;
  --danger: #ff4d4d;
  --ok: #4ade80;

  /* Theme Accents (Ocean Blue default) */
  --accent-category: #c084fc;
  --accent-category-glow: rgba(192, 132, 252, 0.7);
  --accent-channel: #4ade80;
  --accent-channel-glow: rgba(74, 222, 128, 0.7);
  --accent-focus: rgba(74, 222, 128, 0.85);
  --accent-focus-glow: rgba(74, 222, 128, 0.35);

  /* Ambient Glow Blobs */
  --ambient-1: rgba(25, 45, 95, 0.45);
  --ambient-2: rgba(15, 30, 70, 0.25);
  --ambient-body-1: rgba(20, 35, 75, 0.5);
  --ambient-body-2: rgba(10, 20, 50, 0.4);
  --ambient-body-3: rgba(13, 24, 52, 0.55);
}

html,
body,
.app {
  width: 100%;
  height: 100%;
  min-height: 100vh;
}

body {
  background: 
    radial-gradient(circle at 10% 20%, var(--ambient-body-1) 0%, transparent 60%),
    radial-gradient(circle at 90% 80%, var(--ambient-body-2) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, var(--ambient-body-3) 0%, transparent 70%),
    var(--bg-base);
  color: var(--text);
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

/* Rich atmospheric background — applied per-screen for depth control */
@keyframes ambientGradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes subtlePulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.65; }
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.screen {
  width: 100vw;
  height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

.center-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Atmospheric background for login/profile screens */
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(40, 30, 20, 0.5) 0%, transparent 70%),
    radial-gradient(ellipse 50% 80% at 20% 80%, rgba(20, 15, 30, 0.4) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 85% 20%, rgba(25, 20, 15, 0.3) 0%, transparent 55%),
    #06060a;
}

/* ===== LOGIN PANEL ===== */
.panel {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(22, 23, 28, 0.95) 0%, rgba(15, 16, 20, 0.98) 100%);
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 80px rgba(0, 0, 0, 0.7),
    0 8px 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.brand {
  margin-bottom: 24px;
}

.brand-title {
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #fff 20%, #a09a90 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle,
.muted,
.meta,
.hint {
  color: var(--muted);
}

.brand-subtitle {
  margin-top: 8px;
  font-size: 14px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label {
  color: var(--soft);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.field input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  background: rgba(6, 6, 10, 0.6);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ===== SHARED INTERACTIVE ELEMENT STYLES ===== */
.button,
.profile-card,
.poster-card,
.poster-main,
.episode-card,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s cubic-bezier(0.2, 0, 0, 1), background-color 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s cubic-bezier(0.2, 0, 0, 1), transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.button {
  padding: 13px 16px;
  border-color: transparent;
  background: linear-gradient(180deg, #f0ebe3 0%, #d6d0c6 100%);
  color: #0a0a0c;
  font-weight: 700;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.3px;
}

.button.secondary {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  box-shadow: none;
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.field input:focus,
.button:focus-visible,
.profile-card:focus-visible,
.poster-card:focus-visible,
.poster-main:focus-visible,
.episode-card:focus-visible,
.icon-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.3);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.status {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

/* ===== PROFILES ===== */
.profiles-wrap {
  width: min(920px, 100%);
}

.screen-title {
  margin-bottom: 20px;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.3px;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
}

.profile-card {
  min-height: 118px;
  padding: 18px;
  text-align: left;
  background: linear-gradient(165deg, var(--surface-strong) 0%, var(--surface) 100%);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.profile-card.focused,
.poster-card.focused,
.episode-card.focused {
  border-color: rgba(255, 255, 255, 0.35);
  background: var(--surface-raised);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 60px rgba(255, 255, 255, 0.03);
}

.profile-initial {
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--soft);
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.03);
}

/* ===== BROWSE SCREEN ===== */
.browse-screen {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100vw;
  height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: 
    radial-gradient(circle at 0% 100%, var(--ambient-1) 0%, transparent 60%),
    radial-gradient(circle at 100% 0%, var(--ambient-2) 0%, transparent 50%),
    transparent;
  overflow: hidden;
  box-sizing: border-box;
}

.detail-screen {
  display: flex;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  position: relative;
  background: 
    radial-gradient(circle at 0% 100%, var(--ambient-1) 0%, transparent 60%),
    var(--bg-base);
}

/* ===== INFO PILLS (Bottom-left category/channel selectors) ===== */
.selected-info-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 0;
  margin-bottom: 8px;
}

.category-row,
.channel-row {
  display: flex;
  flex-direction: row;
  gap: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  width: 100%;
  padding: 4px 0;
}

.category-row::-webkit-scrollbar,
.channel-row::-webkit-scrollbar {
  display: none;
}

.info-pill {
  border: none !important;
  border-bottom: 2px solid transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: 'Figtree', sans-serif;
  font-size: clamp(14px, 1.6vw, 18px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 0 4px 0 !important;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  color: var(--muted) !important;
  -webkit-text-fill-color: var(--muted) !important;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  position: relative;
}

.info-pill.selected {
  color: var(--soft) !important;
  -webkit-text-fill-color: var(--soft) !important;
  border-bottom-color: rgba(255, 255, 255, 0.15) !important;
}

.info-pill.selected::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulseGreen 1.6s infinite alternate;
  flex-shrink: 0;
}

.info-pill:focus,
.info-pill.focused {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  border-bottom-color: #fff !important;
  transform: translateY(-1px);
}

.info-pill-secondary {
  border: none !important;
  border-bottom: 2px solid transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: 'Figtree', sans-serif !important;
  color: var(--muted) !important;
  -webkit-text-fill-color: var(--muted) !important;
  font-size: clamp(12px, 1.4vw, 15px) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px;
  padding: 0 0 4px 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
  outline: none !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  white-space: nowrap;
  position: relative;
}

.info-pill-secondary.selected {
  color: var(--soft) !important;
  -webkit-text-fill-color: var(--soft) !important;
  border-bottom-color: rgba(255, 255, 255, 0.12) !important;
}

.info-pill-secondary.selected::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--ok);
  box-shadow: 0 0 6px var(--ok);
  animation: pulseGreen 1.6s infinite alternate;
  flex-shrink: 0;
}

.info-pill-secondary:focus,
.info-pill-secondary.focused {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  border-bottom-color: #fff !important;
  transform: translateY(-1px);
}

@keyframes pulseGreen {
  0% {
    transform: scale(0.85);
    opacity: 0.75;
    box-shadow: 0 0 3px var(--ok);
  }
  100% {
    transform: scale(1.15);
    opacity: 1;
    box-shadow: 0 0 8px var(--ok);
  }
}

@media (orientation: portrait) and (max-width: 900px) {
  .selected-info-bar {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }

  .info-pill {
    font-size: 18px;
    padding: 0;
  }

  .info-pill-secondary {
    font-size: 12px;
  }
}

.profile-name {
  font-size: 14px;
  font-weight: 700;
}

.content-area {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 0;
  overflow: hidden;
}

.empty-library-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(40, 30, 20, 0.5) 0%, transparent 70%),
    #06060a;
}

.empty-library-panel {
  width: min(720px, 100%);
  padding: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: linear-gradient(165deg, var(--surface-strong) 0%, var(--surface) 100%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.empty-copy {
  margin: 10px 0 26px;
  color: var(--muted);
}

.empty-add-card {
  width: min(240px, 100%);
  aspect-ratio: 2 / 1;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.empty-add-card.focused,
.empty-add-card:focus-visible {
  border-color: rgba(255, 255, 255, 0.4);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.4);
  background: rgba(255, 255, 255, 0.03);
}

.content-header {
  padding: 0 clamp(24px, 4vw, 50px);
  margin-bottom: 18px;
}

.content-title {
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.15;
}

.content-kicker {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.notice {
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
}

/* ===== POSTER ROW & CARDS ===== */
.poster-row {
  min-height: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.8vw, 20px);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px clamp(24px, 4vw, 50px) 18px;
  scrollbar-width: none;
}

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

.poster-card {
  width: clamp(170px, 17vw, 220px);
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  opacity: 0.5;
  text-align: center;
  cursor: default;
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), opacity 0.25s cubic-bezier(0.2, 0, 0, 1);
  will-change: transform, opacity;
}

.filter-card {
  width: clamp(180px, 18vw, 230px);
}

.poster-card.focused {
  opacity: 1;
  transform: scale(1.08);
}

.poster-main {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: center;
}

.poster-image {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.25s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.25s cubic-bezier(0.2, 0, 0, 1);
  will-change: border-color, box-shadow;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.poster-main:focus-visible .poster-image {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.15);
}

.poster-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.poster-add .poster-image {
  border-style: dashed;
  border-color: var(--line-strong);
}

.filter-card .poster-image {
  aspect-ratio: 2 / 3;
  padding: 18px;
  align-items: flex-start;
  justify-content: flex-end;
  flex-direction: column;
  text-align: left;
}

.filter-card.selected .poster-image {
  border-color: var(--text);
}

.filter-card-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.filter-card-value {
  margin-top: 8px;
  color: var(--text);
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 800;
  line-height: 1.1;
}

/* Duplicate block preserved from original */
.poster-main:focus-visible .poster-image {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.15);
}

.poster-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.poster-add .poster-image {
  border-style: dashed;
  border-color: var(--line-strong);
}

.filter-card .poster-image {
  aspect-ratio: 2 / 3;
  padding: 18px;
  align-items: flex-start;
  justify-content: flex-end;
  flex-direction: column;
  text-align: left;
}

.filter-card.selected .poster-image {
  border-color: var(--text);
}

.filter-card-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.filter-card-value {
  margin-top: 8px;
  color: var(--text);
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 800;
  line-height: 1.1;
}

.poster-add-symbol {
  color: var(--soft);
  font-size: 32px;
  font-weight: 700;
}

.poster-title {
  min-height: 36px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.poster-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

/* ===== DETAIL SCREEN ===== */
.detail-sidebar {
  width: clamp(280px, 30vw, 360px);
  padding: 40px 24px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.detail-poster {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 2 / 3;
  margin: 0 auto 24px auto;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.7),
    0 8px 20px rgba(0, 0, 0, 0.4);
}

.detail-poster img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.detail-info {
  text-align: center;
  width: 100%;
}

/* Dokunmatik Tetikleyici Buton */
.detail-drawer-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: all 0.2s ease;
}

.detail-drawer-trigger:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: var(--surface-raised);
}

/* Sol Açılır Yan Panel */
.detail-drawer {
  position: fixed;
  left: 0;
  top: 0;
  height: 100dvh;
  width: 320px;
  background: rgba(15, 16, 20, 0.9);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-right: 1px solid var(--line);
  padding: 40px 24px;
  box-sizing: border-box;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.detail-drawer.open {
  transform: translateX(0);
}

.detail-drawer-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -0.01em;
  text-align: left;
}

/* Karartma Backdrop Alanı */
.detail-drawer-overlay {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 99;
}

.detail-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-actions-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.detail-action-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 18px;
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  width: 100%;
}

.detail-action-btn.focused {
  border-color: rgba(255, 255, 255, 0.4);
  background: var(--surface-raised);
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(255, 255, 255, 0.02);
  transform: translateY(-1px);
}

.detail-title {
  font-size: 20px;
  line-height: 1.3;
}

.description {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

/* ===== EPISODES ===== */
.episodes-area {
  min-width: 0;
  flex: 1;
  padding: 28px clamp(24px, 4vw, 48px);
  overflow-y: auto;
}

.episodes-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.episode-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  opacity: 0.5;
  border-radius: 12px;
  transition: opacity 0.2s cubic-bezier(0.2, 0, 0, 1), background-color 0.2s cubic-bezier(0.2, 0, 0, 1), border-color 0.2s cubic-bezier(0.2, 0, 0, 1);
  will-change: opacity, background-color;
  position: relative;
  overflow: hidden;
  text-align: left;
}

.episode-progress-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 10;
}

.episode-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8a2be2, #00b050);
  box-shadow: 0 0 8px rgba(0, 176, 80, 0.6);
}

.episode-card.focused {
  opacity: 1;
  background: rgba(255, 255, 255, 0.03);
}

.episode-thumb {
  position: relative;
  width: clamp(120px, 18vw, 180px);
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.episode-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.episode-title {
  font-weight: 700;
}

/* ===== PLAYER ===== */
.player-screen {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  padding: 0 !important;
}

.player-video {
  width: 100%;
  height: 100%;
  background: #000;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  background: rgba(0, 0, 0, 0.72);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Player Custom Controls Overlay */
.player-controls-container {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(40px, env(safe-area-inset-top)) max(48px, env(safe-area-inset-right))
    max(40px, env(safe-area-inset-bottom)) max(48px, env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.8) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.player-controls-container.visible {
  opacity: 1;
  pointer-events: auto;
}

.player-top-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
}

.player-exit-btn,
.player-settings-btn {
  background: rgba(0, 0, 0, 0.5) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
  cursor: pointer;
}

.player-exit-btn:hover,
.player-exit-btn:active,
.player-settings-btn:hover,
.player-settings-btn:active {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: #fff !important;
  transform: scale(1.08);
}

.player-bottom-controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  pointer-events: auto;
}

.player-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

.player-title-text {
  font-family: 'Figtree', sans-serif;
  color: #fff;
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-time-text {
  font-family: 'Figtree', sans-serif;
  color: var(--soft);
  font-size: clamp(13px, 1.5vw, 15px);
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.player-seek-bar-container {
  position: relative;
  width: 100%;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.player-seek-bar-bg {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  transition: height 0.15s ease;
}

.player-seek-bar-fill {
  position: absolute;
  left: 0;
  height: 4px;
  background: #eae6e0;
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(234, 230, 224, 0.3);
  transition: height 0.15s ease;
}

.player-seek-bar-container:hover .player-seek-bar-bg,
.player-seek-bar-container:hover .player-seek-bar-fill {
  height: 6px;
}

.empty {
  color: var(--muted);
  padding: 20px 0;
}

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

@media (orientation: portrait) and (max-width: 900px) {
  .screen {
    height: 100dvh;
  }

  .profiles-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .detail-sidebar {
    width: 170px;
    padding: 18px 10px;
  }

  .detail-poster {
    width: 128px;
  }

  .detail-title {
    font-size: 15px;
  }

  .description,
  .detail-sidebar .meta {
    font-size: 11px;
  }

  .episodes-area {
    padding: 18px 16px;
  }

  .episode-card {
    gap: 10px;
  }

  .episode-thumb {
    width: 96px;
  }
}

/* ===== LEFT SIDEBAR SELECTOR DRAWER ===== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  animation: fadeIn 0.25s ease-out;
}

.category-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(340px, 85vw);
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
  border-right: 1px solid var(--line-strong);
  z-index: 1001;
  box-shadow: 20px 0 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  padding: 32px 20px;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.category-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.drawer-search-container {
  margin-bottom: 20px;
  padding: 0 4px;
}

.drawer-search-input {
  width: 100%;
  padding: 12px 16px;
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-sizing: border-box;
  outline: none;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.drawer-search-input.focused,
.drawer-search-input:focus {
  border-color: var(--accent-focus);
  background: var(--surface-raised);
  box-shadow: 
    0 0 0 1px var(--accent-focus),
    0 0 12px var(--accent-focus-glow);
}

.drawer-title {
  font-family: 'Figtree', sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text);
}

.drawer-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  transition: all 0.15s ease;
}

.drawer-close:hover,
.drawer-close:focus {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.drawer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.drawer-list::-webkit-scrollbar {
  width: 4px;
}
.drawer-list::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 2px;
}

.drawer-item {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: 'Figtree', sans-serif;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}

.drawer-item.selected {
  color: var(--text);
  font-weight: 700;
}

.drawer-type .drawer-item.selected {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.drawer-channel .drawer-item.selected {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.drawer-item:focus,
.drawer-item.focused {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* ===== BROWSE LAYOUT ===== */
.browse-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  flex-shrink: 0;
}

.top-left-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-right-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  margin-left: auto;
}

.mode-title {
  font-family: 'Figtree', sans-serif;
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 700;
  color: var(--soft);
  margin: 0;
  letter-spacing: -0.3px;
}

.circular-back-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  outline: none;
  padding: 0;
  flex-shrink: 0;
}

.circular-back-button:hover,
.circular-back-button:active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  transform: scale(1.05);
}

.browse-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  flex-shrink: 0;
}

.selected-content-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

.content-info-title {
  font-family: 'Figtree', sans-serif;
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 700;
  color: #fff;
  margin: 0;
  text-transform: none;
  letter-spacing: -0.3px;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.content-info-meta {
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

.bottom-right-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  pointer-events: none;
}

.profile-avatar-mini {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--line-strong);
}

.profile-name-text {
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.poster-row .poster-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* ===== FOCUSED POSTER CARD — cinematic highlight ===== */
.poster-card.focused .poster-image {
  border-color: var(--accent-focus);
  border-width: 2px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 20px var(--accent-focus-glow),
    0 20px 60px rgba(0, 0, 0, 0.7);
}

.detail-back-button {
  align-self: flex-start;
  margin-bottom: 24px;
}

.detail-tags-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  margin-top: 14px;
}

.detail-tag-channel {
  font-family: 'Figtree', sans-serif !important;
  color: var(--soft) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.detail-tag-type {
  font-family: 'Figtree', sans-serif !important;
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
}

/* ===== LOGIN SCREEN (JS class aliases) ===== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(40, 30, 20, 0.5) 0%, transparent 70%),
    radial-gradient(ellipse 50% 80% at 20% 80%, rgba(20, 15, 30, 0.4) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 85% 20%, rgba(25, 20, 15, 0.3) 0%, transparent 55%),
    #06060a;
}

.login-container {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(22, 23, 28, 0.95) 0%, rgba(15, 16, 20, 0.98) 100%);
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 80px rgba(0, 0, 0, 0.7),
    0 8px 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.login-logo {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  background: linear-gradient(180deg, #fff 20%, #a09a90 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}

.login-title {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  background: rgba(6, 6, 10, 0.6);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-size: 15px;
}

.login-input:focus,
.login-input.focused {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
  outline: none;
}

.login-submit-btn {
  padding: 13px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #f0ebe3 0%, #d6d0c6 100%);
  color: #0a0a0c;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.login-submit-btn:focus,
.login-submit-btn.focused {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15), 0 2px 8px rgba(0, 0, 0, 0.3);
  outline: none;
}

.login-submit-btn:hover {
  transform: translateY(-1px);
}

.login-submit-btn.secondary {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  box-shadow: none;
}

.login-submit-btn.secondary:focus,
.login-submit-btn.secondary.focused {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
  outline: none;
}

.login-submit-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

/* ===== PROFILES SCREEN (JS class aliases) ===== */
.profiles-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(40, 30, 20, 0.5) 0%, transparent 70%),
    radial-gradient(ellipse 50% 80% at 20% 80%, rgba(20, 15, 30, 0.4) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 85% 20%, rgba(25, 20, 15, 0.3) 0%, transparent 55%),
    #06060a;
}

.profiles-container {
  width: min(920px, 100%);
}

.profiles-title {
  margin-bottom: 20px;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.3px;
}

.profiles-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 10px;
}

.profile-avatar.child {
  border-color: rgba(122, 173, 90, 0.3);
  background: rgba(122, 173, 90, 0.08);
}

.initials {
  color: var(--soft);
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
}

.profile-role-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ===== BROWSE SCREEN (JS class aliases) ===== */
.browse-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  flex-shrink: 0;
  margin-bottom: 12px;
}

.browse-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.parent-category {
  font-size: clamp(14px, 1.6vw, 18px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.sub-category {
  font-size: clamp(12px, 1.4vw, 15px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.section-title {
  font-family: 'Figtree', sans-serif;
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 700;
  color: var(--soft);
  margin: 0;
  letter-spacing: -0.3px;
}

.filter-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  margin-bottom: 12px;
}

.filter-row {
  display: flex;
  flex-direction: row;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  width: 100%;
  padding: 4px 0;
}

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

.filter-btn {
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  box-shadow: none;
  font-family: 'Figtree', sans-serif;
  font-size: clamp(14px, 1.6vw, 18px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 0 4px 0;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  position: relative;
}

.filter-btn.selected {
  color: var(--soft);
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.filter-btn.selected::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulseGreen 1.6s infinite alternate;
  flex-shrink: 0;
}

.filter-btn.focused,
.filter-btn:focus-visible {
  color: #fff;
  border-bottom-color: #fff;
  transform: translateY(-1px);
}

.channel-btn {
  font-size: clamp(12px, 1.4vw, 15px) !important;
}

.browse-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.discover-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ok);
  margin-bottom: 4px;
}

.profile-info-bottom {
  flex-shrink: 0;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.bottom-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
}

.selected-item-info {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.busy-poster-overlay {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* ===== HEADER SELECTED METADATA BUTTONS ===== */
.parent-category, .sub-category {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
  outline: none;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
  display: inline-block;
  white-space: nowrap;
  width: fit-content;
}

.parent-category:empty, .sub-category:empty {
  display: none !important;
}

.parent-category.focused, .parent-category:hover {
  color: var(--accent-category) !important;
  -webkit-text-fill-color: var(--accent-category) !important;
  text-decoration: underline !important;
  text-decoration-color: var(--accent-category) !important;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
  text-shadow: 0 0 16px var(--accent-category-glow);
  transform: scale(1.02);
}

.sub-category.focused, .sub-category:hover {
  color: var(--accent-channel) !important;
  -webkit-text-fill-color: var(--accent-channel) !important;
  text-decoration: underline !important;
  text-decoration-color: var(--accent-channel) !important;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
  text-shadow: 0 0 16px var(--accent-channel-glow);
  transform: scale(1.02);
}

/* ===== DISCOVER FILTER BAR AT THE TOP ===== */
.discover-filter-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.discover-filter-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  width: 100%;
  padding: 4px 0;
}

.discover-filter-row::-webkit-scrollbar {
  display: none;
}

.discover-filter-btn {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
  outline: none;
  font-family: 'Figtree', sans-serif;
  font-size: clamp(14px, 1.6vw, 18px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
  display: inline-block;
  white-space: nowrap;
  width: fit-content;
}

.discover-filter-btn.selected {
  color: var(--soft);
}

.discover-filter-btn.selected::after {
  content: ' •';
  color: var(--ok);
  text-shadow: 0 0 8px var(--ok);
}

.discover-filter-btn.focused, .discover-filter-btn:hover {
  text-decoration: underline !important;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
  transform: scale(1.02);
}

/* Category row (Row 1) focus colors */
.types-row .discover-filter-btn.focused,
.types-row .discover-filter-btn:hover {
  color: var(--accent-category) !important;
  -webkit-text-fill-color: var(--accent-category) !important;
  text-decoration-color: var(--accent-category) !important;
  text-shadow: 0 0 16px var(--accent-category-glow);
}

/* Channel row (Row 2) focus colors */
.channels-row .discover-filter-btn.focused,
.channels-row .discover-filter-btn:hover {
  color: var(--accent-channel) !important;
  -webkit-text-fill-color: var(--accent-channel) !important;
  text-decoration-color: var(--accent-channel) !important;
  text-shadow: 0 0 16px var(--accent-channel-glow);
}

/* ===== SYSTEM THEMES ===== */
body.theme-ocean {
  --bg: #070e1e;
  --bg-base: #050c19;
  --surface: rgba(13, 22, 46, 0.45);
  --surface-strong: rgba(17, 30, 62, 0.65);
  --surface-raised: rgba(22, 38, 79, 0.8);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --ok: #4ade80;
  --accent-category: #c084fc;
  --accent-category-glow: rgba(192, 132, 252, 0.7);
  --accent-channel: #4ade80;
  --accent-channel-glow: rgba(74, 222, 128, 0.7);
  --accent-focus: rgba(74, 222, 128, 0.85);
  --accent-focus-glow: rgba(74, 222, 128, 0.35);
  --ambient-1: rgba(25, 45, 95, 0.45);
  --ambient-2: rgba(15, 30, 70, 0.25);
  --ambient-body-1: rgba(20, 35, 75, 0.5);
  --ambient-body-2: rgba(10, 20, 50, 0.4);
  --ambient-body-3: rgba(13, 24, 52, 0.55);
}

body.theme-emerald {
  --bg: #05140e;
  --bg-base: #030a07;
  --surface: rgba(10, 30, 20, 0.45);
  --surface-strong: rgba(15, 42, 28, 0.65);
  --surface-raised: rgba(20, 55, 36, 0.8);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --ok: #00ff66;
  --accent-category: #00ff66;
  --accent-category-glow: rgba(0, 255, 102, 0.7);
  --accent-channel: #a8ffb2;
  --accent-channel-glow: rgba(168, 255, 178, 0.7);
  --accent-focus: rgba(0, 255, 102, 0.85);
  --accent-focus-glow: rgba(0, 255, 102, 0.35);
  --ambient-1: rgba(10, 48, 28, 0.45);
  --ambient-2: rgba(5, 32, 18, 0.25);
  --ambient-body-1: rgba(10, 48, 28, 0.5);
  --ambient-body-2: rgba(5, 32, 18, 0.4);
  --ambient-body-3: rgba(8, 38, 22, 0.55);
}

body.theme-midnight {
  --bg: #070708;
  --bg-base: #000000;
  --surface: rgba(20, 20, 22, 0.45);
  --surface-strong: rgba(28, 28, 32, 0.65);
  --surface-raised: rgba(35, 35, 40, 0.8);
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  --ok: #ffffff;
  --accent-category: #ffffff;
  --accent-category-glow: rgba(255, 255, 255, 0.7);
  --accent-channel: #aaaaaa;
  --accent-channel-glow: rgba(170, 170, 170, 0.7);
  --accent-focus: rgba(255, 255, 255, 0.85);
  --accent-focus-glow: rgba(255, 255, 255, 0.25);
  --ambient-1: rgba(255, 255, 255, 0.03);
  --ambient-2: rgba(255, 255, 255, 0.02);
  --ambient-body-1: rgba(40, 40, 42, 0.15);
  --ambient-body-2: rgba(30, 30, 32, 0.15);
  --ambient-body-3: transparent;
}

body.theme-crimson {
  --bg: #1c050a;
  --bg-base: #0f0305;
  --surface: rgba(46, 13, 22, 0.45);
  --surface-strong: rgba(62, 17, 30, 0.65);
  --surface-raised: rgba(79, 22, 38, 0.8);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --ok: #ff3b30;
  --accent-category: #ff3b30;
  --accent-category-glow: rgba(255, 59, 48, 0.7);
  --accent-channel: #ff9f0a;
  --accent-channel-glow: rgba(255, 159, 10, 0.7);
  --accent-focus: rgba(255, 59, 48, 0.85);
  --accent-focus-glow: rgba(255, 59, 48, 0.35);
  --ambient-1: rgba(75, 20, 35, 0.45);
  --ambient-2: rgba(50, 10, 20, 0.25);
  --ambient-body-1: rgba(75, 20, 35, 0.5);
  --ambient-body-2: rgba(50, 10, 20, 0.4);
  --ambient-body-3: rgba(52, 13, 24, 0.55);
}

/* ===== DISCOVER SEARCH BAR (Dynamic top area) ===== */
.discover-search-box-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 380px;
}

.discover-search-box-container .discover-search-input {
  flex: 1;
  padding: 12px 18px;
  font-family: 'Figtree', sans-serif;
  font-size: clamp(14px, 1.6vw, 16px);
  font-weight: 500;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: 30px;
  outline: none;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.discover-search-box-container .discover-search-input.focused,
.discover-search-box-container .discover-search-input:focus {
  border-color: var(--accent-focus);
  background: var(--surface-raised);
  box-shadow: 
    0 0 0 1px var(--accent-focus),
    0 0 16px var(--accent-focus-glow);
}

.discover-search-close-btn {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  color: var(--soft);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.discover-search-close-btn:hover,
.discover-search-close-btn:focus {
  background: var(--surface-raised);
  border-color: var(--accent-focus);
  color: var(--text);
  box-shadow: 0 0 12px var(--accent-focus-glow);
}

.episode-watched-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 176, 80, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'Figtree', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  z-index: 2;
  backdrop-filter: blur(4px);
}

.poster-progress-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  z-index: 10;
}

.poster-progress-fill {
  height: 100%;
  background: #e50914; /* Red Netflix bar */
  box-shadow: 0 0 4px rgba(229, 9, 20, 0.6);
}

/* ===== SYSTEM FLOATING TOAST BAR ===== */
#system-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  border-radius: 30px;
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: white;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

#system-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

#system-toast.toast-info {
  background: rgba(30, 30, 35, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#system-toast.toast-success {
  background: rgba(0, 176, 80, 0.9);
  border: 1px solid rgba(0, 255, 102, 0.2);
  box-shadow: 0 8px 32px rgba(0, 255, 102, 0.25);
}

#system-toast.toast-error {
  background: rgba(229, 9, 20, 0.9);
  border: 1px solid rgba(255, 59, 48, 0.2);
  box-shadow: 0 8px 32px rgba(255, 59, 48, 0.25);
}

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

/* ===== PLAYER CENTER CONTROLS ===== */
.player-center-controls {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 40px;
  z-index: 100;
  pointer-events: auto;
}

.player-center-btn {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  backdrop-filter: blur(8px);
}

.player-center-btn.play-pause-toggle {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: white;
}

.player-center-btn:hover,
.player-center-btn:focus {
  background: var(--surface-raised);
  border-color: var(--accent-focus);
  color: var(--text);
  transform: scale(1.15);
  box-shadow: 0 0 20px var(--accent-focus-glow);
  outline: none;
}

.player-center-btn:active {
  transform: scale(0.95);
}

/* TV D-pad / Keyboard Shortcut Flash Animation styling */
.player-center-btn.pop-active {
  background: var(--surface-raised) !important;
  border-color: var(--accent-focus) !important;
  color: var(--text) !important;
  transform: scale(1.25) !important;
  box-shadow: 0 0 24px var(--accent-focus-glow) !important;
}

/* ===== PLAYER SETTINGS DRAWER ===== */
.player-settings-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background: rgba(15, 15, 20, 0.95);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  display: none;
  flex-direction: column;
  padding: 40px 24px;
  z-index: 105;
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
}

.player-settings-drawer.open {
  display: flex;
}

.player-settings-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  color: white;
}

.player-settings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.player-settings-item {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
  text-align: left;
}

.player-settings-item.active {
  border-color: rgba(138, 43, 226, 0.3);
  background: rgba(138, 43, 226, 0.1);
  color: white;
}

.player-settings-item.focused {
  background: var(--surface-raised);
  border-color: var(--accent-focus);
  color: var(--text);
  box-shadow: 0 0 12px var(--accent-focus-glow);
}

.player-settings-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 104;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.player-settings-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ===== PLAYER NEXT EPISODE CARD ===== */
.player-next-episode-card {
  position: absolute;
  bottom: 48px;
  right: 48px;
  width: 360px;
  background: rgba(15, 15, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  z-index: 110;
  display: none;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  color: white;
  text-align: left;
}

.player-next-episode-card.visible {
  display: flex;
  animation: nextEpFadeIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes nextEpFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.next-ep-title-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.next-ep-subtitle {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-focus);
  letter-spacing: 1.5px;
}

.next-ep-title {
  font-size: 16px;
  font-weight: 700;
  color: white;
  line-height: 1.4;
}

.next-ep-countdown-text {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
}

.next-ep-buttons {
  display: flex;
  gap: 12px;
}

.next-ep-buttons button {
  flex: 1;
  text-align: center;
  justify-content: center;
}

/* ===== ORIENTATION WARNING FOR MOBILE PORTRAIT ===== */
.orientation-warning {
  display: none;
  position: fixed;
  inset: 0;
  background: #08090b;
  color: white;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  font-family: 'Figtree', sans-serif;
}

.warning-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 320px;
}

.warning-icon {
  animation: rotatePhone 2.2s ease-in-out infinite;
  color: var(--accent-focus);
}

.warning-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.warning-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

@keyframes rotatePhone {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
  100% { transform: rotate(-90deg); }
}

/* Force show only on small portrait screens */
@media (orientation: portrait) and (max-width: 1024px) {
  .orientation-warning {
    display: flex;
  }
  .app {
    display: none !important;
  }
}

/* Optimization for small screen heights (e.g. mobile landscape) */
@media (max-height: 560px) {
  .poster-card {
    height: 100%;
    width: auto;
    aspect-ratio: 2 / 3.1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  
  .poster-image {
    width: 100%;
    flex: 1;
    min-height: 0;
    aspect-ratio: 2 / 3;
    margin-bottom: 6px;
  }

  .poster-title {
    min-height: 28px;
    font-size: 12px;
    -webkit-line-clamp: 2;
  }

  .poster-meta {
    font-size: 10px;
    margin-top: 2px;
  }
}

/* ===== PERFORMANCE OPTIMIZATIONS FOR ANDROID TV (TV MODE) ===== */
.tv-mode *,
.tv-mode *::before,
.tv-mode *::after {
  transition: none !important;
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  will-change: auto !important;
}

.tv-mode {
  text-rendering: speed !important;
}

.tv-mode * {
  box-shadow: none !important;
  text-shadow: none !important;
}

.tv-mode .browse-screen {
  background: #08090b !important;
}

.tv-mode .category-drawer,
.tv-mode .detail-drawer,
.tv-mode .player-settings-drawer,
.tv-mode .drawer-backdrop,
.tv-mode .overlay,
.tv-mode .busy-poster-overlay {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(10, 11, 14, 0.98) !important;
}

.tv-mode .poster-card.focused,
.tv-mode .profile-card.focused,
.tv-mode .browse-focusable.focused {
  transform: scale(1.05) !important;
  border-color: var(--accent-focus) !important;
}
