.output {
  display: contents;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    opacity: 0.8;
    transition: opacity 500ms ease;
  }

  &.alt-background::before {
    opacity: 0;
  }
}

.two-up {
  composes: abs-fill from global;
}

.pinch-zoom {
  composes: abs-fill from global;
  outline: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pinch-target {
  /* This fixes a severe painting bug in Chrome.
   * We should try to remove this once the issue is fixed.
   * https://bugs.chromium.org/p/chromium/issues/detail?id=870222#c10 */
  will-change: auto;
  /* Prevent the image becoming misshapen due to default flexbox layout. */
  flex-shrink: 0;
}

.controls {
  display: flex;
  justify-content: center;
  overflow: hidden;
  flex-wrap: wrap;
  contain: content;
  grid-area: header;
  align-self: center;
  padding: 9px 66px;
  position: relative;
  gap: 6px;

  /* Allow clicks to fall through to the pinch zoom area */
  pointer-events: none;
  & > * {
    pointer-events: auto;
  }

  @media (min-width: 860px) {
    padding: 9px;
    flex-wrap: wrap-reverse;
    grid-area: viewportOpts;
    align-self: end;
  }
}

.button-group {
  display: flex;
  position: relative;
  z-index: 100;
}

.button,
.zoom {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  background-color: rgba(29, 29, 29, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.67);
  border-width: 1px 0 1px 1px;
  line-height: 1.1;
  white-space: nowrap;
  height: 39px;
  padding: 0 8px;
  font-size: 1.2rem;
  cursor: pointer;

  &:focus-visible {
    box-shadow: 0 0 0 2px #fff;
    outline: none;
    z-index: 1;
  }
}

.button {
  color: #fff;
  margin: 0;

  &:hover {
    background: rgba(50, 50, 50, 0.92);
  }

  &.active {
    background: rgba(72, 72, 72, 0.92);
    color: #fff;
  }
}

.first-button {
  composes: button;
  border-radius: 6px 0 0 6px;
}

.last-button {
  composes: button;
  border-radius: 0 6px 6px 0;
  border-right-width: 1px;
}

.zoom {
  cursor: text;
  width: 7rem;
  font: inherit;
  text-align: center;
  justify-content: center;

  &:focus {
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2), 0 0 0 2px #fff;
  }
}
span.zoom {
  color: #939393;
  font-size: 0.8rem;
  line-height: 1.2;
  font-weight: 100;
}
input.zoom {
  font-size: 1.2rem;
  letter-spacing: 0.05rem;
  font-weight: 700;
  text-indent: 3px;
  color: #fff;
}

.zoom-value {
  margin: 0 3px 0 0;
  padding: 0 2px;
  font-size: 1.2rem;
  letter-spacing: 0.05rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px dashed #999;
}

.buttons-no-wrap {
  display: flex;
  pointer-events: none;

  & > * {
    pointer-events: auto;
  }
}

.pixelated {
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}
