:root {
    /* Ocean Deep Palette */
    --bg-page: #0A0F1A;
    --bg-panel: rgba(15, 23, 42, 0.7);
    --bg-surface: rgba(30, 41, 59, 0.8);
    --bg-hover: rgba(51, 65, 85, 0.8);
    
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    
    --border-color: rgba(51, 65, 85, 0.5);
    --border-light: rgba(255, 255, 255, 0.05);
    
    --primary: #3B82F6; /* Blue 500 */
    --primary-hover: #2563EB;
    --primary-glow: rgba(59, 130, 246, 0.5);
    
    --secondary: #60A5FA; /* Blue 400 */
    --accent: #F97316; /* Orange 500 */
    --accent-glow: rgba(249, 115, 22, 0.5);
    
    --success: #10B981;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(249, 115, 22, 0.05) 0%, transparent 40%);
}

/* Utilities */
.hide { display: none !important; }

/* Layout */
.app-container {
    width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.5rem;
    display: flex; flex-direction: column; gap: 1.5rem; height: 100vh;
}

/* Glass panel */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    position: relative; overflow: hidden;
}

/* Header */
.app-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.5rem; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 1rem; }
.logo {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white;
}
.title-group h1 { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.badge { background: var(--bg-surface); color: var(--secondary); padding: 0.15rem 0.5rem; border-radius: 99px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border: 1px solid var(--border-color);}

/* Buttons */
.btn {
    display: inline-flex; justify-content: center; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1.2rem; border-radius: var(--radius-md); font-size: 0.9rem; font-weight: 600; font-family: inherit;
    border: 1px solid transparent; cursor: pointer; transition: all 0.2s;
}
.btn i { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; border: none; box-shadow: 0 2px 10px var(--primary-glow); }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 15px var(--primary-glow); }

.icon-btn {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md); border: none; background: transparent; color: var(--text-secondary);
    cursor: pointer; transition: 0.2s;
}
.icon-btn i { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn.active { color: var(--primary); background: var(--bg-surface); }

/* Workspace Split View */
.workspace {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; flex: 1; min-height: 0;
}

.panel {
    border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden;
}

.editor-panel {
    display: flex; flex-direction: column;
}

.controls-container {
    display: flex; flex-direction: column; gap: 1.5rem;
}

.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color);
}
.panel-header h2 { font-size: 1rem; font-weight: 600; }
.view-toggles { display: flex; gap: 0.25rem; background: var(--bg-surface); border-radius: var(--radius-md); padding: 0.25rem; }

.panel-body { flex: 1; overflow: auto; padding: 1.5rem; }

/* Canvas Area */
.canvas-container {
    display: flex; justify-content: center; align-items: center;
    background: rgba(0,0,0,0.2); position: relative;
    padding: 2rem;
}

.curve-canvas {
    width: 100%; aspect-ratio: 1/1; max-width: 400px;
    overflow: visible; cursor: crosshair; touch-action: none;
}

.grid-line {
    stroke: var(--border-color); stroke-width: 1; stroke-dasharray: 2 2;
}

.handle-line { stroke: var(--text-muted); stroke-width: 1.5; }
.curve-path { stroke: var(--primary); stroke-width: 4; fill: none; transition: d 0.05s linear; }

.anchor-point { fill: var(--text-primary); }

.handle-point {
    fill: var(--text-primary); stroke: var(--primary); stroke-width: 2;
    cursor: grab; transition: transform 0.1s;
}
.handle-point:hover { transform: scale(1.5); fill: var(--accent); stroke: var(--accent); }
.handle-point:active { cursor: grabbing; transform: scale(1.2); }

/* Steps Config Area */
.steps-container {
    display: flex; flex-direction: column; gap: 1rem; justify-content: center; align-items: center;
    background: rgba(0,0,0,0.2);
}
.steps-config {
    width: 100%; max-width: 300px; background: var(--bg-surface); padding: 1.5rem; border-radius: var(--radius-md);
    border: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 1rem;
}

.panel-footer {
    padding: 1.5rem; border-top: 1px solid var(--border-color); background: var(--bg-surface);
    display: flex; justify-content: center;
}

.css-output {
    font-family: var(--font-mono); font-size: 1.2rem; color: var(--accent);
    background: var(--bg-page); padding: 0.75rem 1.5rem; border-radius: var(--radius-md);
    border: 1px solid var(--border-color); word-break: break-all; text-align: center; width: 100%;
}


/* Preview Area */
.preview-panel { flex: 1; }
.track-row { margin-bottom: 1.5rem; }
.track-row:last-child { margin-bottom: 0; }
.track-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; text-transform: uppercase; font-weight: 600; }
.track {
    width: 100%; height: 40px; background: var(--bg-page); border-radius: var(--radius-lg);
    border: 1px solid var(--border-color); position: relative; overflow: hidden;
}
.ball {
    width: 38px; height: 38px; border-radius: 50%; position: absolute; top: 0; left: 0;
}
.custom-ball { background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: 0 0 15px var(--primary-glow); }
.compare-ball { background: var(--bg-surface); border: 2px solid var(--text-muted); }

/* Running animation class added via JS */
.running .custom-ball { animation: slide var(--duration, 1s) forwards; animation-timing-function: var(--easing, linear); }
.running .linear-compare { animation: slide var(--duration, 1s) forwards; animation-timing-function: linear; }
.running .ease-compare { animation: slide var(--duration, 1s) forwards; animation-timing-function: var(--compare-easing, ease); }

@keyframes slide {
    0% { left: 0; }
    100% { left: calc(100% - 38px); }
}


/* Settings Area */
.settings-panel { flex: 1; }
.settings-group { margin-bottom: 1.5rem; }
.settings-group:last-child { margin-bottom: 0; }
.settings-group label { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--text-secondary); }

select {
    width: 100%; padding: 0.75rem; border-radius: var(--radius-md); background: var(--bg-page);
    border: 1px solid var(--border-color); color: var(--text-primary); font-family: inherit; font-size: 0.9rem; outline: none;
    appearance: none;
}
select:focus { border-color: var(--primary); }

input[type="range"] {
    width: 100%; height: 6px; background: var(--bg-page); border-radius: var(--radius-md);
    outline: none; -webkit-appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%; background: var(--primary);
    cursor: pointer; transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

input[type="number"] {
    width: 100%; padding: 0.75rem; border-radius: var(--radius-md); background: var(--bg-page);
    border: 1px solid var(--border-color); color: var(--text-primary); font-family: var(--font-mono); outline: none;
}

.input-group { display: flex; flex-direction: column; gap: 0.5rem; }

/* Preset Grid */
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.preset-btn {
    padding: 0.5rem; background: var(--bg-page); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); color: var(--text-secondary); font-size: 0.8rem; font-family: var(--font-mono);
    cursor: pointer; transition: 0.2s;
}
.preset-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--primary); }

/* Toasts */
.toast {
    position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--text-primary); color: var(--bg-page); padding: 0.75rem 1.5rem; border-radius: 99px;
    font-weight: 600; font-size: 0.9rem; box-shadow: var(--shadow-md); z-index: 2000;
    opacity: 0; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

@media (max-width: 900px) {
    .workspace { grid-template-columns: 1fr; }
    .panel { min-height: 400px; }
    .preset-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 500px) {
    .preset-grid { grid-template-columns: repeat(2, 1fr); }
}
