/* oma — one object, one vocabulary. Everything snaps to 4px.
   Surface ladder: one step up per nesting level. */

/* the fonts, from here (fonts/, SIL Open Font License): nothing about a visitor goes elsewhere */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/bricolage-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/bricolage-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --window: #191816;
  --well: #0f0e0d;
  --pane: #211f1d;
  --card: #292725;
  --control: #302e2b;
  --control-hover: #3b3834;
  --fader-track: #36332f;
  --disc: #2a2826;
  --disc-hover: #322f2c;
  --line: #3d3a36;

  --ink: #ede7dd;
  --ink-2: #b3ab9f;
  --label: #878075;
  --silent: #5e5952;
  --hot: #f4efe6;

  --track: #ede7dd;
  --sans: 'Bricolage Grotesque', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--window);
  color: var(--ink);
  font: 500 12px/1.4 var(--sans);
  overflow: hidden;
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.spacer {
  flex: 1;
}

/* ---------- type ---------- */

.display {
  font: 750 26px/1 var(--sans);
  letter-spacing: -0.03em;
}

.label {
  font: 500 10px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label);
}

.value {
  font: 500 11px var(--mono);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.value.dim {
  color: var(--ink-2);
}

.word {
  color: var(--label);
}

/* ---------- window ---------- */

#app {
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr) 24px;
  gap: 8px;
  height: 100vh;
  min-width: 900px;
  min-height: 600px;
  padding: 12px 12px 8px;
}

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

/* the logo: round amber glasses over the word (brand/) */
.logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  font: 700 22px/0.8 var(--sans);
  letter-spacing: -0.05em;
}

.logo-specs {
  width: 40px;
  height: auto;
  color: #e3ac3c;
  fill: none;
  stroke: currentColor;
  stroke-width: 13;
  stroke-linecap: round;
  overflow: visible;
}

.library {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--control);
  color: var(--ink-2);
}

.library select {
  appearance: none;
  border: 0;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23b3ab9f'/%3E%3C/svg%3E") no-repeat right center;
  padding-right: 14px;
  color: var(--ink);
  font: 500 12px var(--sans);
  cursor: pointer;
}

.play {
  position: relative;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 16px;
  background: var(--ink);
}

.play::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 10px;
  border-left: 10px solid var(--window);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.play.on::before {
  left: 11px;
  top: 11px;
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 2px;
  background: var(--window);
}

.globals {
  display: flex;
  align-items: center;
  gap: 28px;
}

.tempo {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.tempo .display {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tempo .scrub {
  font: 700 24px/1 var(--sans);
  letter-spacing: -0.02em;
}

.labelled {
  display: flex;
  align-items: center;
  gap: 8px;
}

.labelled .value {
  font-size: 12px;
}

.out {
  width: 120px;
}

#out-val {
  width: 52px;
  text-align: right;
}

/* ---------- panes ---------- */

.panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
}

.pane {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--pane);
  overflow: hidden;
}

.pane-head {
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#tracks-head {
  padding: 0 4px;
}

.pane-title {
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-2);
}

.pane-body {
  position: relative;
  flex: 1;
  min-height: 0;
}

/* ---------- controls: 1 · toggle ---------- */

.tg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  background: var(--control);
  color: var(--label);
  font: 600 10px var(--mono);
  padding: 0;
  flex-shrink: 0;
}

.tg.compact {
  width: 20px;
  height: 20px;
}

.tg.regular {
  min-width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 11px;
}

.tg:hover {
  background: var(--control-hover);
  color: var(--ink);
}

/* Mute = outline (something taken away). Solo = solid cream, the loudest object on screen. */
.tg.muted {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.tg.soloed,
.tg.on {
  background: var(--ink);
  color: var(--window);
}

.ms {
  display: flex;
  gap: 4px;
}

/* ---------- controls: 2 · segmented ---------- */

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  height: 28px;
  border-radius: 8px;
  background: var(--window);
}

.seg button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--label);
  font: 500 12px var(--sans);
  white-space: nowrap;
}

.seg button:hover {
  color: var(--ink);
}

.seg button.on {
  background: var(--control-hover);
  color: var(--ink);
}

.seg.track button.on {
  background: var(--track);
  color: var(--window);
  font-weight: 600;
}

.seg.fill {
  display: flex;
}

.seg.fill button {
  flex: 1;
  padding: 0 4px;
}

.seg.mono button {
  font: 500 11px var(--mono);
}

/* ---------- controls: 3 · scrub number ---------- */

.scrub {
  font: 500 11px var(--mono);
  border-bottom: 1px dotted var(--label);
  cursor: ns-resize;
  user-select: none;
  touch-action: none;
  border-radius: 3px 3px 0 0;
  padding: 0 2px;
}

.scrub:hover,
.scrub.active {
  background: var(--control);
  border-bottom-color: var(--ink);
}

.scrub-input {
  width: 5ch;
  border: 0;
  outline: 0;
  background: var(--control);
  font: 500 11px var(--mono);
  text-align: center;
}

.stepper {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border-radius: 8px;
  background: var(--control);
}

.stepper button {
  width: 24px;
  height: 24px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: 500 13px var(--sans);
}

.stepper button:hover {
  color: var(--ink);
}

.stepper .scrub {
  min-width: 20px;
  text-align: center;
  font-size: 12px;
}

/* ---------- controls: 4 · fader ---------- */

.fd {
  --v: 50%;
  --fill: var(--track);
  position: relative;
  height: 20px;
  flex: 1;
  min-width: 0;
  cursor: ew-resize;
  touch-action: none;
}

.fd i {
  position: absolute;
  display: block;
}

.fd .tr {
  left: 0;
  right: 0;
  top: 8px;
  height: 4px;
  border-radius: 2px;
  background: var(--fader-track);
}

.fd .fl {
  left: 0;
  top: 8px;
  height: 4px;
  width: var(--v);
  border-radius: 2px;
  background: var(--fill);
}

.fd .nt {
  left: var(--notch);
  top: 6px;
  width: 1px;
  height: 8px;
  background: var(--silent);
}

.fd .th {
  /* round, like the rings: centred on the track */
  left: var(--v);
  top: 10px;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.45);
}

.fd:hover .th,
.fd.active .th {
  box-shadow: 0 0 0 4px rgb(237 231 221 / 0.18), 0 1px 3px rgb(0 0 0 / 0.45);
}

.fd .mt {
  left: 0;
  top: 8px;
  height: 4px;
  width: var(--m, 0%);
  border-radius: 2px;
  background: var(--ink-2);
}

/* the header output meter: meter behind, the tick sets the level */
.out .mt {
  z-index: 1;
}

.out .th {
  z-index: 2;
}

/* vertical (mixer) */
.fd.v {
  width: 28px;
  height: auto;
  flex: 1;
  cursor: ns-resize;
}

.fd.v .tr {
  left: 50%;
  right: auto;
  top: 0;
  bottom: 0;
  width: 4px;
  height: auto;
  margin-left: -6px;
}

.fd.v .fl {
  left: 50%;
  top: auto;
  bottom: 0;
  width: 4px;
  height: var(--v);
  margin-left: -6px;
}

.fd.v .mt {
  left: 50%;
  top: auto;
  bottom: 0;
  width: 3px;
  height: var(--m, 0%);
  margin-left: 3px;
  border-radius: 1.5px;
  background: var(--ink);
  opacity: 0.55;
}

