@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter.woff") format("woff");
  font-weight: 400 600;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono.woff") format("woff");
  font-weight: 400 500;
  font-display: swap;
}

/* Backlot fills the page: a top bar, the layers on the left, the preview in the middle, the
   inspector on the right. Neutral greys only; colour is kept for state (budget warning and
   over-limit, errors). */
:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --panel: #111114;
  --menu: #19191d;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --field: rgba(255, 255, 255, 0.045);
  --field-hover: rgba(255, 255, 255, 0.075);
  --raised: rgba(255, 255, 255, 0.07);
  --hover: rgba(255, 255, 255, 0.1);
  --sel: rgba(255, 255, 255, 0.085);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.58);
  --faint: rgba(255, 255, 255, 0.36);
  --ghost: rgba(255, 255, 255, 0.2);
  --warn: #e6ad57;
  --danger: #f0707f;
  --focus: rgba(255, 255, 255, 0.55);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
  --mono: "SF Mono", "Geist Mono", ui-monospace, monospace;
  --r: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.grow { flex: 1; min-width: 0; }
:focus { outline: none; }
:focus-visible { outline: 1.5px solid var(--focus); outline-offset: 1px; }
svg { flex: none; }
::selection { background: rgba(255, 255, 255, 0.22); }

* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.14) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- frame of the app */

.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr) 320px;
  grid-template-rows: 52px minmax(0, 1fr);
  grid-template-areas: "top top top" "layers centre inspector";
  overflow: hidden;
}
@media (max-width: 1360px) {
  .app { grid-template-columns: 228px minmax(0, 1fr) 300px; }
}

.panel { background: var(--panel); min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.layers { grid-area: layers; border-right: 1px solid var(--line); }
.inspector { grid-area: inspector; border-left: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; }

/* ---------------------------------------------------------------- buttons */

.btn {
  height: 32px; padding: 0 12px; border-radius: var(--r); border: 0; background: var(--raised); color: var(--text);
  font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.12s, color 0.12s;
}
.btn:hover { background: var(--hover); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover, .btn.ghost[aria-expanded="true"] { background: var(--raised); color: var(--text); }
.btn.primary { background: #f2f2f4; color: #111114; font-weight: 600; }
.btn.primary:hover { background: #ffffff; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled, .btn.busy { opacity: 0.45; cursor: default; }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.btn .chev { width: 12px; height: 12px; margin-right: -3px; opacity: 0.8; }

.icon-btn {
  width: 32px; height: 32px; border: 0; border-radius: var(--r); background: transparent; color: var(--muted);
  display: inline-grid; place-items: center; transition: background 0.12s, color 0.12s; padding: 0;
}
.icon-btn:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.icon-btn:disabled { color: var(--ghost); cursor: default; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn.sm svg { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- top bar */

.top {
  grid-area: top; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px; min-width: 0;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; margin-right: 10px; }
.sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 4px; }

.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--field); margin-left: 4px; }
.seg button {
  height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: var(--hover); color: var(--text); }

.budget { display: inline-flex; align-items: center; gap: 10px; margin-left: 14px; color: var(--muted); min-width: 0; }
.budget-text { font-size: 12px; white-space: nowrap; }
.meter { position: relative; width: 84px; height: 3px; border-radius: 3px; background: var(--line-strong); overflow: hidden; flex: none; }
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--muted); border-radius: 3px; transition: width 0.2s; }
.budget.warn .budget-text { color: var(--warn); }
.budget.warn .meter-fill { background: var(--warn); }
.budget.over .budget-text { color: var(--danger); }
.budget.over .meter-fill { background: var(--danger); }

/* ---------------------------------------------------------------- menus */

.pop-wrap { position: relative; }
.menu {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 200px; padding: 5px;
  background: var(--menu); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.menu-group { padding: 8px 9px 4px; font-size: 11.5px; color: var(--faint); font-weight: 500; }
.menu-group:not(:first-child) { margin-top: 3px; border-top: 1px solid var(--line); padding-top: 9px; }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 6px 9px; min-height: 30px;
  border: 0; border-radius: 6px; background: transparent; color: var(--text);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.templates-menu { width: 270px; }
.templates-menu .menu-item { padding: 6px; gap: 12px; }
.thumb-16x9 {
  width: 88px; height: 49.5px; border-radius: 5px; flex: none; background: #000; overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line);
}
.thumb-16x9 img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu-note { padding: 6px 9px 4px; font-size: 11.5px; color: var(--faint); }

/* ---------------------------------------------------------------- layers panel */

.layers-head { display: flex; align-items: center; gap: 6px; padding: 12px 10px 8px 16px; }
.panel-title { font-weight: 600; font-size: 12.5px; color: var(--text); }
.layers-head .grow + .pop-wrap .menu { left: auto; right: 0; }
.layer-list { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 2px 8px 8px; list-style: none; margin: 0; }
.layer-row {
  position: relative; display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px 0 2px;
  border-radius: 7px; cursor: default; user-select: none; touch-action: none;
}
.layer-row:hover { background: rgba(255, 255, 255, 0.04); }
.layer-row.on { background: var(--sel); }
.layer-row .eye { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; display: grid; place-items: center; padding: 0; }
.layer-row .eye:hover { color: var(--text); background: var(--raised); }
.layer-row .eye svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.layer-row.off .eye { color: var(--ghost); }
.layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 2px; }
.layer-row.off .layer-name { color: var(--faint); }
.layer-size { font-size: 11px; color: var(--faint); flex: none; }
.layer-rename {
  flex: 1; min-width: 0; height: 26px; border: 0; border-radius: 6px; padding: 0 6px; margin-left: -4px;
  background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.layer-row.dragging { opacity: 0.4; }
.layer-list.sorting .layer-row { cursor: grabbing; }
.drop-line { position: absolute; left: 10px; right: 10px; height: 2px; border-radius: 2px; background: var(--text); pointer-events: none; z-index: 2; }
.layers-empty { padding: 14px 10px; color: var(--faint); font-size: 12.5px; }

.doc-row {
  display: flex; align-items: center; gap: 10px; height: 38px; margin: 0 8px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); text-align: left; flex: none;
}
.doc-row:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.doc-row.on { background: var(--sel); color: var(--text); }
.doc-swatch { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--line-strong); flex: none; }
.layers-foot { display: flex; gap: 4px; padding: 8px; border-top: 1px solid var(--line); flex: none; }
.layers-foot .btn { flex: 1; }
.layers-sep { height: 1px; background: var(--line); margin: 0 16px 6px; flex: none; }

