/* ═══════════════════════════════════════════
   狸尾滑鼠節奏 · Mouse Rhythm Club
   美術借鏡 RhythmLab（狸尾節奏公寓）的深夜酒吧語彙
   ═══════════════════════════════════════════ */
:root {
  --ink: #1d2725;
  --paper: #fff8e8;
  --coral: #ef725f;
  --coral-dark: #aa463c;
  --cyan: #65b8aa;
  --cyan-dark: #256f68;
  --yellow: #f2c85b;
  --violet: #758ab5;
  --track: #152c2c;
  --track-soft: #23403d;
  --wood: #9b613d;
  --font-display: "Arial Black", "Noto Sans TC", system-ui, sans-serif;
  --font-body: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--paper);
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(101, 184, 170, .14), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(239, 114, 95, .12), transparent 60%),
    linear-gradient(180deg, #0d1d1c 0%, var(--track) 55%, #0f2220 100%);
  overflow-x: hidden;
  cursor: default;
}

.screen { min-height: 100dvh; display: flex; flex-direction: column; }
.screen[hidden] { display: none; }

/* ── 選歌畫面 ─────────────────────────── */
#screen-menu { padding: 34px 20px 30px; max-width: 760px; margin: 0 auto; }

.masthead { text-align: center; margin-bottom: 22px; }

.logo {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 3.2rem);
  letter-spacing: .06em;
  color: var(--paper);
  text-shadow: 0 0 18px rgba(242, 200, 91, .35), 0 3px 0 rgba(0, 0, 0, .45);
}
.logo::after {
  content: "♪";
  color: var(--coral);
  margin-left: 10px;
  text-shadow: 0 0 14px rgba(239, 114, 95, .8);
}

.logo-sub {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .22em;
  color: var(--cyan);
}

.howto {
  margin: 16px auto 0;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: .85rem;
  color: #cfd9c8;
}
.howto span b {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--coral-dark);
  color: var(--paper);
  font-size: .72rem;
  margin-right: 4px;
}

.menu-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(21, 44, 44, .72);
  border: 1px solid rgba(255, 248, 232, .14);
  border-radius: 18px;
  padding: 22px;
  backdrop-filter: blur(6px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .4);
}

/* 表演者 */
.performer-wrap {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}
.performer-wrap img {
  width: 132px;
  height: 132px;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid rgba(255, 248, 232, .22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  background: var(--track-soft);
}
.performer-caption {
  font-size: .9rem;
  color: var(--yellow);
  padding-bottom: 8px;
}

/* 歌單：單欄垂直（不並排卡片） */
.song-panel { display: flex; flex-direction: column; gap: 8px; }

.song-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid rgba(255, 248, 232, .16);
  padding-bottom: 6px;
}
.song-head-label { font-family: var(--font-display); font-size: 1rem; letter-spacing: .1em; }
.song-head-count { font-family: var(--font-mono); color: var(--cyan); font-size: .8rem; }

.song-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 216px;
  overflow-y: auto;
  padding-right: 4px;
}

.song-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 248, 232, .1);
  background: rgba(35, 64, 61, .5);
  color: var(--paper);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.song-card:hover { background: rgba(35, 64, 61, .95); border-color: rgba(101, 184, 170, .5); }
.song-card.is-selected {
  background: var(--coral-dark);
  border-color: var(--coral);
  box-shadow: 0 0 16px rgba(239, 114, 95, .35);
}
.song-card .song-num { font-family: var(--font-mono); color: var(--cyan); font-size: .8rem; }
.song-card.is-selected .song-num { color: #ffe9d8; }
.song-card .song-title { font-weight: 800; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-card .song-meta { font-family: var(--font-mono); font-size: .7rem; color: rgba(255, 248, 232, .78); }
.song-card.is-selected .song-meta { color: rgba(255, 248, 232, .85); }

/* 難度 */
.difficulty-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.difficulty-option {
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 248, 232, .16);
  background: rgba(21, 44, 44, .8);
  color: var(--paper);
  font: 800 .9rem var(--font-body);
  cursor: pointer;
  transition: all .15s;
}
.difficulty-option small { display: block; font-family: var(--font-mono); font-weight: 400; font-size: .62rem; color: rgba(255, 248, 232, .5); margin-top: 2px; }
.difficulty-option.is-selected { background: var(--cyan-dark); border-color: var(--cyan); box-shadow: 0 0 14px rgba(101, 184, 170, .4); }
.difficulty-option.is-selected small { color: #d8fff4; }

/* 開始按鈕 */
.start-button {
  margin-top: 4px;
  padding: 16px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(180deg, var(--coral), var(--coral-dark));
  color: var(--paper);
  font: 900 1.15rem var(--font-display);
  letter-spacing: .3em;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(239, 114, 95, .35);
  transition: transform .12s, opacity .15s;
}
.start-button:hover:not(:disabled) { transform: translateY(-2px); }
.start-button:disabled { opacity: .4; cursor: not-allowed; }

.copyright {
  margin-top: 20px;
  text-align: center;
  font-size: .72rem;
  color: rgba(255, 248, 232, .45);
}

/* ── 遊戲畫面 ─────────────────────────── */
#screen-game {
  padding: 10px 14px max(12px, env(safe-area-inset-bottom));
  width: 100%; max-width: 1280px; margin: 0 auto;
  flex-direction: column; min-height: 0;
}

.game-hud {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 14px;
  align-items: baseline;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(21, 44, 44, .8);
  border: 1px solid rgba(255, 248, 232, .12);
  font-family: var(--font-mono);
  font-size: .78rem;
  color: rgba(255, 248, 232, .7);
}
.game-hud b { color: var(--paper); font-size: 1rem; }
.hud-song { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; color: var(--paper); }
.hud-accuracy { color: var(--hx-neon, #6ee7ff); white-space: nowrap; }
.hud-grade { font-family: var(--font-display); font-size: 1.2rem; color: var(--yellow); }

.stage {
  position: relative;
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 12px;
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(500px 300px at 50% 30%, rgba(101, 184, 170, .08), transparent 70%),
    linear-gradient(180deg, rgba(13, 29, 28, .9), rgba(21, 44, 44, .95));
  border: 1px solid rgba(255, 248, 232, .1);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .5);
}
#lane { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; }

.judge-line {
  position: absolute;
  left: 8%; right: 8%;
  bottom: 12%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--coral) 18%, var(--coral) 82%, transparent);
  box-shadow: 0 0 14px rgba(239, 114, 95, .8);
  pointer-events: none;
}
.judge-line-text {
  position: absolute;
  right: 0;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: .6rem;
  letter-spacing: .3em;
  color: rgba(242, 200, 91, .8);
  white-space: nowrap;
}

.judge-pop {
  position: absolute;
  left: 50%;
  bottom: 9%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: .1em;
  pointer-events: none;
  opacity: 0;
}
.judge-pop.is-show { animation: judge-pop .4s ease-out; }
.judge-pop.p-perfect { color: var(--yellow); text-shadow: 0 0 18px rgba(242, 200, 91, .9); }
.judge-pop.p-great { color: var(--cyan); text-shadow: 0 0 14px rgba(101, 184, 170, .9); }
.judge-pop.p-good { color: var(--violet); text-shadow: 0 0 10px rgba(117, 138, 181, .8); }
.judge-pop.p-miss { color: var(--coral); text-shadow: 0 0 10px rgba(239, 114, 95, .8); }
@keyframes judge-pop {
  0% { opacity: 0; transform: translateX(-50%) scale(.5); }
  25% { opacity: 1; transform: translateX(-50%) scale(1.15); }
  60% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(.9) translateY(-26px); }
}

.reaction {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(255, 248, 232, .25);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.reaction.is-show { opacity: 1; }

.progress-track {
  margin-top: 10px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 248, 232, .12);
  overflow: hidden;
}
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--cyan), var(--yellow)); border-radius: 3px; }

.game-hint {
  margin-top: 10px;
  text-align: center;
  font-size: .8rem;
  color: rgba(255, 248, 232, .6);
}

.game-exit {
  position: fixed;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 248, 232, .2);
  background: rgba(21, 44, 44, .85);
  color: rgba(255, 248, 232, .7);
  font-size: .78rem;
  cursor: pointer;
  transition: all .15s;
  z-index: 5;
}
.game-exit:hover { color: var(--paper); border-color: var(--coral); }
/* HUD 已有一致的 Pause 控制；移除舊版右下角重複按鈕。 */
.game-exit { display: none; }

/* ── 結算畫面 ─────────────────────────── */
#screen-result { padding: 30px 20px; max-width: 520px; margin: 0 auto; justify-content: center; }

.result-card {
  background: rgba(21, 44, 44, .9);
  border: 1px solid rgba(255, 248, 232, .16);
  border-radius: 20px;
  padding: 30px 26px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.result-title { font-family: var(--font-display); font-size: 1.1rem; letter-spacing: .3em; color: var(--cyan); }

.result-grade {
  font-family: var(--font-display);
  font-size: 5rem;
  line-height: 1;
  margin: 14px 0 6px;
  color: var(--yellow);
  text-shadow: 0 0 30px rgba(242, 200, 91, .5);
}
.result-score { font-family: var(--font-mono); font-size: .9rem; color: rgba(255, 248, 232, .75); }
.result-score b { color: var(--paper); font-size: 1.3rem; }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}
.result-stats div {
  background: rgba(35, 64, 61, .6);
  border-radius: 10px;
  padding: 10px 6px;
}
.result-stats span { display: block; font-size: .68rem; color: rgba(255, 248, 232, .55); }
.result-stats b { font-size: .95rem; color: var(--paper); }

.result-judges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  font-family: var(--font-mono);
  font-size: .68rem;
}
.result-judges span { padding: 6px 2px; border-radius: 6px; }
.j-perfect { color: var(--yellow); background: rgba(242, 200, 91, .1); }
.j-great { color: var(--cyan); background: rgba(101, 184, 170, .1); }
.j-good { color: var(--violet); background: rgba(117, 138, 181, .1); }
.j-miss { color: var(--coral); background: rgba(239, 114, 95, .1); }

.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.result-actions button {
  padding: 14px;
  border-radius: 10px;
  border: none;
  font: 800 .95rem var(--font-body);
  cursor: pointer;
  transition: transform .12s;
}
.result-actions button:hover { transform: translateY(-2px); }
#btn-retry { background: linear-gradient(180deg, var(--coral), var(--coral-dark)); color: var(--paper); }
#btn-back { background: var(--track-soft); color: var(--paper); border: 1px solid rgba(255, 248, 232, .2) !important; }

/* 窄螢幕 */
@media (max-width: 520px) {
  .difficulty-panel { grid-template-columns: 1fr; }
  .result-judges { grid-template-columns: repeat(2, 1fr); }
  .game-hud { grid-template-columns: 1fr auto; row-gap: 4px; }
  .hud-song { grid-column: 1 / -1; }
}

/* ── 新玩法（CIRRING 式）新增樣式 ────────────────── */
.core-rule {
  margin-top: 10px;
  font-size: .92rem;
  font-weight: 700;
  color: var(--yellow);
  background: rgba(242, 200, 91, .08);
  border: 1px solid rgba(242, 200, 91, .3);
  border-radius: 8px;
  padding: 8px 12px;
  display: inline-block;
}

.song-card.is-locked { opacity: .5; cursor: not-allowed; }
.song-card.is-locked:hover { background: rgba(35, 64, 61, .5); border-color: rgba(255,248,232,.1); }

.menu-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.menu-links button {
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 248, 232, .16);
  background: rgba(21, 44, 44, .8);
  color: var(--paper);
  font: 700 .85rem var(--font-body);
  cursor: pointer;
  transition: all .15s;
}
.menu-links button:hover { border-color: var(--cyan); color: var(--cyan); }

.stage.hide-cursor, .tutorial-stage.hide-cursor { cursor: none !important; }

.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 22, 21, .72);
  backdrop-filter: blur(4px);
  z-index: 10;
}
.game-overlay[hidden] { display: none; }
.overlay-card {
  background: rgba(21, 44, 44, .95);
  border: 1px solid rgba(255, 248, 232, .2);
  border-radius: 16px;
  padding: 26px 30px;
  text-align: center;
  display: grid;
  gap: 12px;
  min-width: 260px;
}
.overlay-title { font-family: var(--font-display); font-size: 1.2rem; color: var(--yellow); margin-bottom: 4px; }
.overlay-card button {
  padding: 12px;
  border-radius: 10px;
  border: none;
  font: 800 .95rem var(--font-body);
  cursor: pointer;
  background: var(--track-soft);
  color: var(--paper);
  border: 1px solid rgba(255, 248, 232, .18);
}
.overlay-card button:first-of-type { background: linear-gradient(180deg, var(--coral), var(--coral-dark)); border: none; }
.overlay-card button:hover { transform: translateY(-1px); }

/* 結算六欄 */
.result-stats { grid-template-columns: repeat(3, 1fr); }

/* 設定 */
.settings-card { text-align: left; max-height: 88dvh; overflow-y: auto; }
.setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(255, 248, 232, .08);
}
.setting-label { font-size: .88rem; color: rgba(255, 248, 232, .85); grid-column: 1 / -1; }
.setting-row input[type="range"] { width: 100%; accent-color: var(--cyan); }
.setting-value { font-family: var(--font-mono); font-size: .8rem; color: var(--yellow); grid-column: 1 / -1; justify-self: end; }
.setting-row button {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 248, 232, .2);
  background: var(--track-soft);
  color: var(--paper);
  font: 700 .85rem var(--font-body);
  cursor: pointer;
}
.switch { position: relative; display: inline-block; width: 52px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0;
  background: rgba(255, 248, 232, .18);
  border-radius: 28px;
  transition: .2s;
  cursor: pointer;
}
.switch span::before {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  left: 3px; top: 3px;
  background: var(--paper);
  border-radius: 50%;
  transition: .2s;
}
.switch input:checked + span { background: var(--cyan-dark); }
.switch input:checked + span::before { transform: translateX(24px); }

/* 教學 */
.tutorial-card { max-width: 640px; }
.tutorial-stage {
  position: relative;
  margin: 16px auto 0;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(13, 29, 28, .9), rgba(21, 44, 44, .95));
  border: 1px solid rgba(255, 248, 232, .1);
  min-height: 300px;
}
#tutorial-canvas { display: block; width: 100%; height: 300px; cursor: none; }
.tutorial-text {
  margin-top: 14px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--paper);
  min-height: 1.4em;
}
.tutorial-step { margin-top: 6px; font-family: var(--font-mono); font-size: .8rem; color: var(--cyan); }
.tutorial-card .result-actions { margin-top: 14px; }
#btn-tut-next:disabled { opacity: .4; cursor: not-allowed; }

/* ── 體力條 HUD（CIRRING Fidelity）── */
.hud-life {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 160px;
  height: 16px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 0.72rem;
  color: #cfe3dc;
}
.hud-life-fill {
  height: 8px;
  border-radius: 4px;
  background: #3ddc84;
  transition: width 0.15s linear;
  min-width: 2px;
}

/* ── 手機遊玩（MOBILE PLAYABILITY）：touch-action 只限遊戲畫布 ── */
#lane {
  touch-action: none; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
#stage { touch-action: none; }
#lane { cursor: crosshair; }
#lane:active { cursor: none; }
.hide-cursor, .hide-cursor * { cursor: none !important; }

