dialog.ag-media {
  position: fixed;
  inset: 0;
  width: min(800px, calc(100% - 32px));
  max-width: none;
  max-height: 88dvh;
  padding: 0;
  margin: auto;
  overflow-y: auto;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--dialog-shadow);
  font-family: var(--font);
}
.ag-media::backdrop { background: var(--veil); }
.ag-media-head, .ag-media-foot { display: flex; align-items: center; gap: 16px; padding: 15px 20px; }
.ag-media-head { justify-content: space-between; border-bottom: 1px solid var(--line); }
.ag-media-head h2 { margin: 0; overflow-wrap: anywhere; font-size: 18px; }
.ag-media-head p, .ag-media-foot span { margin: 4px 0 0; color: var(--quiet); font-size: 13px; }
.ag-media-close, .ag-media-download {
  padding: 7px 12px; border-radius: 6px; color: var(--secondary); background: var(--soft);
  font: inherit; font-weight: 550; text-decoration: none; white-space: nowrap;
}
.ag-media-close:hover { background: var(--line); }
.ag-media-stage { display: grid; place-items: center; min-height: 120px; padding: 18px; background: var(--panel); }
.ag-media-stage :is(img,video) { display: block; max-width: 100%; max-height: 63dvh; object-fit: contain; }
.ag-media-stage audio { width: min(480px, 100%); }
.ag-media-stage .ag-media-pdf { width: 100%; height: 63dvh; border: 0; }
.ag-media-text {
  justify-self: stretch; margin: 0; padding: 4px; color: var(--ink); font: inherit;
  font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.ag-media-note { padding: 10px; color: var(--secondary); line-height: 1.5; text-align: center; }
.ag-media-foot { border-top: 1px solid var(--line); flex-wrap: wrap; }
.ag-media-download { margin-left: auto; color: var(--white); background: var(--blue); }
.ag-media-download:hover { background: var(--blue-hover); }
.ag-media :is(button,a):focus-visible { outline: 3px solid var(--blue-ink); outline-offset: 2px; }
