/* ===========================================================
   NEON RHYTHM — 视觉样式
   =========================================================== */

:root {
  --bg: #05060f;
  --bg-soft: #0a0d1d;
  --panel: rgba(14, 18, 38, 0.72);
  --panel-line: rgba(120, 200, 255, 0.16);
  --text: #e8f4ff;
  --text-dim: #8fa3c8;
  --cyan: #22e1ff;
  --violet: #a259ff;
  --pink: #ff4fa3;
  --gold: #ffd23f;
  --lime: #b6ff3c;
  --red: #ff4d5e;
  --lane-0: #22e1ff;
  --lane-1: #a259ff;
  --lane-2: #ff4fa3;
  --lane-3: #ffd23f;
  --radius: 14px;
  --font-ui: 'Inter', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  margin: 0 2px;
  border-radius: 5px;
  border: 1px solid rgba(140, 210, 255, 0.35);
  background: rgba(30, 50, 90, 0.5);
  font-family: var(--font-mono);
  font-size: 0.85em;
  text-align: center;
  color: #cfe9ff;
}

/* ---------- 背景层 ---------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.overlay-grid {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: linear-gradient(rgba(90, 190, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 190, 255, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 35%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 35%, transparent 100%);
}

.overlay-scan {
  position: fixed;
  inset: -50%;
  z-index: 2;
  pointer-events: none;
  opacity: 0.16;
  background: repeating-linear-gradient(
    to bottom,
    rgba(160, 230, 255, 0.14) 0px,
    rgba(160, 230, 255, 0.14) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: scanDrift 8s linear infinite;
}

@keyframes scanDrift {
  from { transform: translateY(0); }
  to { transform: translateY(6px); }
}

.overlay-vignette {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse 75% 65% at 50% 45%, transparent 40%, rgba(2, 3, 10, 0.85) 100%);
}

#app {
  position: relative;
  z-index: 4;
  height: 100%;
}

/* ---------- 屏幕切换 ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: 22px clamp(16px, 4vw, 54px);
  overflow: hidden;
}

.screen.is-active {
  display: flex;
  animation: screenIn 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

/* ---------- 按钮 ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 11px;
  border: 1px solid rgba(130, 205, 255, 0.28);
  background: linear-gradient(180deg, rgba(28, 40, 76, 0.85), rgba(14, 20, 40, 0.85));
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.btn:hover {
  transform: translateY(-2px);
  border-color: rgba(160, 230, 255, 0.6);
  box-shadow: 0 8px 26px -10px rgba(60, 200, 255, 0.75), inset 0 0 22px -12px rgba(120, 220, 255, 0.9);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary {
  border-color: rgba(34, 225, 255, 0.55);
  background: linear-gradient(135deg, rgba(34, 225, 255, 0.22), rgba(162, 89, 255, 0.26));
  box-shadow: 0 0 30px -12px rgba(34, 225, 255, 0.9);
}

.btn-primary:hover {
  box-shadow: 0 10px 34px -10px rgba(34, 225, 255, 0.95), inset 0 0 26px -10px rgba(162, 89, 255, 0.8);
}

.btn-ghost {
  background: rgba(16, 22, 44, 0.5);
  border-color: rgba(130, 205, 255, 0.18);
  color: var(--text-dim);
  font-weight: 500;
}

.btn-ghost:hover {
  color: var(--text);
}

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

.btn-wide {
  width: 100%;
}

.btn-key {
  font-size: 12px;
  opacity: 0.85;
}

/* ---------- 标题页 ---------- */
.title-wrap {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.logo {
  margin: 0;
  line-height: 0.9;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-main {
  font-family: var(--font-mono);
  font-size: clamp(52px, 12vw, 132px);
  font-weight: 800;
  letter-spacing: 0.14em;
  background: linear-gradient(180deg, #ffffff, var(--cyan) 45%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 34px rgba(34, 225, 255, 0.55));
  animation: logoPulse 3.4s ease-in-out infinite;
}

.logo-sub {
  font-family: var(--font-mono);
  font-size: clamp(20px, 4.6vw, 48px);
  letter-spacing: 0.62em;
  text-indent: 0.62em;
  color: var(--pink);
  text-shadow: 0 0 22px rgba(255, 79, 163, 0.75);
}

@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 30px rgba(34, 225, 255, 0.45)); }
  50% { filter: drop-shadow(0 0 52px rgba(162, 89, 255, 0.75)); }
}

