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

.video-player-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
  background:
    radial-gradient(circle at top, hsl(var(--primary) / 0.16), transparent 38%),
    linear-gradient(180deg, hsl(var(--card)) 0%, hsl(222deg 47% 8%) 100%);
  box-shadow: 0 10px 30px rgb(0 0 0 / 25%);
}

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

.video-top-bar,
.video-bottom-bar {
  position: relative;
  z-index: 2;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.video-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 0.875rem 0.625rem;
  background: linear-gradient(180deg, rgb(6 10 18 / 82%) 0%, rgb(6 10 18 / 30%) 100%);
}

.video-stage {
  position: relative;
  background: rgb(0 0 0 / 40%);
}

.video-player-shell.fullscreen .video-stage {
  height: 100vh;
  background: rgb(0 0 0);
}

.video-player-shell.fullscreen.controls-hidden .video-stage,
.video-player-shell.fullscreen.controls-hidden .chat-video-element {
  cursor: none;
}

.chat-video-element {
  display: block;
  width: 100%;
  max-height: min(28rem, 70vh);
  background: rgb(0 0 0 / 85%);
  cursor: pointer;
  object-fit: contain;
}

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

.video-play-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  transform: translate(-50%, -50%);
  border: 1px solid hsl(var(--border) / 0.8);
  border-radius: 9999px;
  color: hsl(var(--primary-foreground));
  background: rgb(8 14 24 / 78%);
  box-shadow: 0 12px 24px rgb(0 0 0 / 35%);
  transition:
    transform 0.16s ease,
    background-color 0.16s ease;
}

.video-play-overlay:hover {
  transform: translate(-50%, -50%) scale(1.05);
  background: rgb(12 18 30 / 88%);
}

.video-bottom-bar {
  padding: 0.75rem 0.875rem 0.875rem;
  background: linear-gradient(180deg, rgb(6 10 18 / 38%) 0%, rgb(6 10 18 / 86%) 100%);
}

.video-bottom-bar.fullscreen-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding-bottom: max(0.875rem, env(safe-area-inset-bottom));
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.video-bottom-bar.hidden-overlay {
  opacity: 0;
  transform: translateY(1rem);
  pointer-events: none;
}

.video-controls-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.625rem;
}

.video-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid hsl(var(--border) / 0.8);
  border-radius: 9999px;
  color: hsl(var(--foreground));
  background: hsl(var(--card) / 0.72);
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.video-control-btn:hover {
  border-color: hsl(var(--primary) / 0.75);
  background: hsl(var(--primary) / 0.14);
  transform: translateY(-1px);
}

.video-time-label {
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.seek-slider,
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
}

.seek-slider {
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  background: linear-gradient(90deg, hsl(var(--primary)) 0%, hsl(var(--primary)) var(--value, 0%), hsl(var(--secondary)) var(--value, 0%), hsl(var(--secondary)) 100%);
}

.volume-slider {
  width: 5.5rem;
  height: 6px;
  border-radius: 9999px;
  background: hsl(var(--secondary));
}

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

.seek-slider::-webkit-slider-thumb,
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4px;
  border: 2px solid hsl(var(--card));
  border-radius: 50%;
  background: hsl(var(--primary));
  box-shadow: 0 1px 3px rgb(0 0 0 / 30%);
}

.seek-slider::-moz-range-track,
.volume-slider::-moz-range-track {
  height: 6px;
  border: none;
  border-radius: 9999px;
  background: hsl(var(--secondary));
}

.seek-slider::-moz-range-thumb,
.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid hsl(var(--card));
  border-radius: 50%;
  background: hsl(var(--primary));
  box-shadow: 0 1px 3px rgb(0 0 0 / 30%);
}

@media (width <= 640px) {
  .video-top-bar {
    padding-inline: 0.75rem;
  }

  .video-bottom-bar {
    padding-inline: 0.75rem;
  }

  .video-controls-row {
    gap: 0.5rem;
  }

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

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