/* 16:9 캔버스를 화면 가운데에 비율 유지로 배치한다. 픽셀 그림이라 확대는 또렷하게 한다 */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* 주소창이 접히고 펴져도 흔들리지 않게 dvw/dvh 를 쓰고,
   노치와 홈 인디케이터가 먹는 영역을 빼고 무대 크기를 잰다 */
:root {
  --safe-w: calc(100dvw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  --safe-h: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #16110c;
}

body {
  position: fixed;
  inset: 0;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 80% 65% at 50% 42%, #2b2018 0%, #16110c 76%);
  font-family: system-ui, "Segoe UI", sans-serif;
  cursor: default;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  /* 16:9(1280x720)를 유지하면서 창에 맞춰 최대한 키운다 */
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  width: min(var(--safe-w), calc(var(--safe-h) * 16 / 9));
  height: min(var(--safe-h), calc(var(--safe-w) * 9 / 16));
  position: relative;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
  /* 32px 타일을 정수배로 그린 화면이다. 브라우저가 흐리게 늘이면 그림체가 죽는다 */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
}
