/**
 * Flutter Web splash / bootstrap overlay.
 * Loaded from index.html; removed when the engine dispatches `flutter-first-frame`.
 */

#flutter-loading-overlay {
  /* Hex fallbacks first; modern values override where supported */
  --electric-border-color: #dd8448;
  --color-neutral-900: #2f2f2f;
  --color-neutral-900: oklch(0.185 0 0);
  --color-page-bg: #252525;
  --color-page-bg: oklch(0.145 0 0);
  --color-text: #fafafa;
  --color-text: oklch(0.985 0 0);
  --electric-light-color: #e8a060;
  --electric-light-color: oklch(from var(--electric-border-color) l c h);
  --gradient-accent: rgba(221, 132, 72, 0.35);
  --gradient-accent: oklch(
    from var(--electric-border-color) 0.3 calc(c / 2) h / 0.4
  );

  position: fixed;
  inset: 0;
  z-index: 2147483647;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--color-page-bg);
  color: var(--color-text);
  opacity: 1;
  /* Duration must match FADE_MS in splash.js */
  transition: opacity 300ms ease;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  #flutter-loading-overlay {
    transition: none;
  }
}

#flutter-loading-overlay *,
#flutter-loading-overlay *::before,
#flutter-loading-overlay *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#flutter-loading-overlay .main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 24px;
}

/* Frame wraps logo + label; content-sized (no SVG filter animation). */
#flutter-loading-overlay .card-container {
  width: fit-content;
  max-width: min(100%, 420px);
  padding: 2px;
  border-radius: 24px;
  position: relative;
  background:
    linear-gradient(
      -30deg,
      var(--gradient-accent),
      transparent,
      var(--gradient-accent)
    ),
    linear-gradient(
      to bottom,
      var(--color-neutral-900),
      var(--color-neutral-900)
    );
}

#flutter-loading-overlay .inner-container {
  position: relative;
}

#flutter-loading-overlay .border-outer {
  border: 2px solid rgba(221, 132, 72, 0.5);
  border-radius: 24px;
  padding-right: 4px;
  padding-bottom: 4px;
}

#flutter-loading-overlay .main-card {
  position: relative;
  z-index: 1;
  margin-top: -4px;
  margin-left: -4px;
  border-radius: 24px;
  border: 2px solid var(--electric-border-color);
  background: var(--color-neutral-900);
  padding: 28px 32px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#flutter-loading-overlay .glow-layer-1 {
  border: 2px solid rgba(221, 132, 72, 0.6);
  border-radius: 24px;
  position: absolute;
  inset: 0;
  filter: blur(1px);
  pointer-events: none;
}

#flutter-loading-overlay .glow-layer-2 {
  border: 2px solid var(--electric-light-color);
  border-radius: 24px;
  position: absolute;
  inset: 0;
  filter: blur(4px);
  pointer-events: none;
}

#flutter-loading-overlay .overlay-1 {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  opacity: 1;
  mix-blend-mode: overlay;
  transform: scale(1.05);
  filter: blur(12px);
  background: linear-gradient(
    -30deg,
    white,
    transparent 30%,
    transparent 70%,
    white
  );
  pointer-events: none;
}

#flutter-loading-overlay .overlay-2 {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  opacity: 0.45;
  mix-blend-mode: overlay;
  transform: scale(1.05);
  filter: blur(12px);
  background: linear-gradient(
    -30deg,
    white,
    transparent 30%,
    transparent 70%,
    white
  );
  pointer-events: none;
}

#flutter-loading-overlay .background-glow {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  filter: blur(28px);
  transform: scale(1.08);
  opacity: 0.3;
  z-index: -1;
  background: linear-gradient(
    -30deg,
    var(--electric-light-color),
    transparent,
    var(--electric-border-color)
  );
  pointer-events: none;
}

#flutter-loading-overlay .loading-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
}

#flutter-loading-overlay .loading-logo {
  display: block;
  width: 200px;
  height: auto;
  max-width: min(200px, 55vw);
  max-height: min(220px, 38vh);
  object-fit: contain;
}

#flutter-loading-overlay .loading-label {
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-text);
  text-align: center;
}

#flutter-loading-overlay .dot {
  display: inline-block;
  animation: dot-loading 1.4s infinite;
  opacity: 0;
}

#flutter-loading-overlay .dot:nth-child(1) {
  animation-delay: 0s;
}

#flutter-loading-overlay .dot:nth-child(2) {
  animation-delay: 0.2s;
}

#flutter-loading-overlay .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot-loading {
  0% { opacity: 0; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
  100% { opacity: 0; transform: translateY(0); }
}
