/* Chipsmith web UI. Tokens come from tokens.css (a copy of design/tokens.css); the components follow
   design/mockups/mockup.css. Source of truth for the look: docs/design/visual.md. */

/* ---- taste switches (set on <html> in index.html) ---- */
html[data-pixel="off"] { --font-display: var(--font-ui); }
html[data-pixel="off"] .display, html[data-pixel="off"] .stat .v, html[data-pixel="off"] .wordmark { letter-spacing: -0.02em; font-weight: 700; }
html[data-palette="fixed"] {
  --bg: #0b0a0c; --surface: #161418; --surface-2: #211e24; --surface-3: #2c2830;
  --ink: #f4eee4; --ink-2: #b9b1a6;
  --accent: #ff4b3a; --accent-hot: #ff7a5c; --accent-dim: rgba(255, 75, 58, 0.18); --accent-glow: 0 0 24px rgba(255, 75, 58, 0.35); --on-accent: #1a0806;
}

/* ---- base ---- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 400 var(--text-md)/var(--leading) var(--font-ui);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button, .btn, label.btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button:disabled, .btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
input, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.flip { transform: rotate(180deg); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { position: relative; max-width: 430px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { display: flex; flex-direction: column; min-height: 100dvh; flex: 1; }
.topbar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: calc(10px + env(safe-area-inset-top)) var(--s-5) 10px; min-height: 52px;
}
.topbar h1 { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { color: var(--ink-3); font-size: var(--text-sm); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .center { text-align: center; flex: 1; }
.title-btn { flex: 1; min-width: 0; text-align: center; min-height: 44px; border-radius: var(--r-sm); padding: 2px 8px; }
.title-btn:active { background: var(--surface); }
.spacer-44 { width: 44px; flex: none; }
.spacer-24 { height: 24px; }
.min0 { min-width: 0; }
.wordmark { font-family: var(--font-display); font-weight: 600; font-size: 26px; letter-spacing: 0.02em; line-height: 1; }
.wordmark b { color: var(--accent); font-weight: 600; }

.scroll { flex: 1 1 auto; padding: 0 var(--s-5); }
.bottom {
  position: sticky; bottom: 0; z-index: 5; flex: none;
  padding: var(--s-3) var(--s-5) calc(var(--s-4) + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 18px);
}

.caps { font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-3); }
.caps.accent { color: var(--accent); }
.section-head { margin: 22px 0 10px; }
.display { font-family: var(--font-display); font-weight: 600; line-height: 1; letter-spacing: 0.01em; }
.num-lg { font-size: var(--num-lg); }
.display small { font-family: var(--font-ui); font-size: var(--text-xs); color: var(--ink-3); font-weight: 600; margin-left: 4px; letter-spacing: var(--tracking-caps); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.danger { color: var(--danger); }
.small-print { font-size: 13px; text-align: center; margin: 14px 0 0; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap-min); padding: 0 var(--s-5); border-radius: var(--r-pill);
  font-weight: 600; font-size: var(--text-md); background: var(--surface-2); color: var(--ink); position: relative;
  transition: transform var(--t-tap) var(--ease-out), background var(--t-tap), box-shadow var(--t-fade), opacity var(--t-fade);
}
.btn:active { transform: scale(0.96); background: var(--surface-3); }
.btn-primary { background: var(--accent); color: var(--on-accent); min-height: var(--tap-primary); font-size: var(--text-lg); box-shadow: var(--accent-glow); }
.btn-primary:active { background: var(--accent-hot); }
.btn-primary .i { stroke-width: 2.4; }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line-strong); }
.btn-ghost:active { background: var(--surface-2); }
.btn-ghost.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-icon { width: var(--tap-min); height: var(--tap-min); padding: 0; border-radius: 50%; }
.btn-icon.lg { width: 56px; height: 56px; }
.btn-block { width: 100%; }
.btn.surface { background: var(--surface); }
.btn.surface2 { background: var(--surface-2); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.soon { color: var(--ink-3); }
.btn.soon small { position: absolute; top: 4px; right: 12px; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4); font-weight: 700; }

/* ---- home ---- */
.now {
  display: grid; grid-template-columns: 1fr auto; gap: var(--s-3); align-items: center; width: 100%; text-align: left;
  padding: var(--s-4); border-radius: var(--r-lg); background: var(--surface); margin-top: 6px;
  transition: transform var(--t-tap) var(--ease-out);
}
.now:active { transform: scale(0.985); }
.now .t { font-weight: 600; font-size: var(--text-md); display: flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now .d { color: var(--ink-3); font-size: var(--text-sm); }
.now .mini { height: 44px; margin-top: 10px; }
.now .play { width: 56px; height: 56px; }
.now.empty { grid-template-columns: 1fr; }
.now.empty .d { margin-top: 4px; }
.heroes { display: flex; flex-direction: column; gap: 10px; }
.hero {
  position: relative; display: flex; align-items: center; gap: var(--s-4); width: 100%;
  min-height: 88px; padding: var(--s-4) var(--s-5); border-radius: var(--r-lg);
  background: var(--surface); text-align: left; overflow: hidden;
  transition: transform var(--t-tap) var(--ease-out), background var(--t-tap);
}
.hero:active { transform: scale(0.98); background: var(--surface-2); }
.hero .ic { flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-dim); color: var(--accent); }
.hero .ic .i { width: 28px; height: 28px; }
.hero .t { display: block; font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.01em; }
.hero .d { display: block; color: var(--ink-3); font-size: var(--text-sm); margin-top: 2px; }
.hero.alt .ic { background: var(--lane-harmony-dim); color: var(--lane-harmony); }
.hero.alt2 .ic { background: var(--lane-bass-dim); color: var(--lane-bass); }
.recents { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s-5)); padding: 2px var(--s-5) 4px; scroll-snap-type: x proximity; }
.recents::-webkit-scrollbar { display: none; }
.rc { flex: none; width: 150px; padding: 12px 12px 10px; border-radius: var(--r-md); background: var(--surface); text-align: left; scroll-snap-align: start; transition: transform var(--t-tap) var(--ease-out); }
.rc:active { transform: scale(0.97); }
.rc .t { display: block; font-weight: 600; font-size: 15px; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc .d { display: block; color: var(--ink-3); font-size: 13px; }
.foot { display: grid; grid-template-columns: 1fr; gap: 10px; }
.foot.two { grid-template-columns: 1fr 1fr; }
.foot.three { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.foot.three .btn { padding: 0 8px; font-size: 15px; gap: 6px; white-space: nowrap; }
@media (max-width: 380px) { .foot.three .btn { padding: 0 6px; font-size: 14px; gap: 4px; } }
.row-head { display: flex; align-items: center; justify-content: space-between; }
.see-all { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 2px 0 10px; color: var(--ink-2); font-size: var(--text-sm); font-weight: 600; border-radius: var(--r-pill); }
.see-all b { color: var(--ink-3); font-weight: 600; margin-left: 4px; }
.see-all .i { width: 18px; height: 18px; stroke: var(--ink-3); }
.see-all:active { background: var(--surface); }
html:not([data-app]) .app-only { display: none; }
.cartridge { display: inline-flex; align-items: center; gap: 8px; height: var(--tap-min); padding: 0 14px 0 10px; border-radius: var(--r-pill); background: var(--surface); font-weight: 600; font-size: 15px; transition: transform var(--t-tap) var(--ease-out); }
.cartridge:active { transform: scale(0.96); }
.cartridge .sw, .cartridge i { width: 14px; height: 14px; border-radius: 4px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.cartridge .i { width: 16px; height: 16px; stroke: var(--ink-3); }
.cartridge.compact { flex: none; height: var(--tap-min); padding: 0 12px 0 10px; font-size: 13px; gap: 6px; }
.cartridge.compact .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ---- mini lane picture ---- */
.mini { display: grid; grid-template-rows: repeat(4, 1fr); gap: 3px; height: 36px; }
.mini .row { position: relative; border-radius: 2px; }
.mini .row b { position: absolute; top: 1px; bottom: 1px; border-radius: 2px; background: var(--c); left: calc(var(--at) * 100% / var(--rows)); width: max(2px, calc(var(--len) * 100% / var(--rows) - 1px)); }

/* ---- chips ---- */
.chips { display: flex; gap: var(--s-2); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s-5)); padding: 2px var(--s-5); }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; margin: 0; padding: 0; }
.chips.center-chips { justify-content: center; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 var(--s-4);
  border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font-size: 15px; font-weight: 500;
  border: 1px solid transparent; transition: transform var(--t-tap) var(--ease-out), background var(--t-tap), color var(--t-tap);
}
.chip:active { transform: scale(0.95); background: var(--surface-3); }
.chip.on { background: var(--accent-dim); color: var(--accent-hot); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.chip.sm { height: var(--tap-min); padding: 0 12px; font-size: 13px; }
.chip.busy { color: var(--ink-3); }

/* ---- lanes ---- */
/* the name column fits the longest lane name ("FM harmony") on one line at the design's 14 px */
.lanes { --lane-col: 100px; display: flex; flex-direction: column; gap: 10px; position: relative; }
.lane { position: relative; display: grid; grid-template-columns: var(--lane-col) 1fr; align-items: center; gap: 10px; min-height: 50px; width: 100%; text-align: left; border-radius: var(--r-sm); transition: opacity var(--t-fade); }
.lane .name { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); min-width: 0; max-width: 100%; }
.lane .name span { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.lane .name .pn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lane .name i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); box-shadow: 0 0 10px var(--c); flex: none; }
.lane .name small { font-weight: 500; color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 96px; }
.lane .track { position: relative; height: 50px; border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.lane .track::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: calc(100% / var(--bars, 4)) 100%;
}
.lane.sel .track { outline: 2px solid var(--c); outline-offset: 2px; }
.lane.muted .track { opacity: 0.35; }
.lane.muted .name { color: var(--ink-3); }
.lane.muted .name i { box-shadow: none; opacity: 0.5; }
.lane.empty .track { background: transparent; border: 1px dashed var(--line-strong); display: grid; place-items: center; color: var(--ink-3); font-size: var(--text-sm); }
.lane.empty .track::before { display: none; }
.lanes.has-sel .lane:not(.sel) { opacity: 0.45; }
/* the loop screen's lanes end in a lock toggle: a locked lane is off limits to Claude */
.lanes.lockable .lane { grid-template-columns: var(--lane-col) 1fr var(--tap-min); gap: 10px 6px; cursor: pointer; }
.lanes.lockable .playhead { left: calc(var(--lane-col) + 6px + (100% - var(--lane-col) - 56px) * var(--x, 0)); }
.lane .lock { height: 50px; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--ink-4); transition: color var(--t-tap), background var(--t-tap); }
.lane .lock .i { width: 18px; height: 18px; }
.lane .lock:active { transform: scale(0.96); background: var(--surface-2); }
.lane .lock.on { color: var(--c); background: var(--surface); }
/* the song screen's lanes also have a mute toggle (the whole song, on the next bar) */
.lanes.lockable.mutable .lane { grid-template-columns: var(--lane-col) 1fr var(--tap-min) var(--tap-min); }
.lanes.lockable.mutable .playhead { left: calc(var(--lane-col) + 6px + (100% - var(--lane-col) - 106px) * var(--x, 0)); }
.lane .mute { height: 50px; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--ink-4); transition: color var(--t-tap), background var(--t-tap); }
.lane .mute .i { width: 18px; height: 18px; }
.lane .mute:active { transform: scale(0.96); background: var(--surface-2); }
.lane .mute.on { color: var(--warn); background: var(--surface); }
.lane.locked .track { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent); }
.note {
  position: absolute; height: 11px; border-radius: 3px; background: var(--c); opacity: 0.92;
  left: calc(var(--at) * 100% / var(--rows, 64)); width: max(3px, calc(var(--len) * 100% / var(--rows, 64) - 2px));
  bottom: calc(8px + var(--pitch, 0.5) * 30px);
  transition: filter var(--t-tap), transform var(--t-tap);
}
.note.hit { filter: brightness(1.25); transform: translateY(-1px); box-shadow: 0 0 14px var(--c); }
/* drums: kick low and tall, snare mid, hat high and faint, one step wide */
.note.hit-kick { height: 14px; bottom: 6px; }
.note.hit-snare { height: 9px; bottom: 20px; opacity: 0.8; }
.note.hit-hat { height: 6px; bottom: 34px; opacity: 0.5; }
.note[class*="hit-"] { width: max(3px, calc(100% / var(--rows, 64) - 1.5px)); border-radius: 2px; }
.playhead {
  position: absolute; top: 0; bottom: 0; width: 2px; left: calc(var(--lane-col) + 10px + (100% - var(--lane-col) - 10px) * var(--x, 0)); background: var(--ink);
  box-shadow: 0 0 10px rgba(244, 238, 228, 0.7); opacity: 0; pointer-events: none; z-index: 2; transition: opacity var(--t-fade);
}
.playing .playhead { opacity: 1; }
.lane.writing .track { border: 1px solid var(--accent-dim); box-shadow: 0 0 16px var(--accent-dim); }
.lane.writing .track::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--accent-dim), transparent); background-size: 200% 100%; animation: sweep 1.4s linear infinite; }
@keyframes sweep { from { background-position: 200% 0; } to { background-position: -200% 0; } }
/* lanes written together sweep as a wave, one a little behind the next */
.lane:nth-child(2).writing .track::after { animation-delay: -1.05s; }
.lane:nth-child(3).writing .track::after { animation-delay: -0.7s; }
.lane:nth-child(4).writing .track::after { animation-delay: -0.35s; }
.lane.todo .track { opacity: 0.4; }
.note.write { animation: write 420ms var(--ease-spring) both; animation-delay: calc(var(--d, 0) * 1ms); }
@keyframes write { from { opacity: 0; transform: translateY(6px) scaleX(0.4); transform-origin: left; } to { opacity: 0.92; transform: none; } }
.hint { color: var(--ink-3); font-size: 13px; margin: 10px 0 0; text-align: center; min-height: 18px; }
.hint b { color: var(--ink-2); font-weight: 600; }

