/* Page-specific styles for stamp-scanner.html. */
.ss-wrap { max-width: 680px; margin: 0 auto; }

/* ── Scanner card ── */
.scanner-card { background: var(--ink-2); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin-bottom: 14px; }
.scanner-viewport { position: relative; width: 100%; aspect-ratio: 1/1; max-height: 420px; background: #0a0a0a; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#qrVideo { width: 100%; height: 100%; object-fit: cover; display: none; }
#qrCanvas { display: none; }

.scan-frame-wrap { position: absolute; inset: 0; pointer-events: none; display: none; align-items: center; justify-content: center; }
.scan-frame { width: 55%; max-width: 240px; aspect-ratio: 1/1; box-shadow: 0 0 0 9999px rgba(0,0,0,.58); border-radius: 4px; position: relative; }
.sc { position: absolute; width: 22px; height: 22px; }
.sc-tl { top: -2px; left: -2px; border-top: 3px solid var(--g); border-left: 3px solid var(--g); border-radius: 4px 0 0 0; }
.sc-tr { top: -2px; right: -2px; border-top: 3px solid var(--g); border-right: 3px solid var(--g); border-radius: 0 4px 0 0; }
.sc-bl { bottom: -2px; left: -2px; border-bottom: 3px solid var(--g); border-left: 3px solid var(--g); border-radius: 0 0 0 4px; }
.sc-br { bottom: -2px; right: -2px; border-bottom: 3px solid var(--g); border-right: 3px solid var(--g); border-radius: 0 0 4px 0; }
.scan-sweep { position: absolute; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent 10%, var(--g) 50%, transparent 90%); top: 0; animation: sweep 2s ease-in-out infinite; }
@keyframes sweep { 0%,100%{top:0;opacity:1} 50%{top:calc(100% - 2px);opacity:.45} }

