:root {
  --teal: #01838e; --teal-dark: #0f585e; --teal-light: #e6f3f4; --orange: #f5a623;
  --text: #2b2f33; --muted: #5f6b70; --line: #dfe7e8; --bg: #f6f8f8; --card: #fff;
  --good: #1e8e3e; --bad: #d32f2f; --radius: 14px;
  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-weight: 400; color: var(--text); background: var(--bg); line-height: 1.5; font-size: 16px; }
a { color: var(--teal); }
img { max-width: 100%; }
h1 { font-size: 1.45rem; font-weight: 500; margin: .2em 0 .4em; color: var(--teal-dark); line-height: 1.25; }
h2 { font-size: 1.1rem; font-weight: 500; margin: 0 0 .6em; color: var(--teal-dark); }

.top { background: var(--teal); display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 10; }
.brand img { display: block; height: 42px; width: auto; }
.topnav { display: flex; gap: 6px; }
.topnav a { color: #fff; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; }
.topnav a:hover, .topnav a:focus-visible { background: rgba(255,255,255,.15); }
.subbar { background: var(--orange); color: #fff; text-align: center; font-weight: 500; font-size: .9rem; padding: 5px 16px; letter-spacing: .02em; }

main { max-width: 720px; margin: 0 auto; padding: 16px; outline: none; min-height: 60vh; }
main > section, .product > section { background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }

.hero { text-align: center; }
.hero h1 { font-size: 1.7rem; }
.hero p { color: var(--muted); margin: 0 0 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--teal); color: #fff; border: 0; border-radius: 999px; padding: 11px 20px; font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; min-height: 44px; }
.btn:hover { background: var(--teal-dark); }
.btn.ghost { background: transparent; color: var(--teal); box-shadow: inset 0 0 0 2px var(--teal); }
.btn.ghost:hover { background: var(--teal-light); }
.btn.big { font-size: 1.1rem; padding: 14px 26px; }
.btn.scan { background: var(--orange); color: #fff; width: 100%; max-width: 360px; margin-bottom: 16px; }
.btn.scan:hover { background: #e0901a; }
.btn:disabled { opacity: .6; cursor: wait; }

.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; font: inherit; padding: 11px 16px; border: 2px solid var(--line); border-radius: 999px; background: #fff; }
.search input:focus { border-color: var(--teal); outline: none; }

.items { list-style: none; margin: 0; padding: 0; }
.items li + li { border-top: 1px solid var(--line); }
.items a { display: flex; align-items: center; gap: 12px; padding: 10px 2px; text-decoration: none; color: var(--text); }
.items a:hover { background: var(--teal-light); }
.thumb { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; border: 1px solid var(--line); }
.noimg { display: grid; place-items: center; font-size: 22px; background: var(--bg); }
.it { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.it strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.it small { color: var(--muted); }
.ver { color: var(--good); font-style: normal; font-weight: 500; }
.badge { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 6px; border-radius: 50%; color: #fff; font-weight: 700; flex: none; }
.badge.sm { min-width: 34px; height: 34px; font-size: .9rem; }
.badge.none { background: #b0bcbf; }
.legend { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.count, .hint, .small, .empty { color: var(--muted); font-size: .9rem; }
.more { text-align: right; margin: 8px 0 0; }
.loading { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 40px 0; color: var(--muted); }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { color: var(--bad); }

.notfound { text-align: center; }
.nf-icon { font-size: 44px; }

.product .phead { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.pimg { width: 96px; height: 96px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #fff; flex: none; }
.pimg.noimg { font-size: 40px; }
.pt { flex: 1; min-width: 0; }
.pt h1 { margin-top: 0; font-size: 1.25rem; }
.pt p { margin: 0; color: var(--muted); }
.pt .code { font-size: .8rem; margin-top: 4px; }
.fav { background: none; border: 0; font-size: 28px; color: #c9d3d5; cursor: pointer; width: 44px; height: 44px; flex: none; }
.fav.on { color: #e53950; }

.score { display: flex; gap: 16px; align-items: center; background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; border-left: 6px solid var(--c, #b0bcbf); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.score .ring { width: 86px; height: 86px; border-radius: 50%; background: var(--c, #b0bcbf); color: #fff; display: flex; align-items: baseline; justify-content: center; padding-top: 22px; flex: none; }
.score .ring span { font-size: 2rem; font-weight: 700; line-height: 1; }
.score .ring small { font-size: .85rem; opacity: .9; }
.score strong { font-size: 1.15rem; font-weight: 500; color: var(--c, var(--text)); }
.score p { margin: 4px 0 0; }
.score .cat { font-size: .82rem; color: var(--muted); }
.score.none .ring { padding-top: 0; align-items: center; }
.note { font-size: .85rem; color: var(--muted); margin: -6px 4px 14px; }

.claims { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.claims li { background: var(--teal-light); color: var(--teal-dark); border-radius: 999px; padding: 5px 12px; font-size: .9rem; font-weight: 500; }

.portion { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.portion input { width: 90px; font: inherit; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; color: var(--text); }
.tablewrap { overflow-x: auto; }
.nut { width: 100%; border-collapse: collapse; font-size: .95rem; }
.nut th, .nut td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.nut th:first-child { text-align: left; font-weight: 400; }
.nut thead th { font-size: .8rem; color: var(--muted); font-weight: 500; }
.nut tr.sub th { padding-left: 20px; color: var(--muted); }
.nut tr.sep th { text-align: left; font-weight: 500; color: var(--teal-dark); padding-top: 14px; }
.nut td.unk { color: #9aa5a8; font-style: italic; }
.lvl { display: inline-block; font-size: .7rem; padding: 1px 7px; border-radius: 999px; margin-left: 6px; color: #fff; vertical-align: middle; }
.lvl.low { background: var(--good); } .lvl.medium { background: var(--orange); } .lvl.high { background: var(--bad); }
.ingr { font-size: .92rem; color: var(--muted); }
.ingr strong { color: var(--text); font-weight: 500; }
.note-box { background: #fff7e8; border-radius: 10px; padding: 10px 12px; font-size: .92rem; margin: 0 0 8px; }
details summary { cursor: pointer; color: var(--teal); font-size: .9rem; }
.adds { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.adds li { background: var(--bg); border-radius: 8px; padding: 3px 9px; font-size: .85rem; }
.adds li.flag { background: #fdecea; color: var(--bad); font-weight: 500; }
.src { font-size: .82rem; color: var(--muted); padding: 0 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.scanner { text-align: center; }
.cam { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 4 / 3; max-height: 60vh; margin: 0 auto 12px; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.frame span { width: 78%; height: 36%; border: 3px solid rgba(255,255,255,.9); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.torch { position: absolute; right: 10px; bottom: 10px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); font-size: 22px; }
.scanmsg { color: var(--muted); }

.submit form { display: grid; gap: 14px; }
.submit label { display: grid; gap: 4px; font-weight: 500; font-size: .95rem; }
.submit input:not([type=checkbox]), .submit textarea { font: inherit; font-weight: 400; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; width: 100%; }
.submit input:focus, .submit textarea:focus { border-color: var(--teal); outline: none; }
.submit .file input { padding: 8px; background: var(--bg); }
.submit .opt { font-weight: 400; color: var(--muted); font-size: .85rem; }
.submit .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.submit .check input { margin-top: 4px; width: 20px; height: 20px; flex: none; }
.hp { position: absolute !important; left: -9999px; }

.about ul { padding-left: 20px; }
.about li { margin-bottom: 6px; }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 10px 16px 30px; padding-bottom: max(30px, env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.foot p { margin: 4px 0; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: var(--teal-dark); color: #fff; padding: 10px 18px; border-radius: 999px; opacity: 0; transition: .25s; pointer-events: none; z-index: 20; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 420px) {
  .search { flex-direction: column; }
  .score { flex-direction: column; text-align: center; }
  .pimg { width: 76px; height: 76px; }
}
