body {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px 0;
    background-color: #2c3e50;
    font-family: 'Arial', sans-serif;
    touch-action: manipulation;
}

#game-container {
    position: relative;
    width: 408px; /* 400px Canvas + 8px border */
    height: 500px;
    margin-top: 20px;
}

#game-board {
    width: 400px;
    height: 400px;
    border: 4px solid #e74c3c;
    border-radius: 8px;
}

.score, .difficulty {
    color: #ecf0f1;
    font-size: 18px;
    margin: 10px 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #e74c3c;
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    display: none;
    z-index: 3;
}

.difficulty-select, .start-game {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

button {
    padding: 10px 20px;
    font-size: 18px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    touch-action: manipulation;
}

button:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

#powerup-timer {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    z-index: 1;
}

#touch-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 400px;
    height: 400px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    pointer-events: none;
    z-index: 2;
    padding: 4px; /* Entspricht der Rahmenstärke */
}

.control-area {
    background: rgba(128, 128, 128, 0.1);
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.1s;
    border: 2px solid rgba(255, 255, 255, 0.1);
}


.control-area:active {
    background: rgba(128, 128, 128, 0.3);
}

#touch-up {
    grid-column: 2;
    grid-row: 1;
}

#touch-right {
    grid-column: 3;
    grid-row: 2;
}

#touch-down {
    grid-column: 2;
    grid-row: 3;
}

#touch-left {
    grid-column: 1;
    grid-row: 2;
}

.control-area::after {
    color: white;
    font-size: 32px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
}

#touch-up::after { content: '↑'; }
#touch-left::after { content: '←'; }
#touch-down::after { content: '↓'; }
#touch-right::after { content: '→'; }

/* Zentriertes leeres Feld */
#touch-controls > div:not(.control-area) {
    pointer-events: none;
}

#highscore-table {
    margin: 20px;
    color: #ecf0f1;
    width: 400px;
}

#highscore-table table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.3);
}

#highscore-table th, #highscore-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #34495e;
}

#highscore-table tr:hover {
    background: rgba(255, 255, 255, 0.1);
}

#game-over form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
}

#game-over input[type="text"] {
    padding: 8px;
    font-size: 16px;
    border-radius: 4px;
    border: 1px solid #3498db;
    background: rgba(255, 255, 255, 0.9);
}

.game-over-text {
    margin-bottom: 10px;
    display: block;
}

#highscore-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    min-width: 300px;
}

.trophy {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}