:root {
  color-scheme: light;
  --green-950: #023322;
  --green-900: #033e2b;
  --green-700: #176443;
  --lime-500: #91bf3e;
  --lime-300: #b8dc69;
  --paper: #f7faf8;
  --muted: #6d7d75;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--green-950);
  background:
    radial-gradient(circle at 12% 0%, rgba(145,191,62,.18), transparent 34%),
    linear-gradient(160deg, #f8fbf9 0%, #eaf3ee 100%);
  font-family: "Manrope", system-ui, sans-serif;
}
button, input { font: inherit; }
button { border: 0; }
.is-hidden { display: none !important; }

.scanner-page {
  width: min(100%, 590px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}
.scanner-header {
  display: grid;
  grid-template-columns: 52px 1fr 68px;
  align-items: center;
  gap: 13px;
  margin-bottom: 22px;
}
.icon-button {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(3,62,43,.12);
  border-radius: 50%;
  color: var(--green-900);
  background: rgba(255,255,255,.88);
  box-shadow: 0 9px 24px rgba(3,62,43,.09);
}
.icon-button svg { width: 25px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mode-copy { min-width: 0; }
.mode-copy span { display: block; color: var(--green-700); font-size: .68rem; font-weight: 800; letter-spacing: .16em; }
.mode-copy strong { display: block; margin-top: 2px; font-size: 1.32rem; font-weight: 800; letter-spacing: -.025em; }
.brand-logo { width: 68px; height: 50px; object-fit: contain; mix-blend-mode: multiply; }

.camera-card {
  padding: 16px 14px 18px;
  border: 1px solid rgba(3,62,43,.08);
  border-radius: 28px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 24px 65px rgba(3,62,43,.12);
}
.camera-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid #adc8b8;
  border-radius: 23px;
  background: #eaf2ee;
}
#qrReader { position: absolute; inset: 0; background: #08140f; }
#qrReader > div { width: 100% !important; height: 100% !important; border: 0 !important; }
#qrReader video, #qrReader canvas { width: 100% !important; height: 100% !important; object-fit: cover; }
#qrReader img { display: none !important; }
.scan-overlay { position: absolute; inset: 13%; z-index: 3; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.camera-frame[data-state="active"] .scan-overlay { opacity: 1; }
.corner { position: absolute; width: 43px; height: 43px; border-color: #b5e35e; border-style: solid; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.corner.tl { top: 0; left: 0; border-width: 4px 0 0 4px; border-radius: 13px 0 0; }
.corner.tr { top: 0; right: 0; border-width: 4px 4px 0 0; border-radius: 0 13px 0 0; }
.corner.bl { bottom: 0; left: 0; border-width: 0 0 4px 4px; border-radius: 0 0 0 13px; }
.corner.br { right: 0; bottom: 0; border-width: 0 4px 4px 0; border-radius: 0 0 13px; }
.scan-line {
  position: absolute;
  top: 8%;
  right: 6px;
  left: 6px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, #b7ed58 15%, #fff 50%, #b7ed58 85%, transparent);
  box-shadow: 0 0 12px #a7db48;
  animation: scan 2.2s ease-in-out infinite;
}
@keyframes scan { 0%,100% { top: 8%; opacity: .55; } 50% { top: 91%; opacity: 1; } }

.camera-message {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  background: linear-gradient(145deg, rgba(244,249,246,.98), rgba(232,242,236,.98));
}
.camera-frame[data-state="active"] .camera-message { display: none; }
.camera-symbol { width: 78px; height: 78px; display: grid; place-items: center; border-radius: 25px; color: var(--green-900); background: #edf7dc; }
.camera-symbol svg { width: 36px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.camera-message p { max-width: 310px; margin: 18px auto 0; color: var(--muted); font-size: .88rem; font-weight: 700; line-height: 1.55; }
.primary-button {
  min-height: 48px;
  margin-top: 20px;
  padding: 11px 20px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--lime-500), #3f7733);
  box-shadow: 0 10px 24px rgba(74,116,45,.25);
  font-weight: 800;
}
.scan-hint { margin: 13px 4px 15px; color: var(--muted); text-align: center; font-size: .76rem; font-weight: 700; line-height: 1.5; }
.file-button {
  position: relative;
  width: min(100%, 270px);
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0 auto;
  border: 1px solid #c5d8ce;
  border-radius: 15px;
  color: var(--green-900);
  background: #fff;
  font-size: .98rem;
  font-weight: 800;
}
.file-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.processing {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  color: #fff;
  background: rgba(2,36,25,.84);
  backdrop-filter: blur(7px);
  text-align: center;
}
.processing span { width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.25); border-top-color: #b5e35e; border-radius: 50%; animation: spin .7s linear infinite; }
.processing p { margin: 15px 0 0; font-size: .92rem; font-weight: 800; line-height: 1.55; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 720px) {
  .scanner-page { padding-top: 28px; }
  .camera-card { padding: 20px; }
}
