@font-face {
    font-family: "JetBrains Mono";
    src: url(fonts/jetbrains-mono-latin-wght-normal.woff2) format("woff2");
    font-weight: 100 800; font-display: swap;
}
@font-face {
    font-family: "Bricolage";
    src: url(fonts/bricolage-grotesque-latin-wght-normal.woff2) format("woff2");
    font-weight: 200 800; font-display: swap;
}

:root {
    --ink: #0b0c0a;
    --ink-2: #111310;
    --ink-3: #171a15;
    --line: #23271f;
    --line-2: #333829;
    --paper: #ebe8dd;
    --muted: #8e9184;
    --dim: #5d6157;
    --amber: #f3b558;
    --mint: #8fe0b2;
    --coral: #ff8f6b;
    --sky: #8ab8ff;
    --accent: var(--amber);
    --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    --display: "Bricolage", "Helvetica Neue", Arial, sans-serif;
    color-scheme: dark;
}
body[data-tool="flume"] { --accent: var(--mint); }
body[data-tool="pipeline"] { --accent: var(--coral); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: var(--ink);
    background-image: radial-gradient(circle at 1px 1px, rgba(235, 232, 221, .045) 1px, transparent 0);
    background-size: 22px 22px;
    color: var(--paper);
    font: 14px/1.55 var(--mono);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "liga" 0, "calt" 0;
    overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { font-family: var(--mono); }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.top {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: stretch; gap: 28px;
    height: 58px; padding: 0 24px;
    background: rgba(11, 12, 10, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(1.2) blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; flex-shrink: 0; }
.brand-mark { width: 26px; height: 26px; color: var(--paper); }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand-name .slash { color: var(--accent); margin: 0 1px; transition: color .3s; }

.tabs { display: flex; align-items: stretch; gap: 2px; }
.tab {
    position: relative; display: flex; align-items: center; gap: 9px;
    padding: 0 16px; border: 0; background: none; color: var(--muted);
    font-size: 13.5px; white-space: nowrap;
}
.tab kbd {
    display: inline-grid; place-items: center; width: 18px; height: 18px;
    border: 1px solid var(--line-2); border-radius: 4px; font: 600 10.5px var(--mono); color: var(--dim);
}
.tab-name { font-weight: 600; color: inherit; }
.tab-sub { color: var(--dim); font-size: 12px; }
.tab::after {
    content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
    background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s ease;
}
.tab:hover { color: var(--paper); }
.tab[aria-selected="true"] { color: var(--paper); }
.tab[aria-selected="true"] kbd { border-color: var(--accent); color: var(--accent); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }

.top-meta { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 12px; padding-right: 150px; }
.top-meta .sep { color: var(--line-2); }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(143, 224, 178, .14); }

/* ---------- layout ---------- */
main { min-height: calc(100vh - 58px); }
.tool {
    display: grid; grid-template-columns: 372px minmax(0, 1fr);
    height: calc(100vh - 58px); min-height: 640px;
}
.intro {
    padding: 34px 30px 28px 28px; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 18px; overflow: auto;
}
.kicker { margin: 0; color: var(--muted); font-size: 12px; text-transform: lowercase; letter-spacing: .02em; }
.kicker span { color: var(--accent); margin-right: 8px; font-weight: 700; }
.intro h1 {
    margin: -6px 0 0; font: 700 62px/0.95 var(--display); letter-spacing: -.035em; color: var(--paper);
}
.intro h1::after { content: "_"; color: var(--accent); margin-left: 2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lede { margin: 0; color: #c9c6bb; font: 400 16.5px/1.5 var(--display); letter-spacing: -.005em; }
.feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 12.5px; color: var(--muted); }
.feats li { position: relative; padding-left: 18px; }
.feats li::before { content: "›"; position: absolute; left: 2px; color: var(--accent); font-weight: 700; }
.feats code { color: var(--paper); font-size: 12px; }

.cmd { position: relative; border: 1px solid var(--line-2); border-radius: 8px; background: var(--ink-2); padding: 22px 14px 12px; }
.cmd-label { position: absolute; top: -8px; left: 10px; padding: 0 6px; background: var(--ink); color: var(--dim); font-size: 11px; }
.cmd pre { margin: 0; font-size: 11.5px; line-height: 1.6; white-space: pre; overflow-x: auto; color: var(--paper); }
.cmd .p { color: var(--accent); user-select: none; }
.copy {
    position: absolute; top: -11px; right: 10px; padding: 2px 8px; font-size: 11px;
    border: 1px solid var(--line-2); border-radius: 5px; background: var(--ink-3); color: var(--muted);
}
.copy:hover { color: var(--paper); border-color: var(--accent); }

.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); }
.repo {
    flex-basis: 100%; margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
    color: var(--paper); font-size: 12.5px; text-decoration: none; border-bottom: 1px dashed var(--line-2); padding-bottom: 6px; width: max-content; max-width: 100%;
}
.repo svg { width: 11px; height: 11px; color: var(--accent); }
.repo:hover { color: var(--accent); }

