/* Layout: one phone-width column floating on a soft lavender/periwinkle field. Frosted-glass cards,
   a burnt-orange scan orb as the hero, verdicts drawn as score rings. */
:root {
  --bg: #ECEEF6;
  --bg-2: #E2E5F1;
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-edge: rgba(255, 255, 255, .9);
  --ink: #2E2311;
  --ink-2: #5E534C;
  --muted: #857971;
  --line: rgba(46, 35, 17, .09);
  --peri: #9CA9D4;
  --peri-soft: #CBD3EE;
  --accent: #C84614;
  --accent-2: #E8743F;
  --accent-soft: #F7E0D5;
  --on-accent: #FFFFFF;
  --good: #2C9A5E;  --good-soft: rgba(44, 154, 94, .14);
  --mid: #D2920E;   --mid-soft: rgba(210, 146, 14, .16);
  --bad: #D23F2C;   --bad-soft: rgba(210, 63, 44, .13);
  --shadow: 0 18px 40px -22px rgba(46, 35, 17, .35), 0 2px 6px -2px rgba(46, 35, 17, .08);
  --blob-a: #A9B5E2; --blob-b: #F2C4AE; --blob-c: #C9D0EE;
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16141B; --bg-2: #1D1A23;
    --glass: rgba(44, 40, 52, .55); --glass-strong: rgba(36, 32, 43, .92); --glass-edge: rgba(255, 255, 255, .08);
    --ink: #F3EEEA; --ink-2: #CFC6BF; --muted: #A1968F; --line: rgba(255, 255, 255, .08);
    --peri: #8291C8; --peri-soft: #343B57;
    --accent: #F0692F; --accent-2: #FF9563; --accent-soft: rgba(240, 105, 47, .18); --on-accent: #1A1008;
    --good: #4FD28A; --good-soft: rgba(79, 210, 138, .14); --mid: #F2BE45; --mid-soft: rgba(242, 190, 69, .15); --bad: #FF6E5C; --bad-soft: rgba(255, 110, 92, .14);
    --shadow: 0 18px 40px -20px rgba(0, 0, 0, .8);
    --blob-a: #3A4373; --blob-b: #5C3427; --blob-c: #2C3150;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16141B; --bg-2: #1D1A23;
  --glass: rgba(44, 40, 52, .55); --glass-strong: rgba(36, 32, 43, .92); --glass-edge: rgba(255, 255, 255, .08);
  --ink: #F3EEEA; --ink-2: #CFC6BF; --muted: #A1968F; --line: rgba(255, 255, 255, .08);
  --peri: #8291C8; --peri-soft: #343B57;
  --accent: #F0692F; --accent-2: #FF9563; --accent-soft: rgba(240, 105, 47, .18); --on-accent: #1A1008;
  --good: #4FD28A; --good-soft: rgba(79, 210, 138, .14); --mid: #F2BE45; --mid-soft: rgba(242, 190, 69, .15); --bad: #FF6E5C; --bad-soft: rgba(255, 110, 92, .14);
  --shadow: 0 18px 40px -20px rgba(0, 0, 0, .8);
  --blob-a: #3A4373; --blob-b: #5C3427; --blob-c: #2C3150;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--f-body);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
svg { display: block; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); }
.small { font-size: .84rem; }

/* glass surface */
.glass, .health-card, .rcard, .how, .pill, .fam .avatar, .hero-icon, .toast {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--glass-edge);
}

/* ============ HERO ============ */
.hero { position: relative; isolation: isolate; overflow: hidden; }
.blobs { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.blobs span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .85; }
.blobs .b1 { width: 380px; height: 380px; background: var(--blob-a); top: -120px; left: -110px; animation: drift1 18s ease-in-out infinite alternate; }
.blobs .b2 { width: 300px; height: 300px; background: var(--blob-b); top: 120px; right: -120px; animation: drift2 22s ease-in-out infinite alternate; }
.blobs .b3 { width: 420px; height: 420px; background: var(--blob-c); top: 520px; left: 10%; animation: drift1 26s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(60px, 40px) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-50px, 60px) scale(.92); } }

