/* ---------- card scanner ---------- */
.scan-fab {
  display: none; position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 26;
  width: 58px; height: 58px; border-radius: 50%; border: 0; background: #fff; color: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6), 0 0 0 6px rgba(255, 255, 255, .08); place-items: center;
  transition: transform .25s var(--ease);
}
.scan-fab:active { transform: scale(.92); }
.scan-fab .ic { width: 25px; height: 25px; }
body.gated .scan-fab { display: none !important; }
@media (max-width: 760px) { .scan-fab { display: grid; } }

.scanner { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; overflow: hidden; animation: fade .25s both; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-guide {
  position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%);
  height: min(64vh, calc(82vw * 88 / 63)); aspect-ratio: 63 / 88; border-radius: 4.5% / 3.2%;
  box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .55);
}
.scan-guide i { position: absolute; width: 34px; height: 34px; border: 3px solid #fff; }
.scan-guide i:nth-child(1) { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.scan-guide i:nth-child(2) { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.scan-guide i:nth-child(3) { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.scan-guide i:nth-child(4) { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.scan-line { position: absolute; left: 6%; right: 6%; height: 2px; top: 10%; background: linear-gradient(90deg, transparent, #fff, transparent); box-shadow: 0 0 14px #fff; opacity: 0; }
.scanner.busy .scan-line { opacity: 1; animation: scanline 1.3s ease-in-out infinite alternate; }
@keyframes scanline { from { top: 6%; } to { top: 92%; } }
.scan-top { position: absolute; left: 0; right: 0; top: 0; padding: max(14px, env(safe-area-inset-top)) 14px 14px; display: flex; align-items: center; gap: 12px; background: linear-gradient(#000c, transparent); }
.scan-title { flex: 1; text-align: center; font-weight: 800; font-size: 17px; display: flex; flex-direction: column; }
.scan-title span { font-weight: 500; font-size: 12px; color: #bbb; margin-top: 2px; }
.scan-btn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .45); backdrop-filter: blur(8px); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.scan-btn.on { background: #fff; color: #000; }
.scan-btn[hidden] { visibility: hidden; display: grid; }
.scan-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 28px calc(26px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(transparent, #000d); }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 5px; transition: transform .15s; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.shutter:active span { transform: scale(.86); }
.scanner.busy .shutter { opacity: .5; pointer-events: none; }
.scan-status { position: absolute; left: 50%; top: calc(47% + min(32vh, calc(41vw * 88 / 63)) + 18px); transform: translateX(-50%); max-width: 90vw; text-align: center; background: rgba(0, 0, 0, .7); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, .15); padding: 9px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.scan-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; max-height: 82vh; overflow-y: auto;
  background: var(--panel); border-top: 1px solid var(--line-2); border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -20px 60px rgba(0, 0, 0, .7);
  animation: sheetUp .35s var(--ease) both;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 14px; }
.scan-sheet h3 { font-size: 21px; margin: 4px 0 2px; }
.sr-main { display: flex; gap: 16px; align-items: flex-start; }
.sr-img { width: 120px; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 8px; flex: none; background: var(--panel-3); box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
.sr-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sr-price { font-size: 26px; font-weight: 800; letter-spacing: -.03em; margin-top: 8px; display: flex; align-items: baseline; gap: 8px; }
.sr-add { display: flex; gap: 8px; margin-top: 16px; }
.sr-add select { width: auto; flex: 0 0 auto; }
.sr-add .btn { flex: 1; }
.sr-actions { justify-content: space-between; margin-top: 8px; }
.sr-alts { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.sr-alt { flex: none; width: 70px; border: 2px solid transparent; border-radius: 8px; background: none; padding: 0; display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 600; }
.sr-alt img { width: 100%; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 6px; background: var(--panel-3); }
.sr-alt.on { border-color: #fff; color: #fff; }
@media (min-width: 761px) {
  .scan-sheet { left: 50%; transform: translateX(-50%); width: min(560px, 100%); bottom: 16px; border-radius: 22px; border: 1px solid var(--line-2); animation: fade .3s both; }
}
