/* Syntezator: stalowe urządzenie przykręcone do betonu. Moduły z tabliczkami, metalowe gałki ze skalą,
   przełączniki z diodą. Bez poświat i rozmyć: wszystko, co się rusza, rusza się transformacją albo kryciem. */
.synth, .dock, .pop, .steel {
  --card: #222325; --card-2: #2f3134; --field: #0e0f10; --ink: #f1f0ea; --ink-2: #d0cfc9; --muted: #9c9b95; --faint: #6f6e69;
  --rule: rgba(255, 255, 255, .14); --accent: #ff5a1f; --accent-deep: #ff8a52; --orange: #ff5a1f; --green: #5fd068; --red: #e23b2b; --plate: #f4c84a; --focus: #f4c84a;
  color: var(--ink);
}

/* ---------- nagłówek strony syntezatora ---------- */
.synth-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 22px 48px; align-items: start; padding: 26px 0 36px; }
.synth-hero > div:first-child { display: contents; }
.synth-hero .mega { grid-column: 1 / -1; grid-row: 1; }
.synth-hero .kicker { grid-column: 1; grid-row: 2; }
.synth-hero .lead { grid-column: 1; grid-row: 3; }
.hero-actions { grid-column: 2; grid-row: 2 / 4; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.audio-on #power { background: var(--accent); color: #0b0b0a; border-color: var(--ink); }
.audio-on #power::before { background: #0b0b0a; box-shadow: none; }
/* tytuł reaguje na głośność: skrypt ściska go w poziomie samą transformacją (własna warstwa, zero układu) */
.mega.live { transform-origin: 0 50%; will-change: transform; }
@media (max-width: 900px) { .synth-hero { grid-template-columns: minmax(0, 1fr); } .hero-actions { grid-column: 1; grid-row: auto; } }

/* ---------- moduły ---------- */
.synth { position: relative; display: flex; flex-direction: column; gap: 14px; }
.card {
  position: relative; min-width: 0; padding: 18px 20px 20px; border: 2px solid #000; color: var(--ink);
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .014) 0 1px, transparent 1px 3px), var(--card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09);
}
.card::before, .card::after {
  content: ""; position: absolute; top: 8px; width: 8px; height: 8px; border-radius: 50%; pointer-events: none;
  background: linear-gradient(45deg, transparent 42%, #111 43% 57%, transparent 58%), #8b8d90;
}
.card::before { left: 8px; } .card::after { right: 8px; }
.card-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 14px; padding-left: 10px; }
.card-h h2 { margin: 0; padding: 7px 11px 6px; background: #000; color: var(--plate); font: 800 12px/1 var(--sans); font-stretch: 112%; letter-spacing: .14em; text-transform: uppercase; }
.sub { font-size: 12.5px; color: var(--muted); }
.synth .lbl { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: 11px; font-weight: 700; }
.synth kbd { border-color: var(--muted); background: #000; color: var(--ink); }
/* moduły poza ekranem nie są układane ani malowane, dopóki się do nich nie przewinie */
.grid > .card, .loop-card, .song-card { content-visibility: auto; contain-intrinsic-size: auto 340px; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.preset-now { display: flex; flex-direction: column; gap: 4px; min-width: 190px; padding-left: 10px; }
.preset-now b { font: 800 22px/1.1 var(--sans); font-stretch: 112%; color: #fff; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 360px; }
.bar-actions, .proj-actions, .ab-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; flex: 1 1 100%; }
.proj-actions, .ab-row { padding-top: 12px; border-top: 1px solid var(--rule); }
.proj-note { font-size: 12px; color: var(--muted); }

/* przyciski urządzenia */
.btn-s, .chip-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid #000; border-radius: 2px;
  background: #34363a; color: #e9e8e2; font: 600 14px var(--sans); cursor: pointer; text-decoration: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
.chip-btn { min-height: 36px; font-weight: 500; background: #2c2e31; }
.btn-s:hover, .chip-btn:hover { background: #45484d; color: #fff; }
.btn-s:active, .chip-btn:active { transform: translateY(1px); box-shadow: none; }
.btn-s.accent, .chip-btn.on, .pads-btn.on { background: var(--orange); color: #0b0b0a; font-weight: 700; }
.btn-s.accent:hover, .chip-btn.on:hover { background: #ff7a45; color: #0b0b0a; }
.btn-s.ghost { background: #292a2d; color: var(--ink-2); }
.btn-s.ok { background: var(--green); color: #0b0b0a; }
.btn-s.on { background: var(--orange); color: #0b0b0a; }
.btn-s.rec::before, .drum-rec::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.btn-s.rec.on, .drum-rec.on { background: var(--red); color: #fff; animation: recblink 1s steps(2) infinite; }
.btn-s.rec.on::before, .drum-rec.on::before { background: #fff; }
@keyframes recblink { 50% { opacity: .72; } }
.btn-s.coffee { color: #ffc08f; }
.btn-s.coffee.nudge { animation: recblink .8s steps(2) 4; }
.btn-s:disabled { opacity: .4; cursor: not-allowed; }
.btn-s:focus-visible, .chip-btn:focus-visible, .seg button:focus-visible, .scene:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.demo-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.demo-toggle input { accent-color: var(--orange); width: 16px; height: 16px; }
.chip-btn.user { padding-right: 4px; }
.chip-btn .x { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-left: 2px; font-style: normal; color: var(--muted); }
.chip-btn .x:hover { background: #000; color: #fff; }

/* suwak (morph A/B, macierz modulacji, okienka kroków) */
.synth input[type="range"], .pop input[type="range"] { -webkit-appearance: none; appearance: none; height: 28px; background: none; cursor: pointer; min-width: 0; }
.synth input[type="range"]::-webkit-slider-runnable-track, .pop input[type="range"]::-webkit-slider-runnable-track { height: 6px; background: #000; box-shadow: 0 1px 0 rgba(255, 255, 255, .12); }
.synth input[type="range"]::-moz-range-track, .pop input[type="range"]::-moz-range-track { height: 6px; background: #000; }
.synth input[type="range"]::-webkit-slider-thumb, .pop input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 26px; margin-top: -10px; background: var(--orange); border: 1px solid #000; }
.synth input[type="range"]::-moz-range-thumb, .pop input[type="range"]::-moz-range-thumb { width: 14px; height: 26px; background: var(--orange); border: 1px solid #000; border-radius: 0; }
.ab-row .ab-fader { flex: 1 1 220px; max-width: 420px; }
.ab-row output { font: 500 12px var(--mono); color: var(--plate); min-width: 4.5em; }
.ab-btn.has { box-shadow: inset 0 -3px 0 var(--orange), inset 0 1px 0 rgba(255, 255, 255, .12); }

.grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.scope-card { grid-column: span 4; }
.xy-card { grid-column: span 2; }
.grid > .c2 { grid-column: span 2; } .grid > .c3 { grid-column: span 3; } .grid > .c6 { grid-column: span 6; }
.song-card, .play-card, .drum-card { grid-column: span 6; }
.out-body { display: flex; align-items: center; gap: 10px 28px; flex-wrap: wrap; }
.out-body .vu { flex: 0 0 230px; margin: 0; }
.out-body .knobs { flex: 1 1 360px; }
#scope { display: block; width: 100%; height: 220px; background: var(--field); border: 1px solid #000; }
.scope-card .card-h .seg { margin-left: auto; }
.scope-card:fullscreen { display: flex; flex-direction: column; padding: 18px; } .scope-card:fullscreen #scope { flex: 1 1 auto; height: auto; }
.xy { position: relative; aspect-ratio: 1.2; background: var(--field); border: 1px solid #000; touch-action: none; cursor: crosshair; overflow: hidden; }
.xy canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.env { display: block; width: 100%; height: 70px; margin-bottom: 8px; }

/* ---------- gałki ---------- */
.knobs { display: flex; flex-wrap: wrap; gap: 14px 6px; }
.knob { width: 88px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; user-select: none; }
.kn-dial { position: relative; width: 70px; height: 70px; margin: 8px 0 2px; border-radius: 50%; cursor: ns-resize; touch-action: none; }
.kn-dial:focus-visible { outline: 3px solid var(--focus); outline-offset: 6px; }
/* podziałka: jeden wspólny obrazek rysowany w synth.js (--kn-scale), obszar 120 jednostek; 100 jednostek = 80 px (na wąskim 69 px), żeby cyfry sąsiednich gałek się nie stykały */
.kn-dial::before { content: ""; position: absolute; inset: -13px; background: var(--kn-scale, none) center / 100% 100% no-repeat; pointer-events: none; }
.kn-skirt, .kn-ptr { position: absolute; inset: 9px; border-radius: 50%; }
.kn-skirt {
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .18), transparent 60%), repeating-conic-gradient(#1b1c1e 0deg 5deg, #3a3c40 5deg 10deg);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .2), inset 0 -2px 3px rgba(0, 0, 0, .5);
}
.kn-cap {
  position: absolute; inset: 17px; border-radius: 50%;
  background: conic-gradient(from 200deg, #eceef0, #9a9da2 16%, #f6f7f8 30%, #8a8d92 47%, #d9dbde 62%, #84878c 79%, #eceef0);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .4), inset 0 2px 3px rgba(255, 255, 255, .5);
}
.cap-green .kn-cap { background: radial-gradient(circle at 40% 32%, #b6f1d6, #3fa47d 45%, #1d5e47 85%); }
.cap-blue .kn-cap { background: radial-gradient(circle at 40% 32%, #c3dcff, #3d79c9 45%, #1d3f70 85%); }
.cap-amber .kn-cap { background: radial-gradient(circle at 40% 32%, #ffe3a8, #d9952b 45%, #7d4c0f 85%); }
.cap-red .kn-cap { background: radial-gradient(circle at 40% 32%, #ffb9ad, #d13a2c 45%, #6f1610 85%); }
.cap-white .kn-cap { background: conic-gradient(from 200deg, #ffffff, #d4d6d9 16%, #ffffff 30%, #c8cbcf 47%, #f2f3f4 62%, #c4c7cb 79%, #ffffff); }
.kn-ptr { pointer-events: none; }
.kn-ptr::after { content: ""; position: absolute; left: 50%; top: 1px; width: 3px; height: 17px; margin-left: -1.5px; background: #f5f5f5; box-shadow: 0 0 0 1px rgba(0, 0, 0, .45); }
.cap-white .kn-ptr::after { background: #15161a; box-shadow: none; }
.knob.modded .kn-skirt { box-shadow: 0 5px 0 rgba(0, 0, 0, .5), 0 0 0 2px var(--plate), inset 0 1px 0 rgba(255, 255, 255, .2); }
.kn-label { margin-top: 2px; color: #e6e5df; font: 700 10.5px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.kn-out { min-width: 46px; padding: 2px 6px; border: 0; background: #000; color: var(--plate); font: 500 10.5px/1.3 var(--mono); cursor: text; }
.kn-out:hover { outline: 1px solid var(--plate); }
.kn-edit { width: 76px; min-height: 0 !important; padding: 1px 4px !important; border: 1px solid var(--plate) !important; background: #000 !important; color: var(--plate) !important; font: 500 11px/1.3 var(--mono) !important; text-align: center; }
.midi-learn .knob .kn-dial { outline: 2px dashed var(--plate); outline-offset: 4px; cursor: pointer; }
.midi-learn .knob.learn .kn-dial { outline: 3px solid var(--orange); }
@media (min-width: 1001px) { .grid > .c2 .knobs { gap: 12px 2px; } .grid > .c2 .knob { width: 82px; } }

/* ---------- przełączniki z diodą ---------- */
.play-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: #000; border: 1px solid #000; }
.seg button { position: relative; min-height: 32px; padding: 0 12px 0 24px; border: 0; border-radius: 1px; background: #3a3c40; color: #d9d8d2; font: 600 12px var(--sans); cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .13); }
.seg button::before { content: ""; position: absolute; left: 9px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #3b1612; }
.seg button:hover { color: #fff; background: #484b50; }
.seg button.on { background: #50545a; color: #fff; }
.seg button.on::before { background: #ff4b3a; box-shadow: 0 0 0 2px rgba(255, 75, 58, .3); }
.seg button:active { transform: translateY(1px); }
.step-mode button, .pop-seg button { min-height: 30px; padding-right: 10px; }

/* ---------- perkusja ---------- */
.drum-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 16px; }
.drum-top .presets { flex: 1 1 300px; }
.drum-play { min-width: 92px; }
.drum-play.on { background: #000; color: var(--orange); box-shadow: inset 0 0 0 2px var(--orange); }
.drum-play.on::before { content: ""; width: 10px; height: 10px; background: var(--orange); }
.drum-body { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 26px; }
.steps-wrap { flex: 1 1 560px; min-width: 0; overflow-x: auto; padding: 2px 2px 6px; }
.steps { display: grid; grid-template-columns: 76px repeat(16, minmax(24px, 1fr)); gap: 4px; min-width: 520px; }
.st-lab { grid-row: calc(var(--r) + 1); grid-column: 1; display: flex; align-items: center; gap: 2px; min-width: 0; color: var(--ink-2); }
.st-name { flex: 1 1 auto; min-width: 0; border: 0; background: none; padding: 0 4px 0 0; text-align: left; font: 700 12px var(--sans); color: inherit; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-name:hover { color: var(--orange); }
.st-more { flex: 0 0 auto; width: 24px; height: 26px; border: 1px solid #000; background: #2c2e31; color: var(--muted); font: 700 13px var(--sans); line-height: 1; cursor: pointer; padding: 0; }
.st-more:hover { color: #fff; }
.st-lab.h2 { display: none; }
.st-lab.hit { color: var(--orange); }
.st-lab.vol-mod .st-more { font: 600 10px var(--mono); color: var(--orange); }
.st-lab.vol-off .st-name { opacity: .45; text-decoration: line-through; }
.bass-lab { color: #fff; }
.st { position: relative; grid-row: calc(var(--r) + 1); grid-column: calc(var(--s) + 2); height: 32px; border: 0; border-radius: 1px; background: #303236; cursor: pointer; padding: 0; contain: layout paint style; }
.st.beat { background: #3f4146; }
.st:hover { box-shadow: inset 0 0 0 2px rgba(255, 90, 31, .7); }
.st.on { background: var(--orange); opacity: var(--vel, 1); }
.st.ph { box-shadow: inset 0 0 0 2px #fff; }
.st:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; z-index: 1; }
.st.bass { font: 600 10px var(--mono); color: #0b0b0a; touch-action: none; }
.st.bass.on { background: #efeee9; }
.st.bass.on.off-scale { background: #8a8984; }
.st.beyond { opacity: .2; background: repeating-linear-gradient(135deg, #2a2a2e 0 4px, #1d1d20 4px 8px); }
.st.beyond.on { opacity: .3; }
.st.chance.on { background: repeating-linear-gradient(135deg, var(--orange) 0 5px, #c9400f 5px 8px); }
.st.bass.chance.on { background: repeating-linear-gradient(135deg, #efeee9 0 5px, #b9b8b2 5px 8px); }
.st[data-badge]:not([data-badge=""])::after { content: attr(data-badge); position: absolute; right: 1px; top: 1px; font: 700 8px var(--mono); color: #fff; background: #000; padding: 0 2px; line-height: 10px; pointer-events: none; }
.st.px:not(.chance)::before { content: ""; position: absolute; left: 3px; top: 3px; width: 4px; height: 4px; background: #000; pointer-events: none; }
.st.editing { box-shadow: inset 0 0 0 3px #fff; }
.steps.edit-mode .st { cursor: context-menu; }
.drum-knob-col { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.drum-knobs { flex: 0 0 auto; }

/* okienko ustawień kroku i rzędu */
.pop { position: absolute; z-index: 60; width: 300px; max-width: calc(100vw - 16px); padding: 14px 16px; background: #1a1b1d; border: 2px solid #000; box-shadow: 6px 6px 0 rgba(0, 0, 0, .55); display: flex; flex-direction: column; gap: 10px; }
.pop-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pop-h b { font: 800 15px var(--sans); color: #fff; }
.pop-x { width: 30px; height: 30px; border: 1px solid #000; background: #34363a; color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.pop-row { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.pop-row .seg, .pop-row select { grid-column: 2 / 4; }
.pop-row input[type=range] { width: 100%; }
.pop-row output { font: 500 12px var(--mono); color: var(--plate); min-width: 74px; text-align: right; }
.pop-sep { margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--plate); }
.pop-f { display: flex; flex-wrap: wrap; gap: 8px; }
.pop-f .btn-s { min-height: 34px; padding: 0 12px; font-size: 13px; }
.eu-prev { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; }
.eu-prev i { height: 12px; background: #303236; } .eu-prev i.on { background: var(--orange); }
.synth select, .pop select, .dock select, .synth input[type="number"] { min-height: 36px; padding: 0 8px; border: 1px solid #000; border-radius: 0; background: #2c2e31; color: #fff; font: 500 14px var(--sans); min-width: 0; }
body.simple .adv { display: none !important; }

/* ---------- MIDI ---------- */
.midi { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-left: auto; }
.midi-status { font-size: 13px; color: var(--muted); max-width: 34em; }
.midi-status.ok { color: var(--green); }

/* ---------- pętla ---------- */
.loop-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; }
.loop-ctl { display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; }
.loop-main { display: inline-flex; align-items: center; gap: 12px; min-height: 64px; min-width: 210px; padding: 0 22px; border: 2px solid #000; background: #c62f20; color: #fff; font: 800 17px var(--sans); cursor: pointer; }
.loop-main:active { transform: translateY(2px); }
.loop-main:focus-visible, .loop-play:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.loop-dot { width: 16px; height: 16px; border-radius: 50%; background: #fff; flex: 0 0 auto; }
.loop-main[data-state="armed"], .loop-main[data-state="wait"] { background: #7c2a20; }
.loop-main[data-state="armed"] .loop-dot, .loop-main[data-state="wait"] .loop-dot { animation: blink .5s steps(2) infinite; }
.loop-main[data-state="rec"], .loop-main[data-state="dub"] { animation: recblink 1s steps(2) infinite; }
.loop-main[data-state="rec"] .loop-dot, .loop-main[data-state="closing"] .loop-dot { border-radius: 0; }
.loop-main[data-state="closing"], .loop-main[data-state="dub"] { background: #a32419; }
.loop-main[data-state="play"] { background: var(--orange); color: #0b0b0a; }
.loop-main[data-state="play"] .loop-dot { background: var(--red); box-shadow: 0 0 0 3px #0b0b0a; }
.loop-main[data-state="stopped"] { background: var(--green); color: #0b0b0a; }
.loop-main[data-state="stopped"] .loop-dot { width: 0; height: 0; border-radius: 0; background: none; border-left: 14px solid #0b0b0a; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
@keyframes blink { 50% { opacity: .2; } }
.loop-play { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 20px; border: 1px solid #000; background: #34363a; color: #fff; font: 700 16px var(--sans); cursor: pointer; }
.loop-play .play-ic { width: 0; height: 0; border-left: 13px solid var(--green); border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.loop-play.on { background: var(--green); color: #0b0b0a; }
.loop-play.on .play-ic { width: 12px; height: 12px; border: 0; background: #0b0b0a; }
.loop-play:disabled { opacity: .4; cursor: not-allowed; }
.loop-view { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
#loopCanvas { display: block; width: 100%; height: 64px; background: var(--field); border: 1px solid #000; }
.loop-info { margin: 0; font-size: 13px; color: var(--muted); }
.loop-side { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.loop-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.tracks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.trk { display: flex; align-items: stretch; gap: 3px; padding: 3px; background: #000; border: 1px solid #000; min-width: 0; }
.trk.sel { box-shadow: 0 0 0 2px var(--orange); }
.trk-sel { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 10px; border: 0; background: #2c2e31; color: var(--ink-2); cursor: pointer; text-align: left; }
.trk-sel b { font: 700 14px var(--sans); color: #fff; }
.trk-st { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.trk.has .trk-st { color: var(--orange); }
.trk.rec .trk-sel { background: #5a1d16; }
.trk.armed .trk-sel { animation: blink .5s steps(2) infinite; }
.trk.muted { opacity: .5; }
.trk-m, .trk-s { width: 30px; border: 0; background: #34363a; color: var(--muted); font: 700 12px var(--mono); cursor: pointer; }
.trk-m.on { background: var(--red); color: #fff; }
.trk-s.on { background: var(--plate); color: #0b0b0a; }
.wav-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); }

/* ---------- sceny, skala, utwór ---------- */
.scenes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.scene { width: 40px; height: 38px; border: 1px dashed var(--faint); background: transparent; color: var(--muted); font: 700 15px var(--mono); cursor: pointer; }
.scene.has { border: 1px solid #000; background: #34363a; color: #fff; }
.scene.cur { background: var(--orange); color: #0b0b0a; }
.scene.queued { animation: blink .4s steps(2) infinite; }
#sceneSave.on { background: var(--orange); color: #0b0b0a; }
.scale-pick { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; color: var(--ink-2); }
.scale-pick select { margin-left: 6px; }
.song-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.song-empty { margin: 0; font-size: 14px; color: var(--muted); }
.song-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 6px 10px; background: #1a1b1d; border: 1px solid #000; }
.song-row.cur { box-shadow: inset 4px 0 0 var(--green); }
.sr-n { font: 700 14px var(--mono); color: var(--plate); min-width: 18px; }
.song-row input { width: 64px; }
.sr-b { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.sr-btns { display: inline-flex; gap: 4px; margin-left: auto; }
.sr-btns button { width: 32px; height: 32px; border: 1px solid #000; background: #34363a; color: var(--ink-2); cursor: pointer; }
.sr-btns button:hover { color: #fff; background: #45484d; }
.song-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.song-actions .demo-toggle { margin-left: 0; }
.song-pos { font: 500 13px var(--mono); color: var(--muted); margin-left: auto; }
#songPlay.on { background: var(--green); color: #0b0b0a; }

/* ---------- klawiatura ---------- */
.kb-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-bottom: 14px; padding-left: 10px; }
.oct { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }
.oct b { font-family: var(--mono); color: #fff; }
.oct .btn-s { min-width: 38px; padding: 0; }
.keys { position: relative; height: 190px; touch-action: none; user-select: none; background: #000; }
.key { position: absolute; top: 0; border: 0; padding: 0; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; font: 500 11px var(--mono); }
.key.white { height: 100%; background: #efeee9; border: 1px solid #000; border-radius: 0 0 2px 2px; color: #6f6e69; padding-bottom: 10px; z-index: 1; box-shadow: inset 0 -8px 0 #d3d2cc; }
.key.black { height: 60%; background: #0b0b0a; border-radius: 0 0 2px 2px; color: #8a8984; padding-bottom: 8px; z-index: 2; box-shadow: inset 0 -5px 0 #2a2b2d; }
.key.white.on, .key.white.arp { background: var(--orange); color: #0b0b0a; box-shadow: inset 0 -3px 0 #c9400f; }
.key.black.on, .key.black.arp { background: #c9400f; color: #fff; box-shadow: none; }
.key.white.out { background: #a3a29c; box-shadow: inset 0 -8px 0 #8f8e88; color: #5b5a55; }
.key.black.out { background: #2a2b2d; color: #55544f; }
.key.root::after { content: ""; position: absolute; left: 50%; bottom: 30px; width: 8px; height: 8px; margin-left: -4px; background: var(--orange); }
.key.root.on::after { background: #0b0b0a; }
.key.black.root::after { bottom: 22px; }
.key span { pointer-events: none; }

/* ---------- wskaźnik VU ---------- */
.vu { position: relative; width: 100%; max-width: 230px; aspect-ratio: 2 / 1.05; margin: 2px 0 14px; padding: 6px; background: #000; }
.vu canvas { display: block; width: 100%; height: 100%; }
.vu-led { position: absolute; right: 14px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: #4a1510; }
.vu-led.on { background: #ff3b2f; box-shadow: 0 0 0 3px rgba(255, 59, 47, .35); }

/* ---------- macierz modulacji ---------- */
.mx { display: flex; flex-direction: column; gap: 6px; }
.mx-row { display: grid; grid-template-columns: 22px minmax(0, 1.1fr) 16px minmax(0, 1.3fr) minmax(90px, 1.4fr) 56px 32px; align-items: center; gap: 8px; padding: 4px 8px; background: #1a1b1d; border: 1px solid #000; }
.mx-row.live { box-shadow: inset 4px 0 0 var(--plate); }
.mx-n { font: 700 13px var(--mono); color: var(--plate); }
.mx-to { color: var(--muted); text-align: center; }
.mx-row output { font: 500 12px var(--mono); color: var(--plate); text-align: right; }
.mx-row .mx-clr { width: 32px; height: 32px; border: 1px solid #000; background: #34363a; color: var(--ink-2); cursor: pointer; }
.mx-note { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- komunikat ---------- */
.synth-toast { position: fixed; left: 50%; bottom: 76px; translate: -50% 10px; z-index: 50; max-width: calc(100vw - 24px); background: #f1f0ea; color: #0b0b0a; border: 2px solid #000; padding: 9px 16px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .15s, translate .15s; }
.synth-toast.on { opacity: 1; translate: -50% 0; }

/* ---------- pasek transportu: zawsze pod ręką na dole okna ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; align-items: center; gap: 6px; min-height: 56px; padding: 6px var(--gut); background: #151617; border-top: 2px solid #000; box-shadow: 0 -1px 0 rgba(255, 255, 255, .08) inset; }
.dock .dk-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 42px; padding: 0 12px; border: 1px solid #000; background: #34363a; color: #e9e8e2; font: 700 13px var(--sans); cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.dock .dk-btn:hover { background: #45484d; color: #fff; }
.dock .dk-btn.on { background: var(--orange); color: #0b0b0a; }
.dock .dk-btn.rec.on { background: var(--red); color: #fff; }
.dock .dk-btn:focus-visible, .dock select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.dk-ic { width: 0; height: 0; border-left: 12px solid currentColor; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.dk-btn.on .dk-ic { width: 12px; height: 12px; border: 0; background: currentColor; }
.dk-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); } .dk-btn.rec.on .dk-dot { background: #fff; border-radius: 0; }
.dk-sq { width: 12px; height: 12px; background: currentColor; }
.dk-bpm { display: inline-flex; align-items: baseline; gap: 6px; padding: 0 12px; min-height: 42px; align-items: center; background: #000; color: var(--plate); font: 500 15px var(--mono); border: 1px solid #000; cursor: pointer; }
.dk-bpm small { font: 600 10px var(--sans); letter-spacing: .1em; color: var(--muted); }
.dk-meter { flex: 0 1 180px; min-width: 60px; height: 14px; background: #000; position: relative; overflow: hidden; }
.dk-meter i { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, #5fd068 0 62%, #f4c84a 62% 84%, #e23b2b 84%); will-change: transform; }
.dk-stat { font: 500 11px var(--mono); color: var(--muted); white-space: nowrap; }
.dk-sp { flex: 1 1 auto; }
.dock select { min-height: 42px; max-width: 170px; }
body.has-dock .wrap { padding-bottom: 120px; }
@media (max-width: 760px) {
  .dock { gap: 4px; padding: 5px 8px; }
  .dock .dk-btn span, .dk-stat, .dk-bpm small { display: none; }
  .dock .dk-btn { padding: 0 10px; } .dock select { max-width: 104px; } .dk-meter { flex-basis: 60px; }
}

/* ---------- instrukcja (na betonie, poza urządzeniem) ---------- */
.manual { margin-top: 72px; padding-top: 28px; border-top: var(--line) solid var(--ink); }
.manual-head { display: flex; flex-direction: column; gap: 12px; max-width: 46em; margin-bottom: 28px; }
.manual-head h2 { font-weight: 900; font-stretch: 125%; font-size: clamp(34px, 5vw, 72px); line-height: .9; letter-spacing: -.03em; text-transform: uppercase; }
.manual-head .kicker { order: 1; } .manual-lead { order: 2; color: var(--ink-2); font-size: 18px; }
.manual-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; align-items: start; }
.manual details { border-top: var(--line) solid var(--ink); }
.manual details[open] { padding-bottom: 18px; }
.manual summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; font-weight: 800; font-stretch: 108%; font-size: 18px; }
.manual summary::-webkit-details-marker { display: none; }
.manual summary::after { content: "+"; flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 500 18px var(--mono); }
.manual details[open] summary::after { content: "–"; background: var(--accent); color: #0b0b0a; }
.manual summary:hover::after { background: var(--accent); color: #0b0b0a; }
.manual ol, .manual ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.manual ul + ol, .manual ol + ul { margin-top: 10px; }
.manual details p { margin: 0 0 10px; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.manual b { color: var(--ink); font-weight: 700; }
.manual i { font-style: normal; font-weight: 600; border-bottom: 2px solid var(--accent); }
.manual details h3 { margin: 16px 0 4px; font-size: 15.5px; font-weight: 800; }
.manual details h3:first-of-type { margin-top: 4px; }
.manual details h3 + p { margin: 0; }
.manual-keys { margin-top: 28px; padding: 20px 22px; border: var(--line) solid var(--ink); background: var(--card); }
.manual-keys h3 { margin: 0 0 12px; font-size: 17px; font-weight: 800; }
.manual-keys dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 0 32px; }
.manual-keys dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--rule); }
.manual-keys dt { display: flex; flex-wrap: wrap; gap: 4px; }
.manual-keys dd { margin: 0; color: var(--muted); font-size: 14px; text-align: right; }

@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid > .card, .grid > .card:nth-child(n) { grid-column: span 2; }
  .grid > .card.c2 { grid-column: span 1; }
}
@media (max-width: 640px) {
  .grid > .card:nth-child(n) { grid-column: span 2; }
  .card { padding: 16px 14px; }
  .knob { width: 78px; }
  .kn-dial { width: 60px; height: 60px; }
  .kn-dial::before { inset: -11.1px; }
  .kn-skirt, .kn-ptr { inset: 8px; } .kn-cap { inset: 15px; }
  .kn-ptr::after { height: 14px; }
  #scope { height: 150px; }
  .keys { height: 160px; }
  .demo-toggle, .midi, .sr-btns { margin-left: 0; }
  .manual-grid { grid-template-columns: minmax(0, 1fr); }
  .loop-main, .loop-ctl { width: 100%; justify-content: center; }
  .pop-row { grid-template-columns: 80px 1fr auto; }
  .song-pos { margin-left: 0; width: 100%; }
  .steps { grid-template-columns: 54px repeat(8, minmax(0, 1fr)); min-width: 0; row-gap: 6px; }
  .steps::after { content: ""; grid-row: 7; grid-column: 1 / -1; height: 1px; background: var(--rule); margin: 4px 0; }
  .st.h2 { grid-row: calc(var(--r) + 8); grid-column: calc(var(--s) - 6); }
  .st-lab.h2 { display: flex; grid-row: calc(var(--r) + 8); }
  .tracks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scenes { width: 100%; }
  .st { height: 34px; }
  .mx-row { grid-template-columns: 22px minmax(0, 1fr) 16px minmax(0, 1fr) 32px; }
  .mx-row input[type="range"] { grid-column: 1 / 5; } .mx-row output { grid-column: 5; }
}
@media (prefers-reduced-motion: reduce) { .btn-s.rec.on, .drum-rec.on, .loop-main, .btn-s.coffee.nudge, .scene.queued, .trk.armed .trk-sel { animation: none !important; } .synth-toast { transition: none; } }
@media (max-width: 560px) { .dk-meter, .dock .dk-top { display: none; } .dock .dk-btn .dk-keep { display: inline; } }
/* miejsce na presety, zanim skrypt je wstawi (karta nie rośnie po doczytaniu) */
.presets#presets { min-height: 120px; align-content: flex-start; }
@media (max-width: 640px) { .presets#presets { min-height: 246px; } }
/* utwór wśród presetów: żółta tabliczka z nutą, pomarańczowa, gdy gra */
.synth .chip-btn.song { background: var(--plate); border-color: var(--plate); color: #0b0b0a; font-weight: 700; }
.synth .chip-btn.song:hover { background: #fff; border-color: #fff; color: #0b0b0a; }
.synth .chip-btn.song.on { background: var(--orange); border-color: var(--orange); color: #0b0b0a; }
/* strażnik sprzężenia: zielona dioda zamiast pełnego podświetlenia, bo domyślnie jest włączony */
.synth #micGuard::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; background: #55575a; vertical-align: 1px; }
.synth #micGuard.on { background: none; color: inherit; }
.synth #micGuard.on::before { background: var(--green); }
