* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05060a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
}

#game {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  touch-action: none;
  image-rendering: pixelated;
}

#hud {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  z-index: 5;
  pointer-events: none;
}

#healthBar {
  display: flex;
  gap: 6px;
}

#healthBar .segment {
  width: 22px;
  height: 12px;
  border: 2px solid #2ee6d6;
  background: #ff6a3d;
  box-shadow: 0 0 6px rgba(46, 230, 214, 0.6);
}

#healthBar .segment.empty {
  background: transparent;
  box-shadow: none;
  opacity: 0.35;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(20, 30, 45, 0.92), rgba(2, 3, 6, 0.97));
  backdrop-filter: blur(2px);
}

.overlay.hidden {
  display: none;
}

.panel {
  text-align: center;
  padding: 32px;
  color: #cdefff;
}

.panel h1 {
  margin: 0 0 6px;
  font-size: 2.4rem;
  letter-spacing: 0.12em;
  color: #5be9ff;
  text-shadow: 0 0 18px rgba(91, 233, 255, 0.65);
}

.panel .tagline {
  margin: 0 0 20px;
  color: #93a9c2;
  font-size: 0.95rem;
}

.panel .hint {
  max-width: 320px;
  margin: 0 auto 24px;
  font-size: 0.85rem;
  color: #6f8399;
  line-height: 1.5;
}

.panel button {
  pointer-events: auto;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 14px 38px;
  border-radius: 999px;
  border: 2px solid #2ee6d6;
  background: linear-gradient(180deg, #17323a, #0b1a1f);
  color: #baffef;
  box-shadow: 0 0 20px rgba(46, 230, 214, 0.35);
  cursor: pointer;
}

.panel button:active {
  transform: scale(0.96);
}

.mobile-hint { display: none; }
.desktop-hint { display: block; }

@media (hover: none) and (pointer: coarse) {
  .mobile-hint { display: block; }
  .desktop-hint { display: none; }
}

#touchControls {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 18px max(18px, env(safe-area-inset-bottom));
  pointer-events: none;
}

#touchControls.hidden { display: none; }

.dpad, .actions {
  display: flex;
  gap: 14px;
  pointer-events: none;
}

.ctrlBtn {
  pointer-events: auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(91, 233, 255, 0.55);
  background: rgba(10, 20, 28, 0.55);
  color: #bdf3ff;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}

.ctrlBtn:active {
  background: rgba(46, 230, 214, 0.35);
}

.actionBtn {
  border-color: rgba(255, 106, 61, 0.65);
  color: #ffd8c4;
}

.actionBtn:active {
  background: rgba(255, 106, 61, 0.35);
}

#btnJump { width: 72px; height: 72px; }
