* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1d2b4a; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #fff; user-select: none; -webkit-user-select: none; touch-action: none;
  overscroll-behavior: none;
}
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; }
[hidden] { display: none !important; }

.hud {
  position: fixed; left: 0; right: 0; top: 0;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 0;
  display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none;
}
.dist { font-weight: 900; font-size: 44px; line-height: 1; letter-spacing: -1px; text-shadow: 0 2px 0 rgba(0,0,0,.18); font-variant-numeric: tabular-nums; }
.dist small { font-size: 20px; font-weight: 800; margin-left: 3px; opacity: .8; }
.right { display: flex; gap: 10px; align-items: center; pointer-events: auto; }
.coins {
  display: flex; align-items: center; gap: 7px; background: rgba(0,0,0,.25); border-radius: 999px;
  padding: 7px 12px 7px 9px; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums;
}
.coin-dot { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff4b0, #ffc928 55%, #d99a00); box-shadow: 0 0 0 2px rgba(0,0,0,.12); }
.icon { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.25); color: #fff; display: grid; place-items: center; cursor: pointer; }

.hint {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 28px); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center;
  font-size: 15px; font-weight: 600; color: rgba(255,255,255,.92); pointer-events: none; width: 92%;
  transition: opacity .6s;
}
.hint span { background: rgba(0,0,0,.28); padding: 6px 12px; border-radius: 999px; }
.hint.fade { opacity: 0; }

.card {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(88vw, 360px); padding: 26px 22px 22px; border-radius: 26px;
  background: rgba(255,255,255,.96); color: #17213a; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.28); animation: pop .28s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop { from { transform: translate(-50%, -46%) scale(.94); opacity: 0; } }
.card h1 { margin: 6px 0 4px; font-size: 40px; font-weight: 900; letter-spacing: -1.5px; line-height: 1; }
.card h2 { margin: 0 0 12px; font-size: 30px; font-weight: 900; letter-spacing: -1px; }
.sub { margin: 0 0 16px; color: #56607a; font-size: 16px; }
.back { position: absolute; left: 16px; top: 14px; color: #56607a; text-decoration: none; font-weight: 700; font-size: 15px; }
.demo { display: grid; gap: 8px; margin: 0 0 16px; text-align: left; }
.how { display: flex; gap: 12px; align-items: center; font-weight: 600; font-size: 15px; }
.k { width: 34px; height: 34px; border-radius: 10px; background: #eef1f7; display: grid; place-items: center; font-weight: 900; color: #2f6df6; flex: none; }
.best { margin: 0 0 12px; color: #56607a; }
.go, .ghost, .mute {
  display: block; width: 100%; border: 0; border-radius: 16px; padding: 15px; font: inherit; font-size: 19px;
  font-weight: 900; cursor: pointer; text-decoration: none; touch-action: manipulation;
}
.go { background: #2f6df6; color: #fff; box-shadow: 0 5px 0 #1d4fc4; }
.go:active { transform: translateY(3px); box-shadow: 0 2px 0 #1d4fc4; }
.ghost { margin-top: 10px; background: #eef1f7; color: #17213a; }
.mute { margin-top: 10px; background: none; color: #56607a; font-size: 15px; font-weight: 700; padding: 8px; }
.newbest { margin: -4px 0 10px; color: #e08a00; font-weight: 900; font-size: 18px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.stats div { background: #eef1f7; border-radius: 14px; padding: 10px 4px; }
.stats small { display: block; color: #56607a; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stats b { font-size: 24px; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }

.lvlbox { display: flex; flex-direction: column; gap: 6px; }
.score { font-weight: 900; font-size: 44px; line-height: 1; letter-spacing: -1px; font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.prog { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.track { width: 110px; height: 8px; border-radius: 99px; background: rgba(255,255,255,.2); overflow: hidden; }
.bar { height: 100%; width: 0; background: #fff; border-radius: 99px; transition: width .25s; }
.go { background: #12b886; box-shadow: 0 5px 0 #0b8a64; }
.go:active { box-shadow: 0 2px 0 #0b8a64; }
.k { color: #12b886; }
