:root {
  --brand-red: #e50914;
  --bg-900: #141414;
  --bg-800: #181818;
  --bg-700: #202020;
  --text-main: #ffffff;
  --text-muted: #c8c8c8;
  --glass: rgba(20, 20, 20, 0.62);
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --transition-fast: 180ms ease;
  --transition-med: 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 8% 12%, rgba(229, 9, 20, 0.26), transparent 40%),
    radial-gradient(circle at 86% 16%, rgba(255, 255, 255, 0.08), transparent 30%),
    linear-gradient(180deg, #101010 0%, #131313 55%, #0d0d0d 100%);
  color: var(--text-main);
  overflow-x: hidden;
}

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

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

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

.top-nav {
  position: fixed;
  inset: 0 0 auto;
  height: 72px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.2rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.1));
  backdrop-filter: blur(12px);
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links .is-active {
  color: var(--text-main);
  transform: translateY(-1px);
}

.nav-logout {
  padding: 0.46rem 0.82rem;
  font-size: 0.82rem;
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 20, 20, 0.68);
  place-items: center;
  gap: 4px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}

.icon-btn {
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.icon-btn svg {
  width: 21px;
  height: 21px;
  fill: #fff;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: rgba(229, 9, 20, 0.9);
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 8px 18px rgba(229, 9, 20, 0.32);
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(145deg, #2f2f2f, #101010);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.profile-avatar span {
  font-weight: 700;
}

.search-wrap {
  width: 0;
  overflow: hidden;
  opacity: 0;
  transition: width var(--transition-med), opacity var(--transition-med);
}

.search-wrap.is-open {
  width: 220px;
  opacity: 1;
}

.search-input {
  width: 100%;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0 1rem;
  background: rgba(0, 0, 0, 0.45);
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.page-shell {
  padding-top: 72px;
}

.hero {
  position: relative;
  min-height: min(74vh, 700px);
  display: flex;
  align-items: end;
  padding: 0 2.2rem 2.2rem;
}

.hero-backdrop,
.hero-gradient {
  position: absolute;
  inset: 0;
  border-bottom-left-radius: 26px;
  border-bottom-right-radius: 26px;
}

.hero-backdrop {
  background:
    radial-gradient(circle at 22% 30%, rgba(255, 255, 255, 0.18), transparent 45%),
    linear-gradient(140deg, #272727 10%, #181818 35%, #101010 100%);
  filter: saturate(1.08);
  overflow: hidden;
}

.theme-red {
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.28), transparent 45%),
    linear-gradient(145deg, #7f0c15 0%, #1b1f3d 50%, #101010 100%);
}

.theme-blue {
  background:
    radial-gradient(circle at 70% 22%, rgba(255, 255, 255, 0.2), transparent 35%),
    linear-gradient(140deg, #250f1e 0%, #112e4a 55%, #090909 100%);
}

.theme-ember {
  background:
    radial-gradient(circle at 20% 26%, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(145deg, #2f1118 0%, #1b1b3e 53%, #090909 100%);
}

.theme-onyx {
  background:
    radial-gradient(circle at 70% 18%, rgba(255, 255, 255, 0.18), transparent 40%),
    linear-gradient(145deg, #181818 0%, #1e1f28 55%, #0a0a0a 100%);
}

.hero-backdrop__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 24%;
  display: block;
  opacity: 0.9;
  filter: saturate(1.06);
}

.hero-gradient {
  background:
    linear-gradient(0deg, rgba(10, 10, 10, 0.96) 2%, rgba(10, 10, 10, 0.34) 42%, rgba(10, 10, 10, 0.16) 64%, rgba(10, 10, 10, 0.84) 100%),
    linear-gradient(90deg, rgba(20, 20, 20, 0.9) 0%, rgba(20, 20, 20, 0.2) 58%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  display: grid;
  gap: 0.85rem;
  animation: rise-in 0.8s var(--transition-med);
}

.hero-kicker {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.76rem;
  color: #f1f1f1;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.05;
}

.hero p {
  margin: 0;
  color: var(--text-muted);
  max-width: 58ch;
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
  color: #ececec;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.74rem 1.15rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #ed1722, #c7050f 72%);
  box-shadow: 0 10px 22px rgba(229, 9, 20, 0.38);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(229, 9, 20, 0.48);
}

.btn-secondary {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: rgba(255, 255, 255, 0.24);
}

.btn-muted {
  color: #ebebeb;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  cursor: not-allowed;
}

.rows {
  padding: 0.4rem 2.2rem 2.4rem;
  display: grid;
  gap: 1.6rem;
}

.my-list {
  margin: 0 2.2rem 2.2rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--glass);
  backdrop-filter: blur(8px);
}

.my-list h2,
.my-list p {
  margin: 0;
}

.my-list p {
  margin-top: 0.5rem;
  color: var(--text-muted);
}

.movie-page .hero--movie {
  min-height: min(76vh, 760px);
}

.movie-tagline {
  color: #fff;
  font-style: italic;
}

.row {
  display: grid;
  gap: 0.8rem;
}

.row h2 {
  margin: 0;
  font-size: 1.2rem;
}

.row-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(170px, 210px);
  gap: 0.9rem;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.movie-card {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--radius-md);
  aspect-ratio: 2 / 3;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  background: var(--bg-700);
  transition: transform var(--transition-med), box-shadow var(--transition-med), filter var(--transition-med);
}

.movie-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.14) 0%, rgba(0, 0, 0, 0.12) 38%, rgba(0, 0, 0, 0.72) 100%);
}

.movie-card__poster {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.movie-card__poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.movie-card__content {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.85rem;
  gap: 0.38rem;
}

.movie-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.movie-card__meta {
  margin: 0;
  color: #e4e4e4;
  font-size: 0.86rem;
}

.movie-card__badge {
  margin: 0;
  width: fit-content;
  border-radius: 999px;
  padding: 0.14rem 0.5rem;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.movie-card__play {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
  display: grid;
  place-items: center;
}

.movie-card__play svg {
  width: 20px;
  fill: #fff;
}

.movie-card__progress {
  position: relative;
  height: 4px;
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.movie-card__progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.18);
}

.movie-card__progress::-webkit-progress-value {
  background: linear-gradient(90deg, #ff3642, var(--brand-red));
}

.movie-card__progress::-moz-progress-bar {
  background: linear-gradient(90deg, #ff3642, var(--brand-red));
}

.movie-card:hover,
.movie-card:focus-visible {
  transform: translateY(-4px) scale(1.016);
  filter: saturate(1.1);
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.54), 0 0 0 1px rgba(229, 9, 20, 0.4);
}

.movie-card:hover .movie-card__play,
.movie-card:focus-visible .movie-card__play {
  opacity: 1;
  transform: translateY(0);
}

.movie-card:hover .movie-card__play {
  background: rgba(229, 9, 20, 0.88);
}

.empty-state {
  margin: 1rem 0;
  color: var(--text-muted);
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  place-items: center;
  gap: 1rem;
  background: radial-gradient(circle at 50% 25%, rgba(229, 9, 20, 0.22), rgba(12, 12, 12, 0.94) 50%);
  opacity: 0;
  transition: opacity var(--transition-med);
}

.loading-screen--boot {
  display: grid;
  opacity: 1;
}

.loading-screen.is-visible {
  display: grid;
  opacity: 1;
}

.loading-screen__logo,
.player-loading__logo {
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5));
}

.loading-screen__spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--brand-red);
  animation: spin 0.85s linear infinite;
}

