html, body {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #1D2239;
  overflow: hidden;
}

.background-wrapper {
  position: relative;
  width: 100%;
  height: 100%; 
  overflow: hidden;
}

#gameCanvas {
  display: block;
  margin: 0 auto;
  width: 100%;
  height: 100%;
  background-color: #000;
}

#score-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-family: Arial, sans-serif;
  font-size: 20px;
  z-index: 10;
  line-height: 20px;
}


#score-container {
  margin-bottom: 10px;
}

#lives-container {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  color: white;
  font-family: Arial, sans-serif;
  font-size: 20px;
  z-index: 10;
  gap: 10px;
}

/* Styling the hearts (lives) */
#lives {
  display: flex;
  flex-direction: row;  /* Align heart icons in a row */
  gap: 5px;  /* Space between heart icons */
}

/* Heart icon styling */
.heart-icon {
  width: 20px;
  height: 20px;
}

.gameText {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  color: white;
  text-align: center;
  font-family: "Press Start 2P", system-ui;
  display: none;
}

.gameText h1 {
  margin-bottom: 0px;
  font-size: 28px;
}

#flapText {
  display: none;
}

#flapAgainButton {
  margin-top: 0px;
  padding: 10px 20px;
  font-size: 16px;
  background-color: #78BFEE;
  color: black;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: "Press Start 2P", system-ui;
}

#mainmenuButton {
  margin-top: 0px;
  margin-bottom: 1px;
  padding: 10px 20px;
  font-size: 16px;
  background-color: #ffffff;
  color: black;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: "Press Start 2P", system-ui;
}

#nameScreen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  color: #ffffff;
  height: 100vh;
  padding-top: 100px;
  box-sizing: border-box;
}

#nameScreen h1 {
  font-size: 20px;
  margin-bottom: 1rem;
  color: #ffffff;
  font-family: "Press Start 2P", system-ui;
}

#nameScreen p {
  font-size: 0.8rem;
  font-family: "Arial";
  margin-bottom: 15px;
  text-align: center;
}

#playerNameInput {
  padding: 10px;
  font-size: 1rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
  border: 2px solid #78BFEE;
  border-radius: 5px;
  text-align: center;
  background-color: #222;
  color: #fff;
}

#connectWalletButton {
  background-color: #5a99c4;
  color: #ffffff;
  font-size: 0.8rem;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-bottom: 12px;
  margin-top: 22px;
  font-family: "Press Start 2P", system-ui;
}

#connectWalletButton:hover {
  background-color: #4c81a4;
}

#openHatShop {
  background-color: #78BFEE;
  color: #ffffff;
  font-size: 0.8rem;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-bottom: 12px;
  margin-top: 2px;
  font-family: "Press Start 2P", system-ui;
}

#openHatShop:hover {
  background-color: #5fa2ce;
}

#flapNowButton {
  background-color: #ffffff;
  color: #000000;
  font-size: 0.8rem;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  font-family: "Press Start 2P", system-ui;
}

#flapNowButton:hover {
  background-color: #F26E16;
}

#leaderboardContainer {
  margin: 20px auto 0 auto; /* top auto bottom auto */
  text-align: center;
  max-width: 95%;
  min-width: 300px;
  overflow-y: auto;
  max-height: 60vh;
  border-radius: 10px;
  -webkit-overflow-scrolling: touch;
}

#leaderboardTable {
  max-width: 100%;
  border-collapse: collapse;
  min-width: 300px;
  margin: 10px 0;
  font-size: 9px;
  -webkit-overflow-scrolling: touch;
}

#leaderboardTable th, #leaderboardTable td {
  padding: 8px;
  text-align: center;
}

#leaderboardTable th {
  background-color: #0f3567;
  color: white;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 1;
}

#leaderboardTable tr:nth-child(even) {
  background-color: #2b3954;
  color: white;
}

#leaderboardTable tr:nth-child(odd) {
    background-color: #141a29;
    color: white;
}

.highlight-row {
  background-color: rgb(255, 149, 0, 0.15);
  font-weight: bold;
  border-left: 4px solid #fb8f13;
}

#statusText {
  font-size: 12px;
  color: #ffffff;
  margin-top: 20px;
  line-height: 20px;
}

 .popup.hidden {
    display: none;
  }

  .popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
  }

  .popup-content {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    width: 300px;
    text-align: center;
  }

  .hat-list img {
    width: 64px;
    height: 64px;
    margin: 0.5rem;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
  }

  .hat-list img:hover {
    border-color: gold;
  }

.hat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1rem;
  font-family: Arial, sans-serif;
  font-size: 17px;
  color: #000;
}

.hat-label {
  text-align: center;
  margin-top: 8px;
  white-space: normal;
}

.use-hat-btn {
  margin-top: 5px;
  padding: 4px 10px;
  background-color: #19a5e1;
  color: white;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
}

.use-hat-btn:hover {
  background-color: #1790c4;
}

#multiplayerInfo {
  margin-top: 5px;
  color: #ccc;
}

#gameContainer {
  width: 100%;
  max-width: 300px;
  margin: 0 auto; /* center ho11rizontally */
  position: relative; /* allows absolute-positioned children if needed */
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #1a2035;
  display: flex;
  justify-content: center;
  align-items: start;
}

#gameContainer {
  width: 100%;
  max-width: 500px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #111;
}

#finalScore {
  margin-top: 10px;
  font-size: 20px;
  color: white;
  text-align: center;
}

.spinner {
  margin: 10px auto;
  width: 40px;
  height: 40px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top: 5px solid #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}