:root {
  --bg: #f7f6f3;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #666;
  --accent: #2d6a4f;
  --accent-light: #e8f5e9;
  --warn: #b45309;
  --border: #e5e5e5;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  letter-spacing: -.5px;
}

.logo-icon { font-size: 1.6rem; color: var(--accent); }
.logo-text { font-size: .95rem; line-height: 1.1; }

.badge {
  font-size: .7rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  padding: .3rem .7rem;
  border-radius: 999px;
}

.hero {
  max-width: 640px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
  text-align: center;
}

.eyebrow {
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .75rem;
}

h1 {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: .75rem;
}

.sub { color: var(--muted); margin-bottom: 1.5rem; }

.search-box {
  display: flex;
  gap: .5rem;
  max-width: 560px;
  margin: 0 auto .5rem;
}

.search-box input {
  flex: 1;
  min-width: 0;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--card);
}

.search-box button,
.secondary,
.examples button,
.search-results button {
  padding: .85rem 1.1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

.search-box button:hover,
.examples button:hover,
.search-results button:hover { opacity: .92; }

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  margin-top: .75rem;
}

.hint, .scan-status { font-size: .8rem; color: var(--muted); }

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: center;
  margin-top: .85rem;
}

.examples button {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .35rem .7rem;
  font-size: .78rem;
  font-weight: 500;
}

.scanner {
  max-width: 480px;
  margin: 1rem auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: left;
}

.scanner video,
#scanRegion {
  width: 100%;
  border-radius: 8px;
  background: #111;
  min-height: 180px;
}

#scanRegion { overflow: hidden; }
#scanRegion video { width: 100%; border-radius: 8px; }

.search-results {
  list-style: none;
  max-width: 560px;
  margin: .75rem auto 0;
  text-align: left;
}

.search-results button {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  margin-top: .35rem;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
  text-align: left;
}

.search-hit-label { flex: 1; min-width: 0; }

.search-thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  object-fit: contain;
  border-radius: 8px;
  background: #f3f1ec;
}

.search-thumb-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: .62rem;
  line-height: 1.15;
  color: var(--muted);
  padding: .15rem;
  border: 1px solid var(--border);
}

.search-results button.is-open { border-color: var(--accent); }
.search-note { font-size: .8rem; color: var(--muted); }

.product-card {
  max-width: 680px;
  margin: 0 auto 3rem;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.tag {
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: .25rem .6rem;
  border-radius: 999px;
}

#productName {
  margin: .6rem 0 .25rem;
  font-size: 1.4rem;
}

.product-meta { color: var(--muted); font-size: .85rem; margin-bottom: .4rem; }

.product-photo { margin: .75rem 0 .35rem; }

.product-photo img {
  display: block;
  width: min(100%, 320px);
  height: 220px;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 10px;
  background: #f3f1ec;
}

.photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 1rem;
  background: #f3f1ec;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .95rem;
  text-align: center;
}

.product-photo figcaption {
  margin-top: .35rem;
  font-size: .75rem;
  color: var(--muted);
  text-align: center;
}

.improve-link { margin-top: .7rem; font-size: .82rem; }
.improve-link a { color: var(--accent); }

.add-row { margin-top: .9rem; }

.add-product {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: .85rem 1.1rem;
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.add-product:hover { opacity: .92; }

.product-card.is-message .card-header { border-bottom: none; }

.score-row { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.score { font-size: 2rem; font-weight: 800; color: var(--accent); }
.score.insufficient { color: var(--muted); font-size: 1.6rem; }
.score.grade-a { color: #1b7f3a; }
.score.grade-b { color: #60ac0e; }
.score.grade-c { color: #c9a100; }
.score.grade-d { color: #e67e22; }
.score.grade-e { color: #c0392b; }
.score-label { color: var(--text); font-size: .95rem; font-weight: 600; }
.score-note, .completeness-inline { font-size: .85rem; color: var(--muted); margin-top: .35rem; }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  flex: 1;
  padding: .9rem;
  background: none;
  border: none;
  font-size: .9rem;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-content { display: none; padding: 1.5rem; }
.tab-content.active { display: block; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.info-box, .completeness {
  background: var(--bg);
  padding: 1rem;
  border-radius: var(--radius);
}

.info-box strong { display: block; margin: .3rem 0; }
.info-box p { font-size: .9rem; color: var(--muted); }

.completeness-head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: baseline;
}

.disclaimer, .note {
  font-size: .85rem;
  color: var(--muted);
  margin-top: .75rem;
}

.mono { white-space: pre-wrap; font-family: ui-monospace, monospace; font-size: .9rem; }

table { width: 100%; border-collapse: collapse; margin-top: .5rem; }
td { padding: .6rem 0; border-bottom: 1px solid var(--border); }
td:last-child { text-align: right; font-weight: 600; }

.origin-item { margin-bottom: 1.35rem; }
.origin-head {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .6rem;
  align-items: center;
  margin-bottom: .25rem;
}
.origin-item > strong { display: block; margin-bottom: .25rem; }
.origin-item > p { margin-bottom: .35rem; }

.field-source {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: .72rem;
  background: var(--bg);
  color: var(--muted);
  padding: .05rem .4rem;
  border-radius: 4px;
}

.missing { color: var(--warn); font-style: italic; font-weight: 600; }

.claim-banner {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  padding: .65rem .75rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  margin: .9rem 0 .6rem;
}

.check-list { list-style: none; margin-top: .6rem; }
.check-list li {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: baseline;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.check-list li.is-missing span:first-child { color: var(--warn); }

footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: .8rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  h1 { font-size: 2.1rem; }
  .grid { grid-template-columns: 1fr; }
  .search-box { flex-direction: column; }
  .badge { display: none; }
  .product-photo img { width: 100%; height: 210px; }
}