.fd.v .nt {
  left: 50%;
  top: auto;
  bottom: var(--notch);
  width: 6px;
  height: 1px;
  margin-left: -14px;
}

.fd.v .th {
  left: calc(50% - 4px);
  top: auto;
  bottom: var(--v);
  width: 14px;
  height: 14px;
  margin: 0 0 -7px -7px;
}

/* range (rings for) */
.fd.range .fl {
  left: var(--lo);
  width: calc(var(--hi) - var(--lo));
  opacity: 0.55;
}

.fd.range .h {
  top: 5px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 5px;
}

.fd.range .lo {
  left: var(--lo);
  background: var(--track);
}

.fd.range .hi {
  left: var(--hi);
  background: var(--pane);
  box-shadow: inset 0 0 0 1.5px var(--track);
}

/* ---------- lock pill: two of the ring's own hit bars ---------- */

.lockp {
  height: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 7px 0 6px;
  border: 0;
  border-radius: 6px;
  background: var(--control);
  color: var(--ink-2);
  font: 500 11px var(--sans);
  flex-shrink: 0;
}

.lockp:hover {
  background: var(--control-hover);
  color: var(--ink);
}

.lockp .gl {
  display: flex;
  gap: 2px;
}

.lockp .gl i {
  width: 7px;
  height: 7px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1.2px var(--fill, var(--track));
}

.lockp .gl i.filled {
  background: var(--fill, var(--track));
}

.btn {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  background: var(--control);
  color: var(--ink);
  font: 500 12px var(--sans);
}

.btn:hover {
  background: var(--control-hover);
}

.icon-btn {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 6px;
  background: var(--control);
  color: var(--ink-2);
  font-size: 12px;
  padding: 0;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--control-hover);
  color: var(--ink);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ---------- map ---------- */

.map-wrap {
  position: absolute;
  inset: 0;
}

#map,
#long-map {
  position: absolute;
  left: 18px;
  top: 0;
  width: calc(100% - 18px);
  height: calc(100% - 18px);
  touch-action: none;
}

.axis {
  position: absolute;
  font: 500 10px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label);
  pointer-events: none;
}

.axis.y1,
.axis.y0 {
  left: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.axis.y1 { top: 0; }
.axis.y0 { bottom: 22px; }
.axis.x0 { left: 18px; bottom: 0; }
.axis.x1 { right: 0; bottom: 0; }

/* ---------- mixer: replaces the map inside the same pane ---------- */

.mixer {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 4px;
  background: var(--pane);
  transform: translateX(-104%);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mixer.open {
  transform: none;
}

.strip-ch {
  --track: var(--ink);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 10px 6px 8px;
  border-radius: 10px;
  transition: opacity 0.12s;
}

.strip-ch.out {
  background: var(--card);
}

.strip-ch.selected .who {
  /* the open track: a pill around its name, in its colour */
  background: var(--control);
  box-shadow: inset 0 0 0 1.5px var(--track);
}

.strip-ch.silenced {
  opacity: 0.35;
}

.strip-ch .who {
  height: 22px;
  margin: 0 2px;
  padding: 0 6px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.strip-ch .who b {
  font-size: 12px;
  font-weight: 650;
}

.strip-ch .fd.v {
  align-self: center;
}

.strip-ch .db {
  text-align: center;
}

.strip-ch .w-row {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 16px;
}

.strip-ch .w-row .fd {
  height: 16px;
}

.strip-ch .w-row .fd .tr,
.strip-ch .w-row .fd .fl {
  top: 6px;
}

.strip-ch .w-row .fd .th {
  top: 8px;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
}

.strip-ch .ms {
  justify-content: center;
  min-height: 20px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--track);
  flex-shrink: 0;
}

/* ---------- performance view ---------- */

.solo-banner {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 0 10px;
  border-radius: 8px;
  background: var(--control);
  color: var(--ink-2);
}

.solo-banner .tg {
  width: 16px;
  height: 16px;
  font-size: 9px;
  border-radius: 4px;
}

.solo-banner b {
  font-weight: 600;
}

.solo-banner button {
  height: 20px;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  background: var(--control-hover);
  color: var(--ink);
  font: 500 12px var(--sans);
}

.overview {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px;
  transition: opacity 0.18s;
}

.overview.fading {
  opacity: 0;
}

.cell {
  --track: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  min-width: 0;
  padding: 10px 6px 8px;
  border-radius: 10px;
  transition: opacity 0.12s, background 0.12s, box-shadow 0.3s;
}

.cell.hovered {
  background: var(--card);
}

.cell.silenced {
  opacity: 0.35;
}

/* Off the map: no circle, silent; its ring (or dot) is dragged onto the map */
.cell.off-map canvas {
  opacity: 0.45;
}

.cell .head .dot,
.edit-title .track-dot {
  cursor: grab;
  touch-action: none;
}

.place-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  border-radius: 50%;
  border: 1.5px dashed var(--c);
  background: color-mix(in srgb, var(--c) 10%, transparent);
  pointer-events: none;
  opacity: 0.6;
}

.place-ghost.over {
  border-style: solid;
  opacity: 1;
}

.cell.last-open {
  box-shadow: inset 0 0 0 1.5px var(--track);
}

.cell .head {
  height: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  min-width: 0;
}

.cell .num {
  font: 400 10px var(--mono);
  color: var(--label);
}

.cell .name {
  font: 650 14px var(--sans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cell.muted .name {
  color: var(--label);
}

.cell.muted .dot {
  background: var(--silent);
}

/* hits / steps: "11/16", both numbers draggable — the same control in cells and track view */
/* A drone has no hits: its rhythm controls give way to the drone's own */
/* A drone's controls: its tab's groups only, side by side across the pane (no scrolling) */
#rhythm-side[data-mode='drone'][data-dtab='chord'] .group.drone:not(.dt-chord),
#rhythm-side[data-mode='drone'][data-dtab='feel'] .group.drone:not(.dt-feel),
#rhythm-side[data-mode='drone'][data-dtab='sounds'] .group.drone:not(.dt-sounds),
.rhythm-body[data-mode='drone']:not([data-dtab='chord']) .big-ring,
#rhythm-side:not([data-mode='drone']) .group.drone,
#rhythm-side[data-mode='drone'] .group:not(.drone),
#rhythm-side .group.drone .drone-prog[hidden],
.cell.drone .hs,
.cell.drone .ctl .lockp,
.cell.drone .ctl .icon-btn.reroll {
  display: none;
}

.cell .drone-tag {
  display: none;
  font: 500 11px var(--mono);
  letter-spacing: 0.08em;
  color: var(--label);
}

.cell.drone .drone-tag {
  display: inline;
}

/* The drone's screen (src/drone.js): the notes view in the ring's place, its controls */
.view-title {
  position: absolute;
  left: 4px;
  top: 2px;
  font: 500 10px var(--mono);
  letter-spacing: 0.12em;
  color: var(--label);
  pointer-events: none;
}

.sync-tag {
  font: 500 10px var(--mono);
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--ink-2);
  background: var(--control);
}

.drone-prog .row {
  flex-wrap: wrap;
}

#drone-prog,
#drone-family {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#drone-prog button,
#drone-family button {
  font: 500 12px var(--sans);
  padding: 4px 9px;
  border-radius: 6px;
  border: 0;
  background: var(--control);
  color: var(--ink-2, #b3ab9f);
  cursor: pointer;
}

#drone-prog button.on,
#drone-family button.on {
  background: var(--track);
  color: var(--window);
}

#rhythm-side .drone-kept .row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#rhythm-side .drone-kept .row .btn {
  white-space: nowrap;
  padding: 0 7px;
}

