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

/* ─── Page layout ──────────────────────────────────────────────────────────
   Centers the canvas vertically + horizontally on any screen.
──────────────────────────────────────────────────────────────────────────── */
body {
  background: #1a1a2e;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 12px 0;
}

/* ─── Canvas wrapper ───────────────────────────────────────────────────────
   position:relative lets #mobileControls anchor to canvas bounds.
   Width is capped at 360px; on narrow phones it fills the viewport.
──────────────────────────────────────────────────────────────────────────── */
/* ─── Mode selector bar ────────────────────────────────────────────────── */
#wrap {
  flex-direction: column;
  gap: 8px;
}

#modeBar {
  display: flex;
  gap: 6px;
  width: min(360px, 100vw);
}

.mode-btn {
  flex: 1;
  padding: 9px 4px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #888;
  font-size: 0.72rem;
  font-weight: bold;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mode-btn.active {
  background: rgba(255, 215, 0, 0.18);
  border-color: #ffd700;
  color: #ffd700;
}

.mode-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.1);
  color: #ccc;
}

/* ─── Wallet display ───────────────────────────────────────────────────── */
#walletDisplay {
  width: min(360px, 100vw);
  text-align: center;
  font: bold 0.85rem monospace;
  color: #ffd700;
  letter-spacing: 0.04em;
  min-height: 1.2em;
}

#demoLabel {
  width: min(360px, 100vw);
  text-align: center;
  font-size: 0.72rem;
  color: #f0c040;
  margin: -4px 0 4px;
  opacity: 0.85;
}
#demoLabel a { color: #f0c040; text-decoration: underline; }

/* ─── Leaderboard ──────────────────────────────────────────────────────── */
#leaderboard {
  width: min(360px, 100vw);
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  padding: 10px 14px 12px;
  box-sizing: border-box;
  margin-top: 6px;
}
#leaderboard h3 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: #ffd700;
  text-align: center;
  letter-spacing: 0.04em;
  font-family: monospace;
}
.lb-tabs { display: flex; gap: 4px; margin-bottom: 8px; justify-content: center; }
.lb-tab {
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 8px;
  color: #aabbc8;
  font-size: 0.7rem;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lb-tab.active { background: rgba(255,215,0,0.22); color: #ffd700; font-weight: bold; }
#lbRows { font-size: 0.78rem; color: #ccd8e0; font-family: monospace; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.lb-row:last-child { border-bottom: none; }
.lb-rank  { width: 20px; text-align: center; font-size: 0.8rem; }
.lb-nick  { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-total { color: #ffd700; font-weight: bold; white-space: nowrap; }
.lb-wins  { color: #8899aa; font-size: 0.7rem; white-space: nowrap; }
.lb-empty { text-align: center; color: #556677; font-size: 0.75rem; padding: 6px 0; }

/* ─── Hamburger + dropdown ─────────────────────────────────────────────── */
.hamburger-menu-btn {
  position: fixed;
  top: 8px; right: 5px;
  z-index: 1000;
  background: #FFC700;
  border: 1px solid rgba(0,0,0,0.15);
  color: #000;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
}
.hamburger-line { width: 20px; height: 2px; background: #000; border-radius: 2px; }
.header-dropdown {
  position: fixed !important;
  top: 48px !important; right: 5px !important;
  background: #FFC700;
  border: 2px solid #000;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1500;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  min-width: 130px;
}
.header-dropdown.open { display: flex; }
.footer-menu-btn {
  background: transparent;
  border: none;
  color: #000;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-size: 13px;
  font-weight: 700;
}
.footer-menu-btn:hover { background: rgba(0,0,0,0.1); }
.footer-menu-btn i { font-size: 16px; min-width: 18px; }

/* ─── Auth sidebar ─────────────────────────────────────────────────────── */
.interactive-sidebar {
  position: fixed; top: 0; left: 0; width: 350px; height: 100%;
  background: rgb(255,199,0);
  box-shadow: 4px 0 15px rgba(0,0,0,0.3);
  z-index: 2000;
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
  display: flex; flex-direction: column;
}
.interactive-sidebar.open { transform: translateX(0); }
.sidebar-header-new {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: rgba(255,199,0,0.6);
  color: #000;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.sidebar-header-new h3 { margin: 0; font-size: 1.1rem; }
.close-sidebar-btn, .sidebar-back-btn {
  background: rgba(0,0,0,0.1);
  border: none; border-radius: 50%;
  width: 32px; height: 32px;
  cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px; }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1999;
}
.sidebar-overlay.open { display: block; }

/* ─── Canvas wrapper ───────────────────────────────────────────────────── */
#canvasWrap {
  position: relative;
  width: min(360px, 100vw);
}

/* ─── Canvas ───────────────────────────────────────────────────────────────
   width:100% / height:auto preserves the intrinsic 360×600 ratio set in JS.
   touch-action:none prevents browser scroll/zoom on canvas touches.
──────────────────────────────────────────────────────────────────────────── */
#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  touch-action: none;
}

/* ─── Mobile dodge buttons ─────────────────────────────────────────────────
   Overlaid on the beach zone = bottom 31.6% of canvas (190 / 600).
   pointer-events:none on the wrapper so only the buttons capture touches.
──────────────────────────────────────────────────────────────────────────── */
#mobileControls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 31.6%;           /* matches beach zone proportion */
  display: flex;
  justify-content: space-around;
  align-items: flex-start; /* buttons at TOP of beach zone — head draws below */
  padding: 10px 6px 0;
  pointer-events: none;    /* pass-through except for .dodge-btn */
}

.dodge-btn {
  pointer-events: all;
  flex: 0 0 72px;
  margin: 0 4px;
  padding: 14px 4px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.38);
  color: #fff;
  font-size: 1.8rem;
  font-weight: bold;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}

#btnDuck {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  padding: 0;
  align-self: center;
  transform: translateY(-60px);  /* lifted above the head */
}

.dodge-btn:active {
  background: rgba(255, 255, 255, 0.22);
}
