/* =========================================================
   GPS EXTREM - INTRO CINEMÁTICA & ZOOM MAPAMUNDI
   ========================================================= */

:root {
    --intro-bg-dark: #000000;
    --intro-primary: #00d2ff;
    --intro-secondary: #3a7bd5;
    --intro-accent-green: #00ff88;
    --intro-accent-gold: #fbbf24;
    --intro-text: #f8fafc;
    --intro-text-muted: #94a3b8;
    --intro-glow-cyan: rgba(0, 210, 255, 0.45);
    --intro-glow-green: rgba(0, 255, 136, 0.4);
    --intro-glow-gold: rgba(251, 191, 36, 0.4);
}

/* Contenedor principal a pantalla completa */
#gps-intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #000000;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    color: var(--intro-text);
    font-family: 'Outfit', 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s ease, transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#gps-intro-overlay.intro-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(1.08);
}

/* Efecto de Fondo: Rejilla HUD y Estrellas */
.intro-bg-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(0, 210, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 210, 255, 0.05) 1px, transparent 1px);
    background-size: 35px 35px;
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
}

.intro-scanline {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 210, 255, 0.03) 50%, transparent 100%);
    background-size: 100% 8px;
    pointer-events: none;
    z-index: 2;
}

/* ---------------------------------------------------------
   1. CABECERA: TÍTULO, LOGO Y CRÉDITOS
   --------------------------------------------------------- */
.intro-header-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    background: #000000;
    border-bottom: 1px solid rgba(0, 210, 255, 0.2);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.9);
    padding: 14px 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: introFadeDown 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.intro-brand-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 4px;
}

/* Logotipo con anillos animados */
.intro-logo-container {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.intro-logo-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--intro-primary);
    opacity: 0.7;
    animation: introRingSpin 6s linear infinite;
}

.intro-logo-ring:nth-child(2) {
    inset: -4px;
    border-color: var(--intro-accent-green);
    animation-duration: 9s;
    animation-direction: reverse;
    opacity: 0.5;
}

.intro-logo-img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: url('../assets/img/icon-192.png') no-repeat center;
    background-size: cover;
    box-shadow: 0 0 15px var(--intro-glow-cyan);
    position: relative;
    z-index: 2;
}

.intro-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0;
    background: linear-gradient(135deg, #ffffff 40%, #00d2ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(0, 210, 255, 0.3);
}

.intro-title .intro-title-accent {
    background: linear-gradient(135deg, #00ff88 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-credits-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--intro-text-muted);
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.intro-credits-badge {
    background: rgba(0, 210, 255, 0.12);
    border: 1px solid rgba(0, 210, 255, 0.3);
    color: var(--intro-primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
}

/* ---------------------------------------------------------
   2. VISOR DEL ZOOM CINEMÁTICO (MAPA)
   --------------------------------------------------------- */
.intro-stage-container {
    position: relative;
    z-index: 10;
    width: min(90vw, 390px, calc(100dvh - 270px));
    height: min(90vw, 390px, calc(100dvh - 270px));
    aspect-ratio: 1 / 1;
    margin: 4px 0;
    border-radius: 20px;
    background: #000000;
    border: 1px solid rgba(0, 210, 255, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 210, 255, 0.15);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Decoraciones HUD esquinas */
.intro-stage-container::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 14px;
    height: 14px;
    border-top: 2px solid var(--intro-primary);
    border-left: 2px solid var(--intro-primary);
    z-index: 25;
    pointer-events: none;
}

.intro-stage-container::after {
    content: '';
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 14px;
    height: 14px;
    border-bottom: 2px solid var(--intro-primary);
    border-right: 2px solid var(--intro-primary);
    z-index: 25;
    pointer-events: none;
}

/* Canvas y Contenedor de zoom */
.intro-zoom-viewport {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#introZoomCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Capa de Mapa Extremadura (Aspect Ratio 1:1 idéntico a las fichas) */
.intro-extremadura-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    opacity: 0;
    transform: scale(1.3);
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 15;
}

.intro-extremadura-layer.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.intro-extremadura-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
    filter: drop-shadow(0 0 15px rgba(0, 210, 255, 0.2));
}

/* HUD Overlay de Coordenadas y Satélite */
.intro-hud-bar {
    position: absolute;
    top: 10px;
    left: 14px;
    right: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: monospace;
    font-size: 0.7rem;
    color: var(--intro-primary);
    text-shadow: 0 0 8px var(--intro-glow-cyan);
    z-index: 20;
    pointer-events: none;
}

.intro-hud-target {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(2, 6, 23, 0.7);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0, 210, 255, 0.25);
    backdrop-filter: blur(4px);
}

.intro-hud-blinker {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--intro-accent-green);
    box-shadow: 0 0 8px var(--intro-accent-green);
    animation: introBlink 1s infinite alternate;
}

/* ---------------------------------------------------------
   3. BOLA DEL USUARIO Y RÓTULO DINÁMICO ("ESTÁS EN...")
   --------------------------------------------------------- */
.intro-user-pin-wrapper {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 30;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.intro-user-pin-wrapper.active {
    opacity: 1;
}

/* La bola radar pulsante */
.intro-user-dot {
    position: relative;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.9), 0 0 30px rgba(239, 68, 68, 0.6);
}

