@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@300;400;700&display=swap');

/* ============================================
   VARIABLES DE DISEÑO
   ============================================ */
:root {
    --celeste:      #75B2DD;
    --celeste-glow: rgba(117,178,221,0.35);
    --celeste-dim:  rgba(117,178,221,0.15);
    --oro:          #D4AF37;
    --negro:        #050a0f;
    --blanco:       #ffffff;
    --txt-muted:    rgba(255,255,255,0.55);
    --glass:        rgba(5,10,15,0.75);
    --glass-border: rgba(117,178,221,0.22);
    --font-display: 'Bebas Neue', 'Impact', sans-serif;
    --font-body:    'Inter', 'Segoe UI', sans-serif;
}

/* ============================================
   BASE
   ============================================ */
html, body {
    margin: 0; padding: 0;
    width: 100vw; height: 100vh;
    overflow: hidden; background-color: transparent !important;
    font-family: var(--font-body);
    touch-action: none;
}
/* Solo el video de la cámara de MindAR — NO los de a-assets */
body > video,
a-scene > video {
    width: 100vw !important; height: 100vh !important;
    object-fit: cover !important; position: fixed !important;
    top: 0 !important; left: 0 !important; z-index: 0 !important;
}

/* Proteger los videos de a-assets para que A-Frame los use como texturas */
a-assets video {
    position: static !important;
    width: auto !important;
    height: auto !important;
    top: auto !important;
    left: auto !important;
}
canvas { z-index: 2 !important; }

/* ============================================
   CONFETTI
   ============================================ */
#confetti-container {
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh;
    pointer-events: none; z-index: 1; overflow: hidden;
}
.confetti-piece {
    position: absolute; width: 12px; height: 24px; top: -50px; opacity: 0.85;
    /* ✅ GPU acceleration — saca el confetti del flujo de repaint del DOM */
    will-change: transform;
    transform: translateZ(0);
}
.confetti-piece.celeste { background-color: var(--celeste); }
.confetti-piece.blanco  { background-color: var(--blanco); }
@keyframes fall-infinite {
    0%   { top: -10%; transform: translateX(0) rotate(0deg); }
    100% { top: 110%; transform: translateX(var(--muevex)) rotate(var(--rotax)); }
}

/* ============================================
   BOTÓN VOLVER
   ============================================ */
#btn-back {
    position: fixed; top: 20px; left: 20px; z-index: 10000;
    background: var(--glass); color: var(--blanco);
    border: 1px solid var(--glass-border);
    padding: 8px 16px; border-radius: 20px;
    font-family: var(--font-body); font-size: 13px; letter-spacing: 0.5px;
    cursor: pointer; backdrop-filter: blur(10px);
    transition: border-color 0.2s, background 0.2s;
}
#btn-back:active { background: var(--celeste-dim); border-color: var(--celeste); }

/* ============================================
   STATUS — ESCANEAR grande, se oculta al detectar
   ============================================ */
#ui-info {
    white-space: normal;
    text-align: center;
    max-width: 80vw;
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: var(--glass);
    color: var(--blanco);
    padding: 14px 32px; border-radius: 40px;
    font-family: var(--font-display);
    font-size: 24px; letter-spacing: 5px;
    border: 1.5px solid var(--glass-border);
    pointer-events: none; white-space: nowrap;
    backdrop-filter: blur(12px);
    text-shadow: 0 0 20px var(--celeste-glow);
    animation: pulse-escanear 2s ease-in-out infinite;
}
@keyframes pulse-escanear {
    0%,100% { opacity:1; box-shadow: 0 0 0 0 var(--celeste-glow); }
    50%      { opacity:0.75; box-shadow: 0 0 20px 4px var(--celeste-glow); }
}

/* ============================================
   OVERLAYS DE PLAY
   ============================================ */
.overlay-play {
    position: fixed; z-index: 9000;
    display: flex; align-items: center; justify-content: center;
    pointer-events: auto;
    top: 20%; height: 55%;
}
#overlay-izq    { left: 0;   width: 22%; }
#overlay-centro { left: 22%; width: 56%; }
#overlay-der    { right: 0;  width: 22%; }

.play-btn {
    background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center;
    gap: 8px; padding: 0;
    -webkit-tap-highlight-color: transparent;
}
.play-icon-circle {
    width: 44px; height: 44px;
    background: var(--celeste-dim);
    border: 1.5px solid var(--celeste);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: var(--blanco);
    box-shadow: 0 0 20px var(--celeste-glow);
    transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
    padding-left: 3px;
}
.play-icon-circle--grande {
    width: 60px; height: 60px; font-size: 22px;
    padding-left: 4px; box-shadow: 0 0 30px var(--celeste-glow);
}
.play-btn:active .play-icon-circle {
    transform: scale(0.88);
    background: rgba(117,178,221,0.3);
    box-shadow: 0 0 40px var(--celeste-glow);
}
.play-label {
    color: var(--blanco); font-family: var(--font-body);
    font-size: 9px; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    text-shadow: 0 1px 6px rgba(0,0,0,1);
    text-align: center; line-height: 1.4;
}
.play-btn--centro .play-label { font-size: 11px; }

