/* --- 1. CONFIGURACIÓN GLOBAL --- */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Montserrat:wght@700&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: url('background.png') no-repeat center center fixed;
    background-size: cover;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden; 
    padding: 1vh 2vw;
}

/* --- 2. CABECERA --- */
.main-header {
    height: 10vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-header h1 {
    font-family: 'Fredoka One', cursive;
    color: #ffffff;
    font-size: clamp(1.2rem, 4vw, 2.5rem);
    text-shadow: 3px 3px 0px #4CAF50, 6px 6px 15px rgba(0,0,0,0.4);
}

/* --- 3. CONTENEDOR DE CARTAS (MENÚ PRINCIPAL) --- */
.grid-container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 2vh 2vw;
    width: 100%;
    max-width: 1100px;
    padding: 2vh 0;
}

/* --- 4. ESTILO DE CARTAS --- */
.card {
    background: rgba(255, 255, 255, 0.2); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 1.5vh;
    border: 6px solid;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card img {
    max-width: 85%;
    max-height: 80%;
    object-fit: contain;
    filter: drop-shadow(0px 5px 10px rgba(0,0,0,0.3));
}

.card-corner-icon {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: clamp(1.2rem, 3vw, 2.2rem);
    background: rgba(255, 255, 255, 0.6);
    width: 22%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.card-green { border-color: #8BC34A; }
.card-dark-green { border-color: #2E7D32; }
.card-orange { border-color: #FF9800; }
.card-yellow { border-color: #ffff00; }
.card-blue { border-color: #4292c6; }
.card-white { border-color: #FFFFFF; }

.hidden { display: none; }

/* --- 5. OVERLAY (DESAFÍO) - CENTRADO CORREGIDO --- */
.overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    flex-direction: column;
    justify-content: center; /* Centra verticalmente */
    align-items: center;     /* Centra horizontalmente */
    backdrop-filter: blur(12px);
}

.overlay-content {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Contenedor específico para la carta en el centro */
#selected-card-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

/* La carta clonada dentro del desafío */
#selected-card-container .card {
    width: clamp(180px, 40vh, 250px);
    aspect-ratio: 3/4;
    cursor: default;
    transform: none; /* Evita que herede giros del hover */
    animation: slideIn 0.5s ease-out;
}

.challenge-title {
    color: #FFC107;
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    margin: 10px 0 20px 0;
    text-align: center;
}

.options-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.option-card {
    width: clamp(80px, 15vw, 140px);
    aspect-ratio: 1;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 5px solid #eee;
    box-shadow: 0 8px 0px #ccc;
    font-size: clamp(2rem, 8vw, 4rem);
    transition: 0.2s;
}

.option-card:active { transform: translateY(5px); box-shadow: 0 3px 0px #ccc; }

.btn-close {
    background: #FF5252;
    color: white;
    padding: 10px 40px;
    border-radius: 30px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 5px 0px #b71c1c;
}

/* --- 6. ANIMACIONES --- */
@keyframes slideIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.confetti {
    position: fixed;
    width: 12px; height: 12px;
    z-index: 2000;
    animation: fall 3s linear forwards;
}

@keyframes fall {
    to { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}

/* --- 7. MÓVIL --- */
@media (max-width: 600px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
    .options-grid { gap: 10px; }
}