/* --- RESET BÁSICO --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: #000;
    font-family: 'Share Tech Mono', monospace; 
    overflow: hidden; 
    height: 100vh; width: 100%;
    display: flex; justify-content: center; align-items: center;
    transition: background-color 2s ease;
}

.hidden { display: none !important; }

/* SEGURIDAD */
#stage-1-security {
    position: relative; z-index: 1000;
    height: 100vh; width: 100%;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center; text-align: center;
}
.content-box { position: relative; z-index: 1001; color: white; }
h1.blink { color: red; font-size: 3rem; text-shadow: 0 0 10px red; animation: blinker 1s infinite; }
@keyframes blinker { 50% { opacity: 0; } }
.lock-text { color: #4CAF50; font-size: 1.2rem; margin: 20px 0; }
.question { color: #0f0; font-size: 1.5rem; margin-bottom: 30px; }

.buttons { position: relative; z-index: 1002; }
button {
    padding: 15px 25px; font-family: 'Courier Prime', monospace;
    font-weight: bold; border: 2px solid white; cursor: pointer;
    background: black; color: white; margin: 10px; box-shadow: 4px 4px 0 white;
}
button:hover { background: white; color: black; transform: translate(2px, 2px); box-shadow: 2px 2px 0 grey; }
#matrixCanvas { position: fixed; top: 0; left: 0; z-index: 0; opacity: 0; pointer-events: none; }

/* --- TRANSICIÓN DE BIENVENIDA (NUBES Y ARCOÍRIS) --- */
#transition-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    z-index: 9999;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    color: white; overflow: hidden;
}

.welcome-text {
    font-family: 'Pacifico', cursive;
    font-size: 3.5rem; color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    text-align: center; z-index: 10;
    animation: fadeIn 2s ease-in; margin: 0 20px;
}

.clouds-container {
    position: absolute; width: 100%; height: 100%; top: 0; left: 0; pointer-events: none;
}
.cloud, .rainbow {
    position: absolute; opacity: 0.8; bottom: -150px;
    animation: riseUp 4s linear infinite;
}
.cloud { font-size: 5rem; }
.rainbow { font-size: 4rem; }

/* Posiciones aleatorias para nubes y arcoíris */
.cloud:nth-child(1) { left: 10%; animation-duration: 5s; }
.cloud:nth-child(2) { left: 30%; animation-duration: 6s; animation-delay: 1s; }
.cloud:nth-child(3) { left: 80%; animation-duration: 4s; }

.rainbow:nth-child(4) { left: 20%; animation-duration: 5s; animation-delay: 0.5s; }
.rainbow:nth-child(5) { left: 50%; animation-duration: 4.5s; animation-delay: 1.5s; }
.rainbow:nth-child(6) { left: 70%; animation-duration: 6s; animation-delay: 0.2s; }
.rainbow:nth-child(7) { left: 90%; animation-duration: 5.5s; animation-delay: 1s; }

@keyframes riseUp {
    0% { transform: translateY(0); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateY(-120vh); opacity: 0; }
}

.loading-bar { width: 200px; height: 6px; background: rgba(255,255,255,0.5); margin-top: 30px; border-radius: 10px; z-index: 10; }
.loading-progress { width: 0%; height: 100%; background: #fff; border-radius: 10px; animation: loadBar 3s linear forwards; }
@keyframes loadBar { to { width: 100%; } }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* MODO ROMÁNTICO */
body.romance-mode {
    background-color: #FFC0CB; color: black;
    overflow-y: auto !important; height: auto !important;
    min-height: 100vh; display: block; padding: 20px;
}
.stage-container {
    width: 100%; max-width: 800px; margin: 0 auto;
    display: flex; flex-direction: column; align-items: center;
    padding-bottom: 50px; position: relative; z-index: 10;
}
.romance-title {
    font-family: 'Courier Prime', monospace; font-weight: 700; font-size: 2.5rem;
    color: red; text-shadow: 0 0 10px rgba(255,0,0,0.3);
    margin: 30px 0; text-align: center; text-transform: uppercase;
}

/* CORAZONES DE FONDO ETERNOS (Detrás de todo) */
.floating-heart {
    position: fixed; bottom: -50px; 
    z-index: -1; /* Importante: Detrás del texto */
    pointer-events: none;
    font-size: 2rem; opacity: 0.4; 
    animation: floatUp 8s linear infinite;
}
@keyframes floatUp { 0% { transform: translateY(0) rotate(0deg); opacity: 0.6; } 100% { transform: translateY(-110vh) rotate(360deg); opacity: 0; } }

/* FOTOS */
#timeline-box { width: 100%; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
#timeline-img {
    width: 100%; max-width: 500px; height: auto;
    border: 10px solid white; border-bottom: 40px solid white;
    box-shadow: 5px 5px 10px rgba(0,0,0,0.2); margin-bottom: 25px; object-fit: cover;
}
.timeline-caption {
    width: 100%; max-width: 500px; text-align: left;
    background: rgba(255,255,255,0.6); padding: 15px; border: 1px dashed black; font-family: 'Courier Prime', monospace;
}
#timeline-date { font-weight: bold; font-size: 1.4rem; border-bottom: 2px solid red; display: inline-block; }

/* JUEGO */
#game-intro {
    background: white; border: 2px solid black; padding: 20px;
    text-align: center; max-width: 500px;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.2);
    font-family: 'Courier Prime', monospace;
}
#game-area {
    width: 100%; max-width: 600px; height: 400px;
    background: rgba(255, 255, 255, 0.4);
    border: 3px solid black; position: relative; overflow: hidden;
    margin: 10px auto; border-radius: 10px; cursor: none; touch-action: none;
}
#collector-box { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 4rem; z-index: 20; pointer-events: none; }
.game-target-heart {
    position: absolute; font-size: 2.5rem; top: -50px; cursor: pointer;
    user-select: none; z-index: 10; filter: drop-shadow(0 0 2px white);
    animation: fallDown 2.5s linear forwards;
}
.heart-caught { transition: 0.2s; transform: scale(0); opacity: 0; }
@keyframes fallDown { to { top: 420px; } }

/* CARTA */
#envelope-closed {
    width: 280px; height: 180px; background-color: #ff4d4d;
    border: 2px solid black; display: flex; justify-content: center; align-items: center;
    cursor: pointer; box-shadow: 5px 5px 0 rgba(0,0,0,0.2); margin: 20px auto; position: relative;
}
#paper-opened {
    background-color: #fff; width: 100%; max-width: 650px;
    padding: 30px; border: 1px solid black;
    box-shadow: 10px 10px 0 rgba(0,0,0,0.1);
    font-family: 'Courier Prime', monospace; font-size: 1.1rem;
    line-height: 1.6; text-align: left; white-space: pre-wrap;
    display: flex; flex-direction: column; align-items: center;
}
.typing-cursor::after { content: '❤️'; animation: blink 1s infinite; margin-left: 5px; }

#btn-finish { margin-top: 30px; background-color: #ff1493; border: 2px solid black; color: white; font-size: 1.2rem; }

/* FINAL */
#final-page {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    text-align: center;
}
.final-content {
    background: white; padding: 40px; border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); border: 4px solid white;
    max-width: 90%;
}
.final-content h1 { font-family: 'Indie Flower', cursive; color: #ff1493; font-size: 3.5rem; margin-bottom: 20px; }
.final-content p { font-family: 'Indie Flower', cursive; font-size: 1.5rem; margin-bottom: 15px; font-weight: bold; color: #555; }
.big-emoji { font-size: 4rem; margin: 20px 0; }