/* 夜鹿猜歌 —— 仿 yorushika.com 的素纸月色极简风格 */
:root {
  --paper: #f5f1e8;
  --paper-deep: #ece6d8;
  --ink: #23283b;
  --ink-soft: #4a5070;
  --accent: #4d5d8c;
  --accent-deep: #37456e;
  --gold: #b8963e;
  --ok: #3e7a5e;
  --ng: #a04747;
  --line: rgba(35, 40, 59, .18);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

/* PC 端切页时滚动条出现/消失会导致整体位移，固定滚动条槽位 */
html { scrollbar-gutter: stable; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Serif JP", "Noto Serif CJK SC", "Source Han Serif SC", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Songti SC", serif;
  overflow-x: hidden;
  letter-spacing: .04em;
}

/* 背景：一轮淡月 + 纸纹颗粒 */
.moon {
  position: fixed; top: 8vh; right: 10vw; z-index: 0;
  width: 34vmin; height: 34vmin; border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #fdfbf5 0%, #efe8d6 55%, #e3d9c2 100%);
  box-shadow: 0 0 60px 20px rgba(230, 220, 195, .55);
  opacity: .85; pointer-events: none;
  animation: moonfloat 9s ease-in-out infinite;
}
@keyframes moonfloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: repeating-linear-gradient(0deg, rgba(35,40,59,.015) 0 1px, transparent 1px 3px);
}

.wrap { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; min-height: 100%; padding: 0 20px; }

.screen { display: none; min-height: 100vh; min-height: 100dvh; flex-direction: column; padding: 24px 0 40px; animation: fade .45s ease; }
.screen.active { display: flex; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hidden { display: none !important; }

.kbd-hint { display: none; text-align: center; font-size: 11px; color: var(--ink-soft); opacity: .7; margin-top: 14px; letter-spacing: .1em; }
@media (min-width: 600px) { .kbd-hint { display: block; } }

/* ---------- 首页 ---------- */
#screen-home { justify-content: flex-start; position: relative; }
.vertical-title {
  position: absolute; top: 6vh; left: 18px;
  writing-mode: vertical-rl; font-size: 15px; letter-spacing: .5em; line-height: 2.4;
  color: var(--ink-soft); opacity: .75; border-left: 1px solid var(--line); padding-left: 10px;
}
.home-inner { text-align: center; margin: auto 0; width: 100%; padding: 24px 0; }
.catchcopy { font-size: 13px; color: var(--ink-soft); letter-spacing: .3em; margin-bottom: 14px; }
.title { font-size: 44px; font-weight: 600; letter-spacing: .18em; margin-left: .18em; }
.subtitle { font-size: 14px; color: var(--accent); letter-spacing: .35em; margin: 10px 0 38px; }

.menu { display: flex; flex-direction: column; gap: 12px; }

.btn {
  font-family: inherit; cursor: pointer; color: var(--ink);
  background: rgba(255, 255, 255, .55);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 14px 18px; font-size: 16px; letter-spacing: .12em;
  transition: background .2s, border-color .2s, transform .1s;
}
.btn:active { transform: scale(.985); }
.btn-mode { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.btn-mode .mode-name { font-size: 17px; font-weight: 600; }
.btn-mode .mode-desc { font-size: 12px; color: var(--ink-soft); letter-spacing: .06em; }
.btn-mode:hover { border-color: var(--accent); background: rgba(255, 255, 255, .85); box-shadow: 0 4px 18px rgba(35, 40, 59, .08); transform: translateY(-1px); }
.btn-challenge { border-color: var(--gold); }
.btn-challenge .mode-name { color: var(--gold); }
.btn-ghost { background: transparent; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #f5f1e8; }
.btn-primary:hover { background: var(--accent-deep); }

.disclaimer { margin-top: 34px; font-size: 11px; line-height: 1.9; color: var(--ink-soft); opacity: .8; }

/* ---------- 游戏页 ---------- */
.game-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; min-height: 32px; }
.btn-back { background: none; border: none; font-family: inherit; font-size: 14px; color: var(--ink-soft); cursor: pointer; padding: 6px 4px; letter-spacing: .1em; }
.game-mode-label { font-size: 14px; letter-spacing: .3em; color: var(--accent); }
.game-progress-label { font-size: 13px; color: var(--ink-soft); min-width: 48px; text-align: right; }

.player { text-align: center; margin: 10px 0 18px; }
.btn-play {
  width: 88px; height: 88px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--accent); background: rgba(255, 255, 255, .6);
  color: var(--accent); font-size: 26px; transition: all .2s;
  position: relative;
}
.btn-play:hover { background: var(--accent); color: var(--paper); }
.btn-play.playing { background: var(--accent); color: var(--paper); }
.btn-play.playing::after {
  content: ""; position: absolute; inset: -1px; border-radius: 50%;
  border: 1px solid var(--accent); animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: .7; }
  100% { transform: scale(1.45); opacity: 0; }
}
.play-progress { height: 2px; background: var(--line); margin: 16px 24px 8px; }
#play-progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.play-status { font-size: 12px; color: var(--ink-soft); letter-spacing: .2em; }

