:root {
  --counter-h: clamp(220px, 30vh, 320px);
  --counter-current-h: var(--counter-h);
  --card-size: clamp(240px, 40vw, 430px);
  --card-h: var(--card-size);
  --reveal-h: clamp(46px, 8.5vh, 84px);
  --crate-max: 520px;
  --ink: #2d2418;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overscroll-behavior-y: none;
}

html {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 8%, rgba(255, 255, 255, 0.6), transparent 42%),
    linear-gradient(165deg, #efe5cf 0%, #d6c09a 50%, #b9936a 100%);
}

.shop-back {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + clamp(0.42rem, 1.4vw, 0.9rem));
  left: clamp(0.48rem, 1.6vw, 1.2rem);
  z-index: 1500;
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(84, 55, 30, 0.34);
  background: linear-gradient(180deg, rgba(252, 245, 230, 0.96), rgba(228, 205, 165, 0.94));
  color: #3a2817;
  font-size: 1.4rem;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(61, 38, 18, 0.2);
}

.shop-back:hover {
  filter: brightness(0.98);
}

.shop-back:focus-visible {
  outline: 2px solid #2f719e;
  outline-offset: 2px;
}

.shop {
  min-height: 100vh;
}

.counter {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--counter-h);
  padding: clamp(0.45rem, 1.2vw, 0.85rem);
  background: linear-gradient(180deg, rgba(251, 243, 227, 0.97), rgba(232, 214, 184, 0.95));
  border-bottom: 1px solid rgba(115, 80, 48, 0.24);
  box-shadow: 0 8px 20px rgba(79, 51, 24, 0.18);
  backdrop-filter: blur(6px);
}

.counter-inner {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(160px, 0.95fr) 1.45fr;
  gap: clamp(0.45rem, 1.2vw, 0.9rem);
}

.turntable-wrap,
.info-panel {
  background: linear-gradient(160deg, rgba(248, 236, 211, 0.92), rgba(224, 200, 162, 0.9));
  border: 1px solid rgba(94, 64, 33, 0.26);
  border-radius: 0.78rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.turntable-wrap {
  padding: clamp(0.24rem, 0.75vw, 0.55rem);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.turntable {
  position: relative;
  width: 100%;
  height: 100%;
}

.platter {
  position: absolute;
  left: 8%;
  top: 50%;
  width: min(78%, 220px);
  aspect-ratio: 1;
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, #4b4b4b 0%, #1f1f1f 56%, #101010 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.45);
}

.vinyl {
  position: absolute;
  left: 10%;
  top: 50%;
  width: min(74%, 206px);
  aspect-ratio: 1;
  transform: translateY(-50%);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, rgba(255, 255, 255, 0.06) 0 1px, rgba(0, 0, 0, 0) 2px 5px),
    radial-gradient(circle at 30% 28%, #5a5a5a 0%, #202020 58%, #090909 100%);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transform-origin: center center;
}

body.is-playing .vinyl {
  animation: spin 2.9s linear infinite;
}

.vinyl-label {
  position: absolute;
  inset: 29%;
  border-radius: 50%;
  border: 2px solid rgba(251, 245, 232, 0.82);
  background-color: #d9b27a;
  background-image: radial-gradient(circle, #d8b376 0%, #b27d4a 100%);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(39, 24, 11, 0.2);
}

.vinyl-hole {
  position: absolute;
  inset: 48.7%;
  border-radius: 50%;
  background: #171717;
  box-shadow: 0 0 0 1px rgba(254, 245, 229, 0.6);
}

.info-panel {
  padding: clamp(0.42rem, 0.95vw, 0.72rem) clamp(0.5rem, 1.15vw, 0.82rem);
  display: grid;
  align-content: center;
  gap: 0.26rem;
}

#nowTitle {
  margin: 0;
  font-size: clamp(0.96rem, 1.2vw, 1.35rem);
  line-height: 1.15;
}

.now-meta {
  margin: 0;
  color: #4d3d2a;
  font-size: 0.78rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.27rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.47rem;
  border-radius: 999px;
  background: rgba(129, 89, 50, 0.14);
  border: 1px solid rgba(106, 72, 41, 0.2);
  font-size: 0.67rem;
}

.notes {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.32;
  color: #3f2f1d;
}

.provider-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.34rem;
  margin-top: 0.2rem;
}

.provider-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  border: 1px solid rgba(80, 55, 33, 0.34);
  background: linear-gradient(180deg, #faf5e8 0%, #e6cfaa 100%);
  color: #2f2316;
  border-radius: 0.48rem;
  padding: 0.28rem 0.46rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  transition: filter 120ms ease, opacity 120ms ease;
}

.provider-btn:hover {
  filter: brightness(0.98);
}

.provider-btn:focus-visible {
  outline: 2px solid #325f86;
  outline-offset: 2px;
}

.provider-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.crate {
  position: relative;
  padding: 0 clamp(0.7rem, 4vw, 3.2rem);
}

.crate::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(115, 80, 48, 0.1), rgba(78, 52, 30, 0.18)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 2px, rgba(0, 0, 0, 0.03) 2px 6px);
  pointer-events: none;
}

.stack-stage {
  position: sticky;
  top: calc(var(--counter-current-h, var(--counter-h)) + 0.85rem);
  width: min(92vw, var(--card-size));
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  perspective: 1200px;
  z-index: 2;
}

.record-slot {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.record-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(51, 34, 18, 0.38);
  border-radius: 0.72rem;
  overflow: hidden;
  background: #1f1f1f;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.24);
  pointer-events: auto;
  cursor: pointer;
  transform: translate3d(0, 0, 0);
  transform-origin: 50% 58%;
  transition: transform 220ms ease, box-shadow 180ms ease, filter 180ms ease;
  will-change: transform, filter;
  touch-action: pan-y;
  backface-visibility: hidden;
}

.record-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.record-card:focus-visible {
  outline: 3px solid #2f719e;
  outline-offset: 2px;
}

.record-slot[data-preview="true"] .record-card {
  box-shadow: 0 22px 34px rgba(0, 0, 0, 0.38);
}

.record-slot[data-selected="true"] .record-card {
  outline: 2px solid rgba(251, 242, 224, 0.88);
  outline-offset: -3px;
}

.record-slot[data-preview="true"][data-selected="true"] .record-card {
  outline-color: rgba(255, 244, 220, 0.98);
}

@keyframes spin {
  from {
    transform: translateY(-50%) rotate(0deg);
  }

  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

@media (max-width: 900px) {
  :root {
    --counter-h: clamp(250px, 42vh, 420px);
    --card-size: clamp(220px, 78vw, 380px);
    --reveal-h: clamp(38px, 7vh, 64px);
  }

  .counter-inner {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(120px, 0.9fr) 1.15fr;
    gap: 0.42rem;
  }
}

@media (max-width: 520px) {
  .shop-back {
    width: 2rem;
    height: 2rem;
    font-size: 1.28rem;
  }

  #nowTitle {
    font-size: 0.93rem;
  }

  .notes {
    font-size: 0.72rem;
  }

  .provider-btn {
    font-size: 0.64rem;
    padding: 0.26rem 0.28rem;
  }
}
