/* 音乐页：唱片架 + CD 播放页（继承全站纸质风与亮暗变量） */

/* ---------- 唱片架列表 ---------- */
.music-head { text-align: center; padding: 36px 0 10px; }
.music-head h1 { letter-spacing: 8px; font-size: 1.9rem; margin: 0; color: var(--ink); }
.music-sub { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }

.song-list { max-width: 720px; margin: 26px auto 60px; padding: 0 20px; }
.song-row {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px; margin: 0 0 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); transition: all .18s;
}
.song-row:hover { border-color: var(--accent); transform: translateX(4px); }
.song-no { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; min-width: 24px; }
.mini-disc {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  background:
    radial-gradient(circle, #c9ae76 0 24%, transparent 24.5%),
    repeating-radial-gradient(circle, rgba(255,255,255,.05) 0 1px, transparent 1px 3px),
    radial-gradient(circle, #1b1611 0 40%, #221b15 70%, #14100c 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 1px 3px rgba(0, 0, 0, .2);
}
.song-title { flex: 1; font-size: 1.02rem; }
.song-title small { color: var(--muted); font-size: .8rem; margin-left: 8px; }
.song-dur { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }

/* ---------- 唱片架页的唱机 + 列表/歌词切换 ----------
 * 唱机与播放页（.disc-wrap）完全同款；点歌本页播放，
 * 播放列表原地淡出换成歌词区，可随时切回（音乐不停）。 */
/* ---------- 唱片架：唱机在左，曲目列表/歌词在右 ----------
   与播放页 song.html 同一套分栏语言。关键前提：.wrap 默认只有 720px，
   两栏前必须先把容器放宽——否则右侧会被 356px 的唱机挤到只剩两百多像素。 */
/* 唱片架页：右栏（曲目列表/歌词）原本撑到 682，短句歌词空得晃眼。
   容器收到 880，右栏落在 442，与播放页的 438 基本齐平，两页视觉一致。 */
body.page-music-index .wrap { max-width: 880px; }
/* 播放页：歌词多是短句，右栏给到 520 就空得晃眼。
   容器收窄到 920，右栏落在 440 上下，左栏唱机尺寸不动。 */
body.page-music-song .wrap { max-width: 920px; }
.shelf-layout {
  display: flex; gap: 42px; align-items: flex-start;
  margin: 0 auto;
}
.shelf-layout .deck { flex: 0 0 356px; max-width: 356px; margin: 0; }
.shelf-layout .deck-stage { flex: 1 1 auto; min-width: 0; max-width: none; margin: 0; padding: 0; }

.deck { max-width: 356px; margin: 6px auto 0; }
.deck-meta { text-align: center; margin-top: 14px; min-height: 3.2em; }
.deck-title { font-size: 1.08rem; letter-spacing: 1px; color: var(--ink); margin: 0; }
.deck-dur { color: var(--muted); font-size: .8rem; margin: 4px 0 0; font-variant-numeric: tabular-nums; }

.deck-stage {
  max-width: 900px; margin: 20px auto 60px; padding: 0 20px;
  display: grid;
}
.deck-stage > * { grid-area: 1 / 1; min-width: 0; transition: opacity .32s ease, transform .32s ease, visibility .32s; }
.deck-stage .song-list { margin: 0; padding: 0; align-self: start; }
.deck-stage .deck-lyrics { align-self: start; }
.deck-stage.show-lyrics .song-list { opacity: 0; transform: translateY(-12px); visibility: hidden; pointer-events: none; }
.deck-lyrics { opacity: 0; transform: translateY(12px); visibility: hidden; pointer-events: none; }
.deck-stage.show-lyrics .deck-lyrics { opacity: 1; transform: none; visibility: visible; pointer-events: auto; }

/* 「← 曲目列表」放在左栏唱机下方：右栏歌词框顶边才能和唱机顶边齐平。
   显隐跟右栏歌词态同步（body.showing-lyrics 由 music.js 切换）。 */
.lyr-back {
  display: none; margin: 10px auto 0; border: none; background: none;
  color: var(--muted); font-size: .9rem; cursor: pointer; text-align: center;
  /* 「← 曲目列表」文字本身只有 21 高，手机上点不中：padding 撑出可点区，负 margin 抵消 */
  padding: 10px 14px; margin: 0 auto 0;
}
.lyr-back:hover { color: var(--accent); }
body.showing-lyrics .lyr-back { display: block; }
/* 列表页歌词区：固定高度（播放页的 .lyrics-box 是 flex 拉伸，这里直接限高） */
.deck-lyrics .lyrics-box { min-height: 0; height: clamp(420px, 56vh, 560px); }

/* 正在播放的那一行：描边点亮 + 小唱片跟着转 */
.song-row.cur { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0, 0, 0, .10); }
.song-row.cur .mini-disc { animation: disc-spin 4s linear infinite; }
.song-row.cur .song-no { color: var(--accent); }

/* ---------- CD 播放页 ---------- */
.song-page { max-width: 960px; margin: 0 auto; padding: 18px 20px 40px; }
.song-back {
  display: inline-block; color: var(--muted); text-decoration: none;
  font-size: .9rem; margin-bottom: 10px;
  /* 盒高只有 27，手机上偏小：padding 撑到 43 的可点区，负 margin 抵消版式变化 */
  padding: 8px 10px; margin: -8px -10px 2px;
}
.song-back:hover { color: var(--accent); }

.song-layout { display: flex; gap: 42px; align-items: stretch; }
.song-left { flex: 0 0 356px; display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 8px; }

/* 唱机底座：深胡桃木面板，黑胶转盘嵌在左边，唱臂在右上 */
.disc-wrap {
  position: relative;
  width: 356px; max-width: 100%;
  padding: 24px 22px 30px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 226, 168, .10), transparent 36%),
    linear-gradient(168deg, #35291d 0%, #2c2116 52%, #231b11 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 232, 190, .16),
    inset 0 0 0 1px rgba(0, 0, 0, .38),
    0 16px 34px rgba(0, 0, 0, .28);
}
/* 转盘轴心：盘面正中的小金属点，透过黑胶中孔看得见 */
.disc-wrap::after {
  content: ''; position: absolute; left: 22px; top: 24px;
  width: var(--disc-size); aspect-ratio: 1; border-radius: 50%;
  pointer-events: none;
}