/* ---------------------------------------------------------------- centre: the preview */

.centre { grid-area: centre; position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.stage-bar { display: flex; align-items: center; gap: 4px; height: 46px; padding: 0 16px 0 20px; flex: none; }
.stage-title { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tog {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.tog:hover { color: var(--text); background: var(--raised); }
.tog-box { width: 24px; height: 14px; border-radius: 7px; background: var(--line-strong); position: relative; transition: background 0.14s; }
.tog-box::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.6);
  transition: transform 0.14s, background 0.14s;
}
.tog[aria-pressed="true"] { color: var(--text); }
.tog[aria-pressed="true"] .tog-box { background: #e9e9ec; }
.tog[aria-pressed="true"] .tog-box::after { transform: translateX(10px); background: #111114; }

.stage-area { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; padding: 0 24px; }
.stage {
  --ar: 1.7778;
  position: relative; width: min(100cqw, calc(100cqh * var(--ar))); aspect-ratio: var(--ar); overflow: hidden;
  border-radius: 10px; background: #000; box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(0, 0, 0, 0.45);
  cursor: default; touch-action: none;
}
.stage[data-aspect="phone"] { border-radius: 22px; }
.stage.dragging, .stage.dragging * { cursor: grabbing !important; }

/* The selected layer over the preview: its box, its place (drag to move, corners to resize), its points. */
.ov { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.ov-box {
  position: absolute; box-sizing: border-box; border: 1px dashed rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
.ov-box.movable { border-style: solid; pointer-events: auto; cursor: move; }
.ov-knob {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; box-sizing: border-box; border-radius: 2px;
  background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55); pointer-events: auto;
}
.ov-knob.nw { left: 0; top: 0; cursor: nwse-resize; }
.ov-knob.ne { left: 100%; top: 0; cursor: nesw-resize; }
.ov-knob.sw { left: 0; top: 100%; cursor: nesw-resize; }
.ov-knob.se { left: 100%; top: 100%; cursor: nwse-resize; }
.ov-pt {
  position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; box-sizing: border-box; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: auto; cursor: grab;
}
.aspect-seg { margin: 0 6px 0 0; }
.aspect-seg button { height: 24px; padding: 0 9px; font-size: 12px; }
.scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.drop-hint {
  position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(10, 10, 12, 0.6);
  box-shadow: inset 0 0 0 2px var(--text); border-radius: 10px; pointer-events: none;
}
.drop-hint span { padding: 8px 14px; border-radius: 8px; background: var(--menu); font-weight: 500; }

.notes { list-style: none; margin: 0; padding: 10px 24px 14px; min-height: 40px; max-height: 96px; overflow-y: auto; flex: none; font-size: 12px; color: var(--faint); }
.notes li { padding: 1px 0; }
.notes li.danger { color: var(--danger); }
.notes li.warn { color: var(--warn); }

.toast {
  position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); z-index: 50; max-width: min(560px, 90%);
  padding: 9px 14px; border-radius: 9px; background: var(--menu); border: 1px solid var(--line-strong); color: var(--text);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); font-size: 12.5px;
}
.toast.danger { color: var(--danger); }
.toast.warn { color: var(--warn); }

/* The app frame: a plain mock of the desktop window, drawn at 1600 x 900 and scaled to the stage. */
.mock { position: absolute; inset: 0; z-index: 10; pointer-events: none; overflow: hidden; }
.mock-win { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; font-family: var(--sans); }
.mock-side { position: absolute; left: 0; top: 0; bottom: 0; width: 260px; padding: 58px 14px 0; border-right: 1px solid var(--m-line); }
.mock-dots { position: absolute; left: 18px; top: 20px; display: flex; gap: 8px; }
.mock-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--m-line-strong); }
.mock-new { height: 36px; border-radius: 9px; display: flex; align-items: center; padding: 0 12px; font-size: 14px; color: var(--m-text); background: var(--m-soft); margin-bottom: 22px; }
.mock-head { font-size: 12px; color: var(--m-muted); padding: 0 12px 8px; }
.mock-item { height: 34px; display: flex; align-items: center; padding: 0 12px; font-size: 14px; color: var(--m-text-2); border-radius: 9px; white-space: nowrap; overflow: hidden; }
.mock-item.on { background: var(--m-soft); color: var(--m-text); }
.mock-col {
  position: absolute; top: 0; bottom: 0; left: 568px; width: 724px; padding: 64px 52px 0;
  border-left: 1px solid var(--m-line); border-right: 1px solid var(--m-line);
}
.mock-msg { font-size: 15px; line-height: 1.6; color: var(--m-text); margin: 0 0 18px; }
.mock-msg.user { margin-left: auto; width: fit-content; max-width: 76%; padding: 10px 16px; border-radius: 14px; background: var(--m-soft); }
.mock-msg.quiet { color: var(--m-text-2); }
.mock-code { height: 96px; border-radius: 10px; background: var(--m-soft); margin: 0 0 18px; padding: 14px 16px; display: grid; gap: 10px; align-content: start; }
.mock-code i { display: block; height: 9px; border-radius: 5px; background: var(--m-line-strong); }
.mock-composer {
  position: absolute; left: 36px; right: 36px; bottom: 30px; height: 96px; border-radius: 16px; padding: 16px 18px;
  font-size: 15px; color: var(--m-muted); background: var(--m-soft); box-shadow: inset 0 0 0 1px var(--m-line-strong);
}

