@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700&display=swap');

:root {
    --bg-color: #f3e5f5;
    --bg-gradient1: #e0c3fc;
    --bg-gradient2: #ffb8d0;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --primary: #ff4757; 
    --primary-hover: #ff6b81;
    --secondary: #1dd1a1;
    --shadow: 0 10px 40px rgba(255, 71, 87, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    background-image: linear-gradient(135deg, var(--bg-gradient1) 0%, var(--bg-gradient2) 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    color: var(--text-main);
    font-weight: normal; /* Fredoka One ya es muy gruesa */
}

h1 { font-size: 6rem; margin-top: 60px; margin-bottom: 40px; line-height: 1.1; letter-spacing: -2px; color: var(--primary); text-shadow: 2px 2px 0px rgba(255,255,255,0.8); }
h2 { font-size: 2.5rem; margin-bottom: 20px; }

.view {
    display: none;
    width: 100%;
    min-height: 100vh;
    padding-top: 80px;
    padding-bottom: 120px;
}

.view.active {
    display: block;
    animation: fadeInScale 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 30px;
    text-align: center;
}

/* --- Cake CSS --- */
.cake-container {
    margin: 60px auto 40px auto;
    position: relative;
    width: 300px;
    height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}
.cake-tier {
    background: linear-gradient(to right, #ff9ebf, #ffb8d0);
    border-radius: 10px 10px 5px 5px;
    position: relative;
    box-shadow: inset 0 -10px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.2);
    border: 4px solid #fff;
    border-bottom: none;
}
.cake-tier.top { width: 140px; height: 60px; z-index: 3; }
.cake-tier.middle { width: 220px; height: 70px; z-index: 2; margin-top: -5px; }
.cake-tier.bottom { width: 300px; height: 80px; z-index: 1; margin-top: -5px; border-bottom: 4px solid #fff; }

.candle-wrapper {
    position: absolute;
    top: -35px;
    width: 12px;
    height: 40px;
    cursor: pointer;
    transition: transform 0.2s;
}
.candle-wrapper:hover {
    transform: scale(1.1);
}
.candle-stick {
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(45deg, #fff, #fff 5px, #1dd1a1 5px, #1dd1a1 10px);
    border-radius: 4px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
}
.candle-flame {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 22px;
    background: #ffa502;
    border-radius: 50% 50% 20% 20%;
    box-shadow: 0 0 15px #ffa502, 0 0 30px #ff4757;
    animation: flicker 0.4s infinite alternate;
    transition: opacity 0.3s;
}
.candle-wrapper.off .candle-flame {
    opacity: 0;
}
.candle-smoke {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 20px;
    background: rgba(150, 150, 150, 0.5);
    border-radius: 50%;
    opacity: 0;
    filter: blur(2px);
    pointer-events: none;
}
.candle-wrapper.off .candle-smoke {
    animation: smokeUp 1s ease-out forwards;
}

@keyframes flicker {
    0% { transform: translateX(-50%) scale(0.9) rotate(-2deg); opacity: 0.9; }
    100% { transform: translateX(-50%) scale(1.1) rotate(2deg); opacity: 1; }
}
@keyframes smokeUp {
    0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -40px) scale(2); }
}

p {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Campos de texto y botones */
input[type="text"] {
    width: 100%;
    max-width: 400px;
    padding: 20px 30px;
    font-size: 1.3rem;
    font-family: 'Nunito', sans-serif;
    border: 2px solid rgba(74, 59, 50, 0.1);
    border-radius: 40px;
    margin-bottom: 30px;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-main);
}

input[type="text"]:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 5px rgba(212, 163, 43, 0.15);
}

button {
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    padding: 18px 45px;
    font-size: 1.2rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 500;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(212, 163, 43, 0.3);
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(212, 163, 43, 0.4);
}

.error-msg {
    color: #e74c3c;
    font-weight: 500;
    font-size: 1.1rem;
    margin-top: 15px;
}

.hidden { display: none !important; }

/* Timer Gigante Rojo */
.countdown {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    margin: 50px 0;
}

.time-box {
    background: #c0392b; 
    color: white;
    padding: 30px 40px;
    border-radius: 24px;
    min-width: 130px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(192, 57, 43, 0.3);
    border: none;
}

.time-box span {
    font-size: 5.5rem;
    font-weight: 700;
    color: white;
    line-height: 1;
    margin-bottom: 5px;
}
.time-box small {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Grid de los Cofres */
.chests-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin: 60px auto;
}

.chest {
    flex: 0 1 300px;
    background: transparent;
    border: none;
    padding: 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: var(--text-main);
    font-size: 1.5rem;
    font-family: 'Fredoka One', 'Nunito', sans-serif;
}

.chest:hover {
    transform: scale(1.1) translateY(-10px);
}

.chest.unlocked {
    color: var(--primary);
}

/* Modales */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(252, 249, 242, 0.9);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Para que en móviles no se corte por arriba si es muy largo */
    padding: 40px 20px;
    box-sizing: border-box;
    overflow-y: auto; /* Permite hacer scroll en el modal */
    z-index: 1000;
    animation: fadeIn 0.3s ease forwards;
}

