/* /compare/ (16 Nov 2026). Sits on top of the aisle-page styles that tools/build-pages.py inlines (colours, fonts, .btn, .ns, .grid).
   Phones first: two products fit side by side at 375px; the row label becomes a full-width line above each row's values. */
[hidden]{display:none!important}
:root{--good:#1f7a52;--chip:#eef2ee;--diff:#b7791f}
@media (prefers-color-scheme:dark){:root{--good:#4cc38a;--chip:#25302a;--diff:#e0a84a}}
.crumbs{margin-top:14px}
.chead{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-wrap:wrap}
.chead h1{font-size:clamp(24px,5vw,38px);margin:2px 0 8px}
.share{display:flex;gap:14px}
.lnk{background:none;border:0;padding:6px 0;color:var(--accent);font:600 15px var(--body);text-decoration:underline;cursor:pointer}
.bar{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 10px}
.bar .btn{border:1.5px solid var(--brand);cursor:pointer;font:700 16px var(--body);min-height:46px}
.bar .btn.ghost{border-color:var(--line);background:var(--surface)}
.bar svg{flex:none}
@media (max-width:480px){.bar .btn{flex:1 1 0;justify-content:center;padding:10px 12px;font-size:15px}}
.status{min-height:0;margin:4px 0;color:var(--muted);font-size:15px}.status:empty{display:none}.status.err{color:#c2412d}

/* Add a product */
.addbox{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:12px 14px;margin:0 0 14px}
.addrow,.codeform{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end}
.codeform{margin-top:10px}
.fld{display:flex;flex-direction:column;gap:3px;font-size:13px;color:var(--muted);font-weight:600}.fld.grow{flex:1 1 220px}
.fld input,.fld select{min-height:44px;padding:0 12px;border-radius:10px;border:1.5px solid var(--line);background:var(--bg);color:var(--ink);font:16px var(--body)}
.codeform .btn{min-height:44px;border:1.5px solid var(--line);cursor:pointer;font:700 15px var(--body);background:var(--surface)}
.results{list-style:none;margin:8px 0 0;padding:0;max-height:320px;overflow:auto}
.results li{display:flex;align-items:center;gap:10px;padding:6px 0;border-bottom:1px solid var(--line);font-size:15px}
.results li:last-child{border-bottom:0}
.results .rt{flex:1;min-width:0}.results .rt b{display:block;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.results .rt span{color:var(--muted);font-size:13px}
.results button,.recent button{min-height:38px;padding:0 12px;border-radius:999px;border:1.5px solid var(--accent);background:none;color:var(--accent);font:700 14px var(--body);cursor:pointer}
.results button:disabled{opacity:.5;cursor:default}
.results .none{color:var(--muted)}

/* Key differences */
.keydiff{background:var(--tint);border-radius:14px;padding:12px 16px 10px;margin:4px 0 14px}
.keydiff h2{margin:0 0 4px;font-size:20px}
.keydiff ul{margin:0;padding-left:20px}.keydiff li{margin:3px 0;font-size:16px;line-height:1.4}
.keydiff li b{font-weight:700}
.kdnote{font-size:13px;color:var(--muted);margin:6px 0 0}
@media (max-width:480px){.keydiff{padding:10px 12px 8px}.keydiff li{font-size:15px}}

.opts{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 16px;margin:0 0 8px;font-size:14px;color:var(--muted)}
.toggle{display:inline-flex;align-items:center;gap:8px;font-weight:700;color:var(--ink);font-size:15px;min-height:40px;cursor:pointer}
.toggle input{width:20px;height:20px;accent-color:var(--brand)}
.legend{display:inline-flex;align-items:center;gap:4px}
i.dot{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:2px;vertical-align:middle;flex:none}
i.dot.low{background:var(--tl-low)}i.dot.med{background:var(--tl-med)}i.dot.high{background:var(--tl-high)}

/* The table. Wide screens: classic grid of row labels x products, product header sticky at the top. */
.ctw{position:relative;container:ct/inline-size;border:1px solid var(--line);border-radius:14px;background:var(--surface)}
.ctw:empty{display:none}
.ctw:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
table.ct{border-collapse:separate;border-spacing:0;width:100%;font-size:15px;table-layout:fixed}
.ct th,.ct td{padding:9px 12px;text-align:left;vertical-align:top;border-bottom:1px solid var(--line);overflow-wrap:anywhere}
.ct thead th,.ct thead td{position:sticky;top:0;z-index:2;background:var(--surface);border-bottom:1.5px solid var(--line);vertical-align:bottom}
.ct thead td.corner{width:170px}
.ct thead th{font-weight:400;color:var(--ink)}
.ct tbody th[scope=row]{color:var(--muted);font-weight:600;font-size:14px;width:170px;background:var(--surface)}
.ct tr.gh th{background:var(--sunk);font:800 15px var(--display);color:var(--ink);letter-spacing:.01em;padding-top:10px;padding-bottom:8px}
.ct tr.differs th[scope=row]{box-shadow:inset 3px 0 0 var(--diff)}
.ct td.num{font:700 15px var(--mono);font-variant-numeric:tabular-nums}
.ct .nr{color:var(--muted);font:italic 400 14px var(--body)}
.ct td small{display:block;color:var(--muted);font:400 13px var(--body)}
.better{display:inline-block;margin-left:6px;padding:0 6px;border-radius:999px;border:1px solid var(--good);color:var(--good);font:700 12px/18px var(--body);white-space:nowrap;vertical-align:1px}
.ph{display:flex;flex-direction:column;gap:2px}
.ph .thumb{width:64px;height:64px;border-radius:10px;background:var(--sunk);display:grid;place-items:center;overflow:hidden;position:relative;font:800 22px var(--display);color:var(--muted);margin-bottom:4px}
.ph .thumb img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#fff}
.ph b{font-weight:700;line-height:1.25;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.ph .by{color:var(--muted);font-size:13px}
.ph .live{font-size:12px;font-weight:700;color:var(--diff)}
.ph .pa{display:flex;flex-wrap:wrap;gap:2px 12px;font-size:13px;margin-top:2px}
.ph .pa a{color:var(--accent)}
.ph .rm{background:none;border:0;padding:0;color:var(--muted);font:13px var(--body);text-decoration:underline;cursor:pointer;min-height:24px}
.chips{display:flex;flex-wrap:wrap;gap:4px}
.chip{display:inline-block;padding:1px 8px;border-radius:999px;background:var(--chip);border:1px solid var(--line);font-size:13px;font-weight:600;color:var(--ink);white-space:nowrap}
.ingr{font-size:14px;line-height:1.45;color:var(--ink)}
.ingr mark{background:var(--chip);color:inherit;border-bottom:2px solid var(--muted);padding:0 1px}
.ingr.clamp{display:-webkit-box;-webkit-line-clamp:6;-webkit-box-orient:vertical;overflow:hidden}
.more-i{background:none;border:0;padding:4px 0 0;color:var(--accent);font:600 13px var(--body);text-decoration:underline;cursor:pointer}
.adds{margin:0;padding:0;list-style:none;font-size:14px}.adds li{margin:0 0 3px}.adds i{color:var(--muted);font-size:13px}
.ct.only-diff tr.same,.ct.only-diff tr.gh.allsame{display:none}

/* Narrow: each row becomes a full-width label line with the products' values in equal columns underneath */
@container ct (width < 640px){
  table.ct,.ct thead,.ct tbody{display:block}
  .ct tr{display:grid;grid-template-columns:repeat(var(--n),minmax(0,1fr))}
  .ct thead{position:sticky;top:0;z-index:3;background:var(--surface)}
  .ct thead th,.ct thead td{position:static}
  .ct thead td.corner{display:none}
  .ct th,.ct td{padding:7px 10px}
  .ct tbody th[scope=row]{grid-column:1/-1;width:auto;border-bottom:0;padding:8px 10px 0;font-size:13px}
  .ct tr.differs th[scope=row]{box-shadow:none}
  .ct tr.differs th[scope=row]::after{content:" · differs";color:var(--diff);font-weight:700}
  .ct tr.gh th{grid-column:1/-1}
  .ct td+td{border-left:1px solid var(--line)}
  .ph .thumb{width:48px;height:48px;font-size:18px}
  .ph b{font-size:14px;-webkit-line-clamp:2}
  .ct td.num{font-size:14px}
}
/* 3 or 4 products on a phone: columns keep a readable width and the table scrolls sideways inside its box */
@media (max-width:640px){
  .ctw.many{overflow:auto;max-height:calc(100dvh - 16px)}
  .ctw.many .ct tr{grid-template-columns:repeat(var(--n),minmax(150px,1fr))}
  .ctw.many .ct tbody th[scope=row] span,.ctw.many .ct tr.gh th span{position:sticky;left:10px}
  .ctw.many table.ct{width:calc(var(--n) * 160px);min-width:100%}
}
@media (min-width:641px){.ctw.many{overflow-x:auto}}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* Scanner */
dialog.scan{width:min(480px,calc(100% - 24px));max-height:calc(100dvh - 24px);border:0;border-radius:18px;padding:14px 16px 12px;background:var(--surface);color:var(--ink);box-shadow:0 10px 40px rgb(0 0 0/.3)}
dialog.scan::backdrop{background:rgb(10 20 15/.55)}
.scanhead{display:flex;justify-content:space-between;align-items:center}.scanhead h2{margin:0;font-size:22px}
.close{width:40px;height:40px;border-radius:50%;border:1px solid var(--line);background:var(--surface);color:var(--ink);font-size:16px;cursor:pointer}
.scanmsg{font-size:16px;margin:8px 0;min-height:1.5em}.scanmsg b{font-weight:700}
.vid{position:relative;border-radius:12px;overflow:hidden;background:#111;aspect-ratio:4/3}
.vid video{width:100%;height:100%;object-fit:cover;display:block}
/* Phones: about 40% taller than 4:3 (Marc, 16 Nov), capped so the barcode box below stays on screen */
@media (max-width:640px){.vid{aspect-ratio:20/21;max-height:calc(100dvh - 330px);min-height:180px}}
.vid .aim{position:absolute;left:12%;right:12%;top:38%;bottom:38%;border:3px solid rgb(255 255 255/.85);border-radius:10px;box-shadow:0 0 0 999px rgb(0 0 0/.25)}
.vid.off .aim{display:none}
.recent{margin-top:10px}.recent h3{font:700 13px var(--body);color:var(--muted);margin:0 0 4px;text-transform:uppercase;letter-spacing:.06em}
.recent ul{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:6px}
.recent button{border-color:var(--line);color:var(--ink);font-weight:600;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.small{font-size:12px;margin:8px 0 0}
.toast{position:fixed;left:50%;bottom:calc(16px + env(safe-area-inset-bottom));transform:translateX(-50%);background:var(--ink);color:var(--bg);padding:10px 16px;border-radius:999px;font-weight:600;z-index:60}
.empty .grid a span{font-size:13px}
.camnote{font-size:14px;color:var(--muted);margin:0 0 8px}
