/* ============================================================
   远航星的告别 · Voyaging Star's Farewell
   视觉风格参考 飞行雪绒 | Fleet Snowfluff
   ============================================================ */

:root {
  --bg-deep: #0f1123;
  --bg-light: #242446;
  --accent-pink: #ffb7c5;
  --accent-blue: #a0c4ff;
  --text-glow: #e0e6ff;
  --glass: rgba(18, 20, 40, 0.75);
  --border: rgba(160, 196, 255, 0.3);
  --z-noise: 1;
  --z-star: 0;
  --z-sprite: 5;
  --z-card: 10;
  --z-nav: 50;
  --z-ui: 100;
  --font-pixel: 'DotGothic16', 'Zpix', 'Fusion Pixel 12px', 'Courier New', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 70% 55% at 50% -5%, #3a3a6a 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 90%, rgba(160, 196, 255, 0.10) 0%, transparent 70%),
    radial-gradient(ellipse 45% 40% at 10% 85%, rgba(255, 183, 197, 0.08) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg-deep) 0%, #1a1a2e 100%);
  font-family: var(--font-pixel);
  color: var(--text-glow);
  overflow: hidden;
  user-select: none;
  cursor: default;
}

button, input { font-family: inherit; }
button:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

/* 噪点 */
.noise {
  position: fixed;
  inset: 0;
  background: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)" opacity="0.04"/%3E%3C/svg%3E');
  pointer-events: none;
  z-index: var(--z-noise);
}

/* 星空画布 */
.starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-star);
}

/* === 主区 / 中央卡片 === */
.main-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 20px 150px;
  z-index: var(--z-card);
  pointer-events: none;
}

.center-card {
  position: relative;
  width: 760px;
  max-width: 100%;
  min-height: 540px;
  max-height: 100%;
  padding: 32px 38px 20px;
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.55), inset 0 0 60px rgba(160, 196, 255, 0.04);
  animation: float 6s ease-in-out infinite;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.corner {
  position: absolute;
  width: 5px; height: 5px;
  background: var(--accent-pink);
  box-shadow: 0 0 5px var(--accent-pink);
}
.tl { top: -1px; left: -1px; }
.tr { top: -1px; right: -1px; }
.bl { bottom: -1px; left: -1px; }
.br { bottom: -1px; right: -1px; }

/* 曲目头部 */
.track-head { display: flex; align-items: center; gap: 34px; flex-shrink: 0; }

.disc-large {
  position: relative;
  width: 168px; height: 168px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 30px rgba(160, 196, 255, 0.25), 0 0 60px rgba(255, 183, 197, 0.12);
  animation: disc-spin 18s linear infinite paused;
}
.disc-large.spinning { animation-play-state: running; }
.disc-large img { width: 100%; height: 100%; object-fit: cover; display: block; }
.disc-hole {
  position: absolute;
  top: 50%; left: 50%;
  width: 26px; height: 26px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--bg-deep);
  border: 3px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.25), inset 0 0 6px #000;
  z-index: 2;
}
.disc-ring {
  position: absolute; inset: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}
@keyframes disc-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.track-meta { min-width: 0; flex: 1; }

.album-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--accent-blue);
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(160, 196, 255, 0.3);
}
.album-tag small {
  font-size: 11px;
  opacity: 0.6;
  color: var(--text-glow);
  letter-spacing: 0.5px;
}
.deco-pixel {
  display: inline-block;
  width: 8px; height: 8px;
  background: currentColor;
  box-shadow: 0 0 5px currentColor;
  vertical-align: middle;
}

.track-title {
  margin: 14px 0 2px;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.15;
  letter-spacing: 3px;
  background: linear-gradient(90deg, #ffffff 0%, var(--accent-pink) 45%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 183, 197, 0.35));
}
.track-title-en {
  font-size: 15px;
  color: var(--accent-blue);
  opacity: 0.85;
  letter-spacing: 1.5px;
}
.credits {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: rgba(224, 230, 255, 0.6);
  letter-spacing: 0.5px;
}

/* 歌词 */
.lyrics-wrapper {
  position: relative;
  flex: 1 1 auto;
  min-height: 130px;
  margin-top: 14px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent 0%, black 18%, black 82%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 18%, black 82%, transparent 100%);
}
.lyrics-scroll {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
/* 未播放时只有占位提示，让它垂直居中，避免中间大片留白 */
.lyrics-wrapper:has(.lrc-line.placeholder) .lyrics-scroll { top: calc(50% - 17px); }
.lrc-line {
  text-align: center;
  padding: 7px 0;
  color: rgba(255, 255, 255, 0.38);
  font-size: 15px;
  transition: all 0.4s ease;
  min-height: 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  line-height: 1.45;
}
.lrc-line.active {
  color: var(--accent-pink);
  text-shadow: 0 0 10px rgba(255, 183, 197, 0.6);
  font-size: 17px;
  transform: scale(1.04);
  font-weight: bold;
}
.lrc-trans {
  font-size: 0.8em;
  opacity: 0.75;
  margin-top: 3px;
  font-weight: normal;
  color: rgba(255, 255, 255, 0.55);
  transition: color 0.4s;
}
.lrc-line.active .lrc-trans { color: var(--accent-blue); opacity: 1; }
.lrc-line.placeholder {
  color: var(--accent-pink);
  opacity: 0.7;
  font-size: 14px;
  letter-spacing: 1px;
  animation: hint-breathe 3s ease-in-out infinite;
}
@keyframes hint-breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

.card-footer {
  position: relative;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: rgba(224, 230, 255, 0.45);
}
#play-hint { flex: 1; text-align: center; color: var(--accent-pink); opacity: 0.85; }
/* 版权固定在右侧；+6px 抵消页脚上内边距，使文字与状态提示同一基线 */
.card-footer > span:last-child {
  position: absolute;
  right: 0;
  top: calc(50% + 6px);
  transform: translateY(-50%);
}

/* === 播放器 === */
.player-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: var(--z-ui);
  pointer-events: none;
  min-width: 0;
  max-width: 100vw;
}
.player-container, .player-container * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

