* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse 900px 480px at 50% -8%, #fff8fb 0%, transparent 55%),
    linear-gradient(180deg, #ffe8f4 0%, #e8f4ff 45%, #d4f0e8 100%);
  color: #3a2b5a;
  font-family: 'Fredoka', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  overflow: hidden;
}

#game {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
  touch-action: none;
  cursor: none;
}

#ui {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 2;
}

#scoreboard {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.score-item {
  pointer-events: auto;
  background: rgba(255,255,255,0.82);
  color: #3a2b5a;
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 8px 24px rgba(90, 40, 120, 0.12);
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.score-item .label {
  opacity: 0.7;
  font-size: 13px;
}
.score-item span:last-child {
  font-weight: 700;
  font-size: 20px;
}

#powerups {
  pointer-events: none;
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 36px;
}
.power-chip {
  background: rgba(255,255,255,0.88);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(90, 40, 120, 0.12);
  animation: chipIn 220ms ease;
}
@keyframes chipIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#controls { pointer-events: auto; display: flex; gap: 8px; align-items: center; }
#restart, #play, #homeBtn, .home-link {
  cursor: pointer;
  border: none;
  background: linear-gradient(180deg, #ff7eb6, #e85a9a);
  color: white;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 8px 24px rgba(200, 60, 120, 0.28);
}
#restart:hover, #play:hover, #homeBtn:hover, .home-link:hover { filter: brightness(1.05); }
#restart:active, #play:active, #homeBtn:active, .home-link:active { filter: brightness(0.95); }
.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(58, 20, 70, 0.28);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 3;
}
#overlay.show { opacity: 1; pointer-events: auto; }
#overlay .panel {
  background: white;
  color: #3a2b5a;
  width: min(520px, calc(100vw - 32px));
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(90, 40, 120, 0.28);
}
#overlay h1 { margin: 0 0 8px; font-size: 28px; }
#overlay p { opacity: 0.85; line-height: 1.45; margin: 0 0 10px; }
#overlay .hint {
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 16px;
}
#overlay .legend {
  display: grid;
  gap: 6px;
  margin: 12px 0 16px;
  font-size: 14px;
}
#overlay .legend span { opacity: 0.9; }
