/* ═══════════════════════════════════════════════════════════════
   TR3FLEX — app.css  |  Variables sobreescritas dinámicamente por ThemeModule.php
   Los valores aquí son fallback neutros — PHP inyecta el :root real inline.
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Fallback neutros (PHP sobreescribe estos con el color de acento elegido) */
  --bg:           rgba(255,255,255,0.04);
  --surface:      rgba(255,255,255,0.04);
  --surface2:     rgba(255,255,255,0.11);
  --surface3:     rgba(255,255,255,0.16);
  --border:       rgba(255,255,255,0.20);
  --border2:      rgba(255,255,255,0.30);

  /* ── Paneles sobre imagen de fondo ─────────────────────── */
  /* surface-panel: fondo de sidebars/paneles con blur */
  --surface-panel:       rgba(0,0,0,0.25);
  --surface-panel-hover: rgba(0,0,0,0.35);
  /* surface-card: tarjetas dentro del panel */
  --surface-card:        rgba(255,255,255,0.06);
  --surface-card-hover:  rgba(255,255,255,0.12);
  /* border-panel: bordes blancos semitransparentes (siempre legibles) */
  --border-panel:        rgba(255,255,255,0.18);
  /* surface-float: fondo de dropdowns/menús flotantes con backdrop-blur (sobreescrito por ThemeModule) */
  --surface-float:       var(--surface-float);
  --surface-float-solid: var(--surface-float-solid);

  /* Texto */
  --text:         #e8e8e8;
  --text-muted:   #888;
  --text-dim:     #444;

  /* Acento principal (verde por defecto — sobreescrito inline por ThemeModule) */
  --accent:        #39e75f;
  --accent-dim:    #1a7a30;
  --accent-glow:   rgba(57, 231, 95, 0.15);
  --accent-bright: #6affaa;

  /* Alias legado */
  --green:        var(--accent);
  --green-dim:    var(--accent-dim);
  --green-glow:   var(--accent-glow);
  --green-bright: var(--accent-bright);

  /* Acento amarillo (ranking, countdown) */
  --yellow:       #ffd600;
  --yellow-dim:   rgba(255, 214, 0, 0.12);

  /* Acento rojo/peligro */
  --red:          #ff4444;

  /* Dimensiones */
  --header-h:     60px;
  --footer-h:     44px;
  --sidebar-w:    28px;
  --panel-w:      260px;
  --radius:       6px;
  --radius-lg:    12px;

  /* ── Variables EXCLUSIVAS del carrusel ranking ────────────────── */
  /* Separadas para que cambiar el panel no afecte el carrusel ni viceversa */
  --rk-item-bg:       rgba(0,0,0,0.65);   /* fondo tarjeta (antes usaba --header-bg) */
  --rk-item-bg-hover: rgba(0,0,0,0.75);   /* fondo tarjeta hover */
  --rk-border:        rgba(255,255,255,0.18); /* borde tarjeta (antes usaba --border-panel) */

  /* Tipografía */
  --font-ui:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Barlow Condensed', 'Impact', sans-serif;
  --font-reading: 'Inter', -apple-system, sans-serif;
  --font-size-ui:      14px;
  --font-size-reading: 14px;
}

html, body { height: 100%; font-size: var(--font-size-ui, 14px); overflow: hidden; }
html { overflow-x: hidden; max-width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--font-size-ui, 14px);
  line-height: 1.6;
  overflow-x: hidden;
  overflow-y: hidden;
  padding-top: var(--header-h);
  padding-bottom: var(--footer-h);
  box-sizing: border-box;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── APP SHELL ─────────────────────────────────────────────── */
#tr3-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;       /* altura fija para que #tr3-layout pueda activar overflow-y:auto */
  max-height: 100vh;
}

/* ══════════════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════════════ */
#tr3-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* padding simétrico: ambos lados alineados con sus strips laterales */
  padding: 0 var(--sidebar-w, 28px);
  gap: 12px;
  max-width: 100vw;
  /* overflow: hidden  ← ELIMINADO: cortaba el avatar-dropdown al salir del header */
  overflow: visible;
}

/* Logo */
.header-logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1;
  text-decoration: none;
}
.logo-tr3  { color: var(--accent); }
.logo-flex { color: var(--text); }

/* Header right */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Avatar */
.header-avatar-wrap { position: relative; overflow: visible; }
.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border2);
  cursor: pointer;
  transition: border-color 0.2s;
  background: var(--surface2);
}
.header-avatar:hover { border-color: var(--accent); }
.header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.avatar-placeholder svg { width: 22px; height: 22px; }

/* Avatar dropdown */
.avatar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface-float);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  min-width: 180px;
  padding: 8px 0;
  display: none;
  z-index: 9999;
  box-shadow: 0 16px 48px rgba(0,0,0,0.65), 0 2px 12px rgba(0,0,0,0.4);
}
.avatar-dropdown.open { display: block; }
.avatar-dropdown-name {
  padding: 8px 16px 12px;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.avatar-dropdown a,
.avatar-dropdown button {
  display: block;
  width: 100%;
  padding: 8px 16px;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 0.15s;
}
.avatar-dropdown a:hover,
.avatar-dropdown button:hover { background: var(--surface3); color: var(--accent); }

/* Campana */
.header-bell {
  position: relative;
  background: none;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}
.header-bell:hover { color: var(--accent); background: var(--accent-glow); }
.header-bell svg { width: 20px; height: 20px; }
.bell-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* Botones header */
.btn-header-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0 16px;
  height: 34px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-header-accent:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-header-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 0 16px;
  height: 34px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  transition: background 0.15s, color 0.15s;
}
.btn-header-outline:hover { background: var(--accent-glow); }

.btn-header-ghost {
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0 14px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn-header-ghost:hover { color: var(--accent); border-color: var(--accent); }

/* ══════════════════════════════════════════════════════════════
   LAYOUT: SIDEBARS + MAIN
   ══════════════════════════════════════════════════════════════ */
#tr3-layout {
  flex: 1;
  display: flex;
  position: relative;
  height: calc(100vh - var(--header-h) - var(--footer-h));
  min-height: 0;
  overflow: hidden; /* el scroll lo maneja #tr3-main, no el layout */
}

/* MAIN */
#tr3-main {
  flex: 1;
  padding: 28px 20px 100px; /* 100px = footer fijo (44px) + margen cómodo */
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;  /* scroll aquí: la scrollbar queda dentro del main, lejos del footer */
  overflow-x: hidden;
  min-height: 0;
}
#tr3-layout.has-sidebars #tr3-main {
  /* cuando hay sidebars, el max-width se ajusta */
  max-width: 100%;
  padding-top: 0;
}

/* ══════════════════════════════════════════════════════════════
   SIDEBARS
   ══════════════════════════════════════════════════════════════ */

/* Strip lateral (siempre visible) */
#sidebar-left {
  position: relative;
  flex-shrink: 0;
  width: var(--sidebar-w);
  display: flex;
}
#sidebar-right {
  position: relative;
  flex-shrink: 0;
  width: var(--sidebar-w);
  display: flex;
}

.sidebar-strip {
  width: var(--sidebar-w);
  background: var(--surface-panel);
  backdrop-filter: blur(10px) brightness(0.68);
  -webkit-backdrop-filter: blur(10px) brightness(0.68);
  border-color: var(--border-panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  gap: 10px;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
  flex-shrink: 0;
  position: relative; /* necesario para que z-index tenga efecto sobre el panel */
  z-index: 200 !important; /* mayor que el panel (150) — strip siempre visible */
}
#sidebar-left .sidebar-strip { border-right: 1px solid var(--border); }
#sidebar-right .sidebar-strip { border-left: 1px solid var(--border); }
.sidebar-strip:hover { background: var(--surface-panel-hover); }

.strip-icon {
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 700;
  line-height: 1;
}
.strip-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 6px;
}
.sidebar-strip:hover .strip-label { color: var(--accent); }

/* Panel deslizable */
.sidebar-panel {
  position: fixed !important;
  top: var(--header-h, 60px) !important;
  /* Usar height explícito: más robusto que bottom cuando --footer-h puede variar */
  height: calc(100vh - var(--header-h, 60px) - var(--footer-h, 44px)) !important;
  bottom: unset !important;
  width: var(--panel-w, 260px);
  background: var(--surface-panel);
  border-color: var(--border-panel);
  backdrop-filter: blur(14px) brightness(0.72) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) brightness(0.72) saturate(1.4);
  z-index: 150 !important;
  display: flex;
  flex-direction: column;
  min-height: 0; /* FIX BUG2: necesario para que flex:1 en hijos funcione en WebKit/Blink */
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.sidebar-panel-left  { left: var(--sidebar-w); border-right: 1px solid var(--border-panel); transform: translateX(calc(-100% - var(--sidebar-w))); }
.sidebar-panel-right { right: var(--sidebar-w, 28px) !important; border-left: 1px solid var(--border-panel); transform: translateX(calc(100% + var(--sidebar-w, 28px))); }

.sidebar-panel.open { transform: translateX(0); }

/* Panel header */
.sidebar-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-close-btn {
  background: var(--red);
  border: none;
  color: #fff;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.sidebar-close-btn:hover { color: #fff; background: #ff1a1a; }

/* NAV items (sidebar izquierdo) */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0; /* permite que flex-item respete overflow-y:auto */
}
.snav-item {
  background: none;
  border: none;
  text-align: left;
  padding: 11px 18px;
  color: var(--text);
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
  display: block;
}
.snav-item:hover { background: var(--surface2); color: #fff; border-left-color: var(--accent-dim); }
.snav-item.active { background: var(--accent-glow); color: #fff; border-left-color: var(--accent); }
.snav-item.highlight {
  color: #fff;
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-glow);
}
.snav-item.highlight:hover { background: var(--accent-glow); }

/* ── Botones de acción (Publicar / Regalar) ── */
.snav-item--action {
  font-weight: 700;
  letter-spacing: 0.07em;
  font-size: 0.82rem;
  margin: 4px 12px;
  padding: 10px 14px;
  border-radius: 4px;
  border-left: none !important;
  width: calc(100% - 24px);
  text-align: center;
}
.snav-item--publish {
  background: var(--accent-glow);
  border: 1px solid var(--accent) !important;
  color: #fff;
}
.snav-item--publish:hover {
  background: var(--accent) !important;
  color: #000 !important;
  border-left: none !important;
}
.snav-item--gift {
  background: rgba(255, 190, 50, 0.1);
  border: 1px solid rgba(255, 190, 50, 0.5) !important;
  color: #ffbe32;
}
.snav-item--gift:hover {
  background: rgba(255, 190, 50, 0.22) !important;
  color: #ffd166 !important;
  border-left: none !important;
}
.snav-item--integration {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.5) !important;
  color: #a5b4fc;
}
.snav-item--integration:hover {
  background: rgba(99, 102, 241, 0.25) !important;
  color: #c7d2fe !important;
  border-left: none !important;
}

/* ── Botones de navegación (Ver Posts / Ver Regalos) ── */
.snav-item--nav {
  font-weight: 600;
  letter-spacing: 0.05em;
  font-size: 0.82rem;
  color: var(--text);
  border-left-color: transparent;
}
.snav-item--nav:hover {
  background: var(--surface2);
  color: #fff;
  border-left-color: var(--accent-dim);
}
.snav-item--nav.active {
  background: var(--accent-glow);
  color: #fff;
  border-left-color: var(--accent);
}
.snav-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

/* ── POSTS SIDEBAR (derecho) ──────────────────────────────── */
.posts-search {
  display: block;
  width: calc(100% - 24px);
  margin: 12px 12px 8px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}
.posts-search:focus { border-color: var(--accent); }

.posts-filter-tabs {
  display: flex;
  padding: 0 8px 8px;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pf-tab {
  flex: 1;
  padding: 5px 4px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.15s;
}
.pf-tab:hover { border-color: var(--accent); color: var(--accent); }
.pf-tab.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

.posts-list-panel {
  flex: 1 !important;
  overflow-y: auto;
  min-height: 0; /* evita que flex-item ignore el overflow */
  padding: 4px 0 6px;
}
.posts-list-panel::-webkit-scrollbar { width: 4px; }
.posts-list-panel::-webkit-scrollbar-track { background: transparent; }
.posts-list-panel::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── fc-lateral — tarjeta de post en lista lateral ───────── */
.fc-lateral {
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-panel);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.fc-lateral:hover { background: var(--surface-card-hover); }
.fc-lateral--featured {
  border-left: 2px solid var(--yellow);
  background: var(--surface-card-hover);
}

/* Banner destacado */
.fc-lat__featured-banner {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(255,214,0,0.1);
  border-bottom: 1px solid rgba(255,214,0,0.2);
}
.fc-lat__featured-icon { font-size: 0.65rem; }
.fc-lat__featured-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--yellow);
}

/* Header autor */
.fc-lat__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px 4px;
}
.fc-lat__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border2);
  flex-shrink: 0;
}
.fc-lat__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
}
.fc-lat__meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.fc-lat__author {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fc-lat__date {
  font-size: 0.62rem;
  color: var(--text-dim);
}

/* Imagen */
.fc-lat__img-wrap {
  position: relative;
  width: 100%;
  /* Marco universal: siempre 16:9, sin importar la imagen */
  aspect-ratio: 16 / 9;
  background: var(--surface3);
  overflow: hidden;
}
.fc-lat__img-wrap--featured::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(255,214,0,0.8);
}
.fc-lat__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* contain: muestra imagen completa con barras; cover: recorta pero llena */
  object-fit: contain;
  object-position: center;
  background: #000;
  display: block;
}
.fc-lat__img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fc-lat__initials {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-dim);
}
.fc-lat__cat {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  text-transform: uppercase;
  z-index: 2;
}

