/* CSS Animation Keyframe Generator — style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #101018;
    --bg2: #16161f;
    --bg3: #1d1d2a;
    --bg4: #242433;
    --border: #252535;
    --border2: rgba(255, 255, 255, 0.05);
    --text: #e8e8f5;
    --text2: #7070a0;
    --text3: #333355;
    --accent: #a78bfa;
    --accent2: #c4b5fd;
    --accent-glow: rgba(167, 139, 250, 0.18);
    --radius: 10px;
    --t: all 0.18s ease;
}

@media(prefers-color-scheme:light) {
    :root {
        --bg: #f0f0ff;
        --bg2: #ffffff;
        --bg3: #f5f4ff;
        --bg4: #ececfc;
        --border: #ddddf0;
        --border2: rgba(0, 0, 0, 0.05);
        --text: #18183a;
        --text2: #5858a0;
        --text3: #9898cc;
    }
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 50% 30% at 15% 8%, rgba(167, 139, 250, 0.07), transparent);
    z-index: 0;
}

/* Header */
header {
    background: rgba(16, 16, 24, 0.9);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.hdr {
    max-width: 1400px;
    margin: 0 auto;
    padding: 9px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

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

.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.brand-title {
    font-size: 14px;
    font-weight: 700;
}

h1.brand-title {
    display: inline;
}

.brand-sub {
    font-size: 10px;
    color: var(--text3);
}

.hdr-actions {
    display: flex;
    gap: 6px;
}

/* Layout */
.layout {
    max-width: 1400px;
    margin: 14px auto;
    padding: 0 20px 40px;
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    gap: 12px;
    flex: 1;
    position: relative;
    z-index: 1;
    align-items: start;
}

/* Panels */
.panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 12px;
}

.panel:last-child {
    margin-bottom: 0;
}

.panel-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text2);
}

.panel-title-row {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Controls col */
.controls-col {
    display: flex;
    flex-direction: column;
}

.panel .panel-title:not(:parent .panel-title-row) {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border2);
    display: block;
}

.panel>.panel-title {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border2);
    display: block;
}

/* Fields inside panel */
.panel>.field,
.panel>div>.field {
    padding: 8px 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 0;
}

.label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text2);
    display: flex;
    justify-content: space-between;
}

.label-unit {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
}

.inp {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    padding: 5px 9px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--t);
    width: 100%;
}

.inp:focus {
    border-color: var(--accent);
}

select.inp {
    cursor: pointer;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

.range {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Easing presets */
.easing-presets {
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ease-chip {
    padding: 3px 9px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--bg3);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--t);
    font-family: 'Inter', sans-serif;
    color: var(--text2);
}

.ease-chip:hover,
.ease-chip.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

/* Presets grid */
.presets-grid {
    padding: 8px 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.preset-btn {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg3);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--t);
    font-family: 'Inter', sans-serif;
    color: var(--text2);
    text-align: left;
}

.preset-btn:hover {
    border-color: var(--accent);
    color: var(--accent2);
}

/* Preview */
.preview-panel {
    overflow: visible;
}

.preview-stage {
    background: repeating-conic-gradient(var(--bg3) 0% 25%, transparent 0% 50%) 0 0 / 20px 20px;
    border-bottom: 1px solid var(--border2);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.preview-box {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.35);
    transition: none;
}

/* Timeline */
.timeline-panel {
    overflow: visible;
}

.timeline-wrap {
    padding: 12px;
    overflow-x: auto;
}

.timeline-ruler {
    height: 20px;
    position: relative;
    border-bottom: 1px solid var(--border2);
    margin-bottom: 8px;
}

.ruler-tick {
    position: absolute;
    bottom: 0;
    font-size: 9px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text3);
    transform: translateX(-50%);
}

.timeline-track {
    height: 48px;
    position: relative;
    background: var(--bg3);
    border-radius: 8px;
    overflow: visible;
    border: 1px solid var(--border2);
}

.kf-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
    cursor: grab;
    z-index: 5;
    transition: transform 0.1s;
}

.kf-marker:hover {
    transform: translate(-50%, -50%) scale(1.3);
}

.kf-marker.selected {
    box-shadow: 0 0 0 3px var(--accent-glow);
    transform: translate(-50%, -50%) scale(1.2);
}

.kf-pct-label {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    white-space: nowrap;
}

/* Keyframe editor */
#kf-editor {
    margin-top: 0;
}

.kf-label {
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

.kf-props {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.prop-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text2);
    width: 80px;
    flex-shrink: 0;
}

.prop-inp {
    flex: 1;
}

.danger {
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.danger:hover {
    border-color: #f87171;
    background: rgba(239, 68, 68, 0.08);
}

/* Code panel */
.code-col {
    display: flex;
    flex-direction: column;
}

.code-panel {
    flex: 1;
}

.code-view {
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    line-height: 1.7;
    color: #c4b5fd;
    background: #080812;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    min-height: 400px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--t);
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent2);
}

.btn-sm {
    padding: 3px 8px;
    font-size: 10px;
    border-radius: 5px;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 700;
    font-size: 12px;
}

.btn-primary:hover {
    background: #9061f9;
    border-color: #9061f9;
}

/* Toast */
.toast-wrap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.toast {
    background: var(--bg2);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text);
    transform: translateX(20px);
    opacity: 0;
    transition: all 0.22s ease;
    pointer-events: all;
}

.toast.show {
    transform: none;
    opacity: 1;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px
}

::-webkit-scrollbar-track {
    background: transparent
}

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

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