.stage { padding: 22px 24px 18px; min-width: 0; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.stage-note { margin: 0; font-size: 11.5px; color: var(--dim); }

/* ---------- frame ---------- */
.frame {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
    border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--ink-2);
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .7), 0 0 0 4px rgba(243, 181, 88, .03);
}
.frame-bar {
    display: flex; align-items: center; gap: 14px; justify-content: space-between;
    height: 34px; padding: 0 12px; border-bottom: 1px solid var(--line-2); background: var(--ink-3);
    font-size: 11.5px; color: var(--muted); min-width: 0;
}
.frame-cmd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.frame-cmd .p { color: var(--amber); }
.frame-cmd .c { color: var(--dim); }
.frame-url { flex-shrink: 0; color: var(--dim); border: 1px solid var(--line-2); border-radius: 99px; padding: 1px 10px; }

/* ---------- interloki (replica, real palettes) ---------- */
.il {
    --interloki-bg: #ffffff; --interloki-bg-secondary: #f5f5f5; --interloki-fg: #1a1a1a; --interloki-fg-secondary: #666666;
    --interloki-accent: #2563eb; --interloki-border: #e5e5e5; --interloki-level-debug: #6b7280; --interloki-level-info: #2563eb;
    --interloki-level-warn: #d97706; --interloki-level-error: #dc2626; --interloki-bg-hover: #ebebeb; --interloki-bg-active: #e0e7ff;
    --interloki-text-accent: #1d4ed8;
    --j-key: #7c3aed; --j-str: #15803d; --j-num: #b45309; --j-bool: #be185d;
    flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative;
    background: var(--interloki-bg); color: var(--interloki-fg); font-size: 13px;
    transition: background-color .25s, color .25s;
}
.il[data-theme="dark"] {
    --interloki-bg: #0f0f0f; --interloki-bg-secondary: #1a1a1a; --interloki-fg: #e5e5e5; --interloki-fg-secondary: #999999;
    --interloki-accent: #3b82f6; --interloki-border: #333333; --interloki-level-debug: #9ca3af; --interloki-level-info: #60a5fa;
    --interloki-level-warn: #fbbf24; --interloki-level-error: #f87171; --interloki-bg-hover: #252525; --interloki-bg-active: #1e293b;
    --interloki-text-accent: #93c5fd;
    --j-key: #c4b5fd; --j-str: #86efac; --j-num: #fcd34d; --j-bool: #f9a8d4;
}
.il[data-theme="catppuccin-latte"] {
    --interloki-bg: #eff1f5; --interloki-bg-secondary: #e6e9ef; --interloki-fg: #4c4f69; --interloki-fg-secondary: #6c6f85;
    --interloki-accent: #1e66f5; --interloki-border: #ccd0da; --interloki-level-debug: #9ca0b0; --interloki-level-info: #1e66f5;
    --interloki-level-warn: #df8e1d; --interloki-level-error: #d20f39; --interloki-bg-hover: #ccd0da; --interloki-bg-active: #bcc0cc;
    --interloki-text-accent: #7287fd;
    --j-key: #8839ef; --j-str: #40a02b; --j-num: #fe640b; --j-bool: #ea76cb;
}
.il[data-theme="catppuccin-mocha"] {
    --interloki-bg: #1e1e2e; --interloki-bg-secondary: #181825; --interloki-fg: #cdd6f4; --interloki-fg-secondary: #a6adc8;
    --interloki-accent: #89b4fa; --interloki-border: #313244; --interloki-level-debug: #6c7086; --interloki-level-info: #89b4fa;
    --interloki-level-warn: #f9e2af; --interloki-level-error: #f38ba8; --interloki-bg-hover: #313244; --interloki-bg-active: #45475a;
    --interloki-text-accent: #b4befe;
    --j-key: #cba6f7; --j-str: #a6e3a1; --j-num: #fab387; --j-bool: #f5c2e7;
}
.il-head {
    display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 10px 0 12px;
    border-bottom: 1px solid var(--interloki-border); flex-shrink: 0;
}
.il-word { font-weight: 700; color: var(--interloki-accent); font-size: 15px; }
.il-head-actions { display: flex; gap: 6px; align-items: center; }
.il-btn {
    height: 26px; min-width: 30px; padding: 0 8px; display: inline-grid; place-items: center;
    border: 1px solid var(--interloki-border); border-radius: 4px; background: var(--interloki-bg); color: var(--interloki-fg);
    font-size: 11.5px;
}
.il-btn svg { width: 15px; height: 15px; }
.il-btn:hover { background: var(--interloki-bg-hover); }
.il-pal[data-on="true"] { border-color: var(--interloki-accent); color: var(--interloki-accent); }
.il .i-moon { display: none; }
.il[data-theme="light"] .i-sun, .il[data-theme="catppuccin-latte"] .i-sun { display: none; }
.il[data-theme="light"] .i-moon, .il[data-theme="catppuccin-latte"] .i-moon { display: block; }
.il-menu-wrap { position: relative; }
.il-menu {
    position: absolute; right: 0; top: 32px; z-index: 5; min-width: 170px; padding: 8px 10px;
    background: var(--interloki-bg); border: 1px solid var(--interloki-border); border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3); font-size: 12px;
}
.il-menu p { margin: 0 0 6px; color: var(--interloki-fg-secondary); font-size: 11px; }
.il-menu label { display: flex; gap: 8px; align-items: center; padding: 3px 0; cursor: pointer; }
.il-menu input { accent-color: var(--interloki-accent); }

