/* ==========================================================================
   山雀 · 十万嬉皮 · 秦皇岛  —  qingmuy.top
   单页：一张专辑封面 + 一个播放键 + 左右切歌 + 一栏随歌声淡入淡出的歌词
   ========================================================================== */

:root {
  --bg:        #070707;
  --ink:       #f4f1ea;
  --muted:     #8b877e;
  --gold:      #e7d6a6;
  --gold-soft: rgba(231, 214, 166, .34);
  --gold-glow: rgba(231, 214, 166, .30);

  --sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB",
          "Microsoft YaHei UI", "Microsoft YaHei", "Source Han Sans SC",
          "Noto Sans CJK SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC",
           "Noto Serif SC", "SimSun", "Songti TC", Georgia, "Times New Roman", serif;

  --ease: cubic-bezier(.22, 1, .36, 1);

  /* 封面高度：横图（山雀）与方图（万能青年旅店）各一套 */
  --art-h:    clamp(118px, 23vh, 268px);
  --art-h-sq: clamp(132px, 27vh, 316px);
  /* 歌词字号 */
  --line-size: clamp(24px, 2.1vw + 12px, 42px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* 方图封面（万能青年旅店）用更高一档的封面高度 */
body.is-square { --art-h: var(--art-h-sq); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------------------------------------------------------- 氛围层 */

.ambient {
  position: fixed;
  inset: -14vmax;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.ambient i {
  position: absolute;
  inset: 0;
  display: block;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: blur(46px) saturate(115%);
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 1.6s ease;
}
/* 首屏兜底：JS 接管前先铺山雀的雾底 */
.ambient #amb0 { background-image: url("assets/cover-shanque-blur.jpg"); }
/* --amb 由 JS 按封面明暗逐首写入：山雀的黑底给足，赭金色的同名专辑压暗 */
.ambient i.is-on { opacity: var(--amb, .46); }
body.is-playing .ambient i.is-on {
  opacity: calc(var(--amb, .46) * 1.35);
  animation: drift 64s var(--ease) infinite alternate;
}
@keyframes drift {
  from { transform: scale(1.08) translate3d(-1.2%, -0.8%, 0); }
  to   { transform: scale(1.22) translate3d(1.4%, 1%, 0); }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 78% at 50% 42%, rgba(7, 7, 7, 0) 26%, rgba(7, 7, 7, .62) 68%, rgba(7, 7, 7, .93) 100%),
    linear-gradient(180deg, rgba(7, 7, 7, .82) 0%, rgba(7, 7, 7, .16) 26%,
                    rgba(7, 7, 7, .16) 74%, rgba(7, 7, 7, .88) 100%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- 版心 */

.stage {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2vh, 26px);
  padding: clamp(14px, 2.6vh, 30px) clamp(18px, 4vw, 44px) clamp(10px, 2.1vh, 22px);
}

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  width: 100%;
  max-width: 1180px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .3em;
  color: var(--muted);
  flex: 0 0 auto;
}
.tb-left { display: flex; align-items: baseline; gap: .9em; min-width: 0; }
.tb-title {
  font-size: 13.5px;
  letter-spacing: .38em;
  color: var(--gold);
  white-space: nowrap;
  transition: opacity .5s ease;
}
.tb-sep {
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: .38;
  transform: translateY(-3px);
  flex: 0 0 auto;
}
.tb-right { letter-spacing: .22em; opacity: .8; white-space: nowrap; }
/* 切歌瞬间让文字一起退场 */
body.is-switching .tb-title,
body.is-switching .tb-right,
body.is-switching .art figcaption { opacity: 0; }

/* ---------------------------------------------------------------- 封面 */

.art {
  margin: 0;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.art::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: 150%;
  height: 190%;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, var(--gold-glow), rgba(231, 214, 166, 0) 72%);
  opacity: .5;
  filter: blur(18px);
  transition: opacity 1.2s ease;
  pointer-events: none;
}
body.is-playing .art::before { opacity: .95; }

.art img {
  position: relative;
  display: block;
  width: auto;
  /* 高度由 CSS 定死：srcset 的 sizes 会让浏览器按"密度校正"给出一个偏小的固有尺寸，
     用 max-height 兜不住，必须显式指定高度，各曲目才长得一样整齐 */
  height: var(--art-h);
  max-width: min(86vw, 1400px);
  border-radius: 9px;
  box-shadow:
    0 0 0 1px rgba(231, 214, 166, .16),
    0 26px 60px -26px rgba(0, 0, 0, .96),
    0 3px 18px -6px rgba(0, 0, 0, .8);
  transition: transform .9s var(--ease), box-shadow .9s ease, opacity .34s ease;
}
.art:hover img { transform: translateY(-2px) scale(1.008); }
body.is-playing .art img { box-shadow: 0 0 0 1px rgba(231, 214, 166, .3), 0 30px 74px -26px rgba(0, 0, 0, .98); }
body.is-switching .art img { opacity: 0; transform: translateY(6px) scale(.99); }
body.is-switching .art:hover img { transform: translateY(6px) scale(.99); }

.art figcaption {
  font-size: 10.5px;
  letter-spacing: .24em;
  color: var(--muted);
  opacity: .78;
  transition: opacity .5s ease;
}

/* ---------------------------------------------------------------- 歌词 */

.lyric-pane {
  position: relative;
  flex: 1 1 auto;
  min-height: 240px;
  width: 100%;
  max-width: 940px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 20%, #000 80%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 20%, #000 80%, transparent 100%);
}

.lyrics {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  opacity: 1;
  will-change: transform;
  transition: opacity .34s ease;
}
.lyrics.is-ready { transition: transform 950ms var(--ease), opacity .34s ease; }

.line {
  --d: 3;
  margin: 0;
  padding: .3em .5em;
  text-align: center;
  font-family: var(--serif);
  font-weight: 500;
  font-size: var(--line-size);
  line-height: 1.6;
  letter-spacing: .07em;
  color: var(--ink);
  opacity: max(0, calc(1 - var(--d) * .36));
  filter: blur(calc(var(--d) * .7px));
  transform: scale(calc(1 - var(--d) * .022));
  text-shadow: 0 0 0 rgba(231, 214, 166, 0);
  transition:
    opacity 820ms ease,
    filter 820ms ease,
    transform 900ms var(--ease),
    color 820ms ease,
    text-shadow 900ms ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.line.is-active {
  color: var(--gold);
  text-shadow: 0 0 32px var(--gold-glow), 0 0 90px rgba(231, 214, 166, .14);
}

body.is-idle .lyrics { opacity: .5; }
body.is-idle .line { cursor: default; }
body.is-switching .lyrics { opacity: 0; }

/* ---------------------------------------------------------------- 控制区 */

.controls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
}

.switcher {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 32px);
}

.play {
  position: relative;
  width: 66px;
  height: 66px;
  padding: 0;
  border: 1px solid var(--gold-soft);
  border-radius: 50%;
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(231, 214, 166, .10), rgba(231, 214, 166, 0) 62%),
    rgba(255, 255, 255, .028);
  color: var(--gold);
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: transform .5s var(--ease), border-color .5s ease, background-color .5s ease, box-shadow .6s ease;
}
.play:hover {
  transform: scale(1.06);
  border-color: rgba(231, 214, 166, .62);
  box-shadow: 0 0 34px -6px var(--gold-glow);
}
.play:active { transform: scale(.97); }
.play:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

