/* ========= RESET & BASE ========= */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-0: #0a0612;
  --bg-1: #120a22;
  --bg-2: #1a0f30;
  --bg-3: #251540;
  --surface: #1e1233;
  --surface-hover: #2a1a47;
  --border: #2e1f4d;

  --text-1: #f5f0ff;
  --text-2: #c8b8e0;
  --text-3: #8878a8;

  --accent: #a855f7;       /* violeta principal */
  --accent-2: #7c3aed;     /* violeta oscuro */
  --accent-3: #22d3ee;     /* cian para acentos */
  --accent-hot: #ec4899;   /* rosa/magenta para LIVE */
  --accent-gold: #fbbf24;  /* dorado premium */

  --gradient: linear-gradient(135deg, #a855f7 0%, #7c3aed 50%, #ec4899 100%);
  --gradient-soft: linear-gradient(135deg, rgba(168,85,247,.18), rgba(236,72,153,.18));

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 22px;

  --shadow-1: 0 4px 20px rgba(0,0,0,.35);
  --shadow-glow: 0 8px 40px rgba(168,85,247,.35);
}

html, body { height: 100%; }
body {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(168,85,247,.15), transparent 60%),
    radial-gradient(900px 500px at 100% 10%, rgba(236,72,153,.12), transparent 60%),
    var(--bg-0);
  color: var(--text-1);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* Cualquier regla de autor que fije `display` en un elemento (ej. .btn,
   .main-nav a) pisa el `[hidden]{display:none}` del user-agent por orden
   de aparición, dejando "ocultos" visibles. Esta regla, al ir última en
   cascada dentro del mismo layer/origen, gana siempre y hace que `hidden`
   funcione en todo el sitio sin tener que repetir `.selector[hidden]` cada
   vez que un componente nuevo define su propio display. */
[hidden] { display: none !important; }

/* ========= BUTTONS ========= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
  white-space: nowrap;
}
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn-primary {
  background: var(--accent-2);
  color: #fff;
}
.btn-primary:hover { background: var(--accent); }
.btn-outline {
  background: transparent;
  color: var(--text-1);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost {
  color: var(--text-2);
  padding: 10px 16px;
}
.btn-ghost:hover { color: var(--text-1); }

/* ========= HEADER ========= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 6, 18, .85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: grid;
  /* minmax(0,…): el menú y el buscador encogen antes de que las acciones
     se salgan por la derecha (con sesión iniciada hay más botones). */
  grid-template-columns: auto minmax(0, 1fr) minmax(220px, 380px) auto;
  align-items: center;
  gap: 24px;
  padding: 14px 40px;
  max-width: 1600px;
  margin: 0 auto;
}