/* ---- meters ---- */
.meters { display: flex; gap: 6px; align-items: flex-end; height: 28px; }
.meters i { width: 6px; border-radius: 3px; background: var(--c); height: 30%; transform-origin: bottom; opacity: 0.85; transition: opacity var(--t-fade); }
.meters i.off { opacity: 0.2; }
.playing .meters i:not(.off) { animation: meter var(--beat) ease-in-out infinite; }
.meters i:nth-child(2) { animation-delay: calc(var(--beat) * 0.25); }
.meters i:nth-child(3) { animation-delay: calc(var(--beat) * 0.5); }
.meters i:nth-child(4) { animation-delay: calc(var(--beat) * 0.125); }
@keyframes meter { 0% { height: 95%; } 60% { height: 35%; } 100% { height: 95%; } }

/* ---- transport ---- */
.transport { display: flex; align-items: center; gap: 8px; padding: 2px 0 18px; }
.transport .stats { display: flex; gap: 0; min-width: 0; flex: 1; }
.transport .meters { flex: none; margin-left: auto; }
.play {
  flex: none; width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center;
  box-shadow: var(--accent-glow); position: relative; transition: transform var(--t-tap) var(--ease-out);
}
.play > * { grid-area: 1 / 1; }
.play:active { transform: scale(0.94); }
.play .i, .play svg { width: 26px; height: 26px; fill: currentColor; stroke: none; }
.play .pause { display: none; }
.playing .play .pause { display: block; }
.playing .play .tri { display: none; }
.play::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.playing .play::after { animation: pulse var(--beat) var(--ease-out) infinite; }
@keyframes pulse { 0% { opacity: 0.7; transform: scale(0.92); } 100% { opacity: 0; transform: scale(1.18); } }
/* a queued change: the ring fills over the bar, then the change lands */
.play .count { position: absolute; inset: -7px; border-radius: 50%; background: conic-gradient(var(--ink) calc(var(--p, 0) * 1turn), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); opacity: 0; transition: opacity var(--t-fade); pointer-events: none; }
.play.queued .count { opacity: 1; }
.play.queued::after { animation: none; }
.play.sm { width: 48px; height: 48px; box-shadow: none; }
.play.sm svg { width: 20px; height: 20px; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 6px 8px; border-radius: var(--r-sm); min-height: 44px; transition: background var(--t-tap); }
.stat:active { background: var(--surface-2); }
.stat .v { font-family: var(--font-display); font-size: 26px; line-height: 1; white-space: nowrap; }
.stat .v small { font-family: var(--font-ui); font-size: var(--text-xs); color: var(--ink-3); font-weight: 600; margin-left: 3px; }
/* a phone under 400 px: "140 BPM · 2 BARS · Am HARM." and the meters share 278 px; a size down and a 36 px meter column keep the key clear of the meters */
@media (max-width: 400px) {
  .transport .stat { padding: 6px; }
  .transport .stat .v { font-size: 24px; }
  .transport .meters { gap: 4px; }
}
@media (max-width: 380px) { .transport .stat { padding: 6px 4px; } .transport .stat .v { font-size: 23px; } }

