body {
    background-color: #1a1a1a;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    overflow: hidden;
}

#page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
    padding-top: 16px;
}

/* --- Header / Stats --- */

#header {
    text-align: center;
    margin-bottom: 10px;
}

#header h1 {
    font-size: 24px;
    margin: 0 0 8px 0;
    color: #FFD700;
    text-shadow: 2px 2px 0 #000;
    letter-spacing: 2px;
}

#stats-bar {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 13px;
    color: #ccc;
}

#stats-bar span {
    background: #2a2a2a;
    padding: 4px 12px;
    border: 1px solid #444;
    border-radius: 3px;
}

#header-best {
    color: #FFD700 !important;
}

/* --- Game Area --- */

#game-container {
    position: relative;
    border: 4px solid #555;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

canvas {
    display: block;
    background-color: #000;
}

/* --- Footer --- */

#footer {
    margin-top: 8px;
}

.link-btn {
    background: none;
    border: none;
    color: #888;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px 8px;
}

.link-btn:hover {
    color: #FFD700;
}

/* --- End-Game Overlay (inside game-container) --- */

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
}

.overlay h1 {
    font-size: 36px;
    margin: 0 0 12px 0;
    color: #FFD700;
    text-shadow: 2px 2px 0 #000;
}

.overlay p {
    font-size: 16px;
    margin: 4px 0;
    color: #ccc;
}

/* --- Modal (instructions / start) --- */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal {
    background: #2a2a2a;
    border: 3px solid #FFD700;
    border-radius: 8px;
    padding: 32px 48px;
    text-align: center;
    max-width: 420px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.15);
}

.modal h1 {
    font-size: 26px;
    margin: 0 0 4px 0;
    color: #FFD700;
    text-shadow: 2px 2px 0 #000;
}

.modal h2 {
    font-size: 14px;
    margin: 0 0 20px 0;
    color: #888;
    font-weight: normal;
}

.instructions {
    margin-bottom: 24px;
    line-height: 1.9;
    text-align: left;
}

.instructions p {
    margin: 0;
    font-size: 15px;
    color: #ccc;
}

.instructions .instructions-heading {
    font-size: 16px;
    font-weight: bold;
    color: #FFD700;
    margin-top: 12px;
}

.instructions .instructions-heading:first-child {
    margin-top: 0;
}

/* --- Shared Button Style --- */

.game-btn {
    font-family: 'Courier New', Courier, monospace;
    font-size: 20px;
    font-weight: bold;
    color: #000;
    background: #FFD700;
    border: none;
    padding: 12px 40px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 8px;
}

.game-btn:hover {
    background: #fff;
}

/* --- Mobile Shoot Button (hidden on desktop) --- */

#mobile-shoot-btn {
    display: none;
}

/* --- Mobile / Responsive Styles --- */

@media (max-width: 840px) {
    body {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    #page-wrapper {
        padding-top: 8px;
        height: auto;
        min-height: 100vh;
    }

    #header h1 {
        font-size: 16px;
        margin: 0 0 4px 0;
        letter-spacing: 1px;
    }

    #header {
        margin-bottom: 4px;
    }

    #stats-bar {
        font-size: 11px;
        gap: 4px;
        padding: 0 4px;
    }

    #stats-bar span {
        padding: 2px 6px;
    }

    #game-container {
        border-width: 2px;
        width: calc(100vw - 8px);
        max-width: 800px;
    }

    canvas {
        width: 100%;
        height: auto;
        touch-action: none;
    }

    .modal {
        padding: 20px 24px;
        max-width: 90vw;
        margin: 10px;
    }

    .modal h1 {
        font-size: 20px;
    }

    .modal h2 {
        font-size: 12px;
        margin: 0 0 12px 0;
    }

    .instructions p {
        font-size: 13px;
    }

    .instructions .instructions-heading {
        font-size: 14px;
    }

    .game-btn {
        font-size: 16px;
        padding: 10px 30px;
    }

    .overlay h1 {
        font-size: 24px;
    }

    .overlay p {
        font-size: 14px;
    }

    #footer {
        margin-top: 4px;
    }

    /* Mobile shoot button */
    #mobile-shoot-btn {
        display: block;
        font-family: 'Courier New', Courier, monospace;
        font-size: 18px;
        font-weight: bold;
        color: #000;
        background: #ff4444;
        border: 3px solid #cc0000;
        border-radius: 50%;
        width: 64px;
        height: 64px;
        cursor: pointer;
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-top: 8px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
    }

    #mobile-shoot-btn:active {
        background: #ff6666;
        transform: scale(0.95);
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    #header h1 {
        font-size: 13px;
    }

    #stats-bar {
        font-size: 10px;
        gap: 3px;
    }

    #stats-bar span {
        padding: 2px 4px;
    }

    #mobile-shoot-btn {
        width: 56px;
        height: 56px;
        font-size: 14px;
    }
}
