/* ============================================================
   Canal QC — Estilos (dark theme, Telegram-inspired)
   ============================================================ */

:root {
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --bg:          #0a0c18;
  --surface:     #1d2b3c;
  --surface2:    #242f3d;
  --surface3:    #2d3748;
  --primary:     #7c3aed;
  --primary-dim: rgba(124,58,237,0.15);
  --text:        #e2e8f0;
  --subtext:     #94a3b8;
  --border:      #2d3748;
  --danger:      #ef4444;
  --success:     #22c55e;
  --input-bg:    #0c1320;              /* recessed: más oscuro que --surface2 (campo hundido) */
  --live:        #ec4899;              /* acento "en línea/activo" — magenta QueensClub */
  --live-dim:    rgba(236,72,153,0.15);
  --header-h:    60px;
  --bar-h:       60px;
  --nav-h:       56px;
  --nav-float:   8px;
  --pinned-h:    52px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* ── Type scale (iOS/Telegram ramp) ── */
  --fs-caption2: 11px;
  --fs-caption:  12px;
  --fs-footnote: 13px;
  --fs-subhead:  14px;
  --fs-body:     15px;
  --fs-headline: 17px;
  --fs-title3:   20px;

  /* ── Font weights ── */
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* ── Line heights ── */
  --lh-tight: 1.2;
  --lh-snug:  1.35;
  --lh-base:  1.5;

  /* ── Spacing scale (múltiplos de 4px) ── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;

  /* ── Animation easings ── */
  --ease-out:      cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-in-out:   cubic-bezier(0.4, 0, 0.2, 1);
  --ease-linear:   linear;

  /* ── Animation durations ── */
  --t-fast:    120ms;
  --t-base:    200ms;
  --t-slow:    320ms;
  --t-slowest: 500ms;
}

/* ── Reset ─────────────────────────────────────────────────── */

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

html {
  background-color: #0a0c18;
  background-image: radial-gradient(ellipse 120% 85% at 50% 28%, #321666 0%, #130a2e 38%, #0a0c18 100%);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: #0a0c18;
  background-image: radial-gradient(
    ellipse 120% 85% at 50% 28%,
    #321666 0%,
    #130a2e 38%,
    #0a0c18 100%
  );
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input, textarea, [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; touch-action: manipulation; }
a      { color: var(--primary); text-decoration: none; touch-action: manipulation; }
img, video { display: block; max-width: 100%; }

/* Refuerzo en contenedores scrollables: solo pan vertical, sin zoom */
#feed-container,
#comments-list,
.app-section.active { touch-action: pan-y; }

.hidden { display: none !important; }

/* ── Loading ───────────────────────────────────────────────── */

#screen-loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  transition: opacity 0.35s var(--ease-out);
}
#screen-loading.is-hiding {
  opacity: 0;
  pointer-events: none;
}
#loading-logo-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.loading-logo-wrap {
  position: relative;
  overflow: hidden;
  width: 160px;
  height: 160px;
  transform-origin: center;
  transition: transform 0.55s cubic-bezier(0.34, 1.2, 0.64, 1);
  -webkit-mask-image: url('../icons/icon-loading.png');
  mask-image: url('../icons/icon-loading.png');
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}
.loading-logo-wrap.is-flying::after {
  animation: none;
  opacity: 0;
}
.loading-logo {
  width: 160px;
  height: 160px;
  display: block;
  filter: brightness(0.4);
  animation: logo-fade-in 0.4s var(--ease-out) both;
  transition: filter 0.4s var(--ease-out);
}
.loading-logo-wrap.is-flying .loading-logo {
  filter: brightness(1);
}
.loading-logo-wrap::after {
  content: '';
  position: absolute;
  top: -20%; left: 0;
  width: 80%; height: 140%;
  background: linear-gradient(
    to right,
    transparent       0%,
    rgba(255,255,255,0.15) 20%,
    rgba(255,255,255,0.9)  45%,
    rgba(255,255,255,1.0)  50%,
    rgba(255,255,255,0.9)  55%,
    rgba(255,255,255,0.15) 80%,
    transparent       100%
  );
  mix-blend-mode: screen;
  transform: skewX(-12deg) translateX(-200%);
  filter: blur(6px);
  animation: logo-shimmer 1.1s cubic-bezier(0.4, 0, 0.6, 1) 0.15s 1;
  will-change: transform;
}
@keyframes app-enter {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
#app.is-entering {
  animation: app-enter 0.45s var(--ease-out) both;
}
@keyframes logo-fade-in {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes logo-shimmer {
  from { transform: skewX(-12deg) translateX(-130%); }
  to   { transform: skewX(-12deg) translateX(180%); }
}

/* ── App shell ─────────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
  padding-top: calc(var(--safe-top) + var(--header-h));
}

/* ── Header ────────────────────────────────────────────────── */

.main-header {
  position: fixed;
  top: 0;
  left: 0; right: 0;
  padding: calc(var(--safe-top) + 6px) 16px 6px;
  background: rgba(17, 22, 30, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 0.5px solid rgba(255,255,255,0.10);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: background 0.15s;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
}

.header-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(14, 8, 32, 0.97);
  border: 0.5px solid rgba(255,255,255,0.10);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  flex-shrink: 0;
}

.header-title {
  color: var(--text);
  font-size: var(--fs-headline);
  font-weight: var(--fw-bold);
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.header-logo {
  height: 24px;
  width: auto;
  display: block;
  margin: 0 auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-action {
  background: transparent;
  border: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding: 0;
  color: var(--subtext);
  transition: color 0.2s ease, background 0.15s;
}
.btn-action:hover { color: var(--text); background: var(--surface2); }
.btn-action:active { color: var(--text); background: var(--surface3); }
.btn-action[data-status="granted"] { color: var(--primary); }

.header-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--subtext);
  font-size: var(--fs-caption);
  padding-bottom: 2px;
}

.separator { opacity: 0.5; }

.followers-count::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--live);
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.header-user  { display: none; }
.admin-badge  {
  font-size: var(--fs-caption2); font-weight: var(--fw-bold); letter-spacing: 0.05em;
  background: var(--primary); color: #fff;
  padding: 1px 5px; border-radius: 4px; vertical-align: middle;
}

/* ── Feed ──────────────────────────────────────────────────── */

#feed-container {
  padding-bottom: calc(var(--bar-h) + var(--nav-h) + var(--safe-bottom) + 16px);
}

#feed {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px 8px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.feed-empty {
  text-align: center; color: var(--subtext);
  padding: 3rem 1rem; font-size: 0.9rem;
}

#feed-sentinel { height: 1px; }

/* ── Bottom bar ────────────────────────────────────────────── */

#app { position: relative; }

#bottom-bar {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px); left: 0; right: 0;
  z-index: 60;
  background: rgba(14, 8, 32, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
#bottom-input-row {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

#reply-context {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: var(--primary-dim);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
  font-size: 0.75rem;
  color: var(--subtext);
  white-space: nowrap;
  overflow: hidden;
}

.reply-icon { color: var(--primary); flex-shrink: 0; }

#reply-to-title {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

#reply-context-close {
  flex-shrink: 0;
  color: var(--subtext);
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 4px;
  transition: color var(--t-fast);
}
#reply-context-close:hover { color: var(--text); }

/* ── Comment quote (cita inline estilo Telegram) ───────────── */

.comment-quote {
  border-left: 3px solid var(--primary);
  padding: 4px 8px;
  border-radius: 0 6px 6px 0;
  background: rgba(255,255,255,0.06);
  margin-bottom: 5px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.comment-quote:hover { background: rgba(255,255,255,0.10); }
.comment-quote-author {
  display: block;
  font-size: var(--fs-caption2);
  font-weight: var(--fw-semibold);
  color: var(--primary);
  margin-bottom: 2px;
}
.comment-quote-text {
  display: block;
  font-size: var(--fs-caption2);
  color: var(--subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Flash highlight al navegar a un comentario citado */
.comment--highlight .comment-bubble {
  background: rgba(124, 58, 237, 0.25);
  transition: background 1.2s ease-out;
}

/* Flash highlight al navegar a un post vía deep link o banner in-app */
.post--highlight .post-bubble {
  background: rgba(124, 58, 237, 0.25);
  transition: background 1.2s ease-out;
}

#comment-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  outline: none;
  transition: border-color var(--t-fast), background var(--t-fast);
  min-width: 0;
  /* textarea */
  resize: none;
  overflow-y: hidden;
  max-height: 120px;
  display: block;
  /* field-sizing: Chrome 123+ native auto-resize; JS fallback handles the rest */
  field-sizing: content;
}
#comment-input:focus { border-color: var(--primary); background: var(--surface3); }
#comment-input::placeholder { color: var(--subtext); }
#comment-input:disabled { opacity: 0.5; }

#btn-send-comment {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transform: scale(0);
  transform-origin: center;
  transition: opacity var(--t-fast), transform var(--t-base) var(--ease-out-back);
}
#bottom-input-row.has-text #btn-send-comment { transform: scale(1); }
#bottom-input-row.has-text #btn-send-comment:active { transform: scale(0.92); transition: none; }
#btn-send-comment:hover  { opacity: 0.85; }
#btn-send-comment:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Date separator (Telegram-style pill) ──────────────────── */

.date-separator {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 6px 0;
  pointer-events: none;
  user-select: none;
}
.date-separator span {
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 12px;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

/* ── Post ──────────────────────────────────────────────────── */

.post-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 3px 0;
}

.post-pinned-wrap .post-bubble {
  border-left: 3px solid var(--primary);
}

.pin-badge {
  display: flex; align-items: center; gap: 4px;
  font-size: var(--fs-caption2); color: var(--primary);
  font-weight: var(--fw-semibold); padding: 0 4px;
  letter-spacing: 0.02em;
}
.pin-badge svg,
.pinned-bar-label svg {
  transform: rotate(45deg);
  flex-shrink: 0;
}

.post-bubble {
  min-width: 200px;
  max-width: 85%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 60%),
    rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 12px 12px 12px 4px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* Media posts: fixed width to avoid fit-content circular dependency with images */
.post-bubble:has(.post-media-wrap) {
  width: 85%;
}

.post-tipo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-caption2); font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--primary); background: var(--primary-dim);
  padding: 4px 10px;
  border-radius: 0 0 8px 0;
}

