/*
 * Tokens harmonised with Citadel (the LAN dashboard this page is embedded in as an iframe) --
 * same values as Citadel's own web/css/tokens.css, ported verbatim rather than approximated.
 * The vinyl/scrobble/live category triad is this project's own addition, layered on top the
 * same way Citadel layers --ok/--warn/--bad status colours on its one main --accent.
 */
@font-face { font-family: "Chakra Petch"; font-weight: 400; font-display: swap; src: url("../fonts/ChakraPetch-400.woff2") format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 500; font-display: swap; src: url("../fonts/ChakraPetch-500.woff2") format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 600; font-display: swap; src: url("../fonts/ChakraPetch-600.woff2") format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 700; font-display: swap; src: url("../fonts/ChakraPetch-700.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("../fonts/JetBrainsMono-Regular.ttf") format("truetype"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap; src: url("../fonts/JetBrainsMono-Bold.ttf") format("truetype"); }

:root {
  --bg: #07060a; --bg-2: #0b0910; --surface: #0e0b14; --surface-2: #151021; --surface-3: #1c1530;
  --accent: #8b5cf6; --accent-hi: #a855f7; --accent-soft: #c4b5fd; --accent-deep: #4c1d95; --accent-wash: rgba(139, 92, 246, 0.10);
  --silver-hi: #e6e9ee; --silver: #c9ced6; --silver-mute: #9aa1ad; --silver-dim: #6b7280;
  --edge: rgba(201, 206, 214, 0.13); --edge-strong: rgba(168, 85, 247, 0.45);
  --ok: #34d399; --warn: #f5b454; --bad: #f43f5e;
  --well: rgba(0, 0, 0, 0.38); --vignette: rgba(0, 0, 0, 0.45);

  --accent-vinyl: #d9a441;    /* new: warm brass/gold, distinct from violet+silver -- "physical/analog" */
  --accent-scrobble: var(--accent); /* = --accent: scrobbles are the everyday/default category (so a Citadel custom theme's accent recolours them too) */
  --accent-live: #f43f5e;     /* = --bad's rose-red, repurposed here as "hot/live" energy, not an error */

  --font-display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --chamfer: 14px; --gap: 16px; --radius-sm: 2px; --ease: cubic-bezier(.2, .7, .2, 1);

  /* Back-compat aliases: every existing var(--bg-elevated)/var(--border)/var(--text)/var(--font-body)/
     var(--shadow) call site below keeps rendering correctly under the new palette. */
  --bg-elevated: var(--surface-2); --border: var(--edge); --text: var(--silver-hi);
  --text-dim: var(--silver-mute); --text-muted: var(--silver-dim); --gridline: var(--edge);
  --glow: var(--accent-wash); --shadow: 0 1px 2px rgba(0,0,0,.45), 0 5px 26px rgba(76,29,149,.25);
  --font-body: var(--font-display);
}

:root[data-theme="light"] {
  --bg: #f2e8d5; --bg-2: #f5ecdd; --surface: #f8f0e2; --surface-2: #faf4e6; --surface-3: #fdf9f0;
  --accent: #b5541f; --accent-hi: #d9691f; --accent-soft: #82401b; --accent-deep: #6e2a12; --accent-wash: rgba(181, 84, 31, 0.10);
  --silver-hi: #2a2015; --silver: #4a3c2a; --silver-mute: #6b5c44; --silver-dim: #93876c;
  --edge: #ddcda8; --edge-strong: rgba(217, 105, 31, 0.45);
  --ok: #0d8a6a; --warn: #b8791f; --bad: #8a2e2e;
  --well: rgba(42, 32, 21, 0.07); --vignette: rgba(42, 32, 21, 0.10);

  --accent-vinyl: #460c80; --accent-scrobble: var(--accent); --accent-live: #227f38;

  --bg-elevated: var(--surface-2); --border: var(--edge); --text: var(--silver-hi);
  --text-dim: var(--silver-mute); --text-muted: var(--silver-dim); --gridline: var(--edge);
  --glow: var(--accent-wash); --shadow: 0 1px 2px rgba(60,40,10,.08), 0 5px 22px rgba(60,40,10,.07);
}

* { box-sizing: border-box; }

.i { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.hud { font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-dim); }
.hud::before { content: "// "; color: var(--accent); }

/* thin, quiet scrollbars -- same rule as Citadel's own tokens.css */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }

body {
  background-color: var(--bg);
  /* A faint noise tile (breaks up flat color like paper grain / a hint
     of tape hiss) plus a soft glow seated at the top of the page --
     accent stage-light in dark mode, sun-bleached warmth in light. */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E"),
    radial-gradient(1100px 620px at 50% -12%, var(--glow), transparent 60%);
  background-repeat: repeat, no-repeat;
  background-attachment: fixed, fixed;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* Inside Citadel, when its custom theme has a background picture (see applyCitadelLook in app.js): the page
   backdrop goes see-through so Citadel's picture shows behind the panels, as it does on its own dashboard. */
html.citadel-bg, html.citadel-bg body { background: transparent; }

h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.tabbar { display: none; }

/* Three-column grid (not flex) so the search box centers on the bar
   itself -- not just between however wide the home/theme buttons
   happen to be -- via two equal side tracks. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr minmax(0, 420px) 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.topbar-side { display: flex; align-items: center; gap: 8px; }
/* Both side buttons sit right up against the search box (10px gap, from
   the grid gap above) rather than pinned to the outer edges of the bar. */
.topbar-left { justify-self: end; }
.topbar-right { justify-self: start; }
/* phone-only: the back chevron + the page's title (see setTopbarTitle) */
.topbar .topbar-back, .topbar .topbar-title, .topbar .topbar-reload { display: none; }
/* desktop: back sits beside Home and says where it goes ("‹ Gojira"); a phone shows just the chevron */
.tb-label { display: none; }
@media (min-width: 641px) {
  body:not([data-route="home"]) .topbar .topbar-back { display: flex; width: auto; max-width: 220px; gap: 6px; padding: 0 10px 0 6px; }
  .topbar-back .tb-label { display: inline; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-back:hover { color: var(--text); border-color: var(--accent); }
}

.icon-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--edge-strong);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.search-wrap {
  position: relative;
  width: 100%;
}

#search-input {
  width: 100%;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
}
#search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 360px;
  overflow-y: auto;
}
.search-result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.88rem;
}
.search-result-row:hover { background: var(--bg); }
.search-result-row .meta { color: var(--text-dim); font-size: 0.78rem; }

