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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0f0d;
    font-family: 'Press Start 2P', monospace;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: calc(100vh - 40px);
    padding: 10px;
    gap: 10px;
}

#canvas {
    background: #0d1912;
    border: 4px solid #2d4a3e;
    border-radius: 4px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    box-shadow: 
        0 0 20px rgba(45, 74, 62, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
}

#touch-controls {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 640px;
    padding: 10px;
    gap: 20px;
}

#dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.dpad-row {
    display: flex;
    gap: 8px;
}

.dpad-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, #2d4a3e, #1a2f26);
    border: 3px solid #4ade80;
    border-radius: 12px;
    color: #4ade80;
    font-size: 24px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    box-shadow: 
        0 4px 0 #1a2f26,
        0 0 10px rgba(74, 222, 128, 0.3);
}

.dpad-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1a2f26;
    background: #4ade80;
    color: #0a0f0d;
}

#action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.action-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    font-weight: bold;
    cursor: pointer;
    border: 3px solid;
    transition: all 0.1s;
}

/* FIXED: Prominent JUMP button */
.action-btn.jump {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    border-color: #86efac;
    color: #ffffff;
    box-shadow: 0 4px 0 #15803d, 0 0 20px rgba(34, 197, 94, 0.5);
    font-size: 7px;
}

.action-btn.attack {
    background: linear-gradient(145deg, #ef4444, #b91c1c);
    border-color: #fca5a5;
    color: #ffffff;
    box-shadow: 0 4px 0 #991b1b, 0 0 15px rgba(239, 68, 68, 0.4);
}

.action-btn.grab {
    background: linear-gradient(145deg, #a855f7, #7c3aed);
    border-color: #d8b4fe;
    color: #ffffff;
    box-shadow: 0 4px 0 #6b21a8, 0 0 15px rgba(168, 85, 247, 0.4);
}

.action-btn.throw {
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    border-color: #93c5fd;
    color: #ffffff;
    box-shadow: 0 4px 0 #1e40af, 0 0 15px rgba(59, 130, 246, 0.4);
}

.action-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 currentColor;
}

#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 8px;
    background: #0a0f0d;
    color: #4ade80;
    font-size: 10px;
    border-top: 2px solid #2d4a3e;
}

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

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

/* Desktop: hide touch controls if mouse is primary */
@media (hover: hover) and (pointer: fine) {
    #touch-controls {
        opacity: 0.6;
    }
    
    #touch-controls:hover {
        opacity: 1;
    }
}

/* Small screens */
@media (max-width: 480px) {
    .dpad-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
    
    .action-btn {
        width: 50px;
        height: 50px;
        font-size: 6px;
    }
    
    .action-btn.jump {
        font-size: 6px;
    }
    
    #touch-controls {
        padding: 5px;
        gap: 10px;
    }
}

/* Landscape orientation */
@media (orientation: landscape) and (max-height: 500px) {
    #game-wrapper {
        flex-direction: row;
        padding: 5px;
    }
    
    #touch-controls {
        flex-direction: column;
        width: auto;
        max-width: none;
        height: 100%;
        justify-content: center;
    }
    
    .dpad-btn {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .action-btn {
        width: 45px;
        height: 45px;
        font-size: 6px;
    }
}