/* ============================================================================
 * PRIVATEMEDIA.TO ultra-HD live player - presentation
 * ----------------------------------------------------------------------------
 * Extracted verbatim from the production player page (durbin.st/player.php) so
 * the local player looks and behaves exactly like the one viewers already use.
 * Only the layout rules live here; every behaviour is in player.js.
 * ========================================================================== */

:root {
  --primary: #00f2fe;
  --primary-glow: rgba(0, 242, 254, 0.45);
  --secondary: #4facfe;
  --accent: #ff2a6d;
  --accent-glow: rgba(255, 42, 109, 0.5);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-dark: #07090e;
  --card-bg: rgba(15, 23, 42, 0.85);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body, html {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  background: #000000 !important;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden !important;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* Player Main Wrapper - Absolute Lock for 100% Iframe & Container Compatibility */
.player-container {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden !important;
  touch-action: manipulation;
  contain: strict;
}

/* Feature 3: Aspect Ratio Handling & GPU Video Rendering Layer */
video {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  z-index: 2;
  object-fit: contain;
  outline: none;
  background: #000;
  transition: object-fit 0.2s ease;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform;
}
video.aspect-contain { object-fit: contain !important; }
video.aspect-cover { object-fit: cover !important; }
video.aspect-fill { object-fit: fill !important; }

/* Feature 1: Brightness Dim Overlay */
#brightness-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.05s linear;
}

/* Feature 1: Mobile Touch Gesture Visual HUD Pill */
.gesture-hud {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  border: 1.5px solid rgba(0, 242, 254, 0.4);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 30px var(--primary-glow);
  border-radius: 20px;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 140px;
}
.gesture-hud.show-hud {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.gesture-hud svg {
  width: 32px;
  height: 32px;
  fill: var(--primary);
  filter: drop-shadow(0 0 8px var(--primary));
}
.gesture-bar {
  width: 100px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
}
.gesture-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--primary));
  box-shadow: 0 0 10px var(--primary);
  border-radius: 4px;
  transition: width 0.05s linear;
}
.gesture-val {
  font-size: 14px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #fff;
}

/* Fast Action Notification Toast */
#hud-toast {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-15px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  border: 1px solid var(--primary-glow);
  border-radius: 30px;
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px var(--primary-glow);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
#hud-toast.show-toast {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* -------------------------------------------------------------
   CINEMATIC ULTRA-HD INTRO ANIMATION SCREEN
   ------------------------------------------------------------- */
#intro-screen {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: #04060d;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1), transform 0.85s cubic-bezier(0.16, 1, 0.3, 1), filter 0.85s ease;
}
#intro-screen.hide-intro {
  opacity: 0;
  transform: scale(1.06);
  filter: blur(8px);
  pointer-events: none;
}

/* Drifting aurora light (pure gradients, no blur filter = cheap on mobile) */
.intro-aurora { position: absolute; inset: 0; pointer-events: none; opacity: 0; animation: introFadeIn 1.2s ease forwards; }
.intro-aurora span {
  position: absolute;
  width: 75vmax;
  height: 75vmax;
  border-radius: 50%;
  mix-blend-mode: screen;
}
.intro-aurora .a1 { left: -25vmax; top: -35vmax; background: radial-gradient(circle, rgba(0, 242, 254, 0.28) 0%, transparent 60%); animation: auroraA 9s ease-in-out infinite alternate; }
.intro-aurora .a2 { right: -30vmax; top: -20vmax; background: radial-gradient(circle, rgba(127, 92, 255, 0.30) 0%, transparent 60%); animation: auroraB 11s ease-in-out infinite alternate; }
.intro-aurora .a3 { left: 10vmax; bottom: -50vmax; background: radial-gradient(circle, rgba(255, 42, 109, 0.20) 0%, transparent 60%); animation: auroraA 13s ease-in-out infinite alternate-reverse; }
@keyframes auroraA { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(12vmax, 8vmax) scale(1.15); } }
@keyframes auroraB { 0% { transform: translate(0, 0) scale(1.1); } 100% { transform: translate(-14vmax, 10vmax) scale(0.95); } }
@keyframes introFadeIn { to { opacity: 1; } }

