body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #1e3c72 100%);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

.container {
  margin-top: 20px;
  text-align: center;
  max-width: 800px;
  width: 100%;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

h1 {
  margin-bottom: 10px;
  font-size: 3rem;
}

.game-area {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  position: relative;
}

#tetris {
  background: #222;
  border: 4px solid #555;
  border-radius: 4px;
}

.info-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 200px;
}

.info-panel h2 {
  margin: 5px 0;
  font-size: 1.2rem;
}

.next-container,
.hold-container {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.stats p {
  margin: 5px 0;
  font-size: 1.1rem;
}

.controls ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
  text-align: left;
}

.controls li {
  margin-bottom: 5px;
}

/* Leaderboard styling */
.leaderboard-panel {
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  text-align: left;
}

.leaderboard-panel h2 {
  margin: 0 0 10px;
  font-size: 1.4rem;
}

#leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 1rem;
}

#leaderboard-list li {
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

/* Input styling for name entry */
#name-input {
  width: 80%;
  padding: 8px;
  margin: 10px 0;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
}

/* Hide name input by default; will be shown via JS on game over */
#name-input.hidden {
  display: none;
}

/* Touch controls styling */
.touch-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
}

.touch-controls button {
  width: 60px;
  height: 60px;
  font-size: 1.5rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: background 0.2s, transform 0.1s;
  backdrop-filter: blur(4px);
}

.touch-controls button:active {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(2px);
}

@media (min-width: 700px) {
  /* Hide touch controls on larger screens (desktop) */
  .touch-controls {
    display: none;
  }
  .hold-side-btn {
    display: none;
  }
}

/* Side hold button styling */
.hold-side-btn {
  position: absolute;
  right: -50px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s, transform 0.1s;
  backdrop-filter: blur(4px);
}

.hold-side-btn:active {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) translateY(2px);
}

#overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

#overlay.hidden {
  display: none;
}

.overlay-content {
  background: rgba(0, 0, 0, 0.9);
  padding: 30px;
  border-radius: 8px;
  text-align: center;
}

.overlay-content h2 {
  margin-bottom: 10px;
  font-size: 2rem;
}

.overlay-content p {
  margin-bottom: 20px;
}

#restart-btn {
  padding: 10px 20px;
  font-size: 1rem;
  background: #ff6f00;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

#restart-btn:hover {
  background: #ff9900;
}

/* Hidden class for restart button */
#restart-btn.hidden {
  display: none;
}