.label .sync-tag {
  margin-left: 4px;
  letter-spacing: 0;
  text-transform: none;
}

#edit-patch,
.edit-title .btn {
  white-space: nowrap;
}

#edit-patch {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

#instrument .glyph {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  margin-right: 6px;
  vertical-align: -1px;
}

#instrument .g-ring {
  border: 1.5px solid currentColor;
}

#instrument .g-glow {
  background: radial-gradient(circle, currentColor 0 30%, transparent 72%);
}

/* the drone's map: which map it is, and what you can do on it */
.long-top {
  position: absolute;
  left: 26px;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.long-top[hidden] {
  display: none;
}

.long-name {
  font: 600 10px var(--mono);
  letter-spacing: 0.12em;
  padding: 4px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--window) 85%, transparent);
  color: var(--track-l, var(--label));
}

.long-hint {
  margin-left: auto;
  font: 500 10px var(--mono);
  padding: 4px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--window) 85%, transparent);
  color: var(--label);
}

.hs {
  display: flex;
  align-items: baseline;
  font: 500 11px var(--mono);
  color: var(--label);
  flex-shrink: 0;
}

.hs .scrub {
  color: var(--ink);
  padding: 0 1px;
}

.hs .scrub + .slash + .scrub {
  color: var(--ink-2);
}

.hs.big {
  align-self: flex-start;
  font-size: 16px;
}

.hs.big .scrub {
  font-size: 16px;
  padding: 0 2px;
}

.cell-ring {
  flex: 1;
  min-height: 0;
  width: 100%;
  touch-action: none;
}

.cell .patch {
  height: 12px;
  text-align: center;
  font: 500 10px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label);
  white-space: nowrap;
  overflow: hidden;
  line-height: 12px;
}

.cell .patch.live {
  color: var(--ink);
}

.cell .row {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 2px;
}

.cell .row .value {
  width: 30px;
  text-align: right;
  font-size: 10px;
  color: var(--ink-2);
}

.cell.muted .row .value {
  color: var(--label);
}

.cell.muted .fd,
.strip-ch.muted .fd,
.cell.muted .lockp {
  --fill: var(--silent);
}

/* ---------- track view ---------- */

#chips {
  flex: 1;
  min-width: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--window);
  justify-content: flex-start;
}

#chips button {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--label);
  font: 550 12px var(--sans);
  white-space: nowrap;
}

#chips button.chip {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

#chips button:hover {
  color: var(--ink);
}

#chips button.on {
  background: var(--control-hover);
  color: var(--ink);
}

#chips .grid-icon {
  display: grid;
  grid-template-columns: 4px 4px;
  gap: 2px;
}

#chips .grid-icon i {
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: currentColor;
}

#chips .chip i {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--c);
  flex-shrink: 0;
}

.edit {
  --track: var(--ink);
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edit-title {
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

.track-dot {
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background: var(--track);
  flex-shrink: 0;
}

.edit-title .name {
  width: 7ch;
  max-width: 16ch;
  border: 0;
  background: none;
  padding: 0;
}

.edit-title .name:focus {
  outline: none;
  box-shadow: 0 2px 0 var(--track);
}

.edit-title .ms .tg {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 11px;
}

.rhythm-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 20px;
}

.big-ring {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
}

#ring,
#notes-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  transform-origin: 0 0;
}

.side {
  width: 212px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 4px;
  min-height: 0;
  overflow-y: auto; /* more controls than room: they scroll, inside the track */
  scrollbar-width: thin;
  padding-right: 4px;
}

.group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.group .row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.group > .fd {
  flex: none;
  height: 16px;
}

.group > .fd .tr,
.group > .fd .fl {
  top: 6px;
}

.group > .fd .th {
  top: 8px;
}

.group > .fd.range .h {
  top: 3px;
}

#step-base {
  flex: 1;
}

#turn {
  align-self: flex-start;
}

.sound-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 200px;
  gap: 8px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card);
  min-height: 0;
}

.card.grow {
  flex: 1;
}

.card-head {
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

.frow {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 8px;
  height: 24px;
}

.frow .fd {
  height: 16px;
}

.frow .fd .tr,
.frow .fd .fl {
  top: 6px;
}

.frow .fd .th {
  top: 8px;
}

.frow .fd .nt {
  top: 4px;
}

.frow .value {
  text-align: right;
}

.graph {
  flex: 1;
  min-height: 60px;
  width: 100%;
  touch-action: none;
}

.pitch {
  align-items: center;
  padding: 10px 6px;
  gap: 6px;
}

.keys {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1px;
  cursor: ns-resize;
  touch-action: none;
}

.key {
  flex: 1;
  border-radius: 2px;
  background: #3a3733;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 400 9px var(--mono);
  color: var(--label);
}

.key.black {
  background: #161513;
}

.key.near {
  background: color-mix(in srgb, var(--track) 30%, #3a3733);
}

.key.on {
  background: var(--track);
  color: var(--window);
}

/* ---------- hint bar ---------- */

.hintbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 4px;
  color: var(--ink-2);
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.hint-items {
  display: flex;
  gap: 16px;
  min-width: 0;
  overflow: hidden;
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

kbd {
  font: 500 10px var(--mono);
  background: var(--control);
  color: var(--ink);
  border-radius: 4px;
  padding: 2px 6px;
}

#hint-file {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
}

/* the lock glyph inside the "all locked / all free" choice */
.lockp-glyph {
  display: inline-flex;
  gap: 2px;
}

.lockp-glyph i {
  width: 7px;
  height: 7px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1.2px var(--track);
}

.lockp-glyph i.filled {
  background: var(--track);
}

#sounds button {
  box-shadow: inset 0 0 0 1px var(--control-hover);
  color: var(--ink-2);
}

#sounds button.on {
  background: var(--control-hover);
  color: var(--ink);
  box-shadow: none;
}

#reroll:disabled {
  opacity: 0.35;
  cursor: default;
}

/* map zoom: shown only while zoomed in; click to see the whole map */
.zoom-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: var(--control);
  color: var(--ink);
  font: 500 11px var(--mono);
}

.zoom-badge:hover {
  background: var(--control-hover);
}

/* ---------- modulation ----------
   Two modulators per track in signal colours no track uses: M1 random = cyan, M2 envelope =
   magenta. --litc (on the track view) is the colour of the modulator whose layer is open;
   --modc (on a control or card) is the colour of the modulator that owns it. */

.edit {
  --litc: transparent;
}

/* the modulated sign after a track's name: a dot for M1, a falling tail for M2 */
.msign {
  width: 9px;
  height: 8px;
  flex-shrink: 0;
}

.msign.m1 {
  width: 7px;
  background: #2ee8ff;
  -webkit-mask: radial-gradient(circle at 3.5px 4px, #000 2.6px, transparent 3px);
  mask: radial-gradient(circle at 3.5px 4px, #000 2.6px, transparent 3px);
}

.msign.m2 {
  background: #ff38ec;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='8'%3E%3Cpath d='M0 8V0C1 5 3 7.4 9 8Z'/%3E%3C/svg%3E") no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='8'%3E%3Cpath d='M0 8V0C1 5 3 7.4 9 8Z'/%3E%3C/svg%3E") no-repeat;
}

.msign + .msign {
  margin-left: -2px;
}

.cell.muted .msign,
.cell.silenced .msign {
  background: var(--silent);
}

/* the tray: M1 and M2 side by side, under the ring and the sound graphs */
.mod-tray {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.mod-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--card);
  min-width: 0;
}

.mod-card.active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--modc) 70%, transparent);
}