/* ---- edit panel ---- */
.edit { margin-top: 12px; border-radius: var(--r-lg); background: var(--surface); padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 10px; animation: rise 260ms var(--ease-spring); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.edit .h { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.edit .h .t { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.edit .h .hb { display: flex; align-items: center; gap: 8px; }
.edit .h .t i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); box-shadow: 0 0 10px var(--c); }
.edit .caps { margin-bottom: 4px; }
.edit .btn-ghost.on { background: var(--accent-dim); color: var(--accent-hot); border-color: transparent; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.seg button { min-height: 40px; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--ink-2); transition: background var(--t-tap), color var(--t-tap); }
.seg button.on { background: var(--surface-3); color: var(--ink); }
.seg.sm button { min-height: var(--tap-min); font-size: 14px; padding: 0 10px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair > [hidden] + * { grid-column: 1 / -1; }
.pm { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; min-height: 48px; border-radius: 14px; background: var(--surface-2); text-align: center; font-weight: 600; font-size: 15px; }
.pm button { height: 48px; display: grid; place-items: center; color: var(--ink-2); border-radius: 14px; transition: color var(--t-tap), background var(--t-tap); }
.pm button:active { color: var(--ink); background: var(--surface-3); }
.pm small { display: block; color: var(--ink-3); font-size: 11px; font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; }
.pm.pm-inline { display: inline-grid; grid-template-columns: 40px 40px 40px; min-height: 40px; }
.fill { margin: 14px 0 0; min-height: 56px; font-size: 17px; }

/* ---- suggestions, quick actions, ask ---- */
.suggest.dim { display: none; }
.try-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 22px 0 10px; }
.try-head .faint { font-size: 13px; text-align: right; }
/* takes: an AI edit's candidates, auditioned on the bar, one kept */
.take-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.take { min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 8px 8px; min-height: 112px; border-radius: var(--r-md); background: var(--surface); border: 2px solid transparent; text-align: left; transition: transform var(--t-tap), background var(--t-tap), border-color var(--t-tap); }
.take:active { transform: scale(0.96); }
.take .l { font-family: var(--font-display); font-weight: 600; font-size: 26px; line-height: 1; color: var(--ink); height: 26px; display: flex; align-items: center; }
.take .l .i { width: 22px; height: 22px; color: var(--ink-2); }
.take .mini { height: 30px; gap: 2px; }
.take .mini .row.same { opacity: 0.25; }
.take small { display: flex; align-items: center; gap: 5px; height: 16px; font-size: 12px; font-weight: 600; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.take small i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); box-shadow: 0 0 8px var(--c); }
.take.on { background: var(--accent-dim); border-color: var(--accent); }
.take.on .l { color: var(--accent-hot); }
.take.queued { border-color: var(--accent); border-style: dashed; animation: pulse2 var(--beat) ease-in-out infinite; }
.takes .hint { margin-top: 12px; }
.takes .try-head .faint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.keep-bar { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; }
.keep-bar .btn-primary { min-height: var(--tap-primary); }
.picking .loop-bottom .quick, .picking .loop-bottom .ask { display: none; }
.quick { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.quick .btn { min-height: 48px; font-size: 15px; background: var(--surface); padding: 0 8px; }
.quick .btn .i { width: 20px; height: 20px; }
.ask {
  display: flex; align-items: center; gap: var(--s-2); min-height: 56px; padding: 6px 6px 6px var(--s-4); margin: 0;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); transition: border-color var(--t-fade);
}
.ask:focus-within { border-color: var(--line-strong); }
.ask input { flex: 1; min-width: 0; background: none; border: 0; padding: 0; font-size: 16px; color: var(--ink); outline: none; }
.ask input::placeholder { color: var(--ink-3); }
.ask .btn-icon { background: var(--surface-2); }
.ask .send { background: var(--accent); color: var(--on-accent); box-shadow: var(--accent-glow); }
.ask.part { border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.ask .btn-icon.listening { color: var(--rec); animation: blink var(--beat) steps(1) infinite; }
.busy-line { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; justify-content: center; font-size: 14px; color: var(--accent); font-weight: 600; min-height: 18px; }
.busy-line .m { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse2 var(--beat) ease-in-out infinite; }
.busy-line .k { color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }
@keyframes pulse2 { 50% { transform: scale(0.5); opacity: 0.4; } }
.loop-bottom { padding-top: 10px; }

/* ---- writing ---- */
.gen .head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 4px; }
.gen .head h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gen .head .sub { color: var(--ink-3); font-size: var(--text-sm); margin-top: 6px; }
.big-num { font-family: var(--font-display); font-size: var(--num-lg); line-height: 1; color: var(--ink); white-space: nowrap; flex: none; }
.big-num small { font: 600 12px var(--font-ui); color: var(--ink-3); margin-left: 4px; letter-spacing: var(--tracking-caps); }
.gen .lanes { margin-top: 22px; }
.status-list { margin: var(--s-6) 0 0; display: flex; flex-direction: column; gap: 14px; }
.st { display: flex; align-items: center; gap: 12px; font-size: var(--text-md); }
.st .m { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ok); flex: none; }
.st .m .i { width: 16px; height: 16px; }
.st.doing .m { background: var(--accent-dim); color: var(--accent); }
.st.doing .m::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse2 var(--beat) ease-in-out infinite; }
.st.todo { color: var(--ink-3); }
.st.fail .m { color: var(--danger); }
.st .k { margin-left: auto; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- export ---- */
.preview { padding: 16px; border-radius: var(--r-lg); background: var(--surface); position: relative; overflow: hidden; margin-top: 4px; }
.preview .mini { height: 52px; gap: 4px; margin: 12px 0 10px; }
.preview h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; padding-right: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview .meta { color: var(--ink-3); font-size: var(--text-sm); display: flex; gap: 6px; flex-wrap: wrap; }
.preview .meta span + span::before { content: "·"; margin-right: 6px; }
.preview .cartridge.badge { position: absolute; right: 14px; top: 14px; height: 30px; padding: 0 10px; background: var(--bg); font-size: 13px; gap: 6px; }
.preview .cartridge.badge i { width: 10px; height: 10px; border-radius: 3px; box-shadow: 0 0 8px var(--accent); }
.preview .play { position: absolute; right: 14px; bottom: 14px; }
.formats { margin-top: 6px; }
.fmt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface); text-align: left; margin-bottom: 8px; border: 2px solid transparent; transition: border-color var(--t-fade), transform var(--t-tap) var(--ease-out); }
.fmt:active { transform: scale(0.98); }
.fmt.on { border-color: var(--accent); }
.fmt .ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; font-size: 15px; }
.fmt.on .ic { background: var(--accent-dim); color: var(--accent); }
.fmt .t { display: block; font-weight: 600; }
.fmt .d { display: block; color: var(--ink-3); font-size: 13px; }
.fmt .r { margin-left: auto; color: var(--ink-3); display: none; }
.fmt.on .r { display: block; }
.fmt-hint { font-size: 13px; margin: 0 4px 8px; }
.fmt:disabled { opacity: 0.5; }

