/* =========================================================
   ESTILOS GENERALES
   ========================================================= */
body { text-align: center; padding: 0; border: 0; margin: 0; background-color: #05080f; overflow: hidden; color: white; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

/* Estilo Ranking */
#iframe-ranking {
    position: absolute; z-index: 1001; border: none; display: none; background: transparent;
    opacity: 0; transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#iframe-ranking.show-ranking {
    opacity: 1;
}

/* RESPONSIVO: PC (A la izquierda) */
@media (min-width: 768px) {
    #iframe-ranking { top: 20px; left: 20px; width: 300px; height: calc(100vh - 40px); transform: translateX(-50px); }
    #iframe-ranking.show-ranking { transform: translateX(0); }
}
/* RESPONSIVO: MÓVIL (Al centro) */
@media (max-width: 767px) {
    #iframe-ranking { top: 50%; left: 50%; width: 85%; height: 70vh; transform: translate(-50%, -40%); }
    #iframe-ranking.show-ranking { transform: translate(-50%, -50%); }
}

/* =========================================================
   CONTENEDOR MAESTRO PC (Telefono Virtual 9:16)
   ========================================================= */
#game-wrapper {
    position: absolute; 
    top: 50%; left: 50%; 
    transform: translate(-50%, -50%);
    width: 100vw; height: 100vh;
    max-width: 540px; 
    max-height: 960px; 
    background: #000;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
}

/* =========================================================
   ESTILOS DEL LOBBY E INSTRUCCIONES
   ========================================================= */
#lobby-container {
  position: absolute; 
  top: 0; left: 0; 
  width: 100%; height: 100%; 
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: radial-gradient(circle at center, #1a2a6c, #112b3c, #0b101e);
  z-index: 20; padding: 20px; box-sizing: border-box;
}

/* =========================================================
   ANIMACIÓN DE LOGOS (FADER LOOP)
   ========================================================= */
.logos-fader {
    position: relative;
    width: 270px;
    height: 180px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-animado {
    position: absolute;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    filter: drop-shadow(0 0 10px rgba(0,242,254,0.3));
    object-fit: contain;
    
    /* Replicando: (2s visible + 1s fade + 2s oculta + 1s fade) = 6s total */
    animation-duration: 6s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
}

/* Asignamos la animación correspondiente a cada logo */
.logo-1 { animation-name: fadeLogo1; }
.logo-2 { animation-name: fadeLogo2; }

/* Bucle: Logo 1 */
@keyframes fadeLogo1 {
    0%, 33.33% { opacity: 1; }   /* Visible 2 segundos */
    50%, 83.33% { opacity: 0; }  /* Transición a 0 y se queda 2s oculto */
    100% { opacity: 1; }         /* Transición de regreso a 1 */
}

/* Bucle: Logo 2 (invertido) */
@keyframes fadeLogo2 {
    0%, 33.33% { opacity: 0; }   /* Oculto 2 segundos */
    50%, 83.33% { opacity: 1; }  /* Transición a 1 y se queda 2s visible */
    100% { opacity: 0; }         /* Transición de regreso a 0 */
}

/* Responsivo para móviles */
@media (max-width: 480px) {
    .logos-fader { 
        width: 220px; 
        height: 140px; 
    }
}

#instructions-panel {
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px; padding: 20px; width: 85%; max-width: 350px;
    margin-bottom: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    box-sizing: border-box;
}

#instructions-title { font-size: 18px; font-weight: bold; color: #00f2fe; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px;}

/* =========================================================
   INSTRUCCIONES Y CONTROLES (Cajas Expandibles)
   ========================================================= */
.controls-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 10px; 
    margin-bottom: 20px; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
    padding-bottom: 20px; 
    align-items: start;
}

