/* ============ Record Shelf ============ */
:root {
  --ink: #241d18;
  --paper: #f4efe7;
  --paper-2: #e7dfd2;
  --muted: #7b6d60;
  --accent: #d9572b;
  --accent-ink: #fff7ef;
  --bg: #16120f;
  --frame: #2a211b;          /* cube shelving */
  --frame-hi: #3b2f26;
  --cube: 286px;             /* outer width of one cube */
  --cube-h: 300px;
  --gap: 16px;               /* thickness of the shelving between cubes */
  --row: 156px;              /* CD rack shelf height */
  --plank: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cond: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg) radial-gradient(ellipse 120% 70% at 50% -10%, #3a2a1f 0%, #1d1713 55%, var(--bg) 100%) fixed;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4em;
  border: 1px solid rgba(0,0,0,.15); background: var(--paper);
  padding: .5em .9em; border-radius: 8px; cursor: pointer; text-decoration: none; white-space: nowrap;
  font-size: .92rem; line-height: 1.2; transition: background .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: #bf4620; }
.btn.danger { background: transparent; color: #a3271d; border-color: #e3b9b4; }
.btn.danger:hover { background: #fbecea; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .6; cursor: default; }
.topbar .btn.ghost { color: var(--paper); border-color: rgba(244,239,231,.22); }
.topbar .btn.ghost:hover { background: rgba(244,239,231,.1); }
.topbar .btn.subtle { opacity: .7; }
.icon-btn { border: 0; background: transparent; font-size: 1.1rem; cursor: pointer; padding: .3em .5em; border-radius: 6px; color: var(--muted); }
.icon-btn:hover { background: var(--paper-2); }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between;
  padding: .9rem clamp(1rem, 3vw, 2.5rem); padding-top: max(.9rem, env(safe-area-inset-top));
  background: rgba(22,18,15,.88); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.06); color: var(--paper);
}
.brand { display: flex; align-items: baseline; gap: .8rem; }
.brand h1 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.6rem; }
.count { color: #c4b19a; font-size: .9rem; font-variant-numeric: tabular-nums; }
.tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.tools input[type=search], .tools select {
  background: rgba(244,239,231,.08); color: var(--paper);
  border: 1px solid rgba(244,239,231,.2); border-radius: 8px; padding: .5em .75em; font-size: .92rem;
}
.tools input[type=search] { width: min(250px, 60vw); }
.tools input::placeholder { color: #a39380; }
.tools select option { color: var(--ink); }
.banner { background: #f3d58a; color: #3d2c06; padding: .7rem clamp(1rem, 3vw, 2.5rem); font-size: .92rem; }

main { padding: clamp(1rem, 3vw, 2.5rem); padding-bottom: 7rem; max-width: 1500px; margin: 0 auto; }
.section { margin-bottom: 2.75rem; }
.section > h2, .recent > h2 {
  font-family: var(--serif); font-weight: 600; color: var(--paper); font-size: 1.35rem;
  margin: 0 0 .9rem; display: flex; align-items: baseline; gap: .6rem;
}
.section > h2 span { font-family: var(--sans); font-size: .85rem; font-weight: 400; color: #a39380; }

/* ---------- "just added" display ledge ---------- */
.recent { margin-bottom: 2.25rem; }
.ledge {
  position: relative; display: flex; gap: 18px; align-items: flex-end;
  padding: 0 14px 16px; overflow-x: auto; scrollbar-width: none;
}
.ledge::-webkit-scrollbar { display: none; }
.ledge::after { /* the wooden ledge the covers stand on */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 16px; min-width: 100%;
  background: linear-gradient(#5b4130, #3f2c20 60%, #2a1d14);
  border-radius: 2px; box-shadow: 0 8px 18px rgba(0,0,0,.5);
}
.face {
  position: relative; z-index: 1; flex: none; width: 132px; aspect-ratio: 1;
  border: 0; padding: 0; cursor: pointer; background: #222;
  box-shadow: 0 12px 20px -6px rgba(0,0,0,.7); transform: rotate(-1.2deg) translateY(4px);
  transition: transform .2s;
}
.face:nth-child(even) { transform: rotate(1deg) translateY(4px); }
.face:hover { transform: translateY(-6px) rotate(0); }
.face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.face.face-cd { width: 112px; border-radius: 2px; }
.face.face-cd::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, rgba(255,255,255,.28), transparent 35%); border-left: 6px solid rgba(0,0,0,.55); }
.face .cover-fallback { padding: .5rem; overflow: hidden; gap: .25rem; }
.face .cover-fallback b { font-size: .74rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.face .cover-fallback span { font-size: .56rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- vinyl: cube shelving ---------- */
.cubes {
  display: grid; grid-template-columns: repeat(var(--cols, 4), var(--cube)); gap: var(--gap);
  padding: var(--gap); width: max-content; max-width: 100%;
  background: linear-gradient(180deg, var(--frame-hi), var(--frame));
  border-radius: 4px;
  box-shadow: 0 40px 60px -30px rgba(0,0,0,.85), inset 0 1px 0 rgba(255,255,255,.08);
}
.cube {
  position: relative; height: var(--cube-h); padding: 0 10px;
  display: flex; align-items: flex-end; overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255,214,160,.10), transparent 70%),
    linear-gradient(180deg, #1a1411, #241b15);
  box-shadow: inset 0 14px 18px -8px rgba(0,0,0,.8), inset 10px 0 14px -10px rgba(0,0,0,.7), inset -10px 0 14px -10px rgba(0,0,0,.7);
}
.cube::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0,0,0,.35); }
.cube.empty::before {
  content: ""; position: absolute; inset: 40% 30%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.035) 0 40%, transparent 41%);
}

