[data-rally-camera] {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink, #172f34);
}

[data-rally-camera] [hidden] { display: none !important; }

[data-rally-camera-stage] {
  position: relative;
  inline-size: min(100%, 422px, max(170px, calc(75svh - 184.5px)));
  aspect-ratio: 3 / 4;
  isolation: isolate;
  overflow: hidden;
  background: #152b31;
  border: 1px solid #171f2c42;
  border-radius: 5px;
}

[data-rally-camera-stage] :is(video, canvas, img[data-rally-camera-image]) {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

[data-rally-camera-stage] video {
  opacity: .001;
  pointer-events: none;
}

[data-rally-camera]:not([data-camera-state="live"], [data-camera-state="encoding"]) [data-rally-camera-preview] {
  visibility: hidden;
}

[data-rally-camera-status] {
  align-self: stretch;
  max-inline-size: 34em;
  margin: 0;
  padding-inline: 8px;
  color: var(--muted, #556665);
  font-size: .84rem;
  line-height: 1.55;
  text-align: center;
}

[data-rally-camera][data-camera-state="error"] [data-rally-camera-status] {
  color: var(--red, #a63828);
}

[data-rally-camera-shutter] {
  display: inline-grid;
  place-items: center;
  width: 61px;
  height: 61px;
  margin: 0 0 3px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #22404a;
  box-shadow: 0 0 0 1px #244750;
  cursor: pointer;
  touch-action: manipulation;
}

[data-rally-camera-shutter]::before {
  content: '';
  display: block;
  width: 47px;
  height: 47px;
  border-radius: 50%;
  background: #fff;
}

[data-rally-camera-shutter]:disabled {
  opacity: .48;
  cursor: default;
}

[data-rally-camera] button:focus-visible {
  outline: 3px solid var(--red, #a63828);
  outline-offset: 4px;
}

[data-rally-photo-actions] {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

[data-rally-camera] :is([data-rally-camera-retry], [data-rally-camera-save], [data-rally-camera-share], [data-rally-camera-retake]) {
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--ink, #172f34);
  border-radius: 4px;
  background: var(--paper, #fff8e9);
  color: var(--ink, #172f34);
  font: 700 .83rem/1.35 system-ui, sans-serif;
  cursor: pointer;
}

[data-rally-camera] [data-rally-camera-save] {
  border-color: var(--red, #a63828);
  background: var(--red, #a63828);
  color: #fff;
}

[data-rally-camera] :is([data-rally-camera-save], [data-rally-camera-share], [data-rally-camera-retake]):disabled {
  opacity: .6;
  cursor: default;
}
