:root {
  --bg: #08070c;
  --panel: #110f18;
  --panel2: #181521;
  --panel3: #1f1b2a;
  --line: #241f30;
  --line2: #322b42;
  --text: #efeaf8;
  --muted: #8b839e;
  --dim: #5d566e;
  --accent: #ff2e63;
  --accent2: #8c5cff;
  --inst: #ffb547;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1100px 520px at 78% -12%, rgba(140, 92, 255, 0.14), transparent 62%),
    radial-gradient(900px 480px at -5% 112%, rgba(255, 46, 99, 0.11), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 500 14px/1.35 'Manrope', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  overflow-x: hidden;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

button { font: inherit; color: inherit; }

.app {
  height: 100vh;
  min-height: 720px;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(150px, 1fr) auto;
  gap: 10px;
  padding: 10px 18px 6px;
  max-width: 1500px;
  margin: 0 auto;
}

/* ---------- шапка ---------- */

.top {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 46px;
}

.logo {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.14em;
  text-shadow: -1.5px 0 rgba(255, 46, 99, 0.75), 1.5px 0 rgba(80, 200, 255, 0.55);
  white-space: nowrap;
}

.logo b {
  margin-left: 0.35em;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.scope {
  flex: 1;
  height: 38px;
  max-width: 520px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line);
}

.top-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chip.midi-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: none;
}

.chip.midi-chip.active { --c: #3ee6a8; }

.chip.midi-chip.active .dot {
  background: #3ee6a8;
  box-shadow: 0 0 8px #3ee6a8;
}

/* ---------- общие элементы ---------- */

.label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.sub {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.unit {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.muted { color: var(--muted); }

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.008)), var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  min-height: 28px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  --c: var(--inst);
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--panel2);
  font-weight: 700;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, color 0.12s;
}

.chip:hover:not(:disabled) { border-color: #4a4060; background: var(--panel3); }

.chip.active {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 17%, var(--panel2));
  box-shadow: inset 0 0 0 1px var(--c), 0 0 16px color-mix(in srgb, var(--c) 30%, transparent);
}

.chip:disabled { opacity: 0.4; cursor: default; }

.chip.small { height: 28px; padding: 0 10px; font-size: 12px; }

.chip.big { height: 38px; padding: 0 15px; font-size: 14px; }

.chip.ghost { background: transparent; }

.chip svg { width: 14px; height: 14px; }

.chip .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
}

.chip b {
  font-weight: 800;
  color: var(--inst);
}

.mini-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--line2);
  background: var(--panel2);
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
  flex: none;
}

.mini-btn:hover { background: var(--panel3); }

.round {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line2);
  background: var(--panel2);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: background 0.12s, box-shadow 0.12s;
}

.round svg { width: 20px; height: 20px; }

.round:hover { background: var(--panel3); }

.round.play.on {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(255, 46, 99, 0.55);
}

.round.rec { color: #ff3b5c; }

.round.rec.on {
  background: #ff3b5c;
  border-color: #ff3b5c;
  color: #fff;
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255, 59, 92, 0.45); }
  50% { box-shadow: 0 0 22px rgba(255, 59, 92, 0.9); }
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--line2);
}

.seg button {
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.seg button.active {
  background: var(--panel3);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line2);
}

.seg .unit { padding: 0 6px 0 4px; }

.link {
  border: 0;
  background: none;
  color: var(--dim);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.link:hover { color: var(--text); }

select {
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line2);
  background: var(--panel2);
  color: var(--text);
  font: 700 12.5px 'Manrope', 'Segoe UI', sans-serif;
  padding: 0 6px;
  cursor: pointer;
  min-width: 0;
}

select:disabled { opacity: 0.45; }

.icon-btn {
  height: 26px;
  min-width: 26px;
  padding: 0 6px;
  border-radius: 7px;
  border: 1px solid var(--line2);
  background: var(--panel2);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.icon-btn svg { width: 14px; height: 14px; }

.icon-btn:hover:not(:disabled) { background: var(--panel3); color: var(--text); }

.icon-btn:disabled { opacity: 0.35; cursor: default; }

.icon-btn.undo { width: 32px; height: 30px; }

.icon-btn.undo svg { width: 17px; height: 17px; }

.icon-btn.active {
  color: #fff;
  background: color-mix(in srgb, var(--accent) 35%, var(--panel2));
  border-color: var(--accent);
}

/* ---------- звук и эффекты ---------- */

.sounds {
  display: flex;
  align-items: center;
  gap: 14px;
}

.fx { padding-bottom: 6px; }

.fx-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.fx-head #resetFx { margin-left: auto; }

.knobs {
  display: flex;
  gap: 2px;
  justify-content: space-between;
}

.knob {
  position: relative;
  width: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: ns-resize;
  touch-action: none;
  padding: 2px 0;
  border-radius: 10px;
}

.knob[hidden] { display: none; }

.knob:hover { background: rgba(255, 255, 255, 0.025); }

.knob svg { width: 48px; height: 48px; overflow: visible; }

.knob.small { width: 52px; }

.knob.small svg { width: 34px; height: 34px; }

.k-track {
  fill: none;
  stroke: #2a2437;
  stroke-width: 5;
  stroke-linecap: round;
}

.k-val {
  fill: none;
  stroke: var(--inst);
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--inst) 70%, transparent));
}

