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

:root {
  --bg: #07080c;
  --bg-soft: #0d1018;
  --panel: rgba(18, 20, 29, 0.7);
  --panel-light: rgba(255, 255, 255, 0.08);
  --glass: rgba(255, 255, 255, 0.09);
  --glass-strong: rgba(255, 255, 255, 0.13);
  --text: #fffaf5;
  --muted: #b8b1aa;
  --line: rgba(255, 250, 245, 0.16);
  --accent: #e50914;
  --accent-dark: #8f050c;
  --gold: #f2c66d;
  --cyan: #69d8ff;
  --green: #47c47a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  --glass-shadow: 0 18px 54px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
  font-family:
    Outfit, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(1100px 700px at 10% -10%, rgba(229, 9, 20, 0.2), transparent 54%),
    radial-gradient(900px 580px at 95% 12%, rgba(105, 216, 255, 0.12), transparent 56%),
    linear-gradient(160deg, #07080c 0%, #101018 48%, #07080c 100%);
  background-attachment: fixed;
  color: var(--text);
  overflow-x: hidden;
}

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

button,
input {
  font: inherit;
}

button {
  border: 0;
}

button,
a,
input,
.custom-dropdown {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 5vw, 72px);
  background: linear-gradient(180deg, rgba(9, 10, 15, 0.86), rgba(9, 10, 15, 0.58));
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
}

.brand,
.site-header nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.brand-mark {
  display: block;
  width: 56px;
  height: 34px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.site-header nav {
  gap: 22px;
  color: rgba(255, 250, 245, 0.76);
  font-size: 0.95rem;
  font-weight: 700;
}

.site-header nav a:hover,
.site-header nav a:focus-visible {
  color: #fff;
}

.site-header nav a {
  position: relative;
  padding: 8px 0;
}

.site-header nav a::after {
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  content: "";
  opacity: 0;
  transform: scaleX(0.7);
  transition: opacity 160ms ease, transform 160ms ease;
}

.site-header nav a:hover::after,
.site-header nav a:focus-visible::after {
  opacity: 1;
  transform: scaleX(1);
}

.hero-section {
  position: relative;
  min-height: min(780px, 76vh);
  display: grid;
  align-items: end;
  overflow: hidden;
  background: #06070a;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background: url("assets/hero-streaming-room.png") center / cover;
  opacity: 0.7;
  transform: scale(1.02);
}

.hero-section::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 8, 12, 0.98) 0%, rgba(7, 8, 12, 0.77) 42%, rgba(7, 8, 12, 0.28) 100%),
    linear-gradient(0deg, var(--bg) 0%, rgba(7, 8, 12, 0.9) 12%, rgba(7, 8, 12, 0.08) 58%);
  content: "";
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 86px 0 70px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 18px;
  font-size: clamp(2.35rem, 7vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.55rem, 3.4vw, 2.2rem);
  line-height: 1.04;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.hero-content p:not(.eyebrow) {
  max-width: 610px;
  color: rgba(255, 250, 245, 0.82);
  font-size: 1.08rem;
  line-height: 1.65;
}

.hero-actions,
.search-row,
.episode-controls,
.catalog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions {
  margin-top: 28px;
}

.primary-link,
.secondary-link,
.load-button,
.utility-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 900;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-link,
.load-button {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 38%),
    linear-gradient(135deg, #ff3440, var(--accent));
  color: #fff;
  padding: 0 20px;
  box-shadow: 0 18px 38px rgba(229, 9, 20, 0.28);
}

.primary-link:hover,
.load-button:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 38%),
    linear-gradient(135deg, #ff4650, #f41823);
  transform: translateY(-1px);
}

.secondary-link,
.utility-button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.05));
  color: var(--text);
  padding: 0 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.secondary-link:hover,
.utility-button:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.search-panel {
  width: min(720px, 100%);
  margin-top: 34px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.055)),
    rgba(9, 10, 16, 0.68);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(1.32);
  -webkit-backdrop-filter: blur(24px) saturate(1.32);
}

