/* Раскладка: шапка и сцена на весь экран; панели управления лежат поверх сцены сеткой (карточка, ползунки, поиск, инструменты, нижние панели).
   Стиль взят из Teardown (Aibuild OS): тёмная сцена с мягким свечением, стеклянные панели-пилюли, янтарный акцент. */
:root {
  --bg: #0f1219; --bg2: #232b3b; --panel: rgba(58, 64, 80, .5); --panel-solid: #2a303d; --line: rgba(255, 255, 255, .13);
  --fg: #eceff5; --muted: #9aa2b6; --accent: #ef8a38; --accent-a: color-mix(in srgb, var(--accent) 88%, transparent); --accent-fg: #ffffff; --track: rgba(255, 255, 255, .2);
  --hover: rgba(255, 255, 255, .1); --shadow: 0 10px 30px rgba(6, 12, 36, .35); --glow2: rgba(150, 165, 195, .34); --glow: rgba(150, 170, 210, .18);
  --font-text: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #e3e7f0; --bg2: #f7f9fd; --panel: rgba(255, 255, 255, .55); --panel-solid: #ffffff; --line: rgba(20, 24, 44, .12);
    --fg: #171a28; --muted: #5d6279; --accent: #e8801f; --accent-a: color-mix(in srgb, var(--accent) 88%, transparent); --accent-fg: #ffffff; --track: rgba(20, 24, 44, .16);
    --hover: rgba(20, 24, 44, .07); --shadow: 0 10px 28px rgba(30, 36, 70, .16); --glow2: rgba(255, 255, 255, .7); --glow: rgba(120, 100, 255, .1); color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #e3e7f0; --bg2: #f7f9fd; --panel: rgba(255, 255, 255, .55); --panel-solid: #ffffff; --line: rgba(20, 24, 44, .12);
  --fg: #171a28; --muted: #5d6279; --accent: #e8801f; --accent-a: color-mix(in srgb, var(--accent) 88%, transparent); --accent-fg: #ffffff; --track: rgba(20, 24, 44, .16);
  --hover: rgba(20, 24, 44, .07); --shadow: 0 10px 28px rgba(30, 36, 70, .16); --glow2: rgba(255, 255, 255, .7); --glow: rgba(120, 100, 255, .1); color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1219; --bg2: #232b3b; --panel: rgba(58, 64, 80, .5); --panel-solid: #2a303d; --line: rgba(255, 255, 255, .13);
  --fg: #eceff5; --muted: #9aa2b6; --accent: #ef8a38; --accent-a: color-mix(in srgb, var(--accent) 88%, transparent); --accent-fg: #ffffff; --track: rgba(255, 255, 255, .2);
  --hover: rgba(255, 255, 255, .1); --shadow: 0 10px 30px rgba(6, 12, 36, .35); --glow2: rgba(150, 165, 195, .34); --glow: rgba(150, 170, 210, .18); color-scheme: dark;
}
/* выбор «Фон» в нижней панели переключает всю страницу и сильнее системной темы */
:root[data-bd="light"] {
  --bg: #e3e7f0; --bg2: #f7f9fd; --panel: rgba(255, 255, 255, .55); --panel-solid: #ffffff; --line: rgba(20, 24, 44, .12);
  --fg: #171a28; --muted: #5d6279; --accent: #e8801f; --accent-a: color-mix(in srgb, var(--accent) 88%, transparent); --accent-fg: #ffffff; --track: rgba(20, 24, 44, .16);
  --hover: rgba(20, 24, 44, .07); --shadow: 0 10px 28px rgba(30, 36, 70, .16); --glow2: rgba(255, 255, 255, .7); --glow: rgba(120, 100, 255, .1); color-scheme: light;
}
:root[data-bd="dark"] {
  --bg: #0f1219; --bg2: #232b3b; --panel: rgba(58, 64, 80, .5); --panel-solid: #2a303d; --line: rgba(255, 255, 255, .13);
  --fg: #eceff5; --muted: #9aa2b6; --accent: #ef8a38; --accent-a: color-mix(in srgb, var(--accent) 88%, transparent); --accent-fg: #ffffff; --track: rgba(255, 255, 255, .2);
  --hover: rgba(255, 255, 255, .1); --shadow: 0 10px 30px rgba(6, 12, 36, .35); --glow2: rgba(150, 165, 195, .34); --glow: rgba(150, 170, 210, .18); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.4 var(--font-text); overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

#app { height: 100%; display: flex; flex-direction: column; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }

/* шапка */
#top { flex: none; height: 52px; display: flex; align-items: center; gap: 12px; min-width: 0; }
#brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
#brand svg.logo { width: 22px; height: 22px; color: var(--accent); flex: none; }
#brand h1 { margin: 0; font: 600 15px/1 var(--font-head); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#brand .info { width: 16px; height: 16px; color: var(--muted); flex: none; }
.hb { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: var(--fg); font: 500 12px/1 var(--font-text); white-space: nowrap; flex: none; }
.hb:hover { background: var(--hover); }
.hb[aria-pressed="true"] { background: var(--accent-a); border-color: transparent; color: var(--accent-fg); font-weight: 600; }
.hb svg { width: 14px; height: 14px; opacity: .85; }
#hbs { display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
#hbs::-webkit-scrollbar { display: none; }
#top .grow { flex: 1; }
#theme { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); }
#theme:hover { background: var(--hover); }
#theme svg { width: 17px; height: 17px; }

/* сцена */
#stage { position: relative; flex: 1; min-height: 0; margin-bottom: 12px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(ellipse 60% 48% at 10% 92%, var(--glow2), transparent 68%), linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 55%, var(--bg2)) 55%, var(--bg2) 100%); }
#glow { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s; background: radial-gradient(ellipse 38% 42% at 50% 46%, var(--glow), transparent 70%); }
#stage.glow #glow { opacity: 1; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#gl.drag { cursor: grabbing; }
#tip { position: absolute; z-index: 9; pointer-events: none; padding: 4px 8px; border-radius: 6px; background: var(--panel-solid); border: 1px solid var(--line); color: var(--fg);
  font-size: 12px; font-weight: 500; white-space: nowrap; transform: translate(12px, 12px); opacity: 0; transition: opacity .12s; box-shadow: var(--shadow); }