.mod-head {
  height: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.mod-name {
  color: var(--ink-2);
  font-size: 12px;
}

.mod-body {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  height: 64px;
}

.mod-scope {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  background: var(--pane);
}

.mod-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  min-width: 0;
}

.mod-row {
  height: 20px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px 36px 18px;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.mod-row .lbl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mod-row .amt {
  color: var(--modc);
  text-align: right;
}

.mod-row .bar {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: var(--fader-track);
}

.mod-row .bar i {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 2px;
  background: var(--modc);
}

.mod-row .icon-btn {
  width: 18px;
  height: 18px;
}

.mod-badge {
  height: 22px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 0 6px;
  border: 0;
  border-radius: 11px;
  background: var(--control);
  color: var(--ink-2);
  font: 600 11px var(--mono);
  flex-shrink: 0;
}

.mod-badge i {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--silent);
}

.mod-badge.used i {
  background: var(--modc);
}

.mod-badge:hover {
  background: var(--control-hover);
  color: var(--ink);
}

.mod-badge.on {
  background: var(--modc);
  color: var(--window);
}

.mod-badge.on i {
  background: var(--window);
}

.mod-card .seg.track button.on,
.mod-card .tg.on {
  background: color-mix(in srgb, var(--modc) 20%, var(--control));
  color: var(--ink);
}

.mod-card .seg button {
  padding: 0 7px;
}

.mod-add {
  appearance: none;
  align-self: flex-start;
  height: 20px;
  flex-shrink: 0;
  border: 0;
  border-radius: 6px;
  padding: 0 20px 0 8px;
  background: var(--control) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23b3ab9f'/%3E%3C/svg%3E") no-repeat right 7px center;
  color: var(--ink-2);
  font: 500 11px var(--sans);
  cursor: pointer;
}

.mod-add:hover {
  background-color: var(--control-hover);
  color: var(--ink);
}

/* lit: in a modulator's layer, a control it may move. Dragging it sets how far. */
.frow.lit .label,
.group.lit .label,
.card.lit > .label,
.card.lit .frow > .label,
.card.lit .card-head > .label {
  color: var(--litc);
}

.fd.lit,
.graph.lit,
.scrub.lit {
  border-radius: 4px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--litc) 70%, transparent);
  background: color-mix(in srgb, var(--litc) 7%, transparent);
  cursor: crosshair;
}

.fd.lit .th {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--litc) 45%, transparent);
}

/* a modulated control: the band (where the hits take it) and a live dot (where it is now),
   in the owner's colour. In the other modulator's layer: only a thin dashed line. */
.fd .mb,
.fd .md,
.fd .mt2 {
  display: none;
}

.fd.modded .mb {
  display: block;
  left: var(--mb0);
  width: calc(var(--mb1) - var(--mb0));
  top: 6.5px;
  height: 3px;
  border-radius: 1.5px;
  background: var(--modc);
}

.fd.modded.lit .mb {
  top: 6px;
  height: 4px;
  box-shadow: -1px 0 0 0 var(--modc), 1px 0 0 0 var(--modc);
}

.fd.modded .md {
  display: block;
  left: var(--md);
  top: 5px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 3px;
  background: var(--modc);
  box-shadow: 0 0 0 1px var(--pane);
}

.fd.modded.taken .mb,
.fd.modded.taken .md {
  display: none;
}

.fd.modded.taken .mt2 {
  display: block;
  left: var(--mb0);
  width: calc(var(--mb1) - var(--mb0));
  top: 3px;
  height: 0;
  border-top: 1px dashed var(--modc);
}

.fd.taken {
  cursor: not-allowed;
}

.mod-tag {
  font: 500 11px var(--mono);
}

.key.mod {
  box-shadow: inset 0 0 0 2px var(--modc);
}

/* reset: one button with a picker (a single floating menu, shared by every reset button) */
.btn.small {
  height: 24px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 11px;
}

.btn.small:hover {
  color: var(--ink);
}

.btn.small.cell-reset {
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 13px;
  color: var(--ink-2);
}

.reset-menu {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 150px;
  padding: 4px;
  border-radius: 8px;
  background: var(--control);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.45);
}

.reset-menu .hdr {
  padding: 6px 10px 2px;
  font: 500 9px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
}

.reset-menu button {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--ink);
  text-align: left;
  font: 500 12px var(--sans);
}

.reset-menu button:hover {
  background: var(--control-hover);
}

.reset-menu {
  max-height: calc(100vh - 8px);
  overflow-y: auto;
}

.pick-row {
  display: flex;
  align-items: center;
}

.pick-row > button:first-child {
  flex: 1;
}

.pick-row.last {
  margin-top: 4px;
  box-shadow: 0 -1px 0 var(--card);
}

.reset-menu button.x {
  width: 24px;
  padding: 0;
  text-align: center;
  color: var(--label);
}

.reset-menu button.x:hover {
  color: var(--ink);
}

.reset-menu button.back {
  color: var(--label);
  font-size: 11px;
}

.pick-input {
  display: flex;
  gap: 4px;
  padding: 2px 4px 4px;
  margin: 0;
}

.pick-input input {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: var(--window);
  color: var(--ink);
  font: 500 12px var(--sans);
}

.pick-input input:focus {
  outline: 1px solid var(--ink-2);
}

.reset-menu .pick-input button {
  height: 24px;
  background: var(--control-hover);
  text-align: center;
}

#patches {
  margin-right: 4px;
}

#reset-all {
  margin-right: 8px;
}

.mod-steps,
.mod-div {
  color: var(--ink-2);
}

/* fullscreen: either pane takes the whole window */
#app.full-left .panes,
#app.full-right .panes {
  grid-template-columns: minmax(0, 1fr);
}

#app.full-left #right,
#app.full-right #left {
  display: none;
}

.row-end {
  display: flex;
  align-items: center;
  gap: 8px;
}

.full-btn {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 0;
  border-radius: 6px;
  background: var(--control) no-repeat center / 12px 12px;
  /* four corners pointing out = fill the window; pointing in = back */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23b3ab9f' stroke-width='1.5'%3E%3Cpath d='M1 4.5V1h3.5M7.5 1H11v3.5M11 7.5V11H7.5M4.5 11H1V7.5'/%3E%3C/svg%3E");
}

.full-btn:hover {
  background-color: var(--control-hover);
}

.full-btn.on {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23ede7dd' stroke-width='1.5'%3E%3Cpath d='M4.5 1v3.5H1M11 4.5H7.5V1M7.5 11V7.5H11M1 7.5h3.5V11'/%3E%3C/svg%3E");
}

/* library indexing progress, in the header */
.indexing {
  --ix: 0%;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--control);
  color: var(--ink-2);
  font: 500 11px var(--mono);
  white-space: nowrap;
}

.ix-bar {
  position: relative;
  width: 64px;
  height: 4px;
  border-radius: 2px;
  background: var(--fader-track);
  overflow: hidden;
}

.ix-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--ix);
  background: var(--ink-2);
  transition: width 0.6s;
}

