:root {
  --bg: #f6f7f4;
  --card: #ffffff;
  --ink: #1c241c;
  --muted: #5e6b62;
  --line: #e4e8e2;
  --green: #1b7f4e;
  --green-bg: #e7f6ee;
  --red: #c62828;
  --red-bg: #fdecea;
  --shadow: 0 8px 24px rgba(28, 36, 28, 0.06);
  font-family: "Noto Sans TC", "PingFang HK", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #dfe5dc; color: var(--ink); }
body { min-height: 100dvh; }
.app {
  width: min(412px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.top, .sheet, .screen { padding: 16px 16px 8px; }
.top { display: flex; align-items: center; justify-content: space-between; }
h1 { font-size: 28px; margin: 0; letter-spacing: -0.03em; }
.icon-btn, .back {
  width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: var(--card); font-size: 20px;
}
.search {
  width: 100%; height: 52px; border: 1px solid var(--line); border-radius: 14px;
  padding: 0 14px; font-size: 16px; background: var(--card);
}
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 14px 0; }
.actions button, .primary, .ghost {
  min-height: 64px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); font-size: 16px; font-weight: 700;
}
.primary { width: 100%; background: var(--green); color: white; border: 0; min-height: 52px; }
.chips { display: flex; gap: 8px; margin-bottom: 8px; }
.chips button {
  height: 36px; border-radius: 999px; border: 0; background: #eceee9; padding: 0 14px; font-weight: 700;
}
.chips button.on { background: var(--green-bg); color: var(--green); }
.list { display: flex; flex-direction: column; gap: 8px; }
.row, .item {
  background: var(--card); border-radius: 16px; padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  box-shadow: var(--shadow); border: 0; width: 100%; text-align: left;
}
.name { font-size: 18px; font-weight: 700; }
.sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.badge {
  min-width: 72px; text-align: center; border-radius: 999px; padding: 6px 10px; font-weight: 800;
}
.badge.low { background: var(--green-bg); color: var(--green); }
.badge.high { background: var(--red-bg); color: var(--red); }
.badge.mix { background: #eee; color: #444; }
.status {
  margin: 12px 0; border-radius: 20px; text-align: center; font-size: 40px; font-weight: 800;
  padding: 18px 12px; letter-spacing: 0.04em;
}
.status.low { background: var(--green); color: white; }
.status.high { background: var(--red); color: white; }
.num { font-size: 56px; font-weight: 800; line-height: 1; }
.num small { font-size: 16px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.hidden { display: none !important; }
.disclaimer { color: var(--muted); font-size: 12px; text-align: center; padding: 16px 20px 28px; }
.suggest { background: var(--card); border-radius: 14px; overflow: hidden; margin-top: 8px; }
.suggest button { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: white; padding: 12px 14px; font-size: 16px; }
.note { color: var(--muted); font-size: 14px; margin: 8px 0 12px; }
.screen-head { display: flex; align-items: center; gap: 8px; }
.screen-head h2 { flex: 1; font-size: 18px; margin: 0; text-align: center; }
input.name-edit { font-size: 22px; font-weight: 800; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 8px 0; }

#scan-video { width: 100%; height: 240px; margin-bottom: 8px; background: #111; border-radius: 16px; object-fit: cover; }
#scan-go { margin-top: 12px; }

.portion-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.portion-row span { font-weight: 700; }
.step {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-size: 22px; font-weight: 700;
}
#portion-grams {
  width: 92px; height: 44px; border: 1px solid var(--line); border-radius: 12px;
  text-align: center; font-size: 20px; font-weight: 800; background: var(--card);
}
.portion-total { font-size: 22px; font-weight: 800; margin: 0 0 8px; }
.mini-step { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.mini-step input {
  width: 72px; height: 36px; text-align: center; border: 1px solid var(--line);
  border-radius: 10px; font-weight: 800; font-size: 16px;
}
.mini-step button {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); font-size: 18px; font-weight: 700;
}
