:root {
  color-scheme: dark;
  --green: #45df79;
  --green-dark: #24ae55;
  --green-soft: #153b25;
  --scanner: #f1f4f5;
  --ink: #f5f7f8;
  --muted: #aab3bb;
  --line: #4c555e;
  --background: #1d2227;
  --card: #30363d;
  --danger: #b45309;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--background); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 50% -12%, #3c454e 0, var(--background) 44%);
  font-family: Inter, Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button:focus-visible, label:focus-visible { outline: 3px solid rgba(22, 163, 74, .32); outline-offset: 2px; }

.shell { width: min(100% - 32px, 480px); margin: 0 auto; padding: 0 0 30px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  margin: 0 -16px;
  padding: 0 16px;
  background: #252a30;
  border-bottom: 1px solid #454d55;
  box-shadow: 0 4px 15px rgba(0, 0, 0, .18);
}
.topbar-actions { display: flex; align-items: center; gap: 7px; }
.install-button { min-height: 30px; padding: 0 9px; border: 1px solid #b9e7c6; border-radius: 6px; color: var(--green-dark); background: #f4fcf6; cursor: pointer; font-size: 11px; font-weight: 700; }
.install-button:hover { background: var(--green-soft); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 700; letter-spacing: -.03em; }
.brand-mark, .placeholder-icon { display: grid; grid-template-columns: repeat(2, 9px); grid-template-rows: repeat(2, 9px); gap: 3px; width: 26px; height: 26px; padding: 2px; border: 2px solid var(--green); border-radius: 5px; transform: rotate(45deg); }
.brand-mark span, .placeholder-icon span { display: block; background: var(--green); border-radius: 1px; }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(3), .placeholder-icon span:nth-child(2), .placeholder-icon span:nth-child(3) { background: transparent; }
.brand-accent { color: var(--green); }
.secure-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid #53616b; border-radius: 99px; color: #d7dee3; background: #303941; font-size: 10px; }
.secure-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

.intro { padding: 30px 0 21px; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
h1 { margin: 0; color: var(--ink); font-size: clamp(29px, 8vw, 38px); line-height: 1.12; letter-spacing: -.055em; }
h1 em { color: var(--green); font-style: normal; }
.intro-copy { max-width: 390px; margin: 11px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

.scanner-card { overflow: hidden; border: 1px solid #555e67; border-radius: 21px; background: #30363d; box-shadow: 0 14px 30px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255,255,255,.06); }
.scanner-topline, .scanner-footer { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; }
.scanner-topline { border-bottom: 1px solid #4b545d; background: #272d33; }
.status-label { display: flex; align-items: center; gap: 7px; color: var(--scanner); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; transition: color .2s ease; }
.status-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--scanner); box-shadow: 0 0 0 4px rgba(241,244,245,.12); }
.scan-format { color: #9fa9b2; font-size: 10px; font-weight: 600; letter-spacing: .08em; }

.scanner-stage { position: relative; display: grid; place-items: center; min-height: 350px; overflow: hidden; background: #10161b; box-shadow: inset 0 0 0 8px #252b31, inset 0 0 30px rgba(0,0,0,.45); }
video { display: block; width: 100%; height: 100%; min-height: 350px; object-fit: cover; opacity: 0; transition: opacity .3s ease; }
video.is-live { opacity: 1; }
.camera-placeholder { position: absolute; z-index: 2; display: grid; place-items: center; gap: 16px; color: #a9b3bb; font-size: 14px; text-align: center; }
.camera-placeholder .placeholder-icon { border-color: var(--scanner); }
.camera-placeholder .placeholder-icon span { background: var(--scanner); }
.camera-placeholder .placeholder-icon span:nth-child(2), .camera-placeholder .placeholder-icon span:nth-child(3) { background: transparent; }
.camera-placeholder p { margin: 0; }
.placeholder-icon { width: 42px; height: 42px; grid-template-columns: repeat(2, 15px); grid-template-rows: repeat(2, 15px); gap: 4px; padding: 3px; opacity: .8; }
.scan-shade { position: absolute; inset: 0; z-index: 1; background: rgba(17, 29, 40, .26); pointer-events: none; }
.scan-frame { position: absolute; z-index: 3; width: min(69vw, 260px); height: min(69vw, 260px); transition: filter .25s ease; }
.corner { position: absolute; width: 32px; height: 32px; border-color: var(--scanner); border-style: solid; transition: border-color .25s ease, width .25s ease, height .25s ease; }
.corner.top-left { top: 0; left: 0; border-width: 3px 0 0 3px; }
.corner.top-right { top: 0; right: 0; border-width: 3px 3px 0 0; }
.corner.bottom-left { bottom: 0; left: 0; border-width: 0 0 3px 3px; }
.corner.bottom-right { right: 0; bottom: 0; border-width: 0 3px 3px 0; }
.scan-line { position: absolute; top: 8%; left: 4%; width: 92%; height: 2px; background: var(--scanner); box-shadow: 0 0 12px rgba(241,244,245,.7); animation: scan 2.4s ease-in-out infinite; }
.verified-badge { position: absolute; z-index: 4; top: 16px; right: 16px; display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; border: 1px solid #b9e7c6; border-radius: 99px; color: var(--green-dark); background: rgba(247, 255, 249, .94); font-size: 11px; font-weight: 700; opacity: 0; transform: translateY(-5px); transition: opacity .2s ease, transform .2s ease; }
.confirmation-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 9px; color: white; background: var(--green); text-align: center; box-shadow: inset 0 0 44px rgba(255,255,255,.3), 0 0 34px rgba(69,223,121,.65); animation: confirm-glow 1.6s ease-in-out infinite; }
.confirmation-overlay[hidden] { display: none; }
.confirmation-overlay strong { font-size: 31px; letter-spacing: -.04em; }
.confirmation-overlay span { font-size: 14px; opacity: .9; }
.confirmation-check { display: grid; place-items: center; width: 70px; height: 70px; margin-bottom: 4px; border: 4px solid white; border-radius: 50%; color: var(--green); background: white; font-size: 42px; font-weight: 800; line-height: 1; box-shadow: 0 7px 18px rgba(7, 93, 37, .2); }
.check-icon { display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; color: white; background: var(--green); font-size: 12px; font-weight: 800; }
.scanner-stage.is-verified .scan-shade { background: rgba(22, 163, 74, .15); }
.scanner-stage.is-verified .scan-frame { filter: drop-shadow(0 0 16px rgba(22,163,74,.4)); }
.scanner-stage.is-verified .corner { border-color: var(--green); width: 42px; height: 42px; }
.scanner-stage.is-verified .scan-line { opacity: 0; }
.scanner-stage.is-verified .verified-badge { opacity: 1; transform: none; }
.scanner-stage.is-verified video, .scanner-stage.is-verified .scan-shade, .scanner-stage.is-verified .scan-frame, .scanner-stage.is-verified .verified-badge { opacity: 0; }
.scanner-stage.is-verified { background: var(--green); box-shadow: none; }
.scanner-stage.is-verified + .scanner-footer { background: #25362b; }

.scanner-footer { display: block; border-top: 1px solid #4b545d; background: #30363d; }
.helper-text { min-height: 18px; margin: 0 0 13px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.actions { display: grid; grid-template-columns: 1fr; gap: 9px; }
.primary-button, .secondary-button, .restart-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 13px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 700; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.primary-button { color: #092211; border: 1px solid var(--green); background: var(--green); box-shadow: 0 3px 0 #16833a, 0 6px 12px rgba(0,0,0,.2); }
.primary-button:hover, .restart-button:hover { background: var(--green-dark); }
.secondary-button { color: var(--ink); border: 1px solid #59636c; background: #3a424a; box-shadow: 0 3px 0 #252b30; }
.secondary-button:hover { border-color: var(--green); color: var(--green-dark); }
.button-icon { position: relative; display: inline-block; width: 15px; height: 15px; }
.camera-icon { border: 1.5px solid currentColor; border-radius: 3px; }
.camera-icon::before { content: ''; position: absolute; left: 3px; top: -4px; width: 6px; height: 3px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 2px 2px 0 0; }
.camera-icon::after { content: ''; position: absolute; left: 4px; top: 4px; width: 4px; height: 4px; border: 1.5px solid currentColor; border-radius: 50%; }
.upload-icon::before { content: '↑'; position: absolute; inset: -4px 0 0; font-size: 19px; line-height: 19px; }

.result-card { display: flex; align-items: center; gap: 13px; margin-top: 14px; padding: 15px; border: 1px solid #3d9458; border-radius: 15px; background: var(--green-soft); }
.result-card[hidden] { display: none; }
.result-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; color: #fff; background: var(--green); font-size: 21px; font-weight: 800; }
.result-copy { flex: 1; }
.result-kicker { margin: 0 0 2px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .07em; }
.result-copy h2 { margin: 0; font-size: 16px; }
.result-copy p:last-child { margin: 3px 0 0; color: #c3e6cc; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.restart-button { flex: 0 0 auto; min-height: 38px; color: #fff; background: var(--green); border: 1px solid var(--green); font-size: 12px; }

.notice { display: flex; align-items: flex-start; gap: 9px; margin: 18px 1px 0; color: #aab3bb; }
.notice p { margin: 0; font-size: 11px; line-height: 1.5; }
.notice-icon { display: grid; place-items: center; width: 16px; height: 16px; flex: 0 0 16px; border: 1px solid #aebbc6; border-radius: 50%; color: #71808d; font-size: 11px; }
.footer { display: flex; justify-content: center; gap: 7px; margin-top: 28px; color: #99a5af; font-size: 10px; }
.toast { position: fixed; left: 50%; bottom: 20px; z-index: 10; width: max-content; max-width: calc(100% - 28px); padding: 11px 14px; border: 1px solid #f0d3a3; border-radius: 7px; color: var(--danger); background: #fff9ef; font-size: 12px; box-shadow: 0 6px 20px rgba(25,44,65,.14); opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
@keyframes scan { 0%, 100% { top: 8%; opacity: .35; } 50% { top: 90%; opacity: 1; } }
@keyframes confirm-glow { 0%, 100% { filter: brightness(1); box-shadow: inset 0 0 34px rgba(255,255,255,.22), 0 0 22px rgba(69,223,121,.42); } 50% { filter: brightness(1.14); box-shadow: inset 0 0 84px rgba(255,255,255,.45), 0 0 48px rgba(69,223,121,.85); } }
@media (max-width: 400px) {
  .shell { width: min(100% - 24px, 480px); }
  .secure-pill { padding: 5px 7px; font-size: 9px; }
  .scanner-stage, video { min-height: 320px; }
  .restart-button { padding: 0 10px; }
}

/* Modo direto: a tela mostra somente o escaneador e a ação principal. */
.minimal-app .topbar,
.minimal-app .intro,
.minimal-app .scanner-topline,
.minimal-app .helper-text,
.minimal-app .notice,
.minimal-app .footer { display: none; }
.minimal-app .shell { width: min(100% - 24px, 480px); padding-top: 16px; }
.minimal-app .scanner-card { border-radius: 22px; }
.minimal-app .scanner-footer { padding: 12px; }
.minimal-app .primary-button { width: 100%; min-height: 50px; font-size: 15px; }
.minimal-app .result-card { display: none !important; }
.minimal-app .confirmation-overlay span { display: none; }
.minimal-app .confirmation-overlay strong { font-size: 34px; }