/* Body — título */
.fc-lat__body {
  padding: 5px 10px 3px;
}
.fc-lat__title-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-size: 0.78rem;
  line-height: 1.4;
}
.fc-lat__book-icon {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
}
.fc-lat__title {
  color: var(--text);
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer — score + enlace */
.fc-lat__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 7px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
.fc-lat__score {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
}
.fc-lat__view-link {
  font-size: 0.62rem;
  color: var(--text-dim);
  transition: color 0.15s;
}
.fc-lateral:hover .fc-lat__view-link { color: var(--accent); }

.sidebar-spinner {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ══════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════ */
#tr3-footer {
  height: var(--footer-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* padding simétrico: ambos lados alineados con sus strips laterales (28px c/u) */
  padding: 0 var(--sidebar-w, 28px);
  flex-shrink: 0;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 250;
}

.footer-link {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: none;
  transition: color 0.15s;
  padding: 0;
}
.footer-link:hover { color: var(--accent); }


/* Botón CHAT footer — Cyberpunk Gold (independiente del --accent) */
.footer-chat-wrap {
  position: relative;
  display: inline-flex;
}
.footer-chat-wrap .cpk-corner {
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: #ffd700;
  border-style: solid;
  pointer-events: none;
  animation: cpkCornerPulse 1.6s ease-in-out infinite;
  z-index: 1;
}
.footer-chat-wrap .cpk-corner.tl { top: -4px; left: -4px; border-width: 2px 0 0 2px; }
.footer-chat-wrap .cpk-corner.tr { top: -4px; right: -4px; border-width: 2px 2px 0 0; }
.footer-chat-wrap .cpk-corner.bl { bottom: -4px; left: -4px; border-width: 0 0 2px 2px; }
.footer-chat-wrap .cpk-corner.br { bottom: -4px; right: -4px; border-width: 0 2px 2px 0; }
@keyframes cpkCornerPulse {
  0%, 100% { opacity: 0.65; }
  50%       { opacity: 1; filter: drop-shadow(0 0 3px #ffd700); }
}
.footer-btn-chat {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 3px;
  color: #0a0a0a;
  border: none;
  border-radius: 3px;
  padding: 7px 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(90deg,
    #b8860b 0%, #ffd700 20%, #ffec72 38%,
    #ffd700 50%, #b8860b 65%, #ffd700 80%, #ffec72 100%
  );
  background-size: 300% 100%;
  box-shadow:
    0 0 6px #ffd700,
    0 0 18px rgba(212,160,23,.6),
    0 0 32px rgba(184,134,11,.4),
    inset 0 1px 0 rgba(255,255,200,.5),
    inset 0 -1px 0 rgba(100,60,0,.4);
  animation: cpkGoldSlide 2.2s linear infinite,
             cpkGlowPulse 1.6s ease-in-out infinite,
             cpkGlitch 5s ease-in-out infinite;
}
.footer-btn-chat::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 2px,
    rgba(0,0,0,.09) 2px, rgba(0,0,0,.09) 3px
  );
  animation: cpkScanMove 1.8s linear infinite;
  pointer-events: none;
  z-index: 1;
}
.footer-btn-chat::after {
  content: '';
  position: absolute;
  top: 0; left: -80%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,200,.55) 50%, transparent 100%);
  transform: skewX(-15deg);
  animation: cpkFlashSweep 2.8s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}
.footer-btn-chat .cpk-label {
  position: relative;
  z-index: 3;
  pointer-events: none;
}
.footer-btn-chat .cpk-label::before {
  content: '▶ ';
  opacity: .7;
  font-size: .6em;
  vertical-align: middle;
  animation: cpkBlink 1.1s step-end infinite;
}
@keyframes cpkGoldSlide {
  0%   { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}
@keyframes cpkGlowPulse {
  0%, 100% {
    box-shadow: 0 0 6px #ffd700, 0 0 16px rgba(212,160,23,.6),
                0 0 28px rgba(184,134,11,.4),
                inset 0 1px 0 rgba(255,255,200,.5), inset 0 -1px 0 rgba(100,60,0,.4);
  }
  50% {
    box-shadow: 0 0 10px #ffd700, 0 0 28px rgba(255,215,0,.8),
                0 0 50px rgba(212,160,23,.6), 0 0 70px rgba(184,134,11,.35),
                inset 0 1px 0 rgba(255,255,200,.7), inset 0 -1px 0 rgba(100,60,0,.4);
  }
}
@keyframes cpkGlitch {
  0%,94%,100% { transform: none; filter: none; }
  95% { transform: translateX(-2px) skewX(3deg); filter: hue-rotate(20deg) brightness(1.3); }
  97% { transform: translateX(2px) skewX(-2deg); filter: hue-rotate(-10deg) brightness(.9); }
  99% { transform: translateX(-1px); filter: brightness(1.4); }
}
@keyframes cpkScanMove {
  0%   { background-position: 0 0; }
  100% { background-position: 0 20px; }
}
@keyframes cpkFlashSweep {
  0%   { left: -80%; opacity: 0; }
  10%  { opacity: 1; }
  50%  { left: 140%; opacity: 1; }
  51%  { opacity: 0; left: 140%; }
  100% { left: -80%; opacity: 0; }
}
@keyframes cpkBlink {
  0%,100% { opacity: .7; }
  50%     { opacity: .15; }
}
.footer-btn-chat:hover {
  animation: cpkGoldSlide .8s linear infinite,
             cpkGlowPulse .5s ease-in-out infinite,
             cpkGlitch 5s ease-in-out infinite;
  transform: scale(1.07);
  letter-spacing: 4px;
  transition: transform .1s, letter-spacing .1s;
  filter: brightness(1.15);
}
.footer-btn-chat:active { transform: scale(0.96); animation: none; }
/* Dropdown de redes */
.footer-net-wrap { position: relative; }
.footer-net-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 5px 14px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, color 0.15s;
}
.footer-net-btn:hover { border-color: var(--accent); color: var(--accent); }
.footer-net-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  min-width: 220px;
  list-style: none;
  padding: 6px 0;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.5);
  z-index: 300;
}
.footer-net-menu li {
  padding: 10px 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-net-menu li:hover { background: var(--surface3); color: var(--text); }
.footer-net-menu li.net-active { color: var(--accent); font-weight: 600; }
.footer-net-menu li em {
  font-size: 0.72rem;
  font-style: normal;
  color: var(--text-dim);
  background: var(--surface3);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ══════════════════════════════════════════════════════════════
   FEED — CARDS
   ══════════════════════════════════════════════════════════════ */
.tr3-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
  transition: border-color 0.2s, transform 0.15s;
}
.tr3-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.tr3-card.featured { border-color: var(--yellow); box-shadow: 0 0 20px var(--yellow-dim); }

.post-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}
.post-body {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.post-type-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--surface2);
  color: var(--accent);
  border: 1px solid var(--border2);
}
.post-type-badge.gift { color: var(--yellow); border-color: rgba(255,214,0,0.3); }

/* Votos */
.vote-buttons { display: flex; gap: 8px; margin-top: 14px; }

/* ─── VOTE BUTTONS reutilizables ─────────────────────────────────────────── */
.tr3-vote-wrap {
  display: flex; align-items: center; gap: 4px; flex-wrap: nowrap;
}
.tr3-vote-btn {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); padding: 3px 7px; font-size: 0.72rem;
  cursor: pointer; transition: all 0.15s;
  font-family: var(--font-display); letter-spacing: 0.05em; white-space: nowrap;
}
.tr3-vote-btn:hover:not(:disabled) { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }
.tr3-vote-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.tr3-vote-btn.tr3-voted { border-color: var(--accent-dim); color: var(--text-muted); background: var(--surface); }
.tr3-vote-btn.tr3-voted-active { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.tr3-vote-num { font-weight: 700; }
.tr3-vote-score { font-size: 0.68rem; color: var(--accent); font-family: var(--font-display); margin-left: 2px; white-space: nowrap; }
.tr3-vote-wrap--sm .tr3-vote-btn { padding: 4px 8px; font-size: 0.72rem; border-radius: 6px; }
.tr3-vote-wrap--sm .tr3-vote-score { font-size: 0.75rem; color: #fff; font-weight: 700; margin-left: 4px; }

/* Carrusel vote row */
/* .tr3-rk-vote-row removed - score now inside author row */
/* Score display: icono + número grande + etiqueta */
.tr3-rk-score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
  padding: 0 4px;
}
.tr3-rk-score-icon {
  font-size: 1rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
.tr3-rk-score-num {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  letter-spacing: -0.02em;
}
/* Si el usuario ya votó, highlight */
.tr3-rk-score-display--voted .tr3-rk-score-num {
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow);
}
.tr3-rk-pos-badge {
  font-size: 0.68rem; font-weight: 700; color: #fff;
  font-family: var(--font-display); letter-spacing: 0.08em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  background: rgba(255,255,255,0.1);
  padding: 1px 8px;
  border-radius: 10px;
}
.btn-vote {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: all 0.15s;
}
.btn-vote:hover:not(:disabled) {
  background: var(--surface3);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-vote:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-vote.voted { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

/* Feed tabs */
.tr3-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tr3-tab {
  padding: 10px 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
  font-weight: 500;
}
.tr3-tab:hover { color: var(--text); }
.tr3-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Load more */
#btn-load-more {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: all 0.15s;
}
#btn-load-more:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

/* ══════════════════════════════════════════════════════════════
   RANKING
   ══════════════════════════════════════════════════════════════ */
.ranking-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.ranking-pos {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-muted);
  min-width: 38px;
  line-height: 1;
}
.ranking-pos.top1 { color: var(--yellow); }
.ranking-pos.top2 { color: #c0c0c0; }
.ranking-pos.top3 { color: #cd7f32; }
.ranking-score { margin-left: auto; font-size: 0.9rem; color: var(--accent); font-weight: 600; }

/* ══════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════ */
.tr3-form { max-width: 440px; margin: 40px auto; }
.tr3-form h2 { margin-bottom: 24px; font-size: 1.4rem; font-family: var(--font-display); letter-spacing: 1px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.88rem; color: var(--text-muted); font-weight: 500; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { min-height: 120px; resize: vertical; }

/* ── Password toggle (ojo) ─────────────────────────────────── */
.pass-wrap {
  position: relative;
}
.pass-wrap input {
  padding-right: 44px !important;
}
.pass-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  line-height: 0;
}
.pass-toggle:hover { color: var(--accent); }
.pass-toggle svg { width: 18px; height: 18px; pointer-events: none; }

.btn-primary {
  width: 100%;
  padding: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--font-display);
  letter-spacing: 1px;
  border-radius: var(--radius);
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════════
   ADMIN
   ══════════════════════════════════════════════════════════════ */
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn-admin {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  transition: all 0.15s;
}
.btn-admin:hover { background: var(--surface3); }
.btn-admin.danger  { border-color: var(--red); color: var(--red); }
.btn-admin.success { border-color: var(--accent); color: var(--accent); }
.btn-admin--integration {
  border-color: rgba(99,102,241,0.6) !important;
  color: #a5b4fc !important;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.btn-admin--integration:hover {
  background: rgba(99,102,241,0.15) !important;
  color: #c7d2fe !important;
}

.status-badge { font-size: 0.7rem; padding: 2px 8px; border-radius: 20px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.status-active   { background: #0a2a12; color: var(--accent); }
.status-review   { background: #2a1a00; color: var(--yellow); }
.status-paused   { background: #1a1a2a; color: #7b8acd; }
.status-featured { background: #1a2a00; color: var(--accent-bright); }
.status-trash    { background: #2a0a0a; color: var(--red); }

/* ══════════════════════════════════════════════════════════════
   MODALES (publicar / regalar)
   ══════════════════════════════════════════════════════════════ */
.tr3-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.tr3-modal-overlay.open { opacity: 1; pointer-events: all; }
.tr3-modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  margin: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  transform: translateY(20px);
  transition: transform 0.25s;
  flex-shrink: 0;
}
.tr3-modal-overlay.open .tr3-modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
}
.modal-close {
  background: var(--red);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.modal-close:hover { color: #fff; background: #ff1a1a; }

/* ── Upload de imagen en modal ─────────────────────────────── */
.tr3-img-upload {
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
  position: relative;
}
.tr3-img-upload:hover,
.tr3-img-upload.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.tr3-img-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.tr3-img-placeholder span:first-child { font-size: 1.8rem; }
.tr3-img-preview {
  position: relative;
  width: 100%;
  height: 150px;
  max-height: 150px;
  overflow: hidden;
  background: var(--surface2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tr3-img-preview img {
  width: 100%;
  height: 150px;
  max-height: 150px;
  object-fit: cover;
  object-position: center;
  display: block;
  flex-shrink: 0;
}
.tr3-img-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  z-index: 2;
}
.tr3-img-remove:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ══════════════════════════════════════════════════════════════
   MENSAJES Y ESTADOS
   ══════════════════════════════════════════════════════════════ */
.tr3-error   { color: var(--red); font-size: 0.88rem; margin-top: 8px; }
.tr3-success { color: var(--accent); font-size: 0.88rem; margin-top: 8px; }
.tr3-spinner {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.tr3-spinner::after {
  content: '';
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 12px auto 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   COUNTDOWN MINI (home)
   ══════════════════════════════════════════════════════════════ */
.countdown-mini {
  font-family: var(--font-display);
  text-align: center;
  background: transparent;
  border: none;
  padding: 0 0 6px;
  margin: 0 auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 860px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
}
.cd-block {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 1;
}
.cd-num {
  font-size: clamp(1rem, 3.5vw, 1.9rem);
  font-weight: 900;
  color: #ffffff;
  background: transparent;
  border: none;
  padding: 0;
  letter-spacing: 1px;
  line-height: 1;
  -webkit-text-stroke: 1.5px var(--accent);
  text-stroke: 1.5px var(--accent);
  paint-order: stroke fill;
}
.cd-lbl {
  font-size: clamp(0.38rem, 1vw, 0.55rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  -webkit-text-stroke: 0;
  text-stroke: 0;
  align-self: flex-end;
  margin-bottom: 3px;
}
.cd-sep {
  font-size: clamp(0.9rem, 2.5vw, 1.6rem);
  font-weight: 900;
  color: var(--accent);
  align-self: center;
  line-height: 1;
  margin-bottom: 0;
  -webkit-text-stroke: 0;
  flex-shrink: 0;
}


/* ══════════════════════════════════════════════════════════════
   RANKING CAROUSEL
   ══════════════════════════════════════════════════════════════ */
.tr3-rk-wrap {
  margin: 0 auto 16px;
  max-width: 860px;
  width: 100%;
}
.tr3-rk-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 3px;
  color: #fff;
  font-weight: 700;
  text-align: center;
  margin: 2px 0 0;
  opacity: 0.9;
}
.tr3-rk-inner {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.tr3-rk-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 24px;
  height: 44px;
  background: var(--rk-item-bg, rgba(0,0,0,0.65));
  backdrop-filter: blur(12px) saturate(1.5);
  -webkit-backdrop-filter: blur(12px) saturate(1.5);
  border: 1px solid var(--rk-border, rgba(255,255,255,0.18));
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.2s;
}
.tr3-rk-arrow:hover { background: var(--accent); color: #fff; }
.tr3-rk-arrow-l { left: 0; }
.tr3-rk-arrow-r { right: 0; }

.tr3-rk-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  padding: 12px 28px;
  cursor: grab;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
  min-height: 300px;
}
.tr3-rk-viewport:active { cursor: grabbing; }

.tr3-rk-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 150px;
  align-items: flex-start;
  will-change: transform;
  user-select: none;
}

/* ─── Ítem ─────────────────────────────────────────────────── */
.tr3-rk-item {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  flex-shrink: 0;
  background: var(--rk-item-bg, rgba(0,0,0,0.65));
  backdrop-filter: blur(12px) saturate(1.5);
  -webkit-backdrop-filter: blur(12px) saturate(1.5);
  border: 1px solid var(--rk-border, rgba(255,255,255,0.18));
  padding: 0;
  text-align: left;
  position: relative;
  opacity: 0.88;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s, transform 0.2s, border-color 0.2s;
}
/* Esquinas decorativas */
.tr3-rk-item::before,
.tr3-rk-item::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-color: var(--accent);
  border-style: solid;
  opacity: 0.5;
  pointer-events: none;
}
.tr3-rk-item::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.tr3-rk-item::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.tr3-rk-item:hover { border-color: var(--accent); background: var(--rk-item-bg-hover, rgba(0,0,0,0.75)); transform: scale(1.05); opacity: 1; }

/* Imagen arriba, ancho completo — cuadrada */
.tr3-rk-img-wrap {
  position: relative;
  width: 100%;
  height: 175px;
  overflow: hidden;
  background: rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.tr3-rk-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
}
/* Placeholder sin imagen */
.tr3-rk-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
}
/* ── Info band debajo de la imagen (autor + título + score) ── */
.tr3-rk-info {
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.52);
  backdrop-filter: blur(14px) brightness(0.72) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) brightness(0.72) saturate(1.4);
  border-top: 1px solid rgba(255,255,255,0.12);
  width: 100%;
}

/* Autor row */
.tr3-rk-author {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  width: 100%;
}
.tr3-rk-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.5);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.tr3-rk-avatar:hover {
  border-color: #fff;
  transform: scale(1.1);
}
.tr3-rk-avatar-ph {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-display);
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.5);
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.tr3-rk-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  flex: 1;
  min-width: 0;
  gap: 1px;
}
.tr3-rk-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  width: 100%;
}
.tr3-rk-date {
  font-size: 0.52rem;
  color: var(--text-muted);
  text-align: left;
}
/* Título */
.tr3-rk-title {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  font-weight: 500;
  width: 100%;
}
/* Score row */
.tr3-rk-score-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 5px;
  border-top: 1px solid var(--rk-border, rgba(255,255,255,0.18));
}
.tr3-rk-trophy  { font-size: 0.65rem; }
.tr3-rk-pos     { font-size: 0.58rem; color: var(--accent); font-weight: 700; font-family: var(--font-display); }
.tr3-rk-score-val { font-size: 0.58rem; color: var(--text-muted); margin-left: auto; }

/* Medalla */
.tr3-rk-medal {
  position: absolute;
  top: 4px;
  left: 5px;
  font-size: 11px;
  line-height: 1;
  z-index: 2;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
/* Medalla grande para top 3 */
.tr3-rk-medal--big {
  font-size: 2rem;
  top: 6px;
  left: 7px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.7));
}
/* Badge de posición sobre la imagen */
.tr3-rk-pos-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 20px;
  z-index: 3;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
/* Badge posición top 3 — grande y con color de medalla */
.tr3-rk-pos-overlay--top {
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.75);
  border-radius: 6px;
  padding: 2px 7px;
  display: flex;
  align-items: baseline;
  gap: 1px;
  border: 1.5px solid rgba(255,255,255,0.2);
}
.tr3-rk-pos-overlay--top .pos-hash {
  font-size: 0.6rem;
  font-weight: 700;
  opacity: 0.85;
}
.tr3-rk-pos-overlay--top .pos-num {
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
}
/* Color del número según medalla */
.tr3-rk-pos-overlay--top[data-medal="rank-gold"]   .pos-num,
.tr3-rk-pos-overlay--top[data-medal="rank-gold"]   .pos-hash { color: #ffd700; text-shadow: 0 0 10px rgba(255,215,0,0.8); }
.tr3-rk-pos-overlay--top[data-medal="rank-silver"] .pos-num,
.tr3-rk-pos-overlay--top[data-medal="rank-silver"] .pos-hash { color: #e0e0e0; text-shadow: 0 0 10px rgba(192,192,192,0.8); }
.tr3-rk-pos-overlay--top[data-medal="rank-bronze"] .pos-num,
.tr3-rk-pos-overlay--top[data-medal="rank-bronze"] .pos-hash { color: #cd7f32; text-shadow: 0 0 10px rgba(205,127,50,0.8); }
/* Badge DESTACADO */
.tr3-rk-feat-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 3px 0;
  z-index: 3;
}
.tr3-rk-star {
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 14px;
  z-index: 3;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8));
}

