/* ──────────────────────────────────────────────────────────── */
/* 0) Base resets                                            */
/* ──────────────────────────────────────────────────────────── */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: black;
  font-family: Arial, sans-serif;
  color: #eee;
}

/* ──────────────────────────────────────────────────────────── */
/* 1) Top-Bar Header (row 1) holds ☰ + score                   */
/* ──────────────────────────────────────────────────────────── */
#topBar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3rem;                  /* header height */
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: space-between;/* push score to right */
  padding: 0 1rem;
  box-sizing: border-box;
  z-index: 50;                   /* above canvas */
}

#menuButton {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;               /* scales with header */
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background 0.2s, font-size 0.2s;
   position: relative;  
  z-index:101;
}
#menuButton:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* New: Score text on the right */
#scoreDisplay {
  color: #fff;
  font-size: 1.2rem;
  /* no extra margin needed; flex handles positioning */
}

/* ──────────────────────────────────────────────────────────── */
/* 2) Canvas sits immediately below the header                  */
/* ──────────────────────────────────────────────────────────── */
#gameCanvas {
  display: block;
  position: absolute;
  top: 3rem;                     /* same as #topBar height */
  left: 0;
  width: 100vw;
  height: calc(100vh - 3rem);
}

/* ──────────────────────────────────────────────────────────── */
/* 3) Start Overlay (full screen until “Start” clicked)        */
/* ──────────────────────────────────────────────────────────── */
#startOverlay {
  position: absolute;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;                  /* above everything */
}

/* ──────────────────────────────────────────────────────────── */
/* 4) Instruction box inside overlay                            */
/* ──────────────────────────────────────────────────────────── */
#overlayContent {
  background: #111;
  color: #eee;
  padding: 2rem;
  border: 2px solid rgb(238, 255, 0);
  border-radius: 8px;
  text-align: center;
  max-width: 90%;
  width: 320px;
  box-shadow: 0 0 20px rgba(208, 255, 0, 0.6);
  z-index: 101;
}

#overlayContent h1 {
  margin-top: 0;
  color: rgb(238, 255, 0);
}

#overlayContent p, 
#overlayContent ul {
  text-align: left;
  font-size: 0.95rem;
  margin: 0.5rem 0 1rem;
}

#overlayContent ul {
  padding-left: 1.2rem;
}

#overlayContent li {
  margin-bottom: 0.5rem;
}

.dot {
  font-size: 1.2rem;
  color: #fff;
}

.power {
  font-size: 1.2rem;
  color: #fff;
}

#startButton {
  background: rgb(238, 255, 0);
  color: #111;
  border: none;
  font-size: 1.1rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 1rem;
}
#startButton:hover {
  background: rgb(255, 208, 0);
}

/* ──────────────────────────────────────────────────────────── */
/* 5) Countdown centered over entire screen                     */
/* ──────────────────────────────────────────────────────────── */
#countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 15rem;
  font-weight: bold;
  color: rgb(238, 255, 0);
  opacity: 1;
  pointer-events: none;         /* clicks pass through */
  user-select: none;
  z-index: 102;                 /* above #overlayContent */
}

/* ──────────────────────────────────────────────────────────── */
/* 6) Shrink-and-fade animation for countdown (1s)             */
/* ──────────────────────────────────────────────────────────── */
@keyframes shrinkFade {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
}
.countdown-shrink {
  animation: shrinkFade 1s forwards;
}

/* ──────────────────────────────────────────────────────────── */
/* 7) Hide the instruction-box by adding “hidden”               */
/* ──────────────────────────────────────────────────────────── */
#overlayContent.hidden {
  display: none;
}

/* ──────────────────────────────────────────────────────────── */
/* 8) Hide the entire overlay when it has “hidden”              */
/* ──────────────────────────────────────────────────────────── */
#startOverlay.hidden {
  display: none;
}

/* ──────────────────────────────────────────────────────────── */
/* 9) Fly-out Sidebar                                            */
/* ──────────────────────────────────────────────────────────── */
#sideMenu {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  max-width: 80vw;
  height: 100vh;
  background: #111;
  color: #eee;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 9999;                 /* below overlays but above canvas */
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.6);
  overflow-y: auto;
}

#sideMenu.open {
  transform: translateX(0);
}

#sideMenu header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #222;
  border-bottom: 1px solid #444;
}
#sideMenu header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #ffd700;
}
#closeMenu {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}
#closeMenu:hover {
  color: #f00;
}

.menu-section {
  padding: 1rem;
  border-bottom: 1px solid #333;
}
.menu-section h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: #ffd700;
}

/* ──────────────────────────────────────────────────────────── */
/* 10) Responsive Tweaks via Media Queries                      */
/* ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #topBar {
    height: 2.5rem;
    padding: 0 0.75rem;
  }
  #menuButton {
    font-size: 3.5vh;
    padding: 0.25rem 0.5rem;
  }
  #scoreDisplay {
    font-size: 1rem;
  }
  #gameCanvas {
    top: 2.5rem;
    height: calc(100vh - 2.5rem);
  }
  #countdown {
    font-size: 10rem;
  }
}

@media (max-width: 768px) {
  #topBar {
    height: 2.75rem;
    padding: 0 1rem;
  }
  #menuButton {
    font-size: 3vh;
    padding: 0.3rem 0.6rem;
  }
  #scoreDisplay {
    font-size: 1.1rem;
  }
  #gameCanvas {
    top: 2.75rem;
    height: calc(100vh - 2.75rem);
  }
  #countdown {
    font-size: 12rem;
  }
}

/* ---------------------------------------------------------------------
   TOP BAR: burger menu on left, lives+score on the far right
   --------------------------------------------------------------------- */
#topBar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  padding: 10px;
  pointer-events: none;  /* clicks still go to the button itself */
  z-index: 10;
}

/* The menu button stays on the left by default */
#menuButton {
  pointer-events: all;   /* so you can still click it */
  background: none;
  border: none;
  color: #FFF;
  font-size: 24px;
  cursor: pointer;
}

/* #hud is pushed all the way to the right */
#hud {
  margin-left: auto;      /* push the entire HUD to the far right */
  display: flex;
  align-items: center;
  gap: 12px;              /* gap between lives and score */
  pointer-events: none;
}

/* Lives container shows icons in a row */
#livesContainer {
  display: flex;
  align-items: center;
  gap: 8px;               /* space between each 32×32 life icon */
}

/* Each individual life icon is a 32×32 canvas or <canvas> container */
.lifeIcon {
  width: 32px;
  height: 32px;
}

/* Score text goes immediately to the right of the lives */
#scoreDisplay {
  color: #FFF;
  font-size: 20px;
  user-select: none;
  pointer-events: none;
}
#userNameInput {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  box-sizing: border-box;
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
}

#addUserBtn {
  padding: 0.5rem 1rem;
  width: 100%;
  background: #ffd700;
  color: #111;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#addUserBtn:hover {
  background: #ffbf00;
}

#userList {
  list-style: none;
  padding: 0;
  margin-top: 0.5rem;
}

#userList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem;
  background: #333;
  margin-bottom: 0.2rem;
  border-radius: 4px;
}

.removeUserBtn {
  background: none;
  border: none;
  color: #f00;
  cursor: pointer;
}
#closeMenu:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
