/* =====================================================================
   VOZ.PE Social — main.css
   Paleta editorial-seria: blanco / negro / rojo bandera.
   Mobile-first: por defecto cols-side ocultas, bottom-nav visible.
   ===================================================================== */

:root {
    --red:          #C8102E;
    --red-dark:     #9D0C24;
    --red-soft:     #FEE7EB;
    --ink:          #0E1015;
    --ink-soft:     #2A2D34;
    --muted:        #6B7280;
    --line:         #D9DCE2;
    --line-soft:    #E4E7EC;
    --paper:        #FFFFFF;
    --paper-soft:   #EAECF1;
    --bg:           #DDE0E6;
    --shadow-sm:    0 1px 2px rgba(14, 16, 21, .04);
    --shadow:       0 4px 16px rgba(14, 16, 21, .06);
    --shadow-lg:    0 12px 32px rgba(14, 16, 21, .10);
    --r-sm:         8px;
    --r:            12px;
    --r-lg:         16px;
    --r-pill:       999px;
    --font:         'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-serif:   ui-serif, 'Source Serif Pro', Georgia, serif;
    color-scheme: light;
}

/* =====================================================================
   MODO OSCURO — alto contraste (accesibilidad). OPT-IN: solo se aplica
   cuando el usuario lo activa (cookie → <html data-theme="dark">). Por
   defecto, todos ven el tema claro.
   ===================================================================== */
:root[data-theme="dark"] {
    --red:        #FF4D6A;
    --red-dark:   #C8102E;
    --red-soft:   #2A1418;
    --ink:        #F2F4F7;
    --ink-soft:   #C7CCD6;
    --muted:      #A7B0C0;
    --line:       #2C313B;
    --line-soft:  #232730;
    --paper:      #181B22;
    --paper-soft: #232730;
    --bg:         #0E1117;
    --shadow-sm:  0 1px 2px rgba(0, 0, 0, .40);
    --shadow:     0 4px 16px rgba(0, 0, 0, .50);
    --shadow-lg:  0 12px 32px rgba(0, 0, 0, .60);
    color-scheme: dark;
}

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

html, body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }

button {
    font: inherit;
    cursor: pointer;
    background: transparent;
    border: 0;
    color: inherit;
}

img { max-width: 100%; height: auto; display: block; }

input, textarea, select {
    font: inherit;
    color: inherit;
}

/* Tap targets cómodos */
.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: var(--r-pill);
    font-weight: 600;
    font-size: 14px;
    transition: background .15s, color .15s, border-color .15s, transform .1s;
    border: 1px solid transparent;
}
.btn-primary {
    background: var(--red);
    color: #fff;
}
.btn-primary:hover { background: var(--red-dark); color: #fff; }
.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
}
.btn-ghost:hover { background: var(--paper-soft); border-color: var(--ink); }
.btn-block { width: 100%; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }

/* =====================================================================
   LAYOUT — 3 columnas en desktop, single column en mobile
   ===================================================================== */
.app-shell {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
}

.col-left, .col-right { display: none; }
.col-main {
    width: 100%;
    max-width: 100%;
    min-width: 0;          /* CRITICAL: grid items default a min-width:auto y rompen mobile */
    padding: 12px;
    box-sizing: border-box;
}

/* Desktop ≥ 900px: 3 columnas */
@media (min-width: 900px) {
    .app-shell {
        grid-template-columns: 230px minmax(0, 1fr) 320px;
        max-width: 1320px;
        margin: 0 auto;
        gap: 16px;
        padding: 0 16px;
    }
    .col-left, .col-right { display: flex; flex-direction: column; }
    /* Sidebars sticky: toman el alto natural de su contenido. Si el contenido
       excede el viewport, sticky se desactiva al scrollear y todo va junto.
       `align-self: start` evita que el grid los estire al alto del row. */
    .col-left  { padding: 16px 0; position: sticky; top: 64px; align-self: start; }
    .col-right { padding: 16px 0; position: sticky; top: 64px; align-self: start; }
    .col-main { padding: 16px 0; min-width: 0; }

    /* Capsules — nav y user-chip como widgets blancos al estilo del sidebar derecho */
    .col-left > .nav {
        background: var(--paper);
        border: 1px solid var(--line);
        border-radius: var(--r);
        padding: 12px 10px;
        box-shadow: var(--shadow-sm);
        margin-bottom: 14px;
    }
    .col-left > .sidebar-foot {
        background: var(--paper);
        border: 1px solid var(--line);
        border-radius: var(--r);
        padding: 12px;
        box-shadow: var(--shadow-sm);
        border-top: 0;
        margin-top: 0;
    }
}

@media (min-width: 1100px) {
    .app-shell { grid-template-columns: 260px minmax(0, 1fr) 340px; }
}

/* =====================================================================
   HEADER (sticky top, white)
   ===================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(180%) blur(6px);
}
.site-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1320px;
    margin: 0 auto;
    padding: 10px 16px;
    height: 64px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
    font-size: 18px;
    color: var(--ink);
}
.brand-mark { width: 32px; height: 32px; flex-shrink: 0; }
.brand-text { letter-spacing: -.02em; }
.brand-text .dot { color: var(--red); }

.search-wrap {
    flex: 1;
    max-width: 560px;
    position: relative;
}
.search-input {
    width: 100%;
    height: 40px;
    padding: 0 14px 0 38px;
    border: 1px solid var(--line);
    background: var(--paper-soft);
    border-radius: var(--r-pill);
    font-size: 14px;
    transition: border-color .15s, background .15s;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus {
    outline: none;
    border-color: var(--ink);
    background: var(--paper);
}
.search-wrap .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-pill);
    color: var(--ink-soft);
    position: relative;
    transition: background .15s;
}
.icon-btn:hover { background: var(--paper-soft); color: var(--ink); }
.icon-btn .badge {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--r-pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Esconder buscador en mobile, dejarlo solo en desktop */
/* Botón lupa del header: oculto en desktop (search bar ya está inline), visible en mobile */
.header-search-btn { display: none; }

/* Overlay slide-down de búsqueda mobile */
.header-search-overlay {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    z-index: 49;
}
.header-search-overlay[hidden] { display: none; }
.header-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--paper-soft);
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    padding: 6px 12px;
}
.header-search-form .icon { color: var(--muted); display: inline-flex; }
.header-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--ink);
    padding: 6px 0;
    min-width: 0;
}
.header-search-input:focus { outline: none; }
.header-search-close {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}
.header-search-close:hover { color: var(--ink); }

@media (max-width: 720px) {
    .search-wrap { display: none; }
    .header-search-btn { display: inline-flex; align-items: center; justify-content: center; }
    /* Header compacto: menos padding, items chicos */
    .site-header-inner { gap: 8px; padding: 8px 10px; height: 56px; }
    .header-actions { gap: 6px; }
    .header-actions .btn { padding: 0 10px; font-size: 12px; height: 32px; }
    /* En anónimo: ocultar "Iniciar sesión" (el welcome card abajo lo tiene) */
    body.is-anon .header-actions .btn-ghost { display: none; }
    /* Lang switcher más chico */
    .header-actions .icon-btn { width: 32px; height: 32px; }
    .brand-text { font-size: 16px; }
}

/* Red de seguridad: nada puede scrollear horizontalmente la página.
   overflow-x: clip (no 'hidden') evita crear un scroll-container en el root,
   que en iOS Safari rompe el position:fixed del bottom-nav (se iba a media
   pantalla al hacer scroll). Fallback a 'hidden' en navegadores sin clip. */
html, body { overflow-x: hidden; overflow-x: clip; }

/* =====================================================================
   MOBILE DRAWER (☰ menu)
   ===================================================================== */
.header-menu-btn {
    display: none;
    border: none;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    padding: 8px;
    margin: 0;
    border-radius: 8px;
    line-height: 0;
}
.header-menu-btn:hover { background: var(--paper-soft); }

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 998;
    opacity: 0;
    transition: opacity .2s;
}
.drawer-backdrop:not([hidden]) { opacity: 1; }
.drawer-backdrop[hidden] { display: none; }

.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 84%;
    max-width: 320px;
    background: var(--paper);
    z-index: 999;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-100%);
    transition: transform .25s ease-out;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 24px rgba(0,0,0,0.18);
}
.mobile-drawer:not([hidden]) { transform: translateX(0); }
.mobile-drawer[hidden] { display: none; }

.mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.mobile-drawer-close {
    border: none;
    background: transparent;
    color: var(--ink-soft);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.mobile-drawer-close:hover { background: var(--paper-soft); color: var(--ink); }

.mobile-drawer .nav {
    padding: 8px 8px 16px;
    flex: 1;
}
.mobile-drawer .nav-item {
    min-height: 48px; /* touch target cómodo */
}
.mobile-drawer .nav-item-danger {
    color: var(--red);
}
.mobile-drawer .nav-item-danger:hover { background: var(--red-soft); }

.mobile-drawer-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    flex-shrink: 0;
    background: var(--paper-soft);
}
.mobile-drawer-foot .avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.mobile-drawer-foot .who strong {
    display: block;
    font-size: 14px;
    color: var(--ink);
}