/* ─── Top 3 medallas ────────────────────────────────────────── */
@keyframes blink-gold   { 0%,100%{box-shadow:0 0 8px 2px rgba(255,215,0,0.5)} 50%{box-shadow:0 0 22px 6px rgba(255,215,0,1)} }
@keyframes blink-silver { 0%,100%{box-shadow:0 0 8px 2px rgba(192,192,192,0.5)} 50%{box-shadow:0 0 22px 6px rgba(192,192,192,1)} }
@keyframes blink-bronze { 0%,100%{box-shadow:0 0 8px 2px rgba(205,127,50,0.5)} 50%{box-shadow:0 0 22px 6px rgba(205,127,50,1)} }

.rank-gold   { border: 4px solid #ffd700 !important; outline: 3px solid rgba(255,215,0,0.5); outline-offset: 2px; animation: blink-gold 2s ease-in-out infinite; opacity: 1 !important; box-shadow: inset 0 0 20px rgba(255,215,0,0.15); }
.rank-silver { border: 4px solid #d0d0d0 !important; outline: 3px solid rgba(192,192,192,0.5); outline-offset: 2px; animation: blink-silver 2s ease-in-out infinite; opacity: 1 !important; box-shadow: inset 0 0 20px rgba(192,192,192,0.15); }
.rank-bronze { border: 4px solid #cd7f32 !important; outline: 3px solid rgba(205,127,50,0.5); outline-offset: 2px; animation: blink-bronze 2s ease-in-out infinite; opacity: 1 !important; box-shadow: inset 0 0 20px rgba(205,127,50,0.15); }

.rank-gold   .tr3-rk-pos { color: #ffd700; font-weight: 700; }
.rank-silver .tr3-rk-pos { color: #c0c0c0; font-weight: 700; }
.rank-bronze .tr3-rk-pos { color: #cd7f32; font-weight: 700; }

/* Featured */
.rk-featured { border-color: var(--accent) !important; }
.rk-featured::before,
.rk-featured::after { opacity: 0.9 !important; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #tr3-header { padding: 0 12px; gap: 8px; }
  .header-right { gap: 6px; min-width: 0; flex-shrink: 0; }
  .btn-header-accent { padding: 0 10px; font-size: 0.85rem; }

  /* ── Layout: sacar sidebars del flujo para que el main ocupe 100% ── */
  #sidebar-left,
  #sidebar-right {
    position: fixed !important;
    top: var(--header-h, 60px) !important;
    height: calc(100vh - var(--header-h, 60px) - var(--footer-h, 44px)) !important;
    bottom: unset !important;
    width: var(--sidebar-w, 28px);
    z-index: 20;
  }
  #sidebar-left  { left: 0; }
  #sidebar-right { right: 0; }

  /* Main ocupa todo el ancho sin margen automático */
  #tr3-main {
    padding: 16px 12px;
    margin: 0;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  /* En móvil el panel derecho ocupa toda la pantalla (sobre el feed) */
  /* FIX BUG2: overflow:hidden → overflow:clip para no crear stacking context extra
     que impide que flex:1 propague altura en WebKit/Blink mobile */
  .sidebar-panel-right {
    width: calc(100vw - var(--sidebar-w, 28px)) !important;
    right: var(--sidebar-w, 28px) !important;
    z-index: 200 !important;
    overflow: hidden !important;
    /* FIX BUG2: asegurar que la cadena flex tenga min-height:0 */
    min-height: 0 !important;
  }

  /* MÓVIL: el strip se mueve dentro del panel via JS (ver initAvatarStrip en app.js).
     Cuando está dentro del panel, se muestra como banda horizontal superior.
     FIX: Usar #sidebar-right-panel #users-avatar-strip (especificidad 1,1,0)
     para superar a #users-avatar-strip { display:none } (especificidad 1,0,0) */
  .sidebar-panel-right #users-avatar-strip {
    position: static !important;
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    height: 64px !important;
    min-height: 64px !important;
    max-height: 64px !important;
    flex-shrink: 0 !important;
    order: -1 !important;
    right: unset !important;
    top: unset !important;
    bottom: unset !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.18) !important;
    box-shadow: none !important;
    z-index: auto !important;
    overflow: hidden !important;
    background: var(--accent) !important;
    align-items: center !important;
  }
  .sidebar-panel-right #users-avatar-strip .users-avatar-strip__list {
    flex-direction: row !important;
    flex: 1 1 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    width: auto !important;
    padding: 0 10px !important;
    gap: 8px !important;
    align-items: center !important;
    scrollbar-width: none !important;
  }
  /* Strip fuera del panel en móvil: oculto */
  #users-avatar-strip {
    display: none !important;
  }

  /* FIX SCROLL TÁCTIL BUG2: la cadena flex completa necesita min-height:0 */
  .sidebar-panel-right #posts-list-panel {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    min-height: 0 !important;
    height: 0 !important;
    flex: 1 1 0 !important;
  }

  /* Panel lateral izquierdo: casi pantalla completa */
  .sidebar-panel-left { width: calc(100vw - var(--sidebar-w)); }

  /* Carousel: tarjetas más estrechas + contenido sin desborde */
  .tr3-rk-wrap { max-width: 100%; overflow: hidden; }
  .tr3-rk-viewport { padding: 4px 20px; min-height: 220px; }
  body[data-view="feed"] .tr3-rk-viewport { min-height: 0 !important; }
  .tr3-rk-item { width: 220px; min-width: 220px; max-width: 220px; }
  .tr3-rk-img-wrap { width: 100%; height: 175px; }
}

@media (max-width: 480px) {
  .logo-flex { display: none; }
  .hdr-sw-opt { padding: 0 10px; font-size: 0.8rem; }
  .btn-header-switch { height: 30px; }

  /* En móvil pequeño: ambos botones solo icono, sin texto */
  #btn-publicar .hdr-sw-label { display: none; }
  #btn-regalar .hdr-sw-label { display: none; }
  #btn-publicar { padding: 0 10px; font-size: 1.1rem; letter-spacing: 0; }
  #btn-regalar  { padding: 0 10px; font-size: 1.1rem; letter-spacing: 0; }

  /* Panel izquierdo: 100% pantalla en móvil pequeño. Panel derecho mantiene ancho fijo */
  .sidebar-panel-left { width: 100vw; left: 0; }

  /* Imagen de tarjeta del feed: aspecto 4:3 en móvil para que se vea más grande */
  .fc-lat__img-wrap { aspect-ratio: 4 / 3; }

  /* Título de tarjeta: más visible */
  .fc-lat__title { font-size: 0.82rem; }

  /* En vista grid, columna única en móvil muy pequeño */
  .posts-list-panel.spanel-grid-view {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════════════
   FEED MÓVIL PORTRAIT — Layout vertical distribuido
   body[data-view="feed"] nos permite apuntar exclusivamente
   a la vista principal sin afectar otras vistas.

   LAYOUT OBJETIVO:
     ┌─────────────────┐  ← header fijo
     │   countdown     │  ← arriba, compacto
     │                 │
     │  [  ranking  ]  │  ← centrado vertical (flex:1 + align-items:center)
     │                 │
     │ ▓▓▓ REGALOS ▓▓▓ │  ← pegado al footer (margin-top:auto)
     └─────────────────┘  ← footer fijo
   ══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════
   FEED — LAYOUT VERTICAL GARANTIZADO
   Usamos height FIJA (no min-height) en #tr3-main para
   que el flex interno NO pueda desbordarse. Con overflow:hidden
   los hijos DEBEN caber. El carrusel absorbe el espacio
   sobrante (flex:1) y el banner NUNCA se encoge (flex-shrink:0).
   ══════════════════════════════════════════════════════ */
body[data-view="feed"] #tr3-main {
  display: flex;
  flex-direction: column;
  /* height fijo = viewport disponible exacto */
  height: calc(100dvh - var(--header-h, 60px) - var(--footer-h, 44px)) !important;
  max-height: calc(100dvh - var(--header-h, 60px) - var(--footer-h, 44px)) !important;
  overflow: hidden !important;
  box-sizing: border-box;
}

/* Contenedor interno (div que crea el JS) — llena el main */
body[data-view="feed"] #tr3-main > div {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  flex: 1 1 0;
}

/* Countdown: tamaño natural, nunca crece */
body[data-view="feed"] .countdown-mini {
  flex-shrink: 0;
}

/* Desktop: carrusel con tamaño natural, separado del banner */
/* ── Desktop (≥769px): tamaño natural, separado del banner ── */
@media (min-width: 769px) {
  body[data-view="feed"] .tr3-rk-wrap {
    flex: 0 0 auto;
    margin-bottom: 12px;
  }
  body[data-view="feed"] .tr3-rk-viewport {
    min-height: 260px;
    max-height: 300px;
  }
}

/* ── Tablet portrait (481–768px): cards más pequeñas, altura controlada ── */
@media (min-width: 481px) and (max-width: 768px) and (orientation: portrait) {
  body[data-view="feed"] .tr3-rk-wrap {
    flex: 0 0 auto;
    margin-bottom: 8px;
  }
  body[data-view="feed"] .tr3-rk-viewport {
    min-height: 180px;
    max-height: 220px;
  }
  .tr3-rk-item {
    width: 160px;
    min-width: 160px;
    max-width: 160px;
  }
  .tr3-rk-img-wrap { height: 160px; }
}

/* ── Landscape (cualquier dispositivo, altura ≤ 520px) ── */
@media (orientation: landscape) and (max-height: 520px) {
  body[data-view="feed"] .tr3-rk-wrap {
    flex: 0 0 auto;
    margin-bottom: 6px;
  }
  body[data-view="feed"] .tr3-rk-viewport {
    min-height: 140px;
    max-height: 170px;
  }
  .tr3-rk-item {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
  }
  .tr3-rk-img-wrap { height: 140px; }
  .tr3-rk-label { display: none; }
  .countdown-mini { padding: 1px 0 2px; }
  .tr3-dual-banner { height: 56px !important; }
  .tr3-gb__card { width: 160px; height: 48px; }
  .tr3-gb__card-imgpanel { width: 48px; height: 48px; }
}

/* ── Mobile portrait (≤480px): carrusel absorbe espacio sobrante ── */
@media (max-width: 480px) and (orientation: portrait) {
  body[data-view="feed"] .tr3-rk-wrap {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 0;
  }
  body[data-view="feed"] .tr3-rk-viewport {
    flex: 1 1 0;
    min-height: 0 !important;
    height: auto !important;
  }
}

/* Banner: NUNCA se encoge — siempre visible al fondo */
body[data-view="feed"] .tr3-dual-banner {
  flex-shrink: 0 !important;
}