/* 全螢幕根容器 */
#app, #menu, #game, .screen { width: 100vw; height: 100dvh; }
@supports not (height: 100dvh) { #app, #menu, #game, .screen { height: 100vh; } }

/* ── Landscape-first：直向提示 ── */
.rotate-hint {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: #070b10; color: #8fe3c0;
  align-items: center; justify-content: center;
  text-align: center; font-size: 1.1rem; line-height: 1.8;
}
@media (orientation: portrait) and (max-width: 900px) {
  .rotate-hint { display: flex; }
  .rotate-hint .rh-inner { padding: 24px; }
  .rotate-hint small { display: block; color: #6a8a80; margin-top: 12px; font-size: 0.85rem; }
  .rotate-hint button { margin-top: 16px; min-height: 48px; padding: 10px 22px; border-radius: 10px; border: 1px solid #3a6a50; background: #142a20; color: #8fe3c0; font-size: 1rem; }
}

/* ── Safe area ── */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}
#game { padding-left: var(--sal); padding-right: var(--sar); }
.hud { padding-top: var(--sat); }

/* ── 觸控目標（主機風格的按鈕基礎）── */
.menu-links button, .difficulty-option, .start-button {
  min-height: 48px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.start-button:active, .menu-links button:active, .difficulty-option:active {
  transform: scale(0.96);
  transition: transform 0.06s;
}

/* ═══════════ 主機遊戲化 UI（P2）═══════════ */
:root {
  --hx-bg: #070a12;
  --hx-panel: rgba(18, 26, 40, 0.72);
  --hx-border: #2a3a56;
  --hx-neon: #6ee7ff;
  --hx-neon2: #b47cff;
  --hx-accent: #ffd27a;
  --hx-text: #e6f2ff;
  --hx-dim: #7d93ad;
}
body, .screen { background: radial-gradient(120% 100% at 70% 0%, #101a2e 0%, #0a0e1a 45%, #070a12 100%); }
.logo {
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 900; letter-spacing: 0.06em;
  background: linear-gradient(120deg, var(--hx-neon) 0%, var(--hx-neon2) 55%, var(--hx-accent) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(110, 231, 255, 0.35));
}
.logo-sub { color: var(--hx-dim); letter-spacing: 0.14em; font-size: 0.85rem; }
.howto span, .core-rule { background: var(--hx-panel); border: 1px solid var(--hx-border); border-radius: 12px; backdrop-filter: blur(8px); }
.song-card {
  background: linear-gradient(135deg, rgba(22,32,50,.9), rgba(12,18,30,.9));
  border: 1px solid var(--hx-border); border-radius: 14px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.song-card.is-selected {
  border-color: var(--hx-neon);
  box-shadow: 0 0 0 1px var(--hx-neon), 0 0 24px rgba(110,231,255,.25);
  transform: translateX(6px);
}
.song-card.is-locked { opacity: .45; }
.song-num { color: var(--hx-neon); font-weight: 800; }
.song-title { color: var(--hx-text); font-weight: 700; }
.song-meta { color: var(--hx-dim); font-size: .75rem; }
.difficulty-option {
  border-radius: 12px; font-weight: 800; letter-spacing: .08em;
  background: rgba(16,24,40,.85); border: 1px solid var(--hx-border); color: var(--hx-text);
}
.difficulty-option.is-selected { border-color: var(--hx-accent); color: var(--hx-accent); box-shadow: 0 0 18px rgba(255,210,122,.25); }
.start-button {
  border-radius: 14px; font-weight: 900; letter-spacing: .1em; font-size: 1.05rem;
  background: linear-gradient(120deg, #16354a, #1c4a5e); border: 1px solid var(--hx-neon);
  color: #eaffff; box-shadow: 0 0 22px rgba(110,231,255,.35);
}
.start-button:disabled { opacity: .4; box-shadow: none; }
.menu-links button {
  border-radius: 10px; background: rgba(16,24,40,.8); border: 1px solid var(--hx-border);
  color: var(--hx-text); backdrop-filter: blur(6px);
}
.menu-links button:hover { border-color: var(--hx-neon); }
/* HUD：Combo 中央偏上放大 */
.hud-combo {
  position: absolute; left: 50%; top: calc(var(--sat, 0px) + 8px); transform: translateX(-50%);
  font-size: 1.7rem; font-weight: 900; color: var(--hx-text);
  text-shadow: 0 0 16px rgba(110,231,255,.6);
  background: none; border: none; padding: 0;
}
.hud-combo b { color: var(--hx-neon); }
.hud { background: linear-gradient(180deg, rgba(10,14,24,.9), rgba(10,14,24,.55) 70%, transparent); border-bottom: none; }
/* 結算：Rank 大顯示 */
.result-card { border-radius: 20px; background: linear-gradient(160deg, rgba(18,26,44,.95), rgba(10,14,26,.95)); border: 1px solid var(--hx-border); backdrop-filter: blur(10px); }
.result-grade { font-size: clamp(2.6rem, 8vw, 4rem); font-weight: 900; letter-spacing: .12em; }
.result-grade[data-rank="S"] { color: var(--hx-accent); text-shadow: 0 0 28px rgba(255,210,122,.5); }
.result-grade[data-rank="A"] { color: var(--hx-neon); text-shadow: 0 0 24px rgba(110,231,255,.5); }
.result-grade[data-rank="B"] { color: #7ee8a0; }
.result-grade[data-rank="C"] { color: var(--hx-dim); }
.result-grade[data-rank="D"], .result-grade[data-rank="F"] { color: #ef725f; }
.result-title { letter-spacing: .2em; }
/* 轉場 */
.screen { animation: hx-in .28s ease both; }
@keyframes hx-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .hud-combo { font-size: 1.3rem; }
  .result-grade { font-size: 2.4rem; }
}

/* ═══════════ PORTRAIT-FIRST CONSOLE UI ═══════════ */
:root { --app-width: 100vw; --app-height: 100dvh; }
html, body { height: 100%; }
body { overflow: hidden; }
.screen {
  width: var(--app-width, 100vw);
  height: var(--app-height, 100dvh);
  max-width: 100%;
  overflow: hidden;
  display: none;
  position: fixed; inset: 0; z-index: 1;
}
.screen.is-active, .screen[hidden] { display: none; }
.screen.is-active:not([hidden]) { display: flex; }
.screen:not([hidden]) { display: flex; }

/* ── Title Scene ── */
.title-shell {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 3dvh) 24px calc(env(safe-area-inset-bottom, 0px) + 3dvh);
}
.title-logo-wrap { text-align: center; margin-top: 4dvh; }
.title-logo { max-height: 16dvh; font-size: clamp(1.6rem, 7vw, 2.6rem); }
.logo-sub { font-size: 0.72rem; letter-spacing: 0.3em; color: #7d93ad; margin-top: 6px; }
.title-main { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.title-footer { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.title-footer .copyright { margin-top: 14px; color: #55677e; font-size: 0.68rem; }
.btn-primary {
  min-height: 62px; width: min(82%, 420px);
  border-radius: 16px; border: 1px solid var(--hx-neon, #6ee7ff);
  background: linear-gradient(120deg, #16354a, #1c4a5e);
  color: #eaffff; font-size: 1.15rem; font-weight: 900; letter-spacing: 0.12em;
  box-shadow: 0 0 24px rgba(110,231,255,.35);
}
.btn-ghost {
  min-height: 56px; width: min(70%, 380px);
  border-radius: 14px; border: 1px solid var(--hx-border, #2a3a56);
  background: rgba(16,24,40,.8); color: var(--hx-text, #e6f2ff);
  font-size: 1rem; font-weight: 700; letter-spacing: 0.08em;
}
.btn-ghost:active, .btn-primary:active { transform: scale(0.96); }

/* ── Song Select Scene ── */
.songselect-shell {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 14px calc(env(safe-area-inset-bottom, 0px) + 16px);
  position: relative;
}
.songselect-top {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 2px 10px; flex: 0 0 auto;
}
.btn-round {
  width: 52px; height: 52px; min-height: 52px;
  border-radius: 50%; border: 1px solid var(--hx-border, #2a3a56);
  background: rgba(16,24,40,.85); color: #dce; font-size: 1.6rem; line-height: 1;
}
.songselect-title { font-size: 1.05rem; font-weight: 800; letter-spacing: 0.1em; color: var(--hx-text, #e6f2ff); flex: 1; }
.songselect-count { color: var(--hx-dim, #7d93ad); font-size: 0.8rem; }
.song-carousel {
  flex: 1 1 auto; min-height: 0;
  touch-action: pan-y; overscroll-behavior: contain;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; align-items: center;
}
.song-list {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; padding: 6px 2px 10px;
}
.song-card {
  min-height: 84px; width: 100%;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  padding: 12px 16px; text-align: left;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(22,32,50,.92), rgba(12,18,30,.92));
  border: 1px solid var(--hx-border, #2a3a56);
  color: var(--hx-text, #e6f2ff);
  font-size: 1.05rem; font-weight: 700;
}
.song-card.is-selected {
  border-color: var(--hx-neon, #6ee7ff);
  box-shadow: 0 0 0 1px var(--hx-neon, #6ee7ff), 0 0 24px rgba(110,231,255,.22);
}
.song-card.is-locked { opacity: .45; }
.song-title { font-size: 1.05rem; font-weight: 800; }
.song-meta { font-size: 0.72rem; color: var(--hx-dim, #7d93ad); }
.difficulty-panel {
  flex: 0 0 auto;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  padding: 10px 0 12px;
}
.difficulty-option {
  min-height: 56px; border-radius: 14px; font-size: 0.85rem; font-weight: 800;
  background: rgba(16,24,40,.85); border: 1px solid var(--hx-border, #2a3a56); color: var(--hx-text, #e6f2ff);
}
.difficulty-option.is-selected { border-color: var(--hx-accent, #ffd27a); color: var(--hx-accent, #ffd27a); box-shadow: 0 0 16px rgba(255,210,122,.25); }
.start-button {
  flex: 0 0 auto;
  min-height: 60px; width: 100%;
  border-radius: 16px; border: 1px solid var(--hx-neon, #6ee7ff);
  background: linear-gradient(120deg, #16354a, #1c4a5e);
  color: #eaffff; font-size: 1.1rem; font-weight: 900; letter-spacing: 0.1em;
  box-shadow: 0 0 20px rgba(110,231,255,.3);
}
.start-button:disabled { opacity: .4; box-shadow: none; }

/* ── Tools Scene ── */
.tools-shell {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 14px calc(env(safe-area-inset-bottom, 0px) + 16px);
}
.tools-list { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-top: 18px; }
.btn-tool {
  min-height: 60px; border-radius: 14px;
  border: 1px solid var(--hx-border, #2a3a56);
  background: rgba(16,24,40,.85); color: var(--hx-text, #e6f2ff);
  font-size: 1rem; font-weight: 700; letter-spacing: 0.04em;
}
.tools-note { color: #55677e; font-size: 0.72rem; text-align: center; padding-bottom: 8px; }

/* ── Pause 中央 Overlay ── */
#game-overlay {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 9, 16, 0.72);
}
#game-overlay[hidden] { display: none !important; }
#game-overlay .overlay-card {
  width: min(86%, 380px);
  background: linear-gradient(160deg, rgba(18,26,44,.97), rgba(10,14,26,.97));
  border: 1px solid var(--hx-border, #2a3a56);
  border-radius: 20px; padding: 24px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
#game-overlay .overlay-card button {
  min-height: 56px; border-radius: 14px; font-size: 1rem; font-weight: 800;
  background: rgba(20,30,48,.9); border: 1px solid var(--hx-border, #2a3a56); color: var(--hx-text, #e6f2ff);
}
#game-overlay .overlay-card button:active { transform: scale(0.97); }
.overlay-reason {
  min-height: 1.2em;
  color: var(--hx-dim, #7d93ad);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

/* ── 直向 HUD ── */
@media (orientation: portrait) {
  #hud { padding-top: calc(var(--sat, 0px) + 6px); }
  .hud-combo { top: calc(var(--sat, 0px) + 6px); font-size: 1.4rem; }
  #hud .hud-left { font-size: 0.72rem; }
}

/* ── 移除旋轉提示（portrait-first）── */
.rotate-hint { display: none !important; }

/* ── Pause 按鈕（HUD 右上）── */
.hud-pause {
  position: absolute; top: calc(var(--sat, 0px) + 4px); right: calc(var(--sar, 0px) + 10px);
  width: 52px; height: 52px; min-height: 52px;
  border-radius: 14px; border: 1px solid rgba(110,231,255,.5);
  background: rgba(14,22,36,.85); color: #dff6ff; font-size: 1rem;
  z-index: 30; display: flex; align-items: center; justify-content: center;
}

/* ── 手機遊戲 HUD：歌曲、三項成績、體力各自成列，不與 Pause 疊在一起 ── */
@media (max-width: 600px) {
  #screen-game { padding: 6px 6px max(8px, env(safe-area-inset-bottom)); }
  .game-hud {
    position: relative;
    grid-template-columns: 1fr auto auto auto;
    grid-template-areas:
      "song song song song"
      "score combo ok accuracy"
      "life life life life";
    gap: 4px 10px;
    padding: 8px 10px;
    font-size: 0.68rem;
  }
  .hud-song { grid-area: song; padding-right: 54px; min-height: 18px; }
  .hud-score { grid-area: score; text-align: left; }
  .hud-combo {
    grid-area: combo;
    position: static; transform: none;
    font-size: 0.84rem; line-height: 1.2; text-align: center;
    white-space: nowrap;
  }
  .hud-ok { grid-area: ok; text-align: right; white-space: nowrap; padding-right: 48px; }
  .hud-accuracy { grid-area: accuracy; text-align: right; white-space: nowrap; }
  .hud-life { grid-area: life; width: 100%; height: 14px; padding: 2px 6px; }
  .hud-life-fill { height: 7px; }
  .hud-pause {
    top: 6px; right: 7px;
    width: 46px; height: 46px; min-height: 46px;
    border-radius: 12px;
  }
  .game-hint { margin-top: 4px; font-size: 0.68rem; line-height: 1.3; }
  .game-exit { display: none; }
  .progress-track { margin-top: 5px; }
}

/* ═══════════ RESPONSIVE CONSOLE / MOBILE MENU ═══════════ */
#screen-title,
#screen-menu {
  overflow: auto;
  isolation: isolate;
}

#screen-title::before,
#screen-menu::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(rgba(110, 231, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 231, 255, .035) 1px, transparent 1px),
    radial-gradient(700px 420px at 78% 12%, rgba(110, 231, 255, .13), transparent 70%),
    radial-gradient(620px 500px at 14% 90%, rgba(180, 124, 255, .12), transparent 72%);
  background-size: 36px 36px, 36px 36px, auto, auto;
}

#screen-title::after,
#screen-menu::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 0 42%, rgba(110, 231, 255, .04) 42.1% 42.3%, transparent 42.4% 100%);
}

#screen-title .title-shell {
  width: min(100%, 1360px);
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 42px) clamp(18px, 5vw, 72px) max(22px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  align-content: center;
  gap: clamp(18px, 3vh, 34px);
}

.title-topbar,
.songselect-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.title-brand,
.title-status,
.songselect-kicker,
.songselect-online,
.title-kicker,
.preview-panel-kicker,
.song-browser-head,
.difficulty-heading,
.title-hint {
  font: 700 .68rem var(--font-mono);
  letter-spacing: .14em;
  color: var(--hx-dim);
}

.title-brand,
.title-status,
.songselect-online {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.title-brand i,
.title-status b,
.songselect-online b {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hx-neon);
  box-shadow: 0 0 12px var(--hx-neon);
}

.title-status { color: #9aaeca; }
.title-status b { background: #7ee8a0; box-shadow: 0 0 12px #7ee8a0; }

.title-hero {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .84fr);
  align-items: center;
  gap: clamp(28px, 6vw, 100px);
}

.title-copy { min-width: 0; }
.title-kicker { margin-bottom: 18px; color: var(--hx-neon); }
.title-logo-wrap { margin: 0; text-align: left; }
.title-logo {
  max-width: 760px;
  font-size: clamp(2.7rem, 7.5vw, 6.6rem);
  line-height: .98;
  letter-spacing: .04em;
}
.title-logo::after { display: none; }
.title-logo-wrap .logo-sub {
  margin-top: 14px;
  font-size: clamp(.65rem, 1.2vw, .9rem);
  letter-spacing: .38em;
}
.title-tagline {
  max-width: 520px;
  margin-top: 24px;
  color: var(--hx-text);
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  letter-spacing: .08em;
}
.title-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 26px;
}
.title-metrics span {
  padding: 9px 11px;
  border: 1px solid rgba(110, 231, 255, .16);
  border-radius: 9px;
  background: rgba(12, 18, 30, .56);
  color: var(--hx-dim);
  font: 700 .63rem var(--font-mono);
  letter-spacing: .08em;
}
.title-metrics b { color: var(--hx-accent); margin-right: 5px; }

.title-preview {
  position: relative;
  width: min(100%, 590px);
  aspect-ratio: 1.23;
  justify-self: end;
  overflow: hidden;
  border: 1px solid rgba(110, 231, 255, .3);
  border-radius: 22px;
  background: rgba(8, 14, 25, .8);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45), inset 0 0 60px rgba(110, 231, 255, .08);
}
.title-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.035) 0 1px, transparent 1px 5px);
  mix-blend-mode: screen;
  opacity: .55;
}
.title-preview-topline,
.title-preview-bottomline {
  position: absolute;
  z-index: 3;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font: 700 .62rem var(--font-mono);
  letter-spacing: .12em;
  color: #86a2bd;
}
.title-preview-topline { top: 16px; }
.title-preview-topline b { color: #7ee8a0; }
.title-preview-bottomline { bottom: 16px; color: #607b98; }
.title-preview-grid {
  position: absolute;
  inset: 48px 24px 48px;
  background:
    linear-gradient(rgba(110,231,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110,231,255,.08) 1px, transparent 1px);
  background-size: 20% 25%;
  border: 1px solid rgba(110, 231, 255, .15);
}
.title-preview-grid::before,
.title-preview-grid::after {
  content: "";
  position: absolute;
  background: rgba(110, 231, 255, .13);
}
.title-preview-grid::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.title-preview-grid::after { top: 50%; left: 0; right: 0; height: 1px; }
.title-ring {
  position: absolute;
  width: 68px;
  aspect-ratio: 1;
  border: 2px solid var(--hx-neon);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(110,231,255,.65), inset 0 0 12px rgba(110,231,255,.2);
  animation: title-ring-pulse 2.8s ease-in-out infinite;
}
.title-ring::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(255, 210, 122, .8);
  border-radius: 50%;
}
.title-ring-a { left: 18%; top: 23%; }
.title-ring-b { right: 19%; top: 43%; width: 54px; border-color: var(--hx-neon2); animation-delay: -.8s; }
.title-ring-c { left: 42%; bottom: 14%; width: 42px; border-color: var(--hx-accent); animation-delay: -1.6s; }
.title-route {
  position: absolute;
  left: 25%;
  top: 42%;
  width: 48%;
  border-top: 2px dashed rgba(242, 200, 91, .75);
  transform: rotate(16deg);
  transform-origin: left center;
  filter: drop-shadow(0 0 5px rgba(242, 200, 91, .65));
}
.title-cursor {
  position: absolute;
  left: 48%;
  top: 38%;
  width: 12px;
  height: 12px;
  border: 2px solid #fff8e8;
  border-radius: 50%;
  background: #fff8e8;
  box-shadow: 0 0 0 8px rgba(255, 248, 232, .12), 0 0 22px #fff8e8;
  animation: title-cursor-drift 3.8s ease-in-out infinite;
}
@keyframes title-ring-pulse {
  0%, 100% { transform: scale(.9); opacity: .55; }
  48% { transform: scale(1.08); opacity: 1; }
}
@keyframes title-cursor-drift {
  0%, 100% { transform: translate(-34px, 24px); }
  50% { transform: translate(44px, -18px); }
}

#screen-title .title-main {
  width: min(100%, 430px);
  justify-self: start;
  align-items: flex-start;
  gap: 10px;
}
#screen-title .btn-primary {
  width: 100%;
  min-height: 68px;
  border-radius: 15px;
  background: linear-gradient(110deg, #1e5168, #614489 75%, #86574a);
  box-shadow: 0 12px 34px rgba(110, 231, 255, .22), inset 0 1px 0 rgba(255,255,255,.22);
  font-size: 1.1rem;
}
#screen-title .btn-primary::after {
  content: "START / ENTER";
  display: block;
  margin-top: 4px;
  color: rgba(230, 242, 255, .58);
  font: 700 .56rem var(--font-mono);
  letter-spacing: .2em;
}
.title-hint { margin-left: 4px; letter-spacing: .08em; color: #607b98; }
.title-hint kbd {
  padding: 3px 6px;
  border: 1px solid rgba(125, 147, 173, .42);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--hx-text);
  font: 700 .6rem var(--font-mono);
}
.title-hint span { margin: 0 5px; color: var(--hx-neon); }

#screen-title .title-footer {
  width: min(100%, 430px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-items: stretch;
  justify-self: start;
}
#screen-title .btn-ghost {
  width: 100%;
  min-height: 54px;
  padding: 9px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 11px;
  background: rgba(12, 18, 30, .58);
}
#screen-title .btn-ghost span { font-weight: 800; }
#screen-title .btn-ghost small {
  color: var(--hx-dim);
  font: 700 .55rem var(--font-mono);
  letter-spacing: .08em;
}
#screen-title .copyright {
  width: 100%;
  margin: 0;
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  color: #5d7692;
  font: 700 .6rem var(--font-mono);
  letter-spacing: .08em;
}

/* ── Song select ── */
#screen-menu {
  max-width: none;
  margin: 0;
  padding: 0;
}
#screen-menu .songselect-shell {
  width: min(100%, 1360px);
  min-height: 100%;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) clamp(14px, 4vw, 56px) max(18px, env(safe-area-inset-bottom));
  gap: clamp(14px, 2vh, 24px);
}
#screen-menu .songselect-top {
  flex: 0 0 auto;
  padding-bottom: 2px;
}
#screen-menu .btn-round {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  min-height: 48px;
  color: var(--hx-text);
  background: rgba(12, 18, 30, .72);
  transition: transform .15s, border-color .15s;
}
#screen-menu .btn-round:hover { border-color: var(--hx-neon); transform: translateX(-2px); }
.songselect-heading {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.songselect-kicker { color: var(--hx-neon); }
#screen-menu .songselect-title {
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  letter-spacing: .08em;
}
.songselect-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.songselect-online { color: #7ee8a0; font-size: .6rem; }
.songselect-online b { width: 6px; height: 6px; background: #7ee8a0; box-shadow: 0 0 10px #7ee8a0; }

.songselect-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(270px, .38fr) minmax(0, .62fr);
  gap: clamp(14px, 2vw, 28px);
}
.song-preview-panel,
.song-browser-panel {
  min-height: 0;
  border: 1px solid rgba(110, 231, 255, .18);
  border-radius: 20px;
  background: rgba(12, 18, 30, .68);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .28);
}
.song-preview-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(16px, 2vw, 26px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}
.song-preview-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(270px 220px at 20% 22%, rgba(110, 231, 255, .15), transparent 72%),
    linear-gradient(145deg, rgba(180, 124, 255, .12), transparent 44%);
}
.preview-panel-kicker,
.performer-wrap,
.preview-stats,
.preview-rule { position: relative; z-index: 1; }
.preview-panel-kicker {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--hx-neon);
}
.preview-panel-kicker span { color: var(--hx-dim); }
#screen-menu .performer-wrap {
  align-items: center;
  gap: 16px;
}
.performer-frame {
  position: relative;
  flex: 0 0 auto;
  width: clamp(112px, 14vw, 190px);
  aspect-ratio: 1;
  padding: 7px;
  border: 1px solid rgba(110, 231, 255, .42);
  border-radius: 18px;
  background: rgba(7, 10, 18, .66);
  box-shadow: 0 0 28px rgba(110, 231, 255, .13);
}
#screen-menu .performer-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 0;
  box-shadow: none;
}
.performer-scan {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 28%;
  height: 1px;
  background: var(--hx-neon);
  box-shadow: 0 0 10px var(--hx-neon);
  opacity: .65;
  animation: performer-scan 3s ease-in-out infinite;
}
@keyframes performer-scan {
  0%, 100% { transform: translateY(-18px); opacity: .15; }
  50% { transform: translateY(72px); opacity: .8; }
}
.preview-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.preview-selected-label {
  color: var(--hx-accent);
  font: 700 .58rem var(--font-mono);
  letter-spacing: .15em;
}
#screen-menu #song-selected-title {
  overflow: hidden;
  color: var(--hx-text);
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  line-height: 1.1;
  text-overflow: ellipsis;
}
#screen-menu .performer-caption {
  padding: 0;
  color: var(--hx-dim);
  font: 700 .72rem/1.5 var(--font-mono);
}
.preview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.preview-stats div {
  min-width: 0;
  padding: 10px 9px;
  border: 1px solid rgba(125, 147, 173, .16);
  border-radius: 10px;
  background: rgba(7, 10, 18, .4);
}
.preview-stats span {
  display: block;
  margin-bottom: 5px;
  color: var(--hx-dim);
  font: 700 .55rem var(--font-mono);
  letter-spacing: .08em;
}
.preview-stats b {
  display: block;
  overflow: hidden;
  color: var(--hx-text);
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#selected-status { color: #7ee8a0; }
.preview-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(125, 147, 173, .18);
  color: var(--hx-dim);
  font: 700 .62rem var(--font-mono);
  letter-spacing: .1em;
}
.preview-rule b { color: var(--hx-accent); }

.song-browser-panel {
  padding: clamp(14px, 2vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.song-browser-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}
.song-browser-head div { display: flex; flex-direction: column; gap: 4px; }
.song-browser-head div span { color: var(--hx-neon); }
.song-browser-head div b { color: var(--hx-text); font: 800 .85rem var(--font-body); letter-spacing: .06em; }
.song-browser-head small { color: #607b98; font: 700 .58rem var(--font-mono); letter-spacing: .06em; }
#screen-menu .song-carousel {
  flex: 1 1 auto;
  min-height: 180px;
  align-items: stretch;
  padding: 2px 3px 4px 0;
}
#screen-menu .song-list {
  width: 100%;
  min-height: min-content;
  gap: 8px;
  padding: 0 4px 4px 0;
}
#screen-menu .song-card {
  position: relative;
  min-height: 72px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 3px;
  padding: 12px 14px;
  border-radius: 13px;
  background: linear-gradient(105deg, rgba(20, 30, 48, .88), rgba(10, 15, 26, .78));
}
#screen-menu .song-card:hover:not(.is-locked) { transform: translateX(3px); border-color: rgba(110, 231, 255, .56); }
#screen-menu .song-card.is-selected {
  border-color: var(--hx-neon);
  background: linear-gradient(105deg, rgba(25, 66, 82, .9), rgba(21, 28, 52, .9));
  box-shadow: 0 0 0 1px rgba(110, 231, 255, .32), 0 0 28px rgba(110, 231, 255, .15);
  transform: translateX(5px);
}
#screen-menu .song-card .song-num {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--hx-neon);
  font-size: .72rem;
}
#screen-menu .song-card .song-title {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  color: var(--hx-text);
  font-size: .98rem;
}
#screen-menu .song-card .song-meta {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  color: var(--hx-dim);
  font-size: .65rem;
}
#screen-menu .song-card .song-state {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
  padding: 5px 7px;
  border: 1px solid rgba(126, 232, 160, .28);
  border-radius: 5px;
  color: #7ee8a0;
  font: 700 .56rem var(--font-mono);
  letter-spacing: .08em;
}
#screen-menu .song-card.is-locked .song-state {
  border-color: rgba(125, 147, 173, .24);
  color: var(--hx-dim);
}

.selection-controls {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  align-items: end;
  padding-top: 4px;
}
.difficulty-heading {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--hx-accent);
}
.difficulty-heading small { color: var(--hx-dim); font-size: .58rem; }
#screen-menu .difficulty-panel {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
}
#screen-menu .difficulty-option {
  min-height: 52px;
  padding: 8px 6px;
  border-radius: 10px;
  background: rgba(16, 24, 40, .78);
  font-size: .75rem;
}
#screen-menu .difficulty-option.is-selected {
  background: rgba(26, 79, 89, .72);
  border-color: var(--hx-accent);
  color: var(--hx-accent);
}
#screen-menu .start-button {
  grid-column: 2;
  grid-row: 2;
  min-width: 150px;
  min-height: 52px;
  margin: 0;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: .9rem;
  letter-spacing: .12em;
}
#screen-menu .start-button::after {
  content: "START PLAY";
  display: block;
  margin-top: 3px;
  color: rgba(230, 242, 255, .58);
  font: 700 .5rem var(--font-mono);
  letter-spacing: .16em;
}

/* Pause 時保留較清楚的 Canvas 游標與拖尾。 */
#game-overlay {
  background: rgba(6, 9, 16, .46);
  backdrop-filter: blur(3px);
}

@media (max-width: 1020px) and (min-width: 701px) {
  #screen-title .title-shell { padding-inline: 34px; }
  .title-hero { grid-template-columns: minmax(0, 1fr) minmax(300px, .8fr); gap: 28px; }
  .title-logo { font-size: clamp(2.5rem, 6vw, 4.5rem); }
  .title-preview { border-radius: 18px; }
  .songselect-layout { grid-template-columns: minmax(235px, .34fr) minmax(0, .66fr); }
  .song-preview-panel { padding: 16px; }
  #screen-menu .performer-wrap { align-items: flex-start; flex-direction: column; }
  .performer-frame { width: min(100%, 160px); }
}

@media (max-width: 1020px) and (min-width: 701px) and (orientation: portrait) {
  #screen-title .title-shell {
    grid-template-rows: auto 1fr auto auto auto;
    gap: 18px;
  }
  .title-hero {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }
  .title-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .title-logo-wrap { text-align: center; }
  .title-tagline { margin-inline: auto; }
  .title-metrics { justify-content: center; }
  .title-preview {
    width: min(76%, 500px);
    justify-self: center;
  }
  #screen-title .title-main,
  #screen-title .title-footer {
    justify-self: center;
  }
}

@media (max-width: 700px) {
  #screen-title .title-shell {
    min-height: 100%;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    gap: 20px;
  }

  .title-topbar { font-size: .58rem; }
  .title-status { display: none; }
  .title-hero {
    grid-template-columns: 1fr;
    gap: 20px;
    align-content: center;
  }
  .title-kicker { margin-bottom: 12px; font-size: .59rem; }
  .title-logo-wrap { text-align: center; }
  .title-logo { font-size: clamp(2.15rem, 11vw, 3.6rem); }
  .title-logo-wrap .logo-sub { margin-top: 9px; font-size: .6rem; }
  .title-tagline { margin: 16px auto 0; text-align: center; font-size: .95rem; }
  .title-metrics { justify-content: center; margin-top: 17px; gap: 6px; }
  .title-metrics span { padding: 7px 8px; font-size: .53rem; }
  .title-preview {
    width: min(100%, 430px);
    justify-self: center;
    border-radius: 16px;
  }
  .title-preview-grid { inset: 40px 18px 40px; }
  .title-preview-topline,
  .title-preview-bottomline { left: 12px; right: 12px; font-size: .52rem; }
  #screen-title .title-main,
  #screen-title .title-footer { width: 100%; justify-self: stretch; }
  #screen-title .title-main { align-items: stretch; }
  #screen-title .btn-primary { min-height: 62px; }
  .title-hint { align-self: center; font-size: .58rem; }
  #screen-title .copyright { justify-content: center; gap: 10px; font-size: .52rem; }

  #screen-menu .songselect-shell {
    padding-inline: 10px;
    gap: 12px;
  }
  #screen-menu .songselect-top { gap: 10px; }
  #screen-menu .btn-round { width: 44px; height: 44px; min-height: 44px; }
  .songselect-kicker { font-size: .53rem; }
  #screen-menu .songselect-title { font-size: 1.05rem; }
  .songselect-status { gap: 2px; }
  .songselect-online { font-size: .5rem; }
  .songselect-count { font-size: .63rem; }
  .songselect-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .song-preview-panel {
    flex: 0 0 auto;
    min-height: 148px;
    padding: 12px;
    gap: 10px;
    border-radius: 15px;
  }
  .preview-panel-kicker { font-size: .52rem; }
  #screen-menu .performer-wrap { gap: 10px; }
  .performer-frame { width: 82px; padding: 5px; border-radius: 11px; }
  #screen-menu .performer-wrap img { border-radius: 7px; }
  .preview-copy { gap: 4px; }
  .preview-selected-label { font-size: .5rem; }
  #screen-menu #song-selected-title { font-size: 1.15rem; }
  #screen-menu .performer-caption { font-size: .58rem; line-height: 1.35; }
  .preview-stats { gap: 5px; }
  .preview-stats div { padding: 6px 7px; }
  .preview-stats span { margin-bottom: 3px; font-size: .48rem; }
  .preview-stats b { font-size: .65rem; }
  .preview-rule { display: none; }
  .song-browser-panel {
    flex: 1 1 auto;
    min-height: 0;
    padding: 11px;
    gap: 8px;
    border-radius: 15px;
  }
  .song-browser-head { align-items: center; }
  .song-browser-head div b { font-size: .72rem; }
  .song-browser-head small { font-size: .48rem; }
  #screen-menu .song-carousel { min-height: 150px; }
  #screen-menu .song-list { gap: 6px; }
  #screen-menu .song-card { min-height: 62px; padding: 9px 10px; column-gap: 9px; }
  #screen-menu .song-card .song-title { font-size: .82rem; }
  #screen-menu .song-card .song-meta { font-size: .56rem; }
  #screen-menu .song-card .song-state { padding: 4px 5px; font-size: .48rem; }
  .selection-controls { gap: 7px 8px; }
  .difficulty-heading { font-size: .56rem; }
  .difficulty-heading small { font-size: .49rem; }
  #screen-menu .difficulty-panel { gap: 5px; }
  #screen-menu .difficulty-option {
    min-height: 46px;
    padding: 5px 3px;
    font-size: .63rem;
    letter-spacing: .02em;
  }
  #screen-menu .start-button {
    min-width: 116px;
    min-height: 46px;
    padding-inline: 8px;
    font-size: .72rem;
  }
  #screen-menu .start-button::after { font-size: .42rem; }
}

@media (max-width: 380px) {
  #screen-title .title-shell { gap: 14px; }
  .title-preview { aspect-ratio: 1.38; }
  .title-metrics span:last-child { display: none; }
  #screen-title .title-footer { gap: 5px; }
  #screen-title .btn-ghost { min-height: 50px; font-size: .82rem; }
  #screen-menu .song-preview-panel { min-height: 138px; }
  .performer-frame { width: 72px; }
  .preview-stats b { font-size: .59rem; }
  #screen-menu .song-card { min-height: 58px; }
  #screen-menu .song-card .song-num { font-size: .62rem; }
}

@media (prefers-reduced-motion: reduce) {
  .title-ring,
  .title-cursor,
  .performer-scan,
  .screen { animation: none; }
}

/* ═══════════ RHYTHMLAB PARITY VISUAL PASS ═══════════
   保留 MouseRhythm 的游標玩法，改用狸尾公寓的暖色舞台、樂團敘事與段落層級。
   ═══════════════════════════════════════════════════ */
:root {
  --mr-ink: #173a37;
  --mr-paper: #fff6dc;
  --mr-yellow: #f2c95b;
  --mr-coral: #c75448;
  --mr-coral-dark: #9f4038;
  --mr-cyan: #65b8aa;
  --mr-track: #173a37;
  --mr-track-deep: #102c2a;
  --mr-wood: #895337;
  --mr-line: rgba(255, 246, 220, .22);
}

/* 標題：像打開一台有角色的音樂遊戲，而不是工具儀表板。 */
#screen-title {
  color: var(--mr-ink);
  background:
    radial-gradient(620px 380px at 78% 14%, rgba(255, 246, 220, .22), transparent 72%),
    var(--mr-yellow);
}
#screen-title::before {
  background:
    linear-gradient(rgba(23, 58, 55, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 58, 55, .09) 1px, transparent 1px),
    radial-gradient(680px 460px at 88% 16%, rgba(23, 58, 55, .08), transparent 72%);
  background-size: 30px 30px, 30px 30px, auto;
}
#screen-title::after {
  background: linear-gradient(120deg, transparent 0 40%, rgba(255, 246, 220, .18) 40.2% 40.5%, transparent 40.7% 100%);
}
#screen-title .title-brand,
#screen-title .title-status,
#screen-title .title-kicker,
#screen-title .title-hint {
  color: rgba(23, 58, 55, .75);
}
#screen-title .title-brand i,
#screen-title .title-status b {
  background: var(--mr-coral);
  box-shadow: 0 0 10px rgba(199, 84, 72, .55);
}
#screen-title .title-status b { background: #277b65; }
#screen-title .logo {
  background: none;
  color: var(--mr-ink);
  filter: none;
  text-shadow: 0 3px 0 rgba(255, 246, 220, .55);
}
#screen-title .logo-sub { color: rgba(23, 58, 55, .62); }
#screen-title .title-tagline { color: rgba(23, 58, 55, .86); }
#screen-title .title-metrics span {
  color: rgba(23, 58, 55, .72);
  background: rgba(255, 246, 220, .42);
  border-color: rgba(23, 58, 55, .18);
}
#screen-title .title-metrics b { color: var(--mr-coral-dark); }
#screen-title .title-preview {
  border: 2px solid var(--mr-ink);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(28, 75, 69, .96) 0 68%, rgba(137, 83, 55, .96) 68% 100%);
  box-shadow: 8px 9px 0 rgba(23, 58, 55, .95), inset 0 0 40px rgba(0, 0, 0, .22);
}
#screen-title .title-preview::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 32%;
  height: 7px;
  background: var(--mr-yellow);
  box-shadow: 0 0 16px rgba(242, 201, 91, .45);
  z-index: 2;
}
#screen-title .title-preview-topline,
#screen-title .title-preview-bottomline { color: rgba(255, 246, 220, .78); }
#screen-title .title-preview-topline b { color: #b8f0c7; }
#screen-title .title-preview-grid {
  border-color: rgba(255, 246, 220, .2);
  background:
    linear-gradient(rgba(255, 246, 220, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 246, 220, .08) 1px, transparent 1px);
}
#screen-title .title-preview-grid::before,
#screen-title .title-preview-grid::after { background: rgba(255, 246, 220, .14); }
#screen-title .title-ring { border-color: var(--mr-yellow); }
#screen-title .title-ring-b { border-color: var(--mr-cyan); }
#screen-title .title-ring-c { border-color: var(--mr-coral); }
#screen-title .title-route { border-color: rgba(242, 201, 91, .86); }
#screen-title .title-cursor {
  background: var(--mr-paper);
  border-color: var(--mr-paper);
  box-shadow: 0 0 0 8px rgba(255, 246, 220, .14), 0 0 22px var(--mr-paper);
}
.title-preview-band {
  position: absolute;
  z-index: 1;
  left: 5%;
  right: 5%;
  bottom: 8%;
  height: 54%;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 1%;
  overflow: hidden;
  border-bottom: 2px solid rgba(255, 246, 220, .4);
}
.title-preview-band img {
  display: block;
  width: 24%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 8px 5px rgba(0, 0, 0, .34));
}
#screen-title .title-preview-band img:nth-child(2) { transform: translateY(5%); }
#screen-title .title-preview-band img:nth-child(3) { transform: translateY(2%); }
#screen-title .title-preview-band img:nth-child(4) { transform: translateY(7%); }
#screen-title .title-preview-bottomline { z-index: 4; }
#screen-title .btn-primary {
  color: var(--mr-paper);
  background: linear-gradient(180deg, var(--mr-coral), var(--mr-coral-dark));
  border-color: var(--mr-ink);
  box-shadow: 0 6px 0 var(--mr-ink), 0 14px 30px rgba(159, 64, 56, .28);
}
#screen-title .btn-primary:hover { background: #d96252; }
#screen-title .btn-primary:active { box-shadow: 0 2px 0 var(--mr-ink); }
#screen-title .btn-ghost {
  color: var(--mr-ink);
  background: rgba(255, 246, 220, .42);
  border-color: rgba(23, 58, 55, .45);
}
#screen-title .btn-ghost small { color: rgba(23, 58, 55, .58); }
#screen-title .title-hint kbd {
  color: var(--mr-ink);
  border-color: rgba(23, 58, 55, .42);
}
#screen-title .copyright { color: rgba(23, 58, 55, .58); }

