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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #4ab8d9;
  font-family: system-ui, -apple-system, sans-serif;
}

body.in-game {
  background: #0a1628;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

/* ── Main menu ── */

#main-menu {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
}

#menu-bubbles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#studio-logo-link {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 2;
  line-height: 0;
  transition: opacity 0.15s, transform 0.15s;
}

#studio-logo-link:hover {
  opacity: 0.9;
  transform: scale(1.03);
}

#studio-logo {
  max-width: min(220px, 40vw);
  height: auto;
  display: block;
  opacity: 0.95;
  filter: drop-shadow(0 2px 8px rgba(0, 40, 60, 0.35));
}

.menu-panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 380px);
  padding: 32px 28px 28px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 60, 90, 0.25);
  text-align: center;
}

#game-logo {
  display: block;
  width: min(280px, 75vw);
  height: auto;
  margin: 0 auto 8px;
}

.menu-subtitle {
  margin: 0 0 24px;
  color: #4a8090;
  font-size: 0.95rem;
}

.menu-label {
  display: block;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #3a7080;
  margin-bottom: 6px;
}

.menu-label:not(:first-of-type) {
  margin-top: 18px;
}

#player-name {
  width: 100%;
  padding: 11px 14px;
  font-size: 1rem;
  border: 2px solid #b8dfe8;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}

#player-name:focus {
  border-color: #3aadc8;
}

.name-error {
  min-height: 1.2em;
  margin-top: 4px;
  text-align: left;
  font-size: 0.82rem;
  color: #c0392b;
}

.color-picker {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  border-color: #0e6e8a;
  transform: scale(1.12);
}

#play-btn {
  margin-top: 26px;
  width: 100%;
  padding: 13px 24px;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #2ec4b6, #1fa89c);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(30, 140, 130, 0.35);
  transition: transform 0.12s, opacity 0.12s, box-shadow 0.12s;
}

#play-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(30, 140, 130, 0.45);
}

#play-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Game canvas ── */

#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ── HUD ── */

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 10;
}

#size-display {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 12px;
}

#leaderboard {
  background: rgba(0, 40, 80, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 160px;
}

#leaderboard h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
  margin-bottom: 6px;
}

#leaderboard-list {
  padding-left: 20px;
  font-size: 0.95rem;
  line-height: 1.5;
}

#leaderboard-list .player-entry {
  color: #7ee8ff;
  font-weight: 600;
}

/* ── Death screen ── */

#death-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 10, 30, 0.75);
  z-index: 20;
  color: #fff;
  gap: 12px;
}

#death-screen h2 {
  font-size: 2rem;
}

#restart-btn,
#menu-btn {
  margin-top: 4px;
  padding: 10px 28px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
}

#restart-btn {
  background: #2ec4b6;
  color: #042;
}

#restart-btn:hover {
  background: #3dd9cb;
}

#menu-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

#menu-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}
