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

body {
  overflow: hidden;
  background: #0a0a1a;
  font-family: 'Segoe UI', Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#gameContainer {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ===== HUD ===== */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.9);
  z-index: 10;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
  letter-spacing: 0.5px;
  flex-wrap: wrap;
  gap: 3px;
}

#hud div {
  padding: 2px 8px;
  background: rgba(0,0,0,0.35);
  border-radius: 6px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
}

#timeDisplay { color: #ffd700; }
#coinDisplay { color: #ffd700; }
#livesDisplay { color: #ff6b6b; }

/* ===== MENU ===== */
#menuOverlay, #resultOverlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(10px);
}

#menuBox, #resultBox {
  background: linear-gradient(160deg, #1a1a3e, #0f3460);
  border: 2px solid #e94560;
  border-radius: 24px;
  padding: 24px 32px;
  text-align: center;
  box-shadow: 0 25px 80px rgba(233,69,96,0.25);
  max-width: 400px;
  width: 90%;
  position: relative;
  overflow: hidden;
}

#menuBox::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(233,69,96,0.03), transparent, rgba(233,69,96,0.03), transparent);
  animation: rotateBg 10s linear infinite;
}

@keyframes rotateBg {
  to { transform: rotate(360deg); }
}

#menuLogo {
  color: #e94560;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 4px;
  text-shadow: 0 0 30px rgba(233,69,96,0.4);
  position: relative;
  z-index: 1;
}

#menuSub {
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  letter-spacing: 4px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.menuBtn {
  display: block;
  width: 100%;
  padding: 10px 18px;
  margin: 6px 0;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  background: linear-gradient(135deg, #e94560, #c23152);
  color: white;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 15px rgba(233,69,96,0.3);
}

.menuBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(233,69,96,0.5);
}

.menuBtn:active {
  transform: translateY(0px);
}

#controlsInfo {
  margin-top: 10px;
  padding: 12px;
  background: rgba(0,0,0,0.4);
  border-radius: 12px;
  color: #ccc;
  font-size: 11px;
  line-height: 1.7;
  text-align: left;
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255,255,255,0.06);
}

/* ===== PAUSE ===== */
#pauseOverlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  backdrop-filter: blur(4px);
}

#pauseBox {
  text-align: center;
  color: #fff;
}

#pauseBox h2 {
  font-size: 38px;
  margin-bottom: 6px;
  text-shadow: 0 0 30px rgba(233,69,96,0.5);
}

#pauseBox p {
  font-size: 13px;
  opacity: 0.7;
}

/* ===== RESULT ===== */
#resultTitle {
  font-size: 28px;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

#resultSubtitle {
  color: #aaa;
  font-size: 12px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

#resultStats {
  margin: 14px 0;
  position: relative;
  z-index: 1;
}

.statRow {
  display: flex;
  justify-content: space-between;
  padding: 5px 12px;
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  margin: 4px 0;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.05);
}

.statRow span:last-child { color: #ffd700; }

/* ===== MOBILE CONTROLS — 3 buttons, properly spaced ===== */
#mobileControls {
  position: absolute;
  bottom: 160px;
  left: 0;
  right: 0;
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 0 25px;
  z-index: 15;
  pointer-events: none;
  max-width: 500px;
  margin: 0 auto;
}

/* Left + Right buttons grouped on left side */
.ctrlBtn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.2);
  font-size: 22px;
  color: white;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  cursor: pointer;
  touch-action: none;
  transition: 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  pointer-events: auto;
  flex-shrink: 0;
}

.ctrlBtn:active {
  background: rgba(233,69,96,0.45);
  transform: scale(0.85);
  border-color: rgba(233,69,96,0.4);
}

/* Jump button — big, circular, centered, spaced from left/right */
.jumpBtn {
  width: 75px;
  height: 75px;
  font-size: 26px;
  border-width: 3px;
  background: rgba(233,69,96,0.25);
  border-color: rgba(233,69,96,0.4);
  box-shadow: 0 4px 25px rgba(233,69,96,0.2);
  margin: 0 auto;
  flex-shrink: 0;
}

.jumpBtn:active {
  background: rgba(233,69,96,0.5);
  border-color: rgba(233,69,96,0.7);
  box-shadow: 0 4px 35px rgba(233,69,96,0.4);
}

/* Left/Right container */
.btnGroup {
  display: flex;
  gap: 15px;
  align-items: center;
}

/* ===== TOAST ===== */
#toast {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 18px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  color: #ffd700;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid rgba(255,215,0,0.2);
  z-index: 25;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  letter-spacing: 1px;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  #menuBox, #resultBox { padding: 18px 16px; }
  #menuLogo { font-size: 28px; letter-spacing: 2px; }
  .menuBtn { padding: 9px 12px; font-size: 13px; }
  #hud { font-size: 10px; padding: 4px 6px; }
  #hud div { padding: 2px 5px; }
  .ctrlBtn { width: 52px; height: 52px; font-size: 18px; }
  .jumpBtn { width: 65px; height: 65px; font-size: 22px; }
  #mobileControls { bottom: 130px; padding: 0 15px; gap: 10px; }
}

@media (pointer: coarse) {
  #mobileControls { display: flex; }
}