.hero-inner {
  max-width: 560px; margin: 0 auto;
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
  padding-block: 10px 6px;
}
.top { display: flex; align-items: center; justify-content: space-between; padding-block: 6px 18px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 32px; height: 32px; filter: drop-shadow(0 6px 10px rgba(200, 70, 20, .3)); }
.wordmark { font: 800 1.45rem/1 var(--f-display); letter-spacing: -0.025em; }
.wordmark b { color: var(--accent); font-weight: 800; }
.hero-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); box-shadow: var(--shadow); }
.hero-icon svg { width: 22px; height: 22px; }

.greet-eyebrow { margin: 0; color: var(--ink-2); font-size: 1rem; }
.greet { margin: 0; font: 800 clamp(2.3rem, 10vw, 3rem)/1.02 var(--f-display); letter-spacing: -0.035em; text-wrap: balance; overflow-wrap: anywhere; }

.family { display: flex; gap: 12px; overflow-x: auto; padding: 16px 2px 4px; margin-inline: -2px; scrollbar-width: none; }
.family::-webkit-scrollbar { display: none; }
.fam { flex: none; display: grid; justify-items: center; gap: 6px; border: 0; background: none; padding: 0; width: 64px; color: var(--ink-2); font-size: .8rem; font-weight: 700; }
.fam span:last-child { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fam.on { color: var(--ink); }
.fam .avatar { width: 56px; height: 56px; font-size: 1.05rem; transition: transform .2s ease, box-shadow .2s ease; }
.fam.on .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5.5px var(--accent); transform: scale(1.04); }
.fam .avatar.ghost { background: transparent; border: 2px dashed var(--peri); color: var(--ink-2); }
.fam .avatar.ghost svg { width: 22px; height: 22px; }

.avatar {
  --av: #2F6BFF; position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font: 800 .95rem/1 var(--f-display); color: #fff;
  background: var(--av) !important; border: 0 !important;
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, .15), 0 6px 14px -6px var(--av);
}
.avatar b { font-weight: 800; }
.avatar > svg { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; padding: 3px; border-radius: 50%; background: var(--glass-strong); color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.avatar.lg { width: 54px; height: 54px; font-size: 1.15rem; }
.avatar.sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar.sm > svg { width: 15px; height: 15px; padding: 2px; right: -3px; bottom: -3px; }
.avatar.xs { width: 22px; height: 22px; font-size: .6rem; display: inline-grid; vertical-align: -6px; margin-right: 4px; box-shadow: none; }
.avatar.xs > svg { display: none; }

/* scan orb */
.scan-stage { display: grid; justify-items: center; padding-block: 18px 8px; }
.scan-orb {
  position: relative; width: 196px; height: 196px; border-radius: 50%; border: 0; padding: 0;
  background: radial-gradient(circle at 32% 28%, var(--accent-2), var(--accent) 62%);
  color: var(--on-accent); display: grid; place-items: center;
  box-shadow: 0 26px 50px -18px rgba(200, 70, 20, .65), inset 0 2px 0 rgba(255,255,255,.35), inset 0 -10px 24px rgba(0,0,0,.18);
  transition: transform .15s ease;
}
.scan-orb:active { transform: scale(.96); }
.scan-orb > .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: pulse 3s cubic-bezier(.2,.6,.3,1) infinite; pointer-events: none; }
.scan-orb > .r2 { animation-delay: 1s; } .scan-orb > .r3 { animation-delay: 2s; }
@keyframes pulse { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.55); opacity: 0; } }
.orb-core { position: relative; display: grid; justify-items: center; gap: 4px; }
.orb-core svg { width: 62px; height: 62px; }
.orb-core b { font: 800 1.35rem/1 var(--f-display); letter-spacing: -0.01em; }
.orb-hint { margin: 16px 0 0; color: var(--ink-2); font-size: .92rem; text-align: center; max-width: 30ch; }
.hero-alts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: .92rem; color: var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.pill svg { width: 18px; height: 18px; }

