#game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    display: none; /* Initially hidden */
}

#game-over-box {
    background-color: rgba(50, 50, 50, 0.95);
    color: white;
    border-radius: 15px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* When overlay is shown, animate the box upward */
#game-over-overlay[style*="display: flex"] #game-over-box {
    transform: translateY(0);
}

#game-over-title {
    font-size: 32px;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-correct);
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    animation: pulse 2s infinite;
}

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

#game-over-title.lose {
    color: var(--color-absent);
    animation: none;
}

#game-over-message {
    font-size: 18px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.final-word-display {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.final-word-display .letter {
    width: 40px;
    height: 40px;
    margin: 0 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
    animation: flipIn 0.5s ease-out both;
    animation-delay: calc(var(--index) * 0.15s);
}

@keyframes flipIn {
    0% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

.final-word-display .letter.correct {
    background-color: var(--color-correct);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.game-over-stats {
    width: 100%;
    margin-bottom: 25px;
    animation: fadeIn 0.8s ease-in-out;
    animation-delay: 0.5s;
    animation-fill-mode: both;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.stat-label {
    font-weight: bold;
    font-size: 16px;
}

.stat-value {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
}

#restart-btn {
    background-color: var(--color-correct);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    animation: buttonPulse 2s infinite;
    animation-delay: 1.5s;
}

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

#restart-btn:hover {
    background-color: #5a9a54;
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.3);
    animation: none;
}

#restart-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
} 