:root {
  --bg: #F6F7F4; --surface: #FFFFFF; --line: #DDE2DC; --line-soft: #EEF1ED; --field: #CBD3CD;
  --ink: #14201B; --ink-2: #33403A; --muted: #55625C;
  --brand: #1D4E63; --brand-ink: #123645; --brand-soft: #E6EEF2;
  --ok: #1C6B3F; --ok-bg: #E5F2EA; --ok-line: #3C9A63; --ok-ink: #10462A; --ok-ink-2: #1F4D33;
  --warn: #8A5300; --warn-bg: #FCF1DE; --warn-line: #D99A2B; --warn-ink: #5E3800;
  --bad: #A8231B; --bad-bg: #FBE7E5; --bad-line: #E8A39D; --bad-ink: #7A1A14;
  --camera: #12201B;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1714; --surface: #18221E; --line: #2A3631; --line-soft: #222D29; --field: #3A4741;
    --ink: #E8EEEA; --ink-2: #C9D3CE; --muted: #9AA8A1;
    --brand: #7FB6CC; --brand-ink: #A9D3E0; --brand-soft: #1C2F37;
    --ok: #5FC48A; --ok-bg: #13291D; --ok-line: #2F7A4D; --ok-ink: #B8E6C9; --ok-ink-2: #9DD3B2;
    --warn: #F0B65A; --warn-bg: #2E2312; --warn-line: #8A6420; --warn-ink: #F5D9A8;
    --bad: #F08A80; --bad-bg: #331817; --bad-line: #8A3A33; --bad-ink: #F7C4BE;
    --camera: #08100D;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.view { flex: 1; padding: 0 16px 104px; display: flex; flex-direction: column; gap: 14px; }
.view[hidden] { display: none; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; letter-spacing: -0.2px; min-width: 0; }
.brand svg { flex-shrink: 0; }
.brand .bt { display: flex; flex-direction: column; line-height: 1.15; }
.brand small { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.chip {
  flex-shrink: 1; max-width: 58%;
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 700; border: 0; min-width: 0;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 0; }
.back {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px 0 0; border: 0; background: none;
  color: var(--brand); font-size: 15px; font-weight: 700;
}
.title { font-size: 16px; font-weight: 800; }

/* kamera */
.camera {
  position: relative; height: 290px; border-radius: 20px; background: var(--camera); overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: #E6ECE8;
}
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera .frame { position: relative; z-index: 1; pointer-events: none; }
.camera .hint { position: relative; z-index: 1; margin: 0; font-size: 14px; font-weight: 600; text-align: center; padding: 0 24px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.camera .scanline { animation: scan 1.8s ease-in-out infinite alternate; }
@keyframes scan { from { transform: translateY(-34px); } to { transform: translateY(34px); } }
@media (prefers-reduced-motion: reduce) { .camera .scanline { animation: none; } }
.camera .cam-btn {
  position: relative; z-index: 1; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid #3A4A43;
  background: #1E2E28; color: #E6ECE8; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px;
}
.camera .corner-btn { position: absolute; z-index: 2; bottom: 14px; width: 44px; height: 44px; border-radius: 999px; border: 1px solid #3A4A43; background: rgba(30,46,40,.85); color: #E6ECE8; display: flex; align-items: center; justify-content: center; }
.camera .corner-btn.right { right: 14px; }
.camera .corner-btn.left { left: 14px; }
.camera.live .idle { display: none; }
.camera:not(.live) .live-only { display: none; }

.manual { display: flex; flex-direction: column; gap: 8px; }
.manual label { font-size: 13px; font-weight: 600; color: var(--muted); }
.row { display: flex; gap: 8px; }
.input {
  flex: 1; min-width: 0; height: 48px; padding: 0 14px; border: 1.5px solid var(--field); border-radius: 12px;
  background: var(--surface); font-size: 16px; letter-spacing: .5px;
}
.btn {
  min-height: 48px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--brand); color: #fff;
  font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
@media (prefers-color-scheme: dark) { .btn { color: #0F1714; } }
.btn.secondary { background: var(--surface); color: var(--brand); border: 1.5px solid var(--field); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.note { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.msg { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--bad); }

h2.h { margin: 4px 0 0; font-size: 15px; font-weight: 800; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-align: left; width: 100%;
}
.item .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item .n { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .m { font-size: 12.5px; color: var(--muted); }
.empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; height: 28px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; border: 1px solid;
}
.pill.green { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.pill.yellow { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.pill.red { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }

/* eredmeny */
.verdict { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: 18px; border: 2px solid; }
.verdict p { margin: 0; }
.verdict .vt { font-size: 20px; font-weight: 800; line-height: 1.25; }
.verdict .vs { margin-top: 4px; font-size: 14px; line-height: 1.4; }
.verdict.green { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.verdict.yellow { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.verdict.red { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink); }
.verdict.recall { background: #A8231B; border-color: #A8231B; color: #fff; flex-direction: column; align-items: stretch; gap: 10px; }
.verdict.recall .vs { color: #FFECEA; }
.verdict .ico { flex-shrink: 0; }

.product { display: flex; gap: 14px; align-items: center; }
.product .ph {
  width: 72px; height: 72px; flex-shrink: 0; border-radius: 14px; background: var(--line-soft); overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.product .ph img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.product h1 { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.25; }
.product p { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.product .ean { font-size: 12.5px; }
.badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); font-size: 11px; font-weight: 800; letter-spacing: .5px; vertical-align: 2px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.card h2 { margin: 0; font-size: 14px; font-weight: 800; }
.src { display: flex; gap: 10px; align-items: flex-start; }
.src svg { flex-shrink: 0; margin-top: 1px; }
.src p { margin: 0; }
.src .a { font-size: 14px; font-weight: 700; }
.src .b { margin-top: 1px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.kv { display: flex; justify-content: space-between; gap: 12px; min-height: 36px; align-items: center; border-top: 1px solid var(--line-soft); }
.kv span:first-child { font-size: 13.5px; color: var(--muted); }
.kv span:last-child { font-size: 14px; font-weight: 700; text-align: right; }
details.card summary { font-size: 14px; font-weight: 800; cursor: pointer; min-height: 24px; }
details.card p { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.ing-src { font-size: 12px !important; color: var(--muted) !important; }
.taglist { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 4px 10px; border-radius: 999px; background: var(--line-soft); font-size: 12.5px; font-weight: 600; }
textarea.input { height: auto; min-height: 120px; padding: 10px 14px; line-height: 1.5; resize: vertical; font-size: 14px; letter-spacing: 0; }
.ok-msg { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--ok-bg); color: var(--ok-ink); font-size: 13.5px; line-height: 1.45; }
.spinner { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 120px; border-radius: 18px; background: linear-gradient(90deg, var(--line-soft), var(--surface), var(--line-soft)); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* profil */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--field); background: var(--surface); font-size: 14px; font-weight: 600; }
.tab[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
@media (prefers-color-scheme: dark) { .tab[aria-selected="true"] { color: #0F1714; } }
.tab.add { border-style: dashed; color: var(--brand); font-weight: 700; background: transparent; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border-radius: 14px;
  border: 1.5px solid var(--field); background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer;
}
.opt:has(input:checked) { border: 2px solid var(--brand); background: var(--brand-soft); font-weight: 700; }
.opt input { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; flex-shrink: 0; }
.alg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
.alg label { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.alg input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex-shrink: 0; }
.seg { display: flex; gap: 8px; }
.seg .opt { flex: 1; min-height: 44px; }
.lang { display: flex; gap: 8px; }
.lang .tab { min-width: 56px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar nav { max-width: 560px; margin: 0 auto; display: flex; justify-content: space-around; height: 72px; align-items: center; }
.tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 88px; min-height: 44px; justify-content: center;
  border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600;
}
.tabbar button[aria-current="page"] { color: var(--brand); font-weight: 700; }
.foot { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.5; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 20; background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; max-width: calc(100% - 32px);
}

@media (min-width: 900px) {
  .app { max-width: 720px; }
  .view { padding-top: 12px; }
  .camera { height: 240px; }
}
.install { position: relative; display: flex; gap: 10px; align-items: flex-start; background: var(--brand-soft); border: 1px solid var(--line); border-radius: 14px; padding: 12px 44px 12px 14px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.install p { margin: 0; }
.install strong { color: var(--ink); }
.install .corner-btn { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 999px; background: transparent; color: var(--muted); border: 0; cursor: pointer; }
