html {
  --boot-loader-background: #000000;
  --boot-loader-foreground: #f8fafc;
  --boot-loader-muted: #cbd5e1;
  --boot-loader-subtle: #94a3b8;
}

html,
body,
#root {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000000;
}

#boot-loader {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: block;
  background: #000000;
  color: var(--boot-loader-foreground, #f8fafc);
  font-family: ui-sans-serif, system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  transition: opacity 220ms ease;
}

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

.boot-loader__stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.boot-loader__center {
  display: grid;
  justify-items: center;
  gap: 26px;
  transform: translateY(-2vh);
}

.boot-loader__logo {
  width: min(154px, 32vw);
  height: auto;
  display: block;
  filter:
    saturate(1.28)
    contrast(1.12)
    drop-shadow(0 0 34px rgba(196, 0, 0, 0.34));
}

.boot-loader__enter {
  display: inline-flex;
  min-width: 172px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(248, 250, 252, 0.34);
  border-radius: 999px;
  padding: 10px 18px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.38);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    border-color 180ms ease;
}

.boot-loader__enter:disabled {
  cursor: default;
}

#boot-loader.boot-loader--ready .boot-loader__enter {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.boot-loader__enter:not(:disabled):hover,
.boot-loader__enter:not(:disabled):focus-visible {
  border-color: #ffffff;
  outline: none;
}

.boot-loader__meta {
  position: fixed;
  top: max(18px, env(safe-area-inset-top, 0px));
  left: max(18px, env(safe-area-inset-left, 0px));
  right: max(18px, env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 0;
  color: rgba(226, 232, 240, 0.82);
  font-size: 11px;
  line-height: 1.25;
}

.boot-loader__meta-row {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.boot-loader__meta-label,
.boot-loader__meta-value {
  margin: 0;
  min-width: 0;
}

.boot-loader__meta-label {
  color: rgba(148, 163, 184, 0.78);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.boot-loader__meta-value {
  overflow: hidden;
  color: rgba(248, 250, 252, 0.9);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boot-loader__bottom {
  position: fixed;
  left: max(18px, env(safe-area-inset-left, 0px));
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: minmax(76px, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.boot-loader__progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.18);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

.boot-loader__progress-fill {
  width: 8%;
  height: 100%;
  min-width: 24px;
  position: relative;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, #9a0000 0%, #d40000 58%, #ff3b3b 100%);
  transition: width 260ms ease;
}

.boot-loader__progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.42) 48%, transparent 100%);
  transform: translateX(-110%);
  animation: boot-progress-shimmer 1.15s ease-in-out infinite;
}

.boot-loader__status {
  min-width: 0;
  max-width: min(52vw, 420px);
  display: flex;
  align-items: baseline;
  justify-self: end;
  justify-content: flex-end;
  gap: 12px;
  color: var(--boot-loader-muted, #cbd5e1);
  font-size: 12px;
  line-height: 1.3;
}

.boot-loader__status span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boot-loader__elapsed {
  color: var(--boot-loader-subtle, #94a3b8);
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.boot-loader__steps {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.boot-loader__step-time {
  font-variant-numeric: tabular-nums;
}

@keyframes boot-progress-shimmer {
  to {
    transform: translateX(110%);
  }
}

@media (max-width: 760px) {
  .boot-loader__logo {
    width: min(126px, 38vw);
  }

  .boot-loader__meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 12px;
    font-size: 10px;
  }

  .boot-loader__bottom {
    gap: 10px;
  }

  .boot-loader__status {
    font-size: 11px;
    gap: 8px;
  }
}

@media (max-width: 420px) {
  .boot-loader__meta {
    top: max(14px, env(safe-area-inset-top, 0px));
    left: max(14px, env(safe-area-inset-left, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
  }

  .boot-loader__bottom {
    left: max(14px, env(safe-area-inset-left, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
  }

  .boot-loader__status span:first-child {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #boot-loader,
  .boot-loader__enter,
  .boot-loader__progress-fill {
    transition: none;
  }

  .boot-loader__progress-fill::after {
    animation: none;
  }
}