/* ---- sheets ---- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; pointer-events: none; transition: opacity var(--t-fade); z-index: 9; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; width: 100%; max-width: 430px; transform: translate(-50%, 104%); z-index: 10;
  max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 10px var(--s-5) calc(var(--s-6) + env(safe-area-inset-bottom)); box-shadow: var(--shadow-sheet);
  visibility: hidden; transition: transform var(--t-sheet) var(--ease-spring), visibility 0s var(--t-sheet);
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--ink-4); margin: 0 auto 14px; }
.sheet.open { transform: translate(-50%, 0); visibility: visible; transition: transform var(--t-sheet) var(--ease-spring); }
.sheet h2 { margin: 0 0 4px; font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.01em; }
.sheet .lead { color: var(--ink-2); margin: 0 0 var(--s-5); }
.sheet .caps { margin: 14px 0 8px; }
.sheet .btn-primary { margin-top: var(--s-5); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: var(--s-3); }
.sheet-head .lead { margin-bottom: 0; }
.sheet-head .seg { flex: none; margin-top: 4px; }
.tempo-stat { flex: none; align-items: flex-end; text-align: right; }
.tempo-stat .v { font-size: 30px; }
.sheet.tall { display: flex; flex-direction: column; }
.num-row { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; justify-items: center; margin: 10px 0 18px; }
.num-row .display { font-size: 64px; }
.num-row .display small { font-size: var(--text-sm); }

/* rings (count-in, hum progress) */
.ring { --p: 0; position: relative; width: 180px; height: 180px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1turn), var(--surface-3) 0); transition: background 80ms linear; }
.ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.ring .c { position: relative; text-align: center; }
.ring .n { font-family: var(--font-display); font-size: 72px; line-height: 1; min-height: 72px; display: grid; place-items: center; }
.ring .n .i { width: 44px; height: 44px; color: var(--accent); }
.ring .l { font-size: var(--text-sm); color: var(--ink-3); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; margin-top: 4px; }
.ring.live { animation: ringbeat var(--beat) var(--ease-out) infinite; }
@keyframes ringbeat { 0% { transform: scale(1.015); } 100% { transform: scale(1); } }

