* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #fff;
  overflow: hidden;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

h1 {
  font-size: 2rem;
  text-shadow: 0 0 20px rgba(0, 255, 100, 0.5);
  letter-spacing: 2px;
}

.score-board {
  display: flex;
  gap: 30px;
  font-size: 1.2rem;
}

.score span, .best span {
  color: #0f0;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.6);
}

canvas {
  border: 3px solid #0f0;
  border-radius: 8px;
  background: #111;
  box-shadow: 0 0 30px rgba(0, 255, 0, 0.3), inset 0 0 60px rgba(0, 0, 0, 0.5);
}

.controls {
  font-size: 0.85rem;
  color: #aaa;
  text-align: center;
}

.controls b {
  color: #0f0;
}

/* Overlay */
.overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10;
  backdrop-filter: blur(4px);
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

#overlayTitle {
  font-size: 2rem;
  color: #0f0;
  text-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
}

#overlayText {
  font-size: 1rem;
  color: #ccc;
}

.btn {
  padding: 12px 36px;
  font-size: 1.2rem;
  border: 2px solid #0f0;
  background: transparent;
  color: #0f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: bold;
}

.btn:hover {
  background: #0f0;
  color: #111;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

/* Mobile controls */
.mobile-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
}

.dir-row {
  display: flex;
  gap: 5px;
}

.dir-btn {
  width: 55px;
  height: 55px;
  font-size: 1.5rem;
  border: 2px solid #0f0;
  background: rgba(0, 255, 0, 0.1);
  color: #0f0;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.1s;
}

.dir-btn:active {
  background: #0f0;
  color: #111;
}

@media (max-width: 500px) {
  canvas {
    width: 300px;
    height: 300px;
  }
  
  .mobile-controls {
    display: flex;
  }
  
  h1 {
    font-size: 1.5rem;
  }
}