.hint-box {
  border-left: 2px solid var(--gold); background: rgba(255, 255, 255, .5);
  padding: 10px 14px; margin-bottom: 14px; text-align: left;
}
.hint-album { font-size: 13px; color: var(--accent); margin-bottom: 4px; letter-spacing: .08em; }
.hint-text { font-size: 13px; color: var(--ink-soft); line-height: 1.7; }

.timer { height: 3px; background: var(--line); margin-bottom: 16px; }
#timer-bar { height: 100%; width: 100%; background: var(--gold); transition: width 1s linear, background .4s; }
#timer-bar.low { background: var(--ng); }

.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  font-family: inherit; cursor: pointer; text-align: left;
  background: rgba(255, 255, 255, .55); border: 1px solid var(--line); border-radius: 4px;
  padding: 13px 16px; transition: all .15s;
  opacity: 0; animation: optIn .35s ease forwards;
}
@keyframes optIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.option:hover { border-color: var(--accent); transform: translateX(3px); }
.option:disabled { cursor: default; opacity: .85; transform: none; }
.option .opt-ja { font-size: 16px; display: block; letter-spacing: .06em; }
.option .opt-zh { font-size: 12px; color: var(--ink-soft); display: block; margin-top: 2px; }
.option.correct { border-color: var(--ok); background: rgba(62, 122, 94, .12); animation: okGlow .5s ease; }
.option.correct .opt-ja { color: var(--ok); }
.option.wrong { border-color: var(--ng); background: rgba(160, 71, 71, .1); animation: shake .4s ease; }
.option.wrong .opt-ja { color: var(--ng); }
@keyframes okGlow {
  0% { box-shadow: 0 0 0 0 rgba(62, 122, 94, .35); }
  100% { box-shadow: 0 0 0 10px rgba(62, 122, 94, 0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.feedback { margin-top: 18px; text-align: center; animation: fade .3s ease; }
.feedback-text { font-size: 18px; letter-spacing: .2em; margin-bottom: 6px; }
.feedback-text.ok { color: var(--ok); }
.feedback-text.ng { color: var(--ng); }
.feedback-detail { font-size: 13px; color: var(--ink-soft); margin-bottom: 16px; line-height: 1.7; }

/* ---------- 结算 ---------- */
#screen-result { justify-content: flex-start; padding-top: 48px; }
.result-inner { text-align: center; }
.result-title { font-size: 15px; letter-spacing: .3em; color: var(--ink-soft); margin-bottom: 12px; }
.result-rank {
  display: inline-block; font-size: 30px; font-weight: 600; color: var(--accent-deep);
  letter-spacing: .12em; padding: 6px 22px; margin-bottom: 2px;
  border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold);
}
.result-rank-sub { font-size: 12px; color: var(--gold); letter-spacing: .25em; margin-bottom: 18px; }
.result-score { font-size: 56px; font-weight: 600; color: var(--accent-deep); margin-bottom: 4px; }
.result-score small { font-size: 16px; color: var(--ink-soft); }
.result-sub { font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; letter-spacing: .1em; }
.result-best { font-size: 13px; color: var(--gold); margin-bottom: 26px; letter-spacing: .15em; }

.review { text-align: left; margin-bottom: 26px; }
.review-title {
  font-size: 13px; letter-spacing: .3em; color: var(--ink-soft); text-align: center;
  margin-bottom: 10px; font-weight: 400;
}
.review-title::before, .review-title::after { content: "—"; color: var(--line); margin: 0 10px; }
.review-list {
  list-style: none; max-height: 34vh; overflow-y: auto;
  border-top: 1px solid var(--line); scrollbar-width: thin;
}
.review-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 4px;
  border-bottom: 1px solid var(--line); font-size: 13px;
  animation: optIn .3s ease both;
}
.review-mark { width: 20px; text-align: center; flex-shrink: 0; }
.review-item.ok .review-mark { color: var(--ok); }
.review-item.ng .review-mark { color: var(--ng); }
.review-cover { width: 34px; height: 34px; border-radius: 3px; object-fit: cover; flex-shrink: 0; box-shadow: 0 1px 4px rgba(35,40,59,.2); }
.review-main { flex: 1; min-width: 0; }
.review-main b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-main i { font-style: normal; font-size: 11px; color: var(--ink-soft); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-meta { color: var(--ink-soft); font-size: 12px; flex-shrink: 0; text-align: right; }
.review-meta em { font-style: normal; color: var(--gold); display: block; }

.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 排行榜 ---------- */
.rank-boards { display: flex; gap: 8px; margin-bottom: 10px; }
.rank-board {
  flex: 1; font-family: inherit; cursor: pointer; padding: 10px 0; font-size: 15px; letter-spacing: .15em;
  background: rgba(255,255,255,.5); border: 1px solid var(--line); border-radius: 4px; color: var(--ink);
}
.rank-board.active { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--paper); }
.rank-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.rank-tab {
  flex: 1; font-family: inherit; cursor: pointer; padding: 8px 0; font-size: 14px; letter-spacing: .2em;
  background: transparent; border: 1px solid var(--line); border-radius: 4px; color: var(--ink-soft);
}
.rank-tab.active { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.rank-mine { font-size: 13px; color: var(--gold); margin-bottom: 10px; letter-spacing: .1em; min-height: 18px; }
.rank-list { list-style: none; }
.rank-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 6px;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.rank-no { width: 30px; text-align: center; color: var(--ink-soft); font-style: italic; }
.rank-item:nth-child(1) .rank-no { color: var(--gold); font-weight: 700; }
.rank-item:nth-child(2) .rank-no,
.rank-item:nth-child(3) .rank-no { color: var(--accent); }
.rank-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--paper-deep); }
.rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { color: var(--accent-deep); font-weight: 600; }
.rank-empty { text-align: center; color: var(--ink-soft); font-size: 13px; margin-top: 40px; letter-spacing: .1em; }