/* hum */
.hum-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--s-5); }
.hum-wrap .pitch, .hum-wrap .btn { width: 100%; }
.hum-wrap .btn-primary { margin-top: 0; }
.bars-ind { display: flex; gap: 6px; min-height: 6px; }
.bars-ind i { width: 56px; height: 6px; border-radius: 3px; background: var(--surface-3); transition: background var(--t-fade); }
.bars-ind i.on { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--on-accent); animation: blink var(--beat) steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.pitch { position: relative; height: 120px; border-radius: var(--r-md); background: var(--surface-2); overflow: hidden; }
.pitch canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* tap */
.tap-loop { position: relative; height: 10px; border-radius: 5px; background: var(--surface-3); margin: var(--s-3) 0 var(--s-5); overflow: hidden; }
.tap-loop i { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--lane-drums); border-radius: 2px; left: calc(var(--at) * 100%); opacity: 0.8; }
.tap-loop i.beat { background: var(--ink-4); opacity: 1; width: 2px; }
.tap-loop .ph { position: absolute; top: -2px; bottom: -2px; width: 3px; background: var(--ink); left: 0; border-radius: 2px; box-shadow: 0 0 8px var(--ink); opacity: 0; }
.tap-loop .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent-dim); }
.tap-loop.live .ph { opacity: 1; }
.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pad { position: relative; height: 140px; border-radius: var(--r-lg); background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-weight: 600; font-size: var(--text-lg); transition: transform var(--t-tap) var(--ease-out), background var(--t-tap); overflow: hidden; touch-action: none; }
.pad .caps { color: var(--ink-3); }
.pad:active, .pad.flash { transform: scale(0.97); background: var(--surface-3); }
.pad.k { grid-column: 1 / -1; height: 150px; }
.pad::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--lane-drums) 35%, transparent), transparent 60%); opacity: 0; transition: opacity 240ms; }
.pad.flash::after { opacity: 1; transition: none; }
.opts { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: var(--s-4); min-height: 44px; }
.switch-row { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink-2); }
.switch { width: 52px; height: 32px; border-radius: 16px; background: var(--surface-3); position: relative; transition: background var(--t-fade); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); transition: transform var(--t-fade) var(--ease-spring); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.tap-foot { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: var(--s-4); }
.tap-foot .btn-primary { margin-top: 0; min-height: 56px; font-size: 17px; }

