:root {
  color-scheme: dark;
  --page: #07060c;
  --surface: #0f0c19;
  --surface-strong: #151124;
  --text: #f5f3ff;
  --muted: #aaa3ba;
  --violet: #9b6dff;
  --violet-deep: #6d3be8;
  --cyan: #35d9ff;
  --danger: #ff8eae;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ambient {
  position: fixed;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(90px);
  opacity: .16;
}

.ambient-one { top: -160px; right: -140px; background: var(--violet); }
.ambient-two { bottom: 5%; left: -210px; background: var(--cyan); opacity: .1; }

.app-shell {
  position: relative;
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(22px + env(safe-area-inset-top)) 18px calc(48px + env(safe-area-inset-bottom));
}

.scanner-card {
  padding: clamp(18px, 5vw, 34px);
  border: 1px solid rgba(155, 109, 255, .42);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(21, 17, 36, .97), rgba(10, 8, 17, .98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, .45), 0 0 0 1px rgba(53, 217, 255, .04) inset;
}

.scanner-heading { margin: 0 2px 20px; }
.scanner-heading h1 { margin: 5px 0 4px; font-size: clamp(25px, 7vw, 34px); line-height: 1.12; }
.scanner-heading p { margin: 0; color: var(--muted); font-size: 15px; }

.eyebrow {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2em;
}

.scan-window {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(155, 109, 255, .58);
  border-radius: 22px;
  background: #020205;
  box-shadow: 0 0 0 8px rgba(155, 109, 255, .035), 0 22px 60px rgba(0, 0, 0, .34);
}

.scan-window::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, .58);
  content: "";
  pointer-events: none;
}

#camera {
  position: absolute;
  display: none;
  width: 100%;
  height: 100%;
  inset: 0;
  object-fit: cover;
  object-position: center;
  transform: scale(1.015);
}

.scan-window.active #camera { display: block; }
.scan-window.active .scan-placeholder { display: none; }

.scan-placeholder {
  display: flex;
  max-width: 260px;
  align-items: center;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  color: #d8d2e8;
  font-size: clamp(17px, 4.5vw, 22px);
  font-weight: 600;
  text-align: center;
}

.placeholder-icon {
  width: 58px;
  height: 58px;
  border: 2px solid rgba(53, 217, 255, .7);
  border-radius: 16px;
  background:
    linear-gradient(90deg, var(--violet) 8px, transparent 8px) 8px 8px / 17px 17px no-repeat,
    linear-gradient(var(--violet) 8px, transparent 8px) 8px 8px / 17px 17px no-repeat,
    linear-gradient(90deg, var(--cyan) 8px, transparent 8px) 33px 33px / 17px 17px no-repeat,
    linear-gradient(var(--cyan) 8px, transparent 8px) 33px 33px / 17px 17px no-repeat;
  box-shadow: 0 0 30px rgba(155, 109, 255, .18);
}

.scan-guide {
  position: absolute;
  z-index: 3;
  inset: 9%;
  border: 1px dashed rgba(255, 255, 255, .28);
  border-radius: 18px;
  pointer-events: none;
}

.corner { position: absolute; width: 34px; height: 34px; }
.top-left { top: -2px; left: -2px; border-top: 3px solid var(--cyan); border-left: 3px solid var(--cyan); border-radius: 13px 0 0; }
.top-right { top: -2px; right: -2px; border-top: 3px solid var(--violet); border-right: 3px solid var(--violet); border-radius: 0 13px 0 0; }
.bottom-left { bottom: -2px; left: -2px; border-bottom: 3px solid var(--violet); border-left: 3px solid var(--violet); border-radius: 0 0 0 13px; }
.bottom-right { right: -2px; bottom: -2px; border-right: 3px solid var(--cyan); border-bottom: 3px solid var(--cyan); border-radius: 0 0 13px; }

.scan-window.active .scan-guide::after {
  position: absolute;
  right: 10px;
  left: 10px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--violet), transparent);
  box-shadow: 0 0 14px rgba(53, 217, 255, .8);
  content: "";
  animation: scan-line 2.1s ease-in-out infinite;
}

@keyframes scan-line {
  0%, 100% { top: 8%; opacity: .35; }
  50% { top: calc(92% - 2px); opacity: 1; }
}

.scan-status {
  position: absolute;
  z-index: 5;
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: none;
  padding: 12px 14px;
  border: 1px solid rgba(155, 109, 255, .3);
  border-radius: 13px;
  background: rgba(8, 6, 14, .88);
  color: #ece8ff;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  backdrop-filter: blur(12px);
}

.scan-status.visible { display: block; }
.scan-status.error { border-color: rgba(255, 142, 174, .45); color: var(--danger); }

.scan-button {
  width: 100%;
  min-height: 64px;
  margin-top: 20px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(100deg, var(--violet-deep), var(--violet) 52%, #7a87ff);
  box-shadow: 0 14px 32px rgba(109, 59, 232, .3), inset 0 1px rgba(255, 255, 255, .24);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 19px;
  font-weight: 750;
}

.scan-button:active { transform: translateY(1px); }
.scan-button:disabled { cursor: wait; opacity: .68; }

.privacy-note { margin: 14px 12px 0; color: #817a91; font-size: 12px; line-height: 1.4; text-align: center; }

.footer {
  margin-top: 30px;
  padding: 24px 10px 0;
  border-top: 1px solid rgba(155, 109, 255, .22);
  color: var(--muted);
  font-size: clamp(15px, 4vw, 18px);
  font-weight: 500;
  line-height: 1.55;
  text-align: center;
}

.footer p { margin: 0; }
.footer a { color: var(--cyan); font-weight: 750; text-decoration: none; }

@media (max-width: 390px) {
  .app-shell { padding-right: 12px; padding-left: 12px; }
  .scanner-card { padding: 16px; border-radius: 23px; }
  .scan-window { border-radius: 18px; }
  .scanner-heading { margin-bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .scan-window.active .scan-guide::after { animation: none; top: 50%; }
}
