:root {
    color-scheme: light;
    --bg: #f5f6f4;
    --panel: #ffffff;
    --text: #151719;
    --muted: #626a70;
    --line: #d8ddd8;
    --accent: #17685e;
    --accent-dark: #0f4f48;
    --warn: #9b3c36;
    --rack-width: 380px;
    --rack-height: 760px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
    width: min(1152px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
}

header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: 0;
}

.status {
    color: var(--muted);
    min-height: 21px;
    text-align: right;
}

.instrument-layout {
    display: grid;
    grid-template-columns: var(--rack-width) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.surface {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(18, 24, 31, 0.08);
}

.wiring-overview {
    margin-top: 20px;
}

.wiring-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: stretch;
}

.wiring-diagram {
    min-width: 0;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9faf8;
}

.wiring-diagram svg {
    display: block;
    min-width: 780px;
    width: 100%;
    height: auto;
}

.breadboard-shell {
    fill: #f1f3ef;
    stroke: #c5ccc4;
    stroke-width: 2;
}

.breadboard-center {
    fill: #fff;
    stroke: #d8ddd8;
    stroke-width: 1.5;
}

.rail {
    stroke-width: 4;
    stroke-linecap: round;
}

.rail-positive {
    stroke: #b9534d;
}

.rail-ground {
    stroke: #4f575b;
}

.rail-label,
.wiring-node text,
.pin-label {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

.rail-label {
    font-size: 13px;
    font-weight: 800;
}

.rail-positive-label {
    fill: #9b3c36;
}

.rail-ground-label {
    fill: #4f575b;
}

.wire {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    marker-start: url(#wireDot);
    marker-end: url(#wireDot);
    cursor: pointer;
    pointer-events: stroke;
}

.wire:focus-visible,
.wire.active {
    outline: none;
    stroke-width: 7;
}

.wire-power {
    stroke: #b9534d;
}

.wire-ground {
    stroke: #4f575b;
}

.wire-i2c,
.wire-i2c-alt {
    stroke: #4f7fbc;
}

.wire-analog,
.wire-analog-alt {
    stroke: #17685e;
}

.wire-digital,
.wire-digital-alt {
    stroke: #c08b24;
}

.wire-audio {
    stroke: #7b5aa6;
}

.wire-led {
    stroke: #a8423c;
}

.wiring-node {
    cursor: pointer;
}

.wiring-node rect {
    fill: #fff;
    stroke: #aeb5ac;
    stroke-width: 2;
}

.wiring-node circle {
    fill: #f6f7f4;
    stroke: #626a70;
    stroke-width: 2;
}

.wiring-node line {
    stroke: #626a70;
    stroke-width: 3;
    stroke-linecap: round;
}

.wiring-node text {
    fill: var(--text);
    font-size: 15px;
    font-weight: 800;
    text-anchor: middle;
}

.wiring-small {
    fill: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.wiring-seed rect {
    fill: #202726;
    stroke: #48524f;
}

.wiring-seed text {
    fill: #f7f8f3;
}

.wiring-seed .wiring-small {
    fill: #b9c1bb;
}

.wiring-seed circle {
    fill: #d8ddd8;
    stroke: #0b0d0d;
}

.pin-label {
    fill: #dce5df;
    font-size: 10px;
    font-weight: 750;
    text-anchor: start;
}

.pin-right {
    text-anchor: end;
}

.wiring-led-dot {
    fill: #c21a14;
    stroke: #8d2b26;
}

.wiring-resistor {
    fill: #e7d3a5;
    stroke: #8f7138;
}

.button-dots circle {
    fill: #e8ece7;
}

.wiring-node:hover rect,
.wiring-node:focus-visible rect,
.wiring-node.active rect {
    stroke: var(--accent);
    stroke-width: 3;
}

.wiring-node:hover circle,
.wiring-node:focus-visible circle,
.wiring-node.active circle {
    stroke: var(--accent-dark);
}

.wiring-inspector {
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfb;
}

.wiring-inspector h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
}

.wiring-inspector p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.wiring-steps {
    display: grid;
    gap: 7px;
    margin: 0;
    padding-left: 20px;
    color: var(--text);
    font-size: 13px;
}

.wiring-inspector dl {
    display: grid;
    gap: 10px;
    margin: 0;
}

.wiring-inspector dl div {
    display: grid;
    gap: 2px;
}

.wiring-inspector dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.wiring-inspector dd {
    margin: 0;
    color: var(--text);
    font-size: 13px;
}

.eurorack-panel {
    position: sticky;
    top: 20px;
    display: grid;
    grid-template-rows: 18px minmax(0, 1fr) 18px;
    gap: 12px;
    width: var(--rack-width);
    height: var(--rack-height);
    min-height: 0;
    padding: 14px;
    background: #e7e9e3;
}

.rack-rail {
    height: 18px;
    border: 1px solid #b9bfb6;
    border-radius: 4px;
    background: linear-gradient(180deg, #f6f7f4 0%, #cfd4cc 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.eurorack-faceplate {
    position: relative;
    display: grid;
    grid-template-rows: auto auto minmax(145px, 1fr) auto auto auto;
    gap: 14px;
    min-height: 0;
    padding: 42px 24px 38px;
    border: 1px solid #aeb5ac;
    border-radius: 6px;
    background: linear-gradient(180deg, #f7f8f3 0%, #e1e5df 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
}

.rack-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-align: center;
}

.rack-title-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding-left: 34px;
}

.rack-title-copy span {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
}

.rack-title-copy small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
}

.rack-title-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: end;
}

.rack-title-tools .rack-led {
    flex: 0 0 auto;
}

.rack-led {
    --rack-led-opacity: 0.28;
    --rack-led-glow-size: 2px;
    --rack-led-glow-spread: 0px;
    --rack-led-glow-alpha: 0.1;
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    padding: 0;
    border: 1px solid #8d2b26;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 156, 143, 0.92) 18%, rgba(194, 26, 20, 0.96) 50%, rgba(85, 10, 10, 0.98) 100%);
    box-shadow:
        0 0 var(--rack-led-glow-size) var(--rack-led-glow-spread) rgba(226, 34, 28, var(--rack-led-glow-alpha)),
        inset 0 1px 1px rgba(255, 255, 255, 0.6);
    line-height: 0;
    opacity: var(--rack-led-opacity);
}

.rack-oled {
    position: relative;
    align-self: start;
    justify-self: center;
    width: min(280px, 100%);
    margin: 0 auto;
    padding: 10px;
    border: 1px solid #151719;
    border-radius: 6px;
    background: #171c1b;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 5px 12px rgba(20, 24, 23, 0.18);
}

.rack-oled canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 128 / 62;
    border: 1px solid #020605;
    border-radius: 2px;
    background: #020605;
    image-rendering: pixelated;
}