/* describe */
.desc { display: block; width: 100%; min-height: 120px; padding: var(--s-4); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid transparent; font-size: 20px; line-height: 1.35; resize: none; outline: none; caret-color: var(--accent); transition: border-color var(--t-fade); }
.desc:focus { border-color: var(--line-strong); }
.desc::placeholder { color: var(--ink-3); }
#desc-chips { margin-top: 14px; }
.desc-foot { display: grid; grid-template-columns: 56px 1fr; gap: 10px; margin-top: var(--s-4); }
.desc-foot .btn-primary { margin-top: 0; min-height: 56px; font-size: 17px; }

/* cartridge sheet */
.carts { display: flex; flex-direction: column; gap: 10px; }
.cart { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); border: 2px solid transparent; text-align: left; width: 100%; transition: border-color var(--t-fade), transform var(--t-tap) var(--ease-out); }
.cart:active { transform: scale(0.98); }
.cart.on { border-color: var(--accent); }
.cart .sw { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 44px; height: 44px; padding: 4px; border-radius: 12px; background: var(--bg); flex: none; }
.cart .sw i { border-radius: 3px; }
.cart .t { display: block; font-weight: 600; }
.cart .d { display: block; color: var(--ink-3); font-size: var(--text-sm); }
.cart .r { margin-left: auto; color: var(--accent); display: none; }
.cart.on .r { display: block; }

