/* ============================================
   components.css — 按钮、滑块、面板、音符、轨道等组件样式
   ============================================ */

/* ============ 通用按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  transition: transform 0.12s var(--ease-out), box-shadow 0.2s var(--ease-out),
    background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), 0 0 18px var(--accent-glow);
  background: #23233a;
}

.btn:active {
  transform: scale(0.96);
}

.btn.primary {
  background: linear-gradient(135deg, #008bb3, #00d4ff);
  border: none;
  color: #04141c;
  font-weight: 700;
  letter-spacing: 2px;
}

.btn.primary:hover {
  box-shadow: 0 0 24px var(--accent-glow), 0 0 48px var(--accent-glow);
  background: linear-gradient(135deg, #009dcc, #2cdcff);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border-light);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.04);
}

.btn.icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
}

.btn.small {
  padding: 8px 18px;
  font-size: 13px;
}

/* ============ 图标按钮（设置/返回） ============ */
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  transition: all 0.2s var(--ease-out);
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
  transform: rotate(20deg);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============ 歌曲列表项 ============ */
.song-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
  overflow: hidden;
}

/* 左侧选中色条 */
.song-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.2s var(--ease-out);
}

.song-item:hover {
  border-color: var(--border-light);
  background: var(--bg-elevated);
  transform: translateX(4px);
}

.song-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), 0 0 20px rgba(0, 212, 255, 0.15);
}

.song-item.selected::before {
  transform: scaleY(1);
}

.song-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2a2a44, #1a1a2e);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  overflow: hidden;
}

.song-thumb svg {
  width: 26px;
  height: 26px;
}

.song-info {
  min-width: 0;
}

.song-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-artist {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-diffs {
  display: flex;
  gap: 6px;
}

/* 难度 pill */
.diff-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid;
  background: transparent;
}

/* 通用兜底：非标准难度（自定义难度）统一白色 */
.diff-pill:not(.easy):not(.normal):not(.hard):not(.extra):not(.random) {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.5);
}

.diff-pill.easy {
  color: var(--diff-easy);
  border-color: rgba(77, 255, 156, 0.5);
}

.diff-pill.normal {
  color: var(--diff-normal);
  border-color: rgba(77, 201, 255, 0.5);
}

.diff-pill.hard {
  color: var(--diff-hard);
  border-color: rgba(255, 107, 157, 0.5);
}

.diff-pill.extra {
  color: var(--diff-extra);
  border-color: rgba(176, 107, 255, 0.5);
}

.diff-pill.random {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.5);
}

/* ============ 封面预览区 ============ */
.cover-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.cover-art {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #23233e, #14142a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.cover-art.has-cover:hover {
  box-shadow: 0 0 24px var(--accent-glow);
  transform: scale(1.02);
}

.cover-art svg {
  width: 72px;
  height: 72px;
  opacity: 0.5;
}

.cover-art.has-cover {
  background: linear-gradient(135deg, var(--accent), #7b5bff);
}

.cover-info h3 {
  font-size: 18px;
  font-weight: 700;
}

.cover-info .artist {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.cover-info .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ============ 难度选择按钮 ============ */
.diff-group {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.diff-btn {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  transition: all 0.18s var(--ease-out);
}

.diff-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
  background: var(--bg-elevated);
}

/* 自定义难度（非标准难度）统一白色 */
.diff-btn.active:not(.easy):not(.normal):not(.hard):not(.extra):not(.random) {
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4), 0 0 16px rgba(255, 255, 255, 0.2);
}

.diff-btn.active.easy {
  color: var(--diff-easy);
  border-color: var(--diff-easy);
  box-shadow: 0 0 0 1px rgba(77, 255, 156, 0.4), 0 0 16px rgba(77, 255, 156, 0.2);
}

.diff-btn.active.normal {
  color: var(--diff-normal);
  border-color: var(--diff-normal);
  box-shadow: 0 0 0 1px rgba(77, 201, 255, 0.4), 0 0 16px rgba(77, 201, 255, 0.2);
}

.diff-btn.active.hard {
  color: var(--diff-hard);
  border-color: var(--diff-hard);
  box-shadow: 0 0 0 1px rgba(255, 107, 157, 0.4), 0 0 16px rgba(255, 107, 157, 0.2);
}

.diff-btn.active.extra {
  color: var(--diff-extra);
  border-color: var(--diff-extra);
  box-shadow: 0 0 0 1px rgba(176, 107, 255, 0.4), 0 0 16px rgba(176, 107, 255, 0.2);
}

.diff-btn.active.random {
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4), 0 0 16px rgba(255, 255, 255, 0.2);
}

