body.performance-open {
  overflow: hidden;
}
.performance-stage {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(12px, 2vw, 32px);
  min-width: 0;
  scrollbar-color: var(--line) var(--bg);
}
.performance-stage:fullscreen {
  width: 100%;
  height: 100%;
}
.stage-header {
  display: flex;
  align-items: center;
  gap: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  flex-shrink: 0;
}
.stage-header::before {
  content: "";
  position: absolute;
  top: -32px;
  left: 0;
  right: 0;
  height: 32px;
  background: var(--bg);
}
.stage-brand {
  font:
    italic 30px Georgia,
    serif;
  white-space: nowrap;
}
.stage-brand span {
  color: var(--accent);
  margin-left: 10px;
}
.stage-state {
  color: var(--muted);
  font: 12px var(--mono);
}
.stage-state[data-playing="true"] {
  color: var(--input);
}
.stage-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.stage-actions button {
  min-height: 36px;
  padding: 7px 14px;
  font-size: 12px;
}
.stage-clock {
  display: flex;
  gap: clamp(16px, 4vw, 70px);
  align-items: center;
  padding: 14px 0 18px;
}
.stage-tempo {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.stage-tempo output {
  font: clamp(40px, 5.5vw, 84px)/1 var(--mono);
  letter-spacing: -0.06em;
}
.stage-tempo span {
  color: var(--muted);
  font: 11px var(--mono);
}
.stage-beats {
  display: flex;
  flex: 1;
  max-width: 400px;
  gap: 10px;
}
.stage-beats i {
  flex: 1;
  padding: 10px 0;
  border-bottom: 3px solid var(--line);
  color: var(--faint);
  font: 13px var(--mono);
  text-align: center;
}
.stage-beats i[data-active="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.stage-harmony {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.stage-harmony output {
  font:
    clamp(34px, 4vw, 60px)/1 Georgia,
    serif;
}
.stage-harmony span,
.stage-bar {
  color: var(--muted);
  font: 12px var(--mono);
}
.stage-bar {
  margin-left: auto;
  white-space: nowrap;
}
.stage-notice {
  color: var(--error);
  padding: 8px 0;
  font-size: 12px;
}
.stage-body {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr);
  min-height: 360px;
  border-top: 1px solid var(--line);
  gap: clamp(20px, 3vw, 48px);
}
.stage-section-title {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font: 11px var(--mono);
  letter-spacing: 0.06em;
  padding: 16px 0;
}
.stage-kit-section {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.stage-kit {
  position: relative;
  flex: 1;
  min-height: 0;
  max-height: 770px;
  container-type: size;
  display: grid;
  place-items: center;
}
/* Pads use one fixed 5:4 coordinate system so short or wide stages never overlap. */
.stage-kit-stage {
  position: relative;
  width: min(100cqw, 125cqh);
  aspect-ratio: 5 / 4;
}
.stage-pad {
  --hit: 0;
  position: absolute;
  width: 25%;
  aspect-ratio: 1;
  padding: 0;
  background: transparent;
  border: 0;
  display: block;
  color: var(--fg);
  border-radius: 50%;
}
.stage-pad:hover {
  background: transparent;
  color: var(--fg);
}
.stage-pad:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}
.stage-pad svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.stage-ring {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.3;
}
.stage-disc {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 1;
}
.stage-pad[data-active="true"] .stage-disc {
  fill: var(--selection);
  stroke: var(--input);
  stroke-width: calc(1px + var(--hit) * 5px);
}
.stage-pad[data-active="true"] .stage-pad-name {
  color: var(--input);
}
.stage-onsets line {
  stroke: var(--input);
  stroke-width: 2.2;
}
.stage-phase {
  stroke: var(--accent);
  stroke-width: 1.6;
}
.stage-pad-name {
  position: absolute;
  top: 36%;
  left: 0;
  width: 100%;
  font:
    600 clamp(11px, 1.3vw, 21px)/1.2 system-ui,
    sans-serif;
}
.stage-pad-meter {
  position: absolute;
  top: 51%;
  left: 0;
  width: 100%;
  font: clamp(10px, 1.1vw, 16px)/1.4 var(--mono);
  color: var(--accent);
  white-space: nowrap;
}
.stage-pad-confidence {
  position: absolute;
  top: 91%;
  left: -15%;
  width: 130%;
  font: clamp(9px, 0.8vw, 12px)/1.4 var(--mono);
  color: var(--muted);
}
.stage-pad-crash {
  left: 17%;
  top: 1%;
  width: 25%;
}
.stage-pad-ride {
  right: 3%;
  top: 2%;
  width: 28%;
}
.stage-pad-high {
  left: 37%;
  top: 23%;
  width: 25%;
}
.stage-pad-low {
  right: 1%;
  top: 40%;
  width: 28%;
}
.stage-pad-hat {
  left: 0;
  top: 40%;
  width: 24%;
}
.stage-pad-open {
  left: 0;
  top: 4%;
  width: 17%;
}
.stage-pad-snare {
  left: 18%;
  bottom: 11%;
  width: 28%;
}
.stage-pad-kick {
  left: 45%;
  bottom: 2%;
  width: 31%;
}
.stage-key {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  padding: 18px 0;
  color: var(--muted);
  font: 11px var(--mono);
}
.stage-output-section {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.stage-output-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  min-height: 0;
  scrollbar-gutter: stable;
}
.stage-output {
  border-top: 1px solid var(--line);
  padding: 10px 0 12px;
  contain: layout;
}
.stage-output[data-muted="true"] {
  opacity: 0.6;
}
.stage-output-head {
  display: flex;
  gap: 12px;
  align-items: center;
}
.stage-output-head strong {
  font-size: clamp(13px, 1.1vw, 18px);
  min-width: 0;
  overflow-wrap: anywhere;
}
.stage-output-route {
  color: var(--muted);
  font: 10px var(--mono);
  white-space: nowrap;
}
.stage-output-mute {
  margin-left: auto;
  font-size: 10px;
  padding: 3px 7px;
  min-height: 28px;
}
.stage-output-score {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  padding: 10px 0 6px;
}
.stage-output-notes {
  font: clamp(16px, 1.5vw, 24px) var(--mono);
  color: var(--muted);
}
.stage-output[data-active="true"] .stage-output-notes {
  color: var(--accent);
}
.stage-output-detail {
  color: var(--muted);
  font: 10px var(--mono);
  text-align: right;
}
.stage-output-track {
  height: 20px;
  position: relative;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.stage-output-track i {
  position: absolute;
  width: 3px;
  bottom: 0;
  background: var(--accent);
}
.stage-count-cycle {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding-top: 8px;
}
.stage-count-cycle span {
  font: 11px var(--mono);
  min-width: 22px;
  padding: 3px;
  color: var(--muted);
  text-align: center;
  border-bottom: 2px solid transparent;
}
.stage-count-cycle [data-next="true"] {
  color: var(--accent);
  border-color: var(--accent);
}
.stage-output-next {
  display: block;
  color: var(--muted);
  font: 10px var(--mono);
  padding-top: 5px;
}
.stage-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding-top: 12px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 11px var(--mono);
}
.stage-footer label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.stage-footer input {
  accent-color: var(--accent);
}
.stage-fullscreen-status {
  font-size: 10px;
}
.stage-empty {
  color: var(--muted);
  font-size: 13px;
}
@media (min-width: 901px) and (max-height: 820px) {
  .stage-clock {
    padding: 10px 0;
  }
  .stage-body {
    min-height: 330px;
  }
  .stage-output {
    padding: 5px 0 7px;
  }
  .stage-output-score {
    padding: 5px 0 3px;
  }
  .stage-section-title {
    padding: 12px 0;
  }
  .stage-output-track {
    height: 10px;
  }
  .stage-output-mute {
    min-height: 24px;
  }
  .stage-count-cycle {
    padding-top: 4px;
  }
  .stage-output-next {
    font-size: 9px;
  }
  .stage-key {
    padding: 10px 0;
  }
}
@media (max-width: 900px) {
  .stage-body {
    flex: 0 0 auto;
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .stage-output-list {
    overflow: visible;
  }
  .stage-kit {
    height: min(70vw, 560px);
    min-height: 330px;
    flex: none;
  }
  .stage-pad-name {
    font-size: clamp(11px, 2.2vw, 19px);
  }
  .stage-pad-meter {
    font-size: clamp(10px, 1.8vw, 15px);
  }
  .stage-pad-confidence {
    font-size: 9px;
  }
  .stage-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .stage-actions {
    gap: 5px;
  }
  .stage-actions button {
    padding: 6px 9px;
  }
  .stage-clock {
    gap: 18px;
    flex-wrap: wrap;
  }
  .stage-harmony {
    gap: 8px;
  }
  .stage-harmony span {
    font-size: 10px;
  }
  .stage-beats {
    order: 4;
    flex-basis: 100%;
    max-width: none;
  }
  .stage-beats i {
    padding: 2px 0;
  }
  .stage-output-route {
    margin-left: auto;
  }
  .stage-output-mute {
    margin-left: 0;
  }
  .stage-key {
    font-size: 9px;
    gap: 14px;
  }
}
@media (max-width: 480px) {
  .stage-actions {
    width: 100%;
  }
  .stage-actions button {
    flex: 1;
  }
  .stage-state {
    margin-left: auto;
  }
  .stage-footer label {
    margin-left: 0;
  }
  .stage-route-label {
    display: none;
  }
  .stage-fullscreen-status {
    max-width: 160px;
  }
  .stage-output-head {
    gap: 8px;
  }
  .stage-pad-ride .stage-pad-meter {
    font-size: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stage-output-track i {
    left: auto !important;
    position: relative;
    float: right;
    margin-left: 4px;
  }
  .stage-phase {
    display: none;
  }
}
.stage-recording {
  display: block;
  color: var(--error);
  font: 12px var(--mono);
  padding: 6px 0;
}
.stage-recording[hidden] {
  display: none;
}
.stage-beats[data-count] i {
  min-width: 0;
}
.stage-beats[data-count="9"] i,
.stage-beats[data-count="11"] i,
.stage-beats[data-count="12"] i,
.stage-beats[data-count="13"] i,
.stage-beats[data-count="15"] i,
.stage-beats[data-count="16"] i {
  font-size: 10px;
}
.stage-state[data-breakdown="true"] {
  color: var(--accent);
}
.stage-actions [data-action="section"][hidden] {
  display: none;
}
