/* Layout: one quiet track list on a single panel, search pinned on top; the songs are the content. */
:root {
  --bg: #eef1f4;        /* cool paper */
  --panel: #fbfcfd;
  --ink: #1b2430;
  --muted: #637083;
  --line: #dde2e8;
  --accent: #2c4f86;    /* ink blue: the new model, and actions */
  --accent-soft: #e4ebf6;
  --old: #7a6a55;       /* the old model: warm grey, present but secondary */
  --focus: #9db6dc;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101419; --panel: #161b22; --ink: #e6eaf0; --muted: #8d98a8; --line: #252c36;
    --accent: #9ab8ea; --accent-soft: #1f2b3d; --old: #bfae96; --focus: #4a6aa0; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101419; --panel: #161b22; --ink: #e6eaf0; --muted: #8d98a8; --line: #252c36;
  --accent: #9ab8ea; --accent-soft: #1f2b3d; --old: #bfae96; --focus: #4a6aa0; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 680px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* header, centred like a title page: a small waveform split in two (the job this library does), the
   name set wide, who makes it between two hairlines, then the stock line and how it works */
.top { padding-block: 28px 8px; text-align: center; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
a.brand { width: fit-content; margin: 0 auto; border-radius: var(--radius); padding: 2px 10px; }
a.brand:hover h1 { color: var(--accent); }
/* the two pages, as one pill: where you are is filled in */
.nav { display: inline-flex; gap: 4px; margin-top: 16px; padding: 4px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
.nav a { display: flex; align-items: center; gap: 7px; padding: 8px 18px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 600; letter-spacing: .05em; }
.nav a:hover { color: var(--ink); background: var(--bg); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--panel); }
.nav svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.top .nav + .meta { margin-top: 14px; }
.mark { display: flex; align-items: center; gap: 3px; height: 28px; transform: scale(1.25); }
.mark i { width: 3px; border-radius: 2px; background: var(--accent); }
.mark i:nth-child(n+5) { background: var(--old); }
/* the trailing letter-spacing would push the name off centre; the padding evens it */
.top h1 { margin: 2px 0 0; font-size: 30px; font-weight: 700; letter-spacing: .3em; padding-left: .3em; line-height: 1.2; }
.byline { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0;
  color: var(--muted); font-size: 13px; letter-spacing: .25em; padding-left: .25em; }
.byline::before, .byline::after { content: ""; width: 32px; height: 1px; background: var(--line); }
.tagline { margin: 14px 0 0; font-size: 14px; color: var(--ink); text-wrap: balance; }
.tagline + .help { margin-top: 4px; }
.help a { color: var(--accent); text-decoration: none; }
.help a:hover { text-decoration: underline; }
.meta { margin: 6px 0 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.meta b { color: var(--ink); font-weight: 600; }
.top .meta { margin-top: 12px; }
.stale { text-align: left; margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--ink); font-size: 13px; }

.searchbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 2; background: var(--bg); padding-block: 10px; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.search { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0 12px; }
.searchform { display: flex; gap: 8px; }
.search:focus-within { border-color: var(--accent); }
.search { flex: 1; min-width: 0; }
.go { flex: none; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--panel);
  padding: 0 18px; font-size: 15px; font-weight: 600; cursor: pointer; }
.go:active { transform: translateY(1px); }
.search svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 16px; padding: 11px 0; }
.search input::placeholder { color: var(--muted); }
/* where to search: our shelf first, then the two catalogues */
.tabs { display: flex; gap: 20px; margin-top: 8px; font-size: 15px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 6px 0 7px; margin-bottom: -1px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.count { margin-left: 4px; font-size: 12px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }

/* a pasted playlist: its name over the list, a way back to searching */
.plhead { margin-top: 14px; }
.plhead h2 { margin: 2px 0 0; font-size: 18px; font-weight: 650; text-wrap: balance; overflow-wrap: anywhere; }
.back { border: 0; background: none; padding: 2px 0; color: var(--accent); cursor: pointer; font-size: 14px; }

.captionrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 10px 0 8px; }
.caption { color: var(--muted); font-size: 13px; margin: 0; min-width: 0; font-variant-numeric: tabular-nums; }
.toggle { flex: none; display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle input { margin: 0; accent-color: var(--accent); }
.detail { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.warn { color: var(--old); }

/* the track list */
.list { list-style: none; margin: 0; padding: 0; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.list:empty { display: none; }
.song { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; padding: 12px 14px; }
.song + .song { border-top: 1px solid var(--line); }
.line1, .line2 { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; min-width: 0; }
.line2 { margin-top: 5px; row-gap: 4px; align-items: center; font-size: 12px; color: var(--muted); }
.title { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.artist { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }

.tag { display: inline-block; padding: 0 6px; border-radius: 4px; line-height: 20px; font-weight: 500; }
.tag.new { background: var(--accent-soft); color: var(--accent); }
.tag.old { box-shadow: inset 0 0 0 1px var(--line); color: var(--old); }
.platform { color: var(--muted); }

/* buttons share the column's width, so a second one lines up under the first */
.actions { display: grid; gap: 6px; width: 104px; }
.empty .actions { width: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.btn { border: 1px solid var(--accent); background: transparent; color: var(--accent); border-radius: 8px;
  padding: 5px 12px; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--accent-soft); }
.btn:active { transform: translateY(1px); }
.btn.quiet { border-color: var(--line); color: var(--ink); font-weight: 400; font-size: 13px; padding-block: 3px; }
.btn.quiet:hover { background: var(--bg); }
.btn.done, .btn.quiet.done { border-color: var(--line); color: var(--muted); font-weight: 400; }
.song.copied { background: var(--bg); }

.plhint { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.more { display: block; margin: 12px auto 0; border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 14px; }

.empty { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.empty h2 { font-size: 16px; margin: 0 0 6px; }
.empty p { margin: 6px 0; color: var(--muted); font-size: 14px; }
.empty .actions { flex-direction: row; margin-top: 10px; }
.msg { display: block; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--bg);
  font-family: inherit; font-size: 14px; overflow-wrap: anywhere; }

.help { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.help ol { margin: 8px auto 4px; max-width: 34em; text-align: left; }
main.wrap { padding-bottom: 40px; }
.help summary { cursor: pointer; color: var(--ink); }
.help ol { padding-left: 20px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  max-width: calc(100% - 32px); background: var(--ink); color: var(--panel); padding: 9px 16px; border-radius: 8px;
  font-size: 14px; z-index: 5; }

.manual { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); width: min(92vw, 420px); }
.manual textarea { width: 100%; font: 15px/1.4 var(--font); padding: 8px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); color: var(--ink); }
.manual form { text-align: right; margin-top: 8px; }
.manual button { border: 0; background: var(--accent); color: var(--panel); border-radius: 8px; padding: 6px 16px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.nowrap { white-space: nowrap; }

/* thanks, at the very end: small print under a hairline */
.credits { border-top: 1px solid var(--line); margin-top: 8px; padding-block: 18px 32px; color: var(--muted); font-size: 13px; }
.credits h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: .2em; text-align: center; }
.credits ul { margin: 0 auto; padding: 0; list-style: none; max-width: 40em; display: grid; gap: 6px; line-height: 1.6; }
.credits b { color: var(--ink); font-weight: 500; }
.credits a { color: var(--accent); text-decoration: none; }
.credits a:hover { text-decoration: underline; }
