:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #141312;
  color: #f5f1e9;
  --surface: #201d1a;
  --inset: #191714;
  --border: #3a342e;
  --muted: #bfb4a7;
  --accent: #f3c491;
  --accent-ink: #26180d;
  --radius: 20px;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, select, input { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.topbar { border-bottom: 1px solid var(--border); }
.topbar-inner, .shell { width: min(76rem, 100% - 3rem); margin-inline: auto; }

.topbar-inner {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  font-weight: 690;
  letter-spacing: -0.025em;
}

.brand-mark {
  display: grid;
  justify-items: center;
  align-items: start;
  width: 2.25rem;
  height: 2.25rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--surface);
}

.brand-mark img { width: 1.45rem; height: auto; margin-top: 0.34rem; }
.brand-secondary { color: var(--muted); }
.session-note { font-size: 0.8rem; color: var(--muted); text-align: right; }

.shell { padding-block: 1.15rem 3.5rem; }
h1, h2, p { margin: 0; }
h2 { font-size: 1.125rem; letter-spacing: -.02em; }
p { color: var(--muted); line-height: 1.5; }
.settings { scroll-margin-top: 1.25rem; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 17.5rem) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}

.settings, .arrangement, .mixer, .takes {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}

.settings { display: grid; gap: 1.05rem; padding: 1.25rem; }
.field { display: grid; gap: 0.45rem; min-width: 0; }
.field label { font-size: 0.85rem; font-weight: 600; }
.field-detail { min-height: 2.6em; font-size: 0.78rem; }

select, input[type="number"] {
  width: 100%;
  min-width: 0;
  min-height: 2.7rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--inset);
  color: inherit;
  font-size: 0.9rem;
}

.primary, .secondary, .play {
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  font-weight: 680;
}

.primary, .play {
  background: var(--accent);
  color: var(--accent-ink);
}

