:root {
  --brass: #c9a961;
  --brass-bright: #e8cd8a;
  --ink: #0c1420;
  --panel: rgba(12, 20, 32, 0.86);
  --panel-light: rgba(255, 255, 255, 0.07);
  --text: #eef2f6;
  --text-dim: #9fb0c0;
  --teal: #3fc1c9;
  --green: #6fcf97;
  --red: #eb5757;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--ink); color: var(--text); }
#cesiumContainer { position: absolute; inset: 0; }
#cesiumContainer canvas { touch-action: none; } /* browser must not steal pinch/drag from the map */
.cesium-viewer-bottom { opacity: 0.55; }

/* ── Top bar ── */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 54px; z-index: 20;
  display: flex; align-items: center; gap: 16px; padding: 0 18px;
  background: linear-gradient(180deg, rgba(5,10,18,.92), rgba(5,10,18,.55) 80%, transparent);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.brand { font-family: Georgia, "Times New Roman", serif; font-size: 19px; letter-spacing: .4px; color: var(--brass-bright); white-space: nowrap; }
.brand small { color: var(--text-dim); font-family: inherit; font-size: 11px; display: block; letter-spacing: 1.6px; text-transform: uppercase; }
#modeBadge { font-size: 11px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--brass); color: var(--brass-bright); white-space: nowrap; }
#timeCtl { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
#timeCtl input { accent-color: var(--brass); width: 130px; }
#timeCtl button { background: none; border: 1px solid var(--brass); color: var(--brass-bright); border-radius: 6px; padding: 3px 9px; font-size: 11px; cursor: pointer; }
#timeCtl button:hover { background: rgba(201,169,97,.18); }

/* ── Left panel ── */
#panel {
  position: absolute; top: 62px; left: 12px; bottom: 12px; width: 360px; z-index: 15;
  background: var(--panel); backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px; display: flex; flex-direction: column; overflow: hidden;
  transition: transform .25s ease;
}
#panel.collapsed { transform: translateX(-386px); }
#panelToggle {
  position: absolute; top: 70px; left: 380px; z-index: 16; width: 30px; height: 44px;
  background: var(--panel); border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
  color: var(--brass-bright); cursor: pointer; font-size: 14px; transition: left .25s ease;
}
#panel.collapsed + #panelToggle { left: 12px; }
#tabs { display: flex; border-bottom: 1px solid rgba(255,255,255,.09); }
#tabs button {
  flex: 1; padding: 11px 4px; background: none; border: none; color: var(--text-dim);
  font-size: 12.5px; cursor: pointer; border-bottom: 2px solid transparent;
}
#tabs button.active { color: var(--brass-bright); border-bottom-color: var(--brass); }
.tabview { flex: 1; overflow-y: auto; padding: 14px; display: none; }
.tabview.active { display: block; }
.tabview::-webkit-scrollbar { width: 8px; }
.tabview::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

/* ── Neighborhood cards ── */
.nb-card { padding: 11px 12px; border-radius: 10px; background: var(--panel-light); margin-bottom: 8px; cursor: pointer; border: 1px solid transparent; }
.nb-card:hover { border-color: var(--brass); }
.nb-card h3 { font-size: 14.5px; font-weight: 600; }
.nb-card .meta { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }
.nb-card .tags { margin-top: 5px; }
.tag { display: inline-block; font-size: 10px; padding: 1px 7px; margin: 1px 2px 1px 0; border-radius: 999px; background: rgba(201,169,97,.14); color: var(--brass-bright); }

/* ── Chat ── */
#chatlog { display: flex; flex-direction: column; gap: 8px; min-height: 200px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: rgba(201,169,97,.22); }
.msg.bot { align-self: flex-start; background: var(--panel-light); }
.msg.bot a { color: var(--teal); cursor: pointer; text-decoration: underline; }
#chatform { display: flex; gap: 8px; margin-top: 10px; }
#chatinput { flex: 1; background: var(--panel-light); border: 1px solid rgba(255,255,255,.14); border-radius: 9px; color: var(--text); padding: 9px 11px; font-size: 13px; }
#chatinput:focus { outline: none; border-color: var(--brass); }
.chips { margin: 8px 0; }
.chips button { font-size: 11px; margin: 2px 3px 2px 0; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); background: none; color: var(--text-dim); cursor: pointer; }
.chips button:hover { border-color: var(--brass); color: var(--brass-bright); }

