/* 3D CAD (/3dcad) — what U-VIEW puts over the canvas: labels, value boxes, selection rectangles, the 「대상 고르기」 list,
   the view cube and the navigation bar (specs/038-3d-cad/contracts/client-ui.md §1–§3). Colours use the shell's
   variables (cad3d.css) with these fallbacks. No inline styles: positions are set through the CSSOM. */

.c3-view-host {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.c3-view-host > canvas.c3-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.c3-view-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  font-family: var(--c3-font, system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif);
}

/* ---------------------------------------------------------------- cursors */
.c3-view-host.c3-cursor-orbit > canvas.c3-canvas { cursor: grabbing; }
.c3-view-host.c3-cursor-pan > canvas.c3-canvas,
.c3-view-host.c3-cursor-tool-pan > canvas.c3-canvas { cursor: move; }
.c3-view-host.c3-cursor-tool-orbit > canvas.c3-canvas { cursor: grab; }
.c3-view-host.c3-cursor-tool-zoom > canvas.c3-canvas { cursor: ns-resize; }
.c3-view-host.c3-cursor-tool-zoom_window > canvas.c3-canvas,
.c3-view-host.c3-cursor-tool-look > canvas.c3-canvas { cursor: crosshair; }
.c3-view-host.c3-cursor-manipulator > canvas.c3-canvas { cursor: pointer; }

/* ---------------------------------------------------------------- sketch labels */
.c3-dim,
.c3-glyph {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  will-change: transform;
}