/* ============================================
   HINT SWIPE — más grande y llamativo
   ============================================ */
#hint-swipe {
    position: fixed; bottom: 148px;
    left: 50%; transform: translateX(-50%);
    z-index: 10000;
    display: flex; align-items: center; gap: 14px;
    background: var(--glass); border: 1.5px solid var(--celeste);
    border-radius: 40px; padding: 12px 28px;
    pointer-events: none; white-space: nowrap;
    backdrop-filter: blur(12px);
    box-shadow: 0 0 16px var(--celeste-glow);
}
.hint-arrow {
    color: var(--celeste); font-size: 20px; line-height: 1;
    animation: hintArrow 1.2s ease-in-out infinite;
}
.hint-arrow:last-child { animation-direction: reverse; }
@keyframes hintArrow { 0%,100%{opacity:1;transform:translateX(0)} 50%{opacity:0.4;transform:translateX(4px)} }
.hint-texto {
    color: var(--blanco); font-family: var(--font-display);
    font-size: 16px; letter-spacing: 2px; text-transform: uppercase;
}

/* ============================================
   BOTONES CIRCULARES — celeste con bordes blancos
   ============================================ */
#ui-controles-jugador {
    position: fixed; bottom: 50px;
    left: 50%; transform: translateX(-50%);
    display: flex; gap: 28px; z-index: 10000;
    align-items: center; justify-content: center; width: 100%;
    transition: opacity 0.4s ease;
}
.btn-circular {
    width: 84px; height: 84px; border-radius: 50%;
    background: rgba(117,178,221,0.25);
    color: var(--blanco);
    border: 2.5px solid rgba(255,255,255,0.8);
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    backdrop-filter: blur(12px);
    box-shadow: 0 0 20px rgba(117,178,221,0.3), inset 0 0 12px rgba(117,178,221,0.1);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
    font-size: 26px;
}
.btn-circular:active {
    transform: scale(0.88);
    border-color: var(--blanco);
    box-shadow: 0 0 30px var(--celeste-glow), inset 0 0 20px rgba(117,178,221,0.2);
}
.btn-circular .txt {
    font-size: 9px; font-weight: 700; font-family: var(--font-body);
    margin-top: 3px; color: var(--blanco);
    letter-spacing: 1px; text-transform: uppercase;
}

/* Estado activo de botón (perfil abierto / avatar activo)
   ✅ OPTIMIZACIÓN: usar opacity en lugar de animar box-shadow (que fuerza repaint en cada frame) */
.btn-activo {
    background: rgba(117,178,221,0.5) !important;
    border-color: var(--blanco) !important;
    box-shadow: 0 0 40px var(--celeste-glow), 0 0 70px rgba(117,178,221,0.5), inset 0 0 20px rgba(117,178,221,0.3) !important;
    animation: brilloActivo 1.5s ease-in-out infinite;
    will-change: opacity;
}
@keyframes brilloActivo {
    0%,100% { opacity: 0.85; }
    50%      { opacity: 1; }
}

/* ============================================
   GLOW DE ACTIVACIÓN — alrededor del jugador central
   ============================================ */
#glow-centro {
    position: fixed;
    top: 10%; left: 15%; right: 15%; bottom: 25%;
    z-index: 8500; pointer-events: none;
    border-radius: 16px;
    opacity: 0;
    box-shadow: 0 0 0 0 var(--celeste-glow);
    transition: opacity 0.3s ease;
}
#glow-centro.activo {
    animation: glowActivacion 1.5s ease-out forwards;
}
@keyframes glowActivacion {
    0%   { opacity:0; box-shadow: 0 0 0 0 rgba(117,178,221,0.8); }
    20%  { opacity:1; box-shadow: 0 0 60px 20px rgba(117,178,221,0.6); }
    100% { opacity:0; box-shadow: 0 0 0 0 rgba(117,178,221,0); }
}

/* ============================================
   FLECHA INDICADORA HACIA EL BOTÓN DE AUDIO
   ============================================ */
#flecha-audio {
    position: fixed; bottom: 122px; right: 10px;
    z-index: 10001;
    display: flex; flex-direction: row; align-items: center; gap: 6px;
}
.flecha-txt {
    font-family: var(--font-body); font-size: 9px; font-weight: 700;
    color: var(--blanco); letter-spacing: 1px; text-transform: uppercase;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
    white-space: nowrap;
}
.flecha-icon {
    font-size: 18px; color: var(--celeste);
    animation: flechaRebote 0.8s ease-in-out infinite;
    display: block; line-height: 1;
}
@keyframes flechaRebote {
    0%,100% { transform: translateX(0); }
    50%      { transform: translateX(4px); }
}

/* ============================================
   LEYENDA BAJO BOTONES
   ============================================ */
