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

body {
  background: #202124;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #e8eaed;
  overflow: hidden;
}

#back-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  color: #fff;
  text-decoration: none;
  font-size: 22px;
  font-weight: 700;
  z-index: 20;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #5f6368;
  transition: background 0.2s;
  line-height: 1;
}

#back-btn:hover {
  background: #80868b;
}

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

#header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 760px;
  padding: 0 4px;
  font-size: 18px;
  font-weight: 500;
}

#high-score-display {
  color: #9aa0a6;
}

#game-canvas {
  border-radius: 12px;
  display: block;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

#overlay.visible {
  display: flex;
}

#overlay-content {
  text-align: center;
  background: rgba(32, 33, 36, 0.92);
  padding: 48px 56px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#overlay-content h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #4caf50;
}

#overlay-message {
  font-size: 16px;
  color: #9aa0a6;
  margin-bottom: 28px;
}

#start-btn {
  background: #4caf50;
  color: #fff;
  border: none;
  padding: 14px 48px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 28px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#start-btn:hover {
  background: #43a047;
  transform: scale(1.04);
}

#start-btn:active {
  transform: scale(0.97);
}

#mobile-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
}

.ctrl-row {
  display: flex;
  gap: 4px;
}

.ctrl-btn {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  border: none;
  background: #3c4043;
  color: #e8eaed;
  font-size: 22px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: background 0.15s;
}

.ctrl-btn:active {
  background: #5f6368;
}

@media (pointer: coarse) {
  #mobile-controls {
    display: flex;
  }
}

@media (max-width: 640px) {
  #overlay-content {
    padding: 32px 36px;
  }

  #overlay-content h1 {
    font-size: 36px;
  }

  #header {
    font-size: 16px;
  }
}
