#loadingScreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: max(28px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(62px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  overflow: auto;
  background: #82ae4d;
  color: #23482d;
  opacity: 1;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}
#loadingScreen[hidden] {
  display: none !important;
}
.loading-scenery,
.loading-vignette {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}
.loading-scenery {
  background: #a4cd80 url("/assets/loading/background.png") center/cover no-repeat;
}
.loading-vignette {
  z-index: -1;
  background:
    linear-gradient(
      180deg,
      rgba(25, 66, 37, 0.12),
      rgba(32, 67, 26, 0.08) 48%,
      rgba(19, 48, 26, 0.55)
    ),
    radial-gradient(ellipse at 50% 42%, rgba(250, 249, 209, 0.28), transparent 70%);
}
.loading-content {
  width: min(680px, 100%);
  display: grid;
  gap: clamp(24px, 4dvh, 44px);
  justify-items: stretch;
  position: relative;
}
.loading-brand {
  width: 100%;
  text-align: center;
  filter: drop-shadow(0 5px 5px #284e3444);
}
.loading-logo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 28dvh;
  object-fit: contain;
}
.loading-card {
  --frame-y: 44px;
  --frame-x: calc(var(--frame-y) * 1.8);
  position: relative;
  width: min(680px, 100%);
  justify-self: center;
  min-width: 0;
  padding: 16px 14px;
  border-style: solid;
  border-color: transparent;
  border-width: var(--frame-y) var(--frame-x);
  border-image: url("/assets/loading/loading-board-v1.png") 22% fill / 1 stretch;
  filter: drop-shadow(0 12px 16px #21361460);
  color: #4b2814;
}
.loading-status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.loading-status > div {
  flex: 1;
  min-width: 0;
}
.loading-sprout {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #75471920;
  font-size: 25px;
}
.loading-label {
  color: #6b3c1b;
  font:
    800 9px/1.4 Arial,
    sans-serif;
  letter-spacing: 0.13em;
}
#loadingText {
  margin: 4px 0 0;
  font:
    700 clamp(13px, 1.5vw, 16px) / 1.4 Georgia,
    serif;
  color: #49250f;
  text-shadow: 0 1px #ffe49d66;
  overflow-wrap: anywhere;
}
#loadingPercent {
  flex: none;
  font:
    800 16px/1 Arial,
    sans-serif;
  font-variant-numeric: tabular-nums;
  color: #4b2814;
}
.loading-progress {
  position: relative;
  overflow: hidden;
  height: 22px;
  margin-top: 20px;
  padding: 3px;
  border: 2px solid #e9bc60;
  border-radius: 999px;
  background: #633e1f;
  box-shadow:
    inset 0 2px 4px #2a190c88,
    0 1px #5d3519;
}
.loading-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background:
    repeating-linear-gradient(120deg, transparent 0 16px, #ffffff24 16px 28px),
    linear-gradient(180deg, #d6ed68, #8aba2f 48%, #639d1e);
  box-shadow: inset 0 1px #def2a4;
  transition: width 0.22s ease;
}
.loading-tip {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #85502155;
  min-width: 0;
}
.loading-tip-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #6b3c1b;
  font:
    800 9px/1.5 Arial,
    sans-serif;
  letter-spacing: 0.14em;
}
#loadingTipCount {
  color: #7d4c27;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#loadingTip {
  margin: 9px 0 0;
  min-height: 3em;
  font:
    600 clamp(13px, 1.4vw, 15px) / 1.5 Georgia,
    serif;
  color: #4e2c16;
  text-shadow: 0 1px #ffe49d55;
  overflow-wrap: anywhere;
}
.loading-footer {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 20px;
  right: 20px;
  margin: 0;
  text-align: center;
  color: #fffce1cc;
  font:
    12px/1.4 Georgia,
    serif;
  text-shadow: 0 2px 6px #143d24;
}
#loadingRetry {
  margin-top: 16px;
  min-height: 44px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: #507839;
  color: #fffbe2;
  font:
    700 14px Arial,
    sans-serif;
  padding: 12px;
  cursor: pointer;
}
#loadingScreen[data-state="error"] .loading-fill {
  background: #b7794d;
}
#loadingScreen[data-state="error"] .loading-label {
  color: #9b5b33;
}
@media (max-width: 420px) {
  #loadingScreen {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .loading-content {
    gap: 28px;
  }
  .loading-card {
    --frame-y: 28px;
    padding: 12px 8px;
  }
  .loading-scenery {
    background-position: 48% center;
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  #loadingScreen {
    padding: 16px max(24px, env(safe-area-inset-right)) 40px max(24px, env(safe-area-inset-left));
  }
  .loading-content {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    width: min(940px, 100%);
    gap: clamp(20px, 5vw, 56px);
    align-items: center;
  }
  .loading-logo {
    max-height: 62dvh;
  }
  .loading-card {
    --frame-y: 28px;
    padding: 10px 12px;
  }
  .loading-status {
    gap: 9px;
  }
  .loading-sprout {
    width: 34px;
    height: 34px;
    font-size: 21px;
  }
  .loading-label {
    font-size: 8px;
  }
  .loading-progress {
    margin-top: 14px;
  }
  .loading-tip {
    padding-top: 12px;
    margin-top: 14px;
  }
  #loadingTip {
    font-size: 13px;
  }
  .loading-footer {
    bottom: max(10px, env(safe-area-inset-bottom));
    font-size: 11px;
  }
}
@media (max-height: 320px) {
  #loadingScreen {
    place-items: start center;
  }
  .loading-content {
    gap: 20px;
  }
  .loading-card {
    --frame-y: 24px;
    padding: 8px 10px;
  }
  .loading-footer {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  #loadingScreen,
  .loading-fill {
    transition: none;
  }
}

@media (orientation: landscape) and (max-width: 700px) and (max-height: 400px) {
  #loadingScreen {
    padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  }
  .loading-content {
    grid-template-columns: 1fr;
    width: min(560px, 100%);
    gap: 6px;
  }
  .loading-logo {
    max-height: 64px;
  }
  .loading-card {
    --frame-y: 24px;
    padding: 6px 10px;
  }
  .loading-tip {
    margin-top: 10px;
    padding-top: 9px;
  }
  #loadingTip {
    font-size: 12px;
    min-height: 0;
    margin-top: 7px;
  }
  .loading-progress {
    margin-top: 10px;
  }
  .loading-footer {
    display: none;
  }
}