/* Cinematic perspective grid floor rushing toward the viewer */
.intro-grid {
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: -10%;
  height: 60%;
  background-image:
    linear-gradient(rgba(0, 242, 254, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 92, 255, 0.18) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(380px) rotateX(62deg);
  transform-origin: center top;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 45%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 45%, #000 100%);
  opacity: 0;
  animation: introFadeIn 1.4s 0.2s ease forwards, gridRush 1.6s linear infinite;
  pointer-events: none;
}
@keyframes gridRush { from { background-position: 0 0, 0 0; } to { background-position: 0 48px, 0 0; } }

/* Rising light particles */
.intro-particles { position: absolute; inset: 0; pointer-events: none; }
.intro-particles i {
  position: absolute;
  bottom: -8px;
  left: var(--x);
  width: var(--s, 3px);
  height: var(--s, 3px);
  border-radius: 50%;
  background: #bff9ff;
  box-shadow: 0 0 8px #00f2fe, 0 0 14px rgba(0, 242, 254, 0.6);
  opacity: 0;
  animation: particleRise var(--d) linear var(--delay) infinite;
}
.intro-particles i:nth-child(3n) { background: #e3d7ff; box-shadow: 0 0 8px #9a7dff, 0 0 14px rgba(154, 125, 255, 0.6); }
@keyframes particleRise {
  0% { transform: translate(0, 0); opacity: 0; }
  15% { opacity: 0.9; }
  100% { transform: translate(var(--drift, 20px), -105vh); opacity: 0; }
}

/* Logo that draws itself */
.intro-center-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.intro-logo {
  position: relative;
  width: clamp(78px, 21vmin, 128px);
  height: clamp(78px, 21vmin, 128px);
  animation: logoBreath 3s 2s ease-in-out infinite;
}
.intro-logo svg { width: 100%; height: 100%; overflow: visible; }
.il-glass { fill: rgba(255, 255, 255, 0.05); opacity: 0; animation: introFadeIn 0.6s 0.9s ease forwards; }
.il-frame, .il-play {
  fill: none;
  stroke: url(#introGrad);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  filter: drop-shadow(0 0 6px rgba(0, 242, 254, 0.8));
}
.il-frame { stroke-width: 2.2; animation: drawStroke 1s 0.15s cubic-bezier(0.65, 0, 0.35, 1) forwards; }
.il-play { stroke-width: 3.2; animation: drawStroke 0.6s 0.7s cubic-bezier(0.65, 0, 0.35, 1) forwards; }
.il-play-fill {
  fill: url(#introGrad);
  opacity: 0;
  filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.9)) drop-shadow(0 0 22px rgba(127, 92, 255, 0.7));
  animation: introFadeIn 0.45s 1.15s ease forwards;
}
@keyframes drawStroke { to { stroke-dashoffset: 0; } }
@keyframes logoBreath {
  0%, 100% { transform: translateY(0) scale(1); filter: drop-shadow(0 0 0 rgba(0, 242, 254, 0)); }
  50% { transform: translateY(-4px) scale(1.03); filter: drop-shadow(0 0 18px rgba(0, 242, 254, 0.45)); }
}

/* Horizontal lens-flare that ignites when the logo completes */
.intro-flare {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90vw;
  height: 2px;
  transform: translate(-50%, -50%) scaleX(0);
  background: linear-gradient(90deg, transparent 0%, rgba(127, 92, 255, 0.6) 25%, #bff9ff 50%, rgba(255, 42, 109, 0.6) 75%, transparent 100%);
  box-shadow: 0 0 18px rgba(0, 242, 254, 0.8);
  animation: flareIgnite 1.6s 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: none;
  z-index: -1;
}
.intro-flare::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140px;
  height: 140px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(191, 249, 255, 0.55) 0%, rgba(0, 242, 254, 0.15) 35%, transparent 70%);
}
@keyframes flareIgnite {
  0% { transform: translate(-50%, -50%) scaleX(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scaleX(1); opacity: 0.35; }
}

/* Brand name: letters rise in, then a light wave keeps running through them */
.intro-title {
  margin-top: clamp(14px, 3vh, 26px);
  font-size: clamp(15px, 4.4vw, 30px);
  font-weight: 900;
  letter-spacing: clamp(2px, 0.9vw, 7px);
  color: #eaf8ff;
  text-transform: uppercase;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  z-index: 2;
  white-space: nowrap;
  max-width: 92vw;
}
.intro-title .ch {
  display: inline-block;
  opacity: 0;
  animation:
    charIn 0.6s calc(1.05s + var(--i) * 45ms) cubic-bezier(0.16, 1, 0.3, 1) forwards,
    charGlow 3.2s calc(2.2s + var(--i) * 70ms) ease-in-out infinite;
}
.intro-title .ch.tld-dot { color: #00f2fe; text-shadow: 0 0 12px #00f2fe; }
@keyframes charIn {
  0% { opacity: 0; transform: translateY(16px) scale(0.9); filter: blur(8px); }
  100% { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes charGlow {
  0%, 30%, 100% { text-shadow: 0 0 0 transparent; }
  12% { text-shadow: 0 0 10px #00f2fe, 0 0 22px rgba(127, 92, 255, 0.9); color: #ffffff; }
}

.intro-badge {
  margin-top: clamp(8px, 1.6vh, 12px);
  padding: clamp(4px, 0.8vh, 6px) clamp(10px, 2.5vw, 18px);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 242, 254, 0.28);
  font-size: clamp(8px, 2vw, 11px);
  font-weight: 700;
  letter-spacing: clamp(1px, 0.45vw, 3px);
  color: #b9e9f5;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: clamp(5px, 1vw, 8px);
  z-index: 2;
  max-width: 90vw;
  white-space: nowrap;
  opacity: 0;
  animation: badgeUp 0.7s 1.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes badgeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.intro-badge-dot {
  width: 6px;
  height: 6px;
  background: #00f2fe;
  border-radius: 50%;
  box-shadow: 0 0 8px #00f2fe;
  animation: badgeDotBlink 1.4s ease-in-out infinite alternate;
  flex-shrink: 0;
}
@keyframes badgeDotBlink {
  0% { opacity: 0.4; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.2); }
}

.intro-progress-bar {
  margin-top: clamp(14px, 2.8vh, 24px);
  width: clamp(140px, 40vw, 230px);
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  position: relative;
  z-index: 2;
  overflow: visible;
}
.intro-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7f5cff 0%, #00f2fe 100%);
  border-radius: 2px;
  position: relative;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.85);
  animation: fillProgress 2.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
.laser-head {
  position: absolute;
  right: -3px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 10px #00f2fe, 0 0 18px #00f2fe;
}
@keyframes fillProgress {
  0% { width: 0%; }
  40% { width: 65%; }
  80% { width: 92%; }
  100% { width: 100%; }
}

@media (max-height: 480px) {
  .intro-logo { width: 64px; height: 64px; }
  .intro-title { font-size: 15px; letter-spacing: 2.5px; margin-top: 10px; }
  .intro-badge { font-size: 8px; letter-spacing: 1px; padding: 3px 9px; margin-top: 6px; }
  .intro-progress-bar { margin-top: 10px; width: 130px; }
}
@media (prefers-reduced-motion: reduce) {
  .intro-aurora span, .intro-grid, .intro-particles i, .intro-logo, .intro-title .ch { animation-duration: 0.01s; animation-iteration-count: 1; }
}

/* -------------------------------------------------------------
   BIG CENTER PLAY BUTTON & BUFFER SPINNER
   ------------------------------------------------------------- */
.center-overlay-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(15px);
  border: 1.5px solid rgba(0, 242, 254, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 30px var(--primary-glow);
}

.center-overlay-btn svg {
  width: 36px;
  height: 36px;
  fill: #fff;
  filter: drop-shadow(0 0 8px var(--primary));
  margin-left: 4px;
}

.center-overlay-btn.show-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.center-overlay-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(0, 242, 254, 0.25);
  border-color: var(--primary);
}

.spinner-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  z-index: 35;
  display: none !important;
}

.spinner-box.active {
  display: block !important;
}

.spinner {
  width: 100%;
  height: 100%;
  border: 3.5px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* -------------------------------------------------------------
   TOP BAR (STREAM TITLE, LIVE BADGE, HEALTH & ACTIONS)
   ------------------------------------------------------------- */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: linear-gradient(180deg, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.4) 70%, rgba(0,0,0,0) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.stream-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Feature 2: Clickable Live Edge Catch-up Badge */
.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 42, 109, 0.15);
  border: 1px solid rgba(255, 42, 109, 0.4);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #ff2a6d;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
.live-badge:hover {
  background: rgba(255, 42, 109, 0.28);
  border-color: #ff2a6d;
  box-shadow: 0 0 14px rgba(255, 42, 109, 0.5);
  transform: scale(1.05);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #ff2a6d;
  border-radius: 50%;
  box-shadow: 0 0 10px #ff2a6d;
  animation: liveBlink 1.4s ease-in-out infinite;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

/* Feature 6: Real-Time Connection Health Indicator */
.net-health-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  width: 26px;
  height: 26px;
  min-width: 26px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.net-health-chip:hover {
  border-color: var(--primary);
  transform: scale(1.12);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}
.health-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success), 0 0 4px var(--success);
  transition: background 0.3s, box-shadow 0.3s, transform 0.3s;
}
.health-dot.fair {
  background: var(--warning);
  box-shadow: 0 0 10px var(--warning), 0 0 4px var(--warning);
}
.health-dot.poor {
  background: var(--danger);
  box-shadow: 0 0 12px var(--danger), 0 0 5px var(--danger);
  animation: healthPoorPulse 1.2s ease-in-out infinite;
}
@keyframes healthPoorPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}
#health-text {
  display: none !important;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-action-btn {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 13px;
  border-radius: 20px;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-action-btn:hover {
  background: rgba(0, 242, 254, 0.2);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.4);
  transform: translateY(-1px);
}

