/* Heavy Rotation: a seamless studio, frosted-glass records, one model.
   Every record changes --paper (the backdrop) and --glass (the tint of every panel). */

@property --paper { syntax: '<color>'; inherits: true; initial-value: #1a1210; }
@property --glass { syntax: '<color>'; inherits: true; initial-value: #b77c0f; }

:root {
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --cw: 266px;
  --deck-y: 36vh;
  --bar-y: 59.5vh;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  --paper: #1a1210; --glass: #5a2a22;
  background: var(--paper);
  font-family: var(--ui); color: #fff;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
  transition: --paper .9s ease, --glass .9s ease;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid rgba(255,255,255,.9); outline-offset: 3px; }

#app { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#app.is-grab, #app.is-grab * { cursor: grabbing !important; }
#gl-back, #gl-front { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#gl-back { z-index: 1; }
#mid { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#gl-front { z-index: 3; pointer-events: none; }

/* ───────────── Glass (visionOS-style) ─────────────
   Light tint so the photo really blurs through, a specular rim that is bright at the top-left
   and bottom-right, and a soft contact shadow underneath. */
.glass {
  background:
    radial-gradient(380px circle at var(--hx, -500px) var(--hy, -500px), rgba(255,255,255,.2), rgba(255,255,255,0) 62%),
    linear-gradient(180deg, rgba(255,255,255,.17) 0%, rgba(255,255,255,.04) 48%, rgba(255,255,255,.09) 100%),
    color-mix(in srgb, var(--glass) 30%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.7) brightness(1.05);
          backdrop-filter: blur(24px) saturate(1.7) brightness(1.05);
  border: 0;
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.45),
    inset 0 -1px 1px rgba(255,255,255,.12),
    inset 0 0 22px rgba(255,255,255,.05),
    0 2px 6px rgba(0,0,0,.06),
    0 30px 60px -24px rgba(0,0,0,.45);
}
.glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.2px; pointer-events: none;
  background: linear-gradient(150deg, rgba(255,255,255,.9) 0%, rgba(255,255,255,.22) 26%, rgba(255,255,255,.05) 52%, rgba(255,255,255,.18) 78%, rgba(255,255,255,.55) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: var(--rim, .75);
}

/* ───────────── Records (cover flow) ───────────── */
.deck {
  position: absolute; left: 50%; top: var(--deck-y); width: 0; height: 0;
  transition: opacity .9s ease, transform 1.1s cubic-bezier(.2, .9, .2, 1);
}
body:not(.started) .deck { opacity: 0; transform: translateY(60px); }
.card {
  position: absolute; left: 0; top: 0;
  width: var(--cw);
  padding: calc(var(--cw) * .036) calc(var(--cw) * .036) 0;
  border-radius: calc(var(--cw) * .082);
  text-align: center; color: #fff;
  pointer-events: auto;
  will-change: transform, opacity;
  --rim: calc(.55 + var(--glow, 0) * .45);
}
.card::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: color-mix(in srgb, var(--glass) 55%, transparent);
  opacity: var(--dim, 0);
}
.card img {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: calc(var(--cw) * .052);
  -webkit-user-drag: none; pointer-events: none;
}
.card-cap { display: block; padding: calc(var(--cw) * .052) 6px calc(var(--cw) * .05); }
.card-artist { display: block; font-size: calc(var(--cw) * .068); font-weight: 500; letter-spacing: -.012em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title { display: block; font-size: calc(var(--cw) * .047); opacity: .78; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card img, .p-thumb, .sb-row img { transition: filter .9s ease; }
body.is-mono .card img, body.is-mono .p-thumb, body.is-mono .sb-row img { filter: grayscale(1); }

/* ───────────── Player pill ───────────── */
.player {
  position: absolute; left: 50%; top: var(--bar-y);
  width: min(76vw, 1120px); height: 76px; border-radius: 38px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 22px;
  pointer-events: auto;
  transform: translateX(-50%);
  transition: opacity .9s ease .15s, transform 1.1s cubic-bezier(.2, .9, .2, 1) .1s;
}
body:not(.started) .player { opacity: 0; transform: translate(-50%, 40px); }
.p-left, .p-right { display: flex; align-items: center; gap: 14px; }
.p-left { justify-self: start; }
.p-right { justify-self: end; }
.p-btn {
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; color: rgba(255,255,255,.9);
  transition: background .2s ease, transform .25s cubic-bezier(.3, 1.5, .5, 1), opacity .25s ease;
}
.p-btn:hover { background: rgba(255,255,255,.14); }
.p-btn:active { transform: scale(.92); }
.p-btn svg { width: 25px; height: 25px; fill: currentColor; }
.p-line svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.p-btn[aria-pressed="false"] { opacity: .45; }
.p-play .i-pause { display: none; }
.is-playing .p-play .i-pause { display: block; }
.is-playing .p-play .i-play { display: none; }
.p-chip {
  position: relative; overflow: hidden;
  width: min(310px, 27vw); height: 56px; border-radius: 13px;
  display: flex; align-items: center; gap: 12px; padding: 0 14px 0 8px;
  background: color-mix(in srgb, var(--glass) 40%, rgba(0,0,0,.14));
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}
.p-thumb { width: 40px; height: 40px; flex: none; border-radius: 7px; object-fit: cover; display: block; }
.p-meta { min-width: 0; line-height: 1.18; }
.p-artist { font-size: 15px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-title { font-size: 12.5px; opacity: .78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-side { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; padding-left: 8px; }
.p-time { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .78; }
.p-eq { display: flex; align-items: flex-end; gap: 2.5px; height: 14px; }
.p-eq i { display: block; width: 3px; height: 100%; border-radius: 2px; background: rgba(255,255,255,.92); transform-origin: 50% 100%; transform: scaleY(.22); }
.is-playing .p-eq i { animation: eq calc(var(--eqd, .45s) * 1) ease-in-out infinite alternate; }
.is-playing .p-eq i:nth-child(2) { animation-duration: calc(var(--eqd, .45s) * .62); animation-delay: -.2s; }
.is-playing .p-eq i:nth-child(3) { animation-duration: calc(var(--eqd, .45s) * 1.37); animation-delay: -.5s; }
.is-playing .p-eq i:nth-child(4) { animation-duration: calc(var(--eqd, .45s) * .81); animation-delay: -.1s; }
@keyframes eq { 0% { transform: scaleY(.18); } 50% { transform: scaleY(.9); } 100% { transform: scaleY(.42); } }
.p-seek { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.16); cursor: pointer; }
.p-seek::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; }
.p-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255,255,255,.92); }