.post-media-wrap { width: 100%; position: relative; }
.post-media {
  display: block;
  width: 100%; height: auto;
  object-fit: contain; background: #000;
}
video.post-media { aspect-ratio: 9 / 16; object-fit: cover; }

.post-titulo {
  font-size: var(--fs-headline); font-weight: var(--fw-bold);
  color: var(--text);
  padding: 12px 14px 4px;
  line-height: var(--lh-tight);
}

.post-contenido {
  font-size: var(--fs-footnote); color: var(--subtext);
  padding: 0 14px 12px;
  line-height: var(--lh-snug); white-space: pre-wrap; word-break: break-word;
}

/* ── Post meta row (reactions + time) ─────────────────────── */

.post-meta-row {
  display: flex;
  align-items: center;
  padding: 6px 10px 8px;
  gap: 8px;
}

.post-reactions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

/* Sin reacciones: ocultar la fila completa */
.post-reactions:not(:has(.reaction-btn.has-count)) {
  display: none;
}

.post-meta-time {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.reaction-btn {
  display: none;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 12px;
  background: var(--surface2);
  font-size: var(--fs-caption);
  position: relative;
  color: var(--subtext);
  transition: background 0.15s, transform 0.1s;
  border: 1px solid transparent;
  line-height: 1;
}
.reaction-btn.has-count { display: inline-flex; }

@keyframes count-pop {
  from { transform: translateY(-3px); opacity: 0.5; }
  to   { transform: none; opacity: 1; }
}
.r-count.count-popping { animation: count-pop var(--t-fast) var(--ease-out); }
.reaction-btn:hover  { background: var(--surface3); }
.reaction-btn:active { transform: scale(0.92); }
.reaction-btn.reacted {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
}

.r-emoji  { font-size: var(--fs-subhead); line-height: 1; }
.r-count  { font-size: var(--fs-caption); font-weight: var(--fw-semibold); min-width: 0; }
.r-count:empty { display: none; }

/* Touch targets mínimos WCAG 2.5.5 (44×44px) sin afectar layout visual */
.reaction-btn::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
}

/* ── Reaction picker flotante (Telegram-style) ──────────────── */

#rxn-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.35);
  -webkit-tap-highlight-color: transparent;
}
#rxn-backdrop.open { display: block; }

#rxn-picker {
  display: none;
  position: fixed;
  z-index: 301;
  flex-direction: row;
  gap: 2px;
  padding: 8px 10px;
  background: rgba(22, 27, 40, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.25);
  max-width: min(calc(100vw - 24px), 310px);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
#rxn-picker::-webkit-scrollbar { display: none; }
#rxn-picker.open {
  display: flex;
  animation: rxn-picker-pop 0.28s var(--ease-out-back) forwards;
}
@keyframes rxn-picker-pop {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

.rxn-btn {
  font-size: 28px;
  line-height: 1;
  padding: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease-out-back), background 0.1s;
  animation: rxn-btn-pop 0.25s var(--ease-out-back) both;
}
@keyframes rxn-btn-pop {
  from { opacity: 0; transform: scale(0.4) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.rxn-btn:active { transform: scale(0.8); }
.rxn-btn.reacted {
  background: var(--primary-dim);
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}

/* Burbuja atenuada mientras el picker está abierto */
.post-bubble.rxn-open {
  opacity: 0.65;
  transform: scale(0.97);
  transition: opacity 0.15s, transform 0.15s var(--ease-out);
}

.post-views, .post-time {
  font-size: var(--fs-caption2);
  color: var(--subtext);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ── Comments footer (Telegram card-footer pattern) ────────── */

.post-comments-footer {
  border-top: 1px solid var(--border);
}

.btn-comments-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  color: var(--primary);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  padding: 10px 14px;
  transition: background 0.15s;
}
.btn-comments-inline:active { background: var(--surface2); }

.post-comment-count { font-weight: var(--fw-semibold); }

.post-comment-label { opacity: 0.9; }

.comments-chevron {
  margin-left: auto;
  opacity: 0.5;
  flex-shrink: 0;
}

/* lock icon: oculto por defecto, visible cuando comentarios cerrados */
.comments-lock-icon { display: none; }

.btn-comments-inline[data-comments-closed="true"] {
  color: var(--subtext);
  opacity: 0.6;
}
.btn-comments-inline[data-comments-closed="true"] .comments-lock-icon { display: inline-flex; }
.btn-comments-inline[data-comments-closed="true"] .comments-chevron  { display: none; }

/* Banner "Comentarios cerrados" en la vista de comentarios */
#comments-closed-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: var(--fs-caption);
  color: var(--subtext);
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
}
#comments-closed-banner.hidden { display: none; }

/* ── Skeleton ──────────────────────────────────────────────── */

.skeleton-list { display: flex; flex-direction: column; gap: 12px; padding: 12px 0; }

.skeleton-post {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
}

/* Shimmer sweep (reemplaza pulse) */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skel {
  background: linear-gradient(90deg, var(--surface2) 0%, var(--surface3) 50%, var(--surface2) 100%);
  background-size: 1200px 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: 8px;
}
.skel-media  { height: 200px; border-radius: 0; }
.skel-title  { height: 18px; width: 70%; margin: 12px; }
.skel-body   { height: 14px; width: 90%; margin: 0 12px 12px; }

/* Sección Historias — skeleton grid */
.section-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px; padding: 4px;
}
.skel-guardado-item { aspect-ratio: 4 / 5; border-radius: 8px; }

/* Sección Ganadores — skeleton lista */
.skel-ganador-card {
  padding: 14px 0;
  display: flex; flex-direction: column; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.skel-ganador-header { height: 18px; width: 55%; }
.skel-ganador-names  { height: 14px; width: 35%; }

/* Sección FAQ — skeleton acordeón */
.skel-faq-row { height: 52px; border-radius: 12px; margin-bottom: 6px; }

/* Comments — skeleton burbujas */
.skel-comments { display: flex; flex-direction: column; gap: 12px; padding: 12px 0; }
.skel-comment-bubble { height: 56px; border-radius: 12px; }
.skel-comment-bubble:nth-child(1) { width: 72%; }
.skel-comment-bubble:nth-child(2) { width: 55%; }
.skel-comment-bubble:nth-child(3) { width: 80%; }

/* ── Animaciones de entrada — nuevos posts y comentarios ───── */

@keyframes post-flash-new {
  0%   { background: rgba(124, 58, 237, 0.18); }
  100% { background: transparent; }
}
.post-wrap.is-new { animation: post-flash-new 1.2s var(--ease-out) forwards; }

@keyframes comment-slide-in {
  from { transform: translateY(8px) scale(0.96); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.comment-item.is-new { animation: comment-slide-in var(--t-base) var(--ease-out-back) forwards; }

/* ── Comments — discussion view (Telegram-style) ──────────── */

#app.in-comments { padding-top: 0 !important; }
#app.in-comments #app-header  { display: none; }
#app.in-comments #bottom-nav  { transform: translateY(100%); }
#app.in-comments #bottom-bar  { bottom: 0; padding-bottom: calc(8px + var(--safe-bottom)); z-index: 66; }
#app.in-comments #btn-compose { display: none; }

/* #section-comments is always mounted (overrides .app-section { display:none })
   and controlled via transform so CSS transitions work correctly. */
#section-comments {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
  position: fixed;
  inset: 0;
  background-color: #0a0c18;
  background-image: url('/icons/chat-pattern.png');
  background-repeat: repeat;
  background-size: 256px;
  z-index: 65;
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s linear 0.28s;
}

#section-comments.active {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s linear 0s;
}

.comments-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-top) + 10px) 14px 10px;
  background: rgba(14, 8, 32, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  height: calc(var(--header-h) + var(--safe-top));
}

