/* Video Widget Styles */
.video-circular-btn {
  width: 64px;
  height: 36px;
  background: transparent;
  display: flex;
  padding: 0;
  margin-right: 8px;
  outline: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  z-index: 1000;
}

#ko-splash {
  z-index: 100000 !important;
}

.sticky-video-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  height: 180px;
  background: #000;
  border-radius: 12px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: width 0.5s cubic-bezier(0.77, 0, 0.175, 1),
    height 0.5s cubic-bezier(0.77, 0, 0.175, 1),
    top 0.5s cubic-bezier(0.77, 0, 0.175, 1),
    left 0.5s cubic-bezier(0.77, 0, 0.175, 1),
    bottom 0.5s cubic-bezier(0.77, 0, 0.175, 1),
    right 0.5s cubic-bezier(0.77, 0, 0.175, 1),
    border-radius 0.5s cubic-bezier(0.77, 0, 0.175, 1),
    border-color 0.4s ease,
    box-shadow 0.4s ease,
    opacity 0.6s ease,
    visibility 0.6s ease;
}

.sticky-video-widget.is-ready {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sticky-video-widget:not(.is-ready) {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.sticky-video-widget.is-fullscreen {
  position: fixed !important;
  top: auto !important;
  left: auto !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  transform: none !important;
  box-shadow: none !important;
  z-index: 100002 !important;
  background: #000 !important;
  border: none !important;
}

.sticky-video-widget.is-closed {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sticky-video-widget.is-closed:hover {
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.75), 0 0 14px rgba(10, 92, 245, 0.45);
}

.sticky-video-widget.is-closed .video-carousel-track {
  border-radius: 7px;
}

body.theme-light .sticky-video-widget.is-closed {
  border-color: rgba(11, 21, 48, 0.28);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

/* Closed State Circular Play Indicator */
.video-closed-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgb(10, 92, 245);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s ease 0.22s,
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.video-closed-play-btn svg {
  width: 9px;
  height: 9px;
  margin-left: 1.5px;
  fill: #ffffff;
}

.sticky-video-widget.is-closed .video-closed-play-btn {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.sticky-video-widget.is-closed:hover .video-closed-play-btn {
  border-color: #ffffff;
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 0 12px rgba(10, 92, 245, 0.85);
}

.sticky-video-widget.is-closed .video-widget-header,
.sticky-video-widget.is-closed .video-carousel-btn,
.sticky-video-widget.is-closed .video-center-play-btn,
.sticky-video-widget.is-closed .video-widget-controls {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.video-widget-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 15;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.sticky-video-widget:hover:not(.is-closed) .video-widget-header,
.sticky-video-widget.is-paused:not(.is-closed) .video-widget-header,
.sticky-video-widget.show-controls:not(.is-closed) .video-widget-header {
  opacity: 1;
  pointer-events: auto;
}

.video-widget-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  user-select: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.video-widget-title-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0a5cf5;
  box-shadow: 0 0 6px #0a5cf5;
}

.video-widget-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.video-widget-header button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  padding: 0;
}

.video-widget-header button:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

.video-widget-header svg {
  width: 14px;
  height: 14px;
}

/* Center Play Overlay */
.video-center-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(10, 92, 245, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 12;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  padding: 0;
}

.sticky-video-widget.is-paused:not(.is-closed) .video-center-play-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.video-center-play-btn:hover {
  background: #0a5cf5;
  transform: translate(-50%, -50%) scale(1.1);
}

.video-center-play-btn svg {
  width: 20px;
  height: 20px;
}

/* Bottom Controls Bar */
.video-widget-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 6px 12px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 15;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(4px);
}

.sticky-video-widget:hover:not(.is-closed) .video-widget-controls,
.sticky-video-widget.is-paused:not(.is-closed) .video-widget-controls,
.sticky-video-widget.show-controls:not(.is-closed) .video-widget-controls {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Progress bar scrubber */
.video-progress-wrap {
  width: 100%;
  height: 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  outline: none;
}

.video-progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  position: relative;
  transition: height 0.15s ease;
}

.video-progress-wrap:hover .video-progress-bar {
  height: 5px;
}

.video-progress-fill {
  height: 100%;
  width: 0%;
  background: #0a5cf5;
  border-radius: inherit;
  pointer-events: none;
}

.video-progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s ease;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.video-progress-wrap:hover .video-progress-thumb {
  transform: translate(-50%, -50%) scale(1);
}

/* Controls row */
.video-controls-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.video-ctrl-btn {
  background: transparent;
  border: none;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

.video-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

.video-ctrl-btn svg {
  width: 15px;
  height: 15px;
}

/* Volume Group */
.video-volume-group {
  display: flex;
  align-items: center;
  position: relative;
}

.video-volume-slider-wrap {
  width: 0;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, margin 0.2s ease;
  display: flex;
  align-items: center;
}

.video-volume-group:hover .video-volume-slider-wrap,
.video-volume-group:focus-within .video-volume-slider-wrap {
  width: 50px;
  max-width: 50px;
  opacity: 1;
  margin-left: 2px;
}

.video-volume-slider {
  width: 48px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.video-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.video-volume-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Time display */
.video-time-display {
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  user-select: none;
  margin-left: 2px;
}

.video-controls-spacer {
  flex: 1;
}

/* Icon toggles */
.sticky-video-widget .icon-play {
  display: none;
}

.sticky-video-widget .icon-pause {
  display: block;
}

.sticky-video-widget.is-paused .icon-play {
  display: block;
}

.sticky-video-widget.is-paused .icon-pause {
  display: none;
}

.sticky-video-widget .icon-vol-high {
  display: none;
}

.sticky-video-widget .icon-vol-mute {
  display: block;
}

.sticky-video-widget.is-unmuted .icon-vol-high {
  display: block;
}

.sticky-video-widget.is-unmuted .icon-vol-mute {
  display: none;
}

.sticky-video-widget .icon-fs-enter {
  display: block;
}

.sticky-video-widget .icon-fs-exit {
  display: none;
}

.sticky-video-widget.is-fullscreen .icon-fs-enter {
  display: none;
}

.sticky-video-widget.is-fullscreen .icon-fs-exit {
  display: block;
}

.video-carousel-track {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  border-radius: inherit;
}

.sticky-video-widget .video-widget-el {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.sticky-video-widget .video-widget-el.active {
  opacity: 1;
  pointer-events: auto;
}

/* Fullscreen specialized presentation */
.sticky-video-widget.is-fullscreen .video-carousel-track {
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
  background: #000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.sticky-video-widget.is-fullscreen .video-widget-el {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  max-width: 100vw !important;
  max-height: 100dvh !important;
  background: #000;
}

.sticky-video-widget.is-fullscreen .video-widget-header {
  padding-top: max(14px, env(safe-area-inset-top, 14px));
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
  padding-bottom: 24px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.3) 60%, transparent 100%);
}

.sticky-video-widget.is-fullscreen .video-widget-controls {
  padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
  padding-top: 18px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
}

.sticky-video-widget.is-fullscreen .video-widget-header button,
.sticky-video-widget.is-fullscreen .video-ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.sticky-video-widget.is-fullscreen .video-widget-header svg,
.sticky-video-widget.is-fullscreen .video-ctrl-btn svg {
  width: 18px;
  height: 18px;
}

.sticky-video-widget.is-fullscreen .video-center-play-btn {
  width: 64px;
  height: 64px;
}

.sticky-video-widget.is-fullscreen .video-center-play-btn svg {
  width: 28px;
  height: 28px;
}

.sticky-video-widget.is-fullscreen .video-progress-wrap {
  height: 18px;
}

.sticky-video-widget.is-fullscreen .video-progress-bar {
  height: 4px;
}

.sticky-video-widget.is-fullscreen .video-time-display {
  font-size: 12.5px;
}

.video-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease, background 0.2s ease;
}

.video-carousel-btn:hover {
  background: rgba(235, 88, 36, 0.9);
}

.video-carousel-btn svg {
  width: 20px;
  height: 20px;
}

.video-carousel-btn.prev {
  left: 8px;
}

.video-carousel-btn.next {
  right: 8px;
}

.sticky-video-widget:hover:not(.is-closed) .video-carousel-btn {
  opacity: 1;
}

/* Scroll lock when fullscreen is open */
body.video-widget-fullscreen-active {
  overflow: hidden !important;
  touch-action: none;
}

/* Mobile responsive sizing for floating widget */
@media (max-width: 600px) {
  .sticky-video-widget {
    bottom: 16px;
    right: 16px;
    width: min(290px, calc(100vw - 32px));
    height: min(163px, calc((100vw - 32px) * 9 / 16));
    border-radius: 10px;
  }
}