/* Red hover effect for WHO IS CUBE? button */
.cube-name-who:hover {
    box-shadow: 0 0 24px 6px #ff0033, 0 0 8px 2px #ff0033;
    border-color: #ff0033;
    color: #ff0033;
    transition: box-shadow 0.2s, border-color 0.2s, color 0.2s;
}
/* MOA modal custom size and scrollbar */
.moa-modal-card {
    width: 80vw !important;
    max-width: 900px !important;
    min-height: 300px !important;
    height: 420px !important;
    padding: 3rem 2.5rem !important;
    overflow-y: auto !important;
}
.moa-modal-card::-webkit-scrollbar {
    width: 8px;
}
.moa-modal-card::-webkit-scrollbar-thumb {
    background: #00e5ff;
    border-radius: 6px;
}
.moa-modal-card::-webkit-scrollbar-track {
    background: #222;
    border-radius: 6px;
}
/* --- Estilos Generales --- */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000000;
    color: white;
    font-family: 'Rajdhani', sans-serif;
}

/* Contenedor del Canvas (Fondo) */
#space-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh; /* mejor ajuste en móviles */
    z-index: 1;
}

/* --- Contenedor de Nombres (UI) --- */
.content-layer {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    min-height: 100dvh; /* ocupar alto completo en móviles */
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    padding: 2rem;
}

.names-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4rem;
    max-width: 1400px;
    width: 100%;
    text-align: center;
    perspective: 1000px;
    pointer-events: auto;
}

/* ESTILO DE LA LETRA */
.cube-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    letter-spacing: 1px;
    text-transform: uppercase;
    -webkit-user-select: none;
    user-select: none;
    min-width: 200px; 
    text-shadow: 0 4px 10px rgba(0,0,0,0.8);
    animation: float 6s ease-in-out infinite;
    display: inline-block;
}

.cube-name:nth-child(1) { animation-delay: 0s; animation-duration: 6s; }
.cube-name:nth-child(2) { animation-delay: 1.2s; animation-duration: 7s; }
.cube-name:nth-child(3) { animation-delay: 0.6s; animation-duration: 6.5s; }
.cube-name:nth-child(4) { animation-delay: 1.8s; animation-duration: 7.2s; }
.cube-name:nth-child(5) { animation-delay: 0.9s; animation-duration: 6.8s; }
.cube-name:nth-child(6) { animation-delay: 2.1s; animation-duration: 7.4s; }
.cube-name:nth-child(7) { animation-delay: 2.6s; animation-duration: 6.2s; }

@keyframes float {
    0% { transform: translateY(0px); }
    25% { transform: translateY(-10px); }
    50% { transform: translateY(-22px); }
    75% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.cube-name:hover {
    color: #ffffff;
    text-shadow: 
        0 0 15px #00e5ff,
        0 0 30px #00e5ff,
        0 0 50px #00e5ff;
    transform: scale(1.1);
    z-index: 20;
}

.geo-font {
    font-family: 'Arial', sans-serif;
    font-weight: 700;
}

/* --- Modal de Información --- */
.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: background 0.5s ease, opacity 0.3s ease;
}

/* Estado activo del contenedor modal */
.info-modal.active {
    opacity: 1;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.modal-card {
    background: rgba(5, 10, 20, 0.95);
    border: 1px solid #00e5ff;
    box-shadow: 0 0 0 rgba(0, 229, 255, 0);
    width: 80%;
    max-width: 600px;
    min-height: 300px;
    padding: 3rem;
    position: relative;
    transform: scale(0);
    border-radius: 4px;
    color: #d1d5db;
    overflow: hidden;
}

/* --- ANIMACIÓN CÓSMICA "SINGULARITY BURST" --- */
@keyframes singularityBurst {
    0% {
        transform: scale(0.01) rotateX(45deg);
        opacity: 0;
        filter: brightness(300%) contrast(200%);
        box-shadow: 0 0 100px 50px rgba(0, 229, 255, 1);
    }
    40% {
        opacity: 1;
        filter: brightness(200%);
    }
    70% {
        transform: scale(1.05) rotateX(0deg);
        filter: brightness(120%);
        box-shadow: 0 0 60px 20px rgba(0, 229, 255, 0.6);
    }
    100% {
        transform: scale(1) rotateX(0deg);
        filter: brightness(100%);
        box-shadow: 0 0 40px rgba(0, 229, 255, 0.2);
    }
}

/* Animación de la línea de escaneo (Holograma) */
@keyframes scanline {
    0% { top: -100%; opacity: 0; }
    50% { opacity: 1; }
    100% { top: 200%; opacity: 0; }
}

.info-modal.active .modal-card {
    animation: singularityBurst 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-scanline {
    position: absolute;
    left: 0;
    top: -100%;
    width: 100%;
    height: 20px;
    background: linear-gradient(to bottom, transparent, rgba(0, 229, 255, 0.5), transparent);
    z-index: 5;
    pointer-events: none;
}

.info-modal.active .modal-scanline {
    animation: scanline 2s ease-in-out infinite;
    animation-delay: 0.4s;
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 2rem;
    color: #00e5ff;
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
    z-index: 10;
    transition: transform 0.3s;
}

.close-btn:hover {
    color: white;
    text-shadow: 0 0 15px white;
    transform: rotate(90deg);
}

.modal-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: #00e5ff;
    margin-bottom: 2rem;
    border-bottom: 2px solid rgba(0, 229, 255, 0.3);
    padding-bottom: 1rem;
    text-transform: uppercase;
    text-shadow: 2px 0 rgba(255,0,0,0.3), -2px 0 rgba(0,0,255,0.3);
}

#modal-content-area {
    font-size: 1.2rem;
    line-height: 1.6;
    min-height: 100px;
    white-space: normal;
}
/* Espaciado y legibilidad del contenido */
#modal-content-area p {
    margin: 0 0 1rem 0;
}
#modal-content-area strong {
    color: #ffd480;
}