#btn-back-comments {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  flex-shrink: 0;
  transition: background 0.15s;
}
#btn-back-comments:hover { background: var(--surface2); }

.comments-header-info {
  flex: 1;
  min-width: 0;
}

#comments-count-title {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comments-header-sub {
  font-size: 0.72rem;
  color: var(--subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

#comments-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px calc(var(--bar-h) + var(--safe-bottom) + 12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comments-loading, .no-comments {
  text-align: center; color: var(--subtext);
  font-size: 0.85rem; padding: 2rem 0;
}

/* ── Replicated post card (first element of comments list) ─── */

.comment-post-card {
  background: rgba(255,255,255,0.16);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 4px;
}
.cpc-tipo {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-caption2);
  color: var(--primary);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.cpc-titulo {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--text);
  line-height: var(--lh-snug);
  margin-bottom: 4px;
}
.cpc-contenido {
  font-size: var(--fs-footnote);
  color: var(--subtext);
  line-height: var(--lh-snug);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.cpc-media {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 6px;
}
.cpc-fecha {
  font-size: var(--fs-caption2);
  color: var(--subtext);
}

/* ── "↓ N nuevos" badge over input bar ────────────────────── */

#comments-scroll-btn {
  position: absolute;
  right: 16px;
  bottom: 80px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  padding: 6px 12px 6px 10px;
  font-size: var(--fs-footnote);
  font-weight: var(--fw-semibold);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  transition: opacity var(--t-fast), transform var(--t-base) var(--ease-out-back);
  z-index: 10;
}
#comments-scroll-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

/* ── Comment bubble ────────────────────────────────────────── */

.comment {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.comment-bubble {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04) 0%, transparent 60%),
    rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px 12px 12px 4px;
  padding: 8px 12px;
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  max-width: 88%;
}

.comment-apodo {
  font-size: var(--fs-footnote); font-weight: var(--fw-semibold);
  color: var(--primary);
}

.comment-texto {
  font-size: var(--fs-footnote); color: var(--text);
  word-break: break-word; line-height: var(--lh-snug);
}

.comment-time {
  font-size: var(--fs-caption2); color: var(--subtext);
  align-self: flex-end;
}

.comment-bubble--deleted {
  background: transparent;
  border-color: rgba(255,255,255,0.06);
}
.comment-deleted {
  font-size: var(--fs-footnote);
  color: var(--subtext);
  font-style: italic;
  padding: 2px 0;
}

/* ── Bottom nav ────────────────────────────────────────────── */

#bottom-nav {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  z-index: 60;
  background: rgba(17, 22, 30, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px 20px 0 0;
  border: 0.5px solid rgba(255,255,255,0.10);
  border-bottom: none;
  box-shadow: 0 -2px 16px rgba(0,0,0,0.28);
  display: flex;
  align-items: flex-start;
  padding-top: 0;
  transition: transform 0.2s ease;
}

.nav-tab {
  flex: 1;
  height: var(--nav-h);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--subtext);
  font-size: var(--fs-caption2);
  font-weight: var(--fw-medium);
  transition: color 0.18s;
}

.nav-tab.active { color: var(--primary); font-weight: var(--fw-semibold); }

.nav-tab:hover:not(.active) { color: var(--text); }

/* Filled/outline icon toggle */
.nav-icon-filled { display: none; }
.nav-tab.active .nav-icon-outline { display: none; }
.nav-tab.active .nav-icon-filled  { display: block; }

/* Press scale */
.nav-tab .nav-icon { transition: transform var(--t-fast); }
.nav-tab:active .nav-icon { transform: scale(0.92); transition: none; }

/* Bounce on tab activation */
@keyframes nav-bounce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.nav-tab.bouncing .nav-icon-filled { animation: nav-bounce 280ms var(--ease-out-back); }

/* Badge dot — posts nuevos en Chat */
.nav-chat-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 5px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  border: 1.5px solid #0a0c18;
  pointer-events: none;
}
.nav-chat-badge.hidden { display: none; }

/* ── Sections ──────────────────────────────────────────────── */

.app-section { display: none; }

.app-section.active {
  display: block;
  flex: none;
  min-height: 0;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
}

#section-guardado {
  background: #0a0c18;
  transition: opacity 0.22s ease-out;
}
#section-guardado.is-loading {
  opacity: 0;
  transition: none;  /* hide instantáneo — evita flash del contenido viejo */
}
body:has(#section-guardado.active) { background-image: none; }

#section-chat.is-loading {
  opacity: 0;
}

body:has(#section-chat.active) #app {
  background-image: url('/icons/chat-pattern.png');
  background-repeat: repeat;
  background-size: 256px;
  background-color: #0a0c18;
}

#section-ganadores,
#section-faq,
#section-actividad {
  background: #0a0c18;    /* fondo sólido — sin gradiente radial (igual que #section-guardado) */
  transition: opacity 0.22s ease-out;
}
body:has(#section-ganadores.active),
body:has(#section-faq.active),
body:has(#section-actividad.active) { background-image: none; }

#section-ganadores.is-loading,
#section-faq.is-loading {
  opacity: 0;
  transition: none;
}


#section-chat.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding-bottom: 0;
  min-height: 0;
}

/* ── Pinned bar (Telegram-style) ───────────────────────────── */

@keyframes pinned-slide-in {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
#pinned-bar {
  position: fixed;
  top: calc(var(--safe-top) + var(--header-h) + 8px);
  left: 12px; right: 12px;
  z-index: 59;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 10px;
  background: rgba(17, 22, 30, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  border: 0.5px solid rgba(255,255,255,0.10);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
#pinned-bar.slide-in { animation: pinned-slide-in var(--t-slow) var(--ease-out-back); }
#pinned-bar:hover { background: rgba(28, 34, 44, 0.97); }
#pinned-bar.hidden { display: none; }

#pinned-bar:not(.hidden) ~ #feed-container {
  padding-top: calc(var(--pinned-h) + 8px);
}
.pinned-bar-accent {
  width: 3px;
  min-height: 30px;
  border-radius: 2px;
  background: var(--primary);
  flex-shrink: 0;
}
.pinned-bar-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pinned-bar-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.2;
}
.pinned-bar-title {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
#pinned-bar-close {
  color: var(--subtext);
  font-size: 0.8rem;
  padding: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
#pinned-bar-close:hover { background: var(--surface3); color: var(--text); }

.section-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.section-header h2 { font-size: 1rem; font-weight: 700; }
.section-header p  { font-size: 0.8rem; color: var(--subtext); margin-top: 2px; }

.section-loading, .section-empty {
  text-align: center; color: var(--subtext);
  font-size: 0.88rem; padding: 3rem 1rem;
}

/* ── Historias: Profile header ─────────────────────────────── */

#historias-header {
  padding: 20px var(--sp-4) var(--sp-3);
}

/* ── Banner slider ──────────────────────────────────────── */

#historias-banners-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--sp-3);
}

#historias-banners-track {
  width: 100%;
  aspect-ratio: 1920 / 1180;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface2);
}

.historias-banner-slide {
  height: 100%;
  position: relative;
  overflow: hidden;
  background: var(--surface2);
}
.historias-banner-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.historias-banner-link {
  display: block;
  width: 100%;
  height: 100%;
}
.historias-banner-title {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px 8px 5px;
  font-size: var(--fs-caption2);
  font-weight: var(--fw-semibold);
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.historias-banner-delete {
  position: absolute;
  top: 5px; right: 5px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.historias-banner-empty {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--subtext);
  font-size: var(--fs-caption);
  border: 1px dashed var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.historias-banner-empty:hover { border-color: var(--primary); color: var(--text); }

/* Dots row */
#historias-banners-dots-row {
  display: flex;
  align-items: center;
  height: 10px;
}
#historias-banners-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 1;
  justify-content: center;
}
.historias-banner-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transition: background var(--t-fast), width var(--t-fast), border-radius var(--t-fast);
}
.historias-banner-dot.active {
  background: #fff;
  width: 12px;
  border-radius: 3px;
}
#historias-banner-add-btn {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--subtext);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
#historias-banner-add-btn:hover { background: rgba(255,255,255,0.15); color: var(--text); }

/* ── Upload desde dispositivo ───────────────────────────────── */

.media-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.media-input-row .form-input,
.media-input-row #historias-banner-url {
  flex: 1;
  min-width: 0;
  width: auto;
}
.btn-upload-media {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--subtext);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.btn-upload-media:active {
  background: var(--primary-dim);
  color: var(--primary);
  border-color: var(--primary);
}
.upload-status {
  font-size: var(--fs-caption);
  color: var(--subtext);
  margin-top: 4px;
}
.upload-status.hidden    { display: none; }
.upload-status--ok  { color: var(--success); }
.upload-status--err { color: var(--danger); }

/* ── Upload progress bar ───────────────────────────────────── */
.upload-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.upload-progress.hidden { display: none; }
.upload-progress-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--surface3);
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.15s linear;
}
.upload-progress-pct {
  font-size: var(--fs-caption2);
  color: var(--subtext);
  min-width: 30px;
  text-align: right;
}