.modal-content {
    margin: auto; /* Lo centra verticalmente si hay espacio, pero permite scroll si no lo hay */
    background: transparent;
    padding: 50px;
    text-align: center;
    max-width: 600px;
    width: 90%;
}

.modal-content h2 {
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.modal-content p {
    font-size: 1.4rem;
    color: var(--text-main);
    margin-bottom: 40px;
}

/* Estilos de las imágenes */
.surprise-content {
    margin-top: 50px;
    text-align: center;
    font-size: 1.3rem;
    color: var(--text-main);
    line-height: 1.8;
}

.surprise-content img, .surprise-content video {
    max-width: 100%;
    height: auto;
    border-radius: 20px;
    margin: 30px auto;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    display: block;
}

/* Estilos del Quiz */
#quiz-questions {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-question {
    background: rgba(255, 255, 255, 0.6);
    padding: 40px;
    border-radius: 24px;
    border: none;
    margin-bottom: 35px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.02);
}
.quiz-question h3 {
    font-size: 1.3rem;
    color: var(--text-main);
    margin-bottom: 25px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
}
.quiz-option {
    display: block;
    padding: 20px 25px;
    margin-bottom: 15px;
    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-main);
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}
.quiz-option:hover {
    border-color: var(--primary);
    transform: translateX(5px);
}
.quiz-option input[type="radio"] {
    margin-right: 20px;
    accent-color: var(--primary);
    transform: scale(1.3);
}

/* Rompecabezas */
.puzzle-tile {
    position: absolute;
    width: 100px;
    height: 100px;
    background-size: 300px 300px;
    border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

/* Diferencias */
.diff-zone {
    position: absolute;
    cursor: pointer;
    border-radius: 50%;
    /* border: 2px solid red; Uncomment to debug */
}
.diff-zone.found {
    border: 3px solid #2ecc71;
    background: rgba(46, 204, 113, 0.3);
    pointer-events: none;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Botón de Pista y Atrás */
#hint-btn {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
}
#hint-btn:hover {
    background-color: rgba(212, 163, 43, 0.1);
    transform: none;
}

.back-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    margin-bottom: 20px;
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 1.1rem;
    box-shadow: none;
    display: inline-block;
}
.back-btn:hover {
    color: var(--primary);
    background: transparent;
    transform: translateX(-5px);
    box-shadow: none;
}

/* Conecta 4 */
.c4-cell { width: 50px; height: 50px; background-color: white; border-radius: 50%; cursor: pointer; transition: background-color 0.3s; }
.c4-cell:hover { box-shadow: inset 0 0 10px rgba(0,0,0,0.2); }
.c4-player1 { background-color: #ff4136; }
.c4-player2 { background-color: #ffdc00; }

/* Responsive Design */
@media (max-width: 600px) {
    h1 { font-size: 3.5rem; margin-top: 40px; margin-bottom: 20px; }
    h2 { font-size: 2rem; }
    .view { padding-top: 40px; padding-bottom: 60px; }
    .container { padding: 0 15px; }
    #c4-board { grid-template-columns: repeat(7, 40px) !important; grid-template-rows: repeat(6, 40px) !important; gap: 5px !important; }
    .c4-cell { width: 40px !important; height: 40px !important; }
    #diff-container { margin: 20px auto !important; }
}

/* Ocultar cualquier badge o barra de Netlify */
#nl-badge-frame,
#nl-hud-frame,
iframe[id^="nl-"],
iframe[title*="Netlify"],
[data-netlify-drawer], 
#netlify-drawer, 
.netlify-badge, 
iframe[src*="netlify"], 
div[id*="netlify"],
div[class*="netlify"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}
