/* Typing Trainer Styles */
.game-container {
    max-width: 800px;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem;
}

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 2rem;
}

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

.stat .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.text-gold {
    color: #fbbf24 !important;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.play-area {
    position: relative;
    width: 100%;
    height: 700px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    overflow: hidden;

    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.overlay h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

.overlay p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: var(--font-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.input-display {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

#typingInput {
    width: 100%;
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    outline: none;
    transition: var(--transition-fast);
}

#typingInput:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Falling Words */
.word {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    will-change: transform;
    /* Words are visually centered based on left/top in JS */
}

.word span {
    display: inline-block;
}

.word .typed {
    color: #10b981; /* Green for typed letters */
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

/* Broken Letters Animation */
.broken-letter {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-secondary);
    pointer-events: none;
    animation: letterFall 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes letterFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(300px) var(--rotation-end);
        opacity: 0;
    }
}

/* Green Band */
.green-band {
    position: absolute;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(16, 185, 129, 0.15);
    border-top: 2px dashed rgba(16, 185, 129, 0.8);
    border-bottom: 2px dashed rgba(16, 185, 129, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
    opacity: 0;
}

.green-band.active {
    opacity: 1;
}

.green-band .band-text {
    color: #10b981;
    font-weight: 700;
    font-size: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

/* Floating Score */
.floating-score {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fbbf24;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
    pointer-events: none;
    animation: scoreFlyUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    z-index: 50;
    white-space: nowrap;
}

@keyframes scoreFlyUp {
    0% {
        transform: translate(-50%, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -80px) scale(1.2);
        opacity: 0;
    }
}

.floating-score.double-score {
    animation: scoreFlyUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards, flashYellowGreen 0.2s infinite;
}

@keyframes flashYellowGreen {
    0%, 100% {
        color: #fbbf24;
        text-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
    }
    50% {
        color: #10b981;
        text-shadow: 0 0 15px rgba(16, 185, 129, 0.9);
    }
}

/* Screen Flash for Game Over */
.play-area-flash-red {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background-color: rgba(239, 68, 68, 0);
    z-index: 150;
    pointer-events: none;
    animation: fadeOutRed 3s ease-out forwards;
}

@keyframes fadeOutRed {
    0% {
        background-color: rgba(239, 68, 68, 0.7);
    }
    100% {
        background-color: rgba(239, 68, 68, 0);
    }
}