.il-filter {
    display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 10px; flex-shrink: 0;
    border-bottom: 1px solid var(--interloki-border); background: var(--interloki-bg);
}
.il-search-i { width: 14px; height: 14px; color: var(--interloki-fg-secondary); flex-shrink: 0; }
.il-filter input {
    flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--interloki-fg);
    font: 13px var(--mono);
}
.il-filter input::placeholder { color: var(--interloki-fg-secondary); }
.il-levels { display: flex; gap: 4px; flex-shrink: 0; }
.lv {
    font: 600 10.5px var(--mono); padding: 2px 6px; border-radius: 3px; border: 1px solid transparent;
    background: transparent; opacity: .4; transition: opacity .15s;
}
.lv[aria-pressed="true"] { opacity: 1; }
.lv-debug, .lvl-debug { color: var(--interloki-level-debug); background: rgba(107, 114, 128, .15); }
.lv-info, .lvl-info { color: var(--interloki-level-info); background: rgba(37, 99, 235, .14); }
.lv-warn, .lvl-warn { color: var(--interloki-level-warn); background: rgba(217, 119, 6, .14); }
.lv-error, .lvl-error { color: var(--interloki-level-error); background: rgba(220, 38, 38, .16); }
.il-rx {
    flex-shrink: 0; font: 600 11px var(--mono); padding: 1px 7px; border-radius: 4px;
    border: 1px solid var(--interloki-border); background: var(--interloki-bg-secondary); color: var(--interloki-fg-secondary);
}
.il-rx[aria-pressed="true"] { color: var(--interloki-accent); border-color: var(--interloki-accent); }
.il-filter.bad input { color: var(--interloki-level-error); }