.top-action-btn.active-btn {
  background: rgba(0, 242, 254, 0.25);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.top-action-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

#btn-stats {
  display: none !important;
}

/* Floating Unmute Banner */
.unmute-banner {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 15, 30, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--primary);
  border-radius: 30px;
  padding: 10px 22px;
  display: none;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  z-index: 95;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 22px rgba(0, 242, 254, 0.5);
  animation: pulseUnmute 2s ease-in-out infinite;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s, opacity 0.3s;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
}

/* Never show unmute pill over the intro screen */
#intro-screen:not(.hide-intro) ~ #unmute-btn {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.unmute-banner.show {
  display: inline-flex !important;
}

.unmute-banner:hover {
  background: rgba(0, 242, 254, 0.3);
  border-color: #ffffff;
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.9), 0 0 32px var(--primary);
}

.unmute-banner svg {
  width: 18px;
  height: 18px;
  fill: var(--primary);
  filter: drop-shadow(0 0 8px var(--primary));
  flex-shrink: 0;
}

@keyframes pulseUnmute {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 18px rgba(0, 242, 254, 0.4);
    transform: translateX(-50%) scale(1);
  }
  50% {
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.85), 0 0 30px rgba(0, 242, 254, 0.85);
    transform: translateX(-50%) scale(1.03);
  }
}

