/* ============================================================
   Folia Lite — 样式表
   阶段 1：布局 + 播放器外观
   后面阶段会在这里加歌词动画、取色主题
   ============================================================ */

:root {
  --accent: #7c9cff;          /* 主题色，阶段 3 会由封面自动取色覆盖 */
  --accent-soft: rgba(124, 156, 255, 0.35);
  --text: #f2f4f8;
  --text-dim: rgba(242, 244, 248, 0.55);
  --bar-h: 128px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: #0a0c12;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ============ 背景层 ============ */
.bg-layer {
  position: fixed;
  inset: 0;
  background: #0a0c12;
  transition: background 1.2s ease;
  z-index: 0;
}

/* 背景上的柔光，让画面不至于死黑 */
.bg-blur {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 30% 20%, var(--accent-soft), transparent 55%),
    radial-gradient(circle at 75% 75%, rgba(255, 120, 180, 0.18), transparent 55%);
  filter: blur(80px);
  transition: background 1.2s ease;
  z-index: 1;
  pointer-events: none;
}

/* ============ 主舞台 ============ */
.stage {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 32px 24px calc(var(--bar-h) + 16px);
  min-height: 0;
}

/* ---------- 封面 ---------- */
.cover-wrap {
  flex-shrink: 0;
  margin-top: auto;
}

.cover {
  width: 152px;
  height: 152px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.07) inset;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

body.playing .cover {
  transform: scale(1.04);
}

/* ---------- 歌名 / 歌手 ---------- */
.meta {
  text-align: center;
  flex-shrink: 0;
}

.title {
  font-size: 1.32rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 5px;
}

.artist {
  font-size: 0.84rem;
  color: var(--text-dim);
}

/* ---------- 歌词区 ---------- */
.lyrics {
  width: 100%;
  max-width: 640px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  text-align: center;
  padding: 40px 0;
  scrollbar-width: none;
  /* 上下淡出，营造"歌词从远处浮现"的感觉 */
  mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
  -webkit-mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}

.lyrics::-webkit-scrollbar { display: none; }

.lyric-line {
  font-size: 1.02rem;
  line-height: 1.45;
  padding: 7px 12px;
  margin: 0;
  color: var(--text-dim);
  opacity: 0.42;
  transform: scale(0.96);
  transform-origin: center;
  transition:
    color 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    text-shadow 0.35s ease;
  cursor: pointer;
}

/* 相邻行：稍微亮一点，做视觉过渡 */
.lyric-line.near {
  opacity: 0.62;
  transform: scale(0.98);
}

/* 已唱过：暗下去 */
.lyric-line.passed {
  opacity: 0.28;
}

/* 当前行：最大最亮 */
.lyric-line.active {
  font-size: 1.28rem;
  font-weight: 600;
  color: #fff;
  opacity: 1;
  transform: scale(1);
  text-shadow: 0 0 24px var(--accent-soft), 0 2px 12px rgba(0, 0, 0, 0.5);
}

/* 悬停提示可点击跳转 */
.lyric-line:hover:not(.active) {
  opacity: 0.85;
  color: var(--text);
}

/* ============ 逐字高亮（卡拉OK效果）============ */
/* 每个字一个 span，用 --cp (0~1) 控制点亮程度 */
.lyric-line .ch {
  display: inline-block;
  white-space: pre;
  color: rgba(255, 255, 255, 0.38);
  transition: color 0.12s linear, text-shadow 0.12s linear;
}

/* 已点亮的字：纯白 + 发光 */
.lyric-line.active .ch {
  color: rgba(255, 255, 255, calc(0.38 + 0.62 * var(--cp, 0)));
  text-shadow: 0 0 calc(18px * var(--cp, 0)) var(--accent);
}

/* 正在唱的那个字：额外来一点强调 */
.lyric-line.active .ch {
  transform: translateY(calc(-1.5px * var(--cp, 0)));
}

/* ============ 底部播放栏 ============ */
.player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  height: var(--bar-h);
  padding: 18px 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(to top, rgba(6, 8, 14, 0.92), rgba(6, 8, 14, 0.55));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ---------- 进度条 ---------- */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.time {
  font-size: 0.76rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
}
.time:last-child { text-align: right; }

.progress {
  position: relative;
  flex: 1;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.progress-bg {
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
}

.progress-fill {
  position: absolute;
  left: 0;
  height: 4px;
  width: 0%;
  border-radius: 2px;
  background: var(--accent);
  transition: background 1.2s ease;
}

.progress-thumb {
  position: absolute;
  left: 0%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transform: translateX(-50%) scale(0);
  transition: transform 0.18s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.progress:hover .progress-thumb { transform: translateX(-50%) scale(1); }

/* ---------- 控制按钮 ---------- */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.btn {
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, opacity 0.18s;
}

.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }
.btn:active:not(:disabled) { transform: scale(0.96); }

.btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

/* 播放按钮——主按钮 */
.btn.primary {
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.1rem;
  background: var(--accent);
  border-color: transparent;
  color: #0a0c12;
  font-weight: 700;
  transition: background 1.2s ease, transform 0.12s;
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.12);
}

/* ---------- 音量 ---------- */
.volume-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.vol-icon {
  font-size: 0.9rem;
  cursor: pointer;
  opacity: 0.8;
}