main#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  min-height: 60vh;
}

.loading-screen {
  max-width: 380px;
  margin: 130px auto 0;
  padding: 0 24px;
  text-align: center;
}
.loading-label {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.92rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.progress-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.15s ease-out;
}
.progress-fill.indeterminate {
  width: 35% !important;
  animation: progress-indeterminate 1.1s ease-in-out infinite;
}
@keyframes progress-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(340%); }
}
.progress-text {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  padding: 20px;
}
.footer-credit { margin-top: 6px; font-size: 0.72rem; color: var(--text-muted); }
.footer-credit a { color: inherit; text-decoration: underline; }

/* --- Home: css/home.css --- */

h1 { font-size: 1.7rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; color: var(--text-dim); }
.section { margin-bottom: 34px; }
.subtle { color: var(--text-dim); font-size: 0.85rem; }


/* --- Artist page --- */
.artist-header { margin-bottom: 6px; }
.artist-mbid-badge {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  margin-left: 8px;
  vertical-align: middle;
}

.badge-row { display: flex; gap: 10px; margin: 14px 0 30px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid var(--border);
  /* A wash of the category color rather than plain surface -- currentColor
     picks up whichever accent the .vinyl/.scrobble/.live modifier sets. */
  background: color-mix(in srgb, currentColor 10%, var(--bg-elevated));
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge:hover { border-color: currentColor; background: color-mix(in srgb, currentColor 18%, var(--bg-elevated)); }
.badge.disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.badge.vinyl { color: var(--accent-vinyl); }
.badge.scrobble { color: var(--accent-scrobble); }
.badge.live { color: var(--accent-live); }

.bar-row {
  display: grid;
  grid-template-columns: 1fr 60px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.86rem;
  cursor: pointer;
}
.bar-row:hover .bar-label { color: var(--accent); }
.bar-track {
  height: 7px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent-scrobble); }
.bar-count { text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.list-item:first-child { border-top: none; }
.list-item:hover .list-title { color: var(--accent); }
.list-title { font-weight: 600; font-size: 0.92rem; }
.list-sub { color: var(--text-dim); font-size: 0.8rem; margin-top: 1px; }
.list-right { color: var(--text-dim); font-size: 0.82rem; text-align: right; white-space: nowrap; }

.vinyl-card {
  --c: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  clip-path: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, var(--c) 100%, 0 calc(100% - var(--c)));
  padding: 12px 14px;
  margin-bottom: 8px;
}
.vinyl-card .title { font-weight: 600; font-size: 0.9rem; }
.vinyl-card .meta { color: var(--text-dim); font-size: 0.78rem; margin-top: 3px; }

