/* kit.css — 16-pad Auto Kit surface (web mirror of mobile SamplePadGrid4x4).
 * All colors ride the shared --jamn-* custom properties with hard fallbacks;
 * per-pad tint arrives as an "r,g,b" triple in --pad-tint (set from the
 * server's colorHint by kit.js) so rgba(var(--pad-tint), a) composes the
 * mobile tint-at-opacity fills without per-category CSS. */

.kit-surface {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--jamn-text, #fff);
  /* Single source of truth for the surface column width. The grid AND every
   * row that "stays aligned with .kit-grid" (head, transport, arrangement,
   * layers) read this one var, so widening the pads to fill the desktop can
   * never desync the toolbar/transport above them. 16-mode (4-up) caps
   * narrower than 64-mode so 4 pads don't balloon into hero tiles. */
  --kit-w: min(980px, 94vw);
}

/* 64 (8×8) is eight pads wide, so it earns a wider column than the 4-up grid
 * — ~146px pads at the cap, comfortable without the 4-up's ~240px giants.
 * Only the padCount toggle (setPadCount → syncPadCountUi) sets .kit-is-64, so
 * the whole column resizes in lockstep with the grid. */
.kit-surface.kit-is-64 {
  --kit-w: min(1200px, 94vw);
}

/* ---------- header ---------- */

.kit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  max-width: var(--kit-w); /* stay aligned with .kit-grid */
  margin-inline: auto;
  box-sizing: border-box;
}

.kit-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--jamn-text, #fff);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.kit-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Wrap so no segmented group is clipped off the right edge on narrow
     viewports (mobile web) — every control stays reachable. */
  flex-wrap: wrap;
  row-gap: 8px;
  /* LOCK: the controls always take their OWN full-width row under the
   * title/status line. Without this they are a flex sibling of the status
   * text, so the status changing width ("Loading kit…" → "Loading stems
   * 3/6 — 42 MB…" → "") would reflow where the controls sit. Forcing a
   * 100% basis decouples them: the status can only ever reshuffle the title
   * row above, never the control positions. Every control is built at mount
   * (present-but-disabled, never added post-load), so with a stable row the
   * toolbar is pixel-identical before, during, and after the kit loads. */
  flex-basis: 100%;
}

.kit-seg {
  display: inline-flex;
  background: var(--jamn-surface1, #14141A);
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 8px;
  padding: 2px;
}

.kit-seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--jamn-text2, #A1A1AA);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  /* Trimmed from 12px so the wider One-Shot | Follow | Latch labels still fit
   * the segment on one row; nowrap keeps the hyphen in "One-Shot" from
   * breaking the button across two lines (which would jog the toolbar row). */
  padding: 4px 10px;
  white-space: nowrap;
  border-radius: 6px;
  cursor: pointer;
}

