:root {
    --primary: #0EA5E9;
    --primary-glow: rgba(14, 165, 233, 0.15);
    --secondary: #38BDF8;
    --accent: #A78BFA;
    --accent-glow: rgba(167, 139, 250, 0.15);
    --bg: #0C1222;
    --bg-card: #111827;
    --bg-input: #0D1526;
    --border: rgba(56, 189, 248, 0.1);
    --border-hover: rgba(56, 189, 248, 0.25);
    --text: #E2E8F0;
    --text-muted: #94A3B8;
    --text-dim: #64748B;
    --success: #10B981;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --glass: rgba(17, 24, 39, 0.7);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    background-image: radial-gradient(ellipse at 30% 0%, rgba(14, 165, 233, 0.06) 0%, transparent 60%), radial-gradient(ellipse at 70% 100%, rgba(167, 139, 250, 0.04) 0%, transparent 60%)
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border)
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.logo-group {
    display: flex;
    align-items: center;
    gap: .75rem
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0
}

.logo-title {
    font-size: 1.125rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

.logo-subtitle {
    font-size: .75rem;
    color: var(--text-dim)
}

.header-actions {
    display: flex;
    align-items: center;
    gap: .75rem
}

.preset-select {
    padding: .4rem .75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: var(--font);
    font-size: .8125rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .5rem center;
    padding-right: 1.75rem
}

.preset-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow)
}

.preset-select option,
.preset-select optgroup {
    background: var(--bg-card);
    color: var(--text)
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
    border: none;
    font-family: var(--font);
    font-size: .8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border)
}

.btn-ghost:hover {
    background: var(--primary-glow);
    color: var(--primary);
    border-color: rgba(14, 165, 233, 0.3)
}

.btn-accent {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(167, 139, 250, 0.25)
}

.btn-accent:hover {
    background: rgba(167, 139, 250, 0.2)
}

.btn-sm {
    padding: .325rem .625rem;
    font-size: .75rem
}

.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem
}

.layout-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.5rem
}

.controls-col {
    display: flex;
    flex-direction: column;
    gap: 1rem
}

.preview-col {
    display: flex;
    flex-direction: column;
    gap: 1rem
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden
}

.panel-header {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between
}

.panel-title {
    font-size: .875rem;
    font-weight: 600
}

.panel-body {
    padding: 1rem
}

.form-group {
    margin-bottom: .875rem
}

.form-label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    margin-bottom: .375rem;
    color: var(--text-muted)
}

.slider-row {
    display: flex;
    align-items: center;
    gap: .75rem
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid var(--bg);
    box-shadow: 0 0 8px var(--primary-glow)
}

.slider-value {
    font-family: var(--mono);
    font-size: .75rem;
    color: var(--secondary);
    min-width: 40px;
    text-align: right
}

.text-input,
.select-input {
    width: 100%;
    padding: .4rem .625rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: var(--font);
    font-size: .8125rem;
    transition: border-color var(--transition);
    outline: none
}

.text-input:focus,
.select-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow)
}

.text-input.mono {
    font-family: var(--mono);
    font-size: .75rem
}

.select-input {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .5rem center;
    padding-right: 1.75rem
}

.select-input option {
    background: var(--bg-card)
}

.select-sm {
    width: auto;
    min-width: 80px;
    font-size: .75rem;
    padding: .25rem .5rem
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .375rem;
    cursor: pointer
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--primary)
}

.easing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .375rem;
    margin-bottom: .75rem
}

.easing-btn {
    padding: .375rem .5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: .6875rem;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center
}

.easing-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-muted)
}

.easing-btn.active {
    background: var(--primary-glow);
    color: var(--primary);
    border-color: rgba(14, 165, 233, 0.3)
}

.custom-easing {
    margin-top: .5rem
}

.keyframe-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-height: 300px;
    overflow-y: auto
}

.keyframe-list::-webkit-scrollbar {
    width: 5px
}

.keyframe-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px
}

.kf-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .625rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: .75rem
}

.kf-percent {
    font-family: var(--mono);
    font-weight: 600;
    color: var(--primary);
    min-width: 36px
}

.kf-props {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: .25rem
}

.kf-prop {
    padding: .125rem .375rem;
    border-radius: 100px;
    background: var(--accent-glow);
    color: var(--accent);
    font-size: .625rem;
    font-family: var(--mono)
}

.kf-remove {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: .125rem;
    transition: color var(--transition)
}

.kf-remove:hover {
    color: var(--error, #F87171)
}

.preview-panel .panel-body,
.preview-area {
    padding: 0
}

.preview-area {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-conic-gradient(rgba(255, 255, 255, 0.02) 0% 25%, transparent 0% 50%) 50%/20px 20px;
    position: relative;
    overflow: hidden
}

.preview-element {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.3)
}

.preview-element.circle {
    border-radius: 50%
}

.preview-element.text {
    width: auto;
    height: auto;
    padding: .75rem 1.5rem;
    background: transparent;
    color: var(--secondary);
    font-size: 1.5rem;
    box-shadow: none
}

.preview-element.button {
    width: auto;
    height: auto;
    padding: .5rem 1.5rem;
    border-radius: 100px;
    font-size: .875rem
}

.preview-element.card {
    width: 160px;
    height: 100px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    flex-direction: column;
    gap: .25rem
}

.preview-element.card span {
    color: var(--text)
}

.preview-controls {
    display: flex;
    gap: .375rem
}

.element-options {
    padding: .625rem 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .5rem
}

.code-output {
    padding: 1rem;
    font-family: var(--mono);
    font-size: .75rem;
    line-height: 1.6;
    color: var(--secondary);
    margin: 0;
    white-space: pre-wrap;
    max-height: 250px;
    overflow: auto;
    background: var(--bg-input)
}

.code-output::-webkit-scrollbar {
    width: 5px
}

.code-output::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px
}

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: .5rem
}

.toast {
    padding: .75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    font-size: .8125rem;
    animation: toastIn .3s ease-out
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px)
    }

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

@media(max-width:1024px) {
    .layout-grid {
        grid-template-columns: 1fr
    }
}

@media(max-width:768px) {
    .main {
        padding: 1rem
    }

    .easing-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .header-inner {
        flex-wrap: wrap;
        gap: .5rem
    }
}