/* Mostrar el hamburguesa solo en mobile */
@media (max-width: 720px) {
    .header-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
}
/* En desktop ocultar drawer y backdrop pase lo que pase */
@media (min-width: 721px) {
    .mobile-drawer, .drawer-backdrop { display: none !important; }
}

/* =====================================================================
   MOBILE — Touch targets ≥ 40px + modales fit
   ===================================================================== */
@media (max-width: 720px) {
    /* Header icons más cómodos al tap */
    .header-actions .icon-btn { width: 40px; height: 40px; }
    /* Tres puntos del post */
    .post-menu-btn { width: 40px; height: 40px; }
    /* Acciones de comentarios */
    .comment-action-btn { min-height: 36px; padding: 8px 10px; }
    /* Composer icons */
    .composer-icon-link { width: 40px; height: 40px; }
}

/* Modales fit en pantallas muy chicas */
@media (max-width: 600px) {
    .modal-backdrop { padding: 8px; }
    .modal-dialog,
    .modal-dialog-wide { max-width: 100%; border-radius: 12px; }
    .cropper-stage { max-height: 70vh; }
}

/* Post menu dropdown — nunca debe exceder el ancho del viewport en mobile */
.post-menu-dropdown {
    max-width: calc(100vw - 24px);
}

/* Lang switcher: oculto en mobile (no es útil para usuarios peruanos en celu) */
@media (max-width: 720px) {
    .lang-switcher { display: none; }
}

/* Link-preview: en pantalla angosta, vertical (cover arriba, texto abajo) */
@media (max-width: 480px) {
    .link-preview {
        display: flex;
        flex-direction: column;
    }
    .link-preview-cover {
        width: 100%;
        aspect-ratio: 1.91 / 1;
    }
    .link-preview-body {
        width: 100%;
    }
}

/* Compose tabs: si no caben los 4, scroll horizontal en mobile */
@media (max-width: 480px) {
    .compose-tabs {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .compose-tabs::-webkit-scrollbar { display: none; }
    .compose-tab {
        flex: 0 0 auto;
        white-space: nowrap;
        font-size: 12.5px;
        padding: 8px 12px;
    }
}

/* =====================================================================
   SIDEBAR LEFT
   ===================================================================== */
.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--r);
    color: var(--ink);
    font-weight: 500;
    font-size: 15px;
    transition: background .15s, color .15s;
}
.nav-item:hover  { background: var(--paper-soft); color: var(--ink); }
.nav-item.active { background: var(--red-soft); color: var(--red); font-weight: 700; }
.nav-item .icon  { width: 22px; height: 22px; flex-shrink: 0; }

.nav-divider {
    height: 1px;
    background: var(--line);
    margin: 12px 8px;
}

.nav-cta {
    margin: 10px 8px;
}

.sidebar-foot {
    margin-top: auto;
    padding: 12px 8px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-foot .avatar {
    width: 36px; height: 36px;
    border-radius: var(--r-pill);
    background: var(--paper-soft);
    object-fit: cover;
    flex-shrink: 0;
}
.sidebar-foot .who {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.sidebar-foot .who strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.sidebar-foot .who small {
    font-size: 11px;
    color: var(--muted);
}

/* =====================================================================
   SIDEBAR RIGHT — widgets
   ===================================================================== */
.widget {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

/* Widget "Siguiendo": grid de avatares */
.following-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.following-avatar {
    aspect-ratio: 1;
    display: block;
    overflow: hidden;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color .15s, transform .15s;
}
.following-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.following-avatar:hover {
    border-color: var(--red);
    transform: scale(1.05);
}

/* Widget "A quién seguir": rows con avatar + meta + boton */
.suggest-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.suggest-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.suggest-avatar { flex-shrink: 0; }
.suggest-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
.suggest-body {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}
.suggest-name {
    color: var(--ink);
    font-weight: 700;
    font-size: 13.5px;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.suggest-name:hover { color: var(--red); }
.suggest-meta {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
}
.suggest-row .btn-follow,
.suggest-row .btn { flex-shrink: 0; }
.btn-follow.is-following {
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--line);
}
.widget-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.widget-title .accent { color: var(--red); }

/* =====================================================================
   CARDS GENERIC
   ===================================================================== */
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-pad { padding: 16px; }

/* =====================================================================
   AUTH FORMS (register / login)
   ===================================================================== */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(200, 16, 46, .08), transparent),
        var(--paper-soft);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 28px;
    box-shadow: var(--shadow-lg);
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    font-weight: 900;
    font-size: 22px;
}
.auth-title {
    font-size: 22px;
    font-weight: 800;
    margin: 14px 0 4px;
    letter-spacing: -.01em;
}
.auth-sub {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.field {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
}
.field input, .field select, .field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: var(--paper);
    border-radius: var(--r-sm);
    font-size: 15px;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(14, 16, 21, .08);
}

.form-error {
    background: var(--red-soft);
    border: 1px solid var(--red);
    color: var(--red-dark);
    padding: 10px 12px;
    border-radius: var(--r-sm);
    font-size: 14px;
    margin-bottom: 14px;
}
.form-success {
    background: #E7F8EC;
    border: 1px solid #1A8C3A;
    color: #146B2C;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    font-size: 14px;
    margin-bottom: 14px;
}

.auth-foot {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    color: var(--muted);
}
.auth-foot a { color: var(--red); font-weight: 600; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 16px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 700;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* =====================================================================
   FLASH (toast en top corner)
   ===================================================================== */
.flash {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    padding: 12px 18px;
    border-radius: var(--r-pill);
    background: #1F232B;   /* fijo: pill oscura legible en ambos temas (no usa --ink, que se invierte) */
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: flashIn .25s ease, flashOut .3s ease 4.7s forwards;
}
.flash-success { background: #1A8C3A; }
.flash-error   { background: var(--red); }
@keyframes flashIn  { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes flashOut { to { opacity: 0; transform: translate(-50%, -10px); } }

/* =====================================================================
   MOBILE BOTTOM NAV (≤ 720px)
   ===================================================================== */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--paper);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0);
    /* Promover a capa propia: estabiliza el position:fixed en iOS Safari
       durante el scroll (evita el drift del bottom-nav). */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}
.mobile-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    max-width: 520px;
    margin: 0 auto;
}
.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    min-height: 56px;
}
.mobile-nav-item .icon { width: 22px; height: 22px; position: relative; }
.mobile-nav-item .icon .badge {
    position: absolute;
    top: -6px;
    right: -10px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--paper);
}
.mobile-nav-item.active { color: var(--red); }
.mobile-nav-post {
    background: var(--red);
    color: #fff;
    border-radius: var(--r-pill);
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    margin: -8px 0;
}
.mobile-nav-post:hover { background: var(--red-dark); }
.mobile-nav-login { color: var(--red); font-weight: 700; }
.mobile-nav-login .icon { color: var(--red); }

@media (max-width: 720px) {
    .mobile-nav { display: block; }
    body { padding-bottom: 80px; }
}

/* =====================================================================
   UTILS
   ===================================================================== */
.text-muted   { color: var(--muted); }
.text-red     { color: var(--red); }
.text-bold    { font-weight: 700; }
.text-center  { text-align: center; }
.spacer       { flex: 1; }
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.gap-2        { gap: 8px; }
.gap-3        { gap: 12px; }
.mt-2         { margin-top: 8px; }
.mt-3         { margin-top: 12px; }
.mt-4         { margin-top: 16px; }
.hidden       { display: none !important; }
.sr-only      {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* =====================================================================
   POST CARDS
   ===================================================================== */
.post {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    /* Sin overflow:hidden — clipaba el dropdown del menú de tres puntos.
       Los elementos internos que necesitan clip (img-grid, link-preview,
       repost-embed) manejan su propio border-radius + overflow:hidden. */
}
.post-head {
    display: flex;
    gap: 12px;
    padding: 14px 16px 8px;
}
.post-avatar { flex-shrink: 0; }
.post-avatar img {
    width: 42px;
    height: 42px;
    border-radius: var(--r-pill);
    object-fit: cover;
    background: var(--paper-soft);
}
.post-meta { flex: 1; min-width: 0; }
.post-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 14.5px;
    color: var(--ink);
}
.post-meta-sub {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}
.post-author {
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
}
.post-author:hover { color: var(--red); }