/* 選歌：深綠舞台 + 珊瑚焦點，讓曲目可掃讀但有演出感。 */
#screen-menu {
  color: var(--mr-paper);
  background:
    radial-gradient(720px 440px at 82% 8%, rgba(101, 184, 170, .14), transparent 72%),
    var(--mr-track);
}
#screen-menu::before {
  background:
    linear-gradient(rgba(255, 246, 220, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 246, 220, .035) 1px, transparent 1px),
    radial-gradient(620px 480px at 12% 94%, rgba(199, 84, 72, .13), transparent 72%);
  background-size: 34px 34px, 34px 34px, auto;
}
#screen-menu::after { background: linear-gradient(120deg, transparent 0 45%, rgba(242, 201, 91, .045) 45.1% 45.35%, transparent 45.5% 100%); }
#screen-menu .songselect-kicker,
#screen-menu .preview-panel-kicker,
#screen-menu .song-browser-head div span { color: var(--mr-yellow); }
#screen-menu .songselect-title,
#screen-menu .song-browser-head div b,
#screen-menu #song-selected-title { color: var(--mr-paper); }
#screen-menu .songselect-online { color: #b8f0c7; }
#screen-menu .songselect-online b { background: #7ee8a0; box-shadow: 0 0 10px #7ee8a0; }
#screen-menu .songselect-count,
#screen-menu .song-browser-head small,
#screen-menu .performer-caption,
#screen-menu .preview-stats span,
#screen-menu .preview-rule { color: rgba(255, 246, 220, .62); }
#screen-menu .btn-round {
  color: var(--mr-paper);
  background: rgba(16, 44, 42, .9);
  border-color: rgba(255, 246, 220, .3);
}
#screen-menu .btn-round:hover { border-color: var(--mr-yellow); }
#screen-menu .song-preview-panel,
#screen-menu .song-browser-panel {
  border-color: rgba(255, 246, 220, .2);
  background: rgba(16, 54, 50, .88);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .28);
}
#screen-menu .song-preview-panel::before {
  background:
    radial-gradient(260px 220px at 10% 18%, rgba(242, 201, 91, .16), transparent 72%),
    linear-gradient(145deg, rgba(199, 84, 72, .13), transparent 44%);
}
#screen-menu .performer-frame {
  border-color: rgba(255, 246, 220, .46);
  background: rgba(10, 38, 36, .75);
  box-shadow: 0 0 25px rgba(242, 201, 91, .12);
}
#screen-menu .performer-scan { background: var(--mr-yellow); box-shadow: 0 0 10px var(--mr-yellow); }
#screen-menu .preview-selected-label { color: var(--mr-yellow); }
#screen-menu .preview-stats div {
  border-color: rgba(255, 246, 220, .16);
  background: rgba(9, 39, 36, .42);
}
#screen-menu .preview-stats b { color: var(--mr-paper); }
#screen-menu #selected-status { color: #b8f0c7; }
.preview-band-strip {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 76px;
  padding: 8px 8px 0;
  overflow: hidden;
  border-top: 1px solid rgba(255, 246, 220, .14);
  border-bottom: 5px solid var(--mr-wood);
  background: linear-gradient(180deg, rgba(27, 75, 69, .7), rgba(137, 83, 55, .75));
}
.preview-band-strip::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5px;
  height: 3px;
  background: var(--mr-yellow);
  opacity: .85;
}
.preview-band-strip img {
  width: 25%;
  height: 86px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, .35));
}
.preview-band-strip img:nth-child(2) { transform: translateY(4%); }
.preview-band-strip img:nth-child(3) { transform: translateY(1%); }
.preview-band-strip img:nth-child(4) { transform: translateY(6%); }
.preview-section {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  align-items: baseline;
  padding: 9px 11px;
  border-left: 4px solid var(--mr-yellow);
  background: rgba(9, 39, 36, .52);
}
.preview-section span {
  grid-column: 1 / -1;
  color: rgba(255, 246, 220, .5);
  font: 700 .55rem var(--font-mono);
  letter-spacing: .12em;
}
.preview-section strong { color: var(--mr-paper); font-size: .92rem; }
.preview-section small { color: var(--mr-yellow); font: 700 .68rem var(--font-mono); }
#screen-menu .preview-rule { border-color: rgba(255, 246, 220, .18); }
#screen-menu .preview-rule b { color: var(--mr-yellow); }
#screen-menu .song-card {
  border-color: rgba(255, 246, 220, .16);
  background: linear-gradient(105deg, rgba(21, 65, 60, .92), rgba(13, 46, 43, .84));
}
#screen-menu .song-card:hover:not(.is-locked) { border-color: var(--mr-cyan); }
#screen-menu .song-card.is-selected {
  border-color: var(--mr-paper);
  background: linear-gradient(105deg, var(--mr-coral-dark), #b54b43);
  box-shadow: 0 4px 0 rgba(8, 28, 27, .72), 0 0 22px rgba(199, 84, 72, .25);
}
#screen-menu .song-card .song-num { color: var(--mr-yellow); }
#screen-menu .song-card.is-selected .song-num,
#screen-menu .song-card.is-selected .song-title,
#screen-menu .song-card.is-selected .song-meta { color: var(--mr-paper); }
#screen-menu .song-card .song-title { color: var(--mr-paper); }
#screen-menu .song-card .song-meta { color: rgba(255, 246, 220, .62); }
#screen-menu .song-card .song-state {
  border-color: rgba(184, 240, 199, .32);
  color: #b8f0c7;
}
#screen-menu .song-card.is-selected .song-state { border-color: rgba(255, 246, 220, .55); color: var(--mr-paper); }
#screen-menu .selection-controls { border-top: 1px solid rgba(255, 246, 220, .14); padding-top: 12px; }
#screen-menu .difficulty-heading { color: var(--mr-yellow); }
#screen-menu .difficulty-heading small { color: rgba(255, 246, 220, .55); }
#screen-menu .difficulty-option {
  color: var(--mr-paper);
  background: rgba(9, 39, 36, .72);
  border-color: rgba(255, 246, 220, .2);
}
#screen-menu .difficulty-option.is-selected {
  color: var(--mr-yellow);
  background: rgba(37, 111, 104, .72);
  border-color: var(--mr-yellow);
  box-shadow: 0 0 16px rgba(242, 201, 91, .2);
}
#screen-menu .start-button {
  color: var(--mr-paper);
  background: linear-gradient(180deg, var(--mr-coral), var(--mr-coral-dark));
  border-color: rgba(255, 246, 220, .48);
  box-shadow: 0 5px 0 rgba(8, 28, 27, .72), 0 12px 25px rgba(159, 64, 56, .24);
}
#screen-menu .start-button:active { box-shadow: 0 2px 0 rgba(8, 28, 27, .72); }

/* 遊玩：保留可讀性，補上舞台、角色與段落同步。 */
#screen-game {
  background:
    radial-gradient(720px 420px at 50% 0%, rgba(101, 184, 170, .12), transparent 72%),
    var(--mr-track);
}
#screen-game .game-hud {
  background: linear-gradient(180deg, rgba(13, 47, 44, .98), rgba(13, 47, 44, .76));
  border-color: rgba(255, 246, 220, .2);
  color: rgba(255, 246, 220, .72);
}
#screen-game .game-hud b { color: var(--mr-paper); }
#screen-game .hud-accuracy { color: var(--mr-cyan); }
#screen-game .hud-combo { text-shadow: 0 0 16px rgba(242, 201, 91, .48); }
#screen-game .hud-combo b { color: var(--mr-yellow); }
#screen-game .hud-pause {
  color: var(--mr-paper);
  border-color: rgba(255, 246, 220, .42);
  background: rgba(12, 42, 39, .9);
}
#screen-game .stage {
  border-color: rgba(255, 246, 220, .22);
  background:
    radial-gradient(420px 260px at 50% 18%, rgba(101, 184, 170, .12), transparent 72%),
    linear-gradient(180deg, rgba(17, 57, 53, .98), rgba(10, 37, 35, .98));
  box-shadow: inset 0 0 70px rgba(0, 0, 0, .44), 0 16px 40px rgba(0, 0, 0, .22);
}
.stage::after {
  content: "";
  position: absolute;
  inset: 112px 0 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 246, 220, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 246, 220, .07) 1px, transparent 1px);
  background-size: 12.5% 20%;
  opacity: .52;
  z-index: 0;
}
.stage-band {
  position: absolute;
  z-index: 1;
  top: 8px;
  left: 10px;
  right: 10px;
  height: 104px;
  overflow: hidden;
  border: 1px solid rgba(255, 246, 220, .18);
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, rgba(30, 83, 76, .96), rgba(21, 65, 60, .9));
  pointer-events: none;
}
.stage-band::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: var(--mr-wood);
  box-shadow: 0 -3px 0 var(--mr-yellow);
}
.stage-band-members {
  position: absolute;
  inset: 15px 7% 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
}
.stage-band-members img {
  width: 23%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 5px 3px rgba(0, 0, 0, .38));
}
.stage-band-members img:nth-child(2) { transform: translateY(4%); }
.stage-band-members img:nth-child(3) { transform: translateY(1%); }
.stage-band-members img:nth-child(4) { transform: translateY(6%); }
.stage-band-light {
  position: absolute;
  top: -40px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(242, 201, 91, calc(.08 + var(--section-energy, .4) * .08));
  filter: blur(8px);
  transform-origin: top center;
  animation: stage-light-sway 4s ease-in-out infinite;
}
.stage-band-light-a { left: 8%; }
.stage-band-light-b { right: 8%; animation-delay: -1.8s; background: rgba(101, 184, 170, calc(.08 + var(--section-energy, .4) * .08)); }
@keyframes stage-light-sway {
  0%, 100% { transform: rotate(-18deg) scale(.9); }
  50% { transform: rotate(18deg) scale(1.08); }
}
.stage-band-caption {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  color: rgba(255, 246, 220, .68);
  font: 700 .48rem var(--font-mono);
  letter-spacing: .1em;
}
.stage-band-caption b { color: var(--mr-yellow); }
#screen-game #lane {
  position: relative;
  z-index: 2;
}
.stage-section-cue {
  position: absolute;
  z-index: 5;
  top: 18px;
  right: 20px;
  display: grid;
  gap: 2px;
  min-width: 94px;
  padding: 7px 10px;
  border-left: 3px solid var(--mr-yellow);
  background: rgba(10, 38, 36, .76);
  color: rgba(255, 246, 220, .56);
  font: 700 .48rem var(--font-mono);
  letter-spacing: .08em;
  pointer-events: none;
}
.stage-section-cue b { color: var(--mr-paper); font: 800 .82rem var(--font-body); letter-spacing: 0; }
#screen-game[data-theme="rush"] .stage-section-cue,
#stage[data-theme="rush"] .stage-section-cue { border-color: var(--mr-coral); }
#screen-game .progress-fill { background: linear-gradient(90deg, var(--mr-cyan), var(--mr-yellow), var(--mr-coral)); }

/* 結算：把成績變成演出報告，不暴露內部 debug 字串。 */
#screen-result {
  max-width: none;
  padding: clamp(20px, 5vh, 58px) 20px;
  color: var(--mr-ink);
  background:
    linear-gradient(rgba(23, 58, 55, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 58, 55, .08) 1px, transparent 1px),
    var(--mr-yellow);
  background-size: 30px 30px;
}
#screen-result .result-card {
  width: min(100%, 680px);
  color: var(--mr-ink);
  background: var(--mr-paper);
  border: 2px solid var(--mr-ink);
  border-radius: 18px;
  box-shadow: 8px 9px 0 var(--mr-ink), 0 18px 42px rgba(23, 58, 55, .2);
}
#screen-result .result-title { color: var(--mr-coral-dark); }
.result-songline {
  display: grid;
  gap: 3px;
  margin-top: 10px;
  color: rgba(23, 58, 55, .68);
}
.result-songline b { color: var(--mr-ink); font-size: 1.05rem; }
.result-songline span { font: 700 .68rem var(--font-mono); }
#screen-result .result-grade { color: var(--mr-coral); text-shadow: 0 4px 0 rgba(159, 64, 56, .16); }
#screen-result .result-score { color: rgba(23, 58, 55, .7); }
#screen-result .result-score b { color: var(--mr-ink); }
#screen-result .result-stats div { background: rgba(23, 58, 55, .1); }
#screen-result .result-stats span { color: rgba(23, 58, 55, .6); }
#screen-result .result-stats b { color: var(--mr-ink); }
#screen-result .result-judges span { border: 1px solid rgba(23, 58, 55, .1); }
#screen-result .result-actions button { border: 2px solid var(--mr-ink); }
#screen-result #btn-retry { background: var(--mr-coral); color: var(--mr-paper); }
#screen-result #btn-back { color: var(--mr-paper); background: var(--mr-track); border-color: var(--mr-ink) !important; }

@media (max-width: 700px) {
  #screen-title .title-preview { box-shadow: 5px 6px 0 var(--mr-ink), inset 0 0 30px rgba(0, 0, 0, .22); }
  #screen-title .title-preview-band { height: 48%; bottom: 10%; }
  #screen-menu .song-preview-panel { min-height: 206px; }
  .preview-band-strip { min-height: 58px; }
  .preview-band-strip img { height: 64px; }
  .preview-section { padding: 7px 9px; }
  .stage-band { height: 78px; top: 6px; }
  .stage::after { inset: 84px 0 0; }
  .stage-section-cue { top: 10px; right: 10px; min-width: 76px; padding: 5px 7px; }
  .stage-section-cue b { font-size: .7rem; }
}

@media (max-width: 380px) {
  #screen-menu .song-preview-panel { min-height: 194px; }
  .preview-band-strip { display: none; }
  .stage-band { opacity: .86; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-band-light { animation: none; }
}

/* ═══════════ CONSOLE / TV READABILITY PASS ═══════════
   MouseRhythm keeps the RhythmLab characters and palette family,
   but uses its own console dashboard composition and TV-safe hierarchy.
   ═══════════════════════════════════════════════════════ */
:root {
  --tv-bg: #08111f;
  --tv-bg-2: #0d1d30;
  --tv-panel: rgba(16, 31, 51, .96);
  --tv-panel-2: rgba(21, 42, 66, .96);
  --tv-ink: #07101b;
  --tv-text: #f5f2e8;
  --tv-muted: #aebbc8;
  --tv-line: rgba(214, 232, 244, .24);
  --tv-coral: #ff806b;
  --tv-yellow: #ffd166;
  --tv-mint: #72d6c0;
  --tv-blue: #8bb8ff;
}

body {
  background:
    radial-gradient(900px 520px at 78% 0%, rgba(114, 214, 192, .13), transparent 70%),
    radial-gradient(760px 500px at 6% 100%, rgba(255, 128, 107, .1), transparent 72%),
    var(--tv-bg);
}

button:focus-visible,
[tabindex]:focus-visible {
  outline: 4px solid var(--tv-yellow);
  outline-offset: 5px;
}

#screen-title {
  color: var(--tv-text);
  background:
    linear-gradient(rgba(139, 184, 255, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 184, 255, .06) 1px, transparent 1px),
    linear-gradient(135deg, #0a1728, #08111f 58%, #10233b);
  background-size: 64px 64px, 64px 64px, auto;
}

#screen-title::before,
#screen-title::after {
  opacity: .5;
}

#screen-title .title-shell {
  width: min(100%, 1680px);
  padding: clamp(28px, 5vw, 82px) clamp(28px, 6vw, 100px) clamp(24px, 4vw, 64px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  align-items: stretch;
  gap: clamp(24px, 4vh, 56px);
}

#screen-title .title-topbar {
  color: var(--tv-muted);
  font-size: clamp(.75rem, 1vw, 1rem);
}

#screen-title .title-brand,
#screen-title .title-status,
#screen-title .title-kicker,
#screen-title .title-hint {
  color: var(--tv-muted);
}

#screen-title .title-brand i {
  background: var(--tv-coral);
  box-shadow: 0 0 18px rgba(255, 128, 107, .65);
}

#screen-title .title-status b {
  background: var(--tv-mint);
  box-shadow: 0 0 14px rgba(114, 214, 192, .7);
}

#screen-title .title-hero {
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
  gap: clamp(36px, 6vw, 110px);
  align-items: center;
}

#screen-title .title-kicker {
  margin-bottom: 24px;
  color: var(--tv-yellow);
  font-size: clamp(.75rem, 1vw, 1rem);
  letter-spacing: .18em;
}

#screen-title .title-logo {
  max-width: none;
  white-space: nowrap;
  color: var(--tv-text);
  font-size: clamp(3.5rem, 6.2vw, 6.8rem);
  line-height: .98;
  letter-spacing: .03em;
  text-shadow: 0 5px 0 rgba(0, 0, 0, .45), 0 0 34px rgba(114, 214, 192, .2);
}

#screen-title .logo-sub {
  margin-top: 16px;
  color: var(--tv-mint);
  font-size: clamp(.78rem, 1.2vw, 1rem);
}

#screen-title .title-tagline {
  margin-top: 28px;
  color: var(--tv-text);
  font-size: clamp(1.2rem, 2.2vw, 2rem);
  line-height: 1.4;
}

#screen-title .title-metrics {
  margin-top: 34px;
  gap: 10px;
}

#screen-title .title-metrics span {
  min-height: 44px;
  padding: 11px 14px;
  color: var(--tv-muted);
  background: rgba(13, 29, 48, .82);
  border-color: var(--tv-line);
  font-size: clamp(.7rem, .9vw, .9rem);
}

#screen-title .title-metrics b { color: var(--tv-coral); }

#screen-title .title-preview {
  border: 2px solid var(--tv-line);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(17, 54, 70, .98) 0 70%, rgba(103, 63, 48, .98) 70% 100%);
  box-shadow: 12px 14px 0 rgba(0, 0, 0, .4), 0 28px 70px rgba(0, 0, 0, .28);
}

#screen-title .title-preview-topline,
#screen-title .title-preview-bottomline {
  color: var(--tv-muted);
  font-size: clamp(.65rem, .8vw, .85rem);
}

#screen-title .title-preview-topline b { color: var(--tv-mint); }

#screen-title .title-preview-grid {
  border-color: rgba(245, 242, 232, .25);
  background:
    linear-gradient(rgba(245, 242, 232, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 242, 232, .09) 1px, transparent 1px);
}

#screen-title .title-preview-grid::before,
#screen-title .title-preview-grid::after { background: rgba(245, 242, 232, .2); }

#screen-title .title-route { border-color: var(--tv-yellow); }
#screen-title .title-cursor { background: var(--tv-text); border-color: var(--tv-text); }

#screen-title .title-main {
  width: min(100%, 560px);
  justify-self: start;
  align-items: stretch;
}

#screen-title .btn-primary {
  min-height: 96px;
  border: 2px solid rgba(255, 209, 102, .72);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--tv-coral), #c94d57);
  box-shadow: 0 8px 0 rgba(0, 0, 0, .38), 0 20px 42px rgba(255, 128, 107, .18);
  font-size: clamp(1.35rem, 2vw, 2rem);
  letter-spacing: .16em;
}

#screen-title .btn-primary::after {
  content: "A / ENTER  START";
  display: block;
  margin-top: 7px;
  color: rgba(245, 242, 232, .76);
  font: 700 .72rem var(--font-mono);
  letter-spacing: .16em;
}

#screen-title .title-hint {
  margin-left: 4px;
  font-size: clamp(.72rem, 1vw, .95rem);
}

#screen-title .title-hint kbd,
.console-input-bar kbd {
  display: inline-block;
  padding: 5px 8px;
  border: 1px solid var(--tv-line);
  border-bottom-width: 3px;
  border-radius: 6px;
  color: var(--tv-text);
  background: rgba(7, 16, 27, .72);
  font: 800 .72rem var(--font-mono);
}

#screen-title .title-hint span { color: var(--tv-coral); }

#screen-title .title-footer {
  width: min(100%, 560px);
  justify-self: start;
  gap: 10px;
}

#screen-title .btn-ghost {
  min-height: 68px;
  color: var(--tv-text);
  background: rgba(13, 29, 48, .74);
  border-color: var(--tv-line);
  font-size: 1rem;
}

#screen-title .btn-ghost small {
  color: var(--tv-muted);
  font-size: .68rem;
}

#screen-title .copyright {
  justify-content: flex-start;
  color: rgba(174, 187, 200, .7);
  font-size: .7rem;
}

/* 選歌：左側是可循環操作的曲目 rail，右側是固定的大型演出資訊。 */
#screen-menu {
  max-width: none;
  padding: 0;
  background:
    linear-gradient(rgba(139, 184, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 184, 255, .05) 1px, transparent 1px),
    var(--tv-bg);
  background-size: 64px 64px;
}

#screen-menu .songselect-shell {
  width: min(100%, 1680px);
  padding: max(28px, env(safe-area-inset-top)) clamp(24px, 6vw, 100px) max(24px, env(safe-area-inset-bottom));
  gap: clamp(18px, 3vh, 34px);
}

#screen-menu .songselect-top {
  min-height: 70px;
  gap: 18px;
}

#screen-menu .btn-round {
  width: 58px;
  height: 58px;
  min-height: 58px;
  color: var(--tv-text);
  background: rgba(7, 16, 27, .72);
  border-color: var(--tv-line);
  font-size: 2rem;
}

#screen-menu .songselect-kicker {
  color: var(--tv-yellow);
  font-size: clamp(.72rem, 1vw, .95rem);
}

#screen-menu .songselect-title {
  color: var(--tv-text);
  font-size: clamp(1.8rem, 3vw, 3rem);
  letter-spacing: .06em;
}

#screen-menu .songselect-status {
  color: var(--tv-muted);
  font-size: clamp(.75rem, 1vw, 1rem);
}

#screen-menu .songselect-online { color: var(--tv-mint); font-size: .78rem; }
#screen-menu .songselect-online b { background: var(--tv-mint); }

#screen-menu .songselect-layout {
  grid-template-areas: "browser preview";
  grid-template-columns: minmax(310px, .38fr) minmax(0, .62fr);
  gap: clamp(18px, 2.4vw, 38px);
}

#screen-menu .song-browser-panel { grid-area: browser; }
#screen-menu .song-preview-panel { grid-area: preview; }

#screen-menu .song-browser-panel,
#screen-menu .song-preview-panel {
  border: 2px solid var(--tv-line);
  border-radius: 24px;
  background: linear-gradient(145deg, var(--tv-panel-2), var(--tv-panel));
  box-shadow: 0 22px 60px rgba(0, 0, 0, .28);
}

#screen-menu .song-browser-panel {
  padding: clamp(18px, 2vw, 32px);
  gap: 18px;
}

#screen-menu .song-browser-head div span { color: var(--tv-yellow); font-size: clamp(.72rem, 1vw, .95rem); }
#screen-menu .song-browser-head div b {
  color: var(--tv-text);
  font-size: clamp(1.25rem, 1.8vw, 1.8rem);
}
#screen-menu .song-browser-head small { color: var(--tv-muted); font-size: .74rem; }

#screen-menu .song-carousel {
  min-height: 0;
  overflow: hidden;
}

#screen-menu .song-list {
  height: 100%;
  max-height: none;
  gap: 10px;
  overflow-y: auto;
  padding: 5px 10px 8px 4px;
  scrollbar-color: var(--tv-coral) rgba(7, 16, 27, .5);
}

#screen-menu .song-card {
  min-height: 86px;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  padding: 15px 16px;
  border: 2px solid rgba(214, 232, 244, .16);
  border-radius: 14px;
  background: rgba(7, 16, 27, .5);
  transition: background .15s, border-color .15s, transform .15s;
}

#screen-menu .song-card:hover:not(.is-locked),
#screen-menu .song-card:focus-visible:not(.is-locked) {
  transform: translateX(4px);
  border-color: var(--tv-mint);
}

#screen-menu .song-card.is-selected {
  transform: translateX(8px);
  border-color: var(--tv-yellow);
  background: linear-gradient(100deg, rgba(104, 61, 57, .98), rgba(49, 47, 69, .98));
  box-shadow: 0 0 0 2px rgba(255, 209, 102, .16), 0 12px 24px rgba(0, 0, 0, .2);
}

#screen-menu .song-card .song-num {
  color: var(--tv-mint);
  font-size: .88rem;
}

#screen-menu .song-card .song-title {
  color: var(--tv-text);
  font-size: clamp(1rem, 1.35vw, 1.35rem);
}

#screen-menu .song-card .song-meta {
  color: var(--tv-muted);
  font-size: clamp(.68rem, .9vw, .86rem);
}

#screen-menu .song-card .song-state {
  padding: 6px 8px;
  border-color: rgba(114, 214, 192, .45);
  color: var(--tv-mint);
  font-size: .68rem;
}

#screen-menu .song-preview-panel {
  padding: clamp(22px, 3vw, 46px);
  gap: clamp(18px, 3vh, 34px);
}

#screen-menu .preview-panel-kicker {
  color: var(--tv-yellow);
  font-size: clamp(.75rem, 1vw, .95rem);
}

#screen-menu .preview-panel-kicker span { color: var(--tv-muted); }

#screen-menu .performer-wrap {
  align-items: center;
  gap: clamp(22px, 3vw, 42px);
}

#screen-menu .performer-frame {
  width: clamp(170px, 19vw, 280px);
  padding: 10px;
  border: 2px solid var(--tv-mint);
  border-radius: 22px;
  background: rgba(7, 16, 27, .6);
  box-shadow: 0 0 32px rgba(114, 214, 192, .14);
}

#screen-menu .preview-selected-label {
  color: var(--tv-coral);
  font-size: .76rem;
}

#screen-menu #song-selected-title {
  color: var(--tv-text);
  font-size: clamp(2rem, 4vw, 4.8rem);
  line-height: 1.04;
}

#screen-menu .performer-caption {
  color: var(--tv-muted);
  font-size: clamp(.78rem, 1vw, 1rem);
}