/* 黑胶唱片：黑盘 + 细槽纹 + 随盘旋转的纸标签 */
.disc {
  --disc-size: 300px;
  width: var(--disc-size); aspect-ratio: 1; border-radius: 50%;
  cursor: pointer; position: relative;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .07);
  animation: disc-spin 18s linear infinite;
  animation-play-state: paused;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .09) 0 16%, transparent 36% 60%, rgba(255, 255, 255, .05) 78%, transparent),
    repeating-radial-gradient(circle, rgba(255, 255, 255, .042) 0 1px, transparent 1px 4px),
    radial-gradient(circle, #1b1611 0 34%, #221b15 62%, #16110d 86%, #100c09 100%);
}
/* 纸标签：中心的米色圆贴，印着歌名（跟着唱片转，拟物） */
.disc .disc-label {
  position: absolute; left: 50%; top: 50%;
  width: 35%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 11%;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, .2), transparent 58%),
    linear-gradient(160deg, #e3cf9f, #c6ab74);
  box-shadow: inset 0 0 0 1px rgba(84, 66, 34, .42), 0 0 0 1px rgba(0, 0, 0, .3);
  /* 字距收紧、padding 收窄、允许在字之间折行：
     手机上唱片变小，六个字的歌名（如「与书有关的诗」）过去会被 overflow 切掉尾巴 */
  color: #3c3223; font-size: .68rem; line-height: 1.35; letter-spacing: .3px;
  overflow-wrap: anywhere; overflow: hidden;
}
/* 中孔：真唱片是通的，露一点底座色 */
.disc .disc-label::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 15%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #17120d;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6);
}
.playing .disc { animation-play-state: running; }
@keyframes disc-spin { to { transform: rotate(360deg); } }

/* 唱臂：支点在右上，暂停时水平停在托架上（针尖悬在盘缘外），
 * 播放时逆时针（负角）让臂端下落搭向盘面——正角会向上翘，方向别搞反 */
