/* 3D CAD (/3dcad) — the sketch environment (specs/038-3d-cad/contracts/client-ui.md §5, §2): the sketch palette on the
   right of the canvas (options, the constraint buttons, 「스케치 마무리」), the pick hint over the canvas, the inferred
   constraint glyphs next to the cursor and the constraint glyph colours. Colours use the shell's variables (cad3d.css).
   No inline styles: positions are set through the CSSOM. */

/* ---------------------------------------------------------------- palette */
.c3-sketch-palette {
  width: 232px;
  max-height: calc(100vh - 260px);
  overflow: auto;
  border: 1px solid var(--c3-border, #c3c6cb);
  border-radius: var(--c3-radius, 3px);
  background: var(--c3-panel, rgba(255, 255, 255, 0.94));
  box-shadow: var(--c3-shadow, 0 2px 10px rgba(0, 0, 0, 0.16));
  font: 12px/1.35 var(--c3-font, system-ui, sans-serif);
  color: var(--c3-text, #232323);
  user-select: none;
  -webkit-user-select: none;
}
.c3-sketch-palette[hidden] { display: none; }

/* A command dialog takes the top right; the palette waits below it. */
.c3-viewport:has(.c3-cmd-dialog) .c3-palette-host {
  top: auto;
  bottom: 64px;
}

.c3-sketch-palette-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 26px;
  padding: 0 4px 0 9px;
  border-bottom: 1px solid var(--c3-border-soft, #e2e4e7);
  background: var(--c3-surface-alt, #f6f6f6);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.c3-sketch-palette-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: var(--c3-radius, 3px);
  background: transparent;
  color: var(--c3-text-muted, #666a70);
  cursor: pointer;
}
.c3-sketch-palette-collapse:hover { background: var(--c3-hover, #e3eefa); }
.c3-sketch-palette.is-collapsed .c3-sketch-palette-collapse svg { transform: rotate(180deg); }
.c3-sketch-palette.is-collapsed .c3-sketch-palette-body { display: none; }

.c3-sketch-palette-section { padding: 6px 9px 8px; border-bottom: 1px solid var(--c3-border-soft, #e2e4e7); }
.c3-sketch-palette-section-title {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--c3-text-muted, #666a70);
}
.c3-sketch-palette-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  gap: 8px;
}
.c3-sketch-palette-check { cursor: pointer; }
.c3-sketch-palette-check input { margin: 0; accent-color: var(--c3-accent, #0696d7); }
.c3-sketch-palette-label { flex: 1 1 auto; }

.c3-sketch-linetypes { display: inline-flex; }
.c3-sketch-linetype,
.c3-sketch-palette-look {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--c3-border, #c3c6cb);
  background: var(--c3-surface, #fff);
  color: var(--c3-text, #232323);
  font: inherit;
  cursor: pointer;
}
.c3-sketch-linetype:first-child { border-radius: var(--c3-radius, 3px) 0 0 var(--c3-radius, 3px); }
.c3-sketch-linetype:last-child { border-left: 0; border-radius: 0 var(--c3-radius, 3px) var(--c3-radius, 3px) 0; }
.c3-sketch-palette-look { border-radius: var(--c3-radius, 3px); }
.c3-sketch-linetype:hover,
.c3-sketch-palette-look:hover { background: var(--c3-hover, #e3eefa); }
.c3-sketch-linetype.is-on { background: var(--c3-active, #cfe4f8); border-color: var(--c3-accent, #0696d7); }
.c3-sketch-linetype[data-line-type="construction"].is-on { color: var(--c3-construction-ink, #b3610a); }

.c3-sketch-palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}
.c3-sketch-palette-constraint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--c3-radius, 3px);
  background: transparent;
  cursor: pointer;
}
.c3-sketch-palette-constraint:hover { background: var(--c3-hover, #e3eefa); border-color: var(--c3-hover-border, #b5d3f1); }
.c3-sketch-palette-constraint.is-active { background: var(--c3-active, #cfe4f8); border-color: var(--c3-accent, #0696d7); }
.c3-sketch-palette-constraint:disabled { opacity: 0.35; cursor: default; }

.c3-sketch-palette-foot { padding: 8px 9px; }
.c3-sketch-finish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 28px;
  border-color: var(--c3-success, #2e9e4f);
  background: var(--c3-success, #2e9e4f);
  color: #fff;
}
.c3-sketch-finish:hover { filter: brightness(1.06); }

/* ---------------------------------------------------------------- canvas hints */
.c3-sketch-pick-hint {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  max-width: min(520px, calc(100% - 32px));
  padding: 4px 12px;
  border: 1px solid var(--c3-border, #c3c6cb);
  border-radius: 12px;
  background: var(--c3-glass, rgba(255, 255, 255, 0.92));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  font: 12px/1.4 var(--c3-font, system-ui, sans-serif);
  color: var(--c3-text, #232323);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c3-sketch-hint {
  position: absolute;
  left: 0;
  top: 0;
  padding: 1px 4px;
  border: 1px solid var(--c3-line-strong, #8f96a1);
  border-radius: 2px;
  background: var(--c3-glass, rgba(255, 255, 255, 0.94));
  font-size: 10px;
  line-height: 13px;
  color: var(--c3-ink-2, #2b2f36);
  white-space: nowrap;
  pointer-events: none;
  will-change: transform;
}
.c3-sketch-hint[hidden] { display: none; }

/* The value boxes of a drawing tool (length, angle …) leave the clicks to the canvas until a typed number or Tab puts
   the focus in one (Fusion): a click next to the rubber band end always places the point (R-UX-03). */
.c3-value-box.c3-sketch-value:not(.is-typing),
.c3-value-box.c3-sketch-value:not(.is-typing) .c3-value-input { pointer-events: none; }

/* The text dialog's lines. */
.c3-sketch-text-area {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  padding: 3px 6px;
  border: 1px solid var(--c3-border, #c3c6cb);
  border-radius: var(--c3-radius, 3px);
  font: 12px/1.35 var(--c3-font, system-ui, sans-serif);
  resize: vertical;
}
.c3-sketch-text-area:focus { outline: none; border-color: var(--c3-accent, #0696d7); box-shadow: 0 0 0 2px var(--c3-focus, rgba(6, 150, 215, 0.35)); }
/* Characters of the sketch's texts against its 300 (Engine MAX_SKETCH_TEXT) and, beside them, of the document's against
   its 400 (MAX_DOCUMENT_TEXT); each red beyond. */
.c3-sketch-text-counts { display: flex; flex-wrap: wrap; justify-content: flex-end; column-gap: 10px; margin-top: 2px; }
.c3-sketch-text-count { font: 11px/1.3 var(--c3-font, system-ui, sans-serif); color: var(--c3-text-muted, #6b7079); text-align: right; word-break: keep-all; }
.c3-sketch-text-count.is-over { color: var(--c3-error-fg, var(--c3-error, #d6302d)); font-weight: 600; }

/* Constraint glyphs: fixed in green (client-ui §2 「고정 초록」). */
.c3-glyph.c3-glyph-fix { color: var(--c3-success-fg, var(--c3-success, #2e9e4f)); border-color: var(--c3-success, #2e9e4f); }
