body {
    margin: 0;
    overflow: hidden;
    background: #1a1a1a;
    font-family: Arial, sans-serif;
}

canvas {
    display: block;
    touch-action: none;
}

#controls {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 50px;
    display: flex;
    gap: 20px;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 100;
}

.color-picker {
    display: flex;
    gap: 10px;
}

.color-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #000;
}

.tool-controls {
    display: flex;
    gap: 10px;
    border-left: 2px solid rgba(0,0,0,0.1);
    padding-left: 20px;
}

.tool-controls button {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #333;
    transition: background 0.2s, transform 0.2s;
}

.tool-controls button:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.tool-controls button.active {
    background: #333;
    color: white;
}

.instrument-select {
    height: 40px;
    width: 120px;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 0 30px 0 15px;
    margin: 0 5px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    transition: border-color 0.2s;
}

.instrument-select:hover {
    border-color: #999;
}

/* Touch optimizations */
.color-btn {
    width: 40px; /* Larger touch target */
    height: 40px;
    margin: 0 5px;
}

.tool-controls button {
    width: 40px; /* Larger touch target */
    height: 40px;
}

#sizeSlider input[type="range"] {
    width: 200px;
    height: 30px; /* Larger touch target */
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

#sizeSlider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 30px;
    width: 30px;
    border-radius: 50%;
    background: #6c4eff;
    cursor: pointer;
    margin-top: -10px;
}

#sizeSlider input[type="range"]::-webkit-slider-runnable-track {
    height: 10px;
    background: #ddd;
    border-radius: 5px;
}

/* Save feedback toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
}

#instructions {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    text-align: center;
    pointer-events: none;
    z-index: 10;
    opacity: 1;
    transition: opacity 1s;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Size slider popup */
#sizeSlider {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 10px;
    border-radius: 8px;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 101;
}

#sizeSlider.show {
    display: flex;
}