/* Scanner page — NES.css theme */
* { box-sizing: border-box; }

.hidden { display: none !important; }

body:has(.scanner) {
  margin: 0;
  padding: 0;
  background: #000;
}

/* ── Layout shell ─────────────────────────────────────────────────────────── */

.scanner {
  position: relative;
  height: 100dvh;
  overflow: hidden;
}

.scanner__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.6);
  transform-origin: center center;
}

.scanner__video::-webkit-media-controls { display: none !important; }

.scanner__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */

.scanner__topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, transparent 100%);
}

.scanner__scanning-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.scanner__scanning-spinner {
  width: 14px;
  height: 14px;
  animation: scanner-spin 0.9s linear infinite;
}

@keyframes scanner-spin {
  to { transform: rotate(360deg); }
}

.scanner__topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.scanner__icon-btn {
  color: #fff;
  background: rgba(0,0,0,0.45);
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  width: 2.1rem;
  height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.scanner__icon-btn svg {
  width: 16px;
  height: 16px;
}

.scanner__icon-btn--close {
  background: linear-gradient(135deg, #f5a623 0%, #f7c96e 100%);
  border-color: #f5a623;
}

/* ── Found overlay (center) ───────────────────────────────────────────────── */

.scanner__found-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scanner__pokeball-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes pop-in {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.scanner__found-pokeball {
  width: 100px;
  filter: drop-shadow(0 0 16px rgba(255,255,255,0.7));
}

.scanner__checkmark {
  position: absolute;
  font-size: 2.5rem;
  font-weight: 900;
  color: #92cc41;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
  line-height: 1;
}

/* ── Result bottom bar ────────────────────────────────────────────────────── */

.scanner__result-bar {
  position: absolute;
  bottom: 1.25rem;
  left: 1rem;
  right: 1rem;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  background: transparent;
}

.scanner__result-bar.hidden { display: none !important; }

.scanner__thumb-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  flex-shrink: 0;
}

.scanner__thumb-btn {
  display: block;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}

.scanner__thumb {
  display: block;
  width: 95px;
  height: 133px;
  object-fit: cover;
  border-radius: 8px;
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.scanner__card-name {
  color: #fff;
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 95px;
}

.scanner__card-meta {
  display: none;
}

/* ── Hidden capture canvas ────────────────────────────────────────────────── */
/* Analysis-only — never displayed. Keeping the live preview a plain <video>
   means it's decoded by the browser natively and never freezes while our JS
   is busy (e.g. waiting on a recognition request). */

.scanner__capture {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
  width: 0;
  height: 0;
}
