.typ-player {
  --typ-accent: #16a9e0;
  --typ-play: #16a9e0;
  --typ-bg: #080b12;
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: clamp(12px, 2vw, 20px);
  background: var(--typ-bg);
  color: #fff;
  box-shadow: 0 14px 38px rgba(5, 8, 20, 0.22);
  font-family: inherit;
  isolation: isolate;
}

.typ-player:focus-visible,
.typ-player button:focus-visible,
.typ-player input:focus-visible,
.typ-player select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--typ-accent) 75%, white);
  outline-offset: 2px;
}

.typ-player__stage {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 200px;
  background: radial-gradient(circle at 50% 35%, #1d2436 0, #080b12 68%);
}

.typ-player__mount,
.typ-player__mount iframe,
.typ-player__iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Hovering the iframe makes YouTube re-show its title/watermark, so all
   pointer input is kept out of it and handled by the shield instead. */
.typ-player__mount iframe,
.typ-player__iframe { pointer-events: none; }

.typ-player__shield {
  position: absolute;
  z-index: 1;
  inset: 0;
  cursor: pointer;
}

/* Full poster cover: hides YouTube's title bar, channel avatar, pause
   overlay and end-screen suggestions whenever the video is not playing. */
.typ-player__cover {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  background: var(--typ-bg);
  cursor: pointer;
  opacity: 1;
  transition: opacity 200ms ease;
}
.typ-player__cover .typ-player__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.typ-player.is-playing .typ-player__cover {
  opacity: 0;
  pointer-events: none;
}

/* YouTube overlays its title, channel avatar and mobile pause button for a
   few seconds whenever playback starts; .is-masking keeps the poster cover
   up (with the loader) until that UI has faded out. */
.typ-player.is-masking .typ-player__cover {
  opacity: 1;
  pointer-events: none;
}
.typ-player.is-masking .typ-player__loader { display: block; }

/* Native fallback / error states use YouTube's own controls, so the
   custom layers must not block them. */
.typ-player.is-native-fallback .typ-player__shield,
.typ-player.is-native-fallback .typ-player__cover,
.typ-player.has-error .typ-player__shield,
.typ-player.has-error .typ-player__cover { display: none; }
.typ-player.is-native-fallback .typ-player__mount iframe,
.typ-player.is-native-fallback .typ-player__iframe { pointer-events: auto; }

.typ-player__center-play {
  position: absolute;
  z-index: 3;
  inset: 50% auto auto 50%;
  display: grid;
  width: clamp(58px, 8vw, 78px);
  height: clamp(58px, 8vw, 78px);
  padding: 0;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  background: var(--typ-play);
  color: #fff;
  box-shadow: 0 14px 36px color-mix(in srgb, var(--typ-play) 32%, transparent);
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease;
}

.typ-player__center-play:hover { transform: translate(-50%, -50%) scale(1.06); }
.typ-player__center-play svg { width: 42%; fill: currentColor; transform: translateX(2px); }
.typ-player.is-playing .typ-player__center-play { pointer-events: none; opacity: 0; }
.typ-player.is-native-fallback .typ-player__center-play,
.typ-player.has-error .typ-player__center-play { display: none; }

.typ-player__loader {
  position: absolute;
  z-index: 2;
  inset: 50% auto auto 50%;
  display: none;
  width: 42px;
  height: 42px;
  margin: -21px;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: typ-spin 0.8s linear infinite;
}
.typ-player.is-buffering .typ-player__loader { display: block; }
.typ-player.is-native-fallback .typ-player__loader,
.typ-player.has-error .typ-player__loader { display: none; }

.typ-player__error {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: none;
  padding: 24px;
  align-content: center;
  justify-items: center;
  background: rgba(8, 11, 18, 0.92);
  color: #fff;
  text-align: center;
}
.typ-player.has-error .typ-player__error { display: grid; }
.typ-player__error p { margin: 0 0 14px; font-size: 15px; }
.typ-player__error a {
  display: inline-flex;
  min-height: 44px;
  padding: 0 18px;
  align-items: center;
  border-radius: 10px;
  background: var(--typ-accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.typ-player__controls {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0 12px 10px;
  background: linear-gradient(180deg, transparent, rgba(4, 7, 13, 0.78) 34%, rgba(4, 7, 13, 0.96));
  transition: opacity 180ms ease;
}
.typ-player.is-native-fallback .typ-player__controls,
.typ-player.has-error .typ-player__controls { display: none; }

.typ-player__progress-label { display: block; height: 18px; padding-top: 6px; }
.typ-player__progress,
.typ-player__volume {
  width: 100%;
  height: 4px;
  margin: 0;
  accent-color: var(--typ-accent);
  cursor: pointer;
}
.typ-player__progress { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .7)); }

.typ-player__control-row { display: flex; min-height: 46px; align-items: center; gap: 4px; }
.typ-player__button {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 10px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #f8fafc;
  cursor: pointer;
}
.typ-player__button:hover { background: rgba(255, 255, 255, 0.1); }
.typ-player__button svg { width: 23px; height: 23px; fill: currentColor; }
.typ-player__skip { position: relative; font-size: 11px; font-weight: 800; }
.typ-player__skip::before { content: ''; position: absolute; inset: 8px; border: 2px solid currentColor; border-left-color: transparent; border-radius: 50%; opacity: .7; }
.typ-player__time { padding: 0 6px; color: #e6e9ef; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.typ-player__spacer { flex: 1 1 auto; }
.typ-player__volume-label { display: block; width: 78px; padding: 10px 6px; }
.typ-player__speed {
  min-width: 62px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 9px;
  background: rgba(16, 22, 34, .88);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.typ-icon--pause,
.typ-icon--muted { display: none; }
.typ-player.is-playing .typ-icon--play,
.typ-player.is-muted .typ-icon--volume { display: none; }
.typ-player.is-playing .typ-icon--pause,
.typ-player.is-muted .typ-icon--muted { display: block; }

.typ-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.typ-player:fullscreen { border: 0; border-radius: 0; }
.typ-player:fullscreen .typ-player__stage { width: 100%; height: 100%; min-height: 0; }

@media (max-width: 560px) {
  .typ-player__controls { padding-inline: 6px; }
  .typ-player__volume-label { display: none; }
  .typ-player__time { font-size: 11px; }
  .typ-player__button { flex-basis: 42px; width: 42px; height: 42px; }
  .typ-player__skip { display: none; }
  .typ-player__speed { min-width: 56px; padding-inline: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .typ-player *, .typ-player *::before, .typ-player *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@keyframes typ-spin { to { transform: rotate(360deg); } }