/* -------------------------------------------------------------
   BOTTOM CONTROL BAR (GLASSMORPHIC)
   ------------------------------------------------------------- */
.bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.45) 55%, rgba(0,0,0,0) 100%);
  padding: 48px 20px 14px 20px;
  gap: 6px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.player-container.inactive .top-bar {
  opacity: 0;
  transform: translateY(-15px);
  pointer-events: none;
}

.player-container.inactive .bottom-bar {
  opacity: 0;
  transform: translateY(15px);
  pointer-events: none;
}

/* OTT-style control bar (Netflix / Hotstar feel): no box, big white icons over a soft gradient */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.controls-left { flex: 1; }

.ctrl-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, background 0.2s ease;
  position: relative;
  flex-shrink: 0;
  opacity: 0.92;
}
.ctrl-btn:hover {
  opacity: 1;
  transform: scale(1.14);
  background: rgba(255, 255, 255, 0.08);
}
.ctrl-btn:active { transform: scale(0.92); }

.ctrl-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.ctrl-btn svg .ic-solid { fill: currentColor; stroke: none; }

.ctrl-btn.ctrl-primary svg { width: 30px; height: 30px; }

#btn-reload:hover svg { transform: rotate(180deg); }
#btn-settings:hover svg { transform: rotate(60deg); }
#btn-settings.active { background: rgba(255, 255, 255, 0.14); opacity: 1; }
#btn-settings.active svg { transform: rotate(90deg); }

/* Live timeline */
.ott-timeline {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 0 6px;
}
.ott-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  transition: height 0.2s ease;
}
.ott-timeline:hover .ott-track { height: 6px; }
.ott-progress {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff2a6d 0%, #ff4f6d 100%);
  box-shadow: 0 0 10px rgba(255, 42, 109, 0.6);
}
.ott-thumb {
  position: absolute;
  right: -7px;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff2a6d;
  border: 2px solid #fff;
  transform: translateY(-50%);
  animation: liveThumbPulse 1.8s ease-out infinite;
}
@keyframes liveThumbPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 42, 109, 0.7); }
  100% { box-shadow: 0 0 0 10px rgba(255, 42, 109, 0); }
}

/* Channel title next to the controls */
.ott-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-left: 6px;
  color: #fff;
}
.ott-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #ff2a6d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  flex-shrink: 0;
}
.ott-live-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: liveBlink 1.4s ease-in-out infinite;
}
.ott-title-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

/* Feature 4: Spinning Animation for Stream Reconnect Button */
.ctrl-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

/* Tooltips */
.ctrl-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  z-index: 60;
}

.ctrl-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Volume Slider */
.volume-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
  border-radius: 14px;
  transition: background 0.25s ease;
}
.volume-group:hover {
  background: rgba(255, 255, 255, 0.04);
}

.volume-slider {
  --vol: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  opacity: 0;
  height: 4px;
  background: linear-gradient(90deg, #fff 0%, #fff var(--vol), rgba(255, 255, 255, 0.25) var(--vol));
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, margin 0.3s ease;
}
.volume-group:hover .volume-slider,
.volume-slider:focus-visible {
  width: 84px;
  opacity: 1;
  margin: 0 6px 0 2px;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.volume-slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

/* Chromecast / AirPlay Controller Button */
#btn-cast {
  position: relative;
}
#btn-cast google-cast-launcher {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}
#btn-cast.casting-active svg {
  fill: var(--primary) !important;
  stroke: var(--primary) !important;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

/* Unified YouTube / Netflix Style Settings Menu */

#settings-popup {
  position: absolute;
  bottom: 75px;
  right: 24px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 6px;
  width: 290px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 20px 45px rgba(0,0,0,0.8), 0 0 25px rgba(0, 242, 254, 0.15);
  display: none;
  flex-direction: column;
  z-index: 85;
  overflow: hidden;
  animation: fadeInPopup 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

#settings-popup.active {
  display: flex;
}

.settings-view {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.settings-header:hover {
  color: var(--primary);
}

.settings-header svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.settings-item {
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.settings-item:hover {
  background: rgba(0, 242, 254, 0.12);
  color: #fff;
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.settings-item-left svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  color: #94a3b8;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.settings-item:hover .settings-item-left svg {
  color: var(--primary);
}

.settings-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  max-width: 135px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-item:hover .settings-item-right {
  color: #94a3b8;
}

.settings-item-right svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.settings-sub-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 260px;
  overflow-y: auto;
}

.settings-sub-list::-webkit-scrollbar {
  width: 4px;
}
.settings-sub-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.settings-opt-item {
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.2s ease;
  user-select: none;
}

.settings-opt-item:hover {
  background: rgba(0, 242, 254, 0.12);
  color: #fff;
}

.settings-opt-item.selected {
  color: var(--primary);
  font-weight: 700;
  background: rgba(0, 242, 254, 0.15);
}

.settings-check-icon {
  width: 16px;
  height: 16px;
  stroke: var(--primary);
  fill: none;
  stroke-width: 2.5;
}

#settings-cast-launcher {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

/* Popups and Menus */
.menu-popup {
  position: absolute;
  bottom: 75px;
  right: 24px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 8px;
  min-width: 170px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.7);
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 60;
}

