:root{
  --ink:#E4DFD3;
  --paper:#15161A;
  --paper-2:#1E2024;
  --gold:#B08A3E;
  --highlight:#902040;
  --muted:#AFA99C;
  --line: rgba(228,223,211,0.12);
  --shadow: rgba(0,0,0,0.6);
  --danger:#C24C3D;
  --font-display:'Fraunces', serif;
  --font-hand:'Permanent Marker', cursive;
  --font-body:'IBM Plex Sans', sans-serif;
  --font-mono:'IBM Plex Mono', monospace;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--paper);
  color:var(--ink);
  font-family:var(--font-body);
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}
@media (prefers-reduced-motion: reduce){
  *{ animation-duration:0.01ms !important; transition-duration:0.01ms !important; }
}

button{ font-family:var(--font-body); cursor:pointer; }
input, select, textarea{ font-family:var(--font-body); }
:focus-visible{ outline:2px solid var(--highlight); outline-offset:2px; }

.wrap{ max-width:1440px; margin:0 auto; padding:28px 20px 80px; }

header.top{
  padding-bottom:20px; border-bottom:1px solid var(--line); margin-bottom:26px;
}
.header-row{
  display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:14px;
}
.header-row-1{ margin-bottom:18px; justify-content:flex-end; }
.header-row-2{ flex-wrap:nowrap; }
@media (max-width:900px){
  .header-row-2{ flex-wrap:wrap; }
}

.account-row{ display:flex; align-items:center; gap:14px; }

.header-icon-btn{
  background:none; border:none; padding:0; margin:0; cursor:pointer;
  color:var(--ink); display:inline-flex; align-items:center; justify-content:center;
  transition:color 0.15s, transform 0.1s; text-decoration:none;
}
.header-icon-btn:hover{ color:var(--highlight); }
.header-icon-btn:active{ transform:scale(0.92); }
.header-icon-btn svg{ width:26px; height:26px; }
.header-icon-btn.plus-icon{ font-size:30px; line-height:1; font-weight:300; }

