:root {
  --night: #0a0d0c;
  --fg: #e6ebe9;
  --dim: #8a9591;
  --mute: #4d5754;
  --pin: #2dd4bf;
  --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--night);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
}

canvas { position: fixed; inset: 0; display: block; }

.hidden { display: none !important; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: var(--dim);
}

#hud {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 18px);
  left: 0; right: 0;
  text-align: center;
  pointer-events: none;
}
#score {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 300;
  color: var(--fg);
}
#score.bump { animation: bump 0.25s ease-out; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 18vh 24px 24px;
  text-align: center;
  pointer-events: none;
  animation: fadeIn 0.5s ease-out both;
}
.screen > * { animation: scaleIn 0.5s ease-out both; }
.screen > *:nth-child(2) { animation-delay: 0.05s; }
.screen > *:nth-child(3) { animation-delay: 0.1s; }
.screen > *:nth-child(4) { animation-delay: 0.15s; }
.screen > *:nth-child(5) { animation-delay: 0.2s; }
.screen > *:nth-child(6) { animation-delay: 0.25s; }

h1 {
  font-size: clamp(3rem, 16vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}
.how { color: var(--fg); line-height: 1.5; font-size: 1.05rem; margin-top: 6px; }
.hint { color: var(--dim); font-size: 0.85rem; }
.tap {
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--pin);
  animation: breathe 2.4s ease-in-out infinite !important;
}
.best span { color: var(--fg); }
.final {
  font-family: var(--mono);
  font-size: clamp(4rem, 22vw, 7rem);
  font-weight: 300;
  line-height: 1;
}

.modes { display: flex; gap: 6px; margin-top: 18px; }
.modes button, #share {
  pointer-events: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: var(--dim);
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 8px 10px;
  cursor: pointer;
}
.modes button.on { color: var(--fg); border-bottom-color: var(--pin); }
.modes button:hover, #share:hover { color: var(--pin); }
#share { margin-top: 4px; border-bottom-color: var(--mute); }

#mute, #home {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 16px);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--mute);
  background: none;
  border: 0;
  padding: 8px;
  text-decoration: none;
  cursor: pointer;
}
#mute { right: calc(env(safe-area-inset-right) + 10px); }
#home { left: calc(env(safe-area-inset-left) + 10px); }
#mute:hover, #home:hover { color: var(--pin); }
body.playing #home { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes bump { 0% { transform: scale(1.35); color: var(--pin); } 100% { transform: scale(1); } }
