html .cardboard-game > dialog.startup-loader#startup-loader {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  inline-size: 100%;
  block-size: 100%;
  max-inline-size: none;
  max-block-size: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: clip;
  overscroll-behavior: none;
  color: #f8e6bd;
  background: #10182a;
}

html .cardboard-game > dialog.startup-loader#startup-loader[open] {
  display: block;
}

html[data-mobile-game][data-launch-mode='standalone'] .cardboard-game > dialog#startup-loader[open] {
  inline-size: 100dvw;
  block-size: var(--yard-visible-height, 100dvh);
  max-inline-size: none;
  max-block-size: none;
}

#startup-loader .startup-content {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: end;
  text-align: center;
}

#startup-loader .startup-campfire {
  --campfire-ratio: 1.77777778;
  --campfire-focus-y: 50%;
  --fire-x: 49.4%;
  --fire-base: 68.7%;
  --fire-width: 6%;
  --fire-height: 10%;
  position: absolute;
  inset-block-start: var(--campfire-focus-y);
  inset-inline-start: 50%;
  transform: translate(-50%, calc(-1 * var(--campfire-focus-y)));
  isolation: isolate;
  inline-size: max(100%, calc(var(--yard-visible-height, 100dvh) * var(--campfire-ratio)));
  aspect-ratio: var(--campfire-ratio);
  margin: 0;
}

#startup-loader .startup-campfire img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

#startup-loader .startup-fire {
  position: absolute;
  left: var(--fire-x);
  top: var(--fire-base);
  inline-size: var(--fire-width);
  block-size: var(--fire-height);
  transform: translate(-50%, -100%);
  pointer-events: none;
}

#startup-loader .startup-fire::before {
  position: absolute;
  inset: -20% -150% -46%;
  content: '';
  background: radial-gradient(ellipse at 50% 55%, #ffc27547, #fca04b26 35%, transparent 69%);
  opacity: .62;
  animation: startup-firelight 2.5s ease-in-out infinite;
}

#startup-loader .startup-fire::after,
#startup-loader .startup-flame {
  position: absolute;
  inset: 23% 24% 3% 26%;
  content: '';
  border-radius: 66% 35% 56% 49% / 88% 67% 34% 33%;
  background: radial-gradient(ellipse at 50% 81%, #fff3a94d, #ffc55b52 39%, #fb841c3e 61%, transparent 77%);
  transform-origin: 50% 96%;
  animation: startup-flame 1.5s ease-in-out infinite alternate;
}

#startup-loader .startup-flame {
  inset: 32% 47% 5% 15%;
  animation-duration: 1.1s;
  animation-delay: -.6s;
}

#startup-loader .startup-ember {
  --drift: -15px;
  position: absolute;
  left: 48%;
  bottom: 24%;
  inline-size: clamp(1px, .32vmin, 3px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffcb80;
  box-shadow: 0 0 4px #fd9e45;
  opacity: 0;
  animation: startup-ember 2.7s linear infinite;
}

#startup-loader .startup-ember:nth-of-type(3) {
  --drift: 9px;
  left: 65%;
  animation-duration: 2.3s;
  animation-delay: -.85s;
}

#startup-loader .startup-ember:nth-of-type(4) {
  --drift: 20px;
  left: 29%;
  animation-delay: -1.8s;
}

#startup-loader .startup-caption {
  position: relative;
  display: grid;
  justify-items: center;
  gap: clamp(5px, 1.1vmin, 12px);
  padding-block: clamp(22px, 7dvh, 72px) max(16px, env(safe-area-inset-bottom));
  padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right));
  background: linear-gradient(transparent, #07111db3 60%, #07111df2);
}

#startup-title {
  margin: 0;
  color: inherit;
  font: bold clamp(19px, 4.1vmin, 36px)/1.13 Georgia, serif;
  text-shadow: 0 2px #23180f;
  text-wrap: balance;
  outline: none;
}

#startup-loader :is(.startup-rotate-title, .startup-rotate-help) { display: none; }

#startup-status {
  margin: 0;
  min-block-size: 1.2em;
  color: #efd6a8;
  font: 600 clamp(13px, 2vmin, 17px)/1.25 system-ui, sans-serif;
}

#startup-loader .startup-track {
  inline-size: min(80%, 270px);
  block-size: 9px;
}

#startup-progress:not([hidden]) {
  display: block;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  inline-size: 100%;
  block-size: 100%;
  overflow: hidden;
  border: 1px solid #917047;
  border-radius: 2px;
  background: #251d16;
  color: #e0a458;
}

#startup-progress::-webkit-progress-bar { background: #251d16; }
#startup-progress::-webkit-progress-value { background: #e0a458; }
#startup-progress::-moz-progress-bar { background: #e0a458; }

@keyframes startup-firelight {
  0%, 100% { opacity: .47; }
  23% { opacity: .85; }
  58% { opacity: .53; }
  78% { opacity: .79; }
}

@keyframes startup-flame {
  0% { opacity: .34; transform: scale(.94, .83) rotate(-6deg); }
  51% { opacity: .67; transform: scale(.9, 1.11) rotate(4deg); }
  100% { opacity: .41; transform: scale(1.06, .9) rotate(-3deg); }
}

@keyframes startup-ember {
  0% { opacity: 0; transform: translate(0, 0) scale(.6); }
  16% { opacity: .85; }
  72% { opacity: .45; }
  100% { opacity: 0; transform: translate(var(--drift), max(-48px, -8vmin)) scale(.18); }
}

#startup-loader[data-paused] .startup-fire::before,
#startup-loader[data-paused] .startup-fire::after,
#startup-loader[data-paused] :is(.startup-flame, .startup-ember) {
  animation-play-state: paused;
}

@media (orientation: portrait) {
  html[data-mobile-game][data-launch-mode='standalone'] #startup-loader .startup-content {
    align-items: center;
    background: var(--cardboard-cloth) center / 284px auto repeat #422a1e;
    background-blend-mode: multiply;
  }
  html[data-mobile-game][data-launch-mode='standalone'] #startup-loader :is(.startup-campfire, .startup-campfire-title) {
    display: none;
  }
  html[data-mobile-game][data-launch-mode='standalone'] #startup-loader .startup-caption {
    gap: 10px;
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    background: none;
  }
  html[data-mobile-game][data-launch-mode='standalone'] #startup-loader .startup-rotate-title {
    display: block;
    padding: 13px 24px;
    color: var(--cardboard-ink);
    background: var(--cardboard-label) center / 100% 100% no-repeat;
    font-size: clamp(22px, 7vw, 34px);
    text-shadow: none;
  }
  html[data-mobile-game][data-launch-mode='standalone'] #startup-loader .startup-rotate-help {
    display: block;
    max-width: 28ch;
    margin: 0;
    color: #fff0d0;
    font: 600 1rem/1.35 system-ui, sans-serif;
    text-wrap: balance;
  }
}

@media (orientation: landscape) and (max-height: 555px) {
  #startup-loader .startup-campfire { --campfire-focus-y: 65%; }
}

@media (orientation: landscape) and (max-height: 285px) {
  #startup-loader .startup-campfire { --campfire-focus-y: 83%; }
  #startup-loader .startup-caption { padding-block-end: max(10px, env(safe-area-inset-bottom)); }
  #startup-title { font-size: clamp(18px, 4.8vw, 23px); }
  #startup-status { font-size: 12px; }
  #startup-loader .startup-track { block-size: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  #startup-loader .startup-fire::before,
  #startup-loader .startup-fire::after,
  #startup-loader :is(.startup-flame, .startup-ember) {
    animation: none;
  }
}
