:root {
  color-scheme: dark;
  --bg: #0d0f12;
  --surface: #171a20;
  --surface-2: #20242c;
  --surface-3: #282e38;
  --text: #f6f7f9;
  --muted: #a8afbc;
  --line: #303742;
  --accent: #e43f5a;
  --accent-2: #20b486;
  --focus: #f4b942;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius: 8px;
  --page: min(1240px, calc(100vw - 32px));
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #edf1f5;
  --surface-3: #e2e8f0;
  --text: #151820;
  --muted: #5c6675;
  --line: #d7dde6;
  --accent: #c81d45;
  --accent-2: #117f67;
  --focus: #915f00;
  --shadow: 0 24px 58px rgba(19, 25, 35, 0.13);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

img,
video {
  max-width: 100%;
}

button,
select {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 10px max(16px, calc((100vw - 1240px) / 2));
  padding-inline: max(16px, calc((100vw - 1240px) / 2));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand__logo {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: contain;
}

.brand__name {
  overflow: hidden;
  max-width: min(58vw, 620px);
  font-size: 1.08rem;
  font-weight: 850;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

.icon-button:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.facebook {
  background: #1877f2;
  border-color: #1877f2;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
}

.facebook:hover {
  background: #0f66d8;
  border-color: #0f66d8;
}

.layout {
  width: var(--page);
  margin: 0 auto;
  padding: clamp(14px, 2.4vw, 28px) 0 54px;
}

.player-section {
  display: grid;
  gap: 14px;
  max-width: 1120px;
  margin-inline: auto;
}

.now-playing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
}

.title-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  overflow-wrap: anywhere;
  font-size: clamp(1.3rem, 2.2vw, 2.05rem);
  line-height: 1.12;
}

h2 {
  font-size: clamp(1.06rem, 1.8vw, 1.35rem);
  line-height: 1.15;
}

.now-playing__meta {
  display: flex;
  align-items: end;
  gap: 10px;
}

.quality-control {
  flex-shrink: 0;
}

.countdown {
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: right;
}

.countdown__label {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.2;
}

.countdown strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.2;
  white-space: nowrap;
}

.video-shell {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #050506;
  box-shadow: var(--shadow);
}

.video-shell .plyr,
.video-shell video {
  width: 100%;
  height: 100%;
}

.video-shell .plyr {
  position: relative;
  z-index: 2;
}

.empty-player {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  gap: 9px;
  padding: clamp(18px, 5vw, 42px);
  color: #fff;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(228, 63, 90, 0.2), transparent 38%),
    radial-gradient(circle at center, #252a33 0, #050506 70%);
}

.empty-player strong {
  font-size: clamp(1.35rem, 4vw, 2.6rem);
  line-height: 1.05;
}

.empty-player span {
  color: #d3d7df;
  font-size: clamp(0.9rem, 2.2vw, 1.05rem);
  line-height: 1.35;
}

.player-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px 18px;
  min-height: 46px;
}

.select-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.select-control select {
  min-width: 112px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 34px 0 10px;
}

.select-control select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.selected-description {
  color: var(--muted);
  line-height: 1.45;
  text-align: right;
}

.catalog-section {
  margin-top: clamp(24px, 4vw, 38px);
}

.facebook-section {
  margin-top: clamp(28px, 4vw, 44px);
}

.facebook-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid color-mix(in srgb, #1877f2 45%, var(--line));
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(24, 119, 242, 0.18), transparent 48%),
    var(--surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
}

.facebook-panel__mark {
  display: grid;
  width: clamp(52px, 8vw, 72px);
  height: clamp(52px, 8vw, 72px);
  place-items: center;
  border-radius: var(--radius);
  background: #1877f2;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 1;
}

.facebook-panel__copy {
  min-width: 0;
}

