/* --------------------------------------------------------------------------
   1. CONFIGURACIÓN Y VARIABLES
   -------------------------------------------------------------------------- */
:root {
    /* Paleta Principal: Dark Elegant + Neon Accents */
    --bg-dark: #050505;
    --bg-card: rgba(20, 20, 20, 0.6);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    
    --text-primary: #f0f0f0;
    --text-secondary: #888888;
    
    /* Neon Principal (Verde Asensio) */
    --accent-neon: #ccff00; 
    --accent-glow: rgba(204, 255, 0, 0.4);
    
    /* Colores de Esferas (Conceptos) */
    --orb-1: #00d2ff; /* Curiosidad - Azul */
    --orb-2: #ccff00; /* Innovación - Verde Neon */
    --orb-3: #ffaa00; /* Energía - Ambar */
    --orb-4: #ff4d4d; /* Pasión - Rojo Rosado */
    --orb-5: #e0e0e0; /* Lucha - Platino */

    /* Tipografía */
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    /* Tiempos de Animación */
    --ease-elastic: cubic-bezier(0.68, -0.55, 0.27, 1.55);
    --ease-smooth: cubic-bezier(0.23, 1, 0.32, 1);
}

/* --------------------------------------------------------------------------
   2. RESET & BASE
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden; /* Vital para el sistema de vistas deslizantes */
    transition: background-color 0.5s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Textura de ruido (Grain) para acabado premium */
.noise-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* Fondo Glow Ambiental */
body::before {
    content: '';
    position: absolute;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(204,255,0,0.05) 0%, rgba(0,0,0,0) 70%);
    top: -20%; left: -10%;
    z-index: -1;
    animation: pulseAmbient 10s ease-in-out infinite alternate;
}

@keyframes pulseAmbient {
    0% { opacity: 0.5; transform: scale(1); }
    100% { opacity: 0.8; transform: scale(1.1); }
}

/* --------------------------------------------------------------------------
   3. SISTEMA DE VISTAS (SPA / TRANSICIÓN JUEGO)
   -------------------------------------------------------------------------- */
.view-wrapper {
    display: flex;
    width: 200vw; /* El doble del ancho de pantalla para contener Web + Juego */
    height: 100vh;
    /* Aquí definimos la velocidad y suavidad del deslizamiento */
    transition: transform 0.8s var(--ease-smooth);
    will-change: transform;
}

/* Estado activo del juego: mueve todo a la izquierda */
body.game-active .view-wrapper {
    transform: translateX(-100vw); /* Desliza para mostrar la segunda pantalla (Juego) */
}

.view-section {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* Vista 1: Sitio Web */
.site-view {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto; /* Scroll interno si la tarjeta es muy alta */
}

/* --------------------------------------------------------------------------
   4. TARJETA DE PERFIL (LAYOUT PRINCIPAL)
   -------------------------------------------------------------------------- */
.main-container {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.profile-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--bg-card-border);
    border-radius: 32px;
    padding: 40px;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 40px;
    max-width: 900px;
    width: 100%;
    box-shadow: 0 20px 80px rgba(0,0,0,0.5);
    transition: transform 0.3s var(--ease-smooth), box-shadow 0.3s var(--ease-smooth);
}

.profile-card:hover {
    box-shadow: 0 30px 100px rgba(0,0,0,0.6);
    border-color: rgba(255, 255, 255, 0.12);
}

/* --------------------------------------------------------------------------
   5. COLUMNA VISUAL (ÓRBITA & AVATAR)
   -------------------------------------------------------------------------- */
.visual-column {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.orbit-system {
    position: relative;
    width: 280px;
    height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Avatar Central */
.avatar-core {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    position: relative;
    z-index: 2;
    cursor: pointer;
    transition: transform 0.3s var(--ease-elastic);
    overflow: hidden; /* Para recortar la imagen cuadrada */
    background: #000;
}

.avatar-core img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Asegura que la imagen llene el círculo */
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.1);
}

.avatar-glow {
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 1px solid var(--accent-neon);
    opacity: 0.3;
    filter: blur(5px);
    z-index: -1;
    transition: all 0.3s ease;
}

.avatar-core:hover { transform: scale(1.05); }
.avatar-core:hover .avatar-glow { opacity: 0.6; inset: -8px; }
.avatar-core:active { transform: scale(0.95); }

/* Anillo Orbital */
.orbit-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px dashed rgba(255,255,255,0.1);
    animation: rotate 20s linear infinite;
    will-change: transform;
}

