/* ==========================================================================
   Vinyl Picker — Full-screen Frosted Editorial 3D Diagonal Disc Carousel
   ========================================================================== */

#vinyl-picker {
  position: fixed;
  inset: 0;
  width: 100dvw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: transparent;
  color: #fff6e9;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  opacity: 0;
  transition: opacity 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

#vinyl-picker:focus {
  outline: none;
}

#vinyl-picker[open] {
  opacity: 1;
}

#vinyl-picker.is-closing {
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

@starting-style {
  #vinyl-picker[open] {
    opacity: 0;
  }
}

#vinyl-picker::backdrop {
  background: radial-gradient(
    ellipse 82% 76% at 50% 48%,
    rgba(28, 20, 15, 0.14) 0%,
    rgba(16, 11, 8, 0.42) 100%
  );
  backdrop-filter: blur(4.5px) saturate(1.06);
  -webkit-backdrop-filter: blur(4.5px) saturate(1.06);
  opacity: 0;
  transition: opacity 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

#vinyl-picker[open]::backdrop {
  opacity: 1;
}

#vinyl-picker.is-closing::backdrop {
  opacity: 0;
  transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

@starting-style {
  #vinyl-picker[open]::backdrop {
    opacity: 0;
  }
}

body:has(#vinyl-picker[open]) #room-toast {
  visibility: hidden;
}

/* Fullscreen shell */
.vinyl-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr;
  transform: translateY(0) scale(1);
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

@starting-style {
  #vinyl-picker[open] .vinyl-shell {
    transform: translateY(18px) scale(0.975);
  }
}

#vinyl-picker.is-closing .vinyl-shell {
  transform: translateY(14px) scale(0.965);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

#vinyl-picker.is-equipping .vinyl-stage {
  transform: translateY(34px) scale(0.91);
  transition: transform 340ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Soft warm ambient glow behind the center disc */
.vinyl-ambient-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(320px, 50vw, 620px);
  aspect-ratio: 1;
  transform: translate(-50%, -52%);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 228, 190, 0.14) 0%,
    rgba(255, 206, 160, 0.05) 45%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

/* Editorial Top-Left Metadata Block */
#vinyl-picker .vinyl-editorial {
  position: absolute;
  top: clamp(20px, 3.4dvh, 40px);
  left: clamp(22px, 3.8vw, 52px);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(300px, 56vw);
  pointer-events: none;
  text-shadow: 0 2px 14px rgba(16, 10, 7, 0.45);
}

.vinyl-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 236, 210, 0.78);
  margin-bottom: 6px;
}

.vinyl-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffd38e;
  box-shadow: 0 0 8px rgba(255, 211, 142, 0.85);
  display: none;
}

.vinyl-editorial[data-mounted="true"] .vinyl-live-dot {
  display: inline-block;
}

.vinyl-title {
  margin: 0;
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", SimSun, Georgia, serif;
  font-weight: 600;
  font-size: clamp(24px, 3.6vw, 40px);
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: #fff9f0;
  transition: opacity 220ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.vinyl-title.is-changing {
  opacity: 0.35;
  transform: translateY(4px);
}

.vinyl-rule {
  height: 1px;
  margin: 12px 0 10px;
  background: linear-gradient(90deg, rgba(255, 239, 215, 0.42), rgba(255, 239, 215, 0.05));
}

.vinyl-meta-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 16px;
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.vinyl-meta-grid dt {
  color: rgba(255, 233, 204, 0.62);
  letter-spacing: 0.08em;
  font-size: 11px;
}

.vinyl-meta-grid dd {
  margin: 0;
  color: rgba(255, 247, 236, 0.92);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Top-Right Controls */
.vinyl-top-actions {
  position: absolute;
  top: clamp(18px, 3.2dvh, 38px);
  right: clamp(18px, 3.4vw, 44px);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vinyl-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 238, 212, 0.28);
  border-radius: 999px;
  background: rgba(28, 19, 14, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff6e8;
  font-family: inherit;
  font-weight: 500;
  font-size: 12.5px;
  line-height: 1;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.vinyl-pill-btn:hover {
  background: rgba(54, 37, 27, 0.62);
  border-color: rgba(255, 238, 212, 0.52);
}

.vinyl-pill-btn:active {
  transform: scale(0.96);
}

.vinyl-pill-btn[aria-pressed="true"] {
  background: rgba(255, 224, 178, 0.22);
  border-color: rgba(255, 224, 178, 0.62);
}

.vinyl-close {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

/* 3D Diagonal Carousel Stage */
.vinyl-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  z-index: 10;
  transform: translateY(0) scale(1);
  transition: transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
  --disc-size: clamp(205px, min(40vw, 49dvh), 410px);
}

.vinyl-stage.is-dragging {
  cursor: grabbing;
}

/* Hand-drawn organic SVG sketch ring around the centered active disc */
.vinyl-sketch-wrap {
  position: absolute;
  top: 49%;
  left: 50%;
  width: calc(var(--disc-size) * 1.15);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) perspective(1200px) rotateX(16deg) rotateY(-12deg) rotateZ(-6deg);
  pointer-events: none;
  z-index: 62;
  transition: opacity 220ms ease;
}

.vinyl-sketch-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 2px 8px rgba(20, 12, 8, 0.35));
}