/* ============ MAIN ============ */
.app {
  max-width: 560px; margin: 0 auto; display: grid; gap: 22px;
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
  padding-block: 18px 40px;
}
.health-card { border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.hc-head { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.hc-titles { min-width: 0; }
.hc-titles h2 { margin: 0; font: 800 1.2rem/1.2 var(--f-display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.hc-titles p { margin: 2px 0 0; }
.cond-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tile { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 6px 6px 12px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--line); font-size: .88rem; font-weight: 700; }
.tile.rec { background: var(--accent-soft); border-color: transparent; }
.tile.auto { background: var(--peri-soft); border-color: transparent; padding-right: 12px; }
.tile-ico svg { width: 15px; height: 15px; color: var(--accent); }
.tile.auto .tile-ico svg { color: var(--ink); }
.tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile button { border: 0; background: transparent; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: none; }
.tile button:hover { background: var(--line); }
.empty-tiles { margin: 0; color: var(--ink-2); font-size: .93rem; }
.hc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.saved-note { display: flex; gap: 8px; align-items: center; margin: 14px 0 0; color: var(--muted); font-size: .8rem; }
.saved-note svg { width: 16px; height: 16px; flex: none; color: var(--good); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 16px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--glass-strong); color: var(--ink); font-weight: 700; text-align: center;
}
.btn svg { width: 19px; height: 19px; flex: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); box-shadow: 0 10px 22px -12px rgba(200, 70, 20, .8); }
.btn.primary-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: .9rem; border-radius: 12px; }
.btn.wide { width: 100%; margin-top: 14px; }
.btn[disabled] { opacity: .55; }
.danger-text { color: var(--bad); }
.link { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 2px; }
.status { margin: -8px 4px 0; min-height: 0; font-size: .9rem; color: var(--muted); }
.status:empty { display: none; }
.status.error { color: var(--bad); }

