:root {
  --ink: #e9e4ea;
  --ink-dim: rgba(233, 228, 234, .62);
  --ink-faint: rgba(233, 228, 234, .32);
  --night: #0d1424;
  --night-rgb: 13,20,36;
  --glow: 255,210,220;
  --dusk: #c98a9a;
  --scarf: #c8333a;
  --glass: rgba(18, 26, 44, .46);
  --line: rgba(233, 228, 234, .14);
  --serif: "Zen Old Mincho", "Noto Serif SC", "Songti SC", serif;
  --sans: "Noto Sans SC", -apple-system, "PingFang SC", "Hiragino Sans", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--night); color: var(--ink); }
body { color: var(--ink); }
body {
  font-family: var(--sans);
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* ── 背景：模糊封面 + 雨 ── */
.backdrop {
  position: fixed; inset: -8%;
  background: var(--bg) center / cover no-repeat;
  filter: blur(38px) saturate(calc(1.15 - var(--wet, 0) * .25)) brightness(calc(.58 - var(--wet, 0) * .14));
  transition: filter .3s;
  transform: scale(1.1);
  z-index: -3;
}
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(var(--night-rgb),.35) 0%, rgba(var(--night-rgb),.15) 40%, rgba(var(--night-rgb),.85) 100%);
}
#rain, #scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }

/* ── 开场：点一下才开始 ── */
.gate {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; text-align: center;
  background: rgba(var(--night-rgb), .74);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: opacity 1.2s ease, visibility 1.2s;
}
.gate.gone { opacity: 0; visibility: hidden; }
.gate-inner { padding: 0 32px; }
.gate-no { font-family: var(--serif); font-size: 13px; letter-spacing: .5em; color: var(--ink-dim); margin-bottom: 28px; }
.gate-title { font-family: var(--serif); font-size: clamp(24px, 6.4vw, 40px); line-height: 1.4; font-weight: 400; }
.gate-hint {
  margin-top: 56px; display: inline-flex; align-items: center; gap: 12px;
  font-size: 13px; letter-spacing: .3em; color: var(--ink-dim);
  animation: breathe 3.2s ease-in-out infinite;
}
.gate-hint::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent, var(--scarf)); box-shadow: 0 0 12px var(--accent, var(--scarf)); }
@keyframes breathe { 50% { opacity: .35; } }

/* ── 主体 ── */
main {
  width: min(460px, 100%);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 20px max(48px, env(safe-area-inset-bottom));
}
.topbar { display: flex; justify-content: space-between; align-items: center; font-size: 12px; letter-spacing: .28em; color: var(--ink-faint); margin-bottom: 28px; }
.topbar a { color: inherit; text-decoration: none; }
.topbar a:hover { color: var(--ink-dim); }

.cover-wrap { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.7), 0 0 0 1px var(--line); }
.cover-wrap img { width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.0); transition: transform 12s linear; }
.playing .cover-wrap img { transform: scale(1.06); }
/* 横版封面：完整显示在上方，下面用模糊的同一张图补满，歌词叠在补出来的部分 */
.cover-wrap.wide { background: rgb(var(--night-rgb)); }
.cover-wrap.wide::before {
  content: ""; position: absolute; inset: -20%;
  background: var(--bg) center bottom / cover no-repeat;
  filter: blur(26px) brightness(.7) saturate(1.1);
}
.cover-wrap.wide img {
  position: relative; height: auto; object-fit: contain;
  -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 78%, transparent 100%);
  transform-origin: center top;
}
.cover-wrap.wide .cover-shade { background: linear-gradient(180deg, transparent 45%, rgba(var(--night-rgb),.45) 66%, rgba(var(--night-rgb),.85) 100%); }

.meta { margin-top: 30px; }
.meta h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(22px, 6vw, 28px); line-height: 1.45; }
.meta .sub { margin-top: 6px; font-size: 13px; letter-spacing: .12em; color: var(--ink-dim); }

