:root {
  --bg: #05050b;
  --bg-soft: #0b0c16;
  --panel: rgba(14, 16, 30, 0.82);
  --panel-solid: #10121f;
  --line: rgba(120, 140, 200, 0.16);
  --line-bright: rgba(110, 230, 255, 0.42);
  --cyan: #45f0ff;
  --cyan-deep: #09b6d6;
  --magenta: #ff3dbb;
  --purple: #8b5cff;
  --yellow: #ffd166;
  --red: #ff466e;
  --blue: #5b8cff;
  --text: #eef3ff;
  --muted: #8c93b0;
  --muted-2: #5f6685;
  --radius: 18px;
  --font-display: "Arial Black", "Impact", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-body: "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "Consolas", "Menlo", monospace;
}

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

html, body {
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body { position: relative; }

button, input, output { font-family: inherit; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-shadow: 0 0 12px rgba(69, 240, 255, .65); }
img { display: block; user-select: none; }

::selection { background: rgba(69, 240, 255, .28); color: #fff; }

/* ---------- ambient background ---------- */
.ambient { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; background: radial-gradient(120% 90% at 50% 0%, #0c1024 0%, #05050b 55%, #030308 100%); }
.ambient-grid {
  position: absolute; inset: -40% -20%;
  background-image:
    linear-gradient(rgba(90, 140, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 140, 255, .055) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(600px) rotateX(62deg) translateY(18%);
  transform-origin: center 30%;
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.5) 30%, #000 65%, transparent 100%);
  animation: gridDrift 24s linear infinite;
}
@keyframes gridDrift { from { background-position: 0 0, 0 0; } to { background-position: 0 64px, 64px 0; } }
.ambient-glow { position: absolute; width: 60vw; height: 60vw; border-radius: 50%; filter: blur(90px); opacity: .5; }
.glow-a { top: -24vw; left: -14vw; background: radial-gradient(circle, rgba(30, 220, 255, .34), transparent 65%); animation: driftA 18s ease-in-out infinite alternate; }
.glow-b { bottom: -30vw; right: -18vw; background: radial-gradient(circle, rgba(255, 45, 180, .26), transparent 65%); animation: driftB 22s ease-in-out infinite alternate; }
@keyframes driftA { to { transform: translate(8vw, 6vw) scale(1.12); } }
@keyframes driftB { to { transform: translate(-7vw, -5vw) scale(1.08); } }
.ambient-scan { position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, rgba(255,255,255,.028) 0 1px, transparent 1px 3px); mix-blend-mode: overlay; opacity: .5; }

/* ---------- shell ---------- */
#app { position: relative; min-height: 100vh; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: 72px; padding: 0 clamp(18px, 4vw, 56px);
  display: flex; align-items: center; gap: 28px;
  background: linear-gradient(to bottom, rgba(5, 5, 11, .92), rgba(5, 5, 11, .55) 70%, transparent);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid rgba(69,240,255,.55); border-radius: 9px;
  color: var(--cyan); font-family: var(--font-display); font-size: 20px;
  background: rgba(69,240,255,.08); box-shadow: 0 0 18px rgba(69,240,255,.22), inset 0 0 14px rgba(69,240,255,.12);
}
.brand-text { font-family: var(--font-display); letter-spacing: .14em; font-size: 17px; }
.brand-text small { color: var(--cyan); font-size: 10px; letter-spacing: .3em; margin-left: 8px; vertical-align: 2px; }
.topnav { display: flex; gap: 6px; margin-left: 8px; }
.nav-btn {
  border: 0; background: transparent; color: var(--muted); font-size: 13px; letter-spacing: .06em;
  padding: 9px 14px; border-radius: 10px; cursor: pointer; transition: .2s;
}
.nav-btn:hover { color: var(--text); background: rgba(120, 150, 255, .08); }
.nav-btn.is-active { color: var(--cyan); background: rgba(69,240,255,.08); box-shadow: inset 0 0 0 1px rgba(69,240,255,.18); }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted-2); font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; }
.topbar-meta .dot { width: 6px; height: 6px; border-radius: 50%; background: #38ff9e; box-shadow: 0 0 10px #38ff9e; animation: pulseDot 2s infinite; }
@keyframes pulseDot { 50% { opacity: .35; } }

/* ---------- screens ---------- */
.screen { width: 100%; }
.screen.is-active { display: block; }
.game-screen { display: none; position: fixed; inset: 0; z-index: 50; background: #020208; }
.game-screen.is-active { display: flex; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- hero ---------- */
main#home { padding: 118px clamp(18px, 5vw, 72px) 40px; max-width: 1500px; margin: 0 auto; }

.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: center; gap: 40px; min-height: 62vh; padding: 24px 0 48px; }
.eyebrow { color: var(--cyan); font-family: var(--font-mono); font-size: 11px; letter-spacing: .22em; opacity: .8; margin-bottom: 14px; }
.hero h1, .glitch {
  position: relative; font-family: var(--font-display); font-size: clamp(52px, 8.4vw, 118px);
  line-height: .92; letter-spacing: -.02em; text-transform: uppercase;
  color: #f4f7ff; text-shadow: 0 0 34px rgba(69,240,255,.16);
}
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none; opacity: .55;
}
.glitch::before { color: var(--magenta); clip-path: inset(42% 0 40% 0); transform: translate(-3px, 1px); animation: glitchA 4.5s infinite steps(1); }
.glitch::after { color: var(--cyan); clip-path: inset(8% 0 74% 0); transform: translate(3px, -1px); animation: glitchB 5.2s infinite steps(1); }
@keyframes glitchA { 0%, 88%, 100% { opacity: 0; } 89% { opacity: .6; transform: translate(-4px, 1px); } 91% { opacity: .35; transform: translate(2px, -2px); } 93% { opacity: 0; } }
@keyframes glitchB { 0%, 90%, 100% { opacity: 0; } 91% { opacity: .55; transform: translate(4px, -1px); } 94% { opacity: .3; } 96% { opacity: 0; } }
.hero h1 span {
  display: block; font-size: .24em; letter-spacing: .5em; color: var(--cyan); margin-top: 12px;
  font-family: var(--font-mono); font-weight: 400; text-shadow: 0 0 18px rgba(69,240,255,.5);
}
.hero-sub { color: var(--muted); font-size: 15px; line-height: 1.85; max-width: 560px; margin-top: 22px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }
.hero-stats { display: flex; gap: 36px; margin-top: 44px; }
.hero-stats div { display: flex; align-items: baseline; gap: 8px; }
.hero-stats b { font-family: var(--font-display); font-size: 26px; color: var(--cyan); }
.hero-stats span { color: var(--muted-2); font-size: 11px; letter-spacing: .16em; }

.btn {
  position: relative; border: 0; cursor: pointer; border-radius: 12px;
  padding: 14px 26px; font-size: 14px; font-weight: 700; letter-spacing: .08em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .16s ease, box-shadow .2s ease, background .2s ease;
  color: var(--text); background: rgba(120,150,255,.08);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary {
  color: #031014; background: linear-gradient(120deg, #7df6ff, #45f0ff 40%, #10c8ea);
  box-shadow: 0 10px 34px rgba(20, 220, 255, .28), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-primary:hover { box-shadow: 0 14px 44px rgba(20, 220, 255, .45), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-ghost { background: rgba(130, 160, 255, .06); box-shadow: inset 0 0 0 1px rgba(130,160,255,.22); color: #cdd6f5; }
.btn-ghost:hover { background: rgba(130,160,255,.13); }
.btn-danger { color: #ff9cb4; box-shadow: inset 0 0 0 1px rgba(255, 70, 110, .35); background: rgba(255,70,110,.06); }
.btn-small { padding: 9px 16px; font-size: 12px; border-radius: 9px; }
.btn-icon { font-size: 12px; opacity: .85; }
.btn kbd {
  font: 700 10px/1 "SFMono-Regular", Consolas, monospace;
  padding: 4px 5px; border-radius: 5px; letter-spacing: .06em;
  background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  opacity: .72;
}

/* ---------- hero visual ---------- */
.hero-visual { position: relative; height: 460px; display: grid; place-items: center; }
.disc { position: relative; width: min(390px, 34vw); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 34% 28%, rgba(69,240,255,.32), rgba(15,20,44,.9) 42%, #070812 70%);
  box-shadow: 0 0 80px rgba(40,200,255,.18), inset 0 0 60px rgba(80,120,255,.15), 0 0 0 1px rgba(69,240,255,.22);
}
.disc::after { content: ""; position: absolute; inset: 12%; border-radius: 50%; border: 1px dashed rgba(69,240,255,.24); animation: spin 26s linear infinite reverse; }
.disc-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(120,220,255,.2); }
.ring-1 { inset: 3%; animation: spin 18s linear infinite; border-top-color: rgba(69,240,255,.75); }
.ring-2 { inset: 16%; animation: spin 12s linear infinite reverse; border-left-color: rgba(255,61,187,.6); }
.ring-3 { inset: 30%; animation: spin 8s linear infinite; border-bottom-color: rgba(255,209,102,.7); }
@keyframes spin { to { transform: rotate(360deg); } }
.disc-label { font-family: var(--font-display); font-size: 84px; color: rgba(69,240,255,.9); text-shadow: 0 0 36px rgba(69,240,255,.7); }
.float-note {
  position: absolute; font-family: var(--font-mono); font-size: 10px; letter-spacing: .2em;
  padding: 7px 12px; border-radius: 999px; background: rgba(8,10,22,.85);
  box-shadow: inset 0 0 0 1px currentColor, 0 0 20px rgba(0,0,0,.4);
  animation: floaty 5s ease-in-out infinite;
}
.float-note.note-tap { top: 8%; right: 4%; color: var(--cyan); }
.float-note.note-hold { bottom: 14%; left: 0; color: var(--blue); animation-delay: -1.4s; }
.float-note.note-flick { top: 26%; left: 2%; color: var(--red); animation-delay: -2.6s; }
.float-note.note-drag { bottom: 4%; right: 10%; color: var(--yellow); animation-delay: -3.6s; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* ---------- library ---------- */
.library { padding-top: 26px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-head h2 { font-family: var(--font-display); font-size: clamp(26px, 3vw, 38px); letter-spacing: .02em; }
.count { font-family: var(--font-mono); font-size: 13px; color: var(--cyan); vertical-align: 6px; margin-left: 10px; letter-spacing: .1em; }
.section-tools { display: flex; gap: 10px; }

.song-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.song-card {
  position: relative; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .22s ease, box-shadow .25s ease;
  isolation: isolate;
}
.song-card:hover { transform: translateY(-6px); box-shadow: inset 0 0 0 1px rgba(69,240,255,.35), 0 22px 50px rgba(0,0,0,.55), 0 0 40px rgba(25,210,255,.1); }
.song-cover { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #0a0c18; }
.song-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease, filter .4s ease; filter: saturate(.92) brightness(.9); }
.song-card:hover .song-cover img { transform: scale(1.06); filter: saturate(1.1) brightness(1); }
.song-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(7,8,16,.96) 0%, rgba(7,8,16,.25) 46%, transparent 70%); }
.song-level {
  position: absolute; top: 12px; right: 12px; z-index: 2; font-family: var(--font-display);
  font-size: 18px; padding: 4px 12px; border-radius: 9px; background: rgba(5,8,16,.78);
  box-shadow: inset 0 0 0 1px currentColor; color: var(--cyan);
}
.song-badge-import {
  position: absolute; top: 12px; left: 12px; z-index: 2; font-family: var(--font-mono); font-size: 9px;
  letter-spacing: .18em; padding: 5px 9px; border-radius: 6px; color: #061018;
  background: linear-gradient(120deg, #b6ff6b, #45f0ff); font-weight: 700;
}
.song-meta { position: relative; z-index: 2; padding: 0 18px 18px; margin-top: -44px; }
.song-title { font-size: 17px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-sub { color: var(--muted); font-size: 11px; margin-top: 5px; width: 76%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.best-score { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); letter-spacing: .06em; }
.best-score b { color: var(--cyan); font-size: 13px; margin-left: 6px; }
.play-pill { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #041014;
  background: var(--cyan); box-shadow: 0 0 0 4px rgba(69,240,255,.12), 0 6px 18px rgba(20,220,255,.25); font-size: 11px; }
.song-card:hover .play-pill { box-shadow: 0 0 0 6px rgba(69,240,255,.18), 0 8px 26px rgba(20,220,255,.4); }
.song-progress { position: absolute; left: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--cyan), var(--magenta)); width: 0; z-index: 3; transition: width .4s ease; }
.empty-hint { padding: 48px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- info strip ---------- */
.info-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 64px 0 20px; }
.info-card { padding: 26px; border-radius: var(--radius); background: linear-gradient(160deg, rgba(18,22,42,.7), rgba(9,10,20,.7)); box-shadow: inset 0 0 0 1px var(--line); }
.info-index { font-family: var(--font-mono); font-size: 11px; color: var(--cyan); letter-spacing: .2em; }
.info-card h3 { font-size: 16px; margin: 14px 0 8px; }
.info-card p { color: var(--muted); font-size: 13px; line-height: 1.8; }
.footer { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 38px 0 26px; color: var(--muted-2); font-size: 11px; border-top: 1px solid var(--line); margin-top: 40px; }
.footer-links { display: flex; gap: 10px; align-items: center; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,3,8,.72); backdrop-filter: blur(10px); animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative; width: min(560px, 100%); max-height: min(86vh, 760px); overflow: auto;
  background: linear-gradient(170deg, #111528, #0a0b15 70%);
  border-radius: 20px; box-shadow: 0 0 0 1px rgba(120,160,255,.18), 0 40px 100px rgba(0,0,0,.7);
  animation: modalIn .3s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 26px 28px 10px; }
.modal-head h2 { font-family: var(--font-display); font-size: 24px; letter-spacing: .03em; max-width: 440px; }
.icon-btn { border: 0; background: rgba(120,150,255,.08); color: var(--muted); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.icon-btn:hover { color: #fff; background: rgba(120,150,255,.18); }
.modal-body { padding: 18px 28px; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 28px 24px; }
.hint { color: var(--muted-2); font-size: 11px; line-height: 1.6; }
.settings-body { display: flex; flex-direction: column; gap: 8px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-label b { display: block; font-size: 14px; }
.setting-label span { color: var(--muted-2); font-size: 11px; }
.setting-control { display: flex; align-items: center; gap: 14px; min-width: 220px; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(69,240,255,.65), rgba(139,92,255,.45)); outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #e9ffff; box-shadow: 0 0 0 4px rgba(69,240,255,.2), 0 0 12px rgba(69,240,255,.6); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #e9ffff; box-shadow: 0 0 0 4px rgba(69,240,255,.2); }
output { min-width: 42px; text-align: right; font-family: var(--font-mono); color: var(--cyan); font-size: 13px; }
.switch { position: relative; width: 46px; height: 26px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(120,140,200,.2); box-shadow: inset 0 0 0 1px var(--line); transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #8d94b3; top: 4px; left: 4px; transition: .2s; }
.switch input:checked + span { background: rgba(69,240,255,.35); box-shadow: inset 0 0 0 1px rgba(69,240,255,.55); }
.switch input:checked + span::after { transform: translateX(20px); background: #eaffff; box-shadow: 0 0 12px var(--cyan); }

/* detail modal */
.detail-card { width: min(720px, 100%); }
.detail-body { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.detail-cover-wrap { position: relative; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--line), 0 20px 50px rgba(0,0,0,.5); aspect-ratio: 3/4; background: #080a14; }
.detail-cover-wrap img { width: 100%; height: 100%; object-fit: cover; }
.detail-level { position: absolute; bottom: 10px; right: 10px; font-family: var(--font-display); font-size: 22px; padding: 3px 12px; border-radius: 8px; background: rgba(4,7,14,.8); color: var(--cyan); box-shadow: inset 0 0 0 1px currentColor; }
.detail-info { min-width: 0; }
.detail-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.detail-rows div { display: flex; flex-direction: column; gap: 5px; }
.detail-rows span { color: var(--muted-2); font-size: 10px; letter-spacing: .16em; }
.detail-rows b { font-size: 14px; font-weight: 600; color: #dfe6ff; word-break: break-all; }
.detail-diff { margin-top: 26px; }
.diff-chip { display: inline-block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; color: var(--cyan); margin-bottom: 10px; }
.diff-bar { height: 6px; border-radius: 999px; background: rgba(120,140,200,.15); overflow: hidden; }
.diff-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #45f0ff, #8b5cff, #ff3dbb); box-shadow: 0 0 14px rgba(69,240,255,.4); transition: width .6s ease; }
.detail-foot { align-items: center; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* help */
.help-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; background: rgba(120,150,255,.045); box-shadow: inset 0 0 0 1px var(--line); }
.help-item.wide { grid-column: 1 / -1; }
.help-item p { color: var(--muted); font-size: 12px; line-height: 1.65; margin-top: 3px; }
.help-item b { font-size: 13px; }
.note-dot { width: 14px; height: 14px; border-radius: 4px; margin-top: 3px; flex: 0 0 auto; box-shadow: 0 0 12px currentColor; }
.note-dot.tap { background: var(--cyan); color: var(--cyan); }
.note-dot.drag { background: var(--yellow); color: var(--yellow); border-radius: 999px; }
.note-dot.hold { background: var(--blue); color: var(--blue); }
.note-dot.flick { background: var(--red); color: var(--red); transform: rotate(45deg); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 34px; z-index: 120; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 13px 22px; border-radius: 12px; background: rgba(10, 14, 28, .94); color: #e9f6ff; font-size: 13px;
  box-shadow: inset 0 0 0 1px rgba(69,240,255,.3), 0 14px 40px rgba(0,0,0,.5); transition: .3s; max-width: min(86vw, 520px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { box-shadow: inset 0 0 0 1px rgba(255,70,110,.5), 0 14px 40px rgba(0,0,0,.5); color: #ffc6d2; }

/* ---------- game overlays ---------- */
.game-screen { align-items: center; justify-content: center; }
.overlay { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(3, 4, 10, .72); backdrop-filter: blur(10px); animation: fadeIn .2s ease; }
.overlay[hidden] { display: none; }
.rotate-hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 55; color: rgba(180,195,230,.42); font-size: 10px; letter-spacing: .18em; pointer-events: none; }
.game-pause-btn {
  position: absolute; top: 22px; right: 24px; z-index: 56; width: 42px; height: 42px; border-radius: 12px;
  border: 0; cursor: pointer; color: #cfeaff; font-size: 11px; letter-spacing: .08em;
  background: rgba(8, 12, 24, .62); box-shadow: inset 0 0 0 1px rgba(120, 180, 255, .28), 0 6px 18px rgba(0,0,0,.35);
  backdrop-filter: blur(6px); transition: .2s;
}
.game-pause-btn:hover { background: rgba(30, 60, 110, .7); box-shadow: inset 0 0 0 1px rgba(69,240,255,.5), 0 0 18px rgba(69,240,255,.25); }

.loader { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.loader-ring { width: 56px; height: 56px; border-radius: 50%; border: 2px solid rgba(69,240,255,.18); border-top-color: var(--cyan); animation: spin 1s linear infinite; box-shadow: 0 0 30px rgba(69,240,255,.2); }
#loading-text { color: var(--muted); font-size: 12px; letter-spacing: .18em; }

.panel { width: min(460px, 92vw); padding: 34px; border-radius: 20px; background: linear-gradient(170deg, rgba(17,21,40,.97), rgba(8,9,18,.97)); box-shadow: 0 0 0 1px rgba(120,160,255,.22), 0 40px 90px rgba(0,0,0,.7); text-align: center; }
.panel h2 { font-family: var(--font-display); font-size: 34px; letter-spacing: .1em; margin-bottom: 24px; }
.pause-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.pause-actions .btn { width: 100%; }
.pause-options { display: flex; flex-direction: column; gap: 14px; padding-top: 20px; border-top: 1px solid var(--line); }
.pause-options label { display: grid; grid-template-columns: 60px 1fr 44px; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); text-align: left; }
.pause-options output { color: var(--cyan); font-family: var(--font-mono); }
.panel .hint { margin-top: 20px; display: block; }

.result-overlay { background: radial-gradient(120% 100% at 50% 0%, rgba(15, 26, 52, .92), rgba(3, 4, 10, .96)); }
.result-wrap { width: min(900px, 92vw); display: grid; grid-template-columns: .9fr 1.1fr; gap: 40px; padding: 38px; border-radius: 24px; background: rgba(9, 11, 22, .6); box-shadow: inset 0 0 0 1px rgba(120,160,255,.2), 0 40px 100px rgba(0,0,0,.6); }
.result-left { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; border-radius: 18px; background: radial-gradient(circle at 50% 30%, rgba(69,240,255,.12), transparent 70%); }
.grade { font-family: var(--font-display); font-size: clamp(90px, 13vw, 150px); line-height: 1; color: var(--cyan); text-shadow: 0 0 60px rgba(69,240,255,.55); animation: gradePop .6s cubic-bezier(.2,.9,.3,1.4); }
@keyframes gradePop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.grade.grade-phi { background: linear-gradient(160deg, #fff, #45f0ff 45%, #ff3dbb); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px rgba(69,240,255,.5)); }
.grade.grade-s { color: #ffd166; text-shadow: 0 0 60px rgba(255,209,102,.5); }
.grade.grade-a { color: #8bff9d; text-shadow: 0 0 50px rgba(139,255,157,.45); }
.grade.grade-b { color: #7dc4ff; }
.grade.grade-c { color: #b9a4ff; }
.grade.grade-d { color: #ff7b93; }
.result-title { font-size: 18px; font-weight: 700; margin-top: 18px; text-align: center; }
.result-sub { color: var(--muted); font-size: 12px; margin-top: 6px; text-align: center; }
.result-right { display: flex; flex-direction: column; justify-content: center; }
.score-line { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.score-line span { color: var(--muted-2); font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; }
.score-line b { font-family: var(--font-display); font-size: clamp(34px, 5vw, 54px); color: #fff; letter-spacing: .04em; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.stat-grid div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 9px; border-bottom: 1px dashed rgba(120,140,200,.15); }
.stat-grid span { color: var(--muted-2); font-size: 10px; letter-spacing: .14em; }
.stat-grid b { font-family: var(--font-mono); font-size: 16px; color: #dfe6ff; }
.stat-grid .great b { color: var(--cyan); }
.stat-grid .good b { color: var(--yellow); }
.stat-grid .bad b { color: #ff9e6b; }
.stat-grid .miss b { color: var(--red); }
.result-actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-visual { display: none; }
  .detail-body { grid-template-columns: 200px 1fr; }
  .result-wrap { grid-template-columns: 1fr; gap: 20px; padding: 26px; }
  .result-left { padding: 14px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .topbar { height: 60px; padding: 0 16px; gap: 12px; }
  .topbar-meta { display: none; }
  .topnav { margin-left: auto; }
  .nav-btn { padding: 8px 10px; font-size: 11px; }
  .brand-text { font-size: 14px; }
  main#home { padding: 88px 16px 30px; }
  .hero-actions .btn { flex: 1; }
  .hero-stats { gap: 24px; margin-top: 30px; }
  .info-strip { grid-template-columns: 1fr; margin-top: 40px; }
  .song-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
  .detail-body { grid-template-columns: 1fr; }
  .detail-cover-wrap { max-width: 220px; }
  .help-body { grid-template-columns: 1fr; }
  .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .result-right .stat-grid { grid-template-columns: 1fr 1fr; }
  .setting-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .setting-control { width: 100%; }
}
@media (max-width: 480px) {
  .hero h1 { font-size: 46px; }
  .hero-sub { font-size: 13px; }
  .song-grid { grid-template-columns: 1fr; }
  .result-actions .btn { flex: 1; }
  .pause-options label { grid-template-columns: 52px 1fr 38px; }
}
