/* FUENTES INCRUSTADAS */
@font-face {
    font-family: 'FredokaCustom';
    src: url('https://fonts.gstatic.com/s/fredoka/v14/4iCv6KVjbNBYlgoCxCvjvmyNPYZvg7UI.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'FredokaCustom';
    src: url('https://fonts.gstatic.com/s/fredoka/v14/4iCv6KVjbNBYlgoCxCvjsGyNPYZvg7UI.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    --ac-dark-yellow: #f7e652;
    --ac-orange: #ff9d4d;
    --ac-text: #8b7355;
    --fire-red: #ff5f5f;
    --fire-orange: #ffad5a;

    /* Colores Misiones según captura */
    --m1-color: #ff9ca8;
    /* Rosa pastel */
    --m2-color: #ffb48f;
    /* Naranja/Melocoton */
    --m3-color: #ffd485;
    /* Naranja/Amarillo */
    --m4-color: #f7eb81;
    /* Amarillo Claro */
    --m5-color: #aee8a0;
    /* Verde Claro */
    --m6-color: #9cbfee;
    /* Azul Claro */
}

* {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'FredokaCustom', sans-serif;
    height: 100vh;
    width: 100vw;
}

.hidden {
    display: none !important;
}

/* 🚀 INTRO SCREEN */
#intro-screen {
    position: fixed;
    inset: 0;
    background: #1a2a44;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#rocket-container {
    position: relative;
    cursor: pointer;
    text-align: center;
    z-index: 100;
    transition: transform 3s ease-in-out;
}

#rocket img {
    width: 120px;
    height: auto;
    display: block;
    filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.2));
    position: relative;
    z-index: 102;
}

#moon-surface {
    position: absolute;
    top: 63%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    z-index: 50;
    transition: transform 2.5s ease-in-out, opacity 2.5s;
    pointer-events: none;
    opacity: 1;
}

.bubble {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1.1rem;
    width: 130px;
    box-shadow: 0 6px 0 #e0e0e0;
    border: 3px solid #f0f0f0;
    color: var(--ac-text);
    z-index: 110;
}

#rocket-fire {
    position: absolute;
    top: 85%;
    left: 50%;
    transform: translateX(-50%) scaleY(-1) scale(0.8);
    width: 100px;
    opacity: 0;
    transition: opacity 0.3s ease-in, transform 3s ease-in-out;
    z-index: 101;
}

#fire-trail {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 0;
    display: flex;
    flex-direction: column;
    transition: height 1.5s ease-out;
    z-index: 10;
}

.trail-red {
    background: var(--fire-red);
    flex: 1;
}

.trail-orange {
    background: var(--fire-orange);
    flex: 1;
}

.trail-yellow {
    background: var(--ac-dark-yellow);
    flex: 10;
}

/* 🌟 MAIN MENU */
#main-menu {
    position: absolute;
    inset: 0;
    background-color: var(--ac-dark-yellow);
    overflow: hidden;
    z-index: 500;
}

.bg-dots {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: radial-gradient(rgba(200, 200, 100, 0.4) 10px, transparent 10px);
    background-size: 60px 60px;
    animation: rotateBg 100s linear infinite;
    z-index: 1;
}

@keyframes rotateBg {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.menu-container {
    position: relative;
    z-index: 2;
    display: flex;
    height: 100vh;
    padding: 40px;
}

/* LISTA DE MISIONES LATERAL */
.mission-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 200px;
    margin-right: 40px;
    z-index: 3;
    /* Para que queden por encima del bg-dots */
}

/* BOTONES ESTILO READYMAG */
.mission-btn {
    padding: 6px 15px;
    /* Reducido para contrarestar la fuente y que sigan del mismo tamaño */
    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2);
    border: 3px solid white;
    color: white;
    font-size: 30px;
    letter-spacing: 2.5px;
    font-weight: 600;
    font-family: 'Pangolin', cursive;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s, filter 0.2s;
}

.mission-btn:hover {
    filter: brightness(1.05);
    transform: scale(1.02);
}

.mission-btn:active {
    transform: scale(0.98);
}

.mission-btn.locked {
    filter: grayscale(100%) opacity(0.6);
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

/* AREA DE CONTENIDO (DERECHA) */
.content-area {
    flex-grow: 1;
    background: rgba(12, 28, 56, 0.65);
    /* Azul oscuro espacial semitransparente */
    border: 4px dashed rgba(150, 180, 255, 0.5);
    /* Variante de borde azulada-clara */
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    z-index: 3;
    padding: 20px;
    position: relative;
}

#welcome-text {
    color: white;
    /* Cambiado de marrón a blanco para que destaque en el fondo espacial azul */
    font-size: 3rem;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    /* Sombra oscura para leerse impecable sobre lo azul */
    font-weight: 600;
}