/* ── Media preview en compose form ────────────────────────── */
.compose-media-preview {
  position: relative;
  margin-top: 8px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface2);
}
.compose-media-preview.hidden { display: none; }
.compose-media-preview img,
.compose-media-preview video {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
}
.compose-media-preview video { background: #000; }
.compose-preview-clear {
  position: absolute;
  top: 6px; right: 6px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}

/* ── In-app post notification banner ──────────────────────── */
#post-notif {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 10px);
  left: 12px;
  right: 12px;
  background: var(--surface2);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  z-index: 300;
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  transform: translateY(calc(100% + var(--nav-h) + var(--safe-bottom) + 10px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s;
  -webkit-user-select: none; user-select: none;
}
/* Cuando el FAB del chatbot está visible, el banner no cubre el botón */
body:has(#chatbot-fab:not(.hidden)) #post-notif {
  right: calc(16px + 52px + 8px);
}
#post-notif.pn-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.post-notif-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.post-notif-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.post-notif-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.post-notif-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-notif-chevron { color: var(--text3); flex-shrink: 0; }

/* Thumbnail picker (video upload) */
.thumb-picker {
  padding: 10px 0 4px;
}
.thumb-picker-label {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding: 0 2px;
}
.thumb-picker-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}
.thumb-option {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.15s, border-color 0.15s;
}
.thumb-option.selected {
  border-color: var(--accent);
  opacity: 1;
}
.thumb-option:not(.selected):active { opacity: 0.8; }

/* Banner add form */
#historias-banner-form {
  background: var(--surface2);
  border-radius: 10px;
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
#historias-banner-url,
#historias-banner-titulo,
#historias-banner-link {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--sp-2) var(--sp-3);
  color: var(--text);
}
#historias-banner-url:focus,
#historias-banner-titulo:focus,
#historias-banner-link:focus { outline: none; border-color: var(--primary); }
.historias-banner-form-btns {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}
.historias-banner-form-btns button {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: var(--fs-footnote);
  font-weight: var(--fw-medium);
}
#historias-banner-cancel { background: var(--surface3); color: var(--subtext); }
#historias-banner-save   { background: var(--primary);  color: #fff; }
#historias-banner-save:disabled { opacity: 0.6; }

/* Bio */
#historias-bio-view {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  min-height: 18px;
}
#historias-bio-content {
  flex: 1;
  min-width: 0;
  position: relative;
}
#historias-bio-text {
  display: block;
  font-size: var(--fs-footnote);
  line-height: var(--lh-base);
  white-space: pre-wrap;
}
#historias-bio-more.hidden { display: none; }
#historias-bio-content.bio-has-more #historias-bio-more {
  position: absolute;
  bottom: 0;
  right: 0;
  margin: 0;
  padding-left: 40px;
  background: linear-gradient(to right, transparent, #0a0c18 45%);
}

/* ── Links area ─────────────────────────────────────────── */

#historias-links-area {
  margin-bottom: var(--sp-3);
}
.historias-link-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.historias-link-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 1;
  min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--sp-2) var(--sp-3);
  color: var(--text);
  text-decoration: none;
  font-size: var(--fs-footnote);
}
.historias-link-btn svg { flex-shrink: 0; color: var(--primary); }
.historias-link-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.historias-links-more {
  flex-shrink: 0;
  background: var(--surface3);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: var(--fs-caption);
  color: var(--text);
  white-space: nowrap;
}
.historias-link-add-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  background: var(--surface2);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: var(--sp-2) var(--sp-3);
  color: var(--subtext);
  font-size: var(--fs-footnote);
  margin-bottom: var(--sp-2);
}
.historias-link-delete {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface3);
  color: var(--subtext);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.historias-link-delete:active { background: rgba(239,68,68,0.3); color: var(--danger); }

/* link add form */
#historias-link-form {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
#historias-link-form.hidden { display: none; }
#historias-link-url,
#historias-link-titulo {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--sp-2) var(--sp-3);
  color: var(--text);
}
#historias-link-url:focus,
#historias-link-titulo:focus { outline: none; border-color: var(--primary); }
#historias-link-cancel { background: var(--surface3); color: var(--subtext); }
#historias-link-save   { background: var(--primary);  color: #fff; }
#historias-link-save:disabled { opacity: 0.6; }

/* ── Links bottom sheet ─────────────────────────────────── */

.links-sheet-title {
  font-size: var(--fs-subhead);
  font-weight: var(--fw-semibold);
  padding: 0 var(--sp-4) var(--sp-3);
  color: var(--text);
}
.links-sheet-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  text-decoration: none;
  color: var(--text);
  border-top: 1px solid var(--border);
}
.links-sheet-item svg { color: var(--primary); flex-shrink: 0; }
.links-sheet-item-info { flex: 1; min-width: 0; }
.links-sheet-item-title {
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.links-sheet-item-url {
  font-size: var(--fs-footnote);
  color: var(--subtext);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#historias-bio-edit-btn {
  color: var(--subtext);
  padding: 2px;
  flex-shrink: 0;
  margin-top: 2px;
  transition: color var(--t-fast);
}
#historias-bio-edit-btn:hover { color: var(--text); }

#historias-bio-form { margin-bottom: var(--sp-3); }
#historias-bio-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--sp-2) var(--sp-3);
  color: var(--text);
  line-height: var(--lh-base);
  resize: none;
  margin-bottom: var(--sp-2);
}
#historias-bio-input:focus { outline: none; border-color: var(--primary); }

.historias-bio-form-btns {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}
.historias-bio-form-btns button {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: var(--fs-footnote);
  font-weight: var(--fw-medium);
}
#historias-bio-cancel { background: var(--surface2); color: var(--subtext); }
#historias-bio-save   { background: var(--primary);  color: #fff; }
#historias-bio-save:disabled { opacity: 0.6; }

/* Action buttons */
#historias-actions {
  display: flex;
  gap: var(--sp-2);
}
.historias-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  padding: 8px;
  border-radius: 8px;
  font-size: var(--fs-footnote);
  font-weight: var(--fw-semibold);
}
.historias-btn-primary  { background: var(--primary); color: #fff; }
.historias-btn-secondary { background: var(--surface2); color: var(--text); }

/* ── Historias: Highlights row ──────────────────────────────── */

#historias-highlights {
  display: flex;
  gap: 16px;
  padding: var(--sp-3) var(--sp-4);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
#historias-highlights::-webkit-scrollbar { display: none; }

.historias-hl {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 0;
}
.historias-hl-filter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
}
.historias-hl-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.12);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  transition: border-color var(--t-base) var(--ease-out),
              border-width  var(--t-base) var(--ease-out);
}
.historias-hl.active .historias-hl-circle {
  border-color: var(--primary);
  border-width: 2.5px;
}
.historias-hl-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.historias-hl-emoji { font-size: 1.5rem; }
.historias-hl-label {
  font-size: var(--fs-caption2);
  color: var(--subtext);
  max-width: 64px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--t-base);
}
.historias-hl.active .historias-hl-label { color: var(--text); }

.historias-hl-create .historias-hl-circle {
  border-style: dashed;
  border-color: rgba(255,255,255,0.28);
  background: transparent;
}

.historias-hl-delete {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(15,17,28,0.88);
  border: 1.5px solid rgba(255,255,255,0.15);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  flex-shrink: 0;
}
.historias-hl-delete:active { background: rgba(239,68,68,0.5); }

/* ── Highlight create form ──────────────────────────────── */

/* ── Historias grid upload button ──────────────────────────── */
#historias-grid-actions {
  display: flex;
  justify-content: flex-end;
  padding: 6px 12px 2px;
}
#historias-grid-actions.hidden { display: none; }
#historias-grid-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}
#historias-grid-upload-btn:active { opacity: 0.8; }

/* ── Historias upload sheet ────────────────────────────────── */
.historias-upload-filelabel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  color: var(--subtext);
  font-size: var(--fs-body);
  cursor: pointer;
  margin-top: 4px;
}
.historias-upload-filelabel:active { background: var(--surface3); }

#story-upload-queue {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  max-height: 280px;
  overflow-y: auto;
}
.story-queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 8px;
}
.story-queue-item--error { border: 1px solid rgba(220,38,38,0.4); }
.story-queue-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #000;
}
.story-queue-thumb-el { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-queue-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.story-queue-progress-wrap {
  height: 3px;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
  overflow: hidden;
}
.story-queue-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.15s linear;
}
.story-queue-titulo {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  color: var(--fg);
  padding: 2px 0;
  width: 100%;
  outline: none;
}
.story-queue-titulo:disabled { opacity: 0.4; }
.story-queue-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: var(--fg-muted);
  font-size: 13px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#historias-hl-form {
  background: var(--surface2);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  border-bottom: 1px solid var(--border);
}
#historias-hl-form.hidden { display: none; }
.hl-form-top-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.hl-cover-picker {
  cursor: pointer;
  flex-shrink: 0;
}
.hl-cover-picker .historias-hl-circle {
  border-style: dashed;
  border-color: rgba(255,255,255,0.28);
  background: transparent;
  color: var(--subtext);
  transition: border-color 0.15s, color 0.15s;
}
.hl-cover-picker:hover .historias-hl-circle {
  border-color: var(--primary);
  color: var(--primary);
}
#hl-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
#historias-hl-nombre {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--sp-2) var(--sp-3);
  color: var(--text);
}
#historias-hl-nombre:focus { outline: none; border-color: var(--primary); }
#historias-hl-cancel { background: var(--surface3); color: var(--subtext); }
#historias-hl-save   { background: var(--primary);  color: #fff; }
#historias-hl-save:disabled { opacity: 0.6; }

