:root {
  --color-primary: #8234c6;
  --color-primary-dim: #7524b9;
  --color-primary-container: #f1dbff;
  --color-surface: #fdf8f9;
  --color-surface-lowest: #ffffff;
  --color-surface-low: #f8f2f4;
  --color-surface-high: #ece7e9;
  --color-surface-highest: #e7e1e4;
  --color-text: #343234;
  --color-text-muted: #615e61;
  --color-outline-soft: rgba(181, 176, 180, 0.18);
  --shadow-soft: 0 12px 32px -4px rgba(52, 50, 52, 0.06);
  --shadow-panel: 0 8px 24px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px 2px rgba(130, 52, 198, 0.15);
  --shadow-glow-focus: 0 0 30px 4px rgba(130, 52, 198, 0.3);
  --radius-panel: 2rem;
  --radius-hero: 3rem;
}

html,
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  font-size: 15px;
}

body {
  background: var(--color-surface);
  color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="password"] {
  border: none !important;
  box-shadow: none !important;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  vertical-align: middle;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.app-shell {
  min-height: 100vh;
}

.app-main {
  max-width: 80rem;
  margin: 0 auto;
  padding: 6rem 1.5rem 8rem;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 4.75rem;
  padding: 1rem 1.5rem;
  background: rgba(253, 248, 249, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-soft);
}

.app-topbar__left,
.app-topbar__right {
  display: flex;
  align-items: center;
}

.app-topbar__left {
  gap: 2.5rem;
}

.app-topbar__right {
  gap: 1.25rem;
}

.brand-mark {
  font-family: "Plus Jakarta Sans", "Noto Sans SC", sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dim));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.app-nav {
  display: none;
  align-items: center;
  gap: 2rem;
}

.app-nav__link {
  font-family: "Plus Jakarta Sans", "Noto Sans SC", sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.app-nav__link:hover {
  color: var(--color-text);
  background: var(--color-surface-low);
}

.app-nav__link.is-active {
  color: var(--color-primary);
  background: transparent;
  border-bottom: 2px solid var(--color-primary);
  border-radius: 0;
}

.header-search {
  display: none;
  align-items: center;
  width: 15rem;
  min-height: 2.5rem;
  padding: 0 1rem;
  background: var(--color-surface-lowest);
  border-radius: 9999px;
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
  border: 1px solid var(--color-outline-soft);
  overflow: hidden;
}

.header-search:focus-within {
  background: var(--color-surface-lowest);
  border-color: rgba(130, 52, 198, 0.3);
  box-shadow: 0 0 0 4px rgba(130, 52, 198, 0.1);
}

.header-search__icon {
  margin-top: -1px; /* Optical adjustment */
  flex-shrink: 0;
}

.header-search__input {
  flex: 1;
  min-width: 0; /* Allow the input to shrink smaller than its default browser width */
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
  padding: 0.5rem 0;
  margin-left: 0.5rem;
}

.header-search__input::placeholder {
  color: rgba(97, 94, 97, 0.75);
}

.lang-switcher {
  position: relative;
}

.lang-switcher__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.875rem;
  border-radius: 9999px;
  background: var(--color-surface-container-low, var(--color-surface-low));
  color: var(--color-text);
  box-shadow: var(--shadow-panel);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.lang-switcher:hover .lang-switcher__trigger,
.lang-switcher:focus-within .lang-switcher__trigger {
  background: var(--color-surface-high);
  color: var(--color-primary);
}

.lang-switcher__label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.lang-switcher__menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 6rem;
  padding: 0.375rem;
  background: rgba(253, 248, 249, 0.96);
  border: 1px solid var(--color-outline-soft);
  border-radius: 1rem;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.lang-switcher:hover .lang-switcher__menu,
.lang-switcher:focus-within .lang-switcher__menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.lang-switcher__option {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--color-text-muted);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-switcher__option:hover {
  background: var(--color-surface-low);
  color: var(--color-primary);
}

.lang-switcher__option.is-active {
  background: var(--color-primary);
  color: #fff;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 9999px;
  color: var(--color-text-muted);
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.icon-button:hover {
  background: var(--color-surface-low);
  color: var(--color-primary);
}

.icon-button:active {
  transform: scale(0.95);
}

.avatar-button {
  width: 2.5rem;
  height: 2.5rem;
  overflow: hidden;
  border: 2px solid var(--color-primary-container);
  border-radius: 9999px;
  background: var(--color-surface-highest);
  transition: box-shadow 0.2s ease;
}

.avatar-button:hover {
  box-shadow: 0 0 0 2px rgba(130, 52, 198, 0.3);
}

.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0.75rem 1.5rem 1.5rem;
  background: rgba(253, 248, 249, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top-left-radius: 2rem;
  border-top-right-radius: 2rem;
  box-shadow: 0 -8px 24px -6px rgba(0, 0, 0, 0.04);
}

.mobile-nav__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem;
  color: rgba(97, 94, 97, 0.7);
  border-radius: 9999px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.mobile-nav__link:hover {
  color: var(--color-primary);
}

.mobile-nav__link:active {
  transform: scale(0.95);
}

.mobile-nav__link.is-active {
  background: var(--color-primary);
  color: white;
}

.mobile-nav__label {
  font-size: 0.6875rem;
  font-weight: 500;
}

.ui-panel {
  background: var(--color-surface-lowest);
  border: 1px solid var(--color-outline-soft);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-soft);
}

.ui-panel-soft {
  background: var(--color-surface-low);
  border-radius: var(--radius-panel);
}

.ui-panel-glass {
  background: rgba(253, 248, 249, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-panel);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 9999px;
  font-weight: 700;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dim));
  box-shadow: 0 8px 24px -6px rgba(130, 52, 198, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.1) inset;
  border: none;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 32px -8px rgba(130, 52, 198, 0.6), 0 0 20px 2px rgba(130, 52, 198, 0.2);
  filter: brightness(1.05);
}