/* ── Ajustes específicos para móvil portrait (≤ 480px) ── */
@media (max-width: 480px) and (orientation: portrait) {

  body[data-view="feed"] #tr3-main {
    padding: 6px var(--sidebar-w, 28px) 4px;
  }

  /* Countdown compacto */
  .countdown-mini {
    padding: 2px 0 3px;
    gap: 3px;
  }
  .cd-num  { font-size: clamp(0.85rem, 6.5vw, 1.3rem); }
  .cd-lbl  { font-size: clamp(0.28rem, 1.8vw, 0.4rem); letter-spacing: 1px; }
  .cd-sep  { font-size: clamp(0.75rem, 4.5vw, 1.1rem); }

  /* Label del carrusel */
  .tr3-rk-label {
    font-size: 0.55rem;
    letter-spacing: 2px;
    margin: 0 0 1px;
  }

  /* Viewport: rellena el espacio flex sin min-height que lo force */
  .tr3-rk-viewport {
    padding: 4px 22px;
  }

  /* Cards más grandes en mobile */
  .tr3-rk-item {
    width: clamp(145px, 42vw, 185px);
    min-width: clamp(145px, 42vw, 185px);
    max-width: clamp(145px, 42vw, 185px);
  }
  /* Imagen cuadrada: heredada del aspect-ratio base, forzar aquí */
  .tr3-rk-img-wrap { aspect-ratio: 1 / 1; height: auto; }
  .tr3-rk-arrow    { width: 20px; height: 32px; font-size: 15px; }
  /* Medalla más pequeña en mobile */
  .tr3-rk-medal--big { font-size: 1.2rem; top: 5px; left: 5px; }
  /* Número de posición pequeño en esquina */
  .tr3-rk-pos-overlay--top .pos-num { font-size: 0.9rem; }
  .tr3-rk-pos-overlay--top { padding: 2px 5px; }

  /* Banner fijo al fondo */
  .tr3-dual-banner        { height: 66px !important; }
  .tr3-gb__card           { width: 188px; height: 56px; }
  .tr3-gb__card-imgpanel  { width: 56px; height: 56px; }
  .tr3-gb__label          { width: 42px; min-width: 42px; }
  .tr3-gb__icon           { font-size: 12px; }
  .tr3-gb__text           { font-size: 5px; letter-spacing: 0.6px; }
  .tr3-gb__arrow          { width: 16px; font-size: 14px; }
}

/* ── iPhone XR / 12 / 13 / 14 (alto ≥ 750px) ── */
@media (max-width: 480px) and (min-height: 750px) and (orientation: portrait) {
  /* Imágenes del carrusel: cuadradas en pantallas altas también */
  .tr3-rk-img-wrap  { aspect-ratio: 1 / 1; height: auto; }
  /* Banner ligeramente más grande */
  .tr3-dual-banner  { height: 74px !important; }
  .tr3-gb__card     { width: 200px; height: 64px; }
  .tr3-gb__card-imgpanel { width: 64px; height: 64px; }
  /* Countdown con más aire */
  .countdown-mini   { padding: 3px 0 6px; }
}

/* ═══════════════════════════════════════════════════════════════
   MODAL POST EXPANDIDO — pex-modal (estructura Gyms-Power)
   ═══════════════════════════════════════════════════════════════ */

.pex-modal {
  position: fixed; inset: 0; z-index: 2200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.pex-modal[hidden] { display: none !important; }

.pex-modal__backdrop {
  position: fixed; inset: 0; z-index: 0; cursor: pointer;
}

.pex-modal__box {
  position: relative; z-index: 1;
  width: min(480px, 100vw);
  height: min(92vh, 840px);
  max-height: 92vh;
  background: var(--surface);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.pex-modal__box--wide {
  width: min(900px, 98vw);
  height: min(90vh, 720px);
  display: flex; flex-direction: column;
}

/* ── Topbar ───────────────────────────────────────────────── */
.pex-topbar {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 10;
  flex-shrink: 0;
}
.pex-topbar__section-icon { font-size: 0.9rem; flex-shrink: 0; }
.pex-topbar__title {
  font-family: var(--font-display); font-size: 0.9rem; letter-spacing: 0.12em;
  color: var(--text); white-space: nowrap;
}
.pex-topbar__badge {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em;
  color: var(--accent); border: 1px solid var(--accent-dim);
  padding: 0.1rem 0.45rem; text-transform: uppercase; white-space: nowrap;
}
.pex-topbar__permalink-btn {
  display: flex; align-items: center; gap: 0.35rem;
  margin-left: auto; margin-right: 0.6rem;
  font-family: var(--font-display); font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.1em; color: var(--accent);
  background: transparent; border: 1px solid var(--accent-dim);
  padding: 0.35rem 0.7rem; text-decoration: none;
  transition: all 0.2s; flex-shrink: 0; cursor: pointer;
}
.pex-topbar__permalink-btn:hover { background: var(--accent-glow); border-color: var(--accent); }
.pex-topbar__close {
  flex-shrink: 0; background: var(--red); border: 1px solid var(--red);
  font-family: var(--font-display); font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.1em; color: #fff; padding: 0.22rem 0.65rem; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pex-topbar__close:hover { background: #ff1a1a; color: #fff; }

/* ── 2-col layout ─────────────────────────────────────────── */
.pex-two-col { display: flex; flex: 1; overflow: hidden; min-height: 0; }
.pex-col-img { flex: 0 0 46%; position: relative; background: #000; overflow: hidden; }
.pex-card__img-wrap--col { height: 100%; border: 0; margin: 0; position: relative; overflow: hidden; }
.pex-card__img--col { width: 100%; height: 100%; object-fit: cover; display: block; }
.pex-card__img-placeholder--col {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; background: var(--surface3);
  z-index: 1;
}
.pex-card__img-placeholder--col[hidden],
.pex-card__img-placeholder--col[style*="display: none"] { display: none !important; }
.pex-card__img--col { position: relative; z-index: 2; }
.pex-card__img-wrap[hidden] { display: none !important; }

/* Botones flotantes sobre imagen */
.pex-card__img-actions {
  position: absolute; bottom: 0.55rem; right: 0.55rem;
  display: flex; gap: 0.35rem;
}
.pex-img-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.72); color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.18); cursor: pointer;
  transition: all 0.15s;
}
.pex-img-btn:hover { color: #fff; border-color: rgba(255,255,255,0.5); background: rgba(0,0,0,0.9); }
.pex-img-btn[hidden] { display: none !important; }
.pex-img-btn--edit:hover { color: var(--accent); border-color: var(--accent); }
.pex-img-btn--delete:hover { color: var(--red); border-color: var(--red); }

/* ── Columna derecha ──────────────────────────────────────── */
.pex-col-content {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0; position: relative;
}
.pex-modal__body-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--accent) transparent;
  -webkit-overflow-scrolling: touch; scroll-behavior: smooth;
}
.pex-modal__body-scroll::-webkit-scrollbar { width: 6px; background: transparent; }
.pex-modal__body-scroll::-webkit-scrollbar-thumb {
  background: var(--accent-dim); border-radius: 6px;
}
.pex-modal__body-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Scroll indicator */
.pex-scroll-indicator {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 80px; pointer-events: none; z-index: 100;
  opacity: 0; transition: opacity 0.4s;
}
.pex-scroll-indicator.is-visible { opacity: 1; }
.pex-scroll-indicator__gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--surface) 0%, var(--surface) 12%, transparent 100%);
}
.pex-scroll-indicator__arrow {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--accent-dim);
  animation: pex-bounce 1.8s ease-in-out infinite;
}
@keyframes pex-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(5px); }
}

/* ── Card principal ───────────────────────────────────────── */
.pex-card {
  border: 1px solid var(--border2);
  margin: 0.75rem;
  background: var(--surface2);
  display: flex; flex-direction: column;
}

/* Header autor */
.pex-card__header {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.pex-card__avatar {
  width: 42px; height: 42px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--border2); flex-shrink: 0;
}
.pex-card__author-info { display: flex; flex-direction: column; gap: 0.1rem; flex: 1; min-width: 0; }
.pex-card__author-name {
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.06em; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pex-card__date { font-size: 0.65rem; color: var(--text-muted); }

/* Acciones header (compartir) */
.pex-card__actions-top { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; position: relative; }
.pex-share-toggle {
  background: none; border: none; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; cursor: pointer; transition: color 0.15s;
}
.pex-share-toggle:hover { color: var(--accent); }
.pex-share-menu {
  position: absolute; top: calc(100% + 0.4rem); right: 0;
  display: flex; flex-direction: column; gap: 3px;
  background: var(--surface3); border: 1px solid var(--border2);
  padding: 0.3rem; z-index: 20; min-width: 36px;
}
.pex-share-menu[hidden] { display: none !important; }
.pex-share-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; text-decoration: none;
  transition: opacity 0.15s, transform 0.15s;
}
.pex-share-btn:hover { opacity: 0.85; transform: scale(1.08); }
.pex-share-btn--fb   { background: #1877f2; color: #fff; }
.pex-share-btn--wa   { background: #25d366; color: #fff; }
.pex-share-btn--x    { background: var(--bg); color: #fff; border: 1px solid rgba(255,255,255,0.15); }
.pex-share-btn--copy { background: var(--accent-glow); color: var(--accent); border: 1px solid var(--accent-dim); }

/* Meta: autor tag + título */
.pex-card__meta {
  padding: 0.6rem 0.85rem 0.3rem;
  font-size: 0.82rem; color: var(--text-muted); line-height: 1.4;
}
.pex-card__author-tag {
  font-weight: 700; color: #fff; margin-right: 0.35rem; font-size: 0.82rem;
}

/* Rating */
.pex-card__rating {
  display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap;
  padding: 0.4rem 0.85rem;
  background: rgba(0,0,0,0.25);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.pex-rating__label { font-size: 0.65rem; color: var(--text-muted); letter-spacing: 0.05em; }
.pex-rating__type  { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; color: #fff; margin-right: 0.2rem; }
.pex-rating__btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--accent-glow); border: 1px solid var(--accent-dim); color: #fff;
  font-family: var(--font-display); font-size: 0.7rem; font-weight: 700;
  padding: 0.22rem 0.55rem; cursor: pointer; transition: all 0.15s; letter-spacing: 0.04em;
}
.pex-vote-level { font-weight: 700; font-size: 0.85rem; }
.pex-rating__btn:hover, .pex-rating__btn.is-voted { background: var(--accent); color: #fff; box-shadow: 0 0 10px var(--accent-glow); }
.pex-rating__btn.is-loading { opacity: 0.6; cursor: not-allowed; }
.pex-vote-total-wrap {
  display: inline-flex; align-items: center; gap: 0.2rem;
  font-family: var(--font-display); font-size: 0.78rem; font-weight: 700;
  color: var(--text-muted); padding: 0.25rem 0.5rem;
  border-left: 1px solid var(--border); margin-left: 0.2rem;
}
.pex-vote-total-wrap span { color: var(--accent); }

/* Separador */
.pex-card__sep { height: 1px; background: var(--border); margin: 0.15rem 0.85rem; }

/* Cuerpo texto */
.pex-card__body { padding: 0.5rem 0.85rem 0.65rem; }
.pex-card__excerpt { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }
.pex-card__excerpt[hidden] { display: none !important; }
.pex-card__excerpt-full {
  font-size: 0.88rem; line-height: 1.7; color: var(--text);
  white-space: pre-wrap; word-break: break-word; margin: 0;
}
.pex-card__excerpt-full--col { padding: 0.35rem 0; }
.pex-card__excerpt-full[hidden] { display: none !important; }

/* Confirmación borrado */
.pex-delete-confirm {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.88); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.pex-delete-confirm[hidden] { display: none !important; }
.pex-delete-confirm__box {
  background: var(--surface3); border: 1px solid rgba(255,68,68,0.4);
  padding: 1.5rem; text-align: center;
  display: flex; flex-direction: column; gap: 1rem; max-width: 320px;
}
.pex-delete-confirm__msg { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }
.pex-delete-confirm__actions { display: flex; gap: 0.65rem; justify-content: center; }
.btn-secondary {
  background: none; border: 1px solid var(--border2); color: var(--text-muted);
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.1em; padding: 0.4rem 1rem; cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }
.btn-danger {
  background: var(--red); color: #fff; border: 1px solid var(--red);
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.1em; padding: 0.4rem 1rem; cursor: pointer;
  transition: opacity 0.15s;
}
.btn-danger:hover { opacity: 0.85; }

/* ── Botón Destacar Publicación (dentro del modal expandido) ── */
.pex-feature-wrap {
  padding: 0.75rem 0.85rem 0.25rem;
}
.pex-feature-wrap[hidden] { display: none !important; }
.pex-feature-btn {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(90deg, rgba(180,130,0,0.85) 0%, rgba(210,160,0,0.85) 100%);
  border: 1px solid rgba(255,200,0,0.55);
  border-radius: 6px;
  color: #fff;
  font-family: var(--font-display, monospace);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.15s;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.pex-feature-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════════════
   MODAL POST — MÓVIL (≤ 640px)
   PROBLEMA: iOS Safari incluye la barra de dirección en 100vh,
   por eso el modal desborda por arriba y tapa el topbar+close.
   SOLUCIÓN:
   1. Usar 100dvh (Dynamic Viewport Height) — excluye el chrome
   2. Anclar el box con position:fixed inset:0 para garantizar
      que SIEMPRE empiece desde arriba del área visible
   3. padding-top: env(safe-area-inset-top) para notch/isla
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* El overlay cubre exactamente el viewport visible */
  .pex-modal {
    align-items: flex-start;
    padding: 0;
  }

  /* Box normal (.pex-modal__box) — también se ancla en móvil */
  .pex-modal__box {
    position: fixed;
    inset: 0;
    width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0;
    /* Safe area para notch/Dynamic Island de iPhone */
    padding-top: env(safe-area-inset-top, 0px);
    box-sizing: border-box;
  }

  /* Box wide — igual */
  .pex-modal__box--wide {
    position: fixed;
    inset: 0;
    width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0;
    padding-top: env(safe-area-inset-top, 0px);
    box-sizing: border-box;
  }

  /* Topbar siempre pegado arriba, nunca se encoge */
  .pex-topbar {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 20;
    /* Botón cerrar más fácil de tocar en táctil */
    padding: 0.65rem 0.85rem;
  }

  /* Botón cerrar: área de toque mínima 44×44px (Apple HIG) */
  .pex-topbar__close {
    min-width: 44px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
  }

  /* 1 columna: imagen arriba, contenido abajo */
  .pex-two-col { flex-direction: column; }

  .pex-col-img {
    flex: none;
    width: 100%;
    aspect-ratio: 4 / 3;
    min-height: unset;
    max-height: 55vw;
    overflow: hidden;
    position: relative;
    background: #000;
  }
  .pex-card__img--col {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: #000;
  }

  .pex-topbar__permalink-btn { display: none; }
}

/* ══════════════════════════════════════════════════════════════
   BOTÓN CALIFICAR — Carrusel
   ══════════════════════════════════════════════════════════════ */
.tr3-rk-cal-btn {
  display: block;
  width: 100%;
  padding: 9px 0;
  background: rgba(255,255,255,0.07);
  border: none;
  border-top: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.8);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, letter-spacing 0.18s;
  flex-shrink: 0;
}
.tr3-rk-cal-btn:hover {
  background: var(--accent);
  color: #fff;
  letter-spacing: 0.2em;
}
/* Botón calificar destacado para top 3 */
.tr3-rk-cal-btn--top {
  padding: 11px 0;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  border-top: 2px solid rgba(255,255,255,0.35);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.55);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  letter-spacing: 0.18em;
  animation: calificar-pulse 2.2s ease-in-out infinite;
}
.tr3-rk-cal-btn--top:hover {
  background: #fff;
  color: var(--accent);
  letter-spacing: 0.24em;
  animation: none;
}
@keyframes calificar-pulse {
  0%, 100% { box-shadow: 0 -4px 16px rgba(0,0,0,0.55), 0 0 0 0 rgba(var(--accent-rgb, 180,20,40), 0.5); }
  50%       { box-shadow: 0 -4px 20px rgba(0,0,0,0.6),  0 0 0 6px rgba(var(--accent-rgb, 180,20,40), 0); }
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR DERECHO — Header rediseñado
   ══════════════════════════════════════════════════════════════ */
.spanel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}
.spanel-header__left {
  display: flex;
  align-items: center;
  gap: 7px;
}
.spanel-logo-icon { color: var(--accent); flex-shrink: 0; }
.spanel-header__title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: #fff;
}
.spanel-header__right {
  display: flex;
  align-items: center;
  gap: 3px;
}
.spanel-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  font-size: 0.8rem;
}
.spanel-icon-btn:hover { color: var(--accent); border-color: var(--border-panel); background: var(--surface-card-hover); }
.spanel-icon-btn.active { color: var(--accent); background: var(--accent-glow); border-color: var(--accent-dim); }
.spanel-close-btn { background: var(--red) !important; border-color: var(--red) !important; color: #fff !important; }
.spanel-close-btn:hover { background: #ff1a1a !important; border-color: #ff1a1a !important; color: #fff !important; }

/* ── Barra combinada: tabs + buscador + refresh en una sola fila ── */
.spanel-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Tabs dentro de la toolbar */
.spanel-tabs {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: opacity 0.25s ease, max-width 0.3s ease, visibility 0.25s ease;
  max-width: 200px;
  overflow: hidden;
}
/* Desktop: cuando el buscador tiene foco, los tabs se ocultan para que la búsqueda ocupe todo */
@media (min-width: 769px) {
  .spanel-toolbar:has(.spanel-search:focus) .spanel-tabs {
    max-width: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}
.spf-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 7px;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.spf-tab svg { flex-shrink: 0; }
.spf-tab:hover { color: #fff; background: var(--accent-glow); border-color: var(--border); }
.spf-tab.active { color: #fff; background: var(--accent); border-color: var(--accent-dim); }

/* Buscador compacto dentro de la toolbar */
.spanel-search-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-panel);
  border-radius: 4px;
  padding: 0 7px;
  height: 26px;
  transition: border-color 0.25s ease, background 0.2s ease;
  position: relative;
  z-index: 2;
}
/* Desktop: al hacer focus la caja se expande horizontalmente y tapa los tabs */
@media (min-width: 769px) {
  .spanel-search-wrap:focus-within {
    border-color: var(--accent);
    background: var(--surface2);
    /* Se expande hacia la izquierda ocupando todo el espacio disponible */
    flex: 999;
  }
}
/* Móvil: solo cambia color de borde, sin expansión */
@media (max-width: 768px) {
  .spanel-search-wrap:focus-within {
    border-color: var(--accent);
  }
}
.spanel-search-icon { color: var(--text-muted); flex-shrink: 0; }
.spanel-search {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.75rem;
  padding: 0;
  outline: none;
}
.spanel-search::placeholder { color: var(--text-dim); }

/* Botón refresh dentro de la toolbar */
.spanel-toolbar .spanel-icon-btn {
  flex-shrink: 0;
  transition: opacity 0.25s ease, max-width 0.3s ease, visibility 0.25s ease;
  max-width: 40px;
  overflow: hidden;
}
/* Desktop: ocultar botón refresh cuando se busca, para dar todo el espacio al buscador */
@media (min-width: 769px) {
  .spanel-toolbar:has(.spanel-search:focus) #spanel-refresh-btn {
    max-width: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* Vista cuadrícula para la lista de posts */
.posts-list-panel.spanel-grid-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px;
  align-content: start;
}
.posts-list-panel.spanel-grid-view .fc-lateral {
  font-size: 0.7rem;
}
.posts-list-panel.spanel-grid-view .fc-lat__img-wrap {
  /* No sobreescribir aspect-ratio — heredar el 16:9 del padre */
  aspect-ratio: 4 / 3;
}

/* ══════════════════════════════════════════════════════════════
   SISTEMA DE VOTACIÓN — Lista lateral (estilo modal)
   ══════════════════════════════════════════════════════════════ */
.fc-lat__footer {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  gap: 0;
}
.fc-lat__rating-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px;
  padding: 5px 8px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid var(--border);
  overflow: hidden;
}
.fc-lat__rating-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.fc-lat__rating-type {
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.06em;
  margin-right: 2px;
  flex-shrink: 0;
}
.fc-lat__vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 7px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.04em;
}
.fc-lat__vote-btn span { font-weight: 700; font-size: 0.78rem; color: #fff; }
.fc-lat__vote-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 8px var(--accent-glow);
}
.fc-lat__vote-btn--voted {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}
.fc-lat__vote-btn--active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}
.fc-lat__score-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  padding-left: 6px;
  margin-left: 2px;
}
.fc-lat__score-val { color: var(--accent); }

