:root {
  --room: #10231C;
  --room-2: #183329;
  --room-3: #1F3F33;
  --brass: #C8A15A;
  --brass-hi: #E6C989;
  --ivory: #F1E8D6;
  --sage: #A9B5A6;
  --oxblood: #8E2B2B;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Figtree", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ivory);
  font: 400 16px/1.5 var(--sans);
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(230,201,137,.16), transparent 60%),
    var(--room);
  background-attachment: fixed;
}
button, input, a { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 3px; border-radius: 6px; }

.room {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 18px) 20px calc(var(--safe-b) + 110px);
}

/* Header */
.top { display: flex; align-items: baseline; justify-content: space-between; }
.brand { margin: 0; font: 400 44px/1 var(--serif); letter-spacing: -.01em; color: var(--ivory); }
.count { margin: 0; color: var(--sage); font-size: 14px; }

/* Shelf of sleeves: the memorable thing */
.shelf-wrap { position: relative; margin: 18px -20px 0; }
.shelf {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 14px calc(50% - 115px) 26px;
  overscroll-behavior-x: contain;
}
.shelf::-webkit-scrollbar { display: none; }
.sleeve {
  flex: 0 0 230px;
  scroll-snap-align: center;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  transform: scale(.86);
  opacity: .5;
  transition: transform .25s ease, opacity .25s ease;
}
.sleeve[aria-current="true"] { transform: scale(1); opacity: 1; }
.marker {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 36px;
  height: 3px;
  margin-left: -18px;
  border-radius: 2px;
  background: var(--brass);
}

/* Cover art (shared by shelf, grid, mini) */
.art {
  position: relative;
  display: block;
  aspect-ratio: 1;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  background: var(--room-2);
  box-shadow: 0 14px 30px rgba(0,0,0,.45), 0 0 0 1px rgba(241,232,214,.08);
}
.art img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.art.type {
  display: flex;
  align-items: flex-end;
  padding: 12%;
  background: linear-gradient(160deg, hsl(var(--h) 38% 30%), hsl(var(--h) 45% 16%));
}
.art.type b { font: 400 clamp(20px, 5vw, 30px)/1.05 var(--serif); color: var(--ivory); font-weight: 400; }

