/* Music Player. Tokens on :root (dark by default, light when the system asks), no horizontal scroll at 390 px. */
:root {
  --mu-bg: #0e0e10; --mu-bg2: #17171a; --mu-panel: #1f1f24; --mu-line: #34343b; --mu-fg: #f1ede4; --mu-dim: #b3ada0;
  --mu-faint: #938e83; --mu-accent: #e7efff; --mu-accent-ink: #0f1624; --mu-hover: #2a2a31; --mu-danger: #ff6b7f;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --mu-bg: #f6f4ef; --mu-bg2: #ffffff; --mu-panel: #ecE9e1; --mu-line: #cfc9bd; --mu-fg: #1a1a1a; --mu-dim: #55514a;
    --mu-faint: #6b665c; --mu-accent: #145eff; --mu-accent-ink: #ffffff; --mu-hover: #e4e0d6; --mu-danger: #b3263b;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --mu-bg: #f6f4ef; --mu-bg2: #ffffff; --mu-panel: #ecE9e1; --mu-line: #cfc9bd; --mu-fg: #1a1a1a; --mu-dim: #55514a;
  --mu-faint: #6b665c; --mu-accent: #145eff; --mu-accent-ink: #ffffff; --mu-hover: #e4e0d6; --mu-danger: #b3263b; color-scheme: light;
}
:root[data-theme="dark"] { --mu-bg: #0e0e10; --mu-bg2: #17171a; --mu-panel: #1f1f24; --mu-line: #34343b; --mu-fg: #f1ede4; --mu-dim: #b3ada0; --mu-faint: #938e83; --mu-accent: #e7efff; --mu-accent-ink: #0f1624; --mu-hover: #2a2a31; --mu-danger: #ff6b7f; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--mu-bg); color: var(--mu-fg); font: 14px/1.45 "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 100vh; overflow-x: hidden; }
h1, h2, h3 { margin: 0; font-weight: 650; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
/* TlbxUI and the drop panel follow the Music tokens. tlbxui.css sets its --s-* names only inside its own dialogs and
 * menus, so the page sets them too, for the .sui-btn and .sui-input it uses outside them. */
:root { --sui-bg: var(--mu-bg2); --sui-bg2: var(--mu-panel); --sui-input: var(--mu-bg2); --sui-line: var(--mu-line); --sui-fg: var(--mu-fg); --sui-dim: var(--mu-dim);
  --sui-faint: var(--mu-faint); --sui-hover: var(--mu-hover); --sui-accent: var(--mu-accent); --sui-accent-ink: var(--mu-accent-ink);
  --sui-panel: var(--mu-bg2); --sui-text: var(--mu-fg); --sui-muted: var(--mu-dim); }
body { --s-bg2: var(--sui-bg2); --s-input: var(--sui-input); --s-line: var(--sui-line); --s-fg: var(--sui-fg); --s-hover: var(--sui-hover);
  --s-accent: var(--sui-accent); --s-accent-ink: var(--sui-accent-ink); --s-radius: 6px; }
.mu-top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 16px; background: var(--mu-bg2); border-bottom: 1px solid var(--mu-line); }
.mu-top { --tlbx-hbtn-h: 32px; --tlbx-hbtn-radius: 6px; --tlbx-hbtn-bg: var(--mu-panel); --tlbx-hbtn-line: var(--mu-line); --tlbx-hbtn-hover: var(--mu-hover); --tlbx-hbtn-fs: 14px; }
.mu-brand { display: flex; align-items: center; gap: 8px; }
.mu-brand h1 { font-size: 16px; white-space: nowrap; }
.mu-brand .brand { display: grid; place-items: center; width: 28px; height: 28px; flex: none; color: var(--mu-fg); }
.mu-brand .brand-mark { width: 20px; height: 20px; fill: currentColor; }
.mu-tabs { display: flex; gap: 2px; background: var(--mu-panel); border-radius: 8px; padding: 3px; }
.mu-tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; color: var(--mu-dim); }
.mu-tabs button[aria-selected="true"] { background: var(--mu-accent); color: var(--mu-accent-ink); font-weight: 600; }
.mu-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.mu-tools .sui-btn { height: 32px; }
.mu-main { padding: 16px 16px 96px; max-width: 1200px; margin: 0 auto; }
.mu-view { position: relative; }
.mu-view.mu-drop-on { outline: 2px dashed var(--mu-accent); outline-offset: 6px; border-radius: 8px; }
.mu-dropzone { margin: 0 0 10px; padding: 8px 10px; border: 1px dashed var(--mu-line, #3a3a46); border-radius: 8px; }
.mu-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.mu-bar .sui-input { height: 32px; }
#lib-search { flex: 1 1 220px; }
.mu-stat, .mu-fine { color: var(--mu-faint); font-size: 12px; margin: 4px 0 8px; }
.mu-lib { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
.mu-side { position: sticky; top: 72px; display: grid; gap: 4px; align-content: start; }
.mu-side .mu-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mu-faint); margin: 0 0 6px; }
.mu-tagbtn { display: flex; justify-content: space-between; gap: 8px; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; text-align: left; color: var(--mu-dim); overflow: hidden; }
.mu-tagbtn span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mu-tagbtn:hover { background: var(--mu-hover); }
.mu-tagbtn[aria-pressed="true"] { background: var(--mu-accent); color: var(--mu-accent-ink); font-weight: 600; }
.mu-n { font-variant-numeric: tabular-nums; color: var(--mu-faint); }
.mu-tagbtn[aria-pressed="true"] .mu-n { color: inherit; }
.mu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mu-row { display: flex; align-items: center; gap: 4px; border-radius: 8px; padding-right: 4px; }
.mu-row:hover { background: var(--mu-hover); }
.mu-row.on .mu-txt b { color: var(--mu-accent); }
.mu-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 6px; text-align: left; cursor: pointer; border-radius: 8px; }
.mu-txt { display: grid; min-width: 0; flex: 1; }
.mu-txt b, .mu-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mu-txt small { color: var(--mu-dim); font-size: 12px; }
.mu-dur { color: var(--mu-faint); font-variant-numeric: tabular-nums; font-size: 12px; margin-right: 6px; }
.mu-more { border: 0; background: none; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; color: var(--mu-dim); font-size: 18px; flex: none; }
.mu-more:hover { background: var(--mu-panel); }
.mu-tagline { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.mu-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--mu-panel); color: var(--mu-dim); border: 1px solid var(--mu-line); }
.mu-chip-del { border: 0; background: none; cursor: pointer; color: var(--mu-faint); padding: 0 0 0 2px; font-size: 13px; line-height: 1; }
.mu-cover-img, .mu-tile { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; }
.mu-tile { display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, hsl(var(--h) 70% 52%), hsl(calc(var(--h) + 40) 60% 30%)); }
.mu-cover-sm { width: 36px; height: 36px; border-radius: 5px; font-size: 13px; }
.mu-cover-big { width: 100%; height: 100%; border-radius: 12px; font-size: 96px; }
.mu-empty { display: none; padding: 40px 16px; text-align: center; border: 1px dashed var(--mu-line); border-radius: 12px; color: var(--mu-dim); }
.mu-empty:not([hidden]) { display: block; }
.mu-empty h2 { color: var(--mu-fg); margin-bottom: 8px; }
.mu-empty p { margin: 0 auto 14px; max-width: 46ch; }
.mu-empty .sd-preview { margin: 6px 0 18px; }
.mu-empty-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mu-pl { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.mu-pl-side .mu-bar { flex-direction: column; }
.mu-pl-side .sui-btn { width: 100%; }
.mu-pl-btn { width: 100%; display: grid; border: 0; background: none; text-align: left; padding: 8px; border-radius: 8px; cursor: pointer; }
.mu-pl-btn:hover { background: var(--mu-hover); }
.mu-pl-btn[aria-current="true"] { background: var(--mu-panel); }
.mu-pl-btn small { color: var(--mu-faint); }
.mu-pl-head h2 { font-size: 22px; }
.mu-pl-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.mu-pl-item { display: flex; align-items: center; gap: 4px; border-radius: 8px; padding-right: 4px; background: var(--mu-bg); }
.mu-pl-item.mu-dragging { opacity: .6; }
.mu-pl-item.mu-drop { box-shadow: inset 0 3px 0 var(--mu-accent); }
.mu-handle { width: 26px; height: 34px; border: 0; background: none; cursor: grab; touch-action: none; color: var(--mu-faint); font-size: 16px; flex: none; }
.mu-handle::before { content: "⠿"; }
.mu-pick-list { display: grid; gap: 6px; max-height: 55vh; overflow: auto; }
.mu-pick { display: flex; }
.mu-now { display: grid; grid-template-columns: minmax(220px, 380px) minmax(0, 1fr); gap: 28px; align-items: start; }
.mu-cover { aspect-ratio: 1; width: 100%; border-radius: 12px; overflow: hidden; background: var(--mu-panel); display: grid; }
.mu-cover-none { display: grid; place-items: center; font-size: 96px; color: var(--mu-faint); }
.mu-now-info h2 { font-size: 26px; overflow-wrap: anywhere; }
.mu-artist { color: var(--mu-dim); font-size: 16px; margin: 4px 0; }
.mu-wave-wrap { margin: 18px 0 6px; }
.mu-wave { width: 100%; height: 72px; display: block; cursor: pointer; border-radius: 6px; }
.mu-wave:focus-visible, .mu-row-main:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--mu-accent); outline-offset: 2px; }
.mu-times { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; color: var(--mu-dim); font-size: 12px; }
.mu-controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 14px 0; }
.mu-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--mu-line); background: var(--mu-bg2); cursor: pointer; display: grid; place-items: center; flex: none; }
.mu-btn:hover { background: var(--mu-hover); }
.mu-btn.on, .mu-btn[aria-pressed="true"] { color: var(--mu-accent); border-color: var(--mu-accent); }
.mu-btn.mu-big { width: 60px; height: 60px; background: var(--mu-accent); color: var(--mu-accent-ink); border-color: transparent; }
.mu-ic { width: 20px; height: 20px; fill: none; }
.mu-big .mu-ic { width: 26px; height: 26px; }
.mu-sub-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mu-sub-controls input[type="range"] { flex: 1 1 140px; accent-color: var(--mu-accent); }
.mu-rate { display: inline-flex; align-items: center; gap: 6px; color: var(--mu-dim); }
.mu-rate select { height: 30px; }
.mu-err { color: var(--mu-danger); min-height: 1.4em; font-size: 13px; margin: 8px 0 0; }
.mu-tag-edit { margin-top: 18px; }
.mu-tag-edit h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mu-faint); margin-bottom: 8px; }
.mu-tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 8px; }
.mu-tag-add { display: flex; gap: 8px; margin-top: 10px; }
.mu-tag-add input { flex: 1; min-width: 0; height: 32px; }
.mu-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-height: 70vh; overflow: auto; background: var(--mu-bg2); border-top: 1px solid var(--mu-line); border-radius: 14px 14px 0 0; padding: 12px 14px 20px; box-shadow: 0 -10px 30px rgba(0, 0, 0, .35); }
.mu-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mu-idx { width: 22px; text-align: right; color: var(--mu-faint); font-variant-numeric: tabular-nums; flex: none; }
.mu-mini { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 15; display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--mu-panel); border: 1px solid var(--mu-line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); overflow: hidden; }
.mu-mini-link { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.mu-mini-txt { display: grid; min-width: 0; }
.mu-mini-txt b, .mu-mini-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mu-mini-txt small { color: var(--mu-dim); }
.mu-mini .mu-btn { width: 34px; height: 34px; }
.mu-mini .mu-ic { width: 16px; height: 16px; }
.mu-mini-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--mu-line); }
.mu-mini-progress span { display: block; height: 100%; width: 0; background: var(--mu-accent); }
@media (max-width: 760px) {
  .mu-lib, .mu-pl, .mu-now { grid-template-columns: minmax(0, 1fr); }
  .mu-side { position: static; display: flex; flex-wrap: wrap; gap: 6px; }
  .mu-side .mu-h { width: 100%; margin: 0; }
  .mu-side .mu-tagbtn { width: auto; border: 1px solid var(--mu-line); border-radius: 999px; padding: 4px 10px; }
  .mu-tagbtn span:first-child { max-width: 160px; }
  .mu-now-view .mu-cover { max-width: 300px; margin: 0 auto; }
  .mu-now-info h2 { font-size: 22px; }
  .mu-tabs button { padding: 6px 8px; }
}
@media (max-width: 420px) {
  .mu-top { padding: 8px 12px; }
  /* the name gives way before the tabs wrap: a longer app name (a white-label build's) shortens with an ellipsis */
  .mu-brand { flex: 1 0 0; min-width: 0; }
  .mu-brand h1 { overflow: hidden; text-overflow: ellipsis; }
  .mu-main { padding: 12px 12px 96px; }
  .mu-controls { gap: 8px; }
  .mu-btn { width: 38px; height: 38px; }
  .mu-btn.mu-big { width: 56px; height: 56px; }
  .mu-tools .sui-btn { flex: 1; }
  .mu-now-info .mu-times { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* A finger (pointer: coarse): the reorder handle is at least 44 px wide (--tlbx-hit, shared/input/touch.css). */
@media (pointer: coarse) { .mu-handle { width: max(26px, var(--tlbx-hit, 44px)); height: max(34px, var(--tlbx-hit, 44px)); } }
/* A finger: a long press on a track is the track menu (shared/input), not iOS's callout or a text selection. */
@media (pointer: coarse) { .mu-row { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; } }
