:root {
  --splash-bg: #070b16;
  --splash-bg-2: #0d1626;

  --splash-text: #f4f7fb;
  --splash-muted: #8fa0bd;

  --splash-accent: #38bdf8;
  --splash-accent-2: #818cf8;

  --splash-border: #1c2740;

  --splash-dot-color: 129, 170, 224;

  --splash-error: #f87171;
  --splash-error-bg: #2a1111;
  --splash-error-border: #7f1d1d;
}

html,
body {
  margin: 0;
  padding: 0;

  min-height: 100%;

  background:
    var(--splash-bg);
}

body {
  min-width: 320px;
}

#app {
  min-height: 100vh;
}

/*
 * --------------------------------------------------
 * SPLASH
 * --------------------------------------------------
 */

#splash {
  position: fixed;
  inset: 0;

  z-index: 9999;

  display: grid;

  place-items: center;

  padding: 24px;

  box-sizing: border-box;

  overflow: hidden;

  background:
    radial-gradient(
      circle at 50% 30%,
      var(--splash-bg-2) 0%,
      var(--splash-bg) 70%
    );

  font-family:
    'Inter',
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;

  opacity: 1;

  transition:
    opacity 0.3s ease;
}

/*
 * --------------------------------------------------
 * DOT GRID
 * --------------------------------------------------
 *
 * Each column is its own element.
 *
 * The dots themselves are created with a
 * repeating radial-gradient.
 *
 * This lets us gently animate individual columns
 * without creating hundreds of DOM dots.
 */

.splash-dotgrid {
  position: absolute;
  inset: 0;

  z-index: 0;

  display: flex;

  height: 100%;

  pointer-events: none;

  -webkit-mask-image:
    radial-gradient(
      circle at 50% 38%,
      black 40%,
      transparent 88%
    );

  mask-image:
    radial-gradient(
      circle at 50% 38%,
      black 40%,
      transparent 88%
    );
}

/*
 * Individual grid column.
 */

.dot-col {
  flex:
    0 0
    var(--dot-cell, 28px);

  height: 100%;

  background-image:
    radial-gradient(
      circle,
      rgba(
        var(--splash-dot-color),
        0.45
      )
      1.4px,
      transparent
      1.6px
    );

  background-size:
    100%
    var(--dot-cell, 28px);

  background-repeat:
    repeat-y;

  background-position:
    center top;

  transform:
    scale(1);

  filter:
    brightness(1);

  will-change:
    transform,
    filter;
}

/*
 * --------------------------------------------------
 * CONTENT
 * --------------------------------------------------
 */

.splash-inner {
  position: relative;

  z-index: 1;

  display: flex;

  width: 100%;
  max-width: 420px;

  flex-direction: column;

  align-items: center;

  gap: 26px;

  text-align: center;
}

/*
 * --------------------------------------------------
 * LOGO
 * --------------------------------------------------
 */

.splash-mark {
  position: relative;

  display: grid;

  width: 76px;
  height: 76px;

  place-items: center;

  opacity: 0;

  animation:
    splash-rise
    0.5s
    cubic-bezier(
      0.16,
      1,
      0.3,
      1
    )
    0.05s
    forwards;
}

.splash-glow {
  position: absolute;

  inset: -18px;

  border-radius: 50%;

  background:
    radial-gradient(
      circle,
      color-mix(
        in srgb,
        var(--splash-accent)
        26%,
        transparent
      )
      0%,
      transparent
      70%
    );

  animation:
    splash-glow-pulse
    2.4s
    ease-in-out
    infinite;
}

.splash-ring {
  position: absolute;
  inset: 0;

  border-radius: 50%;

  border:
    2px solid
    var(--splash-border);

  border-top-color:
    var(--splash-accent);

  animation:
    splash-spin
    1s
    linear
    infinite;
}

.splash-logo-img {
  grid-area: 1 / 1;

  z-index: 1;

  width: 38px;
  height: 38px;

  object-fit: contain;
}

.splash-logo-fallback {
  grid-area: 1 / 1;

  font-size: 18px;

  font-weight: 700;

  letter-spacing: 0.04em;

  color:
    var(--splash-text);
}