@media (max-width: 360px) {
  .title { font-size: 36px; }
  .vertical-title { display: none; }
}

/* ---------- 战绩 ---------- */
.btn-clear { color: var(--ng); }
.history-stats {
  font-size: 13px; color: var(--ink-soft); letter-spacing: .12em;
  text-align: center; margin: 6px 0 14px; min-height: 18px;
}
.history-list { list-style: none; }
.history-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 6px;
  border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer;
  transition: background .2s ease;
}
.history-item:hover { background: rgba(255,255,255,.45); }
.history-mode {
  flex-shrink: 0; font-size: 12px; letter-spacing: .1em; color: var(--accent);
  border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px;
}
.history-item.challenge .history-mode { color: var(--gold); border-color: rgba(184,150,62,.5); }
.history-main { flex: 1; min-width: 0; }
.history-main b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-main i { font-style: normal; font-size: 11px; color: var(--ink-soft); }
.history-score { color: var(--accent-deep); font-weight: 600; flex-shrink: 0; }
.history-score small { font-weight: 400; font-size: 11px; color: var(--ink-soft); }

/* ---------- 成绩卡预览弹层 ---------- */
.card-overlay {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(35, 40, 59, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fade .3s ease;
}
.card-box {
  background: var(--paper); border-radius: 6px; padding: 14px;
  box-shadow: 0 12px 40px rgba(35,40,59,.35);
  display: flex; flex-direction: column; gap: 10px;
  max-height: 92vh; max-height: 92dvh;
}
.card-box canvas {
  width: min(78vw, 300px); height: auto; border-radius: 3px;
  box-shadow: 0 2px 10px rgba(35,40,59,.25);
}
.card-actions { display: flex; gap: 10px; }
.card-actions .btn { flex: 1; }
.card-status { text-align: center; font-size: 12px; color: var(--ok); min-height: 16px; letter-spacing: .1em; }

/* ---------- 首页重设计：logo · 作者标签 ---------- */
#screen-home .home-inner { position: relative; z-index: 1; }
.logo-eye { width: 74px; height: auto; margin-bottom: 16px; }

/* 回到首页时标题组慢慢浮现（display 切换会重播动画） */
#screen-home.active .logo-eye  { animation: emerge 1.4s ease .05s both; }
#screen-home.active .catchcopy { animation: emerge 1.4s ease .35s both; }
#screen-home.active .title     { animation: emerge 1.8s ease .6s both; }
#screen-home.active .subtitle  { animation: emerge 1.4s ease 1.0s both; }
#screen-home.active .menu      { animation: emerge 1.2s ease 1.25s both; }
@keyframes emerge {
  from { opacity: 0; filter: blur(5px); transform: translateY(6px); }
  to   { opacity: 1; filter: blur(0);   transform: none; }
}
.author-tag {
  font-size: 12px; color: var(--accent); letter-spacing: .2em;
  margin-top: 22px; text-align: center;
}

/* 答题揭晓后选项浮现专辑封面 */
.option { position: relative; }
.opt-cover {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; object-fit: cover; border-radius: 3px;
  box-shadow: 0 2px 8px rgba(35,40,59,.3);
  opacity: 0; animation: coverIn .6s ease .1s both;
  pointer-events: none;
}
.option.correct .opt-cover { animation: coverIn .6s ease .1s both, okGlow .5s ease; }
@keyframes coverIn {
  from { opacity: 0; transform: translateY(-50%) scale(.6); }
  to   { opacity: 1; transform: translateY(-50%) scale(1); }
}

/* ---------- MV GIF 背景：全页面常驻（主页略浓 / 答题页最淡保证可读） ---------- */
.mv-bg {
  position: fixed; inset: -4vmax; z-index: 0; pointer-events: none;
  filter: saturate(.72) contrast(.94) brightness(1.06);
  transform: scale(1.06);
  opacity: .30; transition: opacity 1.4s ease;
  will-change: opacity;
}
.mv-fade {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg,
    rgba(245,241,232,.70) 0%, rgba(245,241,232,.42) 30%,
    rgba(245,241,232,.34) 58%, rgba(245,241,232,.76) 100%);
  opacity: 1; transition: opacity 1.4s ease;
}
body.on-home .mv-bg { opacity: .32; }
body.on-game .mv-bg { opacity: .25; }
body.on-game .mv-fade {
  background: linear-gradient(180deg,
    rgba(245,241,232,.72) 0%, rgba(245,241,232,.58) 40%,
    rgba(245,241,232,.52) 70%, rgba(245,241,232,.80) 100%);
}
body.on-result .mv-bg { opacity: .30; }
body.on-result .mv-fade {
  background: linear-gradient(180deg,
    rgba(245,241,232,.68) 0%, rgba(245,241,232,.40) 34%,
    rgba(245,241,232,.34) 64%, rgba(245,241,232,.76) 100%);
}
@media (max-width: 600px) {
  .mv-bg { opacity: .27; }
  body.on-home .mv-bg { opacity: .30; }
  body.on-game .mv-bg { opacity: .22; }
  body.on-result .mv-bg { opacity: .28; }
}

