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

body {
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 25px;
    max-width: 600px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    color: #2E7D32;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: bold;
}

header p {
    color: #4E342E;
    font-size: 1.2rem;
    font-weight: 500;
}

.word-display {
    text-align: center;
    margin-bottom: 25px;
    background: #E8F5E8;
    border-radius: 15px;
    padding: 20px;
    border: 3px solid #4CAF50;
}

.word-display h2 {
    color: #2E7D32;
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: bold;
}

.target-word {
    font-size: 3rem;
    font-weight: bold;
    color: #FFC107;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    letter-spacing: 0.2em;
}

.formed-word {
    font-size: 2.5rem;
    font-weight: bold;
    color: #4CAF50;
    min-height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border: 2px dashed #81C784;
    border-radius: 10px;
    padding: 10px;
    background: white;
}

.formed-letter {
    animation: letterAppear 0.5s ease-in-out;
    display: inline-block;
}

@keyframes letterAppear {
    0% { transform: scale(0) rotate(180deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(0deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.game-area {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.letter-container {
    text-align: center;
}


#letterCanvas {
    border: 3px solid #4CAF50;
    border-radius: 15px;
    background: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.trace-instruction {
    color: #5D4037;
    font-size: 1rem;
    font-style: italic;
    margin-top: 10px;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.btn {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    background: linear-gradient(145deg, #45a049, #388e3c);
}

.btn:active {
    transform: translateY(-1px);
}

.progress {
    margin-bottom: 20px;
    text-align: center;
}

.progress h3 {
    color: #2E7D32;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

#completedWords {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.completed-word {
    background: #4CAF50;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.instructions {
    background: #E3F2FD;
    padding: 20px;
    border-radius: 15px;
    border-left: 5px solid #2196F3;
}

.instructions h3 {
    color: #1565C0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: bold;
}

.instructions ul {
    padding-left: 25px;
    color: #424242;
    line-height: 1.8;
}

.instructions li {
    margin-bottom: 8px;
    font-size: 1rem;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .container {
        margin: 10px;
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .target-word {
        font-size: 2.5rem;
    }
    
    .formed-word {
        font-size: 2rem;
    }
    
    #letterCanvas {
        width: 100%;
        max-width: 350px;
        height: 250px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 200px;
    }
}

/* Animation for successful letter trace */
@keyframes letterSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); background: #4CAF50; }
    100% { transform: scale(1); }
}

.letter-success-animation {
    animation: letterSuccess 0.6s ease-in-out;
}

/* Celebration animation */
@keyframes celebrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

.celebration {
    animation: celebrate 0.5s ease-in-out 3;
}