/* Base Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: 'Arial', sans-serif;

  /* center the canvas; background shows around it */
  display: flex;
  align-items: center;
  justify-content: center;

  /* these get set from JS to your current stage image */
  background-color: #000;                 /* fallback color */
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
/* Canvas Fullscreen and Responsive */
canvas {
  display: block;
  width: 100%;
  height: auto;       /* keep aspect ratio */
  max-width: 100vw;
  max-height: 100vh;
}
/* Overlay Style for Menus */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  text-align: center;
}

/* Buttons */
.btn {
  padding: 16px 32px;
  font-size: 1.5rem;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  margin: 8px;
  transition: background 0.3s ease;
}

.btn-play {
  background-color: #ff9900;
}
.btn-play:hover {
  background-color: #e68a00;
}

.btn-restart {
  background-color: #e60000;
}
.btn-restart:hover {
  background-color: #cc0000;
}

/* Game Over Text */
.game-over-text {
  color: white;
  font-size: 2rem;
  margin-bottom: 20px;
}

/* Mobile Jump Button */
#jump-button {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 14px 20px;
  background: #ffc400;
  border-radius: 50%;
  font-weight: bold;
  color: #000;
  font-size: 1rem;
  z-index: 5;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

#jump-button:active {
  background: #e6b300;
}

/* Show jump button only on small screens */
@media (max-width: 768px) {
  #jump-button {
    display: block;
  }

  .btn {
    font-size: 1.2rem;
    padding: 12px 24px;
  }

  .game-over-text {
    font-size: 1.5rem;
  }
}
#start-menu,
#game-over {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000; /* <- make sure it's high enough */
  width: 100%;
  height: 100%;
}

canvas {
  pointer-events: none;
}
#jump-button {
  pointer-events: auto;
}


.instructions {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: right;
  max-width: 300px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.instructions h2 {
  margin-top: 0;
  font-size: 1.5rem;
  color: #ffcc00;
}

.instructions ul {
  list-style-type: disc;
  padding-right: 20px;
  margin: 0;
}

.instructions li {
  margin-bottom: 10px;
  font-size: 1rem;
}



/* NEW: Top Scoreboard Styles */
.top-bar {
  position: fixed; /* Fixes the bar to the top */
  top: 0;
  left: 0;
  width: 100%;
  height: 40px; /* Adjust height as needed */
  background-color: rgba(43, 43, 43, 0.85); /* Dark, slightly transparent background */
  display: flex;
  justify-content: space-between; /* Distributes items horizontally */
  align-items: center; /* Vertically centers content */
  padding: 0 20px; /* Padding on the sides */
  box-sizing: border-box; /* Include padding in width */
  z-index: 1001; /* Ensure it's above the canvas but below modals */
  border-bottom: 2px solid #e69900; /* Accent color border */
  font-family: 'Press Start 2P', cursive; /* Example pixel font, ensure you have it linked or use another */
}

.top-bar .score-container,
.top-bar .time-container,
.top-bar .title-container {
  display: flex;
  align-items: center;
  color: #fff;
}

.top-bar .label {
  font-size: 0.7rem; /* Smaller text for labels */
  text-transform: uppercase;
  margin-right: 8px;
  opacity: 0.7; /* Slightly faded labels */
}

.top-bar .value {
  font-size: 1.2rem; /* Larger text for values */
  font-weight: bold;
}

/* Specific adjustments for each container */
.top-bar .score-container {
  /* No specific adjustments needed for layout */
}

.top-bar .time-container {
  /* No specific adjustments needed for layout */
}

.top-bar .title-container {
  /* No specific adjustments needed for layout */
}

/* Style for the canvas to ensure it doesn't overlap the bar badly */
canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100vw;
  max-height: 100vh;
  margin-top: 40px; /* Push canvas down by the height of the scoreboard */
  box-sizing: border-box;
}

/* Ensure game over/win screens are still centered correctly */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10; /* Keep overlays on top of game */
  text-align: center;
}

/* Adjusted z-index for the scoreboard to be below modal overlays but above game canvas */
#top-scoreboard {
    z-index: 1001; /* Ensure it's above canvas */
}

#start-menu,
#game-over,
#win-screen {
    z-index: 1002; /* Ensure modals are above the scoreboard */
}

/* NEW: Hide existing scoreboard element if it exists in HTML */
/* Since the old scoreboard is drawn via JS, we don't need to hide an HTML element,
   but if there was a persistent HTML element for it, you'd target it here. */

/* Adjust jump button positioning to avoid overlapping the new top bar */
#jump-button {
    /* ... existing styles ... */
    z-index: 5; /* Ensure it's above the canvas */
}

@media (max-width: 768px) {
  .top-bar {
    height: 30px; /* Slightly smaller on mobile */
    padding: 0 10px;
  }
  .top-bar .label {
    font-size: 0.6rem;
  }
  .top-bar .value {
    font-size: 1rem;
  }
  canvas {
    margin-top: 30px; /* Adjust for smaller bar height */
  }
}