* {
  box-sizing: border-box;
}

html, body {
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: #0d0d0d;
  color: limegreen;
  font-family: "Courier New", Courier, monospace;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
  text-align: center;
}

.exit-link {
  align-self: flex-start;
  color: limegreen;
  background: #1a1a1a;
  border: 1px solid limegreen;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.exit-link:hover,
.exit-link:focus {
  background: limegreen;
  color: black;
}

.tagline {
  margin: 0;
  max-width: 32rem;
  text-align: center;
  color: #7ee787;
  font-size: 0.95rem;
}

.score-board {
  display: flex;
  gap: 2rem;
  font-size: 1.1rem;
  font-weight: bold;
}

canvas {
  background: black;
  border-radius: 4px;
  max-width: 100%;
  height: auto;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.controls {
  color: #7ee787;
  font-size: 0.95rem;
  text-align: center;
  max-width: 32rem;
}

kbd {
  background: #1a1a1a;
  border: 1px solid limegreen;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  color: limegreen;
}

.dpad {
  display: none;
  grid-template-columns: repeat(3, 3.5rem);
  grid-template-rows: repeat(2, 3.5rem);
  gap: 0.5rem;
  justify-content: center;
}

.dpad-btn {
  font-size: 1.4rem;
  background: #1a1a1a;
  border: 1px solid limegreen;
  border-radius: 8px;
  color: limegreen;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
  background: limegreen;
  color: black;
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 2; }

/* Show the on-screen D-pad only on touch devices (phones/tablets) */
@media (pointer: coarse) {
  .dpad {
    display: grid;
  }
}
