/* Watch page: lock document to one viewport height (no outer scroll) */
html:has(body.ott-watch-page) {
  height: 100%;
  overflow: hidden;
}

body.ott-watch-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body.ott-watch-page .ott-watch-layout {
  min-height: 0;
}

/* Largest 16:9 rectangle that fits in the viewport minus watch chrome */
body.ott-watch-page .ott-watch-shell:not(.mini) {
  width: 100%;
  max-width: min(100%, calc((100dvh - 3rem) * 16 / 9));
  max-height: calc(100dvh - 3rem);
  aspect-ratio: 16 / 9;
  margin-inline: auto;
}

body.ott-watch-page .ott-watch-shell:not(.mini):fullscreen,
body.ott-watch-page .ott-watch-shell:not(.mini):-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: unset;
}

/* Video.js fluid uses padding-top; fill the constrained shell instead */
body.ott-watch-page .ott-watch-shell:not(.mini) .video-js.vjs-fluid {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  padding-top: 0 !important;
}

body.ott-watch-page .ott-watch-shell:not(.mini) .video-js .vjs-tech {
  object-fit: contain;
  background: #000;
}

.ott-player-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  background: #000;
  border-radius: clamp(0.75rem, 2.5vw, 1.25rem);
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.65);
}

.ott-player-shell .video-js {
  width: 100% !important;
  max-width: 100%;
}

.ott-player-shell:fullscreen,
.ott-player-shell:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #000;
}

.ott-player-shell:fullscreen .video-js,
.ott-player-shell:-webkit-full-screen .video-js {
  flex: 1 1 auto;
  min-height: 0;
}

video:fullscreen,
video:-webkit-full-screen {
  object-fit: contain;
  background: #000;
}

.ott-player-shell.theater {
  max-width: min(1200px, 96vw);
  margin-inline: auto;
}

body.ott-watch-page .ott-watch-shell.theater:not(.mini) {
  max-width: min(100%, min(1200px, 96vw), calc((100dvh - 3rem) * 16 / 9));
}

.ott-player-shell.mini {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  width: min(360px, calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 1.5rem));
  z-index: 60;
  border-radius: 1rem;
}

.ott-controls {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
  padding-right: max(0.5rem, env(safe-area-inset-right, 0px));
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  padding-left: max(0.5rem, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 38%, transparent 55%, rgba(0, 0, 0, 0.75));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 20;
}

@media (min-width: 640px) {
  .ott-controls {
    padding: 0.75rem 1rem 1rem;
    padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
  }
}

.ott-controls.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Dailymotion embed: hide MOVIX transport (native DM chrome) */
.ott-player-shell.ott-embed-mode:not(.ott-youtube-mode) .ott-center-play,
.ott-player-shell.ott-embed-mode:not(.ott-youtube-mode) #ott-progress-wrap,
.ott-player-shell.ott-embed-mode:not(.ott-youtube-mode) #ott-skip-intro,
.ott-player-shell.ott-embed-mode:not(.ott-youtube-mode) #ott-skip-recap,
.ott-player-shell.ott-embed-mode:not(.ott-youtube-mode) .space-y-2 > div:first-child,
.ott-player-shell.ott-embed-mode:not(.ott-youtube-mode) .ott-glass-bar > div:first-child,
.ott-player-shell.ott-embed-mode:not(.ott-youtube-mode) #ott-controls > div.pointer-events-none.absolute,
.ott-player-shell.ott-embed-mode:not(.ott-youtube-mode) #ott-theater,
.ott-player-shell.ott-embed-mode:not(.ott-youtube-mode) #ott-mini,
.ott-player-shell.ott-embed-mode:not(.ott-youtube-mode) #ott-pip {
  display: none !important;
}

/* YouTube embed: MOVIX transport over iframe; clicks pass through to video in open areas */
.ott-player-shell.ott-youtube-mode #ott-theater,
.ott-player-shell.ott-youtube-mode #ott-mini,
.ott-player-shell.ott-youtube-mode #ott-pip,
.ott-player-shell.ott-youtube-mode #ott-controls > div.pointer-events-none.absolute {
  display: none !important;
}

.ott-player-shell.ott-youtube-mode #ott-controls {
  z-index: 20;
  pointer-events: none;
}

.ott-player-shell.ott-youtube-mode #ott-controls.visible {
  opacity: 1;
  pointer-events: none;
}

.ott-player-shell.ott-youtube-mode #ott-controls.visible button,
.ott-player-shell.ott-youtube-mode #ott-controls.visible input,
.ott-player-shell.ott-youtube-mode #ott-controls.visible #ott-progress-wrap,
.ott-player-shell.ott-youtube-mode #ott-controls.visible #ott-play-toggle,
.ott-player-shell.ott-youtube-mode #ott-controls.visible .ott-glass-bar,
.ott-player-shell.ott-youtube-mode #ott-controls.visible .space-y-2 {
  pointer-events: auto;
}