#screen-menu .preview-stats {
  gap: 12px;
}

#screen-menu .preview-stats div {
  min-height: 82px;
  padding: 14px;
  border: 2px solid rgba(214, 232, 244, .16);
  background: rgba(7, 16, 27, .42);
}

#screen-menu .preview-stats span {
  color: var(--tv-muted);
  font-size: .68rem;
}

#screen-menu .preview-stats b {
  color: var(--tv-text);
  font-size: clamp(1rem, 1.45vw, 1.5rem);
}

#screen-menu .preview-section {
  border-left-color: var(--tv-yellow);
  background: rgba(7, 16, 27, .52);
}

#screen-menu .preview-section span { color: var(--tv-muted); }
#screen-menu .preview-section strong { color: var(--tv-text); font-size: clamp(1.3rem, 2vw, 2rem); }
#screen-menu .preview-section small { color: var(--tv-yellow); font-size: 1rem; }
#screen-menu .preview-rule { color: var(--tv-muted); font-size: .75rem; }
#screen-menu .preview-rule b { color: var(--tv-coral); }

#screen-menu .selection-controls {
  gap: 14px 18px;
  padding-top: 4px;
}

#screen-menu .difficulty-heading {
  color: var(--tv-yellow);
  font-size: clamp(.8rem, 1vw, 1rem);
}

#screen-menu .difficulty-heading small { color: var(--tv-muted); font-size: .7rem; }

#screen-menu .difficulty-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#screen-menu .difficulty-option {
  min-height: 68px;
  padding: 12px 10px;
  border: 2px solid rgba(214, 232, 244, .18);
  border-radius: 12px;
  color: var(--tv-text);
  background: rgba(7, 16, 27, .58);
  font-size: clamp(.95rem, 1.2vw, 1.2rem);
}

#screen-menu .difficulty-option.is-selected {
  color: var(--tv-yellow);
  border-color: var(--tv-yellow);
  background: rgba(92, 67, 52, .8);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, .14);
}

#screen-menu .start-button {
  min-width: 190px;
  min-height: 68px;
  border: 2px solid var(--tv-yellow);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--tv-coral), #c94d57);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .36), 0 15px 28px rgba(255, 128, 107, .18);
  font-size: clamp(1rem, 1.3vw, 1.35rem);
}

#screen-menu .start-button::after { content: "A / ENTER  START"; font-size: .68rem; }

.console-input-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px 24px;
  pointer-events: none;
  color: var(--tv-muted);
  font: 700 .78rem var(--font-mono);
  letter-spacing: .04em;
}

.console-input-bar span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* 遊戲與結算也使用同一套 TV safe shell。 */
#screen-game {
  max-width: 1728px;
  padding: clamp(18px, 3vw, 48px) clamp(20px, 5vw, 84px) max(18px, env(safe-area-inset-bottom));
  background:
    radial-gradient(700px 360px at 50% 0%, rgba(114, 214, 192, .13), transparent 72%),
    var(--tv-bg);
}

#screen-game .game-hud {
  min-height: 70px;
  gap: clamp(10px, 1.8vw, 28px);
  padding: 12px 18px;
  border: 2px solid var(--tv-line);
  border-radius: 16px;
  background: rgba(13, 29, 48, .94);
  color: var(--tv-muted);
  font-size: clamp(.72rem, 1vw, 1rem);
}

#screen-game .game-hud b { color: var(--tv-text); font-size: 1.15em; }
#screen-game .hud-combo { font-size: clamp(1.1rem, 2.2vw, 2.2rem); }
#screen-game .hud-combo b { color: var(--tv-yellow); }
#screen-game .hud-accuracy { color: var(--tv-mint); }
#screen-game .hud-pause {
  width: 58px;
  height: 52px;
  border: 2px solid var(--tv-line);
  border-radius: 10px;
  color: var(--tv-text);
  background: rgba(7, 16, 27, .78);
  font-size: 1.2rem;
}

#screen-game .stage {
  border: 2px solid var(--tv-line);
  border-radius: 22px;
  background:
    radial-gradient(500px 300px at 50% 12%, rgba(114, 214, 192, .14), transparent 72%),
    linear-gradient(180deg, #102c3d, #081b2b);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, .38), 0 24px 64px rgba(0, 0, 0, .26);
}

#screen-game .stage::after { inset: 0; }
#screen-game .stage-band,
#screen-game .stage-band-members,
#screen-game .stage-band-light,
#screen-game .stage-band-caption {
  display: none;
}

#screen-game .stage-section-cue {
  min-width: 142px;
  padding: 10px 14px;
  border-left: 4px solid var(--tv-yellow);
  background: rgba(7, 16, 27, .82);
  color: var(--tv-muted);
  font-size: .65rem;
}

#screen-game .stage-section-cue b { color: var(--tv-text); font-size: clamp(1rem, 1.4vw, 1.4rem); }
#screen-game .progress-track { height: 8px; background: rgba(214, 232, 244, .14); }
#screen-game .progress-fill { background: linear-gradient(90deg, var(--tv-mint), var(--tv-yellow), var(--tv-coral)); }
#screen-game .game-hint,
#screen-game .game-exit {
  color: var(--tv-muted);
  font-size: clamp(.78rem, 1vw, 1rem);
}

#screen-result {
  max-width: none;
  padding: clamp(28px, 6vh, 80px) clamp(24px, 6vw, 100px);
  color: var(--tv-text);
  background:
    linear-gradient(rgba(139, 184, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 184, 255, .05) 1px, transparent 1px),
    var(--tv-bg);
  background-size: 64px 64px;
}

#screen-result .result-card {
  width: min(100%, 920px);
  color: var(--tv-text);
  border: 2px solid var(--tv-line);
  border-radius: 24px;
  background: linear-gradient(145deg, var(--tv-panel-2), var(--tv-panel));
  box-shadow: 12px 14px 0 rgba(0, 0, 0, .35), 0 26px 70px rgba(0, 0, 0, .28);
}

#screen-result .result-title { color: var(--tv-yellow); font-size: clamp(2rem, 4vw, 4rem); }
#screen-result .result-songline b { color: var(--tv-text); font-size: clamp(1.15rem, 2vw, 2rem); }
#screen-result .result-songline span { color: var(--tv-muted); font-size: .9rem; }
#screen-result .result-grade { color: var(--tv-coral); text-shadow: 0 5px 0 rgba(0, 0, 0, .26); }
#screen-result .result-score { color: var(--tv-muted); }
#screen-result .result-score b,
#screen-result .result-stats b { color: var(--tv-text); }
#screen-result .result-stats div { background: rgba(7, 16, 27, .42); border-color: rgba(214, 232, 244, .16); }
#screen-result .result-stats span { color: var(--tv-muted); }
#screen-result .result-actions button { min-height: 62px; border-width: 2px; }
#screen-result #btn-retry { background: var(--tv-coral); color: var(--tv-text); }
#screen-result #btn-back { color: var(--tv-text); background: var(--tv-bg-2); border-color: var(--tv-line) !important; }

@media (min-aspect-ratio: 16/9) {
  #screen-title .title-shell,
  #screen-menu .songselect-shell,
  #screen-game,
  #screen-result { padding-left: 7vw; padding-right: 7vw; }
}

@media (max-width: 900px) {
  #screen-title .title-shell { padding-inline: 28px; }
  #screen-title .title-hero { grid-template-columns: 1fr; gap: 28px; }
  #screen-title .title-copy { text-align: center; }
  #screen-title .title-logo-wrap { text-align: center; }
  #screen-title .title-logo { margin-inline: auto; }
  #screen-title .title-main,
  #screen-title .title-footer { justify-self: center; }
  #screen-title .title-metrics { justify-content: center; }
  #screen-menu .songselect-layout {
    grid-template-areas: "browser" "preview";
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 1fr) auto;
  }
  #screen-menu .song-browser-panel { min-height: 360px; }
  #screen-menu .song-preview-panel { min-height: 330px; }
  #screen-menu .performer-frame { width: 150px; }
  #screen-menu #song-selected-title { font-size: clamp(2rem, 7vw, 3.4rem); }
  .console-input-bar { justify-content: center; }
}

@media (max-width: 600px) {
  #screen-title .title-shell {
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
    gap: 20px;
  }
  #screen-title .title-status { display: none; }
  #screen-title .title-logo { font-size: clamp(2.45rem, 12vw, 4.2rem); }
  #screen-title .title-tagline { margin-top: 18px; font-size: 1.05rem; }
  #screen-title .title-metrics { margin-top: 22px; }
  #screen-title .title-metrics span { min-height: 36px; padding: 8px 9px; font-size: .55rem; }
  #screen-title .title-preview { border-radius: 18px; box-shadow: 6px 8px 0 rgba(0, 0, 0, .4); }
  #screen-title .title-main,
  #screen-title .title-footer { width: 100%; }
  #screen-title .btn-primary { min-height: 76px; }
  #screen-title .btn-ghost { min-height: 58px; }
  #screen-menu .songselect-shell { padding-inline: 12px; gap: 14px; }
  #screen-menu .songselect-top { min-height: 54px; gap: 10px; }
  #screen-menu .btn-round { width: 48px; height: 48px; min-height: 48px; }
  #screen-menu .songselect-kicker { font-size: .58rem; }
  #screen-menu .songselect-title { font-size: 1.45rem; }
  #screen-menu .songselect-status { font-size: .68rem; }
  #screen-menu .song-browser-panel { min-height: 300px; padding: 14px; border-radius: 17px; }
  #screen-menu .song-preview-panel { min-height: 270px; padding: 16px; border-radius: 17px; }
  #screen-menu .song-card { min-height: 72px; grid-template-columns: 34px minmax(0, 1fr) auto; padding: 11px 10px; }
  #screen-menu .song-card .song-title { font-size: .96rem; }
  #screen-menu .song-card .song-meta { font-size: .58rem; }
  #screen-menu .song-card .song-state { padding: 4px 5px; font-size: .52rem; }
  #screen-menu .performer-wrap { gap: 12px; }
  #screen-menu .performer-frame { width: 100px; padding: 6px; border-radius: 14px; }
  #screen-menu .preview-selected-label { font-size: .56rem; }
  #screen-menu #song-selected-title { font-size: 1.7rem; }
  #screen-menu .performer-caption { font-size: .62rem; }
  #screen-menu .preview-stats { gap: 6px; }
  #screen-menu .preview-stats div { min-height: 64px; padding: 8px; }
  #screen-menu .preview-stats b { font-size: .78rem; }
  #screen-menu .selection-controls {
    grid-template-columns: 1fr;
  }
  #screen-menu .difficulty-panel,
  #screen-menu .start-button { grid-column: 1; }
  #screen-menu .start-button { min-width: 0; width: 100%; }
  .console-input-bar { gap: 8px 12px; font-size: .58rem; }
  .console-input-bar kbd { padding: 4px 5px; font-size: .56rem; }
  #screen-game { padding-inline: 10px; }
  #screen-game .game-hud { min-height: 56px; padding: 8px 10px; gap: 7px; font-size: .56rem; }
  #screen-game .hud-combo { font-size: 1rem; }
  #screen-game .hud-pause { width: 44px; height: 42px; }
  #screen-game .stage { border-radius: 15px; }
  #screen-game .stage-band { height: 78px; }
  #screen-game .stage-section-cue { top: 10px; right: 10px; min-width: 92px; padding: 6px 8px; }
  #screen-game .stage-section-cue b { font-size: .78rem; }
}

@media (prefers-reduced-motion: reduce) {
  #screen-title .title-preview,
  #screen-menu .song-card { animation: none; transition: none; }
}

/* 裝飾性預覽不應攔截主選單操作；窄螢幕改用內容高度，避免預覽與開始鍵重疊。 */
#screen-title .title-preview { pointer-events: none; }

@media (max-width: 600px) {
  #screen-title .title-shell {
    grid-template-rows: auto auto auto auto;
    align-content: start;
  }
  #screen-title .title-hero {
    grid-template-rows: auto auto;
    align-content: start;
    gap: 14px;
  }
  #screen-title .title-preview {
    aspect-ratio: 1.55;
  }
}

@media (max-width: 380px) and (orientation: portrait) {
  /* 保留手機遊戲畫布的可玩寬度；教學提示與進度在極窄螢幕改由 HUD／流程承擔。 */
  #screen-game .game-hud {
    min-height: 56px;
    height: 56px;
    grid-template-rows: 16px 18px 10px;
    gap: 2px 8px;
    padding: 5px 10px;
    overflow: hidden;
  }
  #screen-game .hud-life {
    height: 10px;
    padding: 1px 6px;
  }
  #screen-game .hud-life-fill { height: 5px; }
  #screen-game .progress-track,
  #screen-game .game-hint { display: none; }
}

/* ═══════════ RHYTHMLAB SONG WHEEL BEHAVIOR ═══════════
   保留 MouseRhythm 自己的 console shell，只借用「中央歌曲為選中項」的操作模型。 */
#screen-menu .song-carousel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

#screen-menu .song-carousel::before,
#screen-menu .song-carousel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 12px;
  z-index: 2;
  height: 18%;
  pointer-events: none;
}

#screen-menu .song-carousel::before {
  top: 0;
  background: linear-gradient(180deg, var(--tv-panel-2), transparent);
}

#screen-menu .song-carousel::after {
  bottom: 0;
  background: linear-gradient(0deg, var(--tv-panel), transparent);
}

#screen-menu .song-list {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  scroll-snap-type: y proximity;
  scrollbar-gutter: stable;
  padding-top: clamp(100px, 14vh, 170px);
  padding-bottom: clamp(100px, 14vh, 170px);
}

#screen-menu .song-card {
  scroll-snap-align: center;
  opacity: .4;
  transform: scale(.94);
  filter: saturate(.68);
  transition:
    opacity .18s ease,
    transform .18s ease,
    filter .18s ease,
    background .18s ease,
    border-color .18s ease,
    box-shadow .18s ease;
}

#screen-menu .song-card.is-wheel-near {
  opacity: .76;
  transform: scale(.975);
  filter: saturate(.88);
}

#screen-menu .song-card.is-wheel-active,
#screen-menu .song-card.is-selected {
  opacity: 1;
  transform: scale(1.02);
  filter: none;
}

#screen-menu .song-card.is-wheel-active::before {
  content: "NOW";
  position: absolute;
  top: 8px;
  right: 12px;
  color: var(--tv-yellow);
  font: 800 .58rem var(--font-mono);
  letter-spacing: .12em;
}

#screen-menu .song-card.is-wheel-active {
  border-color: var(--tv-yellow);
  background: linear-gradient(100deg, rgba(104, 61, 57, .98), rgba(49, 47, 69, .98));
  box-shadow:
    0 0 0 2px rgba(255, 209, 102, .18),
    0 12px 24px rgba(0, 0, 0, .24),
    0 0 28px rgba(255, 209, 102, .12);
}

#screen-menu .song-card.is-wheel-far .song-state {
  opacity: .72;
}

#screen-menu .song-browser-head small::after {
  content: "  ·  WHEEL SELECT";
  color: var(--tv-yellow);
}

@media (max-width: 900px) {
  /* 手機／平板採可滾動的上下流程，避免選歌 wheel 被難度區擠到看不見。 */
  #screen-menu {
    overflow-y: auto;
  }

  #screen-menu .songselect-shell {
    height: auto;
    min-height: 100dvh;
    flex: 0 0 auto;
  }

  #screen-menu .songselect-layout {
    flex: 0 0 auto;
  }

  #screen-menu .song-browser-panel {
    min-height: 500px;
  }

  #screen-menu .song-carousel {
    flex: 0 0 250px;
    min-height: 250px;
  }

  #screen-menu .difficulty-panel {
    grid-column: 1;
    grid-row: 2;
  }

  #screen-menu .start-button {
    grid-column: 1;
    grid-row: 3;
  }
}

/* ═══════════ RELEASE UX PASS ═══════════
   Keep every gameplay control in the HUD flow so it cannot cover score data. */
#screen-result {
  align-items: center;
}

#screen-game .game-hud {
  grid-template-columns: minmax(0, 1fr) auto auto auto minmax(118px, auto) minmax(150px, auto) auto;
  grid-template-areas: "song score combo ok accuracy life pause";
  align-items: center;
  position: relative;
}

#screen-game .hud-song { grid-area: song; min-width: 0; }
#screen-game .hud-score { grid-area: score; white-space: nowrap; }
#screen-game .hud-combo {
  grid-area: combo;
  position: static;
  transform: none;
  white-space: nowrap;
}

#screen-game #hud-combo-panel {
  position: static;
  inset: auto;
}
#screen-game .hud-ok { grid-area: ok; white-space: nowrap; }
#screen-game .hud-accuracy { grid-area: accuracy; white-space: nowrap; }
#screen-game .hud-life { grid-area: life; width: 100%; }
#screen-game .hud-pause {
  grid-area: pause;
  position: static;
  justify-self: end;
  width: 58px;
  height: 52px;
  min-height: 52px;
}

#game-overlay .overlay-reason {
  display: none;
}

@media (max-width: 900px) {
  #screen-game .game-hud {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "song song pause"
      "score combo ok"
      "accuracy life life";
    gap: 7px 10px;
    padding: 10px 12px;
    font-size: .7rem;
  }

  #screen-game .hud-song { padding-right: 0; }
  #screen-game .hud-score,
  #screen-game .hud-ok,
  #screen-game .hud-accuracy { text-align: left; }
  #screen-game .hud-combo { justify-self: center; font-size: 1.05rem; }
  #screen-game .hud-life { min-width: 0; }
  #screen-game .hud-pause {
    width: 50px;
    height: 46px;
    min-height: 46px;
  }
}

@media (max-width: 600px) {
  #screen-menu {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  #screen-menu .songselect-shell {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  #screen-menu .song-browser-panel {
    display: flex;
    flex-direction: column;
  }
  #screen-menu .song-carousel {
    flex: 1 1 auto;
    min-height: 0;
  }

  #screen-menu .selection-controls {
    position: static;
    flex: 0 0 auto;
    margin: 0;
    padding: 11px 12px 12px;
    border: 1px solid var(--tv-line);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(13, 29, 48, .97), rgba(7, 16, 27, .98));
    box-shadow: 0 -12px 28px rgba(0, 0, 0, .28);
  }

  #screen-menu .selection-controls .difficulty-heading {
    margin-bottom: 0;
  }

  #screen-menu .difficulty-panel {
    gap: 8px;
  }

  #screen-menu .difficulty-option {
    min-height: 58px;
    padding: 9px 7px;
  }

  #screen-menu .start-button {
    min-height: 62px;
  }

  #screen-menu .console-input-bar {
    display: none;
  }

  #screen-game .game-hud {
    min-height: 0;
    height: auto;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "song song pause"
      "score combo ok"
      "accuracy life life";
    gap: 6px 8px;
    padding: 9px 10px;
    overflow: visible;
    font-size: .68rem;
  }

  #screen-game .hud-song {
    min-height: 18px;
    font-size: .76rem;
  }

  #screen-game .hud-combo {
    font-size: .95rem;
  }

  #screen-game .hud-pause {
    width: 46px;
    height: 42px;
    min-height: 42px;
    border-radius: 11px;
  }

  #screen-game .hud-life {
    height: 14px;
    padding: 2px 6px;
  }

  #screen-game .hud-life-fill {
    height: 7px;
  }
}

/* ═══════════ REVIEW PASS 2026-08-04（P1/P2/P3 補強）═══════════ */
/* ── P1：教學提示自動淡出 ── */
.game-hint { transition: opacity 1.2s ease; }
.hint-fading { opacity: 0.45; }
.hint-gone { opacity: 0; pointer-events: none; }

/* ── P2：暫停 overlay 的「繼續」預設高亮 ── */
#game-overlay .overlay-card button:first-of-type {
  border-color: var(--hx-neon, #6ee7ff);
  color: #eaffff;
  box-shadow: 0 0 14px rgba(110, 231, 255, 0.35);
}
#game-overlay .overlay-card button:not(:first-of-type) { border-color: var(--hx-border, #2a3a56); }

/* ── P2：暫停時 HUD 一併壓暗（overlay 可見時）── */
#screen-game:has(#game-overlay:not([hidden])) .game-hud { opacity: 0.5; transition: opacity 0.25s; }

/* ── P2：通關標記 ── */
.song-state.is-clear {
  color: var(--hx-neon, #6ee7ff);
  border-color: rgba(110, 231, 255, 0.55);
  background: rgba(110, 231, 255, 0.10);
}

/* ── P2：平板直向列表密度（一次可見 ≥5 首）── */
@media (orientation: portrait) and (min-width: 600px) and (max-width: 1024px) {
  .song-card { min-height: 58px; padding: 8px 14px; }
  .song-card .song-title { font-size: 0.95rem; }
  .song-card .song-meta { font-size: 0.68rem; }
}

/* ── P3：觸控裝置隱藏鍵盤提示（手機沒有 A/ENTER）── */
@media (pointer: coarse) {
  .title-hint, .console-input-bar { display: none !important; }
  .start-button small, .btn-primary small { display: none; }
}

/* ═══════════ MOBILE SONG SELECT FIX（2026-08-04：詳情卡隱藏、列表一次 5-6 首）═══════════ */
@media (max-width: 600px) and (orientation: portrait) {
  /* 選歌時不需要插畫/結構詳情 → 隱藏，讓列表佔滿空間 */
  #screen-menu .song-preview-panel { display: none !important; }
  #screen-menu .song-browser-panel { flex: 1 1 auto; min-height: 0; }
  #screen-menu .song-carousel { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
  #screen-menu .song-list { gap: 5px; }
  #screen-menu .song-card { min-height: 48px; padding: 6px 10px; border-radius: 10px; }
  #screen-menu .song-card .song-num { font-size: .6rem; }
  #screen-menu .song-card .song-title { font-size: .86rem; }
  #screen-menu .song-card .song-meta { font-size: .54rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #screen-menu .song-card .song-state { padding: 3px 5px; font-size: .46rem; }
  /* 難度與開始按鈕貼底、避開系統手勢區 */
  #screen-menu .selection-controls { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  #screen-menu .start-button { min-height: 56px; font-size: 1rem; }
}

/* 手機標題畫面：LIVE PLAYFIELD 預覽窗縮小（開始按鈕更早出現） */
@media (max-width: 600px) {
  #screen-title .title-preview { max-height: 30dvh; overflow: hidden; }
  #screen-title .title-preview-grid { min-height: 120px; }
  #screen-title .title-preview-band { display: none; }
}

/* ── 手機選歌：carousel 直接以 dvh 限高（不依賴 flex 鏈，最穩）── */
@media (max-width: 600px) {
  #screen-menu .songselect-layout { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  #screen-menu .song-preview-panel { display: none !important; }
  #screen-menu .song-browser-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #screen-menu .song-carousel { min-height: 0; flex: 1 1 auto; overflow-y: auto; }
  #screen-menu .song-list { gap: 5px; }
  #screen-menu .song-card { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 6px 10px; border-radius: 10px; }
  #screen-menu .song-card .song-num { flex: 0 0 auto; font-size: .6rem; }
  #screen-menu .song-card .song-title { flex: 1 1 auto; font-size: .88rem; line-height: 1.3; min-width: 0; white-space: normal; overflow: visible; text-overflow: clip; }
  #screen-menu .song-card .song-meta { display: none; }
  #screen-menu .song-card .song-state { flex: 0 0 auto; padding: 3px 5px; font-size: .46rem; }
  #screen-menu .selection-controls { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  #screen-menu .start-button { min-height: 56px; font-size: 1rem; }
}

/* ═══════════ SONG CATEGORY FILTER（學 RhythmLab）═══════════ */
.song-categories {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 0 4px; margin-bottom: 8px;
}
.song-cat-btn {
  font: 700 .72rem var(--font-mono, monospace);
  letter-spacing: .08em;
  color: var(--hx-dim, #8aa4bf);
  background: rgba(20, 30, 48, .8);
  border: 1px solid rgba(96, 123, 152, .5);
  border-radius: 999px;
  padding: 6px 16px;
  min-height: 38px;
  cursor: pointer;
  transition: all .15s;
  touch-action: manipulation;
}
.song-cat-btn.is-active {
  color: #fff3d6;
  border-color: rgba(242, 200, 91, .9);
  background: rgba(242, 200, 91, .14);
  box-shadow: 0 0 10px rgba(242, 200, 91, .18);
}
.song-cat-btn:active { transform: scale(.96); }

/* 首尾置中：列表上下留出「半個捲動容器」的空白，讓第一首/最後一首也能捲到中央 */
.song-list { padding-block: calc((100dvh - 380px) / 2); }
@media (max-width: 600px) {
  .song-categories { gap: 6px; margin-bottom: 6px; }
  .song-cat-btn { font-size: .62rem; padding: 5px 12px; min-height: 34px; }
  .song-list { padding-block: 260px; }
}

/* ═══════════ MOBILE RESULT SCREEN（結算畫面手機適配）═══════════ */
@media (max-width: 600px) {
  #screen-result { padding: 16px 12px; }
  #screen-result .result-card { padding: 16px 14px; gap: 10px; border-radius: 18px; }
  #screen-result .result-title { font-size: 1.3rem; margin-bottom: 2px; }
  #screen-result .result-songline { font-size: .68rem; }
  #screen-result .result-grade { font-size: 3rem; line-height: 1.05; }
  #screen-result .result-score { font-size: .85rem; }
  #screen-result .result-score b { font-size: 1.15rem; }
  #screen-result .result-stats { grid-template-columns: 1fr 1fr; gap: 6px; }
  #screen-result .result-stats div { padding: 7px 8px; border-radius: 10px; }
  #screen-result .result-stats div:last-child { grid-column: 1 / -1; }
  #screen-result .result-stats span { font-size: .52rem; margin-bottom: 2px; }
  #screen-result .result-stats b { font-size: .78rem; }
  #screen-result .result-actions { gap: 8px; margin-top: 2px; }
  #screen-result .result-actions button { min-height: 48px; font-size: .85rem; border-radius: 12px; }
}

/* ═══════════ RHYTHMLAB-STYLE SONG MENU（移植 RhythmLab 選單：dialog + ▲▼ wheel）═══════════ */
:root {
  --sl-ink: #1d2725;
  --sl-paper: #fff8e8;
  --sl-coral: #ef725f;
  --sl-coral-dark: #aa463c;
  --sl-cyan: #65b8aa;
  --sl-cyan-dark: #256f68;
  --sl-yellow: #f2c85b;
  --sl-violet: #758ab5;
  --sl-track: #152c2c;
  --sl-track-soft: #23403d;
  --font-display: "Arial Black", "Noto Sans TC", system-ui, sans-serif;
}

#screen-menu .songselect-shell { overflow: hidden; }
#screen-menu .songselect-top { flex: 0 0 auto; }
#screen-menu .mr-menu-copy {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: clamp(18px, 4vh, 40px) clamp(16px, 5vw, 44px) 28px;
  background: rgba(255, 248, 232, .96);
  border: 2px solid var(--sl-ink);
  border-radius: 16px;
  box-shadow: 10px 10px 0 rgba(16, 24, 40, .5);
}
#screen-menu .sl-flow-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  font-size: .88rem;
  font-weight: 900;
  color: var(--sl-ink);
}
#screen-menu .sl-flow-label span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: var(--sl-ink);
  color: #fff;
  font: 900 .72rem/1 var(--font-mono);
}
#screen-menu .sl-flow-label + .sl-flow-label { margin-top: 18px; }
#screen-menu .sl-song-line {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 66px;
  padding: 10px 14px;
  text-align: left;
  color: var(--sl-ink);
  background: rgba(255, 255, 255, .5);
  border: 2px solid rgba(23, 18, 31, .35);
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  box-shadow: 0 3px 0 rgba(29, 39, 37, .32);
  transition: transform .15s ease-out, background .15s ease-out;
}
#screen-menu .sl-song-line:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .82); }
#screen-menu .sl-song-line > span:nth-child(2) { display: grid; min-width: 0; gap: 1px; }
#screen-menu .sl-song-line strong { font-size: 1rem; }
#screen-menu .sl-song-line small { font-size: .72rem; color: #574b62; }
#screen-menu .sl-song-change { margin-left: auto; color: #8b3f38; font-size: .72rem; white-space: nowrap; font-weight: 900; }
#screen-menu .sl-vinyl {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background: var(--sl-ink);
  box-shadow: inset 0 0 0 6px #3f344c, inset 0 0 0 12px var(--sl-ink);
}
#screen-menu .sl-vinyl i {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--sl-coral);
  border: 2px solid var(--sl-paper);
}



