:root {
  color-scheme: dark;
  --ink: #070909;
  --canvas: #0b0e0f;
  --panel: #111516;
  --panel-high: #191f20;
  --line: #343c3d;
  --line-soft: #252b2c;
  --paper: #f3f4ee;
  --muted: #8b9491;
  --acid: #c8ff3d;
  --acid-dim: #8caf2c;
  --sample: #b7a2ff;
  --sample-dim: #7667b2;
  --record: #ff635b;
  --warning: #ffbf4a;
  --mono: "SFMono-Regular", "Roboto Mono", "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { min-width: 320px; background: var(--ink); }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--paper);
  background:
    linear-gradient(90deg, rgb(255 255 255 / 1.3%) 1px, transparent 1px) 0 0 / 52px 52px,
    #07090a;
  font-family: var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

button,
input[type="range"] { touch-action: manipulation; }

button { color: inherit; }

a { color: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--acid);
  outline-offset: 3px;
}

h1,
h2,
h3,
p { margin-top: 0; }

kbd { font-family: var(--mono); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.studio-shell {
  width: min(1600px, calc(100% - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  overflow: hidden;
  border: 1px solid #485052;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 2.2%), transparent 24%),
    var(--canvas);
  box-shadow: 0 28px 90px rgb(0 0 0 / 52%), inset 0 1px rgb(255 255 255 / 8%);
}

.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 108px;
  padding: 19px 25px;
  border-bottom: 1px solid var(--line);
  background: #0c0f10;
}

.brand-lockup { display: grid; gap: 3px; }

.eyebrow,
.control-label {
  margin: 0;
  color: var(--muted);
  font: 750 0.6rem/1 var(--mono);
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4rem);
  font-weight: 860;
  line-height: 0.9;
  letter-spacing: -0.075em;
}

h1 span { color: var(--acid); font-weight: 330; }

.tool-switcher {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}

.tool-switcher a {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font: 750 0.53rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-decoration: none;
}

.tool-switcher a:hover { color: var(--paper); border-color: #737d7b; }

.tool-switcher a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--acid);
  background: var(--acid);
}

.header-actions { display: flex; align-items: center; gap: 15px; }

.view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #080a0b;
}

