:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: #0d1823;
  --panel-2: #101f2c;
  --line: rgba(255,255,255,.11);
  --text: #edf7f7;
  --muted: #93a7b2;
  --accent: #5ff0c8;
  --accent-2: #83a7ff;
  --amber: #ffc86a;
  --radius: 22px;
  --shadow: 0 22px 60px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 75% 0%, #102b38 0, var(--bg) 40%); color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK TC", "Noto Sans CJK SC", sans-serif; line-height: 1.55; }
a { color: inherit; }
button { font: inherit; }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px clamp(18px, 4vw, 54px); border-bottom: 1px solid var(--line); background: rgba(7,16,25,.82); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #071019; background: var(--accent); font-weight: 950; letter-spacing: -.05em; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 12px; margin-top: 1px; }
.top-status { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.badge { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.badge-live { border-color: rgba(95,240,200,.35); background: rgba(95,240,200,.1); color: var(--accent); }
main { width: min(1540px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 70px; }
.hero { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(320px,.65fr); gap: 50px; align-items: end; padding: 28px 6px 46px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 900; letter-spacing: .16em; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 900px; margin-bottom: 20px; font-size: clamp(42px, 6vw, 86px); line-height: .98; letter-spacing: -.055em; }
h2 { margin-bottom: 0; font-size: 24px; letter-spacing: -.03em; }
.hero-copy { max-width: 850px; margin-bottom: 0; color: #b7c7ce; font-size: clamp(16px, 1.7vw, 21px); }
.hero-facts { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: rgba(13,24,35,.66); box-shadow: var(--shadow); }
.hero-facts div { min-height: 104px; padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hero-facts div:nth-child(2n) { border-right: 0; }
.hero-facts div:nth-last-child(-n+2) { border-bottom: 0; }
.hero-facts dt { color: var(--muted); font-size: 12px; }
.hero-facts dd { margin: 9px 0 0; font-size: 14px; font-weight: 850; }
.workspace { display: grid; grid-template-columns: 260px minmax(560px, 1fr) 310px; gap: 18px; align-items: stretch; }
.panel, .viewer-card, .face-section, .contracts-section { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, rgba(16,31,44,.94), rgba(10,20,30,.94)); box-shadow: var(--shadow); }
.panel { padding: 20px; }
.panel-heading { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.control-group { margin-top: 22px; }
.control-label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.button-grid button, .stack-buttons button, .timeline-buttons button, .surface-button { border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.035); color: #c4d2d8; cursor: pointer; transition: .18s ease; }
.button-grid button { padding: 9px 6px; font-size: 12px; }
.stack-buttons { display: grid; gap: 8px; }
.stack-buttons button { padding: 11px; text-align: left; }
.button-grid button:hover, .stack-buttons button:hover, .timeline-buttons button:hover, .surface-button:hover { border-color: rgba(95,240,200,.45); transform: translateY(-1px); }
.button-grid button.active, .stack-buttons button.active, .timeline-buttons button.active, .surface-button.active { border-color: rgba(95,240,200,.65); background: rgba(95,240,200,.12); color: var(--accent); }
.surface-list { display: grid; gap: 7px; }
.surface-button { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 9px 10px; text-align: left; }
.surface-button span:last-child { color: var(--muted); font-size: 10px; }
.microcopy { margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.viewer-card { min-width: 0; overflow: hidden; }
.viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 62px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.viewer-toolbar > div { display: flex; align-items: center; gap: 9px; }
.signal { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px var(--accent); }
.viewer-meta { color: var(--muted); font-size: 12px; }
.viewer-meta span + span::before { content: "·"; margin-right: 9px; }
.viewer { position: relative; min-height: 620px; background: radial-gradient(circle at center, rgba(131,167,255,.08), transparent 54%), linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: auto, 34px 34px, 34px 34px; cursor: grab; touch-action: none; outline: none; }
.viewer.dragging { cursor: grabbing; }
#spaceSvg { display: block; width: 100%; height: 620px; overflow: visible; }
.room-surface { stroke: rgba(255,255,255,.45); stroke-width: 1.35; cursor: pointer; transition: opacity .15s ease, stroke .15s ease; }
.room-surface:hover, .room-surface.selected { stroke: var(--accent); stroke-width: 2.4; opacity: .95 !important; }
.room-edge { fill: none; stroke: rgba(255,255,255,.28); stroke-width: 1; pointer-events: none; }
.object-marker { cursor: pointer; }
.object-marker circle { fill: #071019; stroke: var(--accent-2); stroke-width: 2.5; transition: .16s ease; }
.object-marker.highlight circle, .object-marker:hover circle, .object-marker.selected circle { fill: var(--accent); stroke: #fff; r: 9; }
.object-marker text { fill: #d8e6ea; font-size: 11px; font-weight: 750; paint-order: stroke; stroke: #071019; stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.axis-legend { position: absolute; right: 16px; bottom: 15px; display: flex; gap: 8px; color: #071019; font-size: 10px; font-weight: 900; }
.axis-legend span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; }
.axis-x { background: #ff8b87; }.axis-y { background: var(--accent); }.axis-z { background: var(--accent-2); }
.timeline-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.timeline-bar .control-label { margin: 0; }
.timeline-buttons { display: flex; gap: 8px; }
.timeline-buttons button { padding: 7px 11px; font-size: 11px; }
.inspector-panel { overflow: auto; }
.empty-state { padding-top: 20px; color: #b3c2c9; }
.inspector-list { display: grid; gap: 0; margin: 14px 0 0; }
.inspector-list div { display: grid; grid-template-columns: 102px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.inspector-list dt { color: var(--muted); font-size: 12px; }
.inspector-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 700; }
.inspector-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.small-pill { display: inline-flex; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; }
.face-section, .contracts-section { margin-top: 18px; padding: 24px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.text-link { color: var(--accent); font-size: 12px; font-weight: 800; text-decoration: none; }
.face-layout { display: grid; grid-template-columns: minmax(0,1fr) 260px; gap: 18px; }
.face-canvas { min-height: 500px; border: 1px solid var(--line); border-radius: 18px; background: #09141d; overflow: hidden; }
#faceSvg { width: 100%; min-height: 500px; }
.face-boundary { fill: rgba(131,167,255,.06); stroke: rgba(255,255,255,.65); stroke-width: 2; }
.face-grid { stroke: rgba(255,255,255,.08); stroke-width: 1; }
.face-object { fill: rgba(95,240,200,.16); stroke: var(--accent); stroke-width: 2; cursor: pointer; }
.face-object:hover { fill: rgba(95,240,200,.32); }
.face-label { fill: #dce8eb; font-size: 13px; font-weight: 750; pointer-events: none; }
.dimension-label { fill: var(--muted); font-size: 12px; }
.face-contract { display: grid; align-content: start; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.face-contract div { padding: 16px; border-bottom: 1px solid var(--line); }
.face-contract div:last-child { border-bottom: 0; }
.face-contract span, .face-contract strong { display: block; }
.face-contract span { color: var(--muted); font-size: 11px; }
.face-contract strong { margin-top: 4px; font-size: 12px; }
.contract-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.contract-grid a { min-height: 145px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); text-decoration: none; transition: .18s ease; }
.contract-grid a:hover { border-color: rgba(95,240,200,.5); transform: translateY(-2px); }
.contract-grid span, .contract-grid strong, .contract-grid small { display: block; }
.contract-grid span { color: var(--accent); font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.contract-grid strong { margin: 16px 0 5px; }
.contract-grid small { color: var(--muted); }
footer { display: flex; justify-content: space-between; gap: 18px; padding: 26px clamp(18px,4vw,54px) 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
footer div { display: flex; gap: 9px; align-items: center; }
footer a { color: var(--accent); text-decoration: none; }
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 240px minmax(0,1fr); }
  .inspector-panel { grid-column: 1 / -1; min-height: 260px; }
  .inspector-list { grid-template-columns: 1fr 1fr; column-gap: 28px; }
}
@media (max-width: 820px) {
  .topbar { position: static; align-items: flex-start; }
  .top-status { display: none; }
  main { width: min(100% - 20px, 1540px); padding-top: 24px; }
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .workspace { grid-template-columns: 1fr; }
  .controls-panel { order: 2; }
  .viewer-card { order: 1; }
  .inspector-panel { order: 3; }
  .viewer, #spaceSvg { min-height: 500px; height: 500px; }
  .face-layout { grid-template-columns: 1fr; }
  .contract-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .brand strong { font-size: 13px; }
  .hero-facts, .contract-grid { grid-template-columns: 1fr; }
  .hero-facts div { border-right: 0; }
  .hero-facts div:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
  .hero-facts div:last-child { border-bottom: 0; }
  .timeline-bar, .section-heading, footer { align-items: flex-start; flex-direction: column; }
  .timeline-buttons { flex-wrap: wrap; }
  .inspector-list { grid-template-columns: 1fr; }
}