#screen-menu .sl-difficulty {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 590px;
  gap: 8px;
  border: 0;
  padding: 0;
}
#screen-menu .sl-difficulty legend {
  margin-bottom: 9px;
  font-size: .78rem;
  font-weight: 900;
  color: var(--sl-ink);
}
#screen-menu .sl-difficulty-option {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 8px;
  min-height: 68px;
  padding: 10px 11px;
  text-align: left;
  color: var(--sl-ink);
  background: rgba(255, 255, 255, .5);
  border: 2px solid rgba(23, 18, 31, .35);
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  transition: transform .16s ease-out, background .16s ease-out, border-color .16s ease-out;
}
#screen-menu .sl-difficulty-option:hover { transform: translateY(-2px); border-color: var(--sl-ink); }
#screen-menu .sl-difficulty-option.is-selected {
  background: var(--sl-paper);
  border-color: var(--sl-ink);
  transform: translateY(-3px);
  box-shadow: 0 4px 0 var(--sl-ink);
}
#screen-menu .sl-difficulty-option b { font-size: .95rem; }
#screen-menu .sl-difficulty-option span { font-size: .7rem; color: #62566e; }
#screen-menu .sl-difficulty-option i {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 50%;
  background: var(--sl-ink);
  color: #fff;
  font-size: .72rem;
  font-style: normal;
  font-weight: 900;
}
#screen-menu .sl-difficulty-copy {
  min-height: 1.7em;
  max-width: 590px;
  margin: 12px 0 16px;
  font-size: .78rem;
  color: #51455d;
}
#screen-menu .sl-start {
  display: flex;
  width: min(100%, 590px);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 12px 17px;
  color: #fff;
  background: var(--sl-coral);
  border: 2px solid var(--sl-ink);
  border-radius: 10px;
  box-shadow: 0 6px 0 var(--sl-ink);
  cursor: pointer;
  font: inherit;
  transition: transform .14s ease-out, box-shadow .14s ease-out, background .14s;
}
#screen-menu .sl-start:not(:disabled):hover { background: #ff4f43; transform: translateY(2px); box-shadow: 0 4px 0 var(--sl-ink); }
#screen-menu .sl-start:not(:disabled):active { transform: translateY(5px); box-shadow: 0 1px 0 var(--sl-ink); }
#screen-menu .sl-start:disabled { cursor: wait; filter: saturate(.45); opacity: .72; }
#screen-menu .sl-start span { font-size: 1rem; font-weight: 900; }
#screen-menu .sl-start small { font-size: .68rem; color: rgba(255, 255, 255, .86); }

/* ── 選歌 dialog ── */
#screen-menu .sl-song-dialog {
  width: min(900px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--sl-ink);
  background: #f7e5b0;
  border: 3px solid var(--sl-ink);
  border-radius: 16px;
  box-shadow: 12px 12px 0 rgba(29, 39, 37, .72);
}
#screen-menu .sl-song-dialog[open] {
  display: flex;
  flex-direction: column;
}
#screen-menu .sl-song-dialog::backdrop { background: rgba(12, 29, 28, .76); backdrop-filter: blur(4px); }
#screen-menu .sl-song-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  background: #173a37;
  color: #fff8e8;
  border-bottom: 3px solid var(--sl-ink);
  flex: 0 0 auto;
}
#screen-menu .sl-song-dialog-head p { margin: 0 0 3px; color: #f2c85b; font-size: .66rem; font-weight: 900; }
#screen-menu .sl-song-dialog-head h2 { margin: 0; font-size: clamp(1.45rem, 4vw, 2.25rem); }
#screen-menu .sl-song-dialog-head button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  color: var(--sl-ink);
  background: #f2c85b;
  border: 2px solid #fff8e8;
  border-radius: 50%;
  cursor: pointer;
  font: 900 1.5rem/1 sans-serif;
}
#screen-menu .sl-song-categories {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 9px clamp(16px, 4vw, 58px);
  background: #f7e5b0;
  border-bottom: 3px solid var(--sl-ink);
  flex: 0 0 auto;
}
#screen-menu .sl-song-categories button {
  min-height: 42px;
  padding: 6px 8px;
  color: #4b514c;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font: 900 clamp(.78rem, 1.5vw, 1rem)/1 var(--font-display);
  transition: color .16s ease-out, background .16s ease-out, transform .2s cubic-bezier(.16,1,.3,1);
}
#screen-menu .sl-song-categories button:hover,
#screen-menu .sl-song-categories button:focus-visible { color: var(--sl-ink); border-color: var(--sl-coral-dark); }
#screen-menu .sl-song-categories button.is-active {
  color: var(--sl-ink);
  background: var(--sl-yellow);
  border-color: var(--sl-ink);
  box-shadow: 0 3px 0 var(--sl-coral-dark);
  transform: translateY(-2px);
}
#screen-menu .sl-song-wheel-shell {
  position: relative;
  overflow: hidden;
  background: #23403d;
  border-bottom: 3px solid var(--sl-ink);
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#screen-menu .sl-song-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  height: min(560px, calc(100dvh - 205px));
  min-height: 330px;
  --sl-song-wheel-cap: 0px;
  padding-block: 0;
  padding-inline: clamp(48px, 7vw, 76px);
  overflow-y: auto;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  mask-image: linear-gradient(to bottom, transparent 0, #000 15%, #000 85%, transparent 100%);
}
#screen-menu .sl-song-list::before,
#screen-menu .sl-song-list::after {
  content: "";
  display: block;
  height: var(--sl-song-wheel-cap);
  pointer-events: none;
}
#screen-menu .sl-song-list::-webkit-scrollbar { display: none; }
#screen-menu .sl-song-card {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 11px 18px;
  color: var(--sl-ink);
  background: rgba(255, 248, 232, .72);
  border: 2px solid rgba(29, 39, 37, .28);
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  opacity: .42;
  scroll-snap-align: center;
  text-align: left;
  transform: scale(.91);
  transition: transform .22s cubic-bezier(.16,1,.3,1), opacity .18s ease-out, background .18s ease-out, border-color .18s ease-out;
}
#screen-menu .sl-song-card:hover { opacity: .78; border-color: var(--sl-yellow); background: #fff8e8; }
#screen-menu .sl-song-card:focus-visible { outline: 4px solid var(--sl-yellow); outline-offset: 3px; }
#screen-menu .sl-song-card.is-wheel-near { opacity: .7; transform: scale(.96); }
#screen-menu .sl-song-card.is-wheel-active {
  z-index: 2;
  min-height: 112px;
  opacity: 1;
  color: #fff8e8;
  background: var(--sl-coral-dark);
  border-color: #fff8e8;
  box-shadow: 0 7px 0 var(--sl-ink);
  transform: scale(1.035);
}
#screen-menu .sl-current-badge {
  position: absolute;
  top: -10px;
  right: 20px;
  display: none;
  padding: 4px 8px;
  color: var(--sl-ink);
  background: var(--sl-yellow);
  border: 2px solid var(--sl-ink);
  border-radius: 4px;
  font: 900 .58rem/1 var(--font-mono);
}
#screen-menu .sl-song-card.is-selected .sl-current-badge { display: block; }
#screen-menu .sl-song-number { font: 900 1.2rem/1 var(--font-mono); color: #a84c42; }
#screen-menu .sl-song-card-copy { display: grid; min-width: 0; gap: 2px; }
#screen-menu .sl-song-card-copy strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; white-space: normal; font-size: clamp(1.05rem, 2.4vw, 1.38rem); line-height: 1.15; }
#screen-menu .sl-song-card.is-wheel-active .sl-song-card-copy strong { -webkit-line-clamp: 2; font-size: clamp(1.45rem, 3.6vw, 2.2rem); }
#screen-menu .sl-song-card-copy small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; white-space: normal; color: #655a62; font-size: .7rem; line-height: 1.25; }
#screen-menu .sl-song-card.is-wheel-active .sl-song-card-copy small { margin-top: 4px; color: #ffeec5; font-size: .76rem; }
#screen-menu .sl-song-record { min-width: 52px; text-align: right; color: #7b6e55; font: 800 .58rem/1.35 var(--font-mono); }
#screen-menu .sl-song-record b { display: block; color: #a8463e; font-size: .82rem; }
#screen-menu .sl-song-card.is-wheel-active .sl-song-record { color: #ffeec5; }
#screen-menu .sl-song-card.is-wheel-active .sl-song-record b { color: var(--sl-yellow); font-size: 1.08rem; }
#screen-menu .sl-song-step {
  position: absolute;
  z-index: 4;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  color: var(--sl-ink);
  background: var(--sl-yellow);
  border: 2px solid #fff8e8;
  border-radius: 5px;
  cursor: pointer;
  font-size: .68rem;
  font-weight: 900;
  transform: translateX(-50%);
}
#screen-menu .sl-song-step:hover, #screen-menu .sl-song-step:focus-visible { background: #fff0a5; }
#screen-menu .sl-song-step-prev { top: 11px; }
#screen-menu .sl-song-step-next { bottom: 11px; }
#screen-menu .sl-song-step span { font-size: .8rem; }
#screen-menu .sl-song-counter {
  position: absolute;
  z-index: 4;
  right: 18px;
  bottom: 17px;
  color: #fff8e8;
  font: 900 .72rem/1 var(--font-mono);
}
#screen-menu .sl-song-list[data-direction="next"] .sl-song-card.is-wheel-active { animation: sl-song-next .25s cubic-bezier(.16,1,.3,1); }
#screen-menu .sl-song-list[data-direction="previous"] .sl-song-card.is-wheel-active { animation: sl-song-previous .25s cubic-bezier(.16,1,.3,1); }
@keyframes sl-song-next { from { opacity: .35; transform: translateY(28px) scale(.94); } }
@keyframes sl-song-previous { from { opacity: .35; transform: translateY(-28px) scale(.94); } }
#screen-menu .sl-song-dialog-foot { margin: 0; padding: 11px 18px 14px; color: #655a62; font-size: .65rem; flex: 0 0 auto; }

@media (max-width: 600px) {
  #screen-menu .mr-menu-copy { padding: 14px 12px 20px; border-radius: 14px; box-shadow: 6px 6px 0 rgba(16, 24, 40, .5); }
  #screen-menu .sl-song-line { min-height: 62px; margin-bottom: 6px; padding: 8px 11px; }
  #screen-menu .sl-difficulty-option { min-height: 67px; padding: 8px 6px; }
  #screen-menu .sl-difficulty-copy { min-height: 34px; margin-bottom: 6px; font-size: .7rem; }
  #screen-menu .sl-start { min-height: 56px; }
  #screen-menu .sl-song-dialog { height: calc(100dvh - 28px); max-height: none; }
  #screen-menu .sl-song-dialog-head { min-height: 88px; padding: 13px 16px; }
  #screen-menu .sl-song-dialog-head p { font-size: .68rem; }
  #screen-menu .sl-song-dialog-head h2 { font-size: 1.8rem; }
  #screen-menu .sl-song-wheel-shell { height: auto; flex: 1 1 auto; min-height: 0; }
  #screen-menu .sl-song-list { flex: 1 1 auto; height: auto; min-height: 0; padding-inline: 18px; }
}

/* Desktop console scale: large text, clear focus states, and controller-sized targets. */
@media (min-width: 901px) {
  :where(
    #screen-title,
    #screen-menu,
    #screen-tools,
    #screen-game,
    #screen-result,
    #screen-tutorial,
    #screen-settings
  ) {
    overflow: auto;
    scrollbar-color: var(--sl-coral) rgba(7, 16, 27, .5);
  }

  :where(button, input, select):focus-visible {
    outline: 4px solid var(--sl-yellow);
    outline-offset: 4px;
  }

  #screen-title .title-shell {
    width: min(100%, 1600px);
    padding: 30px clamp(42px, 6vw, 96px) 24px;
    gap: 14px;
  }

  #screen-title .title-topbar {
    min-height: 34px;
    font-size: .9rem;
  }

  #screen-title .title-hero {
    grid-template-columns: minmax(0, 1fr) minmax(480px, .86fr);
    gap: clamp(36px, 5vw, 92px);
  }

  #screen-title .title-kicker,
  #screen-title .title-hint {
    font-size: .9rem;
  }

  #screen-title .title-logo {
    max-width: 860px;
    font-size: clamp(4.6rem, 7vw, 8rem);
  }

  #screen-title .title-logo-wrap .logo-sub {
    font-size: 1rem;
  }

  #screen-title .title-tagline {
    max-width: 680px;
    margin-top: 28px;
    font-size: clamp(1.2rem, 1.8vw, 1.6rem);
  }

  #screen-title .title-metrics {
    gap: 12px;
    margin-top: 30px;
  }

  #screen-title .title-metrics span {
    padding: 12px 15px;
    font-size: .76rem;
  }

  #screen-title .title-preview {
    width: min(100%, 700px);
    border-width: 2px;
    border-radius: 26px;
  }

  #screen-title .title-main {
    width: min(100%, 520px);
    gap: 12px;
  }

  #screen-title .btn-primary {
    min-height: 88px;
    font-size: 1.45rem;
  }

  #screen-title .btn-primary::after {
    font-size: .7rem;
  }

  #screen-title .title-footer {
    width: min(100%, 520px);
    gap: 12px;
  }

  #screen-title .btn-ghost {
    min-height: 76px;
    font-size: 1.05rem;
  }

  #screen-title .btn-ghost small {
    font-size: .68rem;
  }

  #screen-title .copyright {
    font-size: .72rem;
  }

  #screen-menu .songselect-shell {
    width: min(100%, 1440px);
    padding: 28px clamp(42px, 6vw, 96px) 26px;
    gap: 18px;
  }

  #screen-menu .songselect-top {
    min-height: 76px;
  }

  #screen-menu .btn-round {
    width: 64px;
    height: 64px;
    min-height: 64px;
    font-size: 2.25rem;
  }

  #screen-menu .songselect-kicker {
    font-size: .9rem;
  }

  #screen-menu .songselect-title {
    font-size: clamp(1.8rem, 2.8vw, 2.6rem);
  }

  #screen-menu .songselect-status,
  #screen-menu .songselect-count {
    font-size: .9rem;
  }

  #screen-menu .mr-menu-copy {
    width: min(100%, 980px);
    padding: 32px clamp(30px, 4vw, 56px) 38px;
    border-width: 3px;
    border-radius: 22px;
    box-shadow: 14px 14px 0 rgba(16, 24, 40, .52);
  }

  #screen-menu .sl-flow-label {
    gap: 12px;
    margin-bottom: 10px;
    font-size: 1.15rem;
  }

  #screen-menu .sl-flow-label + .sl-flow-label {
    margin-top: 24px;
  }

  #screen-menu .sl-flow-label span {
    width: 34px;
    height: 34px;
    font-size: .9rem;
  }

  #screen-menu .sl-song-line {
    min-height: 96px;
    gap: 18px;
    padding: 15px 20px;
    border-width: 3px;
  }

  #screen-menu .sl-vinyl {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }

  #screen-menu .sl-vinyl i {
    inset: 19px;
  }

  #screen-menu .sl-song-line strong {
    font-size: clamp(1.35rem, 2.1vw, 1.8rem);
  }

  #screen-menu .sl-song-line small {
    font-size: .92rem;
  }

  #screen-menu .sl-song-change {
    font-size: .9rem;
  }

  #screen-menu .sl-difficulty {
    max-width: none;
    gap: 14px;
  }

  #screen-menu .sl-difficulty legend {
    margin-bottom: 12px;
    font-size: 1rem;
  }

  #screen-menu .sl-difficulty-option {
    min-height: 108px;
    padding: 15px 17px;
    border-width: 3px;
    border-radius: 12px;
  }

  #screen-menu .sl-difficulty-option b {
    font-size: 1.35rem;
  }

  #screen-menu .sl-difficulty-option span {
    font-size: .9rem;
  }

  #screen-menu .sl-difficulty-option i {
    width: 40px;
    height: 40px;
    font-size: .95rem;
  }

  #screen-menu .sl-difficulty-copy {
    max-width: none;
    margin: 16px 0 22px;
    font-size: 1rem;
    line-height: 1.55;
  }

  #screen-menu .sl-start {
    width: 100%;
    min-height: 88px;
    padding: 17px 22px;
    border-width: 3px;
    border-radius: 12px;
  }

  #screen-menu .sl-start span {
    font-size: 1.45rem;
  }

  #screen-menu .sl-start small {
    font-size: .82rem;
  }

  #screen-menu .sl-song-dialog {
    width: min(1160px, calc(100% - 80px));
    max-height: calc(100dvh - 56px);
    border-width: 4px;
    border-radius: 22px;
    box-shadow: 16px 16px 0 rgba(29, 39, 37, .72);
  }

  #screen-menu .sl-song-dialog-head {
    padding: 28px 36px 24px;
    border-bottom-width: 4px;
  }

  #screen-menu .sl-song-dialog-head p {
    margin-bottom: 7px;
    font-size: .9rem;
  }

  #screen-menu .sl-song-dialog-head h2 {
    font-size: clamp(2rem, 4vw, 2.8rem);
  }

  #screen-menu .sl-song-dialog-head button {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
    font-size: 1.9rem;
  }

  #screen-menu .sl-song-categories {
    gap: 12px;
    padding: 14px 46px;
    border-bottom-width: 4px;
  }

  #screen-menu .sl-song-categories button {
    min-height: 56px;
    font-size: 1.1rem;
  }

  #screen-menu .sl-song-wheel-shell {
    border-bottom-width: 4px;
  }

  #screen-menu .sl-song-list {
    height: min(640px, calc(100dvh - 250px));
    min-height: 360px;
    gap: 12px;
    padding-inline: 80px;
  }

  #screen-menu .sl-song-card {
    min-height: 92px;
    gap: 20px;
    padding: 16px 24px;
    border-width: 3px;
  }

  #screen-menu .sl-song-card.is-wheel-active {
    min-height: 132px;
    box-shadow: 0 9px 0 var(--sl-ink);
  }

  #screen-menu .sl-song-number {
    font-size: 1.45rem;
  }

  #screen-menu .sl-song-card-copy strong {
    font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  }

  #screen-menu .sl-song-card.is-wheel-active .sl-song-card-copy strong {
    font-size: clamp(1.8rem, 3.6vw, 2.45rem);
  }

  #screen-menu .sl-song-card-copy small,
  #screen-menu .sl-song-card.is-wheel-active .sl-song-card-copy small {
    font-size: .9rem;
  }

  #screen-menu .sl-song-record {
    min-width: 72px;
    font-size: .78rem;
  }

  #screen-menu .sl-song-record b {
    font-size: 1rem;
  }

  #screen-menu .sl-song-card.is-wheel-active .sl-song-record b {
    font-size: 1.3rem;
  }

  #screen-menu .sl-song-step {
    min-height: 50px;
    padding: 9px 20px;
    font-size: .9rem;
  }

  #screen-menu .sl-song-counter {
    right: 28px;
    bottom: 22px;
    font-size: 1rem;
  }

  #screen-menu .sl-song-dialog-foot {
    padding: 16px 28px 20px;
    font-size: .9rem;
  }

  #screen-tools .tools-shell {
    width: min(100%, 1200px);
    margin: 0 auto;
    padding: 34px clamp(42px, 6vw, 96px) 30px;
  }

  #screen-tools .songselect-top {
    min-height: 76px;
  }

  #screen-tools .songselect-title {
    font-size: 2.6rem;
  }

  #screen-tools .tools-list {
    width: min(100%, 900px);
    gap: 22px;
    padding-top: 48px;
  }

  #screen-tools .btn-tool {
    min-height: 104px;
    padding: 22px 30px;
    border-width: 3px;
    border-radius: 18px;
    text-align: left;
    font-size: 1.45rem;
  }

  #screen-tools .tools-note {
    font-size: .9rem;
  }

  #screen-game {
    max-width: 1760px;
    padding: 24px clamp(36px, 5vw, 84px) 30px;
  }

  #screen-game .game-hud {
    min-height: 90px;
    grid-template-columns: minmax(220px, 1fr) auto auto auto minmax(150px, auto) minmax(180px, auto) auto;
    gap: 16px;
    padding: 16px 22px;
    border-width: 3px;
    border-radius: 18px;
    font-size: clamp(.82rem, 1vw, 1.08rem);
  }

  #screen-game .game-hud b {
    font-size: 1.25em;
  }

  #screen-game .hud-song {
    font-size: 1.1em;
  }

  #screen-game .hud-combo {
    font-size: clamp(1.5rem, 2.5vw, 2.6rem);
  }

  #screen-game .hud-life {
    width: 100%;
    min-width: 180px;
    height: 24px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: .86rem;
  }

  #screen-game .hud-life-fill {
    height: 12px;
    border-radius: 6px;
  }

  #screen-game .hud-pause {
    width: 70px;
    height: 64px;
    min-height: 64px;
    border-width: 3px;
    border-radius: 14px;
    font-size: 1.45rem;
  }

  #screen-game .stage {
    margin-top: 18px;
    border-width: 3px;
    border-radius: 26px;
  }

  #screen-game .stage-section-cue {
    min-width: 190px;
    padding: 14px 18px;
    border-left-width: 5px;
    font-size: .8rem;
  }

  #screen-game .stage-section-cue b {
    font-size: clamp(1.25rem, 1.8vw, 1.7rem);
  }

  #screen-game .progress-track {
    height: 10px;
    margin-top: 14px;
  }

  #screen-game .game-hint {
    margin-top: 14px;
    font-size: 1rem;
  }

  #screen-game .overlay-card {
    width: min(90%, 520px);
    padding: 38px 34px;
    border-width: 3px;
    border-radius: 24px;
    gap: 16px;
  }

  #screen-game .overlay-title {
    font-size: 2rem;
  }

  #screen-game .overlay-card button {
    min-height: 72px;
    border-width: 2px;
    border-radius: 16px;
    font-size: 1.2rem;
  }

  #screen-result {
    max-width: none;
    padding: 42px clamp(42px, 6vw, 96px);
  }

  #screen-result .result-card {
    width: min(100%, 1100px);
    padding: 48px 56px;
    border-width: 3px;
    border-radius: 28px;
  }

  #screen-result .result-title {
    font-size: clamp(2.6rem, 4vw, 4.2rem);
  }

  #screen-result .result-songline b {
    font-size: clamp(1.45rem, 2.2vw, 2.2rem);
  }

  #screen-result .result-songline span {
    font-size: 1rem;
  }

  #screen-result .result-grade {
    margin: 20px 0 10px;
    font-size: clamp(6rem, 12vw, 10rem);
  }

  #screen-result .result-score {
    font-size: 1.1rem;
  }

  #screen-result .result-score b {
    font-size: 1.8rem;
  }

  #screen-result .result-stats {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 28px 0;
  }

  #screen-result .result-stats div {
    min-height: 112px;
    padding: 18px 12px;
    border-radius: 14px;
  }

  #screen-result .result-stats span {
    font-size: .78rem;
  }

  #screen-result .result-stats b {
    font-size: 1.4rem;
  }

  #screen-result .result-actions {
    width: min(100%, 720px);
    margin: 28px auto 0;
    gap: 16px;
  }

  #screen-result .result-actions button {
    min-height: 78px;
    border-width: 3px;
    border-radius: 14px;
    font-size: 1.2rem;
  }

  #screen-tutorial {
    max-width: none;
    padding: 42px clamp(42px, 6vw, 96px);
  }

  #screen-tutorial .tutorial-card {
    width: min(100%, 1100px);
    max-width: none;
    padding: 42px 50px;
    border-width: 3px;
    border-radius: 28px;
  }

  #screen-tutorial .result-title {
    font-size: clamp(2.4rem, 4vw, 3.8rem);
  }

  #screen-tutorial .tutorial-stage {
    min-height: min(52vh, 500px);
    margin-top: 26px;
    border-width: 3px;
    border-radius: 20px;
  }

  #screen-tutorial #tutorial-canvas {
    height: min(52vh, 500px);
  }

  #screen-tutorial .tutorial-text {
    margin-top: 22px;
    font-size: 1.35rem;
    line-height: 1.6;
  }

  #screen-tutorial .tutorial-step {
    margin-top: 10px;
    font-size: 1rem;
  }

  #screen-tutorial .result-actions {
    margin-top: 24px;
  }

  #screen-tutorial .result-actions button {
    min-height: 72px;
    font-size: 1.15rem;
  }

  #screen-settings {
    max-width: none;
    align-items: flex-start;
    padding: 36px clamp(42px, 6vw, 96px);
  }

  #screen-settings .settings-card {
    width: min(100%, 1200px);
    max-height: calc(100dvh - 72px);
    margin: 0 auto;
    padding: 38px 50px;
    border-width: 3px;
    border-radius: 28px;
  }

  #screen-settings .result-title {
    font-size: clamp(2.4rem, 4vw, 3.8rem);
  }

  #screen-settings .setting-row {
    grid-template-columns: minmax(330px, .85fr) minmax(300px, 1.25fr) auto;
    gap: 20px 28px;
    padding: 20px 0;
  }

  #screen-settings .setting-label {
    grid-column: 1;
    font-size: 1.05rem;
    line-height: 1.45;
  }

  #screen-settings .setting-row input[type="range"],
  #screen-settings .setting-row select,
  #screen-settings .setting-row > button,
  #screen-settings .setting-row > label {
    grid-column: 2;
  }

  #screen-settings .setting-row input[type="range"] {
    min-height: 28px;
  }

  #screen-settings .setting-row > label {
    font-size: .95rem;
    line-height: 1.5;
  }

  #screen-settings .setting-value {
    grid-column: 3;
    font-size: .9rem;
  }

  #screen-settings .setting-row > button {
    min-height: 58px;
    padding: 12px 18px;
    border-width: 2px;
    font-size: 1rem;
  }

  #screen-settings .switch {
    width: 64px;
    height: 34px;
    justify-self: start;
  }

  #screen-settings .switch span::before {
    width: 28px;
    height: 28px;
  }

  #screen-settings .switch input:checked + span::before {
    transform: translateX(30px);
  }

  #screen-settings .result-actions {
    margin-top: 28px;
  }

  #screen-settings .result-actions button {
    min-height: 72px;
    font-size: 1.15rem;
  }
}

