:root {
    --primary: #64748B;
    --secondary: #94A3B8;
    --accent: #38BDF8;
    --accent-glow: rgba(56, 189, 248, 0.2);
    --bg-dark: #0F1219;
    --bg-panel: #1A1E29;
    --bg-input: #232936;
    --text-main: #F8FAFC;
    --text-muted: #CBD5E1;
    --border: rgba(255, 255, 255, 0.1);
    --success: #10B981;

    --radius-sm: 8px;
    --radius-md: 12px;

    --font-sans: 'Inter', system-ui, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.sidebar-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-input);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.editor-pane {
    display: none;
    animation: fadeIn 0.2s ease;
}

.editor-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.modern-input,
.modern-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: white;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.modern-input.sm {
    padding: 0.4rem 0.6rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.modern-input:focus,
.modern-select:focus {
    outline: none;
    border-color: var(--accent);
}

.coord-inputs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

/* Canvas Visualizer */
.bezier-visualizer {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    position: relative;
}

canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    cursor: crosshair;
}

/* Presets */
.preset-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--secondary);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    border-color: var(--accent);
    color: white;
}

/* Sliders */
.slider-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modern-slider {
    flex-grow: 1;
    accent-color: var(--accent);
}

.slider-val {
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    width: 24px;
    text-align: right;
}

/* Footer Code Output */
.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-input);
}

.export-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--secondary);
    font-weight: 600;
}

.export-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

#css-output {
    display: block;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--accent);
    background: var(--bg-dark);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.helper-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

/* Main Workspace */
.workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at center, var(--bg-panel) 0%, var(--bg-dark) 100%);
}

.topbar {
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.global-controls {
    display: flex;
    gap: 2rem;
}

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

.control-group label {
    font-size: 0.85rem;
    color: var(--secondary);
    font-weight: 600;
}

.duration-control input {
    width: 150px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: var(--font-sans);
}

.primary-btn {
    background: var(--accent);
    color: var(--bg-dark);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.primary-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Previews */
.preview-area {
    flex-grow: 1;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    justify-content: center;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.track-container {
    width: 100%;
}

.track-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.track-header h3 {
    font-size: 1rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--accent);
    border: 1px solid var(--border);
    font-family: monospace;
}

.modern-select.sm {
    width: auto;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.track {
    height: 80px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.track-line {
    position: absolute;
    left: 20px;
    right: 20px;
    height: 1px;
    background: var(--border);
    z-index: 0;
}

.animator {
    position: absolute;
    left: 20px;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Starting defaults */
    transform: translateX(0);
}

.animator.primary {
    background: linear-gradient(135deg, var(--accent), #2563EB);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.animator.secondary {
    background: var(--primary);
    border: 2px solid var(--secondary);
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.tooltip:hover::after {
    opacity: 1;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: var(--bg-dark);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
    z-index: 1000;
    transition: all 0.3s;
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}