:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --text: #17181b;
  --muted: #5f6368;
  --border: #e3e1dc;
  --accent: #e8432e;
  --accent-ink: #ffffff;
  --accent-soft: #fde8e4;
  --save: #0f7b45;
  --save-soft: #e3f4ea;
  --coupon: #7a4b00;
  --coupon-soft: #fff1d6;
  --img-bg: #ffffff;
  --shadow: 0 1px 2px rgba(20, 20, 20, .05), 0 4px 16px rgba(20, 20, 20, .06);
  --radius: 14px;
  --header: #141518;
  --header-ink: #f5f5f5;
  --focus: #2b6cf6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1012; --surface: #18191c; --surface-2: #222328; --text: #ececec; --muted: #a2a5ab;
    --border: #2c2e33; --accent: #ff5a43; --accent-soft: #3a1d18; --save: #4fd18b; --save-soft: #14301f;
    --coupon: #ffcf7a; --coupon-soft: #33270f; --img-bg: #f4f4f4; --shadow: 0 1px 2px rgba(0,0,0,.4);
    --header: #0a0a0b; --focus: #7aa5ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1012; --surface: #18191c; --surface-2: #222328; --text: #ececec; --muted: #a2a5ab;
  --border: #2c2e33; --accent: #ff5a43; --accent-soft: #3a1d18; --save: #4fd18b; --save-soft: #14301f;
  --coupon: #ffcf7a; --coupon-soft: #33270f; --img-bg: #f4f4f4; --shadow: 0 1px 2px rgba(0,0,0,.4);
  --header: #0a0a0b; --focus: #7aa5ff; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.topbar { background: var(--header); color: var(--header-ink); position: sticky; top: 0; z-index: 30; }
