:root {
  --bg: #08070c;
  --ink: #f5eefb;
  --ink-dim: #a89fb9;
  --amber: #ffb84d;
  --teal: #57d9c3;
  --rose: #ff6a85;
  --line: rgba(255, 255, 255, 0.09);
  --card: rgba(255, 255, 255, 0.045);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 55% at 50% -12%, rgba(255, 148, 64, 0.24), transparent 62%),
    radial-gradient(90% 55% at 4% 108%, rgba(96, 74, 255, 0.2), transparent 64%),
    radial-gradient(80% 50% at 100% 96%, rgba(48, 210, 190, 0.13), transparent 66%),
    #08070c;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(80% 60% at 50% 18%, #000 0%, transparent 78%);
  mask-image: radial-gradient(80% 60% at 50% 18%, #000 0%, transparent 78%);
}

button { font-family: inherit; }

.app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  max-width: 540px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(10px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.screen[hidden] { display: none !important; }

/* ---------------- 菜单 ---------------- */

.menu { overflow-y: auto; -webkit-overflow-scrolling: touch; }

.brand { padding: 10px 2px 4px; }

.brand-kicker {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.26em;
  color: rgba(255, 184, 77, 0.85);
  font-weight: 700;
}

.brand-title {
  margin: 8px 0 10px;
  font-size: clamp(34px, 10vw, 44px);
  line-height: 1;
  letter-spacing: 0.02em;
  font-weight: 800;
}

.brand-title span {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.44em;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.38);
}

.brand-lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-dim);
  max-width: 30em;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 18px 0 14px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.mode-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.52);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 11px 8px;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  min-height: 44px;
}

.mode-tab.is-on {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07));
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.clear-stat {
  margin: 0 0 10px 2px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.38);
}
.clear-stat b {
  font-family: var(--mono);
  letter-spacing: 0.08em;
  color: var(--amber);
}

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

.song-card {
  width: 100%;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.022));
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.song-card:hover { border-color: rgba(255, 255, 255, 0.2); }
.song-card:active { transform: scale(0.985); }
.song-card:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.song-art {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.55) 0 18%, transparent 19%),
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 6px),
    linear-gradient(150deg, var(--accent, #ffb84d), rgba(0, 0, 0, 0.65));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 16px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.song-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.28), transparent 45%);
}

.song-lv {
  position: absolute;
  left: 5px;
  bottom: 5px;
  z-index: 1;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #0b0810;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 5px;
  padding: 2px 4px;
}

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

.song-info h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-info h3 small {
  display: block;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.34);
  font-weight: 600;
  margin-top: 3px;
}

.song-info p {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  overflow: hidden;
}

.pips { display: inline-flex; gap: 2.5px; }
.pips i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.pips i.on { background: var(--accent, var(--amber)); box-shadow: 0 0 7px var(--accent, var(--amber)); }

.song-best {
  text-align: right;
  padding-right: 4px;
}
.song-best span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.3);
}
.song-best strong {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.82);
}
.song-best strong.is-empty { color: rgba(255, 255, 255, 0.25); }

/* 即兴面板 */
.jam-panel {
  padding: 22px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(87, 217, 195, 0.12), rgba(255, 255, 255, 0.02));
  text-align: left;
}
.jam-desc { margin: 0 0 18px; font-size: 13.5px; line-height: 1.7; color: #d9d2e6; }
.jam-tip { margin: 14px 0 0; font-size: 11.5px; color: rgba(255, 255, 255, 0.36); }

/* 按钮 */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 13px 20px;
  cursor: pointer;
  min-height: 46px;
  transition: transform 0.14s ease, filter 0.16s ease, background 0.16s ease;
}
.btn:active { transform: scale(0.975); }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.btn.primary {
  background: linear-gradient(180deg, #ffc76b, #ff9a3d);
  color: #241000;
  box-shadow: 0 10px 26px rgba(255, 156, 61, 0.28);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.big { width: 100%; padding: 16px; font-size: 15px; }
.btn.ghost {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line);
  color: var(--ink);
}

.menu-foot { margin-top: auto; padding-top: 20px; }

.settings {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-dim);
  min-height: 30px;
  cursor: pointer;
}

.switch input {
  appearance: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex: none;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.switch input:checked { background: rgba(255, 184, 77, 0.9); }
.switch input:checked::after { transform: translateX(14px); }
.switch input:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.vol {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-dim);
  flex: 1 1 120px;
  min-width: 110px;
}
.vol input {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 20px;
  background: transparent;
  cursor: pointer;
}
.vol input::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
}
.vol input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255, 184, 77, 0.6);
}
.vol input::-moz-range-track {
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
}
.vol input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--amber);
}

.key-hint {
  margin: 10px 0 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.02em;
}
kbd {
  display: inline-block;
  min-width: 18px;
  margin: 0 1px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}

/* ---------------- 演奏 / 即兴 通用 ---------------- */

.play, .jam { overflow: hidden; }

.play-head {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  flex: none;
}

.icon-btn {
  appearance: none;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.16s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.11); }
.icon-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.icon-btn.is-plain { background: transparent; border-color: transparent; font-size: 9px; color: rgba(255, 90, 120, 0.75); }

