.boot-fallback,
.boot-fallback * {
  box-sizing: border-box;
}

.boot-fallback {
  --boot-ink: #193023;
  --boot-muted: #62776a;
  --boot-primary: #2d9b4b;
  --boot-primary-deep: #20743a;
  --boot-primary-soft: #ddf2e2;
  --boot-screen-a: #eef8f0;
  --boot-screen-b: #dcecdf;
  --boot-card: rgba(253, 255, 252, 0.86);
  --boot-card-line: rgba(130, 173, 141, 0.48);
  --boot-card-shadow: 0 28px 80px rgba(30, 65, 39, 0.16);
  position: fixed;
  inset: 0;
  z-index: 10000;
  isolation: isolate;
  display: grid;
  place-items: center;
  overflow: hidden;
  overflow: clip;
  overscroll-behavior: none;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  color: var(--boot-ink);
  background:
    radial-gradient(circle at 104% -4%, transparent 0 22%, color-mix(in srgb, var(--boot-primary) 8%, transparent) 22.2% 27%, transparent 27.2%),
    radial-gradient(ellipse 46% 30% at -4% 104%, transparent 0 88%, color-mix(in srgb, var(--boot-primary) 22%, transparent) 88.4% 88.8%, transparent 89.2%),
    radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.9), transparent 34%),
    radial-gradient(circle at 85% 80%, var(--boot-primary-soft), transparent 38%),
    linear-gradient(145deg, var(--boot-screen-a), var(--boot-screen-b));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="clay"] .boot-fallback {
  --boot-ink: #3e291f;
  --boot-muted: #826a5f;
  --boot-primary: #c96640;
  --boot-primary-deep: #98482d;
  --boot-primary-soft: #f7e2d8;
  --boot-screen-a: #fff5ef;
  --boot-screen-b: #f2ddd1;
  --boot-card-line: rgba(184, 116, 83, 0.42);
  --boot-card-shadow: 0 28px 80px rgba(88, 46, 29, 0.17);
}

:root[data-theme="hard"] .boot-fallback {
  --boot-ink: #172e42;
  --boot-muted: #5e7588;
  --boot-primary: #2d83c0;
  --boot-primary-deep: #1f6491;
  --boot-primary-soft: #dceefa;
  --boot-screen-a: #eff7fd;
  --boot-screen-b: #d9eaf6;
  --boot-card-line: rgba(97, 151, 188, 0.44);
  --boot-card-shadow: 0 28px 80px rgba(29, 65, 91, 0.17);
}

.boot-fallback-card {
  width: min(100%, 520px);
  padding: 30px 34px 28px;
  border: 1px solid var(--boot-card-line);
  border-radius: 28px;
  background: var(--boot-card);
  box-shadow: var(--boot-card-shadow);
  text-align: center;
  backdrop-filter: blur(14px);
}

.boot-fallback-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0;
  color: var(--boot-primary);
  font-size: 22px;
  font-style: italic;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.boot-fallback-brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.boot-fallback-copy {
  margin-top: 22px;
}

.boot-fallback-heading {
  max-width: 390px;
  margin: 0 auto;
  color: var(--boot-ink);
  font-size: clamp(24px, 2.2vw, 31px);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.boot-fallback-status {
  max-width: 360px;
  margin: 10px auto 0;
  color: var(--boot-muted);
  font-size: 14px;
  line-height: 1.5;
}

.boot-fallback-ball-stage {
  --boot-bounce-time: 1.86s;
  --boot-bounce-distance: 231px;
  position: relative;
  width: 270px;
  height: 290px;
  margin: 20px auto 0;
}

.boot-fallback-ball {
  position: absolute;
  z-index: 2;
  top: 0;
  left: calc(50% - 19px);
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 7px 7px rgba(34, 55, 21, 0.17));
  transform-origin: center bottom;
  will-change: transform;
  animation: boot-fallback-ball-bounce var(--boot-bounce-time) linear infinite;
}

.boot-fallback-ball-shadow {
  position: absolute;
  z-index: 1;
  left: calc(50% - 23px);
  bottom: 17px;
  width: 46px;
  height: 10px;
  border-radius: 50%;
  background: rgba(19, 49, 27, 0.3);
  filter: blur(4px);
  will-change: transform, opacity, filter;
  animation: boot-fallback-shadow-bounce var(--boot-bounce-time) linear infinite;
}

