/* --- SHADED UNIVERSE: GAME STYLE (BALANCED LAYOUT) --- */
body {
    background-color: #004400;
    background-image: radial-gradient(circle, #005500 0%, #003300 100%);
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    color: white;
    overflow: hidden; 
    display: flex;
    justify-content: center;
    align-items: center;
}

#layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    padding: 15px; /* Gleichmäßiger Puffer rundherum */
    gap: 30px; 
}

/* --- LANDSCAPE: OPTIMIERTE VERTEILUNG --- */
@media (orientation: landscape) {
    #layout {
        flex-direction: row; 
        justify-content: center; /* Zentriert die gesamte Gruppe */
        align-items: center;
        padding-left: 20px; /* Rand links reduziert */
        padding-right: 20px; /* Rand rechts vergrößert */
    }

    #side {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start; 
        flex: 0 0 260px; /* Feste Breite für Steuerung */
    }

    #title {
        font-size: 44px; 
        margin-bottom: 25px;
        text-align: left;
        width: 100%;
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    }
}

/* --- SPIELFELD (MAXIMIERT & GEPUFFERT) --- */
#game-container {
    flex: 1; 
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding-right: 10px; /* Zusätzlicher Schutzabstand nach rechts */
}

#gameCanvas {
    background: rgba(0,0,0,0.3);
    border: 4px solid rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.15);
    
    max-width: 100%;
    max-height: 92vh; /* Etwas Puffer für oben/unten */
    width: auto;
    height: auto;
    object-fit: contain;
}

/* --- BUTTON GRID --- */
#controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
}

.icon-btn, #controls button {
    width: 100%; 
    height: 55px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #003300;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    cursor: pointer;
    font-weight: bold;
    color: #003300;
    font-size: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* URKNALL: Volle Breite */
#urknallBtn, .urknall-btn {
    grid-column: span 2;
    border-color: #c0392b; 
    color: #c0392b;
    text-transform: uppercase;
}

/* RESET: Normale Breite */
#resetBtn, .reset-btn {
    grid-column: span 1;
}

.icon-btn:active, #controls button:active {
    transform: scale(0.94);
}

/* Portrait-Anpassung */
@media (orientation: portrait) {
    #layout { flex-direction: column; padding: 15px; align-items: center; justify-content: flex-start; }
    #side { align-items: center; flex: none; margin-bottom: 20px; }
    #title { text-align: center; font-size: 28px; margin-bottom: 10px; }
    #gameCanvas { max-height: 55vh; }
}