/* The Amp Distillery · Graphite Ice (dark glass, edge-lit)
 *
 * The look comes from the Inkscape-drawn assets in static/assets/ (sources in ui-kit/graphite/) and the bundled Geist fonts:
 * glass frames are 9-slice SVGs applied with border-image, icons are SVG masks, and the
 * backdrop is a single SVG. CSS here does layout, colour tokens and data-driven fills only.
 */
:root {
  --bg: #06090c;
  --surface: #0f151b;
  --text: #eef5f8;
  --muted: #93a3ad;
  --faint: #7a8a94; /* 4.6:1 on the field wells */
  --line: rgba(230, 249, 255, .08);
  --well: rgba(0, 0, 0, .5);
  --accent: #6fe3ff;
  --accent-ink: #03141a;
  --accent-soft: rgba(111, 227, 255, .12);
  --accent-line: rgba(111, 227, 255, .35);
  --amber: #ffb547;
  --good: #59d9a0;
  --warn: #ffb547;
  --bad: #ff6b6b;
  --chart: #6fe3ff;
  --grid: rgba(230, 249, 255, .07);
  --t1: #6fe3ff; --t2: #ffb547; --t3: #59d9a0; --t4: #b79cff; --t5: #e48cff; --t6: #4f9dff; --t7: #f2ea7a; --t8: #93a3ad;
  /* No reds among the blend colours: in the monitor, red means a neuron that is hurting. */
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
@font-face { font-family: "Geist"; src: url(fonts/Geist-Variable.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url(fonts/Cinzel-Variable.woff2) format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url(fonts/GeistMono-Variable.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
html, body { margin: 0; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url(assets/backdrop.svg) center / cover no-repeat; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Geist", Inter, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; margin: 0; color: var(--muted); font-weight: 600; }
h4 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- glass: drawn frames, applied as 9-slice ---------- */
.panel, .chip, .run-item, .stat, .blend-row, .blender, .player, .files a, pre.log, .model.picked, button.ghost, .primary {
  position: relative; isolation: isolate;
}
#trainBar::before, .panel::before, .chip::before, .run-item::before, .stat::before, .blend-row::before, .blender::before, .player::before,
.files a::before, button.ghost::before, .primary::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border-style: solid; border-width: 0;
}
.panel::before { border-image: url(assets/glass-panel.svg) 84 fill / 84px / 36px stretch; }
.chip::before, .run-item::before, .stat::before, .blend-row::before, .blender::before, .player::before, .files a::before {
  border-image: url(assets/glass-chip.svg) 12 fill / 12px stretch;
}
.run-item.sel::before, .player.b::before { border-image-source: url(assets/glass-chip-selected.svg); }

/* ---------- icons: Inkscape SVGs used as masks, so they take the text colour ---------- */
.i { display: inline-block; flex: none; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.i-search { --i: url(assets/icons/search.svg); } .i-add { --i: url(assets/icons/add.svg); }
.i-check { --i: url(assets/icons/check.svg); } .i-remove { --i: url(assets/icons/remove.svg); }
.i-play { --i: url(assets/icons/play.svg); } .i-pause { --i: url(assets/icons/pause.svg); }
.i-stop { --i: url(assets/icons/stop.svg); } .i-download { --i: url(assets/icons/download.svg); }
.i-monitor { --i: url(assets/icons/monitor.svg); } .i-folder { --i: url(assets/icons/folder.svg); }
.i-chevron { --i: url(assets/icons/chevron.svg); } .i-chevron-right { --i: url(assets/icons/chevron-right.svg); }
.i-back { --i: url(assets/icons/back.svg); } .i-external { --i: url(assets/icons/external.svg); }
.i-log { --i: url(assets/icons/log.svg); } .i-wave { --i: url(assets/icons/wave.svg); }
.i-blend { --i: url(assets/icons/blend.svg); } .i-cancel { --i: url(assets/icons/cancel.svg); }

/* ---------- brand: Cinzel in chrome and ice, as on the Abyssal Audio logo ---------- */
.brandbar { max-width: 1560px; margin: 0 auto; padding: 22px 28px 0; display: flex; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .6)); }
.wordmark {
  font: 600 21px/1 "Cinzel", "Trajan Pro", Georgia, serif; letter-spacing: .06em; text-transform: uppercase;
  background: linear-gradient(180deg, #f6fcff 0%, #bfeaf8 16%, #e9f0f3 34%, #b4c0c7 55%, #7c8a93 78%, #56636c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: .6px rgba(18, 26, 32, .85);
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .9)) drop-shadow(0 3px 6px rgba(0, 0, 0, .55));
}

/* ---------- layout ---------- */
.layout {
  display: grid; grid-template-columns: minmax(290px, 380px) 1fr;
  gap: 22px; padding: 28px; align-items: start; max-width: 1560px; margin: 0 auto;
}
.main-col { display: grid; gap: 22px; min-width: 0; }
.panel { border-radius: 14px; padding: 22px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; min-height: 22px; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; }
.panel-head h2 .i { width: 16px; height: 16px; color: var(--accent); }
.count, .hint { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); padding: 18px 4px; }
#blendEmpty { padding: 16px 18px; margin-bottom: 16px; border-radius: 12px; border: 1px dashed rgba(230, 249, 255, .16); color: var(--muted); }
#blendEmpty b { color: var(--text); font-weight: 600; }

/* ---------- fields: drawn wells ---------- */
input[type=text], input[type=search], input[type=number], select {
  width: 100%; min-width: 0; height: 40px; padding: 0 14px;
  background: none; border: 1px solid transparent; border-image: url(assets/field-well.svg) 10 fill / 10px stretch;
  appearance: none; -webkit-appearance: none;
}
input::placeholder { color: var(--faint); }
input[type=text]:focus, input[type=search]:focus, input[type=number]:focus, select:focus {
  outline: none; border-image-source: url(assets/field-well-focus.svg);
}
input[type=search] { padding-left: 40px; }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
.search { position: relative; display: block; min-width: 0; }
.search .i { position: absolute; left: 13px; top: 11px; color: var(--muted); pointer-events: none; }
.select { position: relative; display: block; min-width: 0; }
.select select { padding-right: 38px; cursor: pointer; }
.select select option { background: var(--surface); }
.select::after { content: ""; position: absolute; right: 12px; top: 10px; width: 20px; height: 20px; pointer-events: none;
  background: var(--muted); -webkit-mask: url(assets/icons/chevron.svg) center / contain no-repeat; mask: url(assets/icons/chevron.svg) center / contain no-repeat; }

/* range: groove + data-driven fill (--v, --fill set by app.js), drawn glass thumb */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: none; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--line);
  background: linear-gradient(var(--fill, var(--accent)), var(--fill, var(--accent))) 0 0 / var(--v, 50%) 100% no-repeat, var(--well);
}
/* The tab is drawn art; its centre line takes the slider's colour. */
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 30px; margin-top: -13px; border: 0;
  background: linear-gradient(var(--fill, var(--accent)), var(--fill, var(--accent))) 50% 9px / 2px 11px no-repeat,
              url(assets/slider-thumb.svg) center / 22px 30px no-repeat;
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--well); box-shadow: inset 0 0 0 1px var(--line); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--fill, var(--accent)); }
input[type=range]::-moz-range-thumb { width: 22px; height: 30px; border: 0;
  background: linear-gradient(var(--fill, var(--accent)), var(--fill, var(--accent))) 50% 9px / 2px 11px no-repeat, url(assets/slider-thumb.svg) center / 22px 30px no-repeat; }
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { filter: drop-shadow(0 0 4px var(--accent)); }