#leyenda-botones {
    position: fixed; bottom: 20px;
    left: 50%; transform: translateX(-50%);
    z-index: 10000; color: var(--txt-muted);
    font-family: var(--font-body); font-size: 9px;
    letter-spacing: 2px; pointer-events: none;
    white-space: nowrap; text-transform: uppercase;
}

#btn-audio {
    position: fixed; bottom: 60px; right: 20px; z-index: 10000;
    background: linear-gradient(135deg, rgba(212,175,55,0.5), rgba(212,175,55,0.2));
    border: 2.5px solid var(--oro);
    width: 60px; height: 60px; border-radius: 50%;
    color: var(--blanco); font-size: 26px; cursor: pointer;
    backdrop-filter: blur(10px);
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    animation: audioLatido 1.5s ease-in-out infinite;
}
#btn-audio.audio-activo {
    background: linear-gradient(135deg, rgba(117,178,221,0.7), rgba(117,178,221,0.4));
    border-color: var(--blanco);
    animation: none;
    box-shadow: 0 0 30px var(--celeste-glow);
}
#btn-audio:active { transform: scale(0.9); }
/* ✅ OPTIMIZACIÓN: animar solo transform+opacity (GPU) en vez de box-shadow */
@keyframes audioLatido {
    0%,100% { transform: scale(1); opacity: 0.92; }
    50%     { transform: scale(1.06); opacity: 1; }
}
#btn-audio { will-change: transform, opacity; }

/* ============================================
   PANEL STATS
   ============================================ */
#ui-stats {
    position: fixed; bottom: 145px;
    left: 50%; transform: translateX(-50%);
    z-index: 10001;
    background: var(--glass); backdrop-filter: blur(16px);
    color: var(--blanco); padding: 22px; border-radius: 20px;
    border-top: 2px solid var(--celeste);
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    width: 85%; max-width: 320px; cursor: pointer;
    animation: slideUp 0.4s cubic-bezier(0.22,1,0.36,1);
}
@keyframes slideUp {
    from { transform: translate(-50%, 24px); opacity: 0; }
    to   { transform: translate(-50%, 0);    opacity: 1; }
}
#ui-stats h3 {
    margin: 0 0 16px 0; font-family: var(--font-display);
    font-size: 22px; letter-spacing: 2px;
    color: var(--celeste); text-align: center;
}
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat-item { display: flex; flex-direction: column; }
.stat-item span {
    color: var(--txt-muted); font-size: 9px;
    text-transform: uppercase; letter-spacing: 1.5px;
}
.stat-item b { color: var(--blanco); font-size: 14px; font-weight: 700; margin-top: 3px; }

/* ============================================
   BOTÓN FIXTURE
   ============================================ */
#btn-fixture {
    position: fixed; bottom: 45%; left: 50%; transform: translateX(-50%);
    z-index: 10001;
    background: linear-gradient(135deg, var(--oro), #f2d06b);
    color: var(--negro); border: none; padding: 16px 36px; border-radius: 16px;
    font-family: var(--font-display); font-size: 26px; letter-spacing: 2px;
    cursor: pointer; box-shadow: 0 6px 24px rgba(212,175,55,0.5);
    display: flex; align-items: center; gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: pulsoOro 2s ease-in-out infinite;
    white-space: nowrap;
}
#btn-fixture:active { transform: translateX(-50%) scale(0.95); }
/* ✅ OPTIMIZACIÓN: usar transform en vez de box-shadow para pulso (GPU) */
@keyframes pulsoOro {
    0%,100% { transform: translateX(-50%) scale(1); }
    50%     { transform: translateX(-50%) scale(1.04); }
}
#btn-fixture { will-change: transform; }
#fixture-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--negro); z-index: 20000;
    display: flex; flex-direction: column;
    color: var(--blanco); box-sizing: border-box;
    font-family: var(--font-body);
    overflow: hidden;
    transition: opacity 0.4s ease;
    /* Permitir scroll vertical dentro del fixture sin bloquear gestos AR */
    touch-action: pan-y !important;
}

/* Header */
#fixture-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 16px 12px;
    background: linear-gradient(135deg, #0d1f3c, #1a3a6e);
    flex-shrink: 0;
}
#close-fixture {
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(255,68,68,0.15); border: 1px solid rgba(255,68,68,0.35);
    color: #ff6b6b; font-size: 14px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
#fixture-header-txt { flex: 1; }
.fixture-titulo {
    font-family: var(--font-display); font-size: 22px;
    letter-spacing: 3px; color: var(--blanco); line-height: 1;
}
.fixture-subtitulo {
    font-size: 9px; color: rgba(255,255,255,0.45);
    letter-spacing: 1px; text-transform: uppercase; margin-top: 3px;
}
#live-indicator {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
}
#live-indicator span {
    font-size: 8px; color: rgba(255,68,68,0.8);
    font-weight: 700; letter-spacing: 1px;
}
.live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #ff4444; animation: liveBlink 1s ease-in-out infinite;
}
@keyframes liveBlink { 0%,100%{opacity:1} 50%{opacity:0.2} }

