/* DriveData hub — Canada's data drive */
:root {
  --bg: #F6F4EF; --surface: #FFFFFF; --surface2: #FBFAF7; --ink: #0E1726; --text: #1B2433; --muted: #5C6678; --muted2: #9AA3B2;
  --line: #E6E2D9; --accent: #D52B1E; --accent2: #0F766E;
  --c1: #2563EB; --c2: #E8553D; --c3: #0EA5A4; --c4: #8B5CF6; --c5: #F59E0B;
  --warm: #E8553D; --cool: #2563EB; --precip: #93C5FD; --good: #0F9D58; --good-bg: #E7F6EE;
  --radius: 18px; --shadow: 0 1px 2px rgba(14,23,38,.05), 0 8px 24px -12px rgba(14,23,38,.18);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B111C; --surface: #121A28; --surface2: #0F1622; --ink: #050A12; --text: #E8ECF3; --muted: #9AA6B8; --muted2: #5E6A7D;
    --line: #223047; --c1: #60A5FA; --c2: #FB7B62; --c3: #2DD4BF; --c4: #A78BFA; --c5: #FBBF24;
    --warm: #FB7B62; --cool: #60A5FA; --precip: #1E3A5F; --good: #34D399; --good-bg: #0E2A20;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--c1); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); color: var(--text); line-height: 1.12; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; }
h1 span { color: var(--muted); font-weight: 600; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); font-weight: 800; }
h3 { font-size: 1.08rem; font-weight: 600; margin-top: 1.4em; font-family: var(--font); }
p { margin: 0 0 1em; }
b { font-weight: 650; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 99; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
main { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; }

/* header */
.top { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; flex-shrink: 0; }
.logo svg { width: 36px; height: 36px; }
.logo b { font-family: var(--display); font-size: 1.2rem; font-weight: 800; display: block; line-height: 1; }
.logo small { display: block; font-size: .72rem; color: var(--muted); letter-spacing: .02em; }
.mainnav { display: flex; gap: 4px; margin-left: auto; }
.mainnav a { color: var(--text); padding: 8px 9px; border-radius: 999px; font-size: .92rem; font-weight: 500; white-space: nowrap; }
.mainnav a:hover, .mainnav a[aria-current] { background: var(--surface); text-decoration: none; box-shadow: var(--shadow); }
.menu-btn { display: none; margin-left: auto; background: none; border: 0; width: 40px; height: 40px; padding: 10px 8px; cursor: pointer; }
.menu-btn span { display: block; height: 2px; background: var(--text); margin: 5px 0; border-radius: 2px; }

/* search */
.search { position: relative; flex: 1; max-width: 360px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input { width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: .95rem; outline: none; transition: border-color .15s, box-shadow .15s; }
.search input:focus { border-color: var(--c1); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c1) 18%, transparent); }
.search .results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; display: none; z-index: 60; }
.search .results.open { display: block; }
.search .results a { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px; color: var(--text); }
.search .results a span { color: var(--muted); font-size: .85rem; }
.search .results a:hover, .search .results a.sel { background: var(--surface2); text-decoration: none; }
.search.big { max-width: 560px; margin: 24px 0 16px; }
.search.big input { padding: 16px 18px 16px 46px; font-size: 1.05rem; box-shadow: var(--shadow); }
.search.big svg { left: 16px; width: 20px; height: 20px; }

/* hero */
.crumbs { font-size: .85rem; color: var(--muted); padding: 18px 0 0; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 4px; }
.hero { display: grid; grid-template-columns: 1fr; gap: 24px; padding: 28px 0 20px; }
.city-hero { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--accent); margin: 0 0 10px; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 70ch; }
.lede b { color: var(--text); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--ink); color: #fff; border: 1px solid var(--ink); padding: 10px 18px; border-radius: 999px; font: 600 .95rem var(--font); cursor: pointer; text-decoration: none !important; transition: transform .12s; }
@media (prefers-color-scheme: dark) { .btn { background: var(--text); color: var(--bg); border-color: var(--text); } }
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.small { padding: 6px 14px; font-size: .85rem; }

