:root {
    --primary-color: #6a11cb;
    --secondary-color: #2575fc;
    --accent-color: #ff9a9e;
    --text-color: #ffffff;
    --bg-color: #1a1a1a;
    --font-pixel: 'Press Start 2P', cursive;
    --font-ui: 'Roboto', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-ui);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    touch-action: none; /* Prevent default touch actions like scrolling */
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); /* Deep blue gradient */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

canvas {
    display: block;
    image-rendering: pixelated; /* Crisp pixels */
    max-width: 100%;
    max-height: 100%;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas by default */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* UI Elements that need interaction */
.interactive {
    pointer-events: auto;
}

/* Premium UI Styles */
.btn {
    pointer-events: auto; /* Ensure buttons are clickable even in non-interactive containers */
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    padding: 12px 24px;
    font-family: var(--font-pixel);
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
    text-transform: uppercase;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.panel {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
}

.title {
    font-family: var(--font-pixel);
    font-size: 32px;
    text-align: center;
    color: var(--accent-color);
    text-shadow: 3px 3px 0px rgba(0,0,0,0.5);
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* HUD */
#hud {
    padding: 10px;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-pixel);
    font-size: 16px;
    text-shadow: 2px 2px 0 #000;
}

/* Editor Toolbar */
#editor-toolbar {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 2px solid var(--secondary-color);
}

.tool-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #555;
    background-color: #333;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 4px;
}

.tool-btn.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

/* Touch Controls */
#touch-controls {
    display: none; /* Hidden on desktop */
    position: absolute;
    bottom: 20px;
    width: 100%;
    height: 150px;
    pointer-events: none;
}

@media (hover: none) and (pointer: coarse) {
    #touch-controls {
        display: flex;
        justify-content: space-between;
        padding: 0 20px;
        box-sizing: border-box;
    }

    .d-pad, .action-btn {
        pointer-events: auto;
        background: rgba(255, 255, 255, 0.1);
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        backdrop-filter: blur(4px);
    }

    .d-pad {
        width: 120px;
        height: 120px;
        position: relative;
    }

    .action-btn {
        width: 80px;
        height: 80px;
        align-self: center;
        margin-bottom: 20px;
    }

    .action-btn:active, .d-pad:active {
        background: rgba(255, 255, 255, 0.3);
    }
}