.info-modal,
.player-shell,
.resume-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}

.info-modal.is-open,
.player-shell.is-open,
.resume-modal.is-open {
  display: block;
}

.info-modal__backdrop,
.player-backdrop,
.resume-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 4, 0.7);
  backdrop-filter: blur(8px);
}

.info-modal__panel,
.resume-modal__panel {
  position: relative;
  width: min(560px, calc(100vw - 2rem));
  margin: 14vh auto 0;
  background: linear-gradient(180deg, rgba(35, 35, 35, 0.96), rgba(16, 16, 16, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  box-shadow: var(--shadow-lg);
}

.info-meta {
  color: #d7d7d7;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}

.player-modal {
  position: relative;
  width: min(1200px, 100vw);
  height: min(94vh, 760px);
  margin: 3vh auto 0;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-lg);
}

.player-page-shell {
  height: 100vh;
}

.player-modal--full {
  width: 100vw;
  height: 100vh;
  margin: 0;
  border-radius: 0;
}

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

.player-loading {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  gap: 1rem;
  background: radial-gradient(circle at 48% 25%, rgba(229, 9, 20, 0.24), rgba(0, 0, 0, 0.9) 48%);
  z-index: 3;
}

.player-loading.is-visible {
  display: grid;
}

.center-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 0;
  display: none;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  cursor: pointer;
  z-index: 2;
}

.center-play svg {
  width: 34px;
  fill: #fff;
}

.player-ui {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  pointer-events: none;
  opacity: 1;
  transition: opacity var(--transition-fast);
}

.player-ui > * {
  pointer-events: auto;
}

body.player-controls-hidden .player-ui,
.player-shell.controls-hidden .player-ui {
  opacity: 0;
}

.player-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent);
}

