:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --text: #121826;
  --muted: #5d6779;
  --border: #e3e7ef;
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-ink: #ffffff;
  --good: #047857;
  --good-bg: #d9f7ea;
  --warn-bg: #fff4d6;
  --warn: #8a5a00;
  --star: #e8a200;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f1a;
    --surface: #131a2a;
    --surface-2: #1a2236;
    --text: #e8ecf5;
    --muted: #97a3ba;
    --border: #25304a;
    --brand: #818cf8;
    --brand-hover: #a5b0ff;
    --brand-ink: #0b0f1a;
    --good: #4ade9f;
    --good-bg: #0b3a2b;
    --warn-bg: #3a2c08;
    --warn: #f5c451;
    --star: #f5b72c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f1a;
  --surface: #131a2a;
  --surface-2: #1a2236;
  --text: #e8ecf5;
  --muted: #97a3ba;
  --border: #25304a;
  --brand: #818cf8;
  --brand-hover: #a5b0ff;
  --brand-ink: #0b0f1a;
  --good: #4ade9f;
  --good-bg: #0b3a2b;
  --warn-bg: #3a2c08;
  --warn: #f5c451;
  --star: #f5b72c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--brand); }
.logo span { color: var(--text); }
.nav { display: flex; gap: 20px; margin-left: 8px; }
.nav a { color: var(--muted); font-weight: 500; font-size: .95rem; }
.nav a:hover { color: var(--text); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: .95rem; transition: background .15s, border-color .15s; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: .85rem; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: transparent; display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; font-size: .9rem; }
.link-btn:hover { text-decoration: underline; }
.select, .select-sm { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; }
.select { width: 100%; }
.select-sm { padding: 7px 10px; font-size: .9rem; }

