:root {
  --bg: #f3efe7; --panel: #fffdf9; --ink: #1d2a2c; --muted: #6c7778; --accent: #c8643b; --accent-ink: #fff;
  --heading: 'Fraunces', serif; --body: 'Commissioner', sans-serif;
  --avail: #2f9a5a; --resv: #d4941a; --sold: #9a958c;
  --line: color-mix(in srgb, var(--ink) 12%, transparent);
  --glass: color-mix(in srgb, var(--panel) 88%, transparent);
  --shadow: 0 18px 50px -18px rgba(10, 20, 25, .35), 0 2px 8px rgba(10, 20, 25, .08);
  --r: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
body.no3d #stage { display: none; }
#fade { position: fixed; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 30; }
#fade.on { opacity: 1; }

#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui > *, #labels > * { pointer-events: auto; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }

/* top bar */
.top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 16px 28px; pointer-events: none !important; background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 82%, transparent), transparent); }
.top > * { pointer-events: auto; }
.brand h1 { font-family: var(--heading); font-weight: 600; font-size: clamp(22px, 3.2vw, 34px); line-height: 1.05; margin: 0; letter-spacing: -.01em; }
.brand p { margin: 6px 0 0; color: var(--muted); font-size: 14px; max-width: 46ch; }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 56%; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); font-size: 14px; font-weight: 500; white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.chip.btn:hover { border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.chip.quiet { color: var(--muted); font-weight: 400; }
.chip.life { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.chip.lang { font-weight: 600; letter-spacing: .04em; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sold); flex: none; }
.dot.avail, .dot.available { background: var(--avail); }
.dot.reserved { background: var(--resv); }
.dot.sold { background: var(--sold); }
.dot.quiet { background: var(--muted); opacity: .5; }
.soldout .dot { background: var(--sold); }

/* lifecycle banner */
.state-banner { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 18px; padding: 12px 12px 12px 22px; background: var(--ink); color: var(--bg); border-radius: 999px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.state-banner strong { font-family: var(--heading); font-size: 18px; margin-right: 10px; }
.state-banner span { opacity: .8; font-size: 14px; }
.state-banner .cta { background: var(--accent); color: var(--accent-ink); }

/* buttons */
.cta { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; transition: transform .15s ease, filter .15s ease; }
.cta:hover { filter: brightness(1.12); }
.cta:active { transform: scale(.97); }
.cta.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.cta.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); filter: none; }
.cta.wide { width: 100%; background: var(--accent); color: var(--accent-ink); }
.cta:disabled { opacity: .55; }
.x { width: 38px; height: 38px; border-radius: 50%; font-size: 24px; line-height: 1; color: var(--muted); display: grid; place-items: center; }
.x:hover { background: var(--line); color: var(--ink); }

/* floors rail */
.floors { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.fl { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 40px; padding: 0 14px; border-radius: 14px; font-size: 14px; font-weight: 500; text-align: left; white-space: nowrap; }
.fl:hover { background: var(--line); }
.fl.on { background: var(--ink); color: var(--bg); }
.fl.all { font-weight: 700; margin-bottom: 4px; }
.fl i { font-style: normal; font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--avail) 18%, transparent); color: var(--avail); }
.fl i.none { background: var(--line); color: var(--muted); }
.fl.on i { background: color-mix(in srgb, var(--bg) 22%, transparent); color: var(--bg); }

.hint { position: absolute; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; padding: 10px 18px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 82%, transparent); color: var(--bg); font-size: 14px; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; pointer-events: none !important; }
body.no3d .hint { position: static; transform: none; white-space: normal; border-radius: 14px; margin: 110px 16px 0; }
.tip { position: fixed; z-index: 20; padding: 8px 12px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 500; pointer-events: none !important; white-space: nowrap; }

/* floating home labels */
.ulabel { position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px 0 10px; border-radius: 999px; background: var(--panel); color: var(--ink); font-weight: 700; font-size: 14px; box-shadow: 0 6px 18px -6px rgba(0,0,0,.4); border: 1px solid var(--line); will-change: transform; }
.ulabel:hover { background: var(--ink); color: var(--bg); }
.ulabel.sold { opacity: .78; }

