:root {
  --bg: #fafaf8; --fg: #1d1d1b; --muted: #6b6b66; --line: #e2e1dc; --card: #ffffff;
  --accent: #b5462d; --accent-fg: #ffffff; --ok: #2f7d4f; --warn: #b8860b; --chip: #efeee9;
  --switch: #b5462d; --nochange: #5a5a56; --review: #9a7209;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615; --fg: #ececea; --muted: #a09f99; --line: #2c2c2a; --card: #1f1f1d;
    --accent: #e0745a; --chip: #2a2a27; --switch: #e0745a; --nochange: #6e6e69; --review: #b8891e;
  }
}
* { box-sizing: border-box; }
/* Flat link baseline: every anchor inherits its surrounding text color and
   never underlines until hover, where it picks up the accent token. More
   specific rules below (.tabs a, .tile hover, index/list links, the
   deliberate .open-link/.back-link treatment) all out-specificity or
   out-order this and are left untouched. */
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
header { padding: 28px 24px 12px; border-bottom: 1px solid var(--line); }
h1 { margin: 0 0 4px; font-family: "Iowan Old Style", "Palatino Nova", Palatino, Georgia, serif; font-size: 28px; letter-spacing: -0.01em; font-weight: 600; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.sub { margin: 0 0 14px; color: var(--muted); max-width: 70ch; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; color: var(--muted); }
.stats b { color: var(--fg); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; padding: 10px 24px 0; border-bottom: 1px solid var(--line); }
.tabs a { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 10px; font: inherit; color: var(--muted); cursor: pointer; text-decoration: none; }
.tabs a.active { color: var(--fg); border-bottom-color: var(--accent); }
.tabs a.right { margin-left: auto; }
main { padding: 16px 24px 60px; max-width: 1200px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 10px; }
.filters { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.filters button { background: none; border: 0; padding: 6px 10px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.filters button.active { background: var(--chip); color: var(--fg); }
input[type=search], input[type=password], select { font: inherit; font-size: 14px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg); min-width: 220px; }
#grid-search { min-width: 280px; } /* fits the "Search by artist, album or edition" placeholder */
button.primary, form button { font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer; }
.hint { color: var(--muted); font-size: 13.5px; max-width: 80ch; }
.hint code { background: var(--chip); padding: 1px 5px; border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.group { cursor: pointer; }
tr.group:hover td { background: var(--chip); }
tr.detail td { background: var(--card); padding: 12px 16px 16px; }
/* Default background so an action or status the rules below do not name can never render white-on-white. */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; background: var(--nochange); white-space: nowrap; }
.pill.switch { background: var(--switch); } .pill.no-meaningful-difference { background: var(--nochange); } .pill.review { background: var(--review); }
.pill.done { background: var(--ok); } .pill.skip { background: var(--nochange); } .pill.todo { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.pill.lossy { background: var(--warn); }
.pill.stale { background: var(--warn); }
.caveat.stale { color: var(--warn); }
.ver { display: inline-block; margin: 0 10px 2px 0; white-space: nowrap; }
.ver .dr { font-weight: 700; font-variant-numeric: tabular-nums; }
.ver.winner .dr { color: var(--accent); }
.muted { color: var(--muted); }
.caveat { margin: 4px 0; padding-left: 14px; position: relative; color: var(--muted); font-size: 13.5px; }
.caveat::before { content: "•"; position: absolute; left: 0; }
.decision { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.decision input[type=text] { flex: 1 1 280px; font: inherit; font-size: 14px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.decision input[type=text]:focus { outline: none; border-color: var(--accent); }
.decision .saved { font-size: 13px; white-space: nowrap; }
.tracks { margin-top: 10px; font-size: 13px; }
.tracks table { width: auto; }
.tracks th, .tracks td { padding: 3px 10px; border: 0; }
.folder { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--muted); }
/* Deliberately accented, non-underlined links: worklist's "open" and the
   artist page's "← All artists" back link. Hover picks up an underline
   instead of a color change, since they are already accent-colored. */
.open-link, .back-link { color: var(--accent); text-decoration: none; }
.open-link:hover, .back-link:hover { text-decoration: underline; }
.empty { color: var(--muted); padding: 24px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 14px; margin-top: 4px; }
.tile { display: block; text-decoration: none; color: inherit; }
.tile .t-cover, .tile .t-fallback { aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line); display: block; width: 100%; }
.tile .t-fallback { display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px; font-size: 13.5px; font-weight: 600; color: var(--fg); background: var(--chip); }
.tile .t-title { display: block; margin-top: 6px; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.tile:hover .t-title { color: var(--accent); }
.tile .t-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile .t-dr { display: inline-block; margin-top: 4px; background: var(--chip); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.tile .t-count { display: inline-block; margin-top: 4px; margin-left: 6px; font-size: 12px; color: var(--muted); }
.recent { margin-bottom: 10px; } /* matches .toolbar's margin-bottom for even rhythm */
.recent-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.recent-row .tile { flex: 0 0 110px; }
.toast { position: fixed; bottom: 18px; right: 18px; background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 8px; font-size: 13.5px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.chip { display: inline-block; background: var(--chip); color: var(--muted); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; margin: 0 4px 2px 0; }
/* Artists index: one flat, undecorated list of links flowing through columns. */
.idx-list { columns: 3; column-gap: 28px; }
.idx-letter { break-inside: avoid-column; margin: 18px 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.idx-letter:first-child { margin-top: 0; }
.idx-artist { display: block; break-inside: avoid-column; padding: 2px 0; color: inherit; text-decoration: none; font-size: 13.5px; }
.idx-artist:hover { color: var(--accent); }
/* Artist page: serif name up top, then one row per album group — a larger
   cover, the album title leading, edition lines below with the DR in a
   quiet chip and the winning copy marked. */
.artist-title { margin: 6px 0 2px; font-family: "Iowan Old Style", "Palatino Nova", Palatino, Georgia, serif; font-size: 30px; line-height: 1.1; letter-spacing: -0.01em; font-weight: 600; }
.artist-meta { margin: 0 0 14px; font-size: 13.5px; }
.av-group { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.av-group:first-child { padding-top: 0; }
.av-cover, .av-fallback { width: 104px; height: 104px; flex: 0 0 104px; object-fit: cover; border: 1px solid var(--line); display: block; }
.av-fallback { display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px; font-size: 10.5px; font-weight: 600; color: var(--fg); background: var(--chip); }
.av-head { font-size: 15.5px; margin-bottom: 5px; }
.av-title { font-weight: 600; color: inherit; text-decoration: none; }
.av-title:hover { color: var(--accent); }
.av-version { font-size: 13px; margin: 3px 0; }
.av-version a { color: var(--muted); text-decoration: none; }
.av-version a:hover { color: var(--accent); }
.av-version .dr-chip { padding: 1px 8px; font-size: 11px; }
.av-best { background: var(--accent); color: var(--accent-fg); border-radius: 999px; padding: 1px 7px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
/* Album detail: the shelf pull. Large cover with a hint of depth, a
   record-sleeve serif title, the Wikipedia lead, then one card per owned
   version — edition name first, DR in a quiet chip, tracks behind a
   disclosure, the winning copy carrying the accent. */
/* align-items start, not the default stretch: a taller info column must not
   stretch the fixed-width cover into a tall object-fit crop. */
.alb-top { display: flex; align-items: flex-start; gap: 28px; margin-bottom: 10px; }
.alb-cover, .alb-fallback { width: 320px; max-width: 320px; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line); display: block; flex: 0 0 320px; box-shadow: 0 18px 34px -22px rgba(0, 0, 0, 0.45); }
.alb-fallback { display: flex; align-items: center; justify-content: center; text-align: center; padding: 14px; font-size: 14px; font-weight: 600; color: var(--fg); background: var(--chip); }
.alb-info { flex: 1 1 auto; min-width: 0; }
.alb-eyebrow { margin: 2px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.alb-artist-link { color: inherit; text-decoration: none; }
.alb-artist-link:hover { color: var(--accent); }
.alb-title { margin: 4px 0 6px; font-family: "Iowan Old Style", "Palatino Nova", Palatino, Georgia, serif; font-size: 36px; line-height: 1.08; letter-spacing: -0.01em; font-weight: 600; }
.alb-meta { margin: 0 0 4px; font-size: 13.5px; }
.alb-wiki { margin: 14px 0 0; max-width: 62ch; }
.alb-wiki-text { margin: 0; font-size: 14px; line-height: 1.55; }
.alb-wiki-text.clamped { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.alb-wiki-attr { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.alb-wiki-attr a { color: var(--muted); } .alb-wiki-attr a:hover { color: var(--accent); }
.alb-wiki-more { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.alb-compare { margin-top: 16px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.alb-basis { margin: 0 0 6px; font-size: 14px; }
.alb-versions { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; align-items: start; margin-top: 26px; }
.alb-version { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 12px; }
.alb-version.is-winner { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.alb-version-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alb-version-name { margin: 0; font-size: 17px; flex: 1 1 auto; min-width: 0; }
.dr-chip { background: var(--chip); color: var(--muted); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.alb-winner-pill { background: var(--accent); color: var(--accent-fg); border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.alb-edge-note { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); font-style: italic; }
.alb-version-meta { margin: 4px 0 0; font-size: 13px; }
.alb-tracks { margin-top: 10px; }
/* An open track list widens its card to the full row — six columns of
   per-track numbers don't fit a third-width card. */
.alb-version:has(.alb-tracks[open]) { grid-column: 1 / -1; }
.alb-tracks summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.alb-tracks summary:hover { color: var(--accent); }
.alb-tracks[open] summary { margin-bottom: 8px; }
.alb-tracks .folder { margin-bottom: 8px; }
/* Stats view: flat totals, a DR histogram, and two ranked lists. */
.dr-dist { max-width: 640px; }
.dr-row { display: grid; grid-template-columns: 46px 1fr 42px; gap: 10px; align-items: center; margin: 3px 0; font-size: 13.5px; }
.dr-bar { height: 14px; background: var(--chip); }
.tnum { font-variant-numeric: tabular-nums; text-align: right; }
.stats-list { list-style: none; margin: 0 0 20px; padding: 0; max-width: 420px; }
.stats-list li { padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.stats-list a { color: inherit; text-decoration: none; }
.stats-list a:hover { color: var(--accent); }
/* Quick-open palette ("/" or Cmd/Ctrl+K): overlay, one input, a short list. */
.pal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.42); display: flex; justify-content: center; align-items: flex-start; padding: 14vh 16px 0; z-index: 100; }
/* display:flex above beats the UA's [hidden]{display:none}, so close() (which
   sets .hidden) needs this to actually hide the overlay. */
.pal-overlay[hidden] { display: none; }
.pal-panel { width: 100%; max-width: 560px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55); overflow: hidden; }
.pal-input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--fg); font: inherit; font-size: 16px; padding: 14px 16px; outline: none; }
.pal-list { list-style: none; margin: 0; padding: 6px; max-height: 420px; overflow-y: auto; }
.pal-list:empty { padding: 0; }
.pal-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.pal-row.selected { background: var(--chip); }
.pal-thumb { width: 40px; height: 40px; object-fit: cover; border: 1px solid var(--line); flex: 0 0 40px; background: var(--chip); }
.pal-text { flex: 1 1 auto; min-width: 0; }
.pal-title { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-meta { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-empty { padding: 14px 12px; color: var(--muted); font-size: 13.5px; }
@media (max-width: 720px) { header, main, .tabs { padding-left: 14px; padding-right: 14px; } th:nth-child(5), td:nth-child(5) { display: none; } .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } .idx-list { columns: 1; } .alb-top { flex-direction: column; } .alb-cover, .alb-fallback { width: 100%; max-width: 320px; } .alb-title { font-size: 30px; } .alb-versions { grid-template-columns: 1fr; } #grid-search { min-width: 160px; } }
