/* Minimal, premium, system-native. Light + dark. Mobile-first. */
:root {
  --bg: #ffffff; --bg2: #f5f5f7; --card: #ffffff; --ink: #1d1d1f; --ink2: #6e6e73; --ink3: #a1a1a6;
  --line: rgba(0,0,0,.08); --glass: rgba(255,255,255,.72); --scrim: rgba(0,0,0,.28);
  --accent: #1d1d1f; --accent-ink: #fff; --rose: #c2416b; --rose-soft: rgba(194,65,107,.10);
  --green: #1f7a4d; --green-soft: rgba(31,122,77,.10); --amber: #9a6400; --amber-soft: rgba(154,100,0,.10);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  --shadow: 0 2px 6px rgba(0,0,0,.04), 0 12px 32px rgba(0,0,0,.08);
  --r: 22px; --ease: cubic-bezier(.2,.8,.2,1);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --bg2: #111113; --card: #161618; --ink: #f5f5f7; --ink2: #a1a1a6; --ink3: #6e6e73;
    --line: rgba(255,255,255,.10); --glass: rgba(22,22,24,.72); --scrim: rgba(0,0,0,.55);
    --accent: #f5f5f7; --accent-ink: #000; --rose: #ff7aa2; --rose-soft: rgba(255,122,162,.14);
    --green: #4cd18a; --green-soft: rgba(76,209,138,.14); --amber: #ffc861; --amber-soft: rgba(255,200,97,.14);
    --shadow-sm: none; --shadow: 0 12px 40px rgba(0,0,0,.6);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.4; -webkit-font-smoothing: antialiased; letter-spacing: -.011em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.link { background: none; border: 0; padding: 0; color: var(--rose); font-weight: 500; cursor: pointer; }

/* Frosted sticky header */
.bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px; background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid transparent; transition: border-color .3s; }
.bar.scrolled { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand { gap: 8px; }
.brand svg { width: 20px; height: 20px; flex-shrink: 0; }
.brand .coin { fill: var(--ink); stroke: none; }
.brand .ring { stroke: var(--rose); stroke-width: 2.4; }
.wordmark { font-size: 20px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.hero h1 .soft { color: var(--ink3); }

/* Segmented control */
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg2); border-radius: 11px; padding: 3px; }
.seg button { position: relative; z-index: 1; border: 0; background: none; padding: 7px 14px; font-size: 13.5px; font-weight: 600; color: var(--ink2); cursor: pointer; border-radius: 8px; transition: color .25s; white-space: nowrap; }
.seg button[aria-checked="true"] { color: var(--ink); }
.seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); background: var(--card); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); transition: transform .35s var(--ease); }
.seg[data-active="kids"] .seg-thumb { transform: translateX(100%); }

main { max-width: 1280px; margin: 0 auto; padding: 0 16px 56px; }

/* Hero */
.hero { text-align: center; padding: clamp(48px, 12vh, 120px) 0 28px; transition: padding .5s var(--ease); }
.hero h1 { font-size: clamp(44px, 11vw, 96px); line-height: .98; font-weight: 800; letter-spacing: -.045em; margin: 0 0 14px; }
.hero .sub { color: var(--ink2); font-size: clamp(17px, 2.4vw, 21px); margin: 0 auto 32px; max-width: 34ch; }
body.has-results .hero { padding: 20px 0 12px; }
body.has-results .hero h1, body.has-results .hero .sub, body.has-results .suggest { display: none; }

