* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Trebuchet MS", Arial, sans-serif;
  background: radial-gradient(circle at top, #1e293b 0%, #0b1021 48%, #050814 100%);
  color: #f8fafc;
  padding: 12px;
}

.app {
  width: min(760px, 100%);
  margin: 0 auto;
}

h1 { margin: 0; font-size: 1.6rem; letter-spacing: 0.04em; }
h2 { margin: 0 0 8px; font-size: 1.1rem; }

.subtitle { margin: 6px 0 14px; color: #93c5fd; }
.muted { color: #94a3b8; font-size: 0.85rem; }

.card {
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
  border: 1px solid #26354b;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.hud-item {
  background: linear-gradient(180deg, #101b2e 0%, #0e1625 100%);
  border: 1px solid #254268;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}

.hud-item span {
  display: block;
  color: #93c5fd;
  font-size: 0.78rem;
}

.hud-item strong {
  display: block;
  margin-top: 3px;
  font-size: 1.02rem;
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

input[type="file"] {
  width: 100%;
  margin: 6px 0 10px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  cursor: pointer;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary { background: #2563eb; }
.btn-secondary { background: #334155; }
.btn-warning { background: #c2410c; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-warning:hover { filter: brightness(1.08); }

.status {
  margin-top: 10px;
  min-height: 22px;
  color: #cbd5e1;
}

.camera-wrap {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #27456d;
  background: #020617;
  margin-bottom: 10px;
  aspect-ratio: 4 / 3;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scan-target {
  position: absolute;
  inset: 14% 12%;
  border: 2px dashed #22d3ee;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.34);
}

.target-label {
  position: absolute;
  left: 10px;
  top: 10px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 5px 9px;
  font-size: 0.82rem;
}

.lockbar-wrap {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 6px 8px;
}

.lockbar-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 5px;
  color: #cbd5e1;
}

.lockbar-track {
  height: 8px;
  border-radius: 999px;
  background: #1e293b;
  overflow: hidden;
}

.lockbar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  transition: width 220ms ease;
}

.hidden-canvas {
  display: none;
}

.caught-preview {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #334155;
  margin-top: 8px;
  display: none;
}

.caught-preview.show {
  display: block;
  animation: caughtPop 520ms ease-out;
}

.catch-fx {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 800;
  color: #86efac;
  text-shadow: 0 0 22px rgba(34, 197, 94, 0.8);
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
}

.catch-fx.show {
  animation: catchText 900ms ease-out;
}

.camera-wrap.caught {
  animation: caughtFlash 800ms ease-out;
}

.result-panel {
  display: none;
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #245f41;
  background: linear-gradient(180deg, #0b1d1c 0%, #0b1220 100%);
}

.result-panel.show {
  display: block;
}

.result-text {
  margin-bottom: 8px;
  color: #bbf7d0;
}

@keyframes caughtFlash {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.9); }
  100% { box-shadow: 0 0 0 16px rgba(34,197,94,0); }
}

@keyframes catchText {
  0% { opacity: 0; transform: scale(0.75); }
  30% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.16); }
}

@keyframes caughtPop {
  0% { transform: scale(0.94); opacity: 0.3; }
  100% { transform: scale(1); opacity: 1; }
}

ol {
  margin: 0;
  padding-left: 22px;
}

li { margin-bottom: 4px; }

.profile-row.compact {
  align-items: center;
}
