/* DNAScale — design tokens (LabScale palette) */
:root {
  --bg: #eef0f4; --panel: #ffffff; --panel-2: #f6f7f9; --raised: #ffffff;
  --line: #d9dde5; --line-2: #c8cdd8;
  --text: #1c2230; --text-2: #4a5367; --muted: #667085;
  --accent: #2563eb; --accent-2: #1d4ed8; --accent-soft: #e3ecff; --accent-line: #b9cdf8;
  --ok: #15803d; --ok-soft: #e0f3e6; --warn: #c2410c; --warn-soft: #fdeadd; --bad: #d1344a; --bad-soft: #fde7ea;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-2: 0 12px 32px -8px rgba(16, 24, 40, .22), 0 2px 6px rgba(16, 24, 40, .08);
  --sel: rgba(37, 99, 235, .14); --sel-line: rgba(37, 99, 235, .9);
  --col-hi: rgba(37, 99, 235, .06);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --r: 10px; --r-sm: 7px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1218; --panel: #171c25; --panel-2: #1d232e; --raised: #1d232e;
  --line: #2a313e; --line-2: #394253;
  --text: #e6e9ef; --text-2: #b4bccb; --muted: #8b94a5;
  --accent: #5b9bff; --accent-2: #8ab8ff; --accent-soft: #1d2a42; --accent-line: #2f4a78;
  --ok: #4ade80; --ok-soft: #12331f; --warn: #fb923c; --warn-soft: #3a2412; --bad: #ff6b81; --bad-soft: #3a1a22;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 16px 40px -8px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .4);
  --sel: rgba(91, 155, 255, .2); --sel-line: rgba(138, 184, 255, .95);
  --col-hi: rgba(91, 155, 255, .08);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13px/1.45 var(--sans); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

#app { height: 100vh; display: grid; grid-template-rows: 52px minmax(0, 1fr) 26px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: 6px; }
.brand .logo { width: 28px; height: 28px; flex: none; }
.brand b { font-size: 15px; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 11.5px; display: block; line-height: 1.1; margin-top: 1px; }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; color: var(--text-2); cursor: pointer; display: flex; gap: 6px; align-items: center; font-weight: 500; }
.seg button:hover { color: var(--text); }
.seg button[aria-selected="true"], .seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow-1); }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--panel); color: var(--text); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--panel-2); border-color: var(--line-2); }
.btn:active { transform: translateY(.5px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.icon { padding: 6px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
kbd { font: 11px/1 var(--mono); padding: 2px 5px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--muted); border-bottom-width: 2px; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 230px; background: var(--raised); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow-2); padding: 5px; z-index: 50; }
.menu button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 7px 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--accent-soft); color: var(--accent); }
.menu button small { margin-left: auto; color: var(--muted); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.menu .lbl { padding: 5px 10px 3px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---------- layout ---------- */
.body { display: grid; grid-template-columns: var(--sb-w, 264px) minmax(0, 1fr) var(--in-w, 328px); min-height: 0; }
#app.no-sidebar .body { grid-template-columns: 0 minmax(0, 1fr) var(--in-w, 328px); }
#app.no-inspector .body { grid-template-columns: var(--sb-w, 264px) minmax(0, 1fr) 0; }
#app.no-sidebar.no-inspector .body { grid-template-columns: 0 minmax(0, 1fr) 0; }
#app.no-sidebar #sidebar, #app.no-inspector #inspector { visibility: hidden; border: 0; }
aside { background: var(--panel); min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
#sidebar { border-right: 1px solid var(--line); }
#inspector { border-left: 1px solid var(--line); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; }
.panel-head h3 { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; }

/* sidebar list */
.search { position: relative; margin: 0 12px 8px; }
.search input { width: 100%; padding: 7px 10px 7px 30px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); outline: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--panel); }
.search svg { position: absolute; left: 9px; top: 8px; color: var(--muted); }
#seqList { flex: 1; overflow: auto; padding: 0 8px 8px; }
.seq { display: grid; grid-template-columns: 14px 1fr auto; gap: 2px 8px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; position: relative; }
.seq:hover { background: var(--panel-2); }
.seq.sel { background: var(--accent-soft); border-color: var(--accent-line); }
.seq.drop-before::before { content: ""; position: absolute; left: 6px; right: 6px; top: -2px; height: 2px; background: var(--accent); border-radius: 2px; }
.seq .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.seq .dot.dna { background: #3ea66b; } .seq .dot.protein { background: #a15cd8; } .seq .dot.trace { background: #3b82f6; }
.seq .nm { font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seq .meta { grid-column: 2; display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); min-width: 0; }
.seq .meta canvas { height: 12px; width: 70px; border-radius: 3px; }
.seq .eye { grid-row: 1 / span 2; grid-column: 3; border: 0; background: transparent; color: var(--muted); padding: 4px; border-radius: 6px; cursor: pointer; }
.seq .eye:hover { background: var(--line); color: var(--text); }
.seq.off { opacity: .5; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 650; letter-spacing: .04em; padding: 1px 6px; border-radius: 99px; background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line); }
.chip.ref { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.rc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.sidebar-foot { padding: 10px 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.sidebar-foot .btn { justify-content: center; }
.hint { color: var(--muted); font-size: 12px; padding: 14px 16px; text-align: center; }

/* ---------- main ---------- */
main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--bg); }
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.toolstrip { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.toolstrip::-webkit-scrollbar { display: none; }
.toolstrip > *, .toolstrip .grp { flex: none; }
.toolstrip .spacer { min-width: 8px; }
.toolstrip .grp { display: flex; align-items: center; gap: 6px; }
.toolstrip .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.toolstrip label { color: var(--muted); font-size: 12px; }
select.sel, .field { padding: 5px 8px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel); outline: none; }
select.sel:focus, .field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="range"] { accent-color: var(--accent); }
.zoom { width: 96px; }

