/* ─────────────────────────────────────────────
   NEONMANCER · overlay de directo → linktree
   Mobile-first. Todo el color sale de estas vars.
   ───────────────────────────────────────────── */
:root {
    --bg:       #0B0713;
    --bg-2:     #150F26;
    --surface:  rgba(255, 255, 255, 0.045);
    --surface-2:rgba(255, 255, 255, 0.08);
    --line:     rgba(255, 255, 255, 0.09);

    --purple:   #9146FF;
    --cyan:     #14E7FF;
    --magenta:  #FF2E97;
    --live:     #FF4155;

    --text:     #F3F0FF;
    --muted:    #9A90C0;

    --grad: linear-gradient(120deg, var(--purple), var(--cyan) 55%, var(--magenta));
    --radius: 16px;

    --font-display: 'Chakra Petch', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    min-height: 100dvh;
    font-family: var(--font-body);
    color: var(--text);
    background:
        radial-gradient(120% 80% at 50% -10%, #2A1352 0%, transparent 55%),
        radial-gradient(90% 60% at 100% 100%, rgba(20,231,255,0.12) 0%, transparent 50%),
        var(--bg);
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    padding: clamp(16px, 5vw, 40px) 16px;
    overflow-x: hidden;
}

/* ── Emotes que suben de fondo (temática de reacciones) ── */
.emote-field {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.emote {
    position: absolute;
    bottom: -40px;
    font-size: var(--size, 22px);
    opacity: 0;
    filter: drop-shadow(0 0 8px rgba(145, 70, 255, 0.5));
    animation: rise var(--dur, 9s) linear forwards;
    will-change: transform, opacity;
}
@keyframes rise {
    0%   { transform: translateY(0) rotate(0deg) scale(0.6); opacity: 0; }
    12%  { opacity: var(--peak, 0.7); }
    85%  { opacity: var(--peak, 0.7); }
    100% { transform: translateY(-105dvh) rotate(var(--spin, 20deg)) scale(1); opacity: 0; }
}

/* ── Marco principal: la "emisión" ── */
.broadcast {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 26px 20px 18px;
    border-radius: 24px;
    background: linear-gradient(180deg, var(--bg-2), var(--bg));
    border: 1px solid var(--line);
    box-shadow:
        0 30px 80px -20px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
    isolation: isolate;
}

/* Borde neón que respira alrededor de la emisión */
.glow-frame {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--grad);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0.55;
    animation: breathe 4.5s ease-in-out infinite;
    pointer-events: none;
}
@keyframes breathe {
    50% { opacity: 1; filter: hue-rotate(25deg); }
}

/* Líneas de escaneo tipo pantalla CRT */
.scanlines {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.03) 0 1px,
        transparent 1px 3px
    );
    mix-blend-mode: overlay;
    opacity: 0.5;
}

/* ── Cabecera ── */
.stream-head { position: relative; text-align: center; }

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 auto 6px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 6px 12px;
    border-radius: 999px;
    color: #fff;
    text-decoration: none;
    background: rgba(255, 65, 85, 0.14);
    border: 1px solid rgba(255, 65, 85, 0.5);
    box-shadow: 0 0 18px rgba(255, 65, 85, 0.35);
}
.live-label { line-height: 1; }
.live-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding-left: 8px;
    margin-left: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    font-variant-numeric: tabular-nums;
}
.live-count::before { content: '👁'; font-size: 10px; }
.live-count[hidden] { display: none; }

/* Estado OFFLINE: apagado y en gris, sin latido */
.live-badge.is-offline {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--line);
    box-shadow: none;
    color: var(--muted);
}
.live-badge.is-offline .live-dot {
    background: var(--muted);
    box-shadow: none;
    animation: none;
}

.live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--live);
    box-shadow: 0 0 0 0 rgba(255, 65, 85, 0.7);
    animation: pulse-dot 1.4s ease-out infinite;
}
@keyframes pulse-dot {
    0%   { box-shadow: 0 0 0 0 rgba(255, 65, 85, 0.7); }
    70%  { box-shadow: 0 0 0 9px rgba(255, 65, 85, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 65, 85, 0); }
}

.avatar-wrap {
    position: relative;
    width: 112px; height: 112px;
    margin: 6px auto 14px;
}
.avatar-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--purple), var(--cyan), var(--magenta), var(--purple));
    animation: spin 6s linear infinite;
    filter: blur(1px);
}
.avatar-ring::after {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: var(--bg-2);
}
@keyframes spin { to { transform: rotate(360deg); } }

.avatar {
    position: relative;
    z-index: 1;
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-2);
}
/* Miniatura del directo: cubre el avatar solo cuando estás en vivo */
.avatar-live {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: inset 0 0 0 3px var(--bg-2);
}
.avatar-live[hidden] { display: none; }
.avatar-status {
    position: absolute;
    z-index: 2;
    right: 6px; bottom: 6px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #2BE47A;
    border: 3px solid var(--bg-2);
    box-shadow: 0 0 10px rgba(43, 228, 122, 0.7);
}

.name {
    font-family: var(--font-display);
    font-size: clamp(26px, 8vw, 34px);
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    background: var(--grad);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
    position: relative;
}
.handle {
    margin-top: 6px;
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--cyan);
    letter-spacing: 0.03em;
}
.tagline {
    margin: 12px auto 0;
    max-width: 30ch;
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted);
}

