/* HOMES by Jo — 3D explorer. Layout: top bar, then find/filter | 3D stage | unit card or stack ranking.
   Brand tokens follow homesbyjo.sg: cream canvas #f7f2ea, logo brown #5A4632, terracotta #7A2E1E, Playfair Display + Karla.
   Sun amber is semantic (direct sun), teal marks filter matches, gold marks the selected unit. */
:root {
  --canvas: #f7f2ea;
  --surface: #fff;
  --sunken: #f4ede6;
  --line: #e2d9d1;
  --ink: #291f18;
  --heading: #3d2f22;
  --muted: #6c6158;
  --accent: #7A2E1E;
  --accent-hover: #62241a;
  --dark: #34251a;
  --on-dark: #f9f4ee;
  --sun: #eb881f;
  --sun-deep: #bd4600;
  --sun-pale: #fad8ab;
  --shade: #535c66;
  --behind: #cbd2d7;
  --night: #353e47;
  --match: #26998e;
  --select: #e3ae28;
  --facade: #ebe7e2;
  --ground: #e8e9e0;
  --sky-top: #b7d7e7;
  --sky-bottom: #f7f1e7;
  --wa: #298646;
  --focus: #0f74c5;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: Karla, "Segoe UI", system-ui, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
/* Older browsers (e.g. iOS 15.0–15.3) read the hex values above; everything else uses the exact oklch tokens. */
@supports (color: oklch(0 0 0)) {
  :root {
    --sunken: oklch(0.95 0.012 65);
    --line: oklch(0.89 0.015 65);
    --ink: oklch(0.25 0.02 60);
    --muted: oklch(0.5 0.02 60);
    --dark: oklch(0.28 0.03 60);
    --on-dark: oklch(0.97 0.01 75);
    --sun: oklch(0.72 0.16 60);
    --sun-deep: oklch(0.55 0.17 45);
    --sun-pale: oklch(0.9 0.07 75);
    --shade: oklch(0.47 0.02 250);
    --behind: oklch(0.86 0.01 240);
    --night: oklch(0.36 0.02 250);
    --match: oklch(0.62 0.1 185);
    --select: oklch(0.78 0.15 85);
    --facade: oklch(0.93 0.008 75);
    --ground: oklch(0.93 0.012 110);
    --sky-top: oklch(0.86 0.04 230);
    --sky-bottom: oklch(0.96 0.015 80);
    --wa: oklch(0.55 0.13 150);
    --focus: oklch(0.55 0.15 250);
  }
}
/* One theme only: the HOMES by Jo light palette, whatever the visitor's OS or host page theme is. */
:root, :root[data-theme] { color-scheme: light; }

[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.45 var(--font-body); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------- shell ---------- */
.shell { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: 300px minmax(0, 1fr) 340px;
  grid-template-areas: "top top top" "left stage right"; gap: 14px; padding: 0 16px 16px; box-sizing: border-box; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: inline-flex; align-items: baseline; gap: 5px; text-decoration: none; color: var(--heading); flex: none; }
.brand-homes { font: 700 19px/1 var(--font-display); letter-spacing: 0.08em; }
.brand-by { font: italic 500 16px/1 var(--font-display); color: var(--accent); }
.topbar-title { display: flex; gap: 8px; align-items: baseline; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topbar-title .proj { font: 600 17px/1.2 var(--font-display); color: var(--heading); }
.tabs { margin-left: auto; display: flex; gap: 6px; }
.tab { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600; font-size: 14px; }
.tab:hover { border-color: var(--muted); }
.count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--sunken); font: 500 12px/18px var(--font-data); text-align: center; }
.wa-btn, .btn.wa { background: var(--wa); color: #fff; border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.wa-btn:hover, .btn.wa:hover { filter: brightness(0.92); }

.panel { min-width: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 2px; }
.panel.left { grid-area: left; }
.panel.right { grid-area: right; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.eyebrow { margin: 0; font: 500 11px/1.2 var(--font-data); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); display: flex; justify-content: space-between; align-items: baseline; }
.eyebrow .match { text-transform: none; letter-spacing: 0; color: var(--match); font-weight: 500; }
.note { margin: 0; font-size: 12.5px; color: var(--muted); padding: 0 2px 8px; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 7px 11px; cursor: pointer; font-weight: 600; font-size: 14px; line-height: 1.2; }
.btn:hover { border-color: var(--muted); }
.btn.dark { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
.btn.primary { background: var(--accent); color: #fff; border: 0; padding: 12px; font-size: 15px; }
.btn.primary:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn[aria-pressed="true"] { background: var(--select); border-color: var(--select); color: oklch(0.25 0.03 60); }
.linkish { border: 0; background: none; padding: 2px 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: 14px; align-self: flex-start; }

/* find */
.find-row { display: flex; gap: 8px; }
.find-row input { flex: 1; min-width: 0; font: 500 17px/1 var(--font-data); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.find-msg { margin: 0; font-size: 13px; color: var(--muted); min-height: 1.4em; }
.find-msg.ok { color: var(--ink); }
.find-msg.err { color: oklch(0.55 0.18 30); }
.selects { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
select, input[type="date"] { background: var(--canvas); border: 1px solid var(--line); border-radius: 9px; padding: 7px 8px; min-width: 0; font-size: 14px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: var(--canvas); border-radius: 999px; padding: 5px 10px; cursor: pointer; font-size: 13px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.chips button .sw { width: 9px; height: 9px; border-radius: 50%; }
.chips button .n { font: 500 11px/1 var(--font-data); color: var(--muted); }
.chips button[aria-pressed="true"] { background: color-mix(in oklab, var(--match) 18%, var(--surface)); border-color: var(--match); }
.chips.small button { padding: 4px 9px; font-size: 12.5px; }
.lvl { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
input[type="range"] { accent-color: var(--accent); width: 100%; }

/* modes */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px; text-align: center; font-weight: 600; font-size: 13px; background: var(--canvas); }
.seg input:checked + span { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, var(--surface)); color: var(--heading); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.legend { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.legend .row { display: flex; flex-wrap: wrap; gap: 5px 12px; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend .ramp { height: 9px; border-radius: 3px; }
.legend .ramp-labels { display: flex; justify-content: space-between; font: 11px/1 var(--font-data); color: var(--muted); }
.legend .caption { color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--accent); }
.range-row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); padding-left: 24px; }
.range-row[hidden] { display: none; }
.range-row input { width: 100%; accent-color: var(--sun-deep); }

/* ---------- stage ---------- */
.stage { grid-area: stage; position: relative; min-width: 0; min-height: 0; border-radius: 16px; overflow: hidden; background: var(--sky-bottom); border: 1px solid var(--line); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.wm { position: absolute; inset: 0; pointer-events: none; }
.sunbar { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: color-mix(in oklab, var(--surface) 92%, transparent); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.clock { font: 600 30px/1 var(--font-display); color: var(--heading); font-variant-numeric: tabular-nums; min-width: 6.2ch; }
.clock .ampm { font-size: 15px; margin-left: 3px; color: var(--muted); }
.sun-main { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.timerow { display: flex; align-items: center; gap: 10px; }
.play { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; background: var(--sun-deep); color: #fff; display: grid; place-items: center; }
.play svg { width: 14px; height: 14px; fill: currentColor; }
.sunline { margin: 0; font-size: 13px; color: var(--muted); }
.sunline b { color: var(--ink); font-weight: 600; }
.sun-date { display: flex; flex-direction: column; gap: 6px; }
.sun-date .chips button[aria-pressed="true"] { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }

.camctl { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; gap: 6px; align-items: center; }
.camctl .btn { background: color-mix(in oklab, var(--surface) 92%, transparent); }
.compass { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: color-mix(in oklab, var(--surface) 92%, transparent); border-radius: 999px; padding: 4px 10px 4px 4px; cursor: pointer; font: 500 12px/1 var(--font-data); }
.compass svg { width: 28px; height: 28px; }
.compass .n { fill: var(--accent); }
.compass .s { fill: var(--muted); }
.viewbar { position: absolute; top: 12px; left: 12px; right: 210px; z-index: 3; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--dark); color: var(--on-dark); border-radius: 12px; padding: 8px 10px 8px 14px; }
.viewbar .muted { color: color-mix(in oklab, var(--on-dark) 70%, transparent); margin-left: 8px; font-size: 13px; }
.viewbar-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.viewbar .btn { background: transparent; color: var(--on-dark); border-color: color-mix(in oklab, var(--on-dark) 35%, transparent); padding: 5px 9px; }
.viewbar .btn.dark { background: var(--on-dark); color: var(--dark); }
.viewbar .lv { font: 500 13px/1 var(--font-data); min-width: 3ch; text-align: center; }
.viewer-badge { position: absolute; right: 12px; top: 56px; pointer-events: none; font: 500 11px/1 var(--font-data); padding: 6px 9px; border-radius: 6px;
  background: color-mix(in oklab, var(--surface) 85%, transparent); color: var(--muted); }
.tip { position: absolute; pointer-events: none; z-index: 4; transform: translate(14px, -50%); background: var(--dark); color: var(--on-dark); border-radius: 9px; padding: 8px 10px; font-size: 13px; line-height: 1.4; box-shadow: 0 6px 20px rgb(0 0 0 / 0.25); white-space: nowrap; }
.tip b { font: 600 13px/1.2 var(--font-data); }
.tip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.loading { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); padding: 7px 12px; border-radius: 999px; font-size: 13px; }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- unit card ---------- */
.unit-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.unit-head h2 { margin: 0; font: 600 34px/1 var(--font-display); color: var(--heading); font-variant-numeric: tabular-nums; }
.unit-addr { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.pill { display: inline-block; font: 600 11px/1 var(--font-body); letter-spacing: 0.04em; padding: 5px 8px; border-radius: 999px; background: var(--dark); color: var(--on-dark); }
.pill.lux { background: oklch(0.45 0.08 220); color: #fff; }
.x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 4px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font: 500 10.5px/1.2 var(--font-data); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.facts dd { margin: 3px 0 0; font-weight: 600; font-size: 15px; color: var(--heading); }
.facts dd small { font-weight: 400; color: var(--muted); font-size: 13px; }
.sunbox { background: var(--sunken); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.sunbox .hrs { display: flex; gap: 16px; align-items: baseline; }
.sunbox .hrs b { font: 600 22px/1 var(--font-display); color: var(--heading); }
.sunbox .hrs span { font-size: 12.5px; color: var(--muted); }
.strip { display: flex; height: 14px; border-radius: 4px; overflow: hidden; }
.strip i { flex: 1; }
.strip-labels { display: flex; justify-content: space-between; font: 10.5px/1 var(--font-data); color: var(--muted); }
.sunbox p { margin: 0; font-size: 13px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.actions .full { grid-column: 1 / -1; }
.plan-thumb { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--canvas); cursor: zoom-in; padding: 0; display: block; width: 100%; }
.plan-thumb canvas { display: block; width: 100%; height: auto; }
.plan-cap { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.plan-cap .linkish { font-size: 12.5px; }

/* ---------- ranking ---------- */
.ranking { padding: 0; gap: 0; overflow: hidden; min-height: 0; flex: 1; }
.rank-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.rank-head select { padding: 5px 8px; font-weight: 600; }
.table-wrap { overflow: auto; flex: 1; min-height: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: var(--surface); text-align: left; font: 500 10px/1.2 var(--font-data); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 8px 7px; border-bottom: 1px solid var(--line); }
td { padding: 6px 7px; border-bottom: 1px solid color-mix(in oklab, var(--line) 60%, transparent); white-space: nowrap; }
td.stk { font: 500 13px/1 var(--font-data); }
td.sm { color: var(--muted); font-size: 12px; }
.num { text-align: right; }
td.num { font-family: var(--font-data); }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr.sel { background: color-mix(in oklab, var(--select) 22%, transparent); }
.hint { margin: 0; padding: 10px 12px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgb(20 15 10 / 0.55); }
.modal-box { width: 100%; max-width: 560px; max-height: calc(100% - 32px); overflow: auto; box-sizing: border-box; background: var(--surface); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-box.wide { max-width: 980px; }
.plan-box { max-width: 1100px; height: calc(100% - 32px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal-head h3 { margin: 0; font: 600 22px/1.2 var(--font-display); color: var(--heading); }
.zoom-btns { display: flex; gap: 6px; }
.plan-view { position: relative; flex: 1; min-height: 240px; overflow: hidden; border-radius: 10px; background: var(--canvas); border: 1px solid var(--line); cursor: grab; touch-action: none; }
.plan-view canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fine { margin: 0; font-size: 12px; color: var(--muted); }
.sl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: sl; }
.sl-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; counter-increment: sl; }
.sl-list li::before { content: counter(sl); font: 600 20px/1 var(--font-display); color: var(--muted); width: 1.2ch; }
.sl-list .grow { flex: 1; min-width: 0; }
.sl-list b { font: 600 15px/1.2 var(--font-data); }
.sl-list small { display: block; color: var(--muted); font-size: 12.5px; }
.sl-list .mini { padding: 4px 8px; font-size: 13px; }
.empty { margin: 0; color: var(--muted); }
.ready { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
.ready legend { font: 500 11px/1 var(--font-data); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); padding: 0 4px; }
.ready .q { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.ready .q span { width: 100%; font-weight: 600; }
.ready label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.modal-actions { display: flex; gap: 8px; }
.cmp th, .cmp td { white-space: normal; vertical-align: top; }
.cmp th[scope="row"] { position: static; width: 120px; }
.cmp td b { font: 600 18px/1.2 var(--font-data); }
.cmp canvas { width: 100%; max-width: 260px; border: 1px solid var(--line); border-radius: 8px; cursor: zoom-in; }

/* ---------- gate ---------- */
.gate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
  background: color-mix(in oklab, var(--canvas) 70%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.gate-card { width: 100%; max-width: 420px; box-sizing: border-box; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 24px 60px rgb(40 25 10 / 0.18); }
.brand.big .brand-homes { font-size: 22px; }
.gate-card h2 { margin: 4px 0 0; font: 600 27px/1.15 var(--font-display); color: var(--heading); text-wrap: balance; }
.gate-lede { margin: 0; color: var(--muted); }
.gate-step { display: flex; flex-direction: column; gap: 8px; }
.gate-step label { font: 500 11px/1 var(--font-data); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-top: 4px; }
.gate-step input { padding: 11px 12px; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
#gCode { font: 500 22px/1 var(--font-data); letter-spacing: 0.4em; text-align: center; }
.sent { margin: 0; font-size: 14px; color: var(--ink); }
.devcode { margin: 0; font: 13px/1.4 var(--font-data); background: color-mix(in oklab, var(--sun) 16%, transparent); padding: 8px 10px; border-radius: 8px; }
.gate-err { margin: 0; color: oklch(0.55 0.18 30); min-height: 1em; font-size: 14px; }
.gate-fine { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .shell { grid-template-columns: 290px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "top top" "left stage" "right right"; }
  .panel.right { flex-direction: row; overflow: visible; }
  .panel.right > .card { flex: 1; min-width: 0; max-height: 520px; }
}
@media (max-width: 820px), (max-height: 500px) {
  html, body { height: auto; }
  .shell { display: flex; flex-direction: column; height: auto; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .titlerow { order: 3; width: 100%; flex: none; }
  .stage { height: 70vh; min-height: 420px; order: 1; }
  .panel.left { order: 3; overflow: visible; }
  .panel.right { order: 2; flex-direction: column; }
  .panel.right > .card { max-height: none; }
  .ranking { max-height: 60vh; }
  .sunbar { gap: 8px; padding: 8px 10px; }
  .clock { font-size: 24px; }
  .sun-date { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .viewbar { right: 12px; top: 58px; }
  .wa-btn { padding: 7px 11px; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* Guest preview: soft sign-in */
.gate.soft { background: rgb(30 20 10 / 0.38); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.gate-card { position: relative; }
.gate-x { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
.gate-x:hover { background: var(--canvas); color: var(--heading); }
.gate-x:focus-visible, .guest-pill:focus-visible, .tab.signin:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gate:not(.soft) .gate-x, .gate:not(.soft) .gate-later { display: none; }
.gate-later { align-self: center; font-size: 13px; color: var(--muted); }
.tab.signin { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab.signin:hover { background: var(--accent-hover); }
.guest-pill { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 4; max-width: calc(100% - 24px); box-sizing: border-box;
  border: 0; border-radius: 999px; padding: 9px 16px; background: var(--dark); color: var(--on-dark); font: 500 13px/1.3 var(--font-body, Karla, sans-serif); cursor: pointer; box-shadow: 0 6px 20px rgb(40 25 10 / 0.25); text-align: center; }
.guest-pill b { color: var(--sun, #e8913a); margin-right: 6px; font-weight: 700; }
.guest-pill:hover { filter: brightness(1.08); }
.locked { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 14px; color: var(--muted); font-size: 14px; }
.locked .btn { align-self: stretch; }
@media (max-width: 720px) { .guest-pill { display: none; } }

/* Google photo-real layer: credits (must stay visible while tiles show) and the alignment HUD */
.attrib { position: absolute; right: 12px; top: 92px; z-index: 3; max-width: min(60%, 420px); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
  font: 500 10.5px/1.3 var(--font-body); color: #fff; background: rgb(0 0 0 / 0.45); padding: 4px 8px; border-radius: 6px; pointer-events: none; text-align: right; }
.attrib img { height: 14px; width: auto; }
.calib { position: absolute; left: 12px; bottom: 140px; z-index: 5; font: 500 12px/1.45 var(--font-data); color: #fff; background: rgb(20 14 8 / 0.85); padding: 10px 12px; border-radius: 10px; white-space: pre; }

/* Floor plan ↔ AI design idea */
.plan-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; background: var(--canvas); }
.plan-tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font: 600 13px/1 var(--font-body); color: var(--muted); cursor: pointer; }
.plan-tabs button[aria-selected="true"] { background: var(--dark); color: var(--on-dark); }
.plan-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.idea { border-color: var(--accent); color: var(--accent); }
.ai-badge { display: inline-block; font: 600 10px/1 var(--font-data); letter-spacing: 0.08em; padding: 3px 6px; border-radius: 4px; background: color-mix(in oklab, var(--accent) 14%, var(--surface)); color: var(--accent); margin-left: 6px; vertical-align: middle; }

/* ---------- facilities ---------- */
.closeto { display: grid; gap: 6px; margin-top: 4px; }
.mini-h { font: 600 11px/1 var(--font-data); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chips button[data-close][aria-pressed="true"] { background: color-mix(in oklab, var(--accent) 14%, var(--surface)); border-color: var(--accent); color: var(--accent); }
.close-rank { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink); }
.close-rank button { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
.route-chip { position: absolute; top: 12px; left: 12px; z-index: 3; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 260px);
  background: var(--dark); color: var(--on-dark); border-radius: 999px; padding: 6px 6px 6px 14px; font-size: 13px; box-shadow: 0 4px 16px rgb(0 0 0 / .18); }
.route-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-chip button { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .16); color: inherit; font-size: 16px; cursor: pointer; }
@media (max-width: 720px) { .route-chip { top: 56px; max-width: calc(100% - 24px); } }
.nearby { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; }
.nearby h3 { margin: 0 0 2px; font: 600 11px/1 var(--font-data); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.nearby h3 .linkish { font: 500 12.5px var(--font-body); letter-spacing: 0; text-transform: none; }
.near-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; width: 100%; text-align: left; border: 1px solid transparent; background: none; border-radius: 8px; padding: 5px 6px; cursor: pointer; font: inherit; color: inherit; }
.near-row:hover, .near-row[aria-pressed="true"] { background: var(--sunken); border-color: var(--line); }
.near-row .cat { font-weight: 600; font-size: 13.5px; }
.near-row .d { font: 500 12.5px var(--font-data); color: var(--heading); white-space: nowrap; }
.near-row .nm { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.near-row .nm i, .fac-list i { flex: none; width: 16px; height: 16px; border-radius: 50%; color: #fff; font: 700 9px/16px var(--font-body); font-style: normal; text-align: center; }
.nearby .fine { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }
.fac-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px 22px; }
.fac-list h4 { margin: 0 0 6px; font: 600 15px var(--font-display); color: var(--heading); grid-column: 1 / -1; }
.fac-list .club { display: grid; gap: 3px; align-content: start; }
.fac-list .club h4 { grid-column: auto; }
.fac-list button { display: flex; gap: 8px; align-items: center; border: 0; background: none; padding: 3px 4px; border-radius: 6px; text-align: left; font: inherit; font-size: 13.5px; color: inherit; cursor: pointer; }
.fac-list button:hover { background: var(--sunken); }
.fac-list button .d { margin-left: auto; font: 500 12px var(--font-data); color: var(--muted); white-space: nowrap; }
.fac-list small { color: var(--muted); }

/* ---- V2: surroundings, landmarks, outlook ---- */
.seg label.wide { grid-column: 1 / -1; }
.legend .row.col { flex-direction: column; gap: 4px; }
.lm-chips { margin: -2px 0 2px 24px; }
.lm-chips button .sw { width: 9px; height: 9px; border-radius: 50%; }
.outlook { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.outlook h3 { margin: 0; font: 600 11px/1 var(--font-data); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.outlook h3 .linkish { font: 500 12.5px var(--font-body); letter-spacing: 0; text-transform: none; }
.ol-row { display: grid; gap: 4px; padding: 8px 10px; border-radius: 10px; background: var(--sunken); }
.ol-row p { margin: 0; font-size: 13.5px; }
.ol-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ol-head .ol-cls { margin-left: auto; font: 500 11.5px var(--font-data); color: var(--muted); }
.ol-sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: none; margin-right: 4px; vertical-align: -1px; }
.ol-bands { font-size: 12.5px !important; color: var(--muted); }
.ol-lms { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; align-items: center; }
.ol-lms > span:first-child { font: 500 10.5px var(--font-data); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); width: 100%; }
.ol-lms .lm { display: inline-flex; align-items: center; gap: 5px; }
.ol-lms .lm i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ol-lms small { color: var(--muted); font-family: var(--font-data); }
.lm-list .club button .d { white-space: nowrap; }
.ol-row .ol-look { font-size: 13px; margin-top: 2px; }

/* ---- V2: free units + Continue with Google ---- */
.free-note { font-size: 13px; padding: 8px 10px; border-radius: 10px; background: color-mix(in oklab, var(--accent) 9%, var(--surface)); border: 1px solid color-mix(in oklab, var(--accent) 25%, var(--line)); }
.free-note .linkish { font-size: 13px; padding: 0; }
.gate-step .lbl-note { text-transform: none; letter-spacing: 0; font: 400 12px var(--font-body); color: var(--muted); margin-left: 4px; }
.gsi-wrap { display: flex; justify-content: center; min-height: 44px; margin-top: 6px; }
.gsi-preview { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; max-width: 380px; height: 44px; border-radius: 999px; border: 1px solid #dadce0; background: #fff; color: #1f1f1f; font: 500 15px Roboto, Karla, Arial, sans-serif; cursor: pointer; }
.gsi-preview svg { width: 18px; height: 18px; }
.gsi-preview small { color: #5f6368; font-weight: 400; }
.gate-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.gate-or::before, .gate-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* =================================================================================================
   Basic / Advanced
   Basic (default): find a unit, a clean 3D view, a plain-language unit card, WhatsApp.
   Advanced: everything above plus filters, colour modes, layers, rankings, dates, walks and compare.
   ================================================================================================= */
.titlerow { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.titlerow .topbar-title { min-width: 0; }
.modeswitch { flex: none; display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.modeswitch button { border: 0; background: none; border-radius: 999px; padding: 6px 12px; font: 600 13px/1 var(--font-body); color: var(--muted); cursor: pointer; white-space: nowrap; }
.modeswitch button[aria-pressed="true"] { background: var(--dark); color: var(--on-dark); }
.modeswitch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tab { white-space: nowrap; }

/* back to the property page: the project name in the top bar is the link (the breadcrumb once PR-B lands) */
.topbar-title .back { display: inline-flex; align-items: baseline; gap: 6px; color: var(--heading); text-decoration: none; border-radius: 6px; }
.topbar-title .back .arr { font-family: var(--font-body); font-weight: 600; color: var(--accent); transition: transform .15s; }
.topbar-title .back:hover { text-decoration: underline; text-underline-offset: 3px; }
.topbar-title .back:hover .arr { transform: translateX(-2px); }
.topbar-title .back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tab { display: inline-flex; align-items: center; gap: 5px; }
.tab-ico { display: none; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }

#startCard, .basic-note { display: none; }
body.basic #unitCard[hidden] ~ #startCard { display: flex; }
body.basic .basic-note { display: block; padding-top: 2px; }
body.basic #ranking,
body.basic .panel.left,
body.basic #tabCompare,
body.basic #tabShortlist.empty,
body.basic #camTop,
body.basic .sunline,
body.basic .sun-date,
body.basic #viewLow,
body.basic #viewHigh { display: none !important; }

/* desktop: 3D on the left, one column on the right (find, then the unit) */
body.basic .shell { grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas: "top top" "stage find" "stage right"; }
body.basic .shell > .find { grid-area: find; }
body.basic .panel.right { flex-direction: column; overflow-y: auto; }
body.basic .panel.right > .card { flex: none; max-height: none; }

/* compact sun bar: the time and a play button */
body.basic .sunbar { right: auto; width: min(400px, calc(100% - 24px)); box-sizing: border-box; flex-wrap: nowrap; gap: 10px; padding: 6px 12px 6px 10px; }
body.basic .sun-main { min-width: 0; }
body.basic .clock { font-size: 22px; min-width: 5.6ch; }
body.basic .clock .ampm { font-size: 12px; }

.steps { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; font-size: 14px; }
.steps li::marker { font: 600 14px var(--font-display); color: var(--accent); }
.more-tools { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.more-tools .linkish { font-size: 13px; padding: 0; }

/* plain-language unit card */
.unit.basic { gap: 12px; }
.unit.basic .unit-addr { margin-top: 6px; }
.unit.basic .facts { grid-template-columns: 1fr 1fr; }
.unit.basic .plan-thumb { margin-top: 2px; }
.says { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.says li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px 10px 10px; background: var(--sunken); border-radius: 12px; }
.says .ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--sun-deep); }
.says .ico.view { color: var(--match); }
.says .ico svg { width: 18px; height: 18px; }
.says b { display: block; font-size: 15px; color: var(--heading); }
.says .sub { display: block; margin-top: 2px; font-size: 13.5px; color: var(--ink); }
.says .also { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.unit.basic .actions { grid-template-columns: 1fr 1fr; gap: 8px; }
.unit.basic .btn { padding: 10px 11px; }
.btn.wa.big { border-radius: 10px; padding: 13px 12px; font-size: 15px; text-align: center; }
.unit.basic .fine { font-size: 11.5px; }
.unit.basic .plan-cap .linkish { white-space: nowrap; font-size: 13px; }

/* ---------- phones ---------- */
@media (max-width: 820px), (max-height: 500px) {
  #scene { touch-action: pan-y !important; }      /* vertical swipes scroll the page; sideways drags turn the model (beats OrbitControls' inline 'none') */
  .titlerow { order: 3; width: 100%; flex: 1 0 100%; }
  .topbar { gap: 8px 10px; padding: 10px 0 8px; }
  .tab { padding: 6px 10px; }
  .modeswitch button { padding: 6px 11px; }
  body.basic .shell > .find { order: 1; }
  body.basic .stage { order: 2; height: 62vh; height: 62svh; min-height: 340px; max-height: 640px; }
  body.basic .panel.right { order: 3; }
  body.basic #unitCard[hidden] ~ #startCard { display: none; }
  body.basic .sunbar { left: 8px; bottom: 8px; width: auto; right: 8px; }
  body.basic .clock { font-size: 20px; }
  .camctl { top: 8px; right: 8px; }
  .find .selects select { padding: 9px 8px; font-size: 15px; }
}
/* phones and small tablets: Shortlist/Compare become icon + count and "Sign in free" → "Sign in", so brand, tabs and
   WhatsApp share one row (checked at 360, 375, 390, 414, 430, 600, 700 and 820 px, gate on and off) */
@media (max-width: 679px) {
  .topbar { flex-wrap: wrap; column-gap: 8px; }
  .topbar .tabs { margin-left: auto; gap: 6px; }
  .tab { padding: 6px 9px; }
  .tab .tl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tab .tab-ico { display: block; }
  .tab .count { margin-left: 0; padding: 0 3px; min-width: 0; background: none; }
  .wa-btn { padding: 7px 10px; }
}
/* signed out (gate on) on a phone: too much for one row, so WhatsApp stays beside the brand and the tabs take row 2 */
@media (max-width: 519px) {
  body.guest .wa-btn { order: 1; margin-left: auto; }
  body.guest .topbar .tabs { order: 2; }
}
@media (max-width: 440px) {
  .wa-name { display: none; }
  .topbar-title .sep, .topbar-title .muted { display: none; }
  .brand-homes { font-size: 17px; }
  .brand-by { font-size: 14.5px; }
}
/* phones held sideways: the 3D view takes the whole screen once scrolled to */
@media (max-height: 500px) and (orientation: landscape) {
  .stage, body.basic .stage { height: calc(100vh - 12px); height: calc(100svh - 12px); min-height: 0; max-height: none; }
  .guest-pill { display: none; }
  body.basic .sunbar { right: auto; width: min(440px, calc(100% - 16px)); }
}

.touch-hint { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); z-index: 4; pointer-events: none; white-space: nowrap;
  background: rgba(40, 28, 18, 0.8); color: #fff; font: 500 12.5px/1 var(--font-body); padding: 8px 12px; border-radius: 999px; transition: opacity .4s; }
.touch-hint.fade { opacity: 0; }

/* the 3D view could not start (very old browser, no WebGL, network): never a dead end */
.loadfail { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 24px; text-align: center; background: rgba(247, 242, 234, 0.96); }
.lf-title { margin: 0; font: 600 20px/1.25 var(--font-display); color: var(--heading); max-width: 26ch; }
.lf-text { margin: 0; color: var(--muted); max-width: 36ch; }
.lf-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lf-btns .btn.wa { padding: 10px 16px; border-radius: 10px; text-decoration: none; }

/* browsers without color-mix (iOS < 16.2): solid fallbacks where a see-through panel sits over the 3D */
@supports not (color: color-mix(in srgb, red, red)) {
  .sunbar, .camctl .btn, .compass, .viewer-badge { background: rgba(255, 255, 255, 0.92); }
  .gate { background: rgba(247, 242, 234, 0.8); }
  .seg input:checked + span, .chips button[aria-pressed="true"], .free-note { background: #f3e6e1; }
  .ai-badge { background: #f3e6e1; }
  td { border-bottom-color: var(--line); }
}