/* Actions del header del post (Seguir + menú ⋯) */
.post-head-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.post-head-actions .btn-follow {
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 700;
    height: auto;
    min-height: 30px;
    transition: opacity .25s;
}
/* Cuando el usuario ya sigue al autor desde el post-card, el botón desaparece */
.post-head-actions .btn-follow.is-following {
    opacity: 0;
    pointer-events: none;
    width: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

/* "Dejar de seguir" item del menú: se oculta si el viewer aún no sigue al autor */
.post-menu-item.unfollow-menu-item.is-not-following { display: none; }

/* Menú "..." de cada post — ya no es absolute, vive dentro de .post-head-actions */
.post { position: relative; }
.post-menu {
    position: relative;
    z-index: 4;
}
.post-menu-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--paper-soft);
    color: var(--ink);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s, border-color .15s;
}
.post-menu-btn:hover,
.post-menu-btn[aria-expanded="true"] {
    background: var(--paper-soft);
    color: var(--ink);
    border-color: var(--line);
}
.post-menu-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 220px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.post-menu-dropdown[hidden] { display: none; }
.post-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.post-menu-item:hover { background: var(--paper-soft); }
.post-menu-item-danger { color: var(--red); }
.post-menu-item-danger:hover { background: var(--red); color: #fff; }
.post-menu-icon { font-size: 1.05rem; line-height: 1; }
.post-menu-form { display: block; margin: 0; padding: 0; }
.post-menu-form button { width: 100%; }
/* Separador + etiqueta de la sección de Moderación (mods/admins) */
.post-menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.post-menu-label {
    padding: 6px 12px 4px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--red);
}

/* Modal genérico para reportar / eliminar */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal-dialog {
    background: var(--paper);
    border-radius: 14px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal-dialog-wide { max-width: 640px; }

/* Cropper stage dentro del modal */
.cropper-stage {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    max-height: 60vh;
}
.cropper-stage img {
    display: block;
    max-width: 100%;
}
.cropper-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.cropper-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
    color: var(--ink);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cropper-btn:hover { background: var(--paper-soft); }
.modal-header {
    padding: 18px 20px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.modal-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--ink);
}
.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--ink-soft);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}
.modal-close:hover { background: var(--paper-soft); color: var(--ink); }
.modal-body {
    padding: 8px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.modal-body label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ink);
}
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--paper);
    color: var(--ink);
    box-sizing: border-box;
}
.modal-body textarea { resize: vertical; min-height: 90px; }
.modal-footer {
    padding: 12px 20px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--line);
    background: var(--paper-soft);
}
.modal-btn {
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
    font-size: 0.95rem;
}
.modal-btn:hover { background: var(--paper-soft); }
.modal-btn-primary {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}
.modal-btn-primary:hover { background: #a30000; border-color: #a30000; }
.modal-btn-primary:disabled { opacity: 0.6; cursor: wait; }
.modal-error {
    color: var(--red);
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 1.2em;
}
/* Inline link en body del post: muestra "link" en chip pequeño en vez del URL crudo */
.inline-link {
    display: inline-block;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--red);
    background: var(--paper-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    text-decoration: none;
    vertical-align: baseline;
    margin: 0 2px;
}
.inline-link:hover {
    background: var(--paper);
    border-color: var(--red);
}
.inline-link::before { content: "🔗 "; opacity: 0.7; }
.post-author-meta {
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
    margin-left: 2px;
}
.verified-badge { display: inline-flex; align-items: center; }
.post-dot { color: var(--muted); }
.post-time { font-size: 13px; color: var(--muted); }
.post-time-link {
    color: var(--muted);
    text-decoration: none;
    border-radius: 4px;
    padding: 0 2px;
    transition: color .15s, text-decoration-color .15s;
}
.post-time-link:hover { color: var(--ink); text-decoration: underline; }
.post-time-link:hover .post-time { color: var(--ink); }

/* ============================================
   Live channels carousel
   ============================================ */
.live-carousel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 12px 0 12px 12px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
}
.live-carousel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 12px;
    margin-bottom: 10px;
}
.live-carousel-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #d11;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.live-carousel-meta {
    font-size: 11px;
    color: var(--muted);
    margin-left: auto;
}
.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d11;
    box-shadow: 0 0 0 0 rgba(221,17,17,0.6);
    animation: live-pulse 1.4s infinite;
    display: inline-block;
}
.live-dot-sm { width: 6px; height: 6px; }
@keyframes live-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(221,17,17,0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(221,17,17,0); }
    100% { box-shadow: 0 0 0 0 rgba(221,17,17,0); }
}
.live-carousel-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: auto;
    cursor: grab;
    padding-right: 12px;
    /* Ocultar scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
    user-select: none;
}
.live-carousel-track::-webkit-scrollbar { display: none; }
.live-carousel-track.is-grabbing { cursor: grabbing; }
.live-carousel-track.is-grabbing .live-card { pointer-events: none; } /* no click durante drag */

.live-card {
    flex-shrink: 0;
    width: 156px;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: var(--paper-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: transform .12s, border-color .12s, box-shadow .12s;
    font-family: inherit;
    overflow: hidden;
}
.live-card:hover {
    transform: translateY(-2px);
    border-color: #d11;
    box-shadow: 0 4px 14px rgba(221,17,17,0.18);
}
.live-card-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #111;
    background-size: cover;
    background-position: center;
    position: relative;
}
.live-card-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #d11;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .07em;
    padding: 3px 6px 3px 5px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}
.live-card-badge .live-dot {
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255,255,255,0.7);
}
@keyframes live-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(221,17,17,0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(221,17,17,0); }
    100% { box-shadow: 0 0 0 0 rgba(221,17,17,0); }
}
.live-card-badge .live-dot {
    animation: live-pulse-white 1.4s infinite;
}
@keyframes live-pulse-white {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.7); }
    70%  { box-shadow: 0 0 0 6px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
.live-card-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    min-width: 0;
}
.live-card-logo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--paper);
}
.live-card-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    min-width: 0;
    flex: 1;
}

/* Player modal (16:9 iframe) */
.live-player-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    position: relative;
}
.live-player-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Inline YouTube player (en post-card) — lazy load */
.yt-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    margin-bottom: 8px;
}
.yt-player-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    padding: 0;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    background-color: #111;
    transition: filter .15s;
}
.yt-player-thumb:hover { filter: brightness(1.1); }
.yt-play-btn {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.92;
    transition: transform .15s, opacity .15s;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}
.yt-player-thumb:hover .yt-play-btn { transform: translate(-50%,-50%) scale(1.08); opacity: 1; }
.yt-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* TikTok embed — vertical 9:16, centrado en la card */
/* Video subido por el usuario: carátula + botón play (lazy-load) */
.uv-player { position: relative; width: 100%; margin: 8px 0; }
.uv-player-thumb {
    position: relative;
    display: block;
    width: 100%;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    background: #000;
    border-radius: var(--r-sm);
    overflow: hidden;
}
.uv-player-thumb.uv-no-poster {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #1f1f1f 0%, #000 100%);
}
.uv-poster {
    display: block;
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    background: #000;
}
.uv-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(196,30,58,0.92);          /* rojo de marca, alto contraste */
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 4px 18px rgba(0,0,0,0.55);
    transition: transform .15s, background .15s;
}
.uv-play-btn svg { width: 42px; height: 42px; margin-left: 2px; }   /* triángulo grande, óptico-centrado */
.uv-player-thumb:hover .uv-play-btn { transform: translate(-50%,-50%) scale(1.1); background: #C41E3A; }
.uv-player video {
    display: block;
    width: 100%;
    max-height: 70vh;
    border-radius: var(--r-sm);
    background: #000;
}

.tt-player {
    position: relative;
    width: 100%;
    max-width: 380px;
    aspect-ratio: 9 / 16;
    background: #000;
    overflow: hidden;
    margin: 8px auto;
    border-radius: 8px;
}
.tt-player-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    padding: 0;
    cursor: pointer;
    background-color: #000;
    background-image: linear-gradient(135deg, #25F4EE 0%, #000 50%, #FE2C55 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: filter .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tt-player-thumb:hover { filter: brightness(1.1); }
.tt-play-btn {
    pointer-events: none;
    opacity: 0.95;
    transition: transform .15s;
    filter: drop-shadow(0 2px 12px rgba(0,0,0,0.6));
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tt-player-thumb:hover .tt-play-btn { transform: scale(1.08); }
.tt-brand {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 16px;
}
.tt-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.yt-caption {
    padding: 6px 14px 0;
    margin-bottom: 8px;
}
.yt-caption-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    display: block;
    line-height: 1.3;
}
.yt-caption-title:hover { color: var(--red); text-decoration: underline; }
.yt-caption-meta {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 3px;
}

/* Image-compose modal */
.ic-dropzone {
    position: relative;
    border: 2px dashed var(--line);
    border-radius: 10px;
    min-height: 200px;
    background: var(--paper-soft);
    transition: border-color .15s, background .15s;
    cursor: pointer;
    overflow: hidden;
}
.ic-dropzone:hover { border-color: var(--red); background: var(--paper); }
.ic-dropzone.is-dragover {
    border-color: var(--red);
    background: rgba(200, 16, 46, 0.06);
}
.ic-dropzone-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 12px;
    color: var(--muted);
    text-align: center;
    height: 100%;
}
.ic-dropzone-empty[hidden] { display: none !important; }
.ic-dropzone-preview {
    position: relative;
    text-align: center;
    background: #000;
}
.ic-dropzone-preview[hidden] { display: none !important; }
.ic-dropzone-preview img {
    max-width: 100%;
    max-height: 300px;
    display: block;
    margin: 0 auto;
}
/* Cuando hay preview, el dropzone deja de tener el cursor de "subir" */
.ic-dropzone.has-image { cursor: default; border-style: solid; }
.ic-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ic-remove:hover { background: var(--red); }

/* Repost embed — card-dentro-de-card mostrando el post original */
.repost-embed {
    display: block;
    margin: 0 16px 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper-soft);
    text-decoration: none;
    color: inherit;
    transition: background .15s, border-color .15s;
}
.repost-embed:hover { background: var(--paper); border-color: var(--line-strong, #c8c8c8); }
.repost-embed-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}
.repost-embed-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.repost-embed-name {
    color: var(--ink);
    font-weight: 700;
}
.repost-embed-time { font-size: 12px; }
.repost-embed-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    background-color: var(--paper);
    border-radius: 6px;
    margin-bottom: 8px;
}
.repost-embed-text {
    color: var(--ink);
    font-size: 14.5px;
    line-height: 1.4;
    word-wrap: break-word;
}
.repost-embed-excerpt {
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.4;
    margin-top: 4px;
}

