html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  position: relative;
  overflow: hidden; /* Prevent scrolling */
}

#canvas,
#capture-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  width: 100%;
  height: 100vh;
  height: 100%; /* Fallback */
  min-height: -webkit-fill-available; /* iOS/Android fix */
}
#backgroundImg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #edeae6;
  z-index: 10;
}

#controls {
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  z-index: 999;
}

#outline {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  height: 150px;
  width: 150px;
  border: none;
  z-index: 900;
  transition: transform 0.3s ease;
  background-size: contain;
  background-position: center;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  /* Static full white ring by default */
  background: url("data:image/svg+xml,    <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\">      <circle cx=\"50\" cy=\"50\" r=\"45\" stroke=\"white\" stroke-width=\"7\" fill=\"none\"/>    </svg>")
    center/contain no-repeat;
}

#outline.animate {
  transform: translate(-50%, -50%) scale(1.5);
  /* White ring stays, red animates over it */
  background: url("data:image/svg+xml,    <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\">      <circle cx=\"50\" cy=\"50\" r=\"45\" stroke=\"white\" stroke-width=\"7\" fill=\"none\"/>      <g transform=\"rotate%28-90 50 50%29\">        <circle cx=\"50\" cy=\"50\" r=\"45\" stroke=\"red\" stroke-width=\"7\" fill=\"none\"                 stroke-dasharray=\"282.7\" stroke-dashoffset=\"282.7\">          <animate attributeName=\"stroke-dashoffset\"                    from=\"282.7\" to=\"0\"                    dur=\"60s\"                    repeatCount=\"indefinite\"/>        </circle>      </g>    </svg>")
    center/contain no-repeat;
}

#record-button {
  display: none;
  height: 170px;
  width: 170px;
  transform: scale(0.9);
  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;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

#back-button-container {
  position: absolute;
  bottom: 1%;
  left: 50%; /* Center horizontally */

  z-index: 1000;
}

#back-button {
  transform: none;
  background-color: transparent;
  height: 125px;
  width: 125px;
  color: transparent;
  border: none;
  cursor: pointer;
  user-select: none;
  outline: none;
  padding: 0%;
  transform: translate(-200%, 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(calc(-200% + 2px), 2px);
}

#action-buttons {
  position: absolute;
  bottom: 1%; /* Adjust the distance from the bottom of the screen */
  left: 50%; /* Center horizontally */
  transform: translate(-50%); /* Offset by half the width and height */
  display: flex; /* Enables flex layout */
  justify-content: center; /* Aligns buttons horizontally */
  align-items: center; /* Aligns buttons vertically */
  z-index: 1000; /* Ensure visibility above other elements */
  flex-wrap: wrap; /* Allows wrapping if container width is too small */
}

#share-button {
  height: 125px;
  width: 125px;
  background-color: transparent;
  transform: translate(50%, 0);
  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(calc(50% + 2px), 2px);
}

#download-button {
  height: 125px;
  width: 125px;
  background-color: transparent;
  transform: translate(94%, 0);
  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(calc(94% + 2px), 2px);
}

#switch-cam {
  position: absolute;
  top: -1%;
  right: -1%;
  z-index: 950;
}

#switch-button {
  display: none;
  height: 125px;
  width: 125px;
  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: absolute;
  top: 30%;
  left: 50%;
  z-index: 900;
  transform: translate(-50%, 0);
  display: none; /* Hidden by default */
}

#loading-icon {
  height: 200px;
  width: 200px;
  animation: spin 2s linear infinite; /* Apply the spin animation */
}

/* 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;
}

