/* ═══════════════════════════════════════════════════════════
   拾光声场 · 悬浮音乐播放器
   性能约定：装饰动画只使用 transform/opacity（GPU 合成），
   不触发重排；尊重 prefers-reduced-motion。
   ═══════════════════════════════════════════════════════════ */
.sgm {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 9000;
  font-family: var(--font, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  --sgm-amber: #f59f00;
  --sgm-fire: #ff7a1a;
  --sgm-cyan: #4fc3f7;
  --sgm-fg: #ffe9d2;
  --sgm-dim: rgba(255, 233, 210, .55);
  --sgm-bg: rgba(14, 7, 4, .97);
  --sgm-line: rgba(245, 159, 0, .35);
}
.sgm, .sgm * { box-sizing: border-box; }

/* —— 悬浮球 —— */
.sgm-orb {
  position: relative;
  width: 54px; height: 54px;
  padding: 0; border: 0; border-radius: 50%;
  cursor: pointer;
  touch-action: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--sgm-fg);
  background: radial-gradient(circle at 32% 28%, rgba(255, 172, 70, .95), rgba(152, 50, 8, .92) 55%, rgba(26, 9, 2, .96));
  box-shadow: 0 4px 18px rgba(0, 0, 0, .55), 0 0 18px rgba(255, 122, 26, .3), inset 0 0 12px rgba(255, 200, 130, .22);
}
.sgm-orb:active { transform: scale(.94); }
.sgm-orb-ico { display: flex; }
.sgm-orb-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  pointer-events: none;
  border: 2px solid transparent;
  border-top-color: var(--sgm-amber);
  border-right-color: var(--sgm-cyan);
  opacity: .9;
}
.sgm[data-state="play"] .sgm-orb-ring,
.sgm[data-state="wait"] .sgm-orb-ring { animation: sgm-spin 2.4s linear infinite; }
@keyframes sgm-spin { to { transform: rotate(360deg); } }

.sgm-orb::after {
  content: ""; position: absolute; inset: -12px; border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 140, 40, .4), transparent 66%);
  opacity: 0; transform: scale(.8);
}
.sgm[data-state="wait"] .sgm-orb::after { animation: sgm-glow 1.5s ease-in-out infinite; }
@keyframes sgm-glow {
  0%, 100% { opacity: .12; transform: scale(.82); }
  50% { opacity: .8; transform: scale(1.22); }
}

/* 播放中的迷你均衡器（纯 CSS，零 JS 动画） */
.sgm-eq { display: none; gap: 3px; height: 16px; align-items: flex-end; }
.sgm[data-state="play"] .sgm-eq { display: flex; }
.sgm-eq i {
  width: 3px; height: 16px; border-radius: 2px;
  background: linear-gradient(180deg, #fff3d6, var(--sgm-fire));
  transform: scaleY(.2); transform-origin: bottom;
  animation: sgm-eq 1.1s ease-in-out infinite;
}
.sgm-eq i:nth-child(2) { animation-delay: .12s; }
.sgm-eq i:nth-child(3) { animation-delay: .24s; }
.sgm-eq i:nth-child(4) { animation-delay: .36s; }
@keyframes sgm-eq { 0%, 100% { transform: scaleY(.2); } 50% { transform: scaleY(1); } }

/* —— 提示气泡（自动播放被浏览器拦截时显示） —— */
.sgm-hint {
  position: absolute; right: 64px; bottom: 15px;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 12px; letter-spacing: 1px;
  color: var(--sgm-fg);
  background: var(--sgm-bg);
  border: 1px solid var(--sgm-line);
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(245, 159, 0, .22);
  pointer-events: none;
  animation: sgm-hint 1.6s ease-in-out infinite;
}
@keyframes sgm-hint { 0%, 100% { transform: translateX(0); opacity: 1; } 50% { transform: translateX(-4px); opacity: .72; } }

/* —— 播放卡片 —— */
.sgm-card {
  position: absolute; right: 0; bottom: 68px;
  width: 288px; max-width: calc(100vw - 28px);
  max-height: calc(100vh - 150px); overflow-y: auto;
  padding: 12px 14px 14px;
  color: var(--sgm-fg);
  background: var(--sgm-bg);
  border: 1px solid var(--sgm-line);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .65), 0 0 26px rgba(245, 159, 0, .12), inset 0 0 24px rgba(232, 89, 12, .06);
  animation: sgm-in .26s ease-out;
}
@keyframes sgm-in { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }

.sgm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sgm-title { font-size: 14px; font-weight: 700; letter-spacing: 2px; display: flex; align-items: center; gap: 6px; }
.sgm-title > span:first-child {
  background: linear-gradient(90deg, var(--sgm-amber), #ffd9a0 45%, var(--sgm-cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sgm-tag {
  font-size: 9px; letter-spacing: 1px; line-height: 1;
  color: var(--sgm-cyan);
  border: 1px solid var(--sgm-cyan);
  border-radius: 3px; padding: 2px 4px;
}
.sgm[data-state="play"] .sgm-tag { animation: sgm-blink 1.4s steps(2, start) infinite; }
@keyframes sgm-blink { 50% { opacity: .25; } }
.sgm-track {
  flex: 1; text-align: right;
  font-size: 12px; letter-spacing: 1px; color: var(--sgm-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sgm-close {
  border: 0; background: none; padding: 2px 4px;
  color: var(--sgm-dim); font-size: 13px; line-height: 1; cursor: pointer;
}
.sgm-close:hover { color: var(--sgm-fg); }

.sgm-viz {
  display: block; width: 100%; height: 48px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .4);
  border: 1px solid rgba(245, 159, 0, .18);
  margin: 2px 0 10px;
}

.sgm-ctrl { display: flex; align-items: center; justify-content: center; gap: 16px; }
.sgm-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--sgm-line);
  background: rgba(255, 122, 26, .08);
  color: var(--sgm-fg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.sgm-btn:hover { border-color: var(--sgm-amber); box-shadow: 0 0 10px rgba(245, 159, 0, .35); }
.sgm-play {
  position: relative;
  width: 46px; height: 46px; border-radius: 50%; border: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #221005;
  background: radial-gradient(circle at 32% 28%, #ffbe66, var(--sgm-fire) 60%, #8f2d00);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .5), 0 0 16px rgba(255, 122, 26, .45);
}
.sgm-play::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px solid rgba(245, 159, 0, .4);
  opacity: 0; pointer-events: none;
}
.sgm[data-state="play"] .sgm-play::after { animation: sgm-glow 2.2s ease-in-out infinite; }
.sgm-play:active { transform: scale(.93); }
/* 音频缓冲中（移动网络下载时的反馈） */
.sgm[data-loading="1"] .sgm-play { animation: sgm-loading 1s ease-in-out infinite; }
@keyframes sgm-loading { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.sgm-dots { display: flex; justify-content: center; gap: 9px; margin: 11px 0 3px; }
.sgm-dots button {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 233, 210, .22);
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.sgm-dots button.on {
  background: var(--sgm-amber);
  box-shadow: 0 0 8px rgba(245, 159, 0, .8);
  transform: scale(1.35);
}

.sgm-vol { display: flex; align-items: center; gap: 8px; margin-top: 9px; color: var(--sgm-dim); }
.sgm-vol-ico { display: flex; flex: none; }
.sgm-vol input[type="range"] {
  flex: 1; height: 4px; margin: 0;
  -webkit-appearance: none; appearance: none;
  border-radius: 2px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--sgm-fire), var(--sgm-amber));
}
.sgm-vol input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--sgm-fg);
  border: 2px solid var(--sgm-fire);
  box-shadow: 0 0 8px rgba(255, 122, 26, .8);
}
.sgm-vol input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--sgm-fg);
  border: 2px solid var(--sgm-fire);
}
.sgm-vol-pct { min-width: 32px; text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }

.sgm.sgm-drag .sgm-card { animation: none; }

@media (max-width: 480px) {
  .sgm-orb { width: 48px; height: 48px; }
  .sgm-card { bottom: 60px; }
  .sgm-hint { right: 56px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .sgm *, .sgm { animation: none !important; transition: none !important; }
}