.row-between { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-title { margin: 0; font: 800 1.15rem/1.2 var(--f-display); letter-spacing: -0.01em; }
.small-title { font-size: 1rem; margin-top: 22px; }

/* recent rail */
.recent-rail { list-style: none; margin: 0 -18px; padding: 4px 18px 14px; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.recent-rail::-webkit-scrollbar { display: none; }
.recent-rail li { flex: none; scroll-snap-align: start; }
.rcard { width: 158px; min-height: 168px; border-radius: 20px; padding: 14px; display: grid; align-content: start; gap: 8px; text-align: left; color: var(--ink); box-shadow: var(--shadow); }
.rc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.rc-pct { font: 700 1.5rem/1 var(--f-mono); letter-spacing: -0.03em; color: var(--v); font-variant-numeric: tabular-nums; }
.rc-pct small { font-size: .8rem; }
.rc-name { font-weight: 700; font-size: .95rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rc-sub { font-size: .76rem; color: var(--muted); }
.tag-example { display: inline-block; font: 700 .6rem/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; padding: 3px 6px; border-radius: 6px; background: var(--peri-soft); color: var(--ink-2); margin-right: 5px; vertical-align: 1px; }

/* verdict colors */
.v-good { --v: var(--good); --vs: var(--good-soft); }
.v-medium { --v: var(--mid); --vs: var(--mid-soft); }
.v-bad { --v: var(--bad); --vs: var(--bad-soft); }

/* score ring */
.ring { --C: 263.9; --off: 0; position: relative; display: inline-grid; place-items: center; width: 46px; height: 46px; flex: none; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .trk { stroke: var(--vs); }
.ring .prg { stroke: var(--v); stroke-linecap: round; stroke-dasharray: var(--C); stroke-dashoffset: var(--off); transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.2,1); }
.ring-in { position: relative; color: var(--v); display: grid; place-items: center; }
.ring-in svg { position: static; transform: none; width: 20px; height: 20px; }
.ring.sm { width: 42px; height: 42px; }
.ring.big { width: 112px; height: 112px; }
.ring.big circle { stroke-width: 8; }
.ring.big .ring-in { width: 62px; height: 62px; border-radius: 50%; background: var(--v); color: #fff; box-shadow: 0 10px 20px -8px var(--v); }
.ring.big .ring-in svg { width: 34px; height: 34px; }
@media (prefers-reduced-motion: reduce) { .ring .prg { transition: none; } }

/* how */
.how { border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.verdict-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.vt { display: grid; justify-items: center; gap: 4px; padding: 14px 6px; border-radius: 16px; background: var(--vs); text-align: center; }
.vt-mark { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--v); color: #fff; }
.vt-mark svg { width: 22px; height: 22px; }
.vt b { font: 700 .9rem var(--f-mono); color: var(--v); margin-top: 4px; }
.vt span:last-child { font-size: .78rem; color: var(--ink-2); line-height: 1.2; }
.how-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; font-size: .92rem; color: var(--ink-2); }
.how-list li { padding-left: 22px; position: relative; }
.how-list li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.how-list b { color: var(--ink); }
.fineprint { font-size: .78rem; color: var(--muted); line-height: 1.45; margin: 0; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50;
  width: min(92vw, 480px); padding: 12px 16px; border-radius: 16px; background: var(--glass-strong); box-shadow: var(--shadow); font-weight: 700; font-size: .92rem;
}
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ CAMERA ============ */
dialog.camera { width: 100%; height: 100%; max-width: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: #000; color: #fff; overflow: hidden; }
dialog.camera::backdrop { background: #000; }
#reader { position: absolute; inset: 0; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
#reader > div, #reader canvas, #reader img { display: none !important; }
.cam-frame { position: absolute; left: 9%; right: 9%; top: 37%; height: 24%; z-index: 2; 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 .laser { position: absolute; left: 6%; right: 6%; top: 50%; height: 3px; border-radius: 3px; background: #FF7A45; box-shadow: 0 0 16px 3px rgba(255, 122, 69, .8); opacity: 0; }
.camera.live .laser { opacity: 1; animation: sweep 1.6s ease-in-out infinite alternate; }
@keyframes sweep { from { top: 10%; } to { top: 90%; } }
@media (prefers-reduced-motion: reduce) { .camera.live .laser { animation: none; } }
.cam-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px)); background: linear-gradient(rgba(0,0,0,.55), transparent); }
.cam-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255,255,255,.18); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; }
.cam-btn svg { width: 22px; height: 22px; }
.cam-for { font-weight: 700; font-size: .95rem; }
.cam-bottom { position: absolute; bottom: 0; left: 0; right: 0; z-index: 3; display: grid; justify-items: center; gap: 12px; padding: 30px 16px calc(28px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, rgba(0,0,0,.7)); text-align: center; }
.cam-bottom p { margin: 0; font-weight: 700; max-width: 32ch; }
.cam-alts { display: flex; gap: 10px; }
.cam-alts .pill { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.25); box-shadow: none; }

/* ============ SHEETS ============ */
dialog.sheet {
  width: min(560px, 100%); max-width: 100%; max-height: 92dvh; margin: auto auto 0; padding: 0 0 calc(22px + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--glass-edge); border-radius: 28px 28px 0 0; background: var(--glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5);
  color: var(--ink); box-shadow: var(--shadow); overflow: auto;
}
dialog.sheet > *, dialog.sheet form > * { margin-left: 20px; margin-right: 20px; }
dialog.sheet form { margin: 0; }
dialog.sheet::backdrop { background: rgba(30, 24, 18, .38); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.sheet[open] { animation: rise .3s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { transform: translateY(48px); opacity: .3; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }
@media (min-width: 620px) { dialog.sheet { margin: auto; border-radius: 28px; } }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 18px 10px; background: inherit; }
dialog.sheet > .sheet-head, dialog.sheet form > .sheet-head { margin: 0; padding-inline: 20px; background: var(--glass-strong); }
.sheet-head h2 { font: 800 1.35rem/1.2 var(--f-display); margin: 0; letter-spacing: -0.01em; }
.eyebrow { font: 700 .72rem/1.2 var(--f-body); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0; }

.field-label { display: block; font-weight: 700; font-size: .9rem; margin-block: 14px 6px; }
.field { width: 100%; min-height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); padding: 12px 14px; font-size: 1rem; }
textarea.field { resize: vertical; line-height: 1.4; }
.field.mono { font-family: var(--f-mono); letter-spacing: .06em; font-size: 1.15rem; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border-radius: 14px; background: var(--bg); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: grid; place-items: center; min-height: 42px; border-radius: 11px; font-weight: 700; font-size: .88rem; text-align: center; padding: 4px; cursor: pointer; color: var(--ink-2); }
.seg input:checked + span { background: var(--glass-strong); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.sw { position: relative; }
.sw input { position: absolute; opacity: 0; inset: 0; }
.sw span { display: block; width: 36px; height: 36px; border-radius: 50%; background: var(--av); cursor: pointer; }
.sw input:checked + span { box-shadow: 0 0 0 3px var(--glass-strong), 0 0 0 5.5px var(--av); }
.sw input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 4px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.picker-hint { margin-block: 6px 10px; color: var(--ink-2); font-size: .9rem; }

.profile-list { list-style: none; padding: 0; display: grid; gap: 8px; margin-top: 4px; margin-bottom: 0; }
.pl-row { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg); text-align: left; }
.pl-row.on { border-color: var(--accent); }
.pl-text { min-width: 0; }
.pl-text b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-text small { color: var(--muted); }
.pl-edit { color: var(--accent); font-weight: 700; font-size: .9rem; padding: 6px 4px; }

/* picker */
.search { position: relative; margin-block: 4px 6px; }
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; color: var(--muted); }
.search input { width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); padding: 0 14px 0 44px; font-size: 1rem; }
.cond-list { display: grid; gap: 2px; padding-bottom: 12px; }
.cond-group { font: 700 .72rem/1 var(--f-body); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 16px 4px 6px; }
.cond-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; }
.cond-opt:hover { background: var(--line); }
.cond-opt .box { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; background: var(--bg); }
.cond-opt[aria-selected="true"] .box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cond-opt .box svg { width: 14px; height: 14px; opacity: 0; }
.cond-opt[aria-selected="true"] .box svg { opacity: 1; }
.cond-opt .co-text { min-width: 0; }
.cond-opt .co-name { font-weight: 700; }
.cond-opt .co-alias { display: block; font-size: .8rem; color: var(--muted); }
.cond-opt.custom .co-name { color: var(--accent); }

