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

body {
  background: #1a1a2e;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
}

#game-container {
  position: relative;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

#metrics-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 8px 12px;
  flex-wrap: wrap;
}

#metrics-bar span {
  background: rgba(255, 255, 255, 0.1);
  color: #d0d0d0;
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

#canvas-wrap {
  position: relative;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  touch-action: none;
}

#sound-toggle-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 0 4px;
}

.sound-label {
  color: #888;
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.sound-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  transition: background 0.25s;
  outline: none;
  padding: 0;
}

.sound-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.sound-toggle.sound-on {
  background: #4caf50;
}

.sound-toggle.sound-on::after {
  transform: translateX(24px);
}

.sound-toggle.sound-off {
  background: #e53935;
}

.sound-toggle.sound-off::after {
  transform: translateX(0);
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  z-index: 10;
}

.overlay-content {
  text-align: center;
  color: #fff;
  padding: 32px 40px;
  background: rgba(20, 20, 40, 0.92);
  border-radius: 16px;
  border: 2px solid rgba(99, 161, 110, 0.5);
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.game-title {
  font-size: 2.4em;
  color: #63a16e;
  margin-bottom: 12px;
  text-shadow: 0 2px 8px rgba(99, 161, 110, 0.4);
  letter-spacing: 1px;
}

.game-subtitle {
  font-size: 1.05em;
  color: #d0d0d0;
  margin-bottom: 20px;
  line-height: 1.5;
}

.controls-info {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 0.92em;
  color: #bbb;
  line-height: 1.6;
}

.controls-info strong {
  color: #fff;
}

.btn {
  display: inline-block;
  padding: 14px 36px;
  font-size: 1.1em;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  letter-spacing: 0.5px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #63a16e, #4a8a58);
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #72b37e, #5a9a68);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 12px;
  padding: 10px 28px;
  font-size: 0.95em;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-cta {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  font-size: 1.05em;
}

.level-title {
  font-size: 2.2em;
  color: #63a16e;
  margin-bottom: 8px;
}

.level-env {
  font-size: 1.2em;
  color: #d0d0d0;
  margin-bottom: 24px;
}

.end-title {
  font-size: 2em;
  color: #63a16e;
  margin-bottom: 16px;
}

.end-stat {
  font-size: 1.15em;
  color: #e0e0e0;
  margin-bottom: 6px;
}

.end-tagline {
  font-size: 1em;
  color: #aaa;
  margin: 18px 0 24px;
  font-style: italic;
}

@media (max-width: 600px) {
  body {
    align-items: flex-start;
    padding-top: 5vh;
  }
  #game-container {
    max-width: 100%;
  }
  #gameCanvas {
    border-radius: 0;
  }
  .overlay-content {
    padding: 20px 24px;
  }
  .overlay {
    border-radius: 0;
  }
  .game-title {
    font-size: 1.8em;
  }
  .btn {
    padding: 12px 24px;
    font-size: 1em;
  }
  #metrics-bar {
    gap: 6px;
    padding: 6px 8px;
  }
  #metrics-bar span {
    font-size: 0.7em;
    padding: 3px 8px;
  }
}
