* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden;
}

/* Estilos de las pantallas de inicio y final */
.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    padding: 40px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.screen.hidden {
    display: none;
}

.logo {
    font-size: 4rem;
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
}

.subtitle, .final-score {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.final-message {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #ffd700;
}


/* Estilos del juego (resto del código) */

.header {
    text-align: center;
    margin-bottom: 20px;
    color: white;
}

.header h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #ffd700, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% { filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5)); }
    100% { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)); }
}

.score-board {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: #000;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.score-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 25px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    width: auto;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(6, 70px);
    grid-template-rows: repeat(6, 70px);
    gap: 10px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    padding: 20px;
    border-radius: 20px;
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.2);
}

.cell {
    width: 70px;
    height: 70px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.cell.AMOR { background: linear-gradient(145deg, #ff6b9d, #ff4757); }
.cell.PACIENTE { background: linear-gradient(145deg, #ff9800, #f57c00); }
.cell.FELIZ { background: linear-gradient(145deg, #ffeb3b, #ffc107); }
.cell.GENIAL { background: linear-gradient(145deg, #4caf50, #2e7d32); }
.cell.BRILLA { background: linear-gradient(145deg, #e91e63, #ad1457); }
.cell.SUEÑA { background: linear-gradient(145deg, #9c27b0, #6a1b9a); }
.cell.RIE { background: linear-gradient(145deg, #ff5722, #d84315); }
.cell.ACEPTAR { background: linear-gradient(145deg, #00bcd4, #0097a7); }

.cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    transition: left 0.5s;
}

.cell:hover::before { 
    left: 100%; 
}

.cell:hover {
    transform: scale(1.08) rotate(2deg);
    border-color: #4ecdc4;
    box-shadow: 0 8px 20px rgba(78, 205, 196, 0.4);
    background: linear-gradient(145deg, #4ecdc4, #44a08d);
    color: white;
}

.cell.selected {
    border-color: #ff6b6b;
    background: linear-gradient(145deg, #ff6b6b, #ee5a52);
    color: white;
    transform: scale(1.15) rotate(-2deg);
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.5);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1.15) rotate(-2deg); }
    50% { transform: scale(1.2) rotate(-2deg); }
}

.cell.matched { animation: matchAnimation 0.8s ease-in-out; }

@keyframes matchAnimation {
    0% { transform: scale(1); }
    25% { transform: scale(1.4) rotate(15deg); background: linear-gradient(45deg, #ffd700, #ffed4e); }
    50% { transform: scale(1.6) rotate(-10deg); background: linear-gradient(45deg, #ff6b6b, #ffa500); }
    75% { transform: scale(1.3) rotate(5deg); background: linear-gradient(45deg, #4ecdc4, #44a08d); }
    100% { transform: scale(0) rotate(180deg); opacity: 0; }
}

.cell.falling { animation: fallAnimation 0.6s ease-out; }

@keyframes fallAnimation {
    0% { transform: translateY(-150px) rotate(180deg); opacity: 0; }
    50% { opacity: 0.5; }
    100% { transform: translateY(0) rotate(0deg); opacity: 1; }
}

.controls {
    margin-top: 25px;
    text-align: center;
}

.btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 10px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before { left: 100%; }
.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.btn:active { transform: translateY(0) scale(0.98); }

.message {
    margin-top: 20px;
    padding: 15px 25px;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.9), rgba(240, 240, 240, 0.9));
    border-radius: 20px;
    color: #333;
    font-weight: bold;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 2px solid rgba(102, 126, 234, 0.3);
    text-align: center;
    font-size: 1.1rem;
}

.floating-points {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    pointer-events: none;
    animation: floatUp 2s ease-out forwards;
    z-index: 1000;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-100px) scale(1.5); }
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
}

.particle-explosion { animation: particleExplosion 1.5s ease-out forwards; }

@keyframes particleExplosion {
    0% { opacity: 1; transform: scale(1) translate(0, 0); }
    100% { opacity: 0; transform: scale(0.3) translate(var(--dx), var(--dy)); }
}

.energy-wave {
    position: absolute;
    border: 3px solid rgba(255, 215, 0, 0.8);
    border-radius: 50%;
    pointer-events: none;
    z-index: 998;
    animation: energyWave 1s ease-out forwards;
}

@keyframes energyWave {
    0% { width: 20px; height: 20px; opacity: 1; border-width: 3px; }
    100% { width: 200px; height: 200px; opacity: 0; border-width: 1px; }
}

.screen-shake { animation: screenShake 0.5s ease-in-out; }

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-5px) rotate(0.5deg); }
    20% { transform: translateX(5px) rotate(-0.5deg); }
    30% { transform: translateX(-3px) rotate(0.3deg); }
    40% { transform: translateX(3px) rotate(-0.3deg); }
    50% { transform: translateX(-2px) rotate(0.2deg); }
    60% { transform: translateX(2px) rotate(-0.2deg); }
    70% { transform: translateX(-1px) rotate(0.1deg); }
    80% { transform: translateX(1px) rotate(-0.1deg); }
    90% { transform: translateX(0) rotate(0deg); }
}

.rainbow-trail {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: linear-gradient(45deg, 
        #ff0000, #ff7f00, #ffff00, #00ff00, 
        #0000ff, #4b0082, #9400d3, #ff0000);
    background-size: 400% 400%;
    animation: rainbowTrail 0.8s ease-in-out;
    z-index: -1;
}

@keyframes rainbowTrail {
    0% { opacity: 0; background-position: 0% 50%; transform: scale(0.8); }
    50% { opacity: 0.8; background-position: 100% 50%; transform: scale(1.2); }
    100% { opacity: 0; background-position: 200% 50%; transform: scale(1); }
}

.star-burst {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ffd700;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1001;
}

.star-burst::before,
.star-burst::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: inherit;
}

.star-burst::before { transform: rotate(45deg); }
.star-burst::after { transform: rotate(-45deg); }

.star-animation { animation: starBurst 1.2s ease-out forwards; }

@keyframes starBurst {
    0% { opacity: 1; transform: scale(0) rotate(0deg); }
    50% { opacity: 1; transform: scale(3) rotate(180deg); }
    100% { opacity: 0; transform: scale(0.5) rotate(360deg) translateY(-100px); }
}

.glow-pulse { animation: glowPulse 2s ease-in-out infinite; }

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 215, 0, 0.4); }
}

.combo-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.7);
    background: linear-gradient(45deg, rgba(255, 107, 107, 0.9), rgba(78, 205, 196, 0.9));
    padding: 20px 40px;
    border-radius: 20px;
    z-index: 1001;
    animation: comboAnimation 2s ease-out forwards;
    pointer-events: none;
}

@keyframes comboAnimation {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* Media query para dispositivos con un ancho máximo de 768px (tabletas y móviles)
    Ajusta el tamaño del tablero y las celdas para que quepan en la pantalla
*/
@media (max-width: 768px) {
    .game-board {
        grid-template-columns: repeat(6, 50px);
        grid-template-rows: repeat(6, 50px);
        gap: 5px;
    }
    .cell {
        width: 50px;
        height: 50px;
        font-size: 0.6rem;
    }
    .header h1 { 
        font-size: 2rem; 
    }
    .score-board {
        flex-direction: column;
        gap: 10px;
    }
}

/* Media query para dispositivos más pequeños, como teléfonos */
@media (max-width: 500px) {
    body {
        padding: 10px;
    }
    .game-container {
        padding: 15px;
    }
    .game-board {
        grid-template-columns: repeat(6, 45px);
        grid-template-rows: repeat(6, 45px);
        gap: 4px;
        padding: 10px;
    }
    .cell {
        width: 45px;
        height: 45px;
        font-size: 0.5rem;
    }
    .header h1 {
        font-size: 1.5rem;
    }
    .score-board {
        font-size: 0.9rem;
    }
    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    .message {
        font-size: 0.9rem;
        padding: 10px 15px;
    }
    .floating-points {
        font-size: 1rem;
    }
    .combo-message {
        font-size: 1.5rem;
        padding: 10px 20px;
    }
}