/* ==================== 电脑端分段式缩放（≥768px）==================== */
@media (min-width: 768px) {
  /* 基准变量（1080p屏）- 降低vw比例防止过度放大 */
  :root {
    --cover-size: min(320px, 20vw);      /* 封面：最大320px，不超过20%视口宽 */
    --control-width: min(320px, 20vw);    /* 控制区：与封面同宽 */
    --button-small: min(40px, 2.8vw);     /* 小按钮 */
    --button-main: min(60px, 4.2vw);      /* 播放按钮 */
    --playlist-width: min(280px, 18vw);   /* 播放列表 */
    --title-font: min(18px, 1.2vw);       /* 标题字号 */
    --lyrics-font: min(28px, 1.8vw);      /* 歌词字号 */
    --lyrics-active-font: min(32px, 2vw); /* 高亮歌词 */
  }

  /* 2K屏微调放大（≥1920px） */
  @media (min-width: 1920px) {
    :root {
      --cover-size: min(380px, 18vw);
      --control-width: min(380px, 18vw);
      --button-small: min(48px, 2.5vw);
      --button-main: min(72px, 3.8vw);
      --playlist-width: min(320px, 16vw);
    }
  }

  /* 4K屏再放大（≥2560px）- 限制最大尺寸 */
  @media (min-width: 2560px) {
    :root {
      --cover-size: min(420px, 16vw);  /* 最大420px，防止过度放大 */
      --control-width: min(420px, 16vw);
      --button-small: min(52px, 2.2vw);
      --button-main: min(78px, 3.3vw);
      --playlist-width: min(360px, 14vw);
    }
  }

  /* ============ 应用变量到具体元素 ============ */
  .cover-wrapper {
    width: var(--cover-size);
    height: var(--cover-size);
  }

  .info {
    width: var(--control-width);
  }

  .controls {
    width: var(--control-width);
  }

  .buttons button.small {
    width: var(--button-small);
    height: var(--button-small);
  }

  .buttons button.main {
    width: var(--button-main);
    height: var(--button-main);
  }

  #playlistPanel {
    width: var(--playlist-width);
    left: calc(var(--playlist-width) * -1);
  }
}

/* ==================== 防溢出保护（核心修复）==================== */
@media (min-width: 768px) {
  /* 限制整体最大宽度，防止超宽屏过度放大 */
  .player {
    max-width: 1600px; /* 整个播放器最大1600px，防止溢出 */
    margin: 0 auto;    /* 水平居中 */
    align-items: center; /* 垂直居中 */
    justify-content: center;
  }

  .left {
    flex-shrink: 0; /* 防止左侧被压缩导致溢出 */
    padding: 0 min(40px, 3vw);
  }

  .right {
    flex: 1;
    max-width: 50%; /* 右侧歌词区不超过50% */
    min-width: 0;   /* 允许收缩但灵活 */
  }

  /* 防止歌词盒子过宽导致布局失衡 */
  .lyrics-wrapper {
    max-width: 100%;
    padding-left: 5%;
    padding-right: 5%;
  }
}

/* ==================== 防止过度缩小的安全保护 ==================== */
@media (min-width: 768px) and (max-width: 1200px) {
  :root {
    --cover-size: 280px !important;
    --control-width: 280px !important;
  }
}

/* 全局重置与安全 */
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
  /* 关键：阻止页面整体滚动 */
  background: #111;
  color: #fff;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

.player {
  display: flex;
  width: 100%;
  height: 100vh;
  /* 保证与视口高度一致 */
  overflow: hidden;
  /* 额外保险 */
}


/* 快捷键帮助面板样式 */
.shortcut-help {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.shortcut-help.show {
  display: flex;
}
.help-content {
  background: #fff;
  color: #333;
  padding: 20px 30px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  max-width: 320px;
  text-align: left;
  animation: fadeIn 0.3s ease;
}
.help-content h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}
.help-content ul {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
}
.help-content li {
  margin: 4px 0;
  font-size: 0.95rem;
}
.help-content b {
  color: #007bff;
}
.help-content button {
  display: block;
  margin: 0 auto;
  padding: 6px 14px;
  border: none;
  background: #007bff;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}


/* 欢迎提示 */
/* 欢迎提示弹窗 */
.welcome-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.welcome-modal.show {
  display: flex;
}
.welcome-content {
  background: #fff;
  color: #333;
  padding: 25px 35px;
  border-radius: 18px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.3);
  max-width: 360px;
  text-align: center;
  animation: fadeIn 0.4s ease;
}
.welcome-content h2 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}
.welcome-content p {
  margin: 6px 0;
  line-height: 1.4;
}
.welcome-content .hint b {
  color: #007bff;
}
.welcome-content button {
  margin-top: 10px;
  padding: 8px 18px;
  border: none;
  background: #007bff;
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
}

