:root {
  --bg: #EEF0F4; --panel: #FFFFFF; --panel-2: #F6F7FA;
  --ink: #15171C; --muted: #697084; --line: #E3E6EC;
  --accent: #C81E8A; --accent-soft: #FBEAF4; --accent-ink: #FFFFFF;
  --ok: #12A150; --ok-soft: #E4F5EC;
  --photo: #0B0C10; --photo-2: #15171E;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C0D11; --panel: #16181F; --panel-2: #1D202A;
    --ink: #F1F3F8; --muted: #97A0B2; --line: #272B36;
    --accent: #EC4FA6; --accent-soft: #2A1622; --accent-ink: #12060D;
    --ok: #35D081; --ok-soft: #12271C;
    --photo: #050609; --photo-2: #0E1017;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--panel); color: var(--ink);
  font-family: var(--sans); -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.app {
  height: 100dvh; width: 100%; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--panel);
  overflow: hidden;
}

.app-top {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; letter-spacing: -.03em; }
.brand .name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.upload { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); padding: 7px 12px; border-radius: 999px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.upload:active { background: var(--line); }

.photo {
  flex: 1 1 auto; min-height: 0; position: relative; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, var(--photo-2), var(--photo));
  display: grid; place-items: center;
}
.shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }

.empty { text-align: center; color: #cfd4e0; padding: 20px; }
.empty .vf { width: 150px; height: 150px; margin: 0 auto 16px; position: relative; }
.empty .hint { font-size: 14px; opacity: .8; margin: 0; }
.c { position: absolute; width: 30px; height: 30px; border: 2px solid rgba(255,255,255,.55); }
.c.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.c.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.c.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.c.br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }

.camera { position: absolute; inset: 0; background: #000; }
.camera video { width: 100%; height: 100%; object-fit: cover; }
.cam-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 18px; cursor: pointer; }
.cam-shot { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); width: 66px; height: 66px; border-radius: 50%; background: #fff; border: 5px solid rgba(255,255,255,.4); cursor: pointer; }
.cam-shot:active { transform: translateX(-50%) scale(.94); }

.results { flex: 0 0 auto; padding: 12px 12px 4px; display: flex; flex-direction: column; gap: 9px; background: var(--panel); }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 10px 13px; }
.card .lbl { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 8px; white-space: nowrap; min-height: 16px; }
.card .found { color: var(--muted); font-weight: 800; letter-spacing: .04em; }
.card .found.yes { color: var(--ok); }
.card .found.no { color: var(--muted); }
.card .val {
  width: 100%; border: 0; background: transparent; resize: none; outline: none;
  color: var(--ink); font-family: var(--mono); padding: 0; margin-top: 5px; overflow: hidden;
}
.card.qr .val { font-size: 19px; font-weight: 700; letter-spacing: .01em; min-height: 24px; }
.card.code { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--accent-soft); }
.card.code .val { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 30px; line-height: 1.08; letter-spacing: .01em; min-height: 36px; margin-top: 6px; }
.card .val:focus { color: var(--accent); }
.copy { border: 0; background: transparent; cursor: pointer; font-family: var(--sans); font-size: 10.5px; color: var(--accent); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 0; display: inline-flex; align-items: center; gap: 5px; -webkit-tap-highlight-color: transparent; }
.copy svg { width: 13px; height: 13px; }
.copy.done { color: var(--ok); }

.status { flex: 0 0 auto; margin: 0; padding: 4px 16px 2px; font-size: 12px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dock { flex: 0 0 auto; padding: 6px 12px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.btn-save {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 14px; padding: 11px; font-family: var(--sans); font-weight: 700; font-size: 14px; cursor: pointer;
  transition: opacity .2s ease, transform .08s ease; -webkit-tap-highlight-color: transparent;
}
.btn-save:disabled { opacity: 0; pointer-events: none; height: 0; padding: 0; margin: 0; border: 0; overflow: hidden; }
.btn-save:active { transform: translateY(1px); }
.btn-scan {
  border: 0; cursor: pointer; border-radius: 18px; padding: 16px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 17px;
  font-family: var(--sans); display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 42%, transparent);
  transition: transform .08s ease, filter .15s ease; -webkit-tap-highlight-color: transparent;
}
.btn-scan:active { transform: translateY(2px) scale(.99); filter: brightness(1.06); }
.btn-scan svg { width: 21px; height: 21px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
