body {
    margin: 0;
    padding: 0;
    background-color: #2c1810;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

#game-container {
    width: 100%;
    max-width: 800px;
    height: 65vh;
    max-height: 600px;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    position: relative;
}

#controls-container {
    width: 100%;
    height: 35vh;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #3c2820;
    border-top: 4px solid #ffd700;
    padding: 10px 0;
    overflow: visible;
}

.controls-wrapper {
    position: relative;
    width: 160px;
    height: 160px;
    margin-bottom: 10px;
}

.d-pad {
    position: absolute;
    width: 50px;
    height: 50px;
    background: #ffd700;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #2c1810;
    font-weight: bold;
    font-size: 22px;
    user-select: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 2px solid #ffed4a;
    touch-action: manipulation;
}

.d-pad:active, .d-pad.active {
    transform: scale(0.95);
    background: #ffed4a;
}

.d-pad-up {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.d-pad-down {
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.d-pad-left {
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.d-pad-right {
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.d-pad-center {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #ffed4a;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

canvas {
    display: block;
    margin: auto;
}

.game-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    color: white;
    font-size: 24px;
    z-index: 1000;
}

.game-button {
    background: #ffd700;
    border: none;
    padding: 10px 20px;
    margin-top: 15px;
    border-radius: 5px;
    color: #2c1810;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-button:hover {
    background: #ffed4a;
    transform: scale(1.05);
}

.zoom-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    z-index: 100;
    pointer-events: none;
}

@media (max-height: 500px) {
    .controls-wrapper {
        width: 120px;
        height: 120px;
        margin-bottom: 5px;
    }
    .d-pad {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    #game-container {
        height: 60vh;
    }
    #controls-container {
        height: 40vh;
    }
}

@media (max-height: 400px) {
    .controls-wrapper {
        width: 100px;
        height: 100px;
    }
    .d-pad {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

@media (orientation: landscape) {
    body {
        flex-direction: row;
    }
    #game-container {
        height: 100vh;
        width: 70vw;
        max-width: none;
    }
    #controls-container {
        height: 100vh;
        width: 30vw;
        max-width: 200px;
        border-top: none;
        border-left: 4px solid #ffd700;
    }
}