/* --- Setlist detail --- */
.setlist-songs { margin-top: 14px; }
.setlist-song-row {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  font-size: 0.87rem;
  align-items: baseline;
}
.setlist-song-row .pos { color: var(--text-dim); width: 22px; flex-shrink: 0; }
.setlist-song-row .cover-tag {
  font-size: 0.72rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 5px;
}
.set-name-label {
  margin-top: 14px;
  margin-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.set-name-label::before { content: "// "; color: var(--accent); }


/* Inline clickable entity name (artist/venue) inside otherwise-plain
   text -- e.g. the setlist page's heading and subline. */
.link-text { cursor: pointer; font-weight: 600; color: var(--text); }
.link-text:hover { color: var(--accent); }

.error-box {
  padding: 40px 0;
  text-align: center;
  color: var(--text-dim);
}

/* --- Charts (bar chart w/ hover tooltip; see js/charts.js) --- */
.chart-wrap { position: relative; margin-bottom: 8px; }
.chart-wrap svg { display: block; width: 100%; overflow: visible; }
.chart-gridline { stroke: var(--gridline); stroke-width: 1; }
.chart-axis-label {
  fill: var(--text-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.chart-bar { cursor: pointer; }
.chart-bar:hover, .chart-bar.hovered { filter: brightness(1.12); }
.chart-bar.selected { filter: brightness(1.2); }

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
/* Scoped to the landing page only (renderHome() passes { center: true }) -- the same
   toolbar/tabs on the Vinyl/Shows/Scrobbles browse pages stay left-aligned as before. */
.chart-toolbar--center { justify-content: center; }
.chart-toolbar--center .clear-filter-pill { margin-left: 12px; }
.tabs-only--center { display: flex; justify-content: center; }
.granularity-tabs {
  /* inline-flex, not flex: flex is block-level by default, so standalone
     (not itself a flex-item, as when it sits directly in a plain .section
     rather than inside .chart-toolbar) it would stretch to the full width
     of its container -- its buttons staying compact but the bordered box
     around them trailing on as empty space past "All". */
  display: inline-flex;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
/* Spacing for a standalone tab strip (renderTimeWindowTabs) -- a chart's
   own tabs get their bottom margin from the .chart-toolbar row instead. */
.tabs-only { margin-bottom: 14px; }
.gtab {
  padding: 5px 12px;
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: none;
  border-right: 1px solid var(--edge);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.gtab:last-child { border-right: none; }
.gtab:hover { color: var(--text); }
.gtab.active { background: var(--accent-wash); color: var(--accent-soft); }
.clear-filter-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.78rem;
  cursor: pointer;
}
.clear-filter-pill:hover { border-color: var(--accent); }
.clear-filter-pill span { color: var(--text-dim); font-size: 0.9rem; }
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: var(--shadow);
  padding: 5px 9px;
  font-size: 0.76rem;
  white-space: nowrap;
  transform: translate(-50%, -110%);
  opacity: 0;
  transition: opacity 0.08s;
  z-index: 5;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip .tt-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tooltip .tt-label { color: var(--text-dim); }

/* --- Browse / table pages (artists, vinyl, shows, scrobbles) --- */
.page-header { margin-bottom: 18px; }
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.filter-bar input[type="text"],
.filter-bar select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--edge);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.85rem;
}
.filter-bar input[type="text"] { flex: 1; min-width: 160px; }
.filter-count { color: var(--text-dim); font-size: 0.8rem; white-space: nowrap; }

/* Sort control for bar-list panels (an expanded "Show more" list that
   keeps the bar-chart look instead of becoming a data-table) -- same
   sort behavior as a data-table's th.sorted/arrow, just on buttons.
   Styled to match the artist page's .badge pills ("on vinyl" / "scrobbles"
   / "seen live") rather than a generic button, so a sort toggle reads as
   the same family of control as everything else on that page. */
.sort-toggle { display: flex; gap: 8px; }
.sort-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid var(--border);
  background: color-mix(in srgb, currentColor 10%, var(--bg-elevated));
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.sort-toggle-btn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.sort-toggle-btn:hover { border-color: currentColor; background: color-mix(in srgb, currentColor 18%, var(--bg-elevated)); }
.sort-toggle-btn.active { color: var(--accent); }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.data-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.data-table th:hover { color: var(--text); }
.data-table th.sorted { color: var(--accent); }
.data-table th .arrow { font-size: 0.7rem; margin-left: 2px; }
.data-table th.num { text-align: right; } /* must mirror td.num or header/data columns drift out of alignment */
.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover td { background: var(--bg); }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-dim); white-space: nowrap; }
.data-table .row-title { font-weight: 600; }
.data-table .row-sub { color: var(--text-dim); font-size: 0.78rem; }
.data-table .nowrap { white-space: nowrap; }
.table-scroll { overflow-x: auto; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.pagination button {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--edge);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination button:not(:disabled):hover { border-color: var(--edge-strong); background: var(--accent-wash); }

.show-more-btn, .show-less-btn {
  display: block;
  margin: 14px auto 0;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--edge);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.show-more-btn:hover, .show-less-btn:hover { border-color: var(--accent); }

/* --- Enrichment (Wikipedia bio, MusicBrainz tags, cover art) --- */
.about-panel {
  --c: 10px;
  display: flex;
  gap: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  clip-path: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, var(--c) 100%, 0 calc(100% - var(--c)));
  padding: 16px;
  margin-bottom: 30px;
}
.about-panel img.about-thumb {
  width: 84px;
  height: 84px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}
