.app-shell-scan {
  background:
    radial-gradient(circle at top, rgba(104, 242, 211, 0.08), transparent 24%),
    linear-gradient(180deg, #02060d 0%, #040911 100%);
}

.scan-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px));
}

.scan-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.scan-close {
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.95rem;
}

.camera-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  height: 100%;
  border-radius: 36px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08), transparent 20%),
    linear-gradient(180deg, #0e1b2b 0%, #040811 100%);
}

.camera-noise,
.camera-glow {
  position: absolute;
  inset: 0;
}

.camera-noise {
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.08) 0.8px, transparent 0.8px);
  background-size: 10px 10px;
  opacity: 0.16;
}

.camera-glow {
  background:
    radial-gradient(circle at 50% 50%, rgba(104, 242, 211, 0.08), transparent 26%),
    radial-gradient(circle at 50% 50%, rgba(140, 184, 255, 0.08), transparent 42%);
}

.scan-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(72vw, 260px);
  height: min(72vw, 260px);
  transform: translate(-50%, -50%);
  z-index: 3;
}

.corner {
  position: absolute;
  width: 42px;
  height: 42px;
  border-color: #9fffe8;
  border-style: solid;
  filter: drop-shadow(0 0 10px rgba(104, 242, 211, 0.45));
}

.corner-tl {
  top: 0;
  left: 0;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 18px;
}

.corner-tr {
  top: 0;
  right: 0;
  border-width: 4px 4px 0 0;
  border-top-right-radius: 18px;
}

.corner-bl {
  bottom: 0;
  left: 0;
  border-width: 0 0 4px 4px;
  border-bottom-left-radius: 18px;
}

.corner-br {
  bottom: 0;
  right: 0;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 18px;
}

.scan-line {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 20px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #9fffe8, transparent);
  box-shadow: 0 0 22px rgba(104, 242, 211, 0.95);
  animation: scanLine 2.2s linear infinite;
}

.overlay {
  position: absolute;
  background: rgba(0, 0, 0, 0.44);
  z-index: 2;
}

.overlay-top,
.overlay-bottom {
  left: 0;
  right: 0;
  height: calc(50% - min(36vw, 130px));
}

.overlay-top {
  top: 0;
}

.overlay-bottom {
  bottom: 0;
}

.overlay-left,
.overlay-right {
  top: calc(50% - min(36vw, 130px));
  bottom: calc(50% - min(36vw, 130px));
  width: calc(50% - min(36vw, 130px));
}

.overlay-left {
  left: 0;
}

.overlay-right {
  right: 0;
}

.scan-status {
  margin-top: 16px;
  min-height: 68px;
  padding: 0 18px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  transition: transform 220ms ease, background 220ms ease, border-color 220ms ease;
}

.scan-status p {
  margin: 0;
  font-size: 1rem;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #9fffe8;
  box-shadow: 0 0 16px rgba(104, 242, 211, 0.7);
  animation: pulseDot 1.6s ease-in-out infinite;
}

body.scan-success .scan-status {
  transform: scale(1.01);
  background: linear-gradient(135deg, rgba(104, 242, 211, 0.22), rgba(255, 255, 255, 0.1));
  border-color: rgba(104, 242, 211, 0.28);
}

body.scan-success .pulse-dot {
  background: #ffd38f;
  box-shadow: 0 0 16px rgba(255, 211, 143, 0.8);
}

@keyframes scanLine {
  0% {
    transform: translateY(0);
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(220px);
    opacity: 0.8;
  }
}

@keyframes pulseDot {
  0%, 100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

@media (max-height: 760px) {
  .scan-screen {
    padding-top: 18px;
  }

  .scan-topbar {
    margin-bottom: 16px;
  }

  .camera-stage {
    border-radius: 28px;
  }

  .scan-frame {
    width: min(66vw, 230px);
    height: min(66vw, 230px);
  }
}