.btn-secondary {
  color: var(--color-text);
  background: var(--color-surface-container-high, var(--color-surface-high));
  border: 1px solid rgba(0, 0, 0, 0.03);
  box-shadow: 0 2px 8px -1px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background: var(--color-surface-lowest);
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: 0 8px 20px -4px rgba(130, 52, 198, 0.12);
}

.btn-ghost {
  color: var(--color-primary);
  background: var(--color-surface-lowest);
  border: 1px solid rgba(130, 52, 198, 0.2);
  box-shadow: var(--shadow-panel);
}

.search-hero {
  background: var(--color-surface-lowest);
  box-shadow: var(--shadow-glow);
}

.search-hero:focus-within {
  box-shadow: var(--shadow-glow-focus);
}

.search-hero__input {
  background: transparent;
  font-size: 1.125rem;
  font-weight: 500;
}

.search-hero__input::placeholder {
  color: rgba(97, 94, 97, 0.4);
}

.autocomplete-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-outline-soft);
  border-radius: 1.5rem;
  box-shadow: var(--shadow-soft);
  z-index: 1000;
  max-height: 20rem;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.autocomplete-results.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.autocomplete-item:hover {
  background: var(--color-surface-low);
  color: var(--color-primary);
}

.autocomplete-item span.material-symbols-outlined {
  font-size: 1.25rem;
  opacity: 0.3;
}

.hero-highlight {
  display: inline-block;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dim));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-heading__title {
  font-family: "Plus Jakarta Sans", "Noto Sans SC", sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.5rem;
  border-radius: 0.375rem;
  background: var(--color-surface-high);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.filter-chip:hover {
  background: var(--color-surface-highest);
}

.filter-chip.is-active {
  background: var(--color-primary-container);
  color: #7423b8;
}

.media-card {
  display: block;
  cursor: pointer;
}

.media-card__visual {
  position: relative;
  overflow: hidden;
  border-radius: 0.75rem;
  background: var(--color-surface-low);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.media-card:hover .media-card__visual {
  transform: scale(1.02);
  box-shadow: var(--shadow-soft);
}

.media-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.media-card:hover .media-card__image {
  transform: scale(1.05);
}

.media-card__title {
  color: var(--color-text);
  transition: color 0.2s ease;
}

.media-card:hover .media-card__title {
  color: var(--color-primary);
}

.poster-fallback {
  background: linear-gradient(180deg, rgba(130, 52, 198, 0.08), rgba(220, 210, 244, 0.35));
}

.player-frame {
  --player-max-height: calc(100dvh - 7.5rem);
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  max-width: 100%;
  max-height: var(--player-max-height);
  margin-inline: auto;
  overflow: hidden;
  border-radius: 1.25rem;
  background: #000;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.28);
}

.player-frame--portrait {
  aspect-ratio: 9 / 16;
  width: min(100%, 40rem, calc(var(--player-max-height) * 9 / 16));
}

.player-frame--landscape {
  aspect-ratio: 16 / 9;
  width: min(100%, calc(var(--player-max-height) * 16 / 9));
}

@media (max-width: 640px) {
  .player-frame {
    --player-max-height: calc(100dvh - 6rem);
  }

  .player-frame--portrait {
    width: min(100%, calc(var(--player-max-height) * 9 / 16));
  }
}

.player-frame #artplayer,
.player-frame .art-player,
.player-frame .art-video-player,
.player-frame .art-video,
.player-frame .art-poster,
.player-frame .art-video-player video {
  width: 100% !important;
  height: 100% !important;
}

.player-frame .art-player,
.player-frame .art-video-player {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #000;
}

.player-frame .art-video {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.player-frame .art-poster {
  object-fit: cover !important;
}

.player-frame .art-video-player .art-video video,
.player-frame .art-video-player video {
  object-fit: contain !important;
  object-position: center center !important;
  align-self: center !important;
  background: #000;
}

.play-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.play-pill:hover {
  transform: translateY(-1px);
}

.play-pill:active {
  transform: scale(0.96);
}

.play-pill.is-active {
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dim));
  color: #fef5ff;
  box-shadow: 0 14px 28px rgba(130, 52, 198, 0.22);
  box-shadow: 0 0 0 4px var(--color-primary-container), 0 14px 28px rgba(130, 52, 198, 0.22);
}

.play-pill.is-idle {
  background: var(--color-surface-low);
  color: var(--color-text-muted);
}

.play-pill.is-idle:hover {
  background: var(--color-primary-container);
  color: var(--color-primary);
}

.episode-selector {
  position: relative;
}

.episode-selector__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cast-rail__item {
  flex: 0 0 auto;
  min-width: 9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--color-surface-low);
  border-radius: 2rem;
  border: 1px solid transparent;
  transition: border-color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
  scroll-snap-align: start;
}

