:root {
  color-scheme: dark;
  --page-bg: #090a0d;
  --surface: #111317;
  --line: rgba(255, 255, 255, 0.11);
  --accent: #ed2632;
  --muted: #9298a4;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  letter-spacing: -0.02em;
  background-color: var(--page-bg);
  background-image: radial-gradient(ellipse at 50% -30%, rgba(54, 35, 39, 0.24), transparent 56%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

#main-header {
  background-color: rgba(9, 10, 13, 0.94);
  border-color: var(--line);
}

#main-header > div {
  max-width: 80rem;
}

.group.text-2xl {
  font-size: 1.35rem;
  letter-spacing: 0.06em;
}

.brand-logo,
.brand-logo:hover,
.brand-logo.tv-focused:not(:focus-visible) {
  border-color: transparent !important;
  outline: none !important;
  outline-offset: 0;
  box-shadow: none !important;
}

.nav-link {
  position: relative;
}

.nav-link.active {
  color: #fff;
  background-color: transparent;
}

nav .nav-link {
  color: #a7abb4;
  padding-inline: 0.85rem;
}

nav .nav-link:hover {
  background: transparent;
  color: #fff;
}

nav .nav-link.active::after {
  position: absolute;
  right: 0.85rem;
  bottom: -0.8rem;
  left: 0.85rem;
  height: 1px;
  background: var(--accent);
  content: "";
}

.heroSwiper,
.heroSwiper.rounded-2xl {
  isolation: isolate;
  border: 0;
  border-radius: 8px !important;
  box-shadow: none;
  background: #101115;
  overflow: hidden;
}

.heroSwiper .swiper-slide {
  height: clamp(360px, 40vw, 460px);
}

.hero-image {
  position: absolute;
  inset: 0;
  object-position: center 42%;
  filter: saturate(0.82);
  transition: transform 0.9s ease, filter 0.5s ease;
}

.hero-slide-active .hero-image,
.heroSwiper .swiper-slide-active .hero-image {
  transform: scale(1.025);
  filter: saturate(0.95);
}

.hero-overlay {
  background:
    linear-gradient(90deg, rgba(9, 10, 13, 0.94) 0%, rgba(9, 10, 13, 0.72) 36%, rgba(9, 10, 13, 0.08) 78%),
    linear-gradient(0deg, rgba(9, 10, 13, 0.78), transparent 58%);
  align-items: flex-start;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #f0a3a8;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.hero-kicker span,
.hero-meta span {
  width: 1.5rem;
  height: 1px;
  background: var(--accent);
}

#page-home .hero-title {
  max-width: 42rem;
  font-size: clamp(2rem, 4vw, 3.35rem);
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.055em !important;
  line-height: 1.08;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #d3d5da;
  font-size: 0.75rem;
  font-weight: 500;
}

.hero-meta i {
  margin-right: -0.5rem;
  color: #f2c46d;
  font-size: 0.65rem;
}

.hero-overview {
  max-width: 38rem;
  color: #c3c5ca;
  line-height: 1.75;
}

.hero-primary {
  background: var(--accent);
  transition: background-color 0.2s ease;
}

.hero-primary:hover {
  background: #c91e29;
}

.movie-card {
  display: block;
  width: 100%;
  background: transparent;
  border-color: transparent;
  padding: 0;
  color: inherit;
}

.movie-card:hover {
  border-color: transparent;
}

.poster-container {
  position: relative;
  width: 100%;
  padding-top: 145%;
  overflow: hidden;
  background: var(--surface);
  border-radius: 4px;
}

.poster-container::after {
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.22));
  content: "";
  pointer-events: none;
}

.poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.movie-card:hover .poster-img,
.movie-card.tv-focused .poster-img {
  transform: scale(1.035);
  filter: brightness(1.08);
}

.movie-card h4 {
  margin-top: 0.7rem;
  line-height: 1.45;
  transition: color 0.18s ease;
}

.movie-card:hover h4 {
  color: #fff;
}

.movie-card > div:last-child {
  color: var(--muted);
}

.movie-card > div:last-child span:last-child {
  background: transparent;
  color: #aeb2bb;
  letter-spacing: 0.015em;
}

.movie-card .poster-container > span {
  z-index: 1;
  backdrop-filter: blur(8px);
}

.movie-card .poster-container > span {
  padding: 0.3rem 0.45rem;
  background: rgba(9, 10, 13, 0.78);
  border-radius: 3px;
}

.tv-focusable {
  outline: none !important;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.tv-focusable:focus-visible,
.tv-focused {
  outline: 2px solid var(--accent) !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(229, 9, 20, 0.18) !important;
  z-index: 40 !important;
}

.tv-focused {
  border-color: var(--accent) !important;
}

.heroSwiper {
  margin-bottom: 3.25rem;
}

.swiper-button-next,
.swiper-button-prev {
  width: 2.35rem;
  height: 2.35rem;
  background: rgba(9, 10, 13, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff !important;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
  background: var(--accent);
}

.swiper-button-next::after,
.swiper-button-prev::after {
  font-size: 0.85rem;
}

.swiper-pagination-bullet {
  width: 0.35rem;
  height: 0.35rem;
  background: rgba(255, 255, 255, 0.6);
  opacity: 1;
}

.swiper-pagination-bullet-active {
  width: 1.25rem;
  background: var(--accent);
}

.spa-page h1,
.spa-page h2 {
  letter-spacing: -0.04em;
}

.spa-page h2 {
  font-size: 1.2rem;
}

.spa-page h2 > span:first-child {
  width: 2px;
  height: 1.15em;
  background: var(--accent) !important;
}

.spa-page .mb-10 {
  margin-bottom: 3rem;
}

.catalog-heading {
  margin-bottom: 1.1rem;
}

.spa-page .mb-4 > button {
  color: #c3c5ca;
}

.spa-page .mb-4 > button:hover {
  color: #fff;
}

select,
input[type="text"] {
  border-radius: 4px;
}

#search-input {
  border-radius: 6px;
}

select:focus,
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.12);
}