/* Hero */
.hero { background: linear-gradient(135deg, #4338ca 0%, #6d28d9 55%, #be185d 120%); color: #fff; }
.hero-inner { padding-top: 64px; padding-bottom: 72px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; opacity: .85; margin-bottom: 14px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.1; letter-spacing: -.02em; }
.lead { margin-top: 16px; max-width: 560px; font-size: 1.1rem; opacity: .92; }
.search { margin-top: 28px; display: flex; gap: 8px; max-width: 680px; background: #fff; padding: 6px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 12px; color: #121826; outline: none; }
.search input::placeholder { color: #6b7280; }
.search .btn-primary { background: #4f46e5; color: #fff; }
.chips { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .12); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: .88rem; font-weight: 500; }
.chip:hover { background: rgba(255, 255, 255, .24); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: -32px; position: relative; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; }
.stats strong { font-size: 1.5rem; letter-spacing: -.01em; }
.stats span { color: var(--muted); font-size: .88rem; }

/* Layout */
.layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; margin-top: 40px; align-items: start; scroll-margin-top: 80px; }
.filters-toggle { display: none; }
.filters { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 20px; }
.filters-head { display: flex; justify-content: space-between; align-items: center; }
.filters h2 { font-size: 1.05rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-weight: 600; font-size: .9rem; display: flex; justify-content: space-between; width: 100%; }
legend output { color: var(--brand); font-weight: 600; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; }
.check .count { margin-left: auto; color: var(--muted); font-size: .8rem; }
.group-label { margin: 8px 0 0; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.group-label:first-child { margin-top: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
input[type="range"] { width: 100%; accent-color: var(--brand); margin: 4px 0 10px; }

/* Results */
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
#count { color: var(--muted); }
#count strong { color: var(--text); }
.sort { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.list { display: flex; flex-direction: column; gap: 16px; }

.card { display: grid; grid-template-columns: 150px 1fr 290px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: border-color .15s, transform .15s; }
.card:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--border)); }
.thumb { position: relative; display: grid; place-items: center; font-size: 3rem; background: linear-gradient(145deg, var(--g1), var(--g2)); min-height: 140px; }
.card-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.meta { color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.meta .topic { color: var(--brand); font-weight: 600; }
.card h3 { font-size: 1.08rem; line-height: 1.3; }
.title-btn { background: none; border: 0; padding: 0; text-align: left; font-weight: 700; font-size: inherit; line-height: inherit; }
.title-btn:hover { color: var(--brand); }
.by { color: var(--muted); font-size: .88rem; }
.rating { font-size: .88rem; display: flex; align-items: center; gap: 6px; margin-top: auto; }
.stars { color: var(--star); letter-spacing: 1px; }
.rating span { color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--good-bg); color: var(--good); }
.tag.alt { background: var(--warn-bg); color: var(--warn); }

.card-prices { padding: 16px 18px; border-left: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.best { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.best small { width: 100%; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.best strong { font-size: 1.6rem; letter-spacing: -.02em; line-height: 1.1; }
.best s { color: var(--muted); font-size: .9rem; }
.offers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
.offers li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--border); }
.offers li:first-child { border-top: 0; }
.offers .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offers .price { font-weight: 600; font-variant-numeric: tabular-nums; }
.offers li.is-best .price { color: var(--good); }
.more { color: var(--muted); font-size: .8rem; }

.empty { text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty p { color: var(--muted); }

/* How */
.how { margin-top: 72px; margin-bottom: 72px; scroll-margin-top: 80px; }
.how h2 { font-size: 1.6rem; margin-bottom: 20px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.steps span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 700; margin-bottom: 12px; }
.steps h3 { margin-bottom: 4px; }
.steps p { color: var(--muted); font-size: .95rem; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0; color: var(--muted); font-size: .9rem; }

/* Drawer */
.scrim { position: fixed; inset: 0; background: rgba(8, 12, 24, .55); z-index: 30; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); z-index: 31; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -12px 0 40px rgba(0, 0, 0, .25); overflow-y: auto; padding: 28px 24px 32px; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-close { position: absolute; top: 16px; right: 16px; }
.drawer h2 { font-size: 1.35rem; line-height: 1.25; padding-right: 44px; margin: 6px 0; }
.drawer .blurb { color: var(--muted); margin: 10px 0 16px; }
.drawer h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 24px 0 10px; }
.ptable { display: flex; flex-direction: column; gap: 10px; }
.prow { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.prow.is-best { border-color: var(--good); background: color-mix(in srgb, var(--good-bg) 55%, var(--surface)); }
.prow .who { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.prow .amt { font-weight: 700; font-size: 1.1rem; text-align: right; font-variant-numeric: tabular-nums; }
.prow .amt s { color: var(--muted); font-weight: 400; font-size: .8rem; margin-right: 6px; }
.prow .sub { color: var(--muted); font-size: .82rem; }
.prow .bar { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.prow .bar i { display: block; height: 100%; border-radius: 6px; }
.prow .go { grid-column: 1 / -1; justify-self: end; }
.spark { width: 100%; height: 90px; display: block; }
.spark-note { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.drawer-actions { display: flex; gap: 10px; margin-top: 20px; }
.drawer-actions .btn { flex: 1; }
.fine { color: var(--muted); font-size: .78rem; margin-top: 16px; }

.badge-pill { position: absolute; top: 10px; left: 10px; background: rgba(255, 255, 255, .95); color: #065f46; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }

/* Price alert popup */
.modal { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; padding: 16px; background: rgba(8, 12, 24, .6); }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(440px, 100%); max-height: 100%; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); padding: 28px 24px 22px; animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-close { position: absolute; top: 12px; right: 12px; }
.modal-eyebrow { color: var(--brand); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.modal-card h2 { font-size: 1.3rem; line-height: 1.25; padding-right: 36px; }
.modal-lead { color: var(--muted); margin: 8px 0 18px; font-size: .95rem; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span, .field > label { font-weight: 600; font-size: .88rem; }
.field em { color: var(--muted); font-weight: 400; font-style: normal; }
.field input[type="email"], .field input[type="tel"] { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; }
.field input:focus { border-color: var(--brand); }
.phone-row { display: grid; grid-template-columns: 112px 1fr; gap: 8px; }
.phone-row .select { padding: 11px 8px; }
.field.invalid input, .field.invalid select { border-color: #dc2626; }
.consent { align-items: flex-start; font-size: .82rem; color: var(--muted); margin: 4px 0 14px; }
.consent input { margin-top: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-error { color: #dc2626; font-size: .85rem; margin-bottom: 10px; }
.skip { display: block; margin: 12px auto 0; color: var(--muted); font-weight: 500; }
.alert-done { text-align: center; padding: 12px 0 4px; }
.alert-done h2 { padding-right: 0; margin: 12px 0 6px; }
.alert-done p { color: var(--muted); margin-bottom: 18px; }
.done-tick { width: 52px; height: 52px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--good-bg); color: var(--good); font-size: 1.6rem; font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); font-size: .92rem; max-width: calc(100% - 32px); }

/* Responsive */
@media (max-width: 1020px) {
  .card { grid-template-columns: 120px 1fr; }
  .card-prices { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); }
  .thumb { min-height: 0; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 16px; }
  .filters-toggle { display: inline-flex; justify-self: start; }
  .filters { position: static; display: none; }
  .filters.open { display: flex; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .nav { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .header-row { gap: 10px; }
  .header-tools .btn { display: none; }
  .hero-inner { padding-top: 40px; padding-bottom: 56px; }
  .search { flex-direction: column; }
  .results-head { flex-direction: column; align-items: flex-start; }
  .card { grid-template-columns: 1fr; }
  .thumb { min-height: 90px; font-size: 2.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .drawer, .modal-card { animation: none; }
}
