.app-boot {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(165deg, #f8fafc 0%, #eef0ff 42%, #edf0fe 100%);
  color: #1f2937;
  font-size: 14px;
  transition: opacity .28s ease, visibility .28s ease;
}
@media (display-mode: standalone), (display-mode: fullscreen) {
  .app-boot {
    min-height: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    max-height: none;
    background: #edf0fe;
  }
}
.app-boot.hidden { display: none; }
.app-boot.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Flowee branded splash — Icon System purple */
.flowee-splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: flowee-splash-in .55s ease both;
}
.flowee-splash-icon {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  box-shadow: 0 12px 36px rgba(91, 92, 235, 0.28);
  object-fit: cover;
  background: #fff;
}
.flowee-splash-brand {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #8b7dff, #5b5ceb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.flowee-splash-warm {
  width: min(240px, 72vw);
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
.flowee-splash-warm[hidden] { display: none !important; }

.flowee-splash-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(91, 92, 235, 0.14);
  overflow: hidden;
}
.flowee-splash-progress__bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b7dff, #5b5ceb);
  transition: width .32s ease;
}

.flowee-splash-status {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  text-align: center;
  line-height: 1.35;
}

html.is-warm-boot .flowee-splash-brand {
  font-size: 24px;
}

html.is-restore-boot .flowee-splash-inner {
  gap: 18px;
}

html.is-restore-boot .flowee-splash-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

html.is-restore-boot .flowee-splash-brand {
  font-size: 22px;
}

html.is-restore-boot .flowee-splash-warm {
  width: min(280px, 82vw);
  margin-top: 2px;
}

html.is-restore-boot .flowee-splash-status {
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
}
@keyframes flowee-splash-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Legacy spinner (errors / fallback only) */
.app-boot-spinner {
  width: 20px; height: 20px; border: 2px solid #e5e7eb;
  border-top-color: #64748b; border-radius: 50%;
  animation: app-spin .7s linear infinite;
}
@keyframes app-spin { to { transform: rotate(360deg); } }

.app-root { min-height: 100vh; }
.app-root.hidden { display: none; }
/* Keep root under splash so restore can mount silently */
.app-root.under-splash {
  visibility: hidden;
  pointer-events: none;
}
.app-page { display: none; min-height: 100vh; }
.app-page.active { display: block; }
.app-error {
  max-width: 400px; margin: 40px auto; padding: 20px;
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px;
  color: #b91c1c; font-size: 14px; text-align: center;
}

@media (prefers-color-scheme: dark) {
  .app-boot {
    background: linear-gradient(165deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    color: #f8fafc;
  }
  .flowee-splash-brand {
    background: linear-gradient(135deg, #c4b5fd, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}