/* Vinyl for live radio */
.art.vinyl {
  background: var(--room-2);
  display: grid;
  place-items: center;
}
.art.vinyl::before {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 31%, rgba(255,255,255,.05) 31.5%, transparent 32%),
    repeating-radial-gradient(circle, #141414 0 2px, #1d1d1d 2px 3px),
    #151515;
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.art.vinyl .label {
  position: relative;
  width: 38%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8%;
  background: radial-gradient(circle, #111 0 5%, hsl(var(--h) 55% 46%) 6%, hsl(var(--h) 50% 36%) 100%);
  font: 600 clamp(8px, 2.4vw, 12px)/1.1 var(--sans);
  color: #fff;
}
.art.vinyl .label span { max-width: 100%; overflow: hidden; }

/* Now selected */
.now { margin-top: 6px; text-align: center; }
.now h2 { margin: 0; font: 400 40px/1.05 var(--serif); color: var(--ivory); }
.now .note { margin: 8px auto 0; max-width: 30em; color: var(--sage); font-size: 16px; }
.tags { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.tag { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--room-3); color: var(--brass-hi); }
.actions { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 99px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.btn-brass { background: var(--brass); color: #1A1407; }
.btn-quiet { background: transparent; box-shadow: inset 0 0 0 1px rgba(241,232,214,.28); color: var(--ivory); }
.btn-stop { background: var(--oxblood); color: var(--ivory); }
.btn-play {
  width: 64px;
  height: 64px;
  padding: 0;
  background: radial-gradient(circle at 35% 30%, var(--brass-hi), var(--brass) 60%, #9C7A3A);
  color: #1A1407;
  box-shadow: 0 8px 20px rgba(200,161,90,.28);
}
.btn-play svg { width: 26px; height: 26px; }
.btn-play.wide { width: auto; padding: 0 22px; font-size: 16px; }

.share-row { display: flex; gap: 22px; justify-content: center; margin-top: 14px; }
.link-btn {
  border: 0;
  background: none;
  padding: 10px 2px;
  min-height: 44px;
  color: var(--brass-hi);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(230,201,137,.4);
  text-underline-offset: 4px;
}

/* Embed dialog */
.embed-dlg {
  width: min(560px, calc(100vw - 20px));
  max-height: calc(100dvh - 20px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--room-2);
  color: var(--ivory);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.embed-dlg::backdrop { background: rgba(5,12,9,.7); }
.embed-in { display: grid; gap: 14px; padding: 20px; }
.embed-in h2 { margin: 0; font: 400 28px/1.1 var(--serif); }
.embed-in iframe { width: 100%; max-width: 480px; border: 0; border-radius: 14px; background: var(--room); }
.embed-in label { display: grid; gap: 6px; font-size: 13.5px; color: var(--sage); }
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row input, .copy-row textarea {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(241,232,214,.18);
  background: var(--room);
  color: var(--ivory);
  font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace;
  resize: none;
}
.copy-row .btn { flex: 0 0 auto; border-radius: 10px; }
.embed-help { margin: 0; font-size: 13.5px; color: var(--sage); }
.embed-in .btn-brass { justify-self: end; }

/* Bands */
.bands {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 34px -20px 0;
  padding: 0 20px;
  border-bottom: 1px solid rgba(241,232,214,.1);
}
.bands::-webkit-scrollbar { display: none; }
.band {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--sage);
  font: 400 22px/1 var(--serif);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.band[aria-pressed="true"] { color: var(--ivory); border-bottom-color: var(--brass); }
.band-blurb { margin: 12px 0 0; color: var(--sage); font-size: 14.5px; }

/* Grid of sleeves */
.grid {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px 16px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.tile .art { box-shadow: 0 8px 18px rgba(0,0,0,.35), 0 0 0 1px rgba(241,232,214,.08); }
.tile[aria-current="true"] .art { box-shadow: 0 0 0 2px var(--brass), 0 8px 18px rgba(0,0,0,.35); }
.tile .tn { display: block; margin-top: 9px; font: 400 21px/1.1 var(--serif); color: var(--ivory); }
.tile .tk { display: block; margin-top: 3px; font-size: 13px; color: var(--sage); }
.tile.live .tk { color: var(--brass-hi); }
.empty { grid-column: 1 / -1; padding: 18px 0; color: var(--sage); }

/* Playing bars */
.bars { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 2px; align-items: flex-end; height: 16px; padding: 4px 5px; border-radius: 4px; background: rgba(16,35,28,.8); box-sizing: content-box; }
.bars i { width: 3px; height: 100%; background: var(--brass-hi); border-radius: 1px; transform-origin: bottom; }
.bars i:nth-child(2) { transform: scaleY(.6); }
.bars i:nth-child(3) { transform: scaleY(.8); }
@media (prefers-reduced-motion: no-preference) {
  .bars i { animation: eq 1s ease-in-out infinite; }
  .bars i:nth-child(2) { animation-delay: -.4s; }
  .bars i:nth-child(3) { animation-delay: -.7s; }
  @keyframes eq { 0%,100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
}

/* Add form */
.add { margin-top: 30px; padding: 18px; border-radius: 12px; background: var(--room-2); }
.add h2 { font: 400 28px/1 var(--serif); margin: 0 0 6px; }
.add p { margin: 0 0 14px; color: var(--sage); font-size: 14.5px; }
.add form { display: grid; gap: 12px; }
.add label { display: grid; gap: 5px; font-size: 14px; color: var(--sage); }
.add input {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(241,232,214,.18);
  background: var(--room);
  color: var(--ivory);
  font-size: 16px;
}
.add .btn { justify-self: start; }

.foot { margin-top: 40px; color: var(--sage); font-size: 13.5px; }
.foot p { margin: 8px 0 0; }
.toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; color: var(--ivory); }
.toggle input { width: 20px; height: 20px; accent-color: var(--brass); }

/* Full-height player */
.player {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--room);
  padding-top: var(--safe-t);
}
.player[hidden], .player.parked { display: flex; visibility: hidden; transform: translateY(100%); pointer-events: none; }
.player-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--room); }
.player-bar .btn { min-height: 38px; padding: 0 12px; font-size: 14px; }
.player-name {
  flex: 1;
  min-width: 0;
  margin: 0 4px;
  font: 400 22px/1 var(--serif);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-hint { margin: 0; padding: 5px 14px; font-size: 13px; color: var(--brass-hi); background: var(--room-2); }
.player iframe { flex: 1; width: 100%; border: 0; background: #0c0c0c; }

/* Mini bar */
.mini {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(var(--safe-b) + 10px);
  z-index: 20;
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border-radius: 14px;
  background: rgba(31,63,51,.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 1px rgba(241,232,214,.08);
}
.mini[hidden] { display: none; }
.mini-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.mini-art { flex: 0 0 44px; width: 44px; }
.mini-art .art { border-radius: 4px; box-shadow: none; }
.mini-art .art.vinyl .label { font-size: 0; }
.mini-art .art.type b { font-size: 11px; }
.mini-text { display: grid; min-width: 0; }
.mini-name { font: 400 19px/1.1 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-label { font-size: 12px; color: var(--sage); }
.mini .btn { min-height: 38px; padding: 0 13px; font-size: 14px; }
body.in-player .mini { display: none; }

@media (min-width: 700px) {
  .sleeve { flex-basis: 270px; }
  .shelf { padding-inline: calc(50% - 135px); }
  .now h2 { font-size: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .sleeve { transition: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .shelf { scroll-behavior: smooth; }
  .player, .player.parked { transition: transform .28s ease, visibility .28s; }
}