.logo {
  display: inline-flex;
  align-items: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.logo-mark {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo-tag {
  color: var(--text-1);
  border: 1.5px solid var(--border);
  padding: 1px 9px;
  border-radius: 6px;
  margin-left: 6px;
  font-size: 18px;
}

.main-nav {
  min-width: 0;
  overflow-x: auto;           /* si no caben todos los enlaces, se deslizan */
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav ul {
  display: flex;
  gap: 4px;
  justify-self: start;
  margin-left: 16px;
}
.main-nav a {
  padding: 8px 2px;
  margin: 0 10px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  transition: border-color .15s ease, color .15s ease;
}
.main-nav a:hover { color: var(--text-1); }
.main-nav a.active { color: var(--text-1); border-color: var(--accent); }
.main-nav a[hidden] { display: none; }
.badge-live {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-hot);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.search-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 4px 4px 18px;
  min-width: 0;
  transition: border-color .15s ease;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-1);
  font-size: 14px;
  padding: 8px 0;
}
.search-bar input::placeholder { color: var(--text-3); }
.search-bar button {
  background: var(--surface-hover);
  color: var(--text-1);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background .15s ease;
}
.search-bar button:hover { background: var(--accent-2); }

.header-actions { display: flex; gap: 8px; align-items: center; }
/* Contenedores de los botones de sesión: en fila, nunca apilados. */
#userGuestActions, .user-auth-profile { display: flex; gap: 8px; align-items: center; min-width: 0; }

/* SUB NAV */
.sub-nav {
  padding: 10px 40px 14px;
  max-width: 1600px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.sub-nav::-webkit-scrollbar { display: none; }
.sub-nav ul {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}
.chip {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all .15s ease;
}
.chip:hover { background: var(--surface-hover); color: var(--text-1); }
.chip-active {
  background: var(--gradient);
  color: #fff;
  font-weight: 600;
}

/* ========= CIFRAS DEL CATÁLOGO (línea compacta bajo los chips) ========= */
.header-catalog-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 40px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  white-space: nowrap;
}
.header-catalog-stats strong { color: var(--accent); font-weight: 800; }
.header-catalog-stats__sep { color: var(--border); }
.header-catalog-stats .stat-ph { color: var(--accent); }
.header-catalog-stats .stat-xv { color: var(--accent-3); }

/* ========= VIDEO SECTIONS ========= */
.video-section,
.categories-section,
.creators-section {
  max-width: 1600px;
  margin: 0 auto;
  padding: 40px 40px;
}
/* Sin creadores reales no se muestra la sección (ni cabecera ni avatares). */
.creators-section.is-empty { display: none; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}
.section-header h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.see-all {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.see-all:hover { color: var(--accent-hot); }

.section-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 0 0.5rem;
}
.section-sentinel {
  height: 1px;
  width: 100%;
  pointer-events: none;
}

.video-grid {
  display: grid;
  /* minmax(0, …) y no 1fr: un 1fr no encoge por debajo del contenido más
     ancho, y un título sin espacios (p.ej. 200 caracteres de escapes Unicode sin decodificar)
     estiraba la columna a 1466px en un móvil de 375. */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 1100px) {
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Móvil: se mantienen 2 columnas (4-6 vídeos por pantalla) y la tarjeta se
   aligera — sin avatar, textos y controles más pequeños. */
@media (max-width: 520px) {
  .video-grid { gap: 16px 10px; }
  .video-grid .video-card { gap: 6px; }
  .video-grid .video-meta .avatar { display: none; }
  .video-grid .video-title { font-size: 13px; margin-bottom: 2px; }
  .video-grid .video-creator { font-size: 12px; }
  .video-grid .video-creator,
  .video-grid .video-stats { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .video-grid .video-stats { font-size: 11px; }
  .video-grid .video-card .play-overlay::after { width: 42px; height: 42px; background-size: 20px 20px; }
  .video-grid .btn-fav-toggle { top: 6px; right: 6px; width: 28px; height: 28px; font-size: 12px; }
  .video-grid .video-card .age-badge { top: 6px; left: 6px; font-size: 10px; padding: 2px 6px; }
  .video-grid .thumb .duration { bottom: 6px; right: 6px; font-size: 10px; padding: 2px 5px; }
}

.video-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;           /* como item de grid, que su contenido no ensanche la columna */
  cursor: pointer;
  transition: transform .2s ease;
}
.video-card:hover { transform: translateY(-4px); }

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.7));
  opacity: .7;
  transition: opacity .2s ease;
}
.video-card:hover .thumb::after { opacity: .4; }

.thumb-gradient {
  position: absolute;
  inset: 0;
}
.thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb .duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,.85);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 5px;
  z-index: 2;
}
.thumb .hd-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--gradient);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
  letter-spacing: .5px;
  z-index: 2;
}
.thumb .play-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 2;
}
.thumb .play-icon svg {
  width: 54px;
  height: 54px;
  color: #fff;
  filter: drop-shadow(0 0 12px rgba(168,85,247,.8));
}
.video-card:hover .thumb .play-icon { opacity: 1; }

.video-meta {
  display: flex;
  gap: 10px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.meta-text { flex: 1; min-width: 0; }
.video-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere; /* títulos sin espacios también se parten */
}
.video-card:hover .video-title { color: var(--accent); }
.video-creator {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 2px;
}
.video-stats {
  font-size: 12px;
  color: var(--text-3);
}

