/* Keyboard Adventure Game Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #6366F1;
    --primary-light: #A5B4FC;
    --background: #EEF2FF;
    --surface: #FFFFFF;
    --text: #1E293B;
    --success: #10B981;
    --error: #EF4444;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, #8B5CF6 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#game-container {
    width: 100%;
    max-width: 500px;
    background: var(--surface);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

#game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--background);
}

.game-title {
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
}

.timer-display,
.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-label,
.score-label {
    font-size: 11px;
    color: #64748B;
    text-transform: uppercase;
}

.timer-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
}

.score-value {
    font-size: 24px;
    font-weight: 700;
    color: #F59E0B;
}

#word-area {
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(180deg, var(--background) 0%, white 100%);
    min-height: 150px;
}

#current-word {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: 4px;
    margin-bottom: 16px;
    color: var(--text);
}

#current-word .letter {
    display: inline-block;
    padding: 4px 2px;
    transition: all 0.1s;
}

#current-word .letter.correct {
    color: var(--success);
}

#current-word .letter.wrong {
    color: var(--error);
    text-decoration: underline;
}

#current-word .letter.current {
    background: var(--primary-light);
    border-radius: 4px;
}

#typed-letters {
    font-size: 14px;
    color: #64748B;
    min-height: 20px;
}

#keyboard-visual {
    padding: 16px;
    background: #F8FAFC;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
}

.key {
    width: 36px;
    height: 40px;
    background: white;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    transition: all 0.1s;
}

.key.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: scale(1.1);
}

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

.key.wrong {
    background: var(--error);
    border-color: var(--error);
    color: white;
    animation: shake 0.2s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

#stats-bar {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 16px;
    background: var(--background);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 12px;
    color: #64748B;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.tip {
    background: var(--background);
    padding: 12px;
    border-radius: 12px;
    margin-top: 16px;
    font-size: 14px;
    color: #64748B;
}

.stars {
    font-size: 48px;
    margin-bottom: 16px;
}

.modal-content h2 {
    font-size: 28px;
    color: var(--text);
    margin-bottom: 8px;
}

.modal-content p {
    color: #64748B;
    margin-bottom: 16px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 32px;
}

.result-stat {
    display: flex;
    flex-direction: column;
}

.result-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.result-label {
    font-size: 12px;
    color: #64748B;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-primary,
.btn-secondary {
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #8B5CF6 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--background);
    color: var(--text);
    border: 2px solid #C7D2FE;
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}