:root {
  --bg: #0b1f18;
  --panel: #12261e;
  --panel-2: #183328;
  --ink: #e8f5ee;
  --muted: #8eaea0;
  --line: #2a4a3d;
  --accent: #c6f54a;
  --accent-ink: #102016;
  --warn: #f3c14e;
  --bad: #ff6b6b;
  --ok: #6ee7b7;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a5c45 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  height: 64px;
  width: auto;
}

h1 {
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: 0.02em;
}

.sub { color: var(--muted); font-size: 0.8rem; margin: 2px 0 0; }

.install {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  display: none;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  background: var(--panel);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 8px;
  border-radius: 10px;
  font-weight: 650;
}

.tabs button.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

#reader {
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: #07140f;
  min-height: 240px;
}

.hint { color: var(--muted); font-size: 0.85rem; margin: 10px 0 0; line-height: 1.4; }

.row { display: flex; gap: 8px; }
input[type="text"] {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 12px;
  padding: 14px 12px;
  font-size: 1rem;
  letter-spacing: 0.06em;
}
button.primary, button.ghost {
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  font-weight: 700;
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-ink); }
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  width: 100%;
  margin-top: 10px;
}

.status {
  margin-top: 12px;
  color: var(--muted);
  min-height: 1.2em;
}

.result { margin-top: 14px; display: none; }
.result.show { display: block; }

.product {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  align-items: start;
}

.product img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 12px;
  background: #07140f;
}

.product h2 { margin: 0 0 4px; font-size: 1.05rem; }
.meta { color: var(--muted); font-size: 0.82rem; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.badge.warn { color: #3a2a00; background: var(--warn); border-color: transparent; }
.badge.bad { color: #3a0000; background: var(--bad); border-color: transparent; }
.badge.ok { color: #063226; background: var(--ok); border-color: transparent; }

.nutrition {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.nutrition h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}
.nutrition table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.nutrition td {
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.nutrition td:last-child {
  text-align: right;
  font-weight: 600;
}
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 0.95rem;
}

.disclaimer {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.history-item:last-child { border-bottom: 0; }
.history-item small { color: var(--muted); }

.empty { color: var(--muted); padding: 8px 0; }

.watch input {
  margin-top: 8px;
  width: 100%;
}
.watch p { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