.indexing.paused .ix-bar i {
  background: var(--silent);
}

/* reach and surprise: greyed out until the reach table is built */
.group.reach.off {
  opacity: 0.4;
}

.group.reach.off .fd {
  pointer-events: none;
}

/* role: a picker; "none here" when the circle has no sounds of it */
.role-btn {
  align-self: flex-start;
}

.group.role.off {
  opacity: 0.4;
}

#role-val.warn {
  color: #e8613f;
}

#role-find:disabled {
  opacity: 0.35;
  cursor: default;
}

/* a narrow card: drop the modulator's name (the badge and its hint say it) so its controls fit */
.mod-card {
  container-type: inline-size;
}

@container (max-width: 470px) {
  .mod-name {
    display: none;
  }

  .mod-head {
    gap: 6px;
  }
}

/* KEY in the header: root (draggable) + scale */
.labelled.key .btn.small {
  height: 22px;
  padding: 0 8px;
}

#key-root {
  min-width: 2ch;
  text-align: center;
}

#key-root.dim {
  color: var(--silent);
}

.tg.in-key {
  width: auto;
  padding: 0 6px;
  font-size: 10px;
  height: 22px;
}

.tg.in-key:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ---------- the map maker (over the tracks pane; the map stays beside it) ---------- */

#right.making > :not(#maker) {
  display: none !important;
}

.maps-btn.on {
  background: var(--control-hover);
}

.maker {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mk-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 4px 4px 12px;
  max-width: 560px;
}

/* a scrolling column: its parts keep their size instead of squeezing */
.mk-body > * {
  flex-shrink: 0;
}

.mk-roll {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mk-new {
  height: 44px;
  padding: 0 20px 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 12px;
  background: var(--hot);
  color: var(--window);
  font: 700 16px var(--sans);
  cursor: pointer;
  transition: transform 0.08s;
}

.mk-new:hover {
  background: #fff;
}

.mk-new:active {
  transform: scale(0.97);
}

/* a die showing five */
.mk-die {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--window);
}

.mk-die i {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 2px;
  background: var(--hot);
}

.mk-die i:nth-child(1) { left: 4px; top: 4px; }
.mk-die i:nth-child(2) { right: 4px; top: 4px; }
.mk-die i:nth-child(3) { left: 9px; top: 9px; }
.mk-die i:nth-child(4) { left: 4px; bottom: 4px; }
.mk-die i:nth-child(5) { right: 4px; bottom: 4px; }

.mk-new:active .mk-die {
  transform: rotate(90deg);
}

.mk-seed {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.mk-seed-val {
  font: 500 15px var(--mono);
  color: var(--ink);
}

.mk-readout {
  font: 400 13px var(--sans);
  color: var(--ink-2);
}

.mk-count {
  font: 700 22px var(--sans);
  color: var(--ink);
  margin-right: 2px;
}

.mk-roles-bar,
.mk-tile-bar {
  display: flex;
  height: 6px;
  gap: 1px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--card);
}

.mk-roles-bar i,
.mk-tile-bar i {
  flex-basis: 0;
  min-width: 1px;
}

.mk-ends {
  display: flex;
  justify-content: space-between;
  font: 400 11px var(--sans);
  color: var(--label);
}

.mk-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mk-chip {
  height: 26px;
  padding: 0 10px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 13px;
  background: var(--control);
  color: var(--ink-2);
  font: 500 12px var(--sans);
  cursor: pointer;
}

.mk-chip::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--c);
  opacity: 0.55;
}

.mk-chip:hover {
  background: var(--control-hover);
}

.mk-chip.on {
  background: color-mix(in srgb, var(--c) 28%, var(--control));
  color: var(--ink);
}

.mk-chip.on::before {
  opacity: 1;
}

.mk-search {
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: var(--well);
  color: var(--ink);
  font: 500 13px var(--sans);
}

.mk-search:focus {
  outline: 1px solid var(--ink-2);
}

.mk-search::placeholder {
  color: var(--label);
}

.mk-pair {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
}

.mk-saved-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mk-saved {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.mk-empty {
  grid-column: 1 / -1;
  margin: 0;
  font: 400 12px var(--sans);
  color: var(--label);
}

.mk-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 28px 10px 10px;
  border-radius: 10px;
  background: var(--card);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.mk-tile:hover {
  background: var(--control);
}

.mk-tile-name {
  font: 650 13px var(--sans);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mk-tile-info {
  font: 400 11px var(--sans);
  color: var(--label);
}

.mk-tile-bar {
  margin-top: 4px;
  height: 4px;
}

.mk-tile .x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--label);
  font: 500 14px var(--sans);
  cursor: pointer;
}

.mk-tile .x:hover {
  background: var(--control-hover);
  color: var(--ink);
}

.mk-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.7;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.4);
}

.mk-ghost.over {
  opacity: 1;
  outline: 1.5px solid var(--hot);
}

/* the tracks in the maker: drag one onto the map */
.mk-tracks {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}

