:root {
  color-scheme: dark;
  --ink: #ecf1de;
  --muted: #9cab92;
  --panel: #101b16;
  --panel-deep: #07100c;
  --line: #314238;
  --teal: #50c8bd;
  --lime: #b9d95e;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #07100c;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -10%, #1c3326 0, transparent 42rem),
    linear-gradient(180deg, #0b1711 0%, #050a08 100%);
  color: var(--ink);
  font-family: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
}

button,
kbd,
input,
output {
  font: inherit;
}

button {
  color: inherit;
}

.demo-shell {
  width: 100%;
  max-width: clamp(320px, calc(177.78dvh - 240px), 1280px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(14px, 2.2vw, 28px);
  display: grid;
  align-content: center;
  gap: 14px;
}

.demo-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--lime);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 3.4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.screen-button,
.game-over button {
  border: 1px solid #63776a;
  border-radius: 3px;
  background: linear-gradient(180deg, #27372f, #15231c);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 10%),
    0 4px 18px rgb(0 0 0 / 24%);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.screen-button {
  padding: 10px 14px;
}

.screen-button:hover,
.game-over button:hover {
  border-color: #9daf9d;
  background: linear-gradient(180deg, #33483d, #1d3026);
}

.screen-button:focus-visible,
.game-over button:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

.game-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid #536559;
  border-radius: 6px;
  background: #172b19;
  box-shadow:
    0 30px 80px rgb(0 0 0 / 48%),
    0 0 0 5px rgb(180 208 160 / 5%);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  touch-action: none;
}

.game-over {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 24px;
  background: rgb(4 10 7 / 72%);
  text-align: center;
  backdrop-filter: blur(3px);
}

.game-over[hidden] {
  display: none;
}

.game-over-label {
  margin: 0 0 8px;
  color: #f0bb71;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.game-over h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 1;
}

.game-over p:not(.game-over-label) {
  margin: 12px 0 22px;
  color: #c3cec0;
  font-size: 13px;
}

.game-over button {
  padding: 12px 18px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 11px;
}

.controls span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sound-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.sound-control input {
  width: 74px;
  accent-color: var(--teal);
  cursor: pointer;
}

.sound-control output {
  min-width: 31px;
  color: #dfe7db;
  font-size: 10px;
}

.sound-control input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

kbd {
  min-width: 30px;
  padding: 4px 6px;
  border: 1px solid #3b4d42;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #101b16;
  color: #e6ebdf;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.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;
}

.game-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  background: #050b08;
}

.game-stage:fullscreen canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 700px) {
  .demo-shell {
    padding: 10px;
    align-content: start;
    max-width: 100%;
  }

  .demo-header {
    align-items: center;
  }

  .eyebrow {
    font-size: 8px;
  }

  .screen-button {
    padding: 8px 10px;
    font-size: 9px;
  }

  .controls {
    gap: 7px 12px;
  }
}

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