/* checkbox */
.check { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 14px; cursor: pointer; }
.check input { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin: 0; flex: none; cursor: pointer;
  background: url(assets/check-off.svg) center / contain no-repeat; }
.check input:checked { background-image: url(assets/check-on.svg); }
.check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- buttons ---------- */
.primary {
  height: 40px; padding: 0 28px; border: 0; background: none; color: var(--accent-ink); text-decoration: none; white-space: nowrap;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; border-radius: 10px;
}
.primary::before { border-image: url(assets/btn-primary.svg) 12 fill / 12px stretch; }
.primary:hover:not(:disabled)::before { border-image-source: url(assets/btn-primary-hover.svg); }
.primary:active:not(:disabled)::before { border-image-source: url(assets/btn-primary-pressed.svg); }
.primary:disabled { opacity: .38; cursor: not-allowed; }

button.ghost {
  height: 38px; padding: 0 15px; border: 0; background: none; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; font-weight: 500; white-space: nowrap;
}
button.ghost::before { border-image: url(assets/glass-button.svg) 12 fill / 12px stretch; }
button.ghost:hover::before { border-image-source: url(assets/glass-button-hover.svg); }
button.ghost:active::before { border-image-source: url(assets/glass-button-pressed.svg); }
button.ghost .i { width: 17px; height: 17px; color: var(--muted); }
button.ghost.accent, button.ghost.accent .i { color: var(--accent); }
button.ghost.danger, button.ghost.danger .i { color: var(--bad); }
button.ghost .i-external { width: 13px; height: 13px; margin-left: -2px; }

