:root {
  color-scheme: dark;
  --ink: #f7f1df;
  --muted: #b9c0a5;
  --surface: #111a18;
  --accent: #ffcc3d;
  --danger: #e4503e;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 204, 61, 0.22), transparent 34rem),
    linear-gradient(180deg, #121915 0%, #0a0d0d 100%);
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  overflow: hidden;
}

.shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  gap: 0.85rem;
  padding: clamp(0.75rem, 2vw, 1.5rem);
}

.game-frame {
  position: relative;
  width: min(100%, 1120px);
  aspect-ratio: 16 / 9;
  max-height: calc(100svh - 6.5rem);
  background: #0b1110;
  border: 2px solid rgba(247, 241, 223, 0.22);
  box-shadow: 0 1.4rem 4rem rgba(0, 0, 0, 0.48);
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.controls-hint {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  max-width: min(34rem, calc(100% - 1.5rem));
  color: rgba(247, 241, 223, 0.92);
  font-size: clamp(0.62rem, 1.5vw, 0.78rem);
  line-height: 1;
  pointer-events: none;
}

.controls-hint span {
  padding: 0.38rem 0.5rem;
  background: rgba(10, 15, 14, 0.72);
  border: 1px solid rgba(247, 241, 223, 0.22);
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  align-content: center;
  gap: 1.25rem;
  background: rgba(7, 9, 9, 0.62);
  text-align: center;
  backdrop-filter: blur(2px);
}

.overlay.is-visible {
  display: grid;
}

.overlay-title {
  max-width: 14ch;
  color: var(--ink);
  font-size: clamp(2.4rem, 9vw, 5.8rem);
  line-height: 0.9;
  text-transform: uppercase;
  text-shadow: 0 0.16em 0 #17211f, 0 0.22em 0 rgba(0, 0, 0, 0.45);
}

button {
  min-width: 3.15rem;
  min-height: 3.15rem;
  border: 2px solid rgba(247, 241, 223, 0.35);
  background: #1d2a24;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: #26362f;
  outline: none;
}

#startButton {
  padding: 0.9rem 1.5rem;
  color: #121006;
  background: var(--accent);
  border-color: #fff4a6;
  text-transform: uppercase;
  box-shadow: 0 0.4rem 0 #875a19;
}

.touch-controls {
  display: grid;
  grid-template-columns: repeat(5, 3.2rem);
  gap: 0.55rem;
}

.touch-controls button {
  border-radius: 0;
  color: var(--ink);
  background: #16211e;
  touch-action: none;
}

@media (min-width: 900px) and (pointer: fine) {
  .touch-controls {
    display: none;
  }

  .game-frame {
    max-height: calc(100svh - 3rem);
  }
}
