:root {
  --bg: #07080d;
  --ink: #eef1f8;
  --dim: #8d93a8;
  --panel: rgba(16, 19, 32, 0.94);
  --line: rgba(255, 255, 255, 0.1);
  --accent: #5ad1ff;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden; overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
canvas#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }

button {
  font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 18px; cursor: pointer; min-height: 46px;
}
button:hover { background: rgba(255, 255, 255, 0.12); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: #061018; border-color: transparent; font-weight: 700; }
button.big { font-size: 20px; padding: 14px 28px; min-width: 200px; }
button.icon { min-width: 46px; padding: 0; }
button.danger { color: #ff8fa0; margin-top: 18px; }
button:disabled { opacity: 0.4; cursor: default; }

.screen { position: fixed; inset: 0; display: flex; justify-content: center; overflow-y: auto; touch-action: pan-y; z-index: 5; background: var(--bg); }
.screen.overlay { background: rgba(7, 8, 13, 0.72); align-items: center; }
.panel { width: 100%; max-width: 460px; padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.panel.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; min-height: 100%; }
.overlay .panel.center { min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; max-width: 360px; margin: 16px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
h2 { margin: 0; font-size: 22px; }
.fine { color: var(--dim); font-size: 14px; margin: 0; }
.tag { color: var(--dim); font-size: 17px; margin: 0 0 18px; }

.logo { display: flex; flex-direction: column; font-weight: 900; font-size: 64px; line-height: 0.95; letter-spacing: -2px; margin-bottom: 8px; }
.logo span:first-child { color: #fff; }
.logo span:last-child { background: linear-gradient(90deg, #7cf3c4, #5ad1ff, #ff7ab8, #ffb347); -webkit-background-clip: text; background-clip: text; color: transparent; }

.bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bar .back { min-width: 46px; padding: 0; font-size: 26px; }
.bar span { width: 46px; }

.song { border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-bottom: 12px; background: rgba(255, 255, 255, 0.03); border-left: 4px solid var(--c); }
.song h3 { margin: 0; font-size: 19px; }
.song .meta { color: var(--dim); font-size: 13px; margin: 2px 0 10px; }
.song .charts { display: flex; gap: 8px; }
.song .charts button { flex: 1; display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 10px 12px; }
.song .charts button b { font-size: 16px; }
.song .charts button small { color: var(--dim); font-size: 12px; }
.song .charts button.locked small { color: #9aa0b4; }
.song.end { border-left-color: var(--line); color: var(--dim); text-align: center; font-size: 14px; }

.set { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 4px; font-size: 15px; text-align: left; width: 100%; }
.set.check { flex-direction: row; align-items: center; gap: 10px; }
.set .val { color: var(--dim); font-size: 13px; }
.set input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }
.set input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); }
#settings button { margin-top: 8px; }

.grade { font-size: 96px; font-weight: 900; line-height: 1; color: var(--accent); }
.grade.small { font-size: 64px; }
.acc { font-size: 26px; font-weight: 700; }
.best { min-height: 22px; color: #ffd36b; font-weight: 700; font-size: 15px; }
.stats { display: flex; gap: 28px; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 20px; }
.stats span { color: var(--dim); font-size: 12px; }
.strip { display: flex; gap: 4px; width: 100%; margin-top: 8px; }
.strip button { flex: 1; min-width: 0; padding: 0; min-height: 64px; border-radius: 10px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; font-size: 11px; background: rgba(255, 255, 255, 0.05); }
.strip button .fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--g); opacity: 0.85; }
.strip button .lbl { position: relative; font-weight: 800; font-size: 15px; color: #fff; text-shadow: 0 1px 2px #000; }
.strip button .pc { position: relative; color: #fff; text-shadow: 0 1px 2px #000; padding-bottom: 4px; }
.strip button.clean { border: 2px solid #fff; }
.strip button.rough .fill { background: repeating-linear-gradient(135deg, var(--g) 0 6px, transparent 6px 10px); }
.unlock { color: #7cf3c4; font-weight: 600; margin: 0; min-height: 0; }

#hud { position: fixed; left: 0; right: 0; top: 0; z-index: 3; pointer-events: none; }
.hud-in { max-width: min(100vw, 62vh, 560px); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: max(8px, env(safe-area-inset-top)) 10px 0; gap: 8px; }
.hud-l { display: flex; flex-direction: column; line-height: 1.1; min-width: 90px; }
.hud-l b { font-size: 18px; font-variant-numeric: tabular-nums; }
.hud-l span { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.hud-c { color: var(--dim); font-size: 13px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pauseBtn { pointer-events: auto; background: rgba(255, 255, 255, 0.08); }
.prog { max-width: min(100vw, 62vh, 560px); margin: 6px auto 0; height: 3px; background: rgba(255, 255, 255, 0.07); }
#progFill { height: 100%; width: 0; background: var(--accent); }

#calib { align-items: flex-start; background: transparent; pointer-events: none; }
.calib-top { pointer-events: auto; width: 100%; max-width: 420px; margin: max(12px, env(safe-area-inset-top)) 12px 0; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; text-align: center; }
.calib-top p { color: var(--dim); font-size: 14px; margin: 6px 0; }
#title { background: rgba(7, 8, 13, 0.45); }
#select, #settings, #results { background: rgba(7, 8, 13, 0.88); }