.rack-screw {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 1px solid #9da59c;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff 0%, #c5cbc2 52%, #8f978d 100%);
}

.rack-screw::after {
    content: "";
    position: absolute;
    top: 7px;
    left: 3px;
    width: 10px;
    height: 2px;
    border-radius: 999px;
    background: #6f766e;
}

.rack-screw-top-left {
    top: 18px;
    left: 18px;
}

.rack-screw-top-right {
    top: 18px;
    right: 18px;
}

.rack-screw-bottom-left {
    bottom: 18px;
    left: 18px;
}

.rack-screw-bottom-right {
    right: 18px;
    bottom: 18px;
}

.rack-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-content: center;
    justify-items: center;
}

.rack-control,
.jack {
    display: grid;
    justify-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
}

.rack-masterdist,
.rack-mastertwister {
    position: relative;
    grid-template-rows: 125px auto;
    width: 132px;
    min-height: 145px;
    align-content: center;
}

.rack-knob-scale {
    position: relative;
    width: 125px;
    aspect-ratio: 1;
}

.rack-vibration-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-self: start;
    gap: 6px;
    width: 132px;
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
}

.rack-vibration-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.rack-vibration-row span:first-child {
    text-align: left;
}

.rack-vibration-row span:last-child {
    color: var(--accent-dark);
    text-align: right;
}