.mk-track {
  height: 30px;
  min-width: 0;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 15px;
  background: var(--control);
  color: var(--label);
  font: 600 12px var(--sans);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.mk-track:hover {
  background: var(--control-hover);
}

.mk-track:active {
  cursor: grabbing;
}

.mk-track i {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 5px;
  border: 1.5px solid var(--c);
}

.mk-track span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* on the map: a filled dot, its name in its colour */
.mk-track.on {
  color: var(--c);
}

.mk-track.on i {
  background: var(--c);
}

/* LIKE: the tracks as chips (a track off the map has no circle to be like) */
.mk-like {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mk-like-chip.off-map {
  opacity: 0.45;
}

.mk-close-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.mk-close-wrap > .fd {
  flex: none;
  height: 16px;
}

.mk-close-wrap > .fd .tr,
.mk-close-wrap > .fd .fl {
  top: 6px;
}

.mk-close-wrap > .fd .th {
  top: 8px;
}

/* the sample library panel (inside the plugin) */
.library-panel {
  position: absolute;
  z-index: 40;
  width: 340px;
  padding: 14px 16px 16px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.library-panel .lp-title {
  font: 600 11px var(--mono);
  letter-spacing: 0.12em;
  color: var(--label);
}

.library-panel .lp-root {
  font: 500 12px var(--mono);
  color: var(--ink-2);
  word-break: break-all;
}

.library-panel .lp-state {
  font-size: 13px;
}

.library-panel .lp-note {
  font-size: 12px;
  color: var(--label);
  line-height: 1.4;
}

.library-panel .lp-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* the playground (the website, <html data-light>): what it leaves out, and its "get the plugin" */
[data-light] #patches,
[data-light] #preset,
[data-light] .strip-ch .w-row:has(.df),
[data-light] .strip-ch .w-row:has(.rf),
[data-light] .card:has(#hit-reverse),
[data-light] .card:has(#send-delay),
[data-light] #rhythm-side .group.reach {
  display: none;
}

.btn.small.get-plugin {
  color: var(--window);
  background: #e3ac3c;
  font-weight: 600;
}

.btn.small.get-plugin:hover {
  color: var(--window);
  background: #edbd57;
}

.plugin-panel .pp-head {
  font: 600 15px var(--sans);
}

.plugin-panel .pp-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.4;
}

.plugin-panel .pp-list b {
  color: var(--ink);
  font-weight: 600;
}

/* the playground's four tracks: two by two, filling the tracks pane */
[data-light] .overview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* the guide: a ring around what to touch, a card beside it */
.tour-ring {
  position: fixed;
  z-index: 60;
  border-radius: 12px;
  box-shadow: 0 0 0 2px #e3ac3c, 0 0 0 6px rgb(227 172 60 / 0.25);
  pointer-events: none;
  transition: left 0.25s, top 0.25s, width 0.25s, height 0.25s;
  animation: tour-pulse 1.6s ease-in-out infinite;
}

@keyframes tour-pulse {
  50% { box-shadow: 0 0 0 2px #e3ac3c, 0 0 0 10px rgb(227 172 60 / 0.12); }
}

.tour-card {
  position: fixed;
  z-index: 61;
  width: 300px;
  padding: 14px 16px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid #e3ac3c;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: left 0.25s, top 0.25s;
}

.tour-card.tour-docked {
  width: calc(100vw - 20px);
  transition: none;
}

.tour-card.tour-in {
  animation: tour-in 0.3s ease-out;
}

@keyframes tour-in {
  from { opacity: 0; transform: translateY(6px); }
}

.tour-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tour-count {
  font: 600 11px var(--mono);
  letter-spacing: 0.12em;
  color: #e3ac3c;
}

.tour-skip {
  border: 0;
  background: none;
  padding: 0;
  font-size: 11px;
  color: var(--label);
}

.tour-skip:hover {
  color: var(--ink);
}

.tour-title {
  font: 600 17px var(--sans);
  letter-spacing: -0.01em;
}

.tour-text {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-2);
}

.tour-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.tour-buttons:empty {
  display: none;
}

.btn.small.tour-next {
  color: var(--window);
  background: #e3ac3c;
  font-weight: 600;
}

.btn.small.tour-next:hover {
  background: #edbd57;
  color: var(--window);
}

@media (prefers-reduced-motion: reduce) {
  .tour-ring, .tour-card.tour-in { animation: none; }
  .tour-ring, .tour-card { transition: none; }
}

/* motion: what shows depends on how the circle travels */
.group.motion .motion-more {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.group.motion[data-mode='still'] .motion-more,
.group.motion:not([data-mode='orbit']):not([data-mode='drift']):not([data-mode='sweep']) .motion-size,
.group.motion:not([data-mode='bounce']):not([data-mode='sweep']) .motion-angle,
.group.motion:not([data-mode='orbit']) .motion-dir {
  display: none !important; /* whatever the layout makes of them */
}

#motion .seg-btn,
#motion button {
  text-transform: none;
}

/* effects: the FX tab's four slots, and the master's (left pane) */
.fx-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.fx-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fx-slot .card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fx-slot .slot-n {
  font: 600 11px var(--mono);
  color: var(--label);
}

.fx-slot select,
.master-fx select,
.fx-choice select {
  flex: 1;
  min-width: 0;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--ink);
  font: 500 12px var(--sans, inherit);
}

.fx-slot.empty .card-head select {
  color: var(--label);
}

.fx-view {
  display: block;
  width: 100%;
  height: 64px;
  border-radius: 8px;
  background: var(--window);
  margin: 2px 0 4px;
}

.fx-slot .about {
  font-size: 11px;
  color: var(--label);
  line-height: 1.3;
  min-height: 14px;
}

.fx-slot .frow,
.master-fx .frow {
  grid-template-columns: 56px minmax(0, 1fr) 62px;
}

.seg-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 26px;
}

.master-fx {
  position: absolute;
  inset: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  padding: 2px;
  background: var(--pane);
}

.master-fx .card {
  gap: 6px;
}

/* ---------- phones: one screen, no scrolling — the map, the four rings below it; an open track
   takes the map's place (its controls scroll inside it) ---------- */
@media (max-width: 760px) {
  /* an instrument, not a page: no double-tap zoom (taps stay quick taps), and Safari doesn't
   enlarge small text by itself (which made the page wider than the screen) */
  html {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  /* text fields and menus at 16px, so Safari doesn't zoom in when one is touched */
  select,
  input,
  textarea {
    font-size: 16px !important;
  }

  #app {
    min-width: 0;
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px 8px 10px;
    width: 100%;
    max-width: 100vw;
    overflow: hidden; /* nothing inside can make the page wider than the screen */
  }

  .bar {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .bar > .spacer {
    display: none;
  }

  .library {
    flex: 1 1 0;
    min-width: 0;
  }

  .library select {
    width: 100%;
    min-width: 0;
  }

  /* two short rows: logo, kit, play · tempo, swing, guide, the plugin */
  .bar {
    column-gap: 8px;
  }

  .logo {
    order: 0;
  }

  .library {
    order: 1;
  }

  #play {
    order: 2;
  }

  /* the line break between the two rows */
  .bar::after {
    content: '';
    order: 3;
    flex-basis: 100%;
    height: 0;
  }

  .globals {
    order: 4;
    flex: 1 1 auto;
    justify-content: flex-start;
    gap: 14px;
  }

  #guide-btn {
    order: 5;
  }

  #get-plugin {
    order: 6;
  }

  .globals .key,
  .globals .labelled:has(#out) {
    display: none;
  }

  .hintbar,
  .full-btn {
    display: none;
  }

  .panes {
    display: flex;
    flex-direction: column;
  }

  #left {
    flex: 1 1 auto;
    min-height: 0;
  }

  #right {
    flex: none;
  }

  /* a track open: it takes the map's place */
  .panes:has(#edit:not([hidden])) #left {
    display: none;
  }

  #right:has(#edit:not([hidden])) {
    flex: 1 1 auto;
    min-height: 0;
  }

  #left .pane-head {
    min-width: 0;
  }

  #left .row-end,
  #chips {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  #right > .pane-body {
    flex: none;
    height: max(116px, 30vw);
  }

  /* the tracks: a row of rings, each with its name (tap one to open it below) */
  #right .overview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    gap: 4px;
  }

  .overview .cell .num,
  .overview .cell .hs,
  .overview .cell .msign,
  .overview .cell .patch,
  .overview .cell .ctl,
  .overview .cell .lvl {
    display: none;
  }

  .overview .cell {
    padding: 6px 4px;
    gap: 2px;
  }

  .overview .cell .head {
    justify-content: center;
  }

  #right > .pane-body:has(#edit:not([hidden])) {
    flex: 1 1 auto;
    height: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .edit {
    position: relative;
    inset: auto;
  }

  .edit-title {
    height: auto;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .rhythm-body {
    flex-direction: column;
  }

  .big-ring {
    flex: none;
    height: min(74vw, 38dvh);
  }

  .side {
    width: auto;
  }

  .sound-body {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .sound-body > .col:last-child {
    grid-column: 1 / -1;
  }

  #env {
    height: 190px;
  }

  .mod-tray {
    grid-template-columns: minmax(0, 1fr);
  }

  .mixer {
    overflow-x: auto;
  }

  .library-panel {
    left: 10px !important;
    right: 10px;
    width: auto;
  }
}

/* ---------- a drone's screen: the line under its tabs, then its tab's controls in two columns ---------- */

.drone-head {
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 0 4px;
  min-width: 0;
  white-space: nowrap;
}

.drone-name {
  font: 750 26px/1 var(--sans);
  letter-spacing: -0.03em;
}