.msg { color: var(--muted); font-size: 13px; text-wrap: balance; }
.msg.err { color: var(--bad); }
.msg.wait { color: var(--amber); }
.msg.ok { color: var(--good); }

/* ---------- library ---------- */
.library { position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.lib-controls { display: grid; grid-template-columns: 1fr 112px; gap: 10px; margin-bottom: 12px; }
.lib-list { overflow-y: auto; margin: 0 -10px; padding: 0 10px; flex: 1;
  -webkit-mask-image: linear-gradient(transparent, #000 12px); mask-image: linear-gradient(transparent, #000 12px); scrollbar-width: thin; scrollbar-color: rgba(230,249,255,.14) transparent; }
.pack { border-top: 1px solid var(--line); }
.pack:first-child { border-top: 0; }
.pack > button {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: none; border: 0; padding: 12px 4px; cursor: pointer; text-align: left; font-weight: 600; border-radius: 8px;
}
.pack > button:hover { color: #fff; }
.pack > button .n { color: var(--muted); font-weight: 400; font-size: 12px; flex: none; font-family: var(--mono); }
.pack > button .i { color: var(--muted); transition: transform .15s; transform: rotate(-90deg); }
.pack.open > button .i { transform: none; }
.pack-items { display: none; padding-bottom: 8px; }
.pack.open .pack-items { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.model {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; color: var(--muted);
  background: none; border: 1px solid transparent; border-radius: 9px; padding: 7px 10px; cursor: pointer; font-size: 13.5px;
}
.model:hover { background: rgba(230, 249, 255, .045); color: var(--text); }
.model .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model .tag { font-size: 10px; color: var(--faint); flex: none; font-family: var(--mono); letter-spacing: .02em; }
.model .i { width: 16px; height: 16px; }
.model:not(.picked) .i { opacity: 0; transition: opacity .12s; }
.model:not(.picked):hover .i, .model:not(.picked):focus-visible .i { opacity: 1; }
@media (hover: none) { .model:not(.picked) .i { opacity: .6; } }
.model.picked { color: var(--text); font-weight: 500; background: var(--accent-soft); border-color: var(--accent-line); }
.model.picked .i { color: var(--accent); }
.model.full { opacity: .45; cursor: not-allowed; }

/* ---------- builder ---------- */
.blend-bar { display: flex; gap: 3px; height: 6px; margin-bottom: 16px; }
.blend-bar div { transition: flex-grow .15s; min-width: 4px; border-radius: 3px; }
.blend-list { display: grid; gap: 8px; margin-bottom: 18px; }
.blend-list:empty { display: none; }
.blend-row {
  display: grid; grid-template-columns: 10px minmax(150px, 200px) minmax(110px, 180px) 1fr 44px 32px;
  gap: 12px; align-items: center; border-radius: 10px; padding: 10px 12px;
}
.blend-row .dot { width: 10px; height: 10px; border-radius: 3px; }
.blend-row .file { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.blend-row .pct { text-align: right; font-family: var(--mono); color: var(--text); font-size: 12.5px; font-weight: 500; }
.blend-row .rm { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 7px; display: grid; place-items: center; }
.blend-row .rm:hover { color: var(--bad); background: rgba(255, 107, 107, .12); }
.blend-row .rm .i { width: 16px; height: 16px; }

.options { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 12px; }
.explain { margin: 0; color: var(--muted); font-size: 12.5px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 4px 0; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary .i { width: 16px; height: 16px; transition: transform .15s; }
.advanced[open] summary .i { transform: rotate(180deg); }
.advanced[open] { display: grid; gap: 24px; }
.field .explain { font-size: 12px; color: var(--faint); margin-top: -2px; }
input[aria-invalid="true"] { border-image-source: url(assets/field-well-error.svg) !important; }
.actions { display: flex; align-items: center; gap: 18px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- runs ---------- */
.runs-body { display: grid; grid-template-columns: minmax(200px, 270px) 1fr; gap: 22px; }
.run-list { display: grid; gap: 8px; align-content: start; position: relative; }
.run-item {
  text-align: left; background: none; border: 0; border-radius: 10px; padding: 11px 14px 11px 16px; cursor: pointer;
  display: grid; gap: 3px;
}
.run-item:not(.sel)::before { opacity: .55; }
.run-item:hover::before { opacity: 1; }
.run-item.sel::after { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 2px; background: var(--accent); }
.run-item .rn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-item .rm2 { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; }
.run-item .amps { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.run-item .rbest { font: 11px var(--mono); color: var(--faint); }
.pill {
  font-size: 11.5px; font-weight: 600; padding: 2px 8px 2px 7px; border-radius: 6px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); background: rgba(230,249,255,.06); box-shadow: inset 0 0 0 1px rgba(230,249,255,.12);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 1.5px; background: currentColor; }
.pill.live { color: var(--accent); background: rgba(111,227,255,.12); box-shadow: inset 0 0 0 1px rgba(111,227,255,.4); }
.pill.done { color: var(--good); background: rgba(89,217,160,.12); box-shadow: inset 0 0 0 1px rgba(89,217,160,.4); }
.pill.failed { color: var(--bad); background: rgba(255,107,107,.12); box-shadow: inset 0 0 0 1px rgba(255,107,107,.4); }

.run-detail { min-width: 0; display: grid; gap: 22px; align-content: start; }
.rd-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; flex-wrap: wrap; }
.rd-head h3 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.rd-head .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.progress { display: grid; gap: 8px; }
.bar { height: 6px; background: var(--well); border-radius: 3px; box-shadow: inset 0 0 0 1px var(--line); }
.bar > div { height: 100%; border-style: solid; border-width: 0; border-image: url(assets/progress-fill.svg) 3 fill / 3px stretch; transition: width .4s; filter: drop-shadow(0 0 5px rgba(111,227,255,.55)); }
.progress .line { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { border-radius: 10px; padding: 12px 16px; }
.stat .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.stat .v { font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 2px; }
.stat:first-child .v { color: var(--accent); font-family: var(--mono); font-size: 22px; }
.stat .q { font-size: 12px; }
.q.excellent, .q.close { color: var(--good); }
.q.near { color: var(--warn); }
.q.rough { color: var(--bad); }

.chart { width: 100%; height: 190px; display: block; overflow: visible; }
.chart .bandlab { fill: var(--muted); }
.chart .bandlab.ex { fill: #59d9a0; fill-opacity: .85; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.chart .grid { stroke: var(--grid); }
.chart .band { stroke: var(--muted); stroke-dasharray: 3 5; opacity: .4; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; }

/* A/B players */
.listen { display: grid; gap: 12px; }
.listen-pick { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.listen-pick label { font-size: 12px; color: var(--muted); font-weight: 600; }
.listen-pick .select { flex: 0 1 320px; }
.ab { display: grid; grid-template-columns: minmax(80px, 140px) 1fr 1fr; gap: 12px; align-items: center; }
.ab.single { grid-template-columns: 1fr 1fr; }
.ab .lab { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }
.player .prow { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; min-width: 0; }
.player .cap { flex: 1 1 auto; min-width: 6ch; }
.player { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; border-radius: 12px; padding: 10px 14px 10px 10px; min-width: 0; }
.player .pb {
  width: 44px; height: 44px; border-radius: 10px; border: 0; cursor: pointer; display: grid; place-items: center;
  background: rgba(230,249,255,.1); color: var(--text); box-shadow: inset 0 0 0 1px rgba(230,249,255,.2);
}
.player .pb:hover { box-shadow: inset 0 0 0 1px var(--accent-line); }
.player.b .pb:hover { filter: brightness(1.08); }
.player.b .pb { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.5); }
.player .pb .i { width: 18px; height: 18px; }
.player .pm { min-width: 0; display: grid; gap: 7px; }
.player .cap { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player.b .cap { color: var(--accent); }
/* Seek bars are real range inputs (keyboard works), drawn smaller than the weight sliders. */
.player input.seek { height: 18px; }
.player input.seek::-webkit-slider-thumb { width: 12px; height: 18px; margin-top: -7px;
  background: url(assets/slider-thumb.svg) center / 12px 18px no-repeat; opacity: 0; transition: opacity .15s; }
.player:hover input.seek::-webkit-slider-thumb, .player input.seek:focus-visible::-webkit-slider-thumb { opacity: 1; }
@media (hover: none) { .player input.seek::-webkit-slider-thumb { opacity: 1; } }
.player input.seek::-moz-range-thumb { width: 12px; height: 18px; background: url(assets/slider-thumb.svg) center / 12px 18px no-repeat; }
.player .t { font-size: 11px; color: var(--muted); font-family: var(--mono); white-space: nowrap; flex: none; }

.files { display: flex; flex-wrap: wrap; gap: 8px; }
.files a {
  text-decoration: none; color: var(--text); border-radius: 10px; padding: 9px 14px; font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
}
.files a .i { color: var(--accent); width: 16px; height: 16px; }
.files a:hover::before { border-image-source: url(assets/glass-chip-selected.svg); }
.blender { display: grid; gap: 10px; border-radius: 12px; padding: 16px; }
.blender .row { display: grid; grid-template-columns: minmax(80px, 140px) 1fr 44px; gap: 12px; align-items: center; }
.blender .pct { text-align: right; font-size: 12.5px; font-family: var(--mono); }
.blender .go { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.blender .go input { max-width: 240px; }
details > summary.explain { list-style: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
details > summary.explain::-webkit-details-marker { display: none; }
pre.log {
  border-radius: 10px; padding: 14px; font: 11.5px/1.55 var(--mono); color: #c3d0d8; max-height: 240px; overflow: auto; white-space: pre-wrap; margin: 10px 0 0;
  background: var(--well); box-shadow: inset 0 0 0 1px var(--line);
}

/* Laptop widths: a narrower library, two fields per row, a slimmer run list. */
@media (max-width: 1240px) and (min-width: 901px) {
  .layout { grid-template-columns: 330px 1fr; gap: 18px; padding: 22px; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .field.grow { grid-column: 1 / -1; }
  .runs-body { grid-template-columns: 1fr; gap: 18px; }
  .run-list { grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); overflow-x: auto; padding-bottom: 4px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent); }
  /* Names that differ only at the end ("... Clean - DI") wrap to two lines instead of losing it. */
  .model .nm { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.3; text-wrap: balance; }
  .blend-row { grid-template-columns: 10px minmax(150px, 200px) 1fr 44px 32px; }
  .blend-row .file { display: none; }
}

/* Phones: a sticky bar keeps "N picked · Train" in reach while you browse the library. */
#trainBar { display: none; }
@media (max-width: 900px) {
  #trainBar.has-picks.away { display: flex; isolation: isolate; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 20;
    align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 14px; }
  #trainBar::before { border-image: url(assets/glass-panel.svg) 84 fill / 84px / 36px stretch; }
  #trainBarText { font-weight: 600; }
  .layout { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .brandbar { padding: 16px 16px 0; }
  .wordmark { font-size: 18px; }
  .main-col { gap: 16px; }
  .panel { padding: 18px 16px; }
  .library { position: relative; top: auto; max-height: 460px; }
  .field-row { grid-template-columns: 1fr; }
  .runs-body { grid-template-columns: 1fr; }
  .run-list { max-height: 260px; overflow-y: auto; -webkit-mask-image: linear-gradient(#000 calc(100% - 14px), transparent); mask-image: linear-gradient(#000 calc(100% - 14px), transparent); }
  .actions .msg { flex-basis: 100%; }
  .blend-row { grid-template-columns: 10px 1fr 44px 32px; }
  .blend-row .file { display: none; }
  .blend-row .dot { grid-column: 1; grid-row: 1; }
  .blend-row input[type=text] { grid-column: 2; grid-row: 1; }
  .blend-row .pct { grid-column: 3; grid-row: 1; }
  .blend-row .rm { grid-column: 4; grid-row: 1; }
  .blend-row input[type=range] { grid-column: 1 / 5; grid-row: 2; }
  .ab, .ab.single { grid-template-columns: 1fr; }
}
@media (max-width: 600px) { #pickHint { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.di-field { margin: 12px 0 4px; }
