/* The page is a viewport and nothing else: no scroll, no selection, no
   browser gestures over the canvas. */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #11161c;
  color: #cfd6de;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: fixed;
  inset: 0;
  display: block;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #11161c;
  touch-action: none;          /* the game gets the touches, not the browser */
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #11161c;
  text-align: center;
  padding: 0 24px;
}

#title {
  font-size: 19px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: #e8edf3;
}

#hint {
  font-size: 13px;
  color: #7d8894;
}

#bar {
  width: min(260px, 70vw);
  height: 3px;
  border-radius: 2px;
  background: #273039;
  overflow: hidden;
}

#fill {
  width: 0;
  height: 100%;
  background: #6fa8d4;
  transition: width 120ms linear;
}

#full {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top));
  right: calc(8px + env(safe-area-inset-right));
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: rgba(16, 21, 27, 0.45);
  color: #e8edf3;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

#trouble {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: 86vw;
  padding: 10px 14px;
  border-radius: 9px;
  background: rgba(120, 32, 32, 0.92);
  color: #fff;
  font-size: 13px;
}

#trouble p { margin: 0; }

/* The hidden attribute loses to the display rules above, so say it again
   with the same specificity. Without this the loading overlay stays up
   forever with the game running behind it, and nothing errors. */
#loading[hidden], #full[hidden], #trouble[hidden] { display: none; }

/* ---------------------------------------------------------------- rotate ---
   Turn the phone.

   Unity has nothing for this on WebGL — its orientation settings apply to
   the native iOS and Android players — and screen.orientation.lock only
   works inside fullscreen and is unimplemented on iOS Safari, which is most
   of the phones that will see this. A media query asks instead of forcing,
   and works everywhere.

   Only on a short, touchable screen held upright: the query deliberately
   does not fire on a desktop window that happens to be taller than it is
   wide, which is a thing people have and do not need telling about. */
#rotate {
  display: none;
}

@media (orientation: portrait) and (pointer: coarse) and (hover: none) {
  #rotate {
    position: fixed;
    inset: 0;
    /* Nothing else in this template sets a z-index, so any positive value
       stacks above the loading panel, the fullscreen button and the
       trouble notice — all of which are positioned and all of which are
       auto. */
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    background: #11161c;
    color: #e8ecf0;
    text-align: center;
    padding: 24px;
  }

  /* A phone, drawn rather than typed: an emoji here renders differently on
     every platform and a glyph depends on a font the device may not have. */
  #rotate-icon {
    width: 64px;
    height: 104px;
    border: 3px solid #d9a23c;
    border-radius: 12px;
    position: relative;
    animation: tip 2.4s ease-in-out infinite;
  }

  #rotate-icon span {
    position: absolute;
    left: 50%;
    bottom: 7px;
    width: 22px;
    height: 3px;
    margin-left: -11px;
    border-radius: 2px;
    background: #d9a23c;
  }

  @keyframes tip {
    0%, 30%   { transform: rotate(0deg); }
    55%, 85%  { transform: rotate(-90deg); }
    100%      { transform: rotate(0deg); }
  }

  #rotate-text strong {
    display: block;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.01em;
  }

  #rotate-text span {
    display: block;
    margin-top: 8px;
    font-size: 15px;
    color: #93a0ad;
  }
}