/* ========= CATEGORIES ========= */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.cat-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  height: 150px;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 700;
  position: relative;
  overflow: hidden;
  transition: transform .2s ease;
}
.cat-card:hover { transform: translateY(-4px) scale(1.02); }
.cat-card span { font-size: 20px; z-index: 2; }
.cat-card em {
  font-size: 12px;
  font-style: normal;
  opacity: .8;
  font-weight: 500;
  z-index: 2;
  margin-top: 4px;
}
.cat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.55));
  z-index: 1;
}
.cat-1 { background: linear-gradient(135deg, #a855f7, #ec4899); }
.cat-2 { background: linear-gradient(135deg, #22d3ee, #7c3aed); }
.cat-3 { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.cat-4 { background: linear-gradient(135deg, #ec4899, #f59e0b); }
.cat-5 { background: linear-gradient(135deg, #10b981, #22d3ee); }
.cat-6 { background: linear-gradient(135deg, #f472b6, #a855f7); }

/* ========= CREATORS ========= */
.creators-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}
.creator-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all .2s ease;
  cursor: pointer;
}
.creator-card:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: translateY(-3px);
}
.creator-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin-bottom: 12px;
  border: 3px solid transparent;
  background-clip: padding-box;
  position: relative;
}
.creator-avatar::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--gradient);
  z-index: -1;
}
.creator-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 2px;
}
.creator-subs {
  font-size: 12px;
  color: var(--text-3);
}

/* ========= PREMIUM CTA ========= */
.premium-cta {
  max-width: 1600px;
  margin: 40px auto;
  padding: 0 40px;
}
.premium-inner {
  background:
    radial-gradient(circle at 20% 50%, rgba(251,191,36,.2), transparent 60%),
    linear-gradient(135deg, #2a1a47 0%, #1a0f30 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 50px 60px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  align-items: center;
  gap: 40px;
  position: relative;
  overflow: hidden;
}
.premium-label {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent-gold), #f59e0b);
  color: #0a0612;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 5px 10px;
  border-radius: 4px;
  margin-bottom: 14px;
}
.premium-inner h2 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 12px;
}
.premium-inner p {
  color: var(--text-2);
  margin-bottom: 24px;
  max-width: 480px;
}
.premium-deco {
  position: relative;
  height: 200px;
}
.deco-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 2px solid rgba(168,85,247,.3);
  animation: spin 20s linear infinite;
}
.deco-ring-2 {
  width: 240px;
  height: 240px;
  border-color: rgba(236,72,153,.2);
  animation-duration: 30s;
  animation-direction: reverse;
}
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }
.deco-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: var(--gradient);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

/* ========= FOOTER ========= */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 60px 40px 30px;
  background: var(--bg-1);
}
.footer-grid {
  max-width: 1600px;
  margin: 0 auto 40px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-desc {
  color: var(--text-3);
  font-size: 14px;
  margin-top: 12px;
  max-width: 320px;
}
.site-footer h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 16px;
}
.site-footer ul li { margin-bottom: 10px; }
.site-footer ul a {
  color: var(--text-3);
  font-size: 14px;
  transition: color .15s ease;
}
.site-footer ul a:hover { color: var(--accent); }

.footer-bottom {
  max-width: 1600px;
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-3);
  font-size: 13px;
}
.socials { display: flex; gap: 8px; }
.socials a {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  transition: all .15s ease;
}
.socials a:hover {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
}

/* ========= RESPONSIVE ========= */
@media (max-width: 1100px) {
  /* Fila 1: logo · menú · acciones. Fila 2: buscador a lo ancho. Así el menú
     sigue visible (y deslizable si no cabe) hasta 860px, donde entra la barra inferior. */
  .header-inner { grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px 16px; padding: 14px 24px; }
  .search-bar { grid-column: 1 / -1; grid-row: 2; }
  .header-actions .btn-label { display: none; }
  .user-menu__name { max-width: 140px; }
  .premium-inner { grid-template-columns: 1fr; padding: 40px 30px; }
  .premium-deco { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  body { padding-bottom: 74px; }
  .header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
  }
  .search-bar {
    order: 3;
    width: 100%;
    margin-top: 4px;
    display: flex;
  }
  .main-nav { display: none; }
  .header-actions { gap: 6px; }
  .header-actions .btn { padding: 6px 12px; font-size: 12px; }
  .sub-nav, .video-section, .categories-section, .creators-section, .premium-cta { padding-left: 14px; padding-right: 14px; }
  .header-catalog-stats { padding-left: 14px; padding-right: 14px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
  .premium-inner h2 { font-size: 22px; }
  .section-header h2 { font-size: 18px; }
}

/* ========= AGE GATE +18 ========= */
html.age-locked, body.age-locked { overflow: hidden; }
body.age-locked > *:not(.age-gate) { filter: blur(12px) brightness(.4); pointer-events: none; user-select: none; }

.age-gate {
  position: fixed; inset: 0;
  z-index: 9999;
  display: grid; place-items: center;
  background: radial-gradient(circle at center, rgba(15,8,22,.92), rgba(0,0,0,.98));
  backdrop-filter: blur(8px);
  padding: 24px;
}
/* Fix: ".age-gate { display: grid }" overrides el UA "[hidden] { display: none }" por orden de aparición.
   Necesitamos esta regla con mayor especificidad para que gate.hidden=true oculte de verdad. */
.age-gate[hidden], .cookie-banner[hidden] { display: none; }
/* Mismo problema con home-sections y filtered-view: tienen display: grid/flex/etc.
 * que pisa el UA "[hidden] { display: none }". Sin esta regla, ocultar via JS no surte efecto. */
.home-sections[hidden], .filtered-view[hidden],
.standalone-view[hidden], [data-home-only][hidden] { display: none; }
.age-gate__panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  max-width: 520px; width: 100%;
  text-align: center;
  box-shadow: var(--shadow-glow), var(--shadow-1);
}
.age-gate__panel h2 {
  font-size: 26px; line-height: 1.25;
  margin-bottom: 16px;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.age-gate__panel p {
  color: var(--text-2);
  font-size: 14px; line-height: 1.6;
  margin-bottom: 28px;
}
.age-gate__panel a { color: var(--accent); text-decoration: underline; }
.age-gate__actions {
  display: flex; gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.age-gate__actions .btn { min-width: 180px; }

/* ========= COOKIE BANNER ========= */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 9000;
  background: rgba(18, 10, 34, .96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  padding: 14px 24px;
  box-shadow: 0 -8px 28px rgba(0,0,0,.45);
}
.cookie-banner__inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  flex-wrap: wrap;
}
.cookie-banner__text {
  color: var(--text-2);
  font-size: 13px; line-height: 1.5;
  flex: 1 1 320px;
  margin: 0;
}
.cookie-banner__text a { color: var(--accent); text-decoration: underline; }
.cookie-banner__actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.cookie-banner__actions .btn { padding: 8px 16px; font-size: 13px; }

@media (max-width: 720px) {
  .cookie-banner__inner { flex-direction: column; align-items: stretch; gap: 12px; }
  .cookie-banner__actions { justify-content: stretch; }
  .cookie-banner__actions .btn { flex: 1; }
}

/* ========= VIDEO EMBED CARDS ========= */
/* Aplicado cuando una card carga su iframe lazy: */
.video-card .embed-frame {
  position: absolute; inset: 0;
  border: 0;
  width: 100%; height: 100%;
}
.video-card .play-overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(0,0,0,.25);
  transition: background .15s ease;
  cursor: pointer;
  pointer-events: none; /* deja que el click vaya al thumb (ahora cargamos auto via IO) */
}
.video-card:hover .play-overlay { background: rgba(0,0,0,.45); }
/* Play button: SVG inline como image-data para evitar bug del multiple-bg overlap */
.video-card .play-overlay::after {
  content: '';
  width: 64px; height: 64px;
  border-radius: 50%;
  background-color: rgba(168, 85, 247, .9);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M8 5v14l11-7z'/></svg>");
  background-size: 30px 30px;
  background-repeat: no-repeat;
  background-position: 56% center; /* ligeramente a la derecha — el triángulo se centra ópticamente */
  box-shadow: 0 8px 28px rgba(168, 85, 247, .55);
}
/* Cuando el iframe ya está cargado, oculta el overlay */
.video-card .thumb[data-embed-loaded="1"] .play-overlay { display: none; }
.video-card .thumb[data-embed-loaded="1"] .age-badge { display: none; }
.video-card .thumb[data-embed-loaded="1"] .duration { display: none; }
.video-card .age-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--accent-hot);
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: .5px;
}

