/* Full-bleed game canvas for the VK Games iframe. */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #20222c;
  color: #f4f4f4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* No text selection or callouts on long-press. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
}

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

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  background: #20222c;
  /* Revealed by the runtime once loading finishes. */
  visibility: hidden;
  image-rendering: auto;
}

#loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: #20222c;
  transition: opacity 0.35s ease;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

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

#loader-logo {
  font-size: clamp(28px, 8vw, 56px);
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #ff4c40;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

#loader-track {
  width: min(320px, 70vw);
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

#loader-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: #ff4c40;
  transition: width 0.2s ease;
}

/* Before game.data reports bytes (love.wasm is still coming down) there is
   nothing honest to show as a percentage - so sweep instead of sitting at 0%. */
#loader-bar.indeterminate {
  width: 40%;
  transition: none;
  animation: loader-sweep 1.2s ease-in-out infinite alternate;
}

@keyframes loader-sweep {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

#loader-text {
  font-size: 14px;
  opacity: 0.7;
  min-height: 1.2em;
}

/* Beats the id selector below, which would otherwise override [hidden]. */
#fatal[hidden] {
  display: none;
}

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

#fatal button {
  padding: 10px 22px;
  font-size: 15px;
  border: 0;
  border-radius: 8px;
  background: #ff4c40;
  color: #fff;
  cursor: pointer;
}