/* home hero */
.home-hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px; align-items: center; padding: 48px 0 28px; }
.home-hero h1 { font-size: clamp(2.3rem, 6vw, 4.2rem); }
.grad { background: linear-gradient(92deg, var(--accent) 0%, #F59E0B 45%, var(--c3) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.clock { padding: 24px; }
.clock-n { font: 800 clamp(2rem, 4.4vw, 3rem)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.clock-l { color: var(--muted); font-size: .85rem; margin: 8px 0 18px; }
.clock-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; }
.clock-row b { display: block; font: 800 1.35rem var(--display); }
.clock-row span { font-size: .75rem; color: var(--muted); line-height: 1.3; display: block; }

/* cards & sections */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sec { margin: 22px 0; }
.card.sec { padding: 24px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sec-head a { font-weight: 600; font-size: .92rem; white-space: nowrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.two > div { min-width: 0; }
.src { font-size: .8rem; color: var(--muted); margin: 18px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); }
.src a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); }
.note { font-size: .85rem; color: var(--muted); }
.updated { text-align: center; color: var(--muted); font-size: .8rem; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 8px 0 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; color: var(--text); }
a.stat:hover { text-decoration: none; border-color: var(--c1); }
.sl { font-size: .78rem; color: var(--muted); font-weight: 500; }
.sv { font: 800 1.55rem/1.15 var(--display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ss { font-size: .76rem; color: var(--muted); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.mini-stats .stat { background: var(--surface2); box-shadow: none; }
.mini-stats .sv { font-size: 1.25rem; }

/* toc */
.toc { position: sticky; top: 62px; z-index: 20; display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; margin: 0 -16px; padding-left: 16px; padding-right: 16px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); scrollbar-width: none; }
.toc::-webkit-scrollbar { display: none; }
.toc a { flex-shrink: 0; font-size: .85rem; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; }
.toc a:hover { text-decoration: none; border-color: var(--c1); }
.sec[id] { scroll-margin-top: 120px; }

/* bars, stacks, charts */
.bars { display: grid; gap: 8px; margin: 10px 0 14px; }
.bar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt { height: 10px; background: var(--surface2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bt i { display: block; height: 100%; border-radius: 999px; }
.bv { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 4.5ch; text-align: right; }
.bars-title { font-weight: 600; margin: 0 0 4px; font-size: .92rem; }
.stack { display: flex; height: 18px; border-radius: 999px; overflow: hidden; margin: 10px 0 8px; background: var(--surface2); }
.stack i { display: block; height: 100%; }
.stack i + i { border-left: 2px solid var(--surface); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--muted); margin: 0 0 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend em { font-style: normal; color: var(--text); font-weight: 600; }
.chart-wrap { width: 100%; max-width: 760px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .grid.zero { stroke: var(--muted2); stroke-dasharray: 3 3; }
.chart .ax { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .tl { fill: var(--text); font-size: 11px; font-weight: 600; font-family: var(--font); }
.chart .precip { fill: var(--precip); }
.chart .tband { fill: color-mix(in srgb, var(--warm) 14%, transparent); }
.chart .tmax { fill: none; stroke: var(--warm); stroke-width: 2.5; }
.chart .tmin { fill: none; stroke: var(--cool); stroke-width: 2.5; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 7px 14px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); color: var(--text); font-size: .86rem; }
.chip b { color: var(--accent); }
.chip:hover { border-color: var(--c1); text-decoration: none; }

/* city cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ccard { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; position: relative; }
.ccard:hover { transform: translateY(-2px); border-color: var(--c1); text-decoration: none; }
.cn { font: 800 1.2rem var(--display); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cn small { font: 600 .75rem var(--font); color: var(--muted); background: var(--surface2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.cp { font-weight: 700; font-size: 1.05rem; }
.cp em, .cm em { font-style: normal; color: var(--muted); font-weight: 400; font-size: .78rem; }
.cm { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; font-weight: 600; font-size: .92rem; }
.cm em { display: block; }
.wxmini { position: absolute; top: 14px; right: 50px; font-size: .85rem; font-weight: 600; color: var(--muted); }

/* rankings */
.rcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.rcard { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; color: var(--text); box-shadow: var(--shadow); }
.rcard:hover { border-color: var(--c1); text-decoration: none; }
.ri { grid-row: span 2; font-size: 1.6rem; width: 46px; height: 46px; display: grid; place-items: center; background: var(--surface2); border-radius: 12px; }
.rt { font-weight: 650; line-height: 1.25; }
.rw { font-size: .8rem; color: var(--muted); }
.fact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.fact-card { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; color: var(--text); font-size: .95rem; }
.fact-card .ri { grid-row: auto; flex-shrink: 0; width: 42px; height: 42px; font-size: 1.35rem; }
.fact-card:hover { border-color: var(--c1); text-decoration: none; }
.pchips { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.pchip { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; color: var(--text); }
.pchip b { grid-row: span 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--ink); color: #fff; font-size: .85rem; }
.pchip span { font-weight: 600; font-size: .92rem; line-height: 1.2; align-self: end; }
.pchip em { font-style: normal; color: var(--muted); font-size: .8rem; }
.pchip:hover { border-color: var(--c1); text-decoration: none; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.promo { padding: 24px; color: var(--text); display: block; }
.promo:hover { text-decoration: none; border-color: var(--c1); }
.promo .ri { margin-bottom: 12px; }
.promo h3 { margin-top: 0; font-family: var(--display); font-size: 1.3rem; }
.promo p { color: var(--muted); }
.about p { color: var(--muted); max-width: 80ch; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr:hover { background: var(--surface2); }
.tbl .rk { color: var(--muted); width: 2.5em; font-variant-numeric: tabular-nums; }
.tbl small { color: var(--muted); }
.tbl.rank .barcell { width: 40%; }
.tbl.rank .barcell i { display: block; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--c1), var(--c3)); }
.tbl.cmp td.win { color: var(--good); font-weight: 700; }
.tbl.cmp td.win::after { content: ' ✓'; }
.tbl.cmp .grp th { padding-top: 20px; color: var(--accent); }
.filter { margin: 0 0 12px; }
.filter input { width: 100%; max-width: 380px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); font: inherit; }
.filter.big input { max-width: 520px; padding: 14px 18px; background: var(--surface); box-shadow: var(--shadow); }

/* weather widget */
.wx { padding: 20px; min-height: 240px; }
.wx-now { display: flex; align-items: center; gap: 14px; }
.wx-ico { font-size: 3rem; line-height: 1; }
.wx-t { font: 800 3rem/1 var(--display); font-variant-numeric: tabular-nums; }
.wx-c { color: var(--muted); font-size: .95rem; }
.wx-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; color: var(--muted); margin: 10px 0 14px; }
.wx-fc { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.wx-fc div { background: var(--surface2); border-radius: 12px; padding: 8px 10px; font-size: .8rem; }
.wx-fc b { display: block; font-size: .82rem; }
.wx-warn { background: #FEF3C7; color: #78350F; border-radius: 10px; padding: 8px 12px; font-size: .85rem; font-weight: 600; margin-bottom: 10px; }
.wx-warn a { color: inherit; text-decoration: underline; }
.wx-src { font-size: .75rem; color: var(--muted); margin: 12px 0 0; }
.wx-skel { height: 180px; border-radius: 12px; background: linear-gradient(90deg, var(--surface2), var(--line), var(--surface2)); background-size: 200% 100%; animation: sk 1.4s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* open data */
.portals { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.portal { background: var(--surface2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.portals .portal { margin: 0; }
.portal h3 { margin: 0 0 8px; font-family: var(--display); font-size: 1.1rem; }
.portal h3 small { display: block; font: 400 .8rem var(--font); color: var(--muted); margin-top: 2px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 10px 0; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.fl { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.fv { font: 800 1.3rem var(--display); }
.fd { font-size: .82rem; color: var(--muted); }
.hl { margin: 8px 0 0; padding-left: 18px; font-size: .9rem; }
.hl li { margin: 4px 0; }
.hl span { color: var(--muted); font-size: .84rem; }
.srcs li { margin: 6px 0; }

/* city lists */
.cgrid { columns: 3 300px; column-gap: 16px; }
.cgroup { break-inside: avoid; margin: 0 0 16px; display: inline-block; width: 100%; }
.cgroup h2 { font-size: 1.15rem; display: flex; justify-content: space-between; }
.cgroup h2 a { color: var(--text); }
.cgroup h2 small { color: var(--muted); font: 500 .85rem var(--font); }
.clist { list-style: none; margin: 0; padding: 0; }
.clist li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.clist li span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* compare tool */
.cmp-pick { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 18px; }
.cmp-pick label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); flex: 1; min-width: 200px; }
.cmp-pick select { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); font: 500 1rem var(--font); }
.vs { font: 800 1.2rem var(--display); color: var(--accent); padding-bottom: 10px; }

/* faq */
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: '+'; color: var(--muted); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: '–'; }
.faq summary::-webkit-details-marker { display: none; }
.faq p { margin: 10px 0 0; color: var(--muted); }

/* footer */
.foot { background: var(--ink); color: #C9D2E0; margin-top: 40px; }
.foot-in { max-width: 1200px; margin: 0 auto; padding: 40px 16px 16px; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.foot .logo { color: #fff; }
.foot .logo small { color: #93A0B5; }
.foot p { font-size: .9rem; color: #93A0B5; max-width: 52ch; margin-top: 14px; }
.foot h4 { color: #fff; margin: 4px 0 10px; font-size: .9rem; }
.foot-in > div > a:not(.logo) { display: block; color: #C9D2E0; font-size: .92rem; padding: 3px 0; }
.foot .fine { max-width: 1200px; margin: 0 auto; padding: 16px 16px 32px; font-size: .78rem; color: #7D8AA0; border-top: 1px solid #1F2A3C; }
.foot .fine a { color: #93A0B5; text-decoration: underline; }

/* responsive */
@media (max-width: 1240px) {
  .mainnav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; box-shadow: var(--shadow); }
  .mainnav.open { display: flex; }
  .menu-btn { display: block; margin-left: 0; }
  .search { max-width: none; }
}
@media (max-width: 860px) {
  .city-hero, .home-hero, .two, .split { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .foot-in { grid-template-columns: 1fr 1fr; }
  .foot-in > div:first-child { grid-column: 1 / -1; }
  .home-hero { padding-top: 28px; }
}
@media (max-width: 560px) {
  .top-in { flex-wrap: wrap; gap: 10px; }
  .top .search { order: 3; flex-basis: 100%; }
  .logo small { display: none; }
  .menu-btn { margin-left: auto; }
  .card.sec { padding: 18px 16px; }
  .sv { font-size: 1.3rem; }
  .hide-sm, .tbl.rank .barcell { display: none; }
  .toc { top: 108px; }
  .sec[id] { scroll-margin-top: 160px; }
  .bar { grid-template-columns: minmax(80px, 40%) 1fr auto; }
  .wx-fc { grid-template-columns: 1fr 1fr; }
}

.wx-aq { display: flex; align-items: center; gap: 8px; font-size: .85rem; margin: 0 0 12px; color: var(--muted); }
.wx-aq span { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 8px; color: #fff; font-weight: 700; }
.wx-aq b { color: var(--text); }
.tbl.live td { vertical-align: top; }
.tbl td.win { color: var(--good); font-weight: 700; }
/* v3.2: answers, names, converter */
.qa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin: 8px 0 24px; }
.qa { padding: 18px 20px; }
.qa h2 { font: 650 1rem/1.3 var(--font); margin: 0 0 8px; color: var(--muted); }
.qa p { margin: 0; font-size: 1.02rem; }
.tbl tr.hl-row td { font-weight: 650; background: var(--surface2); }
ol.names { margin: 0; padding: 0; list-style: none; counter-reset: n; }
ol.names li { counter-increment: n; display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
ol.names li::before { content: counter(n); color: var(--muted); width: 1.8em; flex-shrink: 0; font-variant-numeric: tabular-nums; }
ol.names li a, ol.names li { font-weight: 600; }
ol.names li span { margin-left: auto; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.up { color: var(--good); font-weight: 600; } .down { color: var(--c2); font-weight: 600; } .new { color: var(--c4); font-weight: 600; font-size: .8rem; text-transform: uppercase; } .same { color: var(--muted); }
.conv { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr; gap: 12px; align-items: end; }
.conv label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.conv input, .conv select { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); font: 500 1rem var(--font); min-width: 0; }
.conv-out { grid-column: 1 / -1; font: 800 clamp(1.4rem, 4vw, 2.2rem) var(--display); padding: 8px 0; }
@media (max-width: 560px) { .conv { grid-template-columns: 1fr 1fr; } .conv label:first-child { grid-column: 1 / -1; } .qa-grid { grid-template-columns: 1fr; } }
.conv > * { min-width: 0; }
.conv input, .conv select { width: 100%; }
/* v3.3: stacked columns, tile map, bar race */
.chart-wrap.wide { max-width: none; }
.tilemap { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 620px; }
.tile { aspect-ratio: 1 / 1; border-radius: 12px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; border: 1px solid var(--line); min-width: 0; }
.tile b { font: 800 clamp(.8rem, 2.4vw, 1.1rem) var(--display); }
.tile span { font-size: clamp(.6rem, 1.6vw, .78rem); opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 95%; }
.race { display: grid; gap: 6px; }
.race-row { display: grid; grid-template-columns: 26px minmax(90px, 30%) 1fr auto; gap: 10px; align-items: center; font-size: .9rem; transition: transform .5s; }
.race-row .rk { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.race-row .bt { height: 22px; border-radius: 8px; background: var(--surface2); overflow: hidden; border: 1px solid var(--line); }
.race-row .bt i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--c4), var(--c1)); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.race-row .v { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 6ch; text-align: right; }
.yearpick { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.yearpick button { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); font: 600 .85rem var(--font); cursor: pointer; }
.yearpick button.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
@media (prefers-color-scheme: dark) { .yearpick button.is-on { background: var(--text); color: var(--bg); } }
.bignum { font: 800 clamp(2.4rem, 7vw, 4rem)/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
/* v3.4: newcomer journey */
.journey { display: grid; grid-template-columns: 1.3fr auto 1fr auto 1fr; gap: 12px; align-items: center; margin: 14px 0 6px; }
.jcol { display: grid; gap: 10px; }
.jh { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.jstep { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--surface2); border: 1px solid var(--line); color: var(--ink); transition: transform .2s, border-color .2s; }
.jstep:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--c1); }
.jstep .ji { grid-row: span 3; font-size: 1.8rem; }
.jstep .jn { font: 800 1.6rem/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.jstep .jl { font-weight: 600; }
.jstep .js { font-size: .8rem; color: var(--muted); }
.jcol:nth-of-type(3) .jstep { background: color-mix(in srgb, var(--c1) 12%, var(--surface2)); }
.jcol:nth-of-type(5) .jstep { background: color-mix(in srgb, var(--c2) 12%, var(--surface2)); }
.jarrow { font-size: 1.8rem; color: var(--muted); text-align: center; }
.perday { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.perday div { padding: 14px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); text-align: center; }
.perday b { display: block; font: 800 2rem/1 var(--display); font-variant-numeric: tabular-nums; }
.perday span { font-size: .85rem; color: var(--muted); }
@media (max-width: 860px) { .journey { grid-template-columns: 1fr; } .jarrow { transform: rotate(90deg); line-height: 1; } }
/* v3.4: phone bottom tab bar */
.botnav, .botsheet { display: none; }
@media (max-width: 760px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .botnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px); border-top: 1px solid var(--line); }
  .botnav a, .botnav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 0; background: none; color: var(--muted); font: 600 .7rem/1 var(--font); border-radius: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .botnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .botnav a[aria-current], .botnav button.on, .botnav button[aria-expanded="true"] { color: var(--c1); }
  .botnav a[aria-current] svg, .botnav button[aria-expanded="true"] svg { stroke-width: 2.4; }
  .botnav a:hover { text-decoration: none; }
  .botsheet { display: block; position: fixed; inset: 0; z-index: 59; background: rgba(5, 8, 14, .45); }
  .botsheet[hidden] { display: none; }
  .botsheet-in { position: absolute; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 20px 20px 0 0; padding: 16px 16px 12px; border-top: 1px solid var(--line); box-shadow: 0 -12px 30px rgba(0,0,0,.18); animation: sheetup .22s ease-out; }
  .botsheet-in p { margin: 0 0 10px; font-weight: 700; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
  .botgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .botgrid a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); color: var(--text); font-size: .8rem; font-weight: 600; text-align: center; }
  .botgrid a span { font-size: 1.4rem; }
  .botgrid a:hover { text-decoration: none; }
  .foot { padding-bottom: 12px; }
}
@keyframes sheetup { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .botsheet-in { animation: none; } }
/* ============ v3.5: phone-first fun ============ */
/* province tile map (home) */
.pmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; max-width: 860px; }
.pt { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-height: 86px; padding: 10px; border-radius: 14px; color: #fff; text-decoration: none !important;
  background: linear-gradient(150deg, hsl(var(--h) 75% 52%), hsl(calc(var(--h) + 35) 70% 38%)); box-shadow: 0 8px 18px -12px hsl(var(--h) 70% 30%); transition: transform .18s; }
.pt:hover { transform: translateY(-3px) scale(1.03); }
.pt b { font: 800 1.5rem/1 var(--display); }
.pt span { font-size: .66rem; line-height: 1.15; opacity: .9; }
.pt em { font-style: normal; font-size: .72rem; font-weight: 700; opacity: .95; }
/* sticky section tabs with scroll-spy */
.toc { top: calc(var(--hdr, 61px) - 1px); }
.toc a.on { background: var(--text); color: var(--bg); border-color: var(--text); }
/* tap feedback + reveal */
.ccard:active, .rcard:active, .fact-card:active, .pt:active, .stat:active, .toc a:active, .btn:active { transform: scale(.97); }
.js .rv { opacity: 0; transform: translateY(14px); transition: opacity .45s ease, transform .45s ease; }
.js .rv.in { opacity: 1; transform: none; }
/* long sections fold on phones */
.fold { position: relative; max-height: 560px; overflow: hidden; }
.fold::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 110px; background: linear-gradient(transparent, var(--surface)); pointer-events: none; }
.fold-btn { display: block; margin: 10px auto 0; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); font: 700 .86rem var(--font); cursor: pointer; }
@media (max-width: 760px) {
  /* header search tucks away while scrolling down */
  .top .search { transition: max-height .25s, opacity .2s, margin .25s; max-height: 60px; }
  .top.compact .search { max-height: 0; opacity: 0; margin: 0; overflow: hidden; pointer-events: none; }
  /* compact heroes */
  .hero h1 { font-size: clamp(1.9rem, 9vw, 2.4rem); }
  .hero .lede { font-size: 1rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .hero .lede.open { -webkit-line-clamp: unset; display: block; }
  .hero-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .hero-actions::-webkit-scrollbar { display: none; }
  .hero-actions .btn { flex: none; padding: 9px 14px; font-size: .86rem; }
  .crumbs { display: none; }
  /* swipeable rails instead of long stacks */
  .tiles, .cards, .rcards, .sec .facts { display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: minmax(46%, 1fr); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 4px 16px 10px; scroll-padding: 0 16px; }
  .cards, .rcards { grid-auto-columns: 82%; }
  .tiles::-webkit-scrollbar, .cards::-webkit-scrollbar, .rcards::-webkit-scrollbar, .sec .facts::-webkit-scrollbar { display: none; }
  .tiles > *, .cards > *, .rcards > *, .sec .facts > * { scroll-snap-align: start; }
  .tiles .stat .sv { font-size: 1.45rem; }
  .pmap { gap: 5px; }
  .pt { min-height: 62px; padding: 6px; border-radius: 10px; }
  .pt b { font-size: 1.05rem; }
  .pt span { display: none; }
  .pt em { font-size: .6rem; }
  .rail-hint { display: flex; justify-content: center; gap: 5px; margin: -2px 0 6px; }
  .rail-hint i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: background .2s, width .2s; }
  .rail-hint i.on { background: var(--c1); width: 16px; border-radius: 3px; }
}
@media (prefers-reduced-motion: reduce) { .js .rv { opacity: 1; transform: none; transition: none; } }
@media (max-width: 760px) {
  body:has(.home-hero) .top .search { display: none; }
  .home-hero h1 { font-size: clamp(2rem, 9.5vw, 2.6rem); }
  .home-hero .lede { font-size: .98rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .home-hero .lede.open { -webkit-line-clamp: unset; display: block; }
  .home-hero .hero-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .home-hero .hero-actions .btn { flex: none; }
  .clock-n { font-size: clamp(2.1rem, 11vw, 2.8rem); }
  .wx-fc { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 44%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .wx-fc::-webkit-scrollbar { display: none; }
  .wx-fc > * { scroll-snap-align: start; }
}
/* site-wide search results */
.search .results a { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; justify-content: stretch; }
.search .results a i { grid-row: span 2; font-style: normal; font-size: 1.15rem; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--surface2); }
.search .results a b { font-weight: 600; font-size: .93rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search .results a span { font-size: .76rem; }
.search .results { max-height: min(70vh, 520px); overflow-y: auto; }