/* lists */
.row-list { display: flex; flex-direction: column; }
.row-item { display: flex; align-items: center; gap: var(--s-3); min-height: 60px; padding: 10px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; cursor: pointer; }
.row-item:last-child { border-bottom: 0; }
.row-item .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.row-item .t { display: block; font-weight: 600; }
.row-item .d { display: block; color: var(--ink-3); font-size: var(--text-sm); }

/* notes roll (restyled v1 editor). A step is sized to the width (paintRoll), so the bars on screen fit
   it edge to edge; the roll bleeds into the sheet's padding for the room. */
.roll-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; font-size: 13px; }
.roll-zoom { grid-template-columns: var(--tap-min) 72px var(--tap-min); min-height: var(--tap-min); }
.roll-zoom button { height: var(--tap-min); }
.roll-zoom .i { width: 18px; height: 18px; }
.roll-wrap { flex: 1; max-height: calc(100dvh - 290px); overflow: auto; background: var(--bg); touch-action: pan-x pan-y; overscroll-behavior: contain; min-height: 200px; margin: 0 calc(-1 * var(--s-5)); scrollbar-width: none; }
.roll-wrap::-webkit-scrollbar { display: none; }
.roll { position: relative; }
.roll .rowbg { position: absolute; left: 0; right: 0; border-bottom: 1px solid var(--line); }
.roll .rowbg.root { background: rgba(244, 238, 228, 0.03); }
/* the note names stay at the left edge while the roll scrolls sideways (--sx follows scrollLeft) */
.roll .lbl { position: absolute; left: var(--sx, 0px); z-index: 3; width: 36px; font-size: 10px; color: var(--ink-3); background: var(--bg); display: flex; align-items: center; padding-left: 6px; font-weight: 600; }
.roll .vline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.roll .vline.bar { background: var(--line-strong); }
.roll .note { bottom: auto; opacity: 1; border-radius: 5px; background: var(--c); touch-action: none; z-index: 2; transition: none; }
.roll .note.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.roll .note .grip { position: absolute; right: -6px; top: 0; bottom: 0; width: 16px; cursor: ew-resize; }
.roll .cell { position: absolute; border-radius: 4px; background: var(--surface); border: 1px solid var(--line); }
.roll .cell.on { background: var(--c); border-color: var(--c); }
.roll .cell.beat1 { border-color: var(--line-strong); }
.roll .playhead { left: 0; width: 2px; z-index: 4; }
.note-bar { display: grid; grid-template-columns: 44px 44px 1fr 1fr 44px; gap: 6px; margin: 10px 0 0; }
.note-bar .btn { padding: 0 6px; font-size: 14px; }
.notes .hint { margin-top: 8px; }