/* ========= PÁGINA DE VIDEO =========
   Vista standalone de página completa (no un diálogo flotante): mismo
   .standalone-view que Categorías/Creadores/etc., para que un video se
   sienta como su propia página en vez de un lightbox sobre el fondo. */
.video-modal__panel {
  max-width: 1100px;
  margin: 0 auto;
}
.video-modal__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 16px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.video-modal__back:hover { color: var(--text-1); }
.video-modal__player {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.video-modal__iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
/* Vídeo retirado en origen: aviso en el hueco del reproductor. */
.video-modal__unavailable {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px;
  padding: 16px;
  text-align: center;
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
}
.video-modal__unavailable strong { color: var(--text-1); font-size: 17px; }
.video-modal__title {
  margin: 16px 0 0;
  padding: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
}
.video-modal__hint {
  margin: 10px 0 0;
  padding: 0;
  font-size: 12px;
  color: var(--text-3);
}

body.modal-open { overflow: hidden; }

@media (max-width: 720px) {
  .video-modal__title { font-size: 18px; }
}

/* ============ FILTERED VIEW ============
   Vista que se muestra cuando hay un chip activo (section/tag) o búsqueda.
   Estructura: header (título + count) + grid + botón "Cargar más" + mensaje vacío. */
.filtered-view {
  padding: 28px max(20px, 4vw) 40px;
  max-width: 1640px;
  margin: 0 auto;
  animation: fadeUp .28s ease-out;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.filtered-view .section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.filtered-view .section-header h2 { font-size: 26px; margin: 0; color: #f3e8ff; }
.filtered-count { color: rgba(243, 232, 255, .65); font-size: 13px; font-weight: 500; }
.filtered-actions { display: flex; flex-direction: column; align-items: center; margin-top: 28px; gap: 14px; }

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 32px 0 16px;
}
.pagination button {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.pagination button:hover:not(:disabled):not([aria-current="page"]) {
  background: var(--surface-hover);
  color: var(--text-1);
}
.pagination button:active:not(:disabled) { transform: translateY(1px); }
.pagination button[aria-current="page"] {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}
.pagination button:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.pagination .ellipsis {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 40px;
  color: var(--text-3);
  user-select: none;
}
.pagination-prev,
.pagination-next { padding: 0 14px; }

/* Mini-pager debajo de cada sección home (más compacto que el .pagination grande) */
.section-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin: 16px 0 8px;
}
.section-pagination button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.section-pagination button:hover:not(:disabled):not([aria-current="page"]) {
  background: var(--surface-hover);
  color: var(--text-1);
}
.section-pagination button[aria-current="page"] {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
}
.section-pagination button:disabled { opacity: .35; cursor: not-allowed; }
.section-pagination .ellipsis {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 32px;
  color: var(--text-3);
  font-size: 13px;
}

/* ===== STANDALONE VIEWS (Videos / Categorías / Creadores / En vivo) ===== */
.standalone-view {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 40px 40px;
}
.standalone-view[hidden] { display: none; }
@media (max-width: 720px) {
  .standalone-view { padding: 18px 16px 32px; }
}

/* Vista Categorías: 4 tarjetas grandes */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 24px;
  margin-top: 16px;
}
.category-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color .15s ease;
  text-decoration: none;
  color: inherit;
}
.category-card:hover {
  border-color: var(--accent);
}
.category-card__thumbs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 16 / 9;
  gap: 2px;
  background: var(--bg-2);
}
.cat-card__thumb {
  background-size: cover;
  background-position: center;
  background-color: var(--bg-3);
}
.category-card__body {
  padding: 18px 20px 22px;
}
.category-card__body h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-1);
}
.category-card__body p {
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 10px;
}
.category-card__count {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
}

