:root {
  --bg: #05050f;
  --fg: #c9d1ff;
  --dim: #6b73a8;
  --accent: #ff3b3b;
  --font: "Press Start 2P", ui-monospace, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 8px;
  line-height: 1.6;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}

header,
footer {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 16px;
  color: var(--dim);
}

header h1 {
  margin: 0;
  font-size: 10px;
  font-weight: normal;
  color: var(--fg);
}

footer a {
  color: var(--dim);
}

footer a:hover {
  color: var(--accent);
}

main {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
}

.screen {
  position: relative;
  line-height: 0;
  box-shadow: 0 0 40px rgba(60, 90, 255, 0.18);
}

canvas {
  display: block;
  image-rendering: pixelated;
  background: #000;
  touch-action: none;
}

/* scanlines + vignette */
.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.14) 3px
    ),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.35));
}

#pad {
  display: none;
  flex: none;
  gap: 12px;
  padding: 8px 16px 14px;
}

#pad button {
  flex: 1;
  height: 64px;
  border: 2px solid var(--dim);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#pad button.down {
  background: rgba(255, 59, 59, 0.35);
  border-color: var(--accent);
}

#pad #btn-fire {
  flex: 1.6;
}

@media (pointer: coarse) {
  #pad {
    display: flex;
  }
  footer span {
    display: none;
  }
  footer {
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  header,
  footer {
    padding: 8px 16px;
  }
}