/* Botón Instalar app (PWA) en sidebar / drawer */
.sidebar-install-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 16px);
    margin: 12px 8px 6px;
    padding: 10px 14px;
    background: var(--paper-soft);
    border: 1px solid var(--line);
    border-radius: var(--r);
    color: var(--ink);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    transition: background .15s, border-color .15s;
}
.sidebar-install-btn:hover {
    background: var(--paper);
    border-color: var(--red);
    color: var(--red);
}
.sidebar-install-btn .icon { color: var(--red); flex-shrink: 0; line-height: 0; }

/* Widget de publicidad en sidebar — vertical 9:16 */
.sidebar-ad {
    display: block;
    position: relative;
    margin: 10px 14px 6px;
    border-radius: 12px;
    overflow: hidden;
    width: auto;
    aspect-ratio: 9 / 16;
    flex-shrink: 0;
    flex-grow: 0;
    background: #000;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    transition: transform .15s ease, box-shadow .15s ease;
}
.sidebar-ad:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.sidebar-ad-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}
.sidebar-ad-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(200, 16, 46, .92);
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .5px;
    padding: 3px 7px;
    border-radius: 4px;
    line-height: 1.2;
    z-index: 2;
}
.sidebar-ad-cta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 18px 10px 10px;
    background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.5) 60%, rgba(0,0,0,0) 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    z-index: 2;
    line-height: 1.3;
}

/* Links legales en sidebar foot */
.sidebar-legal {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    padding: 6px 14px 12px;
    font-size: 11.5px;
    color: var(--muted);
}
.sidebar-legal a {
    color: var(--muted);
    text-decoration: none;
}
.sidebar-legal a:hover { color: var(--ink); text-decoration: underline; }

/* =====================================================================
   PÁGINA ANUNCIAR
   ===================================================================== */
.anunciar-card { padding: 32px; max-width: 820px; }
.anunciar-hero { text-align: center; margin-bottom: 32px; }
.anunciar-hero-chip {
    display: inline-block;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 6px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}
.anunciar-title {
    font-size: 34px;
    line-height: 1.15;
    font-weight: 900;
    color: var(--ink);
    margin-bottom: 14px;
    letter-spacing: -.5px;
}
.anunciar-accent {
    color: var(--red);
    position: relative;
    white-space: nowrap;
}
.anunciar-lead {
    font-size: 17px;
    line-height: 1.55;
    color: var(--ink-soft);
    max-width: 620px;
    margin: 0 auto;
}
.anunciar-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 28px 0 28px;
}
.anunciar-card-feature {
    background: var(--paper, #f8f8f8);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 16px;
}
.anunciar-emoji {
    font-size: 28px;
    line-height: 1;
    margin-bottom: 8px;
}
.anunciar-card-feature h3 {
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 6px;
}
.anunciar-card-feature p {
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-soft);
    margin: 0;
}
.anunciar-cta-box {
    background: linear-gradient(135deg, rgba(200,16,46,.06) 0%, rgba(200,16,46,.02) 100%);
    border: 2px solid rgba(200,16,46,.15);
    border-radius: 14px;
    padding: 26px 22px;
    text-align: center;
}
.anunciar-cta-title {
    font-size: 22px;
    font-weight: 900;
    color: var(--ink);
    margin-bottom: 6px;
}
.anunciar-cta-sub {
    font-size: 15px;
    color: var(--ink-soft);
    margin-bottom: 18px;
}
.anunciar-mail-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--red);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    padding: 14px 24px;
    border-radius: 10px;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}
.anunciar-mail-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(200,16,46,.3);
    color: #fff;
}
.anunciar-cta-foot {
    margin-top: 12px;
    font-size: 13px;
    color: var(--muted);
}

@media (max-width: 700px) {
    .anunciar-card { padding: 20px; }
    .anunciar-title { font-size: 26px; }
    .anunciar-lead { font-size: 15px; }
    .anunciar-grid { grid-template-columns: 1fr; }
    .anunciar-mail-btn { font-size: 16px; padding: 12px 18px; }
}

