/* Crate: the covers carry the color; everything else stays quiet. */
:root {
  --paper: #E9ECEB;      /* cool sleeve-board grey */
  --surface: #F7F8F7;
  --ink: #17191B;
  --muted: #61676C;
  --line: #CCD2D2;
  --accent: #1F3FD1;     /* cobalt, used for actions and the to-wash tag only */
  --sale: #19703A;       /* green, the for-sale tag */
  --sale-ink: #FFFFFF;   /* text on a filled for-sale tag */
  --accent-ink: #FFFFFF;
  --warn: #9A5B00;
  --blank-l: 80%;
  --blank-s: 14%;
  --shadow: 0 1px 0 rgba(23,25,27,.06), 0 8px 24px -12px rgba(23,25,27,.35);
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16191C; --surface: #1E2226; --ink: #E8ECEC; --muted: #969DA3; --line: #2F353A;
    --accent: #8FA2FF; --accent-ink: #0E1430; --warn: #E2A84B; --sale: #6FD08F; --sale-ink: #0F2A18;
    --blank-l: 26%; --blank-s: 12%;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 28px -12px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.4 var(--font); font-stretch: 100%;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.booting { padding: 40px var(--gutter); color: var(--muted); }

#app { max-width: 820px; margin: 0 auto; padding: 0 var(--gutter) calc(110px + var(--safe-b)); }

/* ---------- header + search ---------- */
.top { display: flex; align-items: flex-end; justify-content: space-between; padding: calc(18px + env(safe-area-inset-top, 0px)) 0 10px; }
.brand h1 { margin: 0; font-size: 36px; font-weight: 800; font-stretch: 72%; letter-spacing: -.01em; line-height: .9; }
.count { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.top-actions { display: flex; gap: 2px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; border-radius: 999px; color: var(--ink); }
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }

.searchbar { position: sticky; top: 0; z-index: 5; margin: 0 calc(-1 * var(--gutter)); padding: 8px var(--gutter) 10px; background: var(--paper); }
.search { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 6px 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.search:focus-within { border-color: var(--ink); }
.search > svg { color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 17px; }
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: var(--muted); }
.clear svg { width: 18px; height: 18px; }

.filters { display: flex; gap: 8px; align-items: center; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.seg { display: inline-flex; gap: 2px; padding: 3px; margin: 0; border: 0; background: color-mix(in srgb, var(--ink) 7%, transparent); border-radius: 999px; flex: none; }
.seg button, .seg label span { display: block; border: 0; background: none; padding: 7px 13px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.seg [aria-checked="true"], .seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) span { outline: 2px solid var(--accent); }
#genre { flex: none; height: 36px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2361676C' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 8px center / 16px; appearance: none; font-size: 14px; font-weight: 500; max-width: 180px; }

/* ---------- results ---------- */
#results section { margin-top: 18px; }
#results h2, .person h3, .block h3 { margin: 0 0 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
#results h2 span, .more summary span { font-weight: 400; margin-left: 4px; font-variant-numeric: tabular-nums; }

.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row:active { opacity: .6; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; font-size: 16px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.005em; }
.row-sub { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-extra { font-size: 14px; margin-top: 2px; color: var(--ink); line-height: 1.35; overflow-wrap: anywhere; }
.row-extra .role.lead { font-weight: 600; }
.on { color: var(--muted); }
.pos { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 2px; }

/* Thumbs: square like a sleeve. Want = empty-sleeve treatment. */
.thumb { position: relative; flex: none; width: 56px; height: 56px; border-radius: 2px; overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.blank { display: grid; place-items: center; width: 100%; height: 100%; background: hsl(var(--h) var(--blank-s) var(--blank-l)); }
.disc { width: 62%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, transparent 0 9%, color-mix(in srgb, var(--ink) 75%, transparent) 10% 33%, color-mix(in srgb, var(--ink) 60%, transparent) 34% 100%); opacity: .28; }
.thumb.is-want { background: transparent; outline: 1.5px dashed color-mix(in srgb, var(--ink) 55%, transparent); outline-offset: -1.5px; }
.thumb.is-want img, .thumb.is-want .blank { opacity: .5; filter: grayscale(.6); }
.thumb-glyph { position: absolute; right: 3px; bottom: 3px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); color: var(--ink); }
.thumb-glyph svg { width: 14px; height: 14px; stroke-width: 1.4; }
.thumb.mini { width: 40px; height: 40px; }
.thumb.mini .thumb-glyph { display: none; }

.tags { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 999px; font-size: 12.5px; font-weight: 500; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag .glyph { width: 13px; height: 13px; stroke-width: 1.4; }
.tag-want { border: 1px dashed color-mix(in srgb, var(--ink) 50%, transparent); color: var(--ink); }
.tag-sale { border-color: var(--sale); color: var(--sale); padding-left: 8px; }

.person-row .stack { display: flex; flex: none; width: 56px; height: 56px; position: relative; }
.person-row .stack .thumb { position: absolute; width: 40px; height: 40px; box-shadow: 0 0 0 2px var(--paper); }
.person-row .stack .thumb:nth-child(1) { left: 0; top: 0; z-index: 3; }
.person-row .stack .thumb:nth-child(2) { left: 8px; top: 8px; z-index: 2; }
.person-row .stack .thumb:nth-child(3) { left: 16px; top: 16px; z-index: 1; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 12px; padding-top: 6px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 24px 16px; } }
.tile { display: flex; flex-direction: column; min-width: 0; position: relative; }
.tile .tile-art { width: 100%; height: auto; aspect-ratio: 1; box-shadow: var(--shadow); }
.tile .tile-art.is-want { box-shadow: none; }
.tile-title { margin-top: 8px; font-size: 14px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .tags { position: absolute; top: 6px; left: 6px; align-items: flex-start; }
.tile .tag-want { display: none; }
.tile .tag-sale { background: var(--sale); color: var(--sale-ink); border-color: var(--sale); }
.tile .tag-wash { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.empty { padding: 56px 8px; text-align: center; color: var(--muted); }
.empty p { max-width: 34ch; margin: 0 auto 18px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font-size: 14.5px; font-weight: 500; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.big { min-height: 52px; font-size: 16px; width: 100%; }
.btn.danger { color: #B3261E; }
@media (prefers-color-scheme: dark) { .btn.danger { color: #FF8A80; } }
.btn:disabled { opacity: .5; cursor: default; }

.fab { position: fixed; z-index: 6; right: max(var(--gutter), calc(50vw - 410px + var(--gutter))); bottom: calc(18px + var(--safe-b)); display: inline-flex; align-items: center; gap: 8px; height: 56px; padding: 0 22px 0 18px; border-radius: 999px; background: var(--ink); color: var(--paper); font-weight: 600; font-size: 16px; box-shadow: var(--shadow); }
.fab:active { transform: scale(.97); }

/* ---------- overlay panels ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; }
.scrim { position: absolute; inset: 0; background: rgba(12,14,16,.38); }
.panel { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y pinch-zoom; background: var(--paper); outline: none; padding: 0 var(--gutter) calc(40px + var(--safe-b)); }
@media (min-width: 720px) {
  .panel { inset: 24px auto 0 50%; width: min(680px, 100vw - 48px); transform: translateX(-50%); border-radius: 18px 18px 0 0; box-shadow: var(--shadow); padding: 0 28px 48px; }
}
.panel.enter { animation: rise .26s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 720px) { .panel.enter { animation-name: rise-wide; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes rise-wide { from { transform: translate(-50%, 24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .panel.enter { animation: none; } }

.panel-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 calc(-1 * var(--gutter)); padding: calc(6px + env(safe-area-inset-top, 0px)) 6px 6px var(--gutter); background: var(--paper); }
.panel-bar .icon-btn:first-child { margin-left: -12px; }
.panel-title { margin: 0; font-size: 24px; font-weight: 800; font-stretch: 72%; letter-spacing: -.005em; }

/* album */
.album-head { display: flex; flex-direction: column; gap: 18px; }
.thumb.large { width: min(100%, 420px); height: auto; aspect-ratio: 1; box-shadow: var(--shadow); border-radius: 3px; }
.thumb.large.is-want { box-shadow: none; outline-width: 2px; }
.thumb.large .thumb-glyph { width: 30px; height: 30px; right: 10px; bottom: 10px; }
.thumb.large .thumb-glyph svg { width: 22px; height: 22px; }
@media (min-width: 560px) {
  /* Cover pinned to the top; a short title sits at the cover's base, a tall one runs down beside it. */
  .album-head { flex-direction: row; align-items: flex-start; }
  .album-head .album-id { align-self: flex-end; min-width: 0; }
  .album-head:has(.album-title.is-long, .album-title.is-xlong, .album-sub) .album-id { align-self: flex-start; }
  .thumb.large { width: 260px; }
}
.album-title { margin: 0; font-size: clamp(36px, 9.4vw, 56px); line-height: .96; font-weight: 800; font-stretch: 72%; letter-spacing: -.01em; text-wrap: balance; }
.album-artist { margin: 8px 0 0; font-size: 19px; font-weight: 500; }
.album-artist a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.album-meta { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.chip { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 3px 11px; font-size: 13.5px; }

.status-block, .switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 22px 0 6px; padding: 14px 16px; border-radius: 14px; background: var(--surface); }
.status-block.want { border: 1.5px dashed color-mix(in srgb, var(--ink) 40%, transparent); background: none; }
.status-block .btn { flex: none; white-space: nowrap; }
.status-block p { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.status-block p .glyph { width: 18px; height: 18px; stroke-width: 1.3; }
.switch-row { cursor: pointer; }
.switch-row > span { display: flex; flex-direction: column; }
.hint { color: var(--muted); font-size: 13.5px; font-weight: 400; }
input[role="switch"] { appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; }
input[role="switch"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
input[role="switch"]:checked { background: var(--accent); }
input[role="switch"]:checked::after { transform: translateX(20px); }

.block { margin-top: 26px; }
.tracks { list-style: none; margin: 0; padding: 0; }
.tracks li { display: grid; grid-template-columns: 2.6em minmax(0, 1fr) auto; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15.5px; }
.tracks .tt, .tracks .pos { min-width: 0; overflow-wrap: anywhere; }
.tracks .dur { color: var(--muted); font-variant-numeric: tabular-nums; }
.credits { list-style: none; margin: 0; padding: 0; }
/* Phones: name on top, roles beneath. Wider screens: two columns. Nothing may push past the edge. */
.credits a { display: flex; flex-direction: column; gap: 1px; padding: 9px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.credits .who { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.credits .what { color: var(--muted); min-width: 0; overflow-wrap: break-word; word-break: normal; line-height: 1.35; }
/* A role stays on one line when it fits, and wraps inside itself when it doesn't. */
.credits .r { display: inline-block; max-width: 100%; vertical-align: top; overflow-wrap: break-word; }
@media (min-width: 560px) {
  .credits a { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: baseline; column-gap: 16px; padding: 8px 0; }
  .credits .what { text-align: right; }
}
.credits a:hover .who { text-decoration: underline; text-underline-offset: 3px; }
.more summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.more[open] summary { margin-bottom: 6px; }

.note { margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface); font-size: 14.5px; color: var(--muted); }
.note.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }

textarea, .edit input, .add input, .fix-form input, .login input {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; resize: vertical;
}
textarea:focus, .edit input:focus, .add input:focus, .fix-form input:focus, .login input:focus { border-color: var(--ink); }
.edit, .add, .login form { display: flex; flex-direction: column; gap: 14px; }
.edit { margin-top: 26px; }
.edit label, .add label, .login label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.edit label .hint, .add label .hint { display: inline; margin-left: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 8px; }
.footer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }

.fix-form { display: flex; gap: 8px; }
.fix-form input { flex: 1; min-width: 0; }
.cands { list-style: none; margin: 10px 0 0; padding: 0; }
.cands button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line); background: none; }
.cands .use { color: var(--accent); font-size: 14px; font-weight: 600; flex: none; }

/* person */
.person-name { margin: 6px 0 0; font-size: clamp(42px, 11.5vw, 66px); line-height: .92; font-weight: 800; font-stretch: 72%; letter-spacing: -.01em; text-wrap: balance; }
.person-sum { margin: 10px 0 0; color: var(--muted); font-size: 15.5px; }
.person section { margin-top: 24px; }

/* add */
.add { padding-top: 8px; }
.add .seg { align-self: flex-start; }

/* tools */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 16px; }
.stats div { padding: 12px; background: var(--surface); border-radius: 12px; }
.stats dt { font-size: 12.5px; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
@media (max-width: 420px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .3s; }

/* login */
.login { max-width: 380px; margin: 0 auto; padding-top: 18vh; }
.login h1 { font-size: 56px; font-weight: 800; font-stretch: 72%; letter-spacing: -.01em; line-height: .9; margin: 0 0 28px; }

/* toast */
#toast { position: fixed; z-index: 40; left: 50%; bottom: calc(88px + var(--safe-b)); transform: translate(-50%, 12px); max-width: calc(100vw - 32px); padding: 11px 18px; border-radius: 18px; background: var(--ink); color: var(--paper); font-size: 14.5px; font-weight: 500; text-align: center; width: max-content; max-width: min(360px, calc(100vw - 32px)); text-wrap: balance; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.overlay:not([hidden]) ~ #toast { bottom: calc(24px + var(--safe-b)); }

/* cover changing */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cover-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cover-pick { padding: 16px; margin-top: 18px; border-radius: 14px; background: var(--surface); }
.cover-pick .note { margin-top: 0; margin-bottom: 12px; background: var(--paper); }
.cover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 10px; margin-bottom: 16px; }
.cover-opt { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 0; border: 0; background: none; text-align: left; min-width: 0; }
.cover-img { display: block; aspect-ratio: 1; border-radius: 2px; overflow: hidden; background: var(--line); }
.cover-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-opt:hover .cover-img, .cover-opt:focus-visible .cover-img { outline: 2px solid var(--accent); outline-offset: 2px; }
.cover-src { margin-top: 6px; font-size: 13px; font-weight: 600; }
.cover-detail { font-size: 12.5px; color: var(--muted); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cover-own { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.cover-own .fix-form { width: 100%; }
.cover-pick .actions { margin-top: 14px; }
.cover-pick label.btn { cursor: pointer; }
.cover-pick label.btn:has(+ input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.note.looking { color: var(--ink); }

/* add a record */
.add-more summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.add-more[open] { display: flex; flex-direction: column; gap: 14px; }
.add > .hint { margin: -4px 0 0; text-align: center; }

.vinyl-fix { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.vinyl-fix .hint { margin: 0 0 10px; }

/* classical: a piece above its movements */
.tracks li.work { grid-template-columns: 1fr auto; padding: 16px 0 6px; border-bottom: 0; font-weight: 600; line-height: 1.3; }
.tracks li.work:first-child { padding-top: 4px; }
.tracks li.mvt .tt { padding-left: 2px; }
.tracks li.mvt + li:not(.mvt) { margin-top: 0; }

/* long album titles */
.album-title.is-long { font-size: clamp(30px, 7.6vw, 44px); line-height: 1; }
.album-title.is-xlong { font-size: clamp(26px, 6.4vw, 36px); line-height: 1.02; }
.album-sub { display: block; margin-top: 10px; font-size: 17px; line-height: 1.3; font-weight: 600; font-stretch: 100%; letter-spacing: 0; text-wrap: pretty; }
@media (min-width: 560px) { .album-sub { font-size: 18px; } }
.tracks .by { display: block; font-weight: 400; font-size: 14px; color: var(--muted); margin-top: 1px; }

/* ---------- crates ---------- */
#crate { flex: none; height: 36px; padding: 0 30px 0 12px; border: 1px solid var(--ink); border-radius: 999px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2361676C' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 8px center / 16px; appearance: none; font-size: 14px; font-weight: 600; max-width: 200px; }
#crate[hidden] { display: none; }
.icon-btn.on { background: var(--ink); color: var(--paper); }

/* selecting records */
.row .pick, .tile .pick { display: none; }
.selecting .row .pick { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); color: transparent; }
.selecting .row.is-selected .pick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.selecting .tile .pick { display: grid; place-items: center; position: absolute; top: 6px; right: 6px; z-index: 2; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid #fff; background: rgba(0,0,0,.25); color: transparent; }
.selecting .tile.is-selected .pick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.selecting .tile.is-selected .tile-art { outline: 3px solid var(--accent); outline-offset: 2px; }
.pick svg { width: 16px; height: 16px; stroke-width: 2.4; }
.selecting .row:active { opacity: 1; }
.selecting .person-row { opacity: .45; pointer-events: none; }

.selbar { position: fixed; z-index: 8; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); width: min(788px, calc(100vw - 24px)); padding: 12px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.selbar[hidden] { display: none; }
.selrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.selcount { flex: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.selpanel { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.selpanel .hint { margin: 0; }
.selbar .btn:disabled { opacity: .45; }
.selecting ~ .selbar ~ #toast, #selbar:not([hidden]) ~ #toast { bottom: calc(150px + var(--safe-b)); }

/* crates on a record */
.crates-block .chips { margin-top: 0; }
.crate-chip { display: inline-flex; align-items: center; border: 1px solid var(--ink); border-radius: 999px; }
.crate-chip .chip { border: 0; padding-right: 4px; font-weight: 600; }
.chip-x { display: grid; place-items: center; width: 26px; height: 26px; margin-right: 2px; border: 0; background: none; border-radius: 50%; color: var(--muted); }
.chip-x svg { width: 14px; height: 14px; }
.chip-x:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.add-chip { display: inline-flex; align-items: center; gap: 4px; border-style: dashed; color: var(--muted); }
.add-chip svg { width: 15px; height: 15px; }
.crate-add { margin-top: 12px; }
.chips.quick { margin-top: 10px; }

/* managing crates */
.crate-list { list-style: none; margin: 0; padding: 0; }
.crate-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.crate-name { flex: 1; text-align: left; border: 0; background: none; padding: 6px 0; font-weight: 600; font-size: 15.5px; }
.crate-name span { color: var(--muted); font-weight: 400; margin-left: 6px; font-variant-numeric: tabular-nums; }
.crate-list .btn { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.fab[hidden] { display: none; }
#results.selecting { padding-bottom: 90px; }
.selrow .btn { min-height: 38px; padding: 0 14px; }
.selrow .btn.primary, .selrow #sel-remove { flex: 1 1 0; }

/* ---------- pick for me ---------- */
.fab-pick { right: max(calc(var(--gutter) + 140px), calc(50vw - 410px + var(--gutter) + 140px)); width: 56px; padding: 0; justify-content: center; background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.fab-pick svg { width: 24px; height: 24px; }
.picker { display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.pick-from { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 420px; }
.pick-from label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.pick-from select { height: 42px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2361676C' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 8px center / 16px; appearance: none; font-size: 15px; font-weight: 500; color: var(--ink); min-width: 0; }
.pick-card { display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; max-width: 420px; margin-top: 22px; }
.pick-card .thumb.large { width: min(100%, 340px); }
.pick-title { margin-top: 18px; font-size: clamp(28px, 7.5vw, 40px); line-height: 1; font-weight: 800; font-stretch: 72%; letter-spacing: -.01em; text-wrap: balance; }
.pick-artist { margin-top: 8px; font-size: 17px; font-weight: 500; color: var(--muted); text-wrap: balance; }
.pick-pool { margin: 10px 0 0; }
.pick-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 420px; margin-top: 20px; }
.pick-actions .btn.primary svg { width: 20px; height: 20px; }

/* long unbroken text anywhere on a record page wraps instead of widening the page */
.album, .person, .picker, .tools { min-width: 0; overflow-wrap: anywhere; }
.album-meta, .album-artist, .person-sum, .note, .cover-detail, .cands .row-title, .cands .row-sub { overflow-wrap: anywhere; }
.album-head .album-id, .album-title { min-width: 0; }

/* ---------- want-list prices ---------- */
.tag-price { border-color: var(--ink); color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; padding: 2px 8px; }
.tile .tag-price { background: var(--surface); }
.price-line { display: flex; flex-direction: column; gap: 2px; margin: 0 0 12px; }
.price-line strong { font-size: 26px; font-weight: 800; font-stretch: 72%; letter-spacing: -.01em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.price-links { display: flex; flex-wrap: wrap; gap: 8px; }
.price-note { margin: 10px 0 0; }
.linkish { border: 0; background: none; padding: 0; margin-left: 4px; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- view only (guests) ---------- */
.view-only [aria-disabled="true"] { opacity: .38; filter: grayscale(1); cursor: not-allowed; }
.view-only .switch-row[aria-disabled="true"] input { pointer-events: none; }
.view-only #notes[aria-disabled="true"] { opacity: .75; filter: none; cursor: default; }
.login-switch { display: block; margin: 18px auto 0; font-size: 15px; }

/* ---------- importing ---------- */
.importer { display: flex; flex-direction: column; gap: 14px; padding-top: 6px; }
.importer > .btn:not(.big) { align-self: flex-start; }
.importer .note { margin: 0; }
.importer .note p { margin: 0 0 8px; }
.importer .note p:last-child { margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.map { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.map label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; min-width: 0; }
.map label .hint { font-weight: 400; }
.map select { height: 40px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2361676C' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 6px center / 16px; appearance: none; font-size: 14.5px; color: var(--ink); min-width: 0; width: 100%; }
.import-preview { padding: 4px 12px; border-radius: 14px; background: var(--surface); pointer-events: none; }
.importer label.btn { cursor: pointer; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.icon-btn[hidden] { display: none; }

/* Collection page: titled sections, each on its own card */
.tools { display: flex; flex-direction: column; gap: 30px; padding-bottom: 40px; }
.tools > .note { margin: 0; }
.tools-sub { margin: -2px 0 -12px; color: var(--muted); font-size: 14px; }
.sec { display: flex; flex-direction: column; gap: 10px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px; }
.sec-head h3 { margin: 0; font-size: 25px; line-height: 1.1; font-weight: 800; font-stretch: 72%; letter-spacing: -.005em; color: var(--ink); }
.sec-head span { font-size: 13px; color: var(--muted); text-align: right; }
.card { background: var(--surface); border-radius: 16px; overflow: hidden; }
.card > * + * { border-top: 1px solid var(--line); }
.stat-strip { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-strip div { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-strip div + div { border-left: 1px solid var(--line); }
.stat-strip dt { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-strip dd { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-strip .warn dt, .stat-strip .warn dd { color: var(--warn); }
.card-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 44px; }
.card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card-text p { margin: 0; font-size: 14.5px; }
.card-text .hint, .card-row > .hint { margin: 0; font-size: 13px; }
.card-row > .btn { flex: none; width: 112px; padding: 0 10px; background: var(--paper); }
.card-row > .btn.primary { background: var(--accent); }
.progress-row .progress { margin: 4px 0 6px; background: var(--paper); }
.card-foot { margin: 0; padding: 12px 16px; font-size: 13px; }
.card-list .rows { padding: 0 12px; }
.card .crate-list li { padding: 4px 6px 4px 16px; gap: 2px; border-bottom: 0; }
.card .crate-list li + li { border-top: 1px solid var(--line); }
.card .crate-list .icon-btn { color: var(--muted); }
.card .crate-list .icon-btn svg { width: 19px; height: 19px; }
.card .crate-list .icon-btn.danger { color: #B3261E; }
@media (prefers-color-scheme: dark) { .card .crate-list .icon-btn.danger { color: #FF8A80; } }
.import-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.import-tile { display: flex; flex-direction: column; gap: 10px; padding: 16px; min-height: 112px; border-radius: 16px; background: var(--surface); border: 1px solid transparent; }
.import-tile:hover { border-color: var(--line); }
.import-tile svg { width: 26px; height: 26px; color: var(--accent); }
.import-tile > span, .list-row > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.import-tile strong, .list-row strong { font-size: 15px; font-weight: 600; }
.import-tile span span, .list-row span span { font-size: 13px; color: var(--muted); }
.list-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; min-height: 52px; border: 0; background: none; text-align: left; color: var(--ink); }
.list-row strong { font-weight: 500; }
.list-row svg { width: 20px; height: 20px; color: var(--muted); }
.list-row:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.keep-note { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.keep-note p { margin: 0; }

.card-list .row-extra { color: var(--warn); font-size: 13px; font-weight: 600; }
.overlay-tools .panel-title { font-size: 36px; line-height: 1; letter-spacing: -.01em; }
.cands .cand-line, .cands .cand-format { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.35; }
.cands .cand-format { color: var(--ink); }
.cands .row-text { gap: 1px; }
.cands .row-title { white-space: normal; }

.price-block .note.warn { margin: 0 0 12px; }
/* Fix match rows: cover, title and "Use this" share the top line; the details run underneath */
.cands button { align-items: flex-start; padding: 12px 0; }
.cands .thumb.mini { width: 56px; height: 56px; margin-top: 2px; }
.cands .use { padding-top: 2px; }
/* List rows: the cover sits at the top of the row, so long rows (song matches, personnel) read from the
   top like the Fix match list. Short rows still look centred, because the row is then as tall as the
   cover and the text centres beside it. Tags and the select mark stay level with the cover. */
.row > .thumb, .row > .stack { align-self: flex-start; }
.row > .tags { align-self: flex-start; min-height: 56px; justify-content: center; }
.selecting .row > .pick { align-self: flex-start; margin-top: 15px; }

/* Wash queue */
.tag-wash { color: var(--accent); border-color: var(--accent); }
.tag-wash svg { width: 12px; height: 12px; margin-right: 3px; fill: currentColor; stroke: none; }
.selrow .btn svg { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; fill: currentColor; stroke: none; }
.wash-hint { margin: 4px 0 14px; font-size: 14px; color: var(--muted); }
.wash-hint svg { width: 16px; height: 16px; vertical-align: -3px; }
.switch-card { background: var(--surface); border-radius: 16px; overflow: hidden; margin-top: 18px; }
.switch-card .switch-row { background: none; border-radius: 0; margin: 0; }
.switch-card .switch-row + .switch-row { border-top: 1px solid var(--line); }

/* The app's own confirmation: a card at the bottom of the screen */
.confirm-sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(16px + var(--safe-b)); background: rgb(0 0 0 / .35); animation: fade .15s ease-out; }
.confirm-card { width: min(440px, 100%); background: var(--surface); color: var(--ink); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.confirm-card p { margin: 0 0 18px; font-size: 16px; line-height: 1.4; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-actions .btn { width: 100%; justify-content: center; }
.btn.danger-fill { background: #B3261E; border-color: #B3261E; color: #FFFFFF; }
@media (prefers-color-scheme: dark) { .btn.danger-fill { background: #FF8A80; border-color: #FF8A80; color: #2A0B08; } }
@keyframes fade { from { opacity: 0; } }
.confirm-input { width: 100%; box-sizing: border-box; margin: -6px 0 18px; font: inherit; font-size: 16px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }

