#root-loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: var(--z-modal, 3000);
  background: var(--bg-primary, #030303);
  color: var(--text-secondary, #a3a3a3);
  font-family: system-ui, -apple-system, sans-serif;
  text-align: center;
  padding: 24px;
}

#root-loading-spinner {
  width: 40px;
  height: 40px;
  box-sizing: border-box;
  border: 3px solid rgba(0, 243, 255, 0.2);
  border-top-color: var(--accent-cyan, #00f3ff);
  border-radius: 50%;
  animation: root-spin 1s linear infinite, root-spinner-fade 0.3s 15s forwards;
}

#root-loading-label {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

#root-loading-step {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-tertiary, #737373);
}

#root-loading-failure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  animation: root-failure-reveal 0.3s 15s forwards;
}

#root-loading-error {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--accent-orange, #f97316);
}

.root-loading-retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background: var(--surface-2, #27272a);
  color: var(--text-primary, #f4f4f5);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.15));
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.root-loading-retry-btn:hover {
  background: var(--surface-3, #3f3f46);
}

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

@keyframes root-spinner-fade {
  to {
    opacity: 0.3;
  }
}

@keyframes root-failure-reveal {
  to {
    opacity: 1;
    max-height: 120px;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  #root-loading-spinner { animation: root-spinner-fade 0.3s 15s forwards; }
}