/* ---------------------------------------------------------------- inspector */

.insp-head { padding: 14px 16px 10px; display: grid; gap: 2px; border-bottom: 1px solid var(--line); }
.insp-name {
  width: 100%; height: 30px; padding: 0 8px; margin-left: -8px; border: 0; border-radius: 7px; background: transparent;
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
}
.insp-name:hover { background: var(--field); }
.insp-name:focus { background: var(--field); box-shadow: inset 0 0 0 1px var(--line-strong); }
.insp-kind { font-size: 12px; color: var(--faint); }
.insp-actions { padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 6px; }
.insp-actions .btn, .ramp-actions .btn { height: 26px; padding: 0 10px; font-size: 12px; }
.ramp-actions { display: flex; gap: 6px; margin-top: 2px; }
.ramp-actions .btn:disabled { opacity: 0.45; }
.insp-empty { padding: 18px 16px; color: var(--faint); }

.sec { padding: 12px 16px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 7px; }
.sec-title { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.row { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 28px; }
.row > label, .row > .lbl {
  color: var(--muted); font-size: 12.5px; line-height: 1.25; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere;
}
.row.at-top { align-items: start; }
.row.at-top > label { padding-top: 6px; }
.row.stack { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.ctl { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hint { font-size: 11.5px; color: var(--faint); line-height: 1.4; }

.num, .txt, .sel, .area {
  height: 28px; border: 0; border-radius: 7px; background: var(--field); padding: 0 8px; min-width: 0;
  transition: background 0.12s, box-shadow 0.12s;
}
.num:hover, .txt:hover, .sel:hover, .area:hover { background: var(--field-hover); }
.num:focus, .txt:focus, .sel:focus, .area:focus { background: var(--field-hover); box-shadow: inset 0 0 0 1px var(--line-strong); }
.num { width: 58px; flex: none; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; -moz-appearance: textfield; }
.num::-webkit-outer-spin-button, .num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.txt { width: 100%; }
.area { width: 100%; height: auto; min-height: 64px; padding: 6px 8px; resize: vertical; line-height: 1.45; font-family: var(--mono); font-size: 12px; }
.sel {
  width: 100%; -webkit-appearance: none; appearance: none; padding-right: 26px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6.5 8 10l3.5-3.5' fill='none' stroke='%23ffffff' stroke-opacity='.55' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 13px;
}
.sel option { background: var(--menu); color: var(--text); }
.unit { font-size: 11.5px; color: var(--faint); margin-left: -3px; flex: none; width: 15px; }

/* Sliders: a thin track and a small round thumb. */
.slider { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 18px; background: transparent; cursor: pointer; margin: 0; }
.slider::-webkit-slider-runnable-track {
  height: 3px; border-radius: 3px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.62) var(--fill, 0%), var(--line-strong) var(--fill, 0%));
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; background: #f0f0f2; border: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
.slider::-moz-range-track { height: 3px; border-radius: 3px; background: var(--line-strong); }
.slider::-moz-range-progress { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.62); }
.slider::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #f0f0f2; border: 0; }
.slider:focus-visible { outline: none; }
.slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25); }

