/* =====================================================
   Music Player - 사이드 플로팅 (PC 전용, 우측 중간)
   채널톡 버튼(우측 하단)과 겹치지 않도록 top:40% 배치
   ===================================================== */

@media (max-width: 768px) {
  #music-player,
  #music-autoplay-modal {
    display: none !important;
  }
}

/* ── 컨테이너: 우측 세로 중앙 ── */
#music-player {
  position: fixed;
  right: 0;
  top: 40%;
  transform: translateY(-50%);
  z-index: 600;
  display: flex;
  flex-direction: row-reverse; /* 패널이 왼쪽으로 펼쳐짐 */
  align-items: center;
  user-select: none;
  pointer-events: none; /* 기본은 통과, 자식만 받음 */
}

#music-player > * {
  pointer-events: auto;
}

/* ── 탭 토글 버튼 ── */
#mp-toggle {
  position: relative;
  width: 32px;
  height: 52px;
  border-radius: 8px 0 0 8px;
  background: linear-gradient(180deg, #c62a00, #ff4500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: -3px 2px 12px rgba(0,0,0,0.5);
  font-size: 14px;
  flex-shrink: 0;
  transition: width 0.15s;
}
#mp-toggle:hover { width: 38px; }
#music-player.expanded #mp-toggle {
  background: linear-gradient(180deg, #2a2a2a, #444);
}

/* 재생중 점 */
.mp-playing-dot {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4cff91;
  border: 1px solid #111;
  animation: mp-pulse 1.2s infinite;
}
@keyframes mp-pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:0.4; transform:scale(0.7); }
}

/* ── 패널 ── */
#mp-panel {
  width: 260px;
  background: linear-gradient(180deg, #1c1c1c 0%, #111 100%);
  border: 1px solid rgba(255,255,255,0.1);
  border-right: none;
  border-radius: 12px 0 0 12px;
  padding: 14px;
  box-shadow: -4px 4px 24px rgba(0,0,0,0.8);
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
#mp-panel.open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* ── 헤더 ── */
.mp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.mp-title-label {
  font-size: 11px;
  color: #ff6030;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mp-close {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  line-height: 1;
}
.mp-close:hover { color: #bbb; }

/* ── 트랙 정보 ── */
.mp-track-info { margin-bottom: 10px; min-height: 32px; }
.mp-track-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-track-artist {
  font-size: 11px;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ── 진행바 ── */
.mp-progress-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 12px;
}
.mp-time {
  font-size: 10px;
  color: #555;
  min-width: 28px;
  font-variant-numeric: tabular-nums;
}

/* range 공통 */
.mp-range {
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 3px;
  background: #333;
  outline: none;
  cursor: pointer;
}
.mp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff4500;
  border: 2px solid #fff;
  cursor: pointer;
}
.mp-range::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff4500;
  border: 2px solid #fff;
  cursor: pointer;
}
.mp-progress-range { flex: 1; }

/* ── 컨트롤 ── */
.mp-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}
.mp-btn {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 14px;
  padding: 5px;
  border-radius: 50%;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.mp-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
.mp-btn-play {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #c62a00, #ff4500) !important;
  color: #fff !important;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255,69,0,0.4);
}
.mp-btn-play:hover { transform: scale(1.08); }

/* ── 볼륨 ── */
.mp-volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.mp-vol-icon {
  color: #666;
  font-size: 12px;
  cursor: pointer;
  min-width: 14px;
}
.mp-vol-icon:hover { color: #bbb; }
.mp-volume-range { flex: 1; }
.mp-vol-pct {
  font-size: 10px;
  color: #555;
  min-width: 28px;
  text-align: right;
}

/* ── 플레이리스트 ── */
.mp-playlist {
  max-height: 140px;
  overflow-y: auto;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 8px;
  scrollbar-width: thin;
  scrollbar-color: #444 transparent;
}
.mp-playlist::-webkit-scrollbar { width: 3px; }
.mp-playlist::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

.mp-playlist-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}
.mp-playlist-item:hover { background: rgba(255,255,255,0.05); }
.mp-playlist-item.active { background: rgba(255,69,0,0.12); }
.mp-pl-num { font-size: 10px; color: #444; min-width: 14px; text-align: center; }
.mp-playlist-item.active .mp-pl-num { color: #ff4500; }
.mp-pl-info { flex: 1; min-width: 0; }
.mp-pl-title { font-size: 11px; color: #bbb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-playlist-item.active .mp-pl-title { color: #fff; font-weight: 600; }
.mp-pl-artist { font-size: 10px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-pl-playing { font-size: 9px; color: #ff4500; animation: mp-pulse 1.2s infinite; }

/* =====================================================
   자동재생 모달
   ===================================================== */
#music-autoplay-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: mp-fadein 0.2s ease;
}
@keyframes mp-fadein { from{opacity:0} to{opacity:1} }

.mp-autoplay-box {
  background: linear-gradient(180deg,#1e1e1e,#141414);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 28px 24px 20px;
  width: 300px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.8);
  animation: mp-slidein 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes mp-slidein {
  from { transform:translateY(20px) scale(0.95); opacity:0; }
  to   { transform:translateY(0) scale(1); opacity:1; }
}
.mp-autoplay-icon { font-size: 36px; color: #ff4500; margin-bottom: 10px; display: block; }
.mp-autoplay-box h3 { font-size: 15px; color: #fff; margin: 0 0 6px; font-weight: 700; }
.mp-autoplay-box p  { font-size: 12px; color: #777; margin: 0 0 20px; line-height: 1.5; }
.mp-autoplay-btns { display: flex; gap: 8px; }
.mp-autoplay-btns button {
  flex: 1;
  padding: 9px 0;
  border-radius: 7px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.mp-autoplay-btns button:hover { opacity: 0.85; transform: translateY(-1px); }
.mp-btn-yes { background: linear-gradient(135deg,#c62a00,#ff4500); color:#fff; }
.mp-btn-no  { background: #2a2a2a; color:#888; border: 1px solid #444 !important; }
