* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: #1f2933;
  background: #eef2f4;
}

.workbench {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(320px, 1fr) 280px;
  grid-template-rows: 48px minmax(280px, 1fr) 180px;
  gap: 1px;
  background: #c7d0d6;
}

.command-bar,
.object-tree,
.viewport,
.pendant,
.editor,
.bottom-panel {
  background: #f8fafb;
}

.command-bar {
  grid-column: 1 / 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

button {
  min-height: 32px;
  border: 1px solid #9aa8b2;
  background: #ffffff;
  color: #1f2933;
  border-radius: 4px;
}

.object-tree {
  padding: 12px;
  overflow: auto;
}

.object-tree h2,
.pendant h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.object-tree ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
}

.viewport {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  background: linear-gradient(#f8fafb, #dfe7eb);
}

.viewport svg {
  position: absolute;
  inset: auto 24px 24px 24px;
  height: 45%;
  width: calc(100% - 48px);
}

.robot-arm {
  position: absolute;
  left: 12%;
  top: 20%;
  width: 62%;
  height: 48%;
}

.joint {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #334e68;
}

.link {
  position: absolute;
  height: 8px;
  border-radius: 4px;
  background: #627d98;
  transform-origin: left center;
}

.j1 { left: 20px; top: 150px; }
.l1 { left: 35px; top: 155px; width: 115px; transform: rotate(-45deg); }
.j2 { left: 122px; top: 72px; }
.l2 { left: 137px; top: 78px; width: 120px; transform: rotate(20deg); }
.j3 { left: 250px; top: 115px; }
.l3 { left: 265px; top: 120px; width: 95px; transform: rotate(-15deg); }
.j4 { left: 356px; top: 92px; }

.pendant {
  padding: 12px;
  overflow: auto;
}

.pendant dl {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px;
  margin: 0;
}

.pendant dt {
  font-weight: 700;
}

.editor {
  grid-column: 1 / 3;
  padding: 12px;
  overflow: auto;
}

.editor nav {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.editor pre {
  margin: 0;
  padding: 12px;
  background: #1f2933;
  color: #f8fafb;
  overflow: auto;
}

.bottom-panel {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(7, minmax(100px, 1fr));
  gap: 8px;
  overflow: auto;
}

.bottom-panel div {
  border: 1px solid #c7d0d6;
  padding: 8px;
  background: #ffffff;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.bottom-panel span {
  overflow-wrap: anywhere;
}

@media (max-width: 840px) {
  .workbench {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .command-bar,
  .editor {
    grid-column: auto;
  }

  .bottom-panel {
    grid-template-columns: 1fr 1fr;
  }

  .viewport {
    min-height: 300px;
  }
}