.primary { padding: 0.65rem; }
.primary:hover:not(:disabled), .play:hover:not(:disabled) { background: #ffdaa9; }
.primary:disabled { background: #4a3c30; color: #e2d4c6; cursor: wait; }
.primary:active, .secondary:active:not(:disabled), .play:active:not(:disabled) { transform: scale(0.98); }

.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 0.85rem;
  gap: 0.5rem;
  background: var(--inset);
  border-color: var(--border);
  color: inherit;
  text-decoration: none;
}

.secondary:hover:not(:disabled) { background: #332b24; }
.secondary:disabled { opacity: 0.55; }
.loop[aria-pressed="true"]:not(:disabled) { color: var(--accent); border-color: #826045; }
.export { white-space: nowrap; }

.arrangement { padding: 1.25rem; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.panel-heading p { margin-top: 0.3rem; font-size: 0.85rem; }

.timeline {
  margin-top: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--inset);
}

.ruler {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0.65rem 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.ruler span { padding-left: 0.65rem; }

.sections {
  display: flex;
  min-height: 2.25rem;
  gap: 3px;
  margin-inline: 0.35rem;
}

.section-block {
  min-width: 0;
  overflow: hidden;
  padding: 0.45rem 0.4rem;
  border: 0;
  border-radius: 0.45rem;
  background: #332a25;
  color: #ecded1;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 600;
}

.section-block:nth-child(2) { background: #4d382a; }
.section-initial { display: none; }
.section-block:disabled { cursor: default; }
.section-block:hover:not(:disabled) { background: #604432; }
.section-block:focus-visible { outline-offset: -2px; }

.waveform {
  position: relative;
  min-height: 11rem;
  background:
    linear-gradient(to right, #382f26 1px, transparent 1px) 0 0 / 25% 100%,
    linear-gradient(#382f26, #382f26) center / 100% 1px no-repeat;
}

#wave, .seek { position: absolute; inset: 0; width: 100%; height: 100%; }

.empty-wave {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 1rem;
  text-align: center;
  pointer-events: none;
}

.empty-wave span { color: var(--muted); background: var(--inset); padding-inline: 0.6rem; font-size: 1.7rem; }
.empty-wave p { margin-top: 0.3rem; font-size: 0.85rem; }

.seek { appearance: none; margin: 0; background: transparent; cursor: ew-resize; }
.seek:disabled { display: none; }
.seek:focus-visible { outline-offset: -3px; }
.seek::-webkit-slider-thumb { appearance: none; width: 2px; height: 11rem; background: #ffe9cb; cursor: ew-resize; }
.seek::-moz-range-thumb { width: 2px; height: 11rem; border: 0; border-radius: 0; background: #ffe9cb; cursor: ew-resize; }

.transport {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.transport-controls { display: flex; gap: 0.4rem; align-items: center; }
.play { display: grid; place-items: center; width: 2.9rem; }
.play:disabled { opacity: 0.5; }
.play span { width: 0; height: 0; border-block: 0.37rem solid transparent; border-left: 0.62rem solid currentColor; margin-left: 0.1rem; }
.play[data-playing="true"] span { width: 0.68rem; height: 0.75rem; margin: 0; border: solid currentColor; border-width: 0 0.21rem; }

.clock { color: var(--muted); font-size: 0.83rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
#elapsed { color: #f3f5f0; }
.clock-divider { margin-inline: 0.35rem; }
.volume {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.volume input { width: 5.5rem; min-height: 2rem; margin: 0; accent-color: var(--accent); }
.status { margin-top: 0.7rem; min-height: 1.5em; font-size: 0.8rem; }
.status[data-error="true"] { color: #ffc6b4; }

.mixer, .takes { grid-column: 2; padding: 1.25rem; }
.track-list { display: grid; gap: 0.65rem; margin-top: 1rem; }
.track { padding: 0.65rem; border: 1px solid var(--border); border-radius: 0.75rem; background: var(--inset); }
.track-heading { display: grid; grid-template-columns: minmax(5.5rem, 0.23fr) minmax(0, 1fr); gap: 0.65rem; align-items: center; }
.track h3 { margin: 0; font-size: 0.85rem; overflow-wrap: anywhere; }
.track-wave {
  position: relative;
  overflow: hidden;
  border-radius: 0.45rem;
  background-color: color-mix(in srgb, var(--track-color) 19%, var(--inset));
  background-image: linear-gradient(to right, #fff1 1px, transparent 1px);
  background-size: 25% 100%;
}
.track-wave::after { position: absolute; content: ""; inset-block: 0; left: var(--position, 0%); width: 1px; background: #fff9; pointer-events: none; }
.track canvas { width: 100%; height: 2.2rem; display: block; }
.track[data-inaudible="true"] .track-wave { opacity: 0.45; }
.track-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin-top: 0.35rem; }
.track-controls .secondary { min-height: 2.3rem; padding-inline: 0.55rem; }
.track-controls [aria-pressed="true"] { color: var(--accent); border-color: #826045; }
.track-level, .track-shift { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--muted); }
.track-level input { width: 4.5rem; margin: 0; min-height: 2.3rem; accent-color: var(--accent); }
.track-level span { min-width: 2.8rem; font-variant-numeric: tabular-nums; }
.track-shift select { min-width: 4.5rem; min-height: 2.3rem; padding: 0.3rem; font-size: 0.8rem; }
.track-edit { margin-top: 0.4rem; font-size: 0.78rem; color: var(--muted); }
.track-edit summary { width: fit-content; padding: 0.35rem 0; cursor: pointer; }
.file-input { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.import-action { white-space: nowrap; cursor: pointer; }
.mixer .panel-heading:has(.file-input:focus-visible) .import-action { outline: 2px solid var(--accent); outline-offset: 4px; }
.mixer .panel-heading:has(.file-input:disabled) .import-action { opacity: 0.55; cursor: default; }
#import-note { min-height: 0; margin-top: 0.55rem; }
.empty-takes { margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--border); font-size: 0.85rem; }
.take-list { margin: 0; padding: 0; list-style: none; }
.take-list:not(:empty) { margin-top: 0.75rem; }

.take {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem 0.65rem;
  min-height: 3.25rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  padding: 0.55rem 0.65rem;
  color: inherit;
  background: transparent;
  text-align: left;
  font-size: 0.85rem;
}

.take:hover { background: #312822; }
.take[aria-pressed="true"] { background: #392c23; border-color: #77573c; }
.take span:last-child { color: var(--muted); font-size: 0.75rem; }

@media (max-width: 760px) {
  .topbar-inner, .shell { width: calc(100% - 1.5rem); }
  .shell { padding-block: 0.75rem 2.5rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .mixer, .takes { grid-column: 1; }
  .settings, .arrangement, .mixer, .takes { padding: 0.9rem; }
  .settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings h2, .settings .field:first-of-type, .primary { grid-column: 1 / -1; }
  .arrangement { scroll-margin-top: 0.75rem; }
  .transport { flex-wrap: wrap; }
  .volume { flex-basis: 100%; }
  .section-block:has(.section-initial) { font-size: 0; padding-inline: 0.18rem; text-align: center; }
  .section-initial { display: inline; font-size: 0.75rem; }
}

@media (max-width: 360px) {
  .panel-heading { align-items: flex-start; }
  .export { padding-inline: 0.45rem; font-size: 0.72rem; }
  .export span { display: none; }
  .clock-divider { margin-inline: 0.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .primary:active, .secondary:active:not(:disabled), .play:active:not(:disabled) { transform: none; }
}

:root { --surface: #202223; --inset: #151718; --border: #393d3e; --muted: #b6bbba; --radius: 9px; background: #151718; }
.topbar-inner, .shell { width: min(106rem, 100% - 2rem); }
.topbar-inner { min-height: 3.25rem; }
.room-title { margin: 0 0 .9rem; font-size: 1.5rem; letter-spacing: -.035em; }
.workspace { grid-template-columns: 15rem minmax(0, 1fr); gap: .65rem; }
.settings { grid-row: 1 / span 2; }
.sequencer, .rhythm { grid-column: 2; padding: 1rem; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.arrangement .transport { margin: .75rem 0; }
.note-tools, .note-footer { display: flex; flex-wrap: wrap; gap: .65rem 1.25rem; align-items: center; margin: .8rem 0; }
.note-tools label { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .85rem; }
.note-tools select { width: auto; }
.note-tools input { width: 6rem; accent-color: var(--accent); }
.note-footer { justify-content: space-between; margin-bottom: 0; font-size: .85rem; }
.roll-scroll { overflow-x: auto; }
#roll { display: grid; grid-template-columns: 3rem repeat(8, minmax(2rem, 1fr)); min-width: 19rem; gap: 1px; background: #383d3d; }
#roll > * { min-height: 1.5rem; }
.roll-key, .roll-beat { display: grid; place-items: center; font: .74rem ui-monospace, monospace; color: #e5e8e7; background: #353a3a; }
.roll-key.sharp { background: #181b1c; }
.roll-cell { border: 0; padding: 2px; border-radius: 0; background: #25292a; position: relative; }
.roll-cell.downbeat { background: #2d3132; }
.roll-cell[aria-pressed=true]::after { content: ""; display: block; background: #e9af73; border-radius: 2px; width: var(--gate); height: .8rem; opacity: var(--strength); }
.roll-cell:focus-visible { z-index: 1; outline-offset: -2px; }
.workspace.expanded { grid-template-columns: minmax(0,1fr); }
.expanded .sequencer { grid-column: 1; grid-row: 1; }
.expanded .settings, .expanded .mixer, .expanded .takes { grid-column: 1; grid-row: auto; }
.expanded .roll-cell { min-height: 2.25rem; }
@media (max-width: 760px) {
 .workspace { grid-template-columns: minmax(0,1fr); }
 .settings, .sequencer { grid-row: auto; grid-column: 1; }
 .topbar-inner, .shell { width: calc(100% - 1rem); }
 .sequencer { padding: .75rem; }
}
.mic-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-block: .8rem; }
#mic-status { font-size: .85rem; color: var(--muted); }

/* Session console */
@font-face { font-family: "IBM Plex Sans"; src: url("./plex-sans.woff2") format("woff2"); font-weight: 100 700; font-display: swap; }
:root {
  color-scheme: dark;
  --surface: #1e2228;
  --inset: #15181e;
  --border: #393e46;
  --muted: #aeb6c0;
  --accent: #f6bc74;
  --accent-ink: #21170a;
  --radius: 5px;
  background: #111419;
  color: #eef1f4;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.topbar { background: #20242b; border-bottom: 1px solid #484d54; }
.topbar-inner, .shell { width: min(110rem, calc(100% - clamp(1rem,4vw,4rem))); }
.topbar-inner { min-height: 3.4rem; }
.brand { gap: .5rem; font-size: 1.18rem; letter-spacing: -.055em; }
.brand-mark { width: 2rem; height: 2rem; border: 0; background: transparent; }
.brand-mark img { width: 1.6rem; margin-top: 0; }
.brand-secondary { color: #afbac8; font-weight: 460; }
.top-actions { display: flex; align-items: center; gap: 1.4rem; }
.top-actions button { min-height: 2.1rem; }
.session-note { display: flex; align-items: center; gap: .45rem; }
.session-note::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #84c8ab; }
.shell { padding-block: 0 2rem; }
.room-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem 1rem; padding: 1.2rem 0 1rem; }
.room-title { font-size: clamp(1.7rem,3vw,2.75rem); line-height: 1.05; letter-spacing: -.055em; margin: 0; overflow-wrap: anywhere; }
#session-format, .field label, .ruler, .roll-beat, .clock, .lane-names, .status { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
#session-format { color: var(--muted); font-size: .75rem; }
.workspace { grid-template-columns: clamp(13.5rem,20%,18rem) minmax(0,1fr); gap: .85rem; }
.side-column, .main-column { min-width: 0; display: grid; align-content: start; gap: .75rem; }
.workspace :is(.settings,.takes,.arrangement,.sequencer,.rhythm,.mixer) { display: block; padding: 0; grid-row: auto; grid-column: 1; border-radius: var(--radius); background: var(--surface); }
.widget > summary { display: flex; align-items: center; gap: .65rem; cursor: pointer; padding: .75rem .95rem; min-height: 2.6rem; list-style: none; }
.widget > summary::-webkit-details-marker { display: none; }
.widget > summary::before { content: ""; width: .36rem; height: .36rem; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); }
.widget[open] > summary::before { transform: translateY(-2px) rotate(45deg); }
.widget[open] > summary { border-bottom: 1px solid var(--border); }
.widget > summary:hover { background: #ffffff06; }
.widget > summary:focus-visible { outline-offset: -3px; }
.widget h2 { font-size: .95rem; letter-spacing: -.015em; }
.widget-body { min-width: 0; padding: .8rem .95rem; }
.settings .widget-body { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem .5rem; }
.settings .field:first-of-type, .settings .primary { grid-column: 1/-1; }
.field { gap: .35rem; }
.field label { font-size: .72rem; color: var(--muted); }
.field-detail { min-height: 0; }
input[type=number], select, .primary, .secondary, .play { min-height: 2.25rem; border-radius: 4px; }
.secondary { background: #2c3139; border-color: #454b55; }
.secondary:hover:not(:disabled) { background: #383e48; }
.panel-heading { flex-wrap: wrap; }
.panel-heading p { margin: 0; }
.arrangement .widget-body { display: grid; grid-template-columns: minmax(0,1fr) auto; padding: 0; }
.arrangement .panel-heading { grid-column: 1/-1; padding: .55rem .9rem; }
.arrangement .transport { grid-column: 1/-1; flex-wrap: wrap; justify-content: flex-start; margin: 0; padding: .7rem .9rem; background: #292f36; border-block: 1px solid #3a414a; gap: .65rem 1.1rem; }
.transport-controls { gap: .25rem; }
.clock { display: flex; align-items: baseline; padding: .28rem .65rem; border: 1px solid #3c454e; border-radius: 3px; background: #101419; }
#elapsed { font-size: 1.45rem; color: #c7ebdf; line-height: 1; letter-spacing: -.045em; }
.volume { margin-left: auto; }
.mic-controls { grid-column: 1/-1; margin: 0; padding: .55rem .9rem; }
#record-voice { color: #ffb5b1; border-color: #795053; background: #34272c; }
#record-voice:enabled:hover { background: #492e34; }
#record-voice[data-recording=true] { background: #a6353f; color: white; }
.timeline { grid-column: 1/-1; margin: 0; border: 0; border-block: 1px solid var(--border); border-radius: 0; background: #13171d; --gutter: clamp(4rem,11vw,8rem); }
.ruler, .sections { margin-left: var(--gutter); }
.ruler { background: #191e25; padding-block: .45rem; }
.sections { min-height: 1.45rem; margin-right: 0; gap: 2px; }
.section-block { padding: .18rem .5rem; border-radius: 0; color: #d5e4f1; background: #334353; border-top: 2px solid #7399b2; }
.section-block:nth-child(2) { background: #36483f; color: #c6ddcf; border-color: #7da38e; }
.waveform { display: grid; grid-template-columns: var(--gutter) minmax(0,1fr); min-height: 0; background: none; }
.lane-names { display: grid; grid-auto-rows: 1fr; min-width: 0; background: #242a32; }
.lane-names span { display: flex; align-items: center; overflow: hidden; padding: 0 .55rem; border-bottom: 1px solid #373e48; border-left: 3px solid var(--lane-color,#7b9eaf); font-size: .7rem; line-height: 1.25; overflow-wrap: anywhere; }
.lane-names span:nth-child(2) { --lane-color: #c79099; }
.lane-plot { position: relative; min-width: 0; height: calc(var(--lanes,2) * 2.85rem); overflow: hidden;
  background: repeating-linear-gradient(0deg, #353b44 0 1px, transparent 1px 2.85rem),
              linear-gradient(90deg,#656f803d 1px,transparent 1px) 0 0 / 12.5% 100%, #171c23; }
.empty-wave { padding: .25rem; pointer-events: auto; }
.empty-wave button { border: 1px solid #576575; background: #252e39; color: #e3edf5; padding: .4rem .75rem; border-radius: 4px; font-weight: 600; }
.empty-wave p { font-size: .73rem; margin: .2rem 0 0; }
.seek::-webkit-slider-thumb { height: 32rem; background: #ffc580; }
.seek::-moz-range-thumb { height: 32rem; background: #ffc580; }
.arrangement .status { grid-column: 1/-1; margin: 0; min-height: 0; padding: .45rem .9rem; font-size: .7rem; }
.status:empty { display: none; }
.note-tools label { max-width: 100%; min-width: 0; }
#instrument { max-width: 14rem; min-width: 0; }
.roll-key:not(.sharp) { background: #b8c0c8; color: #17212a; }
.roll-cell { background: #202731; }
.roll-cell.downbeat { background: #29313d; }
.roll-cell:hover { background: #414f5e; }
.roll-cell[aria-pressed=true]::after { background: #f3b56e; }
.track { border-radius: 4px; border-left: 3px solid var(--track-color); background: #181d23; }
.track-wave { border-radius: 2px; }
.track-list { gap: .4rem; }
.track-controls { column-gap: .7rem; }
.transfer .widget-body { display: grid; gap: .55rem; }
.transfer p, .transfer a { font-size: .8rem; line-height: 1.5; }
.transfer a { color: var(--accent); }
.transfer p:empty { display: none; }
.workspace.expanded .main-column { display: contents; }
.workspace.expanded .sequencer { grid-row: 1; }
@media (max-width:760px) {
  .workspace { grid-template-columns: minmax(0,1fr); }
  .side-column, .main-column { gap: .45rem; }
  .volume { flex-basis: auto; }
  .room-heading { padding: .8rem 0; }
  .lane-names span { padding-inline: .25rem; }
  .session-note { display: none; }
  .widget-body { padding-inline: .7rem; }
}

.ruler { position: relative; min-height: 1.75rem; }
.ruler span { position: absolute; top: .4rem; padding-left: .28rem; }
.input-meter { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .75rem; }
.input-meter meter { width: 5rem; }
.mic-controls { min-height: 2.15rem; }
.track-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,15rem),1fr)); }
.track-heading { grid-template-columns: 1fr; }
.track-wave { height: 1.4rem; }
.track canvas { height: 100%; }
.track h3 { font-weight: 620; }
.track-controls { column-gap: .4rem; }
.track-controls .secondary, .track-shift select { min-height: 1.9rem; }
.take[aria-pressed=true] { background: #303a46; border-color: #586575; }
#take-label { font-weight: 520; }
#roll-mode { width: auto; margin-left: .5rem; }
.free-tools { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .8rem; margin-bottom: .7rem; }
.free-tools label { display: flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); }
.free-tools input { width: 5.2rem; font-variant-numeric: tabular-nums; }
.free-tools select { width: auto; }
.free-surface { display: grid; grid-template-columns: 3.1rem minmax(0,1fr); border: 1px solid var(--border); --key-height: 1.45rem; }
.free-scroll { overflow-x: auto; }
#free-keys { display: grid; grid-template-rows: repeat(13,var(--key-height)); padding-top: 1.5rem; background: #20252b; }
#free-keys span { font: .69rem ui-monospace,monospace; padding: .25rem .4rem; color: #202630; background: #d4d8dc; border-bottom: 1px solid #848b94; }
#free-keys span.sharp { color: #e4e8ed; background: #353b43; }
#free-ruler { display: flex; align-items: center; height: 1.5rem; color: var(--muted); font: .66rem ui-monospace,monospace; }
#free-ruler span { flex: 1; padding-left: .25rem; white-space: nowrap; }
#free-grid { position: relative; height: calc(13 * var(--key-height)); cursor: crosshair; touch-action: none;
  background: repeating-linear-gradient(to bottom,transparent 0 calc(var(--key-height) - 1px),#454d59 calc(var(--key-height) - 1px) var(--key-height)),
              linear-gradient(to right,#65718365 1px,transparent 1px) 0 0 / 6.25% 100%, #242b34; }
.free-note { position: absolute; min-width: 2px; padding: 0; height: calc(100% / 13 - 1px); background: #cf914d; border: 1px solid #ffbf78; border-radius: 2px; cursor: grab; touch-action: none; }
.free-note[aria-pressed=true] { background: #ffbc75; box-shadow: inset 0 0 0 1px #fff0cf; }
.note-end { position: absolute; right: 0; top: 0; bottom: 0; width: min(35%,10px); border-right: 2px solid #664323; cursor: ew-resize; }
.free-help { margin-top: .45rem; font-size: .77rem; }
.workspace.expanded .free-surface { --key-height: 2rem; }
.drum-layout { display: grid; grid-template-columns: clamp(12rem,26%,18rem) minmax(0,1fr); gap: 1.25rem; align-items: start; }
.pads { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .28rem; padding: .35rem; border-radius: 5px; background: #101317; }
.pads button { position: relative; display: flex; flex-direction: column; justify-content: space-between; aspect-ratio: 1.18; min-width: 0; padding: .23rem .32rem; text-align: left; border: 1px solid #596672; border-bottom: 3px solid #738c97; border-radius: 4px; color: #e9eef1; background: linear-gradient(#3f4953,#333c45); }
.pads button:nth-child(n+5) { border-bottom-color: #93a98d; }
.pads button:nth-child(n+9) { border-bottom-color: #ab95b7; }
.pads button:nth-child(n+13) { border-bottom-color: #b99473; }
.pads button[aria-pressed=true] { background: #563e2d; border-color: #edb371; color: #ffe3c5; }
.pads button:active { background: #aa7343; }
.pads small { font: .62rem ui-monospace,monospace; opacity: .8; }
.pads span { font-size: .72rem; font-weight: 600; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-panel { min-width: 0; }
.drum-heading,.drum-knobs,.drum-actions { display:flex; gap: .55rem .85rem; align-items:center; flex-wrap:wrap; }
.drum-heading { justify-content:space-between; }
.drum-heading h3 { margin: 0; font-size: 1rem; }
.sample-load { position:relative; color: var(--muted); cursor:pointer; font-size:.8rem; text-decoration:underline; }
.sample-load input { position:absolute; inset:0; opacity:0; width:100%; cursor:pointer; }
.sample-load:focus-within {outline:2px solid var(--accent);}
.drum-steps { display:grid; grid-template-columns:repeat(16,minmax(0,1fr)); gap:3px; margin:.8rem 0; }
.drum-steps button { min-width:0; min-height:2.2rem; padding:0; border:1px solid #48505b; background:#2b3139; border-radius:3px; color:#c8ced7; font:.68rem ui-monospace,monospace; }
.drum-steps button:nth-child(4n+1) {border-left:2px solid #9babb8;}
.drum-steps button[aria-pressed=true] {background:#b97b48; color:white; opacity:var(--strength); border-color:#f6bd7b;}
.drum-steps button[data-playing=true] {box-shadow:inset 0 -3px #b2f0dc;}
.drum-knobs label { display:inline-flex; align-items:center; gap:.4rem; color:var(--muted); font-size:.8rem; }
.drum-knobs input[type=number] { width:4.5rem; }
.drum-knobs input[type=range] { width:5rem; accent-color:var(--accent); }
.drum-actions { margin-top:.75rem; }
.drum-actions [aria-pressed=true] { background:#49363a; border-color:#d69396; }
@media (max-width:960px) { .drum-steps { grid-template-columns:repeat(8,minmax(0,1fr)); } }
@media (max-width:600px) { .drum-layout {grid-template-columns:1fr;} .pads {max-width:18rem;} }

#drum-device { width: auto; max-width: 100%; }
.synth-rack { margin: .65rem 0 .85rem; background: #191b20; border: 1px solid #414349; border-radius: 4px; }
.synth-rack > summary { cursor: pointer; padding:.65rem .8rem; font-size:.95rem; font-weight:600; }
.synth-rack > summary span { font-size:.75rem; margin-left:.5rem; font-weight:400; color:var(--muted); }
.rack-body { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap:2px; padding:2px; background:#141519; }
.rack-body fieldset { margin:0; padding:.6rem; min-width:0; border:0; background:#292b30; }
.rack-body legend { float:left; width:100%; font-size:.78rem; font-weight:650; margin-bottom:.48rem; color:#f4ece5; }
.rack-body legend::before { content:""; display:inline-block; width:.45rem; height:.45rem; margin-right:.42rem; border-radius:50%; background:#ffad63; }
.rack-body canvas { clear:both; display:block; width:100%; height:6rem; background:#1a1b20; border-radius:2px; }
.rack-body .wt-envelope { grid-column:span 2; }
.wt-envelope canvas { height:3.6rem; }
.wt-controls { clear:both; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.55rem .8rem; padding-top:.55rem; }
.wt-controls label { display:grid; grid-template-columns:1fr auto; gap:.18rem; align-items:baseline; color:#d3d3d5; font-size:.73rem; }
.wt-controls output { font: .62rem ui-monospace,monospace; color:#eabc8f; }
.wt-controls input { grid-column:1/-1; width:100%; margin:0; accent-color:#ef9f55; }
.wt-mode { display:flex; align-items:center; gap:.4rem; margin-top:.45rem; font-size:.75rem; }
.wt-mode select { min-height:1.6rem; width:auto; font-size:.75rem; padding:.1rem; }
#wt-play { margin-top:.75rem; }
@media(max-width:1050px){.wt-controls {grid-template-columns:1fr;} .wt-envelope .wt-controls {grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:650px){.rack-body {grid-template-columns:1fr;} .rack-body .wt-envelope {grid-column:1;} .wt-controls {grid-template-columns:repeat(2,minmax(0,1fr));}}

#wt-response { cursor: crosshair; touch-action: none; }

#pilot select, #pilot-player { width: 100%; min-width: 0; }
#pilot .widget-body { display: grid; gap: .6rem; }
#pilot-lyrics p { white-space: pre-line; }