.ott-player-shell.ott-youtube-mode #ott-controls.visible .space-y-2 {
  position: relative;
  z-index: 22;
}

.ott-player-shell.ott-youtube-mode #ott-controls.visible > .flex.flex-col.gap-2:first-child,
.ott-player-shell.ott-youtube-mode #ott-controls.visible > .flex.flex-col.gap-2.sm\:flex-row {
  position: relative;
  z-index: 12;
  pointer-events: auto;
}

#ott-youtube-host {
  overflow: hidden;
}

/* Block direct iframe taps (mobile + outbound links); all control via MOVIX UI */
.ott-player-shell.ott-youtube-mode #ott-youtube-host,
.ott-player-shell.ott-youtube-mode #ott-youtube-host iframe {
  pointer-events: none !important;
}

#ott-youtube-host .ott-youtube-iframe-wrap,
#ott-youtube-host .ott-youtube-iframe-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
}

#ott-dailymotion-host iframe,
#ott-dailymotion-player,
#ott-dailymotion-player iframe {
  height: 100% !important;
  width: 100% !important;
  border: 0 !important;
}

/* End screen — MOVIX catalog recommendations (covers YouTube/Dailymotion end cards) */
.ott-end-screen {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: #050508;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.ott-end-screen:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.ott-end-screen.hidden {
  display: none !important;
}

.ott-end-screen-inner {
  width: 100%;
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
}

.ott-end-screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ott-end-screen-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.ott-end-screen-actions {
  display: flex;
  gap: 0.5rem;
}

.ott-end-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  backdrop-filter: blur(12px);
  transition: background 0.2s, border-color 0.2s;
}

.ott-end-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 45, 106, 0.45);
}

.ott-end-recs {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.ott-end-recs::-webkit-scrollbar {
  height: 5px;
}

.ott-end-rec-card {
  flex: 0 0 auto;
  width: min(42vw, 200px);
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease;
}

.ott-end-rec-card:hover {
  transform: translateY(-4px);
}

.ott-end-rec-poster {
  aspect-ratio: 16 / 9;
  border-radius: 0.75rem;
  background-size: cover;
  background-position: center;
  background-color: #15151d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.ott-end-rec-title {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ott-player-shell.ott-end-active #ott-youtube-host,
.ott-player-shell.ott-end-active #ott-dailymotion-host,
.ott-player-shell.ott-end-active #ott-youtube-host iframe,
.ott-player-shell.ott-end-active #ott-dailymotion-host iframe {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.ott-player-shell.ott-end-active .ott-end-screen {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.ott-player-shell.ott-end-active #ott-controls {
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 640px) {
  .ott-end-rec-card {
    width: 200px;
  }
}

.ott-glass-bar {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 15, 20, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ott-glass-bar::-webkit-scrollbar {
  display: none;
}

@media (max-width: 639px) {
  .ott-glass-bar {
    border-radius: 1rem;
  }
}

@media (hover: none) and (pointer: coarse) {
  .ott-hit-target {
    min-width: 2.75rem;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

.ott-progress-wrap {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  touch-action: none;
}

.ott-progress-wrap #ott-seek {
  position: absolute;
  inset: 0;
  z-index: 4;
  margin: 0;
  cursor: pointer;
  pointer-events: auto;
}

@media (max-width: 639px) {
  .ott-progress-wrap {
    height: 5px;
    padding: 0;
    margin: 0;
    border-radius: 999px;
    overflow: visible;
  }

  .ott-progress-wrap .ott-progress,
  .ott-progress-wrap .ott-buffer {
    top: 0;
    bottom: 0;
    height: 100%;
    border-radius: 999px;
  }

  .ott-progress-wrap #ott-seek {
    top: -12px;
    bottom: -12px;
    height: auto;
  }
}

.ott-buffer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  height: 100%;
  width: 0%;
  max-width: 100%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.ott-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  right: auto;
  height: 100%;
  width: 0%;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e50914, #ff4b5c);
  box-shadow: 0 0 18px rgba(229, 9, 20, 0.55);
  pointer-events: none;
  transition: none;
}

/* Range sliders: fill track to match value (YouTube + Video.js) */
#ott-volume.ott-volume-slider {
  --vol-fill: 100%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #e50914 0%,
    #ff4b5c var(--vol-fill),
    rgba(255, 255, 255, 0.18) var(--vol-fill),
    rgba(255, 255, 255, 0.18) 100%
  );
  -webkit-appearance: none;
  appearance: none;
  accent-color: transparent;
}

#ott-volume.ott-volume-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: transparent;
}

#ott-volume.ott-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.45);
}

#ott-volume.ott-volume-slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