/* One search bar */
.search { position: relative; display: flex; align-items: center; gap: 4px; max-width: 680px; margin: 0 auto; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); transition: box-shadow .25s, transform .25s var(--ease); }
.search:focus-within { box-shadow: 0 0 0 4px var(--rose-soft), var(--shadow); }
.ico-search { width: 20px; height: 20px; color: var(--ink3); flex: none; }
.search input[type=text] { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 17px var(--font); color: var(--ink); padding: 12px 8px; letter-spacing: -.01em; }
.search input::placeholder { color: var(--ink3); }
.kind { flex: none; font-size: 11.5px; font-weight: 600; color: var(--rose); background: var(--rose-soft); padding: 4px 8px; border-radius: 99px; animation: pop .25s var(--ease); }
.icon-btn, .go { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; cursor: pointer; border: 0; transition: transform .15s, background .2s; }
.icon-btn { color: var(--ink2); background: transparent; }
.icon-btn:hover { background: var(--bg2); color: var(--ink); }
.icon-btn svg, .go svg { width: 22px; height: 22px; }
.go { background: var(--accent); color: var(--accent-ink); }
.go:active, .icon-btn:active { transform: scale(.94); }
.go[disabled] { opacity: .5; }
.photo-chip { display: inline-flex; align-items: center; gap: 10px; margin-top: 12px; padding: 6px 8px 6px 6px; background: var(--bg2); border-radius: 14px; font-size: 13px; color: var(--ink2); animation: pop .3s var(--ease); }
.photo-chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 9px; }
.photo-chip button { border: 0; background: none; cursor: pointer; color: var(--ink3); padding: 4px 6px; }
.fine { font-size: 12px; color: var(--ink3); max-width: 560px; margin: 10px auto 0; }
.fine a { color: var(--ink2); }
.suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.suggest button { border: 1px solid var(--line); background: transparent; padding: 9px 14px; border-radius: 99px; font-size: 14px; color: var(--ink2); cursor: pointer; transition: all .2s; }
.suggest button:hover { color: var(--ink); background: var(--bg2); }

.status { text-align: center; font-size: 14px; color: var(--ink2); margin: 6px 0 14px; animation: fade .3s; }
.status.error { color: var(--rose); }

/* Original item */
.original { display: grid; grid-template-columns: 88px 1fr; gap: 16px; align-items: center; max-width: 760px; margin: 0 auto 26px; padding: 14px; background: var(--bg2); border-radius: var(--r); animation: rise .5s var(--ease); }
.original img { width: 88px; height: 110px; object-fit: cover; border-radius: 14px; background: var(--line); }
.original .eyebrow { font-size: 12px; font-weight: 600; color: var(--ink3); text-transform: uppercase; letter-spacing: .06em; }
.original .big { font-size: 22px; font-weight: 700; letter-spacing: -.025em; margin: 2px 0; }
.original .t { font-size: 14px; color: var(--ink); }
.original .m { font-size: 13px; color: var(--ink2); margin-top: 4px; }

/* Toolbar */
.toolbar { position: sticky; top: calc(58px + env(safe-area-inset-top)); z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; margin-bottom: 6px; background: linear-gradient(var(--bg) 70%, transparent); }
.summary { font-size: 14px; color: var(--ink2); }
.summary b { color: var(--ink); font-weight: 600; }
.pill-btn { white-space: nowrap; flex: none; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .15s; }
.pill-btn:active { transform: scale(.97); }
.pill-btn svg { width: 18px; height: 18px; }
.pill-btn .count { background: var(--rose); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }

