:root {
  color-scheme: dark;
  background: #111827;
  --game-width: min(calc(100vw - 16px), calc(66.667vh - 10.667px), 920px);
  --game-max-height: calc(100vh - 16px);
  --game-width: min(calc(100vw - 16px), calc(66.667dvh - 10.667px), 920px);
  --game-max-height: calc(100dvh - 16px);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: auto;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 213, 79, 0.16), transparent 24%),
    radial-gradient(circle at 88% 18%, rgba(59, 130, 246, 0.18), transparent 26%),
    radial-gradient(circle at 62% 80%, rgba(255, 107, 129, 0.08), transparent 28%),
    linear-gradient(180deg, #0b1220 0%, #111827 52%, #050915 100%);
  color: #ebf4fa;
  font-family: "Courier New", Courier, monospace;
}

.game-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 8px env(safe-area-inset-right) 8px env(safe-area-inset-left);
}

canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: var(--game-width);
  height: auto;
  max-height: var(--game-max-height);
  border-radius: 8px;
  background: #111827;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.48),
    0 0 0 2px rgba(59, 130, 246, 0.18);
  image-rendering: pixelated;
  touch-action: none;
  user-select: none;
}

.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 (min-width: 900px) {
  :root {
    --game-width: min(calc(100vw - 32px), calc(66.667vh - 21.334px), 980px);
    --game-max-height: calc(100vh - 32px);
    --game-width: min(calc(100vw - 32px), calc(66.667dvh - 21.334px), 980px);
    --game-max-height: calc(100dvh - 32px);
  }

  .game-shell {
    padding: 16px;
  }

  .game-shell::before,
  .game-shell::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
  }

  .game-shell::before {
    background:
      linear-gradient(115deg, transparent 0 11%, rgba(255, 213, 79, 0.13) 11% 13%, transparent 13% 100%),
      linear-gradient(245deg, transparent 0 16%, rgba(59, 130, 246, 0.16) 16% 18%, transparent 18% 100%),
      repeating-linear-gradient(0deg, rgba(235, 244, 250, 0.035) 0 1px, transparent 1px 34px),
      repeating-linear-gradient(90deg, rgba(235, 244, 250, 0.03) 0 1px, transparent 1px 34px);
  }

  .game-shell::after {
    background:
      linear-gradient(90deg, rgba(255, 179, 0, 0.18), transparent 22% 78%, rgba(59, 130, 246, 0.16)),
      repeating-linear-gradient(135deg, transparent 0 52px, rgba(255, 107, 129, 0.08) 52px 56px, transparent 56px 112px);
    mask-image: linear-gradient(90deg, #000 0 16%, transparent 34% 66%, #000 84% 100%);
  }

  canvas {
    border-radius: 10px;
    box-shadow:
      0 34px 90px rgba(0, 0, 0, 0.55),
      0 0 0 2px rgba(59, 130, 246, 0.2);
  }
}

@media (max-width: 540px) {
  :root {
    --game-width: min(calc(100vw - 8px), calc(66.667vh - 5.334px));
    --game-max-height: calc(100vh - 8px);
    --game-width: min(calc(100vw - 8px), calc(66.667dvh - 5.334px));
    --game-max-height: calc(100dvh - 8px);
  }

  .game-shell {
    padding: 4px;
  }

  canvas {
    max-height: var(--game-max-height);
  }
}