/* ---- library ---- */
.search { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 8px 0 16px; border-radius: var(--r-md); background: var(--surface); margin-top: 4px; }
.search .i { stroke: var(--ink-3); }
.search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; font-size: var(--text-md); -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; } /* the input itself has no outline: the box carries the ring */
.search .clear { width: 40px; height: 40px; background: var(--surface-2); }
.search .clear .i { width: 18px; height: 18px; stroke: var(--ink-2); }
#library .chips { margin-top: 10px; }
#library .chips .chip .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--c); box-shadow: 0 0 8px var(--c); }
.lib-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.lib-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 6px 12px 12px; border-radius: var(--r-lg); background: var(--surface); min-height: 92px;
  transition: transform var(--t-tap) var(--ease-out), background var(--t-fade), opacity var(--t-fade);
}
.lib-card.gone { opacity: 0; transform: translateX(-24px) scale(0.98); }
.lib-card.new { animation: landed 900ms var(--ease-out); }
@keyframes landed { 0% { background: var(--accent-dim); } 100% { background: var(--surface); } }
.lib-card .play { width: 56px; height: 56px; background: var(--surface-2); color: var(--ink); box-shadow: none; }
.lib-card .play svg { width: 24px; height: 24px; }
.lib-card .play::after { display: none; }
.lib-card .play .count { inset: -5px; background: conic-gradient(var(--accent) calc(var(--p, 0) * 1turn), var(--surface-3) 0); }
.lib-card.playing .play { background: var(--accent); color: var(--on-accent); box-shadow: var(--accent-glow); }
.lib-card.playing .play .count { opacity: 1; }
.lib-card.playing .play .tri, .lib-card:not(.playing) .play .pause { display: none; }
.lib-card.playing .play .pause { display: block; }
.lib-card:not(.playing) .play .tri { display: block; } /* the app-wide .playing rule above would blank every other card's triangle during a preview */
.lib-card .body { min-width: 0; display: block; text-align: left; align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.lib-card .body:active .t { color: var(--accent-hot); }
.lib-card .t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lib-card .t .name { font-weight: 600; font-size: var(--text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lib-card .kind { font-family: var(--font-display); font-weight: 600; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); border-radius: 6px; padding: 2px 6px; flex: none; }
.lib-card .mini { height: 26px; gap: 2px; }
.lib-card .d { color: var(--ink-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: flex-start; gap: 6px; }
.lib-card .d .meta { min-width: 0; overflow: hidden; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; } /* two lines before it clips: "NES · 1:50 · A harm. minor · 140 bpm" is one and a half at 390 px */
.lib-card .d .cs { width: 8px; height: 8px; border-radius: 2px; background: var(--c); box-shadow: 0 0 6px var(--c); flex: none; margin-top: 5px; } /* on the first line of a wrapped meta (13px text, ~18px line) */
.lib-card .more { width: 44px; height: 56px; border-radius: var(--r-sm); color: var(--ink-2); display: grid; place-items: center; }
.lib-card .more:active { background: var(--surface-2); }
.lib-empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.lib-empty .t { color: var(--ink-2); font-weight: 600; font-size: var(--text-lg); }
.lib-empty .d { font-size: var(--text-sm); margin-top: 6px; }
.item-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
.item-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-head .lead { margin: 0; font-size: var(--text-sm); }
.item-head .mini { flex: none; width: 96px; height: 36px; }
.row-item.danger .ic { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.row-item.danger .t { color: var(--danger); }

/* rename sheet */
#rename-form .ask { margin-top: 6px; min-height: 56px; padding-right: var(--s-4); }
#rename-form .btn-primary { margin-top: var(--s-4); }

/* toast: it sits just above whatever is at the bottom (the open sheet, the bottom bar), never on a control.
   toast() measures that and sets --toast-lift; openSheet() refreshes it while one shows. */
/* the library's way under the hood (remake.html) */
.hood-link { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--line-strong); color: var(--ink-2); }
.hood-link span { flex: 1; min-width: 0; display: grid; gap: 2px; }
.hood-link b { color: var(--ink); font-weight: 600; }
.hood-link small { font-size: 13px; color: var(--ink-3); }
.hood-link:active { background: var(--surface); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--toast-lift, 24px) + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--surface-3); color: var(--ink); padding: 10px 16px; border-radius: var(--r-pill); font-size: var(--text-sm); font-weight: 600;
  transition: all var(--t-fade) var(--ease-out); z-index: 20; width: max-content; max-width: min(92vw, 400px); text-align: center; box-shadow: var(--shadow-card);
  display: flex; align-items: center; gap: 10px;
  pointer-events: none; /* a faded toast must not keep catching taps */
}
/* width: max-content, or shrink-to-fit measures against the space right of left: 50% and the text wraps at half the screen */
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.err { color: var(--danger); }
/* Undo and Try again get a 44 px tap height inside the toast's own padding, so the toast keeps its size */
.toast button { color: var(--accent-hot); font-weight: 700; padding: 6px 8px; min-height: 44px; margin: -6px -8px -6px 0; }

/* ---- reduced motion: keep the playhead and the countdown ring, drop the rest ---- */
@media (prefers-reduced-motion: reduce) {
  .playing .meters i, .playing .play::after, .lane.writing .track::after, .note.write, .take.queued, .edit, .ring.live, .rec-dot, .busy-line .m, .st.doing .m::after, .ask .btn-icon.listening { animation: none !important; }
  .note.write { opacity: 0.92; }
  .btn, .chip, .hero, .pad, .cart, .fmt, .now, .rc, .lib-card, .lane, .stat, .switch::after, .sheet, .scrim, .toast, .note { transition: none !important; }
  .lib-card.new { animation: none; }
}

/* With a mouse, a row that hides its scrollbar can't be scrolled sideways: filter rows wrap, strips show a thin bar */
@media (pointer: fine) {
  .chips { flex-wrap: wrap; overflow-x: visible; }
  .recents, .roll-wrap { scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent; }
  .recents::-webkit-scrollbar, .roll-wrap::-webkit-scrollbar { display: block; height: 6px; width: 6px; }
}