.about-panel .about-text { font-size: 0.85rem; color: var(--text-dim); line-height: 1.55; }
.about-panel .about-source { font-size: 0.72rem; margin-top: 8px; }
.about-panel .about-source a { color: var(--accent); }
.genre-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.genre-pill {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--edge);
  color: var(--text-dim);
}
.about-skeleton { color: var(--text-muted); font-size: 0.82rem; font-style: italic; }

.vinyl-card {
  --c: 10px;
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  clip-path: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, var(--c) 100%, 0 calc(100% - var(--c)));
}
.vinyl-card img.cover-thumb, .vinyl-card img.cover-own {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}
.vinyl-card .vinyl-body { flex: 1; min-width: 0; }
.vinyl-card .meta { margin-top: 2px; }

/* --- Album detail page --- */
.album-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin: 6px 0 30px;
}
.album-cover-large {
  width: 160px;
  height: 160px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

/* --- Mobile: bottom tab bar + swipeable stat carousels (bespoke, not a reflow of desktop) --- */
@media (max-width: 640px) {
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg-2) 92%, transparent);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--edge-strong);
  }
  .tabbar a {
    display: grid; justify-items: center; gap: 2px; padding: 4px 0;
    color: var(--silver-mute); font-family: var(--font-mono);
    font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  }
  .tabbar a[aria-current] { color: var(--accent-soft); }
  .tabbar .i { width: 22px; height: 22px; }

  main#app { padding-bottom: 88px; }
  /* back chevron · search (or the page's title) · theme -- home + maintenance live in the tab bar / desktop */
  .topbar { grid-template-columns: 32px minmax(0, 1fr) 32px; gap: 8px; padding: 8px 10px; }
  .topbar-left, .topbar-right { justify-self: stretch; justify-content: center; }
  .topbar-home, #maintenance-link { display: none; }
  .topbar .icon-btn { width: 32px; height: 32px; border-color: transparent; background: none; }
  .topbar .icon-btn .i { width: 20px; height: 20px; }
  .topbar .topbar-back { display: flex; margin-left: -4px; }
  body[data-route="home"] .topbar-back { display: none; }
  /* phones make a hard refresh hard to find: this re-downloads the site and the data, then reloads */
  .topbar .topbar-reload { display: flex; }
  .topbar-reload.spinning .i { animation: reload-spin .8s linear infinite; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .topbar-left, .topbar-right { min-width: 32px; }
  .search-wrap, .topbar-title { grid-column: 2; grid-row: 1; }
  .topbar-title { align-items: baseline; justify-content: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; }
  .topbar-title .hud { font-size: 10px; }
  .topbar-title .tt-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .03em;
    overflow: hidden; text-overflow: ellipsis; }
  body.has-topbar-title:not(.search-open) .topbar-title { display: flex; cursor: pointer; }
  .topbar-title .tt-search { width: 15px; height: 15px; align-self: center; color: var(--text-dim); margin-left: 2px; }
  body.has-topbar-title:not(.search-open) .search-wrap { display: none; }
  /* a long album title wraps beside a smaller cover instead of running off the screen */
  .album-header { gap: 14px; margin-top: 0; }
  .album-header > div { min-width: 0; }
  .album-header h1 { font-size: 1.35rem; line-height: 1.2; overflow-wrap: anywhere; }
  .album-cover-large { width: 112px; height: 112px; }
  /* Crate dig + the view switch share one row */
  .coll-actions { flex-wrap: nowrap; width: 100%; justify-content: space-between; }
  .coll-btn, .seg button { padding: 7px 9px; }
  .dig-word { display: none; }

}

