:root {
  --bg: #e8e4dc;
  --panel: rgba(252, 250, 246, 0.94);
  --ink: #23211e;
  --muted: #6d675e;
  --line: rgba(35, 33, 30, 0.12);
  --accent: #9a5b2e;
  --accent-ink: #fff;
  --shadow: 0 6px 24px rgba(30, 24, 16, 0.14), 0 1px 3px rgba(30, 24, 16, 0.1);
  --r: 12px;
  font: 14px/1.5 -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); overscroll-behavior: none; }
#app { position: fixed; inset: 0; touch-action: none; }
#app canvas { display: block; }
button { font: inherit; color: inherit; cursor: pointer; }

.bar { position: fixed; z-index: 5; display: flex; gap: 8px; }
.bar.top { top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 12px; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.bar.top > * { pointer-events: auto; }
.brand { background: var(--panel); backdrop-filter: blur(10px); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px 14px; display: grid; }
.brand strong { font-size: 15px; letter-spacing: 0.02em; }
.brand span { color: var(--muted); font-size: 12px; }

.seg { display: flex; background: var(--panel); backdrop-filter: blur(10px); border-radius: var(--r); box-shadow: var(--shadow); padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 500; white-space: nowrap; }
.seg button.on { background: var(--ink); color: #fff; }
.seg.small { box-shadow: none; background: rgba(0,0,0,0.05); }
.seg.small button { padding: 5px 11px; font-size: 13px; }

.bar.side { left: 12px; top: calc(78px + env(safe-area-inset-top)); flex-direction: column; }
.bar.side button { border: 0; background: var(--panel); backdrop-filter: blur(10px); box-shadow: var(--shadow); border-radius: 10px; padding: 8px 12px; text-align: left; }
.bar.side button[aria-pressed="true"], .bar.side button[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); }

.pop { position: fixed; z-index: 6; left: 112px; top: calc(78px + env(safe-area-inset-top)); width: 260px; max-height: calc(100vh - 120px); overflow: auto;
  background: var(--panel); backdrop-filter: blur(12px); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px 14px 12px; }
.pop h3 { margin: 6px 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; }
.pop label { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.pop input { accent-color: var(--accent); width: 16px; height: 16px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 8px; text-align: left; }
.grid button small { color: var(--muted); display: block; font-size: 11px; }

.sheet { position: fixed; z-index: 7; right: 12px; top: calc(78px + env(safe-area-inset-top)); width: 340px; max-height: calc(100vh - 100px); overflow: auto;
  background: var(--panel); backdrop-filter: blur(12px); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 16px 14px; }
.sheet h2 { margin: 0 28px 8px 0; font-size: 16px; }
.sheet table, .drawer table { border-collapse: collapse; width: 100%; }
.sheet td { padding: 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
.sheet td:first-child { color: var(--muted); width: 84px; padding-right: 10px; white-space: nowrap; }
.close { position: absolute; right: 8px; top: 6px; border: 0; background: transparent; font-size: 22px; line-height: 1; padding: 4px 8px; color: var(--muted); }

.drawer { position: fixed; z-index: 8; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); width: min(880px, calc(100vw - 24px)); max-height: 62vh;
  display: flex; flex-direction: column; background: var(--panel); backdrop-filter: blur(12px); border-radius: var(--r); box-shadow: var(--shadow); }
.drawer-head { position: relative; padding: 10px 44px 8px 12px; border-bottom: 1px solid var(--line); }
.drawer-head .close { top: 8px; }
.drawer-body { overflow: auto; padding: 4px 14px 14px; }
.drawer th, .drawer td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.drawer th { color: var(--muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--panel); }
.drawer td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.drawer h4 { margin: 14px 0 4px; font-size: 13px; }
.drawer p, .drawer li { margin: 4px 0; }
.drawer ul { padding-left: 18px; margin: 4px 0; }

.hint { position: fixed; z-index: 4; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); background: rgba(35,33,30,0.78); color: #fff;
  padding: 7px 14px; border-radius: 999px; font-size: 13px; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; transition: opacity .3s; }
.hint:empty { opacity: 0; }

.joy { position: fixed; z-index: 5; left: 24px; bottom: calc(70px + env(safe-area-inset-bottom)); width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,0.28); border: 1.5px solid rgba(255,255,255,0.7); backdrop-filter: blur(4px); touch-action: none; }
.joy .knob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(255,255,255,0.9); box-shadow: var(--shadow); }

