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

body {
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #fff;
}

#gradient-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}

/* UI Panel */
.panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.panel.open {
    transform: translateY(0);
}

.panel-handle {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.panel-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.4);
    transition: background 0.2s;
}

.panel-handle:hover::before {
    background: rgba(255, 255, 255, 0.7);
}

.panel-content {
    padding: 0 24px 24px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Sections */
.section {
    margin-bottom: 16px;
}

.section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 8px;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 2px;
    width: fit-content;
}

.mode-btn {
    padding: 6px 16px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Time Slider */
.time-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.time-label {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    min-width: 50px;
    color: rgba(255, 255, 255, 0.7);
}

/* Preset Buttons */
.preset-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 5px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.preset-btn.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* Color Stops */
.stops-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stop-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stop-color {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.stop-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.stop-color::-webkit-color-swatch {
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

.stop-pos {
    flex: 1;
}

.stop-pos-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    min-width: 32px;
    text-align: right;
}

.stop-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.stop-remove:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.add-stop-btn {
    padding: 6px 14px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    background: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    width: fit-content;
}

.add-stop-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.7);
}

/* Easing Select */
.easing-select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.easing-select option {
    background: #1a1a1a;
    color: #fff;
}

/* Export Row */
.export-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.export-btn {
    padding: 6px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.export-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.figma-btn {
    margin-top: 8px;
    width: 100%;
    border-style: dashed;
    color: rgba(255, 255, 255, 0.6);
    background: none;
    font-size: 12px;
}

.res-select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.res-select option {
    background: #1a1a1a;
    color: #fff;
}

/* Range Slider Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Top row layout */
.top-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.top-row .section {
    margin-bottom: 16px;
}

/* Play controls */
.play-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.play-btn {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 14px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.play-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.play-btn.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.speed-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

/* Bottom row layout */
.bottom-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.bottom-row .section {
    flex: 1;
    min-width: 200px;
}

/* Scroll hint */
.scroll-hint {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.25);
    pointer-events: none;
    transition: opacity 0.5s;
    z-index: 5;
}

/* Preset Editor */
.preset-edit-toggle-btn {
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: none;
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
}

.preset-edit-toggle-btn:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.6);
}

.preset-edit-toggle-btn.active {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
}

.preset-editor {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 300px;
    overflow-y: auto;
}

.preset-editor.visible {
    display: flex;
}

.preset-editor-header {
    display: flex;
    gap: 8px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 4px;
}

.preset-editor-header span:nth-child(1) { width: 110px; }
.preset-editor-header span:nth-child(2) { width: 55px; }
.preset-editor-header span:nth-child(3),
.preset-editor-header span:nth-child(4),
.preset-editor-header span:nth-child(5) { width: 28px; }
.preset-editor-header span:nth-child(6) { width: 24px; }

.preset-edit-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preset-name-input {
    width: 110px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
}

.preset-name-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.35);
}

.preset-hour-input {
    width: 55px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
    font-family: inherit;
}

.preset-hour-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.35);
}

/* Hide number input spinners */
.preset-hour-input::-webkit-inner-spin-button,
.preset-hour-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.preset-hour-input[type=number] {
    -moz-appearance: textfield;
}

.preset-color {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.preset-color::-webkit-color-swatch-wrapper { padding: 0; }
.preset-color::-webkit-color-swatch {
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.preset-delete-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.preset-delete-btn:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.preset-delete-btn:disabled {
    opacity: 0.2;
    cursor: default;
}

.preset-delete-btn:disabled:hover {
    color: rgba(255, 255, 255, 0.3);
    background: none;
}

.preset-add-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.preset-add-btn,
.preset-reset-btn {
    padding: 5px 12px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    background: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-add-btn:hover,
.preset-reset-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.7);
}

/* Image Upload */
.upload-btn {
    padding: 6px 14px;
    border: 1px dashed rgba(255, 255, 255, 0.25);
    background: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.8);
}

.image-result-area {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.image-result-area.visible {
    display: flex;
}

.image-preview-row {
    display: flex;
    gap: 6px;
}

.image-preview-swatch {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.image-mute-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-add-btn {
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    width: fit-content;
    transition: all 0.2s;
}

.upload-add-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}
