:root {
  --bg: #0b0d10;
  --bg-elev: #14181e;
  --bg-elev-2: #1b2129;
  --line: #262d37;
  --text: #e9edf3;
  --muted: #8b97a8;
  --accent: #ff5c39;
  --accent-2: #4ad0a8;
  --danger: #ff5f6d;
  --radius: 14px;
  --topbar-h: 56px;

  /* One spacing step (4px) and one type ramp, so every surface in the app is
     measured against the same ruler instead of ad-hoc pixel values. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --t-micro: 11px;
  --t-small: 12.5px;
  --t-body: 14.5px;
  --t-lead: 19px;
  --t-display: 30px;
  /* Numbers are read as quantities here — counts, sizes, timecodes — so they
     line up in columns rather than jittering as digits change. */
  --num: 'SF Mono', ui-monospace, 'Menlo', 'Cascadia Mono', monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  overscroll-behavior-y: none;
}

body { display: flex; flex-direction: column; }

.hidden { display: none !important; }
.muted { color: var(--muted); }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */

.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-elev-2);
  cursor: pointer;
}
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn:active { transform: scale(0.97); }

.icon-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:active { background: var(--bg-elev-2); color: var(--text); }

/* ---------- Login ---------- */

.login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 0%, #17202b 0%, var(--bg) 60%);
  z-index: 130;
}
.login-card { width: 100%; max-width: 340px; text-align: center; }
.login-mark { font-size: 46px; color: var(--accent); line-height: 1; }
.login-card h1 { margin: 10px 0 4px; font-size: 26px; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 24px; font-size: 14px; }
.login-card input {
  width: 100%;
  padding: 15px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* keeps iOS from zooming on focus */
}
.login-card input:focus { outline: 0; border-color: var(--accent); }
.login-card .btn { width: 100%; padding: 15px; }
.login-err { margin-top: 14px; min-height: 20px; color: var(--danger); font-size: 13px; }

/* ---------- App shell ---------- */

.app { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-t);
  background: rgba(11, 13, 16, 0.88);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-row { display: flex; align-items: center; gap: 4px; height: var(--topbar-h); padding: 0 6px; }

.crumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.crumbs::-webkit-scrollbar { display: none; }
.crumb { padding: 4px 2px; color: var(--muted); background: none; border: 0; font: inherit; cursor: pointer; }
.crumb:last-child { color: var(--text); }
.crumb-sep { color: #3b4453; padding: 0 2px; }

.search-row { display: flex; gap: 8px; align-items: center; padding: 0 12px 10px; }
.search-row input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.search-row input:focus { outline: 0; border-color: var(--accent); }

/* ---------- List ---------- */

.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(150px + var(--safe-b));
}

