:root {
  --bg: #121110;
  --panel: #1d1b19;
  --panel-2: #26231f;
  --text: #f1ebe2;
  --muted: #a39a8e;
  --accent: #e8a33d;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.muted { color: var(--muted); }

header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(18, 17, 16, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #2c2925;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: 0.02em; }
.brand p { margin: 0; font-size: 0.85rem; }

.logo {
  width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0 18%, #111 19% 22%, #222 23% 100%);
  box-shadow: inset 0 0 0 2px #333;
}

.controls { display: flex; flex-wrap: wrap; gap: 8px; }

input, select, button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid #3a3530;
  border-radius: 8px;
  padding: 8px 12px;
}
input[type=search] { min-width: 240px; }
button { cursor: pointer; }
button:hover, select:hover { border-color: var(--accent); }

.chips {
  display: flex;
  gap: 6px;
  padding: 12px 28px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.chip {
  flex: 0 0 auto;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
}
.chip.active { background: var(--accent); color: #1a1a1a; border-color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 22px;
  padding: 22px 28px 60px;
}

.card {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.card .t, .card .a {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.card .sleeve {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover .sleeve, .card:focus-visible .sleeve {
  transform: translateY(-4px) rotate(-1deg);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
}
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .badge {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}
.card .t { margin: 10px 0 2px; font-weight: 600; font-size: 0.95rem; line-height: 1.25; }
.card .a { margin: 0; color: var(--muted); font-size: 0.85rem; }

.empty { text-align: center; color: var(--muted); padding: 60px; }

/* Detail dialog */
dialog {
  width: min(960px, 94vw);
  max-height: 92vh;
  padding: 0;
  color: var(--text);
  background: var(--panel);
  border: 1px solid #3a3530;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }

.close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  border-radius: 50%;
  width: 36px; height: 36px;
  padding: 0;
}

.detail-body { display: grid; grid-template-columns: 380px 1fr; gap: 32px; padding: 32px; }

.cover-wrap { position: relative; align-self: start; }
.cover-wrap img {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}
.vinyl {
  position: absolute;
  top: 3%; left: 3%;
  width: 94%; aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--accent) 0 15%, #0c0c0c 16% 17%, transparent 18%),
    repeating-radial-gradient(circle, #111 0 2px, #1c1c1c 3px 4px);
  transition: transform 0.6s ease;
}
dialog.playing .vinyl { transform: translateX(32%); animation: spin 2s linear infinite; }
@keyframes spin { from { rotate: 0deg; } to { rotate: 360deg; } }

.info .artist { margin: 0; color: var(--accent); font-weight: 600; }
.info h2 { margin: 4px 0 6px; font-size: 1.8rem; line-height: 1.15; }
.rating { font-size: 1.05rem; }
.rating .stars { color: var(--accent); letter-spacing: 2px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tags span {
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid #3a3530;
}

.links { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 20px; }
.links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid #3a3530;
}
.links a:hover { border-color: var(--accent); }
.links a.spotify { background: #1db954; color: #000; border-color: #1db954; font-weight: 600; }

.preview h3 { margin: 0 0 8px; font-size: 1rem; }
.preview .note { font-size: 0.8rem; margin: 0 0 8px; }
.tracks { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.tracks li { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.tracks button {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: 50%;
  flex: 0 0 auto;
}
.tracks li.on button { background: var(--accent); color: #111; border-color: var(--accent); }
.tracks .n { color: var(--muted); width: 1.5em; text-align: right; font-size: 0.85rem; }
.tracks .name { flex: 1; font-size: 0.9rem; }

.detail-nav { display: flex; justify-content: space-between; padding: 0 32px 24px; }

@media (max-width: 760px) {
  header { padding: 12px 16px; }
  .chips { padding: 10px 16px 0; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; padding: 16px; }
  input[type=search] { min-width: 0; flex: 1 1 100%; }
  .detail-body { grid-template-columns: 1fr; padding: 20px; gap: 20px; }
  .cover-wrap { max-width: 300px; }
  .detail-nav { padding: 0 20px 20px; }
}
