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

:root {
  --bg: #1f1f1f;
  --primary: #f2f2f2;
  --accent: #9b9b9b;
  --danger: #f45d5d;
  --grid-border: #303030;
  --shadow: rgba(0, 0, 0, 0.45);
}

* {
  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 {
  width: min(92vw, 420px);
  position: relative;
}

.hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-items: center;
  padding: 16px 18px;
  font-size: 0.75rem;
  color: var(--accent);
  gap: 8px;
}

.home-link {
  font-size: 0.55rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid #3a3a3a;
  padding: 6px 14px;
  border-radius: 4px;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

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

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

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

.controls-hint {
  font-size: 0.6rem;
  color: var(--accent);
  text-align: center;
  white-space: nowrap;
  margin-top: 4px;
}

.controls-hint--mobile {
  display: none;
}

.playfield {
  position: relative;
  border: 2px solid #2f2f2f;
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(180deg, #212121 0%, #181818 100%);
  box-shadow: inset 0 0 0 2px #2b2b2b;
}

#game-canvas {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  border-radius: 4px;
  background: #111;
}

.ground-line {
  display: none;
}

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

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

.overlay-card {
  background: #181818;
  border: 2px solid #3a3a3a;
  border-radius: 8px;
  padding: 26px 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);
}

.final-scoreboard {
  display: inline-flex;
  gap: 12px;
  justify-content: center;
  letter-spacing: 2px;
  font-size: 0.9rem;
  color: var(--primary);
}

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

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

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

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

#share-canvas {
  width: 100%;
  height: auto;
  display: block;
}

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

.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: 520px) {
  .game-shell {
    width: min(92vw, 360px);
  }

  .controls-hint {
    font-size: 0.52rem;
    white-space: normal;
  }

  .controls-hint--desktop {
    display: none;
  }

  .controls-hint--mobile {
    display: block;
  }
}

@media (pointer: coarse) {
  .controls-hint {
    white-space: normal;
  }

  .controls-hint--desktop {
    display: none;
  }

  .controls-hint--mobile {
    display: block;
  }
}
