/* Colab Studio · dark workbench · one accent (signal teal) · Kanit display + IBM Plex Sans Thai body + JetBrains Mono log */
:root {
  --color-paper: oklch(16.5% 0.008 250);
  --color-paper-2: oklch(19.5% 0.009 250);
  --color-paper-3: oklch(23.5% 0.011 250);
  --color-well: oklch(13% 0.007 250);
  --color-line: oklch(29% 0.012 250);
  --color-line-strong: oklch(38% 0.014 250);
  --color-ink: oklch(95% 0.005 250);
  --color-ink-2: oklch(78% 0.01 250);
  --color-ink-3: oklch(62% 0.012 250);
  --color-accent: oklch(82% 0.13 185);
  --color-accent-ink: oklch(20% 0.04 185);
  --color-accent-soft: oklch(82% 0.13 185 / 0.14);
  --color-run: oklch(83% 0.14 80);
  --color-ok: oklch(80% 0.15 150);
  --color-bad: oklch(72% 0.17 25);
  --color-focus: oklch(88% 0.12 185);

  --font-display: "Kanit", "IBM Plex Sans Thai", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --text-xs: 0.75rem; --text-sm: 0.8125rem; --text-md: 0.9375rem; --text-lg: 1.125rem; --text-xl: 1.5rem; --text-2xl: 2.25rem;
  --space-2xs: 4px; --space-xs: 8px; --space-sm: 12px; --space-md: 16px; --space-lg: 24px; --space-xl: 32px; --space-2xl: 48px;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1); --ease-in-out: cubic-bezier(0.6, 0, 0.3, 1);
  --dur-fast: 120ms; --dur-mid: 200ms;
  --rail-w: 380px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { overflow-x: clip; }
body {
  margin: 0; background: var(--color-paper); color: var(--color-ink);
  font: 400 var(--text-md)/1.6 var(--font-body); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; font-style: normal; margin: 0; line-height: 1.2; letter-spacing: 0; }
