/* Wrapper holds the iframe + the loading overlay so the overlay can
   absolute-position over the iframe before it paints. */
.canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg);
}

.canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  background: var(--bg);
}

.canvas--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.canvas__hint {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 24px;
  max-width: 300px;
}

/* Shown until the iframe fires `load`. The iframe is below it (DOM
   order — overlay is rendered after iframe in the React tree).
   Fades in slightly to avoid a hard flash on very-fast loads. */
.canvas-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  pointer-events: none;
  z-index: 1;
  animation: canvas-loading-in 80ms ease-out;
}

@keyframes canvas-loading-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.canvas-loading__spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border-light, rgba(127, 127, 127, 0.2));
  border-top-color: var(--accent, #8b6cf7);
  border-radius: 50%;
  animation: canvas-loading-spin 0.8s linear infinite;
}

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

.canvas-loading__name {
  font-size: 13px;
  color: var(--muted, #999);
  font-family: var(--font, inherit);
  letter-spacing: 0.02em;
}

.canvas-loading__offline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 280px;
  padding: 0 24px;
  text-align: center;
}

.canvas-loading__offline-icon {
  width: 32px;
  height: 32px;
  color: var(--muted, #999);
  opacity: 0.85;
}

.canvas-loading__offline-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #e5e5e5);
  font-family: var(--font, inherit);
}

.canvas-loading__offline-detail {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted, #999);
  font-family: var(--font, inherit);
}
