html {
  -ms-touch-action: none;
}

body, canvas, div {
  display: block;
  outline: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);

  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -khtml-user-select: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* Remove spin of input type number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  /* display: none; <- Crashes Chrome on hover */
  -webkit-appearance: none;
  margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}

body {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  margin: 0;

  cursor: default;
  color: #888;
  background-color: #333;

  text-align: center;
  font-family: Helvetica, Verdana, Arial, sans-serif;

  display: flex;
  flex-direction: column;
  
  /* fix bug: https://github.com/cocos-creator/2d-tasks/issues/791 */
  /* overflow cannot be applied in Cocos2dGameContainer, 
  otherwise child elements will be hidden when Cocos2dGameContainer rotated 90 deg */
  overflow: hidden;
}

#Cocos2dGameContainer {
  position: absolute;
  margin: 0;
  left: 0px;
  top: 0px;

  display: -webkit-box;
  -webkit-box-orient: horizontal;
  -webkit-box-align: center;
  -webkit-box-pack: center;
}

canvas {
  background-color: rgba(0, 0, 0, 0);
}

a:link, a:visited {
  color: #666;
}

a:active, a:hover {
  color: #666;
}

#apk-download {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 58px);
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 2101;
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 14px 0 12px;
  border: 1px solid #ffe28a;
  border-radius: 13px;
  background: linear-gradient(145deg, #a82219 0%, #751116 78%);
  box-shadow: 0 2px 0 #4b090d, 0 8px 20px rgba(0, 0, 0, .46), inset 0 1px 0 rgba(255, 239, 186, .24);
  color: #fff4cf;
  font-family: system-ui, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  transition: transform .16s ease, filter .16s ease;
}

.apk-download-icon {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: #ffe28a;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .42));
}

.apk-download-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1;
}

.apk-download-label strong {
  color: #fff4cf;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .035em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .52);
}

.apk-download-label small {
  color: #f2d47c;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

#apk-download:hover {
  filter: brightness(1.1);
  color: #fff8e0;
}

#apk-download:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

#apk-download:active {
  transform: translateY(2px);
  filter: brightness(.96);
  box-shadow: 0 0 0 #4b090d, 0 4px 12px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 239, 186, .18);
}

@media (max-width: 480px) {
  #apk-download {
    right: max(8px, env(safe-area-inset-right, 0px));
    min-height: 44px;
    padding: 0 10px;
  }

  .apk-download-icon {
    width: 19px;
    height: 19px;
  }

  .apk-download-label strong {
    font-size: 12px;
  }

  .apk-download-label small {
    font-size: 8px;
  }
}

#orientation-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background:
    linear-gradient(rgba(3, 9, 25, .82), rgba(3, 9, 25, .9)),
    url(./splash.png) center / cover no-repeat;
  color: #fff4cf;
  text-align: center;
}

.orientation-icon {
  width: 70px;
  height: 70px;
  fill: none;
  stroke: #ffd45a;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  filter: drop-shadow(0 4px 14px rgba(255, 192, 55, .32));
}

.orientation-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-shadow: 0 2px 9px rgba(0, 0, 0, .75);
}

.orientation-copy strong {
  color: #ffe28a;
  font: 800 clamp(22px, 5vw, 32px)/1.2 system-ui, sans-serif;
}

.orientation-copy span {
  color: #fff8e0;
  font: 500 clamp(14px, 3vw, 18px)/1.4 system-ui, sans-serif;
}

@media screen and (orientation: portrait) and (max-width: 900px) {
  #orientation-gate {
    display: flex;
  }
}

p.header {
  font-size: small;
}

p.footer {
  font-size: x-small;
}

#splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  background: #040b1f url(./splash.png) no-repeat center center;
  background-size: cover;
}

.loading-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(13, 27, 62, .18), rgba(2, 7, 20, .68) 72%),
    linear-gradient(180deg, rgba(2, 7, 20, .12), rgba(2, 7, 20, .12) 52%, rgba(2, 7, 20, .78));
}

.loading-status {
  position: absolute;
  left: 50%;
  bottom: 13%;
  display: flex;
  width: min(72vw, 760px);
  flex-direction: column;
  align-items: center;
  gap: 18px;
  transform: translateX(-50%);
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 24px;
  padding: 4px;
  overflow: hidden;
  border: 2px solid #ffe28a;
  border-radius: 999px;
  background: #091b43;
  box-shadow: 0 0 18px rgba(255, 194, 45, .34), 0 6px 22px rgba(0, 0, 0, .55);
}

.progress-bar span {
  position: relative;
  display: block;
  width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 999px;
  transition: width .25s ease-out;
  background: linear-gradient(180deg, #fff3a5 0%, #ffd84a 45%, #e9940b 100%);
  box-shadow: 0 0 12px rgba(255, 214, 75, .8) inset;
}

.stripes span::after {
  position: absolute;
  inset: 0;
  content: "";
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .38) 0 9px, transparent 9px 20px);
  animation: animate-stripes 1s linear infinite;
}

.loading-copy {
  color: #fff8e0;
  font: 700 clamp(18px, 2.4vw, 28px)/1.2 system-ui, sans-serif;
  letter-spacing: .04em;
  text-shadow: 0 2px 10px #000, 0 0 16px rgba(255, 208, 86, .42);
}

@keyframes animate-stripes {
  to { background-position: 40px 0; }
}

@media (max-aspect-ratio: 4/3) {
  .loading-status {
    width: 82vw;
    bottom: 12%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stripes span::after {
    animation: none;
  }
}