/* =====================================================================
   The Collection (#/vinyl) -- see js/collection.js
   ===================================================================== */
.coll-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.coll-head h1 { margin: 0; font-size: 2rem; letter-spacing: .02em; }
.coll-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.coll-btn { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .06em; padding: 7px 12px;
  border: 1px solid var(--edge); background: var(--surface-2); color: var(--text); border-radius: var(--radius-sm); cursor: pointer; }
.coll-btn:hover { border-color: var(--accent-vinyl); color: var(--accent-vinyl); }
.seg { display: inline-flex; border: 1px solid var(--edge); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { font-family: var(--font-mono); font-size: 0.78rem; padding: 7px 12px; border: none; background: var(--surface); color: var(--text-dim); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--edge); }
.seg button[aria-selected="true"] { background: var(--surface-3); color: var(--accent-vinyl); box-shadow: inset 0 -2px 0 var(--accent-vinyl); }
.linkish { background: none; border: none; padding: 0; color: var(--accent-soft); cursor: pointer; font: inherit; text-align: left; }
.linkish:hover { color: var(--accent-vinyl); text-decoration: underline; }
.linkish.big { font-weight: 600; font-size: 1rem; color: var(--text); }

/* stats strip */
.coll-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); border: 1px solid var(--edge); background: var(--surface);
  margin-bottom: 14px; position: relative; }
.coll-stats::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent-vinyl); }
.cs { padding: 12px 16px; border-right: 1px solid var(--edge); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cs:last-child { border-right: none; }
.cs b { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 500; color: var(--accent-vinyl); }
.cs span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.cs-genres { grid-column: span 2; justify-content: center; }
.gmix { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-bottom: 6px; gap: 2px; }
.gmix i { background: color-mix(in srgb, var(--accent-vinyl) calc(100% - var(--i) * 13%), var(--accent)); min-width: 4px; }

/* tools + facets */
.coll-tools { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 10px; }
.coll-tools input[type="search"], .coll-tools select { padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--edge);
  background: var(--bg-elevated); color: var(--text); font-size: 0.85rem; font-family: inherit; }
.coll-tools input[type="search"] { flex: 1; min-width: 220px; }
.coll-tools input[type="search"]:focus, .coll-tools select:focus { outline: none; border-color: var(--accent-vinyl); }
.coll-tools label { font-size: 0.8rem; color: var(--text-dim); display: flex; gap: 6px; align-items: center; }
.dir-btn { padding: 7px 10px; white-space: nowrap; }
/* Filters: collapsed to one bar (desktop) until opened; the chevron flips to point up when open */
.coll-filters { margin-bottom: 10px; }
.filters-bar { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 14px; border: 1px solid var(--edge); background: var(--surface);
  color: var(--text); cursor: pointer; text-align: left; font-family: var(--font-mono); font-size: 0.76rem; text-transform: uppercase; letter-spacing: .1em; }
.filters-bar:hover { border-color: var(--accent-vinyl); }
.filters-bar .fb-active { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-body, inherit);
  text-transform: none; letter-spacing: 0; font-size: 0.8rem; color: var(--text-dim); }
.filters-bar .fb-active b { font-family: var(--font-mono); color: #120d05; background: var(--accent-vinyl); border-radius: 999px; padding: 0 6px; margin-right: 6px; font-weight: 600; }
.filters-bar .i { margin-left: auto; color: var(--text-dim); transition: transform .2s var(--ease); }
.coll-filters.open .filters-bar .i { transform: rotate(180deg); color: var(--accent-vinyl); }
.coll-facets { display: none; gap: 6px; padding: 10px 12px; border: 1px solid var(--edge); border-top: none; background: var(--surface); }
.coll-filters.open .coll-facets { display: grid; }
.facet { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: baseline; }
.f-title { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); padding-top: 4px; }
.f-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.fchip { font-size: 0.78rem; padding: 3px 9px; border: 1px solid var(--edge); border-radius: 999px; background: var(--surface-2); color: var(--text); cursor: pointer; }
.fchip i { font-style: normal; font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); margin-left: 3px; }
.fchip:hover:not(:disabled) { border-color: var(--accent-vinyl); }
.fchip.on { background: var(--accent-vinyl); border-color: var(--accent-vinyl); color: #120d05; }
.fchip.on i { color: rgba(18, 13, 5, .7); }
.fchip:disabled { opacity: .35; cursor: default; }
.coll-count { font-size: 0.82rem; color: var(--text-dim); margin: 4px 0 14px; }
.coll-group { font-size: 0.95rem; margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--edge); color: var(--accent-vinyl); }
.coll-group span { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); margin-left: 6px; }
.empty-state { padding: 40px; text-align: center; color: var(--text-dim); border: 1px dashed var(--edge); }

