/* ── RESET & VARIABLES ──────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --color-fondo:       #0f0f0f;
    --color-superficie:  #1a1a1a;
    --color-borde:       #2a2a2a;
    --color-texto:       #e0e0e0;
    --color-texto-suave: #888;
    --color-acento:      #6c63ff;
    --radio-card:        16px;
    --sombra-card:       0 4px 24px rgba(0,0,0,0.4);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--color-fondo);
    color: var(--color-texto);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── HEADER ─────────────────────────────────────────────────────────────────── */
.header {
    background: var(--color-superficie);
    border-bottom: 1px solid var(--color-borde);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header__contenido {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    font-size: 1.4rem;
    cursor: pointer;
    user-select: none;
    color: var(--color-texto);
}
.logo strong { color: var(--color-acento); }
.header__nav {
    display: flex;
    align-items: center;
    gap: 16px;
}
.link-header {
    color: var(--color-texto-suave);
    text-decoration: none;
    font-size: 0.85rem;
}
.link-header:hover { color: var(--color-acento); }

/* ── BOTONES ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn--header {
    background: transparent;
    color: var(--color-acento);
    border: 1px solid var(--color-acento);
}
.btn--principal {
    background: var(--color-acento);
    color: #fff;
    padding: 14px 32px;
    font-size: 1rem;
    margin-top: 12px;
}
.btn--principal:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── PANTALLA BIENVENIDA ────────────────────────────────────────────────────── */
.pantalla-bienvenida {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    text-align: center;
}
.bienvenida__titulo {
    font-size: 2rem;
    margin-bottom: 8px;
}
.bienvenida__subtitulo {
    color: var(--color-texto-suave);
    margin-bottom: 32px;
    max-width: 500px;
}

/* ── SELECTOR DE TEMAS ──────────────────────────────────────────────────────── */
.tema-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 800px;
    width: 100%;
    margin-bottom: 16px;
}
.tema-btn {
    background: var(--color-superficie);
    border: 2px solid var(--color-borde);
    color: var(--color-texto);
    padding: 14px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, transform 0.15s;
    text-align: center;
}
.tema-btn:hover { border-color: var(--color-acento); }
.tema-btn.selected {
    border-color: var(--color-acento);
    background: color-mix(in srgb, var(--color-acento) 15%, var(--color-superficie));
    transform: scale(1.03);
}
.selector-aviso {
    color: var(--color-texto-suave);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

/* ── PANTALLA TIPS ──────────────────────────────────────────────────────────── */
.pantalla-tips {
    flex: 1;
    padding: 24px 20px 80px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}
.tips-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

/* ── TARJETA DE TIP ─────────────────────────────────────────────────────────── */
.tip-card {
    background: var(--color-superficie);
    border-radius: var(--radio-card);
    padding: 24px;
    border-top: 4px solid var(--tema-color, var(--color-acento));
    box-shadow: var(--sombra-card);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fade-up 0.4s ease forwards;
    opacity: 0;
}
.tip-card:nth-child(1) { animation-delay: 0ms; }
.tip-card:nth-child(2) { animation-delay: 100ms; }
.tip-card:nth-child(3) { animation-delay: 200ms; }
.tip-card:nth-child(4) { animation-delay: 300ms; }
.tip-card:nth-child(5) { animation-delay: 400ms; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tip-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tip-card__tema {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--tema-color, var(--color-acento));
}
.tip-card__badge {
    font-size: 0.7rem;
    background: var(--tema-color, var(--color-acento));
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
}
.tip-card__emoji {
    font-size: 2.5rem;
    text-align: center;
}
.tip-card__texto {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-texto);
}
.ver-consejo-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-texto-suave);
    text-decoration: none;
    font-size: 0.8rem;
    margin-bottom: 4px;
    transition: color 0.2s;
}
.ver-consejo-link:hover {
    color: var(--color-acento);
    text-decoration: underline;
}

/* ── BOTÓN AFILIADO ─────────────────────────────────────────────────────────── */
.btn-afiliado {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--color-acento);
    color: var(--color-acento);
    text-decoration: none;
    font-size: 0.82rem;
    transition: background 0.2s, color 0.2s;
    margin-top: 4px;
}
.btn-afiliado:hover {
    background: var(--color-acento);
    color: #fff;
}

/* ── SKELETON LOADING ───────────────────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--color-borde) 25%, #333 50%, var(--color-borde) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}
.skeleton--emoji { height: 40px; width: 40px; margin: 0 auto; border-radius: 50%; }
.skeleton--texto { height: 16px; width: 100%; }
.skeleton--boton { height: 32px; width: 60%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── SLOTS DE ANUNCIO ───────────────────────────────────────────────────────── */
.ad-slot {
    min-height: 90px;
    background: transparent;
    margin: 16px 0;
    text-align: center;
    overflow: hidden;
}
.ad-slot--banner-desktop {
    min-height: 90px;
    display: block;
}
.ad-slot--nativo {
    min-height: 250px;
    display: block;
}
.ad-slot--banner-mobile {
    min-height: 50px;
    display: none;
}

/* ── FOOTER ─────────────────────────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--color-texto-suave);
    font-size: 0.8rem;
    border-top: 1px solid var(--color-borde);
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}
.footer a {
    color: var(--color-texto-suave);
    text-decoration: none;
}
.footer a:hover { color: var(--color-acento); }

/* ── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
    .tips-grid { grid-template-columns: repeat(2, 1fr); }
    .ad-slot--nativo { grid-column: span 1; }
}
@media (min-width: 1200px) {
    .tips-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .ad-slot--banner-desktop { display: none; }
    .ad-slot--banner-mobile {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50px;
        z-index: 100;
        background: var(--color-superficie);
        margin: 0;
        min-height: 50px;
        align-items: center;
        justify-content: center;
    }
    body { padding-bottom: 60px; }
    .ad-slot--nativo {
        min-height: 200px;
        grid-column: 1 / -1;
    }
    .tema-selector { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 769px) {
    .ad-slot--banner-mobile { display: none; }
}
.selector-error {
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-top: -8px;
    margin-bottom: 8px;
    animation: fadeInShake 0.4s ease;
}
@keyframes fadeInShake {
    0% { opacity: 0; transform: translateX(-5px); }
    25% { transform: translateX(5px); }
    50% { transform: translateX(-5px); }
    75% { transform: translateX(3px); }
    100% { opacity: 1; transform: translateX(0); }
}
/* ── PWA: ajuste para pantalla completa en iOS ─────────────────────────────── */
@supports (padding-top: env(safe-area-inset-top)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* ── BOTÓN COMPARTIR ─────────────────────────────────────────────────────── */
.btn-compartir {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08);
    color: #ccc;
    text-decoration: none;
    font-size: 0.82rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    margin-top: 8px;
    margin-left: 8px;
    -webkit-tap-highlight-color: transparent;
}
.btn-compartir:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}
.btn-compartir:active {
    transform: scale(0.96);
    transition: transform 0.1s;
}

@media (max-width: 400px) {
    .btn-compartir {
        margin-left: 0;
        margin-top: 6px;
        width: 100%;
        justify-content: center;
    }
}

/* ── BLOQUE SEO (para página pública) ────────────────────────────────────── */
.seo-intro {
    background: #f0f4ff;
    border-left: 4px solid var(--color-tema, #6c63ff);
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    text-align: left;
    font-size: 0.95rem;
    color: #333;
    line-height: 1.6;
}