:root {
  --bg: #121418;
  --panel: #1b1e24;
  --panel-2: #23272f;
  --line: #2f343e;
  --text: #eceef2;
  --muted: #9aa1ad;
  --accent: #ff5d5d;
  --accent-ink: #1a0a0a;
  --good: #5fd08a;
  --warn: #ffc15a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
.boot { padding: 24px; color: var(--muted); }

.shell {
  height: 100%;
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 10px max(12px, env(safe-area-inset-left, 0px)) 0;
  gap: 10px;
}
.top { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.top h1 { font-size: 15px; margin: 0; letter-spacing: .02em; }
.chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--muted); font-size: 12px; }
.notice { border-radius: 8px; padding: 8px 12px; background: var(--panel-2); border: 1px solid var(--line); }
.notice.err { border-color: var(--accent); }
.notice.hint { border-color: var(--warn); color: var(--warn); }

.now { display: grid; grid-template-columns: 96px 1fr; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.now .art { width: 96px; height: 96px; border-radius: 8px; background: var(--panel-2); object-fit: cover; }
.now h2 { margin: 0 0 2px; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now .sub { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 6px; background: var(--panel-2); border-radius: 3px; margin: 8px 0 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); }
.times { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.ctl { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.ctl button, .btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; }
.ctl button:hover:not(:disabled), .btn:hover:not(:disabled) { border-color: var(--muted); }
.ctl .primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.ctl .on { border-color: var(--accent); color: var(--accent); }
.vol { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 150px; }
.vol input { width: 130px; accent-color: var(--accent); }
.vol output { width: 2.2em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; color: var(--muted); }
.tabs button.sel { color: var(--text); border-bottom-color: var(--accent); }

main { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 14px; }
.bar-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.bar-row input[type=text] { flex: 1; min-width: 140px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 10px 0; color: var(--muted); }
.empty { color: var(--muted); padding: 24px 6px; text-align: center; }

.list { display: flex; flex-direction: column; gap: 4px; }
.row { position: relative; display: grid; grid-template-columns: 26px 24px 44px 1fr auto auto; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
.row.active { border-color: var(--accent); background: #261a1c; }
.row.lifted { z-index: 5; opacity: .92; box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.row.drop-before::before, .row.drop-after::after { content: ""; position: absolute; left: 0; right: 0; height: 3px; background: var(--accent); border-radius: 2px; }
.row.drop-before::before { top: -3px; }
.row.drop-after::after { bottom: -3px; }
.grab { touch-action: none; cursor: grab; text-align: center; color: var(--muted); user-select: none; }
.num { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.thumb { width: 44px; height: 30px; border-radius: 4px; background: var(--panel-2); object-fit: cover; }
.meta { min-width: 0; }
.meta b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dur { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.acts { display: flex; gap: 3px; }
.acts button { background: none; border: 1px solid transparent; border-radius: 6px; padding: 3px 7px; color: var(--muted); }
.acts button:hover:not(:disabled) { border-color: var(--line); color: var(--text); }
.acts .del:hover:not(:disabled) { color: var(--accent); }
.extra { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; padding: 4px 0 2px 34px; }
.extra select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.card { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.card:hover { border-color: var(--muted); }
.card b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card span { color: var(--muted); font-size: 12px; }

/* fills the window so only <main> scrolls */
#app { height: 100%; }
main { overscroll-behavior: contain; }

/* compact one-line rows */
.list { gap: 3px; }
.row { grid-template-columns: 18px 24px 40px 1fr auto auto; gap: 6px; padding: 2px 6px; border-radius: 6px; }
.grab { font-size: 13px; }
.num { font-size: 12px; }
.thumb { width: 40px; height: 26px; border-radius: 3px; }
.row .meta { display: flex; gap: 8px; align-items: baseline; overflow: hidden; white-space: nowrap; }
.row .meta b { display: inline; flex: 0 1 auto; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.row .meta span { display: inline; flex: 1 1 0; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.acts button { padding: 1px 6px; font-size: 12px; }
@media (max-width: 560px) {
  .now { grid-template-columns: 64px 1fr; }
  .now .art { width: 64px; height: 64px; }
  .vol { margin-left: 0; width: 100%; }
  .vol input { flex: 1; }
  .row { grid-template-columns: 18px 40px 1fr auto; }
  .row .num, .row .dur { display: none; }
  .tabs button { padding: 8px 10px; }
}

.chip.stale { border-color: var(--warn); color: var(--warn); }
