
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f7ff;
    color: #10234d;
}

.game-header {
    padding: 20px;
    background: white;
    text-align: center;
}

.back-link {
    color: #2563eb;
    text-decoration: none;
}

#game-menu {
    max-width: 500px;
    margin: 70px auto;
    padding: 35px;
    background: white;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 30px #00000012;
}

#game-menu select,
#game-menu button {
    display: block;
    margin: 18px auto;
    padding: 12px 20px;
    border-radius: 10px;
}

button {
    background: #2563eb;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

button:hover {
    background: #1d4ed8;
}

#game-screen {
    max-width: 1100px;
    margin: 20px auto;
    padding: 15px;
}

#game-screen[hidden] {
    display: none;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: white;
    border-radius: 12px;
    font-weight: bold;
}

#game-container {
    width: 100%;
    height: 480px;
    margin-top: 15px;
    background: #17264b;
    border-radius: 18px;
    overflow: hidden;
}

.answer-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.answer-panel input {
    padding: 12px;
    min-width: 240px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 16px;
}

.answer-panel button {
    padding: 12px 20px;
    border-radius: 10px;
}

#game-message {
    text-align: center;
    font-weight: bold;
}

#game-over {
    max-width: 500px;
    margin: 60px auto;
    padding: 35px;
    text-align: center;
    background: white;
    border-radius: 20px;
}

#game-over[hidden] {
    display: none;
}

#game-over button {
    padding: 14px 28px;
    border-radius: 10px;
}

#game-message {
    min-height: 28px;
}

#voice-button:disabled,
#submit-answer:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* XP counter */
#xp-display {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;

    padding: 12px 22px;
    border-radius: 14px;

    background: rgba(8, 20, 45, 0.85);
    border: 2px solid #facc15;

    color: #facc15;
    font-size: 22px;
    font-weight: bold;
    font-family: Arial, sans-serif;

    box-shadow: 0 0 18px rgba(250, 204, 21, 0.35);
    pointer-events: none;
}

#streak-display {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1000;

    padding: 12px 22px;
    border-radius: 14px;

    background: rgba(8, 20, 45, 0.85);
    border: 2px solid #fb923c;

    color: #fb923c;
    font-size: 22px;
    font-weight: bold;
    font-family: Arial, sans-serif;

    box-shadow: 0 0 18px rgba(251, 146, 60, 0.35);
    pointer-events: none;
}

#final-message {
    margin-top: 20px;
    color: #2563eb;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
}

/* Vocabulary Selection */

.vocabulary-selection {
    display: flex;
    flex-direction: column;
    gap: 12px;

    width: 100%;
    max-width: 360px;
    margin: 25px auto;

    padding: 20px;
    box-sizing: border-box;

    background: #f4f7ff;
    border: 2px solid #dbe5ff;
    border-radius: 16px;
}

.vocabulary-selection label {
    color: #142b52;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
}

.vocabulary-selection select {
    width: 100%;
    padding: 12px;

    background: white;
    color: #142b52;

    border: 1px solid #b9c8e8;
    border-radius: 10px;

    font-size: 16px;
    cursor: pointer;
}

/* Game Over - Result Backgrounds */

#game-over #final-distance,
#game-over #final-score,
#game-over #final-xp,
#game-over #final-best-streak {
    display: block;
    width: fit-content;
    min-width: 230px;
    max-width: 100%;
    box-sizing: border-box;

    margin: 12px auto;
    padding: 12px 20px;

    background: #eef4ff;
    border: 1px solid #d5e3ff;
    border-radius: 12px;

    color: #102b5c;
    font-size: 19px;
    font-weight: 600;
    text-align: center;
}

/* Make the progress bar visible below game stats */

.game-stats .progress-track {
    flex: 0 0 100%;
    width: 100%;
    height: 14px;
    margin-top: 8px;
}

.game-stats #progress-fill {
    height: 100%;
}

/* Choose Another Topic Button */

#choose-topic {
    display: block;
    margin: 14px auto 0;
    padding: 13px 24px;

    background: #ffffff;
    color: #2563eb;

    border: 2px solid #2563eb;
    border-radius: 12px;

    font-size: 17px;
    font-weight: 600;
    cursor: pointer;

    transition: 0.2s ease;
}