/* Wall: the cover grid; on hover the sleeve lifts and the record slides out in its real colour */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 26px 20px; }
.rec { display: flex; flex-direction: column; gap: 3px; text-align: left; background: none; border: none; padding: 0; color: var(--text); cursor: pointer; min-width: 0; }
.rec-art { position: relative; aspect-ratio: 1; margin-bottom: 7px; }
.rec-cover { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.rec-cover.noart { display: grid; place-items: center; background: var(--surface-3); font-size: 2.4rem; color: var(--text-muted); }
.rec-disc { position: absolute; z-index: 0; top: 4%; left: 4%; width: 92%; height: 92%; border-radius: 50%; transition: transform .45s var(--ease);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.rec-disc i { position: absolute; inset: 35%; border-radius: 50%; background: radial-gradient(circle, #111 0 7%, var(--accent-vinyl) 8% 100%); opacity: .92; }
.rec:hover .rec-disc, .rec:focus-visible .rec-disc { transform: translateX(36%) rotate(24deg); }
.rec:hover .rec-cover, .rec:focus-visible .rec-cover { transform: translateX(-6%) translateY(-3px); box-shadow: 0 12px 28px rgba(0, 0, 0, .55); }
.rec-title { font-weight: 600; font-size: 0.88rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rec-artist { font-size: 0.8rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-meta { display: flex; gap: 7px; align-items: center; font-size: 0.74rem; color: var(--text-muted); font-family: var(--font-mono); }
.stars { color: var(--accent-vinyl); letter-spacing: 1px; font-family: var(--font-body); }
.stars .off { color: var(--edge); }
.cdot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); flex: none; }
.tagl { border: 1px solid var(--edge); padding: 0 4px; font-size: 0.66rem; }

/* Shelf: spines filed A-Z */
.shelf-note { margin-bottom: 8px; }
.shelf { display: flex; flex-wrap: wrap; align-items: flex-end; row-gap: 26px; padding: 18px 10px 0; position: relative;
  background: linear-gradient(to top, var(--surface-3) 0 10px, transparent 10px) bottom / 100% 236px repeat-y; }
.spine { --spine: #2a2533; position: relative; height: 210px; width: calc(22px + var(--w) * 10px); margin: 0 1px 10px; border: none; cursor: pointer;
  background: linear-gradient(90deg, rgba(0,0,0,.35), transparent 18%, transparent 82%, rgba(0,0,0,.35)), var(--spine);
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 8px 0; overflow: hidden;
  transition: transform .25s var(--ease); box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
.spine span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-height: 96px; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.spine .sp-title { font-weight: 600; max-height: 110px; }
.spine:hover, .spine:focus-visible { transform: translateY(-16px); z-index: 2; }
.shelf-letter { align-self: stretch; display: flex; align-items: flex-start; font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-vinyl);
  margin: 0 6px 10px 12px; padding-top: 2px; border-left: 1px solid var(--edge); padding-left: 6px; height: 210px; }
.shelf-peek { position: absolute; z-index: 5; display: flex; gap: 10px; align-items: center; width: 240px; padding: 8px; pointer-events: none;
  background: var(--surface-2); border: 1px solid var(--edge-strong); box-shadow: var(--shadow); font-size: 0.8rem; }
.shelf-peek .peek-cover { width: 70px; height: 70px; object-fit: cover; flex: none; }
[data-role="results"] { position: relative; }

/* List */
.coll-table .lthumb { width: 34px; height: 34px; object-fit: cover; display: block; }
.coll-table .lthumb.noart { background: var(--surface-3); display: grid; place-items: center; font-size: 0.8rem; }
.coll-table tr.grp td { background: var(--surface-2); color: var(--accent-vinyl); font-weight: 600; }

/* Insights */
.coll-insights { margin: 30px 0 10px; border-top: 1px solid var(--edge); padding-top: 12px; }
.coll-insights summary { cursor: pointer; font-size: 1rem; font-weight: 600; list-style: none; display: flex; gap: 10px; align-items: center; }
.coll-insights summary::-webkit-details-marker { display: none; }
.coll-insights summary::after { content: "▾"; color: var(--text-muted); transition: transform .2s; }
.coll-insights[open] summary::after { transform: rotate(180deg); }
.ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 14px; }
.ins { border: 1px solid var(--edge); background: var(--surface); padding: 12px 14px; min-width: 0; }
.ins-wide { grid-column: 1 / -1; }
.ins h3 { font-size: 0.72rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); margin: 0 0 10px; }
.ibar { display: grid; grid-template-columns: minmax(0, 1fr) 90px 28px; gap: 8px; align-items: center; width: 100%; background: none; border: none;
  color: var(--text); padding: 3px 0; font-size: 0.8rem; cursor: pointer; text-align: left; }
.ibar:hover:not(:disabled) .ik { color: var(--accent-vinyl); }
.ik { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.iv i { display: block; height: 100%; background: var(--accent-vinyl); }
.in { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); text-align: right; }
.split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin-bottom: 8px; gap: 2px; }
.split i:first-child { background: var(--accent-vinyl); } .split i:last-child { background: var(--accent); }

/* The record drawer */
.drawer-shell { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .25s; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg-2); border-left: 1px solid var(--edge-strong);
  box-shadow: -20px 0 60px rgba(0, 0, 0, .5); transform: translateX(100%); transition: transform .3s var(--ease); display: flex; flex-direction: column; }