.player-capsule {
  position: relative;
  height: 58px;
  width: 440px;
  background: rgba(15, 17, 35, 0.95);
  border: 1px solid var(--border);
  border-radius: 50px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 14px;
  transition: height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
              width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
              border-radius 0.4s ease, border-color 0.3s, transform 0.4s ease;
  overflow: hidden;
  pointer-events: auto;
  min-width: 0;
}
.player-capsule.expanded, .player-capsule.manual-expand {
  height: 112px;
  width: 580px;
  border-radius: 20px;
  border-color: var(--accent-blue);
  box-shadow: 0 8px 30px rgba(160, 196, 255, 0.2);
  transform: translateY(-8px);
  justify-content: space-evenly;
}
@media (hover: hover) {
  .player-capsule:hover {
    height: 112px; width: 580px;
    border-radius: 20px;
    border-color: var(--accent-blue);
    box-shadow: 0 8px 30px rgba(160, 196, 255, 0.2);
    transform: translateY(-8px);
    justify-content: space-evenly;
  }
}

.p-compact { display: flex; align-items: center; gap: 12px; min-height: 54px; min-width: 0; flex-shrink: 0; }

/* 方形专辑封面：静态展示，不旋转 */
.album-cover {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 12px rgba(160, 196, 255, 0.28), 0 0 22px rgba(255, 183, 197, 0.12);
}
.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.song-name-wrapper {
  flex: 1; min-width: 0;
  overflow: hidden;
  position: relative;
  height: 24px;
  mask-image: linear-gradient(90deg, transparent 0%, black 6%, black 94%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 6%, black 94%, transparent 100%);
}
.song-name-scroll { white-space: nowrap; display: inline-block; padding: 0 6px; line-height: 24px; }
.song-name-scroll.scrolling { animation: marquee-scroll var(--scroll-duration, 12s) linear infinite; }
@keyframes marquee-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

.btn-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: all 0.2s;
  flex-shrink: 0;
}
@media (hover: hover) {
  .btn-circle:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--accent-pink); box-shadow: 0 0 8px var(--accent-pink); transform: scale(1.05); }
}
.icon-svg { width: 16px; height: 16px; fill: currentColor; }

.btn-play-main {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-blue));
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--bg-deep);
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 0 15px rgba(255, 183, 197, 0.35);
}
.btn-play-main .icon-svg { width: 20px; height: 20px; fill: #fff; }
@media (hover: hover) { .btn-play-main:hover { transform: scale(1.1); box-shadow: 0 0 25px rgba(255, 183, 197, 0.55); } }

.p-expand {
  display: flex; align-items: center; gap: 14px;
  opacity: 0; max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease 0.1s, max-height 0.3s ease;
  padding: 0 4px;
}
.player-capsule.expanded .p-expand, .player-capsule.manual-expand .p-expand { opacity: 1; max-height: 40px; }
@media (hover: hover) { .player-capsule:hover .p-expand { opacity: 1; max-height: 40px; } }

.progress-wrapper { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.time-label { font-size: 11px; font-family: monospace; color: rgba(224, 230, 255, 0.6); white-space: nowrap; min-width: 36px; flex-shrink: 0; }
.progress-track { position: relative; flex: 1; height: 16px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.progress-bg { position: absolute; top: 50%; left: 0; right: 0; height: 4px; transform: translateY(-50%); background: rgba(255, 255, 255, 0.12); border-radius: 2px; }
.progress-fill { position: absolute; top: 50%; left: 0; width: 0%; height: 4px; transform: translateY(-50%); background: linear-gradient(90deg, var(--accent-blue), var(--accent-pink)); border-radius: 2px; pointer-events: none; }
.progress-thumb { position: absolute; top: 50%; left: 0%; width: 12px; height: 12px; background: var(--accent-pink); border-radius: 50%; transform: translate(-50%, -50%) scale(0); box-shadow: 0 0 6px var(--accent-pink); transition: transform 0.15s ease; pointer-events: none; }
.progress-track.dragging .progress-thumb { transform: translate(-50%, -50%) scale(1); }
@media (hover: hover) { .progress-track:hover .progress-thumb { transform: translate(-50%, -50%) scale(1); } }

.vol-wrap { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.vol-svg { width: 14px; height: 14px; fill: rgba(224, 230, 255, 0.55); cursor: pointer; }
.vol-track { width: 62px !important; }
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.15);
  background-image: linear-gradient(90deg, var(--accent-blue), var(--accent-pink));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  display: block; margin: 0; height: 4px; border-radius: 2px;
}
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; background: transparent; border-radius: 2px; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  height: 12px; width: 12px;
  background: var(--accent-pink);
  margin-top: -4px; border-radius: 50%;
  box-shadow: 0 0 5px var(--accent-pink);
  transition: transform 0.1s;
}
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.2); background: #fff; }

