body {
  margin: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #000;
  flex-direction: column;
  font-family: sans-serif;
  color: #e0e0e0;
}

.portal-container {
  position: relative;
  width: 80vw;
  height: 80vh;
  max-width: 800px;
  max-height: 800px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.portal-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

#scannedPortal {
  opacity: 0;
  z-index: 10;
  transition: opacity 0.3s ease-out;
}

#idlePortal {
  z-index: 5;
  opacity: 1;
}

#scanButton {
  margin-top: 20px;
  padding: 15px 30px;
  font-size: 1.2em;
  cursor: pointer;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 5px;
  transition: background-color 0.3s ease;
  z-index: 20;
}

#scanButton:hover {
  background-color: #555;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-content {
  background-color: #222;
  color: #e0e0e0;
  padding: 40px;
  border-radius: 8px;
  text-align: center;
  max-width: 90vw;
  font-size: 1.1em;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.modal-content p {
  margin-top: 0;
  margin-bottom: 30px;
}

.modal-content button {
  padding: 12px 25px;
  font-size: 1em;
  background-color: #444;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.modal-content button:hover {
  background-color: #666;
}

@media (max-width: 768px) {
  body {
    display: block;
    min-height: auto;
  }

  .portal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    z-index: -1;
  }

  #scanButton {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0;
  }
}

@supports (height: 100dvh) {
  @media (max-width: 768px) {
    .portal-container {
      height: 100dvh;
    }
  }
}
@supports (height: 100svh) {
  @media (max-width: 768px) {
    .portal-container {
      height: 100svh;
    }
  }
}