.historias-hl-edit-cover {
  position: absolute;
  bottom: -3px;
  left: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(15,17,28,0.88);
  border: 1.5px solid rgba(255,255,255,0.15);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  flex-shrink: 0;
}
.historias-hl-edit-cover:active { background: rgba(124,58,237,0.5); }

/* ── Grid: remove button (admin, highlight activo) ──────── */

.guardado-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.guardado-remove-btn:active { background: rgba(239,68,68,0.75); }

/* ── Highlight picker sheet ─────────────────────────────── */

.hl-picker-title {
  font-size: var(--fs-footnote);
  font-weight: var(--fw-semibold);
  color: var(--subtext);
  text-align: center;
  padding: 10px 16px 4px;
}
.hl-picker-loading,
.hl-picker-empty {
  font-size: var(--fs-footnote);
  color: var(--subtext);
  text-align: center;
  padding: 12px 16px;
}

/* ── Historias grid (3 columnas Instagram-style) ───────────── */

#guardado-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 0;
}

.guardado-item {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface2);
}
.guardado-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.guardado-item:hover img { transform: scale(1.04); }
.guardado-item video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.guardado-video-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.55);
  border-radius: 4px;
  padding: 3px 5px;
  display: flex;
  align-items: center;
  color: #fff;
}

/* Pin badge Instagram-style: thumbtack blanco top-left */
.guardado-pin-badge {
  position: absolute;
  top: 7px; right: 7px;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.7));
  pointer-events: none;
  z-index: 2;
  transform: rotate(45deg);
  transform-origin: center;
}

.guardado-placeholder {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  background: var(--surface3);
}
.guardado-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  padding: 20px 6px 6px;
}
.guardado-titulo {
  font-size: 0.7rem; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.guardado-date { font-size: 0.6rem; color: rgba(255,255,255,0.65); }

/* ── Ganadores ─────────────────────────────────────────────── */

#ganadores-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }

.ganador-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04) 0%, transparent 40%),
    var(--surface);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.30),
    0 4px 12px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.06);
}
.ganador-card-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.ganador-sorteo-titulo { font-size: 0.9rem; font-weight: 700; }
.ganador-premio        { font-size: 0.8rem; color: var(--subtext); margin-top: 2px; }
.ganador-meta          { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ganador-fecha         { font-size: 0.7rem; color: var(--subtext); white-space: nowrap; }
.ganador-names         { display: flex; flex-wrap: wrap; gap: 6px; }
.ganador-name {
  font-size: 0.8rem; background: var(--primary-dim);
  color: var(--primary); border-radius: 20px; padding: 3px 10px;
  border: 1px solid rgba(124,58,237,0.3);
}
.ganador-delete-btn {
  font-size: 0.85rem; color: var(--subtext);
  padding: 2px 4px; border-radius: 4px;
}
.ganador-delete-btn:hover { color: var(--danger); }

/* ── FAQ ───────────────────────────────────────────────────── */

#faq-list { padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }

.faq-item {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04) 0%, transparent 40%),
    var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.30),
    0 4px 12px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.06);
  overflow: hidden;
  transition: background 0.2s, border-color 0.2s;
}
.faq-item.open {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 40%),
    var(--surface2);
  border-color: #3a4861;
}
.faq-question {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  gap: 12px;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.15s;
}
.faq-question:hover  { background: var(--surface3); }
.faq-question:active { background: rgba(255,255,255,0.1); }
.faq-text    { font-size: 0.88rem; font-weight: 600; flex: 1; }
.faq-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.faq-chevron {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  color: var(--subtext);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.2s;
  flex-shrink: 0;
}
.faq-chevron svg { display: block; }
.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}
/* grid trick: animates height from 0 to auto */
.faq-answer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.faq-item.open .faq-answer {
  grid-template-rows: 1fr;
}
.faq-answer-inner {
  overflow: hidden;
  font-size: 0.85rem; color: var(--subtext); line-height: 1.6;
  padding: 0 16px;
  border-top: 1px solid transparent;
  transition: padding   0.3s cubic-bezier(0.4, 0, 0.2, 1),
              border-top-color 0.25s ease;
}
.faq-item.open .faq-answer-inner {
  padding-top: 12px;
  padding-bottom: 14px;
  border-top-color: var(--border);
}
.faq-edit-btn { font-size: 0.8rem; padding: 2px 4px; border-radius: 4px; }
.faq-edit-btn:hover { background: var(--surface3); }

/* ── Admin FAB ─────────────────────────────────────────────── */

#btn-compose {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + var(--bar-h) + 16px);
  right: 16px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  z-index: 65;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(124,58,237,0.4);
  transition: opacity 0.15s, transform 0.15s;
}
#btn-compose:hover  { opacity: 0.9; transform: scale(1.05); }
#btn-compose.hidden { display: none; }
#btn-compose.fab-hidden { opacity: 0; pointer-events: none; }

/* ── Admin: post guardado button ───────────────────────────── */

.post-unpublished { filter: grayscale(0.4) opacity(0.6); }
.unpublished-badge {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.7rem; color: var(--danger);
  padding: 2px 10px 0;
}

/* ── Admin 3-dot menu trigger ──────────────────────────────── */
.btn-post-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--subtext);
  opacity: 0.55;
  padding: 2px 4px;
  border-radius: 8px;
  transition: opacity 0.15s, background 0.15s;
  position: relative;
}
.btn-post-menu:hover { opacity: 1; background: var(--surface2); }
.btn-post-menu::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  min-width: 44px; min-height: 44px;
}

/* ── Action sheet (bottom sheet) ──────────────────────────── */
.action-sheet {
  position: fixed; inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.action-sheet.hidden { display: none; }
.action-sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  animation: backdrop-fade var(--t-base) var(--ease-out);
}
@keyframes backdrop-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.action-sheet-panel {
  position: relative;
  background: rgba(18, 12, 40, 0.94);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-top: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px 16px 0 0;
  padding: 20px 0 calc(8px + var(--safe-bottom));
  animation: sheet-up var(--t-base) var(--ease-out);
}
.action-sheet-panel::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.28);
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.action-sheet-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 15px 20px;
  font-size: 1rem;
  color: var(--text);
  text-align: left;
  transition: background 0.1s;
}
.action-sheet-item:active { background: var(--surface2); }
.action-sheet-item--danger { color: var(--danger); }
.action-sheet-cancel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 15px 20px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--subtext);
  margin-top: 8px;
  background: rgba(255,255,255,0.04);
}
.confirm-msg {
  padding: 16px 20px 8px;
  font-size: 0.9rem;
  color: var(--subtext);
  line-height: 1.5;
}

/* ── Admin: delete comment button ──────────────────────────── */

.comment-footer { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.btn-delete-comment {
  font-size: 0.65rem; color: var(--subtext);
  padding: 1px 4px; border-radius: 4px;
  line-height: 1;
}
.btn-delete-comment:hover { color: var(--danger); background: rgba(239,68,68,0.1); }
.btn-mod-comment {
  display: inline-flex; align-items: center;
  color: var(--subtext);
  padding: 1px 4px; border-radius: 4px;
  line-height: 1;
}
.btn-mod-comment:hover { color: var(--primary); background: rgba(124,58,237,0.12); }

.mod-sheet-title {
  padding: 4px 20px 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Modales ────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 80;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 480px) {
  .modal-overlay { align-items: center; padding: 20px; }
}

.modal-card {
  background: rgba(18, 12, 40, 0.94);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-top: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 560px;
  max-height: 90dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
@media (min-width: 480px) {
  .modal-card { border-radius: 16px; }
}

.modal-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 0.95rem;
  flex-shrink: 0;
}
.modal-header button {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface2); color: var(--subtext);
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
}
.modal-header button:hover { background: var(--surface3); color: var(--text); }

.modal-body {
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto; flex: 1;
}

.modal-footer {
  padding: 12px 20px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 0.78rem; color: var(--subtext); font-weight: 500; }