/* ── 播放器 ── */
.player { margin-top: 26px; }
#viz { display: block; width: 100%; height: 56px; }
.bar { position: relative; height: 22px; margin-top: 6px; cursor: pointer; touch-action: none; }
.bar-track { position: absolute; left: 0; right: 0; top: 10px; height: 2px; background: var(--line); border-radius: 2px; }
.bar-fill { position: absolute; left: 0; top: 10px; height: 2px; width: 0; background: var(--ink); border-radius: 2px; }
.bar-knob { position: absolute; top: 6px; width: 10px; height: 10px; margin-left: -5px; left: 0; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 4px rgba(233,228,234,.12); }
.times { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .08em; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.controls { display: flex; justify-content: center; align-items: center; gap: 40px; margin-top: 14px; }
.ctl { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink-dim); border-radius: 50%; }
.ctl:hover { color: var(--ink); }
.ctl svg { width: 20px; height: 20px; }
.ctl.main { width: 68px; height: 68px; color: var(--night); background: var(--ink); transition: transform .2s; }
.ctl.main:active { transform: scale(.94); }
.ctl.main svg { width: 26px; height: 26px; }
.ctl .i-pause { display: none; }
.playing .ctl.main .i-play { display: none; }
.playing .ctl.main .i-pause { display: block; }
.ctl.loop.on { color: var(--dusk); }