#page-watch .lg\:col-span-2 + div,
#tv-guide-modal > div {
  background-color: rgba(17, 21, 30, 0.84);
  border-color: var(--line);
  border-radius: 8px;
}

.explore-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}

.explore-tab {
  position: relative;
  padding: 0.45rem 0.75rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.explore-tab:hover,
.explore-tab.active {
  color: #fff;
}

.explore-tab.active::after {
  position: absolute;
  right: 0.75rem;
  bottom: -1px;
  left: 0.75rem;
  height: 2px;
  background: var(--accent);
  content: "";
}

.explore-filters {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  background: rgba(17, 21, 30, 0.72);
}

.explore-filters h1 {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: #c3c5ca;
  font-size: 0.72rem;
  font-weight: 600;
}

.explore-filters h1 i {
  color: var(--accent);
}

.explore-filter-fields {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  min-width: 0;
}

.explore-filter-fields > div {
  min-width: 0;
}

.explore-filter-fields label {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1;
}

.explore-filter-fields select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 1.85rem;
  padding: 0.25rem 1.35rem 0.25rem 0.4rem;
  border: 1px solid var(--line);
  background: #111317;
  color: #e4e5e8;
  font-size: 0.68rem;
  line-height: 1.2;
  text-overflow: ellipsis;
}

.episode-btn {
  min-height: 2.5rem;
  border-radius: 4px;
}

.player-toolbar {
  min-height: 3rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  background: rgba(17, 19, 23, 0.82);
  border-radius: 6px;
}

.quality-control {
  color: #aeb2bb;
  font-size: 0.75rem;
  font-weight: 600;
}

.quality-control i {
  color: var(--accent);
}

.quality-control select {
  width: 7rem;
  min-width: 0;
  flex: 0 0 7rem;
  padding: 0.4rem 1.8rem 0.4rem 0.55rem;
  border: 1px solid var(--line);
  background: #111317;
  color: #fff;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  border-radius: 4px;
}

.quality-control select:disabled {
  color: #8e929b;
  cursor: wait;
}

.next-episode-btn {
  min-height: 2.25rem;
  padding: 0.5rem 0.8rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  transition: background-color 0.18s ease, opacity 0.18s ease;
}

.next-episode-btn:hover:not(:disabled) {
  background: #c91e29;
}

.next-episode-btn:disabled {
  background: #292c33;
  color: #858a94;
  cursor: not-allowed;
}

.player-frame > .plyr {
  flex: 1 1 100%;
  width: 100%;
  height: 100%;
  min-width: 0;
}

.player-frame,
.player-frame.rounded-2xl {
  border-radius: 8px !important;
}

.player-frame .plyr__video-wrapper,
.player-frame video {
  width: 100%;
  height: 100%;
}

.player-embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.catalog-status,
.watch-source-status {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  background: rgba(17, 19, 23, 0.82);
  color: #c3c5ca;
  font-size: 0.8rem;
  line-height: 1.5;
}

.catalog-status.is-error,
.watch-source-status.is-error {
  border-color: rgba(237, 38, 50, 0.55);
  color: #ffb8bd;
}

.catalog-status.is-warning,
.watch-source-status.is-warning {
  border-color: rgba(245, 158, 11, 0.45);
  color: #f5d28b;
}

.explore-load-more {
  display: block;
  min-width: 10rem;
  margin: 1.5rem auto 0;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: #fff;
  font-size: 0.8rem;
}

.explore-load-more:disabled {
  color: var(--muted);
  cursor: wait;
}

.player-frame video {
  object-fit: contain;
}

.nav-link.active i {
  color: var(--accent);
}

#tv-guide-modal {
  background: rgba(0, 0, 0, 0.82);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--page-bg);
}

::-webkit-scrollbar-thumb {
  background: #394151;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

@media (max-width: 767px) {
  body {
    background-image: radial-gradient(ellipse at 50% -10%, rgba(54, 35, 39, 0.18), transparent 50%);
  }

  #main-header > div {
    height: 3.75rem;
  }

  .explore-filters {
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    padding: 0.45rem;
  }

  .explore-filters h1 {
    gap: 0;
  }

  .explore-filters h1 span,
  .explore-filter-fields label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .explore-filter-fields {
    gap: 0.3rem;
  }

  .explore-filter-fields select {
    min-height: 1.8rem;
    padding: 0.25rem 1.1rem 0.25rem 0.3rem;
    font-size: 0.62rem;
  }

  .explore-tab {
    padding: 0.4rem 0.6rem;
    font-size: 0.7rem;
  }

  .nav-link.active {
    color: #fff;
  }

  .nav-link.active i {
    color: var(--accent);
  }

  .heroSwiper {
    margin-bottom: 2.4rem;
  }

  .heroSwiper .swiper-slide {
    height: clamp(390px, 112vw, 460px);
  }

  .hero-overlay {
    background:
      linear-gradient(0deg, rgba(9, 10, 13, 0.96) 0%, rgba(9, 10, 13, 0.75) 45%, rgba(9, 10, 13, 0.05) 100%);
    padding: 1.5rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-overview {
    font-size: 0.75rem;
  }

  .swiper-button-next,
  .swiper-button-prev {
    display: none;
  }

  .spa-page h2 {
    font-size: 1.05rem;
  }

  .spa-page .mb-10 {
    margin-bottom: 2.25rem;
  }

  .player-toolbar {
    flex-wrap: wrap;
  }

  .quality-control {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .next-episode-btn {
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
