* { box-sizing: border-box; }
html, body {
  width: 100%; height: 100%; margin: 0;
  font-family: system-ui, Arial, sans-serif;
  background: #111; /* fallback */
}
canvas {
  display: block;
  width: 100vw; height: 100vh; /* CSS size */
  background: linear-gradient(to bottom, #87CEEB, #E0FFFF);
}

/* Top UI bar */
#ui {
  position: fixed; top: 10px; left: 10px; right: 10px;
  display: flex; gap: 10px; align-items: center;
  z-index: 20; /* ABOVE overlay */
  pointer-events: auto;
}
#ui button {
  padding: 8px 14px; border: none; border-radius: 6px;
  background: #1f7ae0; color: #fff; font-weight: 600; cursor: pointer;
}
#ui button:disabled { opacity: 0.5; cursor: not-allowed; }
#hud {
  margin-left: auto; display: flex; gap: 16px;
  background: rgba(255,255,255,0.8); color: #111;
  padding: 6px 10px; border-radius: 6px; font-weight: 700;
}

/* Overlay */
#overlay {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.5);
  z-index: 10; /* BELOW UI so buttons stay clickable */
}
#overlay.hidden { display: none; }
#overlay .panel {
  background: #fff; width: min(92vw, 420px);
  border-radius: 12px; padding: 20px; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.overlay-actions { display: flex; gap: 10px; justify-content: center; }
#overlay button {
  padding: 10px 16px; border: none; border-radius: 8px;
  font-weight: 700; cursor: pointer; color: #fff;
}
#overlayResume { background: #16a34a; }
#overlayRestart { background: #1f7ae0; }