/* ============ 滑块调节组 ============ */
.slider-group {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.slider-label {
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 1px;
  text-transform: uppercase;
  min-width: 64px;
  text-align: left;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.stepper-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  transition: all 0.15s var(--ease-out);
  flex-shrink: 0;
}

.stepper-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.stepper-btn:active {
  transform: scale(0.9);
}

.stepper-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  min-width: 76px;
  text-align: center;
  color: var(--accent);
}

/* 自定义 range 滑块（整条浅蓝色，去掉灰色分段） */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, #7fdcff var(--fill, 50%), #4dc9ff var(--fill, 50%));
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #eaf9ff;
  border: 2px solid #4dc9ff;
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #eaf9ff;
  border: 2px solid #4dc9ff;
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, #7fdcff var(--fill, 50%), #4dc9ff var(--fill, 50%));
}

input[type="range"]::-moz-range-progress {
  height: 5px;
  border-radius: 3px;
  background: #7fdcff;
}

/* ============ 开关 ============ */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.toggle-row .label {
  font-size: 14px;
  color: var(--text-secondary);
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #2c2c42;
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 0.2s var(--ease-spring), background 0.2s var(--ease-out);
}

.switch.on {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.switch.on::after {
  transform: translateX(20px);
  background: #04141c;
}

/* ============ 设置面板 ============ */
.settings-panel {
  width: min(440px, 92vw);
  background: var(--bg-mid);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.3s var(--ease-spring);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.overlay.open .settings-panel {
  transform: translateY(0) scale(1);
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.settings-head h2 {
  font-size: 18px;
  letter-spacing: 1px;
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-section {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 12px 0 4px;
}

/* 按键映射显示 */
.keymap-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.keymap-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.keycap {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35);
  transition: all 0.15s var(--ease-out);
}

.keycap:hover {
  border-color: var(--accent);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35), 0 0 12px var(--accent-glow);
}

.keymap-item .lane-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* ============ 游戏 HUD ============ */
.hud-left,
.hud-right {
  display: flex;
  flex-direction: column;
}

.hud-right {
  align-items: flex-end;
}

.hud-center {
  text-align: center;
}

.hud-song {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.score {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1;
  text-shadow: 0 0 20px var(--accent-glow);
}

.combo {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.combo-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.accuracy {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
}

.acc-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ============ 轨道与音符 ============ */
.track {
  position: relative;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  transition: background 0.12s var(--ease-out);
}

.track:last-child {
  border-right: none;
}

.track.pressed {
  background: rgba(0, 212, 255, 0.08);
}

/* 判定线 */
.judge-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 110px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 12px var(--accent), 0 0 24px var(--accent-glow);
  animation: judge-breathe 2.4s ease-in-out infinite;
}

/* 按键区 */
.key-zone {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: 78%;
  height: 64px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.1s var(--ease-out);
}

.key-zone.pressed {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.15);
  box-shadow: 0 0 22px var(--accent-glow), inset 0 0 14px rgba(0, 212, 255, 0.2);
  transform: translateX(-50%) scale(0.94);
}

/* 音符占位符 */
.note {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 62%;
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--note-color), var(--note-color-light));
  box-shadow: 0 0 12px var(--note-glow);
  opacity: 0.9;
}

.note.diamond {
  width: 22px;
  height: 22px;
  border-radius: 2px;
  transform: translateX(-50%) rotate(45deg);
}

.note.cool {
  --note-color: var(--judge-cool);
  --note-color-light: #a99bff;
  --note-glow: rgba(143, 123, 255, 0.5);
}

.note.just {
  --note-color: var(--judge-just);
  --note-color-light: #a8f6ff;
  --note-glow: rgba(94, 242, 255, 0.5);
}

.note.rush {
  --note-color: var(--judge-rush);
  --note-color-light: #ffe585;
  --note-glow: rgba(255, 216, 77, 0.5);
}

/* ============ 进度条 ============ */
.progress {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  width: 260px;
  height: 6px;
  border-radius: 3px;
  background: #26263a;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width 0.3s linear;
}

.progress-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 90px;
  text-align: center;
}

