body.in-camera { overflow: hidden; overscroll-behavior: none; }
body.in-camera .topbar { display: none; }

.camera-view {
  --camera-glass: rgba(20, 30, 25, .7);
  --camera-top: max(12px, env(safe-area-inset-top, 0px));
  --camera-right: max(12px, env(safe-area-inset-right, 0px));
  --camera-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  --camera-left: max(12px, env(safe-area-inset-left, 0px));
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  background: #101418;
  user-select: none;
}
.camera-frame, .camera-frame canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.camera-frame canvas { object-fit: fill; touch-action: none; }

.camera-bar {
  position: absolute;
  left: var(--camera-left);
  right: var(--camera-right);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.camera-bar button { pointer-events: auto; }
.camera-top { top: var(--camera-top); z-index: 4; }
.camera-bottom { bottom: var(--camera-bottom); z-index: 1; }
.camera-heading {
  grid-column: 2;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  max-width: min(42vw, 320px);
  text-align: center;
}
.camera-pill, .camera-chip, .camera-round {
  background: var(--camera-glass);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px #0004;
}
.camera-pill, .camera-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  border-radius: 999px;
  font-weight: 800;
  line-height: 1.25;
}
.camera-pill { min-height: 48px; padding: 5px 16px; font-size: 1rem; white-space: nowrap; }
.camera-pill .icon { width: 18px; height: 18px; }
.camera-pill:active, .camera-round:active { transform: scale(.94); }
.camera-home { grid-column: 3; justify-self: end; }
.camera-chip { max-width: 100%; min-height: 34px; padding: 6px 12px; margin: 0; font-size: .92rem; overflow-wrap: anywhere; }

.camera-view button:focus-visible { outline: 3px solid #ffc93c; outline-offset: 2px; }

.camera-shutter {
  grid-column: 2;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  padding: 0;
  border: 5px solid #fff;
  border-radius: 50%;
  background: #ffffff59;
  box-shadow: 0 3px 14px #0005;
}
.camera-shutter:disabled { opacity: .52; }
.camera-shutter span { width: 66px; height: 66px; border-radius: 50%; background: #fff; transition: transform .1s; }
.camera-shutter:active span { transform: scale(.86); background: #ffe8a3; }
.camera-round {
  grid-column: 3;
  justify-self: end;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: .72rem;
  font-weight: 800;
}
.camera-round .icon { width: 25px; height: 25px; }

.camera-message {
  position: absolute;
  left: 50%;
  bottom: calc(108px + var(--camera-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 180px);
  width: max-content;
  padding: 8px 14px;
  border-radius: 14px;
  color: #213e2d;
  background: #fffffff2;
  font-size: .9rem;
  font-weight: 750;
  text-align: center;
  word-break: keep-all;
  pointer-events: none;
}
.camera-message { z-index: 2; bottom: calc(142px + var(--camera-bottom)); color: #75223b; }
.camera-message:empty { display: none; }

.camera-view .camera-gate { z-index: 3; background-color: #101418ad; }

@media (max-width: 600px) {
  .camera-top { grid-template-columns: auto minmax(0, 1fr) auto; }
  .camera-heading { max-width: 100%; }
  .camera-pill { min-height: 44px; padding-inline: 9px; font-size: .83rem; }
  .camera-chip { padding-inline: 7px; font-size: .86rem; }
  .camera-shutter { width: 76px; height: 76px; }
  .camera-shutter span { width: 54px; height: 54px; }
  .camera-round { width: 59px; height: 59px; font-size: .66rem; }
  .camera-message {
    left: var(--camera-left);
    bottom: calc(88px + var(--camera-bottom));
    max-width: calc(100% - 112px);
    transform: none;
    text-align: left;
    font-size: .81rem;
  }
  .camera-message { bottom: calc(139px + var(--camera-bottom)); }
}

@media (max-height: 500px) and (orientation: landscape) {
  .camera-shutter { width: 72px; height: 72px; }
  .camera-shutter span { width: 52px; height: 52px; }
  .camera-round { width: 56px; height: 56px; }
  .camera-message {
    left: var(--camera-left);
    bottom: calc(82px + var(--camera-bottom));
    transform: none;
    max-width: min(45%, calc(100% - 220px));
    text-align: left;
  }
  .camera-message { bottom: calc(132px + var(--camera-bottom)); }
}
