:root {
  color-scheme: dark;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  background: #090a08;
  color: #d8dfc8;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% -20%, #30372c 0, transparent 52%),
    #090a08;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: clamp(8px, 1.5vh, 16px) clamp(12px, 4vw, 48px);
}

button,
canvas {
  -webkit-tap-highlight-color: transparent;
}

.cabinet {
  width: min(100%, 1040px);
  margin: 0 auto;
}

.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 8px;
  color: #e9eddf;
}

.eyebrow,
.build-mark {
  margin: 0;
}

.sound-controls {
  display: grid;
  grid-template-columns: minmax(72px, 140px) 4ch;
  align-items: center;
  gap: 8px;
}

.sound-controls output {
  color: #d8dfc8;
  text-align: right;
}

.sound-controls input {
  width: 100%;
  accent-color: #00aaaa;
}

.eyebrow,
.build-mark {
  color: #89917f;
  font-size: clamp(0.62rem, 1.6vw, 0.75rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.build-mark {
  padding-bottom: 2px;
  text-align: right;
  white-space: nowrap;
}

.screen-shell {
  padding: clamp(8px, 1.8vw, 16px);
  border: 1px solid #454b41;
  border-radius: 5px;
  background: linear-gradient(145deg, #292c28, #171916 70%);
  box-shadow:
    0 28px 80px rgb(0 0 0 / 55%),
    inset 0 1px 0 rgb(255 255 255 / 8%);
}

.screen-bezel {
  position: relative;
  overflow: hidden;
  aspect-ratio: 8 / 5;
  border: clamp(5px, 1vw, 10px) solid #070807;
  border-radius: 2px;
  background: #000;
  box-shadow:
    0 0 0 1px #3c4038,
    inset 0 0 24px rgb(0 0 0 / 80%);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
}

#game:focus-visible {
  box-shadow: inset 0 0 0 2px #00aaaa;
}

.screen-glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgb(255 255 255 / 1.5%), transparent 3%, transparent 97%, rgb(0 0 0 / 12%)),
    repeating-linear-gradient(0deg, rgb(0 0 0 / 7%) 0 1px, transparent 1px 3px);
  mix-blend-mode: screen;
  opacity: 0.42;
}

.screen-meta {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto minmax(116px, 180px) auto;
  align-items: center;
  gap: clamp(10px, 2vw, 28px);
  padding: 9px 4px 0;
  color: #747c70;
  font-size: 0.64rem;
  letter-spacing: 0.12em;
}

.key-hints {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.5vw, 20px);
  color: #929b8a;
}

.key-hints > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

kbd {
  display: inline-grid;
  min-width: 1.7em;
  min-height: 1.7em;
  margin-right: 3px;
  place-items: center;
  border: 1px solid #4c5548;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #1a1d18;
  color: #dce5d4;
  font: inherit;
}

.touch-controls {
  display: none;
  justify-content: center;
  padding-top: 12px;
}

.game-description {
  width: min(100%, 760px);
  margin: 14px auto 0;
  color: #89917f;
  font-size: 0.72rem;
  line-height: 1.6;
}

.game-description h2 {
  margin: 0 0 3px;
  color: #b5bdab;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-description p {
  margin: 0;
}

.dpad {
  display: none;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 5px;
}

.dpad button {
  border: 1px solid #4e574a;
  border-radius: 4px;
  background: #1a1d18;
  color: #d9e1d2;
  font: 700 1.15rem/1 inherit;
  touch-action: manipulation;
}

.dpad button:active {
  translate: 0 1px;
  border-color: #00aaaa;
  color: #55ffff;
}

.dpad [data-direction="up"] {
  grid-column: 2;
  grid-row: 1;
}

.dpad [data-direction="left"] {
  grid-column: 1;
  grid-row: 2;
}

.dpad [data-action="start"] {
  grid-column: 2;
  grid-row: 2;
  color: #aaaa00;
}

.dpad [data-direction="right"] {
  grid-column: 3;
  grid-row: 2;
}

.dpad [data-direction="down"] {
  grid-column: 2;
  grid-row: 3;
}

@media (pointer: coarse), (max-width: 720px) {
  body {
    padding-inline: 10px;
  }

  .masthead {
    align-items: start;
  }

  .screen-meta {
    grid-template-columns: auto auto minmax(92px, 1fr);
    gap: 8px;
  }

  .video-mode,
  .speaker-label,
  .hint-label {
    display: none;
  }

  .key-hints {
    justify-content: start;
    gap: 4px;
  }

  .key-hints > span {
    gap: 0;
  }

  .sound-controls {
    grid-template-columns: minmax(56px, 1fr) 4ch;
    gap: 4px;
  }

  .touch-controls {
    display: grid;
  }

  .dpad {
    display: grid;
  }
}

@media (max-width: 480px) {
  .build-mark {
    display: none;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
