.threedesign {
  --td-bg: #f4f6f8;
  --td-panel: #ffffff;
  --td-border: #d8dee6;
  --td-accent: #1a5f8a;
  --td-text: #1f2933;
  --td-muted: #5f6b7a;
  --td-view: #1c242c;
  --td-hole: #c2410c;
  --td-ok: #0f7b3a;
}

.threedesign__form {
  margin: 0;
}

.threedesign__topbar,
.threedesign__bottom,
.threedesign__viewbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.85rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: var(--td-panel);
  border: 1px solid var(--td-border);
  border-radius: 8px;
}

.threedesign__topbar {
  margin-bottom: 0.75rem;
}

.threedesign__bottom {
  margin-top: 0.75rem;
}

.threedesign__brand {
  font-weight: 700;
  color: var(--td-accent);
  letter-spacing: 0.02em;
}

.threedesign__file-row,
.threedesign__export,
.threedesign__history,
.threedesign__ops,
.threedesign__tools,
.threedesign__view-tabs,
.threedesign__analyse {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.threedesign__status,
.threedesign__formats,
.threedesign__hint,
.threedesign__stat {
  font-size: 0.85rem;
  color: var(--td-muted);
  margin: 0.25rem 0;
}

.threedesign__status.is-ready {
  color: var(--td-ok);
}

.threedesign__status.is-busy,
.threedesign__status.is-error {
  color: var(--td-hole);
}

.threedesign__layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr) minmax(
      200px,
      250px
    );
  gap: 0.75rem;
  min-height: 560px;
}

.threedesign__panel {
  background: var(--td-panel);
  border: 1px solid var(--td-border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  overflow: auto;
  max-height: calc(100vh - 220px);
}

.threedesign__group {
  margin-bottom: 1rem;
}

.threedesign__group h3,
.threedesign__panel-head {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--td-muted);
}

.threedesign__shapes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.threedesign__shape,
.threedesign__tree-item {
  width: 100%;
  text-align: left;
  font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--td-border);
  border-radius: 6px;
  background: #fff;
  cursor: grab;
}

.threedesign__shape:hover,
.threedesign__tree-item:hover {
  border-color: var(--td-accent);
}

.threedesign__tree {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.threedesign__tree-item.is-active,
.threedesign__shape.is-active,
.threedesign__tools .btn.is-active,
.threedesign__view-tabs .btn.is-active {
  background: var(--td-accent);
  color: #fff;
  border-color: var(--td-accent);
}

.threedesign__tree-item.is-hole {
  color: var(--td-hole);
}

.threedesign__ops .btn,
.threedesign__file-row .btn {
  font-size: 0.82rem;
}

.threedesign__stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.threedesign__viewbar {
  margin-bottom: 0.5rem;
}

.threedesign__viewport-wrap {
  position: relative;
  flex: 1 1 auto;
  display: block;
  width: 100%;
  min-height: 420px;
  height: calc(100vh - 280px);
  background: var(--td-view);
  border: 1px solid var(--td-border);
  border-radius: 8px;
  overflow: hidden;
  box-sizing: border-box;
}

.threedesign__canvas,
.threedesign__drawing {
  position: absolute;
  inset: 0;
}

.threedesign__drawing {
  background: #fff;
  overflow: auto;
}

.threedesign__overlay,
.threedesign__loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  max-width: 90%;
  padding: 0.65rem 0.9rem;
  background: rgba(28, 36, 44, 0.82);
  color: #fff;
  border-radius: 6px;
  font-size: 0.88rem;
  text-align: center;
  pointer-events: none;
}

.threedesign__loading[hidden],
.threedesign__overlay[hidden],
.threedesign__drawing[hidden],
.threedesign__canvas[hidden] {
  display: none !important;
}

.threedesign__props label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
  font-size: 0.85rem;
  color: var(--td-text);
}

.threedesign__props input[type="number"],
.threedesign__props select {
  width: 7.5rem;
  max-width: 48%;
}

.threedesign__role {
  display: flex;
  gap: 0.6rem;
  margin: 0.45rem 0 0.7rem;
  font-size: 0.85rem;
}

.threedesign__related {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
  align-items: center;
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
}

.threedesign__related a {
  color: var(--td-accent);
}

.threedesign__related--stack {
  flex-direction: column;
  align-items: flex-start;
}

.threedesign__result {
  min-height: 1.2rem;
  margin-top: 0.6rem;
  font-size: 0.9rem;
}

.threedesign__result.is-error {
  color: var(--td-hole);
}

.threedesign__analyse-label {
  font-size: 0.85rem;
  color: var(--td-muted);
}

.threedesign__fs-btn.rlt-tool-fs-btn {
  margin-left: 0.5rem;
  flex: 0 0 auto;
}

@media (max-width: 980px) {
  .threedesign__layout {
    grid-template-columns: 1fr;
  }

  .threedesign__panel {
    max-height: none;
  }

  .threedesign__viewport-wrap {
    height: 420px;
  }
}