.cast-rail__item:hover {
  border-color: rgba(130, 52, 198, 0.2);
  transform: translateY(-1px);
}

.cast-rail__controls {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.cast-rail__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: var(--color-surface-low);
  color: var(--color-text);
  box-shadow: var(--shadow-panel);
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.cast-rail__arrow:hover {
  transform: translateY(-1px);
  background: var(--color-surface-high);
  color: var(--color-primary);
}

.cast-rail__arrow:active {
  transform: scale(0.97);
}

.play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 9999px;
  font-weight: 700;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.play-button:hover {
  transform: translateY(-2px);
}

.play-button:active {
  transform: scale(0.96);
}

.play-button--soft {
  background: var(--color-surface-container-high, var(--color-surface-high));
  color: var(--color-text);
  border: 1px solid rgba(0, 0, 0, 0.03);
  box-shadow: 0 2px 8px -1px rgba(0, 0, 0, 0.04);
}

.play-button--soft:hover {
  transform: translateY(-2px);
  background: var(--color-surface-lowest);
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: 0 8px 20px -4px rgba(130, 52, 198, 0.12);
}

.play-button--primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dim));
  box-shadow: 0 8px 24px -6px rgba(130, 52, 198, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.1) inset;
  border: none;
}

.play-button--primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 32px -8px rgba(130, 52, 198, 0.6), 0 0 20px 2px rgba(130, 52, 198, 0.2);
  filter: brightness(1.05);
}

.play-button--nav {
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  border-radius: 9999px;
  background: rgba(15, 15, 15, 0.48);
  color: #fff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28), 0 0 1px 1px rgba(255, 255, 255, 0.08) inset;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.play-button--nav:hover {
  background: rgba(15, 15, 15, 0.62);
  transform: scale(1.03);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34), 0 0 1px 1px rgba(255, 255, 255, 0.1) inset;
}

.play-button--nav.is-visible {
  opacity: 1;
  transform: scale(1);
}

@media (max-width: 767px) {
  .app-topbar {
    padding: 1rem 0.875rem;
  }

  .app-topbar__left {
    gap: 1rem;
  }

  .app-topbar__right {
    gap: 0.5rem;
  }

  .brand-mark {
    font-size: 1.125rem;
  }

  .app-main {
    padding: 5rem 0.875rem 9rem;
  }
}

@media (min-width: 768px) {
  .cast-rail__controls {
    display: inline-flex;
  }

  .app-topbar {
    padding: 1rem 2rem;
  }

  .app-nav {
    display: flex;
  }

  .header-search {
    display: flex;
  }

  .app-main {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Source Selector */
.source-pill.is-active {
    background-color: var(--color-primary) !important;
    color: white !important;
    border-color: var(--color-primary) !important;
    box-shadow: var(--shadow-glow);
}

.source-pill.is-active .material-symbols-outlined {
    opacity: 1 !important;
    animation: source-pulse 2s infinite;
}

@keyframes source-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

.source-pill.is-idle {
    opacity: 0.7;
}

.source-pill.is-idle:hover {
    opacity: 1;
}

/* Image Fallbacks */
.poster-fallback {
    object-fit: contain !important;
    background-color: var(--color-surface-container-low);
    padding: 2rem;
}

