:root {
  color: #171717;
  background: #e9eaec;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #e9eaec;
}

body { padding: max(8px, env(safe-area-inset-top)) 0 max(8px, env(safe-area-inset-bottom)); }

#viewer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.page {
  display: block;
  width: calc(100vw - 16px);
  height: auto;
  background: white;
  box-shadow: 0 1px 4px rgb(0 0 0 / 14%);
}

#status {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: #555;
  background: #f7f7f8;
  text-align: center;
}

#status.hidden { display: none; }
#status.error { color: #b42318; }

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #d0d2d5;
  border-top-color: #444;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

#status.error .spinner { display: none; }

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

@media (min-width: 760px) {
  body { padding-block: 16px; }
  #viewer { gap: 16px; }
  .page { width: min(100vw - 32px, 900px); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}