.drone-status {
  flex: 0 1 auto;
  font: 500 11px var(--mono);
  color: var(--label);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drone-last {
  flex-shrink: 0;
  font: 600 11px var(--mono);
  color: var(--ink);
}

.rhythm-body[data-mode='drone'] {
  flex-direction: column;
  gap: 14px;
}

.rhythm-body[data-mode='drone'] .big-ring {
  flex: none;
  height: clamp(84px, 17vh, 170px);
}

#rhythm-side[data-mode='drone'] {
  width: auto;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 14px 24px;
  padding: 0 4px;
}

#rhythm-side[data-mode='drone'] .group {
  gap: 6px;
  min-width: 0;
}

#rhythm-side[data-mode='drone'] .group.span {
  grid-column: 1 / -1;
}

#rhythm-side[data-mode='drone'] .label-row {
  gap: 8px;
}

#rhythm-side[data-mode='drone'] .label-row .value {
  overflow: hidden;
  text-overflow: ellipsis;
}

#rhythm-side[data-mode='drone'] .seg {
  align-self: flex-start;
  max-width: 100%;
}

#rhythm-side[data-mode='drone'] .row {
  flex-wrap: wrap;
  gap: 4px 8px;
}

.drone-breath {
  display: block;
  width: 100%;
  height: clamp(56px, 12vh, 120px);
  border-radius: 8px;
  background: var(--well);
}

.pool-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--control);
  overflow: hidden;
}

.pool-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--track);
  transition: width 0.3s;
}

/* the paint tool, on the drone's map */
.long-brush {
  margin-left: auto;
  pointer-events: auto;
}

.long-brush.seg {
  height: 24px;
  background: color-mix(in srgb, var(--window) 85%, transparent);
}

.long-brush.seg button {
  font: 500 11px var(--sans);
  padding: 0 8px;
}

/* ---------- the track's header: name, M S, instrument, ⋯; its tabs a full row below ---------- */

.edit-title {
  gap: 10px;
}

.edit-tabs {
  flex-shrink: 0;
}

.edit-tabs .seg {
  width: 100%;
}

.more-btn {
  width: 28px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

/* a narrow pane: the tracks as colour dots (the name on hover) */
#right {
  container-type: inline-size;
}

@container (max-width: 640px) {
  #chips button.chip {
    flex: none;
    width: 24px;
    padding: 0;
  }

  #chips button.chip .nm {
    display: none;
  }

  #chips .chip i {
    width: 10px;
    height: 10px;
    border-radius: 5px;
  }

  #chips button.chip.on {
    background: transparent;
  }

  #chips button.chip.on i {
    box-shadow: 0 0 0 2px var(--pane), 0 0 0 3.5px var(--ink);
  }

  #chips {
    gap: 2px;
  }

  #edit-patch {
    display: none;
  }
}

/* ---------- the modulators: one line each, their cards below when opened ---------- */

.mod-strip {
  flex-shrink: 0;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 6px;
  border-radius: 10px;
  background: var(--card);
  min-width: 0;
}

.mod-line {
  flex: 1;
  min-width: 0;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  white-space: nowrap;
  overflow: hidden;
}

.mod-line + .mod-line {
  border-left: 1px solid var(--line);
  border-radius: 0 7px 7px 0;
}

.mod-line:hover {
  background: var(--control);
}

.mod-line i {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--silent);
  flex-shrink: 0;
}

.mod-line.used i,
.mod-line.on i {
  background: var(--modc);
}

.mod-line b {
  font: 600 11px var(--mono);
}

.mod-line .verb {
  font: 500 11px var(--mono);
  color: var(--label);
}

.mod-line .tgt {
  font: 600 12px var(--sans);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
}

.mod-line:not(.used) .tgt {
  font-weight: 500;
  color: var(--label);
}

.mod-open {
  position: relative;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
}

.mod-open:hover {
  background: var(--control);
}

.mod-open::before {
  content: '+';
  font: 500 16px/26px var(--sans);
}

.mod-open.open::before {
  content: '−';
}

/* ---------- effects: one slot open at a time ---------- */

/* the open slot gives up its picture's height first, so a slot with many settings still fits */
.fx-body {
  display: flex;
  flex-direction: column;
}

.fx-slots {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fx-slot {
  flex: none;
}

.fx-slot.open {
  flex: 0 1 auto;
  min-height: 0;
}

.fx-slot.open .slot-body {
  flex: 0 1 auto;
  min-height: 0;
}

.fx-slot {
  gap: 6px;
  padding: 4px 6px;
}

.fx-slot .slot-head {
  height: 30px;
  gap: 10px;
  cursor: pointer;
  touch-action: none;
  border-radius: 7px;
  padding: 0 6px;
}

.fx-slot.open .slot-head {
  background: var(--control);
}

.fx-slot .slot-head select {
  flex: none;
  max-width: 45%;
  height: 26px;
  border: 0;
  background: transparent;
  padding: 0 2px;
  font: 650 13px var(--sans);
  appearance: none;
  cursor: pointer;
}

.fx-slot.empty .slot-head select {
  font-weight: 500;
}

.fx-slot .slot-sum {
  flex: 1;
  min-width: 0;
  font: 500 11px var(--mono);
  color: var(--label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fx-slot.open .slot-sum {
  visibility: hidden;
}

.fx-slot .slot-chev {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--ink-2);
  transition: transform 0.15s;
}

.fx-slot.open .slot-chev {
  transform: rotate(180deg);
}

.fx-slot:not(.open) .slot-body {
  display: none;
}

.slot-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 4px 4px;
}

.fx-params {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 4px 20px;
}

.fx-slot .fx-params .frow {
  grid-template-columns: auto minmax(40px, 1fr) auto;
}

/* what it does is said by its picture (and the menu's hover); no line of text each time */
.fx-slot .about {
  display: none;
}

.fx-slot .fx-view {
  flex: 0 1 auto;
  height: clamp(40px, 9vh, 80px);
  min-height: 12px;
  margin: 0;
}

.fx-params .seg-row {
  grid-column: 1 / -1;
}

/* ---------- small windows (the plugin's smallest is 900 × 600): no shortcut bar, a tighter header ---------- */

@media (min-width: 761px) and (max-width: 1100px), (min-width: 761px) and (max-height: 720px) {
  #app {
    grid-template-rows: 44px minmax(0, 1fr);
  }

  .hintbar {
    display: none;
  }

  .globals {
    gap: 16px;
  }

  .out {
    width: 70px;
  }

  .pane {
    padding: 10px;
    gap: 10px;
  }

  .edit {
    gap: 10px;
  }

  #sorts.seg button,
  #map-mix.seg button {
    padding: 0 7px;
  }

  /* the playground's header holds two more buttons (guide, get the plugin) */
  .bar {
    gap: 10px;
  }

  .bar .btn,
  #key-scale {
    white-space: nowrap;
  }

  [data-light] .globals {
    gap: 12px;
  }

  [data-light] .logo {
    margin-right: 0;
  }
}

/* a phone: the drone's controls in one column (the page scrolls there) */
@media (max-width: 760px) {
  #rhythm-side[data-mode='drone'] {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* a narrow track pane on the desktop (the plugin's smallest window): the Sound tab's columns tighten */
@media (min-width: 761px) {
  @container (max-width: 640px) {
    .sound-body {
      grid-template-columns: 44px minmax(0, 1fr) 150px;
    }

    .sound-body .frow {
      grid-template-columns: 44px minmax(0, 1fr) 34px;
      gap: 6px;
    }

    .sound-body .card {
      padding: 8px;
    }

    .sound-body .card-head {
      gap: 8px;
      min-width: 0;
    }

    #env-val {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    #env-presets.seg button {
      padding: 0 4px;
    }
  }
}