.menu-popup.active {
  display: flex;
  animation: fadeInPopup 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInPopup {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-item {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.2s;
}

.menu-item:hover {
  background: rgba(0, 242, 254, 0.1);
  color: #fff;
}

.menu-item.selected {
  color: var(--primary);
  font-weight: 700;
  background: rgba(0, 242, 254, 0.15);
}

/* Feature 8: Sleep Timer Modal */
#sleep-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
}
#sleep-modal.active {
  display: flex;
}
.sleep-modal-box {
  background: rgba(15, 23, 42, 0.96);
  border: 1.5px solid rgba(0, 242, 254, 0.35);
  border-radius: 20px;
  padding: 24px;
  width: 90%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 35px var(--primary-glow);
}
.sleep-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.sleep-opt-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.sleep-opt-btn:hover, .sleep-opt-btn.active-sleep {
  background: rgba(0, 242, 254, 0.2);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px var(--primary-glow);
}

/* Sleep Mode Activated Overlay Screen */
#sleep-overlay {
  position: absolute;
  inset: 0;
  background: #030712;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 150;
}
#sleep-overlay.active {
  display: flex;
}
.sleep-zzz {
  font-size: 48px;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: 4px;
  text-shadow: 0 0 30px var(--primary);
  margin-bottom: 12px;
}
.sleep-sub {
  color: #94a3b8;
  font-size: 14px;
  margin-bottom: 24px;
}


/* Universal Fullscreen / Pseudo Fullscreen */
body.in-pseudo-fullscreen {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

.player-container.is-pseudo-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  z-index: 2147483647 !important;
  background: #000 !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

.player-container:fullscreen,
.player-container:-webkit-full-screen,
.player-container:-moz-full-screen,
.player-container:-ms-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  background: #000 !important;
  border-radius: 0 !important;
}

/* -------------------------------------------------------------
   MOBILE & TABLET RESPONSIVE ADAPTATIONS (AUTO-ADAPTIVE)
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  .top-bar {
    padding: env(safe-area-inset-top, 0px) 12px 0 12px;
    height: calc(env(safe-area-inset-top, 0px) + 50px);
  }
  .live-badge {
    padding: 4px 9px;
    font-size: 10px;
    letter-spacing: 1px;
  }
  .live-dot {
    width: 6px;
    height: 6px;
  }
  .net-health-chip {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }
  .health-dot {
    width: 7px;
    height: 7px;
  }

  /* Unmute Banner on Mobile: Small, Elegant & Safe */
  .unmute-banner {
    top: calc(env(safe-area-inset-top, 0px) + 56px);
    padding: 7px 15px;
    font-size: 10.5px;
    letter-spacing: 0.9px;
    gap: 7px;
    border-radius: 20px;
    border-width: 1.3px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7), 0 0 14px rgba(0, 242, 254, 0.35);
  }
  .unmute-banner svg {
    width: 15px;
    height: 15px;
  }

  /* Bottom Bar Safe Insets & Compact Controls */
  .bottom-bar {
    padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px) 10px;
    gap: 6px;
    background: linear-gradient(0deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.4) 70%, transparent 100%);
  }
  .volume-slider { display: none !important; }
  .top-action-btn span { display: none; }
  .top-action-btn { padding: 6px 10px; }
  .ctrl-btn { width: 36px; height: 36px; border-radius: 10px; }
  .ctrl-btn svg { width: 17px; height: 17px; }
  .controls-left, .controls-right { gap: 5px; }

  /* Center Play Overlay */
  .center-overlay-btn {
    width: 58px;
    height: 58px;
  }
  .center-overlay-btn svg {
    width: 24px;
    height: 24px;
  }

  /* Fast Action Toast */
  #hud-toast {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    font-size: 11px;
    padding: 6px 14px;
  }

  /* Gesture HUD (Volume & Brightness Swipe) */
  .gesture-hud {
    padding: 7px 14px;
    font-size: 11.5px;
    border-radius: 20px;
  }

  /* Stats for Nerds Panel */
  #stats-panel {
    width: calc(100vw - 20px);
    right: 10px;
    top: calc(env(safe-area-inset-top, 0px) + 55px);
    padding: 12px;
    font-size: 11px;
  }

  /* Settings Modal: Sleek Mobile Drawer */
  #settings-popup {
    width: calc(100vw - 16px) !important;
    right: 8px !important;
    left: 8px !important;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 56px) !important;
    border-radius: 16px;
    padding: 5px;
    background: rgba(12, 18, 34, 0.97);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 242, 254, 0.12);
  }
  .settings-item {
    padding: 8px 10px;
    font-size: 11.5px;
    border-radius: 8px;
  }
  .settings-item-left {
    gap: 8px;
    font-size: 11.5px;
  }
  .settings-item-left svg {
    width: 16px;
    height: 16px;
  }
  .settings-item-right {
    font-size: 11px;
    max-width: 105px;
  }
  .settings-opt-item {
    padding: 8px 10px;
    font-size: 11.5px;
    border-radius: 8px;
  }
  .settings-header {
    padding: 7px 10px;
    font-size: 12px;
  }
  .settings-sub-list {
    max-height: 200px;
  }
}