/* Modal de compartir */
.share-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
.share-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 8px;
    background: var(--paper, #f7f7f7);
    border: 1px solid var(--line);
    border-radius: 10px;
    text-decoration: none;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.share-opt:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,.1);
}
.share-facebook   { color: #1877F2; }
.share-facebook:hover  { background: rgba(24,119,242,.08); color: #1877F2; }
.share-twitter    { color: #000; }
.share-twitter:hover   { background: #000; color: #fff; }
.share-whatsapp   { color: #25D366; }
.share-whatsapp:hover  { background: rgba(37,211,102,.1); color: #25D366; }
.share-telegram   { color: #229ED9; }
.share-telegram:hover  { background: rgba(34,158,217,.1); color: #229ED9; }
.share-email      { color: var(--ink-soft); }
.share-email:hover     { background: var(--ink-soft); color: #fff; }
.share-copy       { color: var(--red); border-color: var(--red-soft, rgba(200,16,46,.3)); }
.share-copy:hover      { background: rgba(200,16,46,.08); color: var(--red); }
.share-url-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.share-url-row input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
    color: var(--ink-soft);
    background: var(--paper, #f7f7f7);
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.share-url-copy-btn {
    flex-shrink: 0;
    padding: 0 14px;
    background: var(--red);
    color: #fff;
    border: 0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.share-url-copy-btn:hover { filter: brightness(1.05); }
.share-url-copy-btn:active { transform: scale(0.97); }

@media (max-width: 480px) {
    .share-grid { grid-template-columns: 1fr 1fr; }
}

/* Botones "Descargar" debajo de imágenes de post (cuando author lo permite) */
.post-img-download-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 14px 0;
}
.post-img-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--paper-soft, #f5f5f5);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}
.post-img-download:hover {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

/* Botón que parece link (logout en sidebar, etc.) */
.linklike {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.linklike:hover { opacity: .85; }

/* Hashtag inline */
.hashtag {
    color: var(--red);
    font-weight: 600;
    text-decoration: none;
}
.hashtag:hover { text-decoration: underline; }

/* Infinite scroll sentinel */
.feed-sentinel {
    text-align: center;
    padding: 24px 12px;
    font-size: 13px;
    color: var(--muted);
    min-height: 60px;
}
.feed-sentinel .feed-sentinel-text { display: inline-block; }
.feed-sentinel.is-loading .feed-sentinel-text::after {
    content: '';
    display: inline-block;
    width: 12px; height: 12px;
    margin-left: 8px;
    border: 2px solid var(--line);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: feed-spin .8s linear infinite;
    vertical-align: -2px;
}
.feed-sentinel.is-end { opacity: 0.7; }
@keyframes feed-spin { to { transform: rotate(360deg); } }
.post-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-soft);
    text-decoration: none;
    transition: background .15s;
}
.chip:hover { background: var(--paper-soft); }
.chip-breaking {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    letter-spacing: .04em;
}

.post-cover {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--paper-soft) center / cover no-repeat;
    border-bottom: 1px solid var(--line);
}
.post-body { padding: 8px 16px 12px; }
.post-title {
    font-size: 19px;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 6px;
    letter-spacing: -.01em;
}
.post-title a { color: var(--ink); text-decoration: none; }
.post-title a:hover { color: var(--red); }
.post-excerpt {
    color: var(--ink-soft);
    font-size: 14.5px;
    line-height: 1.45;
    margin-bottom: 8px;
}
.post-content {
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.post-image {
    display: block;
    margin-top: 8px;
    border-radius: var(--r-sm);
    overflow: hidden;
}

/* Link preview card (embed estilo Facebook para URLs de noticias) */
.link-preview {
    display: block;
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    background: var(--paper-soft);
    transition: background .15s ease, border-color .15s ease;
}
.link-preview:hover {
    background: var(--paper);
    border-color: var(--line-strong, #c8c8c8);
}
.link-preview-cover {
    display: block;
    width: 100%;
    min-height: 180px;            /* fallback si aspect-ratio no soportado */
    aspect-ratio: 1.91 / 1;
    background-size: cover;
    background-position: center;
    background-color: #1a1a1a;
    background-repeat: no-repeat;
    border-bottom: 1px solid var(--line);
}
@supports (aspect-ratio: 1 / 1) {
    .link-preview-cover { min-height: 0; }
}
.link-preview-body {
    padding: 10px 12px 12px;
}
.link-preview-source {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}
.link-preview-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.link-preview-title {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--ink);
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.link-preview-excerpt {
    font-size: 13px;
    line-height: 1.4;
    color: var(--ink-soft);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-image img { width: 100%; height: auto; display: block; }

.post-foot {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 6px 12px 10px;
    border-top: 1px solid var(--line-soft);
    margin-top: 4px;
}
/* Label de texto en una acción (ej. "Comentar") — siempre visible, también en
   mobile (a diferencia de los contadores). Bold para contraste/legibilidad. */
.post-action .post-action-text { font-weight: 700; }
.post-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--r-pill);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.post-action:hover { background: var(--paper-soft); color: var(--red); }
.post-action[data-action="like"]:hover { color: var(--red); }
.post-action[data-action="save"]:hover { color: var(--ink); }

/* =====================================================================
   COMPOSER INLINE
   ===================================================================== */
.composer {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}
.composer-row { display: flex; gap: 12px; align-items: flex-start; }
.composer-avatar {
    width: 42px; height: 42px;
    border-radius: var(--r-pill);
    object-fit: cover;
    flex-shrink: 0;
}
.composer textarea {
    width: 100%;
    min-height: 60px;
    border: 0;
    background: transparent;
    resize: vertical;
    font-size: 16px;
    color: var(--ink);
    padding: 6px 0;
}
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--muted); }
.composer-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
}
.composer-article-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}
.composer-article-link:hover { color: var(--red); }

/* =====================================================================
   PAGINATION
   ===================================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 20px 0;
}
.pagination-btn {
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    color: var(--ink);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.pagination-btn:hover { background: var(--paper-soft); border-color: var(--ink); }
.pagination-btn-disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
}
.pagination-info {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

/* Botón activo en composer tabs */
.btn-active { border-color: var(--ink); background: var(--paper-soft); font-weight: 700; }

/* Mobile post tweaks */
@media (max-width: 600px) {
    .post-head { padding: 12px 14px 6px; }
    .post-body { padding: 6px 14px 10px; }
    .post-title { font-size: 17px; }
    /* En móvil mostramos el CONTADOR (ícono + número, estilo Twitter/FB) y
       ocultamos la etiqueta de texto "Comentar", que es la que roba espacio.
       Antes se ocultaba el número y se perdía la señal de engagement. */
    .post-action .post-action-text { display: none; }
    .post-foot { gap: 2px; }
    .post-action { padding: 8px 8px; }
    .post-action span[data-count]:empty,
    .post-action span:not(.post-action-text):empty { display: none; }
}

/* =====================================================================
   ARTICLE DETAIL PAGE
   ===================================================================== */
.article-detail {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}
.back-link {
    display: inline-block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    text-decoration: none;
}
.back-link:hover { color: var(--red); }

.article-title {
    font-size: 30px;
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -.02em;
    margin-bottom: 10px;
    color: var(--ink);
}
.article-dek {
    font-size: 18px;
    color: var(--ink-soft);
    line-height: 1.4;
    margin-bottom: 16px;
    font-family: var(--font-serif);
}
.article-byline {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 20px;
}
.article-byline .post-avatar img { width: 36px; height: 36px; }
.article-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--paper-soft) center / cover no-repeat;
    border-radius: var(--r-sm);
    margin-bottom: 20px;
}
.article-body {
    font-size: 17px;
    line-height: 1.65;
    color: var(--ink);
    font-family: var(--font-serif);
    word-wrap: break-word;
}
.article-body p { margin-bottom: 16px; }
.article-body > p:first-of-type::first-letter {
    font-size: 3.4em;
    font-weight: 900;
    color: var(--red);
    float: left;
    line-height: .9;
    padding: 4px 8px 0 0;
}
.article-body h2, .article-body h3, .article-body h4 {
    font-family: var(--font-sans);
    font-weight: 800;
    color: var(--ink);
    margin: 28px 0 12px;
    line-height: 1.25;
}
.article-body h2 { font-size: 22px; }
.article-body h3 { font-size: 19px; }
.article-body h4 { font-size: 17px; }
.article-body ul, .article-body ol {
    margin: 0 0 16px 0;
    padding-left: 24px;
}
.article-body li { margin-bottom: 6px; }
.article-body blockquote {
    border-left: 4px solid var(--red);
    margin: 16px 0;
    padding: 8px 18px;
    color: var(--ink-soft);
    font-style: italic;
    background: var(--paper-2, rgba(200, 16, 46, 0.04));
}
.article-body a {
    color: var(--red);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1.5px;
}
.article-body a:hover { background: rgba(200, 16, 46, 0.08); }
.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
    display: block;
}
.article-body figure { margin: 16px 0; }
.article-body figcaption {
    font-size: 14px;
    color: var(--ink-soft);
    font-style: italic;
    margin-top: 6px;
    text-align: center;
}
.article-body strong, .article-body b { font-weight: 800; }

/* Botón "Leer artículo completo en la fuente" al final del article-body */
.article-source {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}
.article-source .btn {
    font-weight: 700;
}

@media (max-width: 600px) {
    .article-detail { padding: 16px; }
    .article-title { font-size: 24px; }
    .article-dek { font-size: 16px; }
    .article-body { font-size: 16px; line-height: 1.55; }
    .article-body h2 { font-size: 20px; }
    .article-body h3 { font-size: 18px; }
}

/* =====================================================================
   FEATURED OUTLET CARD
   ===================================================================== */
.outlet-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}
.outlet-cover {
    width: 100%;
    height: 160px;
    background: var(--paper-soft) center / cover no-repeat;
    position: relative;
}
.outlet-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.15));
}
.outlet-cover-default {
    background: linear-gradient(135deg, var(--red), var(--red-dark));
}
.outlet-body {
    display: flex;
    gap: 16px;
    padding: 0 20px 18px;
    position: relative;
}
.outlet-avatar {
    margin-top: -42px;
    flex-shrink: 0;
}
.outlet-avatar img {
    width: 84px;
    height: 84px;
    border-radius: 18px;
    object-fit: cover;
    border: 4px solid var(--paper);
    background: var(--paper);
    box-shadow: var(--shadow);
}
.outlet-meta { flex: 1; min-width: 0; padding-top: 12px; }
.outlet-name-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.outlet-name {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -.02em;
    color: var(--ink);
}
.outlet-bio {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
}
.outlet-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}
.outlet-stats strong { color: var(--ink); font-weight: 800; }
.outlet-dot { color: var(--line); }

/* =====================================================================
   TEMA DEL DÍA BANNER
   ===================================================================== */
.tema-banner {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--r);
    background: linear-gradient(135deg, #0E1015 0%, #1a1d24 100%);
    margin-bottom: 14px;
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow);
    border: 1px solid var(--ink);
    transition: transform .2s, box-shadow .2s;
}
.tema-banner:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: #fff;
}
.tema-bg {
    position: absolute;
    inset: 0;
    background: center / cover no-repeat;
    opacity: .25;
    z-index: 0;
}
.tema-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(14,16,21,.95) 0%, rgba(14,16,21,.7) 40%, rgba(200,16,46,.4) 100%);
    z-index: 1;
}
.tema-inner {
    position: relative;
    z-index: 2;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.tema-label {
    display: inline-block;
    background: var(--red);
    color: #fff;
    padding: 4px 12px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .12em;
    border-radius: var(--r-pill);
    flex-shrink: 0;
}
.tema-headline {
    flex: 1;
    min-width: 0;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.01em;
    margin: 0;
    color: #fff;
}
.tema-dek {
    flex: 1 0 100%;
    color: rgba(255,255,255,.75);
    font-size: 13px;
    margin: 0;
    line-height: 1.4;
}
.tema-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--red);
    color: #fff;
    padding: 9px 18px;
    border-radius: var(--r-pill);
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    transition: background .15s;
}
.tema-banner:hover .tema-cta { background: var(--red-dark); }

@media (max-width: 600px) {
    .tema-inner { padding: 18px; gap: 10px; }
    .tema-headline { font-size: 18px; }
    .tema-cta { width: 100%; justify-content: center; }
}

/* =====================================================================
   IMAGE GRID en post-card (1/2/3/4 imágenes)
   ===================================================================== */
.img-grid {
    display: grid;
    gap: 2px;
    border-radius: var(--r-sm);
    overflow: hidden;
    margin-top: 10px;
    background: var(--paper-soft);
}
/* Grids con 2/3/4 imágenes mantienen 16:9 fijo (collage estilo Twitter) */
.img-grid-2, .img-grid-3, .img-grid-4 { aspect-ratio: 16 / 9; }
/* Grid con 1 imagen: el aspect lo dicta la celda (puede ser cualquier ratio).
   Si no tenemos dimensiones (legacy), fallback a 4:3 (más razonable que 16:9
   para fotos de celular típicas). El JS post-load corrige si puede leerlas. */
