/* =========================================================================
   KawanLabel design system
   Modern food-tech x accessible wellness. Warm cream, white cards, deep navy
   brand, fresh green accents. Verdict colours (green / yellow / red) are
   reserved for food results.
   ========================================================================= */
:root {
  /* brand */
  --navy: #1D2B4F;
  --navy-dark: #172440;
  --navy-soft: #34476D;
  --navy-tint: #E9ECF3;
  --cream: #F8F7F1;
  --white: #FFFFFF;
  /* fresh accents */
  --green: #4F8B62;
  --green-ink: #2F6A43;
  --sage: #E8F0E7;
  --lime: #B9E94B;
  --pale-green: #F2F7EF;
  --peach: #F8E4D7;
  --orange: #E99A48;
  --pale-yellow: #FFF2C9;
  --blush: #F5E6E2;
  /* neutrals */
  --text: #20283A;
  --text-2: #5F6573;      /* 5.9:1 on white (spec #737986 is used for muted only) */
  --muted: #737986;
  --border: #E6E5DF;
  --surface-2: #F1F0EA;
  /* verdicts */
  --ok: #0B6B2E;
  --ok-tint: #E4F1E7;
  --warn: #FFD400;
  --warn-tint: #FFF6CC;
  --bad: #B3001B;
  --bad-tint: #FBE5E8;

  --r-sm: 12px;
  --r: 16px;
  --r-lg: 20px;
  --r-xl: 24px;
  --pad: 20px;
  --shadow-sm: 0 1px 2px rgba(29, 43, 79, 0.05);
  --shadow: 0 1px 2px rgba(29, 43, 79, 0.05), 0 6px 18px rgba(29, 43, 79, 0.06);
  --shadow-lg: 0 10px 30px rgba(29, 43, 79, 0.18);
  --base: 18px;
}
html { font-size: var(--base); height: 100%; }
html[data-size="a"] { --base: 16px; }
html[data-size="ap"] { --base: 18px; }
html[data-size="app"] { --base: 21px; }
html[data-boost] { --base: 21px; }

* { box-sizing: border-box; }
body {
  margin: 0; height: 100%;
  background: #ECEBE4;
  color: var(--text);
  font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
:lang(zh) { font-family: 'Noto Sans SC', 'Atkinson Hyperlegible', 'PingFang SC', 'Microsoft YaHei', sans-serif; }
:lang(ta) { font-family: 'Noto Sans Tamil', 'Atkinson Hyperlegible', 'Nirmala UI', 'Latha', sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; }
:lang(zh) h1, :lang(zh) h2, :lang(ta) h1, :lang(ta) h2 { letter-spacing: 0; }

:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; border-radius: 10px; }
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }
.cam-controls > [hidden] { display: inline-flex !important; visibility: hidden; }
.cam-error:not([hidden]) ~ .cam-scanline, .cam-view:has(.cam-error:not([hidden])) .cam-scanline { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App shell ---------- */
#app { height: 100%; }
.shell {
  height: 100vh; height: 100dvh;
  max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--cream);
  position: relative;
}
@media (min-width: 640px) {
  .shell { height: calc(100dvh - 40px); margin-top: 20px; border-radius: 32px; overflow: hidden; box-shadow: 0 20px 60px rgba(29, 43, 79, 0.14); border: 1px solid var(--border); }
}
.appbar {
  flex: none; display: flex; align-items: center; gap: 8px;
  height: 70px; padding: 0 20px;
  border-bottom: 1px solid var(--border); background: var(--cream);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; font-weight: 700; font-size: 1.12rem; color: var(--navy); letter-spacing: -0.01em; }
.brand svg { width: 36px; height: 36px; flex: none; }
.navbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 0 14px;
  background: var(--white); color: var(--navy);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.86rem; font-weight: 700;
}
.navbtn.icon-only { padding: 0; width: 44px; }
.navbtn svg { width: 20px; height: 20px; }
.navbtn:hover { background: var(--navy-tint); }