/* Fila inferior: "↗ ver" */
.fc-lat__footer > .fc-lat__view-link {
  display: block;
  text-align: right;
  padding: 4px 10px 5px;
  font-size: 0.6rem;
  color: rgba(255,255,255,0.55);
  transition: color 0.15s;
  border-top: 1px solid var(--border);
}
.fc-lateral:hover .fc-lat__footer > .fc-lat__view-link { color: #fff; }

/* ══════════════════════════════════════════════════════════════
   BOTÓN + SEGUIR / SER FAN — Lista lateral
   ══════════════════════════════════════════════════════════════ */
.fc-lat__follow-wrap {
  margin-left: auto;
  flex-shrink: 0;
}
.fc-lat__follow-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  border-radius: 2px;
}
.fc-lat__follow-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}
.fc-lat__follow-btn--following {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-muted);
}
.fc-lat__follow-btn--following:hover:not(:disabled) {
  background: rgba(255,68,68,0.1);
  border-color: rgba(255,68,68,0.5);
  color: #f66;
}
.fc-lat__follow-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Botón Seguir — modal post individual ────────────────── */
.pex-follow-btn {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  border-radius: 2px;
  flex-shrink: 0;
  margin-left: auto;
}
.pex-follow-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.pex-follow-btn--following {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-muted);
}
.pex-follow-btn--following:hover:not(:disabled) {
  background: rgba(255,68,68,0.1);
  border-color: rgba(255,68,68,0.5);
  color: #f66;
}
.pex-follow-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Header guest intent: avatar placeholder clickable ────── */
.header-avatar.guest-intent {
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s, border-color 0.2s;
}
.header-avatar.guest-intent:hover {
  opacity: 1;
  border-color: var(--accent);
}
/* ── Auth intent modal tabs ────────────────────────────────── */
.auth-tab {
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

/* ══════════════════════════════════════════════════════════════
   HEADER SWITCH BUTTON (publicar / regalar)
   ══════════════════════════════════════════════════════════════ */
.btn-header-switch {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--accent);
  border-radius: 20px;
  overflow: hidden;
  height: 34px;
  background: transparent;
}
.hdr-sw-opt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 0 14px;
  border: none;
  background: transparent;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  position: relative;
}
.hdr-sw-opt:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: var(--border2);
}
.hdr-sw-opt.active {
  background: var(--accent);
  color: #fff;
}
.hdr-sw-opt:not(.active):hover {
  background: var(--accent-glow);
}

/* Post content usa font-reading */
.fc-lat__desc,
.pex-modal .post-content,
.post-body,
.fc-lat__title {
  font-family: var(--font-reading);
  font-size: var(--font-size-reading);
}

/* ══════════════════════════════════════════════════════════════
   USERS AVATAR STRIP — columna de avatares (position:fixed)
   Aparece a la izquierda del panel de posts cuando está abierto.
   Panel está en: right=sidebar-w, ancho=panel-w
   → Strip debe estar en: right = sidebar-w + panel-w
   ══════════════════════════════════════════════════════════════ */
.users-avatar-strip {
  position: fixed !important;
  top: var(--header-h, 60px) !important;
  height: calc(100vh - var(--header-h, 60px) - var(--footer-h, 44px)) !important;
  bottom: unset !important;
  /* Por defecto: pegado al aside cuando el panel está cerrado */
  right: var(--sidebar-w, 28px);
  width: 58px;
  background: var(--accent);
  border-left: 1px solid rgba(0,0,0,0.2);
  border-right: 1px solid rgba(0,0,0,0.1);
  display: none;
  flex-direction: column;
  align-items: center;
  overflow: visible;
  z-index: 160;
  transition: right 0.28s cubic-bezier(.4,0,.2,1);
}
/* DESKTOP: siempre visible via CSS puro */
@media (min-width: 769px) {
  .users-avatar-strip {
    display: flex !important;
  }
  /* Cuando el panel de posts está abierto, el strip se corre a su izquierda */
  body:has(#sidebar-right-panel.open) .users-avatar-strip {
    right: calc(var(--sidebar-w, 28px) + var(--panel-w, 260px));
  }
}
.users-avatar-strip.visible {
  display: flex;
}
.users-avatar-strip__list {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  overflow-y: auto;
  overflow-x: visible; /* ← menú hover puede salir lateralmente */
  flex: 1;
  scrollbar-width: none;
}
.users-avatar-strip__list::-webkit-scrollbar { display: none; }
.users-avatar-strip__spinner {
  color: rgba(0,0,0,0.4);
  font-size: 0.5rem;
  padding: 10px 0;
  writing-mode: vertical-rl;
  letter-spacing: 4px;
}
/* Wrapper de cada avatar — necesario para posicionar el menú */
.users-avatar-strip__wrap {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}
.users-avatar-strip__wrap--me {
  cursor: default;
}
.users-avatar-strip__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(0,0,0,0.25);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  display: block;
  pointer-events: none; /* el click lo maneja el wrap */
}
.users-avatar-strip__wrap:hover .users-avatar-strip__avatar {
  border-color: #fff;
  transform: scale(1.12);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.users-avatar-strip__ph {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.25);
  cursor: pointer;
  background: rgba(0,0,0,0.2);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  pointer-events: none; /* el click lo maneja el wrap */
}
.users-avatar-strip__wrap:hover .users-avatar-strip__ph {
  border-color: #fff;
  transform: scale(1.12);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
/* Indicador "tú" — el usuario actual */
.users-avatar-strip__avatar--me,
.users-avatar-strip__ph--me {
  border-color: #fff;
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.3);
}

/* ══════════════════════════════════════════════════════════════
   CIRCUIT BOARD BANNER UNIFICADO
   Un único SVG que actúa como un solo PCB futurista.
   Ahora: banner dinámico de regalos de usuarios.
   Mismo contenedor (860px × 100px) — tarjetas deslizables.
   ══════════════════════════════════════════════════════════════ */

/* ── Contenedor principal (idéntico al SVG anterior) ── */
.tr3-dual-banner {
  width: 100%;
  max-width: 860px;
  height: 100px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(0,0,0,0.82) 0%, rgba(20,0,0,0.60) 50%, rgba(0,0,0,0.82) 100%);
  border-top: 1.2px solid rgba(220,40,60,0.55);
  border-bottom: 1.2px solid rgba(220,40,60,0.25);
}

/* ── Etiqueta "REGALOS" izquierda ── */
.tr3-gb__label {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 70px;
  min-width: 70px;
  padding: 0 6px;
  background: linear-gradient(90deg, rgba(180,20,40,0.55) 0%, rgba(180,20,40,0.08) 100%);
  border-right: 1px solid rgba(220,40,60,0.35);
  pointer-events: none;
  user-select: none;
}
.tr3-gb__icon {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 3px;
}
.tr3-gb__text {
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 7.5px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: rgba(220,40,60,1);
  text-transform: uppercase;
}

/* ── Flechas del carrusel ── */
.tr3-gb__arrow {
  flex-shrink: 0;
  background: rgba(0,0,0,0.55);
  border: none;
  color: rgba(220,40,60,0.85);
  font-size: 20px;
  width: 22px;
  cursor: pointer;
  z-index: 2;
  padding: 0;
  transition: background 0.2s, color 0.2s;
  pointer-events: all;
}
.tr3-gb__arrow:hover {
  background: rgba(180,20,40,0.35);
  color: #fff;
}

/* ── Viewport del carrusel ── */
.tr3-gb__viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  cursor: grab;
}
.tr3-gb__viewport:active { cursor: grabbing; }

.tr3-gb__track {
  display: flex;
  gap: 180px;
  will-change: transform;
  align-items: center;
  height: 100%;
  padding: 6px 0;
}

/* ── Tarjeta regalo individual ── */
/* ── Tarjeta regalo: layout horizontal imagen-izq / info-der ── */
.tr3-gb__card {
  flex-shrink: 0;
  width: 280px;
  height: 88px;
  border-radius: 4px;
  background: rgba(10,0,0,0.80);
  border: 1px solid rgba(220,40,60,0.22);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  transition: border-color 0.2s;
}
.tr3-gb__card:hover { border-color: rgba(220,40,60,0.65); }

/* Panel imagen izquierdo — ancho fijo, imagen completa */
.tr3-gb__card-imgpanel {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  overflow: hidden;
  position: relative;
  background: rgba(0,0,0,0.6);
}
.tr3-gb__card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Placeholder cuando no hay imagen */
.tr3-gb__card-noimg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: rgba(180,20,40,0.18);
}

/* Panel derecho: usuario + título + descripción + botón */
.tr3-gb__card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 7px 5px;
  gap: 2px;
}

/* Fila superior: avatar + nombre autor */
.tr3-gb__card-user {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.tr3-gb__card-avatar {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(220,40,60,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(220,40,60,0.45);
}
.tr3-gb__card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tr3-gb__card-author {
  font-size: 8px;
  color: rgba(255,255,255,0.60);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Título */
.tr3-gb__card-title {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

/* Descripción corta */
.tr3-gb__card-desc {
  font-size: 8px;
  color: rgba(255,255,255,0.45);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  flex: 1;
}

/* Fila inferior: score + botón calificar */
.tr3-gb__card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 1px;
}
.tr3-gb__card-score {
  font-size: 8.5px;
  font-weight: 700;
  color: rgba(220,40,60,0.95);
  white-space: nowrap;
}
.tr3-gb__card-btn {
  flex-shrink: 0;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background: rgba(180,20,40,0.75);
  border: 1px solid rgba(220,40,60,0.55);
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  pointer-events: all;
  line-height: 1.4;
  transition: background 0.18s;
  white-space: nowrap;
}
.tr3-gb__card-btn:hover { background: rgba(220,40,60,0.95); }

/* Variante "Destacar" — amarillo dorado */
.tr3-gb__card-btn--feat {
  background: rgba(180,140,0,0.75);
  border-color: rgba(255,200,0,0.65);
}
.tr3-gb__card-btn--feat:hover { background: rgba(220,170,0,0.95); }

/* Placeholder sin posts */
.tr3-gb__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  font-style: italic;
  padding: 0 16px;
  text-align: center;
}

/* ── Responsive: reducir alto en móvil ── */
@media (max-width: 600px) {
  .tr3-dual-banner { height: 75px; }
  .tr3-gb__card    { width: 220px; height: 63px; }
  .tr3-gb__card-imgpanel { width: 63px; height: 63px; }
  .tr3-gb__label   { width: 50px; min-width: 50px; }
  .tr3-gb__icon    { font-size: 14px; }
  .tr3-gb__text    { font-size: 6px; letter-spacing: 0.8px; }
  .tr3-gb__card-title  { font-size: 8.5px; }
  .tr3-gb__card-author { font-size: 7px; }
  .tr3-gb__card-desc   { font-size: 7px; -webkit-line-clamp: 1; }
  .tr3-gb__card-btn    { font-size: 7px; padding: 1px 4px; }
  .tr3-gb__arrow   { width: 18px; font-size: 16px; }
}

/* SmartFeed — gift card en sidebar lateral */
.fc-lateral--gift { border-left: 2px solid var(--accent, #39e75f); }
.fc-lateral--gift .fc-lat__cat { background: rgba(57,231,95,.15); color: var(--accent, #39e75f); }

/* ═══════════════════════════════════════════════════════════════════════
   NOTIFICATIONS PANEL — Sistema de Intención Inteligente v2
   ═══════════════════════════════════════════════════════════════════════ */

/* Panel dropdown */
#notif-panel {
  position: fixed;
  top: calc(var(--header-h, 60px) + 6px);
  right: 8px;
  width: 360px;
  max-width: calc(100vw - 16px);
  background: var(--surface-float);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius, 10px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.65), 0 2px 12px rgba(0,0,0,0.4);
  z-index: 400;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: notifSlideIn 0.16s cubic-bezier(.16,1,.3,1);
}
#notif-panel.open { display: flex; }

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

/* Header del panel */
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 11px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
}
.notif-panel-title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-main);
  text-transform: uppercase;
}
.notif-mark-all {
  background: none;
  border: 1px solid var(--border2);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 9px;
  border-radius: 20px;
  transition: background 0.15s, border-color 0.15s;
}
.notif-mark-all:hover { background: var(--accent-glow); border-color: var(--accent); }

/* Lista scrollable */
.notif-list {
  overflow-y: auto;
  max-height: 420px;
  padding: 2px 0;
}
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* Estado vacío */
.notif-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.notif-empty-icon { font-size: 2.2rem; margin-bottom: 8px; opacity: 0.45; }

/* Item de notificación */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 16px 10px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
  border-bottom: 1px solid var(--border2);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(255,255,255,0.08); }