.img-grid-1 .img-grid-cell { aspect-ratio: 4/3; }

.img-grid-cell {
    background: var(--paper-soft) center / cover no-repeat;
    transition: filter .15s;
    display: block;
}
.img-grid-cell:hover { filter: brightness(1.08); }
/* Imágenes verticales que exceden 3:4 (ej: 9:16): el contenedor queda en 3:4
   y la imagen se ajusta al alto manteniendo proporción (bandas a los lados). */
.img-grid-cell-contain {
    background-size: contain;
    background-color: #000;
}

.img-grid-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.img-grid-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.img-grid-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.img-grid-3 .img-grid-cell:nth-child(1) { grid-row: 1 / span 2; }
.img-grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
/* 5-8 imágenes (premium): collage de 3 columnas, celdas cuadradas */
.img-grid-many { grid-template-columns: repeat(3, 1fr); }
.img-grid-many .img-grid-cell { aspect-ratio: 1 / 1; }

/* =====================================================================
   TRENDING WIDGET (sidebar right)
   ===================================================================== */
.trending-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.trending-list li { margin-bottom: 4px; }
.trending-item {
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 6px 4px;
    border-radius: var(--r-sm);
    text-decoration: none;
    color: var(--ink);
    transition: background .15s;
}
.trending-item:hover { background: var(--paper-soft); color: var(--ink); }
.trending-rank {
    flex-shrink: 0;
    width: 22px; height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: #fff;
    border-radius: 6px;
    font-weight: 800;
    font-size: 12px;
    align-self: center;
}
.trending-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    background: var(--paper-soft) center / cover no-repeat;
    border-radius: var(--r-sm);
}
.trending-content { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.trending-title {
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.trending-meta {
    font-size: 11px;
    color: var(--muted);
}
.trending-cat { font-weight: 700; }
.trending-flame { color: var(--red); }

/* =====================================================================
   POLL MINI (sidebar right)
   ===================================================================== */
.poll-mini {
    padding: 6px 2px;
    border-bottom: 1px solid var(--line-soft);
}
.poll-mini:last-child { border-bottom: 0; }
.poll-mini-q {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.3;
    margin-bottom: 6px;
}
.poll-mini-bar {
    height: 5px;
    background: var(--paper-soft);
    border-radius: var(--r-pill);
    overflow: hidden;
    margin-bottom: 6px;
}
.poll-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--red), var(--red-dark));
}
.poll-mini-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.poll-mini-pct {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
}
.btn-sm {
    min-height: 28px;
    padding: 0 12px;
    font-size: 12px;
}

/* =====================================================================
   REGION ROW (sidebar right)
   ===================================================================== */
.region-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 2px;
    border-bottom: 1px solid var(--line-soft);
    text-decoration: none;
    color: var(--ink);
    transition: background .15s;
}
.region-row:last-child { border-bottom: 0; }
.region-row:hover { background: var(--paper-soft); color: var(--ink); }
.region-thumb {
    width: 44px; height: 44px;
    background: var(--paper-soft) center / cover no-repeat;
    border-radius: var(--r-sm);
    flex-shrink: 0;
}
.region-info { flex: 1; min-width: 0; }
.region-name {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
}
.region-meta {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-top: 1px;
}
.region-count {
    font-size: 12px;
    font-weight: 800;
    color: var(--ink);
    text-align: right;
    flex-shrink: 0;
}
.region-up { color: #1A8C3A; font-weight: 900; margin-right: 2px; }

/* =====================================================================
   TOPIC CHIPS
   ===================================================================== */
.topics-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}
.topic-chip {
    background: var(--paper-soft);
    color: var(--ink-soft);
    padding: 5px 12px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.topic-chip:hover { background: var(--red); color: #fff; }

/* widget empty state */
.widget-empty {
    color: var(--muted);
    font-size: 13px;
    padding: 12px 0;
    text-align: center;
}

/* =====================================================================
   COMPOSER UPGRADES
   ===================================================================== */
.compose-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    padding: 4px;
    background: var(--paper-soft);
    border-radius: var(--r-pill);
}
.compose-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--r-pill);
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.compose-tab:hover { color: var(--ink); }
.compose-tab.active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }

.composer-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--r-pill);
    color: var(--red);
    cursor: pointer;
    transition: background .15s;
}
.composer-icon-link:hover { background: var(--red-soft); }

/* File input styling */
input[type="file"] {
    padding: 10px 12px;
    border: 1px dashed var(--line);
    background: var(--paper-soft);
    border-radius: var(--r-sm);
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}
input[type="file"]:hover { border-color: var(--red); }

/* =====================================================================
   PROFILE PAGE
   ===================================================================== */
.profile-header {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}
.profile-cover {
    width: 100%;
    aspect-ratio: 3 / 1;
    max-height: 220px;
    background: var(--paper-soft) center / cover no-repeat;
    position: relative;
}
.profile-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,.12));
    pointer-events: none;
}
.profile-body {
    padding: 0 22px 22px;
    position: relative;
}
.profile-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.profile-avatar {
    margin-top: -56px;
    flex-shrink: 0;
    position: relative;
}

/* Botón overlay para editar foto (avatar o cover) */
.profile-img-edit {
    position: absolute;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-weight: 700;
    transition: background .15s, transform .15s;
    z-index: 3;
}
.profile-img-edit:hover { background: rgba(0,0,0,0.9); transform: scale(1.05); }
.profile-img-edit-avatar {
    bottom: 6px;
    right: 6px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    padding: 0;
    border: 2px solid var(--paper);
}
.profile-img-edit-cover {
    top: 12px;
    right: 12px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
}
@media (max-width: 640px) {
    .profile-img-edit-cover span { display: none; }
    .profile-img-edit-cover { padding: 8px; }
}
.profile-avatar img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--paper);
    background: var(--paper);
    box-shadow: var(--shadow);
}
.profile-actions {
    padding-top: 14px;
    flex-shrink: 0;
}
.profile-identity {
    margin-top: 12px;
}
.profile-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -.02em;
    color: var(--ink);
    margin: 0 0 2px;
    line-height: 1.15;
}
.profile-handle { font-size: 15px; color: var(--muted); font-weight: 500; }
.profile-bio { font-size: 15px; color: var(--ink-soft); margin: 12px 0; line-height: 1.45; max-width: 600px; }
.profile-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 13px;
    color: var(--muted);
    margin: 10px 0 14px;
}
.profile-meta-item { display: inline-flex; align-items: center; gap: 6px; }
.profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    font-size: 14px;
}
.profile-stats > span:hover { color: var(--ink); }
.profile-stats strong { color: var(--ink); font-weight: 800; margin-right: 4px; }

@media (max-width: 600px) {
    .profile-body { padding: 0 16px 18px; }
    .profile-name { font-size: 22px; }
    .profile-avatar img { width: 96px; height: 96px; margin-top: -48px; }
    .profile-avatar { margin-top: -48px; }
    .profile-stats { gap: 14px; font-size: 13px; }
}

.profile-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 14px;
    padding: 0 4px;
}
.profile-tab {
    padding: 12px 16px;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s;
}
.profile-tab:hover { color: var(--ink); }
.profile-tab.active { color: var(--red); border-bottom-color: var(--red); }

/* =====================================================================
   POLISH — sombras, hover, microinteracciones
   ===================================================================== */
.post {
    transition: box-shadow .15s, transform .15s;
}
.post:hover {
    box-shadow: var(--shadow);
}

.widget { transition: box-shadow .15s; }
.widget:hover { box-shadow: var(--shadow); }

.post-title a {
    background-image: linear-gradient(var(--red), var(--red));
    background-size: 0 2px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size .2s;
}
.post-title a:hover { background-size: 100% 2px; }

/* Breaking pulse subtle */
@keyframes breakingPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200,16,46,.4); }
    50%      { box-shadow: 0 0 0 6px rgba(200,16,46,0); }
}
.chip-breaking {
    animation: breakingPulse 2s ease infinite;
}

/* Avatar hover lift */
.post-avatar img,
.composer-avatar { transition: transform .15s; }
.post-avatar:hover img { transform: scale(1.06); }

/* =====================================================================
   POLL CARD (standalone — feed + listing + sidebar)
   ===================================================================== */
.poll-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow .15s;
}
.poll-card:hover { box-shadow: var(--shadow); }
.chip-poll {
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: #fff;
    border: 0;
    letter-spacing: .06em;
}
.poll-body { padding: 14px 18px 16px; }
.poll-question {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--ink);
    margin: 0 0 14px;
    letter-spacing: -.01em;
}
.poll-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