.vinyl-sketch-path {
  fill: none;
  stroke: rgba(255, 244, 224, 0.88);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1450;
  stroke-dashoffset: 1450;
  transition: stroke-dashoffset 680ms cubic-bezier(0.22, 1, 0.36, 1), opacity 260ms ease;
}

.vinyl-sketch-path--outer {
  stroke-width: 1.75;
}

.vinyl-sketch-path--inner {
  stroke-width: 1.1;
  stroke: rgba(255, 232, 198, 0.62);
  transition-delay: 75ms;
}

.vinyl-sketch-wrap.is-drawn .vinyl-sketch-path {
  stroke-dashoffset: 0;
}

/* Individual 3D Disc Slot */
.vinyl-disc {
  position: absolute;
  top: 49%;
  left: 50%;
  width: var(--disc-size);
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  will-change: transform, opacity;
  transform-style: preserve-3d;
  -webkit-tap-highlight-color: transparent;
}

.vinyl-disc:focus-visible {
  outline: none;
}

.vinyl-disc:focus-visible .vinyl-disc-body {
  box-shadow:
    0 0 0 3px #ffe8be,
    0 24px 48px rgba(12, 7, 4, 0.56);
}

/* Disc physical body */
.vinyl-disc-body {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #231d1b;
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 247, 232, 0.38),
    inset 0 0 10px rgba(18, 12, 9, 0.45),
    0 24px 52px rgba(10, 6, 4, 0.52),
    0 6px 16px rgba(10, 6, 4, 0.32);
}

/* Full-bleed picture-disc illustration layer (rotates smoothly when active) */
.vinyl-art {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  will-change: transform;
}

/* Subtle vinyl micro-grooves overlay */
.vinyl-grooves {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-radial-gradient(
      circle at center,
      rgba(255, 255, 255, 0.045) 0px,
      rgba(255, 255, 255, 0.045) 1px,
      rgba(18, 12, 9, 0.06) 1.5px,
      transparent 3px,
      transparent 4.5px
    ),
    radial-gradient(
      circle at center,
      transparent 29%,
      rgba(20, 14, 11, 0.14) 29.4%,
      transparent 30.2%,
      transparent 95.5%,
      rgba(16, 11, 8, 0.28) 98.2%,
      rgba(255, 245, 228, 0.24) 100%
    );
  pointer-events: none;
}

/* Realistic angled studio sheen (stays fixed to light angle, doesn't spin with art) */
.vinyl-sheen {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    conic-gradient(
      from 28deg at 50% 50%,
      transparent 0deg,
      rgba(255, 250, 240, 0.22) 22deg,
      rgba(255, 236, 208, 0.06) 44deg,
      transparent 78deg,
      transparent 178deg,
      rgba(255, 248, 236, 0.18) 204deg,
      rgba(255, 236, 210, 0.04) 228deg,
      transparent 262deg
    ),
    linear-gradient(
      132deg,
      rgba(255, 252, 245, 0.18) 0%,
      transparent 38%,
      rgba(18, 11, 7, 0.18) 100%
    );
  mix-blend-mode: screen;
  opacity: 0.78;
  pointer-events: none;
}

