:root {
  --boot-bg: #030814;
  --boot-panel: rgba(8, 22, 42, .72);
  --boot-line: rgba(116, 211, 255, .28);
  --boot-cyan: #7be8ff;
  --boot-blue: #2e8cff;
  --boot-white: #eefaff;
}

body.is-booting {
  overflow: hidden;
  background: var(--boot-bg);
}
body.is-booting #app,
body.is-booting #pwaInstall {
  visibility: hidden;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
  overflow: hidden;
  color: var(--boot-white);
  background:
    radial-gradient(circle at 50% 42%, rgba(32, 142, 255, .24), transparent 32%),
    radial-gradient(circle at 20% 15%, rgba(80, 226, 255, .11), transparent 28%),
    linear-gradient(145deg, #02050d 0%, #071323 48%, #030814 100%);
  opacity: 1;
  transition: opacity .42s ease, visibility .42s ease;
}
.boot-screen::before {
  content: '';
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(123, 232, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123, 232, 255, .035) 1px, transparent 1px);
  background-size: 34px 34px;
  transform: perspective(700px) rotateX(60deg) translateY(17%);
  transform-origin: 50% 80%;
  mask-image: linear-gradient(to bottom, transparent 10%, #000 66%, transparent 100%);
}
.boot-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(150, 225, 255, .018) 3px 4px);
  mix-blend-mode: screen;
}
.boot-screen.is-exiting {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-screen.is-error .boot-ring,
.boot-screen.is-error .boot-progress__fill {
  animation-play-state: paused;
}

.boot-screen__frame {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  display: grid;
  gap: clamp(1.15rem, 3vh, 2rem);
  text-align: center;
}
.boot-screen__kicker {
  margin: 0;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .28em;
  color: rgba(180, 235, 255, .72);
}
.boot-screen__title {
  margin: .35rem 0 0;
  font-size: clamp(1.75rem, 6vw, 3.4rem);
  line-height: .95;
  letter-spacing: -.04em;
  text-transform: uppercase;
  text-shadow: 0 0 30px rgba(62, 172, 255, .34);
}
.boot-screen__title strong {
  color: var(--boot-cyan);
  font-weight: 900;
}
.boot-screen__subtitle {
  margin: .65rem 0 0;
  color: rgba(219, 242, 255, .72);
  font-size: clamp(.88rem, 2vw, 1rem);
}

.boot-core {
  position: relative;
  width: clamp(150px, 30vw, 220px);
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 32px rgba(48, 159, 255, .3));
}
.boot-core::before,
.boot-core::after,
.boot-ring {
  content: '';
  position: absolute;
  border-radius: 50%;
}
.boot-core::before {
  inset: 0;
  border: 1px solid rgba(111, 216, 255, .18);
  box-shadow: inset 0 0 30px rgba(47, 150, 255, .12), 0 0 26px rgba(47, 150, 255, .12);
}
.boot-core::after {
  inset: 13%;
  border: 1px dashed rgba(133, 229, 255, .32);
  animation: bootSpin 8s linear infinite reverse;
}
.boot-ring--outer {
  inset: 4%;
  border: 3px solid transparent;
  border-top-color: var(--boot-cyan);
  border-right-color: rgba(46, 140, 255, .55);
  animation: bootSpin 2.8s linear infinite;
}
.boot-ring--middle {
  inset: 24%;
  border: 2px solid transparent;
  border-left-color: rgba(238, 250, 255, .85);
  border-bottom-color: rgba(123, 232, 255, .35);
  animation: bootSpin 2s linear infinite reverse;
}
.boot-core__x {
  position: relative;
  width: 42%;
  aspect-ratio: 1;
  transform: rotate(45deg);
  filter: drop-shadow(0 0 14px rgba(123, 232, 255, .8));
}
.boot-core__x::before,
.boot-core__x::after {
  content: '';
  position: absolute;
  inset: 44% 0;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--boot-white) 18%, var(--boot-cyan) 50%, var(--boot-white) 82%, transparent);
  box-shadow: 0 0 18px rgba(123, 232, 255, .9);
}
.boot-core__x::after { transform: rotate(90deg); }
.boot-core__pulse {
  position: absolute;
  width: 20%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--boot-white);
  box-shadow: 0 0 18px 6px rgba(123, 232, 255, .5), 0 0 56px 20px rgba(46, 140, 255, .22);
  animation: bootPulse 1.6s ease-in-out infinite;
}

.boot-status {
  padding: .9rem 1rem 1rem;
  border: 1px solid var(--boot-line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(11, 31, 57, .74), rgba(5, 15, 29, .62));
  box-shadow: inset 0 1px rgba(255,255,255,.05), 0 18px 60px rgba(0,0,0,.22);
  backdrop-filter: blur(14px);
}
.boot-status__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: .65rem;
  text-align: left;
}
.boot-status__stage {
  min-width: 0;
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .03em;
  color: rgba(225, 247, 255, .92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.boot-status__percent {
  font-variant-numeric: tabular-nums;
  font-size: .82rem;
  font-weight: 900;
  color: var(--boot-cyan);
}
.boot-progress {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(135, 222, 255, .18);
  background: rgba(0, 6, 16, .72);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.5);
}
.boot-progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 8%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1b63ff 0%, #34b9ff 55%, #b5f7ff 100%);
  box-shadow: 0 0 14px rgba(65, 183, 255, .85), 0 0 30px rgba(50, 145, 255, .4);
  transition: width .28s cubic-bezier(.22,.8,.32,1);
}
.boot-progress__fill::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 42%;
  margin-left: auto;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.92), transparent);
  transform: skewX(-18deg) translateX(120%);
  animation: bootSweep 1.2s ease-in-out infinite;
}
.boot-status__hint {
  margin: .6rem 0 0;
  min-height: 1.2em;
  font-size: .7rem;
  color: rgba(176, 218, 237, .58);
  text-align: left;
}

.boot-error-actions {
  display: none;
  gap: .65rem;
  justify-content: center;
  flex-wrap: wrap;
}
.boot-screen.is-error .boot-error-actions { display: flex; }
.boot-error-actions button,
.boot-error-actions a {
  appearance: none;
  border: 1px solid rgba(117, 217, 255, .35);
  border-radius: 12px;
  padding: .72rem 1rem;
  color: var(--boot-white);
  background: rgba(13, 41, 71, .8);
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

@keyframes bootSpin { to { transform: rotate(360deg); } }
@keyframes bootPulse {
  50% { transform: scale(.72); opacity: .72; }
}
@keyframes bootSweep {
  from { transform: skewX(-18deg) translateX(150%); opacity: 0; }
  35% { opacity: 1; }
  to { transform: skewX(-18deg) translateX(-260%); opacity: 0; }
}

@media (max-height: 650px) {
  .boot-screen__frame { gap: .8rem; }
  .boot-core { width: 128px; }
  .boot-screen__subtitle { margin-top: .35rem; }
}

@media (prefers-reduced-motion: reduce) {
  .boot-ring,
  .boot-core::after,
  .boot-core__pulse,
  .boot-progress__fill::after { animation: none !important; }
  .boot-screen,
  .boot-progress__fill { transition-duration: .12s; }
}