.content { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; outline: none; }
.page { padding: 22px var(--pad) 28px; display: flex; flex-direction: column; gap: 16px; }
.page > * { margin: 0; }
.page .gap-lg { margin-top: 8px; }

/* ---------- Bottom action area (takes real space, never covers content) ---------- */
.bar {
  flex: none; display: flex; flex-direction: column; gap: 10px;
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  background: var(--white); border-top: 1px solid var(--border);
}
.bar-row { display: flex; gap: 10px; }
.bar-row > * { flex: 1; min-width: 0; padding-left: 12px; padding-right: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 10px 20px;
  border-radius: var(--r); border: 1px solid transparent;
  font-size: 1.02rem; font-weight: 700; line-height: 1.2; text-align: center;
  transition: background-color .15s, transform .05s;
}
.btn:active { transform: scale(0.99); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn-block { width: 100%; }
.btn-primary { background: var(--navy); color: #fff; min-height: 60px; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-primary:disabled { background: #A9AFBD; cursor: not-allowed; }
.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-green { background: var(--green-ink); color: #fff; }

/* ---------- Typography ---------- */
.page-head { display: flex; flex-direction: column; gap: 6px; }
.page-head h1 { font-size: 1.62rem; line-height: 1.2; color: var(--text); }
.page-head .sub { color: var(--text-2); font-size: 0.95rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 6px; }
.section-head h2 { font-size: 1.15rem; }
.link-btn { background: none; border: 0; color: var(--green-ink); font-weight: 700; font-size: 0.88rem; padding: 8px 4px; min-height: 44px; }
.muted { color: var(--text-2); }
.small { font-size: 0.88rem; }
.big-line { font-size: 1.05rem; font-weight: 700; line-height: 1.35; }
h2 { font-size: 1.12rem; }

/* ---------- Cards and rows ---------- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.card > h2 { margin-bottom: 12px; }
.list { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.list > * + *, .list > div > .row + .sizes { border-top: 1px solid var(--border); }
.row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 64px; padding: 12px 16px;
  background: none; border: 0; text-align: left; color: inherit;
}
button.row:hover { background: #FBFAF6; }
.tile {
  flex: none; display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--surface-2); color: var(--navy);
}
.tile svg { width: 22px; height: 22px; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 700; font-size: 1rem; line-height: 1.3; }
.row-desc { color: var(--text-2); font-size: 0.86rem; line-height: 1.35; }
.row-value { color: var(--text-2); font-size: 0.88rem; text-align: right; max-width: 45%; }
.chev { flex: none; color: var(--muted); }
.chev svg { width: 20px; height: 20px; }

.info {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r);
  background: var(--surface-2); color: var(--text); font-size: 0.9rem; line-height: 1.45;
}
.info svg { width: 22px; height: 22px; flex: none; color: var(--navy-soft); margin-top: 1px; }
.info.tint-green { background: var(--pale-green); }
.info.tint-green svg { color: var(--green-ink); }
.info.tint-peach { background: var(--peach); }
.disclaimer { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 0.82rem; line-height: 1.45; padding: 4px 2px; }
.disclaimer svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.notice { background: var(--pale-yellow); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r); background: var(--sage); color: var(--green-ink); font-weight: 700; font-size: 0.92rem; }
.banner svg { width: 22px; height: 22px; flex: none; }
.error-text { color: var(--bad); font-weight: 700; font-size: 0.92rem; }
.error-text:empty { display: none; }

/* ---------- Start screen ---------- */
.start-wrap {
  min-height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 36px;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 60% at 50% 0%, var(--pale-green) 0%, rgba(242, 247, 239, 0) 60%),
    var(--cream);
}
.start-logo { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.start-logo svg { width: 76px; height: 76px; }
.start-logo .name { font-size: 1.9rem; font-weight: 700; color: var(--navy); letter-spacing: -0.02em; }
.start-logo .tagline { color: var(--text-2); font-size: 0.95rem; max-width: 18rem; }
.start-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; padding: 26px 20px; border: 0; border-radius: var(--r-xl);
  background: var(--navy); color: #fff; box-shadow: var(--shadow-lg);
  font-size: 1.15rem; font-weight: 700; line-height: 1.35;
}
.start-btn svg { width: 30px; height: 30px; margin-bottom: 6px; padding: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); box-sizing: content-box; }
.start-btn:hover { background: var(--navy-dark); }

/* ---------- Home ---------- */
.greet h1 { font-size: 1.62rem; line-height: 1.2; }
.greet p { color: var(--text-2); font-size: 0.98rem; margin-top: 4px; }
.scan-card {
  position: relative; overflow: hidden;
  background: var(--navy); color: #fff; border-radius: var(--r-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 18px;
  box-shadow: 0 8px 24px rgba(29, 43, 79, 0.22);
}
.scan-head { display: flex; gap: 14px; align-items: flex-start; }
.scan-head .tile { width: 48px; height: 48px; background: var(--navy-soft); color: #fff; }
.scan-head h2 { font-size: 1.22rem; color: #fff; }
.scan-head p { color: #D5DAE6; font-size: 0.92rem; margin-top: 4px; line-height: 1.4; }
.scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scan-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 76px; padding: 10px 10px; border-radius: 14px;
  font-size: 0.98rem; font-weight: 700; line-height: 1.2; text-align: center;
}
.scan-btn svg { width: 22px; height: 22px; flex: none; }
.scan-btn.take { background: #fff; color: var(--navy); border: 1px solid #fff; }
.scan-btn.take:hover { background: var(--pale-green); }
.scan-btn.upload { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.75); }
.scan-btn.upload:hover { background: rgba(255, 255, 255, 0.08); }

.feature-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 16px 18px; border-radius: var(--r-lg);
  background: var(--white); border: 1px solid var(--border); color: inherit; box-shadow: var(--shadow-sm);
}
.feature-card:hover { border-color: #D3D7CF; }
.feature-card .tile { width: 48px; height: 48px; background: var(--sage); color: var(--green-ink); }
.feature-card .fc-title { font-weight: 700; font-size: 1.05rem; }
.feature-card .fc-desc { color: var(--text-2); font-size: 0.88rem; }

.recent { display: flex; flex-direction: column; }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 68px; }
.recent-item + .recent-item { border-top: 1px solid var(--border); }
.thumb { flex: none; width: 46px; height: 46px; border-radius: 12px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.thumb svg { width: 22px; height: 22px; }
.recent-item .row-title { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.empty { display: flex; gap: 14px; align-items: center; padding: 18px; }
.empty .tile { background: var(--pale-green); color: var(--green-ink); }
.today-chip { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px; background: var(--pale-yellow); font-size: 0.88rem; font-weight: 700; align-self: flex-start; }
.today-chip svg { width: 18px; height: 18px; }

/* verdict pill (small, used in lists) */
.vpill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 0.86rem; line-height: 1.2;
}
.vpill svg { width: 16px; height: 16px; }
.vpill.small { padding: 4px 10px; font-size: 0.78rem; }
.vpill.v-SAFE { background: var(--ok); color: #fff; }
.vpill.v-CAUTION { background: var(--warn); color: #111; }
.vpill.v-UNSAFE { background: var(--bad); color: #fff; }

/* ---------- Selection cards (language, health needs, allergies) ---------- */
.options { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 64px; padding: 14px 16px; text-align: left; color: inherit;
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--r);
  transition: border-color .15s, background-color .15s;
}
.option:hover { border-color: #CDD1C9; }
.option[aria-pressed="true"], .option[aria-checked="true"] { border-color: var(--navy); background: var(--navy-tint); }
.option .mark {
  flex: none; margin-left: auto; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid #C7CBD3; color: transparent; background: #fff;
}
.option .mark.round { border-radius: 999px; }
.option .mark svg { width: 16px; height: 16px; }
.option[aria-pressed="true"] .mark, .option[aria-checked="true"] .mark { background: var(--navy); border-color: var(--navy); color: #fff; }
.option .tile { width: 44px; height: 44px; }
.option[aria-pressed="true"] .tile { background: #fff; }
.lang-card { min-height: 84px; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 16px; }
.lang-card .mark { position: absolute; top: 12px; right: 12px; }
.lang-card .lang-name { font-size: 1.12rem; font-weight: 700; padding-right: 28px; }
.lang-card .lang-native { color: var(--text-2); font-size: 0.82rem; }
.chip { min-height: 56px; padding: 10px 14px; }
.chip .row-title { font-size: 0.95rem; }
.chip.wide { grid-column: span 2; }
.segment { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segment .option { min-height: 52px; padding: 10px 12px; }
.segment .row-title { font-size: 0.92rem; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .field .label { font-weight: 700; font-size: 0.92rem; }
.input { min-height: 54px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--border); background: #fff; font-size: 1rem; }
.input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(29, 43, 79, 0.12); }
.linkbox { word-break: break-all; font-size: 0.8rem; color: var(--text-2); padding: 12px; border-radius: 12px; background: var(--surface-2); }

/* ---------- Guide / tips ---------- */
.tips { display: flex; flex-direction: column; gap: 10px; }
.tip { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--r); background: var(--white); border: 1px solid var(--border); }
.tip .tile { background: var(--pale-green); color: var(--green-ink); }
.tip p { font-size: 0.95rem; }
.illus { display: grid; place-items: center; padding: 18px; border-radius: var(--r-lg); background: var(--pale-green); }
.illus svg { width: 100%; max-width: 300px; height: auto; }

/* ---------- Live camera ---------- */
.cam-page { flex: 1; display: flex; flex-direction: column; background: var(--navy-dark); color: #fff; min-height: 100%; }
.cam-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.cam-top h1 { font-size: 1.15rem; color: #fff; flex: 1; }
.cam-icon {
  display: grid; place-items: center; width: 48px; height: 48px; flex: none;
  border-radius: 999px; border: 0; background: rgba(255, 255, 255, 0.12); color: #fff;
}
.cam-icon svg { width: 22px; height: 22px; }
.cam-view { position: relative; flex: 1; margin: 0 16px; border-radius: var(--r-lg); overflow: hidden; background: #0E1730; min-height: 320px; }
.cam-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-frame { position: absolute; inset: 12% 10%; pointer-events: none; }
.cam-frame i { position: absolute; width: 34px; height: 34px; border: 4px solid #fff; }
.cam-frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.cam-frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.cam-frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.cam-frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.cam-frame.compare { inset: 22% 5%; }
.cam-frame.compare b { position: absolute; top: 8%; bottom: 8%; width: 0; border-left: 2px dashed rgba(255, 255, 255, 0.55); }
.cam-frame.compare b:nth-of-type(1) { left: 33.3%; }
.cam-frame.compare b:nth-of-type(2) { left: 66.6%; }
.cam-scanline { position: absolute; left: 10%; right: 10%; top: 12%; height: 2px; background: var(--lime); box-shadow: 0 0 12px rgba(185, 233, 75, 0.7); animation: scanline 2.6s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { top: 14%; } 50% { top: 84%; } }
.cam-hint { text-align: center; color: #D5DAE6; font-size: 0.92rem; padding: 12px 20px 0; }
.cam-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: #fff; font-size: 0.98rem; }
.cam-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); }
.cam-side { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; justify-self: center; background: none; border: 0; color: #fff; font-size: 0.8rem; font-weight: 700; min-width: 64px; }
.cam-side .cam-icon { width: 52px; height: 52px; }
.shutter {
  width: 78px; height: 78px; border-radius: 999px; border: 5px solid rgba(255, 255, 255, 0.35);
  background: #fff; background-clip: padding-box; display: grid; place-items: center; color: var(--navy);
}
.shutter:disabled { opacity: .45; }
.shutter svg { width: 28px; height: 28px; }

/* ---------- Photo preview ---------- */
.photo-frame { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px; }
.photo-frame img { display: block; width: 100%; max-height: 46vh; object-fit: contain; border-radius: 12px; background: var(--surface-2); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair figure { margin: 0; }
.pair figcaption { text-align: center; font-size: 0.84rem; color: var(--text-2); margin-top: 6px; font-weight: 700; }

/* ---------- Checking ---------- */
.checking { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 32px 28px; text-align: center; }
.scanbox { position: relative; width: 132px; height: 132px; border-radius: 32px; display: grid; place-items: center; background: var(--white); border: 1px solid var(--border); color: var(--navy); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 10px; }
.scanbox svg { width: 62px; height: 62px; }
.scanbox::after { content: ''; position: absolute; left: 14px; right: 14px; height: 3px; border-radius: 3px; background: var(--green); box-shadow: 0 0 10px rgba(79, 139, 98, .6); animation: scanbox 1.8s ease-in-out infinite; }
@keyframes scanbox { 0%, 100% { top: 18px; } 50% { top: 110px; } }
.checking h1 { font-size: 1.4rem; line-height: 1.25; }
.checking .sub { color: var(--text-2); font-size: 0.95rem; max-width: 20rem; }
.steps { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; text-align: left; }
.step { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.9rem; font-weight: 700; transition: color .3s; }
.step i { width: 10px; height: 10px; border-radius: 999px; background: #D5D6CF; flex: none; transition: background .3s; }
.step.on { color: var(--text); }
.step.on i { background: var(--green); }
.live-msg { color: var(--text-2); font-size: 0.9rem; min-height: 1.4em; }

.icon-circle { width: 72px; height: 72px; border-radius: 999px; display: grid; place-items: center; background: var(--peach); color: #A4521A; }
.icon-circle svg { width: 36px; height: 36px; }
.icon-circle.food { background: var(--pale-green); color: var(--green-ink); }

/* ---------- Single result ---------- */
.verdict-hero {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 22px; border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}
.verdict-hero .shape { flex: none; width: 74px; height: 74px; display: grid; place-items: center; border-radius: 22px; }
.verdict-hero .shape svg { width: 46px; height: 46px; }
.verdict-hero .eyebrow { font-size: 0.82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.verdict-hero .word { font-size: 3rem; line-height: 1; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 6px; }
.verdict-hero .say { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.v-SAFE.verdict-hero, .v-SAFE.rec-hero { background: var(--ok); color: #fff; }
.v-CAUTION.verdict-hero, .v-CAUTION.rec-hero { background: var(--warn); color: #111; }
.v-UNSAFE.verdict-hero, .v-UNSAFE.rec-hero { background: var(--bad); color: #fff; }
.v-SAFE .shape, .v-UNSAFE .shape { background: rgba(255, 255, 255, 0.16); }
.v-CAUTION .shape { background: rgba(0, 0, 0, 0.07); }

.product { display: flex; gap: 14px; align-items: center; }
.product img { width: 68px; height: 68px; flex: none; border-radius: 14px; object-fit: cover; background: var(--surface-2); }
.product .pname { font-size: 1.12rem; font-weight: 700; line-height: 1.25; }
.product .porig { color: var(--text-2); font-size: 0.88rem; margin-top: 2px; }
.lang-tag { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 10px; border-radius: 999px; background: var(--sage); color: var(--green-ink); font-size: 0.78rem; font-weight: 700; }
.lang-tag svg { width: 14px; height: 14px; }

.facts .facts-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.facts .facts-head h2 { font-size: 1.05rem; margin: 0; }
.facts .facts-head span { color: var(--text-2); font-size: 0.82rem; }
.fact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fact-grid.two { grid-template-columns: 1fr 1fr; }
.fact { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 14px; background: var(--cream); border: 1px solid var(--border); min-width: 0; }
.fact-label { color: var(--text-2); font-size: 0.8rem; font-weight: 700; }
.fact-value { font-size: 1.18rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.fact-sub { color: var(--text-2); font-size: 0.78rem; }
.meter { height: 6px; border-radius: 6px; background: #E5E4DD; overflow: hidden; margin-top: 4px; }
.meter i { display: block; height: 100%; border-radius: 6px; }
.fact-level { align-self: flex-start; padding: 2px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; margin-top: 2px; }
.lv-low { background: var(--ok-tint); color: var(--ok); }
.lv-medium { background: var(--pale-yellow); color: #7A5600; }
.lv-high { background: var(--bad-tint); color: var(--bad); }
.meter .lv-low { background: var(--green); }
.meter .lv-medium { background: var(--orange); }
.meter .lv-high { background: var(--bad); }
.facts .dv-note { margin-top: 10px; color: var(--text-2); font-size: 0.78rem; line-height: 1.4; }

.sugar-card { background: var(--pale-green); border: 1px solid #DCE8D8; }
.sugar-card h2 { font-size: 1.05rem; }
.sugar-big { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 10px; }
.sugar-big b { font-size: 2.2rem; line-height: 1; color: var(--navy); }
.sugar-big span { font-weight: 700; color: var(--text-2); }
.spoons { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.spoons span { width: 18px; height: 36px; }
.spoons span svg { width: 100%; height: 100%; }
.spoons.mini span { width: 12px; height: 24px; }
.sugar-card .sugar-line { font-weight: 700; }
.sugar-card .sugar-ctx { color: var(--text-2); font-size: 0.84rem; margin-top: 6px; }

.section { display: flex; flex-direction: column; gap: 10px; }
.section > h2 { font-size: 1.1rem; }
.points { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.point { display: flex; align-items: center; gap: 12px; padding: 13px 16px; min-height: 58px; font-weight: 700; font-size: 0.95rem; line-height: 1.35; }
.point + .point { border-top: 1px solid var(--border); }
.point .dot { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.point .dot svg { width: 18px; height: 18px; }
.dot.d-good, .dot.d-SAFE { background: var(--ok-tint); color: var(--ok); }
.dot.d-CAUTION { background: var(--pale-yellow); color: #7A5600; }
.dot.d-UNSAFE { background: var(--bad-tint); color: var(--bad); }

.expander-body { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 16px; }
.swap { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--pale-green); }
.swap b { color: var(--green-ink); }

.ask { display: flex; flex-direction: column; gap: 12px; }
.ask-head { display: flex; gap: 12px; align-items: flex-start; }
.ask-head .tile { background: var(--peach); color: #A4521A; }
.ask-head h2 { font-size: 1.02rem; }
.ask-actions { display: flex; gap: 10px; }
.ask-actions > * { flex: 1; }
.listening { display: flex; gap: 12px; align-items: center; font-weight: 700; }
.listening svg { width: 24px; height: 24px; }
.mic-dot { width: 14px; height: 14px; border-radius: 999px; background: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.qa { display: flex; flex-direction: column; gap: 8px; }
.qa .q { color: var(--text-2); font-size: 0.9rem; }
.qa .a { font-weight: 700; font-size: 1rem; }

.test-card { background: var(--pale-yellow); border-color: #F0E1A6; }

/* ---------- Compare result ---------- */
.rec-hero { border-radius: var(--r-xl); padding: 20px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); }
.rec-top { display: flex; gap: 14px; align-items: center; }
.rec-hero .shape { flex: none; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; }
.rec-hero .shape svg { width: 36px; height: 36px; }
.rec-hero .eyebrow { font-size: 0.8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.rec-title { font-size: 1.45rem; line-height: 1.2; margin-top: 2px; }
.slots { display: flex; gap: 8px; }
.slot { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; border-radius: 12px; font-weight: 700; font-size: 0.9rem; border: 1.5px solid currentColor; opacity: .7; }
.slot svg { width: 18px; height: 18px; }
.slot.picked { opacity: 1; background: #fff; color: var(--text); border-color: #fff; }
.pack { display: flex; flex-direction: column; gap: 12px; }
.pack.best { border: 2px solid var(--green); box-shadow: 0 0 0 4px var(--sage); }
.pack-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.pill svg { width: 15px; height: 15px; }
.pill-pos { background: var(--surface-2); color: var(--navy); }
.pill-best { background: var(--green-ink); color: #fff; }
.pack h2 { font-size: 1.1rem; line-height: 1.3; }
.pack .pack-verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tsp { display: flex; flex-direction: column; gap: 6px; }
.tsp .spoons { margin: 0; }
.pack .facts { padding: 0; border: 0; box-shadow: none; }
.pack-reason { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; font-weight: 700; }
.pack-reason .dot { width: 28px; height: 28px; border-radius: 8px; }
.pack-reason .dot svg { width: 16px; height: 16px; }

/* ---------- Help / settings ---------- */
.sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 16px 16px; }
.sizes .option { justify-content: center; min-height: 54px; font-weight: 700; padding: 8px; }
.switch { flex: none; width: 50px; height: 30px; border-radius: 999px; background: #CDD0D6; position: relative; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
[aria-checked="true"] > .switch { background: var(--green-ink); }
[aria-checked="true"] > .switch::after { transform: translateX(20px); }
.group-label { font-size: 0.8rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; margin: 6px 4px -6px; }
:lang(zh) .group-label, :lang(ta) .group-label { text-transform: none; letter-spacing: 0; }
.version { align-self: center; background: none; border: 0; color: var(--muted); font-size: 0.8rem; padding: 12px; min-height: 44px; }
.test-list .tile { background: var(--pale-yellow); }

/* ---------- Small phones ---------- */
@media (max-width: 380px) {
  :root { --pad: 16px; }
  .page-head h1, .greet h1 { font-size: 1.45rem; }
  .verdict-hero { padding: 18px; gap: 14px; }
  .verdict-hero .shape { width: 60px; height: 60px; }
  .verdict-hero .word { font-size: 2.5rem; }
  .fact-grid { grid-template-columns: 1fr 1fr; }
  .scan-btn { font-size: 0.9rem; }
}
/* long words: Tamil and Malay */
:lang(ta) .page-head h1, :lang(ta) .greet h1 { font-size: 1.32rem; }
:lang(ta) .verdict-hero .word { font-size: 2.1rem; }
:lang(ta) .rec-title { font-size: 1.15rem; }
:lang(ta) .btn, :lang(ta) .scan-btn { font-size: 0.88rem; }
:lang(ta) .row-title, :lang(ta) .option .row-title { font-size: 0.92rem; }
:lang(ta) .lang-card .lang-name, :lang(ta) .feature-card .fc-title { font-size: 0.98rem; }
:lang(ms) .verdict-hero .word { font-size: 2.6rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.slot, .pill-pos { text-transform: capitalize; }
.btn-family { background: var(--bad-tint); color: var(--bad); border-color: #F1C4CB; }
.btn-family:hover { background: #F8D7DC; }
html:lang(ta) { font-size: calc(var(--base) * 0.88); }
:lang(ta) .scan-head h2 { font-size: 1.05rem; }
:lang(ta) .scan-head p, :lang(ta) .feature-card .fc-desc { font-size: 0.82rem; }
.swaps { background: var(--pale-green); border-color: #DCE8D8; display: flex; flex-direction: column; gap: 12px; }
.swaps-head { display: flex; align-items: center; gap: 12px; }
.swaps-head h2 { flex: 1; margin: 0; font-size: 1.05rem; }
.swaps-head .tile { background: #fff; color: var(--green-ink); }
.swap-list { display: flex; flex-direction: column; gap: 8px; }
.swaps .swap { background: #fff; border: 1px solid #DCE8D8; }
