/* ── Base ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  background: linear-gradient(135deg, #111726 0%, #07090e 100%);
  color: #fff;
}

.app-shell {
  width: 100%;
  height: 100dvh;
  height: 100svh;
  display: grid;
  place-items: center;
  padding:
    max(1rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  transition: background 0.8s ease;
}

.player-stage {
  width: 100%;
  max-width: min(92vw, 380px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.25rem, 4vw, 2rem);
}

/* ── Turntable ────────────────────────────────────────────── */
.turntable-base {
  position: relative;
  width: min(92vw, 92svh - 8rem, 360px);
  aspect-ratio: 1;
  background: linear-gradient(145deg, #161b26 0%, #0d1018 100%);
  border-radius: 1.25rem;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.55),
    0 8px 16px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -2px 8px rgba(0, 0, 0, 0.4);
}

.platter-ring {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #2a3140 0%, #141820 70%, #0a0c12 100%);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.04),
    inset 0 -4px 12px rgba(0, 0, 0, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.3);
}

.vinyl-disc {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #1a1a1a 0%, #0a0a0a 55%, #050505 100%);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  will-change: transform;
  transform: translateZ(0);
}

.vinyl-disc.spinning {
  animation: spin 1.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg) translateZ(0); }
  to   { transform: rotate(360deg) translateZ(0); }
}

.vinyl-grooves {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle at 50% 50%,
    transparent 0px,
    transparent 1.5px,
    rgba(255, 255, 255, 0.018) 1.5px,
    rgba(255, 255, 255, 0.018) 2.5px,
    transparent 2.5px,
    transparent 4px
  );
  opacity: 0.9;
}

.vinyl-shine {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(
    from 210deg,
    transparent 0deg,
    rgba(255, 255, 255, 0.04) 30deg,
    transparent 60deg,
    transparent 360deg
  );
  mix-blend-mode: overlay;
}

.vinyl-label {
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  overflow: hidden;
  background: #111;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.5);
}

.vinyl-label img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.spindle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #555 0%, #222 60%, #111 100%);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.8),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  z-index: 2;
}

/* ── Tonearm & stylus tap ─────────────────────────────────── */
.tonearm-pivot {
  position: absolute;
  top: 6%;
  right: 8%;
  z-index: 20;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  transform-origin: 50% 8%;
  will-change: transform;
  transform: rotate(-18deg) translateZ(0);
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.5));
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.tonearm-pivot:focus-visible {
  outline: 2px solid rgba(201, 162, 39, 0.55);
  outline-offset: 4px;
  border-radius: 4px;
}

.tonearm-pivot:disabled {
  pointer-events: none;
}

.tonearm-svg {
  display: block;
  width: clamp(56px, 18vw, 72px);
  height: auto;
}

.stylus-hit {
  pointer-events: all;
  cursor: pointer;
}

.tonearm-pivot.is-playing .stylus-hit {
  animation: stylus-glow 2s ease-in-out infinite;
}

@keyframes stylus-glow {
  0%, 100% { fill: transparent; }
  50%      { fill: rgba(232, 212, 139, 0.08); }
}

/* ── Track info ───────────────────────────────────────────── */
.track-info {
  width: 100%;
  text-align: center;
  padding: 0 0.5rem;
}

.track-artist {
  margin: 0;
  font-size: clamp(0.8rem, 3.2vw, 0.9rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.track-song {
  margin: 0.35rem 0 0;
  font-size: clamp(1.15rem, 4.5vw, 1.45rem);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.95);
}

/* ── Hidden YouTube player ────────────────────────────────── */
.yt-player {
  position: fixed;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .vinyl-disc.spinning {
    animation-duration: 3.6s;
  }
}
