@font-face { font-family: "Google Sans Flex"; font-weight: 400 700; font-display: swap; src: url(fonts/google-sans-flex.woff2) format("woff2"); }
:root {
  --ink: #222;
  --muted: #6a6a6a;
  --line: #ebebeb;
  --bg: #fff;
  --accent: #ff385c;
  --good: #008a05;
  --great: #00696a;
  --warn: #c13515;
  --radius: 12px;
  --header: 64px;
  --filters: 56px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, select { font: inherit; color: inherit; }

/* ---------- header ---------- */
.topbar {
  height: var(--header); display: flex; align-items: center; gap: 24px;
  padding: 0 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--bg); z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 800; font-size: 20px; letter-spacing: -0.5px; }
.search {
  flex: 0 1 420px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
}
.search svg { color: var(--accent); flex: none; }
.search input { border: 0; outline: 0; width: 100%; background: transparent; }
.status { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }

/* ---------- filter pills ---------- */
.filters {
  height: var(--filters); display: flex; align-items: center; gap: 8px; padding: 0 24px;
  overflow-x: auto; border-bottom: 1px solid var(--line); position: sticky; top: var(--header);
  background: var(--bg); z-index: 999; scrollbar-width: none;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 1px solid #ddd; border-radius: 999px; padding: 6px 14px; font-size: 14px; background: #fff;
}
.pill:hover { border-color: var(--ink); }
.pill input[type=number] { width: 72px; border: 0; outline: 0; background: transparent; font-weight: 600; }
.pill select { border: 0; outline: 0; background: transparent; font-weight: 600; }
.pill.check { cursor: pointer; }
.sources label { cursor: pointer; display: inline-flex; gap: 4px; align-items: center; text-transform: capitalize; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.results { padding: 20px 24px 80px; min-width: 0; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.results-head h1 { font-size: 15px; font-weight: 600; margin: 0; }
.move-search { font-size: 14px; display: flex; gap: 6px; align-items: center; cursor: pointer; }
.map-wrap { position: sticky; top: calc(var(--header) + var(--filters)); height: calc(100vh - var(--header) - var(--filters)); }
#map { width: 100%; height: 100%; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 28px 20px; }
.card { cursor: pointer; text-decoration: none; color: inherit; display: block; }
.photo { position: relative; aspect-ratio: 20 / 19; border-radius: var(--radius); overflow: hidden; background: #f2f2f2; }
.photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.card:hover .photo img { transform: scale(1.03); }
.photo .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: #bbb; font-size: 13px; }
.badges { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge { background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.badge.great { color: var(--great); }
.badge.good { color: var(--good); }
.badge.warn { color: var(--warn); }
.badge.new { background: var(--ink); color: #fff; }
.badge.relist { background: #fff4e0; color: #9a5b00; }
.badge.auction { color: #6b3cc9; }
.heart {
  position: absolute; top: 10px; right: 10px; border: 0; background: none; padding: 4px; cursor: pointer;
}
.heart svg { width: 26px; height: 26px; fill: rgba(0,0,0,.45); stroke: #fff; stroke-width: 2; }
.heart.on svg { fill: var(--accent); }
.hide-btn {
  position: absolute; bottom: 10px; right: 10px; border: 0; border-radius: 999px; padding: 4px 10px;
  background: rgba(255,255,255,.92); font-size: 12px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.card:hover .hide-btn, .hide-btn:focus { opacity: 1; }
.meta { padding-top: 10px; font-size: 15px; line-height: 1.35; }
.meta .row1 { display: flex; justify-content: space-between; gap: 8px; }
.meta .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .src { color: var(--muted); font-size: 13px; text-transform: capitalize; flex: none; }
.meta .sub { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .category { color: var(--ink); font-size: 13px; font-weight: 500; }
.meta .price { margin-top: 4px; }
.meta .price b { font-weight: 700; }
.meta .price s { color: var(--muted); margin-right: 4px; }
.meta .median { color: var(--muted); font-size: 13px; }
.flags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.flag { font-size: 11px; border-radius: 4px; padding: 2px 6px; }
.flag.red { background: #fdeceb; color: var(--warn); }
.flag.green { background: #e8f5e9; color: var(--good); }
.card.active .photo { outline: 3px solid var(--ink); outline-offset: 2px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- map price pills ---------- */
.price-pin {
  background: #fff; color: var(--ink); border-radius: 999px; padding: 5px 10px; font-weight: 700;
  font-size: 13px; white-space: nowrap; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.18);
  transform: translate(-50%, -50%); display: inline-block; transition: transform .12s;
}
.price-pin.deal { color: var(--great); }
.price-pin.active, .price-pin:hover { background: var(--ink); color: #fff; transform: translate(-50%, -50%) scale(1.08); z-index: 1000; }
.leaflet-div-icon { background: none; border: 0; }
.pin-wrap.active { z-index: 10000 !important; }
.leaflet-popup-content-wrapper { border-radius: var(--radius); padding: 0; overflow: hidden; }
.leaflet-popup-content { margin: 0; width: 260px !important; }
.popup img { width: 100%; height: 160px; object-fit: cover; display: block; background: #f2f2f2; }
.popup .meta { padding: 10px 12px 12px; }

/* ---------- mobile ---------- */
.toggle-view {
  display: none; position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 1001;
  background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,.25); cursor: pointer;
}
@media (max-width: 860px) {
  .topbar { padding: 0 16px; gap: 12px; }
  .brand span, .status { display: none; }
  .filters { padding: 0 16px; }
  .results { padding: 16px 16px 90px; }
  .layout { grid-template-columns: 1fr; }
  .map-wrap { display: none; }
  .layout.show-map .results { display: none; }
  .layout.show-map .map-wrap { display: block; }
  .toggle-view { display: block; }
}

/* ---------- tagline ---------- */
.tagline { margin: 0 0 14px; color: var(--muted); font-size: 15px; line-height: 1.45; max-width: 60ch; }
.tagline b { color: var(--ink); }

/* ---------- analysis drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1999; opacity: 0; pointer-events: none; transition: opacity .2s; }
body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
body.drawer-open { overflow: hidden; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--bg); z-index: 2000;
  overflow-y: auto; box-shadow: -8px 0 30px rgba(0,0,0,.18); overscroll-behavior: contain;
}
.drawer[hidden] { display: none; }
.p-head { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 12px; z-index: 2; pointer-events: none; }
.p-close { pointer-events: auto; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); cursor: pointer; font-size: 15px; }
.p-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; margin-top: -60px; background: #f2f2f2; }
.p-body { padding: 20px 24px 48px; }
.p-title h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.3px; }
.p-price { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 10px; flex-wrap: wrap; }
.p-price .big { font-size: 28px; font-weight: 700; }
.btn { background: var(--accent); color: #fff; text-decoration: none; padding: 11px 18px; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.verdict { padding: 12px 14px; border-radius: 10px; background: #f4f4f4; font-weight: 600; }
.verdict.good { background: #e6f4ea; color: var(--good); }
.verdict.bad { background: #fdeceb; color: var(--warn); }
.verdict.warn { background: #fff4e0; color: #9a5b00; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.45; }
.psec { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 20px; }
.psec h3 { font-size: 19px; margin: 0 0 12px; }
.psec h4 { font-size: 15px; margin: 18px 0 8px; }
.psec details summary { cursor: pointer; list-style: none; }
.psec details summary h3 { display: inline; }
.psec details summary::after { content: " ▾"; color: var(--muted); }

.range { position: relative; height: 54px; margin: 34px 4px 4px; }
.range::before { content: ""; position: absolute; left: 0; right: 0; top: 24px; height: 6px; background: #eee; border-radius: 3px; }
.range-band { position: absolute; top: 24px; height: 6px; background: #b9e0c4; border-radius: 3px; }
.range-tick { position: absolute; top: 14px; width: 2px; height: 26px; background: var(--ink); }
.range-tick span { position: absolute; transform: translateX(-50%); white-space: nowrap; font-size: 13px; font-weight: 600; }
.range-tick.fair span { top: -22px; }
.range-tick.ask { background: var(--accent); }
.range-tick.ask span { top: 30px; color: var(--accent); }
.range-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 8px 0 6px; }

.waterfall { width: 100%; border-collapse: collapse; font-size: 14px; }
.waterfall td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.waterfall td:first-child { padding-right: 10px; }
.waterfall .bar-cell { width: 28%; padding: 0 10px; }
.wbar { display: block; height: 8px; border-radius: 4px; min-width: 2px; }
.wbar.up { background: var(--good); }
.wbar.down { background: var(--warn); }
.waterfall .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.waterfall .num.up { color: var(--good); }
.waterfall .num.down { color: var(--warn); }
.waterfall .total td { font-weight: 700; border-bottom: 0; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin: 0 0 12px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.note { background: #fff8e6; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.desc summary { cursor: pointer; font-weight: 600; margin-top: 12px; }
.desc p { font-size: 14px; line-height: 1.5; color: #444; }

.scatter { width: 100%; height: auto; font-size: 11px; fill: var(--muted); }
.scatter .grid { stroke: #eee; }
.scatter circle.same { fill: var(--ink); fill-opacity: .75; }
.scatter circle.other { fill: #bbb; }
.scatter circle.old { fill-opacity: .35; }
.scatter circle.self { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.scatter .fair-line { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .7; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); align-items: center; }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: -8px; }
.legend .dot.self { background: var(--accent); }
.legend .dot.same { background: var(--ink); }
.legend .dot.other { background: #bbb; }
.legend .dash { display: inline-block; width: 18px; border-top: 2px dashed var(--accent); margin-right: -8px; }

.guide ul, .psec ul.checks { padding-left: 20px; margin: 0; line-height: 1.5; font-size: 14px; }
.guide li, .psec ul.checks li { margin-bottom: 4px; }
.guide ul.good li::marker { color: var(--good); }
.guide ul.bad li::marker { color: var(--warn); }
.rating { display: inline-block; background: #f4f4f4; border-radius: 999px; padding: 4px 12px; font-size: 13px; margin-bottom: 10px; }
.verdict-line { font-size: 14px; }
.video { display: inline-block; margin-top: 8px; font-weight: 600; color: #c4302b; text-decoration: none; }
.model-note { margin-top: 28px; }
.p-loading { padding: 80px 24px; text-align: center; color: var(--muted); }
@media (max-width: 860px) { .p-body { padding: 16px 16px 48px; } .facts { grid-template-columns: 1fr 1fr; } }

.timeline { margin: 8px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.7; }
.timeline .muted { display: inline-block; min-width: 52px; }

/* ---------- analysis drawer v4 (report.js styles are injected) ---------- */
.drawer { width: min(700px, 100vw); background: #f4f7fc; }
.p-bg { position: sticky; top: 0; height: 0; z-index: 0; }
.p-bg::before { content: ""; position: absolute; left: -10%; right: -10%; top: -120px; height: 360px; background: radial-gradient(closest-side, rgba(96,165,250,.35), rgba(99,102,241,.18) 60%, transparent); filter: blur(10px); }
.p-photo-hero { height: 200px; border-radius: 20px; background-size: cover; background-position: center; margin: 0 0 14px; box-shadow: 0 10px 30px rgba(20,14,8,.15); }
.p-wrap { position: relative; z-index: 1; padding: 16px; }
.p-x { border: 0; background: #fff; box-shadow: 0 0 0 1px #e2e8f0; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 13px; color: #0f172a; }
.p-link { text-decoration: none; background: #0b1b3f; color: #fff; font: 600 12px -apple-system, sans-serif; padding: 8px 12px; border-radius: 10px; }
.fbg .scatter { width: 100%; height: auto; } .fbg .legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: #64748b; margin-top: 4px; }
.fbg .legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.fbg .legend .dot.self { background: #2563eb; } .fbg .legend .dot.same { background: #141414; } .fbg .legend .dot.other { background: #cbd5e1; }
.fbg .legend .dash { display: inline-block; width: 14px; border-top: 2px dashed #2563eb; margin-right: 4px; vertical-align: middle; }
.fbg .scatter .grid { stroke: #e2e8f0; } .fbg .scatter text { font-size: 10px; fill: #64748b; }
.fbg .scatter circle.same { fill: #141414; fill-opacity: .75; } .fbg .scatter circle.other { fill: #cbd5e1; } .fbg .scatter circle.self { fill: #2563eb; stroke: #fff; stroke-width: 2; }
.fbg .scatter .fair-line { fill: none; stroke: #2563eb; stroke-dasharray: 5 4; stroke-width: 1.5; }
.fbg .timeline { margin: 6px 0 0; padding-left: 18px; font-size: 12px; } .fbg .desc-txt { max-height: 220px; overflow: auto; color: #334155; font-size: 12.5px; }
.fbg .psec { margin: 0; } .fbg .psec h3, .fbg .psec summary h3 { font-size: 12.5px; } .fbg .psec ul.checks { padding-left: 16px; font-size: 12px; }
.fbg details summary { cursor: pointer; }

/* drawer motion */
.drawer { transform: translateX(104%); transition: transform .42s cubic-bezier(.2,.85,.25,1); will-change: transform; }
.drawer.open { transform: none; }
.scrim { transition: opacity .35s ease; }
.p-photo-hero { animation: fb-photo .6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes fb-photo { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
.card { transition: transform .2s ease; }
@media (prefers-reduced-motion: reduce) { .drawer, .scrim, .p-photo-hero { transition: none; animation: none; } }

/* ---------- sharing: friends panel and key login ---------- */
.team-btn { flex: none; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 8px 16px; font-size: 14px; cursor: pointer; }
.team-btn:hover { box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.team { position: fixed; top: var(--header); right: 0; bottom: 0; width: min(420px, 100vw); background: var(--bg); border-left: 1px solid var(--line);
  z-index: 1500; overflow-y: auto; padding: 16px 20px 32px; box-shadow: -8px 0 24px rgba(0,0,0,.06); }
.team[hidden] { display: none; }
.team-head { display: flex; align-items: center; justify-content: space-between; }
.team-head h2 { margin: 0; font-size: 20px; }
.team-close { border: 0; background: none; font-size: 28px; line-height: 1; cursor: pointer; color: var(--muted); }
.team h3 { font-size: 14px; margin: 20px 0 8px; color: var(--muted); font-weight: 600; }
.team table { width: 100%; border-collapse: collapse; font-size: 14px; }
.team td, .team th { padding: 8px 0; border-bottom: 1px solid var(--line); text-align: left; }
.team th { font-size: 12px; color: var(--muted); font-weight: 600; }
.team td.n, .team th.n { text-align: right; }
.team .deal { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.team .deal img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--line); flex: none; }
.team .deal small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.team .muted { color: var(--muted); font-size: 14px; }
.login { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 3000; display: grid; place-items: center; padding: 16px; }
.login[hidden] { display: none; }
.login-card { width: min(360px, 100%); background: var(--bg); border-radius: var(--radius); padding: 24px; display: grid; gap: 12px; }
.login-card h2 { margin: 0; } .login-card p { margin: 0; color: var(--muted); font-size: 14px; }
.login-card input { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.login-card button { border: 0; border-radius: 8px; padding: 10px 12px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.login-err { color: var(--warn) !important; }