#error { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; z-index: 10; }

/* поверх сцены: сетка из областей */
#ui { position: absolute; inset: 0; display: grid; gap: 8px 12px; padding: 12px; pointer-events: none;
  grid-template-columns: minmax(0, 230px) minmax(0, 1fr) minmax(0, 230px); grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas: 'tools bars lbtn' 'tools . .' 'bottom bottom bottom' 'status status status'; }
#ui > * { pointer-events: auto; min-width: 0; }
.glass { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

/* верхние панели-пилюли */
#bars { grid-area: bars; justify-self: center; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 100%; }
.pill { display: flex; align-items: center; gap: 4px; max-width: 100%; padding: 5px 6px; border-radius: 999px; }
.pill.scroll { overflow-x: auto; scrollbar-width: none; }
.pill.scroll::-webkit-scrollbar { display: none; }
.grp { display: flex; align-items: center; gap: 6px; padding: 0 8px; flex: none; }
.grp + .grp { border-left: 1px solid var(--line); }
.lbl { font: 600 9.5px/1 var(--font-text); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.sl { display: flex; align-items: center; gap: 8px; padding: 0 10px; flex: none; }
.sl .lbl::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.sl + .sl { border-left: 1px solid var(--line); }
.sl output { font: 600 11px/1 var(--font-text); font-variant-numeric: tabular-nums; color: var(--accent); min-width: 32px; text-align: right; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 92px; height: 4px; border-radius: 2px; margin: 0;
  background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--track) var(--p, 0%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f4f5f8, #b9bec9); border: 0; box-shadow: 0 1px 5px rgba(0, 0, 0, .5); }
input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: #d4d8e0; border: 0; }
.pb { height: 28px; min-width: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--hover); font: 500 12px/1 var(--font-text); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.pb:hover:not(:disabled) { background: var(--track); }
.pb:disabled { opacity: .4; cursor: default; }
.pb.accent { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 72%, #fff), var(--accent)); border-color: color-mix(in srgb, var(--accent) 60%, #fff); color: var(--accent-fg); font-weight: 600; box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35); }
.pb.accent:hover:not(:disabled) { filter: brightness(1.08); }
.pb svg { width: 14px; height: 14px; }
#steplbl { font: 500 11.5px/1.2 var(--font-text); color: var(--muted); padding: 0 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#steplbl b { color: var(--fg); font-weight: 600; }

/* кнопка слоёв и правая колонка со слоями */
#layers-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--fg); padding: 0; }
#layers-btn:hover { background: var(--hover); }
#layers-btn[aria-pressed="true"] { background: var(--accent-a); border-color: var(--accent); color: var(--accent-fg); }
#layers-btn svg { width: 19px; height: 19px; opacity: .82; }
#rcol { position: absolute; z-index: 6; right: 12px; top: 104px; bottom: 150px; width: min(290px, calc(100% - 24px)); display: flex; flex-direction: column; justify-content: center; gap: 8px; pointer-events: none; }
#rcol > aside { pointer-events: auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; animation: slidein .18s ease-out; }
#rcol[data-n="1"] #layers, #rcol[data-n="1"] #cmts { flex: 1 1 auto; }
#rcol[data-n="1"] #info, #rcol[data-n="1"] #envp { flex: 0 1 auto; max-height: 100%; }
#rcol:not([data-n="1"]) > aside { flex: 1 1 0; }
#rbtns { grid-area: lbtn; justify-self: end; align-self: start; display: flex; flex-direction: row-reverse; gap: 8px; }
#env-btn, #cmt-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--fg); padding: 0; }
#env-btn:hover, #cmt-btn:hover { background: var(--hover); }
#env-btn[aria-pressed="true"], #cmt-btn[aria-pressed="true"] { background: var(--accent-a); border-color: var(--accent); color: var(--accent-fg); }
#env-btn svg, #cmt-btn svg { width: 19px; height: 19px; opacity: .82; }
#env-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
#env-body h2 { margin: 0; font: 600 10px/1 var(--font-head); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
#env-drop { border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px 10px; text-align: center; font-size: 12.5px; cursor: pointer; background: var(--hover); }
#env-drop small { display: block; margin-top: 4px; color: var(--muted); font-size: 10.5px; }
#env-drop:hover, #envp.dragging #env-drop, #stage.dragging #env-drop { border-color: var(--accent); }
#env-prev { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.envrow { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; align-items: baseline; }
#env-name { text-align: right; overflow-wrap: anywhere; }
.sl2 { display: grid; grid-template-columns: 92px 1fr 40px; align-items: center; gap: 8px; }
.sl2 input[type=range] { width: 100%; }
.sl2 output { font: 600 11px/1 var(--font-text); color: var(--accent); text-align: right; }
#info header { flex: none; padding: 12px 14px 0; }
#info-body { flex: 1; min-height: 0; overflow: auto; padding: 8px 14px 14px; }
#info h2 { margin: 0 0 8px; font: 600 10px/1 var(--font-head); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
#info .name { font: 600 16px/1.25 var(--font-head); margin: 0 0 10px; overflow-wrap: anywhere; }
#info dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12.5px; }
#info dt { color: var(--muted); }
#info dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#info .sep { grid-column: 1 / -1; height: 1px; background: var(--line); margin: 2px 0; }
#info .sub { grid-column: 1 / -1; font-size: 11px; color: var(--muted); line-height: 1.4; }
@keyframes slidein { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
#layers header { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px 14px; }
#layers header .grow { flex: 1; }
#pin { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--muted); }
#pin:hover { background: var(--hover); color: var(--fg); }
#pin[aria-pressed="true"] { background: var(--accent-a); color: var(--accent-fg); }
#pin svg { width: 15px; height: 15px; }
#layers .acts { flex: none; display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 6px; }
#layers .acts .pb { height: 26px; padding: 0 10px; font-size: 11.5px; }
#layer-list { flex: 1; min-height: 0; overflow: auto; padding: 2px 6px 10px; }
.group { margin-top: 6px; }
.ghead { display: flex; align-items: center; gap: 2px; padding-right: 2px; border-radius: 8px; }
.ghead:hover { background: var(--hover); }
.ghead .toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 8px 4px; text-align: left; font: 600 11px/1 var(--font-head); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.ghead .toggle .chev { width: 13px; height: 13px; flex: none; transition: transform .15s; }
.ghead .toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.ghead .count { margin-left: auto; font-variant-numeric: tabular-nums; }
.ghead.has-sel .toggle { color: var(--accent); }
.eye { width: 26px; height: 26px; flex: none; border: 0; background: none; border-radius: 7px; display: grid; place-items: center; color: var(--fg); }
.eye:hover { background: var(--hover); }
.eye svg { width: 15px; height: 15px; }
.eye[aria-pressed="false"] { color: var(--muted); opacity: .6; }
.eye.gact { opacity: .65; }
.eye.gact:hover { opacity: 1; }
.item { display: flex; align-items: center; gap: 6px; padding: 1px 6px; border-radius: 8px; }
.item:hover { background: var(--hover); }
.item.sel { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.item .pick { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 6px 2px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item.off .pick { opacity: .45; text-decoration: line-through; }
input[type=color] { width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; flex: none; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 5px; }


/* комментарии */
#cmt-btn { position: relative; }
#cmt-btn .bdg { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--accent-fg); font: 700 10px/16px var(--font-text); text-align: center; }
#cmts header { flex: none; padding: 12px 14px 6px; }
#cmt-new { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 0 12px 8px; }
#cmt-new textarea { width: 100%; min-height: 54px; resize: none; border-radius: 10px; border: 1px solid var(--line); background: var(--hover); color: var(--fg); padding: 8px 10px; font: 400 12.5px/1.4 var(--font-text); }
#cmt-new textarea::placeholder { color: var(--muted); }
#cmt-for { font-size: 11px; color: var(--muted); }
#cmt-for b { color: var(--accent); font-weight: 600; }
#cmt-list { flex: 1; min-height: 0; overflow: auto; padding: 2px 8px 12px; display: flex; flex-direction: column; gap: 6px; }
#cmt-empty { padding: 14px 8px; text-align: center; color: var(--muted); font-size: 12px; }
.cm { border: 1px solid var(--line); border-radius: 12px; background: var(--hover); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.cm.sel { border-color: var(--accent); }
.cm.done { opacity: .6; }
.cm .mh { display: flex; align-items: baseline; gap: 8px; }
.cm .mp { font: 600 12px/1.2 var(--font-head); color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm .md { margin-left: auto; font-size: 10.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cm .mt { font-size: 12.5px; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-wrap; }
.cm .ma { display: flex; gap: 4px; align-items: center; }
.cm .ma .sg { border: 1px solid var(--line); height: 24px; font-size: 11px; }
.cm .ma .x { margin-left: auto; width: 24px; height: 24px; display: grid; place-items: center; border: 0; background: none; border-radius: 7px; color: var(--muted); }
.cm .ma .x:hover { background: var(--hover); color: var(--fg); }
#cmts > .pb, #cmt-io-row { flex: none; }
#cmt-io-row { display: flex; gap: 6px; padding: 0 12px 10px; }
#cmt-io-row .pb { height: 26px; font-size: 11.5px; }
#cmt-io { flex: none; margin: 0 12px 8px; width: calc(100% - 24px); min-height: 60px; resize: none; border-radius: 10px; border: 1px solid var(--line); background: var(--hover); color: var(--fg); padding: 6px 8px; font: 400 11px/1.3 var(--font-text); }
#cmt-io-go { margin: 0 12px 10px; }
#dl { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); }
#dl:hover { background: var(--hover); }
#dl:disabled { opacity: .5; cursor: progress; }
#dl svg { width: 17px; height: 17px; }

/* левая панель инструментов */
#tools { grid-area: tools; justify-self: start; align-self: center; display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 14px; width: 38px; max-height: 100%; overflow-y: auto; scrollbar-width: none; }
#tools .tsep { height: 1px; margin: 3px 5px; background: var(--line); flex: none; }
#tools button { flex: none; }
#tools button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 9px; background: none; color: var(--fg); }
#tools button:hover:not(:disabled) { background: var(--hover); }
#tools button:disabled { opacity: .3; cursor: default; }
#tools button[aria-pressed="true"] { background: var(--accent-a); color: var(--accent-fg); }
#tools svg { width: 17px; height: 17px; opacity: .82; }

/* нижние панели */
#bottom { grid-area: bottom; justify-self: center; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 100%; }
.sg { height: 26px; padding: 0 11px; border-radius: 999px; border: 0; background: none; color: var(--muted); font: 500 12px/1 var(--font-text); white-space: nowrap; }
.sg:hover { color: var(--fg); }
.sg[aria-pressed="true"] { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent)); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent-fg); font-weight: 600; }
select.sel { height: 26px; border-radius: 999px; border: 1px solid var(--line); background: var(--hover); padding: 0 8px; font-size: 12px; color: var(--fg); max-width: 150px; }
select.sel option { background: var(--panel-solid); color: var(--fg); }
.tg { height: 26px; padding: 0 11px 0 9px; border-radius: 999px; border: 0; background: none; color: var(--muted); font: 500 12px/1 var(--font-text); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; flex: none; }
.tg::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--track); }
.tg:hover { color: var(--fg); }
.tg[aria-pressed="true"] { color: var(--fg); background: var(--hover); }
.tg[aria-pressed="true"]::before { background: var(--accent-a); box-shadow: 0 0 8px var(--accent); }

/* строка состояния */
#wound { font: 500 11px/1 var(--font-text); color: var(--muted); min-width: 74px; font-variant-numeric: tabular-nums; }
#status { grid-area: status; pointer-events: none !important; font: 400 10.5px/1.4 var(--font-text); color: var(--muted); font-variant-numeric: tabular-nums; }
#status b { color: var(--fg); font-weight: 600; }
#status .partline { color: var(--fg); }

/* инструкция по сборке: заменяет 3D-вид внутри сцены, шапка остаётся на месте */
#manual { position: absolute; inset: 0; z-index: 8; background: var(--bg); }
#manual iframe { display: block; width: 100%; height: 100%; border: 0; background: transparent; }

@media (max-width: 1060px) {
  #ui { grid-template-columns: 38px minmax(0, 1fr) minmax(0, 200px); grid-template-areas: 'tools bars lbtn' 'tools . .' 'bottom bottom bottom' 'status status status'; }
  #tools { grid-row: 1 / 3; }
  .sl input[type=range] { width: 70px; }
}
@media (max-width: 700px) {
  #ui { grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    grid-template-areas: 'tools lbtn' 'tools bars' 'tools .' 'bottom bottom' 'status status'; padding: 8px; }
  #tools { grid-row: 1 / 4; }
  #rcol { top: 150px; bottom: 120px; }
  #bars { justify-self: stretch; align-items: stretch; }
  #bars .pill { border-radius: 16px; }
  #bars .pill.sliders { flex-wrap: wrap; row-gap: 6px; }
  .sl { padding: 0 8px; }
  #brand h1 { display: none; }
  #status { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { #glow, #tip { transition: none; } }