.intro-dot-pulse {
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    border: 2px solid rgba(239, 68, 68, 0.8);
    animation: introPulseRipple 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

.intro-dot-pulse:nth-child(2) {
    animation-delay: 0.7s;
}

/* Rótulo Flotante: "Estás en Trujillo" */
.intro-location-bubble {
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    white-space: nowrap;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid var(--intro-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 15px var(--intro-glow-cyan);
    border-radius: 12px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
    opacity: 0;
    animation: introPopUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

.intro-location-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: var(--intro-primary) transparent transparent transparent;
}

.intro-location-bubble i {
    color: #ef4444;
    font-size: 0.95rem;
    animation: introBounce 1.5s infinite ease-in-out;
}

.intro-location-bubble strong {
    color: var(--intro-primary);
    font-weight: 700;
}

/* ---------------------------------------------------------
   4. ALERTA / BANNER GPS INACTIVO
   --------------------------------------------------------- */
.intro-gps-alert {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    z-index: 35;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--intro-accent-gold);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6), 0 0 15px var(--intro-glow-gold);
    backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.intro-gps-alert.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.intro-gps-alert-text {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--intro-text);
}

.intro-gps-alert-text i {
    font-size: 1.1rem;
    color: var(--intro-accent-gold);
}

.intro-btn-gps {
    background: linear-gradient(135deg, var(--intro-accent-gold), #f59e0b);
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s, filter 0.2s;
}

.intro-btn-gps:hover {
    transform: scale(1.04);
    filter: brightness(1.1);
}

/* ---------------------------------------------------------
   5. CONTROLES INFERIORES: BOTÓN ENTRAR, SALTAR Y BARRA PROGRESO
   --------------------------------------------------------- */
.intro-footer-controls {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 500px;
    padding: 8px 20px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: introFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.intro-btn-enter {
    width: 100%;
    padding: 14px 20px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--intro-primary), var(--intro-secondary));
    color: #000000;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 210, 255, 0.35);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.intro-btn-enter:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 210, 255, 0.55);
    filter: brightness(1.08);
}

.intro-btn-enter:active {
    transform: translateY(1px);
}

.intro-btn-enter::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: skewX(-25deg);
    animation: introShine 3.5s infinite;
}

.intro-skip-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 6px;
    font-size: 0.75rem;
    color: var(--intro-text-muted);
}

.intro-btn-skip {
    background: transparent;
    border: none;
    color: var(--intro-text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.intro-btn-skip:hover {
    color: var(--intro-text);
    background: rgba(255, 255, 255, 0.08);
}

/* Barra de progreso de cuenta regresiva */
.intro-progress-track {
    flex: 1;
    max-width: 120px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 12px;
}

.intro-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--intro-primary), var(--intro-accent-green));
    border-radius: 2px;
    transition: width 0.1s linear;
}

/* Botón flotante para reabrir la intro en cualquier momento desde index.html */
.btn-intro-replay {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(0, 210, 255, 0.3);
    color: var(--intro-primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}

.btn-intro-replay:hover {
    background: rgba(0, 210, 255, 0.2);
    border-color: var(--intro-primary);
    transform: scale(1.03);
}

/* ---------------------------------------------------------
   ANIMACIONES KEYFRAMES
   --------------------------------------------------------- */
@keyframes introFadeDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes introFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes introRingSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes introPulseRipple {
    0% {
        transform: scale(0.6);
        opacity: 0.9;
    }
    100% {
        transform: scale(2.6);
        opacity: 0;
    }
}

@keyframes introPopUp {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(12px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes introBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes introBlink {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

@keyframes introShine {
    0% { left: -100%; }
    20% { left: 150%; }
    100% { left: 150%; }
}

/* ---------------------------------------------------------
   CRÉDITOS DE PELÍCULA (SCROLL VERTICAL CONTINUO)
   --------------------------------------------------------- */
.intro-credits-scroll-wrapper {
    position: relative;
    z-index: 10;
    width: 92%;
    max-width: 440px;
    margin: 4px auto;
    padding: 6px 14px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
    animation: introFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.intro-credits-label {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--intro-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
    opacity: 0.95;
    text-shadow: 0 0 8px var(--intro-glow-cyan);
}

.intro-credits-viewport {
    position: relative;
    width: 100%;
    height: 38px;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 80%, transparent 100%);
}

.intro-credits-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: movieCreditsScroll 8.5s linear infinite;
}

.intro-credits-track:hover {
    animation-play-state: paused;
}

.intro-credit-item {
    font-size: 0.82rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.35;
    padding: 3px 0;
    white-space: nowrap;
    letter-spacing: 0.3px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

@keyframes movieCreditsScroll {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-50%);
    }
}

/* Adaptación responsive en pantallas pequeñas */
@media (max-height: 680px) {
    .intro-header-wrapper { padding: 6px 12px 2px; }
    .intro-title { font-size: 1.3rem; }
    .intro-stage-container {
        width: min(85vw, calc(100dvh - 225px));
        height: min(85vw, calc(100dvh - 225px));
        margin: 2px 0;
    }
    .intro-credits-scroll-wrapper {
        margin: 2px auto;
        padding: 4px 8px;
    }
    .intro-credits-viewport {
        height: 30px;
    }
    .intro-credit-item {
        font-size: 0.74rem;
        padding: 2px 0;
    }
    .intro-footer-controls { padding: 4px 14px 10px; }
    .intro-btn-enter { padding: 10px 14px; font-size: 0.85rem; }
}