/* 背景音乐开关（主页 / 结算页右下角） */
.btn-bgm {
  position: fixed; right: 14px; bottom: 14px; z-index: 20;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(245,241,232,.85);
  color: var(--accent-deep); font-size: 17px; font-family: inherit; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(35,40,59,.14);
}
body.on-home .btn-bgm, body.on-result .btn-bgm { display: flex; }
.btn-bgm.off { color: var(--ink-soft); opacity: .55; text-decoration: line-through; }

/* ---------- 开屏：轻触进入（解锁声音） ---------- */
.enter-overlay {
  position: fixed; inset: 0; z-index: 40; cursor: pointer;
  background: rgba(245, 241, 232, .86);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; text-align: center;
  transition: opacity .55s ease;
}
.enter-overlay.hide { opacity: 0; pointer-events: none; }
.enter-inner img { width: 86px; height: auto; margin-bottom: 22px; animation: emerge 1.6s ease .1s both; }
.enter-title { font-size: 32px; font-weight: 600; letter-spacing: .22em; margin-left: .22em; animation: emerge 1.6s ease .4s both; }
.enter-sub { font-size: 13px; color: var(--accent); letter-spacing: .35em; margin-top: 10px; animation: emerge 1.6s ease .7s both; }
.enter-tip {
  margin-top: 44px; font-size: 13px; color: var(--ink-soft); letter-spacing: .25em;
  animation: enterBlink 2.2s ease-in-out infinite;
}
@keyframes enterBlink { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }

/* ---------- 主页背景视频轮换（多段 MV 淡化切换） ---------- */
.mv-item {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 1.8s ease;
}
.mv-item.on { opacity: 1; }

/* 首页电台入口 */
.btn-radio { border-color: var(--accent); }
.btn-radio .mode-name { color: var(--accent-deep); }

/* ---------- 电台模式：全屏 Three.js 3D 场景 + 毛玻璃浮层 UI ---------- */
#screen-radio.active {
  display: block; position: fixed; inset: 0; z-index: 15;
  padding: 0; background: #111;
}
.scene3d { position: absolute; inset: 0; }
.scene3d canvas { display: block; width: 100%; height: 100%; }

