/* QR скенер: камерата е главното. Графит и неонов лайм (тъмно), хартия и мастило (светло). */
:root {
  --bg: #f1eee4;
  --surface: #fbf9f2;
  --surface2: #e8e4d6;
  --line: #d7d1bf;
  --ink: #15160f;
  --muted: #67685b;
  --acc: #c8f560;
  --acc-ink: #12140b;
  --acc-text: #4a6a00;
  --ok: #23843e;
  --warn: #a86800;
  --bad: #c63a24;
  --stage: #121410;
  --r: 22px;
  --tabbar-h: 66px;
  --f-head: "Onest", "Manrope", system-ui, sans-serif;
  --f-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f100d;
    --surface: #171914;
    --surface2: #21241d;
    --line: #2d3128;
    --ink: #f1f0e8;
    --muted: #9b9d90;
    --acc-text: #c8f560;
    --ok: #74de8f;
    --warn: #ffc24b;
    --bad: #ff705e;
    --stage: #070806;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); margin: 0; font-feature-settings: "locl" 0; font: 16px/1.5 var(--f-body); color: var(--ink); background: var(--bg); min-height: 100vh; overflow-x: hidden; }
a { color: var(--acc-text); text-underline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.grow { flex: 1; min-width: 0; }
[data-t] { white-space: pre-line; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- горе ---------- */
.top {
  position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 620px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 10px; }
.brand .word { font: 800 16px/1 var(--f-head); letter-spacing: -.01em; }

main { max-width: 620px; margin: 0 auto; }
.wrap { padding: 0 16px; }

/* ---------- камерата ---------- */
.stage { position: relative; padding: 0 12px; }
.viewer {
  position: relative; width: 100%; height: min(64vh, 580px); min-height: 400px;
  border-radius: 30px; overflow: hidden; background: var(--stage); color: #f1f0e8; isolation: isolate;
  display: grid; place-items: center;
}
.viewer video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.placeholder {
  position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 28px 24px; text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(200, 245, 96, .10), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 28px);
}
.placeholder h1 { margin: 0; font: 800 clamp(22px, 6.2vw, 30px)/1.1 var(--f-head); letter-spacing: -.02em; max-width: 15ch; }
.placeholder .lead { margin: 0; color: #b9bbac; font-size: 15px; max-width: 34ch; }
.ph-note { color: #8d8f82; font: 500 12px/1.4 var(--f-mono); letter-spacing: .02em; }
.ph-corners { position: absolute; inset: 22px; pointer-events: none; }
.ph-corners i { position: absolute; width: 30px; height: 30px; border: 3px solid rgba(200, 245, 96, .55); }
.ph-corners i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.ph-corners i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 12px; }
.ph-corners i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 12px; }
.ph-corners i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }

/* спусъкът */
.shutter { margin-top: 8px; display: flex; flex-direction: column; align-items: center; gap: 10px; background: none; border: 0; color: #f1f0e8; cursor: pointer; font: inherit; }
.shutter-core {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; color: var(--acc-ink); background: var(--acc);
  box-shadow: 0 0 0 6px rgba(200, 245, 96, .18), 0 0 0 12px rgba(200, 245, 96, .07), 0 10px 40px rgba(200, 245, 96, .35);
  transition: transform .15s;
}
.shutter-core .i { width: 32px; height: 32px; stroke-width: 2; }
.shutter:active .shutter-core { transform: scale(.94); }
.shutter-label { font: 700 13px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; }
@media (prefers-reduced-motion: no-preference) {
  .shutter-core { animation: breathe 2.6s ease-in-out infinite; }
  @keyframes breathe { 50% { box-shadow: 0 0 0 10px rgba(200, 245, 96, .14), 0 0 0 20px rgba(200, 245, 96, .04), 0 10px 40px rgba(200, 245, 96, .35); } }
}

/* рамката при сканиране */
.frame { position: absolute; inset: 18% 12% 22%; pointer-events: none; z-index: 2; }
.frame span { position: absolute; width: 38px; height: 38px; border: 4px solid var(--acc); filter: drop-shadow(0 0 8px rgba(200, 245, 96, .5)); transition: border-color .2s; }
.frame .c1 { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 16px; }
.frame .c2 { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 16px; }
.frame .c3 { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 16px; }
.frame .c4 { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 16px; }
.frame .line {
  left: 4%; right: 4%; width: auto; height: 2px; border: 0; top: 50%; filter: none;
  background: linear-gradient(90deg, transparent, var(--acc), transparent); box-shadow: 0 0 18px 3px rgba(200, 245, 96, .55);
  animation: sweep 2s ease-in-out infinite alternate;
}
@keyframes sweep { from { top: 4%; } to { top: 96%; } }
@media (prefers-reduced-motion: reduce) { .frame .line { animation: none; } }
.viewer.found .frame span { border-color: #fff; }
.viewer.found .frame .line { display: none; }
.viewer .hint {
  position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 3;
  background: rgba(7, 8, 6, .66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 7px 14px; border-radius: 999px;
  font: 500 12px/1.3 var(--f-mono); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis;
}
.viewer .msg { position: relative; z-index: 3; padding: 24px; text-align: center; display: grid; gap: 16px; justify-items: center; }
.viewer .again { position: absolute; z-index: 4; left: 50%; bottom: 20px; transform: translateX(-50%); white-space: nowrap; }

/* лентата с бутоните: статична, под камерата */
.dock { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.dock-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 72px; padding: 10px 6px;
  border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); cursor: pointer; font: inherit; text-decoration: none; text-align: center;
}
.dock-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); flex: none; }
.dock-lb { font: 600 11px/1.2 var(--f-mono); letter-spacing: .02em; }
.dock-btn[aria-pressed="true"] .dock-ic, .dock-btn.hot .dock-ic { background: var(--acc); color: var(--acc-ink); }
.dock-btn:active { transform: scale(.97); }

/* ---------- превключвател ---------- */
.switch { display: flex; align-items: center; gap: 12px; margin: 14px 4px 12px; cursor: pointer; user-select: none; font-weight: 600; }
.sw-text { display: flex; flex-direction: column; }
.sw-sub { color: var(--muted); font: 500 12px/1.35 var(--f-mono); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 48px; height: 28px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); position: relative; flex: none; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch input:checked + .track { background: var(--acc); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(20px); background: var(--acc-ink); }
.switch input:focus-visible + .track { outline: 2px solid var(--acc-text); outline-offset: 2px; }

/* ---------- бутони ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px;
  border: 0; border-radius: 999px; font: 700 15px/1.2 var(--f-body); cursor: pointer; text-decoration: none; text-align: center;
  color: var(--acc-ink); background: var(--acc);
}
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.secondary { background: var(--surface2); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 14px; }
.viewer .btn.secondary { background: rgba(255, 255, 255, .12); color: #f1f0e8; }

/* ---------- панелите ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.tag { display: inline-flex; align-items: center; gap: 8px; font: 700 12px/1.2 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink); }
.tag::before { content: ""; width: 8px; height: 8px; background: var(--acc); border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); flex: none; }

.result { animation: rise .28s ease-out; border-top: 4px solid var(--acc); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.res-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.res-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--acc); color: var(--acc-ink); flex: none; }
.res-ic .i { width: 24px; height: 24px; }
.res-head b { display: block; font: 800 18px/1.2 var(--f-head); letter-spacing: -.01em; }
.res-head small { color: var(--muted); font: 500 13px/1.3 var(--f-mono); overflow-wrap: anywhere; }
.res-text {
  background: var(--bg); border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; margin: 0 0 12px;
  font: 500 14px/1.5 var(--f-mono); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-height: 240px; overflow: auto;
}
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0 0 14px; }
.kv dt { color: var(--muted); font: 500 13px/1.6 var(--f-mono); text-transform: uppercase; letter-spacing: .04em; }
.kv dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.opening { display: flex; align-items: center; gap: 10px; color: var(--muted); margin-bottom: 12px; font: 500 14px/1.4 var(--f-mono); }
.opening .i { color: var(--acc-text); }
.wifi-note { align-items: flex-start; background: var(--surface2); border-radius: 14px; padding: 12px 14px; color: var(--ink); font: 600 14px/1.45 var(--f-body); }
.wifi-note .i { margin-top: 1px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--acc-text); animation: rot .8s linear infinite; flex: none; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- продукт ---------- */
.product-card { border-top: 4px solid var(--acc); animation: rise .28s ease-out; }
.pr-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.pr-head b { display: block; font: 800 18px/1.25 var(--f-head); letter-spacing: -.01em; overflow-wrap: anywhere; }
.pr-head small { display: block; color: var(--muted); }
.pr-head small:last-child { font: 500 12px/1.5 var(--f-mono); }
.pr-img { width: 76px; height: 76px; border-radius: 16px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: none; }
.pr-img.none { display: grid; place-items: center; color: var(--muted); background: var(--surface2); }
.pr-block { padding: 14px 0; border-top: 1px dashed var(--line); }
.pr-label { font: 700 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; }
.ns-scale { display: flex; gap: 4px; }
.ns-scale span { flex: 1; max-width: 54px; height: 40px; display: grid; place-items: center; color: #fff; font: 800 16px/1 var(--f-head); border-radius: 10px; opacity: .28; }
.ns-scale span.on { opacity: 1; transform: scale(1.14); box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.nova { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.nova-n { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font: 800 16px/1 var(--f-head); flex: none; }
.nova-1 .nova-n { background: #038141; } .nova-2 .nova-n { background: #85bb2f; } .nova-3 .nova-n { background: #ee8100; } .nova-4 .nova-n { background: #e63e11; }
.pr-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; flex-wrap: wrap; }
.pr-row + .pr-row { border-top: 1px solid var(--line); }
.pr-price { flex-wrap: nowrap; }
.pr-ingr { margin: 0; font-size: 14px; line-height: 1.5; opacity: .8; overflow-wrap: anywhere; }
.pr-price .grow { min-width: 0; }
.pr-price .grow small { display: block; font: inherit; font-size: 13px; }
.pr-price .pr-eur { flex: none; font-variant-numeric: tabular-nums; }
.pr-price .lv { white-space: nowrap; }
.pr-more { margin-top: 8px; padding: 8px 14px; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.pr-row .muted { font: 500 14px/1.4 var(--f-mono); }
.lv { font: 700 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .06em; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.lv-low { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.lv-moderate { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.lv-high { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface2); border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 600; }
.pr-note { margin: 14px 0 0; }
.empty-box { background: var(--surface2); border-radius: 16px; padding: 14px; }
.empty-box b { display: block; margin-bottom: 4px; }
.empty-box p { margin: 0; }

/* козметика */
.bt-score { display: flex; gap: 16px; align-items: center; padding: 14px 0; border-top: 1px dashed var(--line); }
.bt-ring { position: relative; width: 86px; height: 86px; flex: none; }
.bt-ring svg { width: 100%; height: 100%; }
.bt-track { fill: none; stroke: var(--surface2); stroke-width: 10; }
.bt-val { fill: none; stroke-width: 10; stroke-linecap: round; stroke: var(--ok); }
.bt-ring.bt-mid .bt-val { stroke: var(--warn); } .bt-ring.bt-bad .bt-val { stroke: var(--bad); }
.bt-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1; }
.bt-num b { font: 800 22px/1 var(--f-head); } .bt-num small { color: var(--muted); font-family: var(--f-mono); }
.bt-verdict { font: 800 17px/1.25 var(--f-head); display: block; }
.bt-verdict.bt-good, .bt-verdict.bt-low { color: var(--ok); } .bt-verdict.bt-mid { color: var(--warn); } .bt-verdict.bt-bad { color: var(--bad); }
.bt-sum { margin: 4px 0 8px; color: var(--muted); }
.bt-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.bt-tag { font: 700 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .04em; padding: 5px 10px; border-radius: 999px; background: var(--surface2); }
.bt-tag.high { color: var(--bad); } .bt-tag.medium { color: var(--warn); } .bt-tag.low { color: #d9641a; } .bt-tag.unknown { color: var(--muted); }
.bt-item { display: flex; gap: 10px; padding: 9px 0; }
.bt-item + .bt-item { border-top: 1px solid var(--line); }
.bt-dot { width: 10px; height: 10px; border-radius: 3px; margin-top: 7px; flex: none; background: var(--ok); }
.bt-high .bt-dot { background: var(--bad); } .bt-medium .bt-dot { background: var(--warn); } .bt-low .bt-dot { background: #f08a3c; } .bt-unknown .bt-dot { background: var(--line); }
.bt-item b { display: block; overflow-wrap: anywhere; } .bt-item small { display: block; }
.bt-why { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.bt-allok { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 700; }
.product .fold { border: 0; padding: 0; margin: 0; background: none; }
.product .fold summary { padding: 12px 0; min-height: 0; }

/* ---------- сгъваемите раздели и историята ---------- */
.fold { padding: 0; }
.fold summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 16px; cursor: pointer; min-height: 56px; }
.fold summary::-webkit-details-marker { display: none; }
.fold .chev { transition: transform .2s; color: var(--muted); }
.fold[open] .chev { transform: rotate(90deg); }
.fold-body { padding: 0 16px 16px; }
.fold-body p { margin: 0 0 10px; }
.count { background: var(--acc); color: var(--acc-ink); border-radius: 999px; padding: 2px 9px; font: 700 12px/1.3 var(--f-mono); }
.count:empty { display: none; }
.history { list-style: none; margin: 0 0 10px; padding: 0; }
.history li + li { border-top: 1px dashed var(--line); }
.history button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 0; background: none; border: 0;
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; min-height: 56px;
}
.history .h-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface2); color: var(--ink); flex: none; }
.history .h-main { min-width: 0; flex: 1; }
.history .h-main b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history .h-main small { color: var(--muted); font: 500 12px/1.4 var(--f-mono); }

.foot { padding: 18px 8px calc(30px + env(safe-area-inset-bottom)); font-size: 14px; color: var(--muted); text-align: center; }
.foot p { margin: 0 0 8px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font: 600 14px/1.35 var(--f-body);
  max-width: calc(100% - 32px); text-align: center;
}
.toast.err { background: var(--bad); color: #fff; }

@media (min-width: 700px) {
  .stage { padding: 0 16px; }
}

/* ---------- долната лента: скенер и видео ---------- */
.tabbar {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 8px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); min-height: var(--tabbar-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; max-width: 220px; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font: 700 14px/1 var(--f-body);
}
.tab[aria-current="page"] { background: var(--acc); color: var(--acc-ink); }
.tab:active { transform: scale(.97); }

/* ---------- език ---------- */
.top-act { display: flex; align-items: center; gap: 8px; }
.lang-btn {
  min-width: 44px; height: 40px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line); background: transparent;
  color: var(--ink); font: 700 13px/1 var(--f-mono); letter-spacing: .04em; cursor: pointer;
}
.lang-btn:active { transform: scale(.96); }
.set-label { font: 700 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface2); margin-bottom: 10px; }
.seg button { min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font: 700 14px/1.2 var(--f-body); cursor: pointer; padding: 6px 4px; }
.seg button[aria-checked="true"] { background: var(--acc); color: var(--acc-ink); }

.pr-effect { padding: 8px 0; border-top: 1px solid var(--line); }
.pr-effect summary { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; list-style: none; }
.pr-effect summary::-webkit-details-marker { display: none; }
.pr-effect summary .grow { flex: 1; min-width: 0; }
.pr-effect summary .lv { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex: none; }
.pr-effect p { margin: 8px 0 0; text-wrap: pretty; }

.pr-score { display: flex; align-items: baseline; gap: 6px; }
.pr-score-n { font-size: 34px; line-height: 1.1; padding: 2px 10px; border-radius: 10px; }
