/* The large picture viewer (picview.js), on the chat and the character page. Never the whole screen: a margin of backdrop
   all round (more at the top and bottom, where the × sits), so a click outside always closes it. The picture grows out
   of the thumbnail and back (200 ms); with reduced motion it only fades. */
.pv-back { position: fixed; inset: 0; z-index: 310; display: flex; align-items: center; justify-content: center; cursor: zoom-out;
  background: color-mix(in srgb, var(--scrim) 82%, transparent);
  padding: max(56px, 8vmin, env(safe-area-inset-top, 0px)) max(40px, 6vmin) max(56px, 8vmin, env(safe-area-inset-bottom, 0px));
  opacity: 0; transition: opacity .2s ease; }
.pv-back.pv-in { opacity: 1; }
.pv-fig { margin: 0; max-width: 100%; max-height: 100%; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pv-fig img { display: block; flex: 0 1 auto; min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px;
  box-shadow: 0 20px 80px color-mix(in srgb, var(--scrim) 70%, transparent); transition: transform .2s ease; transform-origin: center; cursor: zoom-out; }
.pv-cap { flex: none; max-width: 60ch; text-align: center; color: var(--on-scrim, var(--text)); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
body.vf .pv-x { position: absolute; top: max(10px, env(safe-area-inset-top, 0px)); right: 10px; width: 38px; height: 38px; padding: 0 !important; border-radius: 50%;
  display: grid; place-items: center; font-size: 24px !important; line-height: 1; background: color-mix(in srgb, var(--panel) 85%, transparent); color: var(--text);
  border: 1px solid var(--line-strong); cursor: pointer; }
body.vf .pv-x:hover, body.vf .pv-x:focus-visible { color: var(--gold); border-color: var(--gold); }
/* Galleries (owner 2026-12-03): a tad smaller than the chat's avatars, ‹ › at the sides, "2 / 6" under the picture. */
.pv-back.pv-small { padding: max(72px, 11vmin, env(safe-area-inset-top, 0px)) max(64px, 10vmin) max(72px, 11vmin, env(safe-area-inset-bottom, 0px)); }
.pv-count { flex: none; color: var(--on-scrim, var(--text)); font-size: 12px; opacity: .75; font-variant-numeric: tabular-nums; }
body.vf .pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; padding: 0 !important; border-radius: 10px;
  display: grid; place-items: center; font-size: 34px !important; line-height: 1; background: color-mix(in srgb, var(--panel) 80%, transparent); color: var(--text);
  border: 1px solid var(--line-strong); cursor: pointer; }
body.vf .pv-prev { left: max(10px, env(safe-area-inset-left, 0px)); }
body.vf .pv-next { right: max(10px, env(safe-area-inset-right, 0px)); }
body.vf .pv-nav:hover, body.vf .pv-nav:focus-visible { color: var(--gold); border-color: var(--gold); }
/* phones: the arrows sit lower and smaller, beside the thumb, and the picture keeps more of the width */
@media (max-width: 600px) {
  .pv-back.pv-small { padding-left: 46px; padding-right: 46px; }
  body.vf .pv-nav { width: 34px; height: 52px; font-size: 28px !important; }
  body.vf .pv-prev { left: 6px; } body.vf .pv-next { right: 6px; }
}
@media (prefers-reduced-motion: reduce) { .pv-back { transition: opacity .09s linear; } .pv-fig img { transition: none; } }