.player-top h3 {
  margin: 0;
  font-size: 1rem;
}

.player-top-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.player-top__meta {
  margin: 0.2rem 0 0;
  color: #d8d8d8;
  font-size: 0.82rem;
}

.timeline-wrap {
  align-self: end;
  position: relative;
  margin: 0 1rem 0.35rem;
}

.timeline-buffer {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
  width: 0;
  pointer-events: none;
}

.timeline {
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  cursor: pointer;
}

.timeline::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(229, 9, 20, 0.5);
}

.timeline::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(229, 9, 20, 0.5);
}

.player-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.4rem 1rem 1rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.92), transparent);
}

.controls-left,
.controls-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.play-pill {
  min-width: 46px;
  height: 46px;
  background: rgba(229, 9, 20, 0.88);
}

#pauseIcon {
  display: none;
}

.time-readout {
  min-width: 100px;
  color: #ebebeb;
  font-size: 0.9rem;
}

.volume {
  width: 90px;
}

.speed-select {
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 0 0.65rem;
  background: rgba(0, 0, 0, 0.48);
}

.resume-modal__panel {
  text-align: center;
}

.resume-modal__panel p {
  color: var(--text-muted);
}

.resume-modal__actions {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
}

.fade-in {
  animation: fade-in 0.28s ease;
}

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

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

@media (max-width: 960px) {
  .top-nav {
    padding: 0 1rem;
  }

  .hero,
  .rows {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .my-list {
    margin-left: 1rem;
    margin-right: 1rem;
  }

  .row-track {
    grid-auto-columns: minmax(150px, 180px);
  }

  .controls-right .volume {
    display: none;
  }
}

@media (max-width: 760px) {
  .menu-toggle {
    display: grid;
  }

  .nav-links {
    position: absolute;
    left: 1rem;
    top: 68px;
    width: min(260px, calc(100vw - 2rem));
    padding: 0.8rem;
    border-radius: var(--radius-md);
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px);
    flex-direction: column;
    align-items: start;
    transform: scale(0.95);
    transform-origin: top left;
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
  }

  .nav-links.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
  }

  .nav-links--static {
    position: static;
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
    backdrop-filter: none;
    flex-direction: row;
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .hero {
    min-height: min(72vh, 610px);
    padding-bottom: 1.5rem;
  }

  .hero h1 {
    font-size: clamp(1.8rem, 8vw, 2.5rem);
  }

  .search-wrap.is-open {
    width: 150px;
  }

  .player-modal {
    height: 100vh;
    margin-top: 0;
    border-radius: 0;
  }

  .player-controls {
    padding-bottom: 0.8rem;
  }

  .controls-right {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 540px) {
  .time-readout {
    min-width: auto;
    font-size: 0.82rem;
  }

  .controls-left {
    gap: 0.25rem;
  }

  .icon-btn {
    min-width: 34px;
    height: 34px;
  }

  .hero-meta {
    font-size: 0.88rem;
  }
}