#ott-volume.ott-volume-slider::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, #e50914, #ff4b5c);
}

#ott-volume.ott-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.45);
}

#ott-seek {
  --seek-fill: 0%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.35) var(--seek-fill),
    transparent var(--seek-fill),
    transparent 100%
  );
}

#ott-seek::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent;
}

#ott-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.5);
}

.ott-scrub-preview {
  position: absolute;
  bottom: 120%;
  transform: translateX(-50%);
  width: 140px;
  height: 78px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background-size: cover;
  background-position: center;
  display: none;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

@media (max-width: 639px) {
  .ott-scrub-preview {
    width: 112px;
    height: 63px;
    font-size: 10px;
  }
}

.ott-center-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.ott-player-shell.ott-youtube-mode .ott-center-play {
  pointer-events: none;
}

.ott-player-shell.ott-youtube-mode #ott-controls.visible #ott-play-toggle {
  pointer-events: auto;
  position: relative;
  z-index: 25;
  min-width: 4.5rem;
  min-height: 4.5rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.ott-player-shell.ott-youtube-mode #ott-play-toggle svg,
.ott-player-shell.ott-youtube-mode #ott-play-icon,
.ott-player-shell.ott-youtube-mode #ott-pause-icon {
  width: 2.25rem;
  height: 2.25rem;
}

@media (max-width: 639px) {
  .ott-player-shell.ott-youtube-mode #ott-controls {
    z-index: 30;
  }

  .ott-player-shell.ott-youtube-mode #ott-controls .space-y-2 {
    z-index: 22;
  }

  .ott-player-shell.ott-youtube-mode #ott-play-toggle {
    min-width: 3.75rem;
    min-height: 3.75rem;
    padding: 0.75rem !important;
  }

  .ott-player-shell.ott-youtube-mode #ott-play-toggle svg,
  .ott-player-shell.ott-youtube-mode #ott-play-icon,
  .ott-player-shell.ott-youtube-mode #ott-pause-icon {
    width: 1.75rem;
    height: 1.75rem;
  }

  .ott-player-shell.ott-youtube-mode #ott-progress-wrap {
    height: 5px;
    min-height: 0;
    display: block;
  }

  .ott-player-shell.ott-youtube-mode #ott-progress-wrap #ott-seek {
    top: -14px;
    bottom: -14px;
    height: auto;
  }

  .ott-player-shell.ott-youtube-mode .ott-glass-bar button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

.ott-center-play button {
  pointer-events: auto;
}

#ott-play-icon,
#ott-pause-icon {
  pointer-events: none;
}

.video-js .vjs-tech {
  outline: none;
}

.ott-spinner {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #e50914;
  animation: ottspin 0.9s linear infinite;
}

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

.ott-banner-host {
  position: absolute;
  inset: 0;
  z-index: 38;
  pointer-events: none;
}

/* Lock controls — right edge, vertically centered */
.ott-lock-btn {
  position: absolute;
  z-index: 36;
  top: 50%;
  right: max(0.75rem, env(safe-area-inset-right));
  left: auto;
  bottom: auto;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.55);
  padding: 0.625rem;
  color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, background 0.2s ease, border-color 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ott-player-shell:has(#ott-controls.visible) .ott-lock-btn,
.ott-player-shell.ott-controls-locked .ott-lock-btn {
  opacity: 1;
  pointer-events: auto;
}

.ott-player-shell.ott-controls-locked #ott-controls {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Transparent shield — block taps on video while locked (unlock btn stays above) */
.ott-player-shell.ott-controls-locked::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 34;
  pointer-events: auto;
  background: transparent;
}

.ott-player-shell.ott-controls-locked .ott-lock-btn {
  z-index: 37;
}

.ott-lock-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.ott-lock-btn svg,
.ott-lock-btn i {
  pointer-events: none;
}

@media (min-width: 640px) {
  .ott-lock-btn {
    right: max(1rem, env(safe-area-inset-right));
    padding: 0.5rem;
  }
}

.ott-banner-host > * {
  pointer-events: auto;
}

.ott-banner-host [data-close],
.ott-banner-host [data-ad-skip] {
  position: relative;
  z-index: 2;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 2.75rem;
  min-width: 2.75rem;
}

.ott-ad-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  min-height: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  touch-action: manipulation;
}

.ott-ad-overlay [data-ad-skip] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 2.75rem;
  min-width: 2.75rem;
}

.ott-ad-overlay .ott-ad-shell {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
}

.ott-ad-overlay .ott-ad-video-stage {
  flex: 1 1 auto;
  min-height: min(42dvh, 100%);
}

.ott-ad-overlay .ott-ad-video-el {
  display: block;
  max-width: 100%;
}

.ott-ad-count {
  font-variant-numeric: tabular-nums;
}