/* === 在线人数悬浮提示 === */
.online-status {
  position: fixed !important;
  right: 20px !important;
  bottom: 20px !important;
  background: rgba(0, 0, 0, 0.85) !important;
  color: #fff !important;
  padding: 8px 16px !important;
  border-radius: 20px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  backdrop-filter: blur(8px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
  transition: all 0.3s ease !important;
  z-index: 1 !important; /* 提高到最高 */
  user-select: none !important;
  pointer-events: none !important; /* 防止遮挡点击 */
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}


/* 评论弹窗样式 */
.comments-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow:hidden;
  z-index: 1000;
  opacity: 0;  /* 初始状态为透明 */
  visibility: hidden;  /* 隐藏 */
  transition: opacity 0.5s ease, visibility 0.5s ease;  /* 设置淡入淡出效果 */
}

.comments-modal.show {
  opacity: 1;  /* 显示时为不透明 */
  visibility: visible;  /* 显示 */
}

/* 弹窗内容 */
/* 自定义滚动条样式 */
.comments-modal-content {
  background-color: #000;
  padding: 20px;
  width: 80%;
  max-height: 80%;
  overflow-y: auto;
  border-radius: 10px;
  position: relative;
  opacity: 0;  /* 弹窗初始状态为透明 */
  transition: opacity 0.5s ease;
}

/* 滚动条背景 */
.comments-modal-content::-webkit-scrollbar {
  width: 10px;  /* 设置滚动条宽度 */
}

/* 滚动条轨道 */
.comments-modal-content::-webkit-scrollbar-track {
  background: #333;  /* 滚动条轨道颜色 */
  border-radius: 5px;
}

/* 滚动条滑块 */
.comments-modal-content::-webkit-scrollbar-thumb {
  background: #888;  /* 滚动条滑块颜色 */
  border-radius: 5px;
}

/* 滚动条滑块悬停时的样式 */
.comments-modal-content::-webkit-scrollbar-thumb:hover {
  background: #555;  /* 滚动条滑块悬停时颜色 */
}


.comments-modal.show .comments-modal-content {
  opacity: 1;  /* 弹窗内容淡入 */
}

/* 评论列表 */
#commentsList {
  max-height: auto;
  overflow-y: scroll;
  overflow:hidden;
}

.comment-item {
  display: flex;
  margin-bottom: 15px;
}

.comment-item img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
}

.comment-item .content {
  font-size: 14px;
}





/* 左侧 50% */
.left {
  width: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 100%;
  padding: 0 20px;
}

.cover-wrapper {
  width: 340px;
  height: 340px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  flex: 0 0 auto;
}

.cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* info: 限高，避免标题撑开布局 */
.info {
  margin-top: 18px;
  width: 300px;
  text-align: center;
  font-size: 18px;

  /* 关键：固定高度，避免被超长标题推开 */
  min-height: 48px;
  /* 高度保证单行或两行都能容纳 */
  max-height: 48px;
  overflow: hidden;
  /* 隐藏溢出（但可通过 title 查看完整） */
}

/* 标题样式：允许最多 2 行，超出显示省略（但保留 title 属性用于完整查看） */
.title {
  font-size: 18px;
  font-weight: 700;
  background-color: #fff;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  /* 最多两行 */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  line-height: 1.2;
}

.controls {
  margin-top: 18px;
  /* 稍微收紧间距 */
  width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.time-display {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #ccc;
}

.progress {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  outline: none;
}

.progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lyrics-inactive-color);
  cursor: pointer;
  transition: transform 0.15s;
}

