:root {
    --bg-base: #0f172a;
    /* slate-900 */
    --bg-panel: rgba(30, 41, 59, 0.7);
    /* slate-800 */
    --bg-input: #0f172a;
    --bg-hover: rgba(56, 189, 248, 0.1);

    --border-light: rgba(148, 163, 184, 0.2);
    --border-active: #38bdf8;
    /* sky-400 */

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --primary: #38bdf8;
    --primary-hover: #0284c7;

    --radius-lg: 16px;
    --radius-md: 8px;
    --radius-sm: 4px;
}

* {
    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;
    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-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

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

.w-5 {
    width: 1.25rem;
}

.h-5 {
    height: 1.25rem;
}

.w-6 {
    width: 1.5rem;
}

.h-6 {
    height: 1.5rem;
}

.hidden {
    display: none !important;
}

/* 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-lg);
}

.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;
}

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

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

.code-input {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.125rem;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s;
    text-align: center;
}

.code-input:focus {
    border-color: var(--primary);
}

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

.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: rgba(56, 189, 248, 0.15);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.presets-nav {
    display: flex;
    gap: 0.5rem;
}

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

.preset-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(56, 189, 248, 0.05);
}

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

/* Left Panel - Builder */
.builder-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    padding: 0 1rem;
}

.tab {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    position: relative;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.02);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* Option Groups inside Tab */
.option-group {
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.option-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}

.option-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.radio-custom {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-group.selected .radio-custom {
    border-color: var(--primary);
}

.option-group.selected .radio-custom::after {
    content: '';
    width: 0.625rem;
    height: 0.625rem;
    background: var(--primary);
    border-radius: 50%;
}

.option-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-main);
}

.option-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.option-body {
    padding: 1.5rem;
    display: none;
}

.option-group.selected .option-body {
    display: block;
}

/* Grid Selectors */
.selector-grid {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr));
}

.sel-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    height: 3rem;
    border-radius: var(--radius-md);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

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

.sel-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #0f172a;
    font-weight: 700;
    transform: scale(1.05);
}

/* Range/Step settings */
.settings-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.num-input {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    width: 5rem;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
}

.num-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Right Panel - Results */
.results-panel {
    flex: 1;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.result-card {
    padding: 1.5rem;
}

.card-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 12px;
    background: var(--primary);
    border-radius: 2px;
}

.expression-display {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.expr-segment {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem 0;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
}

.expr-segment:hover,
.expr-segment.active {
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.1);
}

.human-desc {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--text-main);
}

.runs-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    flex: 1;
}

.run-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.run-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9375rem;
    color: var(--text-main);
}

.run-rel {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary);
    color: #0f172a;
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 10px 25px rgba(56, 189, 248, 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);
}