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

body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    color: #333;
}

/* Contenedor principal - orientación vertical */
#game-container {
    position: relative;
    width: 100%;
    height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #fff;
}

/* Pantallas del juego */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    transition: all 0.5s ease;
}

.screen.active {
    display: flex;
}

/* Pantalla de intro */
#intro-screen {
    background-color: #000;
}

#intro-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tap-to-play {
    position: absolute;
    bottom: 50px;
    width: 100%;
    text-align: center;
    color: #fff;
    font-size: 24px;
    animation: pulse 1.5s infinite;
    z-index: 10;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Pantalla de bienvenida */
#welcome-screen {
    background-color: #3498db;
    color: #fff;
}

#welcome-screen h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

#welcome-screen p {
    font-size: 32px;
    margin-bottom: 40px;
}

/* Pantalla de cuenta regresiva */
#countdown-screen {
    background-color: #2c3e50;
}

#countdown {
    font-size: 120px;
    font-weight: bold;
    color: #fff;
}

/* Pantalla del juego */
#game-screen {
    background-color: #ecf0f1;
    justify-content: flex-start;
}

.game-info {
    width: 100%;
    display: flex;
    justify-content: space-around;
    padding: 15px;
    background-color: #3498db;
    color: #fff;
    font-size: 18px;
    margin-bottom: 20px;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 10px;
    width: 90%;
    max-width: 500px;
    margin: 0 auto;
}

.card {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* Mantiene la relación de aspecto cuadrada */
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.5s;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-front {
    background-color: #3498db;
    transform: rotateY(180deg);
    overflow: hidden;
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-back {
    background-color: #2c3e50;
    background-image: url('../assets/card-back.jpg');
    background-size: cover;
}

/* Pantallas de resultado */
#win-screen, #lose-screen {
    text-align: center;
}

#win-screen {
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#lose-screen {
    background-color: #e74c3c;
    color: #fff;
}

.result-message h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

.result-message p {
    font-size: 24px;
    margin-bottom: 30px;
}

/* Botones */
.btn {
    padding: 15px 30px;
    font-size: 24px;
    background-color: #2ecc71;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    background-color: #27ae60;
    transform: scale(1.05);
}

/* Confeti para la pantalla de victoria */
.confetti {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
}

/* Responsive */
@media (max-width: 768px) {
    .game-info {
        flex-direction: column;
        align-items: center;
    }
    
    .game-info div {
        margin-bottom: 5px;
    }
    
    #game-board {
        grid-template-columns: repeat(4, 1fr);
    }
    
    #countdown {
        font-size: 80px;
    }
    
    .result-message h1 {
        font-size: 36px;
    }
    
    .result-message p {
        font-size: 20px;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    #game-board {
        grid-template-columns: repeat(4, 1fr);
        width: 95%;
    }
    
    .card {
        margin: 5px;
    }
}
