html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden; /* Prevents scrolling */
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #000;
}

canvas {
  background-color: #111;
  border: 2px solid #0f0;
  max-width: 400px;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 1rem auto;
  box-sizing: border-box;
}

#score {
  color: #0f0;
  font-family: monospace;
  font-size: 20px;
  text-align: center;
  margin-top: 10px;
}

#scoreBar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 400px;
  margin: 0 auto 10px auto;
  color: #0f0;
  font-family: monospace;
  font-size: 18px;
  padding: 0 10px;
}

#highscore {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #fff;
  font-size: 24px;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  color: #0f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: monospace;
  font-size: 24px;
  z-index: 10;
  padding: 1rem; /* add spacing on small screens */
  box-sizing: border-box;
  text-align: center; /* ensure text is centered */
}

.overlay h1 {
  font-size: clamp(1.5rem, 5vw, 3rem); /* responsive from 1.5rem to 3rem */
  text-align: center;
  white-space: nowrap; /* prevents it from breaking into two lines */
  overflow: hidden;
  text-overflow: ellipsis; /* optional: adds "..." if still overflows */
}

.overlay h1,
.overlay button {
  max-width: 90%;
  margin: 0.5rem auto;
}

button {
  font-size: 18px;
  padding: 10px 20px;
  margin-top: 20px;
  cursor: pointer;
  background-color: #0f0;
  border: none;
  color: #000;
}

#highScoreList {
  color: #0f0;
  font-family: monospace;
  font-size: 16px;
  text-align: center;
}

#nameInputSection {
  margin-top: 15px;
  text-align: center;
  font-family: monospace;
  color: #0f0;
}

#nameInputSection label {
  display: block;
  margin-bottom: 5px;
  font-size: 16px;
}

#nameInputSection input[type='text'] {
  padding: 6px 10px;
  font-size: 16px;
  width: 200px;
  max-width: 80%;
  text-align: center;
  border: 1px solid #0f0;
  background-color: #000;
  color: #0f0;
  margin-bottom: 10px;
}

#nameInputSection button {
  padding: 8px 16px;
  font-size: 16px;
  background-color: #0f0;
  color: #000;
  border: none;
  cursor: pointer;
  font-weight: bold;
}

#nameInputSection button:hover {
  background-color: #0c0;
}

#mobileControls {
  margin-top: 20px;
  text-align: center;
}

#mobileControls .row {
  margin: 5px;
}

#mobileControls button {
  font-size: 24px;
  padding: 10px 20px;
  margin: 4px;
  border: none;
  background: #0f0;
  color: #000;
  border-radius: 6px;
  cursor: pointer;
}

#mobileControls button:hover {
  background: #0c0;
}

.highlight-title {
  color: #00ff00;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.1);
  }
}

@media (min-width: 768px) {
  #mobileControls {
    display: none;
  }
}
