:root {
    --bg-dark: #0D0B1E;
    --surface: #17153B;
    --surface-hover: #211E48;
    --border: #2D2A54;
    
    --primary: #6C5CE7;
    --primary-hover: #5A4BDE;
    --secondary: #A29BFE;
    --accent: #FD79A8;
    
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --text-dim: #64748B;
    
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 4px;
    
    --transition: 250ms ease;
    
    color-scheme: dark;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Utilities */
.mt-lg { margin-top: 2rem; }
.cursor-pointer { cursor: pointer; }

/* Header */
.app-header {
    height: 64px;
    background: rgba(23, 21, 59, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    flex-shrink: 0;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.logo span {
    font-weight: 400;
    color: var(--secondary);
}

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

.select-chic {
    background: var(--surface);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

/* Layout */
.app-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Pane: Editor */
.editor-pane {
    width: 40%;
    min-width: 300px;
    max-width: 600px;
    background: var(--bg-dark);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.pane-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
}

.pane-header h2 {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Fira Code', monospace;
    color: var(--secondary);
}

#configEditor {
    flex: 1;
    width: 100%;
    background: transparent;
    border: none;
    padding: 1.5rem;
    color: #E2E8F0;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

#configEditor::placeholder {
    color: var(--text-dim);
}

.editor-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--surface);
}
.editor-footer.error { color: #EF4444; }
.editor-footer.success { color: #10B981; }


/* Right Pane: Visualizer */
.visualizer-pane {
    flex: 1;
    background: var(--bg-dark);
    overflow-y: auto;
    position: relative;
    padding-bottom: 4rem;
}

.empty-state {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-dim);
    max-width: 300px;
}

.empty-state .icon-wrap {
    color: var(--border);
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.empty-state p {
    font-size: 0.9rem;
}

/* Design System output */
.design-system {
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

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

.ds-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-main);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.ds-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
}

.ds-section {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.section-title::before {
    content: '';
    display: block;
    width: 6px;
    height: 1.2rem;
    background: var(--primary);
    border-radius: 4px;
}

.subsection-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 1rem;
}

/* Colors Grid */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
}

.color-swatch-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.color-swatch-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.color-fill {
    height: 80px;
    width: 100%;
}

.color-info {
    padding: 0.75rem;
}

.color-name {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-hex {
    font-size: 0.75rem;
    font-family: 'Fira Code', monospace;
    color: var(--text-muted);
}

/* Typography */
.font-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.font-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.font-item h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
    margin-bottom: 0.5rem;
}

.font-item p {
    font-size: 2rem;
    color: var(--text-main);
}

.type-scale {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.type-row {
    display: flex;
    align-items: baseline;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}
.type-row:last-child { border-bottom: none; }

.type-label {
    width: 80px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
}

.type-sample {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Spacing Scale */
.spacing-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.spacing-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.spacing-label {
    font-size: 0.85rem;
    font-family: 'Fira Code', monospace;
    color: var(--text-muted);
    width: 80px;
}
.spacing-bar {
    height: 24px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    min-width: 4px;
    transition: width 0.5s ease;
}
.spacing-value {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Radius Box */
.radius-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1.5rem;
}
.radius-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.radius-box {
    width: 80px;
    height: 80px;
    background: var(--surface);
    border: 2px solid var(--primary);
}
.radius-label {
    font-size: 0.8rem;
    font-family: 'Fira Code', monospace;
    color: var(--text-muted);
}

/* Shadow Box */
.shadow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 2rem;
}
.shadow-box {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    font-family: 'Fira Code', monospace;
    color: var(--text-muted);
}

/* Animations */
.animation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}
.anim-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
}
.anim-box:hover .anim-target {
    /* Triggers specific animation defined in JS inline styles */
}
.anim-target {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 8px;
    margin: 0 auto 1rem;
}
.anim-label {
    font-size: 0.8rem;
    font-family: 'Fira Code', monospace;
    color: var(--text-muted);
}

/* Breakpoints Diagram */
.screens-diagram {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1.5rem;
    position: relative;
    border-left: 2px solid var(--border);
    padding-left: 2rem;
}
.screen-item {
    position: relative;
}
.screen-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 50%;
    width: 1.5rem;
    height: 2px;
    background: var(--border);
}
.screen-item::after {
    content: '';
    position: absolute;
    left: -2.3rem; /* -2rem - 0.3rem (half width) */
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}
.screen-label {
    font-weight: 600;
    color: var(--secondary);
    display: inline-block;
    width: 60px;
}
.screen-value {
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
}

/* Plugins */
.plugin-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.plugin-item {
    background: rgba(253, 121, 168, 0.1);
    color: var(--accent);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}


/* Form / Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}
.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border-color: var(--border);
}
.btn-outline:hover { background: var(--surface-hover); }

/* Toast */
.toast {
    position: fixed;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: #10B981;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: bottom 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}
.toast.show {
    bottom: 2rem;
}
