/* Цвета, размеры, тени — токены дизайн-системы в tokens.css (подключается до этого файла); тема = класс на корне (.th-dark / .th-light) */
/* Шрифт — Inter variable, свои файлы (fonts/, OFL), подмножества и unicode-range — как у Fontsource */
@font-face{font-family:Inter;src:url(../fonts/inter-latin.woff2) format('woff2');font-weight:100 900;font-display:swap;
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,
  U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:Inter;src:url(../fonts/inter-cyrillic.woff2) format('woff2');font-weight:100 900;font-display:swap;
  unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
/* Семейство (--sans) и шкала шрифта (--fs-*, на < 900 на ступень крупнее) — в tokens.css */
*{box-sizing:border-box}
body{display:flex;flex-direction:column;min-height:100vh;margin:0;background:var(--bg);color:var(--text);font:var(--fs-body)/1.4 var(--sans)}
button{font:inherit}
/* Шапка-строка (карточка Tabs): 32 без подложки, шириной стойки (на ≥ 1232 — 1200 по центру): знак и Synthari, через 32 — вкладки,
   справа Presets открытого модуля, View, «?» — клавиши без фона (открытое меню — плашка popover) */
.topbar{display:flex;align-items:center;gap:32px;width:100%;height:var(--size-header);margin:40px auto 0;padding:0 32px}
@media(min-width:1232px){.topbar{width:calc(5 * var(--grid-module));padding:0}}
.brand{display:flex;align-items:center;gap:8px;color:var(--text);text-decoration:none;font-size:var(--fs-title);line-height:20px;font-weight:500}
/* Логотип: светлая плашка 24 с волной */
.logo{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:6.5px;background:var(--logo-bg)}
.logo svg{width:15px;height:15px;fill:none;stroke:var(--logo-fg);stroke-width:1.8;stroke-linecap:round}
/* Вкладки — плоская дорожка inset; клавиша 28 (.flat): выбранная — плашка popover, text и горящий светодиод, наведение — surface */
.tabs{display:inline-flex;flex:none;gap:2px;padding:2px;border-radius:var(--radius-10);background:var(--inset)}
.tabs [data-stub],.tabs [hidden]{display:none}
.flat{display:flex;align-items:center;justify-content:center;gap:6px;height:28px;padding:0 12px;border:0;border-radius:var(--radius-8);
  font:400 var(--fs-body)/16px var(--sans);white-space:nowrap;color:var(--text-2);background:transparent;cursor:pointer}
@media(hover:hover){.flat:hover{background:var(--surface)}.tabs .flat[aria-checked=true]:hover{background:var(--popover)}}
.tabs .flat[aria-checked=true]{background:var(--popover);color:var(--text)}
.flat[aria-checked=true] .led{background:var(--led-on);box-shadow:var(--shadow-led)}
.flat:focus-visible{outline:2px solid var(--accent-text);outline-offset:2px}
.topbar-tools,.module-tools{display:flex;align-items:center;gap:4px}
.topbar-tools{margin-left:auto}
.module-tools[hidden]{display:none}
/* Только клавиши самой шапки — не кнопки внутри её поповеров (пресеты) */
.topbar-tools>.tool-button,.presets-picker>.tool-button,.view-picker>.tool-button{gap:6px;height:var(--size-header);padding:0 12px;border:0;
  color:var(--text-2);font-size:var(--fs-body);font-weight:400}
.topbar-tools>.tool-button.square{width:var(--size-header);padding:0}
@media(hover:hover){:is(.topbar-tools,.presets-picker,.view-picker)>.tool-button:hover{background:var(--surface);color:var(--text)}}
:is(.presets-picker,.view-picker)>.tool-button[aria-expanded=true]{background:var(--popover);color:var(--text)}
.tool-button{display:flex;align-items:center;justify-content:center;gap:8px;height:32px;padding:0 10px;border:1px solid var(--line);border-radius:8px;
  background:transparent;color:var(--text);cursor:pointer}
/* Hover — только для мыши (hover:hover): на телефоне подсветка «залипает» после касания; на месте, чтобы порядок правил
   (выбранное после наведения) остался прежним */
@media(hover:hover){.tool-button:hover{background:var(--surface)}}
.tool-button.square{width:32px;padding:0}
.tool-button svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.5}
.tool-button svg path{fill:currentColor;stroke:none}
/* «Вид»: поповер под кнопкой — строки «подпись — контрол»: сверху звук (Volume, MIDI), под чертой — язык, тема, карточки;
   на < 900 — нижний лист */
.view-picker{position:relative}
.view-picker .tool-button svg path{fill:none;stroke:currentColor;stroke-linecap:round}
.view-picker .tool-button svg circle{fill:var(--bg)}
.view-popover,.card-popover{position:absolute;z-index:30;top:calc(100% + 8px);right:0;display:flex;flex-direction:column;width:320px;padding:8px;
  border:1px solid var(--line-strong);border-radius:16px;background:var(--popover);box-shadow:0 24px 60px var(--shadow)}