.drawer-shell.open { pointer-events: auto; }
.drawer-shell.open .drawer-backdrop { opacity: 1; }
.drawer-shell.open .drawer { transform: none; }
body.drawer-open { overflow: hidden; }
.drawer-bar { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--edge); }
.drawer-bar .spacer { flex: 1; }
.drawer-body { overflow-y: auto; padding: 18px 22px 30px; flex: 1; min-height: 0; touch-action: pan-y; }
.drawer-bar { align-items: center; }
.drawer-pos { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); margin-left: 6px; }
.rd-head { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px 60px; margin-bottom: 18px; } /* the gap is where the record slides out */
.rd-id { position: relative; z-index: 2; min-width: 0; }
.rd-art { position: relative; width: 200px; height: 200px; }
.rd-cover { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; box-shadow: 0 10px 26px rgba(0, 0, 0, .55); }
.rd-cover.noart { display: grid; place-items: center; background: var(--surface-3); font-size: 3rem; }
.rec-disc.big { transform: translateX(22%) rotate(20deg); }
.rd-id h2 { margin: 0 0 6px; font-size: 1.35rem; line-height: 1.2; }
.rd-rating { margin: 8px 0; font-size: 1.05rem; }
.rd-genres, .genre-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.genre-row { margin: 8px 0 12px; }
.gtag { font-size: 0.74rem; padding: 2px 9px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent-vinyl) 55%, transparent);
  color: var(--accent-vinyl); background: color-mix(in srgb, var(--accent-vinyl) 8%, transparent); cursor: pointer; text-decoration: none; }
.gtag:hover { background: var(--accent-vinyl); color: #120d05; }
.rd-sec { border-top: 1px solid var(--edge); padding: 14px 0 6px; }
.rd-sec h3 { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent-vinyl); margin: 0 0 10px; }
.rd-sec h3 .subtle { text-transform: none; letter-spacing: 0; font-family: var(--font-body); margin-left: 6px; }
.rd-line { margin-bottom: 8px; }
.pbadges { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.pbadge { display: inline-flex; gap: 5px; align-items: center; font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border: 1px solid var(--edge); color: var(--text-dim); }
.pbadge.colour { color: var(--text); border-color: var(--edge-strong); }
.meter { display: grid; grid-template-columns: 58px 1fr 40px; gap: 10px; align-items: center; font-size: 0.78rem; margin: 4px 0; }
.m-label { color: var(--text-dim); }
.m-bar { display: flex; gap: 3px; }
.m-bar i { flex: 1; height: 7px; background: var(--surface-3); }
.m-bar i.on { background: var(--ok); }
.m-grade { font-family: var(--font-mono); color: var(--text); }
.rd-note { margin: 12px 0 8px; padding: 10px 14px; border-left: 3px solid var(--accent-vinyl); background: var(--surface); font-style: italic; font-size: 0.88rem; }
.rd-note cite { display: block; margin-top: 6px; font-style: normal; font-size: 0.72rem; color: var(--text-muted); }
.rd-more { margin: 8px 0; font-size: 0.82rem; }
.rd-more summary { cursor: pointer; color: var(--text-dim); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 5px 0; }
.kv > span { color: var(--text-muted); font-size: 0.75rem; }
.rd-links { font-size: 0.8rem; color: var(--text-dim); margin-top: 8px; }
.rd-other { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; margin-bottom: 6px; background: var(--surface);
  border: 1px solid var(--edge); color: var(--text); cursor: pointer; }
.rd-other:hover { border-color: var(--accent-vinyl); }
.rd-other:has(.rd-other-art) { flex-direction: row; align-items: center; gap: 12px; }
.rd-other-art { width: 48px; height: 48px; flex: none; object-fit: cover; }
.rd-other-art.noart { display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted); }
.rd-other-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-set { font-size: 0.85rem; margin-bottom: 6px; color: var(--accent-vinyl); }
.album-set { margin-top: 4px; }
.pc-own { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.pc-own-art { width: 56px; height: 56px; object-fit: cover; flex: none; }
.pc-own-art.noart { display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted); }
.rd-hist { display: flex; flex-wrap: wrap; gap: 22px; margin-bottom: 8px; }
.rd-hist div { display: flex; flex-direction: column; }
.rd-hist b { font-family: var(--font-mono); font-size: 1.2rem; color: var(--accent-scrobble); }
.rd-hist .live b { color: var(--accent-live); }
.rd-hist span { font-size: 0.72rem; color: var(--text-dim); }
.rd-tracks { list-style: none; margin: 0; padding: 0; font-size: 0.86rem; }
.rd-tracks li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--edge); align-items: baseline; }
.rd-tracks li:has(> button:first-child), .rd-tracks li:has(> span:first-child:not(.pos)) { grid-template-columns: minmax(0, 1fr) auto; }
.rd-tracks .pos { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }
.tr-right { display: flex; gap: 10px; align-items: baseline; font-family: var(--font-mono); font-size: 0.74rem; }
.livedot { color: var(--accent-live); font-style: normal; }
.rd-foot { margin-top: 18px; text-align: right; }