.search-panel label,
.episode-field span,
.toggle-control span {
  color: rgba(255, 250, 245, 0.72);
  font-size: 0.82rem;
  font-weight: 900;
}

.search-row {
  margin-top: 8px;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(2, 3, 7, 0.48);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 198, 109, 0.16);
}

.search-input-wrapper {
  position: relative;
  flex: 1 1 320px;
}

.search-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: rgba(255, 250, 245, 0.42);
  pointer-events: none;
  transition: color 0.2s ease;
}

.catalog-search {
  padding-left: 44px !important;
}

.search-input-wrapper:focus-within .search-input-icon {
  color: var(--gold);
}

.catalog-status {
  margin: 10px 0 0;
  color: rgba(255, 250, 245, 0.68);
  font-size: 0.94rem;
}

.player-section,
.catalog-section,
.progress-section {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 58px 0;
}

.player-section {
  scroll-margin-top: 76px;
}

.player-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.player-heading p:not(.eyebrow) {
  margin-bottom: 0;
  color: rgba(255, 250, 245, 0.72);
}

.player-controls {
  width: 100%;
  max-width: 520px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05)),
    rgba(10, 12, 18, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 16px;
  backdrop-filter: blur(22px) saturate(1.28);
  -webkit-backdrop-filter: blur(22px) saturate(1.28);
  box-shadow: var(--glass-shadow);
}

.episode-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  width: 100%;
}

.episode-inputs-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.episode-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.episode-field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(2, 3, 7, 0.48);
  color: var(--text);
  padding: 0 32px 0 12px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba%28255,250,245,0.72%29' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
}

.episode-field select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 198, 109, 0.16);
}

.episode-toggles-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.toggle-control,
.tv-option,
.tv-option-videasy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

/* Hide native checkbox but keep it keyboard accessible */
.toggle-control input[type="checkbox"],
.tv-option input[type="checkbox"],
.tv-option-videasy input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Chip states when checked */
.toggle-control:has(input:checked),
.tv-option:has(input:checked),
.tv-option-videasy:has(input:checked) {
  background: rgba(229, 9, 20, 0.16);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.2);
}

.toggle-control:hover,
.tv-option:hover {
  background: rgba(255, 250, 245, 0.08);
  border-color: rgba(255, 250, 245, 0.25);
}

.toggle-control:has(input:checked):hover,
.tv-option:has(input:checked):hover {
  background: rgba(229, 9, 20, 0.25);
}

.toggle-control:has(input:focus-visible),
.tv-option:has(input:focus-visible) {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.episode-actions-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.episode-actions-row button {
  flex: 1;
}

.load-button {
  min-width: 136px;
}

.player-shell {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    #030406;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.player-viewport {
  aspect-ratio: 16 / 9;
  min-height: 320px;
  background:
    linear-gradient(135deg, rgba(229, 9, 20, 0.18), transparent 36%),
    radial-gradient(520px 320px at 88% 15%, rgba(105, 216, 255, 0.13), transparent 58%),
    #050505;
}

.player-viewport iframe,
.player-viewport .empty-player {
  width: 100%;
  height: 100%;
}

.player-viewport iframe {
  display: block;
  border: 0;
}

.empty-player {
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 28px;
  text-align: center;
}

.empty-player h2 {
  max-width: 650px;
}

.empty-player p:not(.eyebrow) {
  max-width: 680px;
  color: rgba(255, 250, 245, 0.72);
}

.code-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 250, 245, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.code-strip span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

code,
pre {
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.38);
  color: #fff0cc;
}

code {
  padding: 6px 8px;
  overflow-wrap: anywhere;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 24px;
}

.section-heading p:not(.eyebrow) {
  color: rgba(255, 250, 245, 0.72);
  line-height: 1.6;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 18px;
}

.empty-catalog {
  grid-column: 1 / -1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.empty-catalog p {
  margin-bottom: 0;
  color: rgba(255, 250, 245, 0.72);
}

.media-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

.media-card:hover,
.media-card:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-5px);
  outline: none;
}

.media-card:focus-visible .poster {
  box-shadow: 0 0 0 3px rgba(242, 198, 109, 0.48);
}

