:root {
    --bg-app: #1A0A0A;
    --bg-panel: #261111;
    --bg-card: #331717;
    --bg-input: #421D1D;

    --color-primary: #D63031;
    --color-primary-hover: #FC4243;
    --color-secondary: #FF7675;
    --color-accent: #00CEC9;

    --text-main: #FDF2F2;
    --text-muted: #F8BCBC;

    --border-color: #552727;
    --border-focus: #FF7675;

    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius: 12px;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utilities */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(214, 48, 49, 0.3);
}

.btn-icon {
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 6px;
    padding: 0.4rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
}

.btn-icon:hover {
    background: var(--bg-card);
    color: #fff;
}

/* Header */
.app-header {
    height: 70px;
    background: rgba(38, 17, 17, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    flex-shrink: 0;
}

.header-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.brand h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

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

.preset-select {
    background: var(--bg-input);
    color: #fff;
    border: 1px solid var(--border-color);
    padding: 0.45rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.preset-select:focus {
    border-color: var(--border-focus);
}

/* Main Split View */
.app-main {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.split-layout {
    width: 100%;
    max-width: 1400px;
    display: flex;
    gap: 1.5rem;
}

.pane {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

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

.pane-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge {
    background: rgba(214, 48, 49, 0.2);
    color: var(--color-secondary);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(214, 48, 49, 0.3);
}

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

/* Editor List */
.sections-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Card */
.ruleset-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    transition: border-color 0.2s;
    animation: slideIn 0.3s ease-out;
}

.ruleset-card:focus-within {
    border-color: var(--border-focus);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ruleset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.75rem;
}

.glob-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--color-accent);
}

.glob-bracket {
    opacity: 0.5;
}

.glob-input {
    background: transparent;
    border: none;
    color: var(--color-accent);
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    outline: none;
    width: 200px;
}

.glob-input::placeholder {
    color: rgba(0, 206, 201, 0.3);
    font-weight: 400;
}

.btn-delete-section {
    background: rgba(214, 48, 49, 0.1);
    color: var(--color-primary);
    border: 1px solid transparent;
    padding: 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-section:hover {
    background: rgba(214, 48, 49, 0.2);
    border-color: rgba(214, 48, 49, 0.5);
}

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

.rule-control {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.rule-control label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.rule-select {
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    outline: none;
    cursor: pointer;
}

.rule-select:focus {
    border-color: var(--border-focus);
}

.rule-select option[value="unset"] {
    color: #888;
}

/* Preview Code */
.code-preview {
    flex: 1;
    padding: 1.5rem;
    background: #0d0505;
    overflow-y: auto;
}

pre {
    margin: 0;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre;
}

/* Syntax Highlighting Fake Classes */
.ini-header {
    color: var(--color-accent);
    font-weight: bold;
}

.ini-key {
    color: var(--color-secondary);
}

.ini-value {
    color: #55efc4;
}

/* Mint */
.ini-comment {
    color: #636e72;
    font-style: italic;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--color-primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(214, 48, 49, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

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

@media (max-width: 1024px) {
    .split-layout {
        flex-direction: column;
    }

    .pane {
        height: 50vh;
    }
}