.scanner-idle { position: absolute; inset: 0; background: var(--ink-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.idle-icon { width: 72px; height: 72px; border-radius: 20px; background: rgba(0,230,118,.07); border: 1px solid var(--border-g); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; color: var(--g); }
.scanner-idle p { font-size: .82rem; color: var(--text-2); text-align: center; margin: 0; max-width: 200px; line-height: 1.55; }

.scanner-controls { padding: 12px 16px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.btn-start { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: var(--r-sm); background: var(--g); color: #000; border: none; font-family: 'Inter', sans-serif; font-size: .83rem; font-weight: 700; cursor: pointer; transition: background .2s, transform .15s; }
.btn-start:hover { background: #1ffb80; transform: translateY(-1px); }
.btn-stop { display: none; align-items: center; gap: 7px; padding: 8px 16px; border-radius: var(--r-sm); background: rgba(239,68,68,.1); color: #fca5a5; border: 1px solid rgba(239,68,68,.25); font-family: 'Inter', sans-serif; font-size: .83rem; font-weight: 600; cursor: pointer; }
.scan-status { font-size: .74rem; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.scan-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.scan-dot.active { background: var(--g); animation: pulse-dot 1.2s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.25} }
.btn-upload-alt { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: var(--r-sm); background: transparent; border: 1px solid var(--border); color: var(--text-3); font-family: 'Inter', sans-serif; font-size: .76rem; font-weight: 600; cursor: pointer; margin-left: auto; transition: all .15s; white-space: nowrap; }
.btn-upload-alt:hover, .btn-upload-alt.active { border-color: rgba(255,255,255,.22); color: var(--text-2); background: var(--ink-3); }

/* ── Upload panel ── */
.upload-panel { background: var(--ink-2); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin-bottom: 14px; }
.upload-area { margin: 16px; border: 2px dashed var(--border); border-radius: var(--r-sm); padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; transition: border-color .18s, background .18s; }
.upload-area:hover, .upload-area.drag { border-color: var(--border-g); background: rgba(0,230,118,.04); }
.upload-area-icon { width: 52px; height: 52px; border-radius: 14px; background: rgba(0,230,118,.07); border: 1px solid var(--border-g); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--g); }
.upload-area p { font-size: .83rem; font-weight: 600; color: var(--text-1); margin: 0; }
.upload-area small { font-size: .72rem; color: var(--text-3); text-align: center; }
.browse-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--r-sm); background: rgba(0,230,118,.08); border: 1px solid var(--border-g); color: var(--g); font-size: .76rem; font-weight: 600; cursor: pointer; transition: background .15s; }
.browse-btn:hover { background: rgba(0,230,118,.16); }
.upload-status { padding: 10px 16px 14px; text-align: center; font-size: .8rem; color: var(--text-2); min-height: 36px; }

/* ── Preview card ── */
.preview-card { display: none; background: var(--ink-2); border: 1px solid rgba(0,230,118,.22); border-radius: var(--r-md); overflow: hidden; margin-bottom: 14px; }
.preview-card.show { display: block; animation: slide-in .28s ease; }
.preview-card.is-error { border-color: rgba(239,68,68,.28); }
@keyframes slide-in { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:translateY(0)} }
.preview-header { padding: 16px 20px 14px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--border); }
.preview-avatar { width: 48px; height: 48px; border-radius: 13px; background: rgba(0,230,118,.1); border: 1px solid var(--border-g); display: flex; align-items: center; justify-content: center; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--g); flex-shrink: 0; }
.preview-name { font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: 700; color: var(--text-1); }
.preview-phone { font-size: .74rem; color: var(--text-3); margin-top: 2px; }
.verified-badge { margin-left: auto; padding: 3px 9px; border-radius: 20px; background: rgba(0,230,118,.1); border: 1px solid var(--border-g); font-size: .68rem; font-weight: 700; color: var(--g); text-transform: uppercase; letter-spacing: .8px; white-space: nowrap; }
.preview-body { padding: 16px 20px; }
.double-banner { display: flex; align-items: center; gap: 8px; padding: 7px 11px; background: rgba(245,158,11,.07); border: 1px solid rgba(245,158,11,.2); border-radius: var(--r-sm); margin-bottom: 14px; font-size: .79rem; color: #fbbf24; font-weight: 600; }
.stamp-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.stamp-label { font-size: .71rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .6px; }
.stamp-count { font-family: 'Space Grotesk', sans-serif; font-size: .9rem; font-weight: 700; color: var(--text-1); }
.progress-track { width: 100%; height: 5px; background: var(--ink-4); border-radius: 100px; margin-bottom: 12px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--g), #1ffb80); transition: width .5s cubic-bezier(.22,1,.36,1); }
.stamp-dots { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.sd { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--ink-3); display: flex; align-items: center; justify-content: center; font-size: .6rem; }
.sd.done { background: rgba(0,230,118,.15); border-color: var(--border-g); color: var(--g); }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.meta-cell { background: var(--ink-3); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 12px; }
.mc-label { font-size: .67rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.mc-val { font-family: 'Space Grotesk', sans-serif; font-size: .86rem; font-weight: 700; color: var(--text-1); }
.next-reward-row { display: flex; align-items: center; gap: 9px; padding: 9px 13px; background: rgba(0,230,118,.05); border: 1px solid var(--border-g); border-radius: var(--r-sm); margin-bottom: 14px; }
.nr-icon { color: var(--g); font-size: .85rem; flex-shrink: 0; }
.nr-text strong { color: var(--g); font-size: .82rem; }
.nr-text span { color: var(--text-3); font-size: .72rem; display: block; margin-top: 1px; }
.recent-stamp-banner { display: flex; align-items: center; gap: 9px; padding: 9px 13px; background: rgba(245,158,11,.07); border: 1px solid rgba(245,158,11,.22); border-radius: var(--r-sm); margin-bottom: 14px; font-size: .79rem; color: #fbbf24; font-weight: 600; }
.no-recent-banner { display: flex; align-items: center; gap: 9px; padding: 9px 13px; background: rgba(0,230,118,.05); border: 1px solid var(--border-g); border-radius: var(--r-sm); margin-bottom: 14px; font-size: .79rem; color: var(--g); font-weight: 600; }
.preview-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 2px; }
.btn-issue { display: inline-flex; align-items: center; gap: 9px; padding: 12px 36px; background: var(--g); border: none; border-radius: var(--r-sm); color: #000; font-family: 'Inter', sans-serif; font-size: .95rem; font-weight: 700; cursor: pointer; transition: background .2s, transform .15s, box-shadow .2s; box-shadow: 0 0 20px rgba(0,230,118,.22); }
.btn-issue:hover:not(:disabled) { background: #1ffb80; transform: translateY(-2px); box-shadow: 0 0 32px rgba(0,230,118,.38); }
.btn-issue:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-rescan { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--r-sm); background: transparent; border: 1px solid var(--border); color: var(--text-2); font-family: 'Inter', sans-serif; font-size: .8rem; cursor: pointer; transition: background .15s, color .15s; }
.btn-rescan:hover { background: var(--ink-3); color: var(--text-1); }
.error-box { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.2); }
.error-box i { color: #f87171; flex-shrink: 0; margin-top: 1px; }
.error-box p { font-size: .83rem; color: #fca5a5; margin: 0; line-height: 1.55; }

/* ── Result card ── */
.result-card { display: none; background: var(--ink-2); border: 1px solid var(--border-g); border-radius: var(--r-md); padding: 30px 24px 24px; text-align: center; margin-bottom: 14px; }
.result-card.show { display: block; animation: slide-in .3s ease; }
.result-big { font-family: 'Space Grotesk', sans-serif; font-size: 3.2rem; font-weight: 700; color: var(--g); animation: stamp-pop .5s cubic-bezier(.22,1,.36,1); }
@keyframes stamp-pop { 0%{transform:scale(.35);opacity:0} 70%{transform:scale(1.1)} 100%{transform:scale(1);opacity:1} }
.result-sub { font-size: .9rem; color: var(--text-2); margin-bottom: 18px; }
.result-info-row { display: inline-flex; gap: 24px; background: var(--ink-3); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 11px 20px; margin-bottom: 16px; text-align: left; flex-wrap: wrap; }
.ri-label { font-size: .67rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); font-weight: 600; margin-bottom: 3px; }
.ri-val { font-family: 'Space Grotesk', sans-serif; font-size: .92rem; font-weight: 700; color: var(--text-1); }
.reward-pop { background: rgba(0,230,118,.07); border: 1px solid var(--border-g); border-radius: var(--r-sm); padding: 11px 16px; margin-bottom: 10px; text-align: left; }
.reward-pop-title { font-size: .73rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--g); margin-bottom: 3px; }
.reward-pop-desc { font-size: .86rem; font-weight: 600; color: var(--text-1); }
.fraud-warn { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; background: rgba(245,158,11,.06); border: 1px solid rgba(245,158,11,.2); border-radius: var(--r-sm); margin-bottom: 12px; font-size: .78rem; color: #fbbf24; text-align: left; }
.fraud-warn i { flex-shrink: 0; margin-top: 1px; }

/* ── Session history ── */
.history-card { background: var(--ink-2); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.history-head { padding: 11px 18px; border-bottom: 1px solid var(--border); font-size: .79rem; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.history-head i { color: var(--g); font-size: .75rem; }
.history-empty { padding: 20px; text-align: center; font-size: .79rem; color: var(--text-3); }
.history-item { display: flex; align-items: center; gap: 12px; padding: 9px 18px; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: none; }
.hi-name { flex: 1; font-size: .82rem; font-weight: 600; color: var(--text-1); }
.hi-phone { font-size: .71rem; color: var(--text-3); }
.hi-badge { padding: 2px 8px; border-radius: 100px; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.hi-badge.double { background: rgba(245,158,11,.1); color: #fbbf24; border: 1px solid rgba(245,158,11,.2); }
.hi-badge.single { background: rgba(0,230,118,.08); color: var(--g); border: 1px solid var(--border-g); }
.hi-time { font-size: .7rem; color: var(--text-3); white-space: nowrap; }

/* ── Duplicate warning modal ── */
.warn-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.62); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; visibility: hidden; transition: opacity .22s, visibility .22s; }
.warn-overlay.open { opacity: 1; visibility: visible; }
.warn-modal { background: var(--ink-2); border: 1px solid rgba(245,158,11,.3); border-radius: var(--r-md); padding: 28px 24px 22px; max-width: 400px; width: 100%; transform: translateY(14px) scale(.97); transition: transform .25s cubic-bezier(.22,1,.36,1); text-align: center; }
.warn-overlay.open .warn-modal { transform: none; }
.warn-icon { font-size: 2.4rem; color: #fbbf24; margin-bottom: 12px; }
.warn-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.05rem; font-weight: 700; color: var(--text-1); margin-bottom: 8px; }
.warn-desc { font-size: .84rem; color: var(--text-2); line-height: 1.6; margin-bottom: 22px; }
.warn-btns { display: flex; gap: 10px; }
.warn-cancel { flex: 1; padding: 11px; border-radius: var(--r-sm); background: transparent; border: 1px solid var(--border); color: var(--text-2); font-family: 'Inter', sans-serif; font-size: .85rem; font-weight: 600; cursor: pointer; }
.warn-cancel:hover { background: var(--ink-3); color: var(--text-1); }
.warn-issue { flex: 1; padding: 11px; border-radius: var(--r-sm); background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.3); color: #fbbf24; font-family: 'Inter', sans-serif; font-size: .85rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.warn-issue:hover { background: rgba(245,158,11,.22); }
.warn-issue:disabled { opacity: .5; cursor: not-allowed; }

@media(max-width:540px) { .meta-grid { grid-template-columns: 1fr; } .result-info-row { flex-direction: column; gap: 12px; } }
