.player-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
}

.player-modal.hidden {
  display: none;
}

.player-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
  overflow: hidden;
}

.player-video-frame {
  position: absolute;
  inset: 0;
  z-index: 0;
}

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

.player-video-frame.is-mini {
  position: absolute;
  inset: auto;
  right: 100px;
  bottom: 130px;
  width: min(30vw, 540px);
  height: auto;
  aspect-ratio: 16 / 9;
  z-index: 20;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.7);
}

.player-video-frame.is-mini .player-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.player-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* endscreen: lascia vivo solo il back button, senza gradiente top */
.player-overlay.is-blocked {
  opacity: 1;
  pointer-events: none;
}

.player-overlay.is-blocked .overlay-top {
  background: transparent;
  pointer-events: none;
}

.player-overlay.is-blocked .overlay-title-wrap,
.player-overlay.is-blocked .overlay-bottom {
  display: none;
}

.player-overlay.is-blocked .back-chevron-button {
  display: inline-flex;
  pointer-events: auto;
}

.overlay-top {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 16px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
}

.back-chevron-button {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  padding: 0;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
  flex: 0 0 auto;
}

.back-chevron-button:hover {
  color: #fff;
  transform: scale(1.04);
}

.overlay-title-wrap {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding-top: 1px;
}

.overlay-title {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.08;
}

.overlay-subtitle {
  font-size: 16px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overlay-top.has-subtitle {
  align-items: flex-start;
}

.overlay-top.has-subtitle .back-chevron-button {
  margin-top: 8px;
}

.overlay-bottom {
  position: relative;
  padding: 18px 18px 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
}

.player-skip-intro-button {
  position: absolute;
  right: 18px;
  bottom: 260px;
  z-index: 40;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  min-height: 48px;
  padding: 11px 20px 11px 16px;

  border: none;
  border-radius: 4px;
  background: #fff;
  color: #0d1118;

  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  outline: none;

  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  line-height: 1;

  cursor: pointer;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.22s ease;
}

.player-skip-intro-button:focus,
.player-skip-intro-button:focus-visible {
  outline: none;
  box-shadow: none;
}

.player-skip-intro-button:hover {
  opacity: 0.92;
}

.player-skip-intro-button .details-play-icon,
.player-skip-intro-button .player-skip-intro-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  pointer-events: none;
}

.player-skip-intro-button svg {
  display: block;
  flex: 0 0 auto;
  pointer-events: none;
}

.player-skip-intro-button span:last-child {
  pointer-events: none;
}

.player-skip-intro-button.hidden {
  display: none !important;
}

.player-skip-intro-button.is-hiding {
  opacity: 0;
  pointer-events: none;
}

.controls-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
}

.controls-center {
  display: flex;
  align-items: center;
  gap: 0;
}

.controls-right {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
}

.player-control-button {
  width: 58px;
  min-width: 58px;
  height: 68px;
  border: none;
  border-radius: 999px;
  padding: 0;
  margin: 0 -8px;
  background: transparent;
  color: #fff;
  opacity: 0.5;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.player-control-button:hover {
  color: #fff;
  opacity: 1;
}

.player-control-button-icon svg {
  display: block;
  flex: 0 0 auto;
}

.player-back-svg {
  width: 28px;
  height: 28px;
}

.player-episode-nav-svg {
  width: 38px;
  height: 38px;
}

.player-skip-svg {
  width: 44px;
  height: 44px;
}

.player-play-svg,
.player-pause-svg {
  width: 50px;
  height: 50px;
}

.player-volume-svg,
.player-fullscreen-svg {
  width: 40px;
  height: 40px;
}

.player-control-main {
  width: 66px;
  min-width: 66px;
  height: 78px;
}

.player-control-main:hover {
  color: #fff;
}

.player-control-placeholder {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.progress-wrap {
  display: grid;
  grid-template-columns: 78px 1fr 78px;
  align-items: center;
  gap: 12px;
  margin-bottom: 60px;
}

.time-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.timeline-wrap {
  position: relative;
  width: 100%;
  height: 24px;
  display: flex;
  align-items: center;
}

.timeline-visual {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 999px;
  pointer-events: none;
}

.timeline-tooltip {
  position: absolute;
  bottom: 18px;
  left: 0;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
  font-size: 14px;
  padding: 5px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.timeline-tooltip.visible {
  opacity: 1;
}

#progressBar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  background: transparent;
  position: relative;
  z-index: 2;
}

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

#progressBar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  margin-top: -5px;
  cursor: pointer;
  border: none;
}

#progressBar::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

#progressBar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  cursor: pointer;
}

#fullscreenButton .icon-collapse {
  display: none;
}

#fullscreenButton.is-fullscreen .icon-expand {
  display: none;
}

#fullscreenButton.is-fullscreen .icon-collapse {
  display: block;
}

