* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #fd79a8;
    --dark-color: #2d3436;
    --light-color: #f5f6fa;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #d63031;
    --text-color: #2d3436;
    --text-light: #636e72;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    background-color: var(--light-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.game-container {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

header {
    margin: 20px 0;
}

h1 {
    font-size: 36px;
    font-weight: bold;
    letter-spacing: 2px;
    text-align: center;
    color: var(--primary-color);
}

#game-board {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 30px;
    width: 100%;
}

.row {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.tile {
    width: 60px;
    height: 60px;
    border: 2px solid #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    font-weight: bold;
    text-transform: uppercase;
    transition: transform 0.6s, background-color 0.3s, border-color 0.3s;
}

.correct {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.present {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.absent {
    background-color: var(--dark-color);
    border-color: var(--dark-color);
    color: white;
}

#keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.key {
    background-color: #e9ecef;
    color: var(--text-color);
    border: none;
    border-radius: var(--border-radius);
    min-width: 40px;
    height: 58px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
    transition: var(--transition);
}

.key:hover {
    background-color: #dee2e6;
    transform: translateY(-2px);
}

.key-wide {
    min-width: 65px;
}

#message-container {
    height: 30px;
    margin: 20px 0;
    text-align: center;
}

#message {
    font-size: 16px;
    font-weight: bold;
    color: var(--accent-color);
}

#new-game-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: var(--transition);
    text-transform: uppercase;
}

#new-game-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.shake {
    animation: shake 0.5s;
}

.flip {
    animation: flip 0.5s;
}

@keyframes shake {
    0% { transform: translateX(0); }
    10% { transform: translateX(-5px); }
    20% { transform: translateX(5px); }
    30% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    50% { transform: translateX(-5px); }
    60% { transform: translateX(5px); }
    70% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
    90% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

@keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

/* Responsive design */
@media (max-width: 500px) {
    .tile {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
    
    .key {
        min-width: 30px;
        height: 45px;
        font-size: 12px;
        padding: 0 5px;
    }
    
    .key-wide {
        min-width: 50px;
    }
}

@media (max-width: 350px) {
    .tile {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
    
    .key {
        min-width: 25px;
        height: 40px;
        font-size: 10px;
        padding: 0 3px;
    }
    
    .key-wide {
        min-width: 40px;
    }
}

.used-key {
    background-color: #e0e0e0 !important;
    color: var(--text-color) !important;
}

/* Update the tile styles to handle the color changes */
.tile {
    width: 60px;
    height: 60px;
    border: 2px solid #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    font-weight: bold;
    text-transform: uppercase;
    transition: transform 0.6s, background-color 0.3s, border-color 0.3s;
}

/* Ensure the flip animation works with the new styling */
.flip {
    animation: flip 0.5s;
}
