/* Grundlegende Stile */
body, html {
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: sans-serif;

    /* --- NEU: HINTERGRUNDBILD-STILE --- */
    background-image: url('background.png');
    background-size: cover;
    background-position: center center;
    background-repeat: repeat;
    /* Die alte Hintergrundfarbe wird durch das Bild ersetzt */
}

/* Spiel-Container */
#game-container {
    width: 100vw;
    height: calc(100vh - 200px);
    background-color: #000; /* Dieser schwarze Hintergrund überdeckt das Body-Bild */
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    border: 2px solid cyan;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Der Rest der Datei bleibt unverändert --- */

/* Styling für das Steuerkreuz-Layout */
#d-pad-controls {
    display: none; /* Standardmäßig auf Desktop versteckt */
    position: fixed;
    bottom: 30px;
    right: 30px;
    
    /* CSS Grid für die D-Pad-Form */
    display: grid;
    grid-template-columns: 60px 60px 60px;
    grid-template-rows: 60px 60px 60px;
    grid-template-areas:
        ". up ."
        "left . right"
        ". down .";
    gap: 5px; /* Kleiner Abstand zwischen den Tasten */
}

/* Weist die Buttons den Gitter-Bereichen zu */
#btn-up { grid-area: up; }
#btn-left { grid-area: left; }
#btn-right { grid-area: right; }
#btn-down { grid-area: down; }

.d-pad-button {
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(40, 40, 40, 0.7);
    color: white;
    font-size: 24px;
    border-radius: 10px;
    user-select: none; /* Verhindert Textmarkierung */
}
.d-pad-button:active {
    background: rgba(80, 80, 80, 0.9);
}


/* Media Query für mobile Geräte (Querformat) */
@media (max-width: 1024px) and (orientation: landscape) {
    #d-pad-controls {
        display: grid; /* Macht das D-Pad sichtbar */
    }
}

/* Media Query für Portrait-Modus */
@media (max-width: 800px) and (orientation: portrait) {
    #game-container {
       display: none;
    }
    body::after {
        content: "Bitte drehen Sie Ihr Gerät in den Querformat-Modus.";
        color: white;
        font-size: 1.2em;
        text-align: center;
        padding: 20px;
    }
}

/* Stile für das Highscore-Modal */
.modal-overlay {
    display: none; /* Standardmäßig versteckt */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.visible {
    display: flex; /* Sichtbar machen */
}

.modal-content {
    background: #2a2a2a;
    color: white;
    padding: 30px;
    border-radius: 10px;
    border: 2px solid cyan;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.7);
}

.modal-content h2 {
    margin-top: 0;
    color: cyan;
}

.modal-content input, .modal-content button {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    border: 1px solid #555;
    background: #333;
    color: white;
    font-size: 1em;
    box-sizing: border-box;
}

.modal-content button[type="submit"] {
    background: cyan;
    color: black;
    font-weight: bold;
    cursor: pointer;
}

.modal-content #close-modal {
    background: #555;
    cursor: pointer;
}