html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: #000;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  min-height: 100svh;
  min-height: 100dvh;
  font-family: sans-serif;
}

#canvas,
#capture-canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  touch-action: none;
}

#canvas {
  z-index: 1;
}

#capture-canvas {
  z-index: 0;
}

.poweredbysnap-logo {
  width: auto;
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: flex-start;
  z-index: 900;
}

.poweredbysnap-logo > img {
  display: block;
  width: clamp(110px, 24vw, 180px);
  height: auto;
}

#controls {
  position: fixed;
  bottom: max(9%, calc(env(safe-area-inset-bottom) + 20px));
  left: 0;
  width: 100%;
  height: var(--button-size, clamp(76px, 22vw, 140px));
  display: flex;
  justify-content: center;
  z-index: 999;
}

#outline {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: var(--button-size, clamp(76px, 22vw, 140px));
  width: var(--button-size, clamp(76px, 22vw, 140px));
  border: none;
  z-index: 900;
  transition: background-color 0.2s ease;
}

#record-button {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: var(--button-size, clamp(76px, 22vw, 140px));
  width: var(--button-size, clamp(76px, 22vw, 140px));
  background-image: url(/assets/RecordButton.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: transparent;
  border-radius: 50%;
  border: none;
  z-index: 1000;
  transition: background-color 0.2s ease;
}

#record-button.pressed {
  background-color: green; /* Change to green when pressed */
  content: "Recording..."; /* Optionally add text */
}

#action-buttons {
  position: fixed;
  bottom: max(9%, calc(env(safe-area-inset-bottom) + 20px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(16px, 6vw, 48px);
  z-index: 1000;
}

#back-button-container {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  z-index: 1000;
}

#back-button {
  transform: none;
  background-color: transparent;
  height: clamp(48px, 14vw, 80px);
  width: clamp(48px, 14vw, 80px);
  color: transparent;
  border: none;
  cursor: pointer;
  user-select: none;
  outline: none;
  padding: 0%;
  transition: transform 0.15s ease-in-out;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
#back-button img {
  /* Add this if your button uses an image */
  max-width: 100%;
  max-height: 100%;
  height: auto;
}

#back-button:active {
  transform: translate(2px, 2px);
}

#share-button {
  height: clamp(64px, 18vw, 100px);
  width: clamp(64px, 18vw, 100px);
  background-color: transparent;
  color: transparent;
  border: none;
  cursor: pointer;
  user-select: none;
  outline: none;
  padding: 0%;
  transition: transform 0.15s ease-in-out;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

#share-button img {
  max-width: 100%;
  max-height: 100%;
  height: auto;
}

#share-button:active {
  transform: translate(2px, 2px);
}

#download-button {
  height: clamp(64px, 18vw, 100px);
  width: clamp(64px, 18vw, 100px);
  background-color: transparent;
  color: transparent;
  border: none;
  cursor: pointer;
  user-select: none;
  outline: none;
  padding: 0%;
  transition: transform 0.15s ease-in-out;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

#download-button img {
  max-width: 100%;
  max-height: 100%;
  height: auto;
}

#download-button:active {
  transform: translate(2px, 2px);
}

#switch-cam {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 950;
}

#switch-button {
  height: clamp(48px, 13vw, 70px);
  width: clamp(48px, 13vw, 70px);
  background-image: url(/assets/SwitchButton.png); /* Green background */
  background-size: contain; /* Ensure the image covers the button */
  background-position: center; /* Center the image */
  background-repeat: no-repeat; /* Preent tiling */
  background-color: transparent;
  border: none;
  user-select: none; /* Disable text selection */
  outline: none;
  transition: transform 0.2s ease; /* Smooth hover animation */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

#switch-button:active {
  transform: translate(5%, 5%); /* Only scale without affecting translation */
}

#loading {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  place-items: center;
  pointer-events: none;
}

#loading-icon {
  height: clamp(80px, 24vw, 160px);
  width: clamp(80px, 24vw, 160px);
  animation: spin 2s linear infinite; /* Apply the spin animation */
}

#preview {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 999;
}

/* Keyframes for the rotation */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Desktop-specific styles */
.desktop #outline,
.desktop #record-button {
  height: 70px;
  width: 70px;
}

.desktop #share-button {
  height: 70px;
  width: 70px;
}

.desktop #download-button {
  height: 70px;
  width: 70px;
}

.desktop #back-button {
  height: 50px;
  width: 50px;
}

/* Hide switch button on desktop */
.desktop #switch-cam {
  display: none;
}

@media (orientation: landscape) and (max-height: 600px) {
  :root {
    --button-size: clamp(58px, 15vh, 80px);
  }

  .poweredbysnap-logo > img {
    width: clamp(90px, 16vw, 130px);
  }
}

