html, body {
    position: relative; 
    margin: 0; 
    width: 100%; 
    height: 100%; 
    overflow: hidden;
    /* background-color: #fff; */
    font-family: 'Roboto', sans-serif;
}

#container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

#scanning {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: transparent;
    z-index: 2;
}

.guide {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 25px;
    font-weight: bold;
    color: #fff;
    width: 80%;
    text-shadow: 2px 2px 4px #000;
}

@media (min-aspect-ratio: 1/1) {
    #scanning .inner {
    width: 50vh;
    height: 50vh;
    }
}
@media (max-aspect-ratio: 1/1) {
    #scanning .inner {
    width: 80vw;
    height: 60vw;
    }
}

#preload {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}   

#preload .inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px;
}

#preload .inner img {
    width: auto;
    height: auto;
    max-width: 200px;
    margin-bottom: 30px;
}

#preload .inner .loading {
    border: 16px solid rgba(255, 255, 255, 0.2);
    border-top: 16px solid #ffffff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#scanning .inner {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;

    background:
    linear-gradient(to right, white 10px, transparent 10px) 0 0,
    linear-gradient(to right, white 10px, transparent 10px) 0 100%,
    linear-gradient(to left, white 10px, transparent 10px) 100% 0,
    linear-gradient(to left, white 10px, transparent 10px) 100% 100%,
    linear-gradient(to bottom, white 10px, transparent 10px) 0 0,
    linear-gradient(to bottom, white 10px, transparent 10px) 100% 0,
    linear-gradient(to top, white 10px, transparent 10px) 0 100%,
    linear-gradient(to top, white 10px, transparent 10px) 100% 100%;
    background-repeat: no-repeat;
    background-size: 40px 40px;
}

#scanning.hidden {    
    display: none;
}

#scanning img {
    opacity: 0.4;
    width: 90%;
    align-self: center;
}

#scanning .inner .scanline {
    position: absolute;
    width: 100%;
    height: 10px;
    background: white;
    animation: move 2s linear infinite;
}

@keyframes move {
    0%, 100% { top: 0% }
    50% { top: calc(100% - 10px) }
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    /* background-color: rgba(255, 255, 255, 0.5); Set the background overlay to 50% opacity */
    pointer-events: none; /* Ensure the canvas doesn't intercept clicks */
}

/* Remove old button styles */
#record-btn, .record-btn, .control-btn {
  display: none;
}

.control-buttons {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: none;
}

.capture-menu {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-capture-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.main-capture-btn:active {
  transform: scale(0.95);
}

.capture-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid #006885;
  background: transparent;
  transition: all 0.3s ease;
}

.main-capture-btn.recording .capture-icon {
  background: #ff4444;
  border-color: #ff4444;
}

.capture-options {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  gap: 8px;
  min-width: 160px;
}

.capture-menu.active .capture-options {
  display: flex;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: #006885;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.option-btn:hover {
  background: rgba(0, 104, 133, 0.1);
}

.option-btn svg {
  width: 24px;
  height: 24px;
}

.option-btn span {
  font-size: 14px;
  white-space: nowrap;
}

/* Animation for options menu */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(-20px);
  }
}

.capture-menu.active .capture-options {
  display: flex;
  animation: slideUp 0.2s ease-out forwards;
}

/* Show capture menu when scanning is active */
.control-buttons.visible {
  display: block;
}