/* ── Fullscreen song-card browser ──
   The song picker is a direct card browser now; avoid dialog-sized wheel
   scrolling, layout jumps, and smooth-scroll work while changing songs. */
#screen-menu .sl-song-dialog {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#screen-menu .sl-song-dialog[open] {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

#screen-menu .sl-song-dialog-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, .42fr) auto;
  align-items: center;
  gap: 24px;
  padding: 24px clamp(22px, 5vw, 80px) 20px;
}

#screen-menu .sl-song-dialog-current {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 16px;
  color: #ffeec5;
  border: 2px solid rgba(242, 200, 91, .55);
  border-radius: 10px;
  background: rgba(29, 39, 37, .35);
}

#screen-menu .sl-song-dialog-current span {
  color: #f2c85b;
  font: 900 .66rem/1 var(--font-mono);
  letter-spacing: .12em;
}

#screen-menu .sl-song-dialog-current strong {
  overflow: hidden;
  color: #fff8e8;
  font: 900 clamp(1rem, 1.8vw, 1.35rem)/1.1 var(--font-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}

#screen-menu .sl-song-categories {
  padding-inline: clamp(22px, 5vw, 80px);
}

#screen-menu .sl-song-wheel-shell {
  min-height: 0;
  overflow: hidden;
}

#screen-menu .sl-song-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-content: start;
  gap: 14px;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 24px clamp(22px, 5vw, 80px) 72px;
  overflow-y: auto;
  scroll-behavior: auto;
  scroll-snap-type: none;
  scrollbar-width: thin;
  mask-image: none;
}

#screen-menu .sl-song-list::before,
#screen-menu .sl-song-list::after {
  display: none;
}

#screen-menu .sl-song-card,
#screen-menu .sl-song-card.is-wheel-active {
  min-height: 118px;
  padding: 18px 20px;
  opacity: .86;
  transform: none;
  filter: none;
  border-width: 3px;
  border-radius: 14px;
  box-shadow: 0 5px 0 rgba(29, 39, 37, .28);
  transition: opacity .14s ease-out, background .14s ease-out, border-color .14s ease-out, box-shadow .14s ease-out;
}

#screen-menu .sl-song-card:hover,
#screen-menu .sl-song-card:focus-visible {
  opacity: 1;
  background: #fff8e8;
  border-color: var(--sl-coral-dark);
  box-shadow: 0 7px 0 rgba(29, 39, 37, .36);
}

#screen-menu .sl-song-card.is-wheel-near {
  opacity: .86;
  transform: none;
  filter: none;
}

#screen-menu .sl-song-card.is-wheel-active,
#screen-menu .sl-song-card.is-selected {
  opacity: 1;
  color: #fff8e8;
  background: linear-gradient(135deg, var(--sl-coral-dark), #7f3837);
  border-color: #fff8e8;
  box-shadow: 0 7px 0 var(--sl-ink), 0 0 0 3px rgba(242, 200, 91, .28);
}

#screen-menu .sl-song-card.is-wheel-active .sl-song-card-copy strong,
#screen-menu .sl-song-card.is-selected .sl-song-card-copy strong {
  font-size: clamp(1.3rem, 2vw, 1.7rem);
}

#screen-menu .sl-song-card.is-wheel-active .sl-song-card-copy small,
#screen-menu .sl-song-card.is-selected .sl-song-card-copy small {
  color: #ffeec5;
}

#screen-menu .sl-song-step {
  display: none;
}

#screen-menu .sl-song-counter {
  right: clamp(22px, 5vw, 80px);
  bottom: 22px;
  padding: 7px 10px;
  color: var(--sl-ink);
  background: var(--sl-yellow);
  border: 2px solid var(--sl-ink);
  border-radius: 6px;
}

#screen-menu .sl-song-dialog-foot {
  padding: 14px clamp(22px, 5vw, 80px) max(18px, env(safe-area-inset-bottom));
  background: #f7e5b0;
  border-top: 3px solid var(--sl-ink);
  font-size: .8rem;
}

@media (max-width: 900px) {
  #screen-menu .sl-song-dialog-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    padding: 18px 20px 16px;
  }

  #screen-menu .sl-song-dialog-current {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  #screen-menu .sl-song-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 16px 18px 64px;
  }

  #screen-menu .sl-song-categories {
    padding-inline: 18px;
  }

  #screen-menu .sl-song-dialog-foot {
    padding-inline: 18px;
  }
}

@media (max-width: 600px) {
  #screen-menu .sl-song-dialog-head {
    padding: max(14px, env(safe-area-inset-top)) 14px 12px;
  }

  #screen-menu .sl-song-dialog-head h2 {
    font-size: 1.8rem;
  }

  #screen-menu .sl-song-dialog-current {
    display: none;
  }

  #screen-menu .sl-song-categories {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 14px;
  }

  #screen-menu .sl-song-categories button {
    flex: 0 0 auto;
    min-width: 92px;
  }

  #screen-menu .sl-song-list {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 12px 58px;
  }

  #screen-menu .sl-song-card,
  #screen-menu .sl-song-card.is-wheel-active {
    min-height: 82px;
    padding: 12px 14px;
  }

  #screen-menu .sl-song-card.is-wheel-active .sl-song-card-copy strong,
  #screen-menu .sl-song-card.is-selected .sl-song-card-copy strong {
    font-size: 1.25rem;
  }

  #screen-menu .sl-song-dialog-foot {
    padding: 10px 14px max(12px, env(safe-area-inset-bottom));
    font-size: .68rem;
  }
}

/* ── Game-feel UI pass: stage entrance, song shelf, readable player copy ── */
#screen-title {
  color: var(--mr-paper);
  background:
    radial-gradient(720px 540px at 76% 18%, rgba(242, 201, 91, .18), transparent 68%),
    radial-gradient(560px 500px at 14% 94%, rgba(199, 84, 72, .18), transparent 70%),
    linear-gradient(135deg, #0c302d 0%, #173a37 55%, #2a4b45 100%);
}

#screen-title::before {
  opacity: .2;
  background:
    radial-gradient(360px 180px at 72% 7%, rgba(255, 246, 220, .14), transparent 70%),
    linear-gradient(115deg, transparent 0 43%, rgba(242, 201, 91, .12) 43.2% 43.6%, transparent 44% 100%);
}

#screen-title::after {
  opacity: .8;
  background: linear-gradient(180deg, transparent 0 78%, rgba(8, 28, 27, .48) 78% 100%);
}

#screen-title .title-shell {
  width: min(100%, 1680px);
  padding: max(24px, env(safe-area-inset-top)) clamp(28px, 6vw, 100px) max(22px, env(safe-area-inset-bottom));
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: clamp(22px, 3.4vh, 46px);
}

#screen-title .title-topbar {
  min-height: 42px;
  color: rgba(255, 246, 220, .76);
  border-bottom: 2px solid rgba(255, 246, 220, .2);
}

#screen-title .title-brand,
#screen-title .title-status {
  color: rgba(255, 246, 220, .76);
  font-size: clamp(.82rem, 1vw, 1rem);
}

#screen-title .title-brand { letter-spacing: .1em; }
#screen-title .title-brand i { background: var(--mr-coral); box-shadow: 0 0 16px rgba(199, 84, 72, .75); }
#screen-title .title-status b { background: var(--mr-yellow); box-shadow: 0 0 12px rgba(242, 201, 91, .8); }

#screen-title .title-hero {
  grid-template-columns: minmax(0, 1fr) minmax(390px, .82fr);
  gap: clamp(34px, 6vw, 110px);
  align-items: center;
}

#screen-title .title-copy { align-self: center; }
#screen-title .title-kicker {
  margin-bottom: 20px;
  color: var(--mr-yellow);
  font-size: clamp(.85rem, 1.2vw, 1.1rem);
  letter-spacing: .16em;
}

#screen-title .title-logo-wrap {
  margin-top: 0;
  text-align: left;
}

#screen-title .title-logo {
  max-width: 900px;
  color: var(--mr-paper);
  background: none;
  -webkit-text-fill-color: var(--mr-paper);
  font-size: clamp(3.5rem, 7vw, 7.8rem);
  line-height: .98;
  letter-spacing: .03em;
  text-shadow: 0 6px 0 rgba(8, 28, 27, .45), 0 0 34px rgba(242, 201, 91, .16);
  white-space: normal;
}

#screen-title .logo-sub {
  margin-top: 16px;
  color: var(--mr-cyan);
  font-size: clamp(.78rem, 1vw, 1rem);
  letter-spacing: .18em;
}

#screen-title .title-tagline {
  max-width: 700px;
  margin-top: 28px;
  color: var(--mr-paper);
  font-size: clamp(1.2rem, 2.1vw, 2rem);
  line-height: 1.4;
}

#screen-title .title-ritual {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

#screen-title .title-ritual span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 14px;
  color: var(--mr-ink);
  background: rgba(255, 246, 220, .9);
  border: 2px solid var(--mr-ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(8, 28, 27, .52);
  font-size: clamp(.78rem, 1vw, .96rem);
  font-weight: 900;
}

#screen-title .title-preview {
  min-height: 460px;
  aspect-ratio: 1.08;
  border: 4px solid var(--mr-ink);
  border-radius: 42% 42% 26px 26px / 16% 16% 26px 26px;
  background:
    radial-gradient(ellipse at 50% 4%, rgba(242, 201, 91, .42), transparent 28%),
    linear-gradient(180deg, #2d6a60 0 72%, #895337 72% 100%);
  box-shadow: 14px 16px 0 rgba(8, 28, 27, .7), 0 24px 60px rgba(8, 28, 27, .28);
}

#screen-title .title-preview-topline,
#screen-title .title-preview-bottomline {
  color: rgba(255, 246, 220, .84);
  font-size: clamp(.68rem, .9vw, .86rem);
}

#screen-title .title-preview-topline b { color: var(--mr-yellow); }

#screen-title .title-preview-grid {
  inset: 54px 28px 62px;
  border: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(242, 201, 91, .2), transparent 34%),
    radial-gradient(circle at 50% 50%, rgba(255, 246, 220, .1), transparent 58%);
}

#screen-title .title-preview-grid::before,
#screen-title .title-preview-grid::after { display: none; }

#screen-title .title-ring {
  width: clamp(72px, 8vw, 116px);
  border-color: var(--mr-yellow);
  box-shadow: 0 0 24px rgba(242, 201, 91, .64), inset 0 0 14px rgba(242, 201, 91, .24);
}

#screen-title .title-ring-b {
  width: clamp(58px, 6.5vw, 92px);
  border-color: var(--mr-cyan);
}

#screen-title .title-ring-c {
  width: clamp(48px, 5.5vw, 76px);
  border-color: var(--mr-coral);
}

#screen-title .title-route {
  border-top: 3px solid rgba(242, 201, 91, .86);
  filter: drop-shadow(0 0 7px rgba(242, 201, 91, .7));
}

#screen-title .title-cursor {
  width: 16px;
  height: 16px;
  background: var(--mr-paper);
  border-color: var(--mr-paper);
  box-shadow: 0 0 0 10px rgba(255, 246, 220, .16), 0 0 26px var(--mr-paper);
}

#screen-title .title-preview-band {
  left: 5%;
  right: 5%;
  bottom: 8%;
  height: 54%;
  border-bottom: 3px solid rgba(255, 246, 220, .48);
}

#screen-title .title-preview-band img {
  filter: drop-shadow(0 9px 5px rgba(8, 28, 27, .46));
}

#screen-title .title-main {
  width: min(100%, 560px);
  align-items: stretch;
  justify-self: start;
  gap: 10px;
}

#screen-title .btn-primary {
  min-height: 92px;
  color: var(--mr-paper);
  background: linear-gradient(180deg, var(--mr-coral), var(--mr-coral-dark));
  border: 3px solid var(--mr-ink);
  border-radius: 16px;
  box-shadow: 0 8px 0 var(--mr-ink), 0 18px 34px rgba(159, 64, 56, .3);
  font-size: clamp(1.35rem, 2vw, 2rem);
  letter-spacing: .12em;
}

#screen-title .btn-primary::after { content: none !important; display: none !important; }
#screen-title .title-hint { margin-left: 4px; color: rgba(255, 246, 220, .7); font-size: .9rem; }
#screen-menu .start-button::after,
#screen-menu .song-browser-head small::after { content: none !important; display: none !important; }

#screen-title .title-footer {
  width: min(100%, 560px);
  justify-self: start;
  gap: 10px;
}

#screen-title .btn-ghost {
  min-height: 66px;
  color: var(--mr-paper);
  background: rgba(8, 28, 27, .48);
  border: 2px solid rgba(255, 246, 220, .28);
}

#screen-title .btn-ghost:hover,
#screen-title .btn-ghost:focus-visible {
  color: var(--mr-ink);
  background: var(--mr-yellow);
  border-color: var(--mr-ink);
}

#screen-title .btn-ghost small { color: rgba(255, 246, 220, .66); font-size: .72rem; }
#screen-title .btn-ghost:hover small,
#screen-title .btn-ghost:focus-visible small { color: var(--mr-ink); }
#screen-title .copyright { color: rgba(255, 246, 220, .56); }

#screen-menu {
  color: var(--mr-ink);
  background:
    radial-gradient(760px 520px at 82% 8%, rgba(242, 201, 91, .16), transparent 72%),
    linear-gradient(135deg, #17443f, #0d2f2d 65%, #102a2a);
}

#screen-menu .songselect-shell {
  width: min(100%, 1680px);
  padding: max(24px, env(safe-area-inset-top)) clamp(24px, 6vw, 100px) max(22px, env(safe-area-inset-bottom));
  gap: clamp(20px, 3vh, 34px);
}

#screen-menu .songselect-top {
  min-height: 70px;
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(255, 246, 220, .2);
}

#screen-menu .songselect-kicker { color: var(--mr-yellow); font-size: clamp(.82rem, 1vw, 1rem); }
#screen-menu .songselect-title { color: var(--mr-paper); font-size: clamp(1.8rem, 3vw, 3rem); }
#screen-menu .songselect-status { color: rgba(255, 246, 220, .7); font-size: .9rem; }
#screen-menu .songselect-online { color: #b8f0c7; }
#screen-menu .songselect-online b { background: #7ee8a0; box-shadow: 0 0 12px #7ee8a0; }
#screen-menu .songselect-count { color: var(--mr-yellow); }

#screen-menu .mr-menu-copy {
  width: min(100%, 1100px);
  margin: auto;
  padding: clamp(20px, 2.8vw, 40px) clamp(24px, 4vw, 52px);
  color: var(--mr-ink);
  background:
    radial-gradient(420px 180px at 92% 0%, rgba(242, 201, 91, .32), transparent 72%),
    var(--mr-paper);
  border: 4px solid var(--mr-ink);
  border-radius: 28px;
  box-shadow: 14px 15px 0 rgba(8, 28, 27, .58);
}

#screen-menu .sl-flow-label {
  margin-bottom: 12px;
  color: var(--mr-ink);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
}

#screen-menu .sl-flow-label span {
  width: 34px;
  height: 34px;
  background: var(--mr-coral);
  border: 2px solid var(--mr-ink);
  color: var(--mr-paper);
  font-size: .9rem;
}

#screen-menu .sl-song-line {
  min-height: 112px;
  gap: 18px;
  padding: 18px 22px;
  color: var(--mr-ink);
  background: rgba(255, 255, 255, .62);
  border: 3px solid var(--mr-ink);
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(23, 58, 55, .35);
}

#screen-menu .sl-song-line:hover,
#screen-menu .sl-song-line:focus-visible {
  background: #fff8e8;
  border-color: var(--mr-coral-dark);
  transform: translateY(-3px);
}

#screen-menu .sl-vinyl {
  width: 66px;
  height: 66px;
  flex-basis: 66px;
  background: var(--mr-ink);
  box-shadow: inset 0 0 0 8px #3f344c, inset 0 0 0 16px var(--mr-ink);
}

#screen-menu .sl-vinyl i { inset: 23px; background: var(--mr-coral); }
#screen-menu .sl-song-line strong { font-size: clamp(1.3rem, 2.4vw, 2rem); line-height: 1.1; }
#screen-menu .sl-song-line small { margin-top: 6px; color: #62566e; font-size: .9rem; line-height: 1.35; }
#screen-menu .sl-song-change { color: var(--mr-coral-dark); font-size: .9rem; }

#screen-menu .sl-difficulty {
  max-width: none;
  gap: 12px;
}

#screen-menu .sl-difficulty-option {
  min-height: 100px;
  padding: 16px;
  color: var(--mr-ink);
  background: rgba(255, 255, 255, .62);
  border: 3px solid rgba(23, 58, 55, .4);
  border-radius: 14px;
}

#screen-menu .sl-difficulty-option:hover,
#screen-menu .sl-difficulty-option:focus-visible { border-color: var(--mr-coral-dark); }
#screen-menu .sl-difficulty-option.is-selected { background: #fff8e8; border-color: var(--mr-ink); box-shadow: 0 5px 0 var(--mr-ink); }
#screen-menu .sl-difficulty-option b { font-size: clamp(1.1rem, 1.8vw, 1.5rem); }
#screen-menu .sl-difficulty-option span { color: #62566e; font-size: .82rem; line-height: 1.3; }
#screen-menu .sl-difficulty-option i { width: 36px; height: 36px; background: var(--mr-ink); font-size: .85rem; }
#screen-menu .sl-difficulty-copy { color: #51455d; font-size: .9rem; line-height: 1.55; }

#screen-menu .sl-start {
  width: 100%;
  min-height: 82px;
  padding: 16px 22px;
  background: linear-gradient(180deg, var(--mr-coral), var(--mr-coral-dark));
  border: 3px solid var(--mr-ink);
  border-radius: 14px;
  box-shadow: 0 7px 0 var(--mr-ink);
}

#screen-menu .sl-start span { font-size: clamp(1.15rem, 2vw, 1.6rem); }
#screen-menu .sl-start small { font-size: .8rem; }

#screen-menu .sl-song-dialog {
  color: var(--mr-ink);
  background: var(--mr-paper);
}

#screen-menu .sl-song-dialog-head {
  grid-template-columns: minmax(0, 1fr) minmax(300px, .7fr) auto;
  gap: clamp(18px, 3vw, 42px);
  padding: clamp(22px, 3vw, 42px) clamp(24px, 6vw, 100px) 26px;
  background: var(--mr-track);
  border-bottom: 4px solid var(--mr-ink);
}

#screen-menu .sl-dialog-heading p {
  margin: 0 0 8px;
  color: var(--mr-yellow);
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  font-weight: 900;
}

#screen-menu .sl-dialog-heading h2 { color: var(--mr-paper); font-size: clamp(2rem, 4vw, 3.4rem); }
#screen-menu .sl-dialog-heading small { display: block; margin-top: 9px; color: rgba(255, 246, 220, .72); font-size: clamp(.82rem, 1vw, 1rem); }

#screen-menu .sl-song-dialog-current {
  align-self: stretch;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 16px 20px;
  color: var(--mr-paper);
  background: rgba(8, 28, 27, .48);
  border: 3px solid rgba(242, 201, 91, .62);
  border-radius: 16px;
}

#screen-menu .sl-song-dialog-current span { color: var(--mr-yellow); font-size: .76rem; letter-spacing: .12em; }
#screen-menu .sl-song-dialog-current strong {
  overflow: visible;
  color: var(--mr-paper);
  font-size: clamp(1.25rem, 2vw, 2rem);
  line-height: 1.12;
  white-space: normal;
}

#screen-menu .sl-song-dialog-current small {
  color: rgba(255, 246, 220, .76);
  font-size: .78rem;
  line-height: 1.35;
}

#screen-menu .sl-song-dialog-head > button {
  width: 56px;
  height: 56px;
  flex-basis: 56px;
  color: var(--mr-ink);
  background: var(--mr-yellow);
  border: 3px solid var(--mr-ink);
  font-size: 1.9rem;
}

#screen-menu .sl-song-categories {
  gap: 10px;
  padding: 12px clamp(24px, 6vw, 100px);
  background: #f2d897;
  border-bottom: 4px solid var(--mr-ink);
}

#screen-menu .sl-song-categories button {
  min-height: 52px;
  color: #51455d;
  border: 3px solid transparent;
  border-radius: 999px;
  font-size: clamp(.9rem, 1.3vw, 1.1rem);
}

#screen-menu .sl-song-categories button:hover,
#screen-menu .sl-song-categories button:focus-visible { color: var(--mr-ink); border-color: var(--mr-coral-dark); }
#screen-menu .sl-song-categories button.is-active { color: var(--mr-ink); background: var(--mr-yellow); border-color: var(--mr-ink); box-shadow: 0 4px 0 var(--mr-coral-dark); }

#screen-menu .sl-song-wheel-shell {
  background:
    radial-gradient(650px 420px at 82% 0%, rgba(101, 184, 170, .2), transparent 72%),
    var(--mr-track);
  border-bottom: 4px solid var(--mr-ink);
}

#screen-menu .sl-song-list {
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
  padding: 28px clamp(24px, 6vw, 100px) 84px;
}

#screen-menu .sl-song-card {
  --sl-card-accent: var(--mr-coral);
  min-height: 174px;
  padding: 22px 24px;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  overflow: hidden;
  opacity: 1;
  color: var(--mr-ink);
  background: linear-gradient(145deg, #fff8e8, #f2dfb0);
  border: 3px solid rgba(23, 58, 55, .38);
  border-radius: 18px;
  box-shadow: 0 7px 0 rgba(8, 28, 27, .34);
}

#screen-menu .sl-song-card[data-category="party"] { --sl-card-accent: #d55e50; }
#screen-menu .sl-song-card[data-category="heat"] { --sl-card-accent: #e39b3e; }
#screen-menu .sl-song-card[data-category="groove"] { --sl-card-accent: #4e9f95; }
#screen-menu .sl-song-card[data-category="relax"] { --sl-card-accent: #7c82b4; }

#screen-menu .sl-song-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 9px;
  background: var(--sl-card-accent);
}

#screen-menu .sl-song-card::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -38px;
  width: 132px;
  height: 132px;
  border: 16px solid rgba(23, 58, 55, .08);
  border-radius: 50%;
  box-shadow: inset 0 0 0 13px rgba(23, 58, 55, .06);
  pointer-events: none;
}

#screen-menu .sl-song-card:hover,
#screen-menu .sl-song-card:focus-visible {
  opacity: 1;
  background: #fff8e8;
  border-color: var(--sl-card-accent);
  box-shadow: 0 9px 0 rgba(8, 28, 27, .4);
}

#screen-menu .sl-song-card.is-wheel-active,
#screen-menu .sl-song-card.is-selected {
  opacity: 1;
  color: var(--mr-paper);
  background: linear-gradient(145deg, var(--mr-coral-dark), #7f3837);
  border-color: var(--mr-paper);
  box-shadow: 0 8px 0 var(--mr-ink), 0 0 0 4px rgba(242, 201, 91, .26);
}

#screen-menu .sl-song-card.is-wheel-active,
#screen-menu .sl-song-card.is-selected {
  min-height: 174px;
  padding: 22px 24px;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  gap: 16px;
}

#screen-menu .sl-song-number {
  position: relative;
  z-index: 1;
  color: var(--sl-card-accent);
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: .9;
}

#screen-menu .sl-song-card-copy {
  position: relative;
  z-index: 1;
  align-content: start;
  gap: 7px;
}

#screen-menu .sl-song-card-copy strong {
  display: block;
  overflow: visible;
  font-size: clamp(1.2rem, 1.8vw, 1.7rem);
  line-height: 1.12;
  white-space: normal;
}

#screen-menu .sl-song-card.is-wheel-active .sl-song-card-copy strong,
#screen-menu .sl-song-card.is-selected .sl-song-card-copy strong {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
  font-size: clamp(1.2rem, 1.8vw, 1.7rem);
}

#screen-menu .sl-song-card-copy small {
  display: block;
  overflow: visible;
  color: #5f5360;
  font-size: .9rem;
  line-height: 1.35;
  white-space: normal;
}

#screen-menu .sl-song-card.is-wheel-active .sl-song-card-copy small,
#screen-menu .sl-song-card.is-selected .sl-song-card-copy small {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
  white-space: normal;
}

#screen-menu .sl-song-card-details {
  display: block;
  color: #796b68;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.4;
  white-space: normal;
}

#screen-menu .sl-song-card.is-wheel-active .sl-song-card-copy small,
#screen-menu .sl-song-card.is-selected .sl-song-card-copy small,
#screen-menu .sl-song-card.is-wheel-active .sl-song-card-details,
#screen-menu .sl-song-card.is-selected .sl-song-card-details { color: #ffeec5; }

#screen-menu .sl-song-record {
  position: relative;
  z-index: 1;
  min-width: 68px;
  padding-top: 2px;
  color: #786866;
  font-size: .68rem;
}

#screen-menu .sl-song-record b { color: var(--sl-card-accent); font-size: .92rem; }
#screen-menu .sl-song-card.is-wheel-active .sl-song-record,
#screen-menu .sl-song-card.is-selected .sl-song-record { color: #ffeec5; }
#screen-menu .sl-song-card.is-wheel-active .sl-song-record b,
#screen-menu .sl-song-card.is-selected .sl-song-record b { color: var(--mr-yellow); }

#screen-menu .sl-current-badge {
  top: 14px;
  right: 18px;
  padding: 5px 9px;
  color: var(--mr-ink);
  background: var(--mr-yellow);
  border: 2px solid var(--mr-ink);
  border-radius: 999px;
  font-size: .62rem;
}

#screen-menu .sl-song-card-category {
  position: absolute;
  right: 20px;
  bottom: 14px;
  z-index: 1;
  color: var(--sl-card-accent);
  font-size: .68rem;
  font-weight: 900;
}

#screen-menu .sl-song-card.is-wheel-active .sl-song-card-category,
#screen-menu .sl-song-card.is-selected .sl-song-card-category { color: var(--mr-yellow); }

#screen-menu .sl-song-counter {
  right: clamp(24px, 6vw, 100px);
  bottom: 22px;
  padding: 8px 12px;
  color: var(--mr-ink);
  background: var(--mr-yellow);
  border: 3px solid var(--mr-ink);
  border-radius: 999px;
  font-size: .82rem;
}

#screen-menu .sl-song-dialog-foot {
  padding: 16px clamp(24px, 6vw, 100px) max(20px, env(safe-area-inset-bottom));
  color: #62566e;
  background: #f7e5b0;
  border-top: 0;
  font-size: .9rem;
}

#screen-result {
  color: var(--mr-paper);
  background:
    radial-gradient(720px 520px at 75% 10%, rgba(242, 201, 91, .18), transparent 72%),
    linear-gradient(135deg, #17443f, #0d2f2d 65%, #102a2a);
}

#screen-result .result-card {
  width: min(100%, 920px);
  color: var(--mr-ink);
  background: var(--mr-paper);
  border: 4px solid var(--mr-ink);
  border-radius: 28px;
  box-shadow: 14px 15px 0 rgba(8, 28, 27, .62), 0 28px 70px rgba(8, 28, 27, .28);
}