.poster {
  position: relative;
  display: grid;
  aspect-ratio: 2 / 3;
  place-items: end start;
  overflow: hidden;
  border-radius: 8px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent 34%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent),
    var(--poster-color, #5a171b);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34);
}

.poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster::after {
  position: absolute;
  inset: auto 0 0;
  height: 48%;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.78), transparent);
  content: "";
}

.poster span {
  position: relative;
  z-index: 1;
  width: min-content;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 0.92;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.42);
  text-transform: uppercase;
}

.play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 8, 12, 0.46);
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 0.2s ease, backdrop-filter 0.2s ease;
  z-index: 4;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  border-radius: 8px;
}

.play-badge::before {
  content: "";
  display: inline-block;
  width: 46px;
  height: 46px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 26px;
  background-color: var(--accent);
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(229, 9, 20, 0.5);
  transform: scale(0.8);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.media-card:hover .play-badge,
.media-card:focus-visible .play-badge {
  opacity: 1;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.media-card:hover .play-badge::before,
.media-card:focus-visible .play-badge::before {
  transform: scale(1);
}

.media-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.media-card .rating {
  color: var(--gold);
  font-weight: 900;
}

.card-title {
  overflow: hidden;
  color: #fff;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-description {
  display: -webkit-box;
  min-height: 42px;
  overflow: hidden;
  color: rgba(255, 250, 245, 0.66);
  font-size: 0.88rem;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.progress-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.32fr) minmax(0, 1fr);
  gap: 18px;
}

.progress-summary {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.progress-summary span {
  color: var(--green);
  font-size: 3rem;
  font-weight: 900;
}

.progress-summary p {
  color: rgba(255, 250, 245, 0.74);
}

pre {
  min-height: 170px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  white-space: pre-wrap;
}

.site-footer {
  padding: 28px 18px 38px;
  color: rgba(255, 250, 245, 0.62);
  text-align: center;
}

@media (max-width: 920px) {
  h1 {
    font-size: 3.2rem;
  }

  .player-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .progress-layout {
    grid-template-columns: 1fr;
  }
}

/* Bottom Navigation Bar for Mobile */
.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .site-header {
    justify-content: center;
    padding: 12px 18px;
  }

  .site-header nav {
    display: none;
  }

  .ambient-glow {
    display: none;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom));
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.045)),
      rgba(9, 10, 15, 0.88);
    backdrop-filter: blur(24px) saturate(1.35);
    -webkit-backdrop-filter: blur(24px) saturate(1.35);
    border-top: 1px solid rgba(255, 255, 255, 0.13);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  }

  .bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    gap: 4px;
    flex: 1;
    height: 100%;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
  }

  .bottom-nav-link.active {
    background: rgba(229, 9, 20, 0.12);
    color: #fff;
  }

  .bottom-nav-icon {
    width: 22px;
    height: 22px;
  }

  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .player-section,
  .catalog-section,
  .progress-section,
  .history-section {
    width: min(1180px, calc(100% - 24px));
    padding: 28px 0;
  }

  .bottom-nav.keyboard-hidden {
    display: none !important;
  }

  .hero-section {
    min-height: auto;
  }

  .hero-backdrop {
    transform: none;
  }

  .hero-content {
    width: min(1180px, calc(100% - 24px));
    padding: 56px 0 46px;
  }

  h1 {
    font-size: 2.25rem;
    line-height: 1.03;
  }

  h2 {
    font-size: 1.7rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .search-row {
    flex-direction: row;
    gap: 8px;
    width: 100%;
  }

  .catalog-search {
    flex: 1;
    min-width: 0;
  }

  .search-row .utility-button {
    width: auto;
    min-width: fit-content;
  }

  .primary-link,
  .secondary-link {
    width: 100%;
  }

  .player-viewport {
    min-height: auto;
    aspect-ratio: 16 / 9;
  }

  .code-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
  }

  .poster span {
    font-size: 1.15rem;
  }

  .card-description {
    display: none;
  }
}

