/* ============================================================
   BOREL — global page styles
   The game canvas is fully managed by Phaser (Scale.FIT).
   This file handles: page reset, rotate overlay, touch buttons.
   ============================================================ */

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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;   /* iOS Safari: track the real visible area, not the toolbar-covered one */
  background: #0d0d12;
  overflow: hidden;
  touch-action: none;               /* no browser panning/zooming over the game */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Press Start 2P", "Courier New", monospace;
}

#game-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#game-container canvas {
  image-rendering: pixelated;       /* crisp retro scaling */
  image-rendering: crisp-edges;
}

/* ---------- Rotate-to-landscape overlay ---------- */
#rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;                    /* toggled by main.js + media query below */
  align-items: center;
  justify-content: center;
  background: #0d0d12;
  color: #fff;
  text-align: center;
}
#rotate-overlay h1 {
  color: #ff9518;
  font-size: 2.2rem;
  letter-spacing: 0.2em;
  text-shadow: 3px 3px 0 #7a3c00;
  margin: 0.5rem 0;
}
#rotate-overlay p { color: #cfcfcf; font-size: 0.8rem; line-height: 1.6; padding: 0 2rem; }
.rotate-phone {
  font-size: 4rem;
  display: inline-block;
  animation: rotate-hint 1.6s ease-in-out infinite;
}
@keyframes rotate-hint {
  0%, 20%   { transform: rotate(0deg); }
  60%, 100% { transform: rotate(90deg); }
}

/* Only ever show the overlay in portrait; main.js also requires a touch device */
@media (orientation: portrait) {
  body.is-touch #rotate-overlay { display: flex; }
  body.is-touch #touch-controls { display: none !important; }
}

/* ---------- Leaderboard name entry ---------- */
#lb-form {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;                    /* shown by VictoryScene */
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}
#lb-form.visible { display: flex; }
.lb-box {
  background: #14141c;
  border: 3px solid #ff9518;
  border-radius: 10px;
  padding: clamp(16px, 4vmin, 32px);
  text-align: center;
  max-width: 90vw;
}
.lb-title { color: #ffd75e; font-size: clamp(16px, 3.5vmin, 24px); margin-bottom: 10px; }
.lb-sub   { color: #cfcfd8; font-size: clamp(9px, 2vmin, 13px); margin-bottom: 16px; }
#lb-name {
  width: min(320px, 70vw);
  padding: 12px;
  font-family: inherit;
  font-size: clamp(12px, 2.5vmin, 16px);
  text-align: center;
  color: #fff;
  background: #26262e;
  border: 2px solid #55555e;
  border-radius: 6px;
  outline: none;
}
#lb-name:focus { border-color: #ff9518; }
.lb-row { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.lb-row button {
  font-family: inherit;
  font-size: clamp(11px, 2.2vmin, 15px);
  padding: 12px 22px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  background: #ff9518;
  color: #111;
}
#lb-skip { background: #3a3a46; color: #cfcfd8; }

/* ---------- Touch controls ----------
   The DOM buttons are retired: controls are now drawn INSIDE the game
   canvas (GameScene.buildTouchControls) below the characters, so Borel
   and the bosses always render in front of them. */
#touch-controls { display: none !important; }
#touch-controls-legacy {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  pointer-events: none;
}

.tc-side {
  position: absolute;
  bottom: max(2.5vmin, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 2.5vmin, 20px);
}
.tc-left  { left:  max(3vmin, env(safe-area-inset-left)); }
.tc-right { right: max(3vmin, env(safe-area-inset-right)); }

.tc-btn {
  pointer-events: auto;
  /* comfortable thumb size on any phone, capped on tablets */
  width: clamp(56px, 17vmin, 92px);
  height: clamp(56px, 17vmin, 92px);
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.85);
  background: rgba(20, 20, 28, 0.55);
  box-shadow: 0 0 16px rgba(255, 149, 24, 0.45), inset 0 0 10px rgba(255, 255, 255, 0.15);
  color: #fff;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  font-size: clamp(24px, 7vmin, 38px);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.tc-btn:active {
  background: rgba(255, 149, 24, 0.65);
  border-color: #ffd75e;
  box-shadow: 0 0 26px rgba(255, 149, 24, 0.9);
  transform: scale(0.94);
}
.tc-jump {
  width: clamp(64px, 20vmin, 104px);
  height: clamp(64px, 20vmin, 104px);
  border-color: #7ec850;
  box-shadow: 0 0 18px rgba(126, 200, 80, 0.6), inset 0 0 10px rgba(255, 255, 255, 0.15);
}
.tc-throw {
  border-color: #ff9518;
  background: rgba(255, 106, 26, 0.35);
  box-shadow: 0 0 18px rgba(255, 149, 24, 0.75), inset 0 0 10px rgba(255, 255, 255, 0.2);
}
