#videoPlayer {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    margin-inline: auto;
    transition: aspect-ratio var(--motion-base) var(--ease-standard);
}

/* Forced aspect: the box takes the chosen ratio and shrinks to fit the
   viewport so the ratio is never broken by a clamped height. */
#videoPlayer.aspect-forced {
    aspect-ratio: var(--ratio);
    width: min(100%, calc(100vh * var(--ratio)));
}

.video-player-container {
    width: 100%;
    max-height: 100vh;
    object-fit: contain;
    overflow: hidden;
}

.video-player-container {
    position: relative;
}

.controls button {
    background: transparent;
    border: 0;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 16px;
    padding: 12px;
    height: 100%;
    aspect-ratio: 1 / 1;
    transition: background var(--motion-fast) var(--ease-standard);
}

.controls button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.controls button:focus {
    outline: 0px;
}

.controls button:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    outline: 2px solid rgba(255, 255, 255, 0.45);
    outline-offset: -2px;
}

.controls #btnPlayPause svg,
.controls #btnRewind svg,
.controls #btnFastForward svg,
.controls #btnMute svg path:first-child {
    fill: white;
}

.controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translate(-50%, 0) scale(0.8);
    border-radius: 30px;
    padding: 15px;
    box-sizing: border-box;
    width: min(800px, calc(100% - 32px));
    gap: 12px;
    opacity: 1;
    visibility: visible;
}

/* Timing lives in motion.css so show and hide stay identical. */
.controls.controls-hidden {
    transform: translate(-50%, calc(100% + 24px)) scale(0.8);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.volume-group {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    min-width: 0;
}

.volume-group #volumeBar {
    width: 0px;
    opacity: 0;
}

.volume-group:hover #volumeBar,
.volume-group:focus-within #volumeBar {
    width: 120px;
    opacity: 1;
}

.controls-actions {
    width: 100%;
}

.actions-group {
    min-width: 0;
}

.controls-bar {
    gap: 8px;
    padding: 8px;
}

.controls-bar .seek-bar {
    flex: 1;
}

.controls-bar .time-display {
    color: var(--text-primary);
    line-height: 0;
}

.seek-bar:focus {
    outline: 0px;
}

*:focus {
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
  --progress: var(--text-primary);
  --base: rgba(255, 255, 255, 0.2);
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  cursor: pointer;
  background: linear-gradient(to right, var(--progress) 0%, var(--progress) var(--value, 0%), var(--base) var(--value, 0%), var(--base) 100%);
  border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  width: 8px;
  border-radius: 999px;
  background: var(--progress);
  cursor: pointer;
  margin-top: 0px;
}