/* Reset und Basis-Styles */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    background: #2c2c2c;
    font-family: Arial, sans-serif;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    -webkit-overflow-scrolling: touch;
}

#gameContainer {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
}

#info {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    text-align: center;
    font-size: 12px;
    line-height: 1.2;
    flex-shrink: 0;
}

#info h2 {
    margin: 0;
    font-size: 16px;
}

#info p {
    margin: 2px 0;
}

canvas {
    display: block;
    background: #000;
    flex: 1;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
}

#controls {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px;
    text-align: center;
    font-size: 10px;
    line-height: 1.1;
    flex-shrink: 0;
}

#controls p {
    margin: 2px 0;
}

/* Mobile Touch Controls */
.mobile-controls {
    background: rgba(0, 0, 0, 0.9);
    padding: 10px 5px;
    flex-shrink: 0;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
}

.control-group {
    display: flex;
    gap: 8px;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #555;
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    color: white;
    font-size: 20px;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.1s ease;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:active,
.control-btn.active {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    transform: scale(0.95);
    border-color: #777;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.movement-btn {
    background: linear-gradient(145deg, #2a4a2a, #1a3a1a);
    border-color: #4a7a4a;
}

.movement-btn:active,
.movement-btn.active {
    background: linear-gradient(145deg, #3a5a3a, #2a4a2a);
    border-color: #5a8a5a;
}

.jump-btn {
    background: linear-gradient(145deg, #4a4a2a, #3a3a1a);
    border-color: #7a7a4a;
    width: 60px;
    height: 60px;
    font-size: 24px;
}

.jump-btn:active,
.jump-btn.active {
    background: linear-gradient(145deg, #5a5a3a, #4a4a2a);
    border-color: #8a8a5a;
}

.shoot-btn {
    background: linear-gradient(145deg, #4a2a2a, #3a1a1a);
    border-color: #7a4a4a;
    width: 60px;
    height: 60px;
    font-size: 22px;
}

.shoot-btn:active,
.shoot-btn.active {
    background: linear-gradient(145deg, #5a3a3a, #4a2a2a);
    border-color: #8a5a5a;
}

.speech-btn {
    background: linear-gradient(145deg, #2a2a4a, #1a1a3a);
    border-color: #4a4a7a;
    width: 40px;
    height: 40px;
    font-size: 16px;
}

.speech-btn:active,
.speech-btn.active {
    background: linear-gradient(145deg, #3a3a5a, #2a2a4a);
    border-color: #5a5a8a;
}

/* Desktop Responsiveness - nur auf echten Desktop-Geräten anwenden */
@media (min-width: 1024px) and (pointer: fine) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: auto;
        position: static;
    }

    #gameContainer {
        width: auto;
        height: auto;
        max-width: 1200px;
        max-height: 90vh;
    }

    canvas {
        width: 1200px;
        height: 700px;
        max-width: 1200px;
        max-height: 700px;
        border: 2px solid #444;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    }

    .mobile-controls {
        display: none;
    }

    #info,
    #controls {
        font-size: 14px;
    }

    #info h2 {
        font-size: 20px;
    }
}

/* Landscape Mobile Optimization */
@media (orientation: landscape) and (max-width: 768px) {

    #info,
    #controls {
        font-size: 10px;
        padding: 3px;
    }

    #info h2 {
        font-size: 14px;
    }

    .mobile-controls {
        height: 80px;
        padding: 5px;
    }

    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .jump-btn,
    .shoot-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    .speech-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

/* Very Small Screens */
@media (max-width: 480px) {
    .control-group {
        gap: 5px;
    }

    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }

    .jump-btn,
    .shoot-btn {
        width: 55px;
        height: 55px;
        font-size: 20px;
    }

    .speech-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}