/* 走进去：户型小地图、房间条 */
#minimap { position: fixed; z-index: 5; right: 12px; top: calc(70px + env(safe-area-inset-top)); width: 200px; height: auto; background: var(--panel);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; backdrop-filter: blur(10px); }
#minimap rect { fill: #f3eee6; stroke: #8b8277; stroke-width: 0.07; cursor: pointer; transition: fill .2s; }
#minimap rect.on { fill: #ecc9a8; }
#minimap text { font-size: 0.72px; fill: #4a443d; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
#minimap text.yard { fill: #8b8277; }
#mmDot { fill: var(--accent); stroke: #fff; stroke-width: 0.12; }
#mmCone { fill: rgba(154, 91, 46, 0.32); }
.chips { position: fixed; z-index: 5; left: 50%; transform: translateX(-50%); bottom: calc(54px + env(safe-area-inset-bottom)); display: flex; gap: 6px;
  overflow-x: auto; max-width: calc(100vw - 24px); padding: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 0; background: var(--panel); box-shadow: var(--shadow); border-radius: 999px; padding: 6px 13px; white-space: nowrap; backdrop-filter: blur(10px); }
.chips button.on { background: var(--accent); color: var(--accent-ink); }

.loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 20; font-size: 15px; color: var(--muted); transition: opacity .4s; }
.loading.done { opacity: 0; pointer-events: none; }

/* 三维里的文字标签 */
.lbl { font-size: 13px; font-weight: 600; color: #2b2723; background: rgba(255,253,249,0.86); padding: 2px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15); text-align: center; line-height: 1.3; }
.lbl small { display: block; font-weight: 400; font-size: 11px; color: #6d675e; }
.code { font-size: 11px; font-weight: 600; color: #fff; background: #2b2723; padding: 1px 6px; border-radius: 4px; pointer-events: none; white-space: nowrap; }
.badge { font-size: 10px; font-weight: 700; color: #fff; min-width: 17px; height: 17px; line-height: 17px; text-align: center; padding: 0 3px; border-radius: 9px; pointer-events: none;
  box-shadow: 0 0 0 1.5px #fff; white-space: nowrap; }
.mlbl { font-size: 13px; font-weight: 700; color: #fff; background: var(--accent); padding: 2px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; }

@media (max-width: 720px) {
  .bar.top { flex-direction: column; gap: 8px; }
  .brand { padding: 6px 12px; }
  .brand strong { font-size: 14px; }
  .seg button { padding: 7px 11px; }
  .bar.side { top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; right: 12px; flex-direction: row; justify-content: space-between; }
  .bar.side button { flex: 1; text-align: center; padding: 9px 4px; }
  .pop { left: 12px; right: 12px; width: auto; top: auto; bottom: calc(64px + env(safe-area-inset-bottom)); max-height: 55vh; }
  .sheet { left: 12px; right: 12px; width: auto; top: auto; bottom: calc(64px + env(safe-area-inset-bottom)); max-height: 46vh; }
  .drawer { bottom: calc(64px + env(safe-area-inset-bottom)); max-height: 60vh; }
  .hint { bottom: calc(66px + env(safe-area-inset-bottom)); font-size: 12px; }
  .joy { bottom: calc(80px + env(safe-area-inset-bottom)); width: 110px; height: 110px; }
  #minimap { width: 150px; top: calc(100px + env(safe-area-inset-top)); padding: 4px; }
  .chips { bottom: calc(60px + env(safe-area-inset-bottom)); }
  body:has(#walkUI:not([hidden])) .hint { bottom: calc(108px + env(safe-area-inset-bottom)); }
}