body.on-radio { background: #111; } /* PC 滚动条槽位露出的部分也压黑 */

/* 电台打开时隐藏主页背景层与月亮颗粒 */
body.on-radio .mv-bg, body.on-radio .mv-fade,
body.on-radio .moon, body.on-radio .grain { opacity: 0; }

.radio-ui { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.radio-top {
  position: absolute; top: 16px; left: 16px; right: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.radio-label {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: #fff; font-size: 13px; letter-spacing: .3em; white-space: nowrap;
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
  padding: 7px 14px; border-radius: 999px;
  background: rgba(20,20,20,.28); border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
/* 窄屏放不下绝对居中，回退为流式布局 */
@media (max-width: 900px) {
  .radio-label { position: static; transform: none; }
}
.glass-btn {
  pointer-events: auto; cursor: pointer; font-family: inherit;
  border: 1px solid rgba(255,255,255,.28); color: #fff;
  background: rgba(20,20,20,.25);
  backdrop-filter: blur(14px) saturate(130%); -webkit-backdrop-filter: blur(14px);
  border-radius: 999px; box-shadow: 0 8px 28px rgba(0,0,0,.22);
  transition: transform .2s ease, background .2s ease;
}
.glass-btn:hover { background: rgba(20,20,20,.38); }
#btn-radio-back { padding: 10px 16px; font-size: 13px; letter-spacing: .08em; }
.btn-daynight {
  width: 44px; height: 44px; font-size: 18px; color: #f5d67a;
  display: flex; align-items: center; justify-content: center;
}
.btn-daynight:active { transform: rotate(40deg) scale(.92); }

/* 底部正在播放卡片 */
.now-card {
  position: absolute; left: 16px; right: 16px; bottom: 18px; margin: 0 auto;
  max-width: 460px; padding: 14px 16px; pointer-events: auto;
  display: flex; align-items: center; gap: 14px;
  border: 1px solid rgba(255,255,255,.24); border-radius: 20px;
  background: rgba(18,19,20,.42); color: #fff;
  backdrop-filter: blur(18px) saturate(130%); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(0,0,0,.3);
}
.now-cover {
  width: 68px; height: 68px; border-radius: 12px; overflow: hidden; flex-shrink: 0;
  background: #26363a; box-shadow: 0 8px 20px rgba(0,0,0,.3);
}
.now-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.now-main { flex: 1; min-width: 0; }
.radio-title {
  font-size: 17px; font-weight: 600; letter-spacing: .04em; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.radio-sub {
  font-size: 11px; color: rgba(255,255,255,.62); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .05em;
}
.radio-controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.radio-progress {
  position: relative; height: 16px; margin-top: 6px; cursor: pointer;
  touch-action: none;
}
.radio-progress::before {
  content: ""; position: absolute; left: 0; right: 0; top: 6.5px; height: 3px;
  border-radius: 2px; background: rgba(255,255,255,.18);
}
#radio-progress-bar {
  position: absolute; left: 0; top: 6.5px; height: 3px; width: 0;
  border-radius: 2px; background: #f2b56b;
}
#radio-progress-bar::after { /* 拖动手柄 */
  content: ""; position: absolute; right: -4.5px; top: 50%; width: 9px; height: 9px;
  border-radius: 50%; background: #f2b56b; transform: translateY(-50%);
  box-shadow: 0 0 6px rgba(242,181,107,.6);
}
.radio-btn {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-family: inherit;
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.1);
  color: #fff; font-size: 13px; transition: all .16s ease;
}
.radio-btn:hover { background: rgba(255,255,255,.2); }
.radio-btn:active { transform: scale(.94); }
.radio-play {
  width: 48px; height: 48px; font-size: 16px;
  background: #f5f1e8; border-color: #f5f1e8; color: #171717;
}
.radio-play:hover { background: #fff; }

/* ---------- 电台 2D 插画场景（替换 Three.js 版本，旧版保留在 radio3d.js） ---------- */
.scene3d { display: block; background: #0d1117; overflow: hidden; }
/* 场景保持 4:3 原比例并 cover 铺满视口，多余部分居中裁掉，不留黑边 */
.scene2d-frame {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: max(100vw, 133.3333vh); height: max(75vw, 100vh);
  overflow: hidden; user-select: none;
}
.s2-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill;
  opacity: 0; transition: opacity 1.1s ease, filter .6s ease; pointer-events: none;
}
.s2-bg.active { opacity: 1; }
.scene2d-frame[data-weather="cloudy"] .s2-bg.active { filter: brightness(.85); }
.scene2d-frame[data-weather="rain"] .s2-bg.active { filter: brightness(.74); }
.scene2d-frame[data-weather="night"] .s2-bg.active { filter: brightness(.45); }

/* 窗户区域：雨滴 + 歌词（与原插画窗框对齐） */
.s2-rain {
  position: absolute; left: 28.18%; top: 17.68%; width: 46.06%; height: 44.7%;
  overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .25s; z-index: 2;
}
.scene2d-frame[data-weather="rain"] .s2-rain { opacity: .95; }
.s2-drop {
  position: absolute; left: var(--x); top: calc(-28% - var(--spawn)); width: 3px; height: var(--len);
  border-radius: 999px; opacity: var(--alpha);
  background: linear-gradient(to bottom, rgba(176,196,218,0) 0%, rgba(176,196,218,.95) 28%, rgba(150,172,198,.35) 72%, rgba(150,172,198,0) 100%);
  filter: blur(.18px); animation: s2rainfall var(--duration) linear infinite; animation-delay: var(--delay);
}
@keyframes s2rainfall {
  from { transform: translate3d(0, 0, 0) rotate(var(--angle)); }
  to { transform: translate3d(var(--drift), var(--fall, 65vh), 0) rotate(var(--angle)); }
}
.s2-lyric {
  position: absolute; left: 28.18%; top: 17.68%; width: 46.06%; height: 30%;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 0 4%; pointer-events: none; white-space: nowrap; overflow: hidden;
  z-index: 3;
  font-family: "Kaiti SC", "KaiTi", "STKaiti", "Yu Mincho", serif; font-style: italic; font-weight: 600;
  color: rgba(35,40,59,.88); text-shadow: 0 1px 8px rgba(255,255,255,.4);
  transition: opacity .25s ease, color .6s ease;
}
.scene2d-frame[data-weather="night"] .s2-lyric {
  color: rgba(240,232,216,.95); text-shadow: 0 0 14px rgba(0,0,0,.6);
}
.scene2d-frame[data-weather="cloudy"] .s2-lyric {
  color: rgba(250,250,246,.95); text-shadow: 0 1px 10px rgba(70,80,92,.55);
}
.scene2d-frame[data-weather="rain"] .s2-lyric {
  color: rgba(232,238,246,.92); text-shadow: 0 1px 10px rgba(20,30,48,.6);
}

/* 显示器：封面 + 进度条（matrix3d 单应变换精确贴合插画屏幕透视，由 radio2d.js 计算） */
.s2-monitor {
  position: absolute; left: 0; top: 0; transform-origin: 0 0;
  overflow: hidden;
  box-shadow: 0 0 22px rgba(140,190,255,.28);
  transition: filter .45s ease;
}
.scene2d-frame[data-weather="cloudy"] .s2-monitor { filter: brightness(.85); }
.scene2d-frame[data-weather="rain"] .s2-monitor { filter: brightness(.74); }
.scene2d-frame[data-weather="night"] .s2-monitor { filter: brightness(.55); box-shadow: 0 0 26px rgba(140,190,255,.45); }
.s2-monitor img { width: 100%; height: 100%; object-fit: cover; display: block; }
.s2-mon-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 6%; background: rgba(0,0,0,.35); }
#s2-mon-prog-bar { height: 100%; width: 0; background: #f2b56b; }
/* 换歌淡入淡出：显示器封面 + 底部卡片 */
#s2-cover, .s2-mon-prog { transition: opacity .32s ease; }
.s2-monitor.fading #s2-cover, .s2-monitor.fading .s2-mon-prog { opacity: 0; }
.now-cover img, .now-main { transition: opacity .24s ease; }
.now-card.switching .now-cover img, .now-card.switching .now-main { opacity: 0; }

/* 音量调节 */
.radio-volume { display: flex; align-items: center; gap: 6px; margin-left: 4px; }
.radio-vol-icon { font-size: 13px; opacity: .85; }
.radio-volume input[type="range"] {
  width: 76px; accent-color: #f2b56b; cursor: pointer;
}

/* 播放卡片最小化 / 展开 */
.now-card { transition: transform .35s ease, opacity .35s ease; }
.now-card.minimized { transform: translateY(calc(100% + 30px)); opacity: 0; pointer-events: none; }
.radio-min {
  position: absolute; top: 8px; right: 10px; width: 24px; height: 24px;
  border-radius: 50%; border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08); color: #fff; font-size: 11px; line-height: 1;
  cursor: pointer; transition: background .18s ease;
}
.radio-min:hover { background: rgba(255,255,255,.2); }
.radio-show {
  position: absolute; left: 16px; bottom: 18px; width: 46px; height: 46px;
  font-size: 17px; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transform: scale(.7);
  transition: opacity .3s ease, transform .3s ease;
}
.radio-show.visible { opacity: 1; pointer-events: auto; transform: scale(1); }

/* ---------- 电台页手机竖屏适配 ---------- */
@media (max-width: 640px) {
  /* 竖屏下 4:3 插画只能 cover 裁剪，构图左移保住少女与窗户 */
  .scene2d-frame { transform: translate(-46%, -50%); }
  /* 竖屏可视带约为插画的 26%~66%（frame 宽 133vh，居中再左移 4%），歌词与雨幕对齐到可视带 */
  .s2-lyric, .s2-rain { left: 26%; width: 40%; }
  .radio-top { top: 12px; left: 12px; right: 12px; }
  .radio-label { font-size: 11px; letter-spacing: .22em; }
  #btn-radio-back { padding: 8px 12px; font-size: 12px; }
  .btn-daynight { width: 38px; height: 38px; font-size: 15px; }
  .now-card {
    left: 10px; right: 10px; bottom: 12px; max-width: none;
    padding: 10px 12px; gap: 10px; border-radius: 16px;
  }
  .now-cover { width: 54px; height: 54px; border-radius: 10px; }
  .radio-title { font-size: 15px; }
  .radio-sub { font-size: 10px; margin-top: 3px; }
  .radio-controls { gap: 8px; margin-top: 8px; }
  .radio-btn { width: 34px; height: 34px; font-size: 12px; }
  .radio-play { width: 42px; height: 42px; font-size: 14px; }
  .radio-volume { gap: 4px; margin-left: 2px; }
  .radio-volume input[type="range"] { width: 56px; }
  .radio-min { top: 6px; right: 8px; width: 22px; height: 22px; font-size: 10px; }
  .radio-show { left: 10px; bottom: 12px; width: 40px; height: 40px; font-size: 15px; }
}

/* 眨眼 */
.s2-eye { position: absolute; z-index: 5; pointer-events: none; height: auto; }
.scene2d-frame.blinking .s2-eye.open { display: none; }
.scene2d-frame:not(.blinking) .s2-eye.closed { display: none; }

/* ---------- 主界面曲数 & 未登录提示 ---------- */
.song-count {
  font-size: 12px; color: var(--ink-2, #5b6a72); letter-spacing: .3em;
  margin: -26px 0 30px; opacity: .85;
}
#screen-home.active .song-count { animation: emerge 1.4s ease 1.15s both; }
.login-banner {
  margin: 14px 0 0; font-size: 12px; letter-spacing: .08em;
  color: #8a6d2f; background: rgba(184,150,62,.14);
  border: 1px solid rgba(184,150,62,.4); border-radius: 999px;
  padding: 6px 14px; display: inline-block;
}
.login-banner.hidden { display: none; }

/* ---------- 电台顶栏右侧按钮组 ---------- */
.radio-top-right { display: flex; align-items: center; gap: 8px; }
.btn-radio-mode {
  padding: 10px 14px; font-size: 12px; letter-spacing: .1em;
  color: #fff; white-space: nowrap;
}
.btn-radio-import {
  padding: 10px 14px; font-size: 12px; letter-spacing: .1em;
  color: #f2b56b; white-space: nowrap; border-color: rgba(242,181,107,.5);
}
.btn-radio-import.ghost { visibility: hidden; pointer-events: none; } /* 保留占位，防顶栏跳动 */
/* 音乐库屏幕切换只用透明度（transform 会改变 fixed 子元素包含块，导致播放器瞬移） */
#screen-library { animation: libFade .45s ease; }
@keyframes libFade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 电台沉浸模式：隐去全部 UI，点击画面唤回 ---------- */
.radio-ui { transition: opacity .45s ease; }
#screen-radio.immersive .radio-ui { opacity: 0; pointer-events: none; }
#screen-radio.immersive { cursor: pointer; }
#screen-radio.immersive::after {
  content: "轻触画面唤出界面"; position: absolute; left: 50%; bottom: 26px;
  transform: translateX(-50%); font-size: 11px; letter-spacing: .35em;
  color: rgba(255,255,255,.55); text-shadow: 0 1px 8px rgba(0,0,0,.5);
  animation: immerHint 2.6s ease-in-out infinite; pointer-events: none; z-index: 3;
}
@keyframes immerHint { 0%,100% { opacity: .25; } 50% { opacity: .7; } }

@media (max-width: 640px) {
  .radio-top-right { gap: 6px; }
  .btn-radio-mode, .btn-radio-import { padding: 8px 10px; font-size: 11px; }
  .song-count { margin: -22px 0 24px; }
}

/* 场景内显示器暂时不显示封面（后续再恢复） */
#s2-monitor { display: none; }

/* 电台模式分段开关：两个选项并列，当前项高亮 */
.radio-seg {
  pointer-events: auto; display: flex; padding: 3px; gap: 2px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.28);
  background: rgba(20,20,20,.3);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(0,0,0,.22);
}
.radio-seg-btn {
  cursor: pointer; font-family: inherit; border: none; border-radius: 999px;
  padding: 8px 14px; font-size: 12px; letter-spacing: .08em;
  color: rgba(255,255,255,.72); background: transparent;
  transition: background .2s ease, color .2s ease;
}
.radio-seg-btn.active { background: #f5f1e8; color: #171717; font-weight: 600; }
@media (max-width: 640px) {
  .radio-seg-btn { padding: 7px 10px; font-size: 11px; }
}

/* ---------- 电台播放列表面板 ---------- */
.radio-playlist {
  position: absolute; top: 74px; right: 16px; width: 300px; max-height: 62vh;
  display: flex; flex-direction: column; pointer-events: auto;
  border-radius: 16px; border: 1px solid rgba(255,255,255,.22);
  background: rgba(18,19,20,.55); color: #fff;
  backdrop-filter: blur(18px) saturate(130%); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(0,0,0,.3); overflow: hidden;
}
.radio-playlist.hidden { display: none; }
.radio-playlist-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.14);
  font-size: 12px; letter-spacing: .12em;
}
.radio-order { padding: 5px 12px; font-size: 11px; color: #f2b56b; border-color: rgba(242,181,107,.5); }
#radio-playlist-list { overflow-y: auto; margin: 0; padding: 6px; list-style: none; }
.rp-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
.rp-item:hover { background: rgba(255,255,255,.08); }
.rp-item.active { background: rgba(242,181,107,.16); }
.rp-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-item.active .rp-title { color: #f2b56b; }
.rp-sub { font-size: 10px; color: rgba(255,255,255,.55); }
.rp-empty { padding: 18px; text-align: center; font-size: 12px; color: rgba(255,255,255,.5); }
@media (max-width: 640px) {
  .radio-playlist { left: 10px; right: 10px; top: auto; bottom: 96px; width: auto; max-height: 46vh; }
}

/* ---------- 首页：闯关两按钮同行 ---------- */
.menu-row { display: flex; gap: 12px; }
.menu-row .btn { flex: 1; min-width: 0; }

/* ---------- 音乐库 ---------- */
.btn-library { border-color: var(--accent); }
.btn-library .mode-name { color: var(--accent-deep); }
.lib-tip { margin: 4px 0 10px; font-size: 12px; color: var(--ink-soft); letter-spacing: .08em; text-align: center; }
#screen-library { padding-bottom: 148px; } /* 给底部播放器让位 */
.library-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lib-item {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, .72); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px; cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
}
.lib-item:hover { background: rgba(255, 255, 255, .9); transform: translateY(-1px); }
.lib-item.active { border-color: var(--gold); background: rgba(255, 255, 255, .92); box-shadow: 0 4px 16px rgba(184, 150, 62, .18); }
.lib-item-cover { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: var(--paper-deep); }
.lib-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lib-item-title { font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item.active .lib-item-title { color: var(--gold); }
.lib-item-sub { font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item-badge {
  flex: none; font-size: 10px; color: var(--gold); border: 1px solid var(--gold);
  border-radius: 999px; padding: 2px 8px; letter-spacing: .05em;
}
/* 每首歌曲行内的 原声/伴奏 选择 */
.lib-item-srcs { flex: none; display: flex; gap: 6px; }
.lib-item-src {
  border: 1px solid var(--line); background: rgba(255, 255, 255, .6); color: var(--ink-soft);
  font-size: 11px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  font-family: inherit; letter-spacing: .04em; transition: all .15s;
}
.lib-item-src:hover { border-color: var(--accent); color: var(--accent-deep); }
.lib-item-src.active { background: var(--accent-deep); border-color: var(--accent-deep); color: #f5f1e8; }
.lib-player {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 40;
  width: min(520px, calc(100% - 20px));
  display: flex; gap: 12px; align-items: center;
  background: rgba(35, 40, 59, .88); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 12px 32px rgba(35, 40, 59, .35);
}
.lib-cover { width: 64px; height: 64px; flex: none; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.08); }
.lib-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.lib-title { margin: 0; font-size: 15px; font-weight: 600; color: #f5f1e8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-src-tag {
  display: inline-block; font-size: 10px; font-weight: 400; line-height: 1.6;
  color: #e8c98a; border: 1px solid rgba(232, 201, 138, .6); border-radius: 4px;
  padding: 0 6px; margin-right: 7px; vertical-align: 2px; letter-spacing: .05em;
}
.lib-src-tag.hidden { display: none; }
.lib-sub { margin: 0; font-size: 11px; color: rgba(245, 241, 232, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 进度条：加高热区 + 轨道 + 拖动手柄（同电台） */
.lib-progress { position: relative; height: 14px; cursor: pointer; touch-action: none; }
.lib-progress::before {
  content: ""; position: absolute; left: 0; right: 0; top: 5.5px; height: 3px;
  border-radius: 2px; background: rgba(255, 255, 255, .18);
}
.lib-progress > div {
  position: absolute; left: 0; top: 5.5px; height: 3px; width: 0;
  border-radius: 2px; background: var(--gold);
}
.lib-progress > div::after {
  content: ""; position: absolute; right: -4.5px; top: 50%; width: 9px; height: 9px;
  border-radius: 50%; background: var(--gold); transform: translateY(-50%);
  box-shadow: 0 0 6px rgba(184, 150, 62, .6);
}
.lib-controls { display: flex; align-items: center; gap: 10px; }
.lib-controls .radio-btn { color: #f5f1e8; flex: none; }
/* 播放/暂停 CSS 图标（不依赖字体字形，flex 居中防止错位） */
.lib-play-btn { display: flex; align-items: center; justify-content: center; }
.lib-play-btn .ic {
  display: block; margin: 0 0 0 3px; width: 0; height: 0;
  border-style: solid; border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #171717;
}
.lib-play-btn.playing .ic {
  width: 4px; height: 14px; margin: 0; border-width: 0;
  border-left: 4px solid #171717; border-right: 4px solid #171717;
}
/* 进入音乐库时播放器淡入上浮（JS 每次打开重触发 .lib-in） */
@keyframes lib-player-in {
  0% { opacity: 0; transform: translate(-50%, 26px) scale(.97); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.lib-player.lib-in { animation: lib-player-in .5s cubic-bezier(.22,.9,.3,1.08); }
.lib-volume { flex: none; }
.lib-volume input[type="range"] { accent-color: var(--gold); }
.lib-time { margin-left: auto; font-size: 11px; color: rgba(245, 241, 232, .55); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .menu-row { gap: 8px; }
  .menu-row .mode-desc { font-size: 11px; }
  #screen-library { padding-bottom: 158px; }
  .lib-player { bottom: 10px; padding: 10px 12px; }
  .lib-cover { width: 52px; height: 52px; }
  .lib-item { gap: 8px; padding: 7px 10px; }
  .lib-item-src { padding: 4px 8px; font-size: 10px; }
  .lib-volume input[type="range"] { width: 52px; }
}

/* 首页底部信息跟随标题组浮现 */
#screen-home.active .login-banner { animation: emerge 1.2s ease 1.45s both; }
#screen-home.active .author-tag  { animation: emerge 1.2s ease 1.55s both; }
#screen-home.active .disclaimer  { animation: emerge 1.2s ease 1.65s both; }

/* ---------- 手机端电台顶栏：去掉标题文字，压缩按钮，导入不留占位 ---------- */
@media (max-width: 640px) {
  .radio-label { display: none; }
  .radio-top { top: 10px; left: 10px; right: 10px; }
  #btn-radio-back { padding: 8px 12px; font-size: 12px; }
  .radio-top-right { gap: 5px; }
  .radio-seg { padding: 2px; }
  .radio-seg-btn { padding: 6px 9px; font-size: 11px; letter-spacing: .02em; }
  .btn-radio-import { padding: 6px 10px; font-size: 11px; }
  .btn-radio-import.ghost { display: none; } /* 手机端优先保证天气等按钮可见 */
  .btn-daynight { width: 38px; height: 38px; font-size: 15px; }
}