/* Selector grupos */
#grupos-scroll {
    display: flex; gap: 8px; padding: 12px 16px;
    overflow-x: auto; scrollbar-width: none; flex-shrink: 0;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--glass-border);
}
#grupos-scroll::-webkit-scrollbar { display: none; }
.grupo-btn {
    flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
    border: 1.5px solid rgba(117,178,221,0.3);
    background: rgba(117,178,221,0.08); color: var(--celeste);
    font-family: var(--font-display); font-size: 16px; letter-spacing: 1px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s;
}
.grupo-btn.activo {
    background: var(--celeste); color: var(--negro);
    border-color: var(--celeste);
    box-shadow: 0 0 12px var(--celeste-glow);
}

/* Tabs GRUPOS / LLAVES */
#fixture-tabs {
    display: flex; gap: 0; padding: 0 12px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0; margin-top: 4px;
}
.fixture-tab-btn {
    flex: 1; padding: 10px 8px; border: none;
    background: transparent;
    color: var(--txt-muted);
    font-family: var(--font-display); font-size: 15px; letter-spacing: 2px;
    cursor: pointer; transition: all 0.2s;
    border-bottom: 2px solid transparent;
    border-radius: 0;
}
.fixture-tab-btn.activo {
    color: var(--celeste);
    border-bottom: 2px solid var(--celeste);
    background: transparent;
}
.fixture-tab-btn:active { opacity: 0.7; }

#fixture-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y !important;
    overscroll-behavior: contain;
    /* Padding inferior extra: evita que el último partido quede tapado
       por la barra de navegación del browser en móviles */
    padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 72px);
}

/* Sin scroll anidado — #fixture-body maneja todo el scroll */
#partidos-hoy,
#partidos-grupo {
    overflow: visible;
    pointer-events: auto;
}

.fixture-seccion-title {
    font-family: var(--font-display); font-size: 14px;
    letter-spacing: 2px; color: var(--celeste);
    padding: 14px 16px 6px;
}
.fixture-loading {
    color: rgba(255,255,255,0.35); font-size: 12px;
    text-align: center; padding: 20px;
}

/* Partido del día */
.partido-hoy {
    margin: 0 12px 10px; padding: 12px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(117,178,221,0.2); border-radius: 12px;
}
.partido-fase {
    display: none !important; /* Etiquetas genéricas de API (Group Stage, etc.) deshabilitadas */
}
.partido-estado-live {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(255,68,68,0.12); border: 1px solid rgba(255,68,68,0.3);
    border-radius: 10px; padding: 2px 8px;
    font-size: 8px; color: #ff6b6b; font-weight: 700;
    margin-bottom: 6px;
}
.partido-hora {
    font-size: 10px; color: rgba(255,255,255,0.4);
    text-align: center; margin-bottom: 6px;
}
.partido-equipos {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}
.partido-equipo {
    display: flex; align-items: center; gap: 6px; min-width: 0;
}
.partido-equipo.der {
    justify-content: flex-end;
    flex-direction: row-reverse;
}
.partido-equipo-nombre {
    font-size: 12px; font-weight: 600; color: var(--blanco);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 90px;
}
.partido-marcador {
    background: var(--celeste); color: var(--negro);
    font-family: var(--font-display); font-size: 18px;
    padding: 4px 12px; border-radius: 6px; letter-spacing: 1px;
    white-space: nowrap;
}
.partido-marcador.pendiente {
    background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.4);
    font-size: 14px;
}
.sin-partidos {
    color: rgba(255,255,255,0.3); font-size: 12px;
    text-align: center; padding: 16px;
    font-style: italic;
}

/* Tabla de posiciones */
#tabla-posiciones {
    margin: 0 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border); border-radius: 12px;
    overflow: hidden;
}
.tabla-header {
    display: grid; grid-template-columns: 1fr 32px 32px 32px 36px;
    padding: 8px 12px;
    background: rgba(117,178,221,0.1);
    border-bottom: 1px solid var(--glass-border);
}
.tabla-header span {
    font-size: 9px; font-weight: 700; letter-spacing: 1px;
    color: var(--celeste); text-transform: uppercase; text-align: center;
}
.tabla-header span:first-child { text-align: left; }
.tabla-fila {
    display: grid; grid-template-columns: 1fr 32px 32px 32px 36px;
    padding: 9px 12px; align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.2s;
}
.tabla-fila:last-child { border-bottom: none; }
.tabla-fila.destacada { background: rgba(117,178,221,0.1); }
.tabla-equipo {
    display: flex; align-items: center; gap: 8px;
}
.tabla-pos {
    font-size: 10px; color: rgba(255,255,255,0.3);
    width: 14px; flex-shrink: 0;
}
.tabla-nombre {
    font-size: 12px; color: var(--blanco); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 110px;
}
.tabla-stat { font-size: 12px; color: rgba(255,255,255,0.55); text-align: center; }
.tabla-pts { font-size: 13px; color: var(--oro); font-weight: 700; text-align: center; }

