/* 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;
}

@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;
}

/* Main stage is an iframe; hide chrome that targets Video.js only */
.ott-player-shell.ott-youtube-mode .ott-center-play,
.ott-player-shell.ott-youtube-mode #ott-progress-wrap,
.ott-player-shell.ott-youtube-mode #ott-skip-intro,
.ott-player-shell.ott-youtube-mode #ott-skip-recap,
.ott-player-shell.ott-youtube-mode .space-y-2 > div:first-child,
.ott-player-shell.ott-youtube-mode .ott-glass-bar > div:first-child,
.ott-player-shell.ott-youtube-mode #ott-controls > div.pointer-events-none.absolute,
.ott-player-shell.ott-youtube-mode #ott-theater,
.ott-player-shell.ott-youtube-mode #ott-mini,
.ott-player-shell.ott-youtube-mode #ott-pip {
  display: none !important;
}

.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;
}

@media (max-width: 639px) {
  .ott-progress-wrap {
    height: 10px;
  }
}

.ott-buffer {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.18);
}

.ott-progress {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e50914, #ff4b5c);
  box-shadow: 0 0 18px rgba(229, 9, 20, 0.55);
}

.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;
}

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

.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;
}

.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);
}

.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;
}