/* ============ 暂停菜单 ============ */
.pause-menu {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 4, 10, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease-out), visibility 0s 0.25s;
}

.pause-menu.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s var(--ease-out);
}

.pause-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 280px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--bg-mid);
  border: 1px solid var(--border-light);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.92);
  transition: transform 0.25s var(--ease-spring);
}

.pause-menu.open .pause-card {
  transform: scale(1);
}

.pause-card h3 {
  text-align: center;
  font-size: 20px;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

/* ============ 结算界面 ============ */
.result-title {
  font-size: 24px;
  font-weight: 700;
}

.result-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.grade {
  font-family: var(--font-mono);
  font-size: 140px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent-glow), 0 0 80px var(--accent-glow);
  opacity: 0;
  transform: scale(0.5);
}

.grade.animate {
  animation: grade-in 0.6s var(--ease-spring) forwards;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.result-stats .stat-card {
  flex: 1 1 0;
  max-width: 220px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.stat-card .stat-num {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
}

.stat-card .stat-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-card .stat-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.stat-card.just .stat-num { color: var(--judge-just); }
.stat-card.just .stat-dot { background: var(--judge-just); }
.stat-card.rush .stat-num { color: var(--judge-rush); }
.stat-card.rush .stat-dot { background: var(--judge-rush); }
.stat-card.cool .stat-num { color: var(--judge-cool); }
.stat-card.cool .stat-dot { background: var(--judge-cool); }
.stat-card.miss .stat-num { color: var(--judge-miss); }
.stat-card.miss .stat-dot { background: var(--judge-miss); }

.result-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px 40px;
}

.result-summary .sum-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.result-summary .sum-num {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
}

.result-summary .sum-label {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.result-actions {
  display: flex;
  gap: 16px;
}

/* ============ 顶部返回条（准备/结算） ============ */
.topbar {
  position: absolute;
  top: 24px;
  left: 24px;
}

.song-sub {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.pregame-title {
  font-size: 30px;
  font-weight: 700;
}

.pregame-artist {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.pregame-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ============ 随机模式 ============ */
.mode-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #04141c;
  background: linear-gradient(135deg, #00d4ff, #7b5bff);
  box-shadow: 0 0 12px var(--accent-glow);
  margin-left: 6px;
  vertical-align: middle;
}

.song-bpm {
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
}

/* ============ 随机模式歌曲卡片列表 ============ */
.random-song-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* 固定视口高度，滚轮/滑条上下翻动 */
  height: 380px;
  max-height: 42vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
  scroll-behavior: smooth;
  /* 自定义滑条 */
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #2c2c42;
}

.random-song-list::-webkit-scrollbar {
  width: 8px;
}

.random-song-list::-webkit-scrollbar-track {
  background: #1a1a2e;
  border-radius: 4px;
}

.random-song-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), #7b5bff);
  border-radius: 4px;
  transition: background 0.2s var(--ease-out);
}

.random-song-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #2cdcff, #9b7bff);
}

.random-song-card {
  position: relative;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
  overflow: hidden;
  flex-shrink: 0;
}

.random-song-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.2s var(--ease-out);
}

.random-song-card:hover {
  border-color: var(--border-light);
  background: var(--bg-elevated);
  transform: translateX(4px);
}

.random-song-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), 0 0 20px rgba(0, 212, 255, 0.15);
}

.random-song-card.selected::before {
  transform: scaleY(1);
}

.random-song-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.random-song-main {
  flex: 1;
  min-width: 0;
}

.random-song-main .song-title {
  font-size: 16px;
  font-weight: 600;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.random-song-main .song-artist {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.random-song-bpm {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.random-song-diffs {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-left: 62px;
  flex-wrap: wrap;
}

.page-random {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 0;
}

.random-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: min(860px, 92vw);
  max-height: 100%;
  overflow-y: auto;
}

.random-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.random-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

.random-title {
  font-size: 26px;
  font-weight: 700;
  text-align: left;
}

.random-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-align: left;
}

.random-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  width: 100%;
}

.random-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.random-section-label {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.random-bpm-card {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  text-align: center;
}

.random-bpm {
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
}

.random-bpm-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

@media (max-width: 820px) {
  .random-body {
    grid-template-columns: 1fr;
  }
}

/* ============ 游戏 Canvas 与中央 HUD ============ */
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.center-hud {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 64px;
  line-height: 1;
  color: #f5f7fa;
  text-shadow: 0 0 24px var(--accent-glow), 0 0 48px var(--accent-glow);
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
  letter-spacing: 2px;
}

/* ============ HUD 设置面板 ============ */
.hud-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  text-align: left;
}