.play .icon { width: 32px; height: 32px; display: block; }
.play .icon path,
.play .icon rect { fill: currentColor; }

.play .i-pause { opacity: 0; }
.play .i-play  { transition: opacity .28s ease, transform .45s var(--ease); transform-origin: 16px 16px; }
.play .i-pause { transition: opacity .28s ease; }
body.is-playing .play .i-play  { opacity: 0; transform: scale(.72); }
body.is-playing .play .i-pause { opacity: 1; }

/* 左右切歌键 */
.skip {
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(231, 214, 166, .20);
  border-radius: 50%;
  background: rgba(255, 255, 255, .022);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
  transition: color .4s ease, border-color .4s ease, transform .5s var(--ease), opacity .5s ease;
}
.skip svg { width: 19px; height: 19px; display: block; fill: currentColor; }
.skip:hover { color: var(--gold); border-color: rgba(231, 214, 166, .55); transform: scale(1.08); }
.skip:active { transform: scale(.94); }
.skip:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
body.is-switching .skip { opacity: .35; }

/* 播放时的呼吸环 */
.play .ring {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid var(--gold-soft);
  opacity: 0;
  pointer-events: none;
}
body.is-playing .play .ring { animation: breathe 3.6s ease-out infinite; }
@keyframes breathe {
  0%   { opacity: .5; transform: scale(1); }
  70%  { opacity: 0;  transform: scale(1.42); }
  100% { opacity: 0;  transform: scale(1.42); }
}

