@import url('https://fonts.googleapis.com/css2?family=General+Sans:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=swap');

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'General Sans', sans-serif;
    background-color: #FDFDFD;
    color: #444444;
}

main {
    width: 100vw;
    height: 100vh;
    position: relative;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    display: block;
    z-index: 1;
    cursor: default;
}

canvas.drawing-cursor {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pencil"><path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/></svg>') 12 12, auto;
}

/* Controls Container - Responsive Design */
#controls {
    position: absolute;
    top: 2rem;
    left: 1rem;
    right: 1rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 1rem;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: flex-start;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Control Group Styling */
#controls > div {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 0 0 auto;
}

#controls > div label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

/* Slider and Value Display */
#controls > div input[type=range] {
    width: 100px;
    margin-bottom: 0.5rem;
}

#controls > div span {
    font-size: 0.85rem;
    font-weight: 300;
    color: #444444;
    min-height: 1.2em;
}

/* Colour Palette Select - Make it distinct */
#paletteSelect {
    background: linear-gradient(135deg, #FFC500 0%, #FFD700 100%);
    color: #444444;
    border: 2px solid #FFC500;
    font-weight: 300;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Input Range - Touch-friendly */
input[type=range] {
    accent-color: #FFC500;
    width: 130px;
    height: 8px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #FFC500;
    cursor: pointer;
    border: 2px solid #FFC500;
    transition: all 0.2s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type=range]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #FFC500;
    cursor: pointer;
    border: 2px solid #FFC500;
    transition: all 0.2s ease;
}

input[type=range]::-moz-range-thumb:hover {
    transform: scale(1.2);
}

input[type=range]::-webkit-slider-runnable-track {
    background: #ffe066;
    height: 6px;
    border-radius: 3px;
    border: none;
}

input[type=range]::-moz-range-track {
    background: #ffe066;
    height: 6px;
    border-radius: 3px;
    border: none;
}

input[type=range]:focus {
    outline: none;
}

/* Toggle UI Button - Mobile only */
#toggle-ui-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 20;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #FFC500;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: none !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: #444444;
    padding: 0;
    line-height: 1;
}

/* Hidden elements */
#flowAngle-group,
#lineThickness-group,
#upload-svg-input {
    display: none !important;
}

/* Buttons */
button {
    font-family: 'General Sans', sans-serif;
    font-size: 0.9rem;
    color: #444444;
    background: none;
    border: 1px solid #444444;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background: #f0f0f0;
}

button:active {
    background: #e0e0e0;
}

/* Selects */
select {
    font-family: 'General Sans', sans-serif;
    font-size: 0.9rem;
    color: #444444;
    background: white;
    border: 1px solid #444444;
    padding: 0.5rem 0.8rem;
    border-radius: 0.5rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    padding-right: 2rem;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="2"><polyline points="1 4 6 9 11 4"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}

select:hover {
    background-color: #f0f0f0;
}

select:focus {
    outline: none;
    border-color: #FFC500;
}

/* File Input */
input[type=file] {
    cursor: pointer;
}

/* SVG Overlay */
#svg-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: none;
}

/* Mobile-specific tweaks */
@media (max-width: 600px) {
    #controls {
        left: 0.75rem;
        right: 0.75rem;
        padding: 1rem;
        gap: 1rem;
        top: 0.75rem;
    }
    
    #controls > div {
        flex: 0 1 calc(50% - 0.5rem);
        min-width: 140px;
    }
    
    #controls > div input[type=range] {
        width: 90px;
        margin-bottom: 0.75rem;
    }
    
    #controls > div span {
        font-size: 0.8rem;
    }
    
    button, select {
        min-height: 40px;
        font-size: 0.85rem;
    }
    
    input[type=range]::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
    }
    
    input[type=range]::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }
    
    #toggle-ui-button {
        display: flex !important;
    }
    
    #toggle-ui-button:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    }
    
    #toggle-ui-button:active {
        transform: scale(0.95);
    }
}

/* Tablet portrait (600px - 900px) */
@media (min-width: 601px) and (max-width: 900px) {
    #controls {
        left: 1rem;
        right: 1rem;
        padding: 1.25rem;
        gap: 1.25rem;
    }
    
    #controls > div {
        flex: 0 1 auto;
    }
    
    #controls > div input[type=range] {
        width: 110px;
    }
    
    button, select {
        min-height: 42px;
        font-size: 0.9rem;
    }
}

/* Desktop (900px and above) */
@media (min-width: 901px) {
    #controls {
        left: 2rem;
        right: 2rem;
        padding: 1.5rem 2rem;
        gap: 1.5rem;
    }
    
    #controls > div {
        flex: 0 1 auto;
    }
    
    #controls > div input[type=range] {
        width: 120px;
    }
    
    button {
        font-size: 1rem;
        padding: 0.4rem 0.8rem;
        min-height: auto;
    }
    
    select {
        font-size: 1rem;
        min-height: auto;
    }
}

/* Landscape mode adjustments */
@media (max-height: 500px) {
    #controls {
        top: 0.5rem;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
        max-height: 95vh;
    }
    
    #controls label {
        font-size: 0.75rem;
    }
    
    button, select {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
        min-height: 36px;
    }
    
    input[type=range] {
        width: 100px;
    }
}
