@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

:root {
  --bg: #222222;
  --ground: #f7f7f7;
  --primary: #f2f2f2;
  --accent: #9b9b9b;
  --danger: #f45d5d;
}

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

body {
  font-family: "Press Start 2P", monospace;
  background: var(--bg);
  color: var(--primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  gap: 20px;
  padding: 32px 12px;
}

.game-shell {
  position: relative;
  width: min(90vw, 900px);
  max-width: 900px;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  font-size: 0.9rem;
  color: var(--accent);
}

.scoreboard {
  display: inline-flex;
  gap: 12px;
  letter-spacing: 2px;
}

.scoreboard .label {
  color: var(--primary);
}

.controls-hint {
  font-size: 0.65rem;
  color: var(--accent);
}

.playfield {
  position: relative;
  background: #1d1d1d;
  border: 2px solid #3d3d3d;
  border-radius: 6px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  image-rendering: pixelated;
  width: 100%;
  height: auto;
  background: linear-gradient(180deg, #1d1d1d 0%, #1a1a1a 70%, #151515 100%);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px #2b2b2b;
}

.ground-line {
  position: absolute;
  bottom: 32px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: var(--primary);
  opacity: 0.6;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: rgba(17, 17, 17, 0.85);
  z-index: 1000;
  transition: opacity 150ms ease;
}

.overlay--hidden {
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.overlay-card {
  background: #181818;
  border: 2px solid #3a3a3a;
  border-radius: 8px;
  padding: 24px 32px;
  text-align: center;
  width: min(90%, 640px);
  color: var(--primary);
  display: grid;
  gap: 16px;
}

.overlay-card h1 {
  font-size: 1.5rem;
  color: var(--danger);
}

.overlay-card .final-score {
  font-size: 0.9rem;
  color: var(--accent);
}

.btn {
  font-family: inherit;
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: 12px 24px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 120ms ease, color 120ms ease;
}

.btn:hover,
.btn:focus-visible {
  outline: none;
  background: var(--primary);
  color: #181818;
}

.share-preview {
  background: #111111;
  padding: 12px;
  border: 1px dashed #3d3d3d;
  border-radius: 6px;
}

#share-canvas {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.credits {
  font-size: 0.55rem;
  color: var(--accent);
  text-align: center;
  letter-spacing: 1px;
  margin-top: 24px;
}

.credits a {
  color: var(--primary);
  text-decoration: none;
}

.credits a:hover,
.credits a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.heart {
  color: #f45d5d;
  font-size: 0.75rem;
  display: inline-block;
  transform: translateY(1px);
}

@media (max-width: 600px) {
  .hud {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .controls-hint {
    font-size: 0.55rem;
  }
}