/* No leída */
.notif-item.unread {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.notif-item.unread:hover {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
}
/* Punto indicador */
.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Avatar + badge de tipo */
.notif-type-icon {
  position: relative;
  flex-shrink: 0;
}
.notif-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1.5px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  overflow: hidden;
}
.notif-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.notif-avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-dim) 0%, var(--accent) 100%);
  border-radius: 50%;
  user-select: none;
}
.notif-badge-icon {
  position: absolute;
  bottom: -3px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-float);
  border: 1.5px solid rgba(255,255,255,0.2);
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Contenido de texto */
.notif-content { flex: 1; min-width: 0; }
.notif-text {
  font-size: 0.8rem;
  color: var(--text-main);
  line-height: 1.45;
}

/* ── Preview del mensaje DM en notificación ── */
.notif-dm-preview {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.65);
  font-style: italic;
  background: rgba(255,255,255,0.06);
  border-left: 2px solid var(--accent);
  padding: 3px 8px;
  border-radius: 0 4px 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

/* ── Notificación DM: cursor pointer para indicar que abre el chat ── */
.notif-item[data-primary^="chat:dm:"] {
  cursor: pointer;
}
.notif-item[data-primary^="chat:dm:"]:hover {
  background: rgba(255,255,255,0.08);
}
.notif-item[data-primary^="chat:dm:"]::after {
  content: "💬 Abrir chat";
  display: block;
  font-size: 0.62rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 3px;
  opacity: 0.8;
}

/* Links dentro del mensaje (actor y post) */
.notif-link {
  font-weight: 700;
  text-decoration: none;
  border-radius: 3px;
  padding: 0 1px;
  transition: background 0.12s, color 0.12s;
}
.notif-link--actor {
  color: var(--accent);
}
.notif-link--actor:hover {
  background: var(--accent-glow);
  text-decoration: underline;
}
.notif-link--post {
  color: var(--text-main);
  font-style: italic;
}
.notif-link--post:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Fila inferior: tiempo + botón secundario */
.notif-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  flex-wrap: wrap;
}
.notif-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Botón de intención secundaria (inline pequeño) */
.notif-intent-btn {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  background: var(--accent-glow);
  border-radius: 10px;
  padding: 1px 7px;
  transition: background 0.12s, opacity 0.12s;
  white-space: nowrap;
}
.notif-intent-btn:hover { opacity: 0.8; }

/* Loading */
.notif-loading {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Bell animada cuando hay no leídas */
#btn-notif.has-notif svg {
  animation: bellShake 0.5s ease 0s 1;
}
@keyframes bellShake {
  0%,100% { transform: rotate(0); }
  20%      { transform: rotate(15deg); }
  40%      { transform: rotate(-12deg); }
  60%      { transform: rotate(8deg); }
  80%      { transform: rotate(-5deg); }
}

/* ══════════════════════════════════════════════════════════════
   CHAT — Botón header + Panel + Mensajes estilo WhatsApp
   ══════════════════════════════════════════════════════════════ */

/* ── Botón CHAT en header ── */
.header-chat-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}
.header-chat-btn:hover {
  color: var(--accent);
  background: var(--accent-glow);
}
.header-chat-btn.active {
  color: var(--accent);
}

/* Botón chat toggle dentro del header del panel lateral */
.spanel-chat-toggle {
  position: relative;
  color: var(--text-muted);
}
.spanel-chat-toggle:hover,
.spanel-chat-toggle.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-color: var(--accent-dim);
}
.chat-header-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #f44;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0 4px;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  pointer-events: none;
}

/* ── Snav item CHAT badge ── */
.snav-item--chat {
  position: relative;
}
.snav-chat-badge {
  background: #f44;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0 5px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Tabs de Chat ── */
.chat-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.chat-tab {
  flex: 1;
  padding: 8px 4px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.chat-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.chat-tab:hover { color: #fff; }
.chat-dm-badge {
  background: #f44;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0 4px;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Chat views ── */
.chat-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chat-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ── Área de mensajes ── */
.chat-messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  min-height: 0;
}
.chat-messages-wrap::-webkit-scrollbar { width: 4px; }
.chat-messages-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.chat-spinner {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 20px;
}

/* ── Separador de fecha ── */
.chat-date-sep {
  text-align: center;
  font-size: 0.62rem;
  color: var(--text-muted);
  padding: 6px 0;
  letter-spacing: 0.05em;
}

/* ── Burbujas de mensaje ── */
.chat-bubble-wrap {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  max-width: 100%;
}
.chat-bubble-wrap.own {
  flex-direction: row-reverse;
}
.chat-bubble-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  align-self: flex-end;
}
.chat-bubble-avatar-ph {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface3);
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  align-self: flex-end;
}
.chat-bubble-body {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}
.chat-bubble-name {
  font-size: 0.58rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 2px;
  padding-left: 4px;
}
.chat-bubble-wrap.own .chat-bubble-name { display: none; }
.chat-bubble {
  background: var(--surface3);
  color: var(--text-main);
  border-radius: 14px 14px 14px 2px;
  padding: 6px 10px 4px;
  font-size: 0.78rem;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  position: relative;
}
.chat-bubble-wrap.own .chat-bubble {
  background: var(--accent-dim);
  border-radius: 14px 14px 2px 14px;
  color: #fff;
}
.chat-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 2px;
}
.chat-bubble-time {
  font-size: 0.56rem;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
}
.chat-bubble-wrap:not(.own) .chat-bubble-time {
  color: var(--text-muted);
}
/* Palomitas */
.chat-ticks {
  font-size: 0.7rem;
  line-height: 1;
}
.chat-ticks.sent     { color: rgba(255,255,255,0.4); }
.chat-ticks.delivered{ color: rgba(255,255,255,0.55); }
.chat-ticks.read     { color: #4fc3f7; }

/* ── Área de input ── */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
  position: relative;
}
.chat-emoji-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  padding: 2px 2px 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.1s;
}
.chat-emoji-btn:hover { transform: scale(1.2); }
.chat-input-text {
  flex: 1;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-main);
  font-size: 0.8rem;
  padding: 7px 12px;
  resize: none;
  outline: none;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.4;
  font-family: inherit;
  transition: border-color 0.15s;
  scrollbar-width: thin;
}
.chat-input-text:focus { border-color: var(--accent); }
.chat-input-text::placeholder { color: var(--text-muted); }
.chat-send-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  transition: background 0.15s, transform 0.1s;
}
.chat-send-btn:hover { background: var(--accent-bright); transform: scale(1.05); }
.chat-send-btn:active { transform: scale(0.95); }

/* ── Emoji picker ── */
.chat-emoji-picker {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 8px;
  width: 230px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  z-index: 400;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
}
.chat-emoji-picker button {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 3px;
  border-radius: 6px;
  transition: background 0.1s;
  line-height: 1;
}
.chat-emoji-picker button:hover { background: var(--surface3); }

/* ── Lista de DMs ── */
.chat-all-users-list {
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2px;
}
.chat-users-search-wrap {
  padding: 6px 8px 4px;
  border-bottom: 1px solid var(--border);
}
.chat-users-search {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.68rem;
  padding: 4px 8px;
  outline: none;
}
.chat-users-search:focus { border-color: var(--accent); }
.chat-users-count { font-size: 0.65rem; opacity: 0.6; margin-left: 4px; }
.chat-user-item .chat-room-last { color: var(--accent); font-size: 0.58rem; }
.chat-rooms-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
}
.chat-room-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.chat-room-item:hover { background: var(--surface2); }
.chat-room-item.unread { background: var(--accent-glow); }
.chat-room-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.chat-room-avatar-ph {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface3);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.chat-room-info {
  flex: 1;
  min-width: 0;
}
.chat-room-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-room-last {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.chat-room-unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ── Badge numérico de mensajes no leídos ── */
.chat-room-unread-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #e53935;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(229,57,53,.5);
  animation: chat-badge-pulse 1.6s ease-in-out infinite;
}
@keyframes chat-badge-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 2px 6px rgba(229,57,53,.5); }
  50% { transform: scale(1.15); box-shadow: 0 2px 12px rgba(229,57,53,.8); }
}

/* ── Label "NUEVO" junto al nombre ── */
.chat-room-new-label {
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #e53935;
  background: rgba(229,57,53,.12);
  border: 1px solid rgba(229,57,53,.35);
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: 5px;
  vertical-align: middle;
}

/* ── Item con mensajes no leídos: fondo destacado ── */
.chat-room-item.has-unread {
  background: linear-gradient(90deg, rgba(229,57,53,.10) 0%, var(--surface2) 100%);
  border-left: 3px solid #e53935;
}
.chat-room-item.has-unread:hover {
  background: linear-gradient(90deg, rgba(229,57,53,.18) 0%, var(--surface3) 100%);
}

/* ── Banner de alerta: nuevo DM mientras estás en sala pública ── */
.chat-dm-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(90deg, rgba(229,57,53,.18), rgba(229,57,53,.08));
  border: 1px solid rgba(229,57,53,.4);
  border-radius: 8px;
  margin: 8px 10px 0;
  animation: chat-alert-slide 0.3s ease;
  flex-shrink: 0;
}
@keyframes chat-alert-slide {
  from { transform: translateY(-10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.chat-dm-alert-icon { font-size: 1.1rem; flex-shrink: 0; }
.chat-dm-alert-text { flex: 1; font-size: 0.68rem; color: var(--text); line-height: 1.3; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-dm-alert-text strong { color: var(--accent); }
.chat-dm-alert-go {
  background: #e53935;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 0.66rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s;
}
.chat-dm-alert-go:hover { background: #c62828; }
.chat-dm-alert-close {
  background: var(--red);
  border: none;
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 1;
}
.chat-dm-alert-close:hover { background: #ff1a1a; }

/* ── Thread header ── */
.chat-thread-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.chat-back-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.12s;
}
.chat-back-btn:hover { background: var(--accent-glow); }
.chat-thread-user {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.chat-thread-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--accent);
}
.chat-thread-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── User hover menu en avatar strip ── */
.user-hover-menu {
  position: fixed; /* JS lo posiciona con top/left calculados desde el wrap */
  background: var(--surface-float);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.65), 0 2px 12px rgba(0,0,0,0.4);
  z-index: 99999;
  min-width: 170px;
  overflow: hidden;
  animation: menuFadeIn 0.12s ease;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
@keyframes menuFadeIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}
.user-hover-menu-header {
  padding: 8px 10px 4px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-hover-menu-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.1s;
  text-align: left;
}
.user-hover-menu-btn:hover { background: var(--surface3); color: var(--accent); }
.user-hover-menu-btn svg { flex-shrink: 0; }

/* ── Responsive: panel-w reference ── */
.sidebar-panel-right { --panel-w: 260px; }

/* ── No more msgs indicator ── */
.chat-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 30px 10px;
  line-height: 1.6;
}

.chat-empty-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 40px 20px;
  line-height: 1.6;
  opacity: 0.7;
  font-style: italic;
}


/* ═══════════════════════════════════════════════════════════════
   CHAT OVERLAY — panel independiente, sin relación con el sidebar de posts
   ═══════════════════════════════════════════════════════════════ */

#chat-overlay {
  position: fixed;
  bottom: var(--footer-h, 44px);
  right: var(--sidebar-w, 28px);
  width: 520px;
  height: calc(100vh - var(--header-h, 60px) - var(--footer-h, 44px));
  z-index: 200;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-panel);
  border-top: 1px solid var(--border-panel);
  background: var(--surface-panel);
  backdrop-filter: blur(14px) brightness(0.72) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) brightness(0.72) saturate(1.4);
  box-shadow: -4px 0 24px rgba(0,0,0,.45);
}

.chat-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.chat-overlay__title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.chat-overlay__close {
  background: var(--red);
  border: 1px solid var(--red);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.chat-overlay__close:hover { background: #ff1a1a; }

/* ── Toggle Compacto / Extendido ── */
.chat-view-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  margin-left: auto;
  margin-right: 10px;
}
.chat-vt__label {
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  transition: color .2s;
}
.chat-vt__label.active { color: var(--accent); }
.chat-vt__track {
  width: 34px;
  height: 18px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 9px;
  position: relative;
  transition: background .2s;
}
.chat-vt__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform .2s, background .2s;
}
/* Estado extendido */
#chat-overlay.expanded .chat-vt__track { background: var(--accent-glow); border-color: var(--accent); }
#chat-overlay.expanded .chat-vt__thumb { transform: translateX(16px); background: var(--accent); }
#chat-overlay.expanded .chat-vt__label--compact { color: var(--text-muted); }
#chat-overlay.expanded .chat-vt__label--compact.active { color: var(--text-muted); }
#chat-overlay.expanded .chat-vt__label--ext { color: var(--accent); }

/* ── Modo Extendido en móvil: restaurar textos ocultos ── */
@media (max-width: 768px) {
  #chat-overlay.expanded .chat-users-col {
    width: 200px;
    min-width: 160px;
  }
  #chat-overlay.expanded .chat-users-search-wrap,
  #chat-overlay.expanded .chat-users-col .chat-room-name,
  #chat-overlay.expanded .chat-users-col .chat-room-last,
  #chat-overlay.expanded .chat-users-count,
  #chat-overlay.expanded .chat-public-room-btn .chat-room-name,
  #chat-overlay.expanded .chat-public-room-btn .chat-room-last { display: block; }
  #chat-overlay.expanded .chat-public-rooms-list {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 220px;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--border);
}

