/* ==================== VinylPlayer 桌面唱片机 v2 ==================== */

/* --- 唱片容器 --- */
.vp-record {
  position: fixed;
  z-index: 10;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;   /* 位于 #vinyl-layer(none) 内，需显式开启拖拽/点击 */
  transition: filter 0.2s;
}
.vp-record.vp-dragging {
  cursor: grabbing;
  z-index: 100;
  opacity: 0.92;
  transition: none !important;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

/* --- 唱片盘 --- */
.vp-disc {
  width: 106px;
  height: 106px;
  background: url(../static/book-img/music2.png) no-repeat center/cover;
  border-radius: 50%;
  position: relative;
  animation: vp-spin 8s linear infinite;
  animation-play-state: paused;
  transition: box-shadow 0.3s;
}
.vp-record:hover .vp-disc {
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.vp-record.vp-playing .vp-disc {
  animation-play-state: running;
}

/* --- 纹理 --- */
.vp-groove {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle, transparent 28%, rgba(0,0,0,0.08) 29%, transparent 30%),
    radial-gradient(circle, transparent 40%, rgba(0,0,0,0.06) 41%, transparent 42%),
    radial-gradient(circle, transparent 52%, rgba(0,0,0,0.06) 53%, transparent 54%),
    radial-gradient(circle, transparent 64%, rgba(0,0,0,0.05) 65%, transparent 66%);
}

/* --- 封面（不随唱片转） --- */
.vp-cover {
  position: absolute;
  width: 50px;
  height: 50px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #333 url(../static/book-img/cover.png) no-repeat center/cover;
  background-size: cover;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
  animation: vp-counter-spin 8s linear infinite;
  animation-play-state: paused;
}
.vp-record.vp-playing .vp-cover {
  animation-play-state: running;
}

/* --- 在唱片机上的唱片 --- */
.vp-record.vp-on-turntable {
  z-index: 5;
  cursor: grab;
}
.vp-record.vp-on-turntable .vp-disc {
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
}

/* --- 控制按钮（上一首/下一首，唱片在唱片机上才显示） --- */
.vp-controls {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s, transform 0.25s;
}
.vp-record.vp-on-turntable .vp-controls {
  opacity: 1;
  transform: translateY(0);
}

.vp-btn {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(60,60,60,0.75);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s, transform 0.15s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.vp-btn:hover {
  background: rgba(30,30,30,0.9);
  transform: scale(1.1);
}
.vp-btn:active { transform: scale(0.95); }
.vp-btn svg { width: 14px; height: 14px; fill: #fff; }

/* --- 曲目信息 --- */
.vp-info {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -36px;
  white-space: nowrap;
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s;
  background: rgba(30,30,30,0.85);
  color: #eee;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.4;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vp-record:hover .vp-info,
.vp-record.vp-on-turntable .vp-info {
  opacity: 1;
}
.vp-track-num { color: #aaa; margin-right: 4px; font-size: 10px; }
.vp-song-title { display: block; overflow: hidden; text-overflow: ellipsis; }

/* --- 加载指示器 --- */
.vp-loader {
  position: absolute;
  left: 50%; top: 50%;
  width: 24px; height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: vp-loader-spin 0.6s linear infinite;
  pointer-events: none;
}

/* ==================== 唱片机交互提示 ==================== */

/* 装饰元素不拦截鼠标事件，唱片可以在下面拖动 */
#chiji_box, #tea_box {
  pointer-events: none;
}

/* 拖拽接近时的放置提示：由 JS 动态创建的 #vinyl-drop-hint 元素定位到唱盘真实圆心，
   不再使用 #music_box::after（因 #music_box 仅覆盖设备图右上角区域，伪元素无法正确定位到溢出的唱盘中心）。
   此处仅保留旧版 outline 兜底（已弃用，保留防样式断裂） */
#music_box.vp-turntable-hint {
  /* 已迁移为 JS 控制的独立元素，此规则保留但不再生效 */
}
#music_box.vp-turntable-near {
  /* 方形 box-shadow 已移除（用户反馈拖拽时出现方形黄色背景框）；
     圆形 #vinyl-drop-hint 已作为落点提示，此处保留 class 供 JS 切换 */
}

/* 唱臂动画 + 层级始终在唱片之上 */
#music_rod {
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 15 !important;
  pointer-events: none;
}
#music_rod.vp-rod-playing {
  transform: rotate(0deg) !important;
}

/* ==================== Animations ==================== */
@keyframes vp-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes vp-counter-spin {
  from { transform: translate(-50%,-50%) rotate(0deg); }
  to   { transform: translate(-50%,-50%) rotate(-360deg); }
}
@keyframes vp-loader-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ==================== 移动端 ==================== */
@media (max-width: 768px) {
  .vp-record.vp-on-turntable .vp-controls {
    opacity: 1;
    transform: translateY(0);
  }
  .vp-record:hover .vp-info,
  .vp-record.vp-on-turntable .vp-info {
    opacity: 1;
  }
  .vp-btn { width: 28px; height: 28px; }
  .vp-btn svg { width: 14px; height: 14px; }
  .vp-disc { width: 90px; height: 90px; }
  .vp-cover { width: 42px; height: 42px; }
}

/* ==================== 修复原版：唱片旋转（原 #music_record 缺 animation-name） ==================== */
#music_record {
  animation-name: vp-record-spin;
  animation-duration: 8s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-play-state: paused;
}
#music_record.playing {
  animation-play-state: running;
}
@keyframes vp-record-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ==================== 播放控制条（上一首 / 播放暂停 / 下一首 / 曲目名） ==================== */
#music_ctrl {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -34px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 16px;
  background: rgba(28, 26, 22, 0.82);
  color: #eee;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 8;
  transition: opacity 0.25s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
#music_box:hover #music_ctrl,
#music_box.playing #music_ctrl {
  opacity: 1;
  pointer-events: auto;
}
.mc-btn {
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  color: #f3ead6;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.15s, transform 0.15s;
}
.mc-btn:hover { color: #ffd36b; transform: scale(1.12); }
.mc-btn:active { transform: scale(0.94); }
.mc-title {
  max-width: 168px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

/* ==================== 音量滑块（点击 #music_v_box 设音量，#music_volume_c 作旋钮指示） ==================== */
#music_v_box {
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.2s;
}
#music_v_box.mc-active {
  background: rgba(255, 255, 255, 0.12);
}
#music_volume_c {
  pointer-events: none;
  transition: top 0.12s ease-out;
}

