
.scanner-scanline {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 2px;
  transform: translate(-50%, -50%);
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
  animation: scanline 2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes scanline {
  0%, 100% { top: calc(50% - 60px); opacity: 0.3; }
  50% { top: calc(50% + 60px); opacity: 0.7; }
}

/* Reticle pulse: quick accent glow on the corner brackets for every new
   capture, so the acknowledgment reads even with sound off. */
.scanner-reticle.pulse::before,
.scanner-reticle.pulse::after,
.scanner-reticle.pulse .corner-tl,
.scanner-reticle.pulse .corner-br {
  animation: reticlePulse 0.25s ease-out;
}
@keyframes reticlePulse {
  0% {
    border-color: #ffd479;
    box-shadow: 0 0 12px var(--accent), inset 0 0 8px rgba(245, 158, 11, 0.4);
  }
  100% {
    border-color: var(--accent);
    box-shadow: none;
  }
}

.scanner-detected-flash {
  position: absolute;
  inset: 0;
  border: 3px solid var(--accent);
  pointer-events: none;
  opacity: 0;
  border-radius: 2px;
  z-index: 3; /* above a displayed photo */
}
.scanner-detected-flash.flash {
  animation: detectFlash 0.6s ease;
}
@keyframes detectFlash {
  0% { opacity: 0.8; box-shadow: inset 0 0 40px rgba(245, 158, 11, 0.2); }
  100% { opacity: 0; }
}

.scanner-footer {
  padding: 16px 20px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  flex-shrink: 0;
}

.scanner-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 28px;
  align-items: center;
  max-height: 168px;
  overflow-y: auto;
}
.scanner-result-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 4px;
  font-family: var(--font-data);
  font-size: 11px;
  animation: tagAppear 0.2s ease-out;
}
@keyframes tagAppear {
  0% { opacity: 0; transform: scale(0.7); }
  70% { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}
.scanner-result-tag .tag-format {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
}
/* Catch chips (DESIGN_DECISIONS.md section 13, 16a): a big SIGNAL or TRACE
   word and nothing else — telling catches apart works by tapping the chip
   to flash the matching detection box in the picture, not by naming the
   code. The chip arrives bright: its border flashes and settles. */
.scanner-result-tag.catch-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  animation: tagAppear 0.2s ease-out, catchChipFlash 0.9s ease-out;
}
.catch-chip .catch-word {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 3px;
  line-height: 1;
  color: #ffd479;
}
.catch-chip .chip-dismiss {
  font-size: 18px;
}
@keyframes catchChipFlash {
  0% {
    border-color: #ffe9b8;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.6), inset 0 0 12px rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.28);
  }
  100% {
    border-color: var(--accent-dim);
    box-shadow: none;
    background: rgba(245, 158, 11, 0.1);
  }
}
/* Duplicate catch (section 13): the existing chip jiggles — a short side
   shake plus a brief border glow so the chip is easy to spot. Reduced
   motion keeps only the glow. */
.scanner-result-tag.chip-jiggle {
  animation: chipJiggle 0.45s ease-in-out, chipDupGlow 0.7s ease-out;
}
@keyframes chipJiggle {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
@keyframes chipDupGlow {
  0% { border-color: #ffe9b8; box-shadow: 0 0 14px rgba(245, 158, 11, 0.5); }
  100% { border-color: var(--accent-dim); box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .scanner-result-tag.chip-jiggle { animation: chipDupGlow 0.7s ease-out; }
}
/* Owned catch (DESIGN_DECISIONS.md section 11): grey means the system was
   already in the atlas before this session. The chip keeps its SIGNAL or
   TRACE wording but arrives grey, with no bright flash. */
.scanner-result-tag.catch-chip.chip-owned {
  animation: tagAppear 0.2s ease-out;
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.35);
  color: rgba(148, 163, 184, 0.9);
}
.catch-chip.chip-owned .catch-word { color: rgba(160, 172, 190, 0.9); }
/* The grey chip's jiggle glows grey, not amber. */
.scanner-result-tag.chip-owned.chip-jiggle {
  animation: chipJiggle 0.45s ease-in-out, chipOwnedGlow 0.7s ease-out;
}
@keyframes chipOwnedGlow {
  0% { border-color: rgba(200, 210, 225, 0.7); box-shadow: 0 0 14px rgba(148, 163, 184, 0.4); }
  100% { border-color: rgba(148, 163, 184, 0.35); box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .scanner-result-tag.chip-owned.chip-jiggle { animation: chipOwnedGlow 0.7s ease-out; }
}
/* Picture tap (direction two, DCOSMOS-HATCHCEREMONY): tapping a code's box
   in the picture jiggles the matching chip (reuses chip-jiggle above) plus
   this bright one-shot flash layered on top, so a tap from either side of
   the link reads the same way. JS removes the class once it finishes. */
.scanner-result-tag.chip-code-tap-flash {
  animation: chipCodeTapFlash 0.6s ease-out;
}
/* The animation shorthand does not merge across classes -- whichever rule
   wins takes the whole property. A chip carrying both classes plays the
   shake and the flash as one comma-joined animation list, and the selector
   outranks the grey chip's own three-class jiggle rule. */
.scanner-result-tag.chip-jiggle.chip-code-tap-flash,
.scanner-result-tag.chip-owned.chip-jiggle.chip-code-tap-flash {
  animation: chipJiggle 0.45s ease-in-out, chipCodeTapFlash 0.6s ease-out;
}
@keyframes chipCodeTapFlash {
  0% {
    border-color: #fff5da;
    box-shadow: 0 0 22px rgba(255, 245, 218, 0.9), inset 0 0 14px rgba(255, 245, 218, 0.5);
    background: rgba(255, 212, 121, 0.35);
  }
  100% { border-color: var(--accent-dim); box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .scanner-result-tag.chip-code-tap-flash {
    animation: none;
    box-shadow: 0 0 14px rgba(255, 245, 218, 0.6);
  }
}
.chip-dismiss {
  all: unset;
  cursor: pointer;
  margin-left: 2px;
  font-size: 13px;
  line-height: 1;
  color: var(--text-dim);
  opacity: 0.6;
  padding: 0 2px;
}
.chip-dismiss:hover { opacity: 1; color: var(--accent); }
.scanner-actions {
  display: flex;
}
/* The one action: DONE. Always enabled, unmistakably bright. */
.scanner-actions .btn-primary {
  flex: 1;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.5px;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.35);
}
.scanner-actions .btn-primary:hover {
  box-shadow: 0 0 28px rgba(245, 158, 11, 0.5);
}

.scanner-fallback {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px;
  text-align: center;
}
.scanner-fallback p {
  color: var(--text-secondary);
  font-size: 13px;
  max-width: 400px;
  line-height: 1.6;
}
.scanner-fallback .fallback-upload { position: relative; }
.scanner-fallback .fallback-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.scanner-fallback .fallback-upload .btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  padding: 12px 28px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: none;
}