/* --- MINIJUEGO 1 --- */
#solar-game-root {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.game-container-rs {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    width: 100%;
    height: 100%;
    padding: 20px;
    transition: filter 0.4s ease;
    overflow-y: auto;
}

.blurred-rs {
    filter: blur(8px);
    pointer-events: none;
    opacity: 0.6;
}

.score-capsule-rs {
    background: #ff9d4d;
    color: white;
    padding: 12px 35px;
    border-radius: 50px;
    font-size: 1.8rem;
    box-shadow: 0 4px 0 #d67a2e;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    margin-bottom: 5px;
}

.dialog-box-rs {
    background: white;
    border-radius: 20px;
    padding: 25px;
    border: 4px solid #f0f0f0;
    width: 95%;
    max-width: 600px;
    text-align: center;
    margin-bottom: 10px;
    color: #333;
}

.dialog-box-rs h2 {
    margin: 5px 0;
    font-size: 2rem;
}

.dialog-box-rs p {
    margin: 5px 0;
    font-size: 1.2rem;
}

.final-overlay-rs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.final-box-rs {
    width: 85%;
    max-width: 380px;
    padding: 35px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    transform: translateY(-200px);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    from {
        transform: translateY(-50px) scale(0.8);
        opacity: 0;
    }

    to {
        transform: translateY(-30px) scale(1);
        opacity: 1;
    }
}

.box-error-rs {
    background-color: #ffcccc;
    color: #a83232;
    border: 5px solid white;
}

.box-success-rs {
    background-color: #ccffcc;
    color: #2e7d32;
    border: 5px solid white;
}

.btn-final-rs {
    margin-top: 25px;
    padding: 15px 35px;
    border-radius: 50px;
    border: none;
    font-family: 'FredokaCustom', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    color: white;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
}

.btn-red-rs {
    background-color: #ff5e5e;
}

.btn-green-rs {
    background-color: #4cd137;
}

.slots-container-rs {
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.2);
    padding: 35px 45px;
    border-radius: 120px;
    margin-bottom: 15px;
    border: 2px solid white;
    overflow-x: auto;
    max-width: 98%;
    align-items: center;
}

.slot-wrapper-rs {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.planet-slot-rs {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s;
}

.planet-slot-rs.hovered {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.slot-name-rs {
    color: white;
    font-size: 15px;
    margin-top: 10px;
    opacity: 0;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.filled-rs .slot-name-rs {
    opacity: 1;
}

.inventory-rs {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 15px;
}

.inv-item-rs {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: grab;
    transition: transform 0.2s;
}

.inv-item-rs:hover {
    transform: scale(1.1);
}

.planet-img-rs {
    width: 90px;
    height: 90px;
    object-fit: contain;
    user-select: none;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

.planet-label-rs {
    color: white;
    font-weight: 800;
    font-size: 18px;
    margin-top: 8px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.planet-slot-rs img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: none;
    pointer-events: none;
}

/* --- MINIJUEGO 2 --- */
#typing-game-root {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.game-container-mg2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    width: 100%;
    height: 100%;
    padding: 20px;
    transition: filter 0.4s ease;
}

.planet-display-mg2 {
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.planet-img-mg2 {
    width: 180px;
    height: 180px;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(92, 201, 245, 0.4));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.word-container-mg2 {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 15px;
    border-radius: 20px;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.letter-slot {
    width: 55px;
    height: 65px;
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 800;
    text-transform: uppercase;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
}

.letter-slot.filled {
    border-color: #5cc9f5;
    background: rgba(92, 201, 245, 0.3);
}

.error-shake {
    animation: shake 0.4s;
    background: rgba(255, 94, 94, 0.2) !important;
    border-color: #ff5e5e !important;
}

.success-glow {
    background: rgba(76, 209, 55, 0.2) !important;
    border-color: #4cd137 !important;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.floating-points {
    position: absolute;
    font-weight: 800;
    font-size: 3rem;
    pointer-events: none;
    z-index: 100;
    animation: floatUp 0.8s forwards;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
}

@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-80px);
        opacity: 0;
    }
}

.instruction-mg2 {
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0.9;
    margin-top: 15px;
    text-align: center;
    line-height: 1.5;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* --- MINIJUEGO 3 --- */
#trivia-game-root {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.game-container-mg3 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    width: 100%;
    height: 100%;
    padding: 20px;
    transition: filter 0.4s ease;
}

#mg3-question-text {
    font-size: 2.2rem;
    font-weight: 800;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    margin: 15px 0;
}

.options-container-mg3 {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 800px;
}

.mg3-option-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.6);
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.mg3-option-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-5px);
    border-color: #f7e652;
}

#mg3-question-container {
    height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Animations and symbols */
.mg3-symbol {
    font-size: 8rem;
    line-height: 1;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
}

