
#nameEntry:not(.hidden) {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#playerNamePanel {
  margin: 10px auto;
  padding: 10px;
  max-width: 360px;
  background: rgba(255,255,255,0.08);
  border-radius: 14px;
}

#startNameInput.hidden,
#saveStartNameButton.hidden,
#editStartNameButton.hidden {
  display: none;
}

#currentPlayerName {
  color: #ffcf56;
  font-weight: bold;
  margin-bottom: 6px;
}

#startNameInput {
  width: 180px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid #ffcf56;
  font-size: 1rem;
}

#nameEntry:not(.hidden) button {
  margin-top: 12px;
  padding: 14px 20px;
  border-radius: 999px;
  font-size: 1.1rem;
  cursor: pointer;
  background: #ffffff;   /* white button */
  color: #1f1f2e;        /* dark text */
  font-weight: bold;
  border: 2px solid #ffcf56;
}

#instructionsCat {
  width: 120px;
  margin-bottom: 10px;
  animation: float 2s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

#nameEntry:not(.hidden) input {
  width: 180px;
  background: #ffffff;
  color: #1f1f2e;
  caret-color: #1f1f2e;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 1.5rem;
  border: 3px solid #ffcf56;
}

#submitScoreDisplay {
  font-size: 1.6rem;
  font-weight: bold;
  color: #ffcf56;
  margin-bottom: 12px;
}

#nameEntry:not(.hidden) input:focus {
  outline: 3px solid #ffcf56;
  background: #fff8dc;
  color: #000000;
}

#nameEntry:not(.hidden) label {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

#nameEntry:not(.hidden) button {
  margin-top: 10px;
}


#instructionsPopup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#instructionsBox {
  width: min(90vw, 420px);
  background: #1f1f2e;
  color: white;
  padding: 22px;
  border-radius: 18px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}

#instructionsPopup.hidden {
  display: none;
}

html, body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}


* {
  box-sizing: border-box;
}

canvas {
  touch-action: none;
}

    body {
      margin: 0;
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #1f1f2e;
      font-family: Arial, sans-serif;
      color: white;
    }

    #gameWrapper {
      width: min(95vw, 760px);
      text-align: center;
    }

    h1 {
      margin: 8px 0;
      font-size: 2rem;
    }

    #hud {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      margin: 10px 0;
      font-size: 1.1rem;
    }

    canvas {
      width: 100%;
      aspect-ratio: 1 / 1;
      background: #f4d7a1;
      border: 8px solid #7a4a24;
      border-radius: 18px;
      box-shadow: 0 12px 30px rgba(0,0,0,0.35);
      display: block;
    }

    button {
      margin-top: 12px;
      padding: 12px 18px;
      border: none;
      border-radius: 999px;
      font-size: 1rem;
      cursor: pointer;
      background: #ffcf56;
      color: #2a1d00;
      font-weight: bold;
    }

    #instructions {
      opacity: 0.85;
      font-size: 0.95rem;
      margin-top: 8px;
      line-height: 1.4;
    }

    .hidden {
  display: none;
}

#leaderboardList {
  list-style: none;
  padding-left: 0;
  margin: 12px auto 0;
  max-width: 280px;
}

.challengeTag {
  display: inline-block;
  margin-left: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 207, 86, 0.18);
  border: 1px solid #ffcf56;
  color: #ffcf56;
  font-size: 0.45em;
  font-weight: bold;
  vertical-align: middle;
}

#leaderboardPanel {
  margin-top: 8px;
  padding: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 16px;
}

#leaderboardPanel h2 {
  margin: 0 0 6px 0;
  font-size: 1.1rem;
}

#leaderboardList li {
  padding: 4px 8px;
  margin-bottom: 3px;
}


#replacementCountdown {
  margin: 10px auto 14px;
  padding: 12px;
  max-width: 520px;
  background: rgba(255, 207, 86, 0.16);
  border: 2px solid #ffcf56;
  border-radius: 14px;
  font-weight: bold;
  line-height: 1.4;
}

#countdownTimer {
  color: #ffcf56;
  font-size: 1.2rem;
}

#leaderboardList li {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.gold {
  background: rgba(255, 215, 0, 0.35);
}

.silver {
  background: rgba(192, 192, 192, 0.35);
}

.bronze {
  background: rgba(205, 127, 50, 0.35);
}

.playerScore {
  outline: 2px solid white;
}

#startButton {
  font-size: 1.35rem;
  padding: 18px 32px;
  background: #22c55e;
  color: white;
  border: 3px solid #bbf7d0;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}

#saveStartNameButton {
  font-size: 0.9rem;
  padding: 9px 14px;
  opacity: 0.85;
}

#playControlBar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px 0;
  flex-wrap: nowrap;
}

#playControlBar button {
  margin: 0;
  padding: 8px 12px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

#playControlBar #playerNamePanel {
  margin: 0;
  padding: 4px 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  width: 170px;
}

#playControlBar #currentPlayerName {
  font-size: 0.75rem;
  margin-bottom: 2px;
}

#playControlBar #startNameInput {
  width: 100%;
  padding: 6px;
  font-size: 0.85rem;
}

#playControlBar #startButton {
  background: #22c55e;
  color: white;
  border: 2px solid #bbf7d0;
  box-shadow: none;
}

#titleBar {
  display:flex;
  justify-content:center;
  align-items:center;
  gap:8px;
  margin-bottom:6px;
}

#titleBar h1 {
  margin:0;
}

#homeButton {
  text-decoration:none;
  font-size:1.2rem;
  padding:4px 8px;
  border-radius:999px;
  background:rgba(255,255,255,0.08);
}

#levelFlash {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(3rem, 12vw, 7rem);
  font-weight: bold;
  color: #ffcf56;
  text-shadow: 0 0 20px white;
  pointer-events: none;
  animation: levelBlink 0.9s ease-out forwards;
}

#restartFromBeginningButton {
  display: none;
}

#levelFlash.hidden {
  display: none;
}

@keyframes levelBlink {
  0% {
    opacity: 0;
    transform: scale(0.8);
    filter: blur(8px);
  }
  35% {
    opacity: 1;
    transform: scale(1.15);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
    filter: blur(12px);
  }
}