.k-cap {
  fill: #1d1928;
  stroke: #3a3349;
  stroke-width: 1.5;
}

.knob.drag .k-cap { stroke: var(--inst); }

.k-needle {
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
}

.k-num {
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-top: -1px;
}

.k-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.k-tag {
  position: absolute;
  top: 0;
  right: 6px;
  font-size: 9px;
  font-weight: 800;
  color: #3ee6a8;
  opacity: 0;
}

body.midi-live .k-tag:not(:empty) { opacity: 0.9; }

.knob.small .k-num { font-size: 11px; }

.knob.small .k-name { font-size: 10px; }

/* ---------- луп ---------- */

.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 10px;
  height: 322px;
}

.loop {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.loop.recording {
  border-color: rgba(255, 59, 92, 0.6);
  box-shadow: 0 0 0 1px rgba(255, 59, 92, 0.35), 0 0 30px rgba(255, 59, 92, 0.12);
}

.loop-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.loop-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  min-width: 104px;
  font-variant-numeric: tabular-nums;
}

.loop.recording .loop-status { color: #ff6b84; }

.bpm {
  display: flex;
  align-items: center;
  gap: 5px;
}

.bpm input {
  width: 54px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line2);
  background: var(--bg);
  color: var(--text);
  font: 800 15px 'Manrope', 'Segoe UI', sans-serif;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.bpm input::-webkit-outer-spin-button,
.bpm input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

#undoBtn { margin-left: auto; }

.lanes {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
}

.lanes-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 4px 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.lanes-empty > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lanes-empty b { color: var(--text); font-size: 13px; }

.lane {
  --c: var(--inst);
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.lane-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.lane-name {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 4px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lane-name:hover { background: var(--panel2); }

.lane-name .dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
}

.lane.muted .lane-name { color: var(--dim); }

.lane.muted .lane-name .dot { opacity: 0.35; box-shadow: none; }

.lane-btns { display: flex; gap: 3px; }

.lane-roll {
  width: 100%;
  height: 30px;
  border-radius: 8px;
  background: #0b0a10;
  border: 1px solid var(--line);
  display: block;
}

.lane.drums .lane-roll {
  height: 58px;
  cursor: pointer;
}

.loop-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gen-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gen-btn svg { width: 15px; height: 15px; }

body.coaching .gen-group { display: none; }

/* ---------- шаги ---------- */

.coach-chip {
  --c: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line2));
}

body.coaching .coach-chip {
  background: color-mix(in srgb, var(--accent) 22%, var(--panel2));
  box-shadow: inset 0 0 0 1px var(--accent);
}

body.coaching .fx-body { display: none; }

.coach[hidden] { display: none; }

.coach {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: stretch;
  padding: 2px 2px 4px;
}

.coach-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.coach-dots { display: flex; gap: 5px; }

.coach-dots i {
  width: 22px;
  height: 5px;
  border-radius: 3px;
  background: #2a2437;
}