@keyframes splash-rise {
  from {
    opacity: 0;

    transform:
      translateY(10px)
      scale(0.94);
  }

  to {
    opacity: 1;

    transform:
      translateY(0)
      scale(1);
  }
}

@keyframes splash-spin {
  to {
    transform:
      rotate(360deg);
  }
}

@keyframes splash-glow-pulse {
  0%,
  100% {
    opacity: 0.6;

    transform:
      scale(1);
  }

  50% {
    opacity: 1;

    transform:
      scale(1.08);
  }
}

.splash-text {
  display: flex;

  flex-direction: column;

  align-items: center;

  gap: 6px;

  opacity: 0;

  animation:
    splash-rise
    0.5s
    cubic-bezier(
      0.16,
      1,
      0.3,
      1
    )
    0.2s
    forwards;
}

.splash-title {
  font-size: 15px;

  font-weight: 600;

  line-height: 1.4;

  letter-spacing: 0.01em;

  color:
    var(--splash-text);
}

.splash-subtitle {
  max-width: 360px;

  font-size: 13px;

  line-height: 1.55;

  color:
    var(--splash-muted);
}

.splash-progress {
  position: relative;

  width: 160px;
  height: 3px;

  overflow: hidden;

  border-radius: 999px;

  background:
    var(--splash-border);

  opacity: 0;

  animation:
    splash-rise
    0.5s
    cubic-bezier(
      0.16,
      1,
      0.3,
      1
    )
    0.32s
    forwards;
}

.splash-progress::after {
  content: '';

  position: absolute;
  inset: 0;

  width: 40%;

  border-radius: 999px;

  background:
    linear-gradient(
      90deg,
      transparent,
      var(--splash-accent),
      var(--splash-accent-2),
      transparent
    );

  animation:
    splash-progress-move
    1.4s
    ease-in-out
    infinite;
}

@keyframes splash-progress-move {
  0% {
    transform:
      translateX(-100%);
  }

  100% {
    transform:
      translateX(350%);
  }
}

#startup-error {
  display: none;

  width: 100%;
}

#splash.splash-error
.splash-ring {
  border-color:
    var(--splash-error-border);

  animation: none;
}

#splash.splash-error
.splash-glow {
  background:
    radial-gradient(
      circle,
      color-mix(
        in srgb,
        var(--splash-error)
        22%,
        transparent
      )
      0%,
      transparent
      70%
    );

  animation: none;

  opacity: 0.7;
}

#splash.splash-error
.dot-col {
  transform:
    scale(1) !important;

  filter:
    brightness(0.6) !important;
}

#splash.splash-error
.splash-progress {
  display: none;
}

#splash.splash-error
#startup-loading {
  display: none;
}

#splash.splash-error
#startup-error {
  display: flex;

  flex-direction: column;

  align-items: center;

  gap: 14px;

  opacity: 0;

  animation:
    splash-rise
    0.4s
    cubic-bezier(
      0.16,
      1,
      0.3,
      1
    )
    forwards;
}

.startup-error-icon {
  display: grid;

  width: 34px;
  height: 34px;

  place-items: center;

  color:
    var(--splash-error);
}

.startup-error-message {
  max-width: 360px;

  font-size: 13px;

  line-height: 1.55;

  color:
    var(--splash-muted);
}

.startup-reload-button {
  display: inline-flex;

  min-height: 36px;

  align-items: center;

  justify-content: center;

  padding:
    8px 16px;

  border:
    1px solid
    var(--splash-border);

  border-radius: 7px;

  background:
    var(--splash-bg-2);

  font-family: inherit;

  font-size: 13px;

  font-weight: 500;

  color:
    var(--splash-text);

  cursor: pointer;

  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.startup-reload-button:hover {
  border-color:
    var(--splash-accent);
}

.startup-reload-button:focus-visible {
  outline:
    2px solid
    var(--splash-accent);

  outline-offset: 2px;
}

@media (
  prefers-reduced-motion: reduce
) {
  .splash-ring,
  .splash-glow,
  .splash-mark,
  .splash-text,
  .splash-progress,
  .splash-progress::after,
  #startup-error {
    animation:
      none !important;

    opacity:
      1 !important;
  }
}