.page-title-row{ display:flex; flex-direction:column; gap:3px; flex:0 1 auto; min-width:0; }
.brand-title{ margin:0; }
.brand-title a{
  font-family:var(--font-hand); font-weight:400; font-size:clamp(26px,3.6vw,34px);
  letter-spacing:0.01em; color:var(--ink); text-decoration:none;
}
.brand-title a:hover{ color:var(--highlight); }
.page-subtitle-row{ display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
.page-subtitle{
  font-family:var(--font-body); font-weight:600; font-size:15px; color:var(--highlight);
}
.page-subtitle:empty{ display:none; }
.page-count{ font-size:13px; color:var(--muted); white-space:nowrap; }

.header-controls{ display:flex; flex-wrap:nowrap; align-items:center; gap:10px; justify-content:flex-end; }
.header-controls input[type="search"]{
  flex:0 1 180px; min-width:110px; padding:8px 11px; border:1px solid var(--line); border-radius:3px;
  background:var(--paper-2); color:var(--ink); font-size:14px;
}
.header-controls select{
  flex:0 0 auto; padding:8px 11px; border:1px solid var(--line); border-radius:3px;
  background:var(--paper-2); color:var(--ink); font-size:14px;
}
.filter-count{ color:var(--muted); font-size:13px; white-space:nowrap; }

.site-nav{ display:flex; gap:8px; flex-wrap:nowrap; }
.nav-btn{ background:#26282D; text-decoration:none; }
.nav-btn.active{ border-color:var(--highlight); color:var(--highlight); }
.nav-select{ display:none; }

@media (max-width:640px){
  .header-controls{ flex-direction:column; align-items:stretch; width:100%; }
  .header-controls input[type="search"],
  .header-controls select{ flex:1 1 auto; width:100%; }
  .site-nav{ display:none; }
  .nav-select{ display:block; }
}

.artist-list{
  border:1px solid var(--line); border-radius:4px; overflow:hidden; background:var(--paper-2);
  margin-top:4px;
}
.artist-row{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:13px 16px; text-decoration:none; color:var(--ink);
  border-bottom:1px solid var(--line); transition:background 0.12s;
}
.artist-row:last-child{ border-bottom:none; }
.artist-row:hover{ background:var(--paper); color:var(--highlight); }
.artist-row-name{ font-weight:500; font-size:15px; }
.artist-row-count{ color:var(--muted); font-size:13px; white-space:nowrap; }

.btn{
  border:1px solid var(--line); background:transparent; color:var(--ink);
  padding:8px 13px; border-radius:3px; font-size:14.5px; font-weight:500;
  display:inline-flex; align-items:center; gap:8px; transition:background 0.15s, transform 0.1s;
  text-decoration:none;
}
.btn:hover{ background:var(--paper-2); }
.btn:active{ transform:scale(0.98); }
.btn.primary{ background:var(--highlight); border-color:var(--highlight); color:#F6F0E4; }
.btn.primary:hover{ filter:brightness(0.9); }
.btn.danger{ border-color:var(--danger); color:var(--danger); }
.btn.danger:hover{ background:rgba(163,57,46,0.12); }
.btn.ghost{ border-color:transparent; color:var(--muted); }
.btn.ghost:hover{ background:var(--paper-2); color:var(--ink); }
.btn:disabled{ opacity:0.5; cursor:not-allowed; }
.btn svg{ width:16px; height:16px; flex:none; }

.icon-btn{
  width:42px; height:42px; padding:0; border-radius:50%; flex:none;
  display:flex; align-items:center; justify-content:center;
  font-size:22px; line-height:1; font-weight:400;
}
.icon-btn svg{ width:19px; height:19px; }

/* ---------- login page ---------- */
.login-wrap{
  min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px;
}
.login-card{
  width:min(340px, 100%); background:var(--paper-2); border:1px solid var(--line);
  border-radius:6px; padding:30px 26px; text-align:left;
}
.login-card h1{
  font-family:var(--font-hand); font-weight:400; font-size:30px; margin:0 0 6px;
}
.login-card .sub{ color:var(--muted); font-size:14px; margin:0 0 20px; }
.login-error{
  background:rgba(163,57,46,0.12); color:var(--danger); border:1px solid var(--danger);
  border-radius:3px; padding:9px 12px; font-size:13.5px; margin:0 0 16px;
}
.login-submit{ width:100%; justify-content:center; margin-top:4px; }
.cf-turnstile{ margin:14px 0 4px; }

.rack{
  display:flex; flex-direction:column; gap:26px; min-height:160px;
}
.artist-group{
  position:relative;
  background:var(--paper-2); border-radius:6px;
  padding:22px 18px 20px; margin-top:14px;
}
.artist-tab{
  position:absolute; top:-13px; left:20px; z-index:2;
  font-family:var(--font-hand); font-size:16px; line-height:1;
  color:#332B1C; background:rgba(211,194,133,0.94);
  padding:6px 18px 8px; border-radius:2px;
  transform:rotate(-2.6deg);
  box-shadow:0 2px 5px rgba(0,0,0,0.4);
}
.record-grid{
  display:grid; grid-template-columns:repeat(3, 1fr); gap:10px;
}
@media (min-width:640px){
  .record-grid{ grid-template-columns:repeat(4, 1fr); }
}
@media (min-width:860px){
  .record-grid{ grid-template-columns:repeat(6, 1fr); }
}
.record-card{
  aspect-ratio:1/1; border:none; border-radius:4px; overflow:hidden; position:relative;
  background-size:cover; background-position:center; background-repeat:no-repeat;
  display:flex; align-items:flex-end; padding:0; cursor:pointer;
  transition:transform 0.15s ease, box-shadow 0.15s ease;
}
.record-card:hover{ transform:translateY(-4px); box-shadow:0 6px 14px var(--shadow); }
.record-card::after{
  content:''; position:absolute; inset:0; pointer-events:none;
  background:linear-gradient(to top, rgba(4,4,4,0.9), rgba(4,4,4,0) 55%);
}
.record-title{
  position:relative; z-index:1; width:100%; padding:10px;
  font-family:var(--font-body); font-weight:600; font-size:12.5px; line-height:1.3;
  color:#FFFFFF; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  text-align:left; text-shadow:0 1px 3px rgba(0,0,0,0.55);
}

.wishlist-grid{
  display:grid; grid-template-columns:repeat(1, 1fr); gap:14px;
}
@media (min-width:480px){
  .wishlist-grid{ grid-template-columns:repeat(2, 1fr); }
}
@media (min-width:900px){
  .wishlist-grid{ grid-template-columns:repeat(4, 1fr); }
}
.wishlist-card{
  background:var(--paper-2); border-radius:6px; overflow:hidden;
  display:flex; flex-direction:column;
}
.wishlist-card-cover{
  aspect-ratio:1/1; border:none; padding:0; width:100%; position:relative; overflow:hidden;
  background-size:cover; background-position:center; background-repeat:no-repeat;
  display:flex; align-items:flex-end; cursor:pointer;
  transition:transform 0.15s ease;
}
.wishlist-card-cover:hover{ transform:translateY(-2px); }
.wishlist-card-cover::after{
  content:''; position:absolute; inset:0; pointer-events:none;
  background:linear-gradient(to top, rgba(4,4,4,0.9), rgba(4,4,4,0) 55%);
}
.wishlist-card-title{
  position:relative; z-index:1; width:100%; padding:10px;
  font-family:var(--font-body); font-weight:600; font-size:12.5px; line-height:1.3;
  color:#FFFFFF; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  text-align:left; text-shadow:0 1px 3px rgba(0,0,0,0.55);
}
.wishlist-card-links{ display:flex; flex-wrap:wrap; gap:6px; padding:10px; }
.wishlist-card-links a{
  font-size:11.5px; padding:5px 9px; border-radius:3px; background:#26282D; color:var(--ink);
  text-decoration:none; border:1px solid var(--line); white-space:nowrap;
}
.wishlist-card-links a:hover{ color:var(--highlight); border-color:var(--highlight); }

.empty-rack{ width:100%; text-align:center; padding:36px 12px; color:var(--muted); }
.empty-rack svg{ width:56px; height:56px; opacity:0.5; margin-bottom:10px; }
.empty-rack p{ margin:4px 0; font-size:15px; }
.empty-rack .btn{ margin-top:14px; }

.scrim{
  position:fixed; inset:0; background:rgba(20,20,20,0.4); opacity:0; pointer-events:none;
  transition:opacity 0.18s ease; z-index:40;
}
.scrim.open{ opacity:1; pointer-events:auto; }

.panel{
  position:fixed; top:0; right:0; height:100%; width:50vw;
  background:var(--paper); border-left:1px solid var(--line); z-index:41;
  transform:translateX(100%); transition:transform 0.22s ease;
  display:flex; flex-direction:column; box-shadow:-8px 0 24px var(--shadow);
}
.panel.open{ transform:translateX(0); }
.panel-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 20px; border-bottom:1px solid var(--line);
}
.panel-head h2{ font-family:var(--font-hand); font-size:24px; font-weight:400; margin:0; }
.panel-close{ background:none; border:none; color:var(--muted); font-size:22px; line-height:1; padding:4px 8px; }
.panel-body{
  padding:20px; overflow-y:auto; flex:1;
  background-size:cover; background-position:center; background-repeat:no-repeat;
  transition:background-image 0.2s ease;
}
.panel-foot{ padding:16px 20px; border-top:1px solid var(--line); display:flex; gap:10px; justify-content:flex-end; }

.detail-meta-row{ margin-bottom:20px; }
.detail-columns{ display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.detail-col-stack{ display:flex; flex-direction:column; gap:20px; min-width:0; }
.detail-panel-card{
  background:var(--paper-2); border-radius:6px; padding:18px;
  display:flex; flex-direction:column; min-width:0;
}
.detail-notes-row{ margin-top:20px; }
.detail-empty-note{ color:var(--muted); font-size:13.5px; margin:0; }

.field{ margin-bottom:16px; }
.field label{ display:block; font-size:13px; color:var(--muted); margin-bottom:5px; font-weight:500; }
.field input, .field textarea{
  width:100%; padding:9px 11px; border:1px solid var(--line); border-radius:3px;
  background:var(--paper-2); color:var(--ink); font-size:14.5px;
}
.field textarea{ resize:vertical; min-height:64px; }
.field.mono input{ font-family:var(--font-mono); letter-spacing:0.02em; }
.field-row{ display:flex; gap:10px; }
.field-row .field{ flex:1; }

.lookup-row{ display:flex; gap:8px; align-items:flex-end; margin-bottom:16px; }
.lookup-row .field{ flex:1; margin-bottom:0; }
.lookup-status{ font-size:13px; color:var(--muted); margin-top:8px; min-height:18px; }
.lookup-status.hit{ color:var(--gold); }
.lookup-status.err{ color:var(--danger); }
.lookup-matches{ margin-top:8px; }
.lookup-matches select{
  width:100%; padding:8px 10px; border:1px solid var(--line); border-radius:3px;
  background:var(--paper-2); color:var(--ink); font-size:13.5px;
}

.cover-editor{ display:flex; gap:14px; align-items:flex-start; margin-bottom:18px; }
.cover-preview{
  width:96px; height:96px; border-radius:4px; overflow:hidden; flex:none;
  background:var(--paper-2); border:1px solid var(--line);
  display:flex; align-items:center; justify-content:center;
}
.cover-preview img{ width:100%; height:100%; object-fit:cover; display:block; }
.cover-preview.empty span{ color:var(--muted); font-size:12px; text-align:center; padding:0 8px; }
.cover-actions{ display:flex; flex-direction:column; gap:8px; padding-top:4px; }
.cover-upload-btn{ cursor:pointer; text-align:center; }

.detail-cover{
  width:100%; aspect-ratio:1/1; border-radius:4px; margin-bottom:18px;
  background-size:cover; background-position:center; background-repeat:no-repeat;
}

.spotify-embed{ width:100%; border-radius:8px; margin-top:8px; display:block; }
.purchase-links{ display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.purchase-links .btn{ background:#26282D; }
.youtube-embed{ width:100%; border-radius:8px; margin-top:8px; display:block; aspect-ratio:16/9; height:auto; }
.spotify-open-btn{ width:100%; justify-content:center; margin-top:8px; }
.spotify-actions{ display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; }
.spotify-status{ font-size:13px; color:var(--muted); margin-top:8px; min-height:16px; }
.spotify-status.err{ color:var(--danger); }

.detail-meta{ display:flex; flex-wrap:wrap; gap:8px 18px; }
.detail-meta div{ font-size:13.5px; }
.detail-meta span{ display:block; color:var(--muted); font-size:11.5px; margin-bottom:2px; }
.detail-meta a{ color:var(--ink); text-decoration:none; border-bottom:1px solid var(--line); }
.detail-meta a:hover{ color:var(--highlight); border-bottom-color:var(--highlight); }
.detail-meta div.mono{ font-family:var(--font-mono); letter-spacing:0.02em; }
.detail-notes{ font-size:14px; line-height:1.55; color:var(--ink); white-space:pre-wrap; }
.detail-notes strong{ font-weight:600; }
.detail-notes > div + div{ margin-top:4px; }
.detail-tracklist{ margin:0; padding-left:0; list-style:none; font-size:14px; line-height:1.7; color:var(--ink); }
.detail-tracklist li{ padding:2px 0; }

.modal{
  position:fixed; inset:0; background:rgba(10,10,10,0.72); display:none;
  align-items:center; justify-content:center; z-index:50; padding:20px;
}
.modal.open{ display:flex; }
.modal-card{
  background:var(--paper); border-radius:6px; width:min(440px, 100%);
  padding:22px; border:1px solid var(--line);
}
.modal-card h2{ font-family:var(--font-display); font-size:20px; margin:0 0 4px; font-weight:600; }
.modal-card .sub{ color:var(--muted); font-size:13.5px; margin:0 0 14px; }
.scan-video-wrap{
  background:#000; border-radius:4px; overflow:hidden; aspect-ratio:4/3; position:relative;
  margin-bottom:12px;
}
.scan-video-wrap video{ width:100%; height:100%; object-fit:cover; display:block; }
.scan-frame{
  position:absolute; inset:18%; border:2px solid var(--gold); border-radius:6px; opacity:0.85;
  pointer-events:none;
}
.scan-status{ font-size:13.5px; color:var(--muted); min-height:18px; margin-bottom:14px; }
.scan-status.err{ color:var(--danger); }
.modal-foot{ display:flex; justify-content:flex-end; gap:10px; }
.manual-barcode{ display:flex; gap:8px; margin-top:4px; }
.manual-barcode input{ flex:1; padding:9px 11px; border:1px solid var(--line); border-radius:3px; background:var(--paper-2); color:var(--ink); font-family:var(--font-mono); }

.toast{
  position:fixed; bottom:22px; left:50%; transform:translateX(-50%) translateY(12px);
  background:var(--ink); color:var(--paper); padding:11px 18px; border-radius:4px;
  font-size:14px; opacity:0; pointer-events:none; transition:opacity 0.2s, transform 0.2s;
  z-index:60; max-width:90vw; text-align:center;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }

@media (max-width:640px){
  .panel{ width:100%; }
  .detail-columns{ grid-template-columns:1fr; gap:16px; }
}