/* Translucent inner acrylic clamping ring */
.vinyl-hub-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 21%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255, 246, 232, 0.32);
  background: radial-gradient(
    circle,
    transparent 48%,
    rgba(255, 248, 236, 0.1) 50%,
    rgba(30, 20, 15, 0.08) 82%,
    rgba(255, 246, 232, 0.2) 100%
  );
  pointer-events: none;
}

/* Punched center spindle hole */
.vinyl-spindle-hole {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9.2%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(
    circle at 38% 36%,
    rgba(32, 23, 18, 0.82) 0%,
    rgba(16, 11, 8, 0.94) 100%
  );
  box-shadow:
    inset 0 1.5px 3px rgba(0, 0, 0, 0.72),
    0 0 0 1.5px rgba(255, 245, 228, 0.45);
  pointer-events: none;
}

/* Mounted badge subtle halo on the disc currently playing on turntable */
.vinyl-disc[data-mounted="true"] .vinyl-disc-body {
  box-shadow:
    inset 0 0 0 2px rgba(255, 225, 174, 0.65),
    inset 0 0 10px rgba(18, 12, 9, 0.42),
    0 24px 54px rgba(10, 6, 4, 0.56),
    0 0 28px rgba(255, 214, 155, 0.22);
}

/* Bottom Editorial Caption + Action Bar */
.vinyl-bottom {
  position: absolute;
  left: 50%;
  bottom: clamp(18px, 3.6dvh, 40px);
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(560px, calc(100% - 32px));
  text-align: center;
  pointer-events: none;
}

.vinyl-quote {
  margin: 0;
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", SimSun, Georgia, serif;
  font-size: clamp(13.5px, 1.8vw, 16px);
  line-height: 1.55;
  letter-spacing: 0.05em;
  color: rgba(255, 245, 230, 0.9);
  text-shadow: 0 2px 12px rgba(16, 10, 7, 0.55);
  transition: opacity 220ms ease;
}

.vinyl-quote.is-changing {
  opacity: 0.3;
}

.vinyl-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: auto;
}

.vinyl-step-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 16px;
}

.vinyl-confirm {
  min-height: 42px;
  padding: 0 24px;
  background: rgba(255, 244, 226, 0.92);
  border-color: rgba(255, 248, 236, 0.96);
  color: #2c1e16;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 24px rgba(14, 9, 6, 0.36);
}

.vinyl-confirm:hover {
  background: #ffffff;
  border-color: #ffffff;
  transform: translateY(-1px);
}

.vinyl-hint {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(255, 236, 212, 0.56);
}

#vinyl-picker button:focus-visible {
  outline: 2px solid #ffe6b8;
  outline-offset: 3px;
}

/* Mobile / Portrait Refinements */
@media (max-width: 640px) {
  #vinyl-picker .vinyl-editorial {
    top: calc(max(10px, env(safe-area-inset-top)) + 54px);
    left: max(14px, env(safe-area-inset-left));
    width: min(300px, calc(100% - 28px));
  }

  .vinyl-meta-grid {
    display: none;
  }

  .vinyl-rule {
    margin: 8px 0 0;
  }

  .vinyl-top-actions {
    gap: 6px;
  }

  .vinyl-pill-btn {
    padding: 0 10px;
    font-size: 12px;
  }

  .vinyl-stage {
    --disc-size: clamp(195px, 56vw, 285px);
  }

  .vinyl-hint {
    display: none;
  }
}

@media (pointer: coarse), (max-width: 640px) {
  .vinyl-top-actions {
    top: max(10px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
  }
  .vinyl-bottom { bottom: max(12px, env(safe-area-inset-bottom)); }
  .vinyl-pill-btn { min-height: 44px; touch-action: manipulation; }
  .vinyl-close, .vinyl-step-btn { width: 44px; height: 44px; }
}

@media (max-height: 460px) and (orientation: landscape) {
  #vinyl-picker .vinyl-editorial {
    top: max(14px, env(safe-area-inset-top));
    left: max(16px, env(safe-area-inset-left));
  }
  .vinyl-meta-grid, .vinyl-hint { display: none; }
  .vinyl-bottom { gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  #vinyl-picker,
  #vinyl-picker::backdrop,
  .vinyl-title,
  .vinyl-quote,
  .vinyl-sketch-path,
  .vinyl-pill-btn {
    transition: none;
  }
}