.lp {
  --c: #333; --t: #f2eadf;
  position: relative; flex: none; align-self: flex-end;
  width: var(--w, 10px); height: var(--h, 93%);
  margin-right: 1px; border: 0; padding: 0; cursor: pointer;
  background:
    linear-gradient(90deg, rgba(0,0,0,.35) 0, rgba(255,255,255,.14) 22%, rgba(255,255,255,.02) 50%, rgba(0,0,0,.3) 100%),
    var(--c);
  color: var(--t);
  border-radius: 1px;
  box-shadow: 1px 0 1px rgba(0,0,0,.5);
  transform-origin: bottom center;
  transition: transform .18s ease, filter .2s, opacity .2s;
  display: flex; align-items: flex-start; justify-content: center; overflow: hidden;
}
.lp span {
  writing-mode: vertical-rl; font-family: var(--cond); font-size: var(--fs, 9px); font-weight: 600;
  letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-height: calc(100% - 14px); margin-top: 8px; line-height: 1;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.lp:hover, .lp:focus-visible { transform: translateY(-16px); outline: none; z-index: 2; filter: brightness(1.08); }
.lp.dim, .jewel.dim { opacity: .15; filter: grayscale(.8); }
.lp.hit, .jewel.hit { box-shadow: 0 0 0 2px #ffd36b, 0 0 14px rgba(255,211,107,.7); }

.genre-tab { /* divider card between genres, like a record store */
  flex: none; align-self: flex-end; height: 100%; width: 0; position: relative; margin: 0 3px;
}
.genre-tab span {
  position: absolute; bottom: 0; left: -2px; width: 5px; height: 99%;
  background: #e9dfcc; border-radius: 2px 2px 0 0; box-shadow: 1px 0 2px rgba(0,0,0,.5);
}
.genre-tab b {
  position: absolute; bottom: calc(99% - 2px); left: -2px;
  background: #e9dfcc; color: #3d2c1f; font: 700 9.5px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 6px 3px; border-radius: 3px 3px 0 0; white-space: nowrap; box-shadow: 0 -1px 2px rgba(0,0,0,.3);
}
.cube.has-tab { padding-top: 22px; }
.tab-gap { flex: none; align-self: flex-end; height: 1px; }

/* ---------- CDs & tapes: rack ---------- */
.rack-frame {
  padding: 14px 14px 0; border-radius: 4px;
  background: linear-gradient(180deg, var(--frame-hi), var(--frame));
  box-shadow: 0 40px 60px -30px rgba(0,0,0,.85), inset 0 1px 0 rgba(255,255,255,.08);
}
.rack {
  position: relative; display: flex; flex-wrap: wrap; align-content: flex-start;
  padding: 0 12px; min-height: calc(var(--row) * 2);
  background:
    repeating-linear-gradient(180deg,
      transparent 0, transparent calc(var(--row) - var(--plank)),
      #4a3a2e calc(var(--row) - var(--plank)), #3b2f26 calc(var(--row) - 5px),
      #1f1813 calc(var(--row) - 5px), #1a140f var(--row)),
    repeating-linear-gradient(180deg, rgba(0,0,0,.6) 0, rgba(0,0,0,0) 20px, transparent var(--row)),
    radial-gradient(ellipse 70% 100% at 50% 0%, rgba(255,214,160,.06), transparent 70%),
    linear-gradient(180deg, #1a1411, #221a14);
  box-shadow: inset 0 0 30px rgba(0,0,0,.6);
}
.rack::after { content: ""; flex: 0 0 100%; height: var(--row); } /* always one empty shelf */
.slot { height: var(--row); padding-bottom: var(--plank); display: flex; align-items: flex-end; margin-right: 1px; }
.jewel {
  --c: #3a3a3a; --t: #fff;
  position: relative; width: var(--w, 13px); height: var(--h, 112px);
  border: 0; padding: 0; cursor: pointer; border-radius: 1.5px;
  /* jewel case: dark hinge spine, coloured insert behind clear plastic */
  background:
    linear-gradient(90deg, rgba(255,255,255,.35) 0, rgba(255,255,255,.05) 14%, transparent 50%, rgba(255,255,255,.12) 86%, rgba(255,255,255,.3) 100%),
    linear-gradient(180deg, #111 0 5px, var(--c) 5px calc(100% - 5px), #111 calc(100% - 5px));
  color: var(--t);
  box-shadow: 1px 0 1px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.08);
  display: flex; align-items: flex-start; justify-content: center; overflow: hidden;
  transform-origin: bottom center; transition: transform .18s, filter .2s, opacity .2s;
}
.jewel.tape { border-radius: 2px; background: linear-gradient(90deg, rgba(255,255,255,.25), transparent 30%, rgba(255,255,255,.15)), linear-gradient(180deg, #e8e4dc 0 4px, var(--c) 4px calc(100% - 4px), #e8e4dc calc(100% - 4px)); }
.jewel span {
  writing-mode: vertical-rl; font-family: var(--cond); font-size: 8.5px; font-weight: 600; letter-spacing: .03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-height: calc(100% - 16px); margin-top: 8px; line-height: 1;
}
.jewel:hover, .jewel:focus-visible { transform: translateY(-12px); outline: none; z-index: 2; filter: brightness(1.1); }
.rack-divider { height: var(--row); padding-bottom: var(--plank); display: flex; align-items: flex-end; margin: 0 4px; }
.rack-divider span {
  writing-mode: vertical-rl; transform: rotate(180deg); background: #e9dfcc; color: #3d2c1f;
  font: 700 9.5px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  padding: 8px 4px; border-radius: 3px 3px 0 0; max-height: 120px; overflow: hidden; white-space: nowrap;
}
.bookend { height: var(--row); padding-bottom: var(--plank); display: flex; align-items: flex-end; margin-left: 4px; }
.bookend i { display: block; width: 12px; height: 70px; background: linear-gradient(90deg, #2c2c2c, #6a6a6a 40%, #3a3a3a); border-radius: 3px 8px 0 0; }

.empty-note { color: #cdbba3; font-family: var(--serif); font-size: 1.05rem; text-align: center; }
.empty-note small { display: block; font-family: var(--sans); font-size: .85rem; color: #a39380; margin-top: .3rem; }
.cube .empty-note { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 1rem; }
.rack .empty-note { position: absolute; left: 0; right: 0; top: 46px; }

/* new arrival */
.arriving { animation: arrive .9s cubic-bezier(.2,.9,.25,1.15) both, glow 2s ease-out .9s both; }
@keyframes arrive {
  0%   { transform: translateY(-120%); opacity: 0; }
  60%  { transform: translateY(5px); opacity: 1; }
  80%  { transform: translateY(-3px); }
  100% { transform: none; }
}
.glow { animation: glow 2s ease-out .3s both; }
@keyframes glow {
  0%   { box-shadow: 0 0 0 2px #ffd36b, 0 0 24px rgba(255,211,107,.95); }
  100% { box-shadow: 1px 0 1px rgba(0,0,0,.5); }
}

/* ---------- list view ---------- */
.list-view { background: var(--paper); border-radius: var(--radius); overflow: auto; }
.list-view table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.list-view th, .list-view td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--paper-2); vertical-align: middle; }
.list-view th { background: var(--paper-2); font-weight: 600; position: sticky; top: 0; }
.list-view tbody tr { cursor: pointer; }
.list-view tbody tr:hover { background: #fff8ec; }
.list-view td.title { font-family: var(--serif); font-weight: 600; }
.list-view .thumb { width: 34px; height: 34px; object-fit: cover; vertical-align: middle; margin-right: .6rem; border-radius: 2px; background: var(--paper-2); }

/* ---------- scan button ---------- */
.scan-fab {
  position: fixed; z-index: 30; right: clamp(1rem, 3vw, 2.5rem); bottom: max(1.25rem, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: .6rem; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 999px; padding: .95rem 1.4rem .95rem 1.1rem; font-size: 1.05rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.2); transition: transform .15s, background .15s;
}
.scan-fab:hover { background: #bf4620; transform: translateY(-2px); }
.scan-fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ---------- dialogs ---------- */
dialog.sheet {
  border: 0; padding: 0; border-radius: 14px; width: min(520px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem);
  background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
dialog.sheet.wide { width: min(900px, calc(100vw - 1.5rem)); }
dialog::backdrop { background: rgba(10,7,5,.72); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .2s ease-out; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem .5rem; }
.sheet-head h2 { margin: 0; font-family: var(--serif); font-size: 1.35rem; }
#scanDialog > *:not(.sheet-head):not(.scan-wrap) { margin-left: 1.25rem; margin-right: 1.25rem; }
.sheet-foot { display: flex; gap: .5rem; align-items: center; padding: 1rem 1.25rem; border-top: 1px solid var(--paper-2); background: var(--paper); }
.spacer { flex: 1; }

/* scanner */
.scan-wrap { position: relative; background: #000; margin: .25rem 0 .75rem; min-height: 240px; }
#reader { width: 100%; }
#reader video { display: block; width: 100% !important; height: auto; }
#reader img[alt="Info icon"], #reader__dashboard { display: none !important; }
.scan-hint { position: absolute; left: 0; right: 0; bottom: 0; padding: .6rem; text-align: center; color: #fff; font-size: .88rem; background: linear-gradient(transparent, rgba(0,0,0,.7)); pointer-events: none; }
.scan-wrap.flash::after { content: ""; position: absolute; inset: 0; background: rgba(120,255,160,.35); animation: flash .5s ease-out forwards; }
@keyframes flash { to { opacity: 0; } }
.cam-error { background: #fbecea; color: #7d1e16; padding: .7rem .9rem; border-radius: 8px; font-size: .9rem; }
.inline-form { display: flex; gap: .5rem; }
.inline-form input { flex: 1; padding: .6em .8em; border: 1px solid #cdbfa8; border-radius: 8px; background: #fff; font-size: 1rem; letter-spacing: .04em; }
.scan-log { list-style: none; padding: 0; margin: .75rem 1.25rem 1.25rem; display: grid; gap: .5rem; max-height: 34vh; overflow: auto; }
.scan-log li { display: flex; gap: .7rem; align-items: center; background: #fff; border: 1px solid var(--paper-2); border-radius: 8px; padding: .5rem .6rem; font-size: .9rem; }
.scan-log li img, .scan-log li .ph { width: 44px; height: 44px; object-fit: cover; border-radius: 2px; flex: none; background: var(--paper-2); }
.scan-log li .info { flex: 1; min-width: 0; }
.scan-log li .info b { display: block; font-family: var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-log li .info span { color: var(--muted); font-size: .82rem; }
.scan-log li.pending { opacity: .7; }
.scan-log li.warn { border-color: #efd28c; background: #fff9e8; }
.scan-log li.bad { border-color: #e9bdb7; background: #fdf1ef; }
.scan-log li .btn { padding: .35em .6em; font-size: .82rem; }

/* find by name */
.find-form { display: grid; grid-template-columns: 1fr 1fr 130px auto; gap: .6rem; align-items: end; padding: .25rem 1.25rem 0; }
.find-form label { display: grid; gap: .25rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.find-form input, .find-form select { padding: .55em .7em; border: 1px solid #d6c8b1; border-radius: 7px; background: #fff; font-size: .95rem; color: var(--ink); font-weight: 400; }
.find-tip { margin: .6rem 1.25rem 0; }
.find-status { padding: .5rem 1.25rem 0; color: var(--muted); font-size: .9rem; }
.find-results { list-style: none; margin: 0; padding: .5rem 1.25rem 1.25rem; display: grid; gap: .45rem; max-height: calc(100vh - 19rem); overflow: auto; }
.find-results li { display: flex; gap: .8rem; align-items: center; padding: .5rem .6rem; background: #fff; border: 1px solid var(--paper-2); border-radius: 8px; }
.find-results li .art-sm { width: 56px; height: 56px; flex: none; position: relative; background: var(--paper-2); border-radius: 2px; overflow: hidden; }
.find-results li .art-sm img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.find-results li .info { flex: 1; min-width: 0; }
.find-results li .info b { display: block; font-family: var(--serif); font-size: 1rem; }
.find-results li .info .who { color: var(--ink); font-size: .9rem; }
.find-results li .info .meta { color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.find-results li .meta .fmt { display: inline-block; background: var(--paper-2); color: var(--ink); border-radius: 4px; padding: 0 .35em; margin-right: .3em; font-weight: 600; }

/* ---------- covers ---------- */
.sleeve { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--paper-2); box-shadow: 0 1px 2px rgba(0,0,0,.2), 0 14px 28px rgba(0,0,0,.3); }
.sleeve img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.cover-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  padding: 1rem; text-align: center; color: var(--t, #f2eadf); background: var(--c, #3b3b3b);
}
.cover-fallback::before { /* a printed "record" motif on the plain sleeve */
  content: ""; position: absolute; width: 62%; aspect-ratio: 1; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--t, #fff) 25%, transparent);
  box-shadow: 0 0 0 14px color-mix(in srgb, var(--t, #fff) 5%, transparent);
}
.cover-fallback b { position: relative; font-family: var(--serif); font-size: 1.15rem; line-height: 1.2; }
.cover-fallback span { position: relative; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }

/* ---------- record info page ---------- */
#recordView .sheet-head { padding-bottom: 0; }
.record-info { display: grid; grid-template-columns: 330px 1fr; gap: 1.75rem; padding: .25rem 1.75rem 1.5rem; overflow: auto; max-height: calc(100vh - 10rem); }
.info-art { position: sticky; top: 0; align-self: start; }
.art { position: relative; width: 260px; margin-right: 70px; }
.art .sleeve { z-index: 2; }
.art .disc {
  position: absolute; z-index: 1; top: 3%; left: 3%; width: 94%; aspect-ratio: 1; border-radius: 50%;
  transition: transform .9s cubic-bezier(.2,.8,.2,1) .15s;
}
.art.vinyl .disc {
  background:
    radial-gradient(circle, #111 0 2.2%, var(--label, #d9572b) 2.4% 17%, #0d0d0d 17.4% 19%, transparent 19.2%),
    repeating-radial-gradient(circle, #121212 0 1px, #1c1c1c 1.5px 2.5px),
    #111;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
}
.art.vinyl .disc::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 30deg, transparent 0 10%, rgba(255,255,255,.10) 14%, transparent 20% 60%, rgba(255,255,255,.07) 64%, transparent 70%); }
.art.cd .disc {
  background:
    radial-gradient(circle, transparent 0 6%, rgba(255,255,255,.85) 6.3% 8%, #c9ccd1 8.2% 15%, transparent 15.3%),
    conic-gradient(from 0deg, #d9dde3, #f4d6f0, #cfe9f7, #e8f6d4, #f9e7c9, #e0d3f5, #d9dde3);
  box-shadow: 0 6px 18px rgba(0,0,0,.3), inset 0 0 0 1px rgba(0,0,0,.08);
}
.art.cd .disc::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, transparent 0 15.5%, rgba(255,255,255,.35) 16% 17%, transparent 17.5% 97%, rgba(0,0,0,.08) 98%); }
.art.cd .sleeve { border-radius: 2px; }
.art.cd .sleeve::after { content: ""; position: absolute; inset: 0; z-index: 2; background: linear-gradient(120deg, rgba(255,255,255,.3), transparent 35%); border-left: 10px solid rgba(0,0,0,.6); pointer-events: none; }
.art.out .disc { transform: translateX(26%) rotate(140deg); }
.art.tape .disc, .art.other .disc { display: none; }
.art.tape, .art.other { margin-right: 0; }

.info-body { min-width: 0; }
.chips { margin: 0 0 .6rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-block; padding: .25em .7em; border-radius: 999px; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.chip.genre { background: var(--accent); color: var(--accent-ink); }
.chip.format { background: #2b231d; color: #f1e7d8; }
.chip:empty { display: none; }
.info-title { margin: 0; font-family: var(--serif); font-size: 1.95rem; line-height: 1.12; }
.info-artist { margin: .4rem 0 0; font-size: 1.15rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .7rem 1rem; margin: 1.2rem 0; padding: .9rem 0; border-top: 1px solid var(--paper-2); border-bottom: 1px solid var(--paper-2); }
.facts div { min-width: 0; }
.facts dt { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: .15rem 0 0; font-size: .95rem; overflow-wrap: anywhere; }
.tracks h3, .info-notes h3 { margin: 0 0 .35rem; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tracks .side { margin-bottom: .9rem; }
.tracks ol { list-style: none; margin: 0; padding: 0; }
.tracks li { display: grid; grid-template-columns: 2.6em 1fr auto; gap: .5rem; padding: .28rem 0; border-bottom: 1px dotted #ddd2c0; font-size: .95rem; }
.tracks li .pos { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; padding-top: .1em; }
.tracks li .len { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.tracks .total { color: var(--muted); font-size: .82rem; margin-top: -.3rem; }
.info-notes { margin-top: 1rem; background: #fff8e6; border-left: 3px solid #d9b25b; padding: .7rem .9rem; border-radius: 0 8px 8px 0; }
.info-notes p { margin: 0; }
.style-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: 1rem 0 .5rem; }
.style-chips span { font-size: .78rem; padding: .2em .6em; border-radius: 999px; background: var(--paper-2); color: #5a4a3a; }

/* editor */
.record-edit { display: grid; grid-template-columns: 200px 1fr; gap: 1.25rem; padding: .5rem 1.25rem 1rem; overflow: auto; max-height: calc(100vh - 11rem); }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; margin-top: .9rem; }
.swatches button { width: 22px; height: 22px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatches button.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper) inset; }
.swatches button.auto { background: conic-gradient(#d9572b, #2f5d7c, #c9a227, #3d5a2a, #d9572b); font-size: 0; }
.swatches + p { margin: .35rem 0 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem .9rem; align-content: start; }
.fields .full { grid-column: 1 / -1; }
.fields label { display: grid; gap: .25rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.fields .hint { font-weight: 400; }
.fields input, .fields textarea, .fields select { font-weight: 400; font-size: .95rem; color: var(--ink); padding: .5em .65em; border: 1px solid #d6c8b1; border-radius: 7px; background: #fff; width: 100%; }
.fields input[name=title] { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; }
.fields textarea { resize: vertical; }
.fields textarea[name=tracklist_text] { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85rem; }
.fields input:focus, .fields textarea:focus, .fields select:focus, .inline-form input:focus, .find-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* toasts */
.toasts { position: fixed; left: 50%; bottom: 6rem; transform: translateX(-50%); z-index: 100; display: grid; gap: .5rem; width: min(440px, calc(100vw - 2rem)); }
.toast { background: #241c16; color: var(--paper); padding: .75rem 1rem; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); display: flex; gap: .75rem; align-items: center; font-size: .92rem; animation: pop .2s ease-out; }
.toast button { margin-left: auto; background: transparent; color: #ffb98a; border: 0; font-weight: 600; cursor: pointer; }

/* ---------- login ---------- */
body.auth { display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: min(380px, 100%); background: var(--paper); border-radius: 14px; padding: 2rem; box-shadow: 0 30px 80px rgba(0,0,0,.6); display: grid; gap: .85rem; }
.auth-card h1 { margin: 0; font-family: var(--serif); font-size: 1.8rem; }
.auth-card p { margin: 0; }
.auth-card label { display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
.auth-card input { padding: .65em .8em; border: 1px solid #d6c8b1; border-radius: 8px; font-size: 1rem; }
.auth-card .btn { justify-content: center; padding: .75em; font-size: 1rem; margin-top: .3rem; }
.auth-error { background: #fbecea; color: #7d1e16; padding: .55rem .75rem; border-radius: 8px; font-size: .9rem; }
.auth-records { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 60px; border-bottom: 6px solid #3b2f26; padding-left: 4px; }
.auth-records i { display: block; width: 7px; height: 56px; border-radius: 1px; }
.auth-records i:nth-child(1) { background: #d9572b; } .auth-records i:nth-child(2) { background: #222; }
.auth-records i:nth-child(3) { background: #2f5d7c; width: 11px; } .auth-records i:nth-child(4) { background: #e9dfcc; }
.auth-records i:nth-child(5) { background: #c9a227; } .auth-records i:nth-child(6) { background: #6b2d4a; }
.auth-records i:nth-child(7) { background: #3d5a2a; }
.auth-records b { position: absolute; left: 92px; bottom: 2px; width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle, #111 0 6%, #d9572b 7% 30%, #111 31% 33%, transparent 34%), repeating-radial-gradient(circle, #151515 0 1px, #222 1.5px 2.5px); }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  :root { --cube: calc((100vw - 2rem - 3 * 10px) / 2); --cube-h: 210px; --gap: 10px; --row: 132px; --plank: 12px; }
  .brand h1 { font-size: 1.3rem; }
  .tools { width: 100%; }
  .tools input[type=search] { flex: 1 1 100%; width: auto; }
  .tools .btn, .tools select { font-size: .82rem; padding: .45em .65em; }
  .cube { padding: 0 6px; }
  .face { width: 104px; } .face.face-cd { width: 90px; }
  .rack-frame { padding: 8px 8px 0; }
  .rack { padding: 0 6px; }
  .record-info { display: block; padding: .25rem 1rem 1rem; max-height: calc(100vh - 9rem); }
  .info-art { position: static; float: left; margin: 0 1rem .75rem 0; }
  .art { width: 118px; margin-right: 26px; }
  .art.tape, .art.other { margin-right: 0; }
  .info-title { font-size: 1.35rem; }
  .info-artist { font-size: 1rem; }
  .facts { clear: both; grid-template-columns: 1fr 1fr; }
  .record-edit { grid-template-columns: 1fr; max-height: calc(100vh - 10rem); }
  .cover-col { display: grid; grid-template-columns: 110px 1fr; gap: .75rem; align-items: start; }
  .cover-col .swatches { margin-top: 0; }
  .cover-col p { grid-column: 2; }
  .fields { grid-template-columns: 1fr; }
  .find-form { grid-template-columns: 1fr 1fr; }
  .find-form .btn { grid-column: 1 / -1; justify-content: center; }
  .scan-fab span { display: none; }
  .scan-fab { padding: 1rem; }
  .list-view th:nth-child(5), .list-view td:nth-child(5),
  .list-view th:nth-child(6), .list-view td:nth-child(6),
  .list-view th:nth-child(7), .list-view td:nth-child(7) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .arriving, .glow, dialog[open], .art .disc { animation: none; transition: none; }
}