.section-label {
  padding: 16px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.row:active { background: var(--bg-elev); }
.row.playing { background: linear-gradient(90deg, rgba(255,92,57,0.16), transparent 70%); }
.row.selected { background: rgba(74, 208, 168, 0.12); }

.row-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--bg-elev-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.row-icon.folder { color: var(--accent); }
.row-icon.audio { color: var(--accent-2); }
.row.playing .row-icon { background: var(--accent); color: #fff; }
.row.selected .row-icon { background: var(--accent-2); color: #08120e; }

.row-main { flex: 1; min-width: 0; }
/* Track names carry the remix, the version, the label — cutting them off is
   exactly what you cannot afford when deciding where a track belongs, so every
   name wraps in full instead of ending in dots. */
.row-title {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.32;
  white-space: normal;
  overflow-wrap: anywhere;
}
.row-sub {
  margin-top: 3px;
  font-family: var(--num);
  font-size: var(--t-small);
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}
.row-sub .warn { color: #ffb648; }

.row-action {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: -6px -4px -6px 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.row-action:active { background: var(--bg-elev-2); color: var(--text); }

.empty { padding: 60px 24px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Selection bar ---------- */

.selbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-b));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev-2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.selcount { flex: 1; text-align: center; font-size: 13px; font-weight: 600; }

/* ---------- Player ---------- */

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding-bottom: var(--safe-b);
  background: rgba(20, 24, 30, 0.96);
  backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--line);
}
.app:has(.selbar:not(.hidden)) .player { bottom: 64px; }

.player-seek { padding: 6px 12px 0; }
#seek {
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
#seek::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #2c343f; }
#seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}
#seek::-moz-range-track { height: 4px; border-radius: 2px; background: #2c343f; }
#seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--accent); }

.player-row { display: flex; align-items: center; gap: 10px; padding: 2px 10px 10px; }

.play-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.play-btn:active { transform: scale(0.94); }
.play-btn svg { width: 24px; height: 24px; }

.player-meta { flex: 1; min-width: 0; }
/* The mini player is fixed height, so it wraps to two lines and no further. */
.np-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.np-sub { margin-top: 2px; font-size: 11.5px; color: var(--muted); white-space: normal; overflow-wrap: anywhere; }

/* ---------- Sheets ---------- */

/* Above Sort Mode (80) so the full picker opens over it. */
.sheet-wrap { position: fixed; inset: 0; z-index: 95; display: flex; align-items: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); animation: fade 0.18s ease; }
.sheet {
  position: relative;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-b);
  border-radius: 20px 20px 0 0;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  animation: rise 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes rise { from { transform: translateY(22px); opacity: 0.4; } }
@keyframes fade { from { opacity: 0; } }

.sheet-grab { width: 38px; height: 4px; margin: 9px auto 4px; border-radius: 2px; background: #333c48; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 8px 16px 10px; }
.sheet-head-text { flex: 1; min-width: 0; }
.sheet-play {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-top: 1px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.sheet-play svg { width: 18px; height: 18px; }
.sheet-play:active { transform: scale(0.94); }
.sheet-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.sheet-sub { margin-top: 3px; font-size: 12.5px; color: var(--muted); white-space: normal; overflow-wrap: anywhere; }

.chips-wrap { padding: 0 0 8px; }
.chips-label { padding: 0 16px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  /* The row scrolls sideways, so a long crate name is read by scrolling
     rather than by guessing at an ellipsis. */
  max-width: none;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.chip:active { background: var(--accent); border-color: var(--accent); color: #fff; }

.sheet-search { display: flex; gap: 8px; padding: 4px 16px 10px; }
.sheet-search input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev-2);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.sheet-search input:focus { outline: 0; border-color: var(--accent); }

.sheet-crumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 16px 9px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}
.sheet-crumbs::-webkit-scrollbar { display: none; }

.folder-list { flex: 1; min-height: 120px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.folder-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 13px 8px 13px 16px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.folder-row:active { background: var(--bg-elev-2); }
.folder-row.disabled { opacity: 0.38; }
.folder-row.here {
  position: sticky;
  top: 0;
  z-index: 2;
  border-top: 0;
  background: linear-gradient(90deg, rgba(255, 92, 57, 0.18), rgba(255, 92, 57, 0.04));
  box-shadow: inset 2px 0 0 var(--accent);
}
.folder-row.here .fr-title { color: #ffd7cc; }
.folder-row.here.disabled { background: var(--bg-elev-2); box-shadow: none; }

.folder-row .fr-name { flex: 1; min-width: 0; }
.fr-title { font-size: 14px; font-weight: 500; line-height: 1.32; white-space: normal; overflow-wrap: anywhere; }
.fr-path { margin-top: 3px; font-size: 11.5px; color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
.fr-count { flex: 0 0 auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* A folder with children opens on tap, so moving into it needs its own button. */
.fr-move {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.fr-move:active { background: var(--accent); color: #fff; }
.fr-move.disabled { border-color: var(--line); color: var(--muted); }

.fr-chev { flex: 0 0 auto; display: grid; place-items: center; width: 26px; color: #4c586a; }
.fr-chev svg { width: 18px; height: 18px; }

.menu-sheet { padding-bottom: calc(10px + var(--safe-b)); }
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 16px 20px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.menu-item:active { background: var(--bg-elev-2); }
.menu-item.danger { color: var(--danger); }
.menu-sub { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(96px + var(--safe-b));
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev-2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 13.5px;
  pointer-events: auto;
  animation: rise 0.18s ease;
}
.toast .t-msg { flex: 1; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.toast.err { border-color: var(--danger); color: #ffd7da; }
.toast .t-undo {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Sort-these-tracks banner ---------- */

/* Sticks under the header while you scroll a long folder: the moment you decide
   "this whole pile needs triaging" is usually 40 rows down, not at the top. */
.sort-cta {
  position: sticky;
  top: var(--s2);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 24px);
  margin: 12px 12px 4px;
  padding: 14px 16px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--accent), #ff7a4d);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 92, 57, 0.28);
}
.sort-cta:active { transform: scale(0.99); }
.sort-cta svg { width: 20px; height: 20px; }
.sort-cta .sc-sub { margin-left: auto; font-weight: 500; font-size: 12.5px; opacity: 0.9; }

/* ---------- Pinned + star ---------- */

.chip.pinned { border-color: var(--accent); }
.chip.pinned::before { content: '★ '; color: var(--accent); }
.chip.pinned:active::before { color: #fff; }

.fr-star {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  align-self: stretch;
  margin: -13px 0;
  color: #4c586a;
  font-size: 17px;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.fr-star.on { color: var(--accent); }
.fr-star:active { background: var(--bg-elev-2); }

/* Taste = hear a track from a folder, jumped to its chorus. */
.taste-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  align-self: stretch;
  margin: -13px 0;
  border: 0;
  background: transparent;
  color: #6b7688;
  cursor: pointer;
}
.taste-btn svg { width: 19px; height: 19px; }
/* In the library list the rows are taller than the move sheet's, so the button
   fills the row rather than pulling itself out of it. */
.row > .taste-btn { align-self: center; margin: -6px 0; width: 42px; height: 42px; }
.taste-btn:active { background: var(--bg-elev-2); color: var(--text); }
.taste-btn.tasting { color: var(--accent-2); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ---------- Thumb bar ---------- */

/* Search and the menu also live within thumb reach. The header keeps them too —
   this is a second door, not a move, so nothing shifts for muscle memory. */
.thumb-bar {
  position: fixed;
  right: 12px;
  bottom: calc(96px + var(--safe-b));
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.thumb-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(27, 33, 41, 0.92);
  backdrop-filter: saturate(160%) blur(12px);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}
.thumb-btn:active { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(0.94); }
.thumb-btn svg { width: 20px; height: 20px; }
/* Out of the way whenever something else owns the bottom of the screen. */
.app:has(.selbar:not(.hidden)) .thumb-bar,
.app:has(#sortmode:not(.hidden)) .thumb-bar { display: none; }

/* ---------- Hub: the work waiting for you, at the top of the library ------- */

.hub {
  display: block;
  padding: var(--s3) var(--s3) var(--s2);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(255, 92, 57, 0.10) 0%, transparent 60%),
    var(--bg);
}

/* The one thing worth doing right now, sized like it. */
.hub-lead {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4);
  border: 1px solid rgba(255, 92, 57, 0.35);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 92, 57, 0.14), rgba(255, 92, 57, 0.03));
  cursor: pointer;
}
.hub-lead:active { transform: scale(0.995); }
.hub-lead-meta { flex: 1; min-width: 0; }
.hub-kicker {
  font-size: var(--t-micro);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.hub-lead-name {
  margin-top: 3px;
  font-size: var(--t-lead);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.hub-lead-count {
  margin-top: 3px;
  font-family: var(--num);
  font-size: var(--t-small);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.hub-go {
  flex: 0 0 auto;
  min-width: 84px;
  padding: 15px var(--s4);
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.hub-go:active { transform: scale(0.96); }

/* Counters that double as the entry points to each tool. */
.hub-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin-top: var(--s2); }
.hub-tile {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: var(--s3) var(--s2) 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.hub-tile:active { background: var(--bg-elev-2); }
.hub-tile.quiet { opacity: 0.5; }
.hub-tile .ht-value { font-family: var(--num); font-size: 21px; font-weight: 700; line-height: 1; color: var(--accent-2); }
.hub-tile.quiet .ht-value { color: var(--muted); }
.hub-tile .ht-label { margin-top: 5px; font-size: var(--t-small); font-weight: 600; }
.hub-tile .ht-sub { font-size: var(--t-micro); color: var(--muted); overflow-wrap: anywhere; }

/* Runner-up piles: one tap straight into triage. */
.hub-piles { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.hub-pile {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s2);
  padding: 9px var(--s3);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--t-small);
  cursor: pointer;
}
.hub-pile:active { background: var(--accent); border-color: var(--accent); color: #fff; }
.hub-pile .hp-name { font-weight: 600; overflow-wrap: anywhere; }
.hub-pile .hp-count { font-family: var(--num); color: var(--muted); }
.hub-pile:active .hp-count { color: rgba(255, 255, 255, 0.85); }

/* ---------- Delete / trash ---------- */

.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:disabled, .btn:disabled { opacity: 0.4; }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:active { background: rgba(255, 95, 109, 0.16); }

.dupe-head {
  padding: 14px 16px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-2);
  overflow-wrap: anywhere;
}
.fr-move.danger { border-color: var(--danger); color: var(--danger); }
.fr-move.danger:active { background: var(--danger); color: #fff; }
.fr-move:disabled { opacity: 0.4; }

.trash-actions { display: flex; gap: 8px; padding: 0 16px 10px; }
.trash-actions .btn { flex: 1; }

/* A point-of-no-return question must never be covered by a passing toast. */
#confirm { z-index: 160; }
.confirm-sheet { padding-bottom: calc(18px + var(--safe-b)); }
.confirm-sheet h2 { margin: 6px 16px 8px; font-size: 18px; letter-spacing: -0.01em; }
.confirm-body { padding: 0 16px 16px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.confirm-actions { display: flex; gap: 10px; padding: 0 16px; }
.confirm-actions .btn { flex: 1; padding: 14px; }

/* ---------- Taste bar ---------- */

/* One fixed line while a crate is being tasted — it replaces itself instead of
   stacking a toast per example, which used to bury the folder list. */
.taste-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(96px + var(--safe-b)); /* clears the player bar */
  z-index: 130;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px 6px 10px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: var(--bg-elev-2);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.6);
  animation: rise 0.18s ease;
}
.taste-bar .tb-row { display: flex; align-items: center; gap: 10px; }
.taste-bar .tb-play {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-2);
  color: #08120e;
  cursor: pointer;
}
.taste-bar .tb-play svg { width: 18px; height: 18px; }
.taste-bar .tb-text { flex: 1; min-width: 0; }

/* Skim bar across the whole example track. */
.taste-bar .tb-seekwrap { padding: 0 2px; }
.taste-bar #tbSeek {
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
.taste-bar #tbSeek::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #2c343f; }
.taste-bar #tbSeek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: var(--accent-2);
}
.taste-bar #tbSeek::-moz-range-track { height: 4px; border-radius: 2px; background: #2c343f; }
.taste-bar #tbSeek::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--accent-2); }
.taste-bar .tb-time {
  display: flex;
  justify-content: space-between;
  margin-top: -3px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.taste-bar .tb-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}
.taste-bar .tb-meta {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}
/* BOTH: let the crate example and the track you are filing play together, with
   the track ducked underneath — for when the genre line is too thin to hear one
   at a time. */
.taste-bar .tb-both {
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.taste-bar .tb-both.on {
  border-color: var(--accent-2);
  background: rgba(74, 208, 168, 0.16);
  color: var(--accent-2);
}

.taste-bar .tb-next {
  flex: 0 0 auto;
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.taste-bar .tb-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

/* Waiting for the next clip to be cut. */
.taste-btn.loading { animation: none; opacity: 0.55; }

/* Which example you are on, e.g. 2/5 — shown while a folder is being tasted. */
.taste-n {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
}

/* ---------- Sort Mode ---------- */

.sortmode {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  padding: var(--safe-t) 0 var(--safe-b);
  background: radial-gradient(130% 80% at 50% -10%, #1a2230 0%, var(--bg) 55%);
}

.sm-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
}
.sm-head-mid { flex: 1; min-width: 0; text-align: center; }
.sm-count { font-family: var(--num); font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }
.sm-source { font-size: 11.5px; color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
.sm-last { margin-top: 2px; font-size: 11.5px; color: var(--accent-2); white-space: normal; overflow-wrap: anywhere; }

/* How much of the pile is done, without having to read the numbers. */
.sm-progress { height: 3px; background: #222a34; }
.sm-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.25s ease; }

.sm-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 20px 10px;
  overflow-y: auto; /* a very long title scrolls rather than squeezing the crates */
  -webkit-overflow-scrolling: touch;
  text-align: center;
}
/* Acknowledge a flick, so a swipe never feels like it was swallowed. */
.sm-stage.swipe-left { animation: swipeOutLeft 0.2s ease; }
.sm-stage.swipe-right { animation: swipeOutRight 0.2s ease; }
@keyframes swipeOutLeft { 50% { transform: translateX(-14px); opacity: 0.6; } }
@keyframes swipeOutRight { 50% { transform: translateX(14px); opacity: 0.6; } }

.sm-art {
  flex: 0 0 auto;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(150deg, var(--bg-elev-2), #0e1319);
  border: 1px solid var(--line);
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-2);
  letter-spacing: 0.02em;
}
/* The whole title, however long — this is the text the decision rests on. */
.sm-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.sm-dir { font-size: 12.5px; color: var(--muted); max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

.sm-seekwrap { width: 100%; margin-top: 4px; }
#smSeek {
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
#smSeek::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #2c343f; }
#smSeek::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border: 0; border-radius: 50%; background: var(--accent); }
#smSeek::-moz-range-track { height: 6px; border-radius: 3px; background: #2c343f; }
#smSeek::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--accent); }
.sm-time { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: -2px; }

.sm-jumps { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
.sm-jumps .jump {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.sm-jumps .jump:active { background: var(--accent); border-color: var(--accent); color: #fff; }

.sm-transport { display: flex; align-items: center; gap: 22px; margin-top: 2px; }
.sm-transport .sm-delete { margin-left: 14px; border-left: 1px solid var(--line); border-radius: 0 12px 12px 0; padding-left: 8px; width: 56px; }
.play-btn.big { width: 62px; height: 62px; }
.play-btn.big svg { width: 30px; height: 30px; }
.sm-transport .icon-btn { width: 48px; height: 48px; color: var(--text); }
.sm-transport .icon-btn svg { width: 26px; height: 26px; }

/* The crates are the point of Sort Mode, so they get the bigger half of the
   screen instead of a strip at the bottom under a block of empty space. */
.sm-dests {
  flex: 1 1 48vh;
  min-height: 210px;
  max-height: 58vh;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 4px;
  border-top: 1px solid var(--line);
  background: rgba(20, 24, 30, 0.7);
}
.sm-dests-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 9px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.sm-dest {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 46px 14px 14px;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sm-dest .sd-taste {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 34px;
  height: 34px;
  margin: 0;
  border-radius: 10px;
  align-self: auto;
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent-2);
}
.sm-dest:active .sd-taste { color: #fff; }
.sm-dest .sd-taste.tasting { background: rgba(74, 208, 168, 0.16); }
.sm-dest:active { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(0.98); }
/* The library's own guess, marked so you can see it is a guess and why. */
.sm-dest.suggested {
  border-color: var(--accent-2);
  background: linear-gradient(140deg, rgba(74, 208, 168, 0.16), rgba(74, 208, 168, 0.04));
}
.sm-dest.suggested .sd-sub { color: var(--accent-2); font-weight: 600; }
.sm-dest.suggested:active { background: var(--accent-2); border-color: var(--accent-2); color: #08120e; }
.sm-dest.suggested:active .sd-sub { color: rgba(8, 18, 14, 0.75); }

.sm-dest .sd-name { font-size: 14px; font-weight: 700; line-height: 1.28; white-space: normal; overflow-wrap: anywhere; }
.sm-dest .sd-sub { font-family: var(--num); font-size: var(--t-micro); color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
.sm-dest:active .sd-sub { color: rgba(255, 255, 255, 0.85); }
.sm-empty { grid-column: 1 / -1; padding: 22px 12px; text-align: center; color: var(--muted); font-size: 13px; }

@media (min-width: 720px) {
  .list, .topbar-row, .search-row { max-width: 860px; margin-inline: auto; }
  .sheet { max-width: 620px; margin: 0 auto; border-radius: 20px; margin-bottom: 24px; }
  .sheet-wrap { align-items: center; justify-content: center; }
}
