/* Shared Continuity Deck + Ambient Stage */
:root {
  --vcr-player-h: 78px;
}

body.has-vcr-player {
  padding-bottom: calc(var(--vcr-player-h) + env(safe-area-inset-bottom, 0px) + 16px) !important;
}

.vcr-player {
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 500;
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 48px minmax(0, 1.1fr) auto minmax(120px, 1.2fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(229, 227, 223, 0.9);
  box-shadow: 0 2px 6px rgba(17, 17, 17, 0.05), 0 22px 48px rgba(17, 17, 17, 0.12), inset 0 1px 0 rgba(255,255,255,.7);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  transform: translateY(140%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.35s ease;
}

.vcr-player.is-visible {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.vcr-player__stage-hit {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  cursor: pointer;
}

.vcr-player > *:not(.vcr-player__stage-hit) {
  position: relative;
  z-index: 1;
}

.vcr-player__art {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: #F2F0EC;
}

.vcr-player__meta {
  min-width: 0;
}

.vcr-player__title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vcr-player__sub {
  font-size: 12px;
  color: #6e6e73;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vcr-player__controls {
  display: flex;
  gap: 2px;
}

.vcr-player__btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #111111;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.vcr-player__btn--play {
  background: #111111;
  color: #fff;
  font-size: 13px;
}

.vcr-player__progress-wrap {
  min-width: 0;
}

.vcr-player__scrub,
.vcr-stage__scrub {
  width: 100%;
  accent-color: #111111;
  cursor: pointer;
}

.vcr-player__times {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #86868b;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.vcr-player__buy {
  font-size: 12px;
  font-weight: 700;
  color: #111111;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 980px;
  background: rgba(0, 0, 0, 0.06);
}

.vcr-player__close {
  font-size: 18px;
  color: #6e6e73;
}

@media (max-width: 760px) {
  :root {
    --vcr-player-h: 108px;
  }
  .vcr-player {
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: 44px minmax(0, 1fr) auto auto;
    grid-template-areas:
      "art meta controls close"
      "progress progress progress progress";
    gap: 8px 10px;
    padding: 10px 12px 12px;
    border-radius: 18px;
  }
  .vcr-player__art { grid-area: art; width: 44px; height: 44px; border-radius: 8px; }
  .vcr-player__meta { grid-area: meta; }
  .vcr-player__controls { grid-area: controls; gap: 4px; }
  .vcr-player__progress-wrap { grid-area: progress; }
  .vcr-player__close { grid-area: close; }
  .vcr-player__buy { display: none; }
  .vcr-player__btn {
    width: 44px;
    height: 44px;
  }
  .vcr-player__btn--play {
    width: 44px;
    height: 44px;
  }
  .vcr-player__scrub {
    height: 28px;
    touch-action: none;
  }
  .vcr-stage {
    padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  }
  .vcr-stage__hint { display: none; }
  .vcr-stage__btn {
    width: 48px;
    height: 48px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .vcr-stage__btn--play {
    width: 60px;
    height: 60px;
  }
  .vcr-stage__scrub {
    height: 28px;
    touch-action: none;
  }
}

/* Ambient Stage */
.vcr-stage {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #fff;
}

.vcr-stage[hidden] {
  display: none !important;
}

.vcr-stage__bg {
  position: absolute;
  inset: -40px;
  background-size: cover;
  background-position: center;
  filter: blur(48px) saturate(1.15) brightness(0.45);
  transform: scale(1.12);
}

.vcr-stage__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 10, 14, 0.35), rgba(8, 10, 14, 0.72));
}

.vcr-stage__close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 18px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.vcr-stage__content {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: vcrStageIn 0.55s cubic-bezier(0.25, 0.1, 0.25, 1);
}

@keyframes vcrStageIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.vcr-stage__art {
  width: min(280px, 68vw);
  aspect-ratio: 1;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  margin-bottom: 8px;
}

.vcr-stage__kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.vcr-stage__title {
  font-size: clamp(28px, 6vw, 40px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.vcr-stage__artist {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.72);
}

.vcr-stage__controls {
  display: flex;
  gap: 10px;
  margin: 8px 0 4px;
}

.vcr-stage__btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.vcr-stage__btn--play {
  width: 64px;
  height: 64px;
  background: #fff;
  color: #111;
  font-size: 18px;
}

.vcr-stage__scrub {
  width: 100%;
  margin-top: 8px;
}

.vcr-stage__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

.vcr-stage__link {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 980px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.vcr-stage__hint {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

body.vcr-stage-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .vcr-player,
  .vcr-stage__content {
    transition: none !important;
    animation: none !important;
  }
}
