* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a15;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Press Start 2P', monospace;
    overflow: hidden;
}

#game-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 10px;
}

#canvas {
    background: #1a1a2e;
    border: 4px solid #e94560;
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.5), inset 0 0 60px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

#ui-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

#ui-overlay button {
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #e94560;
    border-radius: 8px;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

#ui-overlay button:hover {
    background: #e94560;
    transform: scale(1.1);
}

#controls-overlay {
    display: none;
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    padding: 0 20px;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
}

.mobile-controls {
    pointer-events: auto;
}

.dpad {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 50px);
    gap: 4px;
}

.dpad-btn {
    width: 50px;
    height: 50px;
    background: rgba(0, 116, 217, 0.8);
    border: 2px solid #7FDBFF;
    border-radius: 8px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.dpad-btn.up { grid-column: 2; grid-row: 1; }
.dpad-btn.left { grid-column: 1; grid-row: 2; }
.dpad-btn.right { grid-column: 3; grid-row: 2; }
.dpad-btn.down { grid-column: 2; grid-row: 3; }

.dpad-btn:active {
    background: #7FDBFF;
    transform: scale(0.95);
}

.mobile-controls.right {
    display: flex;
    gap: 10px;
    flex-direction: row;
    align-items: center;
}

.action-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.action-btn.punch {
    background: rgba(233, 69, 96, 0.8);
    border-color: #FF851B;
}

.action-btn.kick {
    background: rgba(46, 204, 64, 0.8);
    border-color: #3D9970;
}

.action-btn.special {
    background: rgba(177, 13, 201, 0.8);
    border-color: #F012BE;
    width: 70px;
    height: 70px;
}

.action-btn:active {
    transform: scale(0.9);
    filter: brightness(1.3);
}

footer {
    text-align: center;
    padding: 10px;
    color: #7FDBFF;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.5);
}

footer a {
    color: #e94560;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    #canvas {
        border-width: 2px;
    }
    
    .dpad {
        grid-template-columns: repeat(3, 40px);
        grid-template-rows: repeat(3, 40px);
    }
    
    .dpad-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .action-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .action-btn.special {
        width: 55px;
        height: 55px;
    }
    
    #ui-overlay {
        top: 10px;
        right: 10px;
    }
    
    #ui-overlay button {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

@media (max-height: 500px) {
    #controls-overlay {
        bottom: 20px;
    }
    
    .dpad {
        grid-template-columns: repeat(3, 35px);
        grid-template-rows: repeat(3, 35px);
    }
    
    .dpad-btn {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
    
    .action-btn {
        width: 45px;
        height: 45px;
    }
}