:root {
  --bg: #0f0b0b;
  --panel: #171212;
  --panel-2: #211919;
  --line: #3b2d2a;
  --text: #f3ede7;
  --muted: #bbaea4;
  --copper: #c88746;
  --gold: #e3bc72;
  --cyan: #7bc7c8;
  --red: #d46a5c;
  --green: #76b796;
  --cream: #e7dccd;
  --shadow: 0 16px 40px rgba(0,0,0,.35);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top, #2a1b18 0%, var(--bg) 42%);
  color: var(--text);
}
.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}
.topbar, .scene-header, .topbar-actions {
  display: flex;
  align-items: center;
}
.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.topbar-actions { gap: 10px; }
.eyebrow, .section-label {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  color: var(--gold);
  margin: 0 0 6px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 5vw, 42px); }
h2 { margin-bottom: 10px; }
h3 { margin-bottom: 8px; }
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
}
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.scene-card { grid-row: span 2; }
.status-pill, .ghost-btn, .tag, .scene-mode, .meta-chip {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}
.status-pill, .ghost-btn, .scene-mode {
  padding: 10px 14px;
  font-size: 13px;
}
.status-pill, .scene-mode { color: var(--gold); }
.ghost-btn { cursor: pointer; }
.scene-header {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.pixel-room {
  position: relative;
  overflow: hidden;
  min-height: 540px;
  border-radius: 20px;
  border: 1px solid #5c4539;
  background: var(--cream);
  image-rendering: pixelated;
}
.room-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(72,66,58,.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(72,66,58,.16) 1px, transparent 1px);
  background-size: 38px 38px;
}
.room, .path-line, .desk, .meeting-table, .cabinet, .plant, .screen, .avatar, .npc, .activity, .poi, .door, .server-rack, .light-cone {
  position: absolute;
}
.room {
  background: rgba(255,255,255,.55);
  border: 6px solid #f8f3ee;
  box-shadow: inset 0 0 0 3px rgba(112,90,74,.12);
}
.north-room { left: 8%; top: 6%; width: 50%; height: 30%; }
.west-room { left: 8%; top: 38%; width: 32%; height: 32%; }
.east-room { right: 8%; top: 14%; width: 30%; height: 32%; }
.hall-room { left: 42%; top: 42%; width: 44%; height: 40%; }
.path-line {
  background: repeating-linear-gradient(90deg, rgba(200,135,70,.35) 0 10px, transparent 10px 18px);
  opacity: .7;
}
.path-a { left: 29%; top: 28%; width: 34%; height: 6px; }
.path-b { left: 61%; top: 28%; width: 14%; height: 6px; }
.path-c { left: 58%; top: 50%; width: 6px; height: 20%; background: repeating-linear-gradient(180deg, rgba(200,135,70,.35) 0 10px, transparent 10px 18px); }
.desk, .meeting-table {
  background: #8f6242;
  border: 4px solid #5f3b27;
  border-bottom-width: 9px;
}
.desk { width: 112px; height: 66px; }
.desk-main { left: 55%; top: 19%; }
.desk-analyst { left: 16%; top: 18%; }
.desk-entry { left: 16%; top: 49%; }
.meeting-table { left: 50%; top: 55%; width: 140px; height: 76px; }
.cabinet {
  width: 52px; height: 112px; background: #c5a27b; border: 4px solid #7e5b3f;
}
.cabinet-a { right: 8%; top: 10%; }
.cabinet-b { right: 11%; bottom: 12%; height: 76px; }
.plant {
  width: 34px; height: 52px; background: linear-gradient(#3a6f58 0 70%, #7a5439 70% 100%); border-radius: 8px;
}
.plant-a { left: 37%; top: 12%; }
.plant-b { right: 14%; bottom: 14%; }
.screen {
  width: 46px; height: 30px; background: #2d3f42; border: 4px solid #132326;
}
.screen-main { left: 60%; top: 25%; }
.screen-secondary { left: 21%; top: 24%; }
.screen-sat { right: 16%; top: 24%; }
.door {
  left: 64%; bottom: 6%; width: 54px; height: 14px; background: #a16b58; border: 3px solid #6d4638;
}
.server-rack {
  right: 10%; bottom: 22%; width: 42px; height: 72px; background: #2a2f36; border: 4px solid #15181d;
}
.server-rack::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 10px;
  width: 20px;
  height: 6px;
  background: var(--cyan);
  box-shadow: 0 14px 0 rgba(123,199,200,.85), 0 28px 0 rgba(123,199,200,.65);
}
.light-cone {
  left: 51%;
  top: 10%;
  width: 120px;
  height: 180px;
  background: radial-gradient(circle at top, rgba(227,188,114,.22), transparent 65%);
  pointer-events: none;
}
.poi {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(17,15,15,.35);
  background: rgba(17,15,15,.82);
  color: var(--gold);
  cursor: pointer;
  z-index: 4;
}
.poi-label { font-size: 11px; font-weight: 700; }
.poi:hover, .poi.active { box-shadow: 0 0 0 2px rgba(227,188,114,.14), 0 0 18px rgba(200,135,70,.18); }
.poi-dof { left: 24%; top: 20%; }
.poi-sat { right: 17%; top: 20%; }
.poi-memory { left: 20%; top: 52%; }
.poi-ops { left: 58%; top: 58%; }
.poi-logs { right: 10%; bottom: 22%; }