#alignHost { flex: 1; min-height: 120px; position: relative; background: var(--panel); outline: none; }
#alignScroller { position: absolute; inset: 0; overflow: auto; outline: none; overscroll-behavior: contain; }
#alignSpacer { position: absolute; top: 0; left: 0; width: 1px; height: 1px; pointer-events: none; }
#alignCanvas { position: sticky; top: 0; left: 0; display: block; }
#overview { height: 38px; background: var(--panel); border-top: 1px solid var(--line); position: relative; flex: none; cursor: pointer; }
#overview canvas { width: 100%; height: 100%; display: block; }

.splitter { height: 7px; flex: none; cursor: row-resize; background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; }
.splitter::after { content: ""; position: absolute; left: 50%; top: 2px; width: 36px; height: 2px; margin-left: -18px; border-radius: 2px; background: var(--line-2); }
.splitter:hover::after, .splitter.drag::after { background: var(--accent); }

#traceDock { height: var(--dock-h, clamp(200px, 36vh, 330px)); flex: none; display: flex; flex-direction: column; background: var(--panel); min-height: 0; }
#traceDock.collapsed { height: 38px; }
.dock-head { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); flex: none; flex-wrap: nowrap; overflow: hidden; }
.dock-head .title { font-weight: 650; display: flex; gap: 8px; align-items: center; min-width: 0; }
.dock-head .title span.nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
#trChips { display: inline-flex; gap: 6px; white-space: nowrap; }
.dock-head .title { flex: 0 1 auto; }
.dock-head .tools { flex: none; }
.dock-head .tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.dock-head label.chk { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12px; cursor: pointer; white-space: nowrap; }
#traceBody { flex: 1; min-height: 0; position: relative; }
#traceCanvas { width: 100%; height: 100%; display: block; cursor: grab; }
#traceCanvas.panning { cursor: grabbing; }
.dock-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 20px; }
.legend { display: inline-flex; gap: 8px; font-size: 12px; font-weight: 650; }
.legend i { font-style: normal; display: inline-flex; align-items: center; gap: 4px; }
.legend i::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: currentColor; }

