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

/* --- 唱片容器 --- */
.vp-record {
  position: fixed;
  z-index: 10;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  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;
}

/* 拖拽时唱片机区域高亮 */
#music_box.vp-turntable-hint {
  outline: 2px dashed rgba(255,255,255,0.3);
  outline-offset: 4px;
  border-radius: 50%;
  transition: outline-color 0.2s;
}

/* 接近时更强的高亮 */
#music_box.vp-turntable-near {
  outline-color: rgba(255,200,50,0.8);
  box-shadow: 0 0 30px rgba(255,200,50,0.3);
}

/* 唱臂动画 + 层级始终在唱片之上 */
#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; }
}