/* unit card */
.panel { position: absolute; right: 16px; top: 92px; bottom: 16px; width: min(400px, calc(100% - 32px)); overflow: auto; padding: 18px 20px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overscroll-behavior: contain; animation: slide .28s cubic-bezier(.2,.8,.2,1); }
@keyframes slide { from { opacity: 0; transform: translateY(14px); } }
.p-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -8px 4px 0; }
.status { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: color-mix(in srgb, var(--sold) 20%, transparent); color: var(--muted); }
.status.available { background: color-mix(in srgb, var(--avail) 16%, transparent); color: var(--avail); }
.status.reserved { background: color-mix(in srgb, var(--resv) 20%, transparent); color: color-mix(in srgb, var(--resv) 80%, var(--ink)); }
.panel h2 { font-family: var(--heading); font-weight: 600; font-size: 30px; margin: 4px 0 2px; letter-spacing: -.01em; }
.p-sub { margin: 0; color: var(--muted); font-size: 15px; }
.price { font-size: 26px; font-weight: 700; margin: 14px 0 0; letter-spacing: -.01em; }
.price small { font-size: 13px; font-weight: 400; color: var(--muted); }
.price.request { font-size: 18px; font-weight: 600; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0 8px; }
.fact { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 5%, transparent); }
.fact b { display: block; font-size: 18px; }
.fact span { font-size: 13px; color: var(--muted); }
.aspect { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.planbox { margin: 14px 0; padding: 10px; border-radius: 14px; background: color-mix(in srgb, var(--ink) 4%, transparent); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }
.acts .cta.ghost { flex: 1 1 auto; }

/* plan drawing */
.plan { display: block; width: 100%; height: auto; max-height: 46vh; }
.pl-room { fill: var(--panel); }
.pl-room.wet { fill: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.pl-out { fill: color-mix(in srgb, var(--accent) 16%, var(--panel)); stroke: color-mix(in srgb, var(--accent) 55%, transparent); stroke-width: .03; stroke-dasharray: .14 .1; }
.pl-wall { stroke: var(--ink); stroke-linecap: square; }
.pl-glass { stroke: color-mix(in srgb, var(--accent) 70%, var(--ink)); }
.pl-door { fill: none; stroke: var(--muted); stroke-width: .035; }
.pl-door.entry { stroke: var(--accent); stroke-width: .05; }
.pl-name { fill: var(--ink); font-family: var(--body); font-weight: 600; }
.pl-dim { fill: var(--muted); font-family: var(--body); }
.pl-dot { fill: var(--accent); stroke: var(--panel); stroke-width: .06; }
.pl-cone { fill: var(--accent); opacity: .35; }

/* list drawer */
.drawer { position: absolute; left: 16px; top: 92px; bottom: 16px; width: min(380px, calc(100% - 32px)); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); z-index: 3; animation: slide .28s cubic-bezier(.2,.8,.2,1); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 12px 6px 20px; }
.drawer-head h2 { font-family: var(--heading); font-size: 22px; margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 16px 12px; border-bottom: 1px solid var(--line); }
.fchip { height: 34px; padding: 0 13px; border-radius: 999px; font-size: 14px; font-weight: 500; box-shadow: inset 0 0 0 1.5px var(--line); }
.fchip.on { background: var(--ink); color: var(--bg); box-shadow: none; }
.rows { overflow: auto; padding: 4px 10px 14px; overscroll-behavior: contain; }
.rows h3 { margin: 14px 10px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.row { width: 100%; display: grid; grid-template-columns: 12px 48px 1fr auto; align-items: center; gap: 10px; min-height: 46px; padding: 0 10px; border-radius: 12px; text-align: left; font-size: 15px; }
.row:hover { background: var(--line); }
.row.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.r-type { color: var(--muted); font-size: 14px; }
.r-price { font-weight: 600; font-size: 14px; }
body.no3d .drawer { position: static; width: auto; margin: 16px; max-height: 46vh; }
body.no3d #drawer-x { display: none; }
body.no3d .panel { position: static; width: auto; margin: 16px; }
body.no3d #ui { position: static; overflow: auto; height: 100%; pointer-events: auto; }
body.no3d { overflow: auto; }

/* walk mode */
.walkhud { position: absolute; inset: 0; pointer-events: none !important; }
.walkhud > * { pointer-events: auto; }
.walk-top { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 16px; display: flex; align-items: center; gap: 12px; }
.walk-top .cta { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.walk-title { display: flex; flex-direction: column; padding: 8px 16px; border-radius: 16px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); }
.walk-title strong { font-family: var(--heading); font-size: 18px; }
.walk-title span { font-size: 13px; color: var(--muted); }
.mini { position: absolute; right: 16px; top: max(14px, env(safe-area-inset-top)); width: min(230px, 38vw); padding: 8px; border-radius: 16px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: var(--shadow); }
.mini .plan { max-height: 30vh; }
.mini .pl-dim { display: none; }
.rooms { position: absolute; left: 0; right: 0; bottom: max(68px, calc(env(safe-area-inset-bottom) + 62px)); display: flex; gap: 8px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; justify-content: safe center; }
.rooms::-webkit-scrollbar { display: none; }
.rchip { flex: none; height: 42px; padding: 0 16px; border-radius: 999px; background: var(--panel); color: var(--ink); font-weight: 600; font-size: 14px; box-shadow: 0 6px 18px -6px rgba(0,0,0,.4); border: 1px solid var(--line); }
.rchip:hover { background: var(--ink); color: var(--bg); }
body.walking .top, body.walking .floors, body.walking .state-banner { display: none; }

/* enquiry */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--ink) 45%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); overflow: auto; }
.sheet { position: relative; width: min(460px, 100%); padding: 26px 24px 24px; background: var(--panel); color: var(--ink); border-radius: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.sheet .x { position: absolute; top: 12px; right: 12px; }
.sheet h2 { font-family: var(--heading); font-size: 26px; margin: 0 40px 0 0; line-height: 1.15; }
.lead-sub { margin: -6px 0 4px; color: var(--muted); font-size: 14px; }
.sheet label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.sheet input:not([type=checkbox]), .sheet textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: color-mix(in srgb, var(--ink) 3%, var(--panel)); font-size: 16px; color: var(--ink); resize: vertical; }
.sheet input:focus, .sheet textarea:focus { outline: none; border-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; font-size: 14px; color: var(--ink); }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.err { min-height: 18px; margin: 0; color: #c0392b; font-size: 14px; font-weight: 500; }
.sheet.done { text-align: center; padding-top: 34px; }
.sheet.done h2 { margin: 0 0 8px; }
.filmbox { position: relative; max-height: 92vh; }
.filmbox video { display: block; max-width: min(92vw, 520px); max-height: 88vh; border-radius: 18px; background: #000; }
.filmbox .x { position: absolute; top: 8px; right: 8px; z-index: 2; background: rgba(0,0,0,.5); color: #fff; }

/* loader */
#loader { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: var(--bg); color: var(--muted); font-size: 15px; transition: opacity .5s ease, visibility .5s; }
#loader.gone { opacity: 0; visibility: hidden; }
.pulse { width: 46px; height: 46px; border-radius: 12px; border: 3px solid var(--accent); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: rotate(45deg) scale(.7); border-radius: 50%; } }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* phones */
@media (max-width: 899px) {
  .top { padding-bottom: 20px; }
  .brand p { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .top-actions { max-width: 50%; gap: 6px; }
  .chip { height: 34px; padding: 0 11px; font-size: 13px; }
  #chip-demo { display: none; }
  .floors { left: 0; right: 0; top: auto; bottom: max(64px, calc(env(safe-area-inset-bottom) + 58px)); transform: none; flex-direction: row; overflow-x: auto; border-radius: 0; border-left: 0; border-right: 0; padding: 8px 12px; scrollbar-width: none; box-shadow: none; }
  .floors::-webkit-scrollbar { display: none; }
  .fl { flex: none; gap: 8px; }
  .fl.all { margin: 0 4px 0 0; }
  .state-banner { top: auto; bottom: max(126px, calc(env(safe-area-inset-bottom) + 120px)); border-radius: 22px; flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; text-align: center; width: calc(100% - 32px); }
  .state-banner strong { display: block; margin: 0 0 2px; }
  .panel { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 64vh; border-radius: 22px 22px 0 0; border-width: 1px 0 0; padding-bottom: max(20px, env(safe-area-inset-bottom)); z-index: 4; }
  .drawer { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 72vh; border-radius: 22px 22px 0 0; z-index: 5; }
  body.has-panel .hint, body.has-drawer .hint { display: none; }
  body.has-panel .floors { display: none; }
  .hint { font-size: 13px; }
  .mini { width: 132px; padding: 5px; }
  .mini .pl-name { display: none; }
  .walk-title { display: none; }
  .two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .panel, .drawer { animation: none; } #fade { transition: none; } }
