/* ─── Design tokens ─── */
:root {
    color-scheme: dark;
    --bg: #0d0f14;
    --surface: #151820;
    --border: #252a35;
    --accent: #f7c948;
    --accent2: #4ecdc4;
    --text: #e8ecf5;
    --muted: #5c6378;
    --error: #ff6b6b;
    --success: #4ecdc4;
    --radius: 8px;
    --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
    --font-ui: "Syne", "Space Grotesk", system-ui, sans-serif;
}

@font-face {
    font-family: "Syne";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("./Syne.woff2") format("woff2");
}
@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("./JetBrainsMono.woff2") format("woff2");
}

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

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

/* ─── Header ─── */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    gap: 16px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.5px;
    user-select: none;
}

.logo-icon {
    width: 30px;
    height: 30px;
    background: var(--accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.logo span {
    color: var(--accent);
}

/* ─── Controls bar ─── */
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

select,
input[type="number"],
input[type="text"] {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    padding: 6px 10px;
    outline: none;
    transition: border-color 0.15s;
}
select:hover,
select:focus,
input:hover,
input:focus {
    border-color: var(--accent);
}

label.inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
}

input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.sep {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: var(--radius);
    border: none;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition:
    opacity 0.15s,
    transform 0.1s;
    white-space: nowrap;
}
.btn:active {
    transform: scale(0.97);
}
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #0d0f14;
}
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    color: var(--text);
    border-color: var(--muted);
}
.btn-icon {
    padding: 7px 10px;
}

/* ─── Main layout ─── */
main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    gap: 0;
    min-height: 0;
}

/* ─── Pane headers ─── */
.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    gap: 8px;
}

.pane-header.left {
    border-right: 1px solid var(--border);
}
.pane-header.right {
    border-left: none;
}

.pane-badge {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.72rem;
    color: var(--muted);
}

/* ─── Editor panes ─── */
.pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.pane.left {
    border-right: 1px solid var(--border);
}

textarea,
.output-area {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.65;
    padding: 18px 20px;
    background: var(--bg);
    color: var(--text);
    border: none;
    resize: none;
    outline: none;
    overflow: auto;
    white-space: pre;
    tab-size: 2;
    min-height: 0;
}

.output-area {
    position: relative;
    overflow: auto;
    cursor: default;
    user-select: text;
}

.output-area.empty {
    color: var(--muted);
    font-style: italic;
    white-space: pre-wrap;
}

/* ─── Status bar ─── */
.statusbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 20px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted);
    flex-wrap: wrap;
}

.statusbar .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--muted);
}
.statusbar .dot.ok {
    background: var(--success);
}
.statusbar .dot.error {
    background: var(--error);
}

.status-msg {
    flex: 1;
}
.status-msg.error {
    color: var(--error);
}

/* ─── Notification toast ─── */
.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--accent2);
    color: #0d0f14;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.84rem;
    opacity: 0;
    transform: translateY(8px);
    transition:
    opacity 0.2s,
    transform 0.2s;
    pointer-events: none;
    z-index: 999;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Diff highlight ─── */
.diff-added {
    background: rgba(78, 205, 196, 0.12);
}
.diff-removed {
    background: rgba(255, 107, 107, 0.12);
    text-decoration: line-through;
    color: var(--muted);
}

/* ─── Responsive ─── */
@media (max-width: 720px) {
    main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto 1fr;
    }
    .pane.left {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

/* kbd hint */
kbd {
    background: var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
}
