:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #101410;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, #243629 0, #111812 52%, #070907 100%);
}

body {
  display: grid;
  place-items: center;
  overscroll-behavior: none;
}

#app {
  position: relative;
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
  overflow: hidden;
}

#game {
  display: block;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  width: min(
    calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)),
    calc((100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 16 / 9)
  );
  height: min(
    calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)),
    calc((100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) * 9 / 16)
  );
  background: #090b09;
  box-shadow: 0 0 50px rgb(0 0 0 / 55%);
  touch-action: none;
  outline: none;
}

@supports (height: 100dvh) {
  #game {
    width: min(
      calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)),
      calc((100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 16 / 9)
    );
    height: min(
      calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)),
      calc((100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) * 9 / 16)
    );
  }
}

.loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: white;
  font-weight: 800;
  letter-spacing: 0.12em;
  background: #00a65a;
  transition: opacity 240ms ease;
}

.loading.hidden {
  pointer-events: none;
  opacity: 0;
}

.loading-ball {
  font-size: 46px;
  animation: bounce 700ms cubic-bezier(.4, 0, .3, 1) infinite alternate;
}

.rotate-tip {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  text-align: center;
  background: rgb(20 29 22 / 96%);
}

.rotate-tip strong {
  font-size: 24px;
}

.rotate-tip span {
  color: #c9d6c9;
  font-size: 14px;
}

.phone-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 48px;
  border: 4px solid #fff;
  border-radius: 10px;
  font-size: 34px;
}

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

@keyframes bounce {
  to {
    transform: translateY(-18px) rotate(16deg);
  }
}

@media (orientation: portrait) and (max-width: 900px) {
  .rotate-tip {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-ball {
    animation: none;
  }
}