.tagline {
  margin: 4px 0 18px;
  color: var(--text-dim);
  letter-spacing: 0.28em;
  font-size: 13px;
  text-transform: uppercase;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(320px, 78vw);
}

.hint {
  color: var(--text-dim);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  margin-top: 10px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--panel-line);
  flex: 0 0 auto;
}

.topbar-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #cfeaff;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

/* ---------- 选曲页 ---------- */
.select-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.85fr);
  gap: 22px;
  padding-top: 18px;
}

.song-list-wrap {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.song-list {
  list-style: none;
  margin: 0;
  padding: 0 6px 0 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 200, 255, 0.35) transparent;
}

.song-list::-webkit-scrollbar { width: 8px; }
.song-list::-webkit-scrollbar-thumb {
  background: rgba(120, 200, 255, 0.28);
  border-radius: 8px;
}

.song-item {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(120, 200, 255, 0.14);
  background: linear-gradient(100deg, rgba(16, 22, 46, 0.72), rgba(10, 14, 30, 0.6));
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.14s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.song-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent, var(--cyan));
  box-shadow: 0 0 16px var(--accent, var(--cyan));
  opacity: 0.8;
}

.song-item:hover {
  transform: translateX(4px);
  border-color: rgba(160, 230, 255, 0.4);
}

.song-item.is-active {
  border-color: var(--accent, var(--cyan));
  box-shadow: 0 0 0 1px rgba(34, 225, 255, 0.25), 0 14px 40px -22px var(--accent, var(--cyan));
  background: linear-gradient(100deg, rgba(28, 40, 78, 0.9), rgba(12, 18, 38, 0.75));
}

.song-thumb {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: #04121a;
  background: linear-gradient(140deg, var(--accent, var(--cyan)), rgba(255, 255, 255, 0.85));
  box-shadow: 0 0 22px -6px var(--accent, var(--cyan));
}

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

.song-name {
  font-size: 15.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-side {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

.song-side b {
  display: block;
  font-size: 15px;
  color: var(--text);
}

.drop-hint {
  flex: 0 0 auto;
  border: 1px dashed rgba(120, 200, 255, 0.3);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
  transition: all 0.2s ease;
}

.drop-hint.is-over {
  border-color: var(--cyan);
  background: rgba(34, 225, 255, 0.1);
  color: var(--text);
}

.song-detail {
  border-radius: 18px;
  border: 1px solid var(--panel-line);
  background: var(--panel);
  backdrop-filter: blur(14px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
}

.detail-art {
  height: 108px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 20%, rgba(34, 225, 255, 0.28), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(255, 79, 163, 0.28), transparent 60%),
    linear-gradient(160deg, #0b1226, #131a35);
  display: flex;
  align-items: flex-end;
  padding: 10px 14px;
  border: 1px solid rgba(140, 210, 255, 0.14);
  overflow: hidden;
}

.detail-art-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100%;
  width: 100%;
}

.detail-art-bars i {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--cyan), rgba(162, 89, 255, 0.15));
  animation: barDance 1.1s ease-in-out infinite alternate;
  transform-origin: bottom;
}

@keyframes barDance {
  from { transform: scaleY(0.22); opacity: 0.65; }
  to { transform: scaleY(1); opacity: 1; }
}