.orbit-system:hover .orbit-ring { animation-play-state: paused; }

/* Planetas (Esferas) */
.planet {
    position: absolute;
    width: 44px;
    height: 44px;
    left: 50%; top: 50%;
    margin-left: -22px; margin-top: -22px;
    will-change: transform;
}

/* Posicionamiento Matemático (Radio ~140px) */
.planet.p-1 { transform: rotate(0deg) translate(140px) rotate(0deg); }
.planet.p-2 { transform: rotate(72deg) translate(140px) rotate(-72deg); }
.planet.p-3 { transform: rotate(144deg) translate(140px) rotate(-144deg); }
.planet.p-4 { transform: rotate(216deg) translate(140px) rotate(-216deg); }
.planet.p-5 { transform: rotate(288deg) translate(140px) rotate(-288deg); }

.planet-inner {
    width: 100%; height: 100%;
    border-radius: 50%;
    background: #111;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex; justify-content: center; align-items: center;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    animation: counter-rotate 20s linear infinite;
    transition: transform 0.3s var(--ease-elastic), box-shadow 0.3s ease;
}

.planet-inner i { width: 18px; height: 18px; }

/* Colores Específicos */
.p-1 .planet-inner { color: var(--orb-1); border-color: rgba(0, 210, 255, 0.3); }
.p-2 .planet-inner { color: var(--orb-2); border-color: rgba(204, 255, 0, 0.3); }
.p-3 .planet-inner { color: var(--orb-3); border-color: rgba(255, 170, 0, 0.3); }
.p-4 .planet-inner { color: var(--orb-4); border-color: rgba(255, 77, 77, 0.3); }
.p-5 .planet-inner { color: var(--orb-5); border-color: rgba(224, 224, 224, 0.3); }

.orbit-system:hover .planet-inner { animation-play-state: paused; }
.planet-inner:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px var(--accent-glow);
    z-index: 10;
}

/* --------------------------------------------------------------------------
   6. COLUMNA INFO & LINKS
   -------------------------------------------------------------------------- */
.info-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-info { margin-bottom: 32px; }