/* Vista Creadores: grid en lugar de fila */
.creators-row-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  overflow-x: visible;
  padding: 4px 0 0;
}

/* Vista En vivo: placeholder */
.live-view { min-height: 70vh; display: grid; place-items: center; }
.live-placeholder {
  text-align: center;
  max-width: 560px;
  padding: 48px 32px;
}
.live-placeholder__icon {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--gradient-soft);
  border: 1px solid rgba(236,72,153,.4);
  color: var(--accent-hot);
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(236,72,153,.5); }
  50%     { box-shadow: 0 0 0 18px rgba(236,72,153,0); }
}
.live-placeholder h2 {
  font-size: 28px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, #fff 0%, #c8b8e0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.live-placeholder p {
  color: var(--text-2);
  font-size: 16px;
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ===== FOOTER CREDIT ===== */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.footer-bottom__copy { display: flex; flex-direction: column; gap: 4px; }
.footer-bottom__credit {
  color: var(--text-3);
  font-size: 13px;
}
.footer-bottom__credit a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: color .15s ease;
}
.footer-bottom__credit a:hover { color: var(--accent-hot); }

/* ===== AUTH MODAL ===== */
.auth-modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
}
.auth-modal[hidden] { display: none; }
.auth-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 4, 18, .82);
  backdrop-filter: blur(8px);
}
.auth-modal__panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px 28px;
  box-shadow: var(--shadow-1), var(--shadow-glow);
}
.auth-modal__close {
  position: absolute;
  top: 12px; right: 12px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 14px;
}
.auth-modal__close:hover { background: var(--surface-hover); color: var(--text-1); }
.auth-modal__title {
  font-size: 22px;
  margin-bottom: 18px;
  text-align: center;
  background: linear-gradient(180deg, #fff 0%, #c8b8e0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-modal__tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-2);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.auth-tab:hover { color: var(--text-1); }
.auth-tab[aria-selected="true"] {
  background: var(--gradient);
  color: #fff;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form[hidden] { display: none; }
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
}
.auth-form input, .auth-form select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-1);
  font: inherit;
  transition: border-color .15s ease;
}
.auth-form input:focus, .auth-form select:focus {
  outline: none;
  border-color: var(--accent);
}
.auth-form input:disabled { opacity: .55; cursor: not-allowed; }
.auth-form .btn { margin-top: 6px; }
.auth-form__notice {
  background: var(--gradient-soft);
  border: 1px solid rgba(168,85,247,.4);
  color: var(--text-2);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}
.auth-form__hint, .auth-form__msg {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  margin: 0;
}
.auth-form__msg { color: var(--accent-hot); min-height: 18px; }
.auth-link {
  color: var(--accent);
  font-weight: 600;
  background: none;
  padding: 0;
  text-decoration: underline;
}
.auth-link:hover { color: var(--accent-hot); }

