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

:root {
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-container: white;
    --bg-card: #f8f9fa;
    --text-primary: #333;
    --text-secondary: #666;
    --accent-color: #667eea;
    --correct-color: #28a745;
    --incorrect-color: #dc3545;
    --border-color: #ddd;
}

body.dark-theme {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-container: #1e1e30;
    --bg-card: #2a2a40;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent-color: #8a8aff;
    --correct-color: #4caf50;
    --incorrect-color: #f44336;
    --border-color: #3a3a50;
}

body {
    font-family: 'Arial', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: background 0.3s ease;
}

.container {
    background: var(--bg-container);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 600px;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
    transition: background 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    margin-bottom: 30px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.theme-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.theme-button:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}

header h1 {
    color: var(--text-primary);
    font-size: 2.5rem;
    margin-bottom: 0;
    font-weight: 700;
}

.score {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-card);
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background 0.3s ease;
}

.score span {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.score span span {
    color: var(--accent-color);
    font-weight: 700;
    transition: color 0.3s ease;
}

.card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.word-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    min-height: 80px;
}

.word {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    animation: pulse 2s infinite;
    margin-right: 15px;
    transition: color 0.3s ease;
}

.play-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.play-button:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}

.play-button:active {
    transform: scale(0.95);
}

.phonetic {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-style: italic;
    min-height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

input[type="text"] {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease;
    background: var(--bg-container);
    color: var(--text-primary);
}

input[type="text"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#submit-btn {
    background: var(--accent-color);
    color: white;
}

#submit-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.feedback {
    font-size: 1.1rem;
    font-weight: 600;
    min-height: 30px;
    margin-top: 15px;
}

.feedback.correct {
    color: var(--correct-color);
    animation: slideIn 0.3s ease;
}

.feedback.incorrect {
    color: var(--incorrect-color);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 15px;
    flex: 1;
    margin: 0 10px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 5px;
    transition: color 0.3s ease;
}

.stat-label {
    font-size: 1rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

footer {
    display: flex;
    gap: 15px;
    justify-content: center;
}

#restart-btn {
    background: #ffc107;
    color: #212529;
}

#restart-btn:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 193, 7, 0.4);
}

#toggle-mode {
    background: #17a2b8;
    color: white;
}

#toggle-mode:hover {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.4);
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .word {
        font-size: 2rem;
    }
    
    .input-container {
        flex-direction: column;
    }
    
    .stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .stat-item {
        margin: 0;
    }
    
    footer {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .word {
        font-size: 1.5rem;
    }
    
    .score {
        font-size: 0.9rem;
        padding: 10px;
    }
    
    .card {
        padding: 20px;
    }
    
    input[type="text"] {
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    button {
        padding: 12px 20px;
        font-size: 1rem;
    }
}