* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgb(20, 20, 20);
    /* Match Pygame's (20,20,20) */
    font-family: 'Inter', sans-serif;
    color: white;
    touch-action: none;
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

#uiPanel {
    position: absolute;
    top: 80px;
    /* Shifted down for framework Top Bar */
    left: 20px;
    padding: 24px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    /* Let clicks pass through */
    min-width: 280px;
    transition: all 0.3s ease;
    z-index: 10;
}

#uiPanel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-20px);
}

#uiPanel h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #fff, #9ca3af);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats {
    margin-bottom: 16px;
    font-size: 0.95rem;
    font-family: monospace;
    color: #e5e7eb;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stats p {
    margin: 4px 0;
    display: flex;
    justify-content: space-between;
}

.controls {
    font-size: 0.85rem;
    color: #9ca3af;
}

.hide-mobile {
    margin-bottom: 12px;
    line-height: 1.4;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    pointer-events: auto;
    /* Buttons are clickable */
}

.action-buttons button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.action-buttons button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.action-buttons button:active {
    transform: scale(0.95);
}

.action-buttons button.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

.slider-group {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
    /* Allow slider interaction */
}

.slider-group label {
    font-size: 0.85rem;
    color: #e5e7eb;
}

.slider-group input[type="range"] {
    width: 100%;
    cursor: pointer;
}

#btnClear {
    pointer-events: auto;
    /* Allow clear button interaction */
}

.toggle-ui-btn {
    display: none;
    position: absolute;
    bottom: 30px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    /* Flex center */
    align-items: center;
    justify-content: center;
}

/* Mobile responsivness */
@media (max-width: 600px) {
    #uiPanel {
        top: 130px;
        left: 10px;
        right: 10px;
        min-width: 0;
        padding: 16px;
    }

    .hide-mobile {
        display: none;
    }

    .action-buttons {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }

    .action-buttons button {
        padding: 6px 2px;
        font-size: 0.7rem;
    }
}