/* Word Rain Typing Game Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #6366F1;
    --primary-light: #A5B4FC;
    --secondary: #F59E0B;
    --background: #F8FAFC;
    --surface: #FFFFFF;
    --text: #1E293B;
    --text-muted: #64748B;
    --success: #10B981;
    --error: #EF4444;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(180deg, #1E3A8A 0%, #3B82F6 50%, #93C5FD 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.3);
    overflow: hidden;
}

/* Header */
#game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--background);
    border-bottom: 1px solid #E5E7EB;
}

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

.stats {
    display: flex;
    gap: 20px;
}

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

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--surface);
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.icon-btn:hover {
    transform: scale(1.1);
}

/* Game Area */
#game-area {
    position: relative;
    min-height: 450px;
}

/* Start Screen */
.start-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.start-screen.hidden {
    display: none;
}

.start-screen h2 {
    font-size: 32px;
    color: var(--text);
    margin-bottom: 16px;
}

.start-screen p {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* Rain Area */
.rain-area {
    position: relative;
    height: 350px;
    background: linear-gradient(180deg, #1E3A8A 0%, #3B82F6 70%, #60A5FA 100%);
    overflow: hidden;
}

.rain-area.hidden {
    display: none;
}

#falling-words {
    position: relative;
    width: 100%;
    height: 100%;
}

.falling-word {
    position: absolute;
    padding: 8px 16px;
    background: var(--surface);
    border-radius: 20px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: fall linear forwards;
    cursor: default;
    user-select: none;
}

.falling-word.matched {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    animation: wordPop 0.3s ease forwards;
}

.falling-word.highlight {
    border: 3px solid var(--secondary);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

@keyframes fall {
    from {
        top: -50px;
    }

    to {
        top: 350px;
    }
}

@keyframes wordPop {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(180deg, #059669 0%, #047857 100%);
}

/* Input Area */
.input-area {
    padding: 20px;
    background: var(--background);
}

.input-area.hidden {
    display: none;
}

#word-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    border: 3px solid #E5E7EB;
    border-radius: 16px;
    outline: none;
    transition: all 0.2s;
}

#word-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

#word-input.correct {
    border-color: var(--success);
    background: #D1FAE5;
}

#word-input.wrong {
    border-color: var(--error);
    animation: inputShake 0.3s ease;
}

@keyframes inputShake {

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

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

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

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

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

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

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

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

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

.result-label {
    font-size: 14px;
    color: var(--text-muted);
}

.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 #E5E7EB;
}

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

/* Responsive */
@media (max-width: 400px) {
    .rain-area {
        height: 300px;
    }

    .falling-word {
        font-size: 16px;
        padding: 6px 12px;
    }

    #word-input {
        font-size: 18px;
        padding: 14px 16px;
    }

    .stats {
        gap: 12px;
    }

    .stat-value {
        font-size: 14px;
    }
}