.play-meta { min-width: 0; flex: 1; }
.play-meta strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.play-meta span {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.36);
}

.progress {
  flex: none;
  height: 3px;
  margin: 8px 0 10px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--amber), #ff7096);
  box-shadow: 0 0 12px rgba(255, 160, 90, 0.6);
}

.hud {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 2px;
}
.hud-cell span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.32);
}
.hud-cell strong {
  display: block;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 1px;
}
.hud-cell.is-right { text-align: right; }

.combo {
  display: flex;
  align-items: baseline;
  gap: 5px;
  opacity: 0.35;
  transition: opacity 0.2s ease;
}
.combo.is-live { opacity: 1; }
.combo b {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  transition: transform 0.09s ease-out;
}
.combo b.is-pop { transform: scale(1.22); }
.combo span {
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: rgba(255, 184, 77, 0.85);
  font-weight: 700;
}

.track {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 4px 0 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.006));
  overflow: hidden;
}

.track-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(70% 34% at 50% 100%, rgba(255, 152, 72, 0.15), transparent 72%);
}

.lanes {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.lane {
  position: relative;
  border-right: 1px dashed rgba(255, 255, 255, 0.055);
}
.lane:last-child { border-right: 0; }

.lane::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 8px;
  height: 8px;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
}
.lane-kick::after { background: rgba(255, 122, 77, 0.7); }
.lane-snare::after { background: rgba(255, 227, 176, 0.7); }
.lane-tom::after { background: rgba(255, 184, 77, 0.7); }
.lane-hat::after { background: rgba(87, 217, 195, 0.7); }

.judge-line {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 10px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  box-shadow: 0 0 16px rgba(255, 200, 140, 0.4);
  pointer-events: none;
}