/* Grid + cards */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 18px; } }
@media (min-width: 1040px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 22px; } }
.card { display: flex; flex-direction: column; animation: rise .5s var(--ease) both; }
.media { position: relative; display: block; aspect-ratio: 4 / 5; border-radius: var(--r); overflow: hidden; background: var(--bg2); }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease), opacity .4s; opacity: 0; }
.media img.loaded { opacity: 1; }
.card:hover .media img { transform: scale(1.035); }
.flag { position: absolute; top: 10px; left: 10px; background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); color: var(--ink); font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 99px; }
.card.cheapest .flag { color: var(--rose); }
.body { padding: 12px 4px 0; display: flex; flex-direction: column; gap: 4px; }
.row1 { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.store { font-weight: 600; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rating { color: var(--ink2); white-space: nowrap; }
.rating .star { color: var(--amber); }
.title { font-size: 14px; line-height: 1.3; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.title:hover { text-decoration: underline; text-underline-offset: 2px; }
.price-row { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; }
.price { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.old { font-size: 13px; color: var(--ink3); }
.approx { font-size: 11px; color: var(--ink3); }
.save { font-size: 12.5px; font-weight: 600; color: var(--green); }
.save.more { color: var(--ink3); font-weight: 500; }
.material { font-size: 12.5px; color: var(--ink); }
.material.unknown { color: var(--ink3); }
.material small { color: var(--ink3); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: var(--bg2); color: var(--ink2); }
.badge.natural, .badge.organic, .badge.soft { background: var(--green-soft); color: var(--green); }
.badge.top-rated, .badge.well-reviewed { background: var(--amber-soft); color: var(--amber); }
.size-link { align-self: flex-start; border: 0; background: none; padding: 2px 0; font-size: 12.5px; color: var(--rose); cursor: pointer; font-weight: 500; }

/* Skeletons */
.skel .media { background: linear-gradient(100deg, var(--bg2) 30%, var(--line) 50%, var(--bg2) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s infinite linear; }
.skel .line { height: 12px; border-radius: 6px; margin-top: 8px; background: var(--bg2); }
.skel .line.s { width: 40%; } .skel .line.m { width: 70%; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* Sheets */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); opacity: 0; transition: opacity .3s; }
.scrim.on { opacity: 1; }
.sheet { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; max-height: 86vh; display: flex; flex-direction: column; background: var(--card); border-radius: 26px 26px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,.18); transform: translateY(105%); transition: transform .45s var(--ease); padding-bottom: env(safe-area-inset-bottom); }
.sheet.open { transform: none; }
.grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px 6px; }
.sheet-head h2 { font-size: 20px; margin: 0; letter-spacing: -.02em; }
.sheet-body { overflow-y: auto; padding: 4px 20px 16px; -webkit-overflow-scrolling: touch; }
.sheet-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink3); margin: 18px 0 10px; font-weight: 600; }
.sheet-foot { padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.primary { width: 100%; border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 14px; padding: 15px; font-size: 16px; font-weight: 600; cursor: pointer; }
@media (min-width: 900px) {
  .sheet { left: auto; top: 0; width: 400px; max-height: none; border-radius: 0; transform: translateX(105%); box-shadow: -10px 0 40px rgba(0,0,0,.12); }
  .sheet.wide { width: min(720px, 92vw); }
  .grab { display: none; }
  .sheet-head { padding-top: 22px; }
}
.options { display: grid; gap: 2px; }
.opt { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; cursor: pointer; font-size: 15px; border: 0; background: none; text-align: left; }
.opt:hover { background: var(--bg2); }
.opt[aria-checked="true"] { background: var(--bg2); font-weight: 600; }
.opt[aria-checked="true"]::after { content: '✓'; color: var(--rose); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 8px 13px; font-size: 14px; cursor: pointer; transition: all .2s; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip .n { opacity: .55; margin-left: 5px; font-size: 12px; }

/* Size guide tables */
.guide-meta { font-size: 13px; color: var(--ink2); margin: 0 0 6px; }
.guide-meta a { color: var(--rose); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; margin: 8px 0 18px; }
.tbl-wrap table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.tbl-wrap td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl-wrap tr:first-child td { font-weight: 600; background: var(--bg2); }
.tbl-wrap td:first-child { font-weight: 600; position: sticky; left: 0; background: var(--card); }
.tbl-wrap tr:first-child td:first-child { background: var(--bg2); }
.guide-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.empty { grid-column: 1 / -1; text-align: center; color: var(--ink2); padding: 50px 0; }
.foot { max-width: 760px; margin: 0 auto; padding: 24px 20px 48px; text-align: center; font-size: 12px; color: var(--ink3); }
.dropzone { position: fixed; inset: 12px; z-index: 60; border: 2px dashed var(--rose); border-radius: 28px; background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); display: grid; place-items: center; font-size: 22px; font-weight: 700; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.92); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