/* Watch History Styles */
.history-section {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 58px 0;
  border-top: 1px solid var(--line);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.history-header h2 {
  margin: 0;
}

.history-header .utility-button {
  min-height: 36px;
  font-size: 0.85rem;
}

.card-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  margin-top: -4px;
}

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

.poster-progress-fill {
  height: 100%;
  background: var(--green);
  transition: width 0.3s ease;
}

.remove-history-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(7, 7, 7, 0.8);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 250, 245, 0.15);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.remove-history-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.4);
}

.empty-history {
  grid-column: 1 / -1;
  border: 1px dashed rgba(255, 250, 245, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.empty-history h3 {
  margin: 0;
  font-size: 1.15rem;
  color: rgba(255, 250, 245, 0.9);
}

.empty-history p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* --- VISUAL POLISH & PREMIUM UI UPDATES --- */

/* 1. Ambient Glows */
.ambient-glow {
  position: fixed;
  width: 58vw;
  height: 46vw;
  max-width: 800px;
  max-height: 620px;
  border-radius: 8px;
  filter: blur(140px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.12;
  animation: float 20s infinite ease-in-out alternate;
}
.ambient-glow.bg-purple {
  background: linear-gradient(135deg, rgba(229, 9, 20, 0.55), rgba(242, 198, 109, 0.2), transparent 72%);
  top: -10%;
  left: -10%;
}
.ambient-glow.bg-blue {
  background: linear-gradient(135deg, rgba(105,216,255,0.45), rgba(71,196,122,0.16), transparent 72%);
  top: 20%;
  right: -20%;
  animation-delay: -5s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(3%, 5%) scale(1.05); }
  100% { transform: translate(-3%, 2%) scale(0.95); }
}

/* 2. Custom Dropdown */
.custom-dropdown-wrapper {
  position: relative;
}
.custom-dropdown {
  position: relative;
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(2, 3, 7, 0.48);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  user-select: none;
}
.custom-dropdown:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 198, 109, 0.16);
}
.dropdown-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: 46px;
}
.dropdown-icon {
  width: 16px;
  height: 16px;
  color: rgba(255, 250, 245, 0.72);
  transition: transform 0.2s;
}
.custom-dropdown.open .dropdown-icon {
  transform: rotate(180deg);
}
.dropdown-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: rgba(14, 16, 23, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 50;
  overflow: hidden;
}
.custom-dropdown.open .dropdown-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-option {
  padding: 12px;
  font-size: 0.95rem;
  transition: background 0.2s;
}
.dropdown-option:hover {
  background: rgba(255, 250, 245, 0.08);
}
.dropdown-option.active {
  background: rgba(229, 9, 20, 0.16);
  color: var(--accent);
  font-weight: 700;
}

/* 3. Stepper Controls for Numbers */
.stepper-control {
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(2, 3, 7, 0.48);
  overflow: hidden;
}
.stepper-control:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 198, 109, 0.16);
}
.stepper-control input {
  border: none;
  background: transparent;
  text-align: center;
  padding: 0;
  width: 100%;
  min-height: 46px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper-control input:focus {
  box-shadow: none;
}
.stepper-control input::-webkit-outer-spin-button,
.stepper-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.stepper-btn {
  background: transparent;
  color: rgba(255, 250, 245, 0.72);
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.stepper-btn:hover {
  background: rgba(255, 250, 245, 0.1);
  color: #fff;
}

/* 4. Custom Toasts */
.toast-container {
  position: fixed;
  bottom: 84px; /* Above bottom nav */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 480px;
}
@media (min-width: 769px) {
  .toast-container {
    bottom: 24px;
    right: 24px;
    left: auto;
    transform: none;
    width: auto;
  }
}
.toast {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05)),
    rgba(14, 16, 23, 0.9);
  border-left: 4px solid var(--accent);
  color: var(--text);
  padding: 14px 20px;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  font-weight: 500;
  font-size: 0.95rem;
  animation: toastEnter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  will-change: transform, opacity;
  width: 100%;
  box-sizing: border-box;
}
.toast.toast-hiding {
  animation: toastExit 0.3s ease-in forwards;
}
.toast.toast-success {
  border-left-color: var(--green);
}
.toast.toast-error {
  border-left-color: var(--accent);
}
.toast.toast-info {
  border-left-color: var(--gold);
}

