:root {
  --bg: #0f1412;
  --panel: rgba(18, 24, 22, 0.92);
  --panel-solid: #121816;
  --line: rgba(255, 255, 255, 0.10);
  --text: #e9efe9;
  --muted: #9aa8a0;
  --accent: #f2c14e;
  --green: #47d17c;
  --red: #ff5a4f;
  --orange: #ff9f43;
  --blue: #5aa9ff;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); overflow: hidden; }
button { font: inherit; color: inherit; }

#viewer { position: fixed; inset: 0; }
#viewer canvas { display: block; width: 100%; height: 100%; touch-action: none; }

#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.lbl {
  position: absolute; transform: translate(-50%, -100%); white-space: nowrap;
  padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(10, 14, 12, 0.78); border: 1px solid var(--line); color: var(--text);
  text-shadow: 0 1px 1px rgba(0,0,0,.5);
}
.lbl.plot { background: rgba(242, 193, 78, 0.92); color: #1b1606; border-color: transparent; text-shadow: none; }
.lbl.road { background: rgba(255, 90, 79, 0.9); color: #fff; border-color: transparent; }
.lbl.house { background: rgba(90, 169, 255, 0.92); color: #06121f; border-color: transparent; text-shadow: none; }
.lbl.dim { font-weight: 500; color: var(--muted); }
.lbl.room { transform: translate(-50%, -50%); background: rgba(255,255,255,0.9); color: #1d2420; border-color: rgba(0,0,0,.12);
  text-shadow: none; font-size: 11.5px; line-height: 1.2; text-align: center; border-radius: 8px; padding: 3px 7px; }
.lbl.room small { display: block; font-weight: 500; color: #5b6660; font-size: 10.5px; }

#loading {
  position: fixed; inset: 0; display: flex; gap: 12px; align-items: center; justify-content: center;
  background: var(--bg); z-index: 20; color: var(--muted); transition: opacity .4s;
}
#loading.done { opacity: 0; pointer-events: none; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.views {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px; display: flex; gap: 6px; z-index: 5;
  background: var(--panel); padding: 5px; border-radius: 999px; border: 1px solid var(--line); backdrop-filter: blur(8px);
}
.views button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.views button:hover { background: rgba(255,255,255,.08); }
.views button.active { background: var(--accent); color: #1b1606; font-weight: 600; }

#panel {
  position: fixed; top: 12px; right: 12px; bottom: 12px; width: 380px; z-index: 6;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(10px); display: flex; flex-direction: column; overflow: hidden;
}
#panel-toggle { display: none; }
#panel-body { overflow-y: auto; padding: 18px 18px 22px; }
#panel.collapsed #panel-body { display: none; }

header h1 { margin: 2px 0 4px; font-size: 22px; letter-spacing: -0.01em; }
.eyebrow { margin: 0; color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.refs { margin: 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 4px; margin: 16px 0 14px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 8px 10px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.variant-list { display: grid; gap: 6px; }
.variant {
  text-align: left; border: 1px solid var(--line); background: rgba(255,255,255,.03);
  border-radius: 10px; padding: 9px 11px; cursor: pointer; display: grid; gap: 2px;
}
.variant:hover { background: rgba(255,255,255,.06); }
.variant.active { border-color: var(--accent); background: rgba(242,193,78,.10); }
.variant .vt { font-weight: 600; }
.variant .vm { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; margin-right: 6px; vertical-align: 1px; }
.tag.law { background: rgba(71,209,124,.18); color: var(--green); }
.tag.hyp { background: rgba(90,169,255,.18); color: var(--blue); }
.tag.cmp { background: rgba(255,255,255,.10); color: var(--muted); }

.card { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: rgba(0,0,0,.18); }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0 0 12px; }
.metrics div { display: grid; }
.metrics dt { color: var(--muted); font-size: 11.5px; }
.metrics dd { margin: 0; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.metrics dd small { font-size: 12px; font-weight: 500; color: var(--muted); }
.card p { margin: 0; color: #c9d3cc; }
.floorbar { display: flex; gap: 4px; margin: 4px 0 12px; background: rgba(255,255,255,.05); border-radius: 999px; padding: 4px; }
.floorbar button { flex: 1; border: 0; background: transparent; padding: 7px 8px; border-radius: 999px; cursor: pointer; }
.floorbar button:hover { background: rgba(255,255,255,.08); }
.floorbar button.active { background: var(--accent); color: #1b1606; font-weight: 600; }
.card h4 { margin: 14px 0 6px; font-size: 12.5px; color: var(--accent); font-weight: 600; }
.rooms { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.rooms li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--line); color: #c9d3cc; }
.rooms li span:last-child { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; margin: 4px 0 12px; }
.bar span { display: block; height: 100%; background: var(--green); }

.toggle { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.sw { display: inline-block; width: 14px; height: 10px; border-radius: 2px; vertical-align: -1px; }
.sw-red { background: rgba(255,90,79,.6); }
.sw-orange { background: rgba(255,159,67,.45); }
.sw-green { background: rgba(71,209,124,.65); }
.sw-house { background: #dfe6ea; box-shadow: inset 0 4px 0 #4b5560; }
.sw-yellow { background: transparent; border: 2px solid var(--accent); }
.sw-white { background: transparent; border: 1px solid rgba(255,255,255,.6); }
.sw-blue-line { height: 0; border-top: 2px dashed var(--blue); border-radius: 0; vertical-align: 3px; }
.legend { margin-top: 12px; color: var(--muted); font-size: 12.5px; }
.legend p { margin: 4px 0; }

.about h2 { font-size: 14px; margin: 16px 0 6px; color: var(--accent); }
.about h2:first-child { margin-top: 0; }
.about p, .about li { color: #c9d3cc; }
.about ol, .about ul { padding-left: 18px; margin: 6px 0; }
.about li { margin: 4px 0; }
.sources { font-size: 12.5px; }
.muted { color: var(--muted) !important; font-size: 12px; }

@media (max-width: 760px) {
  .views { left: 8px; right: 8px; justify-content: space-between; top: max(8px, env(safe-area-inset-top)); }
  .views button { padding: 6px 8px; font-size: 13px; }
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 46vh; border-radius: 14px 14px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  #panel-toggle { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; background: none; border: 0; padding: 8px 0 2px; cursor: pointer; color: var(--muted); font-size: 12px; }
  .grip { width: 38px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); }
  #panel-body { padding: 6px 16px 18px; }
  header h1 { font-size: 19px; }
  .metrics dd { font-size: 16px; }
}