/* ===== ADMIN PANEL VIEW ===== */
.admin-view .admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.admin-view .admin-card h3 {
  margin: 0 0 16px;
  font-size: 18px;
  color: var(--text-1);
}
.admin-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; align-items: end; }
.admin-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.admin-form input, .admin-form select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-1);
  font: inherit;
}
.admin-form input:focus, .admin-form select:focus { outline: none; border-color: var(--accent); }
.admin-form button { height: 42px; }
.admin-form__msg { grid-column: 1 / -1; min-height: 18px; color: var(--text-2); margin: 0; font-size: 13px; }
.admin-counts { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-count {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-2);
}
.admin-count strong { color: var(--accent); margin-right: 4px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--text-3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.admin-table code { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 12px; color: var(--accent-3); }
.btn-danger { color: var(--accent-hot); }
.btn-danger:hover { color: #fff; background: var(--accent-hot); }
.header-admin-link { color: var(--accent); }
.filtered-empty {
  margin: 0;
  padding: 40px 20px;
  text-align: center;
  color: rgba(243, 232, 255, .6);
  font-size: 15px;
  background: rgba(168, 85, 247, .04);
  border: 1px dashed rgba(168, 85, 247, .25);
  border-radius: 12px;
  width: 100%;
}
@media (max-width: 720px) {
  .filtered-view { padding: 18px 16px 32px; }
  .filtered-view .section-header h2 { font-size: 20px; }
}

/* ==========================================================================
   LIVE STREAMING SUITE (Hub, Player, Chat, Studio)
   ========================================================================== */

.live-view {
  min-height: 80vh;
  padding: 24px 20px 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.live-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Nav Header */
.live-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.live-nav-header__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  color: #fff;
}

.live-dot-pulse {
  width: 14px;
  height: 14px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: live-pulse-ring 1.8s infinite;
}

@keyframes live-pulse-ring {
  0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70%  { transform: scale(1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.live-nav-header__subtitle {
  font-size: 14px;
  color: var(--text-2);
  margin-top: 4px;
  display: block;
}

.live-nav-header__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 600px) {
  .live-nav-header__title { font-size: 21px; }
  .live-nav-header__actions { width: 100%; }
  .live-nav-header__actions .btn { flex: 1 1 auto; justify-content: center; white-space: normal; }
}

.btn-pulse-live {
  background: linear-gradient(135deg, #ef4444 0%, #ec4899 100%);
  border: none;
  color: #fff;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-pulse-live:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

/* Grid de Canales en Vivo */
.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 24px;
}

.live-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
}

.live-card:hover {
  transform: translateY(-4px);
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.live-card__thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #181024;
  overflow: hidden;
}

.live-card__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.live-card:hover .live-card__thumb {
  transform: scale(1.04);
}

.live-card__badge-live {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.live-card__badge-viewers {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.live-card__category {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: var(--accent-3);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: capitalize;
}

.live-card__body {
  padding: 14px 16px;
  display: flex;
  gap: 12px;
}

.live-card__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ef4444;
  flex-shrink: 0;
}

.live-card__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.live-card__title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-card__creator {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
}

.live-empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-2);
  border: 1px dashed var(--border);
  border-radius: 16px;
}

.live-empty-state__icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ================= SALA DE STREAM EN VIVO ================= */
.live-room-header {
  margin-bottom: 14px;
}

.live-room-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1080px) {
  .live-room-layout {
    grid-template-columns: 1fr;
  }
}

.live-player-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.live-player-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.live-player-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.reactions-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.live-player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 25%, transparent 75%, rgba(0,0,0,0.85) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 10;
}

.live-player-container:hover .live-player-overlay {
  opacity: 1;
}

.live-player-overlay__top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-live-tag {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: #fff;
  border-radius: 50%;
  display: inline-block;
}

.badge-live-viewers {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-live-quality {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-icon-hud {
  margin-left: auto;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

/* Diagnostic Stats HUD */
.live-stats-hud {
  position: absolute;
  top: 50px;
  right: 16px;
  background: rgba(10, 5, 20, 0.88);
  border: 1px solid rgba(168, 85, 247, 0.3);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 12px;
  color: #cbd5e1;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.live-stats-hud__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.live-stats-hud__row strong {
  color: #38bdf8;
}

.live-player-overlay__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.live-controls-left, .live-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-player-ctrl {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: background 0.15s;
}

.btn-player-ctrl:hover {
  background: rgba(255, 255, 255, 0.2);
}

.volume-slider {
  width: 75px;
  height: 4px;
  accent-color: #ef4444;
  cursor: pointer;
}

.quality-select {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

/* Stream & Creator Info */
.live-stream-info {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.live-creator-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ef4444;
}

.live-stream-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 6px;
}

.live-creator-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
}

.live-creator-name {
  font-weight: 600;
  color: #fff;
}

.live-category-tag {
  background: rgba(236, 72, 153, 0.15);
  color: var(--accent-hot);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: capitalize;
}

/* ================= CHAT EN VIVO ================= */
.live-chat-column {
  height: 100%;
}

.live-chat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  height: 540px;
  overflow: hidden;
}

.live-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.live-chat-header__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
}

.badge-live-chat-mode {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-clear-chat {
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.btn-clear-chat:hover {
  opacity: 1;
}

.live-chat-messages {
  flex: 1;
  padding: 12px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  scroll-behavior: smooth;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.4;
  word-break: break-word;
  animation: fadeInMsg 0.2s ease;
}

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

.chat-msg__head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-msg__badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  text-transform: uppercase;
}

.badge-VIP { background: #f59e0b; color: #000; }
.badge-MOD { background: #3b82f6; color: #fff; }
.badge-CREATOR { background: #ef4444; color: #fff; }
.badge-USER { display: none; }

.chat-msg__user {
  font-weight: 600;
  color: #c084fc;
}

.chat-msg__time {
  font-size: 10px;
  color: var(--text-3);
  margin-left: auto;
}

.chat-msg__text {
  color: #e2e8f0;
  margin: 0;
}

.live-reactions-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.reactions-label {
  font-size: 11px;
  color: var(--text-3);
  margin-right: 4px;
}

.btn-reaction {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.btn-reaction:hover {
  transform: scale(1.25);
  background: rgba(255, 255, 255, 0.15);
}

.live-chat-form {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-1);
}

.live-chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-chat-input-wrapper input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #fff;
}

.live-chat-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-send-chat {
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-send-chat:hover {
  opacity: 0.85;
}

/* ================= ESTUDIO DE EMISIÓN ================= */
.live-studio-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 980px) {
  .live-studio-layout {
    grid-template-columns: 1fr;
  }
}

.studio-preview-card, .studio-config-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.studio-preview-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.studio-preview-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.studio-preview-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-status-badge {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #38bdf8;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
}

.studio-timer {
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.studio-device-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .studio-device-controls {
    grid-template-columns: 1fr;
  }
}

.device-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.device-group label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

.vumeter-container {
  height: 38px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  align-items: center;
}

.vumeter-bar {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #eab308 70%, #ef4444 100%);
  border-radius: 4px;
  transition: width 0.08s ease;
}

.studio-config-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.form-field input, .form-select {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #fff;
}

.form-field input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
}

.studio-actions-wrapper {
  margin-top: 20px;
}

.studio-msg {
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
  color: var(--text-2);
}

/* ================= USER AUTH & FAVORITES ================= */
.user-auth-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-auth-badge {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Menú de usuario: el badge con el nombre abre Favoritos / Listas / Historial. */
.user-menu { position: relative; min-width: 0; }
.user-menu__toggle { max-width: 100%; transition: border-color .15s ease; }
.user-menu__toggle:hover,
.user-menu__toggle[aria-expanded="true"] { border-color: var(--accent); }
.user-menu__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__caret { font-size: 10px; color: var(--text-3); flex-shrink: 0; }
.user-menu__panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-1);
}
.user-menu__panel a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.user-menu__panel a:hover,
.user-menu__panel a:focus-visible { background: var(--surface-hover); color: var(--text-1); }

.badge-fav-count {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
}

.btn-fav-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 4;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  transition: transform 0.2s, background 0.2s, color 0.2s;
}

.btn-fav-toggle:hover {
  transform: scale(1.15);
  background: rgba(0, 0, 0, 0.9);
  color: #f59e0b;
}

.btn-fav-toggle.is-active {
  color: #f59e0b;
  border-color: #f59e0b;
}

/* ================= TIPS / VIRTUAL GIFTS ================= */
.btn-open-tips {
  margin-left: auto;
  background: #ec4899;
  border: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}

.btn-open-tips:hover {
  background: #f59e0b;
}

.live-tips-drawer {
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  animation: slideUpTips 0.2s ease;
}

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

.tips-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 10px;
}