.note {
  position: absolute;
  left: 50%;
  top: 0;
  width: 70%;
  height: 15px;
  border-radius: 8px;
  transform: translate(-50%, -100px);
  will-change: transform;
  opacity: 0;
  pointer-events: none;
}
.note-kick {
  height: 19px;
  background: linear-gradient(180deg, #ff9d6b, #ff5b33);
  box-shadow: 0 0 18px rgba(255, 100, 60, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.note-snare {
  background: linear-gradient(180deg, #fffaf0, #ffd79d);
  box-shadow: 0 0 18px rgba(255, 226, 180, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.note-tom {
  background: linear-gradient(180deg, #ffd98a, #f0a02c);
  box-shadow: 0 0 18px rgba(255, 184, 77, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.note-hat {
  height: 11px;
  width: 62%;
  background: linear-gradient(180deg, #9df4e6, #2cbba3);
  box-shadow: 0 0 18px rgba(87, 217, 195, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.note.is-hit {
  opacity: 1 !important;
  animation: notePop 0.22s ease-out forwards;
}
@keyframes notePop {
  from { transform: translate(-50%, var(--ny, 0px)) scale(1); opacity: 1; }
  to { transform: translate(-50%, var(--ny, 0px)) scale(1.35, 0.4); opacity: 0; }
}

.judge-text {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%) scale(0.85);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.12em;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
}
.judge-text.show { animation: judgePop 0.46s ease-out; }
.judge-text.perfect { color: #a9ffe9; }
.judge-text.great { color: #ffe6a6; }
.judge-text.good { color: #ffd0a0; }
.judge-text.miss { color: #ff7d92; }

@keyframes judgePop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  22% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  70% { opacity: 1; transform: translate(-50%, -62%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -82%) scale(0.98); }
}

.countin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.countin.show { opacity: 1; }

/* ---------------- 鼓垫 ---------------- */

.pads {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 2px 0 4px;
}

.pad {
  position: relative;
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  width: min(100%, 110px);
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.pad-glow {
  position: absolute;
  inset: -12%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow, rgba(255, 184, 77, 0.8)) 0%, transparent 68%);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.pad-shell {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 210deg, var(--rim, #d8d0c4), var(--rim2, #8d8377), var(--rim, #d8d0c4), var(--rim2, #8d8377), var(--rim, #d8d0c4));
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55), 0 2px 0 rgba(255, 255, 255, 0.12) inset;
}

.pad-face {
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background:
    radial-gradient(circle at 50% 26%, var(--f1, #fffaf0) 0%, var(--f2, #e6d6bb) 52%, var(--f3, #c9b696) 100%);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.75),
    inset 0 -8px 16px rgba(70, 45, 15, 0.26),
    inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  transition: transform 0.09s ease-out, filter 0.12s ease-out;
}

.pad-face::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  border: 1px solid rgba(80, 50, 20, 0.16);
  pointer-events: none;
}

.pad-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: rgba(48, 26, 8, 0.78);
}
.pad-cn {
  font-size: 12.5px;
  font-weight: 700;
  color: rgba(48, 26, 8, 0.62);
  letter-spacing: 0.04em;
}
.pad-key {
  position: absolute;
  bottom: 16%;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: rgba(48, 26, 8, 0.4);
}

.pad-kick {
  --f1: #ffd9c4;
  --f2: #f6a97f;
  --f3: #d47b52;
  --rim: #ff9b66;
  --rim2: #b8502c;
  --glow: rgba(255, 110, 60, 0.85);
}
.pad-snare {
  --f1: #fffdf6;
  --f2: #f1e6d2;
  --f3: #cdbda0;
  --rim: #e6ded0;
  --rim2: #8a8071;
  --glow: rgba(255, 235, 200, 0.85);
}
.pad-tom {
  --f1: #ffe9c4;
  --f2: #f3c887;
  --f3: #c8934a;
  --rim: #ffc06a;
  --rim2: #9a5c1e;
  --glow: rgba(255, 184, 77, 0.85);
}
.pad-hat {
  --f1: #d6fff7;
  --f2: #93e3d5;
  --f3: #4b9e92;
  --rim: #7fe4d2;
  --rim2: #2b7f74;
  --glow: rgba(87, 217, 195, 0.85);
}

.pad.is-hit .pad-face {
  transform: scale(0.93);
  filter: brightness(1.16) saturate(1.08);
}
.pad.is-hit .pad-glow {
  opacity: 0.95;
  transform: scale(1.08);
}
.pad:focus-visible { outline: 2px solid var(--amber); outline-offset: 4px; }
.pad:active .pad-face { transform: scale(0.94); }

/* ---------------- 结算 ---------------- */

.result {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 4px;
  overflow-y: auto;
  padding: 8px 0 12px;
}

.rank-badge {
  font-size: clamp(66px, 22vw, 96px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #fff;
  background: linear-gradient(180deg, #fff5dc, #ffb84d 62%, #ff7e4d);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 8px 30px rgba(255, 168, 70, 0.35));
  animation: rankIn 0.55s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.rank-badge[data-rank="A"] {
  background: linear-gradient(180deg, #e6fffb, #57d9c3 60%, #2b9c8c);
  -webkit-background-clip: text;
  background-clip: text;
}
.rank-badge[data-rank="B"] {
  background: linear-gradient(180deg, #e8e2ff, #a08dff 60%, #6d55d8);
  -webkit-background-clip: text;
  background-clip: text;
}
.rank-badge[data-rank="C"], .rank-badge[data-rank="D"] {
  background: linear-gradient(180deg, #f0ecf6, #a89fb9 60%, #6d6580);
  -webkit-background-clip: text;
  background-clip: text;
}

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

.res-kicker {
  margin: 6px 0 0;
  font-size: 9.5px;
  letter-spacing: 0.32em;
  color: rgba(255, 255, 255, 0.35);
}

.res-song {
  margin: 8px 0 14px;
  font-size: 19px;
  font-weight: 800;
}

.res-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.res-score strong {
  font-family: var(--mono);
  font-size: clamp(36px, 12vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.res-score span {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.3);
}

.res-stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0 12px;
}
.res-stats div {
  padding: 11px 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}
.res-stats span {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.36);
}
.res-stats strong {
  display: block;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
}

.res-judges {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.22);
}
.res-judges div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
}
.res-judges b {
  font-family: var(--mono);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}
.res-judges .j-perfect { color: #a9ffe9; }
.res-judges .j-great { color: #ffe6a6; }
.res-judges .j-good { color: #ffcfa0; }
.res-judges .j-miss { color: #ff8ba0; }

.res-new {
  margin: 12px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--amber);
  animation: newPulse 1.6s ease-in-out infinite;
}
@keyframes newPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.res-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: 20px;
}

/* ---------------- 即兴 ---------------- */

.jam-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 4px 0 12px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background:
    radial-gradient(60% 50% at 50% 46%, rgba(87, 217, 195, 0.12), transparent 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 18px;
}

.beat-dots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  width: min(78%, 260px);
}
.beat-dots i {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: background 0.12s ease, box-shadow 0.16s ease, transform 0.12s ease;
}
.beat-dots i.is-first { border-radius: 26% 74% 30% 70% / 60% 34% 66% 40%; }
.beat-dots i.on {
  background: var(--amber);
  box-shadow: 0 0 22px rgba(255, 184, 77, 0.75);
  transform: scale(1.14);
}

.jam-meter, .jam-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: absolute;
}
.jam-meter { left: 18px; top: 18px; align-items: flex-start; }
.jam-count { right: 18px; top: 18px; align-items: flex-end; }
.jam-meter span, .jam-count span {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.34);
}
.jam-meter strong, .jam-count strong {
  font-family: var(--mono);
  font-size: 17px;
}

.jam-word {
  margin: 0;
  max-width: 22em;
  font-size: 12.5px;
  line-height: 1.7;
  text-align: center;
  color: rgba(255, 255, 255, 0.42);
  transition: opacity 0.3s ease;
}

/* ---------------- 小屏微调 ---------------- */

@media (max-height: 700px) {
  .brand-title { font-size: 32px; }
  .brand-lead { font-size: 12px; }
  .pads { gap: 8px; }
  .pad { width: min(100%, 88px); }
  .jam-stage { gap: 10px; }
}

@media (min-width: 560px) {
  .app { padding-left: 22px; padding-right: 22px; }
  .pad { width: min(100%, 118px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
