:root {
  color-scheme: dark;
  --ink: #15120f;
  --gold: #d9a13b;
  --paper: #f1d7a8;
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(180deg, #1b2d32 0%, #0f1719 58%, #070807 100%);
  font-family: Monaco, Consolas, "Courier New", monospace;
}

.game-shell {
  position: relative;
  width: min(100vw - 24px, 1180px);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 24px);
  overflow: hidden;
  border: 4px solid var(--ink);
  outline: 3px solid var(--gold);
  background: #030303;
  box-shadow:
    0 0 0 2px #f5cf77,
    0 22px 70px rgba(0, 0, 0, 0.55);
}

.game-shell canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#gameCanvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #121212;
  cursor: crosshair;
  z-index: 1;
}

#bgCanvas {
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.34;
}

#gameCanvas:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: -8px;
}

.touch-controls {
  position: absolute;
  z-index: 3;
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: none;
  justify-content: space-between;
  pointer-events: none;
}

.touch-cluster {
  display: flex;
  gap: 10px;
}

.touch-controls button {
  width: 52px;
  height: 52px;
  border: 3px solid #15120f;
  border-radius: 8px;
  background: #f1d7a8;
  color: #15120f;
  font: 700 22px Monaco, Consolas, "Courier New", monospace;
  line-height: 1;
  box-shadow: inset -3px -3px 0 rgba(82, 54, 30, 0.45);
  pointer-events: auto;
  touch-action: none;
}

.touch-controls button:active,
.touch-controls button.is-held {
  transform: translateY(2px);
  box-shadow: inset 3px 3px 0 rgba(82, 54, 30, 0.45);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (hover: none) and (pointer: coarse) {
  .touch-controls {
    display: flex;
  }
}