.facebook-panel__copy h2 {
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.facebook-panel__copy p:not(.eyebrow) {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.45;
}

.facebook-cta {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid #1877f2;
  border-radius: var(--radius);
  background: #1877f2;
  color: #fff;
  font-weight: 850;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
  white-space: nowrap;
}

.facebook-cta:hover {
  border-color: #0f66d8;
  background: #0f66d8;
  transform: translateY(-1px);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.movie-count {
  display: inline-flex;
  min-width: 36px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: clamp(10px, 1.5vw, 16px);
}

.movie-card {
  display: grid;
  overflow: hidden;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.movie-card:hover,
.movie-card.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--surface) 88%, var(--accent));
}

.movie-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
}

.movie-card.is-active {
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.movie-card__poster-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--surface-2);
}

.movie-card__poster {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--surface-2);
  object-fit: cover;
  transition: transform 180ms ease;
}

.movie-card:hover .movie-card__poster {
  transform: scale(1.025);
}

.movie-card__badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 5px 7px;
  border-radius: 7px;
  background: rgba(8, 10, 13, 0.78);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.movie-card__body {
  display: grid;
  gap: 7px;
  min-height: 96px;
  padding: 10px;
}

.movie-card__title {
  display: -webkit-box;
  overflow: hidden;
  min-height: 2.35em;
  font-weight: 850;
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.movie-card__meta,
.movie-card__time {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.movie-card__time {
  color: var(--accent-2);
  font-weight: 750;
}

.empty-catalog,
.catalog-error {
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  line-height: 1.45;
}

.catalog-error {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
}

.movie-skeleton {
  min-height: 338px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface-3) 70%, transparent), transparent),
    var(--surface);
  background-size: 220% 100%;
  animation: shimmer 1.2s infinite linear;
}

.plyr {
  --plyr-color-main: var(--accent);
  --plyr-control-radius: 7px;
}

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }

  to {
    background-position: -120% 0;
  }
}

@media (min-width: 980px) {
  .player-section {
    gap: 16px;
  }

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

@media (min-width: 1100px) {
  .player-section {
    max-width: min(1120px, 72vw);
  }
}

@media (max-width: 820px) {
  :root {
    --page: min(100vw - 24px, 1240px);
  }

  .topbar {
    min-height: 62px;
    padding-inline: 12px;
  }

  .brand__logo {
    width: 40px;
    height: 40px;
  }

  .brand__name {
    max-width: calc(100vw - 150px);
    font-size: 1rem;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .now-playing {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

  .now-playing__meta {
    flex-direction: row;
    justify-content: space-between;
  }

  .countdown {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    flex: 1;
  }

  .quality-control {
    flex-shrink: 0;
  }

  .player-toolbar {
    grid-template-columns: 1fr;
  }

  .selected-description {
    text-align: left;
  }

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

  .facebook-panel {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .facebook-cta {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 460px) {
  :root {
    --page: calc(100vw - 20px);
  }

  .topbar {
    gap: 10px;
  }

  .brand {
    gap: 9px;
  }

  .brand__logo {
    width: 38px;
    height: 38px;
  }

  .brand__name {
    max-width: calc(100vw - 138px);
  }

  .actions {
    gap: 6px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .layout {
    padding-bottom: 36px;
  }

  .video-shell {
    border-radius: 7px;
  }

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

  .movie-card__body {
    min-height: 92px;
    padding: 9px;
  }

  .movie-card__badge {
    right: 7px;
    bottom: 7px;
    font-size: 0.72rem;
  }

  .facebook-panel {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .facebook-panel__mark {
    width: 48px;
    height: 48px;
    font-size: 1.9rem;
  }
}

@media (max-width: 360px) {
  .catalog {
    grid-template-columns: 1fr;
  }

  .movie-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .movie-card__poster-wrap {
    height: 144px;
  }

  .movie-card__body {
    align-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Subtítulos Plyr más grandes y más arriba */
.plyr__captions {
  bottom: 3.5em !important;
}

.plyr__captions .plyr__caption {
  font-size: 1.3em !important;
  padding: 0.4em 0.8em !important;
  line-height: 1.4 !important;
}