.hud-settings-title {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.hud-mode-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

.hud-radio input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.hud-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-slider-label {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 64px;
  flex-shrink: 0;
}

.hud-slider-value {
  font-size: 13px;
  color: var(--accent);
  min-width: 48px;
  text-align: right;
}

/* ============ 空状态提示 ============ */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
}

/* 封面预览 img 撑满 */
.cover-art img,
.song-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.song-thumb {
  flex-shrink: 0;
}

/* ============ 选歌页特殊卡片（随机/导入） ============ */
.song-item.special {
  grid-template-columns: 48px 1fr auto;
}

.song-item.special .special-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(139, 123, 255, 0.18));
  color: var(--accent);
  flex-shrink: 0;
}

.song-item.special .special-icon svg {
  width: 24px;
  height: 24px;
}

.song-item.special .song-artist {
  color: var(--text-muted);
}

.song-item.special .special-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 999px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  white-space: nowrap;
}

.song-item.special.import .special-icon {
  background: linear-gradient(135deg, rgba(77, 255, 156, 0.18), rgba(0, 212, 255, 0.18));
  color: var(--diff-easy);
}

.song-item.special.import .special-badge {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.5);
}

/* ============ 结算页曲绘 ============ */
.result-cover {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: linear-gradient(135deg, #23233e, #14142a);
  border: 1px solid var(--border-light);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.result-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-cover svg {
  width: 96px;
  height: 96px;
  opacity: 0.5;
}

.result-cover.hidden {
  display: none !important;
}

/* ============ 结算页误差分布柱状图 ============ */
.result-offset-chart {
  width: 100%;
  max-width: 600px;
  margin: 4px auto 0;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.offset-chart-title {
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-align: center;
  text-transform: uppercase;
}

.offset-chart-canvas {
  display: block;
  width: 100%;
  height: 180px;
}

/* ============ 导入谱面游玩弹窗 ============ */
.import-panel {
  width: min(480px, 92vw);
}

.import-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.import-file-name {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.import-file-name.ready {
  color: var(--diff-easy);
}

.import-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.import-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.import-field input {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s var(--ease-out);
}

.import-field input:focus {
  border-color: var(--accent);
}

.import-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.import-foot {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 0 0;
  margin-top: 20px;
  border-top: 1px solid var(--border);
}

.import-foot .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ============ 随机谱面配置弹窗 ============ */
.random-panel {
  width: min(520px, 92vw);
}

.random-song-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 4px;
}

.random-pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}

.random-pick-item:hover {
  border-color: var(--border-light);
  background: var(--bg-elevated);
}

.random-pick-item.selected {
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.08);
}

.random-pick-item.import .random-pick-icon {
  color: var(--diff-easy);
}

.random-pick-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.random-pick-icon svg {
  width: 20px;
  height: 20px;
}

.random-pick-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.random-pick-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.random-pick-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.random-song-list::-webkit-scrollbar {
  width: 8px;
}
.random-song-list::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

/* ============ Malody 谱面导入弹窗 ============ */
.malody-panel {
  width: min(560px, 94vw);
}

.malody-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out), color 0.15s var(--ease-out);
  text-align: center;
}

.malody-drop:hover,
.malody-drop.drag-over {
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.06);
  color: var(--accent);
}

.malody-drop-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.malody-drop-sub {
  font-size: 12px;
  color: var(--text-muted);
}

#import-hint .error,
.malody-status,
#import-status {
  color: var(--text-muted);
}

.import-hint.error {
  color: var(--diff-hard);
}

.import-hint.ok {
  color: var(--diff-easy);
}

/* 预览区 */
.malody-preview {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.malody-pv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.malody-pv-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.malody-pv-artist {
  font-size: 13px;
  color: var(--text-muted);
}

.malody-pv-bpm {
  font-size: 16px;
  color: var(--accent);
  white-space: nowrap;
}

.malody-pv-structure {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  word-break: break-all;
}

.malody-pv-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.malody-diff-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.malody-diff-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.malody-note-count {
  font-size: 13px;
  color: var(--text-muted);
}

.malody-pv-files {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

