:root {
  --sky: #5ec7ff;
  --ink: #142033;
  --btn: #ffd14a;
  --btn-ink: #2a1a00;
  --jump: #53e36a;
  --blast: #ff5c3a;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #081018;
  font-family: system-ui, "Trebuchet MS", sans-serif;
  touch-action: none;
}

#app {
  height: 100%;
  height: 100dvh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 12px 0;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  text-shadow: 0 1px 0 #000;
}

.hud-bit { white-space: nowrap; }
.coin { color: #ffd24a; }
#hud-power { color: #ffb347; font-size: 13px; }
#hud-goal { color: #7dff9a; font-size: 13px; }

#stage {
  position: relative;
  flex: 1;
  min-height: 160px;
  margin: 4px 8px 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--sky);
  box-shadow: inset 0 0 0 3px #0b1a2c;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 16, 28, 0.45);
  pointer-events: auto;
  touch-action: none;
}

.overlay.hidden {
  display: none;
}

.panel {
  width: min(92%, 340px);
  background: linear-gradient(#fffdf6, #ffe7c2);
  color: var(--ink);
  border-radius: 20px;
  padding: 18px 16px 16px;
  text-align: center;
  border: 3px solid #c47a28;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.18);
}

.panel h1 {
  margin: 0;
  font-size: 1.7rem;
}

.lead {
  margin: 4px 0 10px;
  font-weight: 800;
}

.panel p {
  margin: 6px 0;
  font-size: 0.95rem;
}

.hint {
  margin-top: 12px !important;
  font-weight: 900;
  font-size: 1.05rem !important;
  color: #0a7a28;
}

#btn-start {
  display: inline-block;
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  background: #53e36a;
  color: #0a3a12;
  font-weight: 900;
  font-size: 1.05rem;
  box-shadow: 0 4px 0 #1f9a38;
}

#controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: 10px 12px 8px;
}

.cluster {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

#controls button {
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: var(--btn);
  color: var(--btn-ink);
  font-weight: 900;
  font-size: 1.4rem;
  box-shadow: 0 6px 0 #c79212;
  touch-action: none;
}

#controls button:active, #controls button.held {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #c79212;
}

#controls #btn-blast {
  width: 70px;
  height: 70px;
  background: #7a8494;
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 0 #4a5360;
}

#controls #btn-blast:active, #controls #btn-blast.held {
  box-shadow: 0 2px 0 #4a5360;
}

#controls #btn-blast.is-fire {
  background: #ff7a18;
  box-shadow: 0 6px 0 #b43218, 0 0 14px rgba(255, 140, 40, 0.55);
  font-size: 0.78rem;
}

#controls #btn-blast.is-fire:active, #controls #btn-blast.held.is-fire {
  box-shadow: 0 2px 0 #b43218;
}

#controls #btn-jump {
  width: 88px;
  height: 88px;
  background: var(--jump);
  font-size: 1.05rem;
  box-shadow: 0 7px 0 #1f9a38;
}

#controls #btn-jump:active, #controls #btn-jump.held {
  box-shadow: 0 3px 0 #1f9a38;
}

@media (max-height: 560px) {
  #controls button { width: 62px; height: 62px; }
  #controls #btn-blast { width: 60px; height: 60px; }
  #controls #btn-jump { width: 76px; height: 76px; }
  #hud { min-height: 28px; font-size: 13px; }
}