.form-input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
  color: var(--text); font-size: 16px;
  outline: none; transition: border-color 0.15s;
  width: 100%;
}
.form-input:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; min-height: 80px; font-family: inherit; }
select.form-input,
.settings-control select {
  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' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='1 1 6 7 11 1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.form-checks { flex-direction: row; gap: 16px; flex-wrap: wrap; }
.form-check  { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; cursor: pointer; }
.form-check input { accent-color: var(--primary); }

.btn-primary {
  width: 100%;
  background: var(--primary); color: #fff;
  border-radius: 12px; padding: 12px;
  font-weight: 600; font-size: 0.95rem;
  transition: opacity 0.15s;
}
.btn-primary:hover    { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Apodo / login overlay ─────────────────────────────────── */

#apodo-overlay,
#push-prompt-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.push-prompt-icon {
  color: var(--primary);
}
.push-prompt-hint {
  font-size: 0.82rem;
  color: var(--subtext);
  text-align: center;
  line-height: 1.5;
  margin: -4px 0 0;
}
#btn-push-activate {
  background: var(--primary); color: #fff;
  border-radius: 12px; padding: 12px;
  font-weight: 700; font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: opacity 0.15s;
}
#btn-push-activate:hover { opacity: 0.88; }

.apodo-card {
  background: rgba(18, 12, 40, 0.92);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 14px;
}

.apodo-card h2 { font-size: 1.1rem; font-weight: 700; }
.apodo-card p  { font-size: 0.85rem; color: var(--subtext); line-height: 1.5; }

/* ── Panel 0: Welcome ────────────────────────────────── */
#login-welcome-panel {
  display: flex; flex-direction: column; gap: 16px;
}
.welcome-logo-wrap {
  display: flex; justify-content: center;
  padding: 4px 0;
}
.welcome-logo {
  height: 34px; width: auto;
}
.welcome-tagline {
  font-size: 0.82rem;
  color: var(--subtext);
  text-align: center;
  line-height: 1.5;
  margin: -6px 0 0;
}
.welcome-benefits {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 12px;
  padding: 4px 0;
}
.welcome-benefits li {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.88rem; color: var(--text); line-height: 1.3;
}
.welcome-benefits li svg {
  flex-shrink: 0;
  color: var(--primary);
}
#btn-welcome-register {
  background: var(--primary); color: #fff;
  border-radius: 12px; padding: 12px;
  font-weight: 700; font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: opacity 0.15s;
}
#btn-welcome-register:hover { opacity: 0.88; }

@keyframes panel-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
#login-email-panel, #login-sent-panel, #login-apodo-panel {
  display: flex; flex-direction: column; gap: 12px;
}
#login-welcome-panel:not(.hidden),
#login-email-panel:not(.hidden),
#login-sent-panel:not(.hidden),
#login-apodo-panel:not(.hidden),
#push-prompt-overlay:not(.hidden) .apodo-card {
  animation: panel-fade-in var(--t-base) var(--ease-out) forwards;
}

#login-email-input, #apodo-input, #admin-email, #admin-password {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 14px;
  color: var(--text); font-size: 16px;
  outline: none; transition: border-color 0.15s;
}
#login-email-input:focus, #apodo-input:focus,
#admin-email:focus, #admin-password:focus { border-color: var(--primary); }

#login-error, #apodo-error,
#login-error-admin { font-size: 0.8rem; color: var(--danger); margin-top: -4px; }

/* Panel OTP */
.login-sent-icon { font-size: 2.5rem; text-align: center; }
#login-otp-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: .3em;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
#login-otp-input:focus { border-color: var(--primary); }
#login-otp-error { font-size: 0.8rem; color: var(--danger); margin-top: -4px; }
#btn-resend-otp,
#btn-retry-magic-link,
#btn-welcome-skip,
#btn-push-later,
#btn-skip-login {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 10px;
  color: var(--subtext);
  font-size: 0.875rem;
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
#btn-resend-otp:hover,
#btn-retry-magic-link:hover,
#btn-welcome-skip:hover,
#btn-push-later:hover,
#btn-skip-login:hover {
  background: rgba(255,255,255,0.11);
  color: var(--text);
}
#btn-resend-otp:disabled {
  opacity: 0.5;
  cursor: default;
}

#btn-send-magic-link,
#btn-verify-otp,
#btn-set-apodo,
#btn-admin-login {
  background: var(--primary); color: #fff;
  border-radius: 12px; padding: 11px;
  font-weight: 600; font-size: 0.95rem;
  transition: opacity 0.15s;
}
#btn-send-magic-link:hover,
#btn-verify-otp:hover,
#btn-set-apodo:hover,
#btn-admin-login:hover { opacity: 0.85; }
#btn-send-magic-link:disabled,
#btn-verify-otp:disabled,
#btn-set-apodo:disabled,
#btn-admin-login:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Apodo panel: preview & color picker ──────────────────── */
.apodo-preview {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.apodo-preview-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtext);
}
.apodo-preview-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
  transition: color var(--t-fast);
}
.apodo-preview-msg {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  margin-top: 2px;
}
.apodo-color-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.apodo-color-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--subtext);
}
.apodo-color-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.apodo-color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  background: var(--swatch-color);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.apodo-color-swatch:active { transform: scale(0.88); }
.apodo-color-swatch.selected {
  border-color: #fff;
  transform: scale(1.12);
}
.apodo-color-swatch.selected::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.30);
}

.link-btn {
  background: none; color: var(--subtext);
  font-size: 0.8rem; font-weight: var(--fw-medium);
  padding: 4px 0; text-align: center;
  cursor: pointer;
}
.link-btn:hover { color: var(--text); }

/* ── Profile panel — bottom sheet ──────────────────────────── */

#profile-panel {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: flex-end;
}
#profile-panel.hidden { display: none; }

#profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#profile-sheet {
  position: relative;
  width: 100%;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 8px 20px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 85dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--t-slow);
}
#profile-panel.open #profile-sheet { transform: translateY(0); }

.profile-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 4px auto;
  flex-shrink: 0;
}
.profile-title {
  font-size: 17px; font-weight: 700;
  color: var(--text); margin: 0;
}


/* ── Toast ─────────────────────────────────────────────────── */

.toast {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top) + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(255, 255, 255, 0.13); color: var(--text);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 0.83rem; font-weight: 500;
  z-index: 200;
  white-space: nowrap; pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  border: 1px solid rgba(255,255,255,0.14);
  max-width: calc(100vw - 32px);
  overflow: hidden; text-overflow: ellipsis;
}
.toast.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { border-color: var(--success); color: var(--success); }
.toast-error   { border-color: var(--danger);  color: var(--danger);  }
.toast-info    { border-color: var(--primary);  color: var(--primary); }

/* ── Lightbox ──────────────────────────────────────────────── */

#lightbox {
  position: fixed; inset: 0;
  z-index: 90;
  background: rgba(0,0,0,0.95);
  display: flex; align-items: center; justify-content: center;
  cursor: grab;
}
#lightbox.lb-dragging { cursor: grabbing; }
#lightbox.hidden { display: none; }
#lightbox-img {
  max-width: 95vw; max-height: 95dvh;
  object-fit: contain; border-radius: 4px;
  cursor: inherit; user-select: none;
  will-change: transform;
}
#lightbox-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.15); color: #fff;
  border: none; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 1;
}
#lightbox-close:hover { background: rgba(255,255,255,0.28); }


.post-video-play-btn {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  background: rgba(0,0,0,0.08);
}
.post-video-play-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(0,0,0,0.52);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: transform 0.12s ease, background 0.12s ease;
}
.post-video-play-btn:active .post-video-play-icon {
  transform: scale(0.88);
  background: rgba(0,0,0,0.72);
}

/* ── Scrollbar ─────────────────────────────────────────────── */

::-webkit-scrollbar              { width: 4px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: var(--surface3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover  { background: var(--subtext); }

/* ── Desktop ───────────────────────────────────────────────── */

@media (min-width: 680px) {
  #feed { padding: 16px 16px 8px; }
  .post-bubble { border-radius: 12px 12px 12px 4px; }
}

/* ── P2: Offline banner ────────────────────────────────────── */

#offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: #b45309; color: #fff;
  text-align: center; font-size: .8rem; font-weight: 600;
  padding: 6px 12px; letter-spacing: .02em;
}
#offline-banner.hidden { display: none; }

/* ── Scroll to bottom button ─────────────────────────────────── */

#scroll-bottom-btn {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  right: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(17, 22, 30, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.35);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 71;
  box-shadow: 0 4px 20px rgba(0,0,0,0.45);
  transition: opacity var(--t-base) var(--ease-out),
              bottom var(--t-base) var(--ease-out);
}
/* Cuando el FAB del chatbot está visible, sube el botón de scroll para no taparlo */
body:has(#chatbot-fab:not(.hidden)) #scroll-bottom-btn {
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px + 62px + 12px);
}
/* En vista de comentarios el scroll-btn del feed no debe colarse sobre el panel */
#app.in-comments #scroll-bottom-btn { display: none; }
#scroll-bottom-btn.hidden {
  opacity: 0;
  pointer-events: none;
}
#scroll-bottom-btn:active { opacity: 0.65; }
.scroll-bottom-count {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  background: var(--primary);
  color: #fff;
  font-size: 11px; font-weight: 700;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg);
  line-height: 1;
}
.scroll-bottom-count:empty { display: none; }

/* ── P2: Feed error retry ──────────────────────────────────── */