.detail-title {
  margin: 0;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.detail-artist {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.5px;
  font-family: var(--font-mono);
}

.diff-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.diff-tab {
  padding: 9px 4px;
  border-radius: 10px;
  border: 1px solid rgba(120, 200, 255, 0.18);
  background: rgba(12, 18, 38, 0.7);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.18s ease;
}

.diff-tab:hover { color: var(--text); }

.diff-tab.is-active {
  color: #04121a;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  border-color: transparent;
  box-shadow: 0 0 24px -8px var(--cyan);
}

.detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin: 0;
  padding: 12px 0;
  border-top: 1px solid var(--panel-line);
  border-bottom: 1px solid var(--panel-line);
}

.detail-stats > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.detail-stats dt {
  color: var(--text-dim);
  font-size: 12px;
}

.detail-stats dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.detail-foot {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
  min-height: 16px;
}

/* ---------- 设置页 ---------- */
.settings-layout,
.help-layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 4px 40px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  align-content: start;
}

.help-layout .panel-wide,
.settings-layout .panel-wide {
  grid-column: 1 / -1;
}

.panel {
  border-radius: 16px;
  border: 1px solid var(--panel-line);
  background: var(--panel);
  backdrop-filter: blur(12px);
  padding: 18px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
}

.panel-desc {
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.75;
  margin: 12px 0 0;
}

.row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 84px;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(120, 200, 255, 0.1);
}

.row:last-child { border-bottom: none; }

.row > label:first-child {
  font-size: 13.5px;
  color: #cfe4ff;
}

.row output {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--cyan);
  text-align: right;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(34, 225, 255, 0.65), rgba(162, 89, 255, 0.5));
  outline: none;
  cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #eafcff;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 14px rgba(34, 225, 255, 0.95);
}

input[type='range']::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #eafcff;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 14px rgba(34, 225, 255, 0.95);
}

select {
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid rgba(120, 200, 255, 0.25);
  background: rgba(10, 16, 34, 0.9);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: rgba(40, 52, 84, 0.9);
  border: 1px solid rgba(120, 200, 255, 0.25);
  transition: all 0.22s ease;
}

.switch span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #8fa3c8;
  transition: all 0.22s ease;
}

.switch input:checked + span {
  background: linear-gradient(90deg, rgba(34, 225, 255, 0.45), rgba(162, 89, 255, 0.45));
  border-color: rgba(34, 225, 255, 0.7);
}

.switch input:checked + span::after {
  transform: translateX(22px);
  background: #eafcff;
  box-shadow: 0 0 12px var(--cyan);
}

.calib-area {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.calib-visual {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 46px;
}

.calib-visual span {
  width: 8px;
  height: 14px;
  border-radius: 4px;
  background: rgba(120, 200, 255, 0.25);
  transition: all 0.12s ease;
}

.calib-visual span.on {
  background: var(--cyan);
  height: 42px;
  box-shadow: 0 0 18px var(--cyan);
}

.calib-readout {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  min-width: 220px;
  flex: 1 1 auto;
}

/* ---------- 帮助页 ---------- */
.bullet {
  margin: 0;
  padding-left: 20px;
  color: #cfe4ff;
  font-size: 13.5px;
  line-height: 2;
}

.bullet b { color: var(--gold); }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(120, 200, 255, 0.1);
}