/* ── Última vez en directo (solo offline) ── */
.last-live {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 12px auto 0;
    font-size: 12.5px;
    color: var(--muted);
}
.last-live::before { content: '🕑'; font-size: 12px; opacity: 0.85; }
.last-live[hidden] { display: none; }
.last-live span { color: var(--text); font-weight: 500; }

/* ── Tarjeta "ahora jugando" (solo visible en directo) ── */
.now-live {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin: 14px auto 0;
    max-width: 34ch;
    padding: 10px 14px;
    border-radius: 14px;
    background: linear-gradient(120deg, rgba(145, 70, 255, 0.15), rgba(20, 231, 255, 0.10));
    border: 1px solid rgba(145, 70, 255, 0.35);
    animation: now-in 0.4s ease both;
}
.now-live[hidden] { display: none; }
@keyframes now-in {
    from { opacity: 0; transform: translateY(-6px); }
}
.now-game {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
    color: var(--text);
}
.now-game::before { content: '🎮'; font-size: 13px; }
.now-game[hidden] { display: none; }
.now-title {
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--muted);
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.now-title[hidden] { display: none; }

/* ── Botón "Ver directo" (solo en vivo) ── */
.watch-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 16px auto 0;
    padding: 12px 24px;
    border-radius: 999px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.03em;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(120deg, var(--live), #C026D3);
    box-shadow: 0 10px 30px -8px rgba(255, 65, 85, 0.6);
    animation: watch-pulse 1.9s ease-out infinite;
    transition: transform 0.15s ease, filter 0.15s ease;
}
.watch-cta svg { width: 16px; height: 16px; }
.watch-cta:hover { transform: translateY(-2px); filter: brightness(1.08); }
.watch-cta:active { transform: translateY(0) scale(0.98); }
.watch-cta[hidden] { display: none; }
@keyframes watch-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 65, 85, 0.5), 0 10px 30px -8px rgba(255, 65, 85, 0.6); }
    70%  { box-shadow: 0 0 0 15px rgba(255, 65, 85, 0), 0 10px 30px -8px rgba(255, 65, 85, 0.6); }
    100% { box-shadow: 0 0 0 0 rgba(255, 65, 85, 0), 0 10px 30px -8px rgba(255, 65, 85, 0.6); }
}

.stats {
    display: flex;
    justify-content: center;
    gap: 10px;
    list-style: none;
    margin: 18px 0 4px;
}
.stats li {
    flex: 1;
    padding: 10px 4px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
}
.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.stat-label {
    display: block;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* ── Enlaces ── */
.links {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin: 22px 0 11px;
}

.link-card,
.email-cta {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 15px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    /* entrada escalonada al cargar */
    opacity: 0;
    transform: translateY(14px);
    animation: card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(var(--i) * 70ms + 250ms);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
@keyframes card-in {
    to { opacity: 1; transform: translateY(0); }
}

.link-card:hover,
.email-cta:hover {
    transform: translateY(-2px);
    background: var(--surface-2);
    border-color: rgba(145, 70, 255, 0.55);
    box-shadow: 0 8px 30px -10px rgba(145, 70, 255, 0.5);
}
.link-card:active,
.email-cta:active { transform: translateY(0) scale(0.99); }

.link-card.is-primary {
    background: linear-gradient(120deg, rgba(145, 70, 255, 0.22), rgba(20, 231, 255, 0.16));
    border-color: rgba(145, 70, 255, 0.5);
}
.link-card.is-primary:hover {
    box-shadow: 0 10px 34px -8px rgba(145, 70, 255, 0.6);
}

.link-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 42px; height: 42px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    color: var(--text);
}
.link-icon svg { width: 22px; height: 22px; }
.is-primary .link-icon {
    background: var(--grad);
    color: #0B0713;
    border: none;
    box-shadow: 0 0 16px rgba(145, 70, 255, 0.5);
}

.link-text { flex: 1; min-width: 0; }
.link-text strong {
    display: block;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.link-text small {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-arrow {
    flex: 0 0 auto;
    color: var(--muted);
    transition: transform 0.18s ease, color 0.18s ease;
}
.link-arrow svg { width: 18px; height: 18px; display: block; }
.link-card:hover .link-arrow { transform: translateX(3px); color: var(--cyan); }

/* Destello que barre la tarjeta al pasar/tocar */
.shine {
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.14), transparent);
    transform: skewX(-18deg);
    pointer-events: none;
}
.link-card:hover .shine,
.email-cta:hover .shine {
    animation: sweep 0.7s ease;
}
@keyframes sweep { to { left: 130%; } }

.email-cta {
    margin-top: 4px;
    background: transparent;
    border-style: dashed;
    border-color: rgba(20, 231, 255, 0.3);
}
.email-cta:hover { border-color: var(--cyan); }
.email-cta .link-icon { color: var(--cyan); }

/* ── Pie ── */
.stream-foot {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.04em;
}
.rec {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--live);
}
.rec-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--live);
    animation: blink 1.2s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0.2; } }

/* ── Foco accesible ── */
a:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}

/* ── Respeta reduce-motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    .link-card, .email-cta { opacity: 1; transform: none; }
    .emote-field { display: none; }
}