/* Small Screen Phones (Width <= 420px) */
@media (max-width: 420px) {
  .top-bar {
    padding: env(safe-area-inset-top, 0px) 8px 0 8px;
    height: calc(env(safe-area-inset-top, 0px) + 46px);
  }
  .live-badge {
    padding: 3px 7px;
    font-size: 9px;
    letter-spacing: 0.8px;
  }
  .unmute-banner {
    top: calc(env(safe-area-inset-top, 0px) + 50px);
    padding: 6px 12px;
    font-size: 9.5px;
    letter-spacing: 0.7px;
    gap: 5px;
  }
  .unmute-banner svg {
    width: 13px;
    height: 13px;
  }
  .ctrl-btn {
    width: 33px;
    height: 33px;
  }
  .ctrl-btn svg {
    width: 15px;
    height: 15px;
  }
  .controls-left, .controls-right {
    gap: 3px;
  }
  .settings-item {
    padding: 7px 8px;
    font-size: 11px;
  }
  .settings-opt-item {
    padding: 7px 8px;
    font-size: 11px;
  }
}

/* Outline icons: the generic "fill: currentColor" rule turned them into solid blobs */
.unmute-banner svg line,
.gesture-hud svg line,
.gesture-hud svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.unmute-banner svg { color: var(--primary); }
.gesture-hud svg { color: var(--primary); }

/* OTT bar sizing on phones and short iframes */
@media (max-width: 768px) {
  .bottom-bar { gap: 2px; }
  .ctrl-btn { width: 38px; height: 38px; }
  .ctrl-btn svg { width: 22px; height: 22px; }
  .ctrl-btn.ctrl-primary svg { width: 25px; height: 25px; }
  .controls-left, .controls-right { gap: 4px; }
  .ott-title-text { font-size: 13px; }
  .ott-live-tag { font-size: 9px; padding: 2px 6px; }
}
@media (max-width: 420px) {
  .ott-live-tag { display: none; }
}
/* The bottom bar already shows LIVE, so the top badge would be a duplicate */
@media (min-width: 421px) {
  #badge-live { display: none; }
}
@media (max-height: 300px) {
  .ctrl-btn { width: 32px; height: 32px; }
  .ctrl-btn svg { width: 18px; height: 18px; }
  .ctrl-btn.ctrl-primary svg { width: 21px; height: 21px; }
  .ott-timeline { height: 10px; }
  .ott-title-text { font-size: 12px; }
}
@media (hover: none) {
  .ctrl-btn:hover { transform: none; background: transparent; }
  #btn-reload:hover svg, #btn-settings:hover svg { transform: none; }
}

/* Premium center play button with animated glow */
.center-overlay-btn {
  width: 96px;
  height: 96px;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.08) 45%, rgba(10, 14, 30, 0.55) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  overflow: visible;
}
.center-overlay-btn svg {
  width: 40px;
  height: 40px;
  margin-left: 6px;
  fill: #fff;
  position: relative;
  z-index: 3;
  filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.9)) drop-shadow(0 0 22px rgba(127, 92, 255, 0.6));
}
.cp-ring, .cp-ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.cp-ring {
  inset: -4px;
  background: conic-gradient(from 0deg, #00f2fe, #4facfe, #9a7dff, #ff2a6d, #00f2fe);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  z-index: 2;
}
.cp-ring.cp-glow {
  inset: -10px;
  filter: blur(14px);
  opacity: 0.85;
  -webkit-mask: none;
  mask: none;
  z-index: -1;
}
.cp-ripple {
  inset: 0;
  border: 2px solid rgba(0, 242, 254, 0.7);
  opacity: 0;
  z-index: 1;
}
.center-overlay-btn.show-btn .cp-ring { animation: cpSpin 3.2s linear infinite; }
.center-overlay-btn.show-btn .cp-ripple { animation: cpRipple 2.4s cubic-bezier(0.2, 0.6, 0.4, 1) infinite; }
.center-overlay-btn.show-btn .cp-ripple.r2 { animation-delay: 1.2s; border-color: rgba(154, 125, 255, 0.7); }
.center-overlay-btn.show-btn { animation: cpBreath 2.4s ease-in-out infinite; }
@keyframes cpSpin { to { transform: rotate(360deg); } }
@keyframes cpRipple {
  0% { transform: scale(1); opacity: 0.85; }
  100% { transform: scale(1.75); opacity: 0; }
}
@keyframes cpBreath {
  0%, 100% { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 242, 254, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
  50% { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 60px rgba(127, 92, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
}
.center-overlay-btn:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.12) 45%, rgba(10, 14, 30, 0.5) 100%);
}

/* Whole player edge glows while paused */
.player-container::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.5s ease;
  box-shadow: inset 0 0 40px rgba(0, 242, 254, 0.35), inset 0 0 90px rgba(127, 92, 255, 0.25);
}
.player-container.is-paused::after {
  opacity: 1;
  animation: edgeGlow 2.6s ease-in-out infinite;
}
@keyframes edgeGlow {
  0%, 100% { box-shadow: inset 0 0 30px rgba(0, 242, 254, 0.3), inset 0 0 80px rgba(127, 92, 255, 0.18); }
  50% { box-shadow: inset 0 0 55px rgba(0, 242, 254, 0.5), inset 0 0 120px rgba(255, 42, 109, 0.25); }
}