.name {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.surname { color: var(--text-secondary); font-weight: 300; }

.claim {
    margin-top: 12px;
    font-size: 1rem;
    color: var(--accent-neon);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 600;
    opacity: 0.9;
}

/* Estilos de Enlaces */
.links-list { display: flex; flex-direction: column; gap: 12px; }

.link-item {
    display: flex; align-items: center;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 16px 20px;
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s var(--ease-smooth);
    position: relative; overflow: hidden;
}

.link-item:hover {
    background: rgba(255,255,255,0.08);
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.link-icon {
    display: flex; align-items: center;
    margin-right: 16px;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.link-item:hover .link-icon { color: var(--text-primary); }

.link-text { font-weight: 500; flex-grow: 1; }

.link-arrow {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s var(--ease-smooth);
    color: var(--accent-neon);
}
.link-item:hover .link-arrow { opacity: 1; transform: translateX(0); }

.highlight-link { border-color: rgba(204, 255, 0, 0.15); }
.highlight-link:hover {
    border-color: var(--accent-neon);
    box-shadow: 0 0 15px rgba(204, 255, 0, 0.1);
}

/* --------------------------------------------------------------------------
   7. FOOTER, BOTÓN JUEGO & EASTER EGGS
   -------------------------------------------------------------------------- */
.card-footer {
    margin-top: 32px;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.easter-egg-trigger button {
    background: none; border: none;
    font-size: 1.2rem; cursor: pointer;
    opacity: 0.3; transition: opacity 0.2s;
}
.easter-egg-trigger button:hover { opacity: 1; transform: scale(1.1); }

.mini-heart {
    width: 14px; height: 14px;
    vertical-align: middle; stroke-width: 2.5px;
}

/* BOTÓN DE ACTIVACIÓN DE JUEGO (GAMEPAD) */
.game-trigger-container {
    display: flex; justify-content: flex-end;
    margin-top: 15px;
}

.game-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--accent-neon);
    width: 50px; height: 50px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.3s var(--ease-elastic);
    position: relative;
    z-index: 20;
}

.game-btn:hover {
    background: rgba(204, 255, 0, 0.15);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: scale(1.15) rotate(15deg);
}
.game-btn i { width: 24px; height: 24px; }

.tooltip {
    position: absolute; right: 120%; top: 50%;
    transform: translateY(-50%);
    background: #111; color: #fff;
    padding: 5px 10px; border-radius: 6px;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    opacity: 0; pointer-events: none; transition: 0.2s;
    white-space: nowrap;
}
.game-btn:hover .tooltip { opacity: 1; }

/* --------------------------------------------------------------------------
   8. VISTA DE JUEGO & UI CANVAS
   -------------------------------------------------------------------------- */
.game-view {
    background: #080808; /* Ligeramente distinto al body */
}

canvas#game-canvas {
    display: block; width: 100%; height: 100%;
}

.game-ui {
    position: absolute; inset: 0; pointer-events: none;
}

/* BOTÓN DE MÚSICA */
.music-btn {
    position: absolute; top: 30px; left: 130px; /* Al lado del botón salir */
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: var(--accent-neon);
    width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center;
    cursor: pointer; pointer-events: auto;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
}
.music-btn:hover { background: rgba(204, 255, 0, 0.1); transform: scale(1.1); }
.music-btn.playing { background: var(--accent-neon); color: #000; box-shadow: 0 0 15px var(--accent-glow); }
.music-btn i { width: 18px; height: 18px; }

.score-board {
    position: absolute; top: 30px; right: 30px; text-align: right;
}

.score-label {
    display: block; font-size: 0.75rem;
    color: var(--text-secondary); letter-spacing: 0.1em;
}

#score-display {
    font-family: var(--font-heading);
    font-size: 2.5rem; font-weight: 700;
    color: var(--accent-neon);
    text-shadow: 0 0 10px var(--accent-glow);
}

.exit-btn {
    position: absolute; top: 30px; left: 30px;
    background: rgba(255,255,255,0.1);
    border: none; color: #fff;
    padding: 10px 20px; border-radius: 40px;
    display: flex; gap: 8px; align-items: center;
    cursor: pointer; pointer-events: auto;
    font-family: var(--font-body);
    font-weight: 600;
    backdrop-filter: blur(5px);
    transition: background 0.2s;
}
.exit-btn:hover { background: rgba(255,255,255,0.2); }
.exit-btn i { width: 18px; height: 18px; }

/* -- NUEVOS CONTROLES MÓVIL (PAD ARCADE) -- */
.mobile-controls-layer {
    position: absolute;
    top: 40%; /* Posición media-alta */
    left: 0; width: 100%;
    display: flex; justify-content: space-between;
    padding: 0 30px;
    pointer-events: none; /* Dejamos pasar clicks entre botones */
    z-index: 50;
    transform: translateY(-50%);
}

.control-pad {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 24px;
    display: grid; place-items: center;
    pointer-events: auto; /* Activamos touch */
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: transform 0.1s, background 0.1s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.control-pad:active {
    background: rgba(204, 255, 0, 0.3);
    border-color: var(--accent-neon);
    transform: scale(0.95);
}

/* Alineación limpia */
.pad-jump { margin-bottom: 0; }
.control-pad i { width: 32px; height: 32px; }

/* Overlay de Juego (Inicio / Game Over) */
.game-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 60;
}
.game-overlay.visible { opacity: 1; pointer-events: auto; }

.game-overlay h2 {
    font-family: var(--font-heading);
    font-size: 3.5rem; margin-bottom: 0.5rem;
    color: #fff; text-transform: uppercase;
}

.game-overlay p {
    color: var(--text-secondary); margin-bottom: 2rem; font-size: 1.1rem;
}

/* CONTENEDOR BOTONES OVERLAY */
.overlay-buttons {
    display: flex; flex-direction: column; gap: 15px; width: 100%; max-width: 300px;
}

/* PUNTUACIÓN FINAL */
.final-score {
    font-size: 1.5rem; color: var(--accent-neon); font-weight: bold; margin-top: -10px; margin-bottom: 20px;
    text-shadow: 0 0 15px rgba(204, 255, 0, 0.3); text-align: center;
}

/* BOTONES OVERLAY */
.start-btn {
    background: var(--accent-neon);
    color: #000; border: none;
    padding: 16px 0; width: 100%;
    font-size: 1.1rem; font-weight: 700;
    font-family: var(--font-heading);
    letter-spacing: 0.05em; border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--accent-glow);
}

