* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    background: #1a1a2e;
    font-family: monospace;
}

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Game screen area */
#game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    width: 100%;
    background: #2d3a1a;
    border-bottom: 3px solid #111;
    min-height: 0;
}

canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #c7f0d8;
}

/* Controls area */
#controls {
    width: 100%;
    height: 180px;
    min-height: 180px;
    background: #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
}

/* D-Pad */
.d-pad {
    width: 130px;
    height: 130px;
    position: relative;
}

.d-btn {
    position: absolute;
    width: 42px;
    height: 42px;
    background: #444;
    border: 2px solid #555;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #aaa;
    font-size: 18px;
    font-weight: bold;
    transition: background 0.05s;
}

.d-btn.active {
    background: #666;
    border-color: #888;
}

.d-btn.up    { top: 0;    left: 44px; }
.d-btn.down  { bottom: 0; left: 44px; }
.d-btn.left  { top: 44px; left: 0; }
.d-btn.right { top: 44px; right: 0; }

/* Action buttons */
.action-btns {
    display: flex;
    gap: 16px;
    align-items: center;
}

.action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    border: 2px solid rgba(255,255,255,0.2);
    transition: background 0.05s;
}

.action-btn.fire {
    background: #c0392b;
}
.action-btn.fire.active {
    background: #e74c3c;
}

.action-btn.special {
    background: #2980b9;
}
.action-btn.special.active {
    background: #3498db;
}

.action-btn.enter-btn {
    background: #27ae60;
}
.action-btn.enter-btn.active {
    background: #2ecc71;
}

/* Landscape mode */
@media (orientation: landscape) and (max-height: 500px) {
    #app {
        flex-direction: row;
    }

    #game-container {
        flex: 1;
        height: 100%;
        border-bottom: none;
        border-right: 3px solid #111;
        border-left: 3px solid #111;
        order: 1;
    }

    #controls {
        width: auto;
        height: 100%;
        min-height: unset;
        flex-direction: column;
        padding: 10px;
        order: 2;
    }

    .d-pad {
        width: 110px;
        height: 110px;
    }

    .d-btn {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .d-btn.up    { left: 38px; }
    .d-btn.down  { left: 38px; }
    .d-btn.right { right: 0; }

    .action-btns {
        flex-direction: column;
        gap: 10px;
    }

    .action-btn {
        width: 48px;
        height: 48px;
        font-size: 11px;
    }
}

/* Loading screen */
#loading {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #c7f0d8;
    font-size: 18px;
    z-index: 100;
}

#loading.hidden {
    display: none;
}