.volume {
  -webkit-appearance: none;
  appearance: none;
  width: 88px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
  outline: none;
  cursor: pointer;
}

.volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

/* ============ 拖拽提示遮罩 ============ */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 14, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s;
  pointer-events: none;
}

body.dragging .drop-overlay {
  opacity: 1;
  visibility: visible;
}

.drop-box {
  text-align: center;
  padding: 48px 72px;
  border: 2px dashed var(--accent);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
  transform: scale(0.94);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

body.dragging .drop-box {
  transform: scale(1);
}

.drop-icon {
  font-size: 2.6rem;
  margin-bottom: 14px;
  color: var(--accent);
  animation: dropBounce 1.4s ease-in-out infinite;
}

@keyframes dropBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

.drop-text {
  font-size: 1.22rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.drop-sub {
  font-size: 0.84rem;
  color: var(--text-dim);
}

/* ============ 播放列表面板 ============ */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: var(--bar-h);
  width: 320px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: rgba(10, 12, 18, 0.92);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  transform: translateX(100%);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.panel.open {
  transform: translateX(0);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.panel-count {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

.panel-list::-webkit-scrollbar { width: 6px; }
.panel-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.pl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.16s;
}

.pl-row:hover { background: rgba(255, 255, 255, 0.06); }

.pl-row.current {
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 3px 0 0 var(--accent);
}

.pl-num {
  width: 20px;
  flex-shrink: 0;
  font-size: 0.76rem;
  color: var(--text-dim);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pl-row.current .pl-num {
  color: var(--accent);
}

.pl-info { min-width: 0; flex: 1; }

.pl-title {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-row.current .pl-title {
  font-weight: 600;
  color: #fff;
}

.pl-artist {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.panel-foot {
  flex-shrink: 0;
  padding: 12px 20px 16px;
  font-size: 0.72rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  line-height: 1.5;
}

/* 列表按钮激活态 */
.btn.on {
  background: var(--accent);
  border-color: transparent;
  color: #0a0c12;
  font-weight: 600;
}

/* 圆形图标按钮 */
.btn.icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 0.9rem;
}

/* ============ 响应式 ============ */

/* 中等屏幕：收紧间距 */
@media (max-width: 900px) {
  .cover { width: 132px; height: 132px; }
  .lyrics { max-width: 92%; }
  .panel { width: 300px; }
}

/* 手机：重排控制栏，避免按钮换行 */
@media (max-width: 640px) {
  :root { --bar-h: 138px; }

  .stage {
    padding: 20px 16px calc(var(--bar-h) + 8px);
    gap: 12px;
  }

  .cover { width: 108px; height: 108px; border-radius: 12px; }
  .title { font-size: 1.06rem; }
  .artist { font-size: 0.78rem; }

  /* 歌词：手机上加大对比，否则看不清 */
  .lyrics {
    max-width: 100%;
    padding: 24px 0;
    mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent);
    -webkit-mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent);
  }

  .lyric-line {
    font-size: 1rem;
    padding: 6px 8px;
    opacity: 0.55;              /* 手机上整体调亮 */
  }

  .lyric-line.near { opacity: 0.75; }
  .lyric-line.passed { opacity: 0.38; }

  .lyric-line.active {
    font-size: 1.18rem;
    text-shadow: 0 0 20px var(--accent), 0 2px 10px rgba(0, 0, 0, 0.6);
  }

  .lyric-line .ch { color: rgba(255, 255, 255, 0.5); }

  /* 播放栏 */
  .player-bar {
    padding: 12px 14px 14px;
    gap: 10px;
  }

  .progress-wrap { gap: 10px; }
  .time { font-size: 0.7rem; min-width: 34px; }

  /* 控制按钮：网格布局，绝不换行 */
  .controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: nowrap;          /* 关键：禁止折行 */
    width: 100%;
  }

  .btn {
    flex: 0 0 auto;
    padding: 8px 8px;
    font-size: 0.7rem;
    white-space: nowrap;
    border-radius: 9px;
  }

  /* 手机上把文字按钮改成紧凑圆形图标 */
  #btnPick, #btnCover, #btnKara {
    font-size: 0;
    line-height: 0;
    padding: 0;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
  }

  #btnPick::before { content: '\1F4C2'; font-size: 0.95rem; line-height: 1; }
  #btnCover::before { content: '\1F5BC'; font-size: 0.95rem; line-height: 1; }
  #btnKara::before { content: '\2728'; font-size: 0.95rem; line-height: 1; }
  #btnKara.on { background: var(--accent); }

  /* 播放按钮最醒目 */
  .btn.primary {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    padding: 0;
    font-size: 1.05rem;
    border-radius: 50%;
  }

  .btn.icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    padding: 0;
    font-size: 0.9rem;
    border-radius: 50%;
  }

  .volume-wrap { display: none; }
  .panel { width: 100%; }
}

/* 超小屏：进一步压缩 */
@media (max-width: 360px) {
  .cover { width: 92px; height: 92px; }
  .title { font-size: 0.98rem; }
  .lyric-line { font-size: 0.94rem; }
  .lyric-line.active { font-size: 1.08rem; }
}
