:root {
  --paper: #F4F6F5; --ink: #12343B; --seal: #C8361E; --brass: #B4862C;
  --fog: #6F8183; --wash: #DCE6E4; --card: #FFFFFF; --line: #C9D5D3; --on-ink: #F4F6F5; --gold-on-ink: #E9C77B;
  --serif: "Noto Serif SC", "Songti SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --num: "Barlow Semi Condensed", var(--sans);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1D20; --ink: #E3ECEA; --seal: #F0674D; --brass: #D9AE55;
    --fog: #93A6A8; --wash: #1D3236; --card: #142629; --line: #2A4448; --on-ink: #0F1D20; --gold-on-ink: #8A5F12;
  }
}
:root[data-theme="dark"] {
  --paper: #0F1D20; --ink: #E3ECEA; --seal: #F0674D; --brass: #D9AE55;
  --fog: #93A6A8; --wash: #1D3236; --card: #142629; --line: #2A4448; --on-ink: #0F1D20; --gold-on-ink: #8A5F12;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.6; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }

.demo-note { background: var(--seal); color: #fff; font-size: 13px; padding: 6px 16px; }

header.site { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 32px; border-bottom: 1px solid var(--line); }
.logo { font-family: var(--serif); font-weight: 900; font-size: 22px; letter-spacing: .04em; text-decoration: none; }
header.site nav a { margin-left: 24px; text-decoration: none; color: var(--fog); font-size: 14px; }

.intro { padding: 36px 32px 24px; max-width: 900px; }
.intro h1 { font-family: var(--serif); font-weight: 900; font-size: 40px; line-height: 1.25; margin: 0 0 10px; }
.intro p { margin: 0; color: var(--fog); font-size: 16px; max-width: 34em; }
.intro p b { color: var(--ink); font-weight: 600; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* 首页：整屏地图，面包屑和"查看全部"浮在地图上，列表从右边滑出 */
.mapview { position: relative; height: calc(100vh - 66px); min-height: 480px; }
#map { position: absolute; inset: 0; background: var(--wash); }
.crumbs { position: absolute; top: 12px; left: 56px; z-index: 2; max-width: calc(100% - 340px); background: var(--paper); padding: 8px 14px; font-size: 14px; color: var(--fog); border: 1px solid var(--line); }
.map-actions { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; gap: 8px; }
.list-btn, .near-btn { font: inherit; font-size: 14px; font-weight: 600; padding: 9px 16px; cursor: pointer; white-space: nowrap; }
.list-btn { color: var(--on-ink); background: var(--ink); border: 0; }
.near-btn { color: var(--ink); background: var(--paper); border: 1px solid var(--ink); }
.near-btn:disabled { opacity: .7; cursor: wait; }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #2F7DE1; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47,125,225,.25); }
.map-note { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 3; width: min(520px, calc(100% - 32px)); padding: 12px 40px 12px 16px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--ink); box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 14px; }
.map-note .linklike { font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.note-close { position: absolute; top: 6px; right: 8px; font-size: 18px; line-height: 1; color: var(--fog); background: none; border: 0; cursor: pointer; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; z-index: 3; width: min(420px, 100%); overflow-y: auto; background: var(--paper); border-left: 1px solid var(--line); }
.drawer-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; background: var(--paper); border-bottom: 1px solid var(--line); }
.drawer-close { font: inherit; font-size: 14px; color: var(--fog); background: none; border: 1px solid var(--line); padding: 4px 10px; cursor: pointer; }
.how-btn { font: inherit; font-size: 14px; color: var(--fog); background: none; border: 0; padding: 0; cursor: pointer; }
.how-btn:hover { color: var(--ink); }
dialog.how { width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; padding: 28px 28px 24px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-top: 4px solid var(--brass); box-shadow: 0 12px 40px rgba(0,0,0,.35); }
dialog.how::backdrop { background: rgba(10, 25, 28, .45); }
dialog.how h2 { font-family: var(--serif); font-size: 24px; margin: 0 0 8px; padding-right: 64px; }
dialog.how h3 { font-family: var(--serif); font-size: 17px; margin: 22px 0 6px; }
dialog.how p { margin: 0; font-size: 15px; line-height: 1.6; }
dialog.how .how-lead { color: var(--fog); }
dialog.how .gets { margin-top: 18px; }
dialog.how .gets h3 { margin-top: 0; }
dialog.how .how-fine { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--fog); }
.how-close { position: absolute; top: 16px; right: 16px; font: inherit; font-size: 14px; color: var(--fog); background: none; border: 1px solid var(--line); padding: 4px 10px; cursor: pointer; }
.theme-btn { font: inherit; font-size: 14px; margin-left: 20px; color: var(--ink); background: none; border: 1px solid var(--line); padding: 3px 10px; cursor: pointer; }

/* 地图上弹出的房源卡片 */
.listing-popup .maplibregl-popup-content { padding: 0; background: var(--paper); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.25); border-radius: 0; }
.listing-popup .maplibregl-popup-tip { border-top-color: var(--line); border-bottom-color: var(--line); }
.listing-popup .maplibregl-popup-close-button { font-size: 20px; color: var(--fog); padding: 2px 8px; }
.popup-head { padding: 10px 36px 10px 16px; font-weight: 600; border-bottom: 1px solid var(--line); }
.popup-rows { max-height: min(60vh, 420px); overflow-y: auto; }
.popup-rows .row { padding: 12px 16px 12px 14px; }
.crumbs button { font: inherit; color: var(--fog); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.crumbs b { color: var(--ink); font-weight: 600; }
.empty { padding: 28px 20px; color: var(--fog); }

.row { display: block; text-decoration: none; padding: 16px 20px 16px 18px; border-bottom: 1px solid var(--line); border-left: 4px solid var(--ink); background: var(--card); }
.row:hover { background: var(--paper); }
.row.soon { border-left-color: var(--seal); }
.row.pending { border-left-color: var(--fog); background: transparent; }
.row h3 { margin: 0; font-size: 16px; font-weight: 600; }
.row .meta { color: var(--fog); font-size: 13px; }
.price { font-family: var(--num); font-weight: 600; font-size: 22px; color: var(--brass); margin: 4px 0 8px; }
.price.tbd { font-family: var(--sans); font-size: 14px; font-weight: 400; color: var(--fog); }

.bar { position: relative; height: 6px; background: var(--wash); margin: 6px 0; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); }
.soon .bar i { background: var(--seal); }
.barlabel { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--fog); }
.barlabel b { font-family: var(--num); font-size: 15px; color: var(--ink); font-weight: 600; }
.soon .barlabel b, .flag { color: var(--seal); }
.flag { font-weight: 600; }
.muted { font-size: 13px; color: var(--fog); }