.control-box { 
    background: rgba(0,0,0,0.4); 
    border: 1px solid rgba(0, 242, 254, 0.2);
    border-radius: 8px; 
    font-size: 11px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.control-header {
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.control-box:hover { transform: translateY(-2px); border-color: rgba(0, 242, 254, 0.6); }
.control-header b { color: #00f2fe; display: block; font-size: 13px; margin-bottom: 3px; letter-spacing: 0.5px; }
.control-header span { color: #a8c0ff; font-weight: 500; margin-bottom: 5px; }
.control-icon { width: 35px; height: 35px; object-fit: contain; margin-bottom: 8px; }

.expand-icon { transition: transform 0.3s ease; opacity: 0.7; }
.control-box.expanded .expand-icon { transform: rotate(180deg); opacity: 1; stroke: #fff; }
.control-box.expanded { background: rgba(0, 242, 254, 0.1); border-color: rgba(0, 242, 254, 0.8); }

.control-details {
    max-height: 0;
    opacity: 0;
    width: 100%;
    padding: 0 10px;
    box-sizing: border-box;
    text-align: center;
    color: #fff;
    font-size: 11px;
    line-height: 1.3;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.control-box.expanded .control-details {
    max-height: 150px; 
    opacity: 1;
    padding: 0 10px 10px 10px;
}
.instruction-item { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    margin-bottom: 12px; 
    text-align: left; 
    font-size: 13px; 
    line-height: 1.4; 
    color: #ffffff;
    background: rgba(0,0,0,0.2); 
    padding: 10px;
    border-radius: 10px;
}
.instruction-item b { color: #4facfe; }

.instruction-icon { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 0 3px rgba(0,0,0,0.5)); }
#queue-status { font-size: 15px; color: #a8c0ff; font-weight: 600; margin-bottom: 12px; height: 20px; }

#loading-bar-bg { width: 80%; max-width: 300px; height: 12px; background-color: rgba(255, 255, 255, 0.15); border-radius: 10px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1); margin: 0 auto; }
#loading-bar-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #00f2fe 0%, #4facfe 100%); border-radius: 10px; transition: width 0.15s ease-out; box-shadow: 0 0 10px rgba(0, 242, 254, 0.5); }
#loading-percentage { font-size: 14px; margin-top: 8px; font-weight: bold; opacity: 0.8; }

#time-remaining { font-size: 12px; color: #a8c0ff; margin-top: 5px; font-weight: normal; min-height: 15px; }

#enter-btn {
    display: none; padding: 16px 40px; font-size: 18px; font-weight: 900;
    background: transparent; color: #00f2fe; border: 2px solid #00f2fe; 
    border-radius: 30px; cursor: pointer; text-transform: uppercase;
    animation: pulse 2s infinite; width: 80%; max-width: 300px; margin: 15px auto 0 auto;
    letter-spacing: 1px;
}
#enter-btn:hover, #enter-btn:active {
    background: #00f2fe; color: #05080f; box-shadow: 0 0 20px rgba(0, 242, 254, 0.6);
}
@keyframes pulse { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.4); } 50% { transform: scale(1.05); box-shadow: 0 0 15px 5px rgba(0, 242, 254, 0.2); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 242, 254, 0); } }

/* =========================================================
   ESTILOS DE ADVERTENCIAS Y BLOQUEOS
   ========================================================= */
.overlay-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 8, 15, 0.95); z-index: 100;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 20px; box-sizing: border-box; backdrop-filter: blur(10px);
}
.warning-box {
    background: rgba(255, 255, 255, 0.05); border: 1px solid #555;
    border-radius: 15px; padding: 25px; width: 85%; max-width: 350px; text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8); box-sizing: border-box;
}
.warning-title { font-size: 20px; font-weight: 900; margin-bottom: 15px; }
.warning-text { color: #fff; font-size: 15px; margin-bottom: 25px; opacity: 0.9; line-height: 1.4; }
.warning-btn {
    background: transparent; color: #fff; border: 1px solid #fff; padding: 12px 25px;
    border-radius: 20px; font-weight: 900; cursor: pointer; text-transform: uppercase;
    width: 100%; transition: all 0.3s;
}
.warning-btn:active { background: #fff; color: #000; }

/* =========================================================
   ESTILOS DEL CUADRO DE ERROR (NEON CYAN)
   ========================================================= */
@keyframes pulse-border-cyan {
    0% { box-shadow: 0 0 20px rgba(0, 242, 254, 0.5), inset 0 0 20px rgba(0, 242, 254, 0.2); }
    100% { box-shadow: 0 0 40px rgba(0, 242, 254, 0.8), inset 0 0 40px rgba(0, 242, 254, 0.4); }
}
.btn-neon {
    background: transparent; color: #00f2fe; border: 2px solid #00f2fe;
    padding: 10px 25px; font-size: 16px; font-weight: bold; border-radius: 8px;
    cursor: pointer; margin-top: 15px; text-transform: uppercase;
    transition: all 0.3s ease; box-shadow: 0 0 10px rgba(0, 242, 254, 0.3); width: 100%;
}
.btn-neon:hover, .btn-neon:active { background: #00f2fe; color: #000; box-shadow: 0 0 20px rgba(0, 242, 254, 0.8); }

/* =========================================================
   ESTILOS DEL CANVAS
   ========================================================= */
#unity-canvas { 
    display: block; 
    z-index: 1;
    background: #000000;
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

/* =========================================================
   FONDOS ADAPTATIVOS
   ========================================================= */
#background-blur {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: url('../TemplateData/bg.jpg') no-repeat center center fixed;
    background-size: cover;
    filter: blur(20px) brightness(0.3);
    z-index: -1;
}

/* MEDIA QUERIES (Móviles) */
@media screen and (max-width: 600px) {
    #game-wrapper { width: 100vw; height: 100vh; max-width: none; max-height: none; transform: none; top: 0; left: 0; box-shadow: none; }
    #background-blur { display: none; } 
}