/* ============================================
   NOMBRE ANIMADO
   ============================================ */
#nombre-animado {
    position: fixed;
    bottom: 218px;
    left: 50%; transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0px;
    height: 44px;
    pointer-events: none;
    white-space: nowrap;
}

.letra-anim {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 36px;
    color: var(--blanco);
    letter-spacing: 2px;
    opacity: 0;
    transform: translateY(18px) scaleY(1.3);
    filter: blur(4px);
    /* ✅ Stroke + sombras tipo camiseta para legibilidad sobre cualquier fondo */
    -webkit-text-stroke: 1.5px #000;
    text-shadow:
        2px 2px 0 #000,
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        0 0 6px rgba(0,0,0,0.95),
        0 0 18px rgba(117,178,221,0.6);
    will-change: opacity, transform;
}
/* ✅ Auto-escalar nombre si es muy largo (apellidos compuestos) */
#nombre-animado.nombre-largo .letra-anim { font-size: 28px; letter-spacing: 1px; }
#nombre-animado.nombre-extra .letra-anim { font-size: 22px; letter-spacing: 0.5px; }
.letra-anim.show {
    animation: letraIn 0.35s cubic-bezier(0.22,1,0.36,1) forwards;
}
.letra-apellido {
    color: var(--celeste);
    text-shadow: 0 0 24px rgba(117,178,221,0.7);
}
@keyframes letraIn {
    0%   { opacity:0; transform:translateY(18px) scaleY(1.3); filter:blur(4px); }
    60%  { opacity:1; filter:blur(0); }
    100% { opacity:1; transform:translateY(0) scaleY(1); filter:blur(0); }
}

/* ============================================
   BOTÓN COMPARTIR — inline dentro del flex de botones
   ============================================ */
#btn-compartir {
    animation: popIn 0.35s cubic-bezier(0.22,1,0.36,1);
    position: static !important; /* anula cualquier fixed heredado */
}
@keyframes popIn {
    from { opacity:0; transform: scale(0.5); }
    to   { opacity:1; transform: scale(1); }
}

/* ============================================
   ONBOARDING OVERLAY
   ============================================ */
/* ── ONBOARDING — desactivado: el usuario entra directo a la cámara ────────
#onboarding-overlay {
    position: fixed; inset: 0; z-index: 30000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(5,10,15,0.88);
    backdrop-filter: blur(6px);
    opacity: 1;
    transition: opacity 0.5s ease;
}
#onboarding-overlay.fade-out {
    opacity: 0;
}
#onboarding-card {
    pointer-events: auto;
    display: flex; flex-direction: column;
    align-items: center; gap: 16px;
    padding: 28px 24px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    width: 85%; max-width: 300px;
    animation: cardIn 0.5s cubic-bezier(0.22,1,0.36,1);
}
@keyframes cardIn {
    from { opacity:0; transform: translateY(20px); }
    to   { opacity:1; transform: translateY(0); }
}

.ob-title {
    font-family: var(--font-display);
    font-size: 18px; letter-spacing: 2.5px;
    color: var(--celeste); text-align: center;
}

.ob-frame {
    position: relative; width: 100px; height: 90px;
}
.ob-corner {
    position: absolute; width: 18px; height: 18px;
    border-color: var(--celeste); border-style: solid;
    animation: cornerPulse 2s ease-in-out infinite;
}
.ob-tl { top:0; left:0;  border-width:2px 0 0 2px; }
.ob-tr { top:0; right:0; border-width:2px 2px 0 0; }
.ob-bl { bottom:0; left:0;  border-width:0 0 2px 2px; }
.ob-br { bottom:0; right:0; border-width:0 2px 2px 0; }
@keyframes cornerPulse {
    0%,100% { border-color: var(--celeste); }
    50%     { border-color: rgba(117,178,221,0.2); }
}
.ob-scan-line {
    position: absolute; left:4px; right:4px; height:1px;
    background: linear-gradient(90deg, transparent, var(--celeste), transparent);
    animation: obScan 2s ease-in-out infinite;
}
@keyframes obScan { 0%,100%{top:2px} 50%{top:84px} }
.ob-frame-inner {
    position: absolute; inset:10px;
    display: flex; align-items:center; justify-content:center;
    font-size: 30px;
}

.ob-steps { display:flex; flex-direction:column; gap:10px; width:100%; }
.ob-step  { display:flex; align-items:flex-start; gap:10px; }
.ob-num {
    width:18px; height:18px; border-radius:50%; flex-shrink:0;
    background: var(--celeste-dim); border:1px solid var(--celeste);
    font-size:9px; font-weight:700; color:var(--celeste);
    display:flex; align-items:center; justify-content:center;
    font-family: var(--font-body); margin-top:1px;
}
.ob-step-txt {
    font-family: var(--font-body); font-size:11px;
    color: var(--txt-muted); line-height:1.5; letter-spacing:0.2px;
}
.ob-step-txt b { color:var(--blanco); font-weight:600; }
.ob-accent { color:var(--celeste); font-weight:600; }

.ob-badge {
    display:inline-flex; align-items:center; gap:6px;
    background: var(--celeste-dim);
    border:1px solid var(--glass-border);
    border-radius:20px; padding:5px 14px;
    font-family:var(--font-body); font-size:9px;
    color:var(--txt-muted); letter-spacing:0.8px;
    text-transform:uppercase;
}
.ob-dot {
    width:6px; height:6px; border-radius:50%;
    background:var(--celeste);
    animation: obBlink 1.5s ease-in-out infinite;
}
@keyframes obBlink { 0%,100%{opacity:1} 50%{opacity:0.2} }
── fin ONBOARDING ──────────────────────────────────────────────────────── */