a { color: var(--color-accent); }
code, kbd { font-family: var(--font-mono); font-size: 0.9em; }
code { background: var(--color-paper-3); padding: 1px 6px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--space-lg);
  padding: 0 var(--space-lg); height: 56px; background: oklch(16.5% 0.008 250 / 0.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--color-line);
}
.mark { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); color: var(--color-ink); text-decoration: none; white-space: nowrap; }
.mark span { color: var(--color-accent); margin-left: 2px; }
.tools { display: flex; gap: var(--space-2xs); height: 100%; }
.tools a {
  display: flex; align-items: center; padding: 0 var(--space-sm); color: var(--color-ink-3); text-decoration: none;
  white-space: nowrap; border-bottom: 2px solid transparent; transition: color var(--dur-fast) var(--ease-out);
}
.tools a:hover { color: var(--color-ink); }
.tools a[aria-current="page"] { color: var(--color-ink); border-bottom-color: var(--color-accent); font-weight: 500; }
.who { margin-left: auto; display: flex; align-items: center; gap: var(--space-md); }
.who form { margin: 0; }
.name { color: var(--color-ink-2); white-space: nowrap; }
.quota { display: grid; gap: 3px; min-width: 120px; }
.quota-text { font-size: var(--text-xs); color: var(--color-ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.quota-track { height: 3px; background: var(--color-line); border-radius: 2px; overflow: hidden; }
.quota-track i { display: block; height: 100%; width: 0; background: var(--color-accent); transition: width var(--dur-mid) var(--ease-out); }
.quota.over .quota-track i { background: var(--color-bad); }

/* ---------- shell ---------- */
.shell {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--rail-w); gap: var(--space-lg);
  max-width: 1440px; margin: 0 auto; padding: var(--space-lg);
}
.work { display: grid; gap: var(--space-xl); align-content: start; min-width: 0; }
.rail { position: sticky; top: calc(56px + var(--space-lg)); align-self: start; display: grid; gap: var(--space-md);
  max-height: calc(100vh - 56px - 2 * var(--space-lg)); grid-template-rows: auto minmax(0, 1fr); }

/* ---------- composer ---------- */
.composer { background: var(--color-paper-2); border: 1px solid var(--color-line); border-radius: var(--radius-lg); padding: var(--space-lg); }
.composer-head { margin-bottom: var(--space-lg); }
.composer-head h1 { font-size: var(--text-2xl); }
.lede { color: var(--color-ink-3); margin: var(--space-2xs) 0 0; }
.field { display: grid; gap: var(--space-xs); margin-bottom: var(--space-md); min-width: 0; }
.label { font-size: var(--text-sm); font-weight: 500; color: var(--color-ink-2); padding: 0; }
.label small { color: var(--color-ink-3); font-weight: 400; margin-left: var(--space-2xs); }
input:not([type=radio]):not([type=checkbox]):not([type=file]), textarea {
  width: 100%; min-width: 0; background: var(--color-well); border: 1px solid var(--color-line); border-radius: var(--radius-md);
  padding: 10px var(--space-sm); transition: border-color var(--dur-fast) var(--ease-out);
}
input:hover, textarea:hover { border-color: var(--color-line-strong); }
input:focus-visible, textarea:focus-visible { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
textarea { resize: vertical; line-height: 1.6; font-size: var(--text-md); }
::placeholder { color: var(--color-ink-3); opacity: 0.7; }

.opts { border: 0; padding: 0; margin: 0 0 var(--space-md); min-width: 0; }
.opts legend { margin-bottom: var(--space-xs); }
.row-opts { display: flex; flex-wrap: wrap; gap: var(--space-md) var(--space-lg); align-items: flex-end; }
.row-opts > * { margin-bottom: var(--space-md); }
.seed { width: 140px; margin-bottom: var(--space-md); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--color-well); border: 1px solid var(--color-line); border-radius: var(--radius-md); max-width: 100%; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; color: var(--color-ink-3);
  font-size: var(--text-sm); white-space: nowrap; font-variant-numeric: tabular-nums;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.seg label:hover span { color: var(--color-ink); }
.seg input:checked + span { background: var(--color-paper-3); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-line-strong); }
.seg input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.ratio { display: inline-block; width: calc(var(--w) / max(var(--w), var(--h)) * 14px); height: calc(var(--h) / max(var(--w), var(--h)) * 14px);
  border: 1.5px solid currentColor; border-radius: 2px; }

.switch { display: flex; align-items: center; gap: var(--space-sm); cursor: pointer; color: var(--color-ink-2); font-size: var(--text-sm); position: relative; }
.switch input { position: absolute; opacity: 0; width: 36px; height: 20px; margin: 0; cursor: pointer; }
.switch b { color: var(--color-ink); font-weight: 600; }
.knob { flex: none; width: 36px; height: 20px; border-radius: 10px; background: var(--color-line-strong); position: relative; transition: background var(--dur-fast) var(--ease-out); }
.knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--color-ink); transition: transform var(--dur-mid) var(--ease-out); }
.switch input:checked + .knob { background: var(--color-accent); }
.switch input:checked + .knob::after { transform: translateX(16px); background: var(--color-accent-ink); }
.switch input:focus-visible + .knob { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.more { border-top: 1px solid var(--color-line); padding-top: var(--space-sm); margin-bottom: var(--space-md); }
.more summary { cursor: pointer; color: var(--color-ink-2); font-weight: 500; list-style: none; display: flex; align-items: center; gap: var(--space-xs); width: fit-content; }
.more summary::before { content: "+"; font-family: var(--font-mono); color: var(--color-accent); width: 1ch; }
.more[open] summary::before { content: "−"; }
.more summary::-webkit-details-marker { display: none; }
.hint { color: var(--color-ink-3); font-size: var(--text-sm); margin: var(--space-xs) 0 var(--space-sm); }

.drops { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.drops.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.drops.one { grid-template-columns: minmax(0, 1fr); margin-bottom: var(--space-md); }
.drop {
  position: relative; display: grid; place-content: center; justify-items: center; gap: 2px; min-height: 104px; padding: var(--space-sm);
  border: 1px dashed var(--color-line-strong); border-radius: var(--radius-md); background: var(--color-well); cursor: pointer; text-align: center;
  overflow: hidden; transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.drops.one .drop { min-height: 64px; }
.drop:hover, .drop.over { border-color: var(--color-accent); background: var(--color-accent-soft); }
.drop:focus-within { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-title { font-weight: 500; font-size: var(--text-sm); color: var(--color-ink-2); }
.drop-sub { font-size: var(--text-xs); color: var(--color-ink-3); font-family: var(--font-mono); overflow-wrap: anywhere; }
.drop.has { border-style: solid; border-color: var(--color-line-strong); }
.drop .thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.55; pointer-events: none; }
.drop.has .drop-title, .drop.has .drop-sub { position: relative; text-shadow: 0 1px 3px oklch(0% 0 0 / 0.8); color: var(--color-ink); }
.drop .clear { position: absolute; top: 6px; right: 6px; z-index: 2; }

.submit { display: flex; align-items: center; gap: var(--space-md); flex-wrap: wrap; margin-top: var(--space-xs); }
.go {
  display: inline-flex; align-items: center; gap: var(--space-sm); border: 0; border-radius: var(--radius-md); cursor: pointer;
  background: var(--color-accent); color: var(--color-accent-ink); font-weight: 600; padding: 11px 22px; white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.go:hover { background: var(--color-focus); }
.go:active { transform: translateY(1px); }
.go:disabled { opacity: 0.55; cursor: progress; }
.go kbd { font-size: var(--text-xs); opacity: 0.6; font-weight: 500; }
.cost { margin: 0; color: var(--color-ink-3); font-size: var(--text-sm); flex: 1 1 220px; }
.form-error { color: var(--color-bad); margin: var(--space-sm) 0 0; min-height: 0; }
.form-error:empty { display: none; }

button.ghost {
  background: transparent; border: 1px solid var(--color-line); color: var(--color-ink-2); border-radius: var(--radius-sm);
  padding: 5px 12px; cursor: pointer; white-space: nowrap; font-size: var(--text-sm);
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
button.ghost:hover { border-color: var(--color-line-strong); color: var(--color-ink); }
button.ghost:active { transform: translateY(1px); }
button.ghost:disabled { opacity: 0.5; cursor: default; }
button.small { padding: 3px 10px; font-size: var(--text-xs); }
.check { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); color: var(--color-ink-2); cursor: pointer; white-space: nowrap; }
.check input { accent-color: var(--color-accent); }

/* ---------- results ---------- */
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-md); margin-bottom: var(--space-md); }
.results-head h2 { font-size: var(--text-xl); }
.gallery { display: grid; gap: var(--space-md); grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.gallery.humanize { grid-template-columns: minmax(0, 1fr); }
.gallery.video { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.empty { color: var(--color-ink-3); grid-column: 1 / -1; padding: var(--space-xl) 0; text-align: center; border: 1px dashed var(--color-line); border-radius: var(--radius-lg); margin: 0; }

.tile { background: var(--color-paper-2); border: 1px solid var(--color-line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.tile.selected { border-color: var(--color-accent); }
.media { display: grid; gap: 2px; background: var(--color-well); }
.media.n2, .media.n3, .media.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.media a, .media video { display: block; min-width: 0; }
.media img { display: block; width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; max-height: 520px; }
.media video { width: 100%; max-height: 560px; background: oklch(0% 0 0); }
.pending { display: grid; place-content: center; justify-items: center; gap: var(--space-xs); aspect-ratio: 16 / 10; padding: var(--space-md); background: var(--color-well); text-align: center; }
.gallery.humanize .pending { aspect-ratio: auto; min-height: 120px; }
.pending .big { font-family: var(--font-display); font-size: var(--text-xl); font-variant-numeric: tabular-nums; }
.pending .tail { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending.failed .big { color: var(--color-bad); font-size: var(--text-lg); }
.pending.failed .tail { white-space: normal; overflow-wrap: anywhere; }
.textout { padding: var(--space-md) var(--space-lg); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; max-height: 520px; overflow: auto; background: var(--color-well); }
.textout.src { color: var(--color-ink-3); font-size: var(--text-sm); border-bottom: 1px solid var(--color-line); max-height: 160px; }

.cap { padding: var(--space-sm) var(--space-md) var(--space-md); display: grid; gap: var(--space-xs); }
.cap-top { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; }
.prompt { margin: 0; color: var(--color-ink-2); font-size: var(--text-sm); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.meta { font-size: var(--text-xs); color: var(--color-ink-3); font-variant-numeric: tabular-nums; }
.acts { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.acts a.ghost { text-decoration: none; display: inline-flex; align-items: center; border: 1px solid var(--color-line); color: var(--color-ink-2); border-radius: var(--radius-sm); padding: 3px 10px; font-size: var(--text-xs); white-space: nowrap; }
.acts a.ghost:hover { border-color: var(--color-line-strong); color: var(--color-ink); }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 500; white-space: nowrap; color: var(--color-ink-3); }
.status i, .pill i, .live i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status.running { color: var(--color-run); }
.status.done { color: var(--color-ok); }
.status.failed, .status.cancelled { color: var(--color-bad); }
.status.running i, .pill.on i, .live i { animation: pulse 1.6s var(--ease-in-out) infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---------- rail ---------- */
.panel { background: var(--color-paper-2); border: 1px solid var(--color-line); border-radius: var(--radius-lg); padding: var(--space-md); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.panel-head h2 { font-size: var(--text-lg); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--color-ink-3); padding: 3px 10px; border: 1px solid var(--color-line); border-radius: 99px; white-space: nowrap; }
.pill.on { color: var(--color-ok); border-color: oklch(80% 0.15 150 / 0.4); }
.pill.busy { color: var(--color-run); border-color: oklch(83% 0.14 80 / 0.4); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xs); margin: 0 0 var(--space-sm); }
.stats div { background: var(--color-well); border-radius: var(--radius-sm); padding: var(--space-xs) var(--space-sm); min-width: 0; }
.stats dt { font-size: var(--text-xs); color: var(--color-ink-3); }
.stats dd { margin: 0; font-family: var(--font-display); font-size: var(--text-lg); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sessions, .queue { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2xs); }
.sessions li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--space-sm); padding: var(--space-xs) var(--space-sm); border: 1px solid var(--color-line); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.sessions .gpu { font-family: var(--font-mono); font-weight: 500; color: var(--color-accent); grid-row: span 2; align-self: center; }
.sessions .sid { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hold { border-top: 1px solid var(--color-line); margin-top: var(--space-sm); padding-top: var(--space-sm); }
.hold:empty { display: none; }
.hold p { margin: 0; }
.hold-title { display: flex; align-items: center; gap: var(--space-xs); font-weight: 500; font-size: var(--text-sm); }
.hold-title b { color: var(--color-accent); font-weight: 600; }
.hold-sub { font-size: var(--text-xs); color: var(--color-ink-3); margin-top: 4px !important; }
.hold-sub b { color: var(--color-ink); font-variant-numeric: tabular-nums; font-weight: 500; }
.hold-sub.warn { color: var(--color-run); }
.hold-row, .hold-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); margin-top: var(--space-xs); }
.hold-row .seg span { padding: 4px 9px; }
.status.holding { color: var(--color-accent); }
.status.holding i { animation: pulse 2.4s var(--ease-in-out) infinite; }
.note { font-size: var(--text-xs); color: var(--color-ink-3); margin: var(--space-xs) 0 0; }
.note:empty { display: none; }
.sub { font-family: var(--font-body); font-size: var(--text-xs); font-weight: 500; color: var(--color-ink-3); margin: var(--space-md) 0 var(--space-xs); text-transform: none; }
.queue li { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); }
.queue li.muted { color: var(--color-ink-3); }
.queue .who-q { color: var(--color-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.queue .t { margin-left: auto; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-ink-3); }
.queue button { all: unset; cursor: pointer; display: contents; }
.colab > .ghost { margin-top: var(--space-md); }

.console { display: flex; flex-direction: column; min-height: 280px; }
.console-job { font-size: var(--text-xs); color: var(--color-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.log {
  flex: 1; min-height: 200px; margin: 0; padding: var(--space-sm); background: var(--color-well); border: 1px solid var(--color-line);
  border-radius: var(--radius-md); font: 400 11.5px/1.55 var(--font-mono); color: var(--color-ink-2);
  overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}
.log .cmd { color: var(--color-accent); }
.log .err { color: var(--color-bad); }
.log .ok { color: var(--color-ok); }
.log .dim { color: var(--color-ink-3); }
.console-foot { display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-xs); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--color-run); }

/* ---------- admin ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { text-align: left; padding: var(--space-xs) var(--space-sm); border-bottom: 1px solid var(--color-line); white-space: nowrap; }
th { color: var(--color-ink-3); font-weight: 500; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- login ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: var(--space-md); }
.gate-card { width: 100%; max-width: 380px; background: var(--color-paper-2); border: 1px solid var(--color-line); border-radius: var(--radius-lg); padding: var(--space-xl) var(--space-lg); }
.gate-card .mark { margin: 0 0 var(--space-lg); }
.gate-card h1 { font-size: var(--text-xl); }
.gate-card .lede { margin-bottom: var(--space-lg); }
.gate-card .go { width: 100%; justify-content: center; margin-top: var(--space-xs); }
.gate-card .form-error { margin: 0 0 var(--space-md); }

/* ---------- desktop: one screen, no page scroll; each column scrolls inside itself ---------- */
@media (min-width: 901px) {
  html, body { height: 100%; }
  body { display: flex; flex-direction: column; overflow: hidden; }
  .bar { flex: none; }
  .shell {
    flex: 1; min-height: 0; max-width: none; width: 100%; padding: var(--space-md); gap: var(--space-md);
    grid-template-columns: minmax(340px, 400px) minmax(0, 1fr) minmax(300px, 360px); grid-template-rows: minmax(0, 1fr);
  }
  .work { display: contents; }
  .composer { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: var(--space-md) var(--space-lg); scrollbar-width: thin; }
  .composer-head { margin-bottom: var(--space-md); }
  .composer-head h1 { font-size: var(--text-xl); }
  .lede { font-size: var(--text-sm); }
  #job { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  #job > .field:first-of-type { flex: 1 1 auto; min-height: 150px; display: flex; flex-direction: column; }
  #job > .field:first-of-type textarea { flex: 1; min-height: 0; resize: none; }
  .row-opts { gap: 0 var(--space-md); }
  .seed { width: 110px; }
  .submit { flex-direction: column; align-items: stretch; gap: var(--space-xs); }
  .go { justify-content: center; }
  .cost { flex: none; font-size: var(--text-xs); text-align: center; }
  .drop { min-height: 84px; }
  .drops.one .drop { min-height: 56px; }
  .results { min-height: 0; display: flex; flex-direction: column; }
  .results-head { flex: none; margin-bottom: var(--space-sm); }
  .results-head h2 { font-size: var(--text-lg); }
  .gallery { flex: 1; min-height: 0; overflow-y: auto; align-content: start; padding-right: 4px; scrollbar-width: thin; }
  .rail { position: static; max-height: none; min-height: 0; height: 100%; grid-template-rows: auto minmax(0, 1fr); }
  .colab { overflow-y: auto; max-height: 52vh; scrollbar-width: thin; }
  .console { min-height: 0; }
  .log { min-height: 0; }
}
@media (min-width: 901px) and (max-width: 1199px) {
  .shell { grid-template-columns: 320px minmax(0, 1fr) 280px; }
  .composer { padding: var(--space-md); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 901px) and (max-height: 800px) {
  .composer-head .lede { display: none; }
  .composer-head { margin-bottom: var(--space-sm); }
  #job > .field:first-of-type { min-height: 120px; }
  .field, .opts, .row-opts > *, .seed, .more { margin-bottom: 10px; }
  .opts legend, .field { gap: 4px; }
  .more { padding-top: 8px; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: var(--space-md); gap: var(--space-md); }
  .rail { position: static; max-height: none; grid-template-rows: auto auto; order: 0; }
  .work { display: contents; }
  .composer { order: -2; }
  .rail { order: -1; }
  .results { order: 0; }
  .log { max-height: 320px; }
}
@media (max-width: 640px) {
  .bar { gap: var(--space-sm); padding: 0 var(--space-md); height: auto; min-height: 52px; flex-wrap: wrap; row-gap: 0; }
  .tools { order: 3; width: 100%; height: 40px; overflow-x: auto; margin: 0 calc(-1 * var(--space-md)); padding: 0 var(--space-xs); }
  .name { display: none; }
  .quota { min-width: 96px; }
  .rail { top: 0; }
  .composer { padding: var(--space-md); }
  .composer-head h1 { font-size: var(--text-xl); }
  .drops { grid-template-columns: minmax(0, 1fr); }
  .drops.two { grid-template-columns: minmax(0, 1fr); }
  .seed { width: 100%; }
  .row-opts { gap: 0 var(--space-md); }
  .go kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; }
}
