:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --text: #121211;
  --muted: #6b6a66;
  --line: #e8e7e3;
  --ink: #121211;
  --ink-text: #ffffff;

  --ok: #157f3b;
  --ok-bg: #e9f7ee;
  --warn: #9a5b00;
  --warn-bg: #fff4e0;
  --no: #b42318;
  --no-bg: #fdecea;
  --neutral-bg: #f1f1ef;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}


* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 16px calc(88px + var(--safe-bottom));
}

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; background: var(--ink);
  display: grid; place-items: center;
}
.brand-mark svg { width: 16px; height: 16px; color: var(--ink-text); }
.brand-name { font-weight: 650; font-size: 20px; letter-spacing: -0.02em; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; color: var(--muted);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

/* Scanner */
.scanner {
  position: relative; overflow: hidden;
  aspect-ratio: 4 / 3.4;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.scanner video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .25s;
}
.scanner.live { background: #000; border-color: #000; }
.scanner.live video { opacity: 1; }
.scanner-frame {
  position: absolute; inset: 22% 12%; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 999px rgb(0 0 0 / 0.35);
  opacity: 0; transition: opacity .25s;
}
.scanner-frame::before, .scanner-frame::after {
  content: ""; position: absolute; inset: 0; border-radius: 14px;
  border: 2px solid rgb(255 255 255 / 0.9);
  -webkit-mask: linear-gradient(#000 0 0) top left / 28px 28px no-repeat,
                linear-gradient(#000 0 0) top right / 28px 28px no-repeat,
                linear-gradient(#000 0 0) bottom left / 28px 28px no-repeat,
                linear-gradient(#000 0 0) bottom right / 28px 28px no-repeat;
          mask: linear-gradient(#000 0 0) top left / 28px 28px no-repeat,
                linear-gradient(#000 0 0) top right / 28px 28px no-repeat,
                linear-gradient(#000 0 0) bottom left / 28px 28px no-repeat,
                linear-gradient(#000 0 0) bottom right / 28px 28px no-repeat;
}
.scanner-frame span {
  position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; border-radius: 2px;
  background: rgb(255 255 255 / 0.85);
  animation: sweep 1.8s ease-in-out infinite;
}
@keyframes sweep { 0%, 100% { transform: translateY(-34px); } 50% { transform: translateY(34px); } }
.scanner.live .scanner-frame { opacity: 1; }

.scanner-start {
  position: absolute; inset: 0; border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
.scanner.live .scanner-start { display: none; }
.scanner-start-icon {
  width: 72px; height: 72px; border-radius: 22px; background: var(--ink); color: var(--ink-text);
  display: grid; place-items: center; margin-bottom: 6px;
  transition: transform .15s;
}
.scanner-start:active .scanner-start-icon { transform: scale(0.96); }
.scanner-start-icon svg { width: 34px; height: 34px; }
.scanner-start-label { font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.scanner-start-hint { color: var(--muted); font-size: 14px; }

.scanner-controls {
  position: absolute; top: 12px; right: 12px; display: flex; gap: 8px;
}
.round-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgb(0 0 0 / 0.45); color: #fff; display: grid; place-items: center;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.round-btn[aria-pressed="true"] { background: #fff; color: #000; }
.round-btn svg { width: 20px; height: 20px; }
.scanner-status {
  position: absolute; left: 0; right: 0; bottom: 14px; text-align: center;
  color: #fff; font-size: 14px; text-shadow: 0 1px 2px rgb(0 0 0 / 0.6);
}
.scanner:not(.live) .scanner-status { color: var(--no); text-shadow: none; padding: 0 16px; }

/* Manual entry */
.manual { display: flex; gap: 8px; margin-top: 12px; }
.manual input {
  flex: 1; min-width: 0; height: 48px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  font-size: 16px; letter-spacing: 0.04em;
}
.manual input::placeholder { letter-spacing: 0; color: var(--muted); }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgb(18 18 17 / 0.07); }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

/* Buttons */
.btn {
  height: 48px; padding: 0 18px; border-radius: var(--radius-sm); border: 0;
  font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn-primary { background: var(--ink); color: var(--ink-text); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-block { width: 100%; }
.btn:active { transform: scale(0.99); opacity: .9; }
.link-btn { border: 0; background: none; color: var(--muted); font-size: 14px; padding: 6px 0; }

/* Sections & lists */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; margin: 28px 2px 8px;
}
.section-head h2, .group-title {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.group-title { margin: 26px 2px 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border: 0; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.list > li:first-child .row { border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm); }
.list > li:last-child .row { border-bottom: 0; border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.list { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.list:empty { display: none; }
.row:active { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; }
.row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-sub { font-size: 13px; color: var(--muted); }
.row-side { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.row-seal { width: 26px; height: 26px; object-fit: contain; }
.row-thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.ok { background: var(--ok); } .dot.no { background: var(--no); } .dot.warn { background: var(--warn); } .dot.neutral { background: var(--line); }

/* Pills */
.pill {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--text); white-space: nowrap;
}
.pill.parve { background: var(--surface-2); }
.pill.lacteo { background: #e8f0fe; color: #1e4fb8; }
.pill.carne { background: #fde8e8; color: #9b1c1c; }

/* Search */
.search-box { position: relative; }
.search-box input {
  width: 100%; height: 50px; padding: 0 16px 0 44px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); font-size: 17px;
  -webkit-appearance: none; appearance: none;
}
.search-icon { position: absolute; left: 14px; top: 15px; color: var(--muted); }
.search-icon svg { width: 20px; height: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.chip {
  height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px;
}
.chip:active { background: var(--surface-2); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
#search-meta { margin: 12px 2px 8px; }
#search-meta:empty { display: none; }

/* Places */
.place { padding: 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.list > li:last-child .place { border-bottom: 0; }
.place-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.place-desc { color: var(--muted); font-size: 14px; margin-top: 2px; }
.place-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 14px; }
.place-links a { color: var(--text); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.place-links svg { width: 15px; height: 15px; color: var(--muted); }
.note {
  margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: 14px; color: var(--muted);
}

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; max-width: 160px; border: 0; background: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 500; padding: 6px 0; border-radius: 12px;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--text); }

/* Sheet */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 0.35); animation: fade .2s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  max-height: 94dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 0 16px calc(20px + var(--safe-bottom));
  animation: rise .28s cubic-bezier(.2, .8, .2, 1);
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-bar { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 10px 0 0; background: var(--bg); z-index: 1; }

/* Result */
.scanned { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.scanned img, .scanned .ph { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.scanned-name { font-weight: 600; line-height: 1.3; }
.scanned-meta { font-size: 13px; color: var(--muted); }

.verdict {
  border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; align-items: flex-start;
}
.verdict-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.verdict-icon svg { width: 20px; height: 20px; }
.verdict-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.verdict-text { margin-top: 4px; font-size: 15px; }
.verdict.ok { background: var(--ok-bg); } .verdict.ok .verdict-title, .verdict.ok .verdict-icon { color: var(--ok); }
.verdict.warn { background: var(--warn-bg); } .verdict.warn .verdict-title, .verdict.warn .verdict-icon { color: var(--warn); }
.verdict.no { background: var(--no-bg); } .verdict.no .verdict-title, .verdict.no .verdict-icon { color: var(--no); }
.verdict.neutral { background: var(--neutral-bg); }
.verdict .verdict-icon { background: color-mix(in srgb, currentColor 14%, transparent); }

.card {
  margin-top: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.card-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.card-title { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; margin-top: 2px; }
.card-variants { color: var(--muted); font-size: 14px; margin-top: 4px; }
.card-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.seal-box {
  margin-top: 16px; border-radius: var(--radius-sm); padding: 16px;
  background: var(--warn-bg); display: flex; gap: 16px; align-items: center;
}
.seal-box.free { background: var(--surface-2); padding: 12px 14px; }
.seal-imgs { display: flex; gap: 8px; flex-shrink: 0; }
.seal-imgs img { width: 84px; height: 84px; object-fit: contain; background: #fff; border-radius: 12px; padding: 6px; }
.seal-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--warn); }
.seal-name { font-weight: 650; font-size: 17px; margin-top: 2px; }
.seal-desc { font-size: 14px; color: var(--muted); margin-top: 2px; }
.free-line { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.free-line svg { width: 20px; height: 20px; color: var(--ok); flex-shrink: 0; }
.free-logos { display: flex; gap: 6px; margin-left: auto; }
.free-logos img { width: 34px; height: 34px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }

.facts { margin: 16px 0 0; display: grid; gap: 10px; }
.fact { display: flex; gap: 10px; font-size: 15px; }
.fact svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; margin-top: 2px; }
.fact.check { font-weight: 500; }
.fact.check svg { color: var(--warn); }
.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.card-foot details summary { cursor: pointer; }
.card-foot details p { margin-top: 6px; font-style: italic; }

.question { margin: 20px 2px 10px; font-weight: 600; }
.actions { display: grid; gap: 8px; }
.actions-2 { grid-template-columns: 1fr 1fr; }
.saved-note { margin-top: 12px; font-size: 14px; color: var(--muted); text-align: center; }

.candidates-title { margin: 22px 2px 8px; font-weight: 600; }
.disclaimer { margin-top: 18px; font-size: 13px; color: var(--muted); line-height: 1.5; }

.skeleton { height: 120px; border-radius: var(--radius); background: var(--surface-2); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.brand-city { font-weight: 450; color: var(--muted); }
.footnote { margin: 28px 4px 0; font-size: 12px; line-height: 1.5; color: var(--muted); text-align: center; }
.independent { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 15px; }