.view-popover[hidden],.card-popover[hidden]{display:none}
.view-row{display:grid;grid-template-columns:88px minmax(0,1fr);align-items:center;gap:12px;padding:8px 10px}
.view-row>span,.view-row>label{color:var(--text-2)}
.view-volume-head{display:flex;flex-direction:column;gap:2px}
.view-volume-head output{color:var(--text);font-variant-numeric:tabular-nums}
.view-sep{height:1px;margin:4px -8px;background:var(--line)}
/* Язык, тема, карточки — дорожки, как вкладки: выбранная — плашка selected со светодиодом */
#view-popover .segment{border:0;border-radius:var(--radius-10)}
#view-popover .segment button{display:flex;align-items:center;justify-content:center;gap:6px;border-radius:var(--radius-8)}
#view-popover .segment button::before{content:'';flex:none;width:var(--size-led);height:var(--size-led);border-radius:50%;background:var(--led-off);
  box-shadow:var(--shadow-led-off)}
#view-popover .segment button[aria-pressed=true]::before{background:var(--led-on);box-shadow:var(--shadow-led)}
/* MIDI: список входов и строка состояния под ним; строки нет без Web MIDI */
.view-row[hidden]{display:none}
.view-midi{display:flex;flex-direction:column;gap:4px;min-width:0}
/* Поле — лунка well (доска Stage4Header): светодиод слева горит, когда вход выбран (не «Выкл»), справа тонкая стрелка */
.view-midi-field{position:relative;display:flex}
.view-midi-field::before,.view-midi-field::after{content:'';position:absolute;top:50%;pointer-events:none}
.view-midi-field::before{left:12px;width:var(--size-led);height:var(--size-led);margin-top:calc(var(--size-led) / -2);border-radius:50%;
  background:var(--glow-core);box-shadow:var(--shadow-glow)}
.view-midi-field:has(option[value=""]:checked)::before{background:var(--led-off);box-shadow:var(--shadow-led-off)}
.view-midi-field::after{right:10px;width:12px;height:12px;margin-top:-6px;background:var(--text-2);
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
.view-midi select{width:100%;height:32px;padding:0 30px 0 26px;border:0;border-radius:8px;background:var(--well);box-shadow:var(--shadow-inset);
  color:var(--text);font:inherit;appearance:none}
.view-midi-status{color:var(--text-3);font-size:var(--fs-micro)}
.sheet-handle,.sheet-head,.sheet-backdrop{display:none}
/* Пресеты: кнопка в шапке; меню — rack.css (карточка Presets) */
.presets-picker{position:relative;flex:none}
.presets-picker .tool-button svg path{fill:none;stroke:currentColor;stroke-linecap:round}
/* Справка «?» (карточка Help): значок 16 в зоне 24 в заголовке блока (у Oscillator — справа, у остальных — перед переключателем);
   поповер 320 по центру под «?» со стрелкой (у краёв окна сдвиг и место стрелки — cards.js, --arrow); на < 900 — нижний лист */
.block-head .card-picker{margin-left:auto}
.card-picker{position:relative;flex:none}
.card-open{position:relative;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;
  border-radius:50%;background:none;color:var(--text-3);cursor:pointer}
.card-open svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round}
@media(hover:hover){.card-open:hover{color:var(--text)}}
.card-open[aria-expanded=true]{background:var(--popover);color:var(--text)}
@media(pointer:coarse){.card-open::before{content:'';position:absolute;inset:-10px}}
.card-popover{left:0;right:auto;width:320px;padding:0;border-radius:var(--radius-20);box-shadow:var(--shadow-popover);font-size:var(--fs-body);
  line-height:18px}
.card-popover.card-up{top:auto;bottom:calc(100% + 8px)}
.card-popover:focus{outline:none}
.card-arrow{position:absolute;top:-7px;left:calc(var(--arrow,50%) - 6px);width:12px;height:12px;border:solid var(--line-strong);
  border-width:1px 0 0 1px;background:var(--popover);transform:rotate(45deg)}
.card-up .card-arrow{top:auto;bottom:-7px;border-width:0 1px 1px 0}
.card-body{display:flex;flex-direction:column;gap:12px;min-height:0;padding:16px;overflow-y:auto;overscroll-behavior:contain}
.card-title{display:flex;align-items:baseline;gap:8px}
.card-title h3{margin:0;font-size:var(--fs-title);line-height:20px;font-weight:500}
.card-title span{font-size:var(--fs-micro);color:var(--text-3)}
.card-body p{margin:0;color:var(--text-2)}
.card-body hr{flex:none;height:1px;margin:0;border:0;background:var(--line)}
/* Ручки — 80 по доске; длинное слово («Переключатель») раздвигает столбец, а не налезает на описание */
.card-body dl{display:grid;grid-template-columns:minmax(80px,auto) minmax(0,1fr);gap:6px 8px;margin:0}
.card-body dt{color:var(--text)}
.card-body dd{margin:0;color:var(--text-2)}
.card-body .card-try{padding:10px 12px;border-radius:var(--radius-12);background:var(--accent-tint);color:var(--text)}
.card-try b{color:var(--accent-text);font-weight:500}
/* «?» карточки осциллографа и спектра — в правом верхнем углу полосы */
.scope{position:relative}
.scope>.card-picker{position:absolute;top:6px;right:6px}
/* Справка «?»: модальное окно 600 поверх затемнения, как окно About; разделы — вкладками, текст раздела прокручивается */
.tool-button.guide-open{font-size:var(--fs-body);font-weight:400}
.guide-dialog{position:fixed;inset:0;z-index:70;display:grid;grid-template-columns:minmax(0,1fr);place-items:center;padding:20px;
  background:var(--backdrop)}
