#boot-splash {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  isolation: isolate;
  overflow: hidden;
  background: #ead1aa;
  color: #432316;
  font-family: Georgia, serif;
  transition: opacity 280ms ease;
}

/* The game stylesheet arrives while the splash is still visible. */
#boot-splash,
#boot-splash *,
#boot-splash *::before {
  box-sizing: border-box;
}

#boot-splash.boot-ready {
  opacity: 0;
  pointer-events: none;
}

.boot-scene,
.boot-scene img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.boot-scene {
  z-index: -1;
}

.boot-scene img {
  object-fit: cover;
}

.boot-logo {
  justify-self: center;
  align-self: start;
  padding-top: clamp(6px, 1.4vh, 18px);
  width: min(42vw, 50vh, 525px);
  max-height: 24vh;
  object-fit: contain;
}

.boot-status {
  justify-self: center;
  width: min(66vw, 610px);
  margin: 0 0 max(5vh, env(safe-area-inset-bottom));
}

#boot-progress {
  --progress: 0.08;
  position: relative;
  height: clamp(12px, 1.95vh, 20px);
  border: 1px solid #a7774b;
  border-radius: 999px;
  box-shadow: 0 0 0 1px #fff1d5b8;
  background: repeating-linear-gradient(100deg, #e8c69d, #e8c69d 3px, #efd2ac 4px);
}

#boot-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(100% * var(--progress));
  border-radius: inherit;
  background:
    linear-gradient(#ffb87735, #58210624),
    repeating-linear-gradient(
      132deg,
      #983f20 0 2px,
      #b4532a 3px 5px,
      #da783b 6px 8px,
      #b4532a 9px 11px
    );
  transition: width 210ms ease-out;
}

.boot-needle {
  position: absolute;
  --needle-width: clamp(32px, 4.5vw, 67px);
  left: clamp(18px, calc(100% * var(--progress)), calc(100% - var(--needle-width) * 0.8));
  top: 50%;
  width: var(--needle-width);
  height: clamp(4px, 0.48vw, 7px);
  border-radius: 55% 90% 90% 55%;
  background: linear-gradient(#68574c, #fff7e8 40%, #aa9783 70%, #574735);
  box-shadow: 1px 2px 2px #67432177;
  transform-origin: left center;
  transform: translate(-14%, -40%) rotate(-15deg);
  transition: left 210ms ease-out;
}

.boot-needle::before {
  position: absolute;
  left: 4%;
  top: 14%;
  width: 16%;
  height: 72%;
  border: 1px solid #d9a43e;
  border-radius: 50%;
  background: #69280f;
  content: '';
}

.boot-caption {
  display: grid;
  grid-template-columns: 2.75em minmax(0, 1fr) 2.75em;
  align-items: center;
  margin-top: clamp(7px, 1.2vh, 12px);
  font-size: clamp(16px, 1.65vw, 25px);
  line-height: 1.25;
  text-shadow: 0 1px 2px #fff5df, 0 0 6px #fff1d3;
}

#boot-percent {
  grid-column: 3;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

#boot-label {
  display: grid;
  grid-column: 2;
  align-content: center;
  margin: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-wrap: balance;
}

#boot-retry {
  display: block;
  margin: 8px auto 0;
  padding: 8px 18px;
  border: 1px solid #174439;
  border-radius: 18px;
  background: #166552;
  color: #fff3db;
  min-height: 48px;
  font: 700 16px/1.2 Georgia, serif;
  box-shadow: 0 2px 3px #623e2524;
  cursor: pointer;
}

#boot-splash [hidden] {
  display: none;
}

@media (max-aspect-ratio: 4/5) {
  .boot-logo {
    padding-top: 5vh;
    width: 84vw;
    max-height: 25vh;
  }

  .boot-status {
    width: 90vw;
    margin-bottom: max(3.2vh, env(safe-area-inset-bottom));
  }

  #boot-label {
    min-block-size: 2lh;
  }
}

@media (prefers-reduced-motion: reduce) {
  #boot-splash,
  #boot-fill,
  .boot-needle {
    transition: none;
  }
}
