/* ── Scanner ───────────────────────────────────────── */

.scan-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.scan-trigger .btn-scan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  padding: 10px 22px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: 0.5px;
}
.scan-trigger .btn-scan:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
  transform: translateY(-1px);
}
.scan-trigger .btn-scan .scan-icon { font-size: 18px; line-height: 1; }

.scan-trigger .scan-reference {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
}
.scan-trigger .scan-reference .ref-codes {
  font-size: 11px;
  color: var(--accent);
}
.scan-trigger .scan-reference .ref-summary {
  font-size: 11px;
  color: var(--text-dim);
}
.scan-trigger .scan-reference .ref-marks {
  font-size: 11px;
  color: var(--accent);
}

.scanner-overlay {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 300;
  background: var(--bg-deep);
  display: none;
  flex-direction: column;
}
.scanner-overlay.active {
  display: flex;
  animation: viewFadeIn 0.3s ease;
}

.scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 14, 26, 0.95);
  flex-shrink: 0;
}
.scanner-header h2 {
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}
.scanner-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 96px;
  height: 96px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.scanner-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.scanner-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.scanner-viewfinder {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scanner-viewfinder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scanner-viewfinder .scanner-captured-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 2;
}

.scanner-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220px;
  height: 140px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.scanner-reticle::before,
.scanner-reticle::after {
  content: "";
  position: absolute;
  border: 2px solid var(--accent);
}
.scanner-reticle::before {
  top: 0; left: 0;
  width: 30px; height: 30px;
  border-right: none; border-bottom: none;
}
.scanner-reticle::after {
  bottom: 0; right: 0;
  width: 30px; height: 30px;
  border-left: none; border-top: none;
}
.scanner-reticle .corner-tl,
.scanner-reticle .corner-br {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid var(--accent);
}
.scanner-reticle .corner-tl {
  top: 0; right: 0;
  border-left: none; border-bottom: none;
}
.scanner-reticle .corner-br {
  bottom: 0; left: 0;
  border-right: none; border-top: none;
}
/* Rotate button (photo mode only): ghost style like .btn-skip-reveal,
   above the displayed photo (z 2) and the flash frame (z 3). Sits below
   the header's close button with room to spare so the two thumb-sized
   corner controls never crowd each other. */
.btn-rotate-photo {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 4;
  width: 120px;
  height: 120px;
  padding: 0;
  background: rgba(8, 14, 26, 0.55);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-dim);
  font-size: 60px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-rotate-photo:hover,
.btn-rotate-photo:active {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-rotate-photo[hidden] { display: none; }

/* Photo navigation arrows (photo mode, 2+ photos only): same ghost style as
   the rotate button, floated mid-left / mid-right over the photo. */
.btn-photo-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 40px;
  height: 56px;
  padding: 0;
  background: rgba(8, 14, 26, 0.55);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-photo-prev { left: 10px; }
.btn-photo-next { right: 10px; }
.btn-photo-nav:hover,
.btn-photo-nav:active {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-photo-nav:disabled {
  opacity: 0.35;
  cursor: default;
  border-color: var(--border);
  color: var(--text-dim);
}
.btn-photo-nav[hidden] { display: none; }

/* "2 / 4" position chip (photo mode, 2+ photos only): bottom-left corner of
   the viewfinder, monospace and dim — information, not a control. */
.photo-counter {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 4;
  padding: 3px 8px;
  background: rgba(8, 14, 26, 0.55);
  border-radius: 4px;
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--text-dim);
  pointer-events: none;
}
.photo-counter[hidden] { display: none; }