.sun-symbol {
    text-shadow: 0 0 40px rgba(243, 156, 18, 0.8);
    filter: drop-shadow(0 0 20px rgba(243, 156, 18, 0.6));
}

.earth-symbol {
    text-shadow: 0 0 40px rgba(52, 152, 219, 0.8);
    filter: drop-shadow(0 0 20px rgba(52, 152, 219, 0.6));
}

.moon-symbol {
    text-shadow: 0 0 40px rgba(189, 195, 199, 0.8);
    filter: drop-shadow(0 0 20px rgba(189, 195, 199, 0.6));
}

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

.orbit-center {
    font-size: 7rem;
    z-index: 2;
    position: relative;
}

.orbit-path {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 3px dashed rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: rotatePath 5s linear infinite;
}

.orbit-orbiter {
    position: absolute;
    top: -40px;
    /* Center top */
    left: 50%;
    transform: translateX(-50%);
    font-size: 4.5rem;
    /* Reverse rotation so the emoji doesn't spin upside down */
    animation: rotatePathReverse 5s linear infinite;
}

@keyframes rotatePath {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes rotatePathReverse {
    0% {
        transform: translateX(-50%) rotate(0deg);
    }

    100% {
        transform: translateX(-50%) rotate(-360deg);
    }
}

/* Feedback Animations */
.mg3-flash-correct {
    animation: flashCorrect 0.6s ease-out;
}

.mg3-flash-error {
    animation: flashError 0.6s ease-out;
}

@keyframes flashCorrect {
    0% {
        background: rgba(76, 209, 55, 0.5);
    }

    100% {
        background: transparent;
    }
}

@keyframes flashError {
    0% {
        background: rgba(255, 94, 94, 0.5);
    }

    100% {
        background: transparent;
    }
}

/* --- MINIJUEGO 4 --- */
#distance-game-root {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.game-container-mg4 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding: 30px;
    transition: filter 0.4s ease;
}

.phase-info-mg4 {
    text-align: center;
}

.phase-info-mg4 h2 {
    font-size: 2.2rem;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.phase-info-mg4 p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.distance-counter-mg4 {
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid #f7e652;
    padding: 10px 40px;
    border-radius: 15px;
    font-size: 2.5rem;
    font-weight: 800;
    color: #f7e652;
    text-shadow: 0 0 10px rgba(247, 230, 82, 0.5);
    margin: 20px 0;
}

.game-field-mg4 {
    width: 100%;
    height: 250px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 30px;
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 50px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
}

.earth-anchor-mg4 {
    position: absolute;
    left: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

.earth-anchor-mg4 img {
    width: 110px;
    height: 110px;
    filter: drop-shadow(0 0 20px rgba(52, 152, 219, 0.4));
}

.earth-anchor-mg4 span {
    margin-top: 10px;
    font-weight: 700;
    font-size: 1.2rem;
}

.draggable-target-mg4 {
    position: absolute;
    left: 200px;
    /* Initial position */
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: grab;
    z-index: 10;
    user-select: none;
    transition: transform 0.1s ease;
}

.draggable-target-mg4:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.draggable-target-mg4 img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.3));
}

.draggable-target-mg4 span {
    margin-top: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 10px;
    border-radius: 10px;
}

/* --- MINIJUEGO 5: PUZLE --- */
#puzzle-game-root {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    position: relative;
}

.game-container-mg5 {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 20px;
}

.puzzle-board-mg5 {
    width: 400px;
    height: 320px;
    background: rgba(255, 255, 255, 0.05);
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
    box-sizing: content-box;

    /* Rejilla visual mediante background */
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.15) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.15) 2px, transparent 2px);
    background-size: 80px 80px;
    background-position: -1px -1px;
}

.puzzle-board-mg5::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/b/b2/Earth_from_space_%287628218100%29.jpg?utm_source=commons.wikimedia.org&utm_campaign=index&utm_content=original');
    background-size: cover;
    opacity: 0.1;
    pointer-events: none;
    border-radius: inherit;
}

.puzzle-layout-mg5 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    flex: 1;
}

.puzzle-side-container {
    width: 220px;
    height: 480px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-content: flex-start;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    overflow-y: auto;
}

.puzzle-piece {
    width: 80px;
    height: 80px;
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/b/b2/Earth_from_space_%287628218100%29.jpg?utm_source=commons.wikimedia.org&utm_campaign=index&utm_content=original');
    background-size: 400px 320px;
    cursor: grab;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    position: relative;
    user-select: none;
    touch-action: none;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.puzzle-piece:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
}

.puzzle-piece.placed {
    position: absolute;
    cursor: default;
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    transform: none !important;
    box-shadow: none !important;
    z-index: 1;
}

.puzzle-piece.dragging {
    z-index: 1000;
    cursor: grabbing;
    transform: scale(1.2) !important;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
    transition: transform 0.1s ease;
}