* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #020205;
  color: #e8e8ff;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
canvas { display: block; width: 100vw; height: 100vh; }

.overlay {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: rgba(2, 2, 8, 0.55);
  animation: fade .35s ease-out;
}
.hidden { display: none !important; }
@keyframes fade { from { opacity: 0; } }

.panel { text-align: center; padding: 32px 40px; max-width: 560px; }
h1 {
  font-size: clamp(64px, 14vw, 120px); margin: 0; letter-spacing: .18em; font-weight: 900;
  background: linear-gradient(90deg, #5ef2ff, #ff4fd8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: beat .5s infinite;
}
@keyframes beat { 0% { transform: scale(1.03); } 30%, 100% { transform: scale(1); } }
h2 { font-size: 34px; letter-spacing: .12em; margin: 0 0 22px; color: #5ef2ff; }
.tag { font-size: 17px; color: #a8a8c8; margin: 8px 0 30px; }
.tag em { color: #ff4fd8; font-style: normal; }
.hint { font-size: 13px; color: #7a7a98; margin-top: 18px; line-height: 1.5; }

.btn {
  font: inherit; font-size: 16px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: #05050c; background: #5ef2ff; border: 0; border-radius: 6px;
  padding: 12px 30px; cursor: pointer; margin: 4px;
  box-shadow: 0 0 24px rgba(94, 242, 255, .35);
}
.btn:hover { background: #8ff6ff; }
.btn.ghost { background: transparent; color: #5ef2ff; box-shadow: inset 0 0 0 2px #5ef2ff; }
.row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 20px; margin-top: 28px; font-size: 13px; color: #a8a8c8; }
kbd {
  display: inline-block; min-width: 22px; padding: 2px 6px; margin-right: 4px;
  border: 1px solid #3a3a58; border-bottom-width: 2px; border-radius: 4px;
  font: inherit; font-size: 12px; color: #e8e8ff;
}

.calib { margin-top: 24px; font-size: 14px; color: #a8a8c8; display: flex; align-items: center; justify-content: center; gap: 10px; }
.calib span { min-width: 64px; color: #e8e8ff; font-weight: 700; }
.mini {
  font: inherit; font-size: 16px; width: 30px; height: 30px; border-radius: 4px;
  background: transparent; color: #e8e8ff; border: 1px solid #3a3a58; cursor: pointer;
}

#resultBody { display: grid; gap: 14px; text-align: left; min-width: 300px; }
.group { border-top: 1px solid #23233a; padding-top: 10px; }
.group h3 { margin: 0 0 6px; font-size: 12px; color: #7a7a98; letter-spacing: .12em; text-transform: uppercase; }
.r { display: flex; justify-content: space-between; gap: 40px; font-size: 15px; padding: 2px 0; }
.r b { font-weight: 800; }
.r small { color: #7a7a98; font-weight: 400; margin-left: 6px; }
.r.perfect b { color: #5ef2ff; }
.r.great b { color: #8dff8a; }
.r.good b { color: #ffc44d; }
.r.off b { color: #7a7a98; }
.overall { border-top: 1px solid #23233a; padding-top: 14px; display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; }
.overall b { font-size: 44px; color: #ff4fd8; }

#touch {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; padding: 16px max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
}
#touch .pad { display: flex; gap: 12px; pointer-events: auto; }
#touch button {
  font: inherit; font-weight: 800; font-size: 15px; width: 76px; height: 76px; border-radius: 50%;
  background: rgba(94, 242, 255, .1); color: #e8e8ff; border: 2px solid rgba(94, 242, 255, .45);
  touch-action: none;
}
#touch button:active { background: rgba(94, 242, 255, .35); }

#tracks { display: grid; gap: 8px; width: min(440px, 86vw); margin: 0 auto; }
.track {
  --c: hsl(var(--hue), 100%, 62%);
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px;
  font: inherit; text-align: left; color: #e8e8ff; cursor: pointer;
  background: rgba(255, 255, 255, .03); border: 1px solid #23233a; border-radius: 8px;
  padding: 10px 14px;
}
.track .no { color: #7a7a98; font-weight: 700; }
.track .name { font-size: 16px; font-weight: 800; letter-spacing: .04em; }
.track small { display: block; font-size: 11px; font-weight: 500; color: #7a7a98; letter-spacing: 0; margin-top: 2px; }
.track .best { font-size: 18px; font-weight: 900; color: #7a7a98; }
.track.sel { border-color: var(--c); background: hsla(var(--hue), 100%, 60%, .1); box-shadow: 0 0 20px hsla(var(--hue), 100%, 60%, .2); }
.track.sel .no, .track.sel .best { color: var(--c); }
#resultTitle { text-transform: uppercase; }
@media (max-height: 640px) {
  h1 { font-size: 56px; }
  .tag { margin-bottom: 16px; }
  .controls { margin-top: 16px; }
}

.link {
  font: inherit; font-size: 13px; color: #7a7a98; background: none; border: 0;
  margin-top: 12px; cursor: pointer; text-decoration: underline dotted;
}
.link:hover { color: #e8e8ff; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 10px 0; }
.dots i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid #3a3a58; }
.dots i.on { background: #5ef2ff; border-color: #5ef2ff; box-shadow: 0 0 10px rgba(94, 242, 255, .5); }
#calResult { min-height: 1.5em; font-size: 15px; color: #e8e8ff; }
