:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --text: #1b1b1f;
  --muted: #62626b;
  --border: #e2e1dc;
  --accent: #d52b1e;        /* Canadian red */
  --accent-ink: #ffffff;
  --accent-soft: #fdecea;
  --good: #1f7a4d;
  --warn: #9a5b00;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --surface: #1b1b1f;
    --surface-2: #24242a;
    --text: #ececef;
    --muted: #a0a0aa;
    --border: #2f2f36;
    --accent: #f0493c;
    --accent-soft: #3a1a18;
    --good: #4cc38a;
    --warn: #f0b04a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-weight: 500; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 800; font-size: 1.2rem; text-decoration: none; letter-spacing: -.02em; }
.logo-mark { color: var(--accent); }
.logo-accent { color: var(--accent); }
.header-nav { display: flex; gap: 20px; }
.header-nav a { text-decoration: none; color: var(--muted); font-size: .95rem; }
.header-nav a:hover { color: var(--text); }

/* Hero */
.hero { padding: 56px 0 40px; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); letter-spacing: -.03em; max-width: 760px; }
.lede { color: var(--muted); font-size: 1.1rem; max-width: 640px; margin: 12px 0 28px; }

.search-card {
  display: grid;
  grid-template-columns: 2fr 1fr 1.3fr auto;
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
input[type="text"], select {
  font: inherit;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
select:disabled { opacity: .6; }

.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 10; top: calc(100% + 4px); left: 0; right: 0;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 320px; overflow: auto;
}
.combo-list li { display: flex; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.combo-list li small { color: var(--muted); white-space: nowrap; }
.combo-list li.active, .combo-list li[data-id]:hover { background: var(--surface-2); }
.combo-list li.empty { color: var(--muted); cursor: default; }

.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  height: 46px; padding: 0 20px; border-radius: 10px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); border: 0; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); height: 40px; padding: 0 14px; font-size: .9rem; }
.btn-secondary:hover { background: var(--surface-2); }

.popular { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; color: var(--muted); font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: .85rem; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.chip:hover { border-color: var(--accent); }

.shake { animation: shake .35s; border-color: var(--accent) !important; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Results */
.results { padding: 8px 16px 40px; scroll-margin-top: 16px; }
.results-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 16px; }
.eyebrow { margin: 0 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.results-head h2 { font-size: 1.5rem; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters select { height: 38px; width: auto; font-size: .9rem; }
.toggle { display: inline-flex; gap: 8px; align-items: center; font-size: .9rem; cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

.best-card {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px;
  background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.best-card h3 { font-size: 1.6rem; margin-top: 8px; }
.payout { margin: 4px 0 0; color: var(--muted); }
.req { margin: 8px 0 0; font-size: .9rem; color: var(--warn); }
.req.ok { color: var(--good); }
.best-right { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.amount { margin: 0; font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.upto { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: 0; text-align: right; margin-bottom: 4px; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.badge-best { background: var(--accent-soft); color: var(--accent); }

.offer-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.offer {
  display: grid; grid-template-columns: 32px 1fr auto auto; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px;
}
.rank { font-weight: 700; color: var(--muted); text-align: center; }
.offer h4 { font-size: 1.05rem; }
.offer-main p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.req-inline { color: var(--warn); }
.offer-amount { text-align: right; }
.offer-amount strong { display: block; font-size: 1.3rem; }
.offer-amount small { color: var(--muted); }
.empty-results { padding: 24px; background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--border); }
.fine { color: var(--muted); font-size: .85rem; margin-top: 16px; }

/* How / Providers */
.how, .providers { padding: 40px 16px; }
.how h2, .providers h2 { font-size: 1.5rem; margin-bottom: 16px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0; list-style: none; counter-reset: s; margin: 0; }
.steps li {
  counter-increment: s; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; color: var(--muted);
}
.steps li::before { content: counter(s); display: block; font-weight: 800; font-size: 1.4rem; color: var(--accent); margin-bottom: 6px; }
.steps strong { color: var(--text); display: block; }

.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.provider {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
}
.provider:hover { border-color: var(--accent); }
.provider p { margin: 0; color: var(--muted); font-size: .9rem; flex: 1; }
.provider-payout { font-size: .8rem; font-weight: 600; color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); padding: 24px 0 40px; color: var(--muted); font-size: .85rem; }
.site-footer p { margin: 4px 0; }

/* Mobile */
@media (max-width: 760px) {
  .search-card { grid-template-columns: 1fr 1fr; }
  .field-device, .search-card .btn-primary { grid-column: 1 / -1; }
  .steps { grid-template-columns: 1fr; }
  .best-right { align-items: stretch; width: 100%; }
  .best-right .amount, .upto { text-align: left; }
  .offer { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .rank { display: none; }
  .offer .btn-secondary { grid-column: 1 / -1; }
  .header-nav { display: none; }
}
