/* ============================================================
   Vinyl Shelf — mobile-first 3D playlist
   ============================================================ */

:root {
  --bg: #070708;
  --ink: #f2eee6;
  --muted: rgba(242, 238, 230, 0.52);
  --faint: rgba(242, 238, 230, 0.28);
  --line: rgba(242, 238, 230, 0.13);
  --gold: #d9b978;
  --card: min(68vw, 370px);
  --ease: cubic-bezier(0.22, 0.9, 0.24, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- ambient ---------- */

.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='0.7'/></svg>");
  background-size: 140px 140px;
}

.glow {
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 34% at 50% -4%, rgba(219, 186, 128, 0.16), transparent 62%),
    radial-gradient(52% 38% at 12% 102%, rgba(120, 78, 180, 0.14), transparent 66%),
    radial-gradient(60% 40% at 92% 78%, rgba(196, 84, 64, 0.10), transparent 68%);
}

/* ---------- shell ---------- */

#app {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

#app::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 190px;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(to bottom, #070708 0%, rgba(7, 7, 8, 0.92) 32%, rgba(7, 7, 8, 0) 100%);
}

#app::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 132px;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(to top, #070708 0%, rgba(7, 7, 8, 0.86) 34%, rgba(7, 7, 8, 0) 100%);
}

.topbar {
  flex: none;
  z-index: 5;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 22px 0;
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-family: "Times New Roman", "Songti SC", "STSong", serif;
  font-size: 11px;
  letter-spacing: 0.34em;
  color: rgba(242, 238, 230, 0.62);
  white-space: nowrap;
}

.brand-mark {
  margin-left: 0.5em;
  color: var(--gold);
}

.pill {
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(242, 238, 230, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.pill:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.1);
}

.pl-name {
  margin: 16px 0 6px;
  font-size: 27px;
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.015em;
  max-width: 86%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pl-meta {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- stage ---------- */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  perspective: 1200px;
  perspective-origin: 50% 48%;
  touch-action: none;
  overflow: hidden;
}

.world {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--card);
  height: var(--card);
  margin: 0;
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  opacity: 1;
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  overflow: hidden;
  background: #141416;
  box-shadow:
    0 22px 46px rgba(0, 0, 0, 0.52),
    0 2px 6px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.card-face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

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

.card-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    112deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.03) 26%,
    rgba(255, 255, 255, 0) 52%,
    rgba(0, 0, 0, 0.12) 100%
  );
  pointer-events: none;
}

.card-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 26px 12px 9px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.80), rgba(0, 0, 0, 0.28) 46%, transparent);
  pointer-events: none;
}

.card-caption .t {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-caption .a {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.58);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
}

.card.is-selected .card-face {
  box-shadow:
    0 38px 90px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(217, 185, 120, 0.28),
    0 0 46px rgba(217, 185, 120, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* ---------- hud ---------- */

.hud {
  flex: none;
  z-index: 5;
  height: 68px;
  padding: 0 24px calc(env(safe-area-inset-bottom, 0px) + 8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}

.hint {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}

.hint-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(217, 185, 120, 0.9);
  animation: breathe 2.6s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.counter {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.counter b {
  font-weight: 600;
  color: var(--gold);
}

.counter i {
  font-style: normal;
  opacity: 0.4;
}

/* ---------- detail ---------- */

.detail {
  position: fixed;
  inset: 0;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.32s ease, visibility 0s linear 0.32s;
}

.detail.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.32s ease, visibility 0s linear 0s;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 6, 8, 0.74);
  backdrop-filter: blur(24px) saturate(0.85);
  -webkit-backdrop-filter: blur(24px) saturate(0.85);
}

.detail-body {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.6vh, 24px);
  padding: calc(env(safe-area-inset-top, 0px) + 26px) 26px calc(env(safe-area-inset-bottom, 0px) + 24px);
  transform: translateY(16px) scale(0.985);
  transition: transform 0.46s var(--ease);
  pointer-events: none;
}

.detail-body > * { pointer-events: auto; }

.detail.open .detail-body { transform: none; }

.close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: rgba(242, 238, 230, 0.72);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.cover-stack {
  position: relative;
  width: min(76vw, 38vh, 360px);
  aspect-ratio: 1 / 1;
  flex: none;
}

.disc-wrap {
  position: absolute;
  inset: 0;
  transform: translateX(15%) rotate(9deg);
}

.disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 5px),
    radial-gradient(circle at 38% 32%, #2b2b31 0 18%, #151518 55%, #0a0a0c 100%);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    inset -10px -14px 40px rgba(0, 0, 0, 0.5);
  animation: spin 32s linear infinite;
}