.rack-knob {
    --rack-knob-angle: -7deg;
    position: absolute;
    top: 31px;
    left: 50%;
    width: 62px;
    margin-left: -31px;
    aspect-ratio: 1;
    border: 1px solid #1f2424;
    border-radius: 50%;
    background:
        linear-gradient(90deg, transparent 48%, rgba(255, 255, 255, 0.78) 48%, rgba(255, 255, 255, 0.78) 52%, transparent 52%) 50% 12% / 42% 42% no-repeat,
        radial-gradient(circle at 35% 30%, #4d5553 0%, #1d2222 58%, #070808 100%);
    box-shadow: 0 8px 14px rgba(20, 24, 23, 0.22);
    cursor: ns-resize;
    touch-action: none;
    transform: rotate(var(--rack-knob-angle));
}

.rack-knob:focus-visible {
    outline: 3px solid rgba(23, 104, 94, 0.28);
    outline-offset: 5px;
}

.rack-preset-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: -6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rack-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.rack-preset-button {
    display: grid;
    grid-template-rows: 22px auto;
    place-items: center;
    gap: 4px;
    min-height: 42px;
    border: 1px solid #8f978d;
    border-radius: 5px;
    background: linear-gradient(180deg, #fefefe 0%, #c7cec4 100%);
    color: var(--text);
    padding: 5px 4px 4px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 2px 0 rgba(80, 88, 82, 0.3);
}

.rack-preset-button::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 1px solid #59615a;
    border-radius: 50%;
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.42) 16%, transparent 17%),
        linear-gradient(180deg, #48504d 0%, #161b1a 100%);
    box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.42), 0 2px 3px rgba(20, 24, 23, 0.28);
}

.rack-preset-button.active {
    border-color: var(--accent-dark);
    background: linear-gradient(180deg, #dceee8 0%, #8fbab0 100%);
}

.rack-preset-button.active::before {
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.48) 16%, transparent 17%),
        linear-gradient(180deg, #1f7a68 0%, #0f4f48 100%);
}

.rack-preset-button.save-armed {
    border-color: #c08b24;
}

.rack-preset-button.save-armed::before {
    box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.42), 0 0 0 3px rgba(192, 139, 36, 0.24);
}

.jack-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 72px));
    justify-content: center;
    gap: 28px;
}

.jack-hole {
    width: 26px;
    aspect-ratio: 1;
    border: 1px solid #2d3332;
    border-radius: 50%;
    background: radial-gradient(circle, #111 0%, #111 34%, #626a66 36%, #d6dbd3 68%, #989f96 100%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

.jack-muted {
    opacity: 0.45;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 14px;
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
    text-transform: uppercase;
}

.surface > .section-heading:first-child {
    margin-top: 0;
}

.section-heading::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--line);
}

.section-helper {
    margin: -6px 0 14px;
    color: var(--muted);
    font-size: 13px;
}

.preset-memory {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.preset-memory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
    text-transform: uppercase;
}

.preset-memory-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.preset-memory-actions input[type="file"] {
    display: none;
}

.preset-memory-actions button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
}

.preset-memory-header button.active {
    border-color: #c08b24;
    background: #fff3d8;
    color: var(--text);
}

.preset-memory-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.preset-memory-grid button {
    min-height: 36px;
    padding: 0 8px;
    border-color: var(--line);
    background: #fbfcfb;
    color: var(--text);
    font-size: 12px;
    font-weight: 750;
}

.preset-memory-grid button.active {
    border-color: var(--accent);
    background: #dceee8;
}

.preset-memory-grid button.save-armed {
    border-color: #c08b24;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.kick-panel .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-grid {
    grid-template-columns: minmax(0, 1fr);
    max-width: 420px;
}