@media (max-width: 768px) {
  .center-overlay-btn { width: 72px; height: 72px; }
  .center-overlay-btn svg { width: 30px; height: 30px; margin-left: 4px; }
}
@media (max-height: 300px) {
  .center-overlay-btn { width: 56px; height: 56px; }
  .center-overlay-btn svg { width: 24px; height: 24px; }
}

/* Rightmost tooltip would overflow the player edge when centered */
.controls-right .ctrl-btn:last-child::after { left: auto; right: 0; transform: translateY(4px); }
.controls-right .ctrl-btn:last-child:hover::after { transform: translateY(0); }

/* Telegram join link (right side of the control bar): no box, just a highlighted label */
.tg-promo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  margin-right: 4px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.tg-icon {
  width: 22px;
  height: 22px;
  fill: #2aabee;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(42, 171, 238, 0.75));
  animation: tgIconGlow 2.4s ease-in-out infinite;
}
@keyframes tgIconGlow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(42, 171, 238, 0.55)); transform: rotate(0deg); }
  50% { filter: drop-shadow(0 0 12px rgba(42, 171, 238, 1)); transform: rotate(-8deg); }
}
.tg-label {
  position: relative;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  background: linear-gradient(100deg, #2aabee 0%, #8fe3ff 35%, #ffffff 50%, #8fe3ff 65%, #2aabee 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #2aabee;
  animation: tgShine 3.2s linear infinite;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.7));
}
@keyframes tgShine {
  from { background-position: 100% 0; }
  to { background-position: -150% 0; }
}
/* Glowing underline that grows on hover */
.tg-label::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #2aabee, #8fe3ff);
  box-shadow: 0 0 8px rgba(42, 171, 238, 0.9);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (hover: hover) {
  .tg-promo:hover { transform: translateY(-1px); }
  .tg-promo:hover .tg-label::after { transform: scaleX(1); }
}

@media (max-width: 768px) {
  .tg-promo { height: 34px; padding: 0 6px; gap: 6px; }
  .tg-icon { width: 19px; height: 19px; }
  .tg-label { font-size: 13px; }
}
@media (max-width: 420px) {
  .tg-label { display: none; }
  .tg-promo { padding: 0 4px; margin-right: 0; }
  .tg-icon { width: 21px; height: 21px; }
}
@media (max-height: 300px) {
  .tg-promo { height: 30px; }
  .tg-icon { width: 17px; height: 17px; }
  .tg-label { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .tg-icon, .tg-label { animation: none; }
}

/* Popups must never overflow a small iframe: scroll inside instead of being clipped */
#settings-popup {
  z-index: 96;
  max-height: calc(100% - 90px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
#settings-popup .settings-sub-list {
  max-height: none;
}
#stats-panel {
  max-width: calc(100% - 20px);
  max-height: calc(100% - 90px);
  overflow-y: auto;
}
.sleep-modal-box {
  max-height: calc(100% - 24px);
  overflow-y: auto;
}

/* Touch devices: no sticky hover tooltips / lifted buttons after a tap */
@media (hover: none) {
  .ctrl-btn::after { display: none; }
  .ctrl-btn:hover,
  .top-action-btn:hover,
  .live-badge:hover,
  .net-health-chip:hover,
  .center-overlay-btn:hover {
    transform: none;
    box-shadow: none;
  }
  .center-overlay-btn:hover { transform: translate(-50%, -50%) scale(1); }
  .unmute-banner:hover { transform: translateX(-50%); }
}

/* Short iframes (e.g. 16:9 embed on a phone, ~200px tall) */
@media (max-height: 300px) {
  .top-bar { height: 40px; padding-top: 0; }
  .bottom-bar { padding: 4px 8px 6px 8px; }
  .ctrl-btn { width: 30px; height: 30px; border-radius: 8px; }
  .ctrl-btn svg { width: 14px; height: 14px; }
  .center-overlay-btn { width: 48px; height: 48px; }
  .center-overlay-btn svg { width: 20px; height: 20px; }
  .unmute-banner { top: 44px; padding: 5px 11px; font-size: 9px; }
  .unmute-banner svg { width: 12px; height: 12px; }
  #hud-toast { top: 8px; }
  #settings-popup { bottom: 42px !important; max-height: calc(100% - 50px); }
  #stats-panel { top: 42px; padding: 10px; gap: 6px; }
  .intro-grid, .intro-badge, .intro-particles { display: none; }
  .intro-title { margin-top: 8px; }
  .gesture-hud { padding: 8px 14px; gap: 6px; }
  .gesture-hud svg { width: 22px; height: 22px; }
  .sleep-modal-box { padding: 14px; }
  .sleep-options-grid { margin-top: 10px; gap: 6px; }
  .sleep-opt-btn { padding: 8px; font-size: 12px; }
}

/* Mobile browsers: 100vh includes the URL bar, use dynamic viewport where supported */
@supports (height: 100dvh) {
  .player-container.is-pseudo-fullscreen {
    height: 100dvh !important;
    max-height: 100dvh !important;
  }
}

