*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: #0a0a12;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

canvas#c {
  display: block;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

/* ── Corner buttons ── */
.corner-btn {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 50%;
  width: 44px; height: 44px;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  z-index: 20;
}
.corner-btn:hover { background: rgba(255,255,255,0.16); }
.corner-btn.left  { left:  calc(16px + env(safe-area-inset-left)); }
.corner-btn.right { right: calc(16px + env(safe-area-inset-right)); }

/* ── Give-up button (bottom-center, shown only during flight) ── */
#giveup-btn {
  position: fixed;
  bottom: calc(40px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  z-index: 20;
  transition: background 0.2s;
}
#giveup-btn:hover { background: rgba(255,255,255,0.18); }
#giveup-btn .key-badge {
  position: absolute;
  top: -6px; right: -6px;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  font: 700 11px/20px system-ui, sans-serif;
  text-align: center;
  letter-spacing: 0.5px;
  pointer-events: none;
}

/* ── HUD ── */
#hud {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%; transform: translateX(-50%);
  text-align: center;
  z-index: 10;
  pointer-events: none;
}
#hud-score {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2px;
  text-shadow: 0 0 40px rgba(120,200,255,0.5);
  display: inline-block;
  transition: transform 0.1s;
}
#hud-best {
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.35);
  margin-top: 2px;
  text-transform: uppercase;
}

/* ── Combo flash ── */
#combo-flash {
  position: fixed;
  bottom: 15%;
  left: 50%; transform: translateX(-50%);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  z-index: 15;
  text-shadow: 0 0 20px currentColor;
  white-space: nowrap;
  transition: transform 0.1s ease-out;
}

/* ── Screens ── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  background: rgba(10, 10, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.screen.hidden { display: none; }

.screen-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 32px;
  max-width: 380px;
  width: 100%;
}

/* ── Start screen ── */
.start-inner { gap: 8px; }

.logo-img {
  max-width: min(260px, 72vw);
  height: auto;
}

.logo {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: 6px;
  background: linear-gradient(135deg, #64e8ff, #a78bfa, #ff6eb4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  margin-bottom: 4px;
}
.tagline {
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 6px;
  color: rgba(255,255,255,0.4);
}
.sub-tagline {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.3);
}
#start-stats {
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.35);
  margin-top: 12px;
  min-height: 18px;
}
.tap-hint {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.6);
  margin-top: 16px;
  animation: pulse 2s ease-in-out infinite;
}
#skin-picker {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}
.skin-btn {
  padding: 6px 14px;
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
}
.skin-btn.active {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.9);
  color: #fff;
}
.skin-btn[disabled],
.skin-btn.locked {
  opacity: 0.4;
  cursor: not-allowed;
  color: rgba(255,255,255,0.4);
  border-color: rgba(255,255,255,0.15);
}
.dir-hint {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.3);
  margin-top: 10px;
}
@keyframes pulse {
  0%,100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* ── Overlay headings ── */
.overlay-heading {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 6px;
  color: rgba(255,255,255,0.9);
  margin-bottom: 8px;
}

/* ── Pause screen ── */
.pause-score-label {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.4);
}
#pause-score {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}

/* ── Game Over screen ── */
.go-title {
  font-size: 24px;
  font-weight: 300;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
}
#go-score {
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2px;
  background: linear-gradient(135deg, #64e8ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#go-jumps {
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.35);
  margin-top: -4px;
}
#go-newbest {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #64e8ff;
}
#go-newbest.hidden { display: none; }

#trail-canvas {
  border-radius: 50%;
  margin: 6px 0;
  opacity: 0.9;
  background: rgba(255,255,255,0.03);
}

#go-stats {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border-radius: 14px;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.stat-label {
  font-weight: 300;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
}
.stat-val {
  font-weight: 700;
  color: #fff;
}

/* ── Buttons ── */
.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
}
.action-btn {
  background: linear-gradient(135deg, rgba(100,232,255,0.92), rgba(167,139,250,0.92));
  color: #0a0a12;
  border: none;
  border-radius: 14px;
  padding: 16px 48px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  transition: transform 0.1s, opacity 0.1s;
  box-shadow: 0 0 30px rgba(100,232,255,0.25);
}
.action-btn:active { transform: scale(0.96); opacity: 0.85; }
.action-btn.secondary {
  background: transparent;
  border: 1px solid rgba(167,139,250,0.4);
  color: rgba(255,255,255,0.8);
  box-shadow: none;
  padding: 14px 32px;
}
.retry-btn {
  font-size: 22px;
  font-weight: 700;
  padding: 18px 64px;
  box-shadow: 0 0 30px rgba(100,232,255,0.3);
  margin-top: 4px;
}
