:root {
    --game-bg: rgba(0, 10, 20, 0.7);
    --panel-bg: rgba(0, 20, 40, 0.6);
    --overlay-bg: rgba(15, 12, 41, 0.9);
}

body {
    overflow-x: hidden; /* Prevent horizontal scrollbars */
    overflow-y: auto;   /* Allow vertical scrolling */
}

.game-container {
    display: flex;
    width: 100%;
    padding: 10px;
    gap: 10px;
}

.game-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-medium);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.left-panel {
    flex: 1;
    justify-content: space-around;
}

.right-panel {
    flex: 1;
    justify-content: space-around;
}

.game-center {
    flex: 3;
    height: 620px;
    background: var(--game-bg);
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-large);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 25px var(--shadow-color);
}

.game-panel h3 {
    font-family: var(--font-display);
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    width: 100%;
    text-align: center;
    margin-bottom: 0;
}

.stat-display {
    font-family: var(--font-digital);
    font-size: 3rem;
    color: var(--text-secondary);
    text-shadow: 0 0 10px var(--shadow-color);
}

#lives-container {
    font-size: 2.5rem;
    color: var(--incorrect-color);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.life-coin {
    width: 2.5rem;
    height: 2.5rem;
}

.falling-word {
    position: absolute;
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-light);
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 10px;
    border-radius: var(--radius-small);
    white-space: nowrap;
    transition: top 0.1s linear;
}

#wpm-chart {
    /* Adds a glow effect to the line on the chart */
    filter: drop-shadow(0 0 5px var(--text-secondary));
}

@keyframes burn {
    0% { text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #ff4500, 0 0 30px #ff4500, 0 0 40px #ff4500, 0 0 50px #ff4500, 0 0 60px #ff4500; }
    50% { text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #ff4500, 0 0 50px #ff4500, 0 0 60px #ff4500, 0 0 70px #ff4500, 0 0 80px #ff4500; }
    100% { text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #ff4500, 0 0 30px #ff4500, 0 0 40px #ff4500, 0 0 50px #ff4500, 0 0 60px #ff4500; }
}

.falling-word.burning {
    color: #ffd700; /* Gold color for the text */
    animation: burn 1.5s ease-in-out infinite;
    /* We need to override the active styles for the text color */
}

.falling-word.burning .correct,
.falling-word.burning .incorrect {
    color: #ffd700; /* Keep text color consistent when burning */
}

.falling-word.active {
    background: var(--border-color-strong);
    color: var(--bg-gradient-start);
    font-weight: bold;
    box-shadow: 0 0 15px var(--accent-color);
}

.falling-word .correct {
    color: var(--correct-color);
}

.falling-word .incorrect {
    color: var(--incorrect-color);
    text-decoration: underline;
}

.game-input {
    position: absolute;
    left: -9999px; /* Hide the input field */
    opacity: 0;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
    color: var(--text-light);
    padding: 20px;
    transition: opacity 0.5s ease;
}

.game-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#overlay-title {
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 20px;
}

#overlay-text {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
}

.btn {
    font-family: var(--font-display);
    font-size: 1.5rem;
    padding: 15px 30px;
    background: var(--nav-btn-hover-bg);
    border: 1px solid var(--border-color-strong);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    clip-path: none;
}

.btn:hover {
    box-shadow: 0 0 20px var(--shadow-color);
    transform: scale(1.05);
}

/* Mobile-only top controls */
.mobile-controls {
    display: none; /* Hidden by default on desktop */
    justify-content: center;
    gap: 15px;
    padding: 10px;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border-color);
}
.mobile-controls .btn {
    padding: 10px 20px;
    font-size: 1rem;
}

/* Hide mobile controls by default */
#mobile-restart-btn,
#mobile-pause-btn {
    display: none;
}

/* On desktop, hide the main mobile start button */
@media (min-width: 993px) {
    #start-game-btn-main {
        display: none;
    }
}

/* Responsive Styles for Falling Words Game */
@media (max-width: 992px) {
    .game-container {
        flex-direction: column;
    }

    .mobile-controls {
        display: flex; /* Show on mobile */
    }

    /* Hide the desktop start button on mobile */
    #start-game-btn-desktop {
        display: none;
    }

    .left-panel, .right-panel, .game-center {
        width: 100%;
    }

    .left-panel, .right-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
    }

    .game-panel .stat-item {
        flex-basis: 45%; /* Two items per row */
        margin-bottom: 20px;
    }

    .game-center {
        height: 500px; /* Adjust height for smaller screens */
    }

    .falling-word {
        font-size: 1.2rem;
    }
}

@media (max-width: 576px) {
    .game-panel .stat-item {
        flex-basis: 100%; /* One item per row on very small screens */
    }

    #overlay-title {
        font-size: 2rem;
    }
}