.feed-error { color: var(--subtext); }
.btn-feed-retry {
  margin-left: 8px; padding: 4px 10px;
  background: var(--surface2); border: 1px solid var(--surface3);
  border-radius: 8px; color: var(--text); font-size: .8rem;
  cursor: pointer;
}
.btn-feed-retry:hover { background: var(--surface3); }


/* ── P2: FAQ orden badge (admin) ───────────────────────────── */

.faq-orden-badge {
  font-size: .7rem; color: var(--subtext);
  background: var(--surface2); border-radius: 4px;
  padding: 1px 5px; margin-right: 4px;
}

/* ── P3-A3: Audit log de actividad admin ───────────────────── */

#audit-list {
  padding: 8px 12px 80px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.audit-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: .85rem;
  line-height: 1.4;
  transition: background .15s;
}
.audit-entry:hover { background: var(--surface2); }

.audit-icon {
  flex-shrink: 0;
  font-size: .9rem;
  width: 20px;
  text-align: center;
}

.audit-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
}

.audit-apodo {
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.audit-desc { color: var(--text); }

.audit-target {
  color: var(--subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.audit-target em {
  font-style: italic;
  font-size: .8rem;
}

.audit-time {
  flex-shrink: 0;
  color: var(--subtext);
  font-size: .75rem;
  white-space: nowrap;
  margin-left: auto;
  padding-left: 8px;
}

/* ── Actividad: tabs internas (segmented control) ──────────── */

.act-tabs {
  display: flex;
  gap: 4px;
  margin: 8px 12px 4px;
  padding: 4px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.act-tab {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--subtext);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.act-tab.active {
  background: var(--live);
  color: #fff;
}

.act-panel { display: none; }
.act-panel.active { display: block; }

.act-panel-head {
  padding: 10px 14px 2px;
}
.act-count {
  color: var(--subtext);
  font-size: .8rem;
}

/* ── Actividad: registro de usuarios ───────────────────────── */

#usuarios-list {
  padding: 4px 12px 80px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.usuario-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: .85rem;
  line-height: 1.4;
  transition: background .15s;
}
.usuario-entry:hover { background: var(--surface2); }

.usuario-rank {
  flex-shrink: 0;
  width: 34px;
  color: var(--subtext);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

.usuario-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.usuario-apodo {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usuario-email {
  color: var(--subtext);
  font-size: .75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.usuario-email:active { color: var(--primary); }

.usuario-time {
  flex-shrink: 0;
  color: var(--subtext);
  font-size: .75rem;
  white-space: nowrap;
  margin-left: auto;
  padding-left: 8px;
}

.usuario-status {
  display: inline-block;
  margin-top: 2px;
  font-size: .7rem;
  font-weight: 600;
}
.usuario-status--ban  { color: var(--danger); }
.usuario-status--mute { color: #f59e0b; }

.usuario-mod-btn {
  flex-shrink: 0;
  align-self: center;
  color: var(--subtext);
  padding: 6px;
  border-radius: 8px;
  transition: color .12s, background .12s;
}
.usuario-mod-btn:active { color: var(--primary); background: var(--surface2); }

/* ── Admin settings (slow mode) ────────────────────────────── */

#slow-mode-settings {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.88rem;
  font-weight: 600;
}

.settings-hint {
  font-size: 0.75rem;
  color: var(--subtext);
  font-weight: 400;
}

.settings-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.settings-control select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 6px 30px 6px 8px;
  cursor: pointer;
}

.settings-control select:focus {
  outline: none;
  border-color: var(--primary);
}

#btn-save-slow-mode {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: opacity .15s;
}

#btn-save-slow-mode:disabled { opacity: 0.5; cursor: default; }

/* ── Reacciones configurables ────────────────────────────── */

#reac-emojis-settings {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.settings-row--block {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

#reac-emojis-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.reac-emoji-toggle {
  font-size: 1.4rem;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--surface2);
  cursor: pointer;
  transition: border-color .15s, opacity .15s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0.35;
}

.reac-emoji-toggle.selected {
  border-color: var(--primary);
  opacity: 1;
}

.reac-emoji-toggle:active {
  transform: scale(0.88);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-text-sm {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
  opacity: 0.8;
}

.btn-text-sm:hover { opacity: 1; }

#btn-save-reac-emojis {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: opacity .15s;
  margin-left: auto;
}

#btn-save-reac-emojis:disabled { opacity: 0.5; cursor: default; }

/* ── Post detail overlay (Historias → Instagram-style) ────── */

@keyframes post-detail-slide-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

#post-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 75;
  background: #0a0c18;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#post-detail-overlay.hidden { display: none; }
#post-detail-overlay:not(.hidden) {
  animation: post-detail-slide-in 0.30s var(--ease-out);
}
#post-detail-overlay.pd-dragging {
  will-change: transform;
  cursor: grabbing;
}

.pd-handle-row {
  display: flex;
  justify-content: center;
  padding: calc(var(--safe-top) + 8px) 0 6px;
  flex-shrink: 0;
  cursor: grab;
}
.pd-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.22);
}

#post-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 10px;
  flex-shrink: 0;
  border-bottom: 0.5px solid rgba(255,255,255,0.08);
}

#post-detail-back {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  background: rgba(255,255,255,0.07);
  flex-shrink: 0;
  transition: background var(--t-fast);
}
#post-detail-back:active { background: rgba(255,255,255,0.14); }

#post-detail-menu-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  background: rgba(255,255,255,0.07);
  flex-shrink: 0;
  margin-left: auto;
  transition: background var(--t-fast);
}
#post-detail-menu-btn:active { background: rgba(255,255,255,0.14); }

.post-detail-tipo {
  font-size: var(--fs-footnote);
  font-weight: var(--fw-medium);
  color: var(--subtext);
}

#post-detail-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

#post-detail-media-wrap {
  width: 100%;
  background: #000;
  flex-shrink: 0;
}
#post-detail-media-wrap.hidden { display: none; }
#post-detail-media-wrap img {
  width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
  display: block;
}
#post-detail-media-wrap video {
  width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
  display: block;
  background: #000;
}

#post-detail-body {
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#post-detail-titulo {
  font-size: var(--fs-body);
  font-weight: var(--fw-bold);
  color: var(--text);
  line-height: var(--lh-snug);
}

#post-detail-contenido {
  font-size: var(--fs-footnote);
  color: var(--text);
  line-height: var(--lh-base);
}

#post-detail-fecha {
  font-size: var(--fs-caption2);
  color: var(--subtext);
  margin-top: 2px;
}

#post-detail-footer {
  flex-shrink: 0;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  border-top: 0.5px solid rgba(255,255,255,0.08);
  background: rgba(10, 12, 24, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#post-detail-comments-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  background: rgba(255,255,255,0.07);
  border-radius: 12px;
  color: var(--text);
  font-size: var(--fs-footnote);
  font-weight: var(--fw-medium);
  border: 0.5px solid rgba(255,255,255,0.10);
  transition: background var(--t-fast);
}
#post-detail-comments-btn:active { background: rgba(255,255,255,0.12); }

#post-detail-comments-label {
  flex: 1;
  text-align: left;
}

/* ════════════════════════════════════════════════════════════
   Stories
   ════════════════════════════════════════════════════════════ */

/* ── Avatar ring ──────────────────────────────────────────── */

@keyframes story-ring-pulse {
  0%, 100% { box-shadow: 0 0 0 1.5px rgba(217,70,239,0.3), 0 4px 16px rgba(0,0,0,0.35); }
  50%       { box-shadow: 0 0 0 3px   rgba(217,70,239,0.55), 0 4px 16px rgba(0,0,0,0.35); }
}

.header-avatar.has-stories {
  border: 2.5px solid #d946ef;
  box-shadow: 0 0 0 1.5px rgba(217,70,239,0.3), 0 4px 16px rgba(0,0,0,0.35);
  cursor: pointer;
  animation: story-ring-pulse 2.5s ease-in-out infinite;
}

/* ── Bubble row ───────────────────────────────────────────── */

#stories-bubble-row {
  padding: 10px 12px 8px;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
}
#stories-bubble-row.hidden { display: none; }

#stories-bubble-inner {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#stories-bubble-inner::-webkit-scrollbar { display: none; }

.story-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  width: 64px;
}

.story-bubble-ring {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
}
.story-bubble-ring.ring-active {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(124,58,237,0.4);
}

.story-bubble-circle {
  width: 52px; height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface2);
  border: 2px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.story-bubble-circle img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.story-add-circle {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}

.story-bubble-label {
  font-size: var(--fs-caption2);
  color: var(--subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 64px;
  line-height: 1.2;
  text-align: center;
}
.story-bubble.has-active .story-bubble-label {
  color: var(--text);
  font-weight: var(--fw-medium);
}

/* ── Viewer ───────────────────────────────────────────────── */

#story-viewer {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: #000;
  overflow: hidden;
  touch-action: none;
}
#story-viewer.hidden { display: none; }

/* Progress bars */
#story-progress {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  left: 10px; right: 10px;
  display: flex;
  gap: 3px;
  z-index: 10;
}