#screen-result .result-title { color: var(--mr-coral-dark); font-size: clamp(2rem, 4vw, 4rem); letter-spacing: .08em; }
#screen-result .result-songline b { color: var(--mr-ink); font-size: clamp(1.25rem, 2vw, 2rem); line-height: 1.15; }
#screen-result .result-songline span { color: #62566e; font-size: .9rem; }
#screen-result .result-grade { color: var(--mr-coral); text-shadow: 0 5px 0 rgba(159, 64, 56, .16); }
#screen-result .result-score { color: #62566e; font-size: 1rem; }
#screen-result .result-score b,
#screen-result .result-stats b { color: var(--mr-ink); }
#screen-result .result-stats div { background: rgba(23, 58, 55, .1); border: 2px solid rgba(23, 58, 55, .1); }
#screen-result .result-stats span { color: #62566e; font-size: .78rem; }
#screen-result .result-stats b { font-size: 1.1rem; }
#screen-result .result-actions button { min-height: 70px; border: 3px solid var(--mr-ink); font-size: 1.1rem; }
#screen-result #btn-retry { background: var(--mr-coral); color: var(--mr-paper); }
#screen-result #btn-back { color: var(--mr-paper); background: var(--mr-track); border-color: var(--mr-ink) !important; }

@media (max-width: 900px) {
  #screen-title .title-hero {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  #screen-title .title-copy,
  #screen-title .title-logo-wrap { text-align: center; }
  #screen-title .title-logo { margin-inline: auto; }
  #screen-title .title-ritual,
  #screen-title .title-main,
  #screen-title .title-footer { justify-self: center; }
  #screen-title .title-ritual { justify-content: center; }
  #screen-title .title-preview { width: min(100%, 680px); min-height: 360px; margin-inline: auto; }
  #screen-title .title-main { width: min(100%, 680px); }
  #screen-title .title-footer { width: min(100%, 680px); }

  #screen-menu .sl-song-dialog-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #screen-menu .sl-song-dialog-current {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 600px) {
  #screen-title .title-shell {
    padding-inline: 16px;
    gap: 18px;
  }

  #screen-title .title-topbar { min-height: 34px; }
  #screen-title .title-status { display: none; }
  #screen-title .title-kicker { margin-bottom: 12px; font-size: .76rem; }
  #screen-title .title-logo { font-size: clamp(2.7rem, 13vw, 4.6rem); }
  #screen-title .title-tagline { margin-top: 16px; font-size: 1.08rem; }
  #screen-title .title-ritual { gap: 7px; margin-top: 18px; }
  #screen-title .title-ritual span { min-height: 36px; padding: 7px 10px; font-size: .68rem; }
  #screen-title .title-preview { min-height: 260px; aspect-ratio: 1.3; border-width: 3px; border-radius: 32% 32% 18px 18px / 12% 12% 18px 18px; }
  #screen-title .title-preview-grid { inset: 38px 18px 46px; }
  #screen-title .title-preview-band { height: 48%; }
  #screen-title .title-main { width: 100%; }
  #screen-title .btn-primary { min-height: 76px; }
  #screen-title .title-footer { width: 100%; gap: 7px; }
  #screen-title .btn-ghost { min-height: 58px; padding-inline: 4px; }
  #screen-title .btn-ghost small { font-size: .62rem; }
  #screen-title .copyright { font-size: .58rem; }

  #screen-menu .songselect-shell {
    padding-inline: 12px;
    gap: 14px;
  }

  #screen-menu .songselect-top { min-height: 54px; gap: 10px; }
  #screen-menu .btn-round { width: 48px; height: 48px; min-height: 48px; }
  #screen-menu .songselect-title { font-size: 1.45rem; }
  #screen-menu .songselect-status { font-size: .68rem; }
  #screen-menu .mr-menu-copy { padding: 18px 14px 22px; border-width: 3px; border-radius: 20px; box-shadow: 8px 9px 0 rgba(8, 28, 27, .56); }
  #screen-menu .sl-song-line { min-height: 92px; padding: 13px 14px; gap: 12px; }
  #screen-menu .sl-vinyl { width: 52px; height: 52px; flex-basis: 52px; }
  #screen-menu .sl-vinyl i { inset: 18px; }
  #screen-menu .sl-song-line strong { font-size: 1.25rem; }
  #screen-menu .sl-song-line small { font-size: .74rem; }
  #screen-menu .sl-song-change { display: none; }
  #screen-menu .sl-difficulty { grid-template-columns: 1fr; gap: 8px; }
  #screen-menu .sl-difficulty-option { min-height: 76px; padding: 11px 12px; }
  #screen-menu .sl-difficulty-option b { font-size: 1.15rem; }
  #screen-menu .sl-difficulty-option span { font-size: .74rem; }
  #screen-menu .sl-difficulty-option i { width: 30px; height: 30px; }
  #screen-menu .sl-difficulty-copy { margin: 12px 0 16px; font-size: .78rem; }
  #screen-menu .sl-start { min-height: 72px; }
  #screen-menu .sl-start span { font-size: 1.2rem; }
  #screen-menu .sl-start small { font-size: .7rem; }

  #screen-menu .sl-song-dialog-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: max(16px, env(safe-area-inset-top)) 14px 14px;
  }

  #screen-menu .sl-dialog-heading p { margin-bottom: 5px; font-size: .84rem; }
  #screen-menu .sl-dialog-heading h2 { font-size: 1.8rem; }
  #screen-menu .sl-dialog-heading small { margin-top: 6px; font-size: .72rem; }
  #screen-menu .sl-song-dialog-current { grid-column: 1 / -1; grid-row: 2; padding: 12px 14px; }
  #screen-menu .sl-song-dialog-current strong { font-size: 1.3rem; }
  #screen-menu .sl-song-dialog-current small { font-size: .68rem; }
  #screen-menu .sl-song-dialog-head > button { width: 48px; height: 48px; flex-basis: 48px; font-size: 1.6rem; }
  #screen-menu .sl-song-categories { gap: 6px; padding: 8px 12px; overflow-x: auto; }
  #screen-menu .sl-song-categories button { flex: 0 0 auto; min-width: 82px; min-height: 42px; font-size: .82rem; }
  #screen-menu .sl-song-list { grid-template-columns: 1fr; gap: 10px; padding: 14px 12px 66px; }
  #screen-menu .sl-song-card { min-height: 154px; padding: 19px 18px; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 11px; }
  #screen-menu .sl-song-card.is-wheel-active,
  #screen-menu .sl-song-card.is-selected { min-height: 154px; padding: 19px 18px; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 11px; }
  #screen-menu .sl-song-number { font-size: 2.25rem; }
  #screen-menu .sl-song-card-copy strong { font-size: 1.28rem; }
  #screen-menu .sl-song-card-copy small { font-size: .82rem; }
  #screen-menu .sl-song-card-details { font-size: .7rem; }
  #screen-menu .sl-song-record { min-width: 56px; font-size: .6rem; }
  #screen-menu .sl-song-record b { font-size: .78rem; }
  #screen-menu .sl-song-card-category { right: 17px; bottom: 12px; font-size: .62rem; }
  #screen-menu .sl-song-counter { right: 12px; bottom: 16px; font-size: .7rem; }
  #screen-menu .sl-song-dialog-foot { padding: 11px 14px max(14px, env(safe-area-inset-bottom)); font-size: .72rem; }

  #screen-result { padding-inline: 14px; }
  #screen-result .result-card { padding: 24px 16px; border-width: 3px; border-radius: 20px; box-shadow: 8px 9px 0 rgba(8, 28, 27, .62); }
  #screen-result .result-title { font-size: 2rem; }
  #screen-result .result-grade { font-size: 4rem; }
  #screen-result .result-stats { gap: 7px; }
  #screen-result .result-stats div { padding: 8px 4px; }
  #screen-result .result-stats span { font-size: .64rem; }
  #screen-result .result-stats b { font-size: .9rem; }
  #screen-result .result-actions button { min-height: 62px; font-size: .92rem; }
}

/* ═══════════ TITLE SCREEN / COMBO HUD PASS ═══════════
   入口只保留一個主動作與大型視覺；舞台區不再放置會遮住 Ring 的 combo 浮字。 */
#screen-title {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100dvh;
  color: var(--mr-paper);
  background:
    radial-gradient(48vw 62vh at 78% 42%, rgba(242, 201, 91, .2), transparent 68%),
    radial-gradient(36vw 50vh at 8% 94%, rgba(199, 84, 72, .22), transparent 72%),
    linear-gradient(118deg, #07181d 0%, #0c2b31 43%, #1c2535 100%);
}

#screen-title::before {
  content: "";
  position: absolute;
  inset: -18%;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(112deg, transparent 0 38%, rgba(242, 201, 91, .1) 38.2% 38.7%, transparent 39% 100%),
    linear-gradient(112deg, transparent 0 61%, rgba(101, 184, 170, .08) 61.2% 61.6%, transparent 62% 100%);
  transform: rotate(-7deg);
  animation: title-sweep 11s ease-in-out infinite;
}

#screen-title::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 246, 220, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 246, 220, .06) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, transparent, #000 42%);
  opacity: .56;
}

#screen-title .title-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1920px);
  min-height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) clamp(22px, 6vw, 110px) max(28px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

#screen-title .title-hero {
  width: 100%;
  min-width: 0;
  min-height: calc(100dvh - 56px);
  display: grid;
  justify-self: stretch;
  grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr);
  align-items: center;
  gap: clamp(30px, 6vw, 110px);
}

#screen-title .title-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: start;
}

#screen-title .title-topbar,
#screen-title .title-kicker,
#screen-title .title-tagline,
#screen-title .title-ritual,
#screen-title .title-hint,
#screen-title .title-footer small,
#screen-title .copyright,
#screen-title .logo-sub {
  display: none !important;
}

#screen-title .title-logo-wrap {
  position: relative;
  margin: 0;
  text-align: left;
}

#screen-title .title-mark {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 28px;
  margin: 0 0 24px 7px;
}

#screen-title .title-mark i {
  display: block;
  width: 10px;
  height: 18px;
  border-radius: 999px;
  background: var(--mr-yellow);
  box-shadow: 0 0 18px rgba(242, 201, 91, .82);
  transform-origin: bottom;
  animation: title-mark-beat 1.25s ease-in-out infinite;
}

#screen-title .title-mark i:nth-child(2) {
  height: 28px;
  background: var(--mr-coral);
  box-shadow: 0 0 18px rgba(199, 84, 72, .8);
  animation-delay: -.42s;
}

#screen-title .title-mark i:nth-child(3) {
  height: 21px;
  background: var(--mr-cyan);
  box-shadow: 0 0 18px rgba(101, 184, 170, .82);
  animation-delay: -.78s;
}

#screen-title .title-logo {
  display: flex;
  flex-direction: column;
  max-width: none;
  color: var(--mr-paper);
  background: none;
  -webkit-text-fill-color: var(--mr-paper);
  font-size: clamp(4.2rem, 9.2vw, 9.4rem);
  line-height: .82;
  letter-spacing: -.055em;
  text-shadow: 0 8px 0 rgba(4, 17, 21, .56), 0 0 38px rgba(242, 201, 91, .16);
  transform: skew(-5deg);
}

#screen-title .title-logo span:first-child {
  color: var(--mr-yellow);
  -webkit-text-fill-color: var(--mr-yellow);
}

#screen-title .title-logo span:last-child {
  margin-left: clamp(18px, 3vw, 46px);
}

#screen-title .title-main {
  width: min(100%, 620px);
  margin-top: clamp(42px, 7vh, 86px);
  justify-self: start;
  align-items: stretch;
}

#screen-title .btn-primary {
  position: relative;
  width: 100%;
  min-height: clamp(88px, 11vh, 124px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 3vw, 42px);
  color: var(--mr-paper);
  background: linear-gradient(105deg, var(--mr-coral), #c74e50 55%, #8c3941);
  border: 3px solid var(--mr-paper);
  border-radius: 12px;
  box-shadow: 0 9px 0 rgba(4, 17, 21, .78), 0 0 32px rgba(199, 84, 72, .34);
  font-size: clamp(1.8rem, 3vw, 3.2rem);
  letter-spacing: .08em;
  text-align: left;
  overflow: hidden;
}

#screen-title .btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0 35%, rgba(255, 246, 220, .22) 48%, transparent 62%);
  transform: translateX(-120%);
  animation: title-button-sheen 4.2s ease-in-out infinite;
}

#screen-title .btn-primary span,
#screen-title .btn-primary i {
  position: relative;
  z-index: 1;
}

#screen-title .btn-primary i {
  font-style: normal;
  font-size: 1.28em;
  line-height: 1;
  transform: translateY(-2px);
}

#screen-title .title-footer {
  width: min(100%, 620px);
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  justify-self: start;
}

#screen-title .btn-ghost {
  width: 100%;
  min-height: 72px;
  color: rgba(255, 246, 220, .9);
  background: rgba(4, 17, 21, .46);
  border: 2px solid rgba(255, 246, 220, .34);
  border-radius: 10px;
  font-size: clamp(1.05rem, 1.7vw, 1.5rem);
  letter-spacing: .08em;
}

#screen-title .btn-ghost:hover,
#screen-title .btn-ghost:focus-visible {
  color: var(--mr-ink);
  background: var(--mr-yellow);
  border-color: var(--mr-paper);
  box-shadow: 0 5px 0 rgba(4, 17, 21, .62);
  transform: translateY(-3px);
}

#screen-title .title-preview {
  position: relative;
  width: min(100%, 78dvh, 780px);
  aspect-ratio: 1;
  min-height: 0;
  justify-self: end;
  overflow: visible;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 48%, rgba(242, 201, 91, .16), transparent 23%),
    radial-gradient(circle at 50% 50%, rgba(101, 184, 170, .13), transparent 58%);
  box-shadow: none;
}

#screen-title .title-preview::before {
  content: "";
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(255, 246, 220, .26);
  border-radius: 50%;
  box-shadow:
    0 0 0 24px rgba(101, 184, 170, .035),
    0 0 0 58px rgba(242, 201, 91, .025);
  animation: title-orbit-pulse 4.8s ease-in-out infinite;
}

#screen-title .title-preview::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 14%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--mr-yellow) 22%, var(--mr-coral) 50%, var(--mr-cyan) 78%, transparent);
  box-shadow: 0 0 18px rgba(242, 201, 91, .72);
  opacity: .9;
}

#screen-title .title-preview-grid {
  position: absolute;
  inset: 0;
  border: 0;
  background:
    linear-gradient(rgba(255, 246, 220, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 246, 220, .08) 1px, transparent 1px);
  background-size: 12.5% 12.5%;
  mask-image: radial-gradient(circle at center, #000 0 58%, transparent 82%);
  transform: perspective(900px) rotateX(58deg) rotateZ(-8deg) scale(1.14);
  transform-origin: center 62%;
}

#screen-title .title-preview-grid::before,
#screen-title .title-preview-grid::after {
  display: block;
  background: rgba(255, 246, 220, .2);
}

#screen-title .title-ring {
  width: clamp(88px, 12vw, 156px);
  border: 3px solid var(--mr-yellow);
  box-shadow: 0 0 34px rgba(242, 201, 91, .7), inset 0 0 18px rgba(242, 201, 91, .26);
}

#screen-title .title-ring::after {
  inset: 16px;
  border-color: rgba(255, 246, 220, .82);
}

#screen-title .title-ring-a { left: 13%; top: 21%; }
#screen-title .title-ring-b {
  right: 13%;
  top: 40%;
  width: clamp(70px, 9vw, 124px);
  border-color: var(--mr-cyan);
  box-shadow: 0 0 30px rgba(101, 184, 170, .68), inset 0 0 16px rgba(101, 184, 170, .22);
}
#screen-title .title-ring-c {
  left: 42%;
  bottom: 18%;
  width: clamp(58px, 7vw, 96px);
  border-color: var(--mr-coral);
  box-shadow: 0 0 28px rgba(199, 84, 72, .68), inset 0 0 14px rgba(199, 84, 72, .2);
}

#screen-title .title-route {
  left: 18%;
  top: 43%;
  width: 65%;
  border-top: 3px solid var(--mr-yellow);
  filter: drop-shadow(0 0 9px rgba(242, 201, 91, .82));
  opacity: .9;
}

#screen-title .title-cursor {
  left: 49%;
  top: 39%;
  width: 20px;
  height: 20px;
  background: var(--mr-paper);
  border: 3px solid var(--mr-paper);
  box-shadow: 0 0 0 12px rgba(255, 246, 220, .12), 0 0 34px var(--mr-paper);
}

#screen-title .title-streak {
  position: absolute;
  height: 3px;
  transform-origin: left center;
  background: linear-gradient(90deg, transparent, var(--mr-coral), transparent);
  filter: drop-shadow(0 0 8px rgba(199, 84, 72, .74));
  opacity: .74;
  animation: title-streak-drift 3.6s ease-in-out infinite;
}

#screen-title .title-streak-a { left: 8%; top: 30%; width: 28%; transform: rotate(-20deg); }
#screen-title .title-streak-b { right: 8%; top: 26%; width: 24%; transform: rotate(24deg); background: linear-gradient(90deg, transparent, var(--mr-cyan), transparent); animation-delay: -1.1s; }
#screen-title .title-streak-c { left: 56%; bottom: 30%; width: 22%; transform: rotate(-32deg); background: linear-gradient(90deg, transparent, var(--mr-yellow), transparent); animation-delay: -2.2s; }

#screen-title .title-preview-band {
  left: 5%;
  right: 5%;
  bottom: 7%;
  height: 39%;
  border-bottom: 3px solid rgba(255, 246, 220, .62);
  opacity: .92;
}

#screen-title .title-preview-band img {
  filter: drop-shadow(0 12px 7px rgba(4, 17, 21, .58));
}

/* Combo 只在固定 HUD 顯示，舞台中央保持乾淨，避免遮住下一顆 Ring。 */
#screen-game .combo-center { display: none !important; }
#screen-game #hud-combo-panel {
  --combo-progress: 0%;
  position: relative;
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  column-gap: 9px;
  min-width: 132px;
  padding: 8px 12px 13px;
  color: rgba(255, 246, 220, .72);
  background: rgba(4, 17, 21, .46);
  border: 2px solid rgba(242, 201, 91, .34);
  border-radius: 9px;
  box-shadow: inset 0 0 20px rgba(242, 201, 91, .05);
}

#screen-game #hud-combo-panel::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mr-yellow) 0 var(--combo-progress), rgba(255, 246, 220, .14) var(--combo-progress) 100%);
  box-shadow: 0 0 10px rgba(242, 201, 91, .38);
}

#screen-game #hud-combo-panel > span {
  color: rgba(255, 246, 220, .58);
  font-size: .7em;
  letter-spacing: .1em;
}

#screen-game #hud-combo-panel > b {
  color: var(--mr-yellow);
  font-size: clamp(1.25rem, 2vw, 2rem);
  line-height: 1;
  text-shadow: 0 0 16px rgba(242, 201, 91, .56);
}

#screen-game #hud-combo-panel[data-tier="cyan"] { border-color: rgba(101, 184, 170, .62); }
#screen-game #hud-combo-panel[data-tier="cyan"]::before {
  background: linear-gradient(90deg, var(--mr-cyan) 0 var(--combo-progress), rgba(255, 246, 220, .14) var(--combo-progress) 100%);
}
#screen-game #hud-combo-panel[data-tier="cyan"] > b { color: var(--mr-cyan); text-shadow: 0 0 16px rgba(101, 184, 170, .56); }
#screen-game #hud-combo-panel[data-tier="violet"] { border-color: rgba(154, 135, 225, .7); }
#screen-game #hud-combo-panel[data-tier="violet"]::before {
  background: linear-gradient(90deg, #9a87e1 0 var(--combo-progress), rgba(255, 246, 220, .14) var(--combo-progress) 100%);
}
#screen-game #hud-combo-panel[data-tier="violet"] > b { color: #b6a8ff; text-shadow: 0 0 16px rgba(154, 135, 225, .58); }
#screen-game #hud-combo-panel[data-tier="gold"] { border-color: rgba(242, 201, 91, .9); box-shadow: inset 0 0 22px rgba(242, 201, 91, .1), 0 0 18px rgba(242, 201, 91, .16); }

@keyframes title-sweep {
  0%, 100% { transform: translate3d(-2%, 0, 0) rotate(-7deg); opacity: .68; }
  50% { transform: translate3d(4%, -2%, 0) rotate(-4deg); opacity: 1; }
}

@keyframes title-mark-beat {
  0%, 100% { transform: scaleY(.72); opacity: .66; }
  50% { transform: scaleY(1.12); opacity: 1; }
}

@keyframes title-button-sheen {
  0%, 54%, 100% { transform: translateX(-120%); }
  72% { transform: translateX(120%); }
}

@keyframes title-orbit-pulse {
  0%, 100% { transform: scale(.96) rotate(-4deg); opacity: .62; }
  50% { transform: scale(1.03) rotate(3deg); opacity: 1; }
}

@keyframes title-streak-drift {
  0%, 100% { opacity: .18; transform: translate3d(-12px, 8px, 0) rotate(-20deg) scaleX(.72); }
  50% { opacity: .9; transform: translate3d(12px, -8px, 0) rotate(-20deg) scaleX(1.08); }
}

@media (max-width: 900px) {
  #screen-title .title-hero {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 26px;
  }

  #screen-title .title-copy,
  #screen-title .title-logo-wrap,
  #screen-title .title-main,
  #screen-title .title-footer {
    justify-self: center;
  }

  #screen-title .title-copy {
    width: min(100%, 760px);
    justify-items: center;
  }

  #screen-title .title-logo-wrap { text-align: center; }
  #screen-title .title-mark { margin-left: 0; }
  #screen-title .title-main,
  #screen-title .title-footer { width: min(100%, 680px); }
  #screen-title .title-preview {
    width: min(100%, 620px, 48dvh);
    justify-self: center;
  }
}

@media (max-width: 600px) {
  #screen-title .title-shell {
    padding: max(22px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
  }

  #screen-title .title-hero {
    gap: 14px;
  }

  #screen-title .title-mark {
    height: 22px;
    gap: 6px;
    margin-bottom: 18px;
  }

  #screen-title .title-mark i { width: 8px; height: 14px; }
  #screen-title .title-mark i:nth-child(2) { height: 22px; }
  #screen-title .title-mark i:nth-child(3) { height: 17px; }

  #screen-title .title-logo {
    font-size: clamp(3.35rem, 16vw, 5.4rem);
    line-height: .84;
  }

  #screen-title .title-logo span:last-child { margin-left: 12px; }

  #screen-title .title-main {
    margin-top: 32px;
  }

  #screen-title .btn-primary {
    min-height: 78px;
    padding-inline: 20px;
    border-width: 2px;
    box-shadow: 0 6px 0 rgba(4, 17, 21, .78), 0 0 24px rgba(199, 84, 72, .3);
    font-size: clamp(1.45rem, 7vw, 2.2rem);
  }

  #screen-title .title-footer {
    gap: 7px;
    margin-top: 12px;
  }

  #screen-title .btn-ghost {
    min-height: 58px;
    padding-inline: 4px;
    border-width: 1px;
    font-size: .98rem;
  }

  #screen-title .title-preview {
    width: min(100%, 410px);
    max-height: 36dvh;
    aspect-ratio: 1.12;
  }

  #screen-title .title-preview-grid {
    transform: perspective(700px) rotateX(58deg) rotateZ(-8deg) scale(1.08);
  }

  #screen-title .title-ring {
    width: clamp(64px, 20vw, 92px);
    border-width: 2px;
  }

  #screen-title .title-ring-b { width: clamp(52px, 16vw, 74px); }
  #screen-title .title-ring-c { width: clamp(44px, 13vw, 62px); }
  #screen-title .title-cursor { width: 14px; height: 14px; border-width: 2px; }
  #screen-title .title-preview-band { height: 42%; }

  #screen-game #hud-combo-panel {
    min-width: 96px;
    padding: 6px 8px 11px;
    column-gap: 5px;
  }

  #screen-game #hud-combo-panel > span { font-size: .62em; }
  #screen-game #hud-combo-panel > b { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  #screen-title::before,
  #screen-title .title-mark i,
  #screen-title .btn-primary::before,
  #screen-title .title-preview::before,
  #screen-title .title-cursor,
  #screen-title .title-ring,
  #screen-title .title-streak {
    animation: none;
  }
}

/* ═══════════ HUD / RESULT READABILITY PASS ═══════════
   Combo stays in its own HUD column; CLEAR and FAILED are full-screen result moments. */
#screen-game .game-hud {
  grid-template-columns: minmax(0, 1fr) auto auto minmax(150px, auto) minmax(180px, auto) minmax(118px, auto) auto;
  grid-template-areas: "song score ok accuracy life combo pause";
  column-gap: clamp(12px, 1.6vw, 24px);
}

#screen-game .hud-ok {
  grid-area: ok;
  position: relative;
  z-index: 2;
  white-space: nowrap;
}

#screen-game #hud-combo-panel {
  grid-area: combo;
  inset: auto;
  justify-self: end;
  min-width: 118px;
  padding: 7px 10px 12px;
  column-gap: 7px;
  font-size: 1rem;
  white-space: nowrap;
}

#screen-game #hud-combo-panel > b {
  font-size: clamp(1.2rem, 1.65vw, 1.7rem);
}

#screen-result {
  min-height: 100dvh;
  max-width: none;
  padding: clamp(18px, 4vh, 52px) clamp(16px, 5vw, 96px);
  align-items: center;
  justify-content: center;
}

#screen-result .result-card {
  position: relative;
  width: min(100%, 1400px);
  min-height: min(88dvh, 900px);
  padding: clamp(30px, 5vw, 78px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.5vh, 18px);
  border-width: 4px;
  border-radius: 32px;
  overflow: hidden;
}

#screen-result .result-title {
  margin: 0;
  color: var(--mr-coral-dark);
  font-size: clamp(3rem, 6vw, 6rem);
  line-height: .95;
  letter-spacing: .04em;
}

#screen-result .result-songline {
  gap: 8px;
  margin: 12px 0 0;
}

#screen-result .result-songline b {
  font-size: clamp(1.6rem, 3.2vw, 3.4rem);
  line-height: 1.05;
}

#screen-result .result-songline span {
  font-size: clamp(1rem, 1.5vw, 1.45rem);
}

#screen-result .result-grade {
  margin: clamp(12px, 2vh, 22px) 0 0;
  font-size: clamp(7rem, 13vw, 12rem);
  line-height: .72;
}

#screen-result .result-score {
  font-size: clamp(1.15rem, 1.8vw, 1.85rem);
}

#screen-result .result-score b {
  font-size: clamp(2.1rem, 3.5vw, 3.8rem);
}

#screen-result .result-stats {
  width: min(100%, 1080px);
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: clamp(18px, 3vh, 32px) 0 0;
}

#screen-result .result-stats div {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 9px;
  padding: 16px 10px;
  border-radius: 16px;
}

#screen-result .result-stats span {
  font-size: clamp(.85rem, 1.15vw, 1.15rem);
}

#screen-result .result-stats b {
  font-size: clamp(1.35rem, 2.1vw, 2.25rem);
}

#screen-result .result-actions {
  width: min(100%, 760px);
  gap: 16px;
  margin-top: clamp(18px, 3vh, 32px);
}

