:root {
  --shell-bg: #0a0a0a;
  --error-bg: #0a0a0a;
  --error-fg: #f5f5f5;
  --error-muted: #a3a3a3;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--shell-bg);
  color: var(--error-muted);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#viewer {
  position: absolute;
  inset: 0;
  display: none;
}

#viewer.is-visible {
  display: block;
}

.viewer-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--shell-bg);
  color: var(--error-muted);
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

#viewer.is-loading .viewer-loading {
  display: flex;
}

.viewer-loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid rgba(245, 245, 245, 0.12);
  border-top-color: rgba(245, 245, 245, 0.45);
  border-radius: 50%;
  animation: viewer-spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .viewer-loading-spinner {
    animation: none;
    border-top-color: rgba(245, 245, 245, 0.35);
  }
}

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

#viewer iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  transition: opacity 0.4s ease-out;
}

#viewer:not(.is-loading) iframe {
  opacity: 1;
}

#error {
  display: none;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--error-bg);
  color: var(--error-fg);
  text-align: center;
}

#error.is-visible {
  display: flex;
  flex-direction: column;
}

#error h1 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
}

#error p {
  margin: 0;
  color: var(--error-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 36rem;
}

#error .ids {
  margin-top: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  color: var(--error-fg);
}
