:root {
    /* Brand Colors - Amber Gold Palette */
    --primary: #F39C12;
    --primary-hover: #E67E22;
    --secondary: #FFEAA7;
    --accent: #00CEC9;

    /* Backgrounds */
    --bg-dark: #1A150A;
    /* Deep Brown/Black */
    --bg-surface: #242013;
    --bg-panel: rgba(36, 32, 19, 0.75);

    /* Text */
    --text-primary: #FDFBF7;
    --text-secondary: #D1C7AE;
    --text-muted: #8E8877;

    /* Syntax Highlighting */
    --syn-key: #F39C12;
    --syn-string: #A3E4D7;
    --syn-number: #F1948A;
    --syn-boolean: #C39BD3;

    /* UI Elements */
    --border: rgba(243, 156, 18, 0.2);
    --border-focus: rgba(243, 156, 18, 0.6);
    --radius: 12px;
    --transition: 250ms ease;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    /* Ambient gradient background */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(243, 156, 18, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 206, 201, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Typography */
h1,
h2,
h3 {
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Glassmorphism */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.hidden {
    display: none !important;
}

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

/* Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
}

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

.brand-icon {
    color: var(--primary);
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.app-header p {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

.main-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.builder-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.preview-column {
    width: 500px;
    flex-shrink: 0;
}

.sticky {
    position: sticky;
    top: 2rem;
}

/* Config Cards (Accordions) */
.config-card {
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: var(--transition);
}

.card-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chevron {
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.card-header.collapsed .chevron {
    transform: rotate(-90deg);
}

.card-content {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

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

.full-width {
    grid-column: 1 / -1;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.required {
    color: var(--accent);
}

.form-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--border-focus);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.1);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D1C7AE' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    padding-right: 2.5rem;
}

select.form-input option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Dynamic Lists (Scripts) */
.dynamic-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.list-item {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 0.75rem;
    align-items: start;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.primary-btn {
    background: var(--primary);
    color: #000;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.outline-btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.outline-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.icon-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

.text-btn {
    background: transparent;
    color: var(--text-muted);
}

.text-btn:hover {
    color: var(--text-primary);
}

.sm-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.full-width {
    width: 100%;
}

/* Preview Column */
.preview-card {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 4rem);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius) var(--radius) 0 0;
}

.preview-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

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

.code-container {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: #111113;
    margin: 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.validation-msg {
    padding: 0.75rem 1.5rem;
    font-size: 0.85rem;
    color: #ef4444;
    /* red */
    min-height: 40px;
}

/* Syntax Highlighting CSS */
.str {
    color: var(--syn-string);
}

.num {
    color: var(--syn-number);
}

.bool {
    color: var(--syn-boolean);
}

.null {
    color: var(--text-muted);
}

.key {
    color: var(--syn-key);
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .preview-column {
        width: 100%;
    }

    .preview-card {
        height: 600px;
    }
}

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

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .list-item {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
}