/* Vote view — botones clickeables grandes */
.poll-options-vote {
    border: 0;
    padding: 0;
    margin-bottom: 12px;
}
.poll-option-vote {
    display: block;
    width: 100%;
    background: var(--paper);
    border: 1.5px solid var(--line);
    color: var(--ink);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
}
.poll-option-vote:hover {
    background: var(--red-soft);
    border-color: var(--red);
    color: var(--red-dark);
    transform: translateX(2px);
}
.poll-option-vote:active { transform: translateX(0); }

/* Results view — barras horizontales con fill (más visible: el fill llega hasta el %) */
.poll-option-result {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--paper-soft);
    padding: 10px 14px;
    border-radius: 8px;
    overflow: hidden;
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    border: 1.5px solid var(--line);
    gap: 12px;
}
.poll-option-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: linear-gradient(90deg, rgba(200,16,46,.30), rgba(200,16,46,.18));
    border-right: 2px solid rgba(200,16,46,.45);
    z-index: 0;
    transition: width .6s cubic-bezier(.2,.7,.3,1);
}
.poll-option-label, .poll-option-pct { position: relative; z-index: 1; }
.poll-option-label { flex: 1; min-width: 0; }
.poll-option-pct {
    font-weight: 900;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
/* La opción que el usuario votó: borde rojo + fill saturado */
.poll-option-mine { border-color: var(--red); }
.poll-option-mine .poll-option-fill {
    background: linear-gradient(90deg, rgba(200,16,46,.55), rgba(200,16,46,.38));
    border-right-color: var(--red);
}
.poll-option-mine .poll-option-label,
.poll-option-mine .poll-option-pct { color: var(--red-dark, #7B0000); }

/* Versión clickeable de la cápsula con barras — para votar o redirigir a login.
   Reset de estilos default de <button> y <a> para que se vean iguales que el div. */
button.poll-option-result,
a.poll-option-result {
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
}
.poll-option-clickable {
    transition: background .15s, border-color .15s, transform .1s;
}
.poll-option-clickable:hover {
    border-color: var(--red);
    transform: translateX(2px);
}
.poll-option-clickable:hover .poll-option-fill {
    background: linear-gradient(90deg, rgba(200,16,46,.45), rgba(200,16,46,.28));
}
.poll-option-clickable:active { transform: translateX(0); }

/* Título de la encuesta como link cuando es accesible (después de votar) */
.poll-question-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.poll-question-link:hover .poll-question { color: var(--red); }
.poll-mine-tag {
    display: inline-block;
    background: var(--red);
    color: #fff;
    padding: 1px 7px;
    border-radius: var(--r-pill);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .05em;
    margin-left: 6px;
    vertical-align: middle;
}
.poll-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    padding-top: 4px;
}
.poll-foot strong { color: var(--ink); font-weight: 800; }
.poll-closed-tag {
    color: var(--red);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .06em;
}
.poll-detail-link {
    font-size: 12px;
    font-weight: 700;
    color: var(--red);
    text-decoration: none;
}
.poll-detail-link:hover { color: var(--red-dark); }

@media (max-width: 600px) {
    .poll-body { padding: 12px 14px 14px; }
    .poll-question { font-size: 16px; }
    .poll-option-vote, .poll-option-result { font-size: 14px; padding: 10px 12px; }
}

/* =====================================================================
   ADMIN
   ===================================================================== */
.admin-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    padding: 4px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 14px;
    flex-wrap: wrap;          /* permite que los items bajen a otra línea si no caben */
    overflow: visible;
}
.admin-nav-item {
    padding: 7px 12px;
    border-radius: var(--r-pill);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    flex-shrink: 0;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.admin-nav-item:hover { color: var(--ink); }
.admin-nav-item.active { background: var(--ink); color: #fff; }
:root[data-theme="dark"] .admin-nav-item.active { background: #2C313B; color: #fff; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}
.stat-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 16px;
    text-decoration: none;
    color: var(--ink);
    transition: transform .15s, box-shadow .15s, border-color .15s;
    box-shadow: var(--shadow-sm);
}
a.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--ink);
}
.stat-num {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -.02em;
    color: var(--ink);
    margin-bottom: 2px;
}
.stat-num-red { color: var(--red); }
.stat-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.admin-table thead {
    background: var(--paper-soft);
}
.admin-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 800;
    border-bottom: 1px solid var(--line);
}
.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr:hover td { background: var(--paper-soft); }

/* Comentario enviado por AJAX: error inline + flash del nodo nuevo */
.comment-error { color: var(--red); font-size: 13px; font-weight: 700; margin-top: 6px; }
@keyframes commentNewFlash { from { background: #FFF7CC; } to { background: transparent; } }
.comment.flash-ok { animation: commentNewFlash 1.2s ease-out; border-radius: 8px; }

/* Banners de estado — se adaptan a modo oscuro */
.app-banner { padding: 12px 14px; border-radius: 8px; font-weight: 700; font-size: 14px; border: 1px solid transparent; }
.app-banner.warn { background: #FFF7E6; border-color: #F0C36D; color: #8A5A00; }
:root[data-theme="dark"] .app-banner.warn { background: #2A2410; border-color: #5C4D1A; color: #F5D67A; }

/* =====================================================================
   NOTIFICATIONS
   ===================================================================== */
.notif-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-soft);
    text-decoration: none;
    color: var(--ink);
    transition: background .15s;
}
.notif-row:last-child { border-bottom: 0; }
.notif-row:hover { background: var(--paper-soft); color: var(--ink); }
.notif-icon {
    flex-shrink: 0;
    width: 40px; height: 40px;
    background: var(--red-soft);
    color: var(--red);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.notif-content { flex: 1; min-width: 0; }
.notif-time { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* =====================================================================
   INTERACTIVE STATES (like / save active, follow button)
   ===================================================================== */
.post-action.is-active[data-action="like"]   { color: var(--red); }
.post-action.is-active[data-action="save"]   { color: var(--ink); }
.post-action.is-active[data-action="repost"] { color: #1DB954; } /* verde estilo Twitter */
.post-action.is-active svg { fill: currentColor; }
/* El icono de repost no se ve bien con fill (es de flechas, no relleno).
   Override: en repost solo el stroke cambia, no se rellena. */
.post-action.is-active[data-action="repost"] svg { fill: none; stroke: currentColor; stroke-width: 2.5; }
.post-action[disabled] { opacity: .5; cursor: not-allowed; }
.post-action.flash-ok { background: #E7F8EC; color: #1A8C3A; }

.btn-follow.is-following {
    background: var(--paper);
    color: var(--ink);
    border-color: var(--line);
}
.btn-follow.is-following:hover {
    background: var(--red-soft);
    color: var(--red);
    border-color: var(--red);
}
.btn-follow.is-following:hover::after { content: ' · Dejar'; opacity: .7; }

/* =====================================================================
   COMMENTS
   ===================================================================== */
.comments-wrap {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-top: 14px;
    padding: 18px;
    box-shadow: var(--shadow-sm);
}
.comments-head { margin-bottom: 14px; }
.comments-head h3 {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-soft);
}
.comments-head .text-muted { font-weight: 600; margin-left: 4px; }

.comment-form {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}
.comment-form-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.comment-form textarea {
    flex: 1;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    background: var(--paper);
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
}
.comment-form textarea:focus {
    outline: none;
    border-color: var(--ink);
}
.comment-form .btn { flex-shrink: 0; align-self: flex-end; }

.comments-anon {
    text-align: center;
    padding: 14px 0;
    border: 1px dashed var(--line);
    border-radius: var(--r-sm);
    margin-bottom: 14px;
}
.comments-empty {
    color: var(--muted);
    font-size: 14px;
    padding: 18px 0;
    text-align: center;
}

.comments-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.comment {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--line-soft);
}
.comment:first-child { border-top: 0; padding-top: 0; }
.comment-avatar { flex-shrink: 0; }
.comment-avatar img {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.comment-body { flex: 1; min-width: 0; }
.comment-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--muted);
}
.comment-author {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}
.comment-author:hover { color: var(--red); }
.comment-time { color: var(--muted); font-size: 12px; }
.comment-content {
    color: var(--ink);
    font-size: 14.5px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.comment-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
    font-size: 13px;
}
.comment-action-btn {
    background: none;
    border: none;
    padding: 4px 6px;
    margin: 0;
    cursor: pointer;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 6px;
    line-height: 1;
}
.comment-action-btn:hover { color: var(--ink); background: var(--paper-soft); }
.comment-like-btn.is-liked { color: var(--red); }
.comment-like-btn.is-liked:hover { color: var(--red); }
.comment-like-btn span { font-size: 12px; min-width: 8px; }
/* "Responder" destacado (alto contraste, no pasar desapercibido) */
.comment-reply-btn {
    color: var(--red);
    font-weight: 800;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.comment-reply-btn:hover { color: #fff; background: var(--red); }
/* Menú de 3 puntos en cada comentario (reusa estilos de .post-menu) */
.comment-menu { position: relative; margin-left: auto; }
.comment-menu-btn { width: 30px; height: 30px; }
.comment-menu .post-menu-dropdown { min-width: 200px; }

.comments-replies {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    border-left: 2px solid var(--line-soft);
    padding-left: 12px;
}
.comment.is-reply {
    padding: 8px 0;
    border-top: none;
}
.comment.is-reply:first-child { padding-top: 0; }
.comment.is-reply .comment-avatar img {
    width: 30px; height: 30px;
}
.comment.is-reply .comment-content { font-size: 13.5px; }

.comment-reply-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding: 10px;
    background: var(--paper-soft);
    border-radius: 8px;
}
.comment-reply-form[hidden] { display: none; }
.comment-reply-form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    background: var(--paper);
    color: var(--ink);
    box-sizing: border-box;
}
.comment-reply-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.comment:target {
    background: var(--red-soft);
    margin: 0 -18px;
    padding: 14px 18px;
    border-radius: var(--r-sm);
}

/* Avatar menu dropdown (header) */
.avatar-menu-wrap { display: inline-block; }
.avatar-menu-toggle { background: transparent; border: 0; cursor: pointer; }
.avatar-acting-dot {
    position: absolute;
    bottom: 0; right: 0;
    width: 10px; height: 10px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--paper);
}
.avatar-menu {
    position: absolute;
    top: 100%; right: 0;
    margin-top: 8px;
    min-width: 240px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
    padding: 6px;
    z-index: 1200;
}
.avatar-menu[hidden] { display: none; }
.avatar-menu-banner {
    background: rgba(200, 16, 46, 0.08);
    color: var(--red);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 6px;
    line-height: 1.3;
}
.avatar-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    background: transparent;
    border: 0;
    text-align: left;
    font-family: inherit;
}
.avatar-menu-item:hover { background: var(--paper-soft); }
.avatar-menu-item-btn { font-weight: 600; }
.avatar-menu-pic { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-menu-name { font-weight: 700; }
.avatar-menu-meta { color: var(--muted); font-size: 12px; }
.avatar-menu-icon { width: 20px; text-align: center; font-size: 14px; }
.avatar-menu-divider { height: 1px; background: var(--line); margin: 6px 4px; }
.avatar-menu-form { margin: 0; padding: 0; }

@media (max-width: 720px) {
    /* En mobile el avatar queda pegado al borde derecho — alinear el dropdown
       a la derecha del viewport con margen, no salirse. */
    .avatar-menu {
        right: 8px;
        min-width: 220px;
        max-width: calc(100vw - 16px);
    }
}

/* Banner global "actuando como" — barra fina arriba de todo */
.acting-banner {
    position: sticky;
    top: 0;
    z-index: 1300;
    background: var(--red);
    color: #fff;
    text-align: center;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
}
.acting-banner a, .acting-banner button {
    color: #fff;
    text-decoration: underline;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

/* Pull-to-refresh indicator (mobile feeds) */
#ptr-indicator {
    position: fixed;
    top: 56px;  /* debajo del header */
    left: 50%;
    width: 44px; height: 44px;
    margin-left: -22px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center;
    transform: translateY(-100%);
    transition: transform 0.2s ease-out;
    z-index: 2400;
    pointer-events: none;
}
.ptr-spinner {
    width: 20px; height: 20px;
    border: 2.5px solid var(--line);
    border-top-color: var(--red);
    border-radius: 50%;
    transition: transform 0.15s;
}
#ptr-indicator.is-ready .ptr-spinner { border-top-color: var(--red); transform: rotate(180deg); }
#ptr-indicator.is-loading .ptr-spinner { animation: ptr-spin 0.7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* PWA install banner — aparece sobre el bottom-nav en mobile, descartable */
#pwa-install-banner {
    position: fixed;
    left: 8px; right: 8px;
    bottom: calc(56px + env(safe-area-inset-bottom, 0) + 8px);
    z-index: 2500;
    transform: translateY(120%);
    transition: transform 0.25s ease-out;
}
#pwa-install-banner.is-visible { transform: translateY(0); }
.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.pwa-banner-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--red);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.pwa-banner-text { flex: 1; min-width: 0; line-height: 1.2; }
.pwa-banner-text strong { display: block; font-size: 14px; color: var(--ink); }
.pwa-banner-text small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pwa-banner-install {
    background: var(--red);
    color: #fff;
    border: 0;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}