/* ---------- a rhythm track's view: the ring big, its controls placed around it, nothing scrolls ----------
   Wide: the pattern in a column beside the ring, the rest under it. Narrow (the plugin's smallest
   window): the ring top-left with the pattern beside it, the rest underneath, faders on one line. */

/* (desktop and plugin widths; a phone keeps its own stacked layout) */
@media (min-width: 761px) {
  .rhythm-body:not([data-mode='drone']) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 100px 100px;
    grid-template-rows: repeat(5, auto) minmax(0, 1fr) auto auto;
    gap: 12px 16px;
  }

  .rhythm-body:not([data-mode='drone']) #rhythm-side {
    display: contents;
  }

  .rhythm-body:not([data-mode='drone']) .big-ring {
    grid-column: 1 / 3;
    grid-row: 1 / 7;
    min-height: 140px;
  }

  #rhythm-side > .group {
    min-width: 0;
  }

  #rhythm-side .g-hs { grid-column: 3; grid-row: 1; }
  #rhythm-side .g-turn { grid-column: 4; grid-row: 1; }
  #rhythm-side .g-step { grid-column: 3 / 5; grid-row: 2; }
  #rhythm-side .g-rep { grid-column: 3 / 5; grid-row: 3; }
  #rhythm-side .g-sure { grid-column: 3 / 5; grid-row: 4; }
  #rhythm-side .g-len { grid-column: 3 / 5; grid-row: 5; }
  #rhythm-side .group.motion { grid-column: 3 / 5; grid-row: 6; align-self: start; }
  #rhythm-side .group.role { grid-column: 1; grid-row: 7; }
  #rhythm-side .g-reach { grid-column: 2; grid-row: 7; }
  #rhythm-side .g-surprise { grid-column: 3 / 5; grid-row: 7; }
  #rhythm-side .g-sounds { grid-column: 1 / -1; grid-row: 8; }

  #rhythm-side .g-step .row,
  #rhythm-side .g-sounds .row {
    min-width: 0;
  }

  #rhythm-side .g-step #step-base {
    min-width: 0;
  }

  #rhythm-side .g-sounds .row #sounds {
    flex: 1;
  }

  #rhythm-side .label-row {
    gap: 8px;
  }

  #rhythm-side .label-row .value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  @container (max-width: 640px) {
    .rhythm-body:not([data-mode='drone']) {
      grid-template-columns: repeat(4, minmax(0, 1fr));
      grid-template-rows: auto auto minmax(0, 1fr) repeat(4, auto);
      gap: 8px 14px;
    }

    .rhythm-body:not([data-mode='drone']) .big-ring {
      grid-row: 1 / 4;
    }

    #rhythm-side .g-sure { grid-column: 1 / 3; grid-row: 4; }
    #rhythm-side .g-len { grid-column: 3 / 5; grid-row: 4; }
    #rhythm-side .g-reach { grid-column: 1 / 3; grid-row: 5; }
    #rhythm-side .g-surprise { grid-column: 3 / 5; grid-row: 5; }
    #rhythm-side .group.motion { grid-column: 1 / -1; grid-row: 6; }
    #rhythm-side .group.role { grid-column: 1 / 3; grid-row: 7; }
    #rhythm-side .g-sounds { grid-column: 3 / -1; grid-row: 7; }

    /* MOTION: the choice on the left, its settings (when it moves) on the right, compact */
    #rhythm-side .group.motion {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      column-gap: 14px;
      row-gap: 4px;
      align-content: start;
    }

    #rhythm-side .group.motion > .label-row { grid-column: 1; grid-row: 1; }
    #rhythm-side .group.motion > #motion { grid-column: 1; grid-row: 2; }

    #rhythm-side .group.motion .motion-more {
      grid-column: 2;
      grid-row: 1 / span 3;
      display: grid;
      grid-template-columns: auto minmax(30px, 1fr) auto;
      grid-auto-flow: row dense;
      align-items: center;
      gap: 4px 8px;
      margin: 0;
    }

    #rhythm-side .motion-more > .label-row,
    #rhythm-side .motion-size,
    #rhythm-side .motion-size .label-row,
    #rhythm-side .motion-angle,
    #rhythm-side .motion-angle .label-row {
      display: contents;
    }

    #rhythm-side .motion-more > .label-row .value {
      display: none;
    }

    #rhythm-side #motion-bars {
      grid-column: 2 / 4;
      height: 24px;
    }

    #rhythm-side #motion-bars button {
      padding: 0 2px;
      font-size: 11px;
    }

    #rhythm-side .motion-size .label { grid-column: 1; }
    #rhythm-side .motion-size .fd { grid-column: 2; }
    #rhythm-side .motion-size .value { grid-column: 3; }
    #rhythm-side .motion-angle .label { grid-column: 1; }
    #rhythm-side .motion-angle .fd { grid-column: 2; }
    #rhythm-side .motion-angle .value { grid-column: 3; max-width: 70px; overflow: hidden; text-overflow: ellipsis; }

    #rhythm-side .motion-more .fd {
      height: 16px;
    }

    #rhythm-side .motion-dir {
      grid-column: 1 / 4;
    }

    /* ROLE and SOUNDS on one line */
    #rhythm-side .group.role,
    #rhythm-side .g-sounds {
      flex-direction: row;
      align-items: center;
      gap: 8px;
    }

    #rhythm-side .group.role > .label-row #role-val,
    #rhythm-side .g-sounds > .label-row {
      display: none;
    }

    #rhythm-side .group.role .row {
      gap: 4px;
    }

    #rhythm-side .g-sounds .row {
      flex: 1;
      flex-wrap: nowrap;
      gap: 4px;
    }

    #rhythm-side .g-sounds #sounds button {
      padding: 0 6px;
      font-size: 11px;
    }

    #rhythm-side .g-sounds #reroll {
      flex: none;
      padding: 0 9px;
    }

    #rhythm-side .g-sounds #reroll .tx {
      display: none;
    }

    #rhythm-side .group.role .btn {
      white-space: nowrap;
    }

    #rhythm-side > .group {
      gap: 4px;
    }

    #rhythm-side .hs.big {
      font-size: 22px;
    }

    /* label · fader · value, on one line */
    #rhythm-side .g-line {
      display: grid;
      grid-template-columns: auto minmax(30px, 1fr) auto;
      align-items: center;
      column-gap: 8px;
    }

    #rhythm-side .g-line .label-row {
      display: contents;
    }

    #rhythm-side .g-line .label {
      order: 0;
    }

    #rhythm-side .g-line > .fd {
      order: 1;
    }

    #rhythm-side .g-line .value {
      order: 2;
      max-width: 84px;
    }

    #rhythm-side .seg button {
      padding: 0 6px;
    }

    #rhythm-side .group.motion .seg button {
      padding: 0 4px;
      font-size: 11px;
    }
  }
}

/* dragging an effect slot to another place in the chain */
.fx-slot.dragging {
  position: relative;
  z-index: 2;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), inset 0 0 0 1px var(--line);
}

.fx-slot.dragging .slot-head {
  cursor: grabbing;
}

.fx-slot.drop-before {
  box-shadow: 0 -2px 0 var(--track);
}

.fx-slot.drop-after {
  box-shadow: 0 2px 0 var(--track);
}