/* ───────────── Title card ───────────── */
.title-card {
  position: absolute; z-index: 5; left: 4.2vw; bottom: 8.5vh; max-width: 40vw;
  color: #fff; pointer-events: none;
  text-shadow: 0 2px 30px rgba(0,0,0,.35);
  transition: opacity .8s ease .2s, transform 1.1s cubic-bezier(.2, .9, .2, 1) .15s;
}
body:not(.started) .title-card { opacity: 0; transform: translateY(24px); }
.tc-kick { margin: 0 0 10px; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; color: rgba(255,255,255,.72); letter-spacing: .01em; }
.tc-kick span:first-child { font-variant-numeric: tabular-nums; color: #fff; }
.tc-dash { width: 28px; height: 1px; background: rgba(255,255,255,.55); display: inline-block; }
.tc-title {
  margin: 0; font-size: clamp(44px, 5.4vw, 96px); font-weight: 700; letter-spacing: -.045em; line-height: .95;
  white-space: nowrap;
}
.tc-title .ln { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.tc-title .ch { display: inline-block; white-space: pre; transform: translateY(105%); filter: blur(6px); opacity: 0;
  transition: transform .9s cubic-bezier(.2, .9, .15, 1), filter .9s ease, opacity .5s ease; transition-delay: calc(var(--i) * 22ms + 120ms); }
.tc-title.in .ch { transform: none; filter: blur(0); opacity: 1; }
.tc-title.out .ch { transform: translateY(-105%); filter: blur(6px); opacity: 0; transition-duration: .45s; transition-delay: calc(var(--i) * 10ms); }
.tc-meta { margin: 12px 0 0; font-size: 15px; font-weight: 500; color: rgba(255,255,255,.82); transition: opacity .5s ease; }
.tc-meta.swap { opacity: 0; }
body.sideb-open .title-card { opacity: 0 !important; }

/* ───────────── Tone-on-tone chrome ───────────── */
.logo {
  position: absolute; z-index: 5; left: 50%; top: 8.4vh; transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px;
  color: rgba(255,255,255,.78); text-decoration: none;
  font-size: 23px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap;
}
.logo svg { width: 31px; height: 31px; }
.logo circle { fill: currentColor; }
.logo .groove { fill: none; stroke: var(--paper); stroke-width: 1.1; opacity: .55; }
.logo .hole { fill: var(--paper); }

.foot { position: absolute; z-index: 5; left: 0; right: 0; bottom: max(3vh, env(safe-area-inset-bottom)); text-align: center; pointer-events: none; }
.foot p { margin: 0; }
.hint { font-size: 12px; color: rgba(255,255,255,.66); margin-bottom: 8px !important; transition: opacity .8s ease; }
.hint.is-quiet { opacity: 0; }
.copy { font-size: 13px; color: rgba(255,255,255,.82); letter-spacing: .01em; }

.flash { position: absolute; inset: 0; z-index: 8; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .7s cubic-bezier(.2, .6, .3, 1) 1; }
@keyframes flash { 0% { opacity: 0; } 12% { opacity: calc(.75 * var(--fl, 1)); } 100% { opacity: 0; } }

/* ───────────── Side B ───────────── */
.sideb { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.sb-panel {
  position: absolute; top: 3vh; right: 3vh; bottom: 3vh; width: min(520px, 44vw);
  padding: 7vh 40px 32px; overflow-y: auto; border-radius: 34px;
  transform: translateX(calc(100% + 6vh)); opacity: .4;
  transition: transform .9s cubic-bezier(.7, 0, .2, 1), opacity .6s ease;
  pointer-events: auto;
}
.sideb.is-open .sb-panel { transform: none; opacity: 1; }
.sb-kick { margin: 0; font-size: 14px; font-weight: 500; opacity: .75; }
.sb-title { margin: 2px 0 22px; font-size: 40px; font-weight: 600; letter-spacing: -.03em; }
.sb-list { list-style: none; margin: 0; padding: 0; }
.sb-row button {
  width: 100%; border: 0; background: transparent; border-radius: 14px;
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 8px; text-align: left; transition: background .2s ease;
}
.sb-row button:hover, .sb-row.is-on button { background: rgba(255,255,255,.14); }
.sb-row img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; display: block; }
.sb-name { display: block; font-size: 16px; font-weight: 500; letter-spacing: -.01em; }
.sb-sub { display: block; font-size: 13px; opacity: .72; margin-top: 1px; }
.sb-mood { font-size: 12px; opacity: .6; padding-right: 6px; }
.sb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.sb-btn { height: 46px; padding: 0 20px; border-radius: 23px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08); font-size: 15px; font-weight: 500; }
.sb-btn:hover { background: rgba(255,255,255,.18); }
.sb-primary { background: rgba(255,255,255,.92); color: #1d1d1f; border-color: transparent; }
.sb-primary:hover { background: #fff; }
.sb-scratch { margin: 20px 0 0; font-size: 14px; opacity: .85; }
.sb-credits { margin: 26px 0 0; font-size: 12px; line-height: 1.5; opacity: .62; }
body.sideb-open .player, body.sideb-open .deck, body.sideb-open .foot { opacity: 0 !important; pointer-events: none; }
body.started .foot { transition: opacity .5s ease; }

/* ───────────── Entry ───────────── */
.gate { position: absolute; inset: 0; z-index: 12; display: grid; place-items: center; transition: opacity .7s ease; }
.gate.is-out { opacity: 0; pointer-events: none; }
.gate.is-gone { display: none; }
.g-stack { display: flex; flex-direction: column; align-items: center; gap: 18px; transform: translateY(4vh); }
.g-line { margin: 0; font-size: 17px; font-weight: 500; color: rgba(255,255,255,.88); letter-spacing: -.01em; }
.g-play {
  position: relative;
  height: 68px; padding: 0 34px 0 26px; border-radius: 34px;
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: #fff;
  transition: transform .3s cubic-bezier(.3, 1.5, .5, 1), opacity .3s ease;
}
.g-play svg { width: 24px; height: 24px; fill: currentColor; }
.g-play:disabled { cursor: progress; opacity: .8; }
.g-play:not(:disabled):hover { transform: scale(1.04); }

.noscript { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; background: #d99a1b; color: #fff; font: 600 18px var(--ui); }

/* ───────────── Phones / portrait: the poster layout ───────────── */
@media (max-width: 760px), (max-aspect-ratio: 4/5) {
  .player { width: calc(100vw - 24px); height: 64px; border-radius: 32px; padding: 0 8px; gap: 4px; }
  .p-left { gap: 0; }
  .p-right { gap: 0; }
  .hint { display: none; }
  .title-card { display: none; }
  .foot { bottom: max(1.6vh, env(safe-area-inset-bottom)); }
  .copy { font-size: 11.5px; }
  .p-btn { width: 38px; height: 38px; }
  .p-btn svg { width: 21px; height: 21px; }
  #btn-auto, #btn-shuffle { display: none; }
  .p-time { display: none; }
  .p-chip { width: min(52vw, 260px); height: 48px; gap: 9px; padding: 0 10px 0 6px; }
  .p-thumb { width: 34px; height: 34px; }
  .p-artist { font-size: 13.5px; }
  .p-title { font-size: 11.5px; }
  .logo { top: 6.5vh; font-size: 19px; }
  .logo svg { width: 26px; height: 26px; }
  .sb-panel { top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; height: 58vh; padding: 28px 20px 24px; border-radius: 28px; transform: translateY(calc(100% + 20px)); }
  .sb-title { font-size: 30px; }
}

/* ───────────── Motion preferences / screenshot mode ───────────── */
@media (prefers-reduced-motion: reduce) {
  .flash.go { animation-duration: 1s; }
}
html.still *, html.still *::before, html.still *::after { animation: none !important; transition: none !important; }