.timeline-preview {
  position: absolute;
  bottom: 38px;
  left: 0;
  transform: translateX(-50%);
  width: 160px;
  height: 90px;
  border-radius: 6px;
  background: #000;
  background-size: cover;
  background-repeat: no-repeat;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 1;
}

#playerNextEpisodeButton {
  bottom: 260px;
}

.timeline-preview.visible {
  opacity: 1;
}

/* ===== volume ===== */

.volume-control {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 68px;
  min-width: 68px;
  height: 68px;
}

.volume-slider-wrap {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 6px);
  padding-bottom: 4px;
  transform: translateX(-50%);
  width: 18px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 2;
}

.volume-control.is-open .volume-slider-wrap {
  opacity: 1;
  pointer-events: auto;
}

#volumeButton {
  position: relative;
  z-index: 3;
}

#volumeButton.is-muted {
  color: rgba(255, 255, 255, 0.46);
}

.volume-icon-on,
.volume-icon-muted {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#volumeButton .volume-icon-muted {
  display: none;
}

#volumeButton.is-muted .volume-icon-on {
  display: none;
}

#volumeButton.is-muted .volume-icon-muted {
  display: inline-flex;
}

#volumeSlider {
  -webkit-appearance: none;
  appearance: none;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 20px;
  height: 88px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

#volumeSlider::-webkit-slider-runnable-track {
  width: 3px;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    to top,
    #fff 0%,
    #fff var(--volume-fill, 100%),
    rgba(255, 255, 255, 0.28) var(--volume-fill, 100%),
    rgba(255, 255, 255, 0.28) 100%
  );
}

#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  margin-left: -4px;
  cursor: pointer;
}

#volumeSlider::-moz-range-track {
  width: 3px;
  height: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

#volumeSlider::-moz-range-progress {
  width: 4px;
  border-radius: 999px;
  background: #fff;
}

#volumeSlider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

/* ===== responsive ===== */

@media (max-width: 768px) {
  .volume-control {
    display: none;
  }

  .controls-right {
    gap: 0;
  }

  .player-video-frame.is-mini {
    position: absolute;
    left: 48px;
    right: 48px;
    bottom: 48px;
    width: auto;
    max-width: none;
    margin: 0;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .details-actions {
    flex-direction: column;
    align-items: center;
  }

  .details-actions > button {
    width: min(100%, 320px);
  }
}

@media (max-width: 950px) and (orientation: landscape) {
  .player-skip-intro-button,
  #playerNextEpisodeButton {
    right: 12px;
    bottom: 102px;
    min-height: 42px;
    padding: 9px 16px 9px 14px;
    font-size: 14px;
  }

  .overlay-top {
    gap: 6px;
    padding: 10px 12px;
  }

  .back-chevron-button {
    width: 30px;
    height: 30px;
  }

  .overlay-title-wrap {
    gap: 1px;
    padding-top: 0;
  }

  .overlay-title {
    font-size: 18px;
    line-height: 1.12;
    max-width: 72vw;
  }

  .overlay-subtitle {
    font-size: 12px;
    line-height: 1.15;
    max-width: 72vw;
    color: rgba(255, 255, 255, 0.62);
  }

  .overlay-bottom {
    padding: 10px 12px 12px;
  }

  .controls-row {
    min-height: 46px;
    margin-bottom: 2px;
  }

  .controls-center {
    gap: 2px;
  }

  .controls-right {
    gap: 2px;
  }

  .player-control-button {
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 0;
  }

  .player-control-main {
    width: 56px;
    min-width: 56px;
    height: 56px;
  }

  .player-back-svg {
    width: 24px;
    height: 24px;
  }

  .player-episode-nav-svg {
    width: 30px;
    height: 30px;
  }

  .player-skip-svg {
    width: 34px;
    height: 34px;
  }

  .player-play-svg,
  .player-pause-svg {
    width: 36px;
    height: 36px;
  }

  .player-volume-svg,
  .player-fullscreen-svg {
    width: 30px;
    height: 30px;
  }

  .volume-control {
    display: none;
  }

  .volume-slider-wrap {
    width: 16px;
    height: 88px;
    bottom: 100%;
    padding-bottom: 10px;
  }

  #volumeSlider {
    width: 16px;
    height: 88px;
  }

  .progress-wrap {
    grid-template-columns: 56px 1fr 56px;
    gap: 8px;
    margin-bottom: 10px;
  }

  .time-label {
    font-size: 12px;
  }

  .timeline-wrap {
    height: 20px;
  }

  .timeline-visual {
    height: 3px;
  }

  #progressBar {
    height: 20px;
  }

  #progressBar::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    margin-top: -4.5px;
  }

  #progressBar::-moz-range-thumb {
    width: 12px;
    height: 12px;
  }

  .timeline-preview {
    width: 120px;
    height: 68px;
    bottom: 30px;
  }

  .timeline-tooltip {
    bottom: 14px;
    font-size: 12px;
    padding: 4px 6px;
  }
}