:root {
  color-scheme: dark;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  background: #171024;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, #463b78 0, #21172f 40%, #0e0a16 82%);
}

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(8px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.game-shell {
  position: relative;
  width: min(calc(100vw - 16px), calc((100dvh - 16px) * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgb(135 153 205 / 58%);
  border-radius: clamp(10px, 2vw, 22px);
  background: #251d38;
  box-shadow:
    0 32px 100px rgb(0 0 0 / 58%),
    0 0 48px rgb(105 205 239 / 14%),
    0 0 0 1px rgb(255 255 255 / 10%) inset;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: crosshair;
  image-rendering: auto;
}

#orientation-hint {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 28px;
  background: #21172f;
  color: #fff7e8;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#orientation-hint span {
  display: block;
  color: #ffd166;
  font-size: 46px;
}

@media (orientation: portrait) and (max-width: 740px) {
  .game-shell {
    width: calc(100vw - 16px);
  }

  #orientation-hint {
    display: grid;
  }
}

@media (pointer: coarse), (max-height: 540px) {
  body {
    padding: env(safe-area-inset-top)
      env(safe-area-inset-right)
      env(safe-area-inset-bottom)
      env(safe-area-inset-left);
  }

  .game-shell {
    width: min(
      calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right)),
      calc((100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 16 / 9)
    );
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-shell {
    scroll-behavior: auto;
  }
}