@keyframes toastEnter {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastExit {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(10px) scale(0.95); }
}

/* 5. Staggered Animations */
.stagger-enter {
  opacity: 0;
  transform: translateY(20px);
  animation: cardEnter 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes cardEnter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- MOBILE SPECIFIC INPUT RESPONSIVENESS (Android & iOS) --- */
@media (max-width: 480px) {
  .site-header {
    padding: 10px 12px;
  }

  .brand {
    max-width: 100%;
    font-size: 0.98rem;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
  }

  .hero-section::after {
    background:
      linear-gradient(90deg, rgba(7, 8, 12, 0.98) 0%, rgba(7, 8, 12, 0.78) 100%),
      linear-gradient(0deg, var(--bg) 0%, rgba(7, 8, 12, 0.78) 28%, rgba(7, 8, 12, 0.25) 100%);
  }

  .hero-content {
    padding: 44px 0 38px;
  }

  h1 {
    font-size: 2.05rem;
    line-height: 1.06;
  }

  h2 {
    font-size: 1.45rem;
    line-height: 1.12;
  }

  .hero-content p:not(.eyebrow),
  .section-heading p:not(.eyebrow),
  .player-heading p:not(.eyebrow) {
    font-size: 0.96rem;
    line-height: 1.55;
  }

  .search-panel {
    margin-top: 26px;
    padding: 14px;
  }

  .search-input-wrapper {
    flex-basis: 100%;
  }

  .search-row .utility-button {
    flex: 1 1 auto;
  }

  .primary-link,
  .secondary-link,
  .load-button,
  .utility-button,
  input,
  .custom-dropdown,
  .dropdown-selected,
  .stepper-control input,
  .stepper-btn {
    min-height: 44px;
  }

  .player-heading {
    gap: 14px;
  }

  .episode-inputs-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .custom-dropdown-wrapper {
    flex: 1 1 100% !important;
  }
  .episode-field-tv {
    flex: 1 1 calc(50% - 4px) !important;
  }
  .stepper-btn {
    width: 42px;
    height: 44px;
  }
  .stepper-control input {
    min-height: 44px;
    font-size: 0.95rem;
  }
  .custom-dropdown {
    min-height: 44px;
    font-size: 0.95rem;
  }
  .dropdown-selected {
    height: 44px;
  }
  .episode-field span {
    font-size: 0.78rem;
  }
  .bottom-nav {
    height: calc(58px + env(safe-area-inset-bottom));
  }
  .bottom-nav-icon {
    width: 20px;
    height: 20px;
  }
  .bottom-nav-link {
    font-size: 0.68rem;
    gap: 3px;
  }
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }
  .player-controls {
    padding: 12px;
  }

  .episode-toggles-row {
    gap: 7px;
  }

  .toggle-control,
  .tv-option,
  .tv-option-videasy {
    flex: 1 1 calc(50% - 7px);
    justify-content: center;
    padding-inline: 10px;
  }

  .episode-actions-row {
    gap: 8px;
  }

  .episode-actions-row button {
    min-width: 0;
    padding-inline: 10px;
  }

  .card-title {
    font-size: 0.94rem;
  }

  .media-meta,
  .card-subtitle {
    font-size: 0.74rem;
  }

  .toast-container {
    bottom: calc(72px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
  }
}

@media (max-width: 380px) {
  .hero-content,
  .player-section,
  .catalog-section,
  .progress-section,
  .history-section {
    width: min(1180px, calc(100% - 20px));
  }

  .search-row,
  .episode-actions-row {
    flex-direction: column;
  }

  .search-row .utility-button,
  .episode-actions-row button {
    width: 100%;
  }

  .catalog-grid {
    gap: 12px 10px;
  }

  .poster {
    padding: 10px;
  }

  .poster span {
    font-size: 1rem;
  }

  .toggle-control,
  .tv-option,
  .tv-option-videasy {
    flex-basis: 100%;
  }

  .code-strip {
    padding: 10px;
  }
}