/* record */
.privacy { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; background: var(--good-soft); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; }
.privacy svg { width: 24px; height: 24px; color: var(--good); margin-top: 2px; }
.privacy p { margin: 0; font-size: .9rem; line-height: 1.45; }
.drop { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 26px 16px; cursor: pointer; border: 2px dashed var(--peri); border-radius: 20px; background: var(--bg); }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop svg { width: 34px; height: 34px; color: var(--accent); }
.drop small { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.paste { margin-top: 12px; }
.paste summary { cursor: pointer; font-weight: 700; color: var(--accent); padding-block: 8px; }
.find-group { font: 700 .72rem/1 var(--f-body); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 14px 2px 6px; }
.finding { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); margin-bottom: 6px; cursor: pointer; background: var(--bg); }
.finding:has(input:checked) { border-color: var(--accent); }
.finding input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); }
.finding b { display: block; }
.finding small { display: block; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.finding .weak { display: inline-block; font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mid); margin-left: 6px; }
.finding .muted-tag { color: var(--muted); }
.record-saved { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 10px; }
.record-saved p { margin: 0 0 4px; }
.link.danger { color: var(--bad); padding-left: 0; }

/* ============ RESULT ============ */
.product { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center; margin-top: 4px; }
.thumb { width: 72px; height: 72px; border-radius: 18px; background: var(--bg); overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.thumb svg { width: 32px; height: 32px; }
.product-meta { min-width: 0; }
.product-meta h2 { font: 800 1.2rem/1.25 var(--f-display); margin: 0; overflow-wrap: anywhere; text-wrap: balance; }
.product-meta p { margin: 2px 0 0; }

.family-strip { display: flex; gap: 8px; overflow-x: auto; margin-top: 14px; padding-bottom: 2px; scrollbar-width: none; align-items: center; }
.family-strip:empty { display: none; }
.fs-label { flex: none; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.fs { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; border-radius: 999px; border: 1.5px solid transparent; background: var(--vs); }
.fs.on { border-color: var(--v); }
.fs-name { font-weight: 700; font-size: .85rem; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-mark { color: var(--v); } .fs-mark svg { width: 16px; height: 16px; }
.fs-pct { font: 700 .85rem var(--f-mono); color: var(--v); }

.verdict { margin-top: 14px; padding: 18px; border-radius: 24px; background: var(--vs); display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.mark { display: grid; place-items: center; }
.reading { min-width: 0; }
.pct { font-weight: 700; font-size: 3.2rem; line-height: 1; color: var(--v); font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
.pct small { font-size: 1.4rem; margin-left: 2px; }
.verdict-word { font: 800 1.15rem/1.2 var(--f-display); margin-top: 4px; overflow-wrap: anywhere; }
#rFor { color: var(--ink-2); margin-top: 4px; }
.meter { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--bad) 0 40%, var(--mid) 40% 70%, var(--good) 70%); position: relative; }
.meter span { position: absolute; top: 50%; width: 20px; height: 20px; border-radius: 50%; background: var(--glass-strong); border: 4px solid var(--ink); translate: -50% -50%; transition: left .6s ease-out; }

.per-cond { display: grid; gap: 6px; margin-top: 14px; }
.per-cond:empty { display: none; }
.pc-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); text-align: left; width: 100%; }
.pc-row[aria-pressed="true"] { border-color: var(--v); }
.mini { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--vs); color: var(--v); }
.mini svg { width: 18px; height: 18px; }
.pc-name { min-width: 0; font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-pct { font: 700 .95rem var(--f-mono); color: var(--v); font-variant-numeric: tabular-nums; }

#rWhyTitle { margin-top: 20px; }
.reasons { list-style: none; padding: 0; margin-top: 8px; display: grid; gap: 8px; }
.reason { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; padding: 11px 12px; border-radius: 14px; background: var(--bg); }
.reason .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--vs); color: var(--v); }
.reason .dot svg { width: 14px; height: 14px; }
.reason b { display: block; }
.reason .found { font-size: .82rem; color: var(--muted); }
.ingredients { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.ingredients summary { font-weight: 700; cursor: pointer; padding-block: 6px; }
.ingredients p { font-size: .88rem; color: var(--muted); margin: 6px 0 0; overflow-wrap: anywhere; }
.result-sheet .fineprint { margin-top: 14px; }
.result-sheet .fineprint a { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .blobs span, .scan-orb > .ring { animation: none; }
}

/* fixes */
.app > *, .hero-inner > * { min-width: 0; }
.scan-orb > .ring { width: 100%; height: 100%; display: block; }
.fam .avatar.ghost { background: transparent !important; border: 2px dashed var(--peri) !important; box-shadow: none; color: var(--ink-2); }
.fam .avatar.ghost > svg { position: static; width: 22px; height: 22px; padding: 0; background: none; box-shadow: none; color: var(--ink-2); }