.table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.j-perfect { color: var(--cyan); }
.j-great { color: var(--lime); }
.j-good { color: var(--gold); }
.j-bad { color: #ff9f43; }
.j-miss { color: var(--red); }

/* ---------- 分析页 ---------- */
.analyze-wrap {
  margin: auto;
  width: min(560px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  align-items: center;
}

.analyze-title {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.14em;
}

.analyze-file {
  margin: 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12.5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress {
  width: 100%;
  height: 8px;
  border-radius: 8px;
  background: rgba(30, 44, 80, 0.8);
  overflow: hidden;
  border: 1px solid rgba(120, 200, 255, 0.2);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  box-shadow: 0 0 18px rgba(34, 225, 255, 0.8);
  transition: width 0.2s ease;
}

.analyze-status {
  margin: 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12.5px;
  min-height: 18px;
}

/* ---------- 游戏页 ---------- */
.screen-game {
  padding: 0;
  overflow: hidden;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 62px;
  display: flex;
  align-items: center;
  padding: 0 clamp(12px, 3vw, 30px);
  gap: 16px;
  z-index: 5;
  background: linear-gradient(180deg, rgba(4, 6, 16, 0.92), transparent);
}

.hud-left { min-width: 0; flex: 1 1 0; }
.hud-mid { text-align: center; flex: 0 0 auto; }
.hud-right {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

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

.hud-diff {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 0.16em;
  margin-top: 2px;
}

.hud-score {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.05;
  text-shadow: 0 0 22px rgba(34, 225, 255, 0.55);
}

.hud-acc {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

.hud-combo-label {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--text-dim);
  text-align: right;
}

.hud-combo {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 210, 63, 0.6);
  line-height: 1;
  margin-right: 10px;
}

.progress-track {
  position: absolute;
  top: 62px;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(40, 60, 100, 0.5);
  z-index: 5;
}

.progress-track .progress-fill { transition: none; }

.stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

#playfield {
  display: block;
  width: 100%;
  height: 100%;
}

.touch-keys {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 84px;
  display: none;
  z-index: 6;
}

.touch-keys i {
  flex: 1;
  border-top: 1px solid rgba(120, 200, 255, 0.2);
  border-right: 1px solid rgba(120, 200, 255, 0.08);
  transition: background 0.08s linear;
}

.touch-keys i.on { background: rgba(34, 225, 255, 0.22); }

.countdown {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 8;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 130px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 60px rgba(34, 225, 255, 0.9);
  background: rgba(4, 6, 16, 0.55);
}

.countdown.is-on { display: grid; }

.countdown span {
  animation: countPop 0.5s ease-out;
}

@keyframes countPop {
  from { transform: scale(1.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.pause-overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 9;
  background: rgba(4, 6, 16, 0.78);
  backdrop-filter: blur(9px);
}

.pause-overlay.is-on { display: grid; }

.pause-card {
  width: min(440px, 88vw);
  border-radius: 18px;
  border: 1px solid var(--panel-line);
  background: var(--panel);
  padding: 24px;
}

.pause-card h2 {
  margin: 0 0 16px;
  text-align: center;
  letter-spacing: 0.22em;
  font-size: 16px;
  color: var(--cyan);
}

.pause-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.pause-card .hint { text-align: center; }

/* ---------- 结算页 ---------- */
.result-wrap {
  margin: auto;
  width: min(760px, 92vw);
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0 24px;
}

.result-grade {
  font-family: var(--font-mono);
  font-size: clamp(64px, 14vw, 118px);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(180deg, #fff, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 32px rgba(34, 225, 255, 0.7));
  animation: gradeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes gradeIn {
  from { transform: scale(0.55) rotate(-8deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.result-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.result-meta {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.5px;
  font-family: var(--font-mono);
}

.result-score {
  font-family: var(--font-mono);
  font-size: clamp(34px, 6vw, 50px);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 0 30px rgba(34, 225, 255, 0.5);
}

.result-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 24px;
}

.tag {
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  border: 1px solid currentColor;
}

.tag-gold { color: var(--gold); background: rgba(255, 210, 63, 0.12); }
.tag-cyan { color: var(--cyan); background: rgba(34, 225, 255, 0.12); }
.tag-pink { color: var(--pink); background: rgba(255, 79, 163, 0.12); }
.tag-dim { color: var(--text-dim); background: rgba(140, 170, 210, 0.1); }

.result-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.result-cell {
  border-radius: 12px;
  border: 1px solid var(--panel-line);
  background: rgba(14, 20, 42, 0.6);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.result-cell .k { font-size: 12px; color: var(--text-dim); }
.result-cell .v { font-family: var(--font-mono); font-size: 16px; font-weight: 650; color: var(--text); }
.result-cell.j-perfect .v { color: var(--cyan); }
.result-cell.j-great .v { color: var(--lime); }
.result-cell.j-good .v { color: var(--gold); }
.result-cell.j-bad .v { color: #ff9f43; }
.result-cell.j-miss .v { color: var(--red); }

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .select-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(140px, 1fr) auto;
  }
  .song-detail { max-height: 52vh; }
  .hud-combo-label { display: none; }
  .hud-score { font-size: 20px; }
  .touch-keys { display: flex; }
}

@media (max-width: 560px) {
  .screen { padding: 14px; }
  .row { grid-template-columns: 92px minmax(0, 1fr) 62px; gap: 8px; }
  .hud { height: 54px; }
  .progress-track { top: 54px; }
  .result-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}

/* ===========================================================
   成绩页
   =========================================================== */

.records-layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 4px 40px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  align-content: start;
}

.records-layout .panel-wide { grid-column: 1 / -1; }

.player-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.player-avatar {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 800;
  color: #04121a;
  background: linear-gradient(140deg, var(--cyan), var(--violet) 60%, var(--pink));
  box-shadow: 0 0 30px -8px var(--cyan);
}

.player-info { flex: 1 1 220px; min-width: 0; }

.player-name-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.player-name-input {
  width: 100%;
  max-width: 320px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(120, 200, 255, 0.25);
  background: rgba(10, 16, 34, 0.9);
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 650;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.player-name-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 225, 255, 0.16);
}

.player-id {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.player-id code {
  font-family: var(--font-mono);
  color: var(--cyan);
  background: rgba(34, 225, 255, 0.1);
  padding: 1px 6px;
  border-radius: 5px;
}

.player-id-hint { opacity: 0.75; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
}

.stat-tile {
  border-radius: 12px;
  border: 1px solid var(--panel-line);
  background: rgba(14, 20, 42, 0.6);
  padding: 12px 14px;
}

.stat-tile .v {
  display: block;
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-tile .k {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.stat-tile.is-accent .v { color: var(--cyan); text-shadow: 0 0 18px rgba(34, 225, 255, 0.45); }
.stat-tile.is-gold .v { color: var(--gold); text-shadow: 0 0 18px rgba(255, 210, 63, 0.4); }

.records-table-wrap { overflow-x: auto; }

.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 560px;
}

.records-table th,
.records-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(120, 200, 255, 0.1);
  white-space: nowrap;
}

.records-table th {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: rgba(10, 14, 30, 0.96);
  backdrop-filter: blur(6px);
  z-index: 1;
}

.records-table tbody tr:hover { background: rgba(34, 225, 255, 0.05); }

.records-table .col-song { min-width: 180px; white-space: normal; }
.records-table .col-plays { text-align: right; }

.rec-song-title { font-weight: 650; }
.rec-song-meta { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); margin-top: 2px; }

.rec-cell { display: flex; align-items: center; gap: 8px; }
.rec-cell .lv {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  min-width: 30px;
}
.rec-cell .sc { font-family: var(--font-mono); font-size: 13px; }
.rec-cell.is-empty { color: rgba(140, 170, 210, 0.45); font-family: var(--font-mono); }

.grade-badge {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.05);
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 340px;
  overflow-y: auto;
}

.history-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(120, 200, 255, 0.1);
  background: rgba(14, 20, 42, 0.45);
}

.history-item .hi-main { min-width: 0; }
.history-item .hi-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item .hi-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.history-item .hi-right {
  text-align: right;
  font-family: var(--font-mono);
}
.history-item .hi-score { font-size: 15px; font-weight: 700; }
.history-item .hi-acc { font-size: 11px; color: var(--text-dim); }
.history-item .hi-new {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--pink);
}

@media (max-width: 560px) {
  .player-name-input { max-width: none; }
  .player-avatar { width: 48px; height: 48px; font-size: 20px; border-radius: 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .history-item { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; padding: 7px 9px; }
}
