/* Layout: full-bleed 3D canvas; frosted-glass controls float over it (brand top-left, context panel right, dock bottom-centre) */
:root {
  --ink: #141c26;
  --ink-2: #4a5563;
  --ink-3: #7c8794;
  --glass: rgba(238, 240, 244, 0.46);
  --glass-strong: rgba(246, 247, 249, 0.74);
  --glass-line: rgba(255, 255, 255, 0.62);
  --sel: rgba(255, 255, 255, 0.86);
  --accent: #2f6dff;
  --accent-ink: #ffffff;
  --navy: #132235;
  --ok: #1d9a63;
  --hold: #d39a12;
  --sold: #c8553d;
  --bg: #9fb3c4;
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-brand: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-data: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r-l: 22px; --r-m: 16px; --r-s: 12px;
  color-scheme: light;
}
html, body { height: 100%; margin: 0; }
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-ui); overflow: hidden; -webkit-font-smoothing: antialiased; }
#app { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#gl, #map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#map { cursor: grab; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--glass-line);
  box-shadow: 0 10px 34px rgba(14, 24, 40, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* brand */
.brand { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); left: max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 10px; color: #fff; text-shadow: 0 1px 10px rgba(0,0,0,0.35); pointer-events: none; z-index: 5; }
.brand svg { width: 30px; height: 30px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); }
.brand b { display: block; font-family: var(--font-brand); font-weight: 400; font-size: 22px; line-height: 1; letter-spacing: 0.01em; }
.brand small { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; opacity: 0.9; margin-top: 3px; }
.mode-dark .brand { color: #fff; }

/* top right */
.topright { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); display: flex; gap: 8px; align-items: center; z-index: 6; }
.pill { height: 38px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.iconbtn { width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; }
.iconbtn svg, .pill svg { width: 18px; height: 18px; }
.search { height: 38px; border-radius: 999px; display: flex; align-items: center; padding: 0 6px 0 14px; gap: 6px; }
.search input { border: 0; background: transparent; font: 600 13px var(--font-ui); color: var(--ink); width: 168px; outline: none; }
.search input::placeholder { color: var(--ink-2); }

/* dock */
.dock { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 999px; z-index: 6; }
.dock .d { width: 46px; height: 46px; border-radius: 999px; display: grid; place-items: center; color: var(--ink); transition: background .2s, transform .2s; position: relative; }
.dock .d svg { width: 21px; height: 21px; }
.dock .d:hover { background: rgba(255,255,255,0.45); }
.dock .d.on { background: var(--sel); box-shadow: 0 2px 10px rgba(0,0,0,0.12); }
.dock .d .tip { position: absolute; bottom: 56px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; padding: 5px 9px; border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; }
.dock .d:hover .tip { opacity: 1; }
.dock .sep { width: 1px; height: 26px; background: rgba(20,28,38,0.16); margin: 0 4px; }
.dock .inv { height: 46px; padding: 0 16px 0 14px; border-radius: 999px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; line-height: 1.05; background: var(--navy); color: #fff; }
.dock .inv b { font-size: 9px; letter-spacing: 0.2em; font-weight: 800; opacity: 0.75; }
.dock .inv span { font-size: 13px; font-weight: 800; letter-spacing: 0.04em; display: flex; align-items: center; gap: 6px; }
.dock .inv i { width: 7px; height: 7px; border-radius: 50%; background: #39d98a; box-shadow: 0 0 0 0 rgba(57,217,138,.7); animation: live 1.8s infinite; }
.dock .inv.on { background: var(--accent); }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(57,217,138,.7); } 70% { box-shadow: 0 0 0 8px rgba(57,217,138,0); } 100% { box-shadow: 0 0 0 0 rgba(57,217,138,0); } }

/* side view buttons (home) */
.side-btns { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; z-index: 5; }
.side-btns button { min-width: 132px; height: 44px; border-radius: 999px; font-weight: 700; font-size: 13.5px; padding: 0 18px; text-align: center; }
.side-btns button.on { background: var(--sel); }

/* right panel */
.panel { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); top: calc(62px + env(safe-area-inset-top, 0px)); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); width: 268px; border-radius: var(--r-l); padding: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 5; overflow-y: auto; scrollbar-width: none; }
.panel > * { flex: none; }
.panel > .list { flex: 1 1 auto; }
.panel[hidden] { display: none !important; }
.panel.auto { bottom: auto; max-height: calc(100% - 160px); }
.p-head { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; padding: 2px 4px 4px; }
.p-head button { width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; }
.p-head button:hover { background: rgba(255,255,255,0.5); }
.p-head svg { width: 16px; height: 16px; }
.p-sub { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); padding: 4px 6px 0; }
.list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; padding-right: 2px; scrollbar-width: thin; }
.li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-s); font-weight: 600; font-size: 13.5px; text-align: left; width: 100%; }
.li:hover { background: rgba(255,255,255,0.42); }
.li.on { background: var(--sel); box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.li .ic { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #fff; }
.li .ic svg { width: 15px; height: 15px; }
.li .meta { margin-left: auto; font: 500 11.5px var(--font-data); color: var(--ink-2); white-space: nowrap; }
.li .t { min-width: 0; display: flex; flex-direction: column; }
.li .t small { font-size: 11px; color: var(--ink-2); font-weight: 600; }
.chev { width: 14px; height: 14px; margin-left: auto; opacity: .5; flex: none; }

/* inventory */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: rgba(255,255,255,0.3); padding: 4px; border-radius: 999px; }
.tabs button { height: 30px; border-radius: 999px; font-weight: 800; font-size: 13px; }
.tabs button.on { background: var(--navy); color: #fff; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tg { height: 34px; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 10px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,0.32); }
.tg .sw { width: 30px; height: 18px; border-radius: 99px; background: rgba(20,28,38,0.22); position: relative; transition: background .2s; flex: none; }
.tg .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.tg[aria-pressed="true"] .sw { background: var(--accent); }
.tg[aria-pressed="true"] .sw::after { transform: translateX(12px); }
.floorbar { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px; }
.floorbar b { font: 700 12px var(--font-data); letter-spacing: 0.08em; }
.floorbar button { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; background: rgba(255,255,255,0.4); }
.floorbar svg { width: 15px; height: 15px; }
.floors { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; overflow-y: auto; max-height: 112px; min-height: 58px; padding: 2px; scrollbar-width: thin; }
.floors button { height: 26px; border-radius: 8px; font: 600 11.5px var(--font-data); background: rgba(255,255,255,0.28); font-variant-numeric: tabular-nums; position: relative; }
.floors button.on { background: var(--navy); color: #fff; }
.floors button .avl { position: absolute; right: 3px; top: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
.units { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.units button { height: 44px; border-radius: 11px; font: 600 12px var(--font-data); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: rgba(255,255,255,0.4); border: 1.5px solid transparent; font-variant-numeric: tabular-nums; }
.units button i { width: 22px; height: 4px; border-radius: 4px; display: block; }
.units button.available i { background: var(--ok); }
.units button.hold i { background: var(--hold); }
.units button.booked { color: var(--ink-3); }
.units button.booked i { background: var(--sold); }
.units button.on { border-color: var(--accent); background: #fff; color: var(--ink); }
.units button.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%,100% { box-shadow: none; } 30% { box-shadow: 0 0 0 4px rgba(47,109,255,.45); } }
.legend { display: flex; gap: 10px; font-size: 10.5px; font-weight: 700; color: var(--ink-2); padding: 0 4px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.stat { font: 500 11px var(--font-data); color: var(--ink-2); padding: 0 4px; }

/* unit card (left) */
.unit-card { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); top: calc(66px + env(safe-area-inset-top, 0px)); width: 210px; border-radius: var(--r-l); padding: 14px; z-index: 5; display: flex; flex-direction: column; gap: 10px; }
.unit-card h3 { font: 600 18px var(--font-data); letter-spacing: 0.02em; margin: 0; }
.unit-card dl { margin: 0; display: grid; gap: 7px; }
.unit-card dt { font: 600 9.5px var(--font-data); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
.unit-card dd { margin: 0; font: 600 13px var(--font-data); font-variant-numeric: tabular-nums; }
.unit-card dd.available { color: var(--ok); text-decoration: underline; text-underline-offset: 3px; }
.unit-card dd.hold { color: var(--hold); }
.unit-card dd.booked { color: var(--sold); }
.unit-card .row { display: flex; gap: 6px; }
.btn { height: 36px; border-radius: 12px; font-weight: 800; font-size: 12.5px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1; }
.btn.light { background: rgba(255,255,255,0.7); }
.btn.dark { background: var(--navy); color: #fff; }
.btn.blue { background: var(--accent); color: #fff; }
.btn svg { width: 15px; height: 15px; }

/* labels in 3D */
#labels { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; will-change: transform; pointer-events: auto; }
.lbl.tower { padding: 5px 10px; border-radius: 999px; font: 800 12px var(--font-ui); color: var(--ink); cursor: pointer; transform-origin: 50% 100%; white-space: nowrap; }
.lbl.tower::after { content: ""; position: absolute; left: 50%; bottom: -14px; width: 1px; height: 14px; background: rgba(255,255,255,.8); }
.lbl.tower.on { background: var(--navy); color: #fff; }
.lbl.hot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.lbl.hot svg { width: 16px; height: 16px; }
.lbl.hot span { position: absolute; left: 40px; top: 50%; transform: translateY(-50%); background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 8px; white-space: nowrap; opacity: 0; transition: opacity .15s; pointer-events: none; }
.lbl.hot:hover span, .lbl.hot:focus-visible span { opacity: 1; }
.lbl.poi { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; font-size: 11.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.lbl.poi .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.lbl.poi .ic svg { width: 13px; height: 13px; }
.lbl.poi.on { background: var(--navy); color: #fff; }
.lbl.poi small { font: 500 10.5px var(--font-data); opacity: .75; }

/* route info chip */
.routecard { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); border-radius: 18px; padding: 10px 14px; display: flex; gap: 14px; align-items: center; z-index: 6; max-width: calc(100% - 32px); }
.routecard .nm { font-weight: 800; font-size: 13.5px; }
.routecard .sub { font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.routecard .big { font: 600 15px var(--font-data); white-space: nowrap; }
.routecard .big small { font-size: 11px; color: var(--ink-2); }

/* mini plan (interior) */
.miniplan { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); top: calc(62px + env(safe-area-inset-top, 0px)); width: 236px; border-radius: var(--r-m); padding: 8px; z-index: 5; }
.miniplan .plan-svg { width: 100%; height: auto; display: block; background: rgba(255,255,255,0.82); border-radius: 10px; }
.miniplan .cap { font: 600 10px var(--font-data); letter-spacing: 0.12em; color: var(--ink-2); padding: 6px 4px 0; display: flex; justify-content: space-between; }
.pl-dot { cursor: pointer; }
.pl-dot-halo { fill: rgba(47,109,255,0.18); }
.pl-dot-core { fill: #2f6dff; stroke: #fff; stroke-width: 2.5; }
.pl-dot.on .pl-dot-halo { fill: rgba(47,109,255,0.3); animation: halo 1.6s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes halo { 50% { transform: scale(1.35); } }
.pl-name { font-family: var(--font-ui); font-weight: 800; fill: #2a2f36; letter-spacing: 0.06em; }
.pl-dim { font-family: var(--font-data); fill: #6a737d; }
.pl-dimline line { stroke: #8a929b; stroke-width: 1; }

/* modal: floor plan + gallery */
.modal { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(12, 18, 28, 0.55); padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); }
.plancard { background: #fbfaf8; border-radius: 22px; width: min(980px, 100%); max-height: 100%; display: grid; grid-template-columns: 1fr 240px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.plancard .pv { padding: 14px; min-width: 0; display: grid; place-items: center; background: #fff; }
.plancard .pv .plan-svg { width: 100%; height: auto; max-height: calc(100vh - 90px); }
.plancard aside { padding: 18px; border-left: 1px solid #ece8e1; display: flex; flex-direction: column; gap: 12px; }
.plancard h2 { font: 400 28px var(--font-brand); margin: 0; line-height: 1.05; }
.plancard .kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 12.5px; }
.plancard .kv span:nth-child(odd) { color: var(--ink-2); font-weight: 600; }
.plancard .kv span:nth-child(even) { font: 600 12.5px var(--font-data); text-align: right; }
.plancard .x { align-self: flex-end; width: 34px; height: 34px; border-radius: 50%; background: #efece6; display: grid; place-items: center; }
.plancard .x svg { width: 16px; height: 16px; }
.keyplan { border: 1px solid #ece8e1; border-radius: 12px; padding: 8px; }
.keyplan svg { width: 100%; height: auto; display: block; }
.note { font-size: 11px; color: var(--ink-3); line-height: 1.45; }

.gallery { position: absolute; inset: 0; z-index: 20; background: #0d1830; display: grid; grid-template-rows: 1fr auto; }
.gallery .stage { position: relative; display: grid; place-items: center; overflow: hidden; padding: 56px max(64px, env(safe-area-inset-right, 0px)) 8px max(64px, env(safe-area-inset-left, 0px)); }
.gallery img { max-width: 100%; max-height: 100%; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.45); transition: opacity .35s; object-fit: contain; }
.gallery .cap { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); color: #fff; font-weight: 700; font-size: 13px; background: rgba(0,0,0,.35); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.gallery .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(255,255,255,0.14); }
.gallery .nav svg { width: 20px; height: 20px; }
.gallery .prev { left: max(12px, env(safe-area-inset-left, 0px)); } .gallery .next { right: max(12px, env(safe-area-inset-right, 0px)); }
.gallery .close { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.16); color: #fff; display: grid; place-items: center; }
.gallery .close svg { width: 18px; height: 18px; }
.gallery .thumbs { display: flex; gap: 8px; justify-content: center; padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); overflow-x: auto; }
.gallery .thumbs button { width: 74px; height: 44px; border-radius: 9px; overflow: hidden; opacity: .5; flex: none; border: 2px solid transparent; }
.gallery .thumbs button.on { opacity: 1; border-color: #fff; }
.gallery .thumbs img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; box-shadow: none; }

/* toast */
.toasts { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 30; pointer-events: none; align-items: center; }
.toast { border-radius: 999px; padding: 8px 14px 8px 10px; font-size: 12.5px; font-weight: 700; display: flex; gap: 8px; align-items: center; animation: tin .35s ease; white-space: nowrap; }
.toast i { width: 8px; height: 8px; border-radius: 50%; }
.toast code { font-family: var(--font-data); font-weight: 600; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }

/* hint + loader */
.hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 1px 6px rgba(0,0,0,.5); z-index: 4; pointer-events: none; transition: opacity .6s; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.hint svg { width: 18px; height: 18px; }
.loader { position: absolute; inset: 0; z-index: 50; background: radial-gradient(120% 90% at 50% 30%, #1f3552 0%, #0c1626 70%); display: grid; place-items: center; color: #fff; transition: opacity .8s; }
.loader .in { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; padding: 0 24px; }
.loader b { font: 400 42px var(--font-brand); line-height: 1; }
.loader small { font-size: 10.5px; letter-spacing: 0.3em; font-weight: 700; opacity: .75; text-transform: uppercase; }
.loader .bar { width: 220px; height: 3px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; }
.loader .bar i { display: block; height: 100%; width: 0; background: #fff; transition: width .3s; }
.loader .pct { font: 500 11px var(--font-data); opacity: .7; }
.busy { position: absolute; inset: 0; display: grid; place-items: center; z-index: 15; pointer-events: none; }
.busy span { padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(20,28,38,.2); border-top-color: var(--ink); animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.rotate-hint { display: none; }
.credits { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); font-size: 9.5px; color: rgba(255,255,255,0.8); text-shadow: 0 1px 4px rgba(0,0,0,.6); z-index: 4; max-width: 200px; line-height: 1.35; }
.credits a { color: inherit; }

/* phones */
@media (max-width: 760px), (max-height: 460px) {
  .brand b { font-size: 18px; } .brand svg { width: 24px; height: 24px; }
  .panel { width: 228px; top: calc(56px + env(safe-area-inset-top, 0px)); bottom: calc(70px + env(safe-area-inset-bottom, 0px)); padding: 9px; gap: 6px; }
  .li { padding: 7px 8px; font-size: 12.5px; }
  .dock { padding: 4px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .dock .d { width: 40px; height: 40px; } .dock .d svg { width: 19px; height: 19px; }
  .dock .inv { height: 40px; padding: 0 12px; }
  .unit-card { width: 184px; padding: 11px; gap: 7px; top: calc(52px + env(safe-area-inset-top, 0px)); }
  .unit-card h3 { font-size: 15px; } .unit-card dd { font-size: 12px; }
  .side-btns button { min-width: 112px; height: 38px; font-size: 12.5px; }
  .miniplan { width: 170px; top: calc(52px + env(safe-area-inset-top, 0px)); }
  .floors { max-height: 84px; }
  .units button { height: 38px; }
  .credits { display: none; }
  .search input { width: 120px; }
  .routecard { bottom: calc(62px + env(safe-area-inset-bottom, 0px)); padding: 8px 12px; }
  .plancard { grid-template-columns: 1fr; overflow-y: auto; }
  .plancard aside { border-left: 0; border-top: 1px solid #ece8e1; }
}
@media (max-width: 560px) and (orientation: portrait) {
  .panel { left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); width: auto; top: auto; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); max-height: 44%; }
  .panel.auto { max-height: 36%; top: auto; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  .routecard { top: calc(56px + env(safe-area-inset-top, 0px)); bottom: auto; }
  .hint { display: none; }
  .side-btns { top: auto; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); transform: none; flex-direction: row; right: 50%; transform: translateX(50%); }
  .unit-card { width: auto; right: max(16px, env(safe-area-inset-right, 0px)); flex-direction: row; flex-wrap: wrap; }
  .unit-card dl { grid-template-columns: 1fr 1fr; flex: 1 1 100%; }
  .rotate-hint { display: flex; position: absolute; top: calc(56px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 4; font-size: 11.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px; gap: 6px; align-items: center; white-space: nowrap; }
  .rotate-hint svg { width: 14px; height: 14px; }
  .topright .search { display: none; }
  .miniplan { width: 150px; }
  .dock .d .tip { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- v1.1 production polish ---------- */
:root { --ease-out: cubic-bezier(.22,1,.36,1); --ease-io: cubic-bezier(.65,0,.35,1); }
#gl { cursor: grab; }
#gl.dragging { cursor: grabbing; }
#gl.pointer { cursor: pointer; }
#gl.walk { cursor: none; }

.pill.cta { background: var(--navy); color: #fff; box-shadow: 0 8px 24px rgba(19,34,53,.28); transition: transform .25s var(--ease-out), background .2s; }
.pill.cta:hover { transform: translateY(-1px); background: #1b3150; }
.live-dot { height: 38px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px; font: 800 11px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; }
.live-dot i { width: 8px; height: 8px; border-radius: 50%; background: #39d98a; animation: live 1.8s infinite; }
.live-dot.off i { background: var(--ink-3); animation: none; }

/* panels & cards slide in */
.panel:not([hidden]) { animation: panelIn .45s var(--ease-out) both; }
.unit-card:not([hidden]), .miniplan:not([hidden]) { animation: cardIn .45s var(--ease-out) both; }
.routecard:not([hidden]) { animation: upIn .4s var(--ease-out) both; }
.side-btns:not([hidden]) button { animation: panelIn .5s var(--ease-out) both; }
.side-btns button:nth-child(2) { animation-delay: .06s; }
@keyframes panelIn { from { opacity: 0; transform: translateX(18px) scale(.985); } }
@keyframes cardIn { from { opacity: 0; transform: translateX(-18px) scale(.985); } }
@keyframes upIn { from { opacity: 0; transform: translate(-50%, 12px); } }
.li, .units button, .floors button, .tabs button, .dock .d, .side-btns button, .btn { transition: background .2s, transform .2s var(--ease-out), box-shadow .2s, color .2s; }
.btn:active, .li:active, .dock .d:active, .units button:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.05); }
.list .li { animation: liIn .35s var(--ease-out) both; }
.list .li:nth-child(2) { animation-delay: .02s } .list .li:nth-child(3) { animation-delay: .04s } .list .li:nth-child(4) { animation-delay: .06s }
.list .li:nth-child(5) { animation-delay: .08s } .list .li:nth-child(6) { animation-delay: .1s } .list .li:nth-child(n+7) { animation-delay: .12s }
@keyframes liIn { from { opacity: 0; transform: translateY(6px); } }

/* 3D-anchored labels fade instead of popping */
.lbl { opacity: 0; transition: opacity .35s ease; visibility: hidden; }
.lbl.show { opacity: 1; visibility: visible; }
.lbl.tower:hover, .lbl.hot:hover, .lbl.poi:hover { background: var(--sel); }

/* hover tooltip following the mouse over the 3D scene */
.tip3d { position: absolute; left: 0; top: 0; z-index: 7; pointer-events: none; padding: 7px 11px; border-radius: 12px; font-size: 12px; font-weight: 700; white-space: nowrap; transform: translate(-50%, calc(-100% - 14px)); transition: opacity .15s; }
.tip3d b { font-family: var(--font-data); font-weight: 600; }
.tip3d .st { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; font-weight: 700; }
.tip3d .st i { width: 7px; height: 7px; border-radius: 50%; }

/* full-screen crossfade between big scene changes */
.veil { position: absolute; inset: 0; z-index: 12; background: #e9eef3; opacity: 0; pointer-events: none; transition: opacity .45s var(--ease-io); }
.veil.on { opacity: 1; }
#map { transition: opacity .5s var(--ease-io); }
#map.fade { opacity: 0; }
.gallery, .modal { animation: fadeIn .35s var(--ease-out) both; }
@keyframes fadeIn { from { opacity: 0; } }
.plancard, .leadcard { animation: popIn .45s var(--ease-out) both; }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* gallery: ken-burns + mouse parallax */
.gallery .stage { perspective: 1200px; }
.gallery img { transition: opacity .45s ease, transform .9s var(--ease-out); will-change: transform; }

/* enquiry form */
.leadcard { position: relative; width: min(460px, 100%); max-height: 100%; overflow-y: auto; background: #fbfaf8; border-radius: 22px; padding: 24px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.leadcard h2 { font: 400 30px var(--font-brand); margin: 0; }
.leadcard .x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; background: #efece6; display: grid; place-items: center; }
.leadcard .x svg { width: 16px; height: 16px; }
.lead-sub { margin: -6px 0 2px; color: var(--ink-2); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 11.5px; font-weight: 800; letter-spacing: .04em; color: var(--ink-2); }
.field label em { font-style: normal; font-weight: 600; color: var(--ink-3); }
.field input, .field textarea { font: 600 14px var(--font-ui); color: var(--ink); background: #fff; border: 1.5px solid #e2ded6; border-radius: 12px; padding: 10px 12px; outline: none; transition: border-color .2s, box-shadow .2s; width: 100%; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(47,109,255,.12); }
.field input[aria-invalid="true"] { border-color: var(--sold); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.btn.big { height: 46px; font-size: 14px; flex: none; }
.form-err { margin: 0; color: var(--sold); font-size: 12.5px; font-weight: 700; }
.contact { margin: 0; font-size: 12px; color: var(--ink-2); text-align: center; }
.contact a { color: var(--accent); font-weight: 700; text-decoration: none; }
.done { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 18px 0 6px; }
.done .tick { width: 56px; height: 56px; border-radius: 50%; background: #e3f5ec; color: var(--ok); display: grid; place-items: center; animation: popIn .5s var(--ease-out) both; }
.done .tick svg { width: 28px; height: 28px; }
.unit-card .row .btn.ghost { background: transparent; border: 1.5px solid rgba(20,28,38,.18); }

@media (max-width: 760px), (max-height: 460px) {
  .pill.cta span { display: none; }
  .pill.cta { width: 38px; padding: 0; justify-content: center; }
  .live-dot span { display: none; }
  .leadcard { padding: 18px; gap: 9px; }
  .leadcard h2 { font-size: 24px; }
}
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }
.linkbtn { margin-left: 10px; font: 800 12px var(--font-ui); color: var(--accent); background: rgba(255,255,255,.7); padding: 4px 10px; border-radius: 999px; }
.toasts .toast { pointer-events: auto; }
.unit-card { width: 228px; }
.unit-card .row .btn { padding: 0 8px; font-size: 12px; white-space: nowrap; }
@media (max-width: 760px), (max-height: 460px) { .unit-card { width: 200px; } .unit-card .row .btn { font-size: 11px; gap: 4px; } }

/* ---------- v1.2 polish (2026-11-17) ---------- */
/* brand + credits stay readable over bright towers / grass */
.brand { text-shadow: 0 1px 3px rgba(0,0,0,.6), 0 2px 14px rgba(0,0,0,.5); }
.credits { text-shadow: 0 1px 3px rgba(0,0,0,.65), 0 1px 8px rgba(0,0,0,.5); }
/* buttons never wrap mid-label (plan modal "Step inside" wrapped) */
.btn { white-space: nowrap; }
@media (max-width: 560px) and (orientation: portrait) {
  /* inventory panel gets the same room as the other panels */
  .panel.auto { max-height: 44%; }
  /* unit card: full-width row card again (the v1.1 760px rule narrowed it to 200px) */
  .unit-card { width: auto; right: max(16px, env(safe-area-inset-right, 0px)); }
  /* live toasts: above the dock instead of over the unit-card title */
  .toasts { top: auto; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .toast { max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
}
