.area-juego-maze {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 10px;
}

.cabecera-maze {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 100%;
    margin-bottom: 20px;
}

.controles-maze {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.mision-maze {
    background: #FFD93D;
    color: #2d3436;
    padding: 10px 20px;
    border-radius: 15px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    border: 3px solid #f1c40f;
    box-shadow: 0 4px 0 #d4ac0d;
}

.stats-maze {
    background: #4ECDC4;
    color: white;
    padding: 10px 20px;
    border-radius: 15px;
    font-family: 'Fredoka One', cursive;
}

/* ============ GRID DEL LABERINTO ============ */
.contenedor-laberinto {
    position: relative;
    background: #2c3e50;
    padding: 10px;
    border-radius: 15px;
    border: 8px solid #34495e;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
}

#grid-laberinto {
    display: grid;
    gap: 0; /* Sin gaps para unir texturas */
    background: #34495e;
}

.celda {
    width: clamp(25px, 4vw, 45px); /* Dinámico por ancho */
    height: clamp(25px, 4vw, 45px);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: background 0.3s;
}

/* ============ AMBIENTES (TEMAS) ============ */
/* 1. BOSQUE (Árboles y Naturaleza) */
.tema-castillo .celda.pared {
    background: #2d6a4f; /* Verde bosque oscuro */
    border: 1px solid #40916c;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.4);
}
.tema-castillo .celda.camino { background: #d8f3dc; } /* Verde muy claro */


/* 2. SELVA (Césped y Setos) */
.tema-selva .celda.pared {
    background: #27ae60;
    border: 1px solid #2ecc71;
    border-radius: 4px;
}
.tema-selva .celda.camino { background: #f1c40f; opacity: 0.3; } /* Tierra */
.tema-selva #grid-laberinto { background: #d4ac0d; }

/* 3. ESPACIO (Neon y Metal) */
.tema-espacio .celda.pared {
    background: #2c3e50;
    border: 1px solid #3498db;
    box-shadow: 0 0 10px #3498db;
}
.tema-espacio .celda.camino { background: #000; }
.tema-espacio #grid-laberinto { background: #1a1a1a; }

.celda.jugador {
    background: #ecf0f1;
    z-index: 10;
}

/* Personaje Estilo Scratch */
.personaje-scratch {
    position: relative;
    width: 28px;
    height: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s;
}

.scratch-head {
    width: 14px;
    height: 14px;
    background: #FFD93D;
    border-radius: 50%;
    border: 2px solid #2d3436;
}

.scratch-body {
    width: 12px;
    height: 14px;
    background: #4ECDC4;
    border-radius: 4px;
    border: 2px solid #2d3436;
    margin-top: -2px;
}

.scratch-legs {
    display: flex;
    justify-content: space-between;
    width: 12px;
    margin-top: -2px;
}

.scratch-leg {
    width: 4px;
    height: 8px;
    background: #2d3436;
    border-radius: 2px;
    transform-origin: top center;
}

/* Animación de Caminar */
.caminando .scratch-leg.l {
    animation: leg-swing 0.2s infinite alternate;
}
.caminando .scratch-leg.r {
    animation: leg-swing 0.2s infinite alternate-reverse;
}

@keyframes leg-swing {
    from { transform: rotate(-25deg); }
    to { transform: rotate(25deg); }
}

.mirar-izquierda {
    transform: scaleX(-1);
}


.celda.item-figura {
    background: #ecf0f1;
    cursor: pointer;
}

.celda.item-figura svg {
    width: 80%;
    height: 80%;
}

.celda.salida {
    background: #ff7675;
}

.celda.salida::after {
    content: "🚪";
}

.celda.salida.abierta {
    background: #55efc4;
}

.celda.salida.abierta::after {
    content: "🌟";
}

/* ============ NIEBLA DE GUERRA ============ */
.celda.con-niebla {
    background: #000 !important;
    color: transparent !important;
    box-shadow: none !important;
    border-color: transparent !important;
}

.celda.con-niebla * {
    display: none !important;
}

/* ============ ENEMIGO ============ */
.celda.enemigo {
    background: #c0392b !important;
    z-index: 15;
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(192, 57, 43, 0); }
    100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

.enemigo-icon {
    font-size: 1.5rem;
}



/* ============ CONTROLES MÓVILES ============ */
.controles-movimiento {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
}

.fila-movimiento {
    display: flex;
    gap: 5px;
}

.btn-move {
    width: 60px;
    height: 60px;
    background: white;
    border: 3px solid #4ECDC4;
    border-radius: 15px;
    font-size: 1.5rem;
    color: #4ECDC4;
    cursor: pointer;
    box-shadow: 0 4px 0 #3ba099;
}

.btn-move:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* ============ OVERLAYS ============ */
.overlay-maze {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.mensaje-victoria {
    background: white;
    padding: 30px;
    border-radius: 25px;
    text-align: center;
    border: 5px solid #FFD93D;
    animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop-in {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