/* Album page: pressing cards */
.pressing-card { display: block; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 10px; background: var(--surface); color: var(--text);
  border: 1px solid var(--edge); border-left: 3px solid var(--accent-vinyl); cursor: pointer; }
.pressing-card:hover { border-color: var(--accent-vinyl); }
.pc-note { margin: 6px 0; font-style: italic; }

@media (max-width: 760px) {
  .rd-head { grid-template-columns: 1fr; }
  .rd-art { width: min(260px, 70vw); height: min(260px, 70vw); margin: 0 auto; }
}
@media (max-width: 640px) {
  .coll-head h1 { font-size: 1.6rem; }
  .cs-genres { grid-column: 1 / -1; }
  .coll-tools input[type="search"] { flex-basis: 100%; }
  .coll-title { display: none; } /* it's in the top bar */
  .coll-head { margin-top: 0; }
  .facet { grid-template-columns: 1fr; gap: 4px; }
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; }
  .rec:hover .rec-disc { transform: translateX(18%) rotate(12deg); }
  .drawer { width: 100vw; border-left: none; }
  .drawer-body { padding: 14px 16px 90px; }
  .spine { height: 170px; }
  .shelf-letter { height: 170px; }
  .coll-stats { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
  .cs { flex: 0 0 34%; scroll-snap-align: start; }
  .cs-genres { flex: 0 0 70%; }
}

main#app.wide { max-width: 1380px; }

.rec-press { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-soft); }
.press-kind { display: inline-block; margin-left: 8px; font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: .06em;
  padding: 1px 6px; border: 1px solid var(--edge); vertical-align: middle; }
.press-kind.og { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.press-kind.re { color: var(--accent-soft); }

/* Home: latest record buys -- the collection's tiles with the key facts */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.section-link { font-size: 0.8rem; color: var(--accent-vinyl); text-decoration: none; white-space: nowrap; }
.section-link:hover { text-decoration: underline; }
.home-wall { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 20px; }
.rec-detailed { gap: 4px; }
.rec-press.og { color: var(--ok); }
.rec-keys { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.ktag { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 0.64rem; text-transform: uppercase;
  letter-spacing: .04em; padding: 1px 6px; border: 1px solid var(--edge); color: var(--text-dim); }
.ktag.colour { color: var(--text); border-color: var(--edge-strong); }
.ktag .cdot { width: 9px; height: 9px; }
.rec-label { font-size: 0.74rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-added { font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-mono); }
@media (max-width: 640px) { .home-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; } }
.rd-unlisted { margin-top: 12px; }
.rd-unlisted .subtle { font-size: 0.76rem; margin-bottom: 4px; }
/* Album page tracklist (from a pressing you own) */
.tl-line { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: baseline; }
.tl-line:not([data-song-id]) { cursor: default; opacity: .6; }
.tl-pos { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }
.tl-dur { margin-left: 10px; font-family: var(--font-mono); font-size: 0.72rem; }

@keyframes reload-spin { to { transform: rotate(360deg); } }