.disc-label {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26%;
  height: 26%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #e8d3a8, #b98a4e 70%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.disc-label::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #0a0a0b;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.d-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
  background: #141416;
  box-shadow:
    0 34px 80px rgba(0, 0, 0, 0.66),
    0 0 0 1px rgba(255, 255, 255, 0.09),
    0 1px 0 rgba(255, 255, 255, 0.14) inset;
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.5s var(--ease) 0.04s, opacity 0.36s ease 0.04s;
}

.detail.open .d-cover {
  transform: none;
  opacity: 1;
}

.d-info {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.d-kicker {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--gold);
  margin-bottom: 10px;
}

.d-title {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.d-artist {
  margin: 8px 0 0;
  font-size: 14px;
  color: rgba(242, 238, 230, 0.74);
}

.d-album {
  margin: 6px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.d-actions {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  height: 52px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, background 0.2s ease, opacity 0.2s ease;
}

.btn:active { transform: scale(0.975); }

.btn.primary {
  background: #f3efe6;
  color: #0a0a0b;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  color: rgba(242, 238, 230, 0.9);
  height: 46px;
  font-weight: 500;
  font-size: 14px;
}

.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.d-note {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: rgba(242, 238, 230, 0.3);
  text-align: center;
}

/* ---------- sheet ---------- */

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  visibility: hidden;
  pointer-events: none;
}

.sheet-wrap.open {
  visibility: visible;
  pointer-events: auto;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.sheet-wrap.open .sheet-backdrop { opacity: 1; }

.sheet {
  position: relative;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  background: #101012;
  border-radius: 22px 22px 0 0;
  padding: 10px 22px calc(env(safe-area-inset-bottom, 0px) + 20px);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.55);
  transform: translateY(102%);
  transition: transform 0.4s var(--ease);
}

.sheet-wrap.open .sheet { transform: none; }

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  margin: 4px auto 18px;
}

.sheet-title {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 650;
}

.sheet-desc {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.sheet-input {
  display: block;
  width: 100%;
  min-height: 128px;
  resize: none;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #09090b;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  transition: border-color 0.2s ease;
  -webkit-user-select: text;
  user-select: text;
}

.sheet-input:focus { border-color: rgba(217, 185, 120, 0.45); }

.sheet-input::placeholder { color: rgba(242, 238, 230, 0.36); }

.sheet-msg {
  min-height: 18px;
  margin: 8px 2px 4px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #e0a07a;
}

.sheet-msg.ok { color: #9fd6a8; }

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.sheet-actions .btn { flex: 1; height: 48px; }

.sheet-note {
  margin: 14px 0 0;
  font-size: 10px;
  line-height: 1.6;
  color: rgba(242, 238, 230, 0.28);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  z-index: 80;
  transform: translate(-50%, 12px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(28, 28, 32, 0.92);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(242, 238, 230, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s var(--ease);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.wx-tip {
  position: fixed;
  left: 14px;
  right: 14px;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  z-index: 85;
  padding: 11px 15px;
  border-radius: 13px;
  background: rgba(32, 32, 36, 0.96);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
  color: rgba(242, 238, 230, 0.92);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease);
  pointer-events: none;
}

.wx-tip.show {
  opacity: 1;
  transform: none;
}

@media (min-width: 700px) {
  .pl-name { font-size: 32px; }
  .d-title { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .disc { animation: none; }
  .hint-dot { animation: none; }
}