#screen-result .result-actions button {
  min-height: 82px;
  border-width: 3px;
  border-radius: 14px;
  font-size: clamp(1.15rem, 1.7vw, 1.65rem);
}

#screen-result[data-state="failed"] {
  background:
    radial-gradient(720px 560px at 50% 0%, rgba(199, 84, 72, .28), transparent 70%),
    linear-gradient(145deg, #27171d, #111b28 68%, #0b131d);
}

#screen-result[data-state="failed"] .result-card {
  border-color: rgba(239, 114, 95, .74);
  box-shadow: 0 0 0 4px rgba(239, 114, 95, .12), 16px 18px 0 rgba(4, 17, 21, .58), 0 30px 80px rgba(0, 0, 0, .36);
}

#screen-result[data-state="failed"] .result-title,
#screen-result[data-state="failed"] .result-grade {
  color: #ff8d7a;
}

#screen-result[data-state="failed"] .result-grade {
  text-shadow: 0 0 34px rgba(239, 114, 95, .48), 0 7px 0 rgba(92, 32, 39, .4);
}

@media (max-width: 900px) {
  #screen-game .game-hud {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "song song pause"
      "score ok combo"
      "accuracy life life";
  }

  #screen-game #hud-combo-panel {
    min-width: 96px;
    justify-self: end;
  }

  #screen-result .result-card {
    min-height: calc(100dvh - 36px);
    padding: 34px clamp(22px, 5vw, 56px);
  }

  #screen-result .result-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  #screen-game .game-hud {
    grid-template-areas:
      "song song pause"
      "score ok combo"
      "accuracy life life";
  }

  #screen-game #hud-combo-panel {
    min-width: 88px;
    padding: 5px 7px 10px;
    column-gap: 4px;
    font-size: .9rem;
  }

  #screen-game #hud-combo-panel > span {
    font-size: .6em;
  }

  #screen-game #hud-combo-panel > b {
    font-size: 1.08rem;
  }

  #screen-result {
    padding: 14px;
  }

  #screen-result .result-card {
    min-height: calc(100dvh - 28px);
    padding: 30px 14px 24px;
    border-width: 3px;
    border-radius: 24px;
  }

  #screen-result .result-title {
    font-size: clamp(2.4rem, 11vw, 3.5rem);
  }

  #screen-result .result-songline {
    margin-top: 8px;
  }

  #screen-result .result-songline b {
    font-size: clamp(1.35rem, 6.4vw, 2rem);
  }

  #screen-result .result-songline span {
    font-size: .9rem;
  }

  #screen-result .result-grade {
    margin-top: 18px;
    font-size: clamp(6.5rem, 27vw, 9rem);
  }

  #screen-result .result-score {
    font-size: 1rem;
  }

  #screen-result .result-score b {
    font-size: 1.8rem;
  }

  #screen-result .result-stats {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 20px;
  }

  #screen-result .result-stats div {
    min-height: 74px;
    gap: 5px;
    padding: 10px 6px;
    border-radius: 12px;
  }

  #screen-result .result-stats span {
    font-size: .74rem;
  }

  #screen-result .result-stats b {
    font-size: 1.28rem;
  }

  #screen-result .result-actions {
    width: 100%;
    gap: 8px;
    margin-top: 18px;
  }

  #screen-result .result-actions button {
    min-height: 64px;
    border-width: 2px;
    border-radius: 12px;
    font-size: 1.08rem;
  }
}

/* 桌面選歌卡片加大，讓歌曲資訊有更寬的單行閱讀空間。 */
@media (min-width: 901px) {
  #screen-menu .sl-song-list {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 22px;
    padding: 34px clamp(28px, 6vw, 112px) 92px;
  }

  #screen-menu .sl-song-card,
  #screen-menu .sl-song-card.is-wheel-active,
  #screen-menu .sl-song-card.is-selected {
    min-height: 208px;
    padding: 26px 28px;
    grid-template-columns: 78px minmax(0, 1fr) auto;
    gap: 20px;
  }

  #screen-menu .sl-song-number {
    font-size: clamp(2.4rem, 3.4vw, 3.4rem);
  }

  #screen-menu .sl-song-card-copy strong,
  #screen-menu .sl-song-card.is-wheel-active .sl-song-card-copy strong,
  #screen-menu .sl-song-card.is-selected .sl-song-card-copy strong {
    font-size: clamp(1.4rem, 2vw, 2rem);
    line-height: 1.15;
  }

  #screen-menu .sl-song-card-copy small {
    font-size: 1rem;
    line-height: 1.4;
  }

  #screen-menu .sl-song-card-details {
    font-size: .84rem;
    line-height: 1.5;
  }

  #screen-menu .sl-song-record {
    min-width: 82px;
    font-size: .76rem;
  }

  #screen-menu .sl-song-record b {
    font-size: 1rem;
  }

  #screen-menu .sl-current-badge {
    top: 18px;
    right: 22px;
    padding: 6px 10px;
    font-size: .68rem;
  }

  #screen-menu .sl-song-card-category {
    right: 24px;
    bottom: 18px;
    font-size: .74rem;
  }
}

/* 短手機 viewport 仍須讓開始演出保持在可視與可觸控範圍。 */
@media (max-width: 600px) and (max-height: 740px) {
  #screen-menu {
    overflow-y: auto;
  }

  #screen-menu .songselect-shell {
    gap: 8px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  #screen-menu .songselect-top {
    min-height: 46px;
    padding: 2px 2px 8px;
  }

  #screen-menu .btn-round {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }

  #screen-menu .songselect-title {
    font-size: 1.25rem;
  }

  #screen-menu .mr-menu-copy {
    padding: 12px 12px 14px;
  }

  #screen-menu .sl-flow-label {
    margin-bottom: 8px;
    font-size: 1rem;
  }

  #screen-menu .sl-song-line {
    min-height: 76px;
    margin-bottom: 4px;
    padding: 10px 12px;
    gap: 10px;
  }

  #screen-menu .sl-vinyl {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  #screen-menu .sl-vinyl i {
    inset: 16px;
  }

  #screen-menu .sl-song-line strong {
    font-size: 1.08rem;
  }

  #screen-menu .sl-song-line small {
    margin-top: 4px;
    font-size: .68rem;
  }

  #screen-menu .sl-difficulty {
    gap: 6px;
  }

  #screen-menu .sl-difficulty-option {
    min-height: 64px;
    padding: 8px 10px;
  }

  #screen-menu .sl-difficulty-option b {
    font-size: 1rem;
  }

  #screen-menu .sl-difficulty-option span {
    font-size: .68rem;
  }

  #screen-menu .sl-difficulty-option i {
    width: 28px;
    height: 28px;
  }

  #screen-menu .sl-difficulty-copy {
    margin: 8px 0 10px;
    font-size: .7rem;
    line-height: 1.3;
  }

  #screen-menu .sl-start {
    min-height: 64px;
    padding: 12px 16px;
  }

  #screen-menu .sl-start span {
    font-size: 1.1rem;
  }

  #screen-menu .sl-start small {
    font-size: .64rem;
  }
}

/* ── Mobile screen safety pass ──
   Keep every secondary screen reachable on short phones without shrinking
   the large console typography into desktop-style helper text. */
@media (max-width: 900px) {
  #screen-title,
  #screen-result,
  #screen-tutorial,
  #screen-settings,
  #screen-tools {
    height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
  }

  #screen-game .game-overlay {
    overflow: auto;
    padding: 16px;
  }

  #screen-game #game-overlay .overlay-card {
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
  }
}

@media (max-width: 600px) {
  /* The five filters fit on one row so no category is hidden behind a
     horizontal scroll edge on touch screens. */
  #screen-menu .sl-song-categories {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    padding: 8px 10px;
  }

  #screen-menu .sl-song-categories button {
    min-width: 0;
    min-height: 44px;
    padding: 6px 2px;
    font-size: .72rem;
    white-space: nowrap;
  }

  /* Result cards must scroll rather than clip the two primary actions. */
  #screen-result {
    align-items: stretch;
    justify-content: flex-start;
    padding: max(10px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  }

  #screen-result .result-card {
    width: 100%;
    min-height: 0;
    height: auto;
    margin: 0 auto;
    overflow: visible;
    justify-content: flex-start;
    padding: 24px 14px 20px;
  }

  #screen-result .result-actions {
    flex: 0 0 auto;
    padding-bottom: max(2px, env(safe-area-inset-bottom));
  }

  /* Settings is a long form: keep the return action fixed and reserve
     enough content space so the last control is never covered. */
  #screen-settings {
    min-height: 0;
    align-items: stretch;
    padding: 0;
  }

  #screen-settings .settings-card {
    width: 100%;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: max(24px, env(safe-area-inset-top)) 16px 112px;
    border-radius: 20px;
  }

  #screen-settings .result-actions {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 10;
    width: auto;
    margin: 0;
    padding: 10px;
    background: linear-gradient(180deg, rgba(8, 28, 27, 0), rgba(8, 28, 27, .94) 34%);
  }

  #screen-settings .result-actions button {
    min-height: 58px;
    font-size: 1.05rem;
  }
}

@media (max-width: 600px) and (max-height: 740px) {
  /* A short phone can show the complete result without sacrificing legible
     grades and statistics; taller phones keep the larger spacing above. */
  #screen-result .result-card {
    padding: 18px 12px 14px;
    gap: 4px;
    border-radius: 20px;
  }

  #screen-result .result-title {
    font-size: clamp(2rem, 9vw, 2.8rem);
  }

  #screen-result .result-songline {
    gap: 4px;
    margin-top: 4px;
  }

  #screen-result .result-songline b {
    font-size: clamp(1.2rem, 5.5vw, 1.8rem);
  }

  #screen-result .result-songline span {
    font-size: .8rem;
  }

  #screen-result .result-grade {
    margin-top: 8px;
    font-size: clamp(5.25rem, 22vw, 7rem);
  }

  #screen-result .result-score {
    font-size: .92rem;
  }

  #screen-result .result-score b {
    font-size: 1.55rem;
  }

  #screen-result .result-stats {
    gap: 6px;
    margin-top: 12px;
  }

  #screen-result .result-stats div {
    min-height: 62px;
    gap: 4px;
    padding: 8px 4px;
  }

  #screen-result .result-stats span {
    font-size: .68rem;
  }

  #screen-result .result-stats b {
    font-size: 1.12rem;
  }

  #screen-result .result-actions {
    gap: 8px;
    margin-top: 12px;
  }

  #screen-result .result-actions button {
    min-height: 56px;
    font-size: 1rem;
  }
}

/* Final song-wheel contract: one centered card at a time on every viewport. */
#screen-menu .sl-song-wheel-shell {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

#screen-menu .sl-song-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 10px;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding-block: 0;
  padding-inline: clamp(18px, 7vw, 84px);
  overflow-y: auto;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
}

#screen-menu .sl-song-list::-webkit-scrollbar { display: none; }

#screen-menu .sl-song-list::before,
#screen-menu .sl-song-list::after {
  content: "";
  display: block;
  height: var(--sl-song-wheel-cap, 0px);
  pointer-events: none;
}

#screen-menu .sl-song-card,
#screen-menu .sl-song-card.is-wheel-active,
#screen-menu .sl-song-card.is-selected {
  min-height: 98px;
  padding: 14px 18px;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  opacity: .46;
  transform: scale(.92);
  filter: none;
  scroll-snap-align: center;
  transition: transform .22s cubic-bezier(.16, 1, .3, 1), opacity .18s ease-out, background .18s ease-out, border-color .18s ease-out, box-shadow .18s ease-out;
}

#screen-menu .sl-song-card.is-wheel-near {
  opacity: .72;
  transform: scale(.97);
}

#screen-menu .sl-song-card.is-wheel-active,
#screen-menu .sl-song-card.is-selected {
  min-height: 132px;
  opacity: 1;
  transform: scale(1.035);
}

#screen-menu .sl-song-step {
  display: flex;
}

@media (max-width: 600px) {
  #screen-menu .sl-song-list {
    gap: 8px;
    padding-inline: 18px;
  }

  #screen-menu .sl-song-card,
  #screen-menu .sl-song-card.is-wheel-active,
  #screen-menu .sl-song-card.is-selected {
    min-height: 82px;
    padding: 12px 14px;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 10px;
  }

  #screen-menu .sl-song-card.is-wheel-active,
  #screen-menu .sl-song-card.is-selected {
    min-height: 112px;
  }
}

/* ═══════════ FINAL MULTI-SCREEN RELEASE CONTRACT ═══════════
   Keep each public scene inside the live visual viewport. Long secondary
   panels may scroll internally, while title/menu remain fixed like a console
   front end and never clip their primary action or legal notice. */
:root {
  --mr-live-width: var(--app-width, 100vw);
  --mr-live-height: var(--app-height, 100dvh);
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

.screen {
  width: var(--mr-live-width);
  height: var(--mr-live-height);
  min-height: 0;
  max-height: var(--mr-live-height);
}

.mr-copyright {
  color: rgba(255, 246, 220, .72);
  font: 800 clamp(.72rem, .9vw, .95rem)/1.35 var(--font-mono);
  letter-spacing: .04em;
  text-align: center;
}

#screen-title .mr-title-copyright {
  width: min(100%, 620px);
  margin: 14px 0 0;
  justify-self: start;
}

#screen-menu .mr-menu-copyright {
  width: 100%;
  margin: 12px 0 0;
  color: #62566e;
}

#screen-tools .mr-tools-copyright,
#screen-result .mr-result-copyright,
.mr-card-copyright {
  margin: 18px auto 0;
}

#screen-title,
#screen-menu,
#screen-tools,
#screen-game,
#screen-result,
#screen-tutorial,
#screen-settings {
  max-width: none;
}

#screen-title,
#screen-menu {
  overflow: hidden;
}

#screen-title .title-copy {
  min-width: 0;
}

#screen-menu .songselect-shell {
  height: var(--mr-live-height);
  min-height: 0;
}

#screen-menu .mr-menu-copy {
  min-width: 0;
}

#screen-tools .tools-shell {
  min-height: 0;
}

@media (min-width: 901px) {
  #screen-title .mr-title-copyright {
    text-align: left;
  }

  #screen-menu .mr-menu-copyright {
    text-align: left;
  }

  #screen-tools .mr-tools-copyright {
    text-align: left;
  }

  #screen-result .mr-result-copyright,
  .mr-card-copyright {
    font-size: .82rem;
  }
}

@media (max-width: 900px) {
  #screen-title,
  #screen-menu {
    height: var(--mr-live-height);
    min-height: 0;
    max-height: var(--mr-live-height);
  }

  #screen-title .title-shell {
    height: 100%;
    min-height: 0;
    padding: max(10px, env(safe-area-inset-top)) 14px max(8px, env(safe-area-inset-bottom));
    display: flex;
    align-items: stretch;
    justify-content: stretch;
  }

  #screen-title .title-hero {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: stretch;
    gap: 8px;
  }

  #screen-title .title-copy {
    width: min(100%, 680px);
    min-height: 0;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
  }

  #screen-title .title-logo-wrap {
    flex: 0 0 auto;
    text-align: center;
  }

  #screen-title .title-mark {
    margin-bottom: 8px;
  }

  #screen-title .title-logo {
    font-size: clamp(2.5rem, 12vw, 5rem);
    line-height: .84;
  }

  #screen-title .title-logo span:last-child {
    margin-left: 8px;
  }

  #screen-title .title-main {
    width: min(100%, 620px);
    margin-top: 10px;
  }

  #screen-title .btn-primary {
    min-height: 62px;
    padding-inline: 16px;
    font-size: clamp(1.25rem, 5.5vw, 2rem);
  }

  #screen-title .title-footer {
    width: min(100%, 620px);
    margin-top: 8px;
    gap: 6px;
  }

  #screen-title .btn-ghost {
    min-height: 46px;
    font-size: clamp(.82rem, 3.5vw, 1.1rem);
  }

  #screen-title .mr-title-copyright {
    width: 100%;
    margin-top: 7px;
    font-size: clamp(.62rem, 2.4vw, .78rem);
    line-height: 1.25;
  }

  #screen-title .title-preview {
    width: min(100%, 280px);
    height: min(22dvh, 190px);
    min-height: 110px;
    aspect-ratio: 1.35;
    justify-self: center;
    align-self: end;
  }

  #screen-title .title-preview-band {
    display: none;
  }

  #screen-menu .songselect-shell {
    height: 100%;
    min-height: 0;
    padding: max(7px, env(safe-area-inset-top)) 10px max(7px, env(safe-area-inset-bottom));
    gap: 7px;
  }

  #screen-menu .songselect-top {
    min-height: 42px;
    padding: 0 2px 3px;
    gap: 8px;
  }

  #screen-menu .btn-round {
    width: 42px;
    height: 42px;
    min-height: 42px;
  }

  #screen-menu .songselect-kicker {
    font-size: .62rem;
  }

  #screen-menu .songselect-title {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
  }

  #screen-menu .songselect-status,
  #screen-menu .songselect-count {
    font-size: .62rem;
  }

  #screen-menu .mr-menu-copy {
    width: min(100%, 680px);
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
    margin: 0 auto;
    padding: 10px 11px 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-width: 2px;
    border-radius: 15px;
    box-shadow: 6px 7px 0 rgba(8, 28, 27, .5);
  }

  #screen-menu .sl-flow-label {
    flex: 0 0 auto;
    gap: 6px;
    margin: 0 0 3px;
    font-size: clamp(.78rem, 2.8vw, .98rem);
    line-height: 1;
  }

  #screen-menu .sl-flow-label + .sl-flow-label {
    margin-top: 6px;
  }

  #screen-menu .sl-flow-label span {
    width: 22px;
    height: 22px;
    font-size: .7rem;
  }

  #screen-menu .sl-song-line {
    flex: 0 0 auto;
    min-height: 54px;
    margin: 0;
    padding: 7px 9px;
    gap: 8px;
  }

  #screen-menu .sl-vinyl {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  #screen-menu .sl-vinyl i {
    inset: 13px;
  }

  #screen-menu .sl-song-line strong {
    font-size: clamp(.98rem, 3.8vw, 1.25rem);
  }

  #screen-menu .sl-song-line small {
    font-size: clamp(.66rem, 2.7vw, .82rem);
  }

  #screen-menu .sl-difficulty {
    flex: 0 0 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    margin: 0;
  }

  #screen-menu .sl-difficulty-option {
    min-height: 49px;
    padding: 6px 7px;
    border-width: 2px;
    border-radius: 8px;
  }

  #screen-menu .sl-difficulty-option b {
    font-size: clamp(.82rem, 3.2vw, 1.05rem);
  }

  #screen-menu .sl-difficulty-option span {
    font-size: clamp(.58rem, 2.4vw, .74rem);
  }

  #screen-menu .sl-difficulty-option i {
    display: grid;
    width: 23px;
    height: 23px;
    font-size: .68rem;
  }

  #screen-menu .sl-difficulty-copy {
    flex: 0 0 auto;
    height: 2.4em;
    min-height: 0;
    margin: 4px 0;
    overflow: hidden;
    font-size: clamp(.64rem, 2.6vw, .78rem);
    line-height: 1.2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  #screen-menu .sl-start {
    flex: 0 0 auto;
    min-height: 54px;
    height: 54px;
    padding: 7px 10px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  #screen-menu .sl-start span {
    font-size: clamp(1rem, 4vw, 1.25rem);
  }

  #screen-menu .sl-start small {
    font-size: clamp(.6rem, 2.5vw, .74rem);
  }

  #screen-menu .mr-menu-copyright {
    flex: 0 0 auto;
    margin: auto 0 0;
    padding-top: 4px;
    font-size: clamp(.62rem, 2.4vw, .76rem);
    line-height: 1.2;
  }

  #screen-tools,
  #screen-result,
  #screen-tutorial,
  #screen-settings {
    height: var(--mr-live-height);
    max-height: var(--mr-live-height);
    overflow-y: auto;
    overflow-x: hidden;
  }

  #screen-tools .mr-tools-copyright,
  #screen-result .mr-result-copyright,
  .mr-card-copyright {
    font-size: clamp(.68rem, 2.5vw, .82rem);
  }
}

@media (max-width: 600px) and (max-height: 740px) {
  #screen-title .title-shell {
    padding-top: max(5px, env(safe-area-inset-top));
    padding-bottom: max(5px, env(safe-area-inset-bottom));
  }

  #screen-title .title-hero {
    gap: 4px;
  }

  #screen-title .title-mark {
    height: 18px;
    margin-bottom: 4px;
  }

  #screen-title .title-mark i {
    width: 6px;
    height: 12px;
  }

  #screen-title .title-mark i:nth-child(2) { height: 18px; }
  #screen-title .title-mark i:nth-child(3) { height: 14px; }

  #screen-title .title-logo {
    font-size: clamp(2.15rem, 11vw, 3.5rem);
  }

  #screen-title .title-main {
    margin-top: 6px;
  }

  #screen-title .btn-primary {
    min-height: 54px;
  }

  #screen-title .title-footer {
    margin-top: 5px;
  }

  #screen-title .btn-ghost {
    min-height: 40px;
  }

  #screen-title .mr-title-copyright {
    margin-top: 4px;
    font-size: .6rem;
  }

  #screen-title .title-preview {
    height: min(18dvh, 120px);
    min-height: 84px;
  }

  #screen-menu .songselect-shell {
    gap: 4px;
    padding-top: max(4px, env(safe-area-inset-top));
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }

  #screen-menu .songselect-top {
    min-height: 36px;
    padding-bottom: 1px;
  }

  #screen-menu .btn-round {
    width: 36px;
    height: 36px;
    min-height: 36px;
    font-size: 1.35rem;
  }

  #screen-menu .songselect-title {
    font-size: 1.12rem;
  }

  #screen-menu .mr-menu-copy {
    padding: 7px 8px 5px;
    border-radius: 12px;
  }

  #screen-menu .sl-flow-label {
    margin-bottom: 2px;
    font-size: .74rem;
  }

  #screen-menu .sl-flow-label + .sl-flow-label {
    margin-top: 4px;
  }

  #screen-menu .sl-flow-label span {
    width: 19px;
    height: 19px;
    font-size: .62rem;
  }

  #screen-menu .sl-song-line {
    min-height: 47px;
    padding-block: 5px;
  }

  #screen-menu .sl-vinyl {
    width: 33px;
    height: 33px;
    flex-basis: 33px;
  }

  #screen-menu .sl-vinyl i {
    inset: 11px;
  }

  #screen-menu .sl-difficulty {
    gap: 3px;
  }

  #screen-menu .sl-difficulty-option {
    min-height: 42px;
    padding: 5px 6px;
  }

  #screen-menu .sl-difficulty-option b {
    font-size: .8rem;
  }

  #screen-menu .sl-difficulty-option span {
    font-size: .56rem;
  }

  #screen-menu .sl-difficulty-option i {
    width: 20px;
    height: 20px;
    font-size: .62rem;
  }

  #screen-menu .sl-difficulty-copy {
    height: 1.2em;
    margin: 3px 0;
    -webkit-line-clamp: 1;
  }

  #screen-menu .sl-start {
    min-height: 47px;
    height: 47px;
    padding-block: 5px;
  }

  #screen-menu .sl-start span {
    font-size: .98rem;
  }

  #screen-menu .sl-start small {
    font-size: .58rem;
  }

  #screen-menu .mr-menu-copyright {
    padding-top: 2px;
    font-size: .58rem;
  }
}

/* Final mobile readability and HUD layout.
   Keep the title controls large while reserving the preview as a separate
   row, and make Pause a real grid item so it cannot cover Combo. */
@media (max-width: 600px) {
  #screen-title .title-logo {
    font-size: clamp(2.65rem, 13.5vw, 4.4rem);
    line-height: .84;
  }

  #screen-title .btn-primary {
    min-height: 64px;
    font-size: clamp(1.2rem, 5.5vw, 1.75rem);
  }

  #screen-title .mr-title-copyright {
    margin-top: 8px;
    font-size: clamp(.76rem, 3vw, .95rem);
    line-height: 1.3;
  }

  #screen-title .title-preview {
    height: min(18dvh, 132px);
    min-height: 84px;
  }

  #screen-menu .songselect-title {
    font-size: clamp(1.24rem, 5.5vw, 1.85rem);
  }

  #screen-menu .songselect-kicker,
  #screen-menu .songselect-status,
  #screen-menu .songselect-count {
    font-size: .7rem;
  }

  #screen-menu .sl-flow-label {
    font-size: clamp(.88rem, 3.2vw, 1.08rem);
  }

  #screen-menu .sl-song-line {
    min-height: 58px;
    padding-block: 7px;
  }

  #screen-menu .sl-song-line strong {
    font-size: clamp(1.05rem, 4.2vw, 1.35rem);
  }

  #screen-menu .sl-song-line small,
  #screen-menu .sl-song-change {
    font-size: clamp(.7rem, 2.9vw, .88rem);
  }

  #screen-menu .sl-difficulty-option {
    min-height: 56px;
    padding: 7px 8px;
  }

  #screen-menu .sl-difficulty-option b {
    font-size: clamp(.94rem, 3.8vw, 1.18rem);
  }

  #screen-menu .sl-difficulty-option span {
    font-size: clamp(.66rem, 2.8vw, .84rem);
  }

  #screen-menu .sl-difficulty-option i {
    width: 24px;
    height: 24px;
    font-size: .7rem;
  }

  #screen-menu .sl-difficulty-copy {
    height: 2.4em;
    margin: 5px 0;
    font-size: clamp(.7rem, 2.9vw, .86rem);
    line-height: 1.2;
  }

  #screen-menu .sl-start {
    min-height: 62px;
    height: 62px;
  }

  #screen-menu .sl-start span {
    font-size: clamp(1.12rem, 4.8vw, 1.45rem);
  }

  #screen-menu .sl-start small {
    font-size: clamp(.68rem, 2.8vw, .84rem);
  }

  #screen-menu .mr-menu-copyright {
    padding-top: 5px;
    font-size: clamp(.72rem, 2.8vw, .9rem);
    line-height: 1.25;
  }

  #screen-game .game-hud {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "song song pause"
      "score combo ok"
      "accuracy accuracy accuracy"
      "life life life";
    grid-template-rows: auto auto auto auto;
    align-items: center;
    row-gap: 6px;
    padding: 9px 10px;
  }

  #screen-game .hud-song {
    grid-area: song;
    min-height: 20px;
    padding-right: 0;
  }

  #screen-game .hud-score { grid-area: score; text-align: left; }

  #screen-game .hud-combo {
    grid-area: combo;
    position: static;
    transform: none;
    font-size: .92rem;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
  }

  #screen-game .hud-ok {
    grid-area: ok;
    padding-right: 0;
    text-align: right;
    white-space: nowrap;
  }

  #screen-game .hud-accuracy {
    grid-area: accuracy;
    text-align: left;
  }

  #screen-game .hud-life {
    grid-area: life;
    width: 100%;
    height: 14px;
    padding: 2px 6px;
  }

  #screen-game .hud-pause {
    position: static;
    grid-area: pause;
    width: 46px;
    height: 46px;
    min-height: 46px;
    justify-self: end;
    align-self: center;
  }
}

@media (max-width: 600px) {
  #screen-game #hud-combo-panel {
    position: static;
    inset: auto;
  }
}