.il-body { flex: 1; min-height: 0; display: flex; position: relative; }
.il-list { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; outline: none; overscroll-behavior: contain; }
.il-list::-webkit-scrollbar { width: 10px; }
.il-list::-webkit-scrollbar-thumb { background: var(--interloki-border); border-radius: 6px; border: 2px solid var(--interloki-bg); }
.row {
    display: flex; align-items: center; gap: 8px; height: 24px; padding: 0 8px;
    white-space: nowrap; cursor: pointer; user-select: none; transition: background-color .1s;
}
.row:nth-child(even) { background: var(--interloki-bg-secondary); }
.row:hover { background: var(--interloki-bg-hover); }
.row.sel, .row.sel:nth-child(even) { background: var(--interloki-bg-active); }
.row.fresh { animation: fresh .9s ease-out; }
@keyframes fresh { from { box-shadow: inset 2px 0 0 var(--interloki-accent); } to { box-shadow: inset 2px 0 0 transparent; } }
.r-t { flex-shrink: 0; color: var(--interloki-fg-secondary); min-width: 95px; }
.r-l { flex-shrink: 0; min-width: 48px; text-align: center; font-weight: 600; font-size: 11px; border-radius: 3px; padding: 1px 4px; }
.r-s { flex-shrink: 0; color: var(--interloki-fg-secondary); opacity: .75; font-size: 11px; width: 104px; overflow: hidden; text-overflow: ellipsis; }
.r-m { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.r-m.json { color: var(--interloki-fg-secondary); }
.r-m mark { background: rgba(250, 204, 21, .35); color: inherit; border-radius: 2px; }
.il.hide-time .r-t, .il.hide-level .r-l, .il.hide-source .r-s { display: none; }
.il-empty { padding: 28px 16px; color: var(--interloki-fg-secondary); font-size: 12.5px; }

.il-detail {
    width: 46%; max-width: 440px; min-width: 300px; border-left: 1px solid var(--interloki-border);
    background: var(--interloki-bg); display: flex; flex-direction: column; animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(16px); opacity: 0; } }
.il-detail-head {
    display: flex; justify-content: space-between; align-items: center; height: 36px; padding: 0 8px 0 12px;
    border-bottom: 1px solid var(--interloki-border); font-weight: 600; font-size: 12.5px; flex-shrink: 0;
}
.il-x { border: 0; }
.il-detail-body { overflow: auto; padding: 10px 12px 16px; font-size: 12px; }
.il-detail-body h4 { margin: 12px 0 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--interloki-fg-secondary); font-weight: 600; }
.il-detail-body table { border-collapse: collapse; width: 100%; }
.il-detail-body td { padding: 3px 0; vertical-align: top; }
.il-detail-body td:first-child { color: var(--interloki-fg-secondary); width: 96px; }
.il-detail-body pre {
    margin: 0; padding: 8px 10px; background: var(--interloki-bg-secondary); border: 1px solid var(--interloki-border);
    border-radius: 4px; white-space: pre-wrap; word-break: break-all; font: 12px/1.55 var(--mono);
}
.jk { color: var(--j-key); } .js { color: var(--j-str); } .jn { color: var(--j-num); } .jb { color: var(--j-bool); }