.view-switch button {
  min-width: 90px;
  min-height: 42px;
  padding: 6px 12px;
  border: 0;
  border-radius: 3px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.view-switch span,
.view-switch small { display: block; font-family: var(--mono); }
.view-switch span { font-size: 0.64rem; font-weight: 850; letter-spacing: 0.1em; }
.view-switch small { margin-top: 4px; font-size: 0.54rem; }
.view-switch button[aria-pressed="true"] { color: var(--paper); background: #262d2e; box-shadow: inset 0 1px rgb(255 255 255 / 8%); }

.engine-status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 150px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.engine-status i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #606866;
  box-shadow: 0 0 0 5px rgb(255 255 255 / 3%);
}

.engine-status small,
.engine-status strong { display: block; font-family: var(--mono); }
.engine-status small { margin-bottom: 4px; color: var(--muted); font-size: 0.52rem; letter-spacing: 0.12em; }
.engine-status strong { max-width: 165px; overflow: hidden; font-size: 0.63rem; text-overflow: ellipsis; white-space: nowrap; }
.engine-status.is-ready i { background: var(--acid); box-shadow: 0 0 15px rgb(200 255 61 / 70%), 0 0 0 5px rgb(200 255 61 / 8%); }
.engine-status.is-warning i { background: var(--warning); }
.engine-status.is-error i { background: var(--record); }

.stop-all,
.transport-button,
.quiet-button,
.session-mode-buttons button {
  border: 1px solid #505a58;
  border-radius: 5px;
  background: #1a1f20;
  box-shadow: inset 0 1px rgb(255 255 255 / 6%), 0 3px 0 #050707;
  font: 800 0.63rem/1 var(--mono);
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 90ms ease, border-color 90ms ease, background 90ms ease, color 90ms ease;
}

.stop-all:hover,
.transport-button:hover,
.quiet-button:hover,
.session-mode-buttons button:hover { border-color: #7e8886; background: #222829; }

.stop-all:active,
.transport-button:active,
.quiet-button:active,
.session-mode-buttons button:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px rgb(255 255 255 / 5%), 0 1px 0 #050707;
}

.stop-all {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 45px;
  padding: 0 12px;
}

.stop-all > span { width: 8px; height: 8px; background: currentColor; }
.stop-all kbd,
.transport-button kbd { padding: 3px 4px; border: 1px solid #4a5352; border-radius: 3px; color: var(--muted); font-size: 0.5rem; }

.transport-deck {
  display: grid;
  grid-template-columns: auto minmax(285px, 0.85fr) minmax(145px, 0.45fr) minmax(145px, 0.45fr) minmax(250px, 1fr);
  align-items: stretch;
  min-height: 94px;
  border-bottom: 1px solid var(--line);
  background: #101415;
}

.transport-deck > * {
  min-width: 0;
  padding: 15px 18px;
  border-right: 1px solid var(--line-soft);
}

.transport-deck > *:last-child { border-right: 0; }

.transport-actions { display: flex; align-items: center; gap: 9px; }

.transport-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 82px;
  min-height: 51px;
  padding: 0 12px;
}

.transport-button.is-primary {
  color: #111507;
  border-color: var(--acid);
  background: var(--acid);
}

.transport-button.is-primary:hover { color: var(--paper); background: #222a20; }

.transport-button.is-primary > i {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}

.transport-button.is-primary.is-playing > i {
  width: 9px;
  height: 11px;
  border: 0;
  border-right: 3px solid currentColor;
  border-left: 3px solid currentColor;
}

.record-button { min-width: 66px; }
.record-button > i { width: 9px; height: 9px; border-radius: 50%; background: var(--record); }
.record-button[aria-pressed="true"] { color: #130605; border-color: var(--record); background: var(--record); }
.record-button[aria-pressed="true"] > i { background: #130605; box-shadow: 0 0 0 5px rgb(19 6 5 / 12%); }

.tempo-control {
  display: grid;
  grid-template-columns: auto 30px auto auto 30px;
  align-items: center;
  gap: 7px;
}

.tempo-control .control-label { grid-column: 1 / -1; }
.tempo-control button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: #181d1e; cursor: pointer; }
.tempo-control output { min-width: 62px; font: 800 1.72rem/1 var(--mono); letter-spacing: -0.08em; text-align: right; }
.tempo-control > span:not(.control-label) { color: var(--muted); font: 700 0.5rem/1 var(--mono); }
.tempo-control input { grid-column: 1 / -1; }

.range-control {
  display: grid;
  align-content: center;
  gap: 12px;
}

.range-control > span { display: flex; justify-content: space-between; color: var(--muted); font: 700 0.56rem/1 var(--mono); letter-spacing: 0.11em; }
.range-control output { color: var(--paper); }

input[type="range"] {
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--acid-dim), #3c4544); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: #46504e; }
input[type="range"]::-webkit-slider-thumb { width: 17px; height: 17px; margin-top: -7px; appearance: none; border: 2px solid #0c0f10; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 1px #6d7775; }
input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border: 2px solid #0c0f10; border-radius: 50%; background: var(--paper); }

.bar-monitor { display: grid; align-content: center; grid-template-columns: 1fr auto; gap: 9px 14px; }
.bar-track { grid-column: 1 / -1; height: 5px; overflow: hidden; border-radius: 1px; background: #29302f; }
.bar-track i { display: block; width: 100%; height: 100%; background: var(--acid); box-shadow: 0 0 10px rgb(200 255 61 / 40%); transform: scaleX(0); transform-origin: left; will-change: transform; }
.bar-monitor > strong { color: var(--acid); font: 800 0.62rem/1 var(--mono); letter-spacing: 0.09em; }

.performance-stage { background: #0d1112; }

.stage-rail {
  display: grid;
  grid-template-columns: minmax(360px, 0.62fr) minmax(500px, 1fr);
  border-bottom: 1px solid var(--line);
}

.layer-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 12px 18px;
  border-right: 1px solid var(--line);
  background: #0b0e0f;
}

.layer-switch button {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 3px 10px;
  min-height: 64px;
  padding: 10px 14px;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.layer-switch button:first-child { border-right-color: var(--line-soft); }
.layer-switch small { grid-column: 1 / -1; font: 750 0.49rem/1 var(--mono); letter-spacing: 0.14em; }
.layer-switch strong { font: 900 1.17rem/1 var(--mono); letter-spacing: -0.04em; }
.layer-switch span { font-size: 0.65rem; }
.layer-switch button[aria-pressed="true"] { color: var(--paper); border-color: var(--acid-dim); background: rgb(200 255 61 / 5%); box-shadow: inset 0 -3px var(--acid); }
.studio-shell[data-layer="sample"] .layer-switch button[aria-pressed="true"] { border-color: var(--sample-dim); background: rgb(183 162 255 / 6%); box-shadow: inset 0 -3px var(--sample); }

.preset-strip { display: grid; grid-template-columns: minmax(150px, 0.3fr) 1fr; align-items: center; gap: 14px; padding: 12px 20px; overflow: hidden; }
.preset-copy { min-width: 0; }
.preset-copy > * { display: block; }
.preset-copy strong { margin-top: 6px; overflow: hidden; font: 850 0.82rem/1 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.preset-copy small { margin-top: 6px; overflow: hidden; color: var(--muted); font: 600 0.54rem/1.2 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.preset-copy small.is-queued { color: var(--warning); }

.preset-buttons { display: flex; gap: 7px; overflow-x: auto; padding: 4px 1px 7px; scrollbar-width: thin; }
.preset-buttons button {
  flex: 0 0 auto;
  min-width: 91px;
  min-height: 45px;
  padding: 7px 10px;
  border: 1px solid #404948;
  border-radius: 4px;
  color: var(--muted);
  background: #151a1b;
  font: 750 0.55rem/1.2 var(--mono);
  cursor: pointer;
}
.preset-buttons button span { display: block; margin-top: 4px; color: #68716f; font-size: 0.45rem; letter-spacing: 0.1em; }
.preset-buttons button:hover { color: var(--paper); border-color: #75807d; }
.preset-buttons button[aria-pressed="true"] { color: #0e1207; border-color: var(--acid); background: var(--acid); }
.preset-buttons button.is-pending { color: var(--warning); border-color: var(--warning); box-shadow: inset 0 -2px var(--warning); }

.stage-layout { display: grid; grid-template-columns: minmax(640px, 1fr) minmax(330px, 0.4fr); min-height: 620px; }
.pad-surface { min-width: 0; padding: 23px 26px 19px; border-right: 1px solid var(--line); background: #101415; }
.build-panel { min-width: 0; padding: 23px 25px; background: #0b0e0f; }

.surface-heading,
.builder-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.surface-heading h2,
.builder-heading h2 { margin: 5px 0 0; font-size: clamp(1.15rem, 2vw, 1.52rem); letter-spacing: -0.035em; }
.surface-heading > p { max-width: 390px; margin: 0; color: var(--muted); font: 600 0.61rem/1.4 var(--mono); text-align: right; }

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

.studio-pad {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  aspect-ratio: 1 / 0.7;
  min-height: 100px;
  overflow: hidden;
  padding: 11px 12px 12px;
  border: 1px solid #4c5654;
  border-radius: 8px;
  color: #c2c8c5;
  background:
    linear-gradient(150deg, rgb(255 255 255 / 7%), transparent 42%),
    #202627;
  box-shadow: inset 0 1px rgb(255 255 255 / 7%), inset 0 -5px rgb(0 0 0 / 19%), 0 4px 0 #070909;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 75ms ease, border-color 100ms ease, color 100ms ease, background 100ms ease, box-shadow 100ms ease;
}

.studio-pad::after {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 72%, rgb(200 255 61 / 22%), transparent 62%);
  opacity: 0;
  content: "";
  pointer-events: none;
  transition: opacity 100ms ease;
}

.studio-pad:hover { border-color: #77817f; color: var(--paper); }
.studio-pad.is-selected { border-color: var(--acid-dim); box-shadow: inset 0 0 0 1px rgb(200 255 61 / 24%), inset 0 -5px rgb(0 0 0 / 20%), 0 4px 0 #070909; }
.studio-pad.is-triggered { transform: translateY(3px) scale(0.987); color: var(--paper); border-color: var(--acid); background: #293225; box-shadow: inset 0 1px rgb(255 255 255 / 8%), 0 1px 0 #070909, 0 0 22px rgb(200 255 61 / 13%); }
.studio-pad.is-triggered::after { opacity: 1; }

.studio-shell[data-layer="sample"] .studio-pad { color: #bdb6d4; }
.studio-shell[data-layer="sample"] .studio-pad::after { background: radial-gradient(circle at 50% 72%, rgb(183 162 255 / 29%), transparent 62%); }
.studio-shell[data-layer="sample"] .studio-pad.is-selected { border-color: var(--sample-dim); box-shadow: inset 0 0 0 1px rgb(183 162 255 / 25%), inset 0 -5px rgb(0 0 0 / 20%), 0 4px 0 #070909; }
.studio-shell[data-layer="sample"] .studio-pad.is-triggered,
.studio-shell[data-layer="sample"] .studio-pad.is-looping { color: #fbf9ff; border-color: var(--sample); background: #302a42; box-shadow: inset 0 1px rgb(255 255 255 / 8%), 0 1px 0 #070909, 0 0 24px rgb(183 162 255 / 15%); }
.studio-shell[data-layer="sample"] .studio-pad.is-queued { border-color: var(--warning); animation: queue-pulse 900ms ease-in-out infinite alternate; }
.studio-pad.is-empty { color: #636b69; border-style: dashed; background: #15191a; }

.pad-topline { display: flex; align-items: center; justify-content: space-between; color: inherit; font: 750 0.5rem/1 var(--mono); letter-spacing: 0.09em; }
.pad-topline kbd { min-width: 24px; padding: 4px 5px; border: 1px solid #596260; border-radius: 3px; color: var(--paper); background: rgb(0 0 0 / 20%); text-align: center; }
.studio-pad.is-empty .pad-topline kbd { color: #78807e; border-color: #3b4241; }
.pad-name { position: relative; z-index: 1; align-self: end; overflow: hidden; font: 900 clamp(0.65rem, 1.25vw, 0.92rem)/1.1 var(--mono); letter-spacing: -0.025em; text-overflow: ellipsis; white-space: nowrap; }
.pad-mode { position: relative; z-index: 1; margin-top: 7px; color: #7f8885; font: 700 0.48rem/1 var(--mono); letter-spacing: 0.11em; }
.studio-shell[data-layer="sample"] .studio-pad.is-looping .pad-mode { color: var(--sample); }

.performance-readout { display: grid; grid-template-columns: 1.1fr 0.8fr 1fr; margin-top: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.performance-readout > div { min-width: 0; padding: 12px 13px; border-right: 1px solid var(--line-soft); }
.performance-readout > div:last-child { border-right: 0; }
.performance-readout span,
.performance-readout strong { display: block; font-family: var(--mono); }
.performance-readout span { margin-bottom: 5px; color: var(--muted); font-size: 0.49rem; letter-spacing: 0.12em; }
.performance-readout strong { overflow: hidden; font-size: 0.65rem; text-overflow: ellipsis; white-space: nowrap; }
#nextBarText.is-queued { color: var(--warning); }

.keyboard-help { display: flex; flex-wrap: wrap; gap: 10px 18px; padding-top: 14px; color: var(--muted); font: 650 0.54rem/1.3 var(--mono); }
.keyboard-help span { display: flex; align-items: center; gap: 4px; }
.keyboard-help kbd { padding: 3px 4px; border: 1px solid #414a48; border-radius: 3px; color: #c4cac7; background: #171c1d; }

.builder-intro { margin: 0 0 20px; color: var(--muted); font-size: 0.73rem; line-height: 1.65; }
.quiet-button { min-height: 35px; padding: 0 11px; color: var(--muted); font-size: 0.53rem; }

.step-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.step-button {
  position: relative;
  aspect-ratio: 1.3 / 1;
  min-height: 46px;
  padding: 7px;
  border: 1px solid #404947;
  border-radius: 4px;
  color: #69716f;
  background: #171c1d;
  box-shadow: inset 0 1px rgb(255 255 255 / 4%), 0 2px 0 #050707;
  font: 750 0.54rem/1 var(--mono);
  text-align: left;
  cursor: pointer;
}
.step-button:nth-child(4n+1)::after { position: absolute; right: 6px; bottom: 6px; width: 4px; height: 4px; border-radius: 50%; background: #66706e; content: ""; }
.step-button:hover { color: var(--paper); border-color: #727c79; }
.step-button[aria-pressed="true"] { color: #111507; border-color: var(--acid); background: var(--acid); box-shadow: inset 0 1px rgb(255 255 255 / 25%), 0 2px 0 #36480b; }
.step-button.is-playhead { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--paper), 0 0 16px rgb(255 255 255 / 12%); }

.beat-recipe { margin-top: 22px; padding: 15px 0; border-top: 1px solid var(--line); }
.beat-recipe span { color: var(--acid); font: 800 0.55rem/1 var(--mono); letter-spacing: 0.12em; }
.beat-recipe p { margin: 8px 0 0; color: var(--muted); font-size: 0.7rem; line-height: 1.6; }
.beat-recipe b { color: var(--paper); }

.sample-ready-panel > p { margin: 0 0 16px; overflow-wrap: anywhere; font-weight: 760; }
.sample-ready-panel dl { margin: 0 0 18px; border-top: 1px solid var(--line); }
.sample-ready-panel dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.sample-ready-panel dt,
.sample-ready-panel dd { margin: 0; font-family: var(--mono); }
.sample-ready-panel dt { color: var(--muted); font-size: 0.53rem; letter-spacing: 0.11em; }
.sample-ready-panel dd { font-size: 0.64rem; }
.sample-ready-panel > small { display: block; margin-top: 10px; color: var(--muted); font: 600 0.55rem/1.45 var(--mono); }

.session-mode-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.session-mode-buttons button { min-height: 39px; padding: 0 5px; color: var(--muted); font-size: 0.48rem; }
.session-mode-buttons button[aria-pressed="true"] { color: #160f27; border-color: var(--sample); background: var(--sample); }

.sampler-link { display: inline-flex; margin-top: 18px; color: var(--sample); font: 750 0.61rem/1 var(--mono); letter-spacing: 0.04em; text-decoration: none; }
.sampler-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.sampler-link.is-primary { align-items: center; justify-content: center; min-height: 42px; padding: 0 14px; border: 1px solid var(--sample); border-radius: 4px; color: #171024; background: var(--sample); text-decoration: none; }

.empty-sample-state { display: grid; justify-items: start; padding: 26px 0 8px; border-top: 1px solid var(--line); }
.empty-sample-state > span { display: grid; place-items: center; width: 50px; height: 50px; margin-bottom: 17px; border: 1px dashed var(--sample-dim); border-radius: 50%; color: var(--sample); font: 300 1.6rem/1 var(--sans); }
.empty-sample-state h3 { margin-bottom: 7px; font-size: 1rem; }
.empty-sample-state p { max-width: 360px; margin-bottom: 0; color: var(--muted); font-size: 0.7rem; line-height: 1.65; }

.studio-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 48px; padding: 10px 25px; border-top: 1px solid var(--line); color: var(--muted); background: #0a0d0e; font: 650 0.54rem/1.4 var(--mono); }
.studio-footer p { margin: 0; }
.studio-footer span { color: var(--acid); }
#messageLine { max-width: 780px; color: #bdc3c0; text-align: right; }

/* PERFORM removes edit decisions and promotes the stage to the whole instrument. */
.studio-shell[data-view="perform"] { min-height: calc(100svh - 16px); margin-top: 8px; margin-bottom: 8px; }
.studio-shell[data-view="perform"] .studio-header { min-height: 72px; padding-block: 9px; }
.studio-shell[data-view="perform"] .eyebrow,
.studio-shell[data-view="perform"] .engine-status,
.studio-shell[data-view="perform"] .build-control,
.studio-shell[data-view="perform"] .build-panel,
.studio-shell[data-view="perform"] .keyboard-help,
.studio-shell[data-view="perform"] .studio-footer { display: none; }
.studio-shell[data-view="perform"] h1 { font-size: clamp(2rem, 3vw, 3.25rem); }
.studio-shell[data-view="perform"] .transport-deck { grid-template-columns: auto minmax(250px, 1fr); min-height: 64px; }
.studio-shell[data-view="perform"] .transport-deck > * { padding-block: 10px; }
.studio-shell[data-view="perform"] .transport-button { min-height: 42px; }
.studio-shell[data-view="perform"] .stage-rail { grid-template-columns: minmax(360px, 0.7fr) minmax(520px, 1.3fr); }
.studio-shell[data-view="perform"] .layer-switch { padding-block: 6px; }
.studio-shell[data-view="perform"] .layer-switch button { min-height: 48px; }
.studio-shell[data-view="perform"] .preset-strip { padding-block: 6px; }
.studio-shell[data-view="perform"] .stage-layout { grid-template-columns: 1fr; min-height: 0; }
.studio-shell[data-view="perform"] .pad-surface { padding: 12px 28px 14px; border-right: 0; }
.studio-shell[data-view="perform"] .surface-heading { margin-bottom: 7px; }
.studio-shell[data-view="perform"] .pad-grid { width: min(100%, 980px); margin-inline: auto; gap: 9px; }
.studio-shell[data-view="perform"] .studio-pad { min-height: 72px; aspect-ratio: 3.1 / 1; }
.studio-shell[data-view="perform"] .performance-readout { width: min(100%, 980px); margin-inline: auto; margin-top: 9px; }
.studio-shell[data-view="perform"] .surface-heading { width: min(100%, 980px); margin-inline: auto; margin-bottom: 7px; }

@keyframes queue-pulse {
  from { box-shadow: inset 0 0 0 1px rgb(255 191 74 / 14%), 0 4px 0 #070909; }
  to { box-shadow: inset 0 0 18px rgb(255 191 74 / 16%), 0 4px 0 #070909, 0 0 18px rgb(255 191 74 / 10%); }
}

@media (max-width: 1180px) {
  .header-actions { gap: 10px; }
  .engine-status { display: none; }
  .transport-deck { grid-template-columns: auto minmax(250px, 1fr) minmax(140px, 0.5fr) minmax(240px, 0.9fr); }
  .transport-deck .range-control:nth-of-type(2) { display: none; }
  .stage-rail { grid-template-columns: 1fr; }
  .layer-switch { border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-layout { grid-template-columns: minmax(560px, 1fr) minmax(300px, 0.45fr); }
}

@media (max-width: 900px) {
  .studio-shell { width: min(100% - 14px, 760px); min-height: calc(100vh - 14px); margin: 7px auto; border-radius: 12px; }
  .studio-header { align-items: flex-start; min-height: 102px; padding: 17px 18px; }
  .header-actions { align-items: flex-start; }
  .view-switch button { min-width: 72px; }
  .view-switch small { display: none; }
  .stop-all { min-width: 45px; padding: 0 11px; font-size: 0; }
  .stop-all::after { content: "STOP"; font: 800 0.5rem/1 var(--mono); letter-spacing: 0.06em; }
  .stop-all > span { width: 10px; height: 10px; }
  .stop-all kbd { font-size: 0.48rem; }
  .transport-deck { grid-template-columns: auto minmax(230px, 1fr); }
  .transport-deck > * { padding: 13px 15px; }
  .transport-deck .range-control { display: none; }
  .stage-layout { grid-template-columns: 1fr; }
  .pad-surface { border-right: 0; border-bottom: 1px solid var(--line); }
  .build-panel { min-height: 440px; }
  .pad-grid { grid-template-columns: repeat(4, minmax(76px, 1fr)); gap: 8px; }
  .studio-pad { min-height: 84px; }
  .studio-shell[data-view="perform"] .studio-header { min-height: 78px; }
  .studio-shell[data-view="perform"] .stage-rail { grid-template-columns: 1fr; }
  .studio-shell[data-view="perform"] .preset-strip { display: flex; align-items: center; }
  .studio-shell[data-view="perform"] .preset-copy { min-width: 130px; }
  .studio-shell[data-view="perform"] .studio-pad { min-height: 92px; aspect-ratio: 1 / 0.72; }
}

@media (max-width: 580px) {
  .studio-header { min-height: 94px; }
  .eyebrow { font-size: 0.45rem; }
  h1 { font-size: clamp(1.85rem, 9vw, 2.55rem); }
  .tool-switcher { margin-top: 5px; }
  .tool-switcher a { padding: 4px 5px; font-size: 0.45rem; }
  .header-actions { gap: 6px; }
  .view-switch { padding: 2px; }
  .view-switch button { min-width: 54px; min-height: 38px; padding: 5px 7px; }
  .view-switch span { font-size: 0.5rem; }
  .stop-all { min-width: 54px; min-height: 42px; gap: 5px; padding-inline: 7px; }
  .stop-all kbd { display: none; }
  .stop-all::after { flex: 0 0 auto; }
  .transport-deck { grid-template-columns: 1fr; }
  .transport-actions { justify-content: stretch; border-right: 0; border-bottom: 1px solid var(--line); }
  .transport-actions .transport-button:first-child { flex: 1; }
  .tempo-control { display: none; }
  .bar-monitor { min-height: 61px; }
  .stage-rail { display: flex; flex-direction: column; }
  .layer-switch { padding: 8px; }
  .layer-switch button { min-height: 57px; padding: 8px 10px; }
  .layer-switch strong { font-size: 0.93rem; }
  .layer-switch span { display: none; }
  .preset-strip { display: block; padding: 11px 13px 8px; }
  .preset-copy { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: baseline; }
  .preset-copy strong { margin-top: 0; text-align: right; }
  .preset-copy small { grid-column: 1 / -1; margin-top: 2px; }
  .preset-buttons { margin-top: 5px; }
  .preset-buttons button { min-width: 86px; min-height: 41px; }
  .pad-surface { padding: 18px 14px 15px; }
  .surface-heading { align-items: flex-start; }
  .surface-heading h2 { font-size: 1.06rem; }
  .surface-heading > p { max-width: 150px; font-size: 0.5rem; }
  .pad-grid { grid-template-columns: repeat(4, minmax(58px, 1fr)); gap: 7px; }
  .studio-pad { min-height: 68px; aspect-ratio: 1 / 0.83; padding: 8px; border-radius: 6px; }
  .pad-topline { font-size: 0.43rem; }
  .pad-topline kbd { min-width: 20px; padding: 3px; font-size: 0.46rem; }
  .pad-name { font-size: clamp(0.5rem, 2.4vw, 0.65rem); }
  .pad-mode { margin-top: 4px; font-size: 0.39rem; }
  .performance-readout { grid-template-columns: 1fr 1fr; }
  .performance-readout > div { padding: 10px 9px; }
  .performance-readout > div:nth-child(3) { grid-column: 1 / -1; border-top: 1px solid var(--line-soft); border-right: 0; }
  .keyboard-help { display: grid; gap: 7px; }
  .build-panel { min-height: 410px; padding: 20px 17px; }
  .step-grid { gap: 7px; }
  .step-button { min-height: 42px; }
  .studio-footer { display: block; padding: 10px 15px; }
  .studio-footer > p:first-child { display: none; }
  #messageLine { max-width: none; text-align: left; }
  .studio-shell[data-view="perform"] { width: calc(100% - 8px); margin: 4px; border-radius: 9px; }
  .studio-shell[data-view="perform"] .studio-header { min-height: 70px; padding: 10px 12px; }
  .studio-shell[data-view="perform"] h1 { font-size: 1.8rem; }
  .studio-shell[data-view="perform"] .transport-deck { grid-template-columns: 1fr; }
  .studio-shell[data-view="perform"] .bar-monitor { display: grid; }
  .studio-shell[data-view="perform"] .preset-copy { min-width: 0; }
  .studio-shell[data-view="perform"] .pad-surface { padding: 13px 9px 12px; }
  .studio-shell[data-view="perform"] .studio-pad { min-height: 65px; aspect-ratio: 1 / 0.84; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .studio-pad.is-triggered,
  .step-button.is-playhead { transform: none; }
}