.pwa-banner-close {
    background: transparent;
    color: var(--muted);
    border: 0;
    font-size: 22px;
    line-height: 1;
    width: 28px; height: 28px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
}
.pwa-banner-close:hover { background: var(--paper-soft); color: var(--ink); }

/* Anuncios en el feed — layout horizontal, tono distinto al post-card */
.ad-card {
    display: flex;
    gap: 14px;
    align-items: stretch;
    background: #FFF8E7;          /* crema cálida, distinto al paper blanco */
    border: 1px solid #F2DFB2;
    border-radius: var(--r);
    padding: 14px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.ad-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ad-badge {
    display: inline-block;
    align-self: flex-start;
    background: var(--red);
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
}
.ad-title { font-size: 16px; font-weight: 800; color: var(--ink); margin: 0; line-height: 1.25; }
.ad-body-text { font-size: 13.5px; color: var(--ink-soft); margin: 0; line-height: 1.4; }
.ad-cta {
    align-self: flex-start;
    background: var(--red);
    color: #fff;
    border: 0;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    margin-top: 4px;
}
.ad-cta:hover { filter: brightness(1.08); }
/* Modo oscuro: el anuncio pasa a tarjeta oscura (su texto usa --ink/--ink-soft,
   que ya se vuelven claros en oscuro → legible). Antes quedaba crema + texto claro. */
:root[data-theme="dark"] .ad-card { background: #221C12; border-color: #4A3D22; box-shadow: none; }
.ad-card-thumb {
    flex: 0 0 110px;
    height: 110px;
    background-size: cover;
    background-position: center;
    border-radius: 10px;
    flex-shrink: 0;
}
@media (max-width: 480px) {
    .ad-card-thumb { flex: 0 0 90px; height: 90px; }
    .ad-title { font-size: 15px; }
    .ad-body-text { font-size: 13px; }
}

/* Source badges — r/PERU / YouTube — para transparencia de origen del post */
.source-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    margin-left: 4px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.4;
    text-transform: uppercase;
    border: 1px solid currentColor;
}
.source-badge-reddit   { color: #C2410C; background: #FFEDD5; border-color: #FED7AA; }
.source-badge-youtube  { color: #B91C1C; background: #FEE2E2; border-color: #FCA5A5; }

/* Photo lightbox — foto maximizada + comentarios al lado (estilo Facebook) */
.photo-lightbox{position:fixed;inset:0;z-index:3000;background:rgba(0,0,0,.94);display:flex;}
.photo-lightbox[hidden]{display:none;}
.photo-lightbox-close{position:absolute;top:14px;right:14px;background:rgba(0,0,0,.6);color:#fff;border:0;width:44px;height:44px;border-radius:50%;font-size:30px;line-height:1;cursor:pointer;z-index:10;font-weight:700;display:flex;align-items:center;justify-content:center;}
.photo-lightbox-close:hover{background:rgba(0,0,0,.85);}
.photo-lightbox-stage{flex:1;display:flex;align-items:center;justify-content:center;position:relative;padding:20px;min-width:0;min-height:0;}
.photo-lightbox-img{max-width:100%;max-height:100%;object-fit:contain;display:block;}
.photo-lightbox-nav{position:absolute;top:50%;transform:translateY(-50%);background:rgba(0,0,0,.55);color:#fff;border:0;width:52px;height:52px;border-radius:50%;font-size:38px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;font-weight:700;}
.photo-lightbox-nav:hover{background:rgba(0,0,0,.85);}
.photo-lightbox-nav.prev{left:18px;}
.photo-lightbox-nav.next{right:18px;}
.photo-lightbox-counter{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);background:rgba(0,0,0,.6);color:#fff;padding:6px 14px;border-radius:16px;font-size:13px;font-weight:600;}
.photo-lightbox-sidebar{width:400px;flex-shrink:0;background:var(--paper);border-left:1px solid var(--line);overflow:hidden;display:flex;}
.photo-lightbox-iframe{width:100%;height:100%;border:0;display:block;background:var(--paper);}
@media (max-width:900px){
  .photo-lightbox{flex-direction:column;}
  .photo-lightbox-stage{flex:0 0 50vh;padding:10px;}
  .photo-lightbox-sidebar{width:100%;flex:1 1 auto;border-left:0;border-top:1px solid var(--line);}
  .photo-lightbox-nav{width:42px;height:42px;font-size:30px;}
  .photo-lightbox-nav.prev{left:8px;}
  .photo-lightbox-nav.next{right:8px;}
  .photo-lightbox-close{top:8px;right:8px;width:38px;height:38px;font-size:26px;}
}

/* Photo lightbox — foto + comentarios estilo Facebook */
.photo-lightbox{position:fixed;inset:0;z-index:3000;background:rgba(0,0,0,.94);display:flex;}
.photo-lightbox[hidden]{display:none;}
.photo-lightbox-close{position:absolute;top:14px;right:14px;background:rgba(0,0,0,.6);color:#fff;border:0;width:44px;height:44px;border-radius:50