/* ---------- inspector ---------- */
#inspectorBody { flex: 1; overflow: auto; padding: 0 0 20px; }
.card { border-top: 1px solid var(--line); padding: 12px 14px; }
.card:first-child { border-top: 0; }
.card h4 { margin: 0 0 9px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card h4 .r { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bigres { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.bigres .letter { width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center; font: 700 24px var(--mono); color: #fff; flex: none; }
.bigres .where { line-height: 1.3; }
.bigres .where b { font-size: 14px; }
.bars { display: grid; gap: 4px; margin-top: 8px; }
.bar { display: grid; grid-template-columns: 18px 1fr 34px; gap: 8px; align-items: center; font-size: 12px; }
.bar .track { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.bar .fill { height: 100%; border-radius: 3px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 -14px 10px; padding: 0 10px; }
.tabs button { border: 0; background: transparent; padding: 7px 10px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 550; margin-bottom: -1px; }
.tabs button.on { color: var(--accent); border-color: var(--accent); }
.list { display: grid; gap: 2px; max-height: 240px; overflow: auto; margin: 0 -6px; }
.list button { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 5px 8px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; font-size: 12.5px; }
.list button:hover { background: var(--accent-soft); }
.list button small { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
.protein-out { font: 12px/1.6 var(--mono); word-break: break-all; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; max-height: 150px; overflow: auto; user-select: all; }
.protein-out .stop { color: var(--bad); font-weight: 700; } .protein-out .met { color: var(--ok); font-weight: 700; }
.slider-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.slider-row input { width: 100%; }
.callout { padding: 9px 11px; border-radius: 9px; font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2); }
.callout.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.callout.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.qhist { display: flex; height: 36px; align-items: flex-end; gap: 1px; margin: 8px 0 4px; }
.qhist i { flex: 1; background: var(--accent); opacity: .75; border-radius: 1px 1px 0 0; min-height: 1px; }

/* ---------- tree + matrix ---------- */
.pane { flex: 1; min-height: 0; overflow: auto; background: var(--panel); position: relative; }
.pane-head { display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.pane-head h2 { font-size: 14px; margin: 0; }
#treeSvg text { font: 12px var(--sans); fill: var(--text); }
#treeSvg .branch { stroke: var(--text-2); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
#treeSvg .tip { cursor: pointer; }
#treeSvg .tip:hover text { fill: var(--accent); font-weight: 650; }
#matrixWrap { padding: 18px; }
table.mx { border-collapse: separate; border-spacing: 2px; font-size: 12px; }
table.mx th { font-weight: 560; color: var(--text-2); padding: 3px 8px; white-space: nowrap; text-align: right; }
table.mx th.cn { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; vertical-align: bottom; padding: 8px 3px; }
table.mx td { width: 46px; height: 32px; text-align: center; border-radius: 6px; font-variant-numeric: tabular-nums; font-weight: 560; cursor: default; }
table.mx td:hover { outline: 2px solid var(--accent); }

/* ---------- empty state ---------- */
#empty { position: absolute; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 5; padding: 24px; overflow: auto; }
.empty-card { width: min(680px, 100%); text-align: center; }
.empty-card .hero { width: 120px; height: 120px; margin: 0 auto 8px; }
.empty-card h1 { font-size: 26px; letter-spacing: -.02em; margin: 6px 0 6px; }
.empty-card p { color: var(--text-2); font-size: 14.5px; margin: 0 auto 22px; max-width: 520px; }
.drop { border: 2px dashed var(--line-2); border-radius: 16px; padding: 28px; background: var(--panel); transition: .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.formats { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; text-align: left; }
.flow div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 12.5px; color: var(--text-2); }
.flow b { display: block; color: var(--text); margin-bottom: 2px; font-size: 13px; }
.flow span.n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 11px; margin-bottom: 6px; }
@media (max-width: 720px) { .flow { grid-template-columns: 1fr; } }

/* ---------- status bar ---------- */
#status { display: flex; align-items: center; gap: 16px; padding: 0 12px; background: var(--panel); border-top: 1px solid var(--line); color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; }
#status .grow { flex: 1; }
#status b { color: var(--text); font-weight: 600; }
#status .res { font-family: var(--mono); padding: 0 5px; border-radius: 4px; color: #fff; font-weight: 700; }

/* ---------- overlays ---------- */
#dropOverlay { position: fixed; inset: 0; z-index: 90; background: color-mix(in srgb, var(--accent) 14%, transparent); backdrop-filter: blur(3px); display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .15s; }
#dropOverlay.on { opacity: 1; }
#dropOverlay div { border: 2px dashed var(--accent); border-radius: 22px; padding: 44px 64px; background: var(--panel); font-size: 18px; font-weight: 650; box-shadow: var(--shadow-2); }
dialog { border: 1px solid var(--line-2); border-radius: 14px; padding: 0; background: var(--raised); color: var(--text); box-shadow: var(--shadow-2); width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 14, 22, .42); backdrop-filter: blur(2px); }
.dlg-head { padding: 16px 20px 6px; } .dlg-head h2 { margin: 0 0 2px; font-size: 17px; } .dlg-head p { margin: 0; color: var(--muted); }
.dlg-body { padding: 10px 20px 4px; display: grid; gap: 14px; }
.dlg-foot { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 8px; padding: 14px 20px 18px; }
.opt { display: grid; grid-template-columns: 22px 1fr; gap: 2px 10px; align-items: start; padding: 11px 12px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; }
.opt:hover { background: var(--panel-2); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt input { margin-top: 3px; accent-color: var(--accent); }
.opt b { font-weight: 600; } .opt span { color: var(--text-2); font-size: 12.5px; grid-column: 2; }
.row-opts { display: grid; gap: 8px; }
.row-opts label { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.row-opts input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
textarea.field { width: 100%; min-height: 180px; font: 12.5px var(--mono); resize: vertical; }

#palette { width: min(620px, calc(100vw - 32px)); margin-top: 14vh; }
#palette input { width: 100%; padding: 15px 18px; border: 0; border-bottom: 1px solid var(--line); background: transparent; font-size: 15px; outline: none; border-radius: 14px 14px 0 0; }
#palList { max-height: 360px; overflow: auto; padding: 6px; }
#palList button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 12px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left; }
#palList button.on { background: var(--accent-soft); color: var(--accent); }
#palList button small { margin-left: auto; color: var(--muted); }
#toasts { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 120; justify-items: center; }
.toast { display: flex; align-items: center; gap: 12px; padding: 9px 12px 9px 15px; background: var(--text); color: var(--bg); border-radius: 11px; box-shadow: var(--shadow-2); animation: tin .18s ease-out; max-width: 80vw; }
.toast button { border: 0; background: color-mix(in srgb, var(--bg) 20%, transparent); color: inherit; padding: 3px 10px; border-radius: 6px; font-weight: 600; cursor: pointer; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.busy { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; background: rgba(10, 14, 22, .3); }
.busy div { background: var(--raised); padding: 16px 22px; border-radius: 12px; box-shadow: var(--shadow-2); font-weight: 600; display: flex; gap: 12px; align-items: center; }
.spin { width: 18px; height: 18px; border: 2.5px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.ctx { position: fixed; z-index: 100; }
.shortcuts { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; font-size: 13px; }
.shortcuts h5 { grid-column: 1 / -1; margin: 8px 0 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; border: 3px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }
@media (max-width: 1240px) { :root { --in-w: 296px; --sb-w: 228px; } .brand small, .legend, .dock-head .muted, #btnPalette .lbl, #btnPalette kbd { display: none; } }
@media (max-width: 900px) { .btn .lbl2 { display: none; } .toolstrip label { display: none; } #trChips { display: none; } .dock-head label.chk:nth-of-type(2) { display: none; } }

.legal { max-height: 58vh; overflow: auto; font-size: 13px; line-height: 1.55; padding-right: 6px; }
.legal h4 { margin: 14px 0 3px; font-size: 14px; } .legal p { margin: 4px 0 8px; color: var(--text-2); }
.legal-links a { color: var(--muted); text-decoration: none; } .legal-links a:hover { color: var(--accent); }
#ltabs button.on { background: var(--panel); color: var(--accent); font-weight: 600; box-shadow: var(--shadow-1); }

.grp { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px 4px; margin-top: 6px; cursor: pointer; border-radius: 8px; color: var(--muted); font-size: 11.5px; }
.grp b { color: var(--text); font-size: 12px; } .grp span { margin-left: auto; }
.grp:hover { background: var(--panel-2); } .grp.on b { color: var(--accent); }
.grp.on { box-shadow: inset 2px 0 0 var(--accent); }

#findPanel { position: absolute; top: 8px; right: 22px; z-index: 6; width: min(420px, calc(100% - 44px)); background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-2); padding: 8px; }
.find-row { display: flex; align-items: center; gap: 6px; } .find-row.opts { margin-top: 6px; padding-left: 2px; font-size: 12px; color: var(--text-2); }
.find-row input#findQ { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font: 13px var(--mono); padding: 4px 2px; }
.find-row .chk { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
#findList { max-height: 200px; overflow: auto; margin-top: 6px; }
#findList:empty { display: none; }
#findList button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 4px 8px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; font-size: 12px; text-align: left; }
#findList button:hover { background: var(--panel-2); } #findList button.on { background: var(--accent-soft); color: var(--accent); }
#findList small { color: var(--muted); }
#anBody { padding: 16px; display: grid; gap: 16px; align-content: start; background: var(--bg); }
.card.an { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.card.an canvas { display: block; width: 100%; border-radius: 8px; }
.num-in { width: 64px; padding: 2px 6px; }
.note { font-size: 12px; margin-top: 8px; }
.orf-list { max-height: 220px; overflow: auto; margin-top: 10px; display: grid; gap: 1px; }
.orf { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 4px 8px; border-radius: 7px; cursor: pointer; font-size: 12.5px; }
.orf:hover { background: var(--panel-2); } .orf.on { background: var(--accent-soft); }
.orf .acts { display: flex; gap: 4px; }
.enz { display: flex; flex-wrap: wrap; gap: 4px 6px; max-height: 130px; overflow: auto; margin: 8px 0; }
.enz label { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border: 1px solid var(--line-2); border-radius: 99px; font-size: 12px; cursor: pointer; }
.enz label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.enz small { color: var(--muted); } .enz input { accent-color: var(--accent); margin: 0; }
table.frag { border-collapse: collapse; font-size: 12.5px; margin-top: 10px; min-width: 320px; }
table.frag th, table.frag td { padding: 4px 14px 4px 0; text-align: left; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.frag .r { text-align: right; }
.card.an details { margin-top: 10px; } .card.an summary { cursor: pointer; color: var(--text-2); }
.card.an h4 .r select, .card.an h4 .r input { font-size: 12px; }
.card.an textarea { width: 100%; min-height: 60px; font: 12px var(--mono); resize: vertical; }

.pane-head h2 { white-space: nowrap; } .pane-head > .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.seq .sacts { grid-row: 1 / span 2; grid-column: 3; display: flex; gap: 1px; align-self: center; }
.seq .eye { grid-row: auto; grid-column: auto; }
.seq .del { opacity: 0; } .seq:hover .del, .seq.sel .del { opacity: .7; } .seq .del:hover { opacity: 1; color: var(--bad); background: var(--bad-soft); }

.vz-seqs { display: flex; gap: 12px; margin-left: 8px; flex-wrap: wrap; } .vz-seqs label { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; } .vz-seqs .sel { max-width: 240px; }
.pane.vz { display: flex; flex-direction: column; background: var(--bg); overflow: auto; }
.hx-controls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 12.5px; }
.hx-controls label { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); } .hx-controls .grow { flex: 1; } .hx-controls .chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip-toggle { cursor: pointer; } .chip-toggle input { display: none; } .chip-toggle span { padding: 3px 10px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--panel); color: var(--text-2); }
.chip-toggle input:checked + span { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.hx-stage { position: relative; flex: 1; min-height: 360px; background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--accent) 10%, var(--panel)), var(--panel) 70%); overflow: hidden; }
:root[data-theme="dark"] .hx-stage { background: radial-gradient(ellipse at 50% 40%, #16213a, #0b0f16 75%); }
#hxCanvas { position: absolute; inset: 0; cursor: grab; touch-action: none; } #hxCanvas:active { cursor: grabbing; }
#hxTip { position: absolute; z-index: 3; pointer-events: none; padding: 4px 9px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line-2); box-shadow: var(--shadow-1); font-size: 12px; white-space: nowrap; }
#hxStats { position: absolute; left: 16px; top: 14px; font-size: 12px; color: var(--text-2); line-height: 1.5; pointer-events: none; } #hxStats b { color: var(--text); font-size: 14px; } #hxStats span { color: var(--muted); }
.hx-hint { position: absolute; right: 14px; bottom: 10px; font-size: 11.5px; color: var(--muted); pointer-events: none; }
.hx-strip { background: var(--panel); border-top: 1px solid var(--line); cursor: pointer; } .hx-strip canvas { display: block; width: 100%; }
.dot-wrap { position: relative; padding: 14px 16px 6px; display: flex; justify-content: center; } .dot-wrap .hx-hint { position: static; margin-left: 12px; align-self: flex-end; }
.legend-row { display: flex; gap: 14px; flex-wrap: wrap; padding: 6px 18px 16px; font-size: 12px; color: var(--text-2); } .legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.cgr-row { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; padding: 16px; } .cgr-cell canvas { display: block; border-radius: 12px; box-shadow: var(--shadow-1); } .cgr-title { font-weight: 600; margin-bottom: 6px; text-align: center; }

.menu.ctx { min-width: 0; width: max-content; max-width: 260px; }
.menu.ctx button { white-space: nowrap; gap: 8px; padding: 6px 9px; }
.menu.ctx button small { margin-left: 18px; }