/* 缓冲中 */
body.is-loading .play { border-color: rgba(231, 214, 166, .7); }
body.is-loading .play .icon { opacity: .45; }
body.is-loading .play::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid transparent;
  border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 曲目指示 */
.dots {
  display: flex;
  align-items: center;
  gap: 9px;
}
.dot {
  width: 5px;
  height: 5px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(139, 135, 126, .5);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .5s ease, width .5s var(--ease), box-shadow .5s ease;
}
.dot:hover { background: rgba(231, 214, 166, .7); }
.dot.is-on {
  width: 18px;
  border-radius: 3px;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}
.dot:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

.hint {
  font-size: 10.5px;
  letter-spacing: .26em;
  color: var(--muted);
  opacity: .72;
  transition: opacity .5s ease;
}
body.is-playing .hint { opacity: 0; }
body.is-switching .hint { opacity: 0; }

/* ---------------------------------------------------------------- 底栏 */

.legal {
  flex: 0 0 auto;
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .35em .55em;
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--muted);
  opacity: .6;
  transition: opacity .5s ease;
  text-align: center;
  line-height: 1.9;
}
.legal:hover { opacity: .95; }
.legal a {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: .35em;
  border-bottom: 1px solid rgba(139, 135, 126, .28);
  padding-bottom: 1px;
  transition: color .35s ease, border-color .35s ease;
}
.legal a:hover { color: var(--gold); border-bottom-color: var(--gold-soft); }
.legal-sep { opacity: .45; }
.beian-badge { display: block; width: 14px; height: 15px; }

/* ---------------------------------------------------------------- 进度发丝线 */

.progress {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  z-index: 6;
  background: rgba(255, 255, 255, .05);
  pointer-events: none;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(231, 214, 166, .28), var(--gold));
  box-shadow: 0 0 14px rgba(231, 214, 166, .45);
  opacity: 0;
  transition: opacity .6s ease;
}
body.is-started .progress i { opacity: 1; }

/* ---------------------------------------------------------------- 响应式 */

@media (max-height: 760px) {
  .art figcaption { display: none; }
  :root { --art-h: clamp(96px, 21vh, 190px); --art-h-sq: clamp(110px, 24vh, 220px); }
  .lyric-pane { min-height: 200px; }
}
@media (max-height: 620px) {
  :root { --art-h: clamp(80px, 19vh, 150px); --art-h-sq: clamp(88px, 21vh, 170px); }
  .lyric-pane { min-height: 150px; }
  .play { width: 58px; height: 58px; }
  .play .icon { width: 28px; height: 28px; }
  .skip { width: 40px; height: 40px; }
  .skip svg { width: 16px; height: 16px; }
  .hint { display: none; }
}

@media (max-width: 720px) {
  .topbar { font-size: 10px; letter-spacing: .24em; }
  .tb-title { font-size: 12.5px; }
  .tb-sep { display: none; }
  .tb-right { display: none; }
  .line { letter-spacing: .05em; padding: .32em .2em; }
}

@media (max-width: 420px) {
  .stage { padding-left: 16px; padding-right: 16px; }
  .legal { font-size: 9.5px; letter-spacing: .02em; }
  .legal-sep { display: none; }
  .switcher { gap: 16px; }
  .skip { width: 42px; height: 42px; }
}

/* 竖屏触屏：封面略大，歌词行数略少 */
@media (orientation: portrait) and (max-width: 720px) {
  :root {
    --art-h: clamp(124px, 24vh, 230px);
    --art-h-sq: clamp(140px, 26vh, 250px);
  }
  .lyric-pane { min-height: 250px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .ambient i { animation: none !important; }
}