/* ============================================
   UTILIDADES
   ============================================ */
/* ============================================
   BRACKET LLAVES
   ============================================ */
.bracket-scroll {
    overflow-x: auto; padding: 12px 8px 20px;
    -webkit-overflow-scrolling: touch;
}
.bracket-scroll::-webkit-scrollbar { height: 4px; }
.bracket-scroll::-webkit-scrollbar-thumb { background:rgba(117,178,221,0.3); border-radius:2px; }
.bracket-wrap {
    display: flex; align-items: center;
    min-width: 700px; gap: 4px;
}
.bracket-col {
    display: flex; flex-direction: column;
    align-items: center; flex: 1;
}
.bracket-centro { flex: 0 0 auto; padding: 0 6px; }
.bracket-col-title {
    font-family: var(--font-display); font-size: 10px;
    letter-spacing: 2px; color: var(--celeste);
    text-align: center; padding: 4px 0 8px; white-space: nowrap;
}
.bracket-col-partidos { display:flex; flex-direction:column; width:100%; }
.bracket-oct .bracket-partido { margin-bottom: 6px; }
.bracket-qua .bracket-partido { margin-bottom: 46px; }
.bracket-sem .bracket-partido { margin-top: 52px; }
.bracket-16  .bracket-partido { margin-bottom: 2px; }
.bracket-vacio { opacity: 0.35; border-style: dashed; }
.bracket-partido {
    display: flex; flex-direction: column;
    border-radius: 6px; overflow: hidden;
    border: 1px solid rgba(117,178,221,0.2);
    width: 120px; margin: 0 auto;
}
.bracket-equipo {
    display: flex; align-items: center; gap: 4px;
    padding: 5px 6px;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    min-width: 0;
}
.bracket-equipo:last-child { border-bottom: none; }
.bracket-equipo.bracket-ganador {
    background: rgba(117,178,221,0.2); font-weight: 700;
}
.bracket-nombre {
    font-size: 9px; color: var(--blanco); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 1; min-width: 0;
}
.bracket-gol {
    font-family: var(--font-display); font-size: 12px;
    color: var(--celeste); margin-left: 2px; flex-shrink: 0;
}
.bracket-ganador .bracket-gol { color: var(--oro); }

.hidden { display: none !important; opacity: 0; pointer-events: none; }

/* ============================================
   ✅ TÍTULO TAPA (overlay HTML) — "Homenaje a la mejor hinchada"
   ============================================ */