.progress::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.buttons {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.buttons button {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.buttons button.small {
  width: 40px;
  height: 40px;
}

.buttons button.main {
  width: 60px;
  height: 60px;
  background: var(--lyrics-inactive-color);
 // background: linear-gradient(90deg, #0565ff, #ff4e50);
}

.buttons button img {
  width: 60%;
  height: 60%;
  object-fit: contain;
  display: block;
}

.buttons button:hover {
  transform: scale(1.06);
  background: rgba(255, 255, 255, 0.18);
}

/* 播放列表面板 */
#playlistPanel {
  position: fixed;
  top: 0;
  left: 0; /* 改为 left: 0 */
  width: 320px;
  height: 100vh;
  /* background: rgba(24, 24, 24, 0.98); */
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.6);
  transform: translateX(-100%); /* 初始状态：完全移出视口 */
  transition: transform 0.28s ease;
  will-change: transform; /* 提示浏览器优化 */
  z-index: 1000;
  overflow: hidden;
}

#playlistPanel.show {
  transform: translateX(0); /* 移入视口 */
}

#playlistPanel:not(.show) {
  visibility: hidden;
  transition: transform 0.28s ease, visibility 0s linear 0.28s; /* 延迟隐藏 */
}

#playlistPanel.show {
  visibility: visible;
  transition: transform 0.28s ease;
}

/* 内部内容可滚动：并隐藏滚动条（彻底隐藏 + 兼容） */
#playlistInner {
  height: 100%;
  overflow-y: auto;
  padding: 12px 8px;
  /* 兼容隐藏滚动条 */
  -ms-overflow-style: none;
  /* IE 10+ */
  scrollbar-width: none;
  /* Firefox */
}

#playlistInner::-webkit-scrollbar {
  display: none;
}

/* Chrome,Safari,Opera */

#playlistPanel.show {
  left: 0;
}

#playlistInner ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

#playlistInner li {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  white-space: normal;
  /* 允许换行显示完整标题 */
  word-break: break-word;
  line-height: 1.4;
  color: #fff;
  transition: background 0.12s;
}

#playlistInner li:hover {
  background: rgba(255, 203, 5, 0.08);
}

#playlistInner li.active {
  background: rgba(255, 203, 5, 0.18);
  color: #ffcb05;
  font-weight: 700;
}

/* 右侧 50%（歌词区内部滚动） */
.right {
  width: 50%;
  padding: 36px;
  overflow: hidden;
  height: 100%;
  box-sizing: border-box;
}

.lyrics-wrapper {
  cursor: pointer;
  height: 100%;
  overflow-y: auto;
  padding-bottom: 120px;
  box-sizing: border-box;
  /* scroll-behavior: smooth; */
  word-break: break-word;
  white-space: normal;
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0),
    rgba(0, 0, 0, 1) 10%,
    rgba(0, 0, 0, 1) 90%,
    rgba(0, 0, 0, 0)
  );
}

.lyrics-wrapper::-webkit-scrollbar {
  display: none;
}

.lyrics-block p {
  margin: 2px 0;
  color: var(--lyrics-inactive-color, #aaa);
  font-size: 34px;
  line-height: 1.6;
  text-align: left;
  opacity: 0.65; 
}

.lyrics-block.active p {
  color: var(--lyrics-active-color, #fff) !important;
  font-size: 36px;
  font-weight: 700;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.7); /* 增强发光效果 */
  opacity: 1;
}



/* ==================== 播放列表新样式 ==================== */

#playlistInner li {
  padding: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#playlistInner li.active {
  background: rgba(255, 203, 5, 0.15);
  border-left: 3px solid #ffcb05;
}

.playlist-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  min-height: 70px;
}

.item-cover {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
}

.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
  opacity: 0;
}

.cover-img.loaded {
  opacity: 1;
}

.item-info {
  flex: 1;
  min-width: 0;
}

.song-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.artist-name {
  font-size: 12px;
  color: #ccc;
  opacity: 0.8;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-actions {
  display: flex;
  gap: 8px;
}

.item-actions button {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.item-actions button:hover {
  background: rgba(255, 203, 5, 0.2);
  transform: scale(1.1);
}

.item-actions button.delete-btn:hover {
  background: rgba(255, 50, 50, 0.2);
}

.item-actions button img {
  width: 60%;
  height: 60%;
  object-fit: contain;
}