.coach-dots i.done { background: color-mix(in srgb, var(--accent2) 70%, #2a2437); }

.coach-dots i.cur {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(255, 46, 99, 0.6);
}

.coach-count {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.coach-title {
  font-size: 18px;
  font-weight: 800;
  margin: 2px 0 2px;
}

.coach-text {
  font-size: 13px;
  color: #cfc8de;
  line-height: 1.45;
  max-width: 820px;
}

.coach-task {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 800;
}

.coach-mark {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  transform: translateY(2px);
}

.coach-task.done .coach-mark {
  background: #3ee6a8;
  border-color: #3ee6a8;
  box-shadow: 0 0 10px rgba(62, 230, 168, 0.6);
}

.coach-progress {
  font-weight: 700;
  color: var(--muted);
}

.coach-task.done .coach-progress { color: #3ee6a8; }

.coach-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-width: 300px;
}

.coach-extra {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 420px;
}

.coach-btns { display: flex; gap: 6px; }

.coach-next.active {
  --c: #3ee6a8;
  border-color: #3ee6a8;
  background: color-mix(in srgb, #3ee6a8 22%, var(--panel2));
  box-shadow: inset 0 0 0 1px #3ee6a8, 0 0 18px rgba(62, 230, 168, 0.35);
}

.coach-close { font-size: 11.5px; }

.coach-cta {
  --c: var(--accent);
  flex: none;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, var(--panel2));
}

.foot-right {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

/* ---------- пэды и тональность ---------- */

.side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.pads .panel-head .seg { margin-left: auto; }

.pad-bank {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.pad-bank[hidden] { display: none; }

.pad {
  position: relative;
  height: 46px;
  border-radius: 9px;
  border: 1px solid var(--line2);
  background: linear-gradient(180deg, #221d2e, #17141f);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 4px;
  cursor: pointer;
  touch-action: none;
  transition: background 0.06s, box-shadow 0.06s;
}

.pad-name {
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.1;
}

.pad-num {
  position: absolute;
  top: 3px;
  left: 6px;
  font-size: 9px;
  font-weight: 800;
  color: var(--dim);
}

.pad.fx .pad-name { color: #c9b8ff; }

.pad.on {
  background: linear-gradient(180deg, #ff7a45, #ff2e63);
  box-shadow: 0 0 18px rgba(255, 90, 80, 0.55);
}

.pad.fx.on {
  background: linear-gradient(180deg, #a07bff, #6b3dff);
  box-shadow: 0 0 18px rgba(140, 92, 255, 0.6);
}

.pad.on .pad-name, .pad.on .pad-num { color: #fff; }

.tone { flex: 1; min-height: 0; overflow: hidden; }

.tone .panel-head select:first-of-type { margin-left: auto; width: 62px; }

.tone .panel-head select:last-of-type { width: 150px; }

.tone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.placeholder {
  font-size: 12px;
  color: var(--dim);
  line-height: 24px;
}

.now {
  display: flex;
  align-items: baseline;
  gap: 8px;
  height: 30px;
  padding: 5px 8px 0;
  margin-bottom: 6px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}

.now > * { flex: none; }

.now .now-hist, .now .now-sub {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.now-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--inst);
}

.now-sub, .now-hist { color: var(--muted); font-weight: 600; }

.now-key {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
}

.now-key.ok { color: #3ee6a8; }

.now-key.off { color: #ff6b84; }

.now-guess { margin-left: auto; font-size: 11.5px; color: var(--accent2); }

.chord-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chord-chip {
  height: 24px;
  min-width: 30px;
  padding: 0 5px;
  border-radius: 7px;
  border: 1px solid var(--line2);
  background: var(--panel2);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}

.chord-chip:hover { background: var(--panel3); }

.chord-chip.home {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.chord-chip.odd { color: var(--dim); }

/* ---------- клавиатура ---------- */

.kb {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.kb-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.oct {
  display: flex;
  align-items: center;
  gap: 6px;
}

.oct b {
  min-width: 34px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}

.kb-hint {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.piano {
  position: relative;
  flex: 1;
  min-height: 130px;
  touch-action: none;
  border-radius: 6px 6px 12px 12px;
  border-top: 3px solid color-mix(in srgb, var(--inst) 70%, #000);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}

.pkey {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.pkey.white {
  height: 100%;
  padding-bottom: 10px;
  background: linear-gradient(180deg, #d9d4e3 0%, #f6f4fa 14%, #f3f0f8 82%, #dcd6e7 100%);
  border: 1px solid #0b0a10;
  border-top: 0;
  border-radius: 0 0 9px 9px;
  box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.07);
  z-index: 1;
}

.pkey.black {
  height: 61%;
  padding-bottom: 8px;
  background: linear-gradient(180deg, #121017 0%, #2b2734 80%, #1a1720 100%);
  border: 1px solid #000;
  border-top: 0;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5), inset 0 -5px 0 rgba(255, 255, 255, 0.05);
  z-index: 2;
}

.pkey.white.on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--inst) 45%, #fff), var(--inst));
  box-shadow: 0 0 26px color-mix(in srgb, var(--inst) 65%, transparent), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.pkey.black.on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--inst) 55%, #000), var(--inst));
  box-shadow: 0 0 20px var(--inst);
}

.pkey.ghost::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 0 0 7px 7px;
  box-shadow: inset 0 0 0 2px var(--accent2), 0 0 14px rgba(140, 92, 255, 0.5);
  pointer-events: none;
}

.k-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.pkey.in .k-dot {
  background: var(--accent2);
  box-shadow: 0 0 6px var(--accent2);
}

.pkey.root .k-dot {
  width: 11px;
  height: 11px;
  background: var(--accent);
  box-shadow: 0 0 9px var(--accent);
}

.pkey.chordtone .k-dot {
  width: 12px;
  height: 12px;
  background: #ffd27a;
  box-shadow: 0 0 10px #ffd27a, 0 0 0 2px rgba(255, 210, 122, 0.35);
}

.pkey.white.chordtone { box-shadow: inset 0 -7px 0 rgba(255, 196, 80, 0.35); }

.k-letter {
  font-size: 11px;
  font-weight: 800;
  color: #7d778b;
  min-width: 20px;
  text-align: center;
  padding: 3px 4px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.55);
  line-height: 1;
}

.k-note {
  font-size: 12px;
  font-weight: 800;
  color: #4b4559;
  line-height: 1;
}

.pkey.black .k-letter {
  color: #a9a2b9;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  min-width: 0;
  padding: 3px;
}

.pkey.black .k-note {
  font-size: 9px;
  color: #7f7891;
}

.pkey.on .k-note, .pkey.on .k-letter { color: #16121d; }

.pkey.black.on .k-note, .pkey.black.on .k-letter { color: #fff; }

.pkey.white.out {
  background: linear-gradient(180deg, #8f899c 0%, #a49eb1 80%, #8d8799 100%);
}

.pkey.black.out { background: #0c0a10; }

.pkey.out .k-note, .pkey.out .k-letter { opacity: 0.4; }

/* ---------- подсказки ---------- */

.hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  font-size: 11.5px;
  color: var(--dim);
  font-weight: 600;
  padding: 2px 0;
}

kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  margin: 0 1px;
  border-radius: 5px;
  border: 1px solid var(--line2);
  border-bottom-width: 2px;
  background: var(--panel2);
  color: var(--text);
  font: 800 10.5px/1.4 'Manrope', 'Segoe UI', sans-serif;
  text-align: center;
}

/* ---------- идеи ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(3, 2, 6, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  z-index: 19;
}

.scrim.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 94vw;
  background: #0f0d15;
  border-left: 1px solid var(--line);
  transform: translateX(102%);
  transition: transform 0.22s ease;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.drawer.open {
  transform: none;
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.55);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.drawer-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.idea-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.idea {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.idea .mini {
  width: 92px;
  height: 44px;
  border-radius: 7px;
  background: #0b0a10;
  border: 1px solid var(--line);
}

.idea-body { min-width: 0; }

.idea-name {
  font-weight: 800;
  font-size: 13px;
  outline: none;
  border-radius: 5px;
  padding: 1px 3px;
  margin-left: -3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
  user-select: text;
}

.idea-name:focus { background: var(--panel3); text-overflow: clip; }

.idea-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.idea-btns { display: flex; gap: 4px; }

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 18px 4px;
}

/* ---------- MIDI ---------- */

.pop {
  position: fixed;
  top: 58px;
  right: 18px;
  width: 360px;
  max-width: 92vw;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line2);
  background: rgba(17, 14, 25, 0.98);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  z-index: 25;
  display: none;
  font-size: 12.5px;
}

.pop.open { display: block; }

.pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.pop-dev { font-weight: 800; margin-bottom: 8px; }

.pop-map {
  margin: 0 0 10px;
  padding-left: 16px;
  color: var(--muted);
  line-height: 1.45;
}

.pop-log {
  margin-top: 6px;
  max-height: 200px;
  overflow-y: auto;
  font: 600 11.5px/1.5 Consolas, 'Cascadia Mono', monospace;
  color: #cfc7e0;
  user-select: text;
}

/* ---------- вход в «12 нот» ---------- */

.login {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(5, 4, 8, 0.82);
  backdrop-filter: blur(6px);
}

.login-card {
  width: min(380px, 92vw);
  padding: 26px 24px;
  border-radius: 18px;
  border: 1px solid var(--line2);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.login-sub {
  font-size: 13px;
  color: var(--muted);
}

.login-card input {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line2);
  background: var(--bg);
  color: var(--text);
  font: 700 15px 'Manrope', 'Segoe UI', sans-serif;
  padding: 0 12px;
  user-select: text;
}

.login-err {
  min-height: 16px;
  font-size: 12.5px;
  font-weight: 700;
  color: #ff6b84;
}

.login-card .chip { justify-content: center; }

/* ---------- тост ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(700px, 92vw);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line2);
  background: rgba(22, 19, 31, 0.97);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

/* ---------- узкие и низкие окна ---------- */

@media (max-width: 1180px) {
  .knob { width: 62px; }
  .knob svg { width: 42px; height: 42px; }
  .chip.big { height: 34px; padding: 0 12px; font-size: 13px; }
  .lane { grid-template-columns: 158px minmax(0, 1fr); }
  .lane .icon-btn { height: 22px; min-width: 22px; padding: 0 4px; }
  .lane-name { font-size: 12px; gap: 5px; }
  .main { grid-template-columns: minmax(0, 1fr) 270px; }
  .loop-bar { gap: 8px; }
  .seg .unit { display: none; }
  .loop-status { min-width: 92px; }
}

@media (max-height: 800px) {
  .app { gap: 8px; padding-top: 6px; }
  .knob svg { width: 40px; height: 40px; }
  .main { height: 312px; }
  .pad { height: 42px; }
}
