.mobile-wrap {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
}

.mobile-connect {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(800px 600px at 30% -10%, #1e3a8a44, transparent 60%),
              radial-gradient(800px 600px at 120% 120%, #7c3aed44, transparent 60%),
              #0b1120;
}

.scanner-root {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  display: none;
}
.scanner-root.active { display: block; }

#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#qr-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
}

.scan-frame {
  position: absolute;
  top: 50%; left: 50%;
  width: 68vw; height: 68vw;
  max-width: 320px; max-height: 320px;
  transform: translate(-50%, -50%);
  border-radius: 18px;
  pointer-events: none;
}
.scan-frame::before, .scan-frame::after,
.scan-frame > span::before, .scan-frame > span::after {
  content: '';
  position: absolute;
  width: 34px; height: 34px;
  border-color: rgba(255,255,255,.9);
  border-style: solid;
  border-width: 0;
}
.scan-frame::before { top: 0; left: 0; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 16px; }
.scan-frame::after { top: 0; right: 0; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 16px; }
.scan-frame > span::before { bottom: 0; left: 0; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 16px; }
.scan-frame > span::after { bottom: 0; right: 0; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 16px; }
.scan-frame::after, .scan-frame > span { position: absolute; inset: 0; }

.laser {
  position: absolute;
  left: 5%;
  right: 5%;
  height: 3px;
  top: 16%;
  opacity: .5;
  border-radius: 2px;
  background: currentColor;
  color: var(--color-laser-red);
  box-shadow: 0 0 14px currentColor, 0 0 26px currentColor;
  animation: laserScan 2.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 3;
}
.laser.green {
  color: var(--color-laser-green);
}
@keyframes laserScan {
  0%, 100% { top: 16%; }
  50% { top: 70%; }
}
.scan-frame + .laser {
  width: calc(68vw - 16px);
  max-width: 304px;
  left: 0;
  right: 0;
  margin: 0 auto;
  animation-name: laserScanInFrame;
  animation-duration: 2.2s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  top: calc(50% - 34vw + 4px);
}
@keyframes laserScanInFrame {
  0%, 100% { top: calc(50% - 34vw + 4px); }
  50% { top: calc(50% + 34vw - 7px); }
}
@media (min-width: 480px) {
  .scan-frame + .laser {
    top: calc(50% - 156px);
    animation-name: laserScanInFrameLarge;
  }
  @keyframes laserScanInFrameLarge {
    0%, 100% { top: calc(50% - 156px); }
    50% { top: calc(50% + 149px); }
  }
}

.scanner-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 5;
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,0));
  color: #fff;
}
.scanner-topbar .title {
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.scanner-topbar .state {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16,185,129,.18);
  color: #a7f3d0;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(16,185,129,.4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.scanner-topbar .state .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse 1.4s ease-out infinite;
}

.scanner-help {
  position: absolute;
  bottom: 24px; left: 12px; right: 12px;
  text-align: center;
  color: rgba(255,255,255,.85);
  z-index: 5;
  font-size: 13.5px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0,0,0,.36);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.08);
}

.btn.mobile-connect-btn {
  height: 52px;
  font-size: 16px;
}
.btn.mobile-connect-btn.loading .dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: currentColor;
  border-radius: 50%;
  margin: 0 2px;
  animation: dotPulse 1.2s ease-in-out infinite;
}
.btn.mobile-connect-btn.loading .dot:nth-child(2) { animation-delay: .15s; }
.btn.mobile-connect-btn.loading .dot:nth-child(3) { animation-delay: .3s; }
@keyframes dotPulse {
  0%, 80%, 100% { opacity: .2; transform: scale(.8); }
  40% { opacity: 1; transform: scale(1); }
}

.mobile-result .backdrop { padding: 18px; }
.mobile-result .modal { padding: 24px 20px; }
.mobile-result .msg { font-size: 17px; }

/* PC link indicator in the scanner topbar ------------------------------- */
.pc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,255,255,.08);
  color: #cbd5e1;
  white-space: nowrap;
}
.pc-link .dot { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; flex: none; }
.pc-link.on  { background: rgba(16,185,129,.20); color: #6ee7b7; }
.pc-link.on .dot { background: #10b981; animation: pcLinkPulse 2s infinite; }
.pc-link.off { background: rgba(239,68,68,.20); color: #fca5a5; }
.pc-link.off .dot { background: #ef4444; }
@keyframes pcLinkPulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.6); }
  70%  { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