.il-jump {
    position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 3;
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 9px; border-radius: 99px;
    background: var(--interloki-accent); color: #fff; border: 0; font-size: 12px; font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
}
.il[data-theme="catppuccin-mocha"] .il-jump { color: #1e1e2e; }
.il-jump svg { width: 14px; height: 14px; }

.il-status {
    display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 10px 0 12px; flex-shrink: 0;
    border-top: 1px solid var(--interloki-border); background: var(--interloki-bg-secondary);
    font-size: 11.5px; color: var(--interloki-fg-secondary);
}
.il-status b { color: var(--interloki-fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.il-conn { display: inline-flex; align-items: center; gap: 6px; }
.il-conn i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.il.paused .il-conn i { background: var(--interloki-level-warn); }
.il-sep { width: 1px; height: 14px; background: var(--interloki-border); }
.il-pause {
    width: 30px; height: 22px; display: grid; place-items: center; border-radius: 4px;
    border: 1px solid var(--interloki-border); background: var(--interloki-bg); color: var(--interloki-fg);
}
.il-pause svg { width: 13px; height: 13px; }
.il .i-play { display: none; }
.il.paused .i-play { display: block; }
.il.paused .i-pause { display: none; }
.il.paused .il-pause { border-color: var(--interloki-level-warn); color: var(--interloki-level-warn); }

/* ---------- flume ---------- */
.fl { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.fl-diagram {
    min-width: 0; min-height: 0; display: flex; flex-direction: column;
    border: 1px solid var(--line-2); border-radius: 10px; background: var(--ink-2); overflow: hidden;
}
.fl-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 14px;
    border-bottom: 1px solid var(--line); background: var(--ink-3);
}
.fl-group { display: flex; align-items: center; gap: 6px; }
.fl-lbl { font-size: 11px; color: var(--dim); margin-right: 2px; }
.seg {
    font-size: 11.5px; padding: 3px 9px; border-radius: 5px; border: 1px solid var(--line-2); background: transparent; color: var(--muted);
}
.seg[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: var(--accent); font-weight: 600; }
.tgl {
    display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; padding: 3px 10px 3px 6px;
    border-radius: 99px; border: 1px solid var(--line-2); background: transparent; color: var(--muted);
}
.tgl i { width: 22px; height: 12px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; }
.tgl i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--paper); transition: transform .2s; }
.tgl[aria-pressed="true"] { color: var(--paper); }
.tgl[aria-pressed="true"] i { background: var(--accent); }
.tgl[aria-pressed="true"] i::after { transform: translateX(10px); background: var(--ink); }
.act {
    font-size: 11.5px; padding: 4px 11px; border-radius: 5px; border: 1px solid var(--accent);
    background: rgba(255, 255, 255, .02); color: var(--accent); font-weight: 600;
}
.act:hover { background: var(--accent); color: var(--ink); }
.act.ghost { border-color: var(--line-2); color: var(--muted); font-weight: 400; }
.act.ghost:hover { background: var(--ink-3); color: var(--paper); border-color: var(--muted); }
.act:disabled { opacity: .4; cursor: default; }
input[type="range"] { accent-color: var(--accent); width: 110px; }

.fl-svg-wrap { flex: 1; min-height: 0; position: relative; padding: 6px; }
#fl-svg { width: 100%; height: 100%; display: block; }
.fl-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.fl-stats div { padding: 10px 14px; border-right: 1px solid var(--line); display: grid; gap: 1px; min-width: 0; }
.fl-stats div:last-child { border-right: 0; }
.fl-stats span { font-size: 10.5px; color: var(--dim); text-transform: lowercase; }
.fl-stats b { font: 600 20px/1.2 var(--mono); color: var(--paper); font-variant-numeric: tabular-nums; }
.fl-stats em { font-style: normal; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* svg pieces */
.n-node { fill: rgba(255, 255, 255, .015); stroke: var(--line-2); stroke-dasharray: 3 4; }
.n-label { fill: var(--dim); font: 10.5px var(--mono); }
.n-box { fill: var(--ink-3); stroke: var(--line-2); }
.n-box.hot { stroke: var(--mint); }
.n-title { fill: var(--paper); font: 600 12.5px var(--mono); }
.n-sub { fill: var(--muted); font: 10.5px var(--mono); }
.n-num { fill: var(--mint); font: 600 11px var(--mono); }
.pod { fill: #1c2019; stroke: #3a4033; transition: opacity .3s, stroke .3s; }
.pod.match { stroke: var(--mint); }
.pod.off { opacity: .28; }
.pod-t { fill: #c9c6bb; font: 9.5px var(--mono); pointer-events: none; transition: opacity .3s; }
.pod-t.off { opacity: .3; }
.wire { fill: none; stroke: #343a2d; stroke-width: 1.4; }
.wire.s3 { stroke-dasharray: 4 5; }
.wire.s3.off { opacity: .25; }
.wire-lbl { fill: var(--dim); font: 9.5px var(--mono); }
.pkt { fill: var(--mint); }
.pkt.s3 { fill: var(--amber); }
.pkt.ws { fill: var(--sky); }
.pkt.err { fill: #ff6b6b; }
.db-body { fill: var(--ink-3); stroke: var(--line-2); }
.s3-off .s3grp { opacity: .3; }

.fl-config {
    min-width: 0; min-height: 0; display: flex; flex-direction: column;
    border: 1px solid var(--line-2); border-radius: 10px; background: var(--ink-2); overflow: hidden;
}
.cfg-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--ink-3); overflow-x: auto; }
.cfg-tab {
    padding: 9px 13px; font-size: 11.5px; border: 0; background: none; color: var(--muted); border-right: 1px solid var(--line); white-space: nowrap;
}
.cfg-tab[aria-selected="true"] { color: var(--paper); background: var(--ink-2); box-shadow: inset 0 2px 0 var(--accent); }
.code {
    margin: 0; padding: 14px 16px; font: 12px/1.7 var(--mono); color: #d8d5ca; overflow: auto; flex: 1; min-height: 0;
    white-space: pre; tab-size: 4;
}
.cfg-note { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.cfg-note b { color: var(--paper); font-weight: 600; }

/* syntax */
.t-k { color: #ff9e7a; }
.t-s { color: #b9e08f; }
.t-c { color: #6c7163; font-style: italic; }
.t-n { color: #f3b558; }
.t-f { color: #8ab8ff; }
.t-t { color: #7fd8d0; }
.t-key { color: #8fe0b2; }
.t-p { color: #8e9184; }
.t-b { color: #e6a3ff; }
.ln { display: inline-block; width: 2.4em; color: #3d4236; user-select: none; text-align: right; margin-right: 1.1em; }
.hl-line { display: block; margin: 0 -16px; padding: 0 16px; }
.hl-line.on { background: rgba(255, 143, 107, .1); box-shadow: inset 2px 0 0 var(--coral); }
.flash { animation: flash 1s ease-out; }
@keyframes flash { 0% { background: rgba(255, 143, 107, .45); } 100% { background: transparent; } }

/* ---------- pipeline ---------- */
.pl { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 16px; }
.pl-code {
    min-width: 0; min-height: 0; display: flex; flex-direction: column;
    border: 1px solid var(--line-2); border-radius: 10px; background: var(--ink-2); overflow: hidden;
}
.pl-file {
    display: flex; justify-content: space-between; align-items: center; padding: 9px 14px;
    border-bottom: 1px solid var(--line); background: var(--ink-3); font-size: 11.5px; color: var(--muted);
}
.pl-dirty { color: var(--coral); font-size: 10.5px; border: 1px solid rgba(255, 143, 107, .4); border-radius: 99px; padding: 0 7px; }
.pl-code .code { font-size: 11.5px; line-height: 1.68; }
.inl-n {
    display: inline-flex; align-items: center; gap: 0; vertical-align: baseline; border-radius: 4px;
    background: rgba(243, 181, 88, .12); outline: 1px solid rgba(243, 181, 88, .35);
}
.inl-n button {
    width: 16px; height: 17px; padding: 0; border: 0; background: transparent; color: var(--amber);
    font: 700 12px/1 var(--mono); display: inline-grid; place-items: center;
}
.inl-n button:hover { background: rgba(243, 181, 88, .25); }
.inl-n b { color: var(--amber); font-weight: 700; min-width: 1ch; text-align: center; }

.pl-viz {
    min-width: 0; min-height: 0; display: flex; flex-direction: column;
    border: 1px solid var(--line-2); border-radius: 10px; background: var(--ink-2); overflow: hidden;
}
.pl-controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--ink-3); }
.pl-ctl-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.pl-board { flex: 1; min-height: 360px; position: relative; display: flex; flex-direction: column; padding: 14px 16px; }
.pl-src {
    align-self: flex-start; display: flex; align-items: baseline; gap: 8px; min-width: 150px;
    border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 12px; background: var(--ink-3);
}
.pl-sink { display: flex; gap: 10px; }
.pl-out, .pl-errs { flex: 1; display: flex; align-items: baseline; gap: 8px; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 12px; background: var(--ink-3); }
.pl-k { font-size: 10.5px; color: var(--dim); }
.pl-src b, .pl-out b, .pl-errs b { font: 600 20px/1.15 var(--mono); font-variant-numeric: tabular-nums; }
.pl-src em, .pl-out em, .pl-errs em { font-style: normal; font-size: 10.5px; color: var(--muted); }
.pl-out b { color: var(--mint); }
.pl-errs b { color: #ff7b7b; }
.pl-stages { flex: 1; display: flex; flex-direction: column; min-height: 0; margin: 10px 0; }
.pl-stage { flex: 1; display: flex; align-items: center; gap: 12px; border-top: 1px dashed #2f3429; padding: 8px 0; position: relative; }
.pl-stage:last-child { border-bottom: 1px dashed #2f3429; }
.pl-stage-h { width: 96px; flex-shrink: 0; }
.pl-stage-h b { display: block; font-size: 13px; color: var(--paper); }
.pl-stage-h span { font-size: 10.5px; color: var(--dim); }
.pl-workers { flex: 1; display: flex; gap: 8px; min-width: 0; }
.pl-w {
    flex: 1; max-width: 118px; min-width: 0; height: 40px; border: 1px solid var(--line-2); border-radius: 7px; position: relative;
    background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(255, 255, 255, .015) 6px 12px);
    display: flex; align-items: center; padding: 0 8px; font-size: 9.5px; color: var(--dim);
    transition: border-color .2s, box-shadow .2s;
}
.pl-w.work { border-color: rgba(143, 224, 178, .6); }
.pl-w.block { border-color: #f3b558; box-shadow: 0 0 0 3px rgba(243, 181, 88, .12); }
.pl-w .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--mint); border-radius: 0 2px 2px 0; }
.pl-w.block .bar { display: none; }
.pl-w-lbl { position: relative; z-index: 1; margin-left: auto; }
.pl-chips { position: absolute; inset: 0; pointer-events: none; }
.chip-item {
    position: absolute; left: 0; top: 0; height: 22px; padding: 0 7px; border-radius: 5px;
    display: flex; align-items: center; font: 600 10.5px var(--mono); color: var(--ink);
    background: var(--paper); white-space: nowrap;
    transition: transform .42s cubic-bezier(.3, .7, .2, 1), background-color .2s, opacity .35s;
    will-change: transform;
}
.chip-item.work { background: var(--mint); }
.chip-item.block { background: var(--amber); }
.chip-item.bad { background: #ff7b7b; }
.chip-item.gone { opacity: 0; }
.pl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.pl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-work { background: var(--mint); }
.lg-block { background: var(--amber); }
.lg-idle { border: 1px solid var(--line-2); }
.pl-tp { margin-left: auto; }
.pl-tp b { color: var(--paper); }

/* ---------- toast / ribbon ---------- */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 60;
    padding: 8px 14px; border-radius: 6px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 600;
    transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.ribbon {
    position: fixed; top: 16px; right: 16px; z-index: 50; text-decoration: none;
    font-size: 11px; padding: 4px 10px; border-radius: 999px;
    background: var(--ink-3); border: 1px solid var(--line-2); color: var(--muted);
}
.ribbon:hover { color: var(--paper); border-color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
    .tool { grid-template-columns: 330px minmax(0, 1fr); }
    .intro h1 { font-size: 52px; }
    .fl { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 210px; }
    .tab-sub { display: none; }
}
@media (max-width: 1100px) {
    .pl { grid-template-columns: minmax(0, 1fr); grid-template-rows: 250px minmax(0, 1fr); }
}
@media (max-width: 900px) {
    .top { gap: 10px; padding: 0 14px; height: auto; flex-wrap: wrap; }
    .brand { height: 50px; }
    .top-meta { display: none; }
    .tabs { order: 3; flex-basis: 100%; margin: 0 -14px; padding: 0 6px; border-top: 1px solid var(--line); overflow-x: auto; }
    .tab { padding: 12px 10px; }
    .tab-sub { display: none; }
    main { min-height: 0; }
    .tool { display: flex; flex-direction: column; height: auto; min-height: 0; }
    .intro { border-right: 0; border-bottom: 1px solid var(--line); padding: 22px 16px 20px; gap: 14px; overflow: visible; }
    .intro h1 { font-size: 44px; }
    .lede { font-size: 15px; }
    .meta { margin-top: 2px; }
    .stage { padding: 16px 12px 20px; }
    .frame { flex: none; height: 600px; }
    .frame-url { display: none; }
    .fl { display: flex; flex-direction: column; }
    .fl-svg-wrap { flex: none; }
    .fl-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .fl-stats div:nth-child(3) { border-right: 0; }
    .fl-stats div:nth-child(n+4) { border-top: 1px solid var(--line); }
    .fl-config { height: 360px; flex: none; }
    .pl { display: flex; flex-direction: column; }
    .pl-code { height: 330px; flex: none; }
    .pl-board { padding: 12px; }
    .pl-stage-h { width: 70px; }
    .ribbon { top: 14px; right: 14px; }
}
@media (max-width: 560px) {
    .il-levels .lv { padding: 2px 4px; font-size: 9.5px; }
    .lv-debug { display: none; }
    .r-s { display: none; }
    .r-t { display: none; }
    .hide-sm { display: none; }
    .il-detail { position: absolute; inset: 0; width: auto; max-width: none; min-width: 0; z-index: 4; }
    .fl-toolbar { gap: 8px 12px; }
    input[type="range"] { width: 90px; }
    .pl-stage-h b { font-size: 11.5px; }
    .pl-src em, .pl-out em, .pl-errs em { display: none; }
    .pl-src { min-width: 70px; }
    .chip-item { font-size: 9.5px; padding: 0 5px; height: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 4px 0 0; border: 1px solid var(--line); border-radius: 8px; }
.facts div { padding: 10px 12px; border-right: 1px solid var(--line); }
.facts div:last-child { border-right: 0; }
.facts dt { font: 600 19px/1.2 var(--mono); color: var(--paper); }
.facts dd { margin: 2px 0 0; font-size: 10.5px; color: var(--dim); line-height: 1.35; }
.pl-insight { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--paper); min-height: 38px; }
@media (max-width: 900px) {
    .tabs { flex-basis: calc(100% + 28px); }
    .feats { display: none; }
    .pl-board { min-height: 440px; }
}

*, *::before, *::after { font-variant-ligatures: none !important; font-feature-settings: "liga" 0, "calt" 0 !important; }