.topbar-inner { max-width: 1440px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text small { color: #f0a497; font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: #26282d; border-radius: 10px; padding: 0 12px; min-width: 0; }
.search svg { width: 18px; height: 18px; fill: none; stroke: #9a9ea6; stroke-width: 2; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: #fff; padding: 10px 0; outline: none; }
.search:focus-within { box-shadow: 0 0 0 2px var(--focus); }
.mainnav { display: flex; gap: 4px; flex: none; }
.mainnav a { text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; color: #cfd2d7; }
.mainnav a:hover { background: #23252a; color: #fff; }
.mainnav a[aria-current="page"] { background: #2c2f35; color: #fff; }
.theme-toggle { background: transparent; border: 0; padding: 6px; border-radius: 8px; cursor: pointer; flex: none; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: #cfd2d7; stroke-width: 2; }

/* ---------- filter bar ---------- */
.filterbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 54px; z-index: 20; }
.filterbar-inner { max-width: 1440px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 600; }
.f select, .f input[type="number"] {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 14px; color: var(--text); min-width: 0;
}
.f select { min-width: 120px; }
.range { display: flex; align-items: center; gap: 4px; }
.range input { width: 78px; }
.range em { font-style: normal; color: var(--muted); }
.f-check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.f-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; padding: 8px 4px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 7px 12px; font-weight: 600; cursor: pointer; }
.chip-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- layout ---------- */
.layout { max-width: 1440px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 24px; }
.sidebar { position: sticky; top: 140px; align-self: start; max-height: calc(100vh - 156px); overflow: auto; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.cat { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; text-decoration: none; font-weight: 500; }
.cat:hover { background: var(--surface-2); }
.cat[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.cat .n { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.cat[aria-current="page"] .n { background: var(--surface); color: var(--accent); }
.cat-sep { height: 1px; background: var(--border); margin: 8px 4px; }
.sidebar-note { font-size: 12px; color: var(--muted); padding: 12px 10px; }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 12px; }
.icon-btn { border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 999px; font-size: 22px; line-height: 1; cursor: pointer; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
.only-mobile { display: none; }

/* ---------- page head ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin: 2px 0 14px; }
.page-head h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }
.disclosure { flex-basis: 100%; margin: 2px 0 0 !important; font-size: 12.5px !important; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 7px 12px; }
.disclosure strong { color: var(--text); }
.crumb { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 2px; }
.crumb:hover { color: var(--accent); }

/* ---------- deal grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.card-media { position: relative; aspect-ratio: 1 / 1; min-height: 0; overflow: hidden; background: var(--img-bg); border-bottom: 1px solid var(--border); }
/* Absolutely positioned so tall/wide product photos can never stretch the tile; "contain" + padding zooms them out. */
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 34px 26px 38px; }
.badge-save { position: absolute; left: 10px; top: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13px; padding: 4px 9px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.badge-approx { position: absolute; right: 8px; top: 12px; background: rgba(20,20,20,.72); color: #fff; font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.banner { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px; font-size: 12px; font-weight: 700; text-align: center; color: #fff; letter-spacing: .01em; }
.banner-age { background: rgba(23, 24, 27, .72); font-weight: 600; }
.banner-epp { background: #1a3e8f; }
.banner-ok { background: #0f7b45; }
.logo { width: 44px; height: 44px; border-radius: 12px; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; flex: none; overflow: hidden; }
.logo img { width: 34px; height: 34px; object-fit: contain; }
.title-with-logo { display: inline-flex; align-items: center; gap: 10px; }
.title-with-logo .logo, .title-with-logo .avatar { width: 36px; height: 36px; border-radius: 10px; font-size: 16px; }
.title-with-logo .logo img { width: 28px; height: 28px; }
.ph { position: absolute; inset: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #8a8d93; background: repeating-linear-gradient(45deg, #f6f6f6, #f6f6f6 10px, #f1f1f1 10px, #f1f1f1 20px); }
.ph svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.ph span { font-weight: 700; font-size: 13px; text-align: center; padding: 0 10px; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.store-chip { align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none; text-transform: uppercase; letter-spacing: .04em; }
.store-chip:hover { color: var(--accent); }
.card-title { font-size: 14px; font-weight: 600; margin: 0; min-height: calc(3 * 1.45em); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.prices { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: auto; }
.now { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.was { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.pct { color: var(--save); background: var(--save-soft); font-weight: 700; font-size: 12px; padding: 1px 7px; border-radius: 999px; }
.tag-muted { font-size: 12px; color: var(--muted); }
.tag-offer { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.mode-offers .f-price, .mode-offers .f-pct, .mode-offers .f-saved { display: none !important; }
.saved-line { font-size: 13px; color: var(--save); font-weight: 700; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.coupon { display: inline-flex; align-items: center; gap: 5px; border: 1px dashed var(--coupon); color: var(--coupon); background: var(--coupon-soft); font-weight: 700; border-radius: 7px; padding: 2px 8px; cursor: pointer; font-size: 12px; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.coupon svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.btn-deal { display: flex; justify-content: center; align-items: center; gap: 6px; background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 700; padding: 9px 12px; border-radius: 10px; }
.btn-deal:hover { filter: brightness(1.06); }
.btn-deal svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.btn-deal[aria-disabled="true"] { background: var(--surface-2); color: var(--muted); pointer-events: none; }
.btn-secondary { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 18px; font-weight: 700; cursor: pointer; }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.more { display: flex; justify-content: center; padding: 22px 0 8px; }
.empty, .loading { text-align: center; padding: 60px 16px; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* ---------- stores ---------- */
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.store-tile { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; box-shadow: var(--shadow); min-width: 0; }
.store-tile:hover { border-color: var(--accent); }
.avatar { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; flex: none; }
.store-tile strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-tile small { color: var(--muted); font-size: 12.5px; display: block; }
.store-tile .top { color: var(--save); font-weight: 600; }
.section-title { font-size: 15px; margin: 26px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #17181b; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 60; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.footer { max-width: 1440px; margin: 24px auto 0; padding: 20px 16px 36px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--border); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .mainnav a { padding: 8px 8px; }
}
@media (max-width: 900px) {
  .only-mobile { display: inline-flex; }
  .sidebar-head.only-mobile { display: flex; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); max-height: none; background: var(--surface); z-index: 50; padding: 14px 10px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar.open { transform: none; }
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; flex-basis: 100%; }
  .mainnav { margin-left: auto; }
  .filterbar { position: static; }
  .filterbar:not(.open) .f-extra { display: none; }
  .filterbar-inner { align-items: center; }
  #filterCount:not(:empty) { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 2px; }
}
@media (max-width: 560px) {
  .brand-text { display: none; }
  .topbar-inner { gap: 8px; }
  .mainnav a { font-size: 13px; padding: 6px 7px; }
  .filterbar-inner { gap: 8px 10px; }
  .f select { min-width: 0; max-width: 44vw; }
  .f-price { flex-basis: 100%; }
  .range input { width: 100%; }
  .range { width: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-body { padding: 10px; }
  .card-media img { padding: 26px 14px 30px; }
  .now { font-size: 17px; }
  .page-head h1 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- footer links + info pages (About / Privacy / Contact) ---------- */
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.info { max-width: 760px; margin: 0 auto; padding: 28px 16px 8px; font-size: 16px; line-height: 1.65; }
.info h1 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
.info h2 { font-size: 19px; margin: 28px 0 6px; }
.info .lede { color: var(--muted); margin: 0 0 18px; }
.info a { color: var(--accent); }
.info ul { padding-left: 22px; }
.info .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.info .back { display: inline-block; margin-top: 28px; font-weight: 600; text-decoration: none; }
.topbar .brand-text strong { color: var(--header-ink); }