.chat-public-room-btn { justify-content: flex-start; padding: 10px 10px; }
  #chat-overlay.expanded .chat-dms-header {
    font-size: 0.62rem;
    padding: 7px 10px;
    justify-content: flex-start;
    letter-spacing: 0.12em;
  }
  #chat-overlay.expanded .chat-dms-header[data-short]::after { display: none; }
  #chat-overlay.expanded .chat-users-col .chat-room-item { padding: 8px 8px; justify-content: flex-start; }
  #chat-overlay.expanded .chat-users-col .chat-room-avatar,
  #chat-overlay.expanded .chat-users-col .chat-room-avatar-ph { width: 30px; height: 30px; }
}

/* ── Modo Extendido: ocupa todo el espacio entre strips y entre header/footer ── */
#chat-overlay.expanded {
  left: var(--sidebar-w, 28px) !important;
  right: var(--sidebar-w, 28px) !important;
  width: auto !important;
  max-width: none !important;
  transition: left .2s, right .2s, width .2s;
}
#chat-overlay.expanded .chat-users-col {
  width: 220px;
  min-width: 180px;
}

.chat-overlay__inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-overlay__body {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
}

/* ── Columna izquierda: lista de usuarios ── */
.chat-users-col {
  width: 170px;
  min-width: 140px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface2);
  overflow: hidden;
}

/* Botón sala pública */
.chat-public-room-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}
.chat-public-room-btn:hover { background: var(--surface3); }
.chat-public-room-btn.active {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
}
.chat-pub-icon { font-size: 1.1rem; flex-shrink: 0; }
.chat-public-room-btn .chat-room-name { font-size: 0.72rem; }
.chat-public-room-btn .chat-room-last { font-size: 0.6rem; }

/* ── Dropdown custom de salas públicas ──────────────── */
.chat-dms-header--rooms {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 10px;
  flex-shrink: 0;
}
.chat-dms-header__label {
  flex-shrink: 0;
  white-space: nowrap;
}
/* Botón trigger */
.chat-rooms-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: var(--surface3, #1a1a1a);
  border: 1px solid var(--border, #333);
  border-radius: 4px;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 4px 7px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
}
.chat-rooms-btn:hover,
.chat-rooms-btn[aria-expanded="true"] {
  border-color: var(--accent, #39e75f);
  background: var(--surface2, #111);
}
.chat-rooms-btn__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: left;
}
.chat-rooms-btn__chevron {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
  transition: transform 0.15s;
}
.chat-rooms-btn[aria-expanded="true"] .chat-rooms-btn__chevron {
  transform: rotate(180deg);
}
/* Panel flotante — posicionado con JS usando fixed */
.chat-rooms-dropdown {
  position: fixed;
  z-index: 99999;
  background: var(--surface-float-solid);
  border: 1px solid var(--accent, #39e75f);
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
  padding: 4px 0;
  margin: 0;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.chat-rooms-dropdown__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s;
  color: rgba(255,255,255,0.85);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.chat-rooms-dropdown__item:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.chat-rooms-dropdown__item.active {
  background: var(--accent-glow, rgba(57,231,95,0.12));
  color: var(--accent, #39e75f);
  border-left: 2px solid var(--accent, #39e75f);
  padding-left: 12px;
}
.crd-icon { font-size: 1rem; flex-shrink: 0; }
.crd-name { flex: 1; }
.crd-badge-priv { font-size: 0.7rem; opacity: 0.7; flex-shrink: 0; }

/* Separador dentro del dropdown */
.chat-rooms-dropdown__sep {
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 4px 0;
  padding: 4px 14px 2px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  cursor: default;
  pointer-events: none;
}

/* Salas de grupo del usuario */
.chat-rooms-dropdown__item--group {
  opacity: 0.92;
}

/* Botón "Crear nueva sala" */
.chat-rooms-dropdown__item--create {
  color: var(--accent, #39e75f);
  font-weight: 700;
  border-top: 1px solid rgba(57,231,95,0.15);
  margin-top: 2px;
}
.chat-rooms-dropdown__item--create:hover {
  background: rgba(57,231,95,0.1);
}

/* ── Modal Crear Sala ─────────────────────────────────────────── */
.chat-create-room-box {
  background: var(--surface-float-solid);
  border: 1px solid rgba(57,231,95,0.35);
  border-radius: 12px;
  width: min(92vw, 420px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.8);
  overflow: hidden;
}
.chat-crm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.chat-crm-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
}
.chat-crm-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.chat-crm-close:hover { color: #fff; background: rgba(255,255,255,0.1); }
.chat-crm-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-crm-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chat-crm-input {
  width: 100%;
  background: #111;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.chat-crm-input:focus { border-color: var(--accent, #39e75f); }
.chat-crm-vis-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}
.chat-crm-vis-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #111;
}
.chat-crm-vis-opt input[type="radio"] { display: none; }
.chat-crm-vis-opt.selected {
  border-color: var(--accent, #39e75f);
  background: rgba(57,231,95,0.07);
}
.chat-crm-vis-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.chat-crm-vis-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}
.chat-crm-vis-desc {
  display: block;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.45);
  line-height: 1.3;
}
.chat-crm-error {
  font-size: 0.72rem;
  color: #f66;
  min-height: 16px;
  margin-top: 2px;
}
.chat-crm-submit {
  margin-top: 6px;
  width: 100%;
  padding: 10px;
  background: var(--accent, #39e75f);
  color: #000;
  font-weight: 800;
  font-size: 0.85rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: opacity 0.15s;
}
.chat-crm-submit:hover { opacity: 0.88; }
.chat-crm-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cabecera DMs */
.chat-dms-header {
  padding: 7px 10px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.75);
  background: #000;
  border-top: 2px solid #111;
  border-bottom: 2px solid #111;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* Lista de rooms en columna izq */
.chat-users-col .chat-rooms-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
}
.chat-users-col .chat-room-item { padding: 8px 8px; }
.chat-users-col .chat-room-avatar,
.chat-users-col .chat-room-avatar-ph {
  width: 30px; height: 30px; font-size: 0.7rem;
}
.chat-users-col .chat-room-name { font-size: 0.7rem; }
.chat-users-col .chat-room-last { font-size: 0.59rem; }
.chat-room-item.active-room {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
}

/* ── Columna derecha: conversación ── */
.chat-conv-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.chat-conv-col .chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Thread header */
.chat-thread-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.chat-thread-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chat-thread-room {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent, #39e75f);
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Responsive móvil — BUG3 FIX */
@media (max-width: 600px) {
  #chat-overlay {
    width: calc(100vw - var(--sidebar-w, 28px));
    max-width: calc(100vw - var(--sidebar-w, 28px));
    top: var(--header-h, 60px);
    bottom: var(--footer-h, 44px);
    height: auto;
    max-height: calc(100vh - var(--header-h, 60px) - var(--footer-h, 44px));
    overflow: hidden;
    box-sizing: border-box;
  }
  /* FIX BUG3: reducir col izquierda a solo iconos en pantallas pequeñas */
  .chat-users-col {
    width: 56px;
    min-width: 48px;
    flex-shrink: 0;
  }
  .chat-users-search-wrap,
  .chat-users-col .chat-room-name,
  .chat-users-col .chat-room-last,
  .chat-users-count,
  .chat-public-room-btn .chat-room-name,
  .chat-public-room-btn .chat-room-last { display: none; }
  .chat-dms-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px 0;
    font-size: 0;
    background: #000;
    border-top: 2px solid #111;
    border-bottom: 2px solid #111;
    min-height: 8px;
    letter-spacing: 0;
    overflow: hidden;
  }
  .chat-dms-header[data-short]::after {
    content: attr(data-short);
    font-size: 0.42rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.75);
    text-transform: uppercase;
    line-height: 1;
  }
  /* En móvil: usuarios como avatares compactos, sin scroll oculto */
  .chat-all-users-list {
    max-height: none;
    overflow-y: visible;
    border-bottom: 1px solid var(--border);
  }
  .chat-user-item .chat-room-last { display: none; }
  .chat-public-room-btn { justify-content: center; padding: 10px 4px; }
  .chat-pub-icon { font-size: 1.3rem; }
  .chat-users-col .chat-room-item { padding: 6px 4px; justify-content: center; }
  .chat-users-col .chat-room-avatar,
  .chat-users-col .chat-room-avatar-ph { width: 34px; height: 34px; font-size: 0.8rem; }
  /* Lista de usuarios en móvil: scroll vertical compacto */
  .chat-all-users-list {
    max-height: 220px;
    overflow-y: auto;
  }
  /* Lista DMs en móvil también con scroll */
  .chat-rooms-list {
    max-height: 180px;
    overflow-y: auto;
  }
  .chat-input-wrap { position: sticky; bottom: 0; z-index: 10; }

  /* FIX MÓVIL: evitar que el input desborde la pantalla al hacer focus.
     1) font-size:16px previene el auto-zoom de iOS (< 16px lo dispara).
     2) max-width + box-sizing contienen el área al 90% del viewport.
     3) overflow:hidden en el área evita scroll horizontal fantasma. */
  .chat-input-area {
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  .chat-input-text {
    font-size: 16px !important;
    max-width: 90vw;
    box-sizing: border-box;
    min-width: 0;
  }
}
@media (max-width: 400px) {
  .chat-users-col { display: none; }
}

/* ── Formulario de registro en 5 pasos ─────────────────────────────────── */
.reg-page-wrap { max-width: 480px; }

.reg-step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
}
.reg-step {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  background: var(--surface2);
  color: var(--text-muted);
  border: 2px solid var(--border2);
  flex-shrink: 0;
  transition: all .25s;
}
.reg-step.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.reg-step.done {
  background: #22c55e;
  color: #fff;
  border-color: #22c55e;
}
.reg-step-line {
  flex: 1;
  height: 2px;
  background: var(--border2);
  margin: 0 6px;
  transition: background .25s;
}
.reg-step-line.active { background: var(--accent); }

.reg-step-title {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-display);
  margin: 4px 0 2px;
  color: var(--accent);
  letter-spacing: .5px;
}
.reg-step-sub {
  font-size: .82rem;
  color: var(--text-muted);
  margin: 0 0 16px;
}
.reg-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 14px 0 8px;
}

/* Género */
.reg-gender-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}
.reg-gender-btn {
  flex: 1;
  padding: 9px 4px;
  border-radius: 8px;
  border: 1.5px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.reg-gender-btn:hover { border-color: var(--accent); color: var(--accent); }
.reg-gender-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

/* Chips de disciplina y personalidad */
.reg-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 4px;
}
.reg-chip {
  padding: 6px 11px;
  border-radius: 20px;
  border: 1.5px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.reg-chip:hover { border-color: var(--accent); color: var(--accent); }
.reg-chip.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ── Barra de progreso de 5 pasos ── */
.reg-progress-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
}
.reg-prog-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.reg-prog-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  background: var(--surface2);
  color: var(--text-muted);
  border: 2px solid var(--border2);
  transition: all .25s;
}
.reg-prog-label {
  font-size: .6rem;
  color: var(--text-dim);
  letter-spacing: .3px;
  white-space: nowrap;
}
.reg-prog-item.active .reg-prog-circle {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.reg-prog-item.active .reg-prog-label { color: var(--accent); }
.reg-prog-item.done .reg-prog-circle {
  background: #22c55e;
  color: #fff;
  border-color: #22c55e;
}
.reg-prog-line {
  flex: 1;
  height: 2px;
  background: var(--border2);
  margin: 0 3px;
  margin-bottom: 14px;
  transition: background .25s;
  min-width: 8px;
}
.reg-prog-line.done { background: #22c55e; }

/* ── Validador de contraseña en tiempo real ── */
.pass-rules {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pass-rule {
  font-size: .78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .2s;
}
.pass-rule .rule-icon {
  width: 16px;
  text-align: center;
  font-weight: 700;
  color: var(--text-dim);
  transition: color .2s;
}
.pass-rule.ok { color: #22c55e; }
.pass-rule.ok .rule-icon { color: #22c55e; }

/* ── Hint de campo ── */
.reg-field-hint {
  font-size: .78rem;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 8px 10px;
  margin-bottom: 8px;
  line-height: 1.5;
}

/* ── Aviso avatar IA ── */
.reg-avatar-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 16px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   MODAL DE PREFERENCIAS DE USUARIO
   ═══════════════════════════════════════════════════════════ */
#tr3-prefs-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}
#tr3-prefs-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#tr3-prefs-panel {
  position: relative;
  z-index: 1;
  width: 360px;
  max-width: 95vw;
  height: 100vh;
  background: rgba(14,10,22,0.97);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border-left: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -16px 0 48px rgba(0,0,0,0.7);
  animation: prefsPanelIn 0.22s cubic-bezier(.22,1,.36,1);
}
@keyframes prefsPanelIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}
.prefs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.prefs-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.prefs-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.prefs-close:hover { background: var(--surface3); color: var(--text); }
.prefs-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.prefs-section {
  padding: 18px 0 12px;
  border-bottom: 1px solid var(--border);
}
.prefs-section:last-child { border-bottom: none; }
.prefs-section-title {
  margin: 0 0 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.prefs-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.prefs-hint {
  margin: 6px 0 0;
  font-size: 0.74rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Toggle switch */
.prefs-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}
.prefs-toggle-row > span:first-child {
  font-size: 0.82rem;
  color: var(--text);
  flex: 1;
  line-height: 1.4;
}
.prefs-toggle-row small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.prefs-toggle {
  position: relative;
  flex-shrink: 0;
}
.prefs-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.prefs-toggle-track {
  display: block;
  width: 40px;
  height: 22px;
  background: var(--surface3);
  border-radius: 20px;
  position: relative;
  transition: background 0.2s;
  cursor: pointer;
}
.prefs-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s, background 0.2s;
}
.prefs-toggle input:checked + .prefs-toggle-track { background: var(--accent); }
.prefs-toggle input:checked + .prefs-toggle-track::after {
  transform: translateX(18px);
  background: #fff;
}

/* Grilla de fuentes */
.prefs-font-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.prefs-font-btn {
  padding: 5px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--border2);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.prefs-font-btn:hover { border-color: var(--accent); color: var(--accent); }
.prefs-font-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* Slider de tamaño */
.prefs-range {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Presets de color */
.prefs-color-presets {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.prefs-color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  padding: 0;
}
.prefs-color-dot:hover { transform: scale(1.15); box-shadow: 0 0 0 3px rgba(255,255,255,0.3); }
.prefs-color-dot.active { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,0.5); }

/* Input color */
.prefs-color-input {
  width: 36px;
  height: 26px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 6px;
}

/* Vista previa de acento */
.prefs-accent-preview {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#pref-accent-preview-btn {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}
#pref-accent-preview-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  font-size: 0.82rem;
}

/* Footer del panel */
.prefs-footer {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.prefs-footer button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  transition: all 0.15s;
}
#btn-prefs-save {
  background: var(--accent);
  color: #000;
}
#btn-prefs-save:hover { filter: brightness(1.15); }
#btn-prefs-reset {
  background: var(--surface3);
  color: var(--text);
}
#btn-prefs-reset:hover { background: var(--surface2); }

/* ═══════════════════════════════════════════════════════════
   GYM FM — BARRA FLOTANTE GLOBAL
   ═══════════════════════════════════════════════════════════ */

/* Trigger mínimo en sidebar */
.gymfm-sidebar-trigger { position:relative; }
.gymfm-sidebar-badge {
  position:absolute; right:10px; top:50%; transform:translateY(-50%);
  font-size:0.65rem; color:var(--accent); font-weight:700;
  animation: gymfm-pulse 1s ease-in-out infinite alternate;
}
@keyframes gymfm-pulse { from{opacity:.4} to{opacity:1} }

/* ── Barra principal ── */
#gymfm-bar {
  position: fixed;
  bottom: 16px; right: 16px;
  left: unset; top: unset;
  width: 420px;
  min-width: 280px;
  max-width: 700px;
  z-index: 9999;
  display: none;
  flex-direction: column;
  background: var(--surface1, #16161f);
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  transition: max-height 0.32s cubic-bezier(.4,0,.2,1);
  max-height: 56px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

/* ── Handle de resize (esquina inferior izquierda) ── */
#gymfm-resize-handle {
  position: absolute;
  bottom: 0; left: 0;
  width: 18px; height: 18px;
  cursor: sw-resize;
  z-index: 10;
  touch-action: none;
  opacity: 0.4;
  transition: opacity .2s;
}
#gymfm-resize-handle:hover { opacity: 1; }
#gymfm-resize-handle::before {
  content: '';
  position: absolute;
  bottom: 4px; left: 4px;
  width: 10px; height: 10px;
  border-left: 2px solid var(--accent, #a855f7);
  border-bottom: 2px solid var(--accent, #a855f7);
  border-radius: 0 0 0 3px;
}
#gymfm-bar.gymfm-dragging {
  cursor: grabbing;
  transition: none;
  box-shadow: 0 16px 60px rgba(0,0,0,.8);
}
#gymfm-bar.gymfm-expanded {
  max-height: 620px;
}
#gymfm-bar.gymfm-bar-collapsed .gymfm-compact {
  opacity: 0.3;
  pointer-events: none;
}