#choose-topic:hover {
    background: #eff6ff;
    transform: translateY(-2px);
}

.runner-banner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 26px 32px;
    margin: 25px 0 35px;

    background: linear-gradient(110deg, #173b83, #2563eb);
    border-radius: 22px;
    color: white;
    text-decoration: none;

    box-shadow: 0 10px 28px rgba(37, 99, 235, 0.16);
    transition: transform 0.2s ease;
}

.runner-banner:hover {
    transform: translateY(-3px);
}

.runner-icon {
    font-size: 48px;
}

.runner-info {
    flex: 1;
}

.runner-info h2 {
    margin: 0 0 8px;
    color: white;
    font-size: 25px;
}

.runner-info p {
    margin: 0;
    color: #dbeafe;
    font-size: 16px;
}

.runner-play {
    background: white;
    color: #2563eb;
    padding: 13px 23px;
    border-radius: 12px;
    font-weight: bold;
    white-space: nowrap;
}

@media (max-width: 650px) {
    .runner-banner {
        flex-wrap: wrap;
        padding: 20px;
    }

    .runner-play {
        width: 100%;
        text-align: center;
    }
}

/* EnglishGlow Runner 3D - Background */


/* Background only before starting the game */
body {
    background-image: url("game-bg.svg");
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
}

/* Hide background during gameplay */
body.game-playing {
    background-image: none !important;
    background-color: #24272e;
}

/* White background for the game interface */
body:has(#game-container) {
    background-color: #ffffff;
}

/* Keep the 3D scene unchanged */
#game-container canvas {
    background: transparent;
}

/* EnglishGlow Runner 3D — responsive layout (no game logic changes) */
@media (max-width: 700px) {
    .game-header {
        padding: 16px 12px;
    }
    .game-header h1 {
        font-size: clamp(20px, 5vw, 27px);
        line-height: 1.3;
        margin: 10px 0 0;
    }
    .back-link {
        display: inline-block;
        padding: 6px 4px;
    }
    #game-menu, #game-over {
        width: calc(100% - 28px);
        max-width: 500px;
        margin: 24px auto;
        padding: 24px 18px;
    }
    #game-menu select, #game-menu button,
    .vocabulary-selection {
        max-width: 100%;
    }
    #game-menu select {
        width: 100%;
        min-height: 44px;
    }
    #start-game {
        width: 100%;
        min-height: 48px;
    }
    #game-screen {
        width: 100%;
        margin: 8px auto;
        padding: 10px;
    }
    .game-stats {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 12px;
        text-align: center;
        font-size: 14px;
    }
    .game-stats > span {
        min-width: 0;
        overflow-wrap: anywhere;
    }
    .game-stats .progress-track {
        grid-column: 1 / -1;
        width: 100%;
    }
    #game-container {
        height: clamp(270px, 48dvh, 460px);
        margin-top: 10px;
        border-radius: 12px;
    }
    .answer-panel {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-top: 12px;
    }
    .answer-panel input {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        min-height: 48px;
        font-size: 16px;
    }
    .answer-panel button {
        min-width: 0;
        min-height: 48px;
        padding: 10px;
    }
    #xp-display, #streak-display {
        position: static;
        display: inline-block;
        margin: 8px 0 0 8px;
        padding: 7px 10px;
        font-size: 14px;
        border-radius: 10px;
        box-shadow: none;
        vertical-align: middle;
    }
    #game-over #final-distance,
    #game-over #final-score,
    #game-over #final-xp,
    #game-over #final-best-streak {
        min-width: 0;
        width: 100%;
        font-size: 16px;
    }
    #game-over button {
        max-width: 100%;
        min-height: 46px;
    }
    body {
        background-attachment: scroll;
    }
}
@media (max-width: 360px) {
    .game-stats { font-size: 12px; gap: 7px; }
    #game-menu, #game-over { padding: 18px 12px; }
    #xp-display, #streak-display { font-size: 12px; padding: 6px 8px; }
}
