/* Холст занимает всё окно с сохранением пропорций 16:9 (размер считает Renderer). */
html,
body {
  margin: 0;
  height: 100%;
  background: #050608;
  overflow: hidden;
  /* Телефоны: без «оттягивания» страницы, выделения текста и подсветки касаний. */
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Высота видимой области на телефонах (без панели адреса). */
  height: 100dvh;
}

#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Просьба повернуть телефон (показывается игрой в портретной ориентации). */
#rotate {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px;
  background: #050608;
  color: #e8ecf2;
  font-family: "PT Mono", Consolas, "Courier New", monospace;
  font-size: 20px;
  text-align: center;
  touch-action: manipulation;
}

#rotate[hidden] {
  display: none;
}

#rotate p {
  margin: 0;
  max-width: 20em;
  line-height: 1.4;
}

/* Пиксельный «телефон», который поворачивается набок. */
#rotate .phone {
  width: 54px;
  height: 92px;
  border: 6px solid #f2c230;
  border-radius: 4px;
  box-sizing: border-box;
  position: relative;
  animation: rotate-phone 2.4s ease-in-out infinite;
}

#rotate .phone::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 10px;
  height: 4px;
  margin-left: -5px;
  background: #f2c230;
}

@keyframes rotate-phone {
  0%, 25% { transform: rotate(0deg); }
  55%, 100% { transform: rotate(-90deg); }
}

#rotate button {
  font: inherit;
  font-size: 16px;
  color: #8d96a8;
  background: transparent;
  border: 2px solid #4a5266;
  padding: 10px 18px;
  cursor: pointer;
}

/* Экран ошибки запуска. */
#boot-error {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050608;
  color: #e8ecf2;
  font-family: "PT Mono", Consolas, "Courier New", monospace;
  padding: 24px;
  z-index: 10;
  user-select: text;
  -webkit-user-select: text;
}

#boot-error[hidden] {
  display: none;
}

#boot-error .box {
  max-width: 820px;
  border: 3px solid #8f99ad;
  padding: 24px 32px;
  background: #0b0d14;
}

#boot-error h1 {
  color: #f2c230;
  font-size: 22px;
  margin-top: 0;
}

#boot-error pre {
  white-space: pre-wrap;
  color: #e0605a;
  max-height: 40vh;
  overflow: auto;
  font-size: 13px;
}

#boot-error a {
  color: #f2c230;
}