.home-btn {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid rgba(255, 255, 255, 0.15);
    padding: 14px 0; width: 100%;
    font-size: 1rem; font-weight: 600;
    font-family: var(--font-heading);
    letter-spacing: 0.05em; border-radius: 50px;
    cursor: pointer; transition: all 0.2s;
    text-transform: uppercase;
}
.home-btn:hover {
    border-color: var(--accent-neon); color: var(--accent-neon); background: rgba(204, 255, 0, 0.05);
}

/* Pistas de Control */
.controls-hint {
    display: flex; gap: 20px;
    font-size: 0.9rem;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 15px 30px; border-radius: 20px;
    margin-bottom: 2rem !important;
    background: rgba(255,255,255,0.05);
}
.controls-hint span {
    display: inline-block; background: rgba(255,255,255,0.1);
    padding: 2px 8px; border-radius: 4px; font-weight: bold; margin-right: 5px;
}
.mobile-hint { display: none; }

/* --------------------------------------------------------------------------
   9. EASTER EGG LAYERS (TOAST, SCENE, JAPAN MODE)
   -------------------------------------------------------------------------- */
/* Toast */
.toast-message {
    position: fixed; bottom: 30px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(255,255,255,0.95);
    color: #000;
    padding: 12px 24px;
    border-radius: 50px;
    display: flex; align-items: center; gap: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    font-weight: 600; font-size: 0.9rem;
    opacity: 0; pointer-events: none;
    transition: all 0.4s var(--ease-elastic);
    z-index: 100;
}
.toast-message.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Escena de Emojis Caminando */
.scene-container {
    position: fixed; bottom: 0; left: 0;
    width: 100%; height: 35%;
    pointer-events: none; z-index: 1000;
    overflow: hidden;
}
.walker {
    position: absolute; bottom: 0;
    font-size: 3rem; will-change: transform;
    /* Animación inyectada via JS */
}

/* JAPAN MODE (Activado por Konami Code o Puntuación) */
body.japan-mode {
    background-color: #f4f4f4;
    --text-primary: #111;
    --text-secondary: #555;
    --bg-card: rgba(255,255,255,0.8);
    --bg-card-border: rgba(0,0,0,0.1);
    --accent-neon: #bc002d; /* Rojo Japón */
    --accent-glow: rgba(188, 0, 45, 0.4);
}
body.japan-mode .name { color: #000; }
body.japan-mode .planet-inner { background: #fff; color: #bc002d; border-color: #bc002d; }
body.japan-mode .link-item:hover { background: rgba(188,0,45,0.05); border-color: #bc002d; }
body.japan-mode .game-view { background: #fff; }

/* --------------------------------------------------------------------------
   10. ANIMACIONES & RESPONSIVE
   -------------------------------------------------------------------------- */
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes counter-rotate { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }

/* Media Queries */
@media (max-width: 1024px) {
    /* En tablet/móvil, el juego ocupa toda la pantalla con un swipe del 100% */
    body.game-active .view-wrapper { transform: translateX(-100vw); }
    .view-wrapper { width: 200vw; }
}

@media (max-width: 768px) {
    .profile-card {
        grid-template-columns: 1fr;
        gap: 30px; padding: 30px 20px;
    }
    
    .visual-column { margin-bottom: 10px; }
    
    .orbit-system { width: 240px; height: 240px; }
    .avatar-core { width: 110px; height: 110px; }
    
    /* Reajuste de planetas para móvil (Radio ~120px) */
    .planet.p-1 { transform: rotate(0deg) translate(120px) rotate(0deg); }
    .planet.p-2 { transform: rotate(72deg) translate(120px) rotate(-72deg); }
    .planet.p-3 { transform: rotate(144deg) translate(120px) rotate(-144deg); }
    .planet.p-4 { transform: rotate(216deg) translate(120px) rotate(-216deg); }
    .planet.p-5 { transform: rotate(288deg) translate(120px) rotate(-288deg); }

    .header-info { text-align: center; }
    .name { font-size: 2rem; }
    .card-footer { justify-content: center; gap: 20px; }
    .game-trigger-container { justify-content: center; }

    /* Hints del juego */
    .desktop-hint { display: none; }
    .mobile-hint { display: block; }
    
    .game-overlay h2 { font-size: 2.5rem; }
    
    /* Ajustes botones movil */
    .mobile-controls-layer {
        padding: 0 10px; /* Más cerca de los bordes si la pantalla es muy pequeña */
    }
    .control-pad {
        width: 70px; height: 70px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .orbit-ring, .planet-inner, .avatar-glow { animation: none; }
    .profile-card, .link-item, .view-wrapper { transition: none; }
    body::before { animation: none; }
}