.avatar {
  width: 56px;
  height: 86px;
  left: 63%;
  top: 34%;
  z-index: 3;
  transition: left .75s ease, top .75s ease, transform .35s ease;
}
.avatar.walking { animation: walk 0.55s steps(2) infinite; }
.avatar[data-state="analysis"], .avatar[data-state="monitoring"] { animation: bob 1.7s ease-in-out infinite; }
.avatar[data-state="alert"] { animation: pulse 1s ease-in-out infinite; }
.avatar.walking[data-state="analysis"], .avatar.walking[data-state="monitoring"], .avatar.walking[data-state="alert"] { animation: walk 0.55s steps(2) infinite; }

.owl-head {
  width: 44px;
  height: 34px;
  background: #2f2a28;
  border: 4px solid #171312;
  border-radius: 12px;
  left: 6px;
  top: 0;
}
.owl-head::before, .owl-head::after {
  content: "";
  position: absolute;
  top: 10px;
  width: 7px;
  height: 7px;
  background: var(--gold);
  border-radius: 50%;
}
.owl-head::before { left: 10px; }
.owl-head::after { right: 10px; }

.owl-body {
  width: 36px;
  height: 38px;
  background: var(--copper);
  border: 4px solid #5d3319;
  border-radius: 10px;
  left: 10px;
  top: 30px;
}
.owl-feet {
  width: 24px;
  height: 8px;
  left: 16px;
  bottom: 10px;
  border-bottom: 4px solid #5d3319;
}

.npc {
  width: 38px;
  height: 60px;
  border-radius: 10px;
  background: linear-gradient(#2f2a28 0 34%, #7e8fb0 34% 100%);
  border: 3px solid #171312;
  opacity: .72;
}
.npc-analyst { left: 27%; top: 30%; }
.npc-clerk {
  left: 58%;
  top: 64%;
  background: linear-gradient(#2f2a28 0 34%, #8aa98f 34% 100%);
}

.speech {
  position: absolute;
  left: -12px;
  top: -38px;
  white-space: nowrap;
  background: rgba(17,15,15,.92);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.activity {
  min-width: 54px;
  text-align: center;
  padding: 6px 8px;
  font-size: 12px;
  background: rgba(17,15,15,.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  opacity: .42;
  z-index: 2;
}
.activity.active {
  opacity: 1;
  color: var(--text);
  box-shadow: 0 0 0 2px rgba(227,188,114,.14), 0 0 18px rgba(200,135,70,.18);
}
.activity-dof { left: 22%; top: 34%; }
.activity-sat { right: 14%; top: 36%; }
.activity-alert { right: 8%; bottom: 10%; }
.activity-memory { left: 14%; bottom: 20%; }
.activity-logs { right: 7%; bottom: 32%; }

.legend, .metric-stack, .signal-list, .timeline, .live-strip, .detail-meta { display: grid; gap: 12px; }
.legend {
  grid-template-columns: repeat(3, minmax(0,1fr));
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}
.online { background: var(--green); }
.warn { background: var(--gold); }
.alert { background: var(--red); }

.metric-row, .signal-item, .timeline-item, .detail-panel, .live-item {
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.signal-item, .timeline-item, .live-item { display: block; }
.signal-item strong, .timeline-item strong, .live-item strong { display: block; margin-bottom: 6px; }
.muted { color: var(--muted); }

.tag, .meta-chip {
  padding: 4px 10px;
  font-size: 11px;
  display: inline-block;
  margin-top: 8px;
}
.tag.ok { color: var(--green); }
.tag.warn { color: var(--gold); }
.tag.alert { color: var(--red); }
.compact { margin-bottom: 14px; }
.live-strip { margin-bottom: 14px; }
.detail-panel { min-height: 170px; }
.detail-meta { grid-template-columns: repeat(2, minmax(0,1fr)); margin-top: 10px; }
.meta-chip { color: var(--gold); }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes walk {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

@media (max-width: 860px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .scene-card { grid-row: auto; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .pixel-room { min-height: 460px; }
  .legend, .detail-meta { grid-template-columns: 1fr; }
}