/* -------------------------------------------------------------
   STREAM DOWN / OFFLINE SCREEN
   ------------------------------------------------------------- */
#down-screen {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px 16px 72px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(0, 242, 254, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(127, 92, 255, 0.14) 0%, transparent 60%),
    rgba(4, 6, 13, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#down-screen.active { display: flex; animation: snIn 0.3s ease; }
.ds-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 420px;
}
.ds-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.3);
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.2);
  margin-bottom: 14px;
  animation: dsPulse 2.2s ease-in-out infinite;
}
#down-screen[data-kind="offline"] .ds-icon {
  background: rgba(255, 42, 109, 0.08);
  border-color: rgba(255, 42, 109, 0.35);
  box-shadow: 0 0 30px rgba(255, 42, 109, 0.2);
}
@keyframes dsPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.ds-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: #00f2fe;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ds-ic-offline { display: none; stroke: #ff4f7b !important; }
#down-screen[data-kind="offline"] .ds-ic-down { display: none; }
#down-screen[data-kind="offline"] .ds-ic-offline { display: block; }
.ds-title {
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.ds-sub {
  margin-top: 6px;
  color: #94a3b8;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.ds-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
.ds-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.ds-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.ds-primary {
  color: #04101f;
  background: linear-gradient(135deg, #00f2fe, #4facfe);
  box-shadow: 0 6px 18px rgba(0, 242, 254, 0.3);
}
.ds-primary svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ds-tg {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}
.ds-tg svg { fill: #29b6f6; }
@media (hover: hover) {
  .ds-btn:hover { transform: translateY(-1px); }
  .ds-primary:hover { box-shadow: 0 8px 24px rgba(0, 242, 254, 0.5); }
  .ds-tg:hover { background: rgba(255, 255, 255, 0.12); }
}
@media (max-width: 480px) {
  .ds-title { font-size: 16px; }
  .ds-sub { font-size: 12px; }
  .ds-icon { width: 50px; height: 50px; margin-bottom: 10px; }
  .ds-icon svg { width: 24px; height: 24px; }
  .ds-btn { height: 34px; padding: 0 12px; font-size: 12px; }
}
@media (max-height: 300px) {
  #down-screen { padding-bottom: 48px; }
  .ds-icon { display: none; }
  .ds-title { font-size: 14px; }
  .ds-sub { font-size: 11px; margin-top: 3px; }
  .ds-actions { margin-top: 10px; gap: 6px; }
  .ds-btn { height: 28px; padding: 0 10px; font-size: 11px; }
}

/* The unmute pill must not cover the down screen or the rotate hint */
#player-wrap:has(#down-screen.active) #unmute-btn,
#player-wrap:has(#rotate-hint.show) #unmute-btn {
  display: none !important;
}

/* Rotate-to-fullscreen hint */
#rotate-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 62;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 30px;
  border: 1.5px solid rgba(0, 242, 254, 0.6);
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 24px rgba(0, 242, 254, 0.45);
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
#rotate-hint.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
  animation: rotateHintGlow 2s ease-in-out infinite;
}
@keyframes rotateHintGlow {
  0%, 100% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 18px rgba(0, 242, 254, 0.35); }
  50% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 34px rgba(0, 242, 254, 0.75); }
}
#rotate-hint svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #00f2fe;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* -------------------------------------------------------------
   STATS FOR NERDS (YouTube-style)
   ------------------------------------------------------------- */
#stats-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  right: auto;
  width: 400px;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 16px 14px;
  background: rgba(22, 22, 26, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #fff;
  z-index: 80;
  display: none;
  user-select: text;
  -webkit-user-select: text;
}
#stats-panel.active {
  display: block;
  animation: snIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes snIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
#stats-panel::-webkit-scrollbar { width: 4px; }
#stats-panel::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 4px; }

.sn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.sn-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.sn-head-actions { display: flex; align-items: center; gap: 2px; }
.sn-icon-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.sn-icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.sn-icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  line-height: 1.95;
  min-width: 0;
}
.sn-k {
  color: rgba(255, 255, 255, 0.68);
  white-space: nowrap;
  flex-shrink: 0;
}
.sn-v {
  color: #fff;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.sn-graph-v {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.sn-spark {
  width: 90px;
  height: 16px;
  flex-shrink: 0;
}

@media (max-width: 520px) {
  #stats-panel { top: 8px; left: 8px; width: auto; right: 8px; max-width: none; padding: 10px 12px; }
  .sn-row { font-size: 11px; gap: 10px; line-height: 1.8; }
  .sn-title { font-size: 12px; }
  .sn-spark { width: 56px; height: 13px; }
}
@media (max-width: 420px) {
  .sn-spark { width: 44px; height: 12px; }
  .sn-row { font-size: 10px; gap: 8px; }
  .sn-graph-v { gap: 6px; }
}
@media (max-width: 330px) {
  .sn-spark { display: none; }
}
@media (max-height: 300px) {
  #stats-panel { top: 6px; left: 6px; max-height: calc(100% - 12px); padding: 8px 10px; }
  .sn-head { margin-bottom: 4px; }
  .sn-row { font-size: 10px; line-height: 1.6; }
  .sn-icon-btn { width: 24px; height: 24px; }
}
