.preview-actions { display: flex; align-items: center; gap: 8px; }

.canvas-preview-dialog .preview-surface {
  position: relative;
  width: 100%;
  height: calc(100% - 52px);
  container-type: size;
  overflow: hidden;
}
.canvas-preview-dialog .preview-surface iframe { width: 100%; height: 100%; }
.preview-surface:fullscreen { height: 100%; background: var(--zy-black); }
.preview-surface .preview-exit-fullscreen { display: none; }
.preview-surface:fullscreen .preview-exit-fullscreen {
  display: block;
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  color: var(--zy-white);
  background: var(--zy-black);
}

/* Match the centered 16:9 playing area, including on a portrait screen. */
.preview-surface .preview-brand-position {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(100cqw, calc(100cqh * 16 / 9));
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: 100%;
  align-self: center;
  pointer-events: none;
}
.preview-watermark {
  position: absolute;
  right: clamp(6px, 1vw, 14px);
  bottom: clamp(5px, .8vw, 10px);
  padding: 3px 7px;
  color: color-mix(in srgb, var(--zy-black) 74%, transparent);
  background: color-mix(in srgb, var(--zy-white) 67%, transparent);
  border-radius: 4px;
  font: 500 clamp(9px, .85vw, 12px)/1.2 var(--zy-sans);
  letter-spacing: .02em;
  pointer-events: none;
  user-select: none;
}
/* Brand the interactive preview without covering the iframe's click targets. */
.canvas-preview-dialog .preview-watermark {
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  padding: 0;
  color: rgb(255 255 255 / 48%);
  background: transparent;
  font-size: clamp(24px, 7cqw, 72px);
  font-weight: 650;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgb(0 0 0 / 22%);
}
.legacy-preview-surface { position: relative; margin: auto; }
.legacy-preview-surface:has(iframe[data-viewport="mobile"]) { max-width: 390px; }

.free-example { display: flex; flex-direction: column; }
.free-example .case-toolbar {
  position: static;
  flex: none;
  padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  border: 0;
  border-bottom: 1px solid var(--zy-line);
  box-shadow: none;
  background: var(--zy-surface);
  color: var(--zy-ink);
}
.free-example .case-toolbar small { color: var(--zy-muted); }
.free-example .case-toolbar nav { flex-direction: row; }
.free-example .case-toolbar a {
  color: var(--zy-ink);
  background: var(--zy-surface);
  border: 1px solid var(--zy-line);
  border-radius: var(--zy-button-radius);
}
.free-example .case-toolbar .case-primary { color: var(--zy-white); background: var(--color-primary); }
.free-example #viewport { flex: 1; min-height: 0; height: auto; container-type: size; }
.free-example #stage {
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
}
.free-example .preview-brand-position { position: absolute; inset: 0; z-index: 101; pointer-events: none; }
@media (max-width: 440px) {
  .free-example .case-toolbar small { display: none; }
}