/* === 飘落像素 === */
.sprite { position: fixed; pointer-events: none; z-index: var(--z-sprite); image-rendering: pixelated; will-change: transform, opacity; }

/* === 响应式 === */
@media (max-width: 900px) {
  .main-wrapper { inset: 0; padding: 86px 16px 140px; }
  .center-card { padding: 24px 22px 16px; min-height: auto; }
  .track-head { gap: 22px; }
  .disc-large { width: 128px; height: 128px; }
  .credits { font-size: 11px; }
  .player-container { bottom: 18px; width: calc(100vw - 28px); max-width: calc(100vw - 28px); }
  .player-capsule, .player-capsule:hover, .player-capsule.expanded, .player-capsule.manual-expand { width: 100%; max-width: 100%; height: 104px; border-radius: 20px; transform: none; justify-content: space-evenly; }
  .player-capsule .p-expand, .player-capsule:hover .p-expand { opacity: 1; max-height: 40px; }
  .vol-wrap { display: none; }
}

@media (max-width: 600px) {
  .track-head { flex-direction: column; text-align: center; gap: 14px; }
  .disc-large { width: 104px; height: 104px; }
  .album-tag { flex-direction: column; align-items: center; gap: 3px; }
  .album-tag small { display: block; width: 100%; text-align: center; font-size: 10px; }
  .credits { align-items: center; }
  .track-title { letter-spacing: 2px; }
  .lyrics-wrapper { min-height: 110px; }
  .lrc-line { font-size: 13px; }
  .lrc-line.active { font-size: 15px; }
  .card-footer { font-size: 10px; flex-wrap: wrap; justify-content: center; gap: 4px 10px; }
  .card-footer span:last-child { display: none; }
  .p-compact { gap: 8px; }
  .btn-circle { width: 30px; height: 30px; }
  .btn-play-main { width: 40px; height: 40px; }
  .time-label { min-width: 32px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .center-card, .disc-large { animation: none !important; }
  .lyrics-scroll { transition: none; }
}

/* === 桌面：右下角方形播放器面板（边长约为屏幕高度的 2/5） ===
   中央卡片保持原有居中位置，此处只重排播放器，不改动主区布局。 */
@media (min-width: 700px) {
  :root { --panel-size: min(40vh, 40vw); }

  .player-container {
    left: auto;
    right: clamp(8px, 1.6vw, 22px);
    bottom: clamp(8px, 1.4vh, 18px);
    transform: none;
    width: var(--panel-size);
    height: var(--panel-size);
    max-width: none;
  }

  .player-capsule,
  .player-capsule:hover,
  .player-capsule.expanded,
  .player-capsule.manual-expand {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 18px;
    padding: 14px 16px 12px;
    transform: none;
    justify-content: space-between;
    border-color: rgba(160, 196, 255, 0.42);
    box-shadow: 0 10px 38px rgba(0, 0, 0, 0.65);
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
  }
  .p-compact {
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-height: 0;
    width: 100%;
  }

  .album-cover {
    width: min(22vh, 54%);
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    border-width: 2px;
    box-shadow: 0 0 26px rgba(160, 196, 255, 0.32), 0 0 50px rgba(255, 183, 197, 0.16);
  }

  .song-name-wrapper {
    flex: 0 0 auto;
    width: 100%;
    height: 22px;
    text-align: center;
    mask-image: none;
    -webkit-mask-image: none;
  }
  .song-name-scroll { font-size: 13px; line-height: 22px; }
  .btn-play-main { width: 46px; height: 46px; }
  .btn-play-main .icon-svg { width: 21px; height: 21px; }

  .p-expand,
  .player-capsule:hover .p-expand,
  .player-capsule.expanded .p-expand,
  .player-capsule.manual-expand .p-expand {
    opacity: 1;
    max-height: none;
    overflow: visible;
    flex-direction: column;
    flex-shrink: 0;
    gap: 7px;
    padding: 0;
  }
  .progress-wrapper { width: 100%; }
  .vol-wrap { display: flex; width: 100%; justify-content: center; gap: 7px; }
  .vol-svg { width: 13px; height: 13px; }
  .vol-track { width: 58% !important; }
  .time-label { font-size: 10px; min-width: 32px; }
}
