html, body {
  margin: 0;
  padding: 0;
  background: #000;
  overflow: hidden;
  width: 100%;
  height: 100%;
  position: fixed;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

canvas {
  display: block;
  touch-action: none;
}

/* Overlay controls: shutter bottom right, fullscreen toggle bottom left. */
.controls {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  gap: 14px;
  z-index: 10;
}

.controls-right {
  right: calc(16px + env(safe-area-inset-right));
}

.controls-left {
  left: calc(16px + env(safe-area-inset-left));
}

.control-button {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, background 0.15s ease;
}

.control-button svg {
  width: 32px;
  height: 32px;
  pointer-events: none;
}

.control-button:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.25);
}

.control-button[hidden],
.no-fullscreen #fullscreen {
  display: none;
}

/* Fullscreen icon swaps between enter and exit states. */
#fullscreen .icon-exit { display: none; }
body.is-fullscreen #fullscreen .icon-enter { display: none; }
body.is-fullscreen #fullscreen .icon-exit { display: block; }

/* About / info modal. */
.info-modal {
  position: fixed;
  width: min(420px, calc(100vw - 48px));
  box-sizing: border-box;
  padding: 28px 28px 24px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  background: rgba(20, 16, 32, 0.85);
  color: #fff;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  font-size: 16px;
  line-height: 1.5;
  -webkit-user-select: text;
  user-select: text;
}

.info-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.info-modal h1 {
  margin: 0 40px 14px 0;
  font-size: 24px;
  font-weight: 700;
}

.info-modal p {
  margin: 0 0 12px;
}

.info-modal p:last-child {
  margin-bottom: 0;
}

.info-modal a {
  color: #f267ac;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.info-modal .info-licences {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
}

.info-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.info-close svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.info-close:active {
  background: rgba(255, 255, 255, 0.25);
}

/* Status / error message while the camera and model load. */
.status {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 80vw;
  padding: 14px 22px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 18px;
  text-align: center;
  line-height: 1.4;
  z-index: 20;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.status[hidden] {
  display: none;
}

.status.error {
  background: rgba(160, 20, 40, 0.85);
}

/* White flash when a picture is taken. */
.flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 15;
}

.flash.active {
  animation: flash 0.35s ease-out;
}

@keyframes flash {
  0%   { opacity: 0.9; }
  100% { opacity: 0; }
}
