:host {
  display: block;
  max-width: 40rem;
}

.video-player-shell {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) + 2px);
  background: #000;
}

.video-player-shell.fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
}

.video-stage {
  position: relative;
  background: #000;
}

.video-player-shell.fullscreen .video-stage {
  height: 100vh;
}

.video-player-shell.controls-hidden:not(.paused) .video-stage,
.video-player-shell.controls-hidden:not(.paused) .chat-video-element {
  cursor: none;
}

.chat-video-element {
  display: block;
  width: 100%;
  max-height: min(28rem, 70vh);
  background: #000;
  cursor: pointer;
  object-fit: contain;
  vertical-align: middle;
}

.video-player-shell.fullscreen .chat-video-element {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
}

.video-top-overlay,
.video-bottom-overlay {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  color: #fff;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

.video-top-overlay {
  top: 0;
  justify-content: space-between;
  background: linear-gradient(180deg, rgb(0 0 0 / 72%) 0%, transparent 100%);
}

.video-bottom-overlay {
  bottom: 0;
  padding-bottom: max(0.625rem, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgb(0 0 0 / 78%) 0%, transparent 100%);
}

.video-top-overlay.hidden-overlay,
.video-bottom-overlay.hidden-overlay {
  opacity: 0;
  pointer-events: none;
}

.video-meta {
  min-width: 0;
}

.video-filename {
  overflow: hidden;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-size {
  margin-top: 0.125rem;
  color: rgb(255 255 255 / 72%);
  font-size: 0.6875rem;
  line-height: 1.2;
}

.video-play-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  transform: translate(-50%, -50%);
  border: none;
  border-radius: 9999px;
  color: #fff;
  background: rgb(0 0 0 / 55%);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.video-play-overlay:hover {
  background: rgb(0 0 0 / 72%);
}

.video-controls-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.video-control-btn {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 9999px;
  color: #fff;
  background: transparent;
}

.video-control-btn:hover {
  background: rgb(255 255 255 / 14%);
}

.video-time-label {
  flex-shrink: 0;
  color: rgb(255 255 255 / 88%);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.video-volume-group {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
}

.seek-slider,
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
  background: linear-gradient(
    90deg,
    #fff 0%,
    #fff var(--progress, 0%),
    rgb(255 255 255 / 28%) var(--progress, 0%),
    rgb(255 255 255 / 28%) 100%
  );
}

.seek-slider {
  flex: 1 1 auto;
  min-width: 3rem;
  height: 4px;
  border-radius: 9999px;
}

.volume-slider {
  width: 4.5rem;
  height: 4px;
  border-radius: 9999px;
}

.seek-slider::-webkit-slider-runnable-track,
.volume-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 9999px;
  background: transparent;
}

.seek-slider::-webkit-slider-thumb,
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 25%);
}

.seek-slider::-moz-range-track,
.volume-slider::-moz-range-track {
  height: 4px;
  border: none;
  border-radius: 9999px;
  background: rgb(255 255 255 / 28%);
}

.seek-slider::-moz-range-progress {
  height: 4px;
  border-radius: 9999px;
  background: #fff;
}

.seek-slider::-moz-range-thumb,
.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 25%);
}

@media (width <= 640px) {
  .video-top-overlay,
  .video-bottom-overlay {
    padding-inline: 0.625rem;
  }

  .video-volume-group .volume-slider {
    display: none;
  }

  .video-time-label {
    font-size: 0.625rem;
  }
}
