/* ============================================================
   PIXELBURRITO GAME SHELL — shared styles for every game
   Loaded inside the game iframe. Handles full-viewport canvas,
   HUD bar, overlays (menu / stage select / win / lose) and
   touch-friendly buttons on every screen size.
   ============================================================ */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  background: #14102a;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  font-family: 'Rubik', 'Segoe UI', system-ui, sans-serif;
}

.pb-root { position: fixed; inset: 0; }

.pb-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

/* ---------- HUD bar ---------- */
.pb-hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 8px;
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px 10px;
  pointer-events: none;
  z-index: 5;
  font-size: clamp(11px, 2.6vmin, 15px);
}
.pb-chip {
  background: rgba(10, 8, 24, 0.62);
  border: 1px solid rgba(255,255,255,0.14);
  color: #f3eefc;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.pb-stagechip { color: #ffb703; }
.pb-hudleft { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.pb-goalchip { color: #8be9a8; }
.pb-pausebtn {
  pointer-events: auto;
  background: rgba(10, 8, 24, 0.62);
  border: 1px solid rgba(255,255,255,0.18);
  color: #f3eefc;
  border-radius: 10px;
  min-width: 40px; min-height: 34px;
  font-size: 15px;
  cursor: pointer;
}
.pb-pausebtn:active { transform: scale(0.94); }

/* ---------- Overlays ---------- */
.pb-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom)) 16px;
  background: rgba(12, 8, 28, 0.82);
  backdrop-filter: blur(3px);
  z-index: 10;
  text-align: center;
  color: #f3eefc;
  overflow-y: auto;
}
.pb-overlay[hidden] { display: none; }

.pb-big-emoji { font-size: clamp(44px, 12vmin, 76px); line-height: 1; }
.pb-title {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  color: #ffb703;
  font-size: clamp(15px, 4.4vmin, 28px);
  line-height: 1.5;
  margin: 0;
  text-shadow: 0 3px 0 rgba(0,0,0,0.45);
}
.pb-sub {
  font-size: clamp(13px, 3vmin, 17px);
  color: #cfc6e8;
  max-width: 520px;
  line-height: 1.55;
  margin: 0;
  white-space: pre-line;
}
.pb-howto {
  font-size: clamp(12px, 2.8vmin, 15px);
  color: #a89dc7;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 10px 14px;
  max-width: 480px;
  line-height: 1.55;
  margin: 0;
}
.pb-best { color: #8be9a8; font-weight: 700; font-size: clamp(12px, 2.8vmin, 15px); }

/* ---------- Buttons ---------- */
.pb-btnrow { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pb-btn {
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(14px, 3.2vmin, 17px);
  color: #14102a;
  background: #ffb703;
  border: 0;
  border-radius: 12px;
  padding: 12px 22px;
  min-height: 48px; min-width: 110px;
  cursor: pointer;
  box-shadow: 0 4px 0 #b47f00;
  transition: transform 0.06s;
}
.pb-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b47f00; }
.pb-btn.pb-secondary {
  background: rgba(255,255,255,0.10);
  color: #f3eefc;
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 4px 0 rgba(0,0,0,0.35);
}

/* ---------- Stage select grid ---------- */
.pb-stages-label {
  font-size: clamp(11px, 2.4vmin, 13px);
  letter-spacing: 0.12em;
  color: #a89dc7;
  font-weight: 700;
  margin: 4px 0 0 0;
}
.pb-stagegrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(44px, 56px));
  gap: 8px;
  justify-content: center;
  max-width: 420px;
}
@media (max-width: 380px) { .pb-stagegrid { grid-template-columns: repeat(4, minmax(44px, 56px)); } }
.pb-stagebtn {
  aspect-ratio: 1;
  min-width: 44px; min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.08);
  color: #f3eefc;
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(13px, 3vmin, 16px);
  cursor: pointer;
}
.pb-stagebtn.pb-cleared { background: rgba(139, 233, 168, 0.18); border-color: rgba(139,233,168,0.5); color: #8be9a8; }
.pb-stagebtn.pb-current { background: #ffb703; color: #14102a; border-color: #ffb703; }
.pb-stagebtn:disabled { opacity: 0.38; cursor: default; }
.pb-stagebtn:not(:disabled):active { transform: scale(0.93); }