.control {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.effect-control {
    align-content: start;
}

.macro-control {
    max-width: 420px;
    margin-bottom: 16px;
}

label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.control-description {
    margin: -2px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.25;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.toggle-label input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

input,
select,
button {
    font: inherit;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

input[type="number"] {
    width: 82px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    padding: 0 8px;
    font-variant-numeric: tabular-nums;
}

select {
    width: 100%;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    padding: 0 8px;
}

select:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.value-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
}

.readout {
    min-width: 78px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.range-stepper {
    display: grid;
    gap: 2px;
    width: 22px;
}

.step-button {
    min-height: 18px;
    width: 22px;
    border-color: var(--line);
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    padding: 0;
    font-size: 10px;
    line-height: 1;
}

.step-button:hover {
    border-color: var(--accent);
}

.adsr-panel {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(252, 245, 217, 0.55);
}

.adsr-graph {
    width: 100%;
    height: 170px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfb;
    touch-action: none;
}

.adsr-time-labels {
    pointer-events: none;
}

.adsr-time-label {
    fill: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    vector-effect: non-scaling-stroke;
}

.adsr-graph polyline {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.adsr-handle {
    fill: #fff;
    stroke: var(--accent);
    stroke-width: 3;
    cursor: grab;
    vector-effect: non-scaling-stroke;
}

.adsr-handle:active {
    cursor: grabbing;
}

.adsr-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.good-vibrations-panel,
.master-panel,
.twister-panel {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.twister-panel {
    background: rgba(232, 247, 238, 0.55);
}

.good-vibrations-panel {
    background: rgba(231, 243, 252, 0.55);
}

.master-panel {
    background: rgba(241, 243, 242, 0.75);
}

.good-vibrations-panel .section-heading {
    margin: 0;
}

.good-vibrations-panel .section-helper,
.good-vibrations-panel .macro-control {
    margin-bottom: 0;
}

.master-panel .section-heading {
    margin: 0;
}

.twister-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.twister-header .toggle-label {
    font-size: 15px;
    font-weight: 800;
}

.twister-header span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    text-align: right;
}

.twister-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.twister-canvas {
    display: block;
    width: 100%;
    height: 260px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfb;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

button {
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 700;
}

.primary {
    background: var(--accent);
    color: #fff;
}

.primary:hover {
    background: var(--accent-dark);
}

.secondary {
    background: #fff;
    border-color: var(--line);
    color: var(--text);
}

.secondary:hover {
    border-color: var(--accent);
}

.danger {
    background: #fff;
    border-color: #e1bbb8;
    color: var(--warn);
}

.tempo-readout {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    min-width: 132px;
}

.tempo-control {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    max-width: 420px;
}

.firmware-output {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.firmware-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.firmware-output textarea {
    width: 100%;
    min-height: 188px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfb;
    color: var(--text);
    padding: 12px;
    font: 13px/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.firmware-note {
    color: var(--muted);
    font-size: 13px;
}

.vu {
    margin-top: 20px;
    display: grid;
    gap: 8px;
}

.vu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.vu-readout {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.vu-bar {
    position: relative;
    height: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: linear-gradient(90deg, #edf0ed 0%, #edf0ed 68%, #f3e4bb 68%, #f3e4bb 88%, #eed0cd 88%);
}

.vu-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #1f7a68 0%, #1f7a68 68%, #c08b24 68%, #c08b24 88%, #a8423c 88%);
    transition: width 70ms linear;
}

.vu-peak {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0%;
    width: 2px;
    background: var(--text);
    opacity: 0.7;
}

.spectrum {
    display: grid;
    gap: 8px;
    margin-top: 6px;
}

.spectrum-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.spectrum-header span:last-child {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.spectrum-canvas {
    display: block;
    width: 100%;
    height: 160px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f9faf8;
}

.scope {
    display: grid;
    gap: 8px;
    margin-top: 6px;
}

.scope-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.scope-header span:last-child {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.scope-control {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.scope-control input {
    width: 100%;
}

.scope-canvas {
    display: block;
    width: 100%;
    height: 140px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f9faf8;
}

.memory {
    margin-top: 20px;
    display: grid;
    gap: 10px;
}

.memory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.memory-time {
    color: var(--text);
    font-weight: 500;
}

.memory-note {
    color: var(--muted);
    font-size: 13px;
}

.memory-grid {
    display: grid;
    gap: 8px;
}

.memory-row {
    display: grid;
    grid-template-columns: 96px 1fr 132px;
    align-items: center;
    gap: 12px;
    min-height: 24px;
    font-variant-numeric: tabular-nums;
}

.memory-name {
    color: var(--text);
    font-weight: 650;
}

.memory-track {
    height: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #edf0ed;
}

.memory-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
}

.memory-fill.warning {
    background: #c08b24;
}

.memory-fill.danger {
    background: var(--warn);
}

.memory-value {
    color: var(--muted);
    text-align: right;
}

.preset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.preset-actions input[type="file"] {
    display: none;
}

@media (max-width: 980px) {
    .instrument-layout {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .eurorack-panel {
        position: static;
        justify-self: center;
    }

    .wiring-layout {
        grid-template-columns: 1fr;
    }

    .wiring-inspector {
        min-height: 0;
    }
}

@media (max-width: 760px) {
    header {
        align-items: start;
        flex-direction: column;
    }

    .status {
        text-align: left;
    }

    .grid,
    .kick-panel .grid {
        grid-template-columns: 1fr;
    }

    .adsr-controls {
        grid-template-columns: 1fr;
    }

    .twister-header {
        align-items: start;
        flex-direction: column;
    }

    .twister-header span {
        text-align: left;
    }

    .twister-controls {
        grid-template-columns: 1fr;
    }

    .rack-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .jack-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .preset-memory-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .memory-row {
        grid-template-columns: 76px 1fr;
    }

    .memory-value {
        grid-column: 1 / -1;
        text-align: left;
    }

    .tempo-control {
        grid-template-columns: 1fr;
        max-width: none;
    }
}
