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

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #2d3748;
    display: flex;
    gap: 20px;
}

.palette-panel {
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    height: fit-content;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.palette-panel.collapsed {
    transform: translateX(-240px);
    opacity: 0.7;
}

/* hidden on desktop */
.panel-toggle {
    display: none;
}

.palette-section {
    margin-bottom: 25px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e2e8f0;
}

.palette-button {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-weight: 500;
    color: #475569;
}

.palette-button:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateX(5px);
}

.palette-button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.container {
    flex: 1;
    max-width: 1380px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    margin: 0;
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.control-group {
    background: #f8fafc;
    padding: 20px;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
}

.control-group h3 {
    margin-bottom: 15px;
    color: #1e293b;
    font-weight: 600;
}

.control-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.control-row:last-child {
    margin-bottom: 0;
}

label {
    min-width: 80px;
    font-weight: 500;
    color: #475569;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

input[type="number"] {
    width: 40px;
    max-width: 50px;
    padding: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-align: center;
    background: white;
    flex-shrink: 0;
    appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.color-space-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.toggle-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.toggle-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.generate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease;
    margin-bottom: 15px;
}

.export-controls {
    background: #f8fafc;
    padding: 10px;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.export-btn {
    padding: 10px 16px;
    background: white;
    color: #475569;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.export-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.color-swatch {
    aspect-ratio: 1;
    border-radius: 15px;
    display: flex;
    align-items: end;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.color-swatch:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.color-label {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 8px;
    transition: opacity 0.3s ease;
}

.color-swatch:hover .color-label {
    opacity: 0.9;
}

.info-panel {
    background: #f1f5f9;
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
    border-left: 4px solid #667eea;
}

.info-panel h4 {
    margin-bottom: 10px;
    color: #1e293b;
}

.info-panel p {
    color: #64748b;
    line-height: 1.6;
}

.copied-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    transform: translateX(300px);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.copied-toast.show {
    transform: translateX(0);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 900;
}

.overlay.show {
    opacity: 1;
    pointer-events: auto;
}


/* Mobile/tablet drawer style */
@media (max-width: 1024px) {
    .palette-panel {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 320px;
        height: 100%;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
        border-radius: 0;
        padding: 20px;
        overflow-y: auto;
        transition: left 0.3s ease;
        z-index: 1000;
    }

    .palette-panel.show {
        left: 0;
    }

    .panel-toggle {
        display: block;
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: darkgrey;
        border: none;
        position: fixed;
        top: 25px;
        left: 15px;
        border-radius: 50%;
        width: 48px;
        height: 48px;
        font-size: 20px;
        line-height: 48px;
        text-align: center;
        cursor: pointer;
        z-index: 999;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        opacity: 80%;
    }

    .panel-toggle.hide {
        display: none;
    }

    .generate-btn {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 500;
    }

    .color-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
        margin-bottom: 15px;
    }
}
