:root {
    --bg-base: #0F0A1A;
    --bg-panel: rgba(22, 15, 36, 0.7);
    --bg-hover: rgba(108, 92, 231, 0.1);

    --border-light: rgba(162, 155, 254, 0.2);
    --border-active: #6C5CE7;

    --text-main: #f8fafc;
    --text-muted: #a29bfe;

    --primary: #6C5CE7;
    --primary-hover: #5A4FCF;
    --secondary: #A29BFE;
    --accent: #FF7675;
    --accent-hover: #E86B6A;

    --success: #00b894;
    --danger: #d63031;

    --radius-xl: 16px;
    --radius-lg: 12px;
    --radius-md: 8px;

    --shadow-glow: 0 0 15px rgba(108, 92, 231, 0.3);
}

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

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

/* Utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.w-full {
    width: 100%;
}

.w-4 {
    width: 1rem;
}

.h-4 {
    height: 1rem;
}

.w-5 {
    width: 1.25rem;
}

.h-5 {
    height: 1.25rem;
}

.w-6 {
    width: 1.5rem;
}

.h-6 {
    height: 1.5rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.pt-1 {
    padding-top: 0.25rem;
}

.pt-3 {
    padding-top: 0.75rem;
}

.pr-2 {
    padding-right: 0.5rem;
}

.pb-8 {
    padding-bottom: 2rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

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

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

.mt-2 {
    margin-top: 0.5rem;
}

.min-h-0 {
    min-height: 0;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-y-auto {
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.block {
    display: block;
}

.text-center {
    text-align: center;
}

.break-all {
    word-break: break-all;
}

.text-xl {
    font-size: 1.25rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

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

.text-white {
    color: #fff;
}

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

.text-secondary {
    color: var(--secondary);
}

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

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

.bg-black\/40 {
    background-color: rgba(0, 0, 0, 0.4);
}

.border {
    border-width: 1px;
    border-style: solid;
}

.border-light {
    border-color: var(--border-light);
}

.border-b {
    border-bottom-width: 1px;
    border-style: solid;
    border-color: inherit;
}

.rounded-full {
    border-radius: 9999px;
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.shadow-lg {
    box-shadow: var(--shadow-glow);
}

/* Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 100vh;
}

@media (min-width: 768px) {
    .md\:w-5\/12 {
        width: 41.666667%;
    }
}

.topbar {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 100px;
}

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

.brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.workspace {
    display: flex;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

/* Components */
.glass-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
}

.card {
    padding: 1.5rem;
    border-radius: var(--radius-xl);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    outline: none;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
}

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

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.btn-icon {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 118, 117, 0.15);
    /* Tint color using accent */
    color: var(--accent);
}

.preset-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: var(--primary);
    color: white;
    background: var(--bg-hover);
}

.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.text-input,
.select-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
}

.text-input:focus,
.select-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.2);
}

.select-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/200.svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a29bfe' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    padding-right: 2rem;
}

/* Directives Builder */
.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.directives-list {
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dir-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: border-color 0.2s;
}

.dir-card:hover {
    border-color: var(--primary);
}

.dir-card .btn-icon {
    opacity: 0;
    pointer-events: none;
}

.dir-card:hover .btn-icon,
.dir-card:focus-within .btn-icon {
    opacity: 1;
    pointer-events: auto;
}

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

.dir-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--secondary);
    font-size: 1rem;
}

.dir-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.source-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.source-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: 100px;
    font-size: 0.8125rem;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.2s;
}

.source-btn:hover {
    border-color: var(--secondary);
    color: var(--text-main);
}

.source-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.source-btn.active-danger {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.custom-val-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px dashed var(--border-light);
    color: var(--text-main);
    padding: 0.35rem 0.75rem;
    border-radius: 100px;
    font-size: 0.8125rem;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
    transition: all 0.2s;
    min-width: 150px;
    flex-grow: 1;
}

.custom-val-input:focus {
    border-color: var(--primary);
    border-style: solid;
}

.custom-val-input::placeholder {
    color: rgba(162, 155, 254, 0.4);
    font-family: 'Inter', sans-serif;
}

/* Result Box */
.code-display {
    white-space: pre-wrap;
    word-break: break-all;
}

.code-display .sys {
    color: #fff;
}

.code-display .dir {
    color: var(--secondary);
    font-weight: 700;
}

.code-display .val {
    color: #81ecec;
}

.code-display p {
    display: inline;
}

/* Test Result states */
.test-success {
    background: rgba(0, 184, 148, 0.15);
    color: #55efc4;
    border: 1px solid var(--success);
}

.test-danger {
    background: rgba(214, 48, 49, 0.15);
    color: #ff7675;
    border: 1px solid var(--danger);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(162, 155, 254, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-main);
    color: var(--bg-base);
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}