/* ---------- Noche con estrellas ---------- */

body {
    font-family: Arial, sans-serif;
    text-align: center;
    color: #e8eaff;
    min-height: 100vh;
    margin: 0;
    padding: 100px 15px 40px;
    box-sizing: border-box;
    background:
        radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent),
        radial-gradient(1px 1px at 80px 90px, #fff, transparent),
        radial-gradient(1.5px 1.5px at 140px 50px, #dfe6ff, transparent),
        radial-gradient(1px 1px at 190px 150px, #fff, transparent),
        radial-gradient(1px 1px at 50px 170px, #fff, transparent),
        radial-gradient(2px 2px at 120px 120px, #fffbe0, transparent),
        linear-gradient(#050818, #101a3d 60%, #1d2a5c);
    background-size:
        220px 220px, 220px 220px, 220px 220px,
        220px 220px, 220px 220px, 220px 220px,
        100% 100%;
    background-attachment: fixed;
}

/* Estrellas que titilan */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(2px 2px at 60px 40px, #fff, transparent),
        radial-gradient(2px 2px at 170px 110px, #fff, transparent),
        radial-gradient(1.5px 1.5px at 110px 190px, #fff, transparent);
    background-size: 250px 250px;
    animation: titilar 3s ease-in-out infinite alternate;
}

@keyframes titilar {
    from { opacity: 0.15; }
    to   { opacity: 1; }
}

.contenedor {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: auto;
    padding: 30px;
    border-radius: 10px;
    background: rgba(14, 20, 50, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 40px rgba(120, 140, 255, 0.15);
}

h1 {
    text-shadow: 0 0 12px rgba(180, 190, 255, 0.5);
}

/* ---------- Luna ---------- */

.luna {
    position: absolute;
    top: -62px;
    right: 28px;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fffef0, #f4efc8 60%, #e3dca8);
    box-shadow:
        0 0 25px 8px rgba(255, 250, 210, 0.45),
        0 0 80px 25px rgba(255, 250, 210, 0.2);
}

.luna::before,
.luna::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(160, 150, 100, 0.35);
}

.luna::before {
    width: 16px;
    height: 16px;
    top: 20px;
    left: 48px;
}

.luna::after {
    width: 11px;
    height: 11px;
    top: 48px;
    left: 24px;
    box-shadow: 30px 12px 0 2px rgba(160, 150, 100, 0.3);
}

/* ---------- Textos y botones ---------- */

.consigna {
    color: #aab3e6;
    font-size: 0.95em;
}

.estadisticas p {
    display: inline-block;
    margin: 4px 10px;
    font-weight: bold;
    color: #b9c1f5;
}

button {
    margin-top: 15px;
    padding: 10px 20px;
    cursor: pointer;
    color: #fff;
    background: #2b3470;
    border: 1px solid #5662b8;
    border-radius: 6px;
}

button:hover:not(:disabled) {
    background: #3a4691;
}

#mensaje {
    min-height: 3em;
    margin-top: 15px;
    font-weight: bold;
}

/* ---------- Hotel ---------- */

#hotel {
    max-width: 420px;
    margin: 25px auto 0;
}

.techo {
    padding: 10px;
    background: #2a1f3d;
    border: 3px solid #3a2d52;
    border-radius: 10px 10px 0 0;
    color: #ff7ad9;
    font-weight: bold;
    letter-spacing: 3px;
    text-shadow: 0 0 8px #ff4fc8, 0 0 18px #ff4fc8;
}

.piso {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: #161a33;
    border: 3px solid #3a3f66;
    border-top: none;
}

.piso:last-child {
    border-radius: 0 0 6px 6px;
}

.numero {
    width: 34px;
    text-align: right;
    font-size: 0.8em;
    font-weight: bold;
    color: #9aa3d8;
}

.ventanas {
    display: flex;
    flex: 1;
    justify-content: center;
    gap: 12px;
}

.ventana {
    width: 38px;
    height: 22px;
    line-height: 22px;
    font-size: 14px;
    border-radius: 3px;
    background: #0b0e20;
    border: 2px solid #2d3359;
}

/* Pisos ya superados: ventanas encendidas con su cabra */
.superado .ventana {
    background: #ffd966;
    border-color: #b8962e;
    box-shadow: 0 0 10px rgba(255, 217, 102, 0.6);
}

/* Piso actual */
.piso.activo {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 10px 14px;
    background: #201a3f;
    border-color: #ffd966;
    box-shadow: 0 0 20px rgba(255, 217, 102, 0.35);
}

.etiqueta {
    font-size: 0.85em;
    font-weight: bold;
    color: #ffd966;
}

.formula {
    margin: 6px 0 12px;
    font-family: "Courier New", monospace;
    font-size: 1.5em;
    font-weight: bold;
    color: #8affc1;
    text-shadow: 0 0 8px rgba(138, 255, 193, 0.5);
}

/* ---------- Puertas ---------- */

.puertas {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.puerta {
    position: relative;
    flex: 1 1 0;
    max-width: 78px;
    aspect-ratio: 0.7;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(#8b5a2b, #6b4423);
    border: 3px solid #3d2812;
    border-radius: 40px 40px 0 0;
}

.puerta::after {
    content: "";
    position: absolute;
    right: 9px;
    top: 62%;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #f5c542;
}

.puerta:hover:not(:disabled) {
    background: linear-gradient(#a0693a, #7d5230);
    transform: translateY(-2px);
}

.puerta:disabled {
    cursor: default;
}

.placa {
    margin-top: 22%;
    padding: 3px 7px;
    background: #1b1b1b;
    border: 1px solid #c9a24d;
    border-radius: 4px;
    color: #ffe9a8;
    font-weight: bold;
    font-size: 1.05em;
}

.dentro {
    display: none;
    margin-top: 6px;
    font-size: 2em;
    line-height: 1;
}

.puerta.abierta {
    background: radial-gradient(#3b2f55, #120d1f);
}

.puerta.abierta::after {
    display: none;
}

.puerta.abierta .placa {
    margin-top: 12%;
}

.puerta.abierta .dentro {
    display: block;
}

.puerta.acierto {
    border-color: #2ecc71;
    box-shadow: 0 0 18px #2ecc71;
}

.puerta.fallo {
    border-color: #e74c3c;
    box-shadow: 0 0 14px #e74c3c;
}

@media (max-width: 480px) {
    .contenedor {
        padding: 22px 14px;
    }
}