/* ── 留言 ── */
.letter { margin-top: 48px; padding: 28px 24px; border-radius: 6px; background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.letter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 11px; letter-spacing: .3em; color: var(--ink-faint); margin-bottom: 18px; }
.letter p { font-family: var(--serif); font-size: 16px; line-height: 2; color: var(--ink); }
.letter p + p { margin-top: .9em; }
/* ── 歌词：逐字点亮 + 自动滚动 ── */
.cover-shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 38%, rgba(var(--night-rgb),.55) 62%, rgba(var(--night-rgb),.9) 100%);
  opacity: 0; transition: opacity 1s;
}
.has-lyrics .cover-shade { opacity: 1; }
.lyrics-box {
  position: absolute; left: 0; right: 0; bottom: 0; height: 50%; overflow: hidden; padding: 0 20px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 30%, #000 82%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 30%, #000 82%, transparent 100%);
}
.lyrics-scroll { position: absolute; left: 20px; right: 20px; top: 0; transition: transform .7s cubic-bezier(.22,.8,.3,1); }
.ly-line {
  padding: 7px 0; font-family: var(--serif); font-size: clamp(15px, 4.4vw, 19px); line-height: 1.5;
  color: rgba(233,228,234,.3); cursor: pointer; text-align: center;
  transition: color .5s, transform .5s, opacity .5s; transform-origin: left center;
}
.ly-line.gap { height: 18px; padding: 0; pointer-events: none; }
.ly-line.near { color: rgba(233,228,234,.34); }
.ly-line.active { color: rgba(233,228,234,.3); }
.ly-line .tr { display: block; font-family: var(--sans); font-size: 11.5px; letter-spacing: .04em; margin-top: 3px; color: rgba(233,228,234,.28); }
.ly-line.active .tr { color: rgba(233,228,234,.72); }
.wide .lyrics-box { height: 38%;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 84%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 84%, transparent 100%); }
/* 每个字：--p 从 0 到 1，从左往右被光“填满” */
.ly-c {
  --p: 0;
  color: transparent;
  background: linear-gradient(90deg, #fff 0, #fff calc(var(--p) * 100%), rgba(233,228,234,.38) calc(var(--p) * 100%));
  -webkit-background-clip: text; background-clip: text;
}
.ly-line.active .ly-c { background-image: linear-gradient(90deg, #fff 0, #fff calc(var(--p) * 100%), rgba(233,228,234,.45) calc(var(--p) * 100%)); }
.ly-c.lit { filter: drop-shadow(0 0 6px rgba(var(--glow),.85)) drop-shadow(0 0 1px rgba(255,255,255,.6)); }
.ly-line.done .ly-c { --p: 1; filter: none; }
.ly-line.done { opacity: .5; }
.ly-line:not(.active):not(.near) { opacity: .35; }

.foot { margin-top: 40px; text-align: center; font-size: 11px; letter-spacing: .3em; color: var(--ink-faint); }

/* 入场 */
.rise { opacity: 0; transform: translateY(14px); transition: opacity 1.1s ease, transform 1.1s ease; }
.ready .rise { opacity: 1; transform: none; }
.ready .rise:nth-child(2) { transition-delay: .12s; }
.ready .rise:nth-child(3) { transition-delay: .24s; }
.ready .rise:nth-child(4) { transition-delay: .36s; }
.ready .rise:nth-child(5) { transition-delay: .48s; }

/* ── 首页歌单 ── */
.home-title { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 24px 0 6px; }
.home-sub { font-size: 13px; color: var(--ink-dim); letter-spacing: .12em; margin-bottom: 32px; }
.list { list-style: none; border-top: 1px solid var(--line); }
.list a { display: flex; align-items: center; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.list a:hover { background: rgba(255,255,255,.03); }
.list .no { font-family: var(--serif); font-size: 13px; color: var(--ink-faint); width: 22px; }
.list img { width: 48px; height: 48px; border-radius: 3px; object-fit: cover; }
.list .t { font-family: var(--serif); font-size: 16px; line-height: 1.4; }
.list .s { font-size: 12px; color: var(--ink-dim); margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  #rain, #scene { display: none; }
  .rise, .cover-wrap img { transition: none; }
}

/* ── 鲜血歌词（songs.js 里 lyricStyle: "blood"）：唱到的字被血从上往下浸透，有的字会滴下血痕 ── */
.lyric-blood .ly-c {
  position: relative;
  background: linear-gradient(180deg, #d0161f 0, #8e0b12 calc(var(--p) * 100%), rgba(233,228,234,.32) calc(var(--p) * 100%));
  -webkit-background-clip: text; background-clip: text;
}
.lyric-blood .ly-line.active .ly-c { background-image: linear-gradient(180deg, #e01a24 0, #9a0c14 calc(var(--p) * 100%), rgba(233,228,234,.5) calc(var(--p) * 100%)); }
.lyric-blood .ly-c.lit { filter: drop-shadow(0 0 5px rgba(210,20,30,.75)) drop-shadow(0 1px 0 rgba(60,0,4,.8)); }
.lyric-blood .ly-line.done .ly-c { background: none; color: #6e0e14; -webkit-text-fill-color: #6e0e14; filter: none; }
.lyric-blood .ly-line.done { opacity: .6; }
.lyric-blood .ly-c.drip::after {
  content: ""; position: absolute; left: var(--dx, 50%); top: 78%;
  width: var(--dw, 2px); height: 0; border-radius: 0 0 2px 2px;
  background: linear-gradient(180deg, #a10d16, #6a070c);
  animation: blood-drip var(--dd, 2.6s) cubic-bezier(.4,0,.6,1) forwards;
}
.lyric-blood .ly-c.drip::before { /* 血滴末端的小圆珠 */
  content: ""; position: absolute; left: calc(var(--dx, 50%) - 1px); top: 78%;
  width: calc(var(--dw, 2px) + 2px); height: calc(var(--dw, 2px) + 2px); border-radius: 50%;
  background: #8a0b12; animation: blood-bead var(--dd, 2.6s) cubic-bezier(.4,0,.6,1) forwards;
}
@keyframes blood-drip { 0% { height: 0; opacity: 1; } 70% { height: var(--dh, 12px); opacity: 1; } 100% { height: var(--dh, 12px); opacity: .4; } }
@keyframes blood-bead { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(var(--dh, 12px)); opacity: 1; } 100% { transform: translateY(var(--dh, 12px)); opacity: .4; } }

/* ── 野兽歌词（lyricStyle: "beast"）：字被“砸”出来，抖一下，变成红色 ── */
.lyric-beast .ly-c { position: relative;
  background: linear-gradient(90deg, #ff3b2f 0, #ff3b2f calc(var(--p) * 100%), rgba(233,228,234,.32) calc(var(--p) * 100%));
  -webkit-background-clip: text; background-clip: text; }
.lyric-beast .ly-line.active .ly-c { background-image: linear-gradient(90deg, #fff1ec 0, #ff4a3a calc(var(--p) * 100%), rgba(233,228,234,.5) calc(var(--p) * 100%)); }
.lyric-beast .ly-c.lit { animation: beast-hit .28s cubic-bezier(.2,1.6,.4,1); filter: drop-shadow(0 0 6px rgba(255,40,30,.9)) drop-shadow(2px 0 0 rgba(0,0,0,.8)); }
.lyric-beast .ly-line.done .ly-c { background: none; color: #a8251c; -webkit-text-fill-color: #a8251c; filter: none; }
@keyframes beast-hit { 0% { top: -7px; left: 2px; } 40% { top: 2px; left: -2px; } 70% { top: -1px; left: 1px; } 100% { top: 0; left: 0; } }

/* ── orphiusmusic.com：YouTube 链接 + 完整歌词 ── */
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.lnk { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass);
  color: var(--ink); text-decoration: none; font-size: 13px; letter-spacing: .06em; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.lnk:hover { border-color: var(--ink-dim); }
.full-lyrics { margin-top: 48px; padding: 28px 24px; border-radius: 6px; background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.fl-head { font-family: var(--serif); font-weight: 400; font-size: 13px; letter-spacing: .2em; color: var(--ink-faint); margin: 0 0 20px; }
.full-lyrics p { margin: 0 0 16px; }
.full-lyrics .o { display: block; font-family: var(--serif); font-size: 16px; line-height: 1.8; color: var(--ink); }
.full-lyrics .t { display: block; font-size: 13px; line-height: 1.6; color: var(--ink-dim); }
.full-lyrics .none { font-family: var(--serif); color: var(--ink-dim); }

/* ── 字幕语言切换 ── */
.sub-switch { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.sub-label { font-size: 11px; letter-spacing: .14em; color: var(--ink-faint); margin-right: 6px; }
.sub-switch button { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass);
  color: var(--ink-dim); font: inherit; font-size: 12px; cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.sub-switch button:hover { color: var(--ink); }
.sub-switch button[aria-pressed="true"] { background: var(--ink); color: var(--night); border-color: var(--ink); }
.full-lyrics .sub-switch { margin: -8px 0 22px; }
.full-lyrics .t[data-l] { display: none; }
html[data-sub="en"] .full-lyrics .t[data-l="en"],
html[data-sub="zh"] .full-lyrics .t[data-l="zh"],
html[data-sub="ja"] .full-lyrics .t[data-l="ja"] { display: block; }

/* ── 首页背景模式（?bg=1）：只留场景和封面里的动态，其余全部隐藏 ── */
html.bg-mode, html.bg-mode body { overflow: hidden; }
html.bg-mode .gate, html.bg-mode .topbar, html.bg-mode .meta, html.bg-mode .sub-switch,
html.bg-mode .player, html.bg-mode .links, html.bg-mode .full-lyrics, html.bg-mode .foot,
html.bg-mode #lyricsBox, html.bg-mode .cover-shade { display: none !important; }
html.bg-mode main { width: 100%; padding-top: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
html.bg-mode .cover-wrap { position: fixed; left: 50%; top: 50%; width: min(60vmin, 520px); margin: 0; transform: translate(-50%, -50%); visibility: hidden; }
html.bg-mode.show-cover .cover-wrap { left: var(--cx); top: var(--cy); width: var(--cw); transform: none; visibility: visible; }
html.bg-mode .rise { animation: none !important; opacity: 1 !important; transform: none !important; }

/* 封面位置的循环小视频（Spotify Canvas 等），由 film 场景按时间显示 */
.cover-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.2s ease; pointer-events: none; }  /* 在封面之上、歌词之下（按 DOM 顺序）*/
.cover-canvas.on { opacity: 1; }
