@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@700;900&display=swap');

*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

body {
  background: #0d2b1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: 'Fredoka One', cursive;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

/* ── Game wrapper ── */
#wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid #52b788;
  box-shadow: 0 0 50px rgba(82,183,136,0.3), 0 20px 60px rgba(0,0,0,0.6);
}

canvas { display: block; }

/* ── HUD ── */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 18px;
  pointer-events: none;
  z-index: 5;
}

#score-display {
  font-size: 2.8rem;
  color: #fff;
  text-shadow: 0 3px 0 #1b4332, 0 0 20px rgba(0,0,0,0.4);
  line-height: 1;
}

#best-hud {
  font-size: 0.9rem;
  color: #b7e4c7;
  text-align: right;
  line-height: 1.3;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#best-hud span {
  display: block;
  font-size: 1.3rem;
  color: #ffd166;
}

/* ── Overlay ── */
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10,35,18,0.83);
  z-index: 20;
  gap: 10px;
  padding: 28px 20px;
  backdrop-filter: blur(2px);
}

#ov-emoji {
  font-size: 3.6rem;
  line-height: 1;
}

#ov-title {
  font-size: 2.3rem;
  color: #52b788;
  text-shadow: 0 3px 0 #1b4332;
  text-align: center;
}

#ov-sub {
  font-family: 'Nunito', sans-serif;
  font-size: 0.92rem;
  color: #b7e4c7;
  text-align: center;
  line-height: 1.6;
  font-weight: 700;
}

#result-box {
  display: none;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(82,183,136,0.35);
  border-radius: 14px;
  padding: 10px 30px;
  gap: 3px;
  margin: 4px 0;
}

#res-score {
  font-size: 2rem;
  color: #ffd166;
}

#res-best {
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  color: #b7e4c7;
  font-weight: 700;
}

#play-btn {
  background: #52b788;
  color: #1b4332;
  border: none;
  border-radius: 50px;
  padding: 13px 40px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 6px 0 #2d6a4f, 0 10px 24px rgba(0,0,0,0.35);
  transition: transform 0.1s, box-shadow 0.1s;
  margin-top: 6px;
  -webkit-tap-highlight-color: transparent;
}

#play-btn:active { transform: translateY(3px);  box-shadow: 0 3px 0 #2d6a4f; }

.btn-home {
  background: transparent;
  color: rgba(183,228,199,0.55);
  border: 2px solid rgba(82,183,136,0.25);
  border-radius: 50px;
  padding: 9px 32px;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-home:active { transform: scale(0.95); }

#tap-hint {
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  color: #74c69d;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ── Mobile jump button ── */
#jump-btn {
  margin-top: 18px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(82,183,136,0.15);
  border: 3px solid #52b788;
  font-size: 2.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 28px rgba(82,183,136,0.2);
  transition: background 0.1s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
#jump-btn:active {
  background: rgba(82,183,136,0.38);
  transform: scale(0.93);
}

@media (max-width: 420px) {
  #score-display { font-size: 2.2rem; }
  #ov-title      { font-size: 1.8rem; }
}