.c3-dim {
  padding: 0 3px;
  font-size: 12px;
  line-height: 16px;
  color: var(--c3-text, #141414);
  background: var(--c3-glass-label, rgba(255, 255, 255, 0.78));
  border-radius: 2px;
}
.c3-dim.is-reference { color: var(--c3-text-muted, #5b6270); }
.c3-dim.is-over { color: var(--c3-error-fg, var(--c3-error, #d62d2d)); }
.c3-dim.is-hover { color: var(--c3-accent-fg, var(--c3-accent, #2f7fd8)); outline: 1px solid rgba(47, 127, 216, 0.55); }
.c3-dim.is-selected { color: #fff; background: var(--c3-accent, #2f7fd8); }

.c3-glyph {
  min-width: 14px;
  height: 14px;
  padding: 0 1px;
  font-size: 10px;
  line-height: 13px;
  text-align: center;
  color: var(--c3-ink-2, #2b2f36);
  background: var(--c3-surface);
  border: 1px solid var(--c3-line-strong, #8f96a1);
  border-radius: 2px;
  box-sizing: border-box;
}
.c3-glyph.is-over { color: #fff; background: var(--c3-error, #d62d2d); border-color: var(--c3-error, #d62d2d); }
.c3-glyph.is-hover { border-color: var(--c3-accent, #2f7fd8); color: var(--c3-accent-fg, var(--c3-accent, #2f7fd8)); }
.c3-glyph.is-selected { color: #fff; background: var(--c3-accent, #2f7fd8); border-color: var(--c3-accent, #2f7fd8); }

/* ---------------------------------------------------------------- value box (manipulators) */
.c3-value-box {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  will-change: transform;
}
.c3-value-box[hidden] { display: none; }
.c3-value-input {
  width: 92px;
  height: 22px;
  padding: 0 6px;
  font: 12px/20px var(--c3-font, system-ui, sans-serif);
  color: var(--c3-text, #141414);
  background: var(--c3-surface);
  border: 1px solid var(--c3-accent, #2f7fd8);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  outline: none;
}
.c3-value-box.is-invalid .c3-value-input {
  border-color: var(--c3-error, #d62d2d);
  background: var(--c3-error-tint, #fff3f2);
}

/* ---------------------------------------------------------------- selection rectangles */
.c3-select-rect,
.c3-zoom-rect {
  position: absolute;
  box-sizing: border-box;
}
.c3-select-rect.is-window {
  border: 1px solid #2f7fd8;
  background: rgba(47, 127, 216, 0.12);
}
.c3-select-rect.is-crossing {
  border: 1px dashed #2e9e4f;
  background: rgba(46, 158, 79, 0.12);
}
.c3-zoom-rect {
  border: 1px dashed var(--c3-ink-3, #4a5260);
  background: rgba(74, 82, 96, 0.06);
}

.c3-orbit-ring {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px solid rgba(47, 127, 216, 0.55);
  border-radius: 50%;
}
.c3-orbit-knob {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border: 1.5px solid rgba(47, 127, 216, 0.8);
  border-radius: 50%;
  background: var(--c3-glass, rgba(255, 255, 255, 0.85));
}
.c3-orbit-knob-n { left: 50%; top: 0; }
.c3-orbit-knob-s { left: 50%; top: 100%; }
.c3-orbit-knob-e { left: 100%; top: 50%; }
.c3-orbit-knob-w { left: 0; top: 50%; }

/* ---------------------------------------------------------------- 대상 고르기 */
.c3-pick-list {
  position: absolute;
  min-width: 200px;
  max-width: 340px;
  max-height: 260px;
  overflow: auto;
  padding: 4px 0;
  pointer-events: auto;
  background: var(--c3-surface, #fbfbfc);
  border: 1px solid var(--c3-border, #b9bfc8);
  border-radius: 3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  font-size: 12px;
}
.c3-pick-list-title {
  padding: 2px 10px 5px;
  color: var(--c3-text-muted, #5b6270);
  border-bottom: 1px solid var(--c3-border-soft, #e1e4e8);
  margin-bottom: 3px;
}
.c3-pick-list-item {
  display: flex;
  gap: 8px;
  width: 100%;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  color: var(--c3-text, #141414);
  cursor: pointer;
}
.c3-pick-list-item:hover,
.c3-pick-list-item:focus-visible {
  background: var(--c3-hover, #e3eefb);
  outline: none;
}
.c3-pick-list-kind {
  flex: 0 0 auto;
  min-width: 64px;
  color: var(--c3-text-muted, #5b6270);
}
.c3-pick-list-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Same-named rows: what tells them apart (surface and area, curve and length, position, order; T132). */
.c3-pick-list:has(.c3-pick-list-detail) {
  max-width: 460px;
}
.c3-pick-list-detail {
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 6px;
  color: var(--c3-text-muted, #5b6270);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- view cube */
.c3-viewcube {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 110px;
  height: 110px;
  user-select: none;
  -webkit-user-select: none;
}
.c3-viewcube-canvas {
  display: block;
  width: 110px;
  height: 110px;
  cursor: pointer;
  touch-action: none;
}
.c3-viewcube button {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--c3-ink-3, #4d5561);
  cursor: pointer;
  opacity: 0.7;
}
.c3-viewcube button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.c3-viewcube .c3-viewcube-step svg path { fill: currentColor; stroke: none; }
.c3-viewcube button:hover,
.c3-viewcube button:focus-visible {
  opacity: 1;
  color: var(--c3-accent-fg, var(--c3-accent, #2f7fd8));
  background: var(--c3-glass, rgba(255, 255, 255, 0.7));
  outline: none;
}
.c3-viewcube-home { left: -4px; top: -4px; }
.c3-viewcube-menu { right: -4px; bottom: -4px; }
.c3-viewcube-cw { right: -4px; top: -4px; }
.c3-viewcube-ccw { right: 18px; top: -4px; }
.c3-viewcube-step-up { left: 45px; top: -6px; }
.c3-viewcube-step-down { left: 45px; bottom: -6px; }
.c3-viewcube-step-left { left: -6px; top: 45px; }
.c3-viewcube-step-right { right: -6px; top: 45px; }
.c3-viewcube:not(.is-face-on) .c3-viewcube-roll,
.c3-viewcube:not(.is-face-on) .c3-viewcube-step {
  display: none;
}
.c3-viewcube:not(:hover) .c3-viewcube-home,
.c3-viewcube:not(:hover) .c3-viewcube-menu {
  opacity: 0.35;
}

/* ---------------------------------------------------------------- navigation bar */
.c3-navbar {
  position: absolute;
  left: 50%;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  transform: translateX(-50%);
  background: var(--c3-toolbar, rgba(246, 247, 249, 0.96));
  border: 1px solid var(--c3-border, #c3c8d0);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
  user-select: none;
  -webkit-user-select: none;
}
.c3-navbar-group {
  display: flex;
  align-items: center;
}
.c3-navbar-separator {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--c3-border, #c3c8d0);
}
.c3-navbar-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--c3-text, #2b2f36);
  cursor: pointer;
}
.c3-navbar-button.c3-navbar-drop {
  width: 14px;
  margin-left: -2px;
}
.c3-navbar-button:hover,
.c3-navbar-button:focus-visible,
.c3-navbar-button.is-open {
  background: var(--c3-hover, #e3eefb);
  border-color: var(--c3-hover-border, #b7d1f0);
  outline: none;
}
.c3-navbar-button.is-active {
  background: var(--c3-active, #cfe2f8);
  border-color: var(--c3-accent, #2f7fd8);
}