.guide-dialog[hidden]{display:none}
/* Страница под открытой справкой не прокручивается */
html:has(.guide-dialog:not([hidden])){overflow:hidden}
.guide-card{position:relative;box-sizing:border-box;display:flex;flex-direction:column;gap:16px;width:min(100%,600px);max-height:min(88vh,560px);
  padding:32px;
  border:1px solid var(--line-strong);border-radius:var(--radius-20);background:var(--popover);box-shadow:var(--shadow-popover)}
.guide-card h2{margin:0;padding-right:24px;font-size:var(--fs-display);line-height:28px;font-weight:600}
.guide-tabs{flex:none;display:flex;flex-wrap:wrap;gap:4px}
.guide-tabs button{flex:none;height:28px;padding:0 12px;border:0;border-radius:var(--radius-8);background:none;color:var(--text-2);font:inherit;
  white-space:nowrap;cursor:pointer}
.guide-tabs button[aria-selected=true]{background:var(--well);box-shadow:var(--shadow-well);color:var(--text)}
@media(hover:hover){.guide-tabs button:hover{color:var(--text)}}
@media(pointer:coarse){.guide-tabs button{height:44px}}
#guide-body{min-height:0;overflow-y:auto;overscroll-behavior:contain;color:var(--text-2);line-height:1.55}
#guide-body:focus-visible{outline:2px solid var(--accent-text);outline-offset:2px}
#guide-body ul{margin:0;padding-left:18px}
#guide-body li+li{margin-top:8px}
/* Окно для новых пользователей (welcome.js, карточка About): 600, три шага в ряд, строки о проекте, «Начать играть» — клавиша */
.welcome-card{position:relative;box-sizing:border-box;display:flex;flex-direction:column;gap:24px;width:min(100%,600px);max-height:88vh;
  overflow-y:auto;padding:32px;border:1px solid var(--line-strong);border-radius:var(--radius-20);background:var(--popover);
  box-shadow:var(--shadow-popover)}
.welcome-card:focus{outline:none}
.dialog-close{position:absolute;top:16px;right:16px;display:grid;place-items:center;width:28px;height:28px;padding:0;border:0;
  border-radius:var(--radius-8);background:none;color:var(--text-3);cursor:pointer}
.dialog-close svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round}
@media(hover:hover){.dialog-close:hover{color:var(--text)}}
@media(pointer:coarse){.dialog-close::before{content:'';position:absolute;inset:-8px}}
.welcome-card header{display:flex;flex-direction:column;gap:8px}
.welcome-card h2{margin:0;padding-right:24px;font-size:var(--fs-display);line-height:28px;font-weight:600}
.welcome-card p{margin:0;font-size:var(--fs-body);line-height:18px;color:var(--text-2)}
.welcome-steps{display:flex;gap:16px;margin:0;padding:0;list-style:none}
.welcome-steps li{display:flex;flex-direction:column;gap:8px;width:168px}
.welcome-steps svg{height:20px}
.welcome-steps .line{fill:none;stroke:var(--text-2);stroke-width:1.5;stroke-linecap:round}
.welcome-steps .fill{fill:var(--text-2)}
.welcome-steps .mark-fill{fill:var(--screen-mark)}
.welcome-steps .mark-line{fill:none;stroke:var(--screen-mark);stroke-width:1.5;stroke-linecap:round}
.welcome-steps h3{margin:0;font-size:var(--fs-title);line-height:20px;font-weight:500}
.welcome-notes{display:flex;flex-direction:column;gap:6px;padding-top:24px;border-top:1px solid var(--line)}
.welcome-ok{align-self:flex-end}
.welcome-ok .key{width:auto;min-width:128px;height:32px;padding:0 16px;font-size:var(--fs-body);color:var(--text);white-space:nowrap}
/* Узко — шаги в столбец; горизонтальный телефон — шаги в ряд и плотнее, чтобы окно помещалось в 390 по высоте */
@media(max-width:599px){.welcome-card{padding:24px 20px}.welcome-steps{flex-direction:column}.welcome-steps li{width:auto}}
@media(max-height:500px){#welcome-dialog{padding:12px}.welcome-card{width:min(100%,760px);gap:10px;padding:14px 20px}
  .welcome-card header{gap:2px}.welcome-card h2{font-size:var(--fs-title);line-height:22px}.welcome-card p{line-height:16px}
  .welcome-steps{flex-direction:row;gap:16px}.welcome-steps li{flex:1;gap:2px;width:auto}.welcome-steps h3{font-size:var(--fs-body)}
  .welcome-notes{padding-top:10px;gap:2px}}
