/* ============================================================
   MONX FLAP — Styles
   Pixel-art aesthetic matching monx-run: white canvas, Courier New
   HUD, blue+purple power-up palette. The outer chrome (dark border,
   Inter font) matches the site shell.
   ============================================================ */

/* ── Sized container that sits beside the leaderboard (mirrors
   .road-canvas-container — without this, .game-canvas-container
   from styles.css squishes the canvas). ───────────────────── */
.flap-canvas-container {
  display: flex;
  flex-direction: column;
  max-width: 420px;
  width: 100%;
}

/* ── Mount point ──────────────────────────────────────────── */
.flap-root {
  background: #0a0a0a;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  overflow: hidden;
}

/* ── Top HUD strip — mirrors monx-run's QUEUE strip ──────── */
.flap-hud-top {
  background: #111;
  border-bottom: 1px solid #2a2a2a;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: #555;
}
.flap-hud-label { color: #555; }
.flap-hud-none  { color: #444; }
.flap-hud-chip {
  font-family: 'Courier New', monospace;
  font-size: 9px;
  font-weight: bold;
  color: #fff;
  padding: 2px 7px;
  border-radius: 2px;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.flap-hud-chip.shield { background: #3CA3E2; }
.flap-hud-chip.slowmo { background: #a78bfa; }
.flap-hud-chip-time { font-size: 8px; opacity: 0.85; }

/* ── HUD split: power-up chips (left) + event countdown (right) ──────
   The strip is space-between; the left side holds the existing ACTIVE/
   power-up content and may shrink, the right side holds the "ENDS IN"
   clock and never shrinks. */
.flap-hud-powerups {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;          /* allow truncation rather than pushing the clock off */
  overflow: hidden;
  white-space: nowrap;
}
.flap-hud-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-family: 'Courier New', monospace;
}
.flap-hud-timer-label {
  color: #555;
  font-size: 9px;
  letter-spacing: 2px;
}
.flap-hud-timer-val {
  color: #ffd34a;        /* same amber as the pre-launch countdown */
  font-weight: bold;
  font-size: 10px;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}
/* Final 5 minutes — warm up to orange */
.flap-hud-timer.soon .flap-hud-timer-label,
.flap-hud-timer.soon .flap-hud-timer-val { color: #ff8c3c; }
/* After the deadline — red "GAME OVER" */
.flap-hud-timer.ended .flap-hud-timer-val {
  color: #e74c3c;
  letter-spacing: 2px;
}

/* ── Canvas — white, pixel art ────────────────────────────── */
.flap-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #ffffff;
  flex-shrink: 0;          /* don't let parent flex squish the canvas vertically */
}
.flap-canvas-wrap canvas#flap-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  /* iOS Safari: prevents the browser from waiting ~300ms after each touch
     to see if it's a double-tap-zoom, and stops pinch/pan gestures from
     intercepting touchstart. Without this, flaps feel "jolty" on mobile. */
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Bottom controls hint ─────────────────────────────────── */
.flap-hud-bot {
  background: #111;
  border-top: 1px solid #2a2a2a;
  padding: 10px 12px;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  color: #555;
  text-transform: uppercase;
}

/* ── Overlay (idle / dead) ────────────────────────────────── */
.flap-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  gap: 10px;
  text-align: center;
  /* Dark panel matching MONX JUMP. Slight transparency so the bird/pipes
     preview still peeks through faintly behind. */
  background: rgba(20, 20, 20, 0.86);
  /* Same iOS touch fix as the canvas — buttons stay tappable but the
     browser doesn't pause to check for double-tap zoom. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.flap-overlay.hidden { display: none; }
/* Old "Monx Protocol" pre-line removed — JUMP doesn't have one */
.flap-overlay-pre { display: none; }

.flap-overlay-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: 6px;
  color: #ffffff;
  margin: 0;
}
.flap-overlay-title.big   { font-size: clamp(30px, 6vh, 48px); }
.flap-overlay-title.small { font-size: clamp(18px, 3vh, 26px); }

/* Desktop: 20% smaller title (per request — mobile keeps current size) */
@media (min-width: 720px) {
  .flap-overlay-title.big   { font-size: 38px; }
  .flap-overlay-title.small { font-size: 21px; }
}
.flap-overlay-score {
  font-family: 'Courier New', monospace;
  font-size: clamp(34px, 6vh, 48px);
  font-weight: bold;
  color: #3CA3E2;
  line-height: 1.1;
  margin-top: 4px;
}
.flap-overlay-tagline {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #aaa;
  letter-spacing: 0.5px;
  max-width: 320px;
  font-weight: 400;
  margin: 0;
  line-height: 1.5;
}
/* Thin-border PLAY button — matches MONX JUMP's minimalist style */
.flap-overlay-btn {
  margin-top: 18px;
  padding: 14px 56px;
  background: transparent;
  border: 1px solid #ffffff;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 5px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
  transition: background 120ms ease, color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.flap-overlay-btn:hover  { background: #ffffff; color: #111; }
.flap-overlay-btn:active { transform: translateY(1px); }

.flap-overlay-cta {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #888;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 4px;
}
.flap-overlay-err {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #e25c3c;
  letter-spacing: 0.5px;
  margin: 6px 0 0;
  max-width: 280px;
  font-weight: bold;
}

/* Pre-launch countdown — big tabular monospace clock */
.flap-countdown {
  font-family: 'Courier New', monospace;
  font-size: clamp(34px, 7vh, 56px);
  font-weight: bold;
  color: #ffd34a;
  margin: 10px 0 4px;
  letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(255, 211, 74, 0.3);
}
.flap-overlay-launchat {
  font-size: 11px;
  color: #888;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* "Playing as @user [CHANGE]" row */
.flap-overlay-userline {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #999;
  letter-spacing: 0.3px;
}
.flap-overlay-userline strong {
  color: #fff;
  font-weight: 600;
}
/* Small inline button — CHANGE / SET USERNAME / LEADERBOARD */
.flap-overlay-tinybtn {
  padding: 5px 12px;
  background: transparent;
  border: 1px solid #777;
  color: #ccc;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.flap-overlay-tinybtn:hover {
  background: #ddd;
  color: #111;
  border-color: #ddd;
}
.flap-overlay-tinybtn:active { transform: translateY(1px); }

/* LEADERBOARD ↓ link — hidden on desktop (leaderboard sits beside the canvas),
   shown on mobile (where it's stacked below the canvas, off-screen). */
.flap-overlay-leaderboardlink { display: none; }

/* ── Leaderboard modal ─────────────────────────────────────
   Pops over the canvas when LEADERBOARD button is clicked. Shows
   whatever main.js has rendered in #flapLeaderboardContent.   */
.flap-lb-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 16px;
  -webkit-tap-highlight-color: transparent;
}
.flap-lb-modal.hidden { display: none; }
.flap-lb-modal-panel {
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  width: 100%;
  max-width: 360px;
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.flap-lb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #2a2a2a;
}
.flap-lb-modal-title {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #ffd34a;
  text-transform: uppercase;
}
.flap-lb-modal-close {
  background: transparent;
  border: 1px solid #444;
  color: #ccc;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  border-radius: 2px;
  padding: 0;
}
.flap-lb-modal-close:hover {
  background: #ddd;
  color: #111;
  border-color: #ddd;
}
.flap-lb-modal-body {
  padding: 14px 16px;
  color: #ddd;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  overflow-y: auto;
}
.flap-lb-modal-stats {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #2a2a2a;
}
.flap-lb-modal-loading {
  color: #888;
  text-align: center;
  font-size: 12px;
  margin: 12px 0;
}
/* Re-style any leaderboard rows that came from main.js's HTML, in case they
   use the site's dark theme variables that aren't in this modal. */
.flap-lb-modal-body * {
  color: inherit;
}
@media (max-width: 720px) {
  .flap-canvas-container {
    max-width: 100%;
  }
  .flap-root {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .flap-overlay-leaderboardlink { display: inline-block; }

  /* ── Nav-tabs wrap-to-2-rows on mobile ─────────────────────
     Defensive: targets several likely parent selectors used by the site's
     game-tab buttons. Falls back to a per-button rule that forces tabs to
     wrap when their parent is a flexbox row. If your styles.css uses a
     different parent class, tell me and I'll swap this. */
  .game-tabs,
  .game-tab-nav,
  .game-tabs-container,
  nav.game-tabs,
  [class*="game-tabs"] {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 0 12px !important;
  }
  .game-tab {
    flex: 0 1 auto;
    min-width: 0;
  }
}