.tone-arm {
  position: absolute; right: 16px; top: 18px;
  width: 46%; height: 7px;
  border-radius: 4px;
  transform-origin: 92% 50%;
  transform: rotate(0deg);
  transition: transform .8s cubic-bezier(.3, .8, .3, 1);
  background: linear-gradient(90deg, #93887a, #cbc2af 55%, #a99e88);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .3);
  z-index: 2;
}
/* 针头 */
.tone-arm::before {
  content: ''; position: absolute; left: -8px; top: -2px;
  width: 14px; height: 11px; border-radius: 2px;
  background: linear-gradient(180deg, #d8d0bd, #9a8f78);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
/* 支点轴座 */
.tone-arm::after {
  content: ''; position: absolute; right: -6px; top: 50%;
  width: 16px; height: 16px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #b7ac93, #6d6250 62%, #453c2c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .4), 0 2px 4px rgba(0, 0, 0, .4);
}
.playing .tone-arm { transform: rotate(-26deg); }

.song-meta { text-align: center; }
.song-meta h1 { font-size: 1.5rem; margin: 0; letter-spacing: 2px; color: var(--ink); }
.song-meta .sub { color: var(--muted); font-size: .85rem; margin-top: 6px; }

/* 控制区 */
.ctrl { display: flex; align-items: center; gap: 14px; width: 100%; }
.ctrl button.pv, .ctrl button.nx {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 1.05rem; cursor: pointer; transition: all .2s;
}
.ctrl button.pv:hover, .ctrl button.nx:hover { border-color: var(--accent); color: var(--accent); }
.play-btn {
  width: 58px; height: 58px; border-radius: 50%;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-size: 1.4rem; cursor: pointer; transition: transform .15s;
  display: flex; align-items: center; justify-content: center;
}
.play-btn:hover { transform: scale(1.06); }
.play-btn .ico-pause { display: none; }
.playing .play-btn .ico-pause { display: inline; }
.playing .play-btn .ico-play { display: none; }

.bar { width: 100%; }
.bar input[type=range] {
  width: 100%; -webkit-appearance: none; appearance: none; height: 4px;
  background: var(--line); border-radius: 999px; outline: none; cursor: pointer;
}
.bar input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--card);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
/* 进度条下的时间字：普通视图去掉——没播放/缓冲时只是两个死数字，看着像坏了；
   校准模式（?tune=1）保留，拖进度标记行首需要看当前时间。 */
.bar-time { display: none; }
body.tune .bar-time { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* 歌词 */
.lyrics-box {
  flex: 1; position: relative; min-height: 420px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.lyrics {
  position: absolute; inset: 0; overflow-y: auto; padding: 16px 28px 55%;
  scroll-behavior: smooth;
  /* 顶部渐隐带收窄到 5%：开头第一行从顶部完整可见，不被 mask 淡化 */
  -webkit-mask-image: linear-gradient(transparent, #000 5%, #000 82%, transparent);
  mask-image: linear-gradient(transparent, #000 5%, #000 82%, transparent);
  scrollbar-width: none;
}
.lyrics::-webkit-scrollbar { display: none; }
.lrc-line {
  padding: 9px 6px; line-height: 1.7; color: var(--muted);
  font-size: 1.02rem; cursor: pointer; transition: color .3s, transform .3s;
  transform-origin: left center;
}
.lrc-line:hover { color: var(--ink-soft); }
.lrc-line.cur { color: var(--accent); font-weight: 600; transform: scale(1.045); }
.lrc-empty { color: var(--muted); text-align: center; padding-top: 42%; line-height: 2; }

/* 校准模式 */
.tune-bar {
  display: none; max-width: 960px; margin: 14px auto 0;
  background: var(--card); border: 1px dashed var(--accent); border-radius: var(--radius);
  padding: 10px 16px; font-size: .88rem; color: var(--ink-soft);
  align-items: center; gap: 8px; flex-wrap: wrap;
}
body.tune .tune-bar { display: flex; }
.tune-bar b { color: var(--accent); font-variant-numeric: tabular-nums; min-width: 130px; }
.tune-bar button {
  border: 1px solid var(--line); background: var(--paper-2); color: var(--ink);
  border-radius: 8px; padding: 4px 12px; cursor: pointer; font-size: .84rem;
}
.tune-bar button:hover { border-color: var(--accent); color: var(--accent); }
.tune-bar textarea {
  width: 100%; height: 70px; margin-top: 6px; display: none;
  background: var(--paper-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; font-size: .8rem; padding: 6px;
}
.tune-bar.show-out textarea { display: block; }
.tune-hint { font-size: .8rem; color: var(--muted); width: 100%; }

/* ---------- 移动端 ---------- */
/* 中间宽度：两栏挤不下，退回上下堆叠（唱机在上、列表在下） */
@media (max-width: 1000px) {
  .shelf-layout { flex-direction: column; align-items: center; }
  .shelf-layout .deck { flex: 0 0 auto; margin: 0 auto; }
  /* 堆叠时右栏占满整行，限宽跟横排的 442 对齐，别反而比横排还宽 */
  .shelf-layout .deck-stage { width: 100%; max-width: 480px; }
}

@media (max-width: 760px) {
  .song-page { padding: 12px 14px 30px; }
  .song-layout { flex-direction: column; gap: 18px; }
  .song-left { flex: none; width: 100%; }
  .disc-wrap { width: min(292px, 76vw); padding: 18px 16px 24px; }
  .disc { --disc-size: calc(min(292px, 76vw) - 32px); }
  .tone-arm { right: 10px; top: 12px; width: 44%; }
  .lyrics-box { min-height: 52vh; }
  .lyrics { padding: 12px 18px 45%; }
  .lrc-line { font-size: .98rem; padding: 8px 4px; }
  .song-list { padding: 0 12px; }
  .deck { width: min(292px, 76vw); }
  .deck-stage { margin-top: 14px; padding: 0 12px; }
  .shelf-layout { gap: 14px; }
  .shelf-layout .deck-stage { padding: 0 12px; max-width: 100%; }
  .deck-lyrics .lyrics-box { height: 52vh; }
}
