/* KidsTV player enhancements. See docs/player-enhancements-spec.md. */

.kt-player-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  font-family: inherit;
}

/* ---- Paused-state ±5 second controls ---- */

.kt-skip-layer {
  position: absolute;
  inset: 0;
  display: none;
}

.kt-skip-layer.kt-visible {
  display: block;
}

.kt-skip-btn {
  position: absolute;
  top: 50%;
  width: 54px;
  height: 54px;
  padding: 0;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.46);
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: transform 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}

.kt-skip-back {
  left: calc(50% - 88px);
}

.kt-skip-forward {
  left: calc(50% + 88px);
}

.kt-skip-btn svg {
  width: 34px;
  height: 34px;
  display: block;
}

.kt-skip-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.2px;
  font-variant-numeric: tabular-nums;
}

.kt-skip-btn:hover {
  background: rgba(0, 0, 0, 0.58);
}

.kt-skip-btn:active,
.kt-skip-btn.kt-pulse {
  animation: kt-skip-pulse 0.24s ease-out;
}

.kt-skip-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.kt-skip-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

@keyframes kt-skip-pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  45% {
    transform: translate(-50%, -50%) scale(0.88);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ---- Skip feedback and drag timestamp ---- */

.kt-feedback,
.kt-scrub-tip {
  position: absolute;
  left: 50%;
  color: #fff;
  background: rgba(12, 12, 16, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-variant-numeric: tabular-nums;
}

.kt-feedback {
  bottom: 42px;
  max-width: calc(100% - 32px);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transform: translate(-50%, 8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.kt-feedback.kt-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.kt-scrub-tip {
  bottom: 34px;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  transform: translate(-50%, 4px);
  transition: opacity 0.1s ease, transform 0.1s ease;
}

.kt-scrub-tip.kt-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.kt-scrub-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(12, 12, 16, 0.84);
}

/* ---- Seek bar hit area and drag visuals ---- */

/*
 * The visual bar stays 4-5px tall, but the interactive area grows to 44px
 * whenever the controls are visible. This is the main fix for the old
 * "can't drag" bug: touches near (not exactly on) the 5px strip now land.
 */
.video-controls.visible .video-progress::before,
.video-progress.kt-scrubbing::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 44px;
  transform: translateY(-50%);
}

.video-progress {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.video-progress.kt-scrubbing {
  cursor: grabbing;
}

.video-progress.kt-scrubbing .video-progress-fill {
  width: var(--kt-scrub-x) !important;
  transition: none !important;
}

.video-progress.kt-scrubbing .video-progress-thumb {
  opacity: 0;
}

.video-progress.kt-scrubbing::after {
  content: '';
  position: absolute;
  top: 50%;
  left: var(--kt-scrub-x);
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.video-progress:focus {
  outline: none;
}

.video-progress:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 5px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .kt-skip-btn,
  .kt-feedback,
  .kt-scrub-tip {
    transition: none;
  }

  .kt-skip-btn:active,
  .kt-skip-btn.kt-pulse {
    animation: none;
  }
}