/* ── Forms / buttons ── */
label.f { display: block; font-size: 11.5px; color: var(--text-dim); margin: 10px 0 3px; }
input.f, select.f, textarea.f { width: 100%; background: var(--panel-light); border: 1px solid rgba(255,255,255,.14); border-radius: 8px; color: var(--text); padding: 8px 10px; font-size: 13px; font-family: inherit; resize: vertical; }
.btn { display: inline-block; margin-top: 12px; background: var(--brass); color: #14100a; border: none; border-radius: 9px; padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--brass-bright); }
.btn.ghost { background: none; border: 1px solid var(--brass); color: var(--brass-bright); }
.result-box { margin-top: 12px; background: var(--panel-light); border-radius: 10px; padding: 12px; font-size: 13px; }
.result-box .big { font-size: 22px; color: var(--brass-bright); font-weight: 700; }
.result-box table { width: 100%; border-collapse: collapse; font-size: 12px; }
.result-box td { padding: 3px 0; color: var(--text-dim); }
.result-box td:last-child { text-align: right; color: var(--text); }

/* ── Compare ── */
#compareTable { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 10px; }
#compareTable th, #compareTable td { padding: 6px 6px; border-bottom: 1px solid rgba(255,255,255,.08); text-align: left; }
#compareTable th { color: var(--brass-bright); font-weight: 600; }
#compareTable td:first-child { color: var(--text-dim); }
.cmp-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.cmp-pick button { font-size: 11px; padding: 4px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); background: none; color: var(--text-dim); cursor: pointer; }
.cmp-pick button.on { border-color: var(--brass); color: var(--brass-bright); background: rgba(201,169,97,.14); }

/* ── Info card (right) ── */
#infocard {
  position: absolute; top: 62px; right: 12px; width: 330px; z-index: 15;
  background: var(--panel); backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px; padding: 16px; display: none; max-height: calc(100% - 90px); overflow-y: auto;
}
#infocard h2 { font-family: Georgia, serif; font-size: 18px; color: var(--brass-bright); margin-bottom: 2px; }
#infocard .price { font-size: 23px; font-weight: 700; margin: 6px 0; }
#infocard .sub { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
#infocard .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0; }
#infocard .fact { background: var(--panel-light); border-radius: 8px; padding: 7px 9px; font-size: 12px; }
#infocard .fact b { display: block; font-size: 14px; color: var(--text); }
#infocard .fact span { color: var(--text-dim); font-size: 10.5px; }
#infocard .close { position: absolute; top: 10px; right: 12px; background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; }
.badge { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 999px; margin-right: 4px; }
.badge.wf { background: rgba(63,193,201,.18); color: var(--teal); }
.badge.flood { background: rgba(235,87,87,.16); color: var(--red); }
.badge.demo { background: rgba(255,255,255,.1); color: var(--text-dim); }

/* ── Listing art + hover card ── */
.listing-art { width: 100%; border-radius: 10px; display: block; margin: 4px 0 6px; border: 1px solid rgba(255,255,255,.1); }
#hovercard { position: fixed; z-index: 40; display: none; pointer-events: none; max-width: 265px; background: var(--panel); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.16); border-radius: 10px; overflow: hidden; box-shadow: 0 10px 28px rgba(0,0,0,.55); }
#hovercard .hc-body { padding: 8px 11px; font-size: 12.5px; color: var(--text); line-height: 1.5; }
#hovercard .hc-body span { color: var(--text-dim); font-size: 11px; }

/* ── Zoom buttons ── */
#zoomCtl { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); z-index: 14; display: flex; flex-direction: column; gap: 8px; }
#zoomCtl button { width: 42px; height: 42px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18); background: var(--panel); color: var(--brass-bright); font-size: 22px; line-height: 1; cursor: pointer; backdrop-filter: blur(10px); }
#zoomCtl button:active { background: rgba(201,169,97,.25); }

/* ── Toast + legend ── */
#toast { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 30; background: var(--panel); border: 1px solid var(--brass); color: var(--text); padding: 9px 18px; border-radius: 10px; font-size: 13px; opacity: 0; transition: opacity .3s; pointer-events: none; }
#toast.show { opacity: 1; }
#legend { position: absolute; bottom: 34px; right: 14px; z-index: 12; background: var(--panel); border-radius: 10px; padding: 9px 12px; font-size: 11px; color: var(--text-dim); border: 1px solid rgba(255,255,255,.09); }
#legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

@media (max-width: 760px) {
  #topbar { padding: 0 10px; gap: 10px; }
  .brand { font-size: 15px; }
  .brand small { font-size: 9px; letter-spacing: 1px; }
  #modeBadge { display: none; }
  #timeCtl span { display: none; }
  #timeCtl input { width: 90px; }

  /* Panel becomes a bottom sheet: tab bar stays visible, content slides down */
  #panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 58%; border-radius: 16px 16px 0 0;
    transition: transform .28s ease; transform: none;
  }
  #panel.collapsed { transform: none; }
  #panel.mobile-min { transform: translateY(calc(100% - 46px)); }
  #panelToggle { display: none; }
  #tabs button { padding: 13px 4px; }

  #infocard { width: calc(100% - 20px); left: 10px; top: 62px; bottom: auto; max-height: 46%; }
  #legend { display: none; }
  .btn { padding: 11px 18px; } /* bigger touch targets */
}