.btn-close-drawer {
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
}

.tips-gifts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.btn-gift {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.btn-gift:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  transform: translateY(-2px);
}

/* Tip Alert Banner Overlay over Player */
.live-tip-alert-overlay {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  pointer-events: none;
  animation: tipBannerFade 4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tipBannerFade {
  0%   { opacity: 0; transform: translate(-50%, -20px) scale(0.9); }
  12%  { opacity: 1; transform: translate(-50%, 0) scale(1); }
  85%  { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -20px) scale(0.95); }
}

.tip-alert-badge {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.95) 0%, rgba(236, 72, 153, 0.95) 100%);
  color: #fff;
  border-radius: 999px;
  padding: 8px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.tip-alert-icon {
  font-size: 28px;
}

.tip-alert-text {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  line-height: 1.3;
}

.tip-alert-msg {
  font-size: 12px;
  font-style: italic;
  margin: 2px 0 0;
  opacity: 0.9;
}

/* ================= ADVANCED FILTERS ================= */
.btn-filter-toggle {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-2);
  transition: color 0.15s, transform 0.15s;
}

.btn-filter-toggle:hover {
  color: #fff;
  transform: rotate(30deg);
}

.advanced-filters-drawer {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  animation: slideDownFilters 0.2s ease;
}

@keyframes slideDownFilters {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.advanced-filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}

