/* ═══════════════════════════════════════════════════════════════
   MUNDO GLOBALINK — Historias en un globo 3D interactivo
   Estética: neón cian/magenta sobre azul profundo (identidad Globalink).
   El globo es el elemento firma: interconexiones que cruzan fronteras.
   ═══════════════════════════════════════════════════════════════ */

:root {
    --glb-cyan:     #00d4ff;
    --glb-magenta:  #c639b8;
    --glb-violet:   #6a1fa8;
    --glb-deep:     #050a1a;   /* azul profundo del espacio */
    --glb-deep-2:   #0a1230;
    --glb-text:     #eaf2ff;
    --glb-muted:    rgba(234,242,255,.55);
}

/* ── Pantalla completa del globo ───────────────────────────── */
.glb-screen {
    position: fixed;
    inset: 0;
    z-index: 940;
    background:
        radial-gradient(ellipse at 50% 45%, #0d1b45 0%, var(--glb-deep) 55%, #02040d 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: none;          /* el canvas maneja los gestos */
    animation: glbFadeIn .35s ease;
}
@keyframes glbFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Estrellas de fondo (capa sutil, no distrae del globo) */
.glb-stars {
    position: absolute; inset: 0;
    pointer-events: none;
    opacity: .5;
}

/* ── Cabecera ──────────────────────────────────────────────── */
.glb-header {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 12px;
    flex-shrink: 0;
}
.glb-back {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 50%;
    color: var(--glb-text);
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s;
    touch-action: manipulation;
}
.glb-back:hover { background: rgba(255,255,255,.14); }
.glb-title {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.2px;
    background: linear-gradient(100deg, var(--glb-cyan), var(--glb-magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.glb-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--glb-muted);
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    padding: 5px 11px;
    border-radius: 99px;
    white-space: nowrap;
}

/* ── Canvas del globo ──────────────────────────────────────── */
.glb-canvas-wrap {
    flex: 1;
    position: relative;
    min-height: 0;
}
.glb-canvas-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    cursor: grab;
}
.glb-canvas-wrap canvas:active { cursor: grabbing; }

/* ── Etiquetas de usuario sobre el globo ───────────────────── */
/* Se posicionan con JS siguiendo la proyección 3D → 2D. */
.glb-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
    z-index: 3;
    transition: opacity .2s;
    touch-action: manipulation;
    text-align: center;
    will-change: transform, opacity;
}
.glb-pin-ring {
    width: 56px; height: 56px;
    border-radius: 50%;
    padding: 2.5px;
    /* Cada usuario tiene su gradiente propio (se asigna por JS) */
    background: linear-gradient(135deg, var(--glb-cyan), var(--glb-magenta));
    box-shadow: 0 0 16px rgba(0,212,255,.45), 0 0 32px rgba(198,57,184,.25);
    animation: glbPinPulse 3s ease-in-out infinite;
}
@keyframes glbPinPulse {
    0%, 100% { box-shadow: 0 0 14px rgba(0,212,255,.4), 0 0 28px rgba(198,57,184,.2); }
    50%      { box-shadow: 0 0 22px rgba(0,212,255,.6), 0 0 44px rgba(198,57,184,.35); }
}
.glb-pin-ring img,
.glb-pin-ring .glb-pin-initial {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: var(--glb-deep-2);
    border: 2px solid var(--glb-deep);
}
.glb-pin-initial {
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 20px;
    background: linear-gradient(135deg, var(--glb-violet), var(--glb-magenta));
}
/* Ya visto: anillo apagado (como Instagram) */
.glb-pin.seen .glb-pin-ring {
    background: rgba(255,255,255,.25);
    box-shadow: none;
    animation: none;
}
.glb-pin-label {
    margin-top: 5px;
    font-size: 11px;
    font-weight: 700;
    color: var(--glb-text);
    text-shadow: 0 1px 6px rgba(0,0,0,.9);
    white-space: nowrap;
    line-height: 1.3;
}
.glb-pin-meta {
    font-size: 9.5px;
    font-weight: 500;
    color: var(--glb-muted);
    text-shadow: 0 1px 5px rgba(0,0,0,.9);
    white-space: nowrap;
}
/* Contador cuando el usuario tiene varias historias */
.glb-pin-badge {
    position: absolute;
    top: -3px; right: -3px;
    min-width: 18px; height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--glb-magenta), var(--glb-violet));
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--glb-deep);
}
.glb-pin:hover .glb-pin-ring { transform: scale(1.08); }
.glb-pin-ring { transition: transform .18s ease; }

/* ── Tu historia (botón +) ─────────────────────────────────── */
.glb-add {
    position: absolute;
    left: 18px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(10,18,48,.75);
    border: 1px solid rgba(0,212,255,.28);
    border-radius: 99px;
    padding: 7px 16px 7px 7px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: border-color .2s, transform .2s;
    touch-action: manipulation;
}
.glb-add:hover { border-color: rgba(0,212,255,.6); transform: translateY(-1px); }
.glb-add-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--glb-violet), var(--glb-magenta));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 19px; font-weight: 300;
    flex-shrink: 0;
}
.glb-add-text { line-height: 1.25; }
.glb-add-text b { display: block; font-size: 13px; font-weight: 700; color: var(--glb-text); }
.glb-add-text span { font-size: 10.5px; color: var(--glb-muted); }

/* ── Pie: pista de uso ─────────────────────────────────────── */
.glb-hint {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(10,18,48,.7);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 99px;
    padding: 9px 18px;
    backdrop-filter: blur(10px);
    font-size: 12px;
    color: var(--glb-muted);
    white-space: nowrap;
    pointer-events: none;
    animation: glbHintIn .6s ease .4s both;
}
@keyframes glbHintIn {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.glb-hint i { color: var(--glb-cyan); }

/* ── Estados: cargando y vacío ─────────────────────────────── */
.glb-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 8;
    text-align: center;
    padding: 30px;
}
.glb-spinner {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 2.5px solid rgba(0,212,255,.15);
    border-top-color: var(--glb-cyan);
    border-right-color: var(--glb-magenta);
    animation: glbSpin .9s linear infinite;
}
@keyframes glbSpin { to { transform: rotate(360deg); } }
.glb-state p {
    font-size: 13.5px;
    color: var(--glb-muted);
    line-height: 1.6;
    max-width: 280px;
    margin: 0;
}
.glb-state b { color: var(--glb-text); font-size: 16px; display: block; margin-bottom: 4px; }

/* ── Botón "Explorar mapa" en la fila de historias del Feed ── */
.glb-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--glb-cyan);
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 2px;
    white-space: nowrap;
    touch-action: manipulation;
    transition: opacity .2s;
}
.glb-open-btn:hover { opacity: .75; }
.glb-open-btn i { font-size: 11px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .glb-title { font-size: 17px; }
    .glb-pin-ring { width: 48px; height: 48px; }
    .glb-pin-label { font-size: 10px; }
    .glb-pin-meta { font-size: 9px; }
    .glb-hint { font-size: 11px; padding: 8px 14px; }
    .glb-add { left: 12px; padding: 6px 13px 6px 6px; }
    .glb-add-icon { width: 36px; height: 36px; font-size: 17px; }
}

/* Accesibilidad: respetar quien prefiere menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .glb-pin-ring { animation: none; }
    .glb-screen, .glb-hint { animation: none; }
}
