/* The canvas is the entire UI; everything else here exists to stop mobile
   browsers from doing their usual scroll / zoom / text-select behaviour on top
   of a full-screen game. */

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #080b10;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  color: #e8e2d0;
  /* Kill the tap-highlight flash and the long-press callout on iOS. */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  /* Respect the notch / home indicator. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  /* Without this, a drag on the board scroll-chains to the page on Android. */
  touch-action: none;
  cursor: pointer;
}

/* ------------------------------------------------------- portrait nudge */
#rotate-hint {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: #0b1017;
  z-index: 10;
  text-align: center;
}

#rotate-hint p {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #cfd6dd;
}

#rotate-hint .phone {
  width: 64px;
  height: 108px;
  border: 4px solid #e8e2d0;
  border-radius: 12px;
  animation: rotate-nudge 2.2s ease-in-out infinite;
}

@keyframes rotate-nudge {
  0%,
  40% {
    transform: rotate(0deg);
  }
  60%,
  100% {
    transform: rotate(90deg);
  }
}

/* Only nag on phone-sized portrait screens — a portrait tablet is playable. */
@media (orientation: portrait) and (max-width: 760px) {
  #rotate-hint {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  #rotate-hint .phone {
    animation: none;
    transform: rotate(90deg);
  }
}

.noscript {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b1017;
  font-size: 18px;
  z-index: 20;
}