.story-prog-seg {
  flex: 1;
  height: 2px;
  background: rgba(255,255,255,0.35);
  border-radius: 1px;
  overflow: hidden;
}
.story-prog-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 1px;
}
.story-prog-seg.done .story-prog-fill { width: 100%; }

/* Header overlay */
#story-header-overlay {
  position: absolute;
  top: calc(var(--safe-top) + 22px);
  left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  z-index: 10;
}

#story-header-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

#story-header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
#story-header-name {
  font-size: var(--fs-footnote);
  font-weight: var(--fw-semibold);
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
#story-header-time {
  font-size: var(--fs-caption2);
  color: rgba(255,255,255,0.65);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

#story-close-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-fast);
}
#story-close-btn:active { background: rgba(0,0,0,0.7); }

/* Media */
#story-media {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.story-img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

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

/* Tap zones */
#story-tap-prev,
#story-tap-next {
  position: absolute;
  top: 0; bottom: 0;
  z-index: 5;
}
#story-tap-prev { left: 0;  width: 35%; }
#story-tap-next { right: 0; width: 65%; }

/* Title overlay */
#story-titulo {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 76px);
  left: 16px; right: 16px;
  font-size: var(--fs-subhead);
  font-weight: var(--fw-semibold);
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
  z-index: 10;
  text-align: center;
}
#story-titulo.hidden { display: none; }

/* Expired badge (admin) */
#story-expired-badge {
  position: absolute;
  top: calc(var(--safe-top) + 22px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239,68,68,0.9);
  color: #fff;
  font-size: var(--fs-caption2);
  font-weight: var(--fw-semibold);
  padding: 2px 10px;
  border-radius: 10px;
  z-index: 11;
  pointer-events: none;
}
#story-expired-badge.hidden { display: none; }

/* Admin bar */
#story-admin-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10;
}
#story-admin-bar.hidden { display: none; }

#story-archive-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  border-radius: 20px;
  padding: 9px 16px;
  font-size: var(--fs-footnote);
  font-weight: var(--fw-medium);
  border: 1px solid rgba(255,255,255,0.2);
  transition: background var(--t-fast);
}
#story-archive-btn:active { background: rgba(255,255,255,0.24); }
#story-archive-btn:disabled { opacity: 0.6; pointer-events: none; }

#story-delete-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(239,68,68,0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ef4444;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(239,68,68,0.28);
  flex-shrink: 0;
  transition: background var(--t-fast);
}
#story-delete-btn:active { background: rgba(239,68,68,0.38); }

/* ══════════════════════════════════════════════════════════
   CHATBOT — FAB + Panel de soporte en vivo
   z-index: FAB=70, panel=300 (sobre todo)
   ══════════════════════════════════════════════════════════ */

/* ── FAB ──────────────────────────────────────────────────── */
#chatbot-fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  transition: transform var(--t-base) var(--ease-out-back),
              opacity var(--t-fast);
}
#chatbot-fab.hidden       { display: none; }
#chatbot-fab:active       { transform: scale(0.93); }
#app.in-comments #chatbot-fab { display: none; }

/* ── FAB badge ────────────────────────────────────────────── */
#chatbot-fab-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--bg);
}
#chatbot-fab-badge.hidden { display: none; }

/* ── Panel ────────────────────────────────────────────────── */
/* initKeyboardAdjust() en app.js ancla este panel al visual viewport cuando el
   teclado se abre — mismo patrón que #section-comments. */
#chatbot-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  background-color: #0a0c18;
  background-image: radial-gradient(ellipse 120% 85% at 50% 28%, #321666 0%, #130a2e 38%, #0a0c18 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform var(--t-slow) var(--ease-out);
  pointer-events: none;
}
#chatbot-panel.hidden { pointer-events: none; }
#chatbot-panel.chatbot-panel--open {
  transform: translateY(0);
  pointer-events: all;
}
/* Keyboard abierto: home indicator detrás del teclado — eliminar safe-bottom. */
#chatbot-panel.chatbot-kb-open .chatbot-input-row {
  padding-bottom: 8px;
}

/* ── Drag handle — oculto en panel full-screen ────────────── */
.chatbot-drag-handle { display: none; }

/* ── Header ───────────────────────────────────────────────── */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 11px;
}
.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chatbot-name {
  font-size: var(--fs-subhead);
  font-weight: var(--fw-semibold);
  color: var(--text);
  line-height: var(--lh-tight);
}
.chatbot-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-caption);
  color: var(--success);
  line-height: var(--lh-tight);
  margin-top: 2px;
}
.chatbot-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
#chatbot-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  border: none;
  cursor: pointer;
  color: var(--subtext);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
#chatbot-close:active {
  background: var(--surface3);
  color: var(--text);
}

/* ── Messages list ────────────────────────────────────────── */
#chatbot-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: transparent;
}

/* ── Bubbles ──────────────────────────────────────────────── */
.chatbot-msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: var(--fs-footnote);
  line-height: var(--lh-base);
  word-break: break-word;
  animation: chatbot-bubble-in var(--t-base) var(--ease-out-back) both;
  position: relative;
}
@keyframes chatbot-bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.chatbot-msg--user {
  align-self: flex-end;
  background: linear-gradient(150deg, rgba(154,78,255,0.82) 0%, rgba(124,58,237,0.78) 55%, rgba(94,34,201,0.82) 100%);
  border: 1px solid rgba(124, 58, 237, 0.40);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chatbot-msg--admin {
  align-self: flex-start;
  background: linear-gradient(150deg, rgba(58,72,96,0.80) 0%, rgba(22,34,52,0.76) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chatbot-msg--bot {
  align-self: flex-start;
  background: linear-gradient(150deg, rgba(58,72,96,0.80) 0%, rgba(22,34,52,0.76) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border-left: 2px solid var(--primary);
}

.chatbot-msg--bot:not(.chatbot-typing),
.chatbot-msg--admin:not(.chatbot-typing) {
  padding-top: 20px;
  min-width: 82px;
}
.chatbot-msg--bot:not(.chatbot-typing)::before,
.chatbot-msg--admin:not(.chatbot-typing)::before {
  position: absolute;
  top: 7px;
  left: 13px;
  font-size: 11px;
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  white-space: nowrap;
}
.chatbot-msg--bot:not(.chatbot-typing)::before   { content: 'Asistente'; color: var(--primary); }
.chatbot-msg--admin:not(.chatbot-typing)::before { content: 'Soporte';   color: var(--success); }

/* ── Typing indicator ─────────────────────────────────────── */
.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}
.chatbot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--subtext);
  animation: chatbot-dot 1.2s infinite ease-in-out;
}
.chatbot-typing span:nth-child(1) { animation-delay: 0s;    }
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s;  }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s;  }

@keyframes chatbot-dot {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1;   }
}

/* ── Input row ────────────────────────────────────────────── */
.chatbot-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
#chatbot-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 16px;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  line-height: var(--lh-base);
  font-family: inherit;
  transition: border-color var(--t-fast);
}
#chatbot-input:focus {
  outline: none;
  border-color: var(--primary);
}
#chatbot-input::placeholder { color: var(--subtext); }

#chatbot-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0);
  transition: transform var(--t-base) var(--ease-out-back);
}
#chatbot-send.chatbot-send--visible { transform: scale(1); }
#chatbot-send:active                { opacity: 0.85; transform: scale(0.94); }

/* ── Message timestamp ────────────────────────────────────── */
.chatbot-msg-time {
  display: block;
  font-size: 10px;
  margin-top: 4px;
  text-align: right;
  opacity: 0.50;
  line-height: 1;
  font-style: normal;
}

/* ── Session separator ────────────────────────────────────── */
.chatbot-session-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
  color: var(--subtext);
  font-size: var(--fs-caption);
  align-self: stretch;
}
.chatbot-session-sep::before,
.chatbot-session-sep::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--border);
}

/* ── Quick replies ────────────────────────────────────────── */
.chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 2px;
  align-self: stretch;
}
.chatbot-qr-chip {
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
  background: var(--surface2);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 10px 14px;
  color: var(--text);
  font-size: var(--fs-footnote);
  font-family: inherit;
  line-height: var(--lh-base);
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.30),
              inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: background var(--t-fast), border-color var(--t-fast),
              box-shadow var(--t-fast), transform var(--t-fast);
  animation: chatbot-bubble-in var(--t-base) var(--ease-out-back) both;
  animation-delay: calc(0.10s + 0.06s * var(--i, 0));
}
.chatbot-qr-chip:active {
  background: var(--surface3);
  box-shadow: none;
  transform: translateY(1px);
}

.chatbot-qr-chip--featured {
  flex: 1 1 100%;
  background: var(--surface2);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: var(--fw-semibold);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.30),
              inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.chatbot-qr-chip--featured:active {
  background: var(--surface3);
  box-shadow: none;
  transform: translateY(1px);
}

/* ── Back to menu ─────────────────────────────────────────── */
.chatbot-back-to-menu {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  color: var(--subtext);
  font-size: var(--fs-caption);
  font-family: inherit;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
  animation: chatbot-bubble-in var(--t-base) var(--ease-out-back) both;
}
.chatbot-back-to-menu:active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.30);
}