/* Экран модуля — колонкой: клавиатура закреплена у нижнего края на всех ширинах (sticky), на коротком — прижата к нему */
main{display:flex;flex-direction:column;flex:1;width:100%;max-width:1440px;margin:0 auto;padding:24px 32px 0}
.screen{display:flex;flex-direction:column;flex:1}
.screen[hidden]{display:none}
/* Строки модуля нет (карточка Tabs): название — для диктора */
.module-title{position:absolute;width:1px;height:1px;margin:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
/* Плашка «Вернуть» (карточка Presets): 44, по центру над закреплённой клавиатурой (её потомок); текст text-2, имя — text
   (кавычки вокруг имени скрыты, controls.js), клавиша «Вернуть» selected, черта, × */
.toast{position:absolute;left:50%;bottom:calc(100% + 12px);z-index:30;display:flex;align-items:center;gap:16px;box-sizing:border-box;height:44px;
  padding:0 8px 0 16px;transform:translateX(-50%);border:1px solid var(--line-strong);border-radius:var(--radius-12);background:var(--popover);
  box-shadow:var(--shadow-toast);color:var(--text-2);font-size:var(--fs-body);white-space:nowrap}
.toast[hidden]{display:none}
.toast-name{color:var(--text)}
.toast-quote{display:none}
.toast button{display:flex;flex:none;align-items:center;justify-content:center;height:28px;padding:0;border:0;border-radius:var(--radius-8);
  background:none;color:var(--text-3);font:inherit;cursor:pointer}
.toast .toast-undo{gap:6px;padding:0 12px;background:var(--selected);color:var(--text)}
.toast-undo svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.toast-rule{flex:none;width:1px;height:20px;background:var(--line)}
.toast .toast-close{width:28px;font-size:15px}
@media(hover:hover){.toast .toast-undo:hover{background:var(--line-strong)}.toast .toast-close:hover{color:var(--text)}}
/* Подсказка «Щёлкните, чтобы включить звук» (MIDI до первого жеста): карточка по центру экрана поверх всего, акцентная рамка,
   пульсирует (без «Уменьшить движение») */
.wake-hint{position:fixed;z-index:60;left:50%;top:42%;display:flex;flex-direction:column;align-items:center;gap:12px;
  width:min(300px,calc(100vw - 32px));padding:24px 22px;transform:translate(-50%,-50%);border-radius:16px;background:var(--popover);
  box-shadow:inset 0 0 0 2px var(--accent),0 24px 60px var(--shadow);text-align:center;cursor:pointer}
.wake-hint[hidden]{display:none}
.wake-hint svg{width:36px;height:36px;fill:none;stroke:var(--accent-text);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.wake-hint p{margin:0;color:var(--text);font-size:var(--fs-title);font-weight:500;line-height:1.4}
.wake-hint .wake-why{margin-top:-6px;color:var(--text-2);font-size:var(--fs-body);font-weight:400}
@media(prefers-reduced-motion:no-preference){.wake-hint:not([hidden]){animation:wake-pulse 1.6s ease-in-out infinite}}
@keyframes wake-pulse{50%{box-shadow:inset 0 0 0 2px var(--accent),0 0 0 8px var(--accent-tint),0 24px 60px var(--shadow)}}
/* Осциллограф и спектр: два полотна в ряд, подпись в углу */
.scope{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:12px}
.block{display:flex;flex-direction:column;gap:10px;padding:14px 16px 16px;border-radius:14px;background:var(--surface)}
.block h2{margin:0;font-size:var(--fs-title);font-weight:500}
/* Заголовок блока с переключателем «вкл / выкл»; выключенный блок приглушён, ручки остаются доступны */
.block-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.block-head h2{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.block>:not(.block-head){transition:opacity .15s}
/* Level усилителя (.slider[data-live]) — не часть огибающей, не приглушается */
.block[data-off]>:not(.block-head,[data-live]){opacity:var(--opacity-off)}
/* Сегмент — как в Sonari */
.segment{display:flex;gap:2px;padding:2px;border:1px solid var(--line);border-radius:9px;background:var(--inset)}
/* Ширина кнопок — по подписи плюс поровну остатка; поля малые: на 900 px подписи фильтра впритык; не влезут — многоточие */
.segment button{flex:1 1 auto;min-width:0;height:28px;padding:0 4px;border:0;border-radius:7px;background:transparent;color:var(--text-2);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
@media(hover:hover){.segment button:hover{background:var(--hover);color:var(--text)}}
.segment button[aria-pressed=true]{background:var(--selected);color:var(--text)}
/* Основа всех input range; размеры, дорожка, бегунок и --thumb — у ручки, фейдера и слайдера (rack.css) */
input[type=range]{display:block;margin:0;background:transparent;cursor:pointer;-webkit-appearance:none;appearance:none}
/* Клавиатура: строка управления (rack.css), пианино на всю ширину (белые — flex, чёрные — поверх, по границам белых, как в Sonari) */
/* Закреплена у нижнего края: играть и крутить параметры одновременно */
.keys-panel{position:sticky;z-index:5;bottom:0;margin:auto -16px 0;padding:10px 16px 14px;border-radius:16px 16px 0 0;
  background:var(--surface);box-shadow:0 -8px 24px var(--shadow)}
/* Заголовок панели — только для диктора */
.keys-head h2{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
/* Петля бывает выше экрана телефона: панель — не выше окна, петля сжимается и прокручивается внутри,
   строка управления и пианино остаются на виду */
@media(max-width:899px),(orientation:landscape) and (max-height:500px){
  .keys-panel{display:flex;flex-direction:column;max-height:calc(100dvh - 80px)}
  .keys-head,.keys-piano{flex:none}
  .keys-extra{min-height:0;overflow-y:auto;overscroll-behavior:contain}
}
/* Короткий широкий экран (1200 × 800): ниже полотна и пианино — все блоки над закреплённой клавиатурой без прокрутки
   (пианино — rack.css; высоты пианино здесь — до раскладок 7.22–7.26) */
@media(min-width:1200px) and (max-height:839px){
  .keys-piano .piano{height:126px}
}
:focus-visible{outline:2px solid var(--accent-text);outline-offset:2px}
.segment button:focus-visible{outline-offset:-2px}
/* Страница 404 (Cloudflare Pages): заголовок, строка и ссылка на главную */
.notfound{gap:12px;align-items:flex-start;padding-top:48px;padding-bottom:48px}
.notfound h1{margin:0;font-size:var(--fs-display);font-weight:600}
.notfound p{margin:0;color:var(--text-2)}
.notfound .tool-button{color:var(--text);text-decoration:none}
/* Nodes (карточка Nodes): стойка — экраны выхода, строка поля 56 и плашка с полем. Поле утоплено, точки field-dot шагом 16
   идут за видом (nodes.js: background-position и -size); слой узлов и SVG-слой проводов сдвигаются видом (transform) */
.nodes-bar{display:flex;align-items:center;gap:8px;height:56px;padding:0 16px;background:var(--surface);box-shadow:var(--shadow-plate)}
.key:is(.nodes-key,.nodes-icon) svg{width:14px;height:14px}
.key.nodes-key{width:auto;color:var(--text);gap:6px;padding:0 10px 0 8px;font-size:var(--fs-micro);line-height:14px;white-space:nowrap}
.key.nodes-icon{width:24px;color:var(--text)}
.nodes-up[hidden]{display:none}
.nodes-path{display:flex;align-items:center;gap:4px;min-width:0;margin:0 auto 0 8px;overflow:hidden}
.nodes-path button{flex:none;height:24px;padding:0 6px;border:0;border-radius:6px;background:none;color:var(--text-2);font:inherit;
  font-size:var(--fs-body);line-height:16px;white-space:nowrap;cursor:pointer}
.nodes-path button+button::before{content:'›';margin-right:10px;color:var(--text-3);font-weight:400}
.nodes-path button[aria-current]{color:var(--text);font-weight:500;cursor:default}
@media(hover:hover){.nodes-path button:not([aria-current]):hover{color:var(--text)}}
.nodes-state{position:relative;flex:none;width:176px;height:var(--size-screen-strip);border-radius:var(--radius-12);background:var(--screen);
  box-shadow:var(--shadow-screen-flush)}
.nodes-state .screen-label{top:9px}
.nodes-help{margin-left:8px}
.nodes-help .card-popover{left:auto;right:-8px}
.nodes-help .card-arrow{left:auto;right:14px}
.nodes-help .card-body dl{grid-template-columns:88px minmax(0,1fr);gap:4px 8px;font-size:var(--fs-micro);line-height:16px}
.nodes-help .card-body dt{color:var(--text-2)}
.nodes-help .card-body dd{color:var(--text)}
.card-body kbd{display:inline-block;padding:0 5px;border-radius:var(--radius-4);background:var(--inset);
  box-shadow:var(--shadow-inset);color:var(--text);
  font:inherit;white-space:nowrap}
.nodes-well{padding:0 16px 16px;border-radius:0 0 var(--radius-20) var(--radius-20);background:var(--surface);box-shadow:var(--shadow-plate)}
.nodes-field{position:relative;height:clamp(360px,62vh,760px);overflow:hidden;border-radius:var(--radius-12);background-color:var(--field-bg);
  background-image:radial-gradient(circle,var(--field-dot) 1px,transparent 1.4px);background-size:16px 16px;background-position:8px 8px;
  box-shadow:var(--shadow-inset);outline:none;touch-action:pinch-zoom}
.nodes-field:focus-visible{outline:2px solid var(--accent-text);outline-offset:2px}
.nodes-field.panning{cursor:grabbing}
.nodes-canvas{position:absolute;top:0;left:0;transform-origin:0 0}
.nodes-wires{position:absolute;inset:0;width:100%;height:100%}
.nodes-marquee{position:absolute;border:1px dashed var(--accent);background:var(--accent-tint);pointer-events:none}
.nodes-marquee[hidden]{display:none}
/* Пояснение (отказ провода, звук не загрузился) — плашка popover у места действия, по умолчанию — в левом верхнем углу поля */
.nodes-note{position:absolute;z-index:2;top:16px;left:16px;box-sizing:border-box;max-width:288px;margin:0;padding:8px 12px;
  border:1px solid var(--line-strong);border-radius:var(--radius-8);background:var(--popover);box-shadow:var(--shadow-toast);color:var(--text);
  font-size:var(--fs-micro);line-height:16px;pointer-events:none}
.nodes-note:empty{display:none}
/* Меню «Добавить узел»: поиск, группы, пункты 32 — имя и порты моноширинным */
.nodes-picker{position:relative}
.nodes-menu{position:absolute;top:calc(100% + 8px);left:0;z-index:40;display:flex;flex-direction:column;box-sizing:border-box;width:256px;
  max-height:420px;padding:8px;border:1px solid var(--line-strong);border-radius:var(--radius-12);background:var(--popover);
  box-shadow:var(--shadow-popover)}
.nodes-menu.at-pointer{position:fixed;top:auto;left:auto}
.nodes-menu[hidden]{display:none}
.nodes-search{display:flex;flex:none;align-items:center;gap:6px;height:32px;padding:0 8px;border-radius:var(--radius-8);background:var(--inset);
  box-shadow:var(--shadow-inset);color:var(--text-3)}
.nodes-search svg{flex:none;width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round}
.nodes-search input{flex:1;min-width:0;height:100%;padding:0;border:0;background:none;color:var(--text);font:inherit;outline:none}
.nodes-menu-list{min-height:0;margin-top:4px;overflow:auto}
.nodes-menu-group p{margin:8px 8px 2px;color:var(--text-2);font-size:var(--fs-micro);line-height:14px}
.nodes-menu-group[hidden],.nodes-menu-group button[hidden]{display:none}
.nodes-menu-group button{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;height:32px;padding:0 8px;border:0;
  border-radius:var(--radius-8);background:none;color:var(--text);font:inherit;text-align:left;cursor:pointer}
.nodes-menu-group button small{overflow:hidden;color:var(--text-2);font:var(--fs-micro)/14px ui-monospace,Menlo,monospace;white-space:nowrap;
  text-overflow:ellipsis}
.nodes-menu-group button:focus-visible,.nodes-menu-group button:hover{background:var(--hover);outline:none}
/* Кабели (nodes.js, soundPorts): звук — wire 2,5, управление — wire-ctl 1,5, тень влево-вниз — одна на слой; выбранный — accent,
   тянущийся — пунктир accent-text. Толщина и тень — в пикселях экрана при любом масштабе поля (тень — на svg без масштаба) */
.nodes-wires{filter:drop-shadow(-1.5px 3px 0 var(--shadow))}
.wire{fill:none;stroke:var(--wire-ctl);stroke-width:1.5;stroke-linecap:round;pointer-events:stroke;cursor:pointer;
  vector-effect:non-scaling-stroke}
.wire.sound{stroke:var(--wire);stroke-width:2.5}
@media(hover:hover){.wire:hover{stroke:var(--text)}}
.wire.selected{stroke:var(--accent)}
.wire-drag{fill:none;stroke:var(--accent-text);stroke-width:1.5;stroke-dasharray:6 4;pointer-events:none;vector-effect:non-scaling-stroke}
/* Узел: плашка surface с тенью на поле, ширины кратны 8; шапка 28 (имя, комментарий, ×), строки портов 24, поле числа 64 × 20 */
.node{--node-shadow:-2px 4px 10px var(--shadow),var(--shadow-raised-sm);position:absolute;box-sizing:border-box;width:160px;
  border-radius:var(--radius-8);background:var(--surface);box-shadow:var(--shadow-plate),var(--node-shadow);user-select:none}
.node[data-type=expr]{width:232px}
.node[data-type=out]{width:112px}
.node.group{width:176px}
.node[data-type=scope]{width:240px}
.node.selected{outline:2px solid var(--accent)}
.node-head{display:flex;align-items:center;gap:6px;height:28px;padding:0 2px 0 10px;border-bottom:1px solid var(--inset);
  box-shadow:0 1px 0 var(--grille-lit);font-size:var(--fs-body);line-height:16px;font-weight:500;white-space:nowrap;cursor:grab;
  touch-action:none}
.node-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
.node-stack{flex:none;width:14px;height:14px;margin-right:-2px;fill:none;stroke:var(--text-2);stroke-width:1.5;stroke-linejoin:round}
.node-tools{display:flex}
.node-tool{display:grid;place-items:center;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:transparent;
  color:var(--text-3);
  cursor:pointer}
.node-open{color:var(--text-2)}
.node-tool svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
@media(hover:hover){.node-tool:hover{background:var(--hover);color:var(--text)}}
/* Контейнер — вторая плашка stand позади со сдвигом 4 вверх-вправо; Inputs / Outputs внутри — на плашке stand, без × */
.node.group{box-shadow:4px -4px 0 0 var(--stand),4px -4px 0 1px var(--shadow),var(--shadow-plate),var(--node-shadow)}
.node:is([data-type=inputs],[data-type=outputs]){background:var(--stand)}
.node:is([data-type=inputs],[data-type=outputs]) .node-name{color:var(--text-2)}
.node-ports{padding:4px 0}
.node-row{position:relative;display:flex;align-items:center;justify-content:space-between;gap:8px;height:24px;padding:0 8px 0 14px;
  color:var(--text-2);font-size:var(--fs-micro);line-height:14px}
.node-row.out{justify-content:flex-end;padding:0 14px 0 8px}
.node-row input{box-sizing:border-box;flex:none;width:64px;height:20px;margin-left:auto;padding:0 6px;border:1px solid transparent;
  border-radius:var(--radius-4);background:var(--inset);box-shadow:var(--shadow-inset);color:var(--text);font:12px/18px var(--sans);
  font-variant-numeric:tabular-nums}
.node-row input:focus-visible{border-color:var(--accent-text);outline:none}
.node-row.wired input{visibility:hidden}
/* Число — протяжкой вбок; в фокусе — ввод */
.node-row input[data-port]:not(:focus){cursor:ew-resize}
/* Стрелки числа не нужны: протяжка и клавиши ↑ ↓ (щелчок по стрелке был бы протяжкой) */
.node-row input[data-port]{appearance:textfield;-moz-appearance:textfield}
.node-row input[data-port]::-webkit-inner-spin-button,.node-row input[data-port]::-webkit-outer-spin-button{margin:0;-webkit-appearance:none}
/* Formula: формула моноширинным и меню пресетов; ошибка — рамка accent и пояснение плашкой под узлом */
.node-row.node-expr{padding:0 8px}
.node-row .node-formula{flex:1;width:auto;min-width:0;font-family:ui-monospace,Menlo,monospace}
.node-row .node-formula.invalid{border-color:var(--accent);color:var(--accent-text)}
.node-preset{flex:none;width:80px;height:20px;padding:0 2px;border:0;border-radius:var(--radius-4);background:var(--keycap);color:var(--text-2);
  font:var(--fs-micro) var(--sans);cursor:pointer}
.node-error{position:absolute;top:calc(100% + 8px);left:0;box-sizing:border-box;width:100%;margin:0;padding:8px 12px;
  border:1px solid var(--line-strong);
  border-radius:var(--radius-8);background:var(--popover);box-shadow:var(--shadow-toast);color:var(--text-2);
  font-size:var(--fs-micro);line-height:16px;
  pointer-events:none}
.node-error[hidden]{display:none}
/* Экраны Display (144 × 48: IN и значение, шкала −1…+1) и Scope (208 × 80: максимум, минимум, ms) — стекло экрана */
.node-meter,.node-scope{position:relative;border-radius:var(--radius-12);background:var(--screen);
  box-shadow:var(--shadow-screen-flush);overflow:hidden}
.node-meter{width:144px;height:var(--size-screen-value);margin:0 8px 8px}
.node-meter svg{position:absolute;inset:0;width:100%;height:100%}
.node-meter .scale{fill:none;stroke:var(--screen-ink-2);stroke-linecap:round}
.node-meter .bar{stroke:var(--screen-ink);stroke-width:3;stroke-linecap:round}
.node-meter .mark{stroke:var(--screen-mark);stroke-width:2;stroke-linecap:round}
.node-meter .screen-label{top:8px}
.node-scope{width:208px;height:var(--size-screen);margin:0 16px 16px}
.node-scope canvas{display:block;width:208px;height:80px}
.node-scope span{position:absolute;color:var(--screen-ink-2);font:600 var(--fs-micro)/14px var(--sans);letter-spacing:.04em;
  font-variant-numeric:tabular-nums;pointer-events:none}
.node-scope-hi{top:6px;left:8px}
.node-scope-lo{bottom:6px;left:8px}
.node-scope-ms{top:6px;right:8px}
/* Комментарий — под портами за разделителем */
.node-comment{margin:0;padding:8px 10px 10px;border-top:1px solid var(--inset);box-shadow:inset 0 1px 0 var(--grille-lit);color:var(--text-3);
  font-size:var(--fs-micro);line-height:16px;white-space:pre-wrap;overflow-wrap:anywhere}
.node-comment-edit{display:block;box-sizing:border-box;width:100%;margin:0;padding:8px 10px;border:0;border-top:1px solid var(--inset);
  border-radius:0 0 var(--radius-8) var(--radius-8);background:var(--inset);color:var(--text);font:inherit;
  font-size:var(--fs-micro);line-height:16px;
  resize:vertical}
/* Гнездо 14 на краю узла: ободок по light-convex, пустое — отверстие jack-hole, с проводом — штекер цвета кабеля */
.port{position:absolute;top:50%;box-sizing:border-box;width:14px;height:14px;margin-top:-7px;padding:3px;border-radius:50%;
  background:linear-gradient(var(--light-convex),var(--knob-rim),var(--knob-rim-lo) 50%,var(--key-black-lo));box-shadow:var(--shadow-raised-sm);
  cursor:crosshair;touch-action:none}
.port::after{content:'';display:block;width:8px;height:8px;border-radius:50%;background:var(--jack-hole);
  box-shadow:inset -0.5px 1px 1px var(--shadow)}
.port.wired::after{background:var(--wire-ctl);box-shadow:inset 0.5px -0.5px 0 var(--grille-lit)}
.port.wired.sound::after{background:var(--wire)}
.port.wired.selected::after{background:var(--accent)}
.port.target{outline:2px solid var(--accent-text);outline-offset:1px}
/* Область захвата гнезда — шире видимой */
.port::before{content:'';position:absolute;inset:-7px;border-radius:50%}
.port[data-dir=in]{left:-7px}
.port[data-dir=out]{right:-7px}
/* Пустой патч — карточка-плашка у Out: что сделать первым и две клавиши */
.nodes-empty{position:absolute;box-sizing:border-box;width:288px;padding:16px;border-radius:var(--radius-12);background:var(--surface);
  box-shadow:var(--shadow-plate),-2px 4px 10px var(--shadow),var(--shadow-raised-sm)}
.nodes-empty h2{margin:0 0 4px;font-size:var(--fs-body);line-height:16px;font-weight:500}
.nodes-empty p{margin:0 0 16px;color:var(--text-2);font-size:var(--fs-micro);line-height:16px}
.nodes-empty div{display:flex;gap:8px}
/* Подвал (карточка About): строка 32 без подложки — версия слева, About и Feedback справа */
.site-footer{box-sizing:border-box;display:flex;flex-wrap:wrap;align-items:center;gap:4px 24px;width:100%;max-width:1440px;min-height:32px;
  margin:0 auto;padding:0 32px 16px;color:var(--text-3);font-size:var(--fs-micro);line-height:14px;font-variant-numeric:tabular-nums}
@media(min-width:1232px){.site-footer{width:calc(5 * var(--grid-module));padding:0 0 16px}}
.site-footer nav{display:flex;gap:24px;margin-left:auto}
.site-footer a,.site-footer nav button{padding:0;border:0;background:none;color:var(--text-2);font:inherit;text-decoration:none;cursor:pointer}
@media(hover:hover){.site-footer a:hover,.site-footer nav button:hover{color:var(--text)}}
@media(max-width:899px),(orientation:landscape) and (max-height:500px){
  .topbar{gap:16px;margin-top:16px;padding:0 16px}
  .tool-button.square{width:44px;height:44px;border:0;border-radius:10px}
  /* Presets, View, «?» — значками 32 (касание 44) */
  .tool-label{display:none}
  :is(.topbar-tools,.presets-picker,.view-picker)>.tool-button{position:relative;width:var(--size-header);padding:0}
  :is(.topbar-tools,.presets-picker,.view-picker)>.tool-button::before{content:'';position:absolute;inset:-6px}
  /* Нижний лист: затемнение, радиус 16 сверху, до 82 % высоты, подписи над сегментами */
  /* Затемнение не прокручивает страницу под листом */
  .sheet-backdrop:not([hidden]){display:block;position:fixed;z-index:29;inset:0;background:var(--backdrop);touch-action:none}
  /* Выезд листа снизу и появление затемнения; смахивание вниз и плавное закрытие — view.js */
  @media(prefers-reduced-motion:no-preference){
    .view-popover:not([hidden]),.card-popover:not([hidden]){animation:sheet-in .24s cubic-bezier(.2,.8,.2,1)}
    .sheet-backdrop:not([hidden]){animation:sheet-fade .24s ease-out}
  }
  .view-popover,.card-popover{position:fixed;top:auto;left:0;right:0;bottom:0;gap:12px;width:auto;max-height:82vh;overflow-y:auto;
    padding:8px 16px calc(24px + env(safe-area-inset-bottom));border:0;border-top:1px solid var(--line-strong);border-radius:16px 16px 0 0;
    box-shadow:0 -16px 40px var(--shadow);overscroll-behavior:contain}
  .view-sep{margin:0 -16px}
  .sheet-handle{display:block;align-self:center;flex:none;width:36px;height:4px;border-radius:4px;background:var(--line-strong)}
  .sheet-head{display:flex;align-items:center;justify-content:space-between}
  .sheet-head h2{margin:0;font-size:var(--fs-title);font-weight:500}
  .sheet-head button{height:44px;padding:0 12px;border:0;border-radius:8px;background:transparent;color:var(--accent-text);
    font-size:var(--fs-body);font-weight:600;cursor:pointer}
  .view-row{display:flex;flex-direction:column;align-items:stretch;gap:6px;padding:0}
  .card-popover{gap:0;padding:8px 0 env(safe-area-inset-bottom);border-radius:var(--radius-20) var(--radius-20) 0 0}
  .card-arrow{display:none}
  .card-body{padding:24px;overflow:visible}
  .view-row>span,.view-row>label{font-size:var(--fs-micro)}
  .view-midi select{height:44px}
  main{padding:24px 16px 0}
  .block{gap:12px}
  /* Плашка — во всю ширину над клавиатурой; длинный перевод — в две строки, а не за край; касание 44 */
  .toast{left:16px;right:16px;gap:8px;height:auto;min-height:44px;transform:none}
  .toast-text{flex:1;min-width:0;white-space:normal}
  .toast .toast-undo{height:44px}
  .toast .toast-close{width:44px;height:44px}
  .segment button{height:44px}
  .keys-piano .piano{height:112px}
  .site-footer{padding:0 16px 24px}
}
@keyframes sheet-in{from{transform:translateY(100%)}}
@keyframes sheet-fade{from{opacity:0}}
/* Планшет 600 и телефон горизонтально — знак без слова; на телефоне (< 600) вкладки в панели клавиатуры — знак и Synthari */
@media(min-width:600px) and (max-width:899px),(orientation:landscape) and (max-height:500px){
  .brand-name{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
}
@media(max-width:599px){
  .topbar{gap:8px}
  .topbar-tools,.module-tools{gap:0}
  .guide-dialog{padding:12px}
  .guide-card{max-height:calc(100dvh - 24px);padding:24px 16px 16px}
}
/* Телефон горизонтально: клавиатура ниже, чтобы осталось место блокам */
@media(orientation:landscape) and (max-height:500px){
  .keys-piano .piano{height:84px}
}
/* Телефон горизонтально с открытым ящиком (две плашки, 144) — пианино ниже, иначе панель выше окна */
@media(orientation:landscape) and (max-height:500px){
  .keys-head.open~.keys-piano .piano{height:74px}
}
/* Узкий телефон горизонтально (< 720) с развёрнутой петлёй: пианино и сетка ниже */
@media(orientation:landscape) and (max-height:500px) and (max-width:719px){
  .keys-panel:has(.loop:not([hidden])) .keys-piano .piano{height:74px}
}
/* Планшет (доска Stage6Tablet) — шапка и подвал шириной стойки по центру (после правил < 900 — перекрывает их поля): 600 — 480, 900 — 720 */
@media(min-width:600px) and (max-width:1231px){:is(.topbar,.site-footer){width:calc(2 * var(--grid-module));padding-right:0;padding-left:0}}
@media(min-width:900px) and (max-width:1231px){:is(.topbar,.site-footer){width:calc(3 * var(--grid-module))}}