/* Área de video dentro del panel */
.gymfm-video-area {
  width: 100%;
  background: #000;
  flex-shrink: 0;
  overflow: hidden;
  transition: height 0.3s ease;
}
.gymfm-video-area.gymfm-video-hidden {
  height: 0;
}
.gymfm-video-area:not(.gymfm-video-hidden) {
  height: 180px;
}
#gymfm-iframe-wrap {
  width: 100%; height: 100%;
}
#gymfm-iframe {
  width: 100%; height: 100%;
  border: none;
  display: block;
}

/* Canvas visualizer (dentro del panel, reemplaza el área de video en modo audio) */
#gymfm-canvas {
  display: none;
  width: 100%;
  height: 56px;
  border-radius: 0;
  background: var(--surface2, #1e1e2e);
  flex-shrink: 0;
}

/* ── Barra compacta ── */
.gymfm-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 10px 0 6px;
  flex-shrink: 0;
}
.gymfm-fab {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent, #00e5a0);
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform .15s;
  color: #000;
}
.gymfm-fab:hover { transform: scale(1.1); }
.gymfm-compact-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.gymfm-compact-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gymfm-compact-playlist {
  font-size: 0.65rem;
  color: var(--text-dim, rgba(255,255,255,.45));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gymfm-compact-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.gymfm-cb {
  background: var(--surface2, #1e1e2e);
  border: none;
  border-radius: 6px;
  color: var(--text, #fff);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background .12s, color .12s;
  flex-shrink: 0;
  padding: 0;
}
.gymfm-cb:hover { background: var(--surface3, #2a2a3e); color: var(--accent, #00e5a0); }
.gymfm-cb-play {
  background: var(--accent, #00e5a0);
  color: #000;
  border-radius: 50%;
  width: 34px; height: 34px;
  font-size: 0.95rem;
  font-weight: 700;
}
.gymfm-cb-play:hover { filter: brightness(1.12); }
.gymfm-vol-slider {
  width: 68px;
  accent-color: var(--accent, #00e5a0);
  cursor: pointer;
  height: 4px;
}
@media (max-width: 480px) {
  .gymfm-vol-slider { display: none; }
}

/* ── Panel expandido ── */
.gymfm-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  border-top: 1px solid var(--border, rgba(255,255,255,.08));
}

/* Modos */
.gymfm-modes {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
  overflow-x: auto;
  flex-shrink: 0;
}
.gymfm-mode-label {
  font-size: 0.7rem;
  color: var(--text-dim, rgba(255,255,255,.4));
  flex-shrink: 0;
}
.gymfm-mode-btn {
  background: var(--surface2, #1e1e2e);
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--text-dim, rgba(255,255,255,.55));
  font-size: 0.7rem;
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.gymfm-mode-btn:hover { color: var(--text, #fff); border-color: var(--accent, #00e5a0); }
.gymfm-mode-btn.gymfm-mode-active {
  background: var(--accent, #00e5a0);
  color: #000;
  font-weight: 700;
  border-color: transparent;
}

/* Lista scrolleable */
.gymfm-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}
.gymfm-list::-webkit-scrollbar { width: 4px; }
.gymfm-list::-webkit-scrollbar-thumb { background: var(--border, rgba(255,255,255,.15)); border-radius: 2px; }
.gymfm-list-loading {
  padding: 16px;
  font-size: 0.8rem;
  color: var(--text-dim, rgba(255,255,255,.4));
  text-align: center;
}
.gymfm-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background .1s;
  border-radius: 4px;
  margin: 0 4px;
}
.gymfm-list-item:hover { background: var(--surface2, #1e1e2e); }
.gymfm-list-item--active {
  background: var(--surface2, #1e1e2e);
  border-left: 3px solid var(--accent, #00e5a0);
}
.gymfm-list-num {
  font-size: 0.65rem;
  color: var(--text-dim, rgba(255,255,255,.3));
  width: 18px;
  text-align: right;
  flex-shrink: 0;
}
.gymfm-list-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.gymfm-list-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gymfm-list-pl {
  font-size: 0.62rem;
  color: var(--text-dim, rgba(255,255,255,.4));
}
.gymfm-list-dur {
  font-size: 0.65rem;
  color: var(--text-dim, rgba(255,255,255,.35));
  flex-shrink: 0;
}

/* ── Tabs de vista (Todos / Listas) ── */
.gymfm-view-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
  flex-shrink: 0;
}
.gymfm-view-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim, rgba(255,255,255,.4));
  font-size: 0.72rem;
  padding: 7px 4px;
  cursor: pointer;
  transition: all .15s;
  font-weight: 600;
}
.gymfm-view-tab:hover {
  color: var(--text, #fff);
}
.gymfm-view-tab--active {
  color: var(--accent, #00e5a0);
  border-bottom-color: var(--accent, #00e5a0);
}

/* ── Vista de playlists ── */
.gymfm-pl-group {
  margin: 0 4px 4px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border, rgba(255,255,255,.08));
}
.gymfm-pl-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  background: var(--surface2, #1e1e2e);
  border: none;
  width: 100%;
  text-align: left;
  color: var(--text, #fff);
  transition: background .12s;
}
.gymfm-pl-header:hover {
  background: var(--surface3, #2a2a3e);
}
.gymfm-pl-header-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
}
.gymfm-pl-header-label {
  flex: 1;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gymfm-pl-header-count {
  font-size: 0.65rem;
  color: var(--text-dim, rgba(255,255,255,.4));
  flex-shrink: 0;
}
.gymfm-pl-header-arrow {
  font-size: 0.7rem;
  color: var(--text-dim, rgba(255,255,255,.4));
  flex-shrink: 0;
  transition: transform .2s;
}
.gymfm-pl-group.gymfm-pl-open .gymfm-pl-header-arrow {
  transform: rotate(180deg);
}
.gymfm-pl-videos {
  display: none;
  flex-direction: column;
}
.gymfm-pl-group.gymfm-pl-open .gymfm-pl-videos {
  display: flex;
}

/* ═══════════════════════════════════════════════════════════
   TR3FLEX JUEGOS — FlappyHero
   ═══════════════════════════════════════════════════════════ */
.snav-item--game {
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  border-left-color: var(--accent) !important;
  animation: game-pulse 2s ease-in-out infinite;
}
@keyframes game-pulse {
  0%,100% { box-shadow: none; }
  50% { box-shadow: inset 0 0 12px var(--accent-glow); }
}

/* Modal del juego */
#game-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}
#game-modal-overlay.open { display: flex; }

#game-modal {
  position: relative;
  background: var(--surface1);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 0;
  max-width: 560px;
  width: 96vw;
  box-shadow: 0 0 40px var(--accent-glow);
  overflow: hidden;
}

#game-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--accent);
}

#game-close-btn {
  background: none;
  border: none;
  color: var(--fg);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
#game-close-btn:hover { background: var(--surface3); }

#game-canvas-wrap {
  position: relative;
  width: 100%;
  background: #0a0f1a;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

#game-ui {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}

#game-score-display {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  letter-spacing: 2px;
  pointer-events: none;
}

#game-overlay-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.72);
  pointer-events: all;
  gap: 10px;
}

#game-overlay-screen h2 {
  font-size: 26px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 3px;
  margin: 0;
  text-shadow: 0 0 20px var(--accent);
}
#game-overlay-screen p {
  font-size: 13px;
  color: #ccc;
  margin: 0;
}
#game-overlay-screen .game-best {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
}

#game-start-btn {
  margin-top: 8px;
  background: var(--accent);
  color: #000;
  border: none;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
  border-radius: 6px;
  cursor: pointer;
  pointer-events: all;
  transition: transform 0.1s, filter 0.1s;
}
#game-start-btn:hover { filter: brightness(1.15); transform: scale(1.04); }
#game-start-btn:active { transform: scale(0.97); }

#game-footer {
  padding: 8px 14px;
  font-size: 10px;
  color: var(--fg-dim);
  text-align: center;
  background: var(--surface2);
  border-top: 1px solid var(--border);
}

/* ── Botón JUEGOS footer (azul cyber-punk, espejo del botón CHAT) ── */
.footer-game-wrap {
  position: relative;
  display: inline-flex;
}
.footer-game-wrap .cpk-corner.cpk-b {
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: #00c8ff;
  border-style: solid;
  pointer-events: none;
  animation: cpkCornerPulseBlue 1.6s ease-in-out infinite;
  z-index: 1;
}
.footer-game-wrap .cpk-corner.cpk-b.tl { top: -4px; left: -4px; border-width: 2px 0 0 2px; }
.footer-game-wrap .cpk-corner.cpk-b.tr { top: -4px; right: -4px; border-width: 2px 2px 0 0; }
.footer-game-wrap .cpk-corner.cpk-b.bl { bottom: -4px; left: -4px; border-width: 0 0 2px 2px; }
.footer-game-wrap .cpk-corner.cpk-b.br { bottom: -4px; right: -4px; border-width: 0 2px 2px 0; }
@keyframes cpkCornerPulseBlue {
  0%, 100% { opacity: 0.65; }
  50%       { opacity: 1; filter: drop-shadow(0 0 3px #00c8ff); }
}
.footer-btn-game {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 3px;
  color: #000;
  border: none;
  border-radius: 3px;
  padding: 7px 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(90deg,
    #005f8a 0%, #00c8ff 20%, #7ef4ff 38%,
    #00c8ff 50%, #005f8a 65%, #00c8ff 80%, #7ef4ff 100%
  );
  background-size: 300% 100%;
  box-shadow:
    0 0 6px #00c8ff,
    0 0 18px rgba(0,200,255,.6),
    0 0 32px rgba(0,120,180,.4),
    inset 0 1px 0 rgba(180,255,255,.5),
    inset 0 -1px 0 rgba(0,40,80,.4);
  animation: cpkBlueSlide 2.2s linear infinite,
             cpkBlueGlowPulse 1.6s ease-in-out infinite,
             cpkGlitch 5s ease-in-out infinite;
}
.footer-btn-game::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 2px,
    rgba(0,0,0,.09) 2px, rgba(0,0,0,.09) 3px
  );
  animation: cpkScanMove 1.8s linear infinite;
  pointer-events: none;
  z-index: 1;
}
.footer-btn-game::after {
  content: '';
  position: absolute;
  top: 0; left: -80%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(180,255,255,.55) 50%, transparent 100%);
  transform: skewX(-15deg);
  animation: cpkFlashSweep 2.8s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}
.footer-btn-game .cpk-label {
  position: relative;
  z-index: 3;
  pointer-events: none;
  color: #001a2e;
}
.footer-btn-game .cpk-label::before {
  content: '🎮 ';
  opacity: .85;
  font-size: .8em;
  vertical-align: middle;
  animation: cpkBlink 1.1s step-end infinite;
}
@keyframes cpkBlueSlide {
  0%   { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}
@keyframes cpkBlueGlowPulse {
  0%, 100% {
    box-shadow: 0 0 6px #00c8ff, 0 0 16px rgba(0,200,255,.6),
                0 0 28px rgba(0,120,180,.4),
                inset 0 1px 0 rgba(180,255,255,.5), inset 0 -1px 0 rgba(0,40,80,.4);
  }
  50% {
    box-shadow: 0 0 10px #00c8ff, 0 0 28px rgba(0,200,255,.8),
                0 0 50px rgba(0,150,220,.6), 0 0 70px rgba(0,100,180,.35),
                inset 0 1px 0 rgba(180,255,255,.7), inset 0 -1px 0 rgba(0,40,80,.4);
  }
}
.footer-btn-game:hover {
  animation: cpkBlueSlide .8s linear infinite,
             cpkBlueGlowPulse .5s ease-in-out infinite,
             cpkGlitch 5s ease-in-out infinite;
  transform: scale(1.07);
  letter-spacing: 4px;
  transition: transform .1s, letter-spacing .1s;
  filter: brightness(1.15);
}
.footer-btn-game:active { transform: scale(0.96); animation: none; }

/* ── Modal de auth limpio (sin header ni tabs) ───────────────── */
.tr3-modal.auth-modal-clean {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 420px;
  width: 100%;
  margin: auto;
}
.auth-hola-img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: block;
  flex-shrink: 0;
}
#auth-modal-body {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 70vh;
}
.auth-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  background: rgba(0,0,0,0.55);
  border: none;
  color: #fff;
  font-size: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s;
}
.auth-close-btn:hover { background: #ff1a1a; }
.reg-welcome-wrap {
  text-align: center;
}
.reg-welcome-field {
  text-align: left;
  margin-top: 8px;
}

/* ── Step 1 Smart Login/Register ─────────────────────────────── */
.s1-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2, rgba(255,255,255,0.07));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 8px;
  animation: s1CardIn 0.2s ease;
}
@keyframes s1CardIn {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}
.s1-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  background: var(--surface);
  flex-shrink: 0;
}
.s1-found-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

/* ── Step 4: Recuperación de cuenta ─────────────────────────── */
.reg-security-intro {
  text-align: center;
  padding: 4px 0 8px;
}
.reg-security-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 4px;
}
.tr3-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23999' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.tr3-select:focus {
  outline: none;
  border-color: var(--accent);
}