.boot-fallback-loading-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--boot-primary-deep);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.boot-fallback-loading-hint::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--boot-primary);
  box-shadow: 0 0 0 4px var(--boot-primary-soft);
  animation: boot-fallback-status-pulse 1.5s ease-in-out infinite;
}

.boot-fallback [hidden] {
  display: none !important;
}

.boot-fallback-button {
  min-height: 46px;
  margin-top: 18px;
  padding: 10px 22px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--boot-primary);
  box-shadow: 0 10px 20px color-mix(in srgb, var(--boot-primary) 24%, transparent);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.boot-fallback-button:hover {
  background: var(--boot-primary-deep);
}

.boot-fallback-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--boot-primary) 34%, transparent);
  outline-offset: 3px;
}

.boot-fallback--error .boot-fallback-ball {
  animation: none;
  transform: translateY(var(--boot-bounce-distance));
}

.boot-fallback--error .boot-fallback-ball-shadow {
  opacity: 0.42;
  filter: blur(2px);
  animation: none;
  transform: scale(1.02, 0.82);
}

@keyframes boot-fallback-ball-bounce {
  0% {
    transform: translateY(0) scale(1);
    animation-timing-function: cubic-bezier(0.45, 0.03, 0.95, 0.55);
  }
  44% {
    transform: translateY(var(--boot-bounce-distance)) scale(1);
  }
  48% {
    transform: translateY(var(--boot-bounce-distance)) scale(1.12, 0.84);
  }
  53% {
    transform: translateY(calc(var(--boot-bounce-distance) - 12px)) scale(0.96, 1.07);
    animation-timing-function: cubic-bezier(0.08, 0.56, 0.22, 1);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes boot-fallback-shadow-bounce {
  0% {
    opacity: 0.09;
    filter: blur(8px);
    transform: scale(0.5, 0.68);
    animation-timing-function: cubic-bezier(0.45, 0.03, 0.95, 0.55);
  }
  44%,
  48% {
    opacity: 0.48;
    filter: blur(2px);
    transform: scale(1.08, 0.8);
  }
  53% {
    opacity: 0.36;
    filter: blur(3px);
    transform: scale(0.9, 0.78);
    animation-timing-function: cubic-bezier(0.08, 0.56, 0.22, 1);
  }
  100% {
    opacity: 0.09;
    filter: blur(8px);
    transform: scale(0.5, 0.68);
  }
}

@keyframes boot-fallback-status-pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.72);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 640px) {
  .boot-fallback {
    padding: 12px;
  }

  .boot-fallback-card {
    width: 100%;
    padding: 20px 10px;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .boot-fallback-brand {
    font-size: 20px;
  }

  .boot-fallback-brand img {
    width: 32px;
    height: 32px;
  }

  .boot-fallback-copy {
    margin-top: 24px;
  }

  .boot-fallback-heading {
    max-width: 315px;
    font-size: 27px;
  }

  .boot-fallback-status {
    max-width: 300px;
    font-size: 13px;
  }

  .boot-fallback-ball-stage {
    width: 246px;
    margin-top: 24px;
  }
}

@media (max-width: 350px) {
  .boot-fallback-heading {
    font-size: 24px;
  }

  .boot-fallback-ball-stage {
    width: 232px;
  }
}

@media (max-height: 620px) {
  .boot-fallback {
    padding-block: 4px;
  }

  .boot-fallback-card {
    padding-block: 8px;
  }

  .boot-fallback-brand {
    font-size: 18px;
  }

  .boot-fallback-brand img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .boot-fallback-copy {
    margin-top: 12px;
  }

  .boot-fallback-heading {
    font-size: 22px;
  }

  .boot-fallback-status {
    margin-top: 6px;
    line-height: 1.35;
  }

  .boot-fallback-ball-stage {
    margin-top: 10px;
  }

  .boot-fallback-loading-hint {
    margin-top: 6px;
  }

  .boot-fallback-button {
    margin-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot-fallback-ball,
  .boot-fallback-ball-shadow,
  .boot-fallback-loading-hint::before {
    animation: none !important;
  }

  .boot-fallback-ball {
    transform: translateY(var(--boot-bounce-distance));
  }

  .boot-fallback-ball-shadow {
    opacity: 0.42;
    filter: blur(2px);
    transform: scale(1.02, 0.82);
  }
}
