:root {
  --ink: #17211f;
  --muted: #68716d;
  --paper: #f3f1eb;
  --card: #fffefa;
  --line: #d8d8d0;
  --accent: #ef5b3f;
  --accent-dark: #d9462c;
  --green: #276b54;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 10%, rgba(239, 91, 63, .08), transparent 29%),
    var(--paper);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.topbar, .result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font: 700 18px "Space Grotesk", sans-serif;
  text-decoration: none;
}

.brand-mark {
  width: 29px;
  height: 29px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 8px;
  color: white;
  background: var(--ink);
  transform: rotate(-2deg);
}

.brand-mark i { width: 2px; height: 13px; background: currentColor; }
.brand-mark i:nth-child(2) { width: 3px; height: 17px; }
.brand-mark i:nth-child(3) { height: 10px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid #d9ddd7;
  border-radius: 99px;
  color: var(--green);
  background: rgba(255,255,255,.55);
  font-size: 12px;
  font-weight: 700;
}

.status-pill span, .privacy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4f9b73;
}

.hero { padding: 54px 2px 29px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .2em; }
h1 { margin: 0; font: 700 clamp(42px, 12vw, 59px)/.98 "Space Grotesk", sans-serif; letter-spacing: -.055em; }
h1 em { color: var(--accent); font-style: normal; }
.intro { max-width: 360px; margin: 19px 0 0; color: var(--muted); font-size: 15px; line-height: 1.55; }

.scanner-card {
  padding: 10px 10px 16px;
  border: 1px solid rgba(23,33,31,.1);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 18px 45px rgba(23,33,31,.08);
}

.camera-view {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 17px;
  background: #232a28;
}

#reader { position: absolute; inset: 0; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
#reader img { display: none; }
#reader__dashboard_section_csr, #reader__scan_region > br { display: none !important; }

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: #aeb5b1;
  background: linear-gradient(145deg, #27302d, #151b19);
  z-index: 1;
}
.camera-placeholder p { margin: 0; font-size: 13px; }
.barcode-art { display: flex; align-items: center; gap: 4px; height: 45px; opacity: .7; }
.barcode-art i { width: 3px; height: 32px; background: #e6e9e6; }
.barcode-art i:nth-child(2n) { width: 6px; height: 44px; }
.barcode-art i:nth-child(3n) { width: 2px; height: 38px; }

.scan-frame { position: absolute; inset: 24% 10%; z-index: 3; pointer-events: none; opacity: .45; }
.scan-frame span { position: absolute; width: 28px; height: 28px; border-color: white; border-style: solid; }
.scan-frame span:nth-child(1) { left: 0; top: 0; border-width: 3px 0 0 3px; border-radius: 8px 0 0; }
.scan-frame span:nth-child(2) { right: 0; top: 0; border-width: 3px 3px 0 0; border-radius: 0 8px 0 0; }
.scan-frame span:nth-child(3) { right: 0; bottom: 0; border-width: 0 3px 3px 0; border-radius: 0 0 8px; }
.scan-frame span:nth-child(4) { left: 0; bottom: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 8px; }
.scan-line { display: none; position: absolute; top: 50%; left: 5%; width: 90%; height: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.camera-view.is-scanning .scan-frame { opacity: 1; }
.camera-view.is-scanning .scan-line { display: block; animation: scan 2s ease-in-out infinite; }
.camera-placeholder[hidden] { display: none; }

@keyframes scan { 0%,100% { transform: translateY(-48px); } 50% { transform: translateY(48px); } }

.primary-button {
  width: calc(100% - 12px);
  min-height: 56px;
  margin: 16px 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border: 0;
  border-radius: 15px;
  color: white;
  background: var(--accent);
  box-shadow: 0 7px 16px rgba(239,91,63,.22);
  font-weight: 700;
  cursor: pointer;
}
.primary-button:active { transform: translateY(1px); background: var(--accent-dark); }
.camera-icon { width: 20px; height: 15px; border: 2px solid currentColor; border-radius: 4px; position: relative; }
.camera-icon::before { content: ""; position: absolute; width: 6px; height: 6px; border: 2px solid currentColor; border-radius: 50%; left: 5px; top: 2px; }
.camera-icon::after { content: ""; position: absolute; width: 7px; height: 3px; border-radius: 3px 3px 0 0; background: currentColor; left: 1px; top: -5px; }
.scan-status { margin: 11px 0 0; color: var(--muted); text-align: center; font-size: 12px; }
.secondary-button {
  width: calc(100% - 12px);
  min-height: 43px;
  margin: 8px 6px 0;
  border: 1px solid #d7d9d3;
  border-radius: 13px;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.secondary-button:active { background: #f0efe9; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.result-block { padding: 30px 2px 0; }
.result-heading label { font-size: 13px; font-weight: 700; }
.clear-button { border: 0; padding: 6px; color: var(--accent); background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.input-wrap { display: flex; align-items: center; margin-top: 9px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.65); overflow: hidden; transition: .2s; }
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(239,91,63,.1); }
.input-wrap input { min-width: 0; flex: 1; height: 56px; padding: 0 15px; border: 0; outline: 0; color: var(--ink); background: transparent; font: 600 17px "Space Grotesk", sans-serif; letter-spacing: .04em; }
.input-wrap input::placeholder { color: #aeb0aa; font-size: 14px; letter-spacing: 0; }
.copy-button { margin-right: 7px; padding: 9px 11px; border: 0; border-radius: 9px; color: var(--green); background: #e5eee9; font-size: 11px; font-weight: 700; cursor: pointer; }
.copy-button:disabled { opacity: .4; cursor: default; }
.hint { margin: 9px 3px 0; color: #8a918d; font-size: 11px; }
.hint span { color: var(--accent); }

footer { display: flex; justify-content: center; align-items: flex-start; gap: 8px; padding-top: 33px; color: #8b918e; text-align: center; font-size: 10px; line-height: 1.45; }
footer p { margin: 0; }
.privacy-dot { width: 6px; height: 6px; margin-top: 4px; background: var(--green); }

@media (min-width: 700px) {
  .app-shell { padding-left: 34px; padding-right: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .scan-line { animation: none; }
}