.bubble { font-family: var(--num); font-weight: 600; color: var(--on-ink); background: var(--ink); border: 3px solid var(--paper);
  border-radius: 50%; width: 58px; height: 58px; display: grid; place-content: center; line-height: 1.1; text-align: center; cursor: pointer; padding: 0; }
.bubble span { display: block; font-size: 20px; }
.bubble small { display: block; font-family: var(--sans); font-weight: 500; font-size: 10px; max-width: 52px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bubble.zero { background: var(--fog); }
.area-tag { font: inherit; font-size: 13px; white-space: nowrap; color: var(--on-ink); background: var(--ink); border: 2px solid var(--paper); padding: 4px 10px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.area-tag b { font-family: var(--num); font-size: 15px; }
.area-tag .mini { display: none; font-family: var(--num); font-size: 14px; font-weight: 600; }
.area-tag.is-mini { padding: 1px 7px; }
.area-tag.is-mini .full { display: none; }
.area-tag.is-mini .mini { display: inline; }

/* 详情页 */
.detail-wrap { padding: 40px 32px 64px; }
.detail { max-width: 760px; }
.detail .where { color: var(--fog); font-size: 14px; display: flex; justify-content: space-between; gap: 12px; }
.detail .where a { color: var(--fog); }
.detail h1 { font-family: var(--serif); font-weight: 900; font-size: 32px; line-height: 1.3; margin: 6px 0 4px; }
.detail .facts { font-size: 16px; }
.detail .bid { margin: 18px 0 28px; }
.detail .bid small { display: block; color: var(--fog); font-size: 13px; }
.detail .bid b { font-family: var(--num); font-size: 44px; font-weight: 600; color: var(--brass); line-height: 1.1; }
.detail .bid .tbd { font-size: 18px; color: var(--fog); font-weight: 400; }

.deadline { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--ink); padding: 22px 24px; }
.deadline.soon { border-top-color: var(--seal); }
.deadline h2 { font-family: var(--serif); font-size: 18px; margin: 0 0 18px; }
.timeline { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 0 0 20px; }
.timeline::before { content: ""; position: absolute; left: 6px; right: 6px; top: 6px; height: 2px; background: var(--line); }
.stop { position: relative; padding: 22px 8px 0 0; font-size: 13px; color: var(--fog); }
.stop::before { content: ""; position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink); }
.stop.now::before { background: var(--ink); }
.stop.key::before { border-color: var(--seal); background: var(--seal); }
.stop b { display: block; font-family: var(--num); font-size: 18px; color: var(--ink); font-weight: 600; }
.stop.key b { color: var(--seal); }
.deadline dl { display: grid; grid-template-columns: 7em 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.deadline dt { color: var(--fog); }
.deadline dd { margin: 0; }
.stopped { margin: 0 0 16px; color: var(--seal); font-weight: 600; }

.buy { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.buy button { font: inherit; font-size: 17px; font-weight: 600; color: var(--on-ink); background: var(--ink); border: 0; padding: 14px 26px; cursor: pointer; }
.buy button span { font-family: var(--num); color: var(--gold-on-ink); margin-left: 10px; font-size: 20px; }
.buy p { margin: 0; color: var(--ink); font-size: 14px; max-width: 30em; }
.buy .notice { flex-basis: 100%; color: var(--ink); }
.pay { margin-top: 20px; max-width: 520px; }
.pay label { display: block; font-weight: 600; margin-bottom: 8px; }
.pay-row { display: flex; gap: 8px; }
.pay input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 12px 14px; color: var(--ink); background: var(--card); border: 1px solid var(--line); }
.pay button { font: inherit; font-weight: 600; color: var(--on-ink); background: var(--ink); border: 0; padding: 0 20px; cursor: pointer; white-space: nowrap; }
.pay button:disabled { opacity: .6; cursor: wait; }
.pay button .num { color: var(--gold-on-ink); }
.pay-msg { min-height: 1.6em; margin: 8px 0 0; color: var(--seal); font-size: 14px; }
.pay .muted { margin: 0; }
.pay .linklike { font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* 详情页：购买后能得到什么，要醒目 */
.gets { margin-top: 28px; padding: 20px 24px; background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--brass); }
.gets h2 { font-family: var(--serif); font-size: 20px; margin: 0 0 12px; color: var(--ink); }
.gets ul { list-style: none; margin: 0; padding: 0; }
.gets li { position: relative; padding: 6px 0 6px 28px; font-size: 15px; color: var(--ink); line-height: 1.5; }
.gets li::before { content: "✓"; position: absolute; left: 0; top: 5px; font-weight: 700; color: var(--brass); }
.gets b { font-weight: 600; }

footer.site { border-top: 1px solid var(--line); padding: 24px 32px 40px; color: var(--fog); font-size: 13px; max-width: 900px; }

@media (max-width: 760px) {
  header.site, .intro, .detail-wrap, footer.site { padding-left: 16px; padding-right: 16px; }
  header.site nav a { display: none; }
  .intro h1 { font-size: 30px; }
  .mapview { height: calc(100svh - 58px); min-height: 420px; }
  .crumbs { top: 10px; left: 52px; max-width: calc(100% - 64px); font-size: 13px; padding: 6px 10px; }
  .map-note { bottom: 84px; }
  .map-actions { top: auto; right: auto; bottom: 28px; left: 50%; transform: translateX(-50%); }
  .list-btn, .near-btn { box-shadow: 0 4px 16px rgba(0,0,0,.25); padding: 10px 14px; }
  .theme-btn { margin-left: 0; }
  .timeline { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); row-gap: 16px; }
  .timeline::before { display: none; }
  .detail h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media (max-width: 640px) { dialog.how { padding: 22px 18px 18px; } dialog.how h2 { font-size: 20px; } }
footer.site a, dialog.how p a { color: var(--ink); text-underline-offset: 3px; }
