body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  margin: 0;
  padding: 16px;
  background: #111;
  color: #f5f5f5;
  text-align: center;
}

h3 {
  margin-bottom: 8px;
}

#status {
  font-size: 14px;
  margin-bottom: 12px;
  opacity: 0.85;
}

/* Video + overlay konteyner */
#video-wrapper {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid #333;
}

/* Html5-qrcode video joylaydigan blok */
#video-root {
  width: 100%;
  height: auto;
}

/* Ichidagi video ham radius bilan chiqsin */
#video-wrapper video {
  width: 100% !important;
  height: auto !important;
  border-radius: 18px;
  background: #000;
}

/* Barcode-style overlay */
#scanner-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Vertikal chiziqlar – ancha aniq ko'rinsin */
#scanner-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.18) 0px,
    rgba(255, 255, 255, 0.18) 2px,
    transparent 2px,
    transparent 5px
  );
  mix-blend-mode: soft-light;
}

/* Tepasi-pastini qorong‘i, o‘rtada “scan window” */
#scanner-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.85) 25%,
    transparent 25%,
    transparent 75%,
    rgba(0, 0, 0, 0.85) 75%,
    rgba(0, 0, 0, 0.85) 100%
  );
}

/* O‘rtadagi “barcode oynasi” */
#scan-window {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 30%;
  bottom: 30%;
  border-radius: 10px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.9) inset;
}

/* Harakatlanadigan qizil chiziq tepaga-pastga */
.scanner-line {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 3px;
  background: rgba(255, 0, 0, 0.98);
  box-shadow: 0 0 12px rgba(255, 0, 0, 0.98);
  animation: scan-line 1.7s linear infinite alternate;
}

@keyframes scan-line {
  from {
    top: 32%;
  }
  to {
    top: 68%;
  }
}

/* Barcode tasdiqlanganda effekt */
#scanner-overlay.success #scan-window {
  border-color: #2ecc71;
  box-shadow: 0 0 18px rgba(46, 204, 113, 0.95);
  animation: flash-window 0.25s ease-out 0s 2 alternate;
}

#scanner-overlay.success .scanner-line {
  background: rgba(46, 204, 113, 0.98);
  box-shadow: 0 0 14px rgba(46, 204, 113, 0.98);
}

@keyframes flash-window {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.04);
  }
}

.buttons {
  margin-top: 12px;
}

#scan-btn,
#stop-btn {
  margin: 6px;
  padding: 10px 18px;
  font-size: 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

#scan-btn {
  background: #2ecc71;
  color: #111;
}

#stop-btn {
  background: #e74c3c;
  color: #fff;
  display: none;
}

#list-wrapper {
  margin-top: 16px;
  text-align: left;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

#list-wrapper h4 {
  margin-bottom: 8px;
  font-size: 15px;
}

#codes-list {
  list-style: decimal;
  padding-left: 20px;
  font-size: 14px;
  max-height: 180px;
  overflow-y: auto;
  border-radius: 8px;
  background: #1b1b1b;
  border: 1px solid #333;
}

#codes-list li {
  padding: 4px 8px;
  border-bottom: 1px solid #222;
  word-break: break-all;
}

#codes-list li:last-child {
  border-bottom: none;
}

.finish-btn {
  margin-top: 16px;
  padding: 12px 20px;
  font-size: 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #3498db;
  color: #fff;
  width: 100%;
  max-width: 400px;
}