.overlay-titulo {
    position: fixed;
    top: 11vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
    text-align: center;
    animation: tituloIn 0.6s cubic-bezier(0.22,1,0.36,1);
    will-change: opacity, transform;
}
@keyframes tituloIn {
    from { opacity: 0; transform: translate(-50%, -16px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
#tapa-titulo .titulo-linea-1,
#tapa-titulo .titulo-linea-2,
#tapa-titulo .titulo-linea-3 {
    font-family: var(--font-display);
    color: var(--blanco);
    letter-spacing: 3px;
    line-height: 1.05;
    /* Stroke + sombras para legibilidad sobre cualquier fondo */
    -webkit-text-stroke: 1.5px #000;
    text-shadow:
        2px 2px 0 #000,
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        0 0 8px rgba(0,0,0,0.9),
        0 0 22px rgba(117,178,221,0.7);
}
#tapa-titulo .titulo-linea-1 { font-size: 22px; }
#tapa-titulo .titulo-linea-2 { font-size: 30px; color: var(--celeste); }
#tapa-titulo .titulo-linea-3 { font-size: 22px; }

/* Responsive — pantallas chicas */
@media (max-width: 360px) {
    #tapa-titulo .titulo-linea-1,
    #tapa-titulo .titulo-linea-3 { font-size: 18px; letter-spacing: 2px; }
    #tapa-titulo .titulo-linea-2 { font-size: 24px; }
}

/* ============================================
   ✅ TÍTULO MUNDIAL 78 / 86 (overlay HTML, cambia con swipe)
   ============================================ */
#mundial-titulos {
    position: fixed;
    top: 12vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    animation: tituloIn 0.5s cubic-bezier(0.22,1,0.36,1);
    will-change: opacity, transform;
}
.mundial-label {
    font-family: var(--font-display);
    font-size: 30px;
    color: var(--blanco);
    letter-spacing: 3px;
    padding: 8px 22px;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.5);
    -webkit-text-stroke: 1px #000;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.7);
    white-space: nowrap;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.25s ease;
}
/* Mundial 78 — fondo celeste (albiceleste) */
.mundial-label.mundial-78 {
    background: linear-gradient(135deg, rgba(117,178,221,0.88), rgba(117,178,221,0.55));
    border: 2px solid var(--celeste);
    box-shadow: 0 4px 18px rgba(0,0,0,0.5), 0 0 20px rgba(117,178,221,0.4);
}
/* Mundial 86 — fondo azul profundo */
.mundial-label.mundial-86 {
    background: linear-gradient(135deg, rgba(30,80,180,0.92), rgba(15,45,130,0.70));
    border: 2px solid rgba(80,140,255,0.8);
    box-shadow: 0 4px 18px rgba(0,0,0,0.5), 0 0 20px rgba(30,80,180,0.5);
}
.mundial-hint {
    display: flex; align-items: center; gap: 8px;
    background: var(--glass);
    border: 1px solid var(--celeste);
    border-radius: 30px;
    padding: 6px 16px;
    font-family: var(--font-display);
    font-size: 13px; letter-spacing: 2px;
    color: var(--blanco);
    backdrop-filter: blur(8px);
}
@media (max-width: 360px) {
    .mundial-label { font-size: 24px; padding: 6px 16px; letter-spacing: 2px; }
    .mundial-hint { font-size: 11px; }
}

/* ============================================
   ✅ OPTIMIZACIONES PARA DISPOSITIVOS DE BAJA GAMA
   - Reduce animaciones costosas y blur cuando el usuario lo prefiere
   - Reduce blur en pantallas chicas (gama baja suele tener pantalla chica)
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .confetti-piece,
    .letra-anim,
    .hint-arrow,
    #ui-info,
    #btn-audio,
    #btn-fixture,
    .btn-activo,
    #loading-logo,
    .ob-corner,
    .ob-scan-line,
    .ob-dot,
    .live-dot,
    .flecha-icon {
        animation: none !important;
    }
}

/* Reducir backdrop-filter en pantallas pequeñas — blur consume mucha GPU */
@media (max-width: 380px) {
    #ui-info,
    #hint-swipe,
    #ui-stats,
    .btn-circular,
    #btn-audio,
    #btn-back {
        backdrop-filter: blur(4px);
    }
}
/* ============================================
   PANTALLA DE CARGA
   ============================================ */
#loading-screen {
    position: fixed; inset: 0; z-index: 99999;
    background: #050a0f;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.8s ease;
}
#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}
#loading-card {
    display: flex; flex-direction: column;
    align-items: center; gap: 16px;
    padding: 40px 32px;
}
#loading-logo {
    font-size: 56px;
    animation: loadingPulse 1.5s ease-in-out infinite;
}
@keyframes loadingPulse {
    0%,100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.15); opacity: 0.7; }
}
#loading-titulo {
    font-family: var(--font-display);
    font-size: 28px; letter-spacing: 6px;
    color: var(--blanco);
}
#loading-barra-wrap {
    width: 220px; height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px; overflow: hidden;
}
#loading-barra {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--celeste), var(--oro));
    border-radius: 2px;
    transition: width 0.3s ease;
}
#loading-texto {
    font-family: var(--font-body);
    font-size: 11px; letter-spacing: 2px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
}

/* ============================================
   SCANNER UI — anillos + "Mantené la cámara quieta"
   Controlado completamente por JS (style.display)
   Sin dependencia de .hidden para evitar conflictos
   ============================================ */
