/* Compact controls stay over the image, preserving each video's original ratio. */
.video-player {
  --vp-progress: 0%;
  --vp-buffered: 0%;
  --vp-accent: var(--gold, #d69a10);
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #09080c;
  color: #f6effb;
  line-height: 1;
  cursor: auto;
  -webkit-tap-highlight-color: transparent;
}

.video-player > video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
  background: #09080c;
  cursor: auto;
}

body.video-player-hover .cursor { opacity: 0; }

.video-player [hidden] {
  display: none !important;
}

.video-player:focus-visible {
  outline: 2px solid var(--vp-accent);
  outline-offset: -3px;
}

.vp-overlay {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid #f6effb40;
  border-radius: 50%;
  background: #100d056b;
  color: #f6effb;
  transform: translate(-50%, -50%);
  opacity: 1;
  cursor: pointer;
  transition: opacity .18s, background-color .18s, border-color .18s;
}

.vp-overlay svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0;
  pointer-events: none;
}

.vp-overlay:hover {
  border-color: var(--vp-accent);
  background: #100d05a8;
}

.video-player.is-playing .vp-overlay {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.vp-controls {
  position: absolute;
  z-index: 3;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 5px;
  background: linear-gradient(transparent, #09080c45 44%, #09080ca6);
  opacity: 1;
  transition: opacity .2s;
}

.vp-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  height: 36px;
}

.vp-control {
  appearance: none;
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #f6effb;
  cursor: pointer;
  transition: color .15s, background-color .15s;
}

.vp-control svg {
  display: block;
  width: 17px;
  height: 17px;
  pointer-events: none;
}

.vp-control:hover {
  background: #f6effb12;
  color: var(--vp-accent);
}

.vp-control:disabled {
  opacity: .4;
  cursor: default;
}

.vp-control:focus-visible,
.vp-overlay:focus-visible {
  outline: 2px solid var(--vp-accent);
  outline-offset: 2px;
}

.vp-time {
  flex: 0 0 auto;
  padding-inline: 3px;
  color: #f6effbd9;
  font: 10px/1 var(--mono, monospace);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow: 0 1px 3px #000;
}

.vp-spacer {
  flex: 1 1 auto;
  min-width: 0;
}

.video-player .vp-progress {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  flex: 0 0 24px;
  width: 100%;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--vp-accent);
  cursor: pointer;
  touch-action: pan-y;
}

.vp-progress::-webkit-slider-runnable-track {
  height: 2px;
  border: 0;
  border-radius: 2px;
  background: linear-gradient(to right, var(--vp-accent) 0 var(--vp-progress), transparent var(--vp-progress) 100%),
    linear-gradient(to right, #f6effb80 0 var(--vp-buffered), #f6effb38 var(--vp-buffered) 100%);
}

.vp-progress::-moz-range-track {
  height: 2px;
  border: 0;
  border-radius: 2px;
  background: linear-gradient(to right, var(--vp-accent) 0 var(--vp-progress), transparent var(--vp-progress) 100%),
    linear-gradient(to right, #f6effb80 0 var(--vp-buffered), #f6effb38 var(--vp-buffered) 100%);
}

.vp-progress::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 6px;
  height: 6px;
  margin-top: -2px;
  border: 0;
  border-radius: 50%;
  background: var(--vp-accent);
}

.vp-progress::-moz-range-thumb {
  width: 6px;
  height: 6px;
  border: 0;
  border-radius: 50%;
  background: var(--vp-accent);
}

.video-player .vp-progress:focus-visible {
  outline: 2px solid var(--vp-accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.vp-status {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 40px);
  padding: 11px 15px;
  border: 1px solid #f6effb26;
  border-radius: 4px;
  background: #100d05e6;
  color: #f6effb;
  font: 11px/1.6 var(--body, sans-serif);
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.video-player:fullscreen {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  background: #000;
}

.video-player:fullscreen > video {
  background: #000;
}

.video-player:fullscreen .vp-controls {
  padding-right: max(24px, env(safe-area-inset-right));
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  padding-left: max(24px, env(safe-area-inset-left));
}

.video-player.is-playing.is-idle .vp-controls {
  opacity: 0;
  pointer-events: none;
}

.video-player.is-away .vp-controls,
.video-player.is-away .vp-overlay {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: none;
}

.video-player.is-playing.is-idle:focus-visible .vp-controls,
.video-player.is-playing.is-idle:has(:focus-visible) .vp-controls,
.video-player.is-away:focus-visible .vp-controls,
.video-player.is-away:has(:focus-visible) .vp-controls,
.video-player.is-away:not(.is-playing):focus-visible .vp-overlay,
.video-player.is-away:not(.is-playing):has(:focus-visible) .vp-overlay {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
  .video-player.is-playing.is-idle,
  .video-player.is-playing.is-idle > video {
    cursor: none;
  }

}

@media (pointer: coarse) {
  .vp-control {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }

  .vp-toolbar {
    height: 44px;
  }

  .video-player .vp-progress {
    flex-basis: 30px;
    height: 30px;
  }
}

@media (max-width: 480px) {
  .vp-controls {
    padding: 18px 10px 4px;
  }

  .vp-toolbar {
    gap: 1px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .video-player *,
  .video-player *::before,
  .video-player *::after {
    transition: none;
  }
}
