.qv {
  position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh;
  max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--paper); color: var(--ink); overflow: hidden;
}
.qv[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.qv::backdrop { background: var(--cover); }
.qv-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: max(.65rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .65rem max(1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.qv-header h2 { margin: 0; font: 400 clamp(1.5rem, 3vw, 2.2rem)/1.1 var(--serif); }
.qv button {
  display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0 .7rem;
  color: var(--ink); background: var(--paper); border: 1px solid #abb2a5; border-radius: 3px;
  font: 500 1.3rem/1 var(--sans);
}
.qv button:enabled:hover { background: #e9ede4; }
.qv button:disabled { color: #72776e; border-color: var(--line); cursor: default; }
.qv .qv-close { flex-shrink: 0; border-radius: 50%; }
.qv-stage {
  position: relative; overflow: hidden; min-height: 0; min-width: 0; isolation: isolate;
  background: #e6e1d7; touch-action: none; user-select: none; -webkit-user-select: none; cursor: zoom-in;
}
.qv-stage:focus-visible { outline-offset: -4px; }
.qv-stage.qv-enlarged { cursor: grab; }
.qv-stage.qv-enlarged.qv-dragging { cursor: grabbing; }
.qv-stage img {
  position: absolute; display: block; top: 50%; left: 50%; max-width: none; max-height: none;
  transform-origin: center; pointer-events: none; -webkit-user-drag: none;
}
.qv-error { position: absolute; inset: 45% 1rem auto; text-align: center; }
.qv-controls {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .65rem .75rem max(.65rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
}
.qv-level { width: 3.5rem; text-align: center; font: 550 1rem var(--sans); font-variant-numeric: tabular-nums; }
.qv .qv-fit { margin-left: .4rem; padding-inline: .9rem; font-size: .95rem; }
