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

body {
    background: #0f172a;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#controls {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 24px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    width: 100%;
    z-index: 10;
    touch-action: manipulation;
}

#controls label {
    color: #94a3b8;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#controls label span {
    color: #e2e8f0;
    font-weight: 600;
    min-width: 20px;
}

#brush-slider {
    width: 120px;
    accent-color: #6366f1;
}

#clear-btn,
#undo-btn,
#fill-btn,
#toggle-path-btn {
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

#clear-btn:hover,
#undo-btn:hover,
#fill-btn:hover,
#toggle-path-btn:hover {
    background: #475569;
}

.instructions {
    color: #64748b;
    font-size: 13px;
    margin-left: auto;
}

#canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

canvas {
    display: block;
    cursor: crosshair;
    touch-action: none;
}

@media (max-width: 600px) {
    #controls {
        gap: 8px;
        padding: 8px 12px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    #controls > * {
        flex-shrink: 0;
    }

    #controls label {
        font-size: 12px;
        gap: 4px;
    }

    #brush-slider {
        width: 80px;
    }

    #clear-btn,
    #undo-btn,
    #toggle-path-btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    .instructions {
        display: none;
    }
}