/* Switch */
.switch { position: relative; width: 30px; height: 18px; flex: none; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 9px; background: var(--line-strong); transition: background 0.14s; pointer-events: none; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.62);
  transition: transform 0.14s, background 0.14s;
}
.switch input:checked + span { background: #e9e9ec; }
.switch input:checked + span::after { transform: translateX(12px); background: #111114; }
.switch input:focus-visible + span { outline: 1.5px solid var(--focus); outline-offset: 2px; }

/* Colour swatches */
.swatch { position: relative; width: 28px; height: 28px; flex: none; border-radius: 7px; box-shadow: inset 0 0 0 1px var(--line-strong); overflow: hidden; }
.swatch input[type="color"] { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); opacity: 0; cursor: pointer; border: 0; padding: 0; }
.swatch.none { background: linear-gradient(135deg, transparent calc(50% - 0.75px), var(--faint) calc(50% - 0.75px), var(--faint) calc(50% + 0.75px), transparent calc(50% + 0.75px)), var(--field); }
.swatch:focus-within { outline: 1.5px solid var(--focus); outline-offset: 1px; }
.hex { width: 84px; flex: none; font-family: var(--mono); font-size: 12px; text-align: left; }
.ramp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ramp .swatch { width: 26px; height: 26px; }

/* Number pairs and quads (point, rect) */
.pairs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 8px; width: 100%; }
.pair { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pair b { font-weight: 500; font-size: 11.5px; color: var(--faint); width: 12px; flex: none; }
.pair .num { flex: 1; width: auto; }

/* Media */
.media { display: grid; gap: 8px; }
.media-drop {
  display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 9px; background: var(--field);
  box-shadow: inset 0 0 0 1px transparent; transition: box-shadow 0.12s, background 0.12s;
}
.media-drop.over { box-shadow: inset 0 0 0 1.5px var(--text); background: var(--field-hover); }
.media-thumb {
  width: 64px; height: 64px; border-radius: 6px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.05) 0 25%, transparent 0 50%) 0 0 / 12px 12px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.media-thumb canvas, .media-thumb img { max-width: 100%; max-height: 100%; display: block; image-rendering: pixelated; }
.media-info { min-width: 0; display: grid; gap: 4px; }
.media-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta { font-size: 11.5px; color: var(--faint); }
.media-actions { display: flex; gap: 4px; margin-top: 2px; }
.media-actions .btn { height: 26px; padding: 0 9px; font-size: 12px; }
.samples { display: flex; flex-wrap: wrap; gap: 6px; }
.sample {
  width: 40px; height: 40px; border-radius: 7px; border: 0; padding: 0; overflow: hidden; background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center;
}
.sample canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.sample:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.sample.on { box-shadow: inset 0 0 0 1.5px var(--text); }
.samples-label { font-size: 11.5px; color: var(--faint); }

/* ---------------------------------------------------------------- start-up error */

.boot-error {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 100; max-width: 560px;
  padding: 16px 18px; border-radius: 10px; background: var(--menu); border: 1px solid var(--line-strong); color: var(--danger);
}