.filter-select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
}

/* ================= VIDEO MODAL ACTIONS & COMMENTS ================= */
.video-modal__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.video-modal__comments {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.video-comments-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 14px;
  padding-right: 6px;
}

.comment-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.comment-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.comment-card__author {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.comment-card__time {
  font-size: 11px;
  color: var(--text-2);
}

.comment-card__text {
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.4;
  margin: 0;
}

.comment-form {
  display: flex;
  gap: 8px;
}

.comment-form input {
  flex: 1;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
}

.comment-form input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ================= PLAYLISTS & HISTORIAL ================= */
.playlists-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.playlist-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: transform 0.15s, border-color 0.15s;
}

.playlist-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.playlist-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
}

.playlist-card__count {
  font-size: 13px;
  color: var(--text-2);
}

.playlist-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ================= MOBILE BOTTOM NAVIGATION ================= */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: rgba(15, 8, 22, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(168, 85, 247, 0.25);
  z-index: 8000;
  padding: 0 8px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
  justify-content: space-around;
  align-items: center;
}

@media (max-width: 860px) {
  .mobile-bottom-nav {
    display: flex;
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  color: var(--text-2);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: color 0.15s ease, transform 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item:active {
  transform: scale(0.92);
}

.mobile-nav-item.active {
  color: var(--accent-hot, #ec4899);
  font-weight: 700;
}

.mobile-nav-item[hidden] { display: none; }

.mobile-nav-icon {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 2px;
}

.mobile-nav-label {
  font-size: 10px;
  letter-spacing: 0.2px;
}

/* ================= TOAST NOTIFICATIONS ================= */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 90vw;
}

.toast-message {
  background: rgba(24, 12, 38, 0.95);
  color: #fff;
  border: 1px solid var(--accent, #a855f7);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(168, 85, 247, 0.3);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  backdrop-filter: blur(8px);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.25s ease forwards 2.5s;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ================= RELATED VIDEOS IN MODAL ================= */
.video-modal__related {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.video-related-title {
  font-size: 14px;
  font-weight: 700;
  color: #f3e8ff;
  margin-bottom: 12px;
}

.video-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

@media (max-width: 600px) {
  .video-related-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

/* Mensaje de error cuando el API de catálogo no responde */
.grid-error {
  grid-column: 1 / -1;
  padding: 28px 16px;
  text-align: center;
  color: #ff8a8a;
  background: rgba(255, 90, 90, .08);
  border: 1px solid rgba(255, 90, 90, .25);
  border-radius: 12px;
  font-size: 15px;
}

/* Acciones sociales y virales (PWA, Telegram, WhatsApp) */
.header-telegram-link {
  color: #229ed9 !important;
  font-weight: 600;
}
.header-telegram-link:hover {
  background: rgba(34, 158, 217, 0.15) !important;
}
.btn-pwa-install {
  border-color: #a855f7 !important;
  color: #c084fc !important;
}
.btn-share-wa:hover {
  background: rgba(37, 211, 102, 0.15) !important;
}
.btn-share-tg:hover {
  background: rgba(34, 158, 217, 0.15) !important;
}
.btn-share-x:hover {
  background: rgba(255, 255, 255, 0.15) !important;
}


/* ================= MÓVIL: CABECERA COMPACTA ================= */
@media (max-width: 860px) {
  /* Red de seguridad: nada puede arrastrar la página en horizontal.
     `clip` y no `hidden`, que rompería los position: sticky de dentro. */
  html, body { overflow-x: clip; }

  /* En móvil la cabecera apila logo, acciones, buscador, chips y cifras
     (~250px): fija ocupaba un tercio de la pantalla. La navegación
     persistente la da .mobile-bottom-nav. */
  .site-header { position: relative; }

  .logo { font-size: 20px; }
  .logo-tag { font-size: 16px; padding: 1px 7px; }

  /* Las acciones pueden partirse en líneas en vez de desbordar el ancho. */
  .header-actions {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  #userGuestActions, .user-auth-profile { gap: 6px; }

  /* Botones secundarios (instalar, Telegram, admin): solo el icono. */
  .header-actions .btn-label { display: none; }
  .header-telegram-link, .btn-pwa-install, .header-admin-link { padding: 6px 9px; }

  .user-auth-badge { padding: 5px 10px; font-size: 12px; }
  .user-menu__name { max-width: 90px; }

  .sub-nav { padding-top: 8px; padding-bottom: 10px; }
  .header-catalog-stats { padding-bottom: 10px; }
}