.kit-seg-btn.is-on {
  background: var(--jamn-accent, #8B5CF6);
  color: var(--jamn-text, #fff);
}

.kit-toggle {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--jamn-border, #2A2A36);
  background: var(--jamn-surface1, #14141A);
  color: var(--jamn-text2, #A1A1AA);
  cursor: pointer;
}

.kit-toggle.is-on {
  border-color: var(--jamn-accent, #8B5CF6);
  color: var(--jamn-accent, #8B5CF6);
}

/* Edit chip (launchpad-edit-mode parity): ON gets a faint accent fill on
 * top of the shared .kit-toggle.is-on outline so "pads are editable right
 * now" reads at a glance — the mode changes what a hold/right-click DOES,
 * not just a panel's visibility. */
.kit-toggle.kit-edit.is-on {
  background: rgba(139, 92, 246, 0.14);
}

/* Latch only means something in Loop mode — fade it in Tap. */
.kit-toggle.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.kit-toggle:hover {
  color: var(--jamn-text, #fff);
}

/* Instant Groove: the one prominent header action (desktop's accent
 * "Groove" button) — filled accent, not another quiet outline chip. */
.kit-groove {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--jamn-accent, #8B5CF6);
  background: var(--jamn-accent, #8B5CF6);
  color: var(--jamn-text, #fff);
  cursor: pointer;
  /* The session block beside it is a COLUMN (controls + caption), which
   * makes its wrap-line tall; centering against that dropped Groove below
   * the control row. Top-align so it sits on the same line as the pills. */
  align-self: flex-start;
}

.kit-groove:hover {
  filter: brightness(1.12);
}

/* Disabled while the kit is still loading (renderShell builds this button
 * before s.engine exists) — a click here used to reach instantGroove()'s
 * engine-readiness guard and silently do nothing. */
.kit-groove:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

/* ---------- manual chop-slicing (Stem / Slices / Load) ---------- */

/* Reuses the segmented-group shell (.kit-seg) so the cluster reads as one
 * control, matching the surrounding toolbar rather than raw browser selects. */
.kit-chop {
  gap: 6px;
}

.kit-select {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-inline: 4px;
}

.kit-select-cap {
  font-size: 11px;
  font-weight: 600;
  color: var(--jamn-text2, #A1A1AA);
}

/* Styled to sit inside the segmented shell — no default browser chrome. */
.kit-select-el {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--jamn-text, #fff);
  background: var(--jamn-surface2, #1C1C24);
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 6px;
  padding: 3px 22px 3px 8px;
  cursor: pointer;
  /* Chevron drawn inline so the control needs no external asset. */
  background-image: linear-gradient(45deg, transparent 50%, var(--jamn-text2, #A1A1AA) 50%),
    linear-gradient(135deg, var(--jamn-text2, #A1A1AA) 50%, transparent 50%);
  background-position: right 9px center, right 5px center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.kit-select-el:focus {
  outline: none;
  border-color: var(--jamn-accent, #8B5CF6);
}

.kit-chop-load {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--jamn-accent, #8B5CF6);
  background: transparent;
  color: var(--jamn-accent, #8B5CF6);
  cursor: pointer;
}

.kit-chop-load:hover {
  background: var(--jamn-accent, #8B5CF6);
  color: var(--jamn-text, #fff);
}

/* Disabled while a Load fetch is in flight. */
.kit-chop-load:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ---------- optional Session key/BPM target (Borrow conform) ---------- */

/* OFF by default; songs play TRUE. When on, only ADDED (borrowed) parts are
 * conformed to this key/tempo — never the loaded song's own playback. The
 * cluster stacks its toggle+fields row over a one-line "plays true" hint so
 * the promise stays visible right at the control. */
.kit-session {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.kit-session-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Reuses the .kit-seg segmented shell; hidden until the session is on. */
.kit-session-fields {
  gap: 6px;
}

.kit-session-fields[hidden] {
  display: none;
}

/* Plain number input dressed to match .kit-select-el (no spinner chrome). */
.kit-num {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  width: 52px;
  color: var(--jamn-text, #fff);
  background: var(--jamn-surface2, #1C1C24);
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 6px;
  padding: 3px 6px;
}

.kit-num::-webkit-outer-spin-button,
.kit-num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox drops the number spinners without the browser default chrome. */
.kit-num {
  -moz-appearance: textfield;
}

.kit-num:focus {
  outline: none;
  border-color: var(--jamn-accent, #8B5CF6);
}

.kit-session-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--jamn-text2, #A1A1AA);
  max-width: 340px;
  line-height: 1.3;
}

.kit-session-hint[hidden] {
  display: none;
}

/* Kill All: the panic button — danger-tinted and unmissable. Lives at the
 * right edge of the controls row (margin-left:auto in the flex row) — the
 * kit-level Play/Stop/time bar is gone, the page's bottom transport owns
 * playback. */
.kit-kill {
  margin-left: auto;
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 8px;
  border: 1px solid var(--jamn-danger, #EF4444);
  background: rgba(239, 68, 68, 0.14);
  color: var(--jamn-danger, #EF4444);
  cursor: pointer;
  white-space: nowrap;
}

.kit-kill:hover {
  background: var(--jamn-danger, #EF4444);
  color: var(--jamn-text, #fff);
}

/* ---------- live-capture arrangement ---------- */

/* Own row UNDER the transport: controls line + section strip. Aligned to
 * the same 720px column so it never widens the surface or crowds the
 * transport buttons above it. */
.kit-arr {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: var(--kit-w);
  margin-inline: auto;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: var(--jamn-radius-md, 12px);
  background: var(--jamn-surface1, #14141A);
}

.kit-arr-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kit-arr-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--jamn-text2, #A1A1AA);
  margin-right: 2px;
}

/* Rec: filled red while armed so "we're capturing" is unmistakable. */
.kit-toggle.kit-arr-rec.is-recording {
  border-color: var(--jamn-danger, #EF4444);
  background: rgba(239, 68, 68, 0.16);
  color: var(--jamn-danger, #EF4444);
  animation: kit-arr-rec-pulse 1.2s ease-in-out infinite;
}

@keyframes kit-arr-rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* The section strip: one segment per COLLAPSED block, flex-grown by its
 * duration. position:relative anchors the sweeping playhead. */
.kit-arr-strip {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--jamn-surface2, #1C1C24);
  border: 1px solid var(--jamn-border, #2A2A36);
}

.kit-arr-seg {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-right: 1px solid var(--jamn-border, #2A2A36);
  background: transparent;
  transition: background 0.15s ease;
}

.kit-arr-seg:last-of-type {
  border-right: 0;
}

.kit-arr-seg-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--jamn-text2, #A1A1AA);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* A block that carries captured pads — a soft accent fill + brighter label. */
.kit-arr-seg.has-pads {
  background: rgba(139, 92, 246, 0.16);
}

.kit-arr-seg.has-pads .kit-arr-seg-label {
  color: var(--jamn-text, #fff);
}

/* The block the song is currently inside. */
.kit-arr-seg.is-active {
  background: rgba(139, 92, 246, 0.30);
}

.kit-arr-seg.is-active .kit-arr-seg-label {
  color: var(--jamn-text, #fff);
}

/* Live playhead: a thin accent line swept by the arrangement poll. */
.kit-arr-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--jamn-accent, #8B5CF6);
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.9);
  pointer-events: none;
  z-index: 2;
}

.kit-arr-note {
  font-size: 12px;
  color: var(--jamn-text2, #A1A1AA);
  opacity: 0.8;
}

/* ---------- grid ---------- */

.kit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px; /* matches mobile tile spacing */
  /* Never wider than the visible content area — a fixed 4-up grid was
   * clipping its right column off-screen next to the 260px sidebar. */
  width: 100%;
  /* Launchpad scale: square pads that fill the desktop column (~240px at
   * 4-up, ~146px at 8-up) instead of small centred tiles marooned in empty
   * margin. The cap rides --kit-w so head/transport/arrangement track it. */
  max-width: var(--kit-w);
  margin-inline: auto;
  box-sizing: border-box;
}

/* Loading shimmer + status: the bare skeleton read as "dead page"
 * during the multi-second stem fetch (no spinner anywhere). */
.kit-pad.is-skeleton {
  animation: kit-shimmer 1.2s ease-in-out infinite;
}
@keyframes kit-shimmer {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}
.kit-status {
  font-size: 0.85rem;
  color: var(--jamn-text2, #A1A1AA);
  margin-left: 12px;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Borrow fill row: the Jamtide mark breathing as a wave (twin of
   JamnWaveLoader.swift — profile .42/.68/1/.68/.42, 1.1 s cycle, per-bar
   lag 0.9 rad ≈ 0.158 s) beside "Filling pads n/N". */
.kit-status:has(.jamn-wave) { display: flex; align-items: center; gap: 8px; }
.kit-status-text { overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.jamn-wave { display: inline-flex; align-items: center; gap: 2px; height: 14px; flex: none; }
.jamn-wave i {
  display: block; width: 2.5px; border-radius: 2px;
  background: linear-gradient(180deg, #A855F7, #6366F1);
  transform-origin: center;
  animation: jamn-wave 1.1s ease-in-out infinite;
}
.jamn-wave i:nth-child(1), .jamn-wave i:nth-child(5) { height: 42%; }
.jamn-wave i:nth-child(2), .jamn-wave i:nth-child(4) { height: 68%; }
.jamn-wave i:nth-child(3) { height: 100%; }
.jamn-wave i:nth-child(2) { animation-delay: 0.158s; }
.jamn-wave i:nth-child(3) { animation-delay: 0.315s; }
.jamn-wave i:nth-child(4) { animation-delay: 0.473s; }
.jamn-wave i:nth-child(5) { animation-delay: 0.630s; }
@keyframes jamn-wave {
  0%, 100% { transform: scaleY(0.35); opacity: 0.55; }
  50% { transform: scaleY(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .jamn-wave i { animation: none; } }
/* A borrow pad still downloading: placed (layout never shifts) but dim. */
.kit-pad.kit-pad--pending { opacity: 0.45; animation: kit-shimmer 1.2s ease-in-out infinite; }

.kit-pad {
  --pad-tint: 139, 92, 246; /* accent fallback until kit.js sets colorHint */
  position: relative;
  appearance: none;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: var(--jamn-radius-lg, 16px);
  /* Idle filled pad: tint at low opacity over the surface — the mobile
   * "0.30 over near-black" look ("filled must not read as dead"). */
  background:
    linear-gradient(rgba(var(--pad-tint), 0.28), rgba(var(--pad-tint), 0.28)),
    var(--jamn-surface2, #1C1C24);
  aspect-ratio: 1 / 1;
  min-height: 64px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 4px;
  cursor: pointer;
  overflow: hidden;
  touch-action: none; /* pointer events own the gesture (no scroll/zoom steal) */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.kit-pad.is-playing {
  /* Stronger tint while ringing (mobile bumps 0.30 → 0.50). */
  background:
    linear-gradient(rgba(var(--pad-tint), 0.5), rgba(var(--pad-tint), 0.5)),
    var(--jamn-surface2, #1C1C24);
  border-color: rgba(255, 255, 255, 0.85);
}

.kit-pad.is-pressed {
  box-shadow: inset 0 0 0 100vmax rgba(255, 255, 255, 0.18);
}

.kit-pad.is-empty {
  background: var(--jamn-surface1, #14141A);
  cursor: default;
  opacity: 0.5;
}

/* Duplicate placement mode: while a copy is waiting to be dropped, every
 * empty pad becomes a pulsing drop target and everything else dims, so the
 * one gesture left (tap an empty pad) reads at a glance. */
.kit-grid.is-dup-mode .kit-pad.is-dup-dim {
  opacity: 0.32;
  filter: saturate(0.6);
}
.kit-grid.is-dup-mode .kit-pad.is-dup-source {
  /* The source keeps a faint accent outline so you can see what's copying. */
  outline: 1.5px dashed rgba(var(--pad-tint), 0.9);
  outline-offset: -3px;
  opacity: 0.5;
}
.kit-grid.is-dup-mode .kit-pad.is-drop-target {
  /* Override .is-empty's dead look — these are the live targets. */
  opacity: 1;
  cursor: copy;
  border-color: var(--jamn-accent, #8B5CF6);
  border-style: dashed;
  background:
    linear-gradient(rgba(139, 92, 246, 0.16), rgba(139, 92, 246, 0.16)),
    var(--jamn-surface1, #14141A);
  animation: kit-dup-pulse 1.1s ease-in-out infinite;
}
.kit-grid.is-dup-mode .kit-pad.is-drop-target:hover {
  background:
    linear-gradient(rgba(139, 92, 246, 0.3), rgba(139, 92, 246, 0.3)),
    var(--jamn-surface1, #14141A);
}
@keyframes kit-dup-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.25); }
  50%      { box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.75),
                         0 0 10px rgba(139, 92, 246, 0.35); }
}
@media (prefers-reduced-motion: reduce) {
  .kit-grid.is-dup-mode .kit-pad.is-drop-target { animation: none; }
}

/* Full-grid REPLACE targets: filled pads that can be overwritten with the
   copy. Amber (not the green add colour) so the destructive drop reads
   differently — these keep their sound/waveform, just gain an amber ring. */
.kit-grid.is-dup-mode .kit-pad.is-replace-target {
  opacity: 1;
  cursor: copy;
  border-color: #F59E0B;
  border-style: dashed;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.55);
  animation: kit-dup-replace-pulse 1.1s ease-in-out infinite;
}
.kit-grid.is-dup-mode .kit-pad.is-replace-target:hover {
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.9),
              0 0 10px rgba(245, 158, 11, 0.35);
}
@keyframes kit-dup-replace-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.3); }
  50%      { box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.8),
                         0 0 10px rgba(245, 158, 11, 0.4); }
}
@media (prefers-reduced-motion: reduce) {
  .kit-grid.is-dup-mode .kit-pad.is-replace-target { animation: none; }
}
.kit-dup-hint.is-replace {
  border-color: #F59E0B;
}

/* Placement hint banner (mirrors .kit-toast placement, sits just above it). */
.kit-dup-hint {
  position: fixed;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%);
  z-index: 1001;
  padding: 8px 16px;
  border: 1px solid var(--jamn-accent, #8B5CF6);
  border-radius: var(--jamn-radius-md, 12px);
  background: var(--jamn-surface1, #14141A);
  color: var(--jamn-text, #fff);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  animation: kit-toast-in 0.18s ease-out;
}

/* Move mode (pad-move-swap, desktop moveModeOverlay): every filled pad gets
 * a dashed accent outline + grab cursor so "these can be picked up" reads
 * before the first drag; while dragging, the lifted pad fades and the cell
 * under the pointer lights as the drop target (an empty one included —
 * that's a move, so it must stop looking dead). */
/* The hint floats over the bottom rows; the drop cell is hit-tested with
 * elementFromPoint, so the banner must be transparent to it or a drag
 * released under it would read as "off the grid" and cancel. */
.kit-move-hint {
  pointer-events: none;
}
.kit-toggle.kit-move.is-on {
  background: rgba(139, 92, 246, 0.14);
}
.kit-grid.is-move-mode .kit-pad:not(.is-empty) {
  cursor: grab;
  outline: 1.5px dashed rgba(139, 92, 246, 0.6);
  outline-offset: -3px;
}
.kit-grid.is-move-mode.is-move-dragging,
.kit-grid.is-move-mode.is-move-dragging .kit-pad {
  cursor: grabbing;
}
.kit-grid.is-move-mode .kit-pad.is-move-source {
  opacity: 0.4;
  outline: 2px solid var(--jamn-accent, #8B5CF6);
}
.kit-grid.is-move-mode .kit-pad.is-move-target {
  opacity: 1;
  border-color: var(--jamn-accent, #8B5CF6);
  outline: 2px solid var(--jamn-accent, #8B5CF6);
  box-shadow: inset 0 0 0 100vmax rgba(139, 92, 246, 0.22),
              0 0 12px rgba(139, 92, 246, 0.45);
}

.kit-pad-name {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  color: var(--jamn-text, #fff);
  text-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.45); /* scrim: readable mid-flash */
  /* Truncate at two lines like the mobile tile label. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  pointer-events: none;
}

/* Source-song label (Borrow): which song a pad's loop came from. The tint
 * (blue = this song, amber = borrowed) carries the same signal in colour;
 * this line makes it readable. Sits under the name, above the waveform. */
.kit-pad-source {
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  pointer-events: none;
}

/* Donor tempo-stretch badge on the source line (>= ±10%): warn tint so a
 * heavily stretched borrow is visibly flagged. */
.kit-pad-stretch { color: var(--jamn-warn, #F59E0B); font-weight: 700; }

.kit-grid.kit-grid-64 .kit-pad-source {
  font-size: 8px;
  line-height: 1.1;
}

.kit-pad-wave {
  /* Fill the tile body so the waveform reads mid-pad like the native
   * tiles (a 30px bottom strip read as a footer, not the pad's face). */
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  align-self: stretch;
  pointer-events: none;
}

/* Elapsed sweep + playhead over the tile while playing (mobile
 * loopPlayhead: translucent elapsed region ending in a bright line). */
.kit-pad-sweep {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(255, 255, 255, 0.14);
  border-right: 2px solid rgba(255, 255, 255, 0.95);
  pointer-events: none;
}

.kit-pad:not(.is-playing) .kit-pad-sweep {
  display: none;
}

/* Progress ring: kit.js paints a conic-gradient into this element each
 * frame; the mask hollows it to a 2.5px edge ring hugging the tile radius. */
.kit-pad-ring {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2.5px;
  background: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* Armed: triggered but waiting for the quantize boundary — pulsing tinted
 * border reads "waiting for the beat", not broken silence. */
.kit-pad.is-armed {
  border-color: rgba(var(--pad-tint), 0.9);
  animation: kit-armed-pulse 0.9s ease-in-out infinite;
}

@keyframes kit-armed-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--pad-tint), 0.0); }
  50%      { box-shadow: 0 0 0 3px rgba(var(--pad-tint), 0.45); }
}

/* ---------- loading skeleton ---------- */

.kit-pad.is-skeleton {
  border-color: var(--jamn-border, #2A2A36);
  background: var(--jamn-surface1, #14141A);
  cursor: default;
  animation: kit-skeleton 1.2s ease-in-out infinite;
}

@keyframes kit-skeleton {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.85; }
}

/* ---------- 8×8 compact grid (header 64 toggle / ?pads=64) ---------- */

/* Header + transport + arrangement + grid all widen together in 64 mode via
 * the --kit-w bump on .kit-surface.kit-is-64 (above) — no per-row max-width
 * override needed here; the grid only changes its column count + gap. */
.kit-grid.kit-grid-64 {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}

.kit-grid.kit-grid-64 .kit-pad {
  min-height: 44px;
  padding: 5px;
  border-radius: 10px;
}

.kit-grid.kit-grid-64 .kit-pad-name {
  font-size: 9px;
  -webkit-line-clamp: 1;
}

.kit-grid.kit-grid-64 .kit-pad-badge {
  font-size: 9px;
  padding: 1px 4px;
}

/* Step dots don't survive ~100px tiles — the simplified waveform is the
 * only chrome the compact grid keeps. */
.kit-grid.kit-grid-64 .kit-pad-steps {
  display: none;
}

/* ---------- sequence step dots (kit defaultSequence, kind=flip) ---------- */

.kit-pad-steps {
  display: flex;
  gap: 2px;
  align-items: center;
  pointer-events: none;
}

.kit-pad-step {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  flex: none;
}

.kit-pad-step.is-on {
  background: rgba(255, 255, 255, 0.9);
}

/* ---------- layers view (desktop LayerStackView rack) ---------- */

.kit-layers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: var(--kit-w); /* stay aligned with .kit-grid */
  margin-inline: auto;
  box-sizing: border-box;
}

.kit-layer-row {
  --pad-tint: 139, 92, 246;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: var(--jamn-radius-md, 12px);
  background: var(--jamn-surface1, #14141A);
}

.kit-layer-row.is-live {
  border-color: rgba(var(--pad-tint), 0.55);
  background:
    linear-gradient(rgba(var(--pad-tint), 0.10), rgba(var(--pad-tint), 0.10)),
    var(--jamn-surface1, #14141A);
}

/* Armed layer: same "waiting for the beat" pulse as the grid pads. */
.kit-layer-row.is-armed {
  animation: kit-armed-pulse 0.9s ease-in-out infinite;
}

.kit-layer-bar {
  width: 6px;
  height: 32px;
  border-radius: 3px;
  background: rgba(var(--pad-tint), 0.95);
  flex: none;
}

.kit-layer-cat {
  width: 66px;
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(var(--pad-tint), 0.95);
}

.kit-layer-active {
  flex: 0 0 150px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kit-layer-wave {
  width: 100%;
  height: 22px;
}

.kit-layer-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--jamn-text, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kit-layer-play {
  appearance: none;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--jamn-border, #2A2A36);
  background: var(--jamn-surface2, #1C1C24);
  color: var(--jamn-text, #fff);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.kit-layer-row.is-live .kit-layer-play {
  border-color: rgba(var(--pad-tint), 0.9);
  color: rgba(var(--pad-tint), 0.95);
}

/* Swap picker: the category's pads as chips, best score first. */
.kit-layer-chips {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.kit-layer-chip {
  appearance: none;
  flex: none;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--jamn-border, #2A2A36);
  background: var(--jamn-surface2, #1C1C24);
  color: var(--jamn-text2, #A1A1AA);
  cursor: pointer;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kit-layer-chip:hover {
  color: var(--jamn-text, #fff);
}

.kit-layer-chip.is-on {
  border-color: rgba(var(--pad-tint), 0.9);
  color: var(--jamn-text, #fff);
  background:
    linear-gradient(rgba(var(--pad-tint), 0.25), rgba(var(--pad-tint), 0.25)),
    var(--jamn-surface2, #1C1C24);
}

/* ---------- per-pad override badge ---------- */

/* Radial loop/one-shot override marker: ∞ (forced loop) or 1 (forced
 * one-shot) in the pad's top-right corner; hidden when following mode. */
.kit-pad-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--jamn-text, #fff);
  display: none;
  pointer-events: none;
}

.kit-pad-badge.is-on {
  display: block;
}

/* "FX" chip: pad carries non-neutral per-pad effects (radial Effects).
 * Bottom-right corner — the name owns the top-left and the loop badge the
 * top-right, and the dark scrim keeps it readable over the waveform. */
.kit-pad-fx {
  position: absolute;
  bottom: 5px;
  right: 6px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  padding: 2px 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(var(--pad-tint), 0.95);
  display: none;
  pointer-events: none;
}

.kit-pad-fx.is-on {
  display: block;
}

/* ---------- radial pad menu ---------- */

.kit-radial-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  /* Stronger dim + blur: the wheel floats over busy waveforms — at 0.4
   * the buttons read as unrelated circles lost in the pad noise. */
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.kit-radial {
  position: absolute; /* left/top set by kit.js at the (clamped) cursor */
  --pad-tint: 139, 92, 246;
  width: 0;
  height: 0;
}

/* The pie wheel itself — a single SVG of equal wedges (desktop
 * PadRadialMenu parity). Empty regions carry pointer-events:none so a
 * click outside the ring falls through to the backdrop and dismisses;
 * only the wedge slices below re-enable hit-testing. */
.kit-radial-svg {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 12px 48px rgba(0, 0, 0, 0.6));
}

/* One pie slice. The slice captures the pointer; icon/label ride on top
 * but stay inert, so a click ANYWHERE in the wedge fires the action and a
 * hover highlights the whole wedge (not a floating bubble). */
.kit-wedge-slice {
  pointer-events: fill;
  fill: rgba(28, 28, 36, 0.92); /* --jamn-surface2 over the scrim */
  stroke: rgba(255, 255, 255, 0.1); /* the divider line between wedges */
  stroke-width: 1;
  transition: fill 0.1s ease, stroke 0.1s ease;
}

.kit-wedge-icon,
.kit-wedge-label {
  pointer-events: none;
  font-family: inherit;
}

.kit-wedge-icon {
  font-size: 17px;
  font-weight: 600;
  fill: rgba(var(--pad-tint), 0.95); /* tinted icons over the dark ring */
}

/* Labels ALWAYS visible (mobile radial convention). */
.kit-wedge-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  fill: var(--jamn-text2, #A1A1AA);
}

/* Hover / press highlights the WEDGE. */
.kit-wedge:hover .kit-wedge-slice {
  fill: rgba(var(--pad-tint), 0.28);
  stroke: rgba(var(--pad-tint), 0.75);
}
.kit-wedge:hover .kit-wedge-label {
  fill: var(--jamn-text, #fff);
}
.kit-wedge:active .kit-wedge-slice {
  fill: rgba(var(--pad-tint), 0.42);
}

/* Active state (e.g. loop engaged, FX present) — a persistent tint. */
.kit-wedge.is-active .kit-wedge-slice {
  fill: rgba(var(--pad-tint), 0.22);
  stroke: rgba(var(--pad-tint), 0.7);
}

.kit-wedge.is-danger .kit-wedge-icon {
  fill: var(--jamn-danger, #EF4444);
}
.kit-wedge.is-danger:hover .kit-wedge-slice {
  fill: rgba(239, 68, 68, 0.28);
  stroke: rgba(239, 68, 68, 0.8);
}

.kit-wedge.is-disabled {
  opacity: 0.35;
}
.kit-wedge.is-disabled .kit-wedge-slice {
  pointer-events: none;
}

/* Solid center hub: pad name + mini waveform, doubles as the cancel zone
 * (desktop's inner circle / identity icon). Size set inline by kit.js. */
.kit-radial-hub {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  appearance: none;
  border: 1px solid var(--jamn-border, #2A2A36);
  background: var(--jamn-surface1, #14141A);
  color: var(--jamn-text2, #A1A1AA);
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 6px 28px rgba(0, 0, 0, 0.55);
}
.kit-radial-hub:hover {
  border-color: rgba(var(--pad-tint), 0.6);
}

.kit-radial-hub-wave {
  width: 68%;
  height: 20px;
  display: block;
}

.kit-radial-hub-name {
  font-size: 10px;
  font-weight: 600;
  max-width: 86%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* ---------- per-pad FX popover (radial Effects) ---------- */

.kit-fx-pop {
  position: fixed;
  z-index: 1002; /* above the radial backdrop — Effects opens from it */
  --pad-tint: 139, 92, 246;
  width: 264px;
  padding: 10px 12px 8px;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-top: 2px solid rgba(var(--pad-tint), 0.9);
  border-radius: var(--jamn-radius-md, 12px);
  background: var(--jamn-surface1, #14141A);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

.kit-fx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.kit-fx-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--jamn-text, #fff);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kit-fx-close {
  appearance: none;
  border: none;
  background: none;
  color: var(--jamn-text2, #A1A1AA);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}

.kit-fx-close:hover {
  color: var(--jamn-text, #fff);
}

.kit-fx-row {
  display: grid;
  grid-template-columns: 74px 1fr 52px;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.kit-fx-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--jamn-text2, #A1A1AA);
  white-space: nowrap;
}

.kit-fx-row input[type="range"] {
  width: 100%;
  accent-color: rgb(var(--pad-tint));
}

.kit-fx-val {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--jamn-text, #fff);
}

.kit-fx-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.kit-fx-hint {
  font-size: 10px;
  color: var(--jamn-text2, #A1A1AA);
  opacity: 0.8;
}

.kit-fx-reset {
  appearance: none;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 8px;
  background: var(--jamn-surface2, #1C1C24);
  color: var(--jamn-text, #fff);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
}

.kit-fx-reset:hover {
  border-color: rgba(var(--pad-tint), 0.9);
}

/* ---------- toast ---------- */

.kit-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 1001;
  padding: 8px 16px;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: var(--jamn-radius-md, 12px);
  background: var(--jamn-surface1, #14141A);
  color: var(--jamn-text, #fff);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  animation: kit-toast-in 0.18s ease-out;
}

/* Action button inside a toast (Delete's Undo). */
.kit-toast .kit-toast-act {
  appearance: none;
  border: none;
  background: none;
  margin-left: 12px;
  padding: 0;
  color: var(--jamn-accent, #8B5CF6);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.kit-toast .kit-toast-act:hover {
  text-decoration: underline;
}

@keyframes kit-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- error ---------- */

.kit-error {
  padding: 14px 16px;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: var(--jamn-radius-lg, 16px);
  background: var(--jamn-surface1, #14141A);
  color: var(--jamn-text2, #A1A1AA);
  font-size: 13px;
}

/* ---------- Remix bar (remix.js, mounted above the kit) ----------
 * Web home of the native Remix sheets. Buttons ride the shared
 * .tab-control-btn look (jam.css) inside a .tab-control-group; the
 * extra classes below only add layout + the busy/active affordances
 * the sheets show per row. */

.remix-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  /* remix-bar mounts in #remix-root (a sibling of .kit-surface, not a
   * descendant), so --kit-w can't cascade here — pin the 16-mode default so
   * it aligns with the grid's common state. */
  max-width: min(980px, 94vw); /* align with .kit-head / .kit-grid */
  margin: 0 auto 10px;
  box-sizing: border-box;
}

.remix-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--jamn-text2, #A1A1AA);
}

.remix-group {
  display: inline-flex;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 8px;
  background: var(--jamn-surface1, #14141A);
  overflow: hidden;
}

.remix-btn {
  white-space: nowrap;
  padding: 5px 10px;
}

.remix-btn.is-active {
  color: var(--jamn-bg, #0B0B0F);
  background: var(--jamn-accent, #8B5CF6);
}

/* Busy = quiet pulse, not a spinner — matches the pad "armed" idiom. */
.remix-btn.is-busy {
  color: var(--jamn-text, #fff);
  animation: kit-skeleton 1.2s ease-in-out infinite;
  cursor: progress;
}

.remix-btn:disabled:not(.is-busy) {
  opacity: 0.45;
  cursor: default;
}

.remix-error {
  font-size: 12px;
  color: var(--jamn-danger, #EF4444);
}

/* Re-Drum donor rows expand under the bar on their own line. */
.remix-donors {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.remix-donors .remix-btn {
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 8px;
  background: var(--jamn-surface1, #14141A);
}

.remix-note {
  font-size: 12px;
  color: var(--jamn-text2, #A1A1AA);
}

/* ---------- "+ Add from another song" (Borrow) ---------- */

/* Toolbar button: accent-outline, matching the chop "Load" chip so it reads
 * as a first-class action in the controls row (not a raw browser widget). */
/* ♥ Favourite (beside "+ Add from another song"): saves the song + its
   borrowed loops to Songs → Favourites. */
.kit-fav-btn {
  appearance: none;
  border: 1px solid var(--jamn-accent, #8B5CF6);
  background: transparent;
  color: var(--jamn-accent, #8B5CF6);
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.kit-fav-btn:hover { background: rgba(139, 92, 246, .14); }
.kit-fav-btn:focus-visible { outline: 2px solid var(--jamn-accent, #8B5CF6); outline-offset: 1px; }

.kit-borrow-btn {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--jamn-accent, #8B5CF6);
  background: transparent;
  color: var(--jamn-accent, #8B5CF6);
  cursor: pointer;
  white-space: nowrap;
}

.kit-borrow-btn:hover,
.kit-borrow-btn.is-open {
  background: var(--jamn-accent, #8B5CF6);
  color: var(--jamn-text, #fff);
}

/* 🎲 Roulette (roulette.js): prominent like Groove — filled accent — since
 * it's a whole-surface action (loads a new pair), not a per-pad tweak. */
.kit-roulette-btn {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--jamn-accent, #8B5CF6);
  background: var(--jamn-accent, #8B5CF6);
  color: var(--jamn-text, #fff);
  cursor: pointer;
  white-space: nowrap;
}

.kit-roulette-btn:hover { filter: brightness(1.12); }
.kit-roulette-btn:focus-visible { outline: 2px solid var(--jamn-text, #fff); outline-offset: 1px; }

/* The popover — house style (mirror of .kit-fx-pop): fixed, accent top rule,
 * clamped on-viewport by kit.js. */
.kit-borrow-pop {
  position: fixed;
  z-index: 1002;
  width: 288px;
  max-width: calc(100vw - 16px);
  padding: 10px 12px 10px;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-top: 2px solid var(--jamn-accent, #8B5CF6);
  border-radius: var(--jamn-radius-md, 12px);
  background: var(--jamn-surface1, #14141A);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

.kit-borrow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.kit-borrow-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--jamn-text, #fff);
}

.kit-borrow-close {
  appearance: none;
  border: none;
  background: none;
  color: var(--jamn-text2, #A1A1AA);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}

.kit-borrow-close:hover {
  color: var(--jamn-text, #fff);
}

/* Part selector — the segmented-group shell, so it matches the toolbar. */
.kit-borrow-parts {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--jamn-surface1, #14141A);
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 8px;
  margin-bottom: 8px;
}

.kit-borrow-part {
  appearance: none;
  flex: 1 1 0;
  border: 0;
  background: transparent;
  color: var(--jamn-text2, #A1A1AA);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.kit-borrow-part.is-on {
  background: var(--jamn-accent, #8B5CF6);
  color: var(--jamn-text, #fff);
}

/* Candidate list. Scrolls if a user has many analyzed songs. */
.kit-borrow-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

.kit-borrow-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--jamn-text2, #A1A1AA);
  padding: 6px 2px;
}

/* Small inline spinner for "Finding compatible loops…". */
.kit-borrow-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--jamn-border, #2A2A36);
  border-top-color: var(--jamn-accent, #8B5CF6);
  animation: kit-borrow-spin 0.7s linear infinite;
  flex: 0 0 auto;
}

@keyframes kit-borrow-spin {
  to { transform: rotate(360deg); }
}

/* One donor row — full-width button; name + key/tempo on the left, the
 * Add / Loading… affordance on the right. */
.kit-borrow-cand {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 8px;
  background: var(--jamn-surface2, #1C1C24);
  color: var(--jamn-text, #fff);
  font: inherit;
  cursor: pointer;
}

.kit-borrow-cand:hover:not(:disabled) {
  border-color: var(--jamn-accent, #8B5CF6);
}

.kit-borrow-cand:disabled {
  opacity: 0.5;
  cursor: default;
}

.kit-borrow-cand.is-busy {
  border-color: var(--jamn-accent, #8B5CF6);
  opacity: 1;
}

.kit-borrow-cand-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.kit-borrow-cand-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kit-borrow-cand-meta {
  font-size: 11px;
  color: var(--jamn-text2, #A1A1AA);
  font-variant-numeric: tabular-nums;
}

.kit-borrow-cand-act {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--jamn-accent, #8B5CF6);
}

.kit-borrow-cand:disabled .kit-borrow-cand-act {
  color: var(--jamn-text2, #A1A1AA);
}

/* ---------- Vinyl Crate (shared CC donor pool) ---------- */

/* The crate's browse form needs more width than a bare donor list. */
.kit-borrow-pop.is-crate {
  width: 340px;
}

/* Source toggle: My songs | Crate — the segmented-group shell. */
.kit-borrow-src {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--jamn-surface1, #14141A);
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 8px;
  margin-bottom: 8px;
}

.kit-borrow-srcbtn {
  appearance: none;
  flex: 1 1 0;
  border: 0;
  background: transparent;
  color: var(--jamn-text2, #A1A1AA);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.kit-borrow-srcbtn.is-on {
  background: var(--jamn-accent, #8B5CF6);
  color: var(--jamn-text, #fff);
}

/* Crate controls block — sub-mode toggle + genre affinity / facet form. */
.kit-crate-ctrls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.kit-crate-ctrls[hidden] {
  display: none;
}

/* Sub-mode: For your session | Browse crate. */
.kit-crate-mode {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--jamn-surface1, #14141A);
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 8px;
}

.kit-crate-modebtn {
  appearance: none;
  flex: 1 1 0;
  border: 0;
  background: transparent;
  color: var(--jamn-text2, #A1A1AA);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.kit-crate-modebtn.is-on {
  background: var(--jamn-accent, #8B5CF6);
  color: var(--jamn-text, #fff);
}

/* Genre affinity row (match mode). */
.kit-crate-genremode {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kit-crate-flabel {
  font-size: 11px;
  font-weight: 600;
  color: var(--jamn-text2, #A1A1AA);
}

/* A pill — genre affinity toggle + facet-count chips share this look. */
.kit-crate-chip {
  appearance: none;
  border: 1px solid var(--jamn-border, #2A2A36);
  background: var(--jamn-surface2, #1C1C24);
  color: var(--jamn-text2, #A1A1AA);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.kit-crate-chip.is-on {
  border-color: var(--jamn-accent, #8B5CF6);
  background: var(--jamn-accent, #8B5CF6);
  color: var(--jamn-text, #fff);
}

/* Facet form (browse mode). */
.kit-crate-facets {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kit-crate-q {
  appearance: none;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 12px;
  padding: 6px 9px;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 8px;
  background: var(--jamn-surface2, #1C1C24);
  color: var(--jamn-text, #fff);
}

.kit-crate-q:focus,
.kit-crate-input:focus {
  outline: none;
  border-color: var(--jamn-accent, #8B5CF6);
}

.kit-crate-fgrid {
  display: flex;
  gap: 6px;
}

.kit-crate-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;
}

.kit-crate-input {
  appearance: none;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 12px;
  padding: 5px 7px;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 7px;
  background: var(--jamn-surface2, #1C1C24);
  color: var(--jamn-text, #fff);
}

.kit-crate-num {
  font-variant-numeric: tabular-nums;
}

.kit-crate-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.kit-crate-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--jamn-text2, #A1A1AA);
  cursor: pointer;
}

.kit-crate-check input {
  accent-color: var(--jamn-accent, #8B5CF6);
}

.kit-crate-chiphost {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kit-crate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Crate row — the donor-row shell plus a required attribution sub-line. */
.kit-crate-namerow {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* The BY-SA share-alike badge (informational: outputs get labelled). */
.kit-crate-lock {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--jamn-warn, #F59E0B);
  border: 1px solid var(--jamn-warn, #F59E0B);
  border-radius: 4px;
  padding: 1px 4px;
}

/* Attribution (CC-BY obligation) — always visible on every crate row. */
.kit-crate-attrib {
  font-size: 10px;
  color: var(--jamn-text2, #A1A1AA);
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ⌨ Keys toggle + per-pad key caps (computer-keyboard pad play). */
.kit-keys-btn {
  appearance: none; cursor: pointer;
  border: 1px solid var(--jamn-border, #2A2A36);
  background: transparent; color: var(--jamn-text2, #A1A1AA);
  border-radius: 8px; padding: 4px 9px; font: inherit; font-size: .8rem;
}
.kit-keys-btn.is-on {
  border-color: var(--jamn-accent, #8B5CF6); color: var(--jamn-text, #fff);
  background: rgba(139, 92, 246, .18);
}
.kit-keys-btn:focus-visible { outline: 2px solid var(--jamn-accent, #8B5CF6); outline-offset: 1px; }
/* ⏱ Clock switched on but still waiting for MIDI access (first gesture or
   the browser prompt): dashed, so it never reads as sending when it isn't. */
.kit-keys-btn.is-pending { border-style: dashed; color: var(--jamn-text, #fff); }
.kit-keys-btn:disabled { opacity: .45; cursor: not-allowed; }
/* Bottom-left: the name owns the top-left, the loop badge the top-right and
   the FX chip the bottom-right. */
.kit-pad-key {
  position: absolute; bottom: 5px; left: 6px; z-index: 2;
  font-size: .62rem; font-weight: 700; line-height: 1;
  padding: 2px 4px; border-radius: 999px;
  color: rgba(255, 255, 255, .7); background: rgba(0, 0, 0, .28);
  pointer-events: none;
}

/* ---------- Slip pads page (Stem Slip) ---------- */

/* "Slip pads" chip: amber while up, matching the Launchpad Note 94 LED
 * (§4.5's amber-dim/amber). Reuses .kit-toggle's base look. */
.kit-toggle.kit-slip-page.is-on {
  border-color: #F59E0B;
  color: #F59E0B;
  background: rgba(245, 158, 11, .14);
}

.kit-focus-wrap {
  display: inline-flex;
  align-items: center;
}

.kit-slip-hint {
  width: 100%;
  text-align: center;
  font-size: .8rem;
  color: var(--jamn-text2, #A1A1AA);
  padding: 2px 0 6px;
}
.kit-slip-hint[hidden] { display: none; }

/* The whole page dims while the transport isn't playing ("Play the song to
 * slip it" — a cell can't land anywhere without a shadow to land on). */
.kit-grid.is-slip-dim { opacity: .5; }

.kit-slip-cell {
  justify-content: center;
  align-items: center;
  gap: 2px;
}

.slip-row-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
}

.kit-slip-label {
  font-size: 20px;
  font-weight: 800;
  color: var(--jamn-text, #fff);
}

.kit-slip-cell.is-unavailable {
  opacity: .28;
  cursor: not-allowed;
}

/* Held (a row's top stack entry, whether or not audio has handed over
 * yet) vs. active (actually sounding — the lane past its handover, or a
 * KILL in effect). Active pulses gently so a long roll reads as alive. */
.kit-slip-cell.is-held {
  border-color: rgba(255, 255, 255, .85);
  background:
    linear-gradient(rgba(var(--pad-tint), .45), rgba(var(--pad-tint), .45)),
    var(--jamn-surface2, #1C1C24);
}
.kit-slip-cell.is-active {
  border-color: rgba(255, 255, 255, .95);
  background:
    linear-gradient(rgba(var(--pad-tint), .65), rgba(var(--pad-tint), .65)),
    var(--jamn-surface2, #1C1C24);
  animation: kit-slip-pulse .6s ease-in-out infinite;
}
@keyframes kit-slip-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}
@media (prefers-reduced-motion: reduce) {
  .kit-slip-cell.is-active { animation: none; }
}

/* Focus (Acapella/Instrumental) silences this row's part. */
.kit-slip-cell.is-focus-dim { opacity: .4; }

/* Refusal: a 200ms red flash (§3.14 — "the cell or LED flashes red"). */
.kit-slip-cell.is-refused {
  animation: kit-slip-refused .2s ease-in-out;
}
@keyframes kit-slip-refused {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: inset 0 0 0 100vmax rgba(239, 68, 68, .55); }
}

/* Slip (takeover) switch: reuse .kit-toggle.is-on, no extra tint needed —
 * it's a plain on/off, not a mode with its own colour language. */

/* ---------- Perform sidebar layout (ui/web-perform-sidebar, desktop twin
 * ui/desktop-sidebar-grid) — LEFT sidebar beside the pad grid, replacing the
 * old flat toolbar row above it: compact header, a 2×2 hero grid of the
 * four most-used actions, always-visible core controls, then everything
 * else in collapsible sections. Every control inside is the SAME element
 * built earlier in this file (renderShell) — this block only lays them
 * out; none of their classes/behavior changed. ---------- */

.kit-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}

.kit-sidebar {
  --kit-hero-accent: #a855f7; /* Jamtide violet, per the shared sidebar spec */
  flex: 0 0 260px;
  width: 260px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* The sidebar can carry more content than the grid is tall (many
   * sections open at once) — its own scroll, never the page's. */
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.kit-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Pads · Live view switch (owner amendment 2026-09-28) -------
   TOP-most, primary sidebar control, above even the compact header —
   supersedes the old lone .pb-live-btn toggle that lived on the transport
   row (jam.css). A real two-button segmented switch; colors carried over
   1:1 from that old button's is-on state (solid accent fill selected,
   plain/ghost unselected) so nothing about how it READS changed, only
   where it lives and that it's now two explicit states instead of one
   toggle. Bigger padding/font than every other sidebar control (kit-seg,
   kit-toggle, hero tiles) — it's the primary action, not a peer of Edit
   or Grid/Layers. */
.kit-live-switch {
  display: flex;
  gap: 6px;
}

.kit-live-switch-btn {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid var(--jamn-border, #2A2A36);
  background: var(--jamn-surface1, #14141A);
  color: var(--jamn-text2, #A1A1AA);
  cursor: pointer;
}

.kit-live-switch-btn:hover {
  border-color: var(--jamn-accent, #8b5cf6);
  color: var(--jamn-text, #fff);
}

/* Selected = solid accent fill (exactly .pb-live-btn.is-on's old look);
   unselected = the plain/ghost look above. */
.kit-live-switch-btn.is-on {
  background: var(--jamn-accent, #8b5cf6);
  border-color: var(--jamn-accent, #8b5cf6);
  color: #fff;
}

/* ---------- compact header: title + Edit + device status ---------- */

.kit-sb-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.kit-sb-header .kit-title {
  flex: 1 1 auto;
  font-size: 15px;
}

.kit-sb-header .kit-toggle,
.kit-sb-header .kit-midi-btn {
  flex: 0 0 auto;
  padding: 4px 8px;
  font-size: 11px;
}

/* ---------- hero 2×2 (Slip / Roulette / Add song / Groove) ---------- */

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

.kit-hero-tile-wrap {
  position: relative;
  display: flex;
}

/* Every hero tile reads as an equal, deliberate action — same shape/weight
 * regardless of which base button class it started life as
 * (.kit-borrow-btn, .kit-roulette-btn, .kit-toggle.kit-slip-page,
 * .kit-groove all get overridden here to one look). */
.kit-hero .kit-hero-tile,
.kit-hero-tile-wrap .kit-hero-tile {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid var(--jamn-border, #2A2A36);
  background: var(--jamn-surface1, #14141A);
  color: var(--jamn-text2, #A1A1AA);
  white-space: normal;
  text-align: center;
  cursor: pointer;
}

.kit-hero .kit-hero-tile:hover {
  border-color: var(--kit-hero-accent, #a855f7);
  color: var(--jamn-text, #fff);
  background: rgba(168, 85, 247, 0.12);
}

.kit-hero .kit-hero-tile.is-on,
.kit-hero .kit-hero-tile.is-open {
  border-color: var(--kit-hero-accent, #a855f7);
  color: var(--jamn-text, #fff);
  background: rgba(168, 85, 247, 0.22);
}

.kit-hero-icon {
  font-size: 18px;
  line-height: 1;
}

.kit-hero-label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
}

.kit-hero-menu-chevron {
  position: absolute;
  top: 4px;
  right: 4px;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--jamn-text2, #A1A1AA);
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 6px;
}
.kit-hero-menu-chevron:hover { color: var(--jamn-text, #fff); background: rgba(255, 255, 255, .08); }

.kit-style-beat-menu {
  z-index: 1002;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  padding: 4px;
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 8px;
  background: var(--jamn-surface1, #14141A);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}
.kit-style-beat-menu button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--jamn-text, #fff);
  font: inherit;
  font-size: 12px;
  text-align: left;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.kit-style-beat-menu button:hover { background: rgba(168, 85, 247, 0.18); }

/* ---------- core controls (always visible, no scrolling) ---------- */

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

.kit-core-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kit-core-row .kit-seg { flex: 0 1 auto; }
.kit-core-row .kit-viewseg,
.kit-core-row .kit-sizeseg { flex: 1 1 0; }
.kit-core-row .kit-viewseg .kit-seg-btn,
.kit-core-row .kit-sizeseg .kit-seg-btn { flex: 1 1 0; text-align: center; }

/* Lock: same look as every other .kit-toggle chip; the padlock glyph swaps
 * meaning (open/closed) purely through the shared is-on accent, no new
 * color language needed. */
.kit-toggle.kit-lock.is-on {
  border-color: var(--jamn-accent, #8B5CF6);
  background: rgba(139, 92, 246, 0.14);
}

/* ---------- collapsible sections ---------- */

.kit-sections {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kit-section {
  border: 1px solid var(--jamn-border, #2A2A36);
  border-radius: 10px;
  background: var(--jamn-surface1, #14141A);
  overflow: hidden;
}

.kit-section-sum {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.kit-section-sum::-webkit-details-marker { display: none; }
.kit-section-sum::marker { content: ""; }

.kit-section-caret {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  color: var(--jamn-text2, #A1A1AA);
  transition: transform 0.15s ease;
}
.kit-section-caret::before {
  content: "▸";
  font-size: 11px;
}
.kit-section[open] > .kit-section-sum .kit-section-caret {
  transform: rotate(90deg);
}

.kit-section-label {
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--jamn-text, #fff);
}

.kit-section-sum .kit-fav-btn {
  flex: 0 0 auto;
  padding: 2px 7px;
  font-size: .85rem;
}

.kit-section-body {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kit-section-body > .kit-chop,
.kit-section-body > .kit-kits-group,
.kit-section-body > .kit-kb-group {
  width: 100%;
}

/* The Chops shell (.kit-chop) is a .kit-seg — inline-flex, nowrap — sized
 * for the old full-width toolbar row. In the 260px sidebar column its three
 * children (Stem select, Slices select, Load) no longer fit on one line;
 * let it wrap instead of clipping/overflowing the section. Same story for
 * the Session key/BPM target's toggle+fields row once it's switched on. */
.kit-section-body > .kit-chop,
.kit-section-body .kit-session-row,
.kit-section-body .kit-session-fields {
  flex-wrap: wrap;
  row-gap: 6px;
}
.kit-section-body .kit-session { width: 100%; }

.kit-kits-group,
.kit-kb-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.kit-kits-note {
  font-size: 11px;
  font-weight: 600;
  color: var(--jamn-text2, #A1A1AA);
}

/* ---------- sidebar footer: Kill All, pinned, never buried ---------- */

.kit-sidebar-footer {
  margin-top: auto;
  padding-top: 4px;
}

.kit-sidebar-footer .kit-kill {
  width: 100%;
  margin-left: 0;
}

/* ---------- responsive: stack sidebar above the pads under ~900px ------ */

@media (max-width: 900px) {
  .kit-layout {
    flex-direction: column;
  }
  .kit-sidebar {
    flex: 1 1 auto;
    width: 100%;
    max-height: none;
    overflow: visible;
  }
  .kit-hero {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .kit-hero-icon { font-size: 16px; }
  .kit-hero-label { font-size: 10px; }
}

/* =====================================================================
   Live performance surface (live_surface_spec.md) — Lane W2
   =====================================================================
   The Live surface: an overlay inside .kit-main that replaces ONLY the
   pad-grid AREA. Owner amendment (live review, 2026-09-27) supersedes spec
   §1.5's "chrome — sidebar/hero/core/sections/arrangement — hides": Live
   is a view inside Perform, and the kit sidebar and the layers rack stay
   visible exactly like every other surface (iOS, desktop) keeps its
   chrome (the arrangement/song-sections strip stays visible too, but
   reparents to below the Live surface — kit.js#syncArrReparent — matching
   its new below-the-grid placement in Pads view). FX side = the X-Y pad +
   tile row, full size, 4 tiles incl. Flanger; Slip side = the ONE reused
   #kit-grid (reparented in, never duplicated) beside a Focus/Throw/Brake
   column. Owner amendment 2026-09-28 REMOVED the Pads-view compact strip
   (X-Y filter + Gater/Throw/Brake under the grid) this comment used to
   describe here too — Live's own FX side below is untouched by that
   change; only the on-screen Pads-view copy is gone. */

/* The grid itself only hides on the FX side — on the Slip side it has
   been reparented into .live-slip-grid-slot (kit.js#syncLiveGridReparent)
   and this selector no longer matches it there. */
#kit-root.is-live:not(.is-live-slip) .kit-main > .kit-grid {
  display: none !important;
}

.live-surface {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: max(480px, calc(100vh - 160px));
  gap: 12px;
}
.live-surface[hidden] { display: none; }

.live-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border, var(--jamn-border));
}
.live-target-pill {
  font: 700 11px/1 var(--font, inherit);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--jamn-accent, #8b5cf6);
  background: color-mix(in srgb, var(--jamn-accent, #8b5cf6) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--jamn-accent, #8b5cf6) 40%, transparent);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}
.live-side-seg {
  display: flex;
  border: 1px solid var(--border, var(--jamn-border));
  border-radius: 10px;
  overflow: hidden;
}
.live-side-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-dim, var(--jamn-text2));
  font: 700 13px/1 inherit;
  padding: 8px 16px;
  cursor: pointer;
}
.live-side-btn.is-on {
  background: var(--jamn-accent, #8b5cf6);
  color: #fff;
}
.live-side-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.live-kill-filter {
  appearance: none;
  border: 1px solid var(--border, var(--jamn-border));
  background: var(--panel-2, var(--jamn-surface2));
  color: var(--text, var(--jamn-text));
  border-radius: 8px;
  padding: 7px 12px;
  font: 600 12px/1 inherit;
  cursor: pointer;
}
.live-header-spacer { flex: 1 1 auto; }
.live-exit-pads {
  appearance: none;
  border: 1px solid var(--border, var(--jamn-border));
  background: var(--panel, var(--jamn-surface1));
  color: var(--text, var(--jamn-text));
  border-radius: 8px;
  padding: 7px 14px;
  font: 700 13px/1 inherit;
  cursor: pointer;
}

.live-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

/* ---------- FX side: dominant X-Y pad + tile column/row ------------- */

.live-fx-panel,
.live-fx-side {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 14px;
}
/* Landscape (wide) default: pad fills the left, tiles form a RIGHT
   column. Portrait (narrow) flips to a pad-over-tile-ROW layout below. */
.live-fx-tiles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 160px;
}
.live-fx-tiles.is-compact {
  flex-direction: row;
  flex: 0 0 auto;
}

.live-xy-pad {
  position: relative;
  flex: 1 1 auto;
  min-height: 220px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--jamn-accent, #8b5cf6) 10%, transparent), transparent 60%),
    var(--panel, var(--jamn-surface1));
  border: 1px solid var(--border, var(--jamn-border));
  cursor: crosshair;
  touch-action: none;
  overflow: hidden;
}
.live-xy-pad.is-engaged {
  border-color: var(--jamn-accent, #8b5cf6);
}
.live-xy-pad.is-compact {
  min-height: 96px;
  border-radius: 12px;
}
.live-xy-label {
  position: absolute;
  font: 700 10px/1 inherit;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim, var(--jamn-text2));
  pointer-events: none;
}
.live-xy-label-x { left: 10px; bottom: 8px; }
.live-xy-label-y { left: 10px; top: 8px; }
.live-xy-puck {
  position: absolute;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--jamn-accent, #8b5cf6);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--jamn-accent, #8b5cf6) 30%, transparent);
  pointer-events: none;
}
.live-xy-pad.is-compact .live-xy-puck {
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
}
.live-xy-readout {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font: 700 10px/1 inherit;
  color: var(--text-dim, var(--jamn-text2));
  pointer-events: none;
}

.live-fx-tile {
  appearance: none;
  border: 1px solid var(--border, var(--jamn-border));
  background: var(--panel, var(--jamn-surface1));
  color: var(--text, var(--jamn-text));
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  cursor: pointer;
  flex: 1 1 auto;
}
.live-fx-tile.is-compact {
  flex: 1 1 0;
  align-items: center;
  flex-direction: row;
  justify-content: space-between;
}
.live-fx-tile-label { font: 700 13px/1 inherit; }
.live-fx-tile-state {
  font: 700 10px/1 inherit;
  letter-spacing: .06em;
  color: var(--text-dim, var(--jamn-text2));
}
.live-fx-tile.is-on {
  border-color: var(--jamn-accent, #8b5cf6);
  background: color-mix(in srgb, var(--jamn-accent, #8b5cf6) 22%, var(--panel, var(--jamn-surface1)));
}
.live-fx-tile.is-on .live-fx-tile-state { color: #fff; }

/* ---------- Slip side: the reused grid + Focus/Throw/Brake column --- */

.live-slip-side {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 14px;
}
.live-slip-grid-slot {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
}
.live-slip-grid-slot .kit-grid {
  display: grid !important; /* undo the FX-side `display:none` rule above */
}
.live-slip-column {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.live-slip-fx-tiles {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- responsive: portrait / phone width ----------------------- */

@media (max-width: 900px) {
  .live-fx-panel,
  .live-fx-side,
  .live-slip-side {
    flex-direction: column;
  }
  .live-fx-tiles {
    flex-direction: row;
    flex: 0 0 96px;
  }
  .live-slip-column {
    flex-direction: row;
    flex: 0 0 auto;
  }
}

@media (max-width: 480px) {
  .live-header {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .live-target-pill { order: -1; }
  .live-header-spacer { flex-basis: 100%; height: 0; }
}
