/* ============================================================
   SEO Survivor — style.css
   ============================================================ */

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

body {
  background: #FAFAFA;
  font-family: 'Courier New', Courier, monospace;
}

/* ── Game Container ── */
#game-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ── Canvas ── */
/*
   width:100% + height:auto preserves the 800×500 aspect ratio at every
   viewport width. The canvas pixel dimensions are set in JS via DPR so
   this CSS size is purely for layout — never set a fixed height here.
*/
#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #FAFAFA;
  cursor: pointer;
  border: 2px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* ── Overlays ── */
/*
   position:absolute (not fixed) — inside an iframe on iOS Safari,
   position:fixed can anchor to the *parent* page viewport and scroll
   off-screen. Absolute anchors to #game-container which is exactly the
   canvas area, so the overlay always covers the visible game.

   All font and spacing values use vw-based clamp().
   The embed uses aspect-ratio 800/500, so canvas height = 0.625 × vw.
   Sizing relative to vw therefore scales proportionally with BOTH the
   width and height of the iframe on every device — no media-query hacks
   needed.
*/
.overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(6px, 1.5vw, 20px) clamp(10px, 2.5vw, 24px);
  gap: clamp(4px, 1vw, 12px);
  background: rgba(250, 250, 250, 0.97);
  text-align: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.overlay.hidden {
  display: none;
}

/* ── Start Screen ── */
#start-overlay h1 {
  font-size: clamp(16px, 4vw, 36px);
  color: #222;
  letter-spacing: 2px;
  text-transform: uppercase;
}

#start-overlay .tagline {
  font-size: clamp(10px, 1.6vw, 14px);
  color: #555;
}

#start-overlay .hint {
  font-size: clamp(9px, 1.4vw, 12px);
  color: #999;
}

/* ── Game Over Screen ── */
#gameover-overlay h2 {
  font-size: clamp(14px, 3.2vw, 30px);
  color: #EA4335;
  letter-spacing: 3px;
}

#death-message {
  font-size: clamp(10px, 1.6vw, 14px);
  color: #444;
  font-style: italic;
  max-width: 80%;
  line-height: 1.4;
}

.scores {
  display: flex;
  gap: clamp(10px, 3vw, 24px);
  font-size: clamp(11px, 1.6vw, 15px);
  color: #333;
}

.scores strong {
  color: #222;
}

/* ── Overlay button row ── */
.overlay-buttons {
  display: flex;
  gap: clamp(6px, 1.5vw, 12px);
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Buttons ── */
button {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(11px, 1.6vw, 14px);
  font-weight: bold;
  letter-spacing: 1px;
  padding: clamp(5px, 1vw, 11px) clamp(14px, 3vw, 28px);
  background: #4285F4;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

button:hover  { background: #2a6dd9; }
button:active { transform: scale(0.97); }

/* ── Social share row ── */
.share-row {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1vw, 8px);
  flex-wrap: wrap;
  justify-content: center;
}

.share-label {
  width: 100%;
  font-size: clamp(8px, 1.2vw, 11px);
  color: #999;
  font-family: 'Courier New', Courier, monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.share-btn {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(9px, 1.3vw, 12px);
  font-weight: bold;
  letter-spacing: 0.5px;
  padding: clamp(4px, 0.9vw, 8px) clamp(8px, 1.8vw, 14px);
  min-width: clamp(54px, 9vw, 80px);
  min-height: clamp(26px, 4vw, 36px);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.share-btn:hover  { opacity: 0.82; }
.share-btn:active { transform: scale(0.96); }

.share-x    { background: #000000; color: #ffffff; }
.share-li   { background: #0077B5; color: #ffffff; }
.share-copy { background: #607D8B; color: #ffffff; }

/* ── Very narrow screens only (phones < 400px) ── */
@media (max-width: 400px) {
  .share-label { display: none; }
  .share-btn   { flex: 1; }
}
