* { box-sizing: border-box; }
:root { --accent: #4c6ef5; --accent2: #15aabf; --ink: #1b1f3b; --muted: #6b7091; --line: #e0e5f5; --good: #0aa86e; --bad: #e0435a; --gr-accent: #4c6ef5; }
html, body { margin: 0; color: var(--ink); font-family: Pretendard, "Noto Sans KR", system-ui, "Malgun Gothic", sans-serif; }
body { min-height: 100vh; background: radial-gradient(circle at 15% 0%, #e3ecff, transparent 50%), radial-gradient(circle at 90% 30%, #dff7fb, transparent 45%), #f5f7ff; }
button { font: inherit; cursor: pointer; color: inherit; }
[hidden] { display: none !important; }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.bar a { color: var(--ink); text-decoration: none; font-weight: 800; white-space: nowrap; }
.bar button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 12px; white-space: nowrap; }

.shell { max-width: 640px; margin: 0 auto; padding: 20px 16px 48px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 26px; padding: 26px 22px; text-align: center; box-shadow: 0 16px 40px #4c6ef51c; }
h1 { margin: 4px 0 8px; font-size: clamp(28px, 7vw, 38px); }
.lead { color: var(--muted); line-height: 1.6; }
.small { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 0; }
.pick-title { margin: 18px 0 8px; font-size: 16px; color: var(--muted); }

.song-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; text-align: left; }
.song-btn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 16px; background: #fff; text-align: left; }
.song-btn .emo { font-size: 26px; }
.song-btn b { display: block; }
.song-btn small { color: var(--muted); }
.song-btn[aria-pressed="true"] { border-color: var(--accent); background: #eef2ff; }

.kind-row { display: inline-flex; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; }
.diff-btn { border: 0; background: transparent; border-radius: 10px; padding: 8px 16px; font-weight: 800; color: var(--muted); }
.diff-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.best-line { min-height: 1.6em; margin: 10px 0 6px; font-weight: 800; }
.board-btn { margin-bottom: 14px; font-size: 14px; }

.primary { border: 0; border-radius: 14px; padding: 12px 20px; font-weight: 900; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.primary.big { display: block; width: 100%; max-width: 320px; margin: 0 auto; padding: 15px; font-size: 19px; }
.ghost { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 9px 16px; font-weight: 800; }

/* 연주 화면 */
.play { user-select: none; -webkit-user-select: none; }
.hud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pill { padding: 5px 12px; border-radius: 999px; background: #eef2ff; color: var(--accent); font-weight: 900; }
.score { font-weight: 900; font-size: 20px; font-variant-numeric: tabular-nums; }
.progress { height: 6px; border-radius: 99px; background: #e6eafa; overflow: hidden; margin-bottom: 8px; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.stage { position: relative; }
#stage { display: block; width: 100%; height: min(56vh, 480px); border-radius: 18px 18px 0 0; background: #141833; touch-action: none; }
.pause-card { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; text-align: center; background: #141833cc; border-radius: 18px 18px 0 0; color: #fff; font-weight: 900; font-size: 20px; }

.keys { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; padding: 4px; background: #141833; border-radius: 0 0 18px 18px; touch-action: none; }
.pkey { height: 110px; border: 0; border-radius: 0 0 10px 10px; background: linear-gradient(#fff 70%, #e8ebf5); box-shadow: inset 0 -6px 0 #cfd5ea; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 12px; gap: 2px; touch-action: none; -webkit-tap-highlight-color: transparent; }
.pkey b { font-size: 15px; }
.pkey small { color: var(--muted); font-size: 12px; font-weight: 800; }
.pkey.down { background: linear-gradient(var(--lane), #fff); box-shadow: inset 0 -2px 0 #cfd5ea; transform: translateY(2px); }
.play-tools { display: flex; justify-content: center; margin-top: 12px; }

/* 결과 */
.grade { margin: 0; font-size: 72px; font-weight: 900; line-height: 1; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.final { margin: 6px 0; font-size: 22px; }
.final b { font-size: 48px; color: var(--accent); font-variant-numeric: tabular-nums; }
.counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; }
.counts li { padding: 10px 4px; border-radius: 12px; background: #f5f7ff; font-size: 13px; font-weight: 800; color: var(--muted); }
.counts b { display: block; font-size: 22px; color: var(--ink); }
.counts .perfect b { color: #f59f00; }
.counts .great b { color: var(--good); }
.counts .good b { color: var(--accent); }
.counts .miss b { color: var(--bad); }
.end-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.end-actions button:not(.primary) { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 18px; font-weight: 800; }

@media (max-width: 480px) {
  .shell { padding: 12px 8px 32px; }
  .pkey { height: 92px; }
  .pkey b { font-size: 13px; }
  .pkey small { display: none; }
}
@media (pointer: coarse) { .pkey small { display: none; } }