#scanner-ui {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 99999 !important;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    pointer-events: none;
    animation: scannerFadeIn 0.5s ease;
}
@keyframes scannerFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Anillos */
.scanner-rings {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.scanner-ring {
    position: absolute;
    top: 50%; left: 50%;
    border-radius: 50%;
    border: 2px solid var(--celeste);
    opacity: 0;
    animation: scanPulse 2.4s ease-out infinite;
    will-change: transform, opacity;
}
.s-ring-1 { width:  56px; height:  56px; animation-delay: 0s;   transform: translate(-50%,-50%) scale(0); }
.s-ring-2 { width: 100px; height: 100px; animation-delay: 0.7s; transform: translate(-50%,-50%) scale(0); }
.s-ring-3 { width: 148px; height: 148px; animation-delay: 1.4s; transform: translate(-50%,-50%) scale(0); }

@keyframes scanPulse {
    0%   { transform: translate(-50%,-50%) scale(0.15); opacity: 1; }
    75%  { opacity: 0.2; }
    100% { transform: translate(-50%,-50%) scale(1);    opacity: 0; }
}

/* Badge con aura dorada */
.scanner-label {
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 4px;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    padding: 13px 28px;
    border-radius: 40px;
    border: 1.5px solid rgba(212,175,55,0.8);
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    text-shadow:
        0 0 12px rgba(212,175,55,0.8),
        0 1px 4px rgba(0,0,0,1);
    box-shadow:
        0 0 18px rgba(212,175,55,0.55),
        0 0 38px rgba(212,175,55,0.28),
        0 0 70px rgba(212,175,55,0.12),
        inset 0 0 14px rgba(212,175,55,0.12);
    animation: scanLabelPulse 2s ease-in-out infinite;
}
@keyframes scanLabelPulse {
    0%, 100% {
        box-shadow:
            0 0 18px rgba(212,175,55,0.55),
            0 0 38px rgba(212,175,55,0.28),
            0 0 70px rgba(212,175,55,0.12),
            inset 0 0 14px rgba(212,175,55,0.12);
    }
    50% {
        box-shadow:
            0 0 28px rgba(212,175,55,0.85),
            0 0 56px rgba(212,175,55,0.45),
            0 0 100px rgba(212,175,55,0.22),
            inset 0 0 20px rgba(212,175,55,0.2);
    }
}

@media (max-width: 380px) {
    .scanner-rings { width: 116px; height: 116px; }
    .s-ring-1 { width:  46px; height:  46px; }
    .s-ring-2 { width:  84px; height:  84px; }
    .s-ring-3 { width: 122px; height: 122px; }
    .scanner-label { font-size: 16px; letter-spacing: 3px; padding: 11px 22px; }
}

/* ============================================
   VIDEO LOADER — spinner mientras el video bufferiza
   Controlado por JS (style.display), sin .hidden
   ============================================ */
#video-loader {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 999999 !important;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    pointer-events: none;
    /* Sin animación de entrada: en gama baja loaderFadeIn retrasaba el primer paint */
}
@keyframes loaderFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Aro giratorio */
.vl-ring {
    width: 52px; height: 52px;
    border-radius: 50%;
    border: 3px solid rgba(117, 178, 221, 0.15);
    border-top-color: var(--celeste);
    border-right-color: var(--celeste);
    animation: vlSpin 0.85s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    will-change: transform;
    filter: drop-shadow(0 0 8px var(--celeste-glow));
}
@keyframes vlSpin { to { transform: rotate(360deg); } }

/* Texto */
.vl-label {
    font-family: var(--font-display);
    font-size: 26px;
    letter-spacing: 5px;
    color: var(--blanco);
    text-align: center;
    white-space: nowrap;
    padding: 10px 24px;
    border-radius: 32px;
    background: rgba(0, 0, 0, 0.60);
    border: 1.5px solid rgba(117, 178, 221, 0.40);
    text-shadow:
        0 0 18px var(--celeste-glow),
        0 0 36px rgba(117, 178, 221, 0.30),
        0 2px 8px rgba(0, 0, 0, 1);
    backdrop-filter: blur(10px);
    animation: vlPulse 1.2s ease-in-out infinite;
}
@keyframes vlPulse {
    0%, 100% { opacity: 0.80; }
    50%       { opacity: 1; }
}
@media (max-width: 380px) {
    .vl-label { font-size: 20px; letter-spacing: 3px; padding: 8px 16px; }
}

/* Sub-etiqueta "Enfocar a la página" dentro del cartel #ui-info */
.ui-info-sub {
    display: block;
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.55);
    text-align: center;
    text-transform: uppercase;
    margin-top: 6px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

/* ============================================
   CARTEL FLOTANTE "DESLIZÁ PARA VER SIGUIENTE"
   Aparece a los 4s en targets con jugadores.
   Se mantiene visible hasta que se pierde el target.
   ============================================ */
#hint-deslizar {
    position: fixed;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass);
    border: 1.5px solid var(--celeste);
    border-radius: 40px;
    padding: 11px 26px;
    pointer-events: none;
    white-space: nowrap;
    backdrop-filter: blur(12px);
    box-shadow: 0 0 18px var(--celeste-glow), 0 4px 16px rgba(0,0,0,0.5);
    animation: hintDeslizarIn 0.5s cubic-bezier(0.22,1,0.36,1);
}
@keyframes hintDeslizarIn {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.hint-deslizar-texto {
    color: var(--blanco);
    font-family: var(--font-display);
    font-size: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.hint-deslizar-arrow {
    color: var(--celeste);
    font-size: 18px;
    line-height: 1;
    animation: hintArrow 1.2s ease-in-out infinite;
}
.hint-deslizar-arrow:last-child { animation-direction: reverse; }
@media (max-width: 380px) {
    #hint-deslizar { padding: 9px 18px; bottom: 150px; }
    .hint-deslizar-texto { font-size: 12px; letter-spacing: 1.5px; }
}