/* Lectura con “rayo de sol” en el contenido */
#modal-content-area .content-char {
    display: inline;
    transition: color 0.18s ease, text-shadow 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
    opacity: 0.9;
}

#modal-content-area .content-char.lit {
    color: #fff9e6; /* tono cálido */
    opacity: 1;
    text-shadow: 0 0 10px #ffd480, 0 0 22px #ffea99, 0 0 36px rgba(255,212,128,0.9);
    transform: translateY(-0.5px);
}

/* Overlay para sensación de barrido luminoso */
.modal-card.reading-overlay::before {
    content: "";
    position: absolute;
    top: 0;
    left: -45%;
    width: 45%;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(90deg,
        rgba(0,0,0,0) 0%,
        rgba(255,180,80,0.18) 28%,
        rgba(255,230,160,0.30) 50%,
        rgba(255,180,80,0.18) 72%,
        rgba(0,0,0,0) 100%
    );
    filter: blur(7px);
    mix-blend-mode: screen;
    animation: sweep 6s ease-out forwards;
}
#modal-content-area .content-word {
    display: inline-block;
    margin-right: 0.25ch; /* pequeño espacio visual entre palabras */
    transition: color 0.25s ease, text-shadow 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

#modal-content-area .content-word.lit {
    color: #fff9e6;
    text-shadow: 0 0 10px #ffd480, 0 0 22px #ffea99, 0 0 36px rgba(255,212,128,0.9);
    transform: translateY(-0.5px);
}

@keyframes sweep {
    0% { left: -45%; opacity: 0.0; }
    10% { opacity: 0.7; }
    60% { opacity: 0.6; }
    100% { left: 110%; opacity: 0; }
}

/* Responsividad */
@media (max-width: 900px) {
    .content-layer { padding: 1.25rem; }
    .names-grid { gap: 2rem; }
    .cube-name { font-size: 2.4rem; flex: 1 1 46%; min-width: auto; }
    .modal-card { width: 92vw; max-width: none; padding: 1.75rem; }
}
@media (max-width: 600px) {
    .content-layer { padding: 1rem; }
    .names-grid { gap: 1.25rem; }
    .cube-name { font-size: 1.75rem; flex: 1 1 100%; }
    .modal-card { width: 94vw; padding: 1.25rem; min-height: auto; max-height: 80vh; overflow-y: auto; }
    .modal-title { font-size: 1.8rem; margin-bottom: 1rem; }
    #modal-content-area { font-size: 1rem; }
}

/* Lectura rápida: cada carácter se ilumina y se apaga */
.cube-name .char {
    display: inline-block;
    transition: color 0.2s ease, text-shadow 0.2s ease, opacity 0.2s ease;
    opacity: 0.7;
}

.cube-name .char.lit {
    color: #ffffff;
    opacity: 1;
    text-shadow: 0 0 12px #00e5ff, 0 0 24px #00e5ff, 0 0 36px #00e5ff;
}

/* efecto de apagado sutil después de lectura */
.cube-name.read-complete .char {
    transition: opacity 0.6s ease;
    opacity: 0.85;
    text-shadow: 0 0 6px rgba(0,229,255,0.6);
}