    /* [force-dark 차단 2026-06-14] 삼성 인터넷/Chrome 의 강제 다크 모드가 흰 배경(ISO 도면)을
       회색/검정으로 반전하는 것 차단. meta color-scheme 와 함께 CSS 에도 only light 선언해
       라이트 전용임을 확실히 알림. 앱 배경 토글은 JS 로 직접 칠하므로 무관. */
    :root {
      color-scheme: only light;
    }
    html,
    body {
      margin: 0;
      height: 100%;
      overflow: hidden;
      overscroll-behavior: none;
      font-family: 'Segoe UI', sans-serif;
      /* 핀치 zoom 차단 (iOS Safari 가 user-scalable=no 무시) — 한 손가락 pan 만 허용 */
      touch-action: pan-x pan-y;
    }
    body {
      padding-top: env(safe-area-inset-top, 0px);
    }

    /*
     * Icon-only window/modal close buttons share one geometry contract.
     *
     * Several feature panels inject their own colours and borders at runtime,
     * but a plain `×` still inherited the browser button padding/baseline. That
     * made the glyph look off-centre (especially with mobile font substitution).
     * Match only semantic icon-close controls so regular text buttons such as
     * "닫기"/"취소" keep their natural width and padding.
     */
    button.icon-close-button,
    button[aria-label][class*="-close"],
    button.fcat-x,
    button.fcat-picker-x,
    button.ecat-x,
    button.ecat-picker-x,
    button.pcat-x,
    button.rms-assembly-x,
    button[data-close-editor],
    button#tutCloseBtn {
      box-sizing: border-box !important;
      min-inline-size: 28px;
      min-block-size: 28px;
      aspect-ratio: 1 / 1;
      display: inline-grid !important;
      place-items: center !important;
      padding: 0 !important;
      font-family: Arial, sans-serif;
      line-height: 1 !important;
      text-align: center;
      vertical-align: middle;
    }

    :root {
      --toolbar-bg: #002244;
      --toolbar-text: white;
      --panel-bg: white;
      --panel-text: #333;
    }

    :root[data-theme="light"] {
      --toolbar-bg: #1a1a1a;
      --toolbar-text: white;
      --panel-bg: #F5F6F8;
      --panel-text: #1a1a1a;
    }

    :root[data-theme="contrast"] {
      --toolbar-bg: #000000;
      --toolbar-text: #FFFFFF;
      --panel-bg: #000000;
      --panel-text: #FFFFFF;
    }

    #top-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: var(--toolbar-bg);
      color: var(--toolbar-text);
      padding: 0 12px;
      height: 36px;
      position: relative;
      z-index: 1002;
      overflow: hidden;
    }

    #top-toolbar .toolbar-btn {
      background: none !important;
      border: none !important;
      color: white !important;
      cursor: pointer;
      padding: 4px 8px !important;
      display: flex;
      align-items: center;
      gap: 4px;
      font-size: 13px;
      border-radius: 6px;
    }

    #top-toolbar .toolbar-btn:hover {
      background: rgba(255, 255, 255, 0.15) !important;
    }

    #top-toolbar .toolbar-btn .material-icons-round {
      font-size: 20px;
    }

    #pipeModeToolbarBtn {
      margin-left: 14px;
    }

    /* 좁은 화면: 툴바 버튼 텍스트 숨기고 아이콘만 표시 */
    @media (max-width: 480px) {
      #top-toolbar .toolbar-btn {
        font-size: 0 !important;
        padding: 4px 6px !important;
      }
      #top-toolbar .toolbar-btn .material-icons-round {
        font-size: 18px !important;
      }
      #top-toolbar {
        padding: 0 6px;
      }
      #isoToggle, #bgToggle {
        padding: 3px 6px !important;
        gap: 3px !important;
      }
      #pipeModeToolbarBtn {
        margin-left: 8px;
      }
    }

    #fittingToggleBtn.mode-active {
      background: rgba(0,100,204,0.5) !important;
      border: 1px solid rgba(100,180,255,0.6);
    }

    :root {
      --panel-width: 300px;
    }
    .panel {
      position: fixed;
      left: 0;
      top: 36px;
      width: var(--panel-width);
      bottom: 0;
      overflow-y: auto;
      background: var(--panel-bg);
      color: var(--panel-text);
      padding: 10px;
      box-sizing: border-box;
      display: none;
      z-index: 1000;
    }
    /* 파이프 패널만 padding-top 제거 → sticky 가 패널 상단에 딱 붙음 (다른 패널 영향 X) */
    #panel-pipe { padding-top: 0; }
    #panel-pipe > #pipeEditorPanel > #pipeEditorControls { padding-top: 10px; }

    .helperLabel {
      color: #fff;
      background: rgba(255, 0, 0, 0.6);
      padding: 2px 4px;
      border-radius: 3px;
      font-size: 0.8rem;
      pointer-events: none;
      white-space: nowrap;
    }

    .helperLabel.blue {
      color: #fff;
      background: rgba(0, 0, 255, 0.6);
    }

    .panel.active {
      display: block;
    }

    .parts-manage-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin: 0 0 10px;
      padding: 8px;
      border: 1px solid rgba(100, 116, 139, 0.28);
      border-radius: 8px;
      background: rgba(15, 23, 42, 0.08);
    }

    .parts-manage-title {
      flex: 0 0 auto;
      font-size: 13px;
      font-weight: 700;
      color: var(--panel-text);
      white-space: nowrap;
    }

    .parts-manage-context {
      flex: 1 1 auto;
      min-width: 0;
      color: var(--panel-text);
    }

    .parts-manage-context strong {
      display: block;
      font-size: 13px;
      font-weight: 800;
      line-height: 1.2;
    }

    .parts-manage-context small {
      display: block;
      margin-top: 2px;
      color: rgba(148, 163, 184, 0.95);
      font-size: 10.5px;
      line-height: 1.25;
      white-space: normal;
    }

    .parts-manage-button {
      flex: 1 1 auto;
      width: auto;
      height: 32px;
      border: 1px solid rgba(59, 130, 246, 0.36);
      border-radius: 7px;
      background: rgba(15, 95, 184, 0.13);
      text-align: left;
      padding: 0 10px;
      cursor: pointer;
    }

    .parts-manage-quick {
      flex: 0 0 auto;
      width: auto;
      height: 32px;
      border: 1px solid rgba(34, 197, 94, 0.34);
      border-radius: 7px;
      background: rgba(34, 197, 94, 0.12);
      color: var(--panel-text);
      font-size: 12px;
      font-weight: 700;
      padding: 0 10px;
      text-align: center;
      white-space: nowrap;
      cursor: pointer;
    }

    .parts-design-switch {
      position: relative;
      flex: 0 0 auto;
    }

    .parts-design-switch-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      padding: 0 8px;
    }

    .parts-design-switch-btn > .material-icons-round:first-child {
      font-size: 16px;
    }

    .parts-design-switch-chevron {
      font-size: 16px;
      transition: transform 0.15s ease;
    }

    .parts-design-switch.open .parts-design-switch-chevron {
      transform: rotate(180deg);
    }

    .parts-design-switch-menu {
      position: absolute;
      top: calc(100% + 6px);
      right: 0;
      z-index: 1250;
      display: none;
      min-width: 154px;
      padding: 5px;
      border: 1px solid rgba(148, 163, 184, 0.28);
      border-radius: 8px;
      background: #111827;
      box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
    }

    .parts-design-switch.open .parts-design-switch-menu {
      display: grid;
      gap: 3px;
    }

    .parts-design-switch-item {
      width: 100%;
      min-height: 36px;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 0 9px;
      border: 0;
      border-radius: 6px;
      background: transparent;
      color: #e5edf7;
      font-size: 12px;
      font-weight: 700;
      text-align: left;
      white-space: nowrap;
      cursor: pointer;
    }

    .parts-design-switch-item:hover,
    .parts-design-switch-item:focus-visible {
      outline: none;
      background: rgba(59, 130, 246, 0.18);
      color: #ffffff;
    }

    .parts-design-switch-item .material-icons-round {
      width: 18px;
      color: #93c5fd;
      font-size: 17px;
      text-align: center;
    }

    :root[data-theme="light"] .parts-design-switch-menu {
      border-color: rgba(15, 23, 42, 0.16);
      background: #ffffff;
      box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
    }

    :root[data-theme="light"] .parts-design-switch-item {
      color: #172033;
    }

    :root[data-theme="light"] .parts-design-switch-item:hover,
    :root[data-theme="light"] .parts-design-switch-item:focus-visible {
      background: #eff6ff;
      color: #0f172a;
    }

    :root[data-theme="contrast"] .parts-design-switch-menu {
      border-color: rgba(255, 255, 255, 0.45);
      background: #000000;
    }

    :root[data-theme="contrast"] .parts-design-switch-item {
      color: #ffffff;
    }

    :root[data-theme="contrast"] .parts-design-switch-item:hover,
    :root[data-theme="contrast"] .parts-design-switch-item:focus-visible {
      background: #242424;
      color: #ffff00;
    }

    .parts-manage-button:hover {
      background: rgba(15, 95, 184, 0.22);
      border-color: rgba(59, 130, 246, 0.6);
    }

    .parts-hub-overlay {
      --parts-hub-surface: #101421;
      --parts-hub-card-bg: rgba(15, 23, 42, 0.82);
      --parts-hub-card-hover-bg: rgba(30, 41, 59, 0.96);
      --parts-hub-disabled-bg: rgba(15, 23, 42, 0.52);
      --parts-hub-border: rgba(148, 163, 184, 0.24);
      --parts-hub-card-border: rgba(96, 165, 250, 0.24);
      --parts-hub-card-border-hover: rgba(96, 165, 250, 0.68);
      --parts-hub-title: #f8fafc;
      --parts-hub-muted: #b8c2d1;
      --parts-hub-icon-bg: rgba(59, 130, 246, 0.2);
      --parts-hub-icon: #93c5fd;
      --parts-hub-close-bg: rgba(15, 23, 42, 0.74);
      position: fixed;
      inset: 0;
      z-index: 3000;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 18px;
      background: rgba(2, 6, 23, 0.56);
      backdrop-filter: blur(4px);
      box-sizing: border-box;
    }

    :root[data-theme="light"] .parts-hub-overlay {
      --parts-hub-surface: #f8fafc;
      --parts-hub-card-bg: #ffffff;
      --parts-hub-card-hover-bg: #f1f5f9;
      --parts-hub-disabled-bg: #eef2f7;
      --parts-hub-border: rgba(15, 23, 42, 0.16);
      --parts-hub-card-border: rgba(37, 99, 235, 0.22);
      --parts-hub-card-border-hover: rgba(37, 99, 235, 0.58);
      --parts-hub-title: #172033;
      --parts-hub-muted: #566274;
      --parts-hub-icon-bg: #dbeafe;
      --parts-hub-icon: #1d4ed8;
      --parts-hub-close-bg: #ffffff;
    }

    :root[data-theme="contrast"] .parts-hub-overlay {
      --parts-hub-surface: #000000;
      --parts-hub-card-bg: #101010;
      --parts-hub-card-hover-bg: #1e1e1e;
      --parts-hub-disabled-bg: #080808;
      --parts-hub-border: rgba(255, 255, 255, 0.38);
      --parts-hub-card-border: rgba(255, 255, 255, 0.34);
      --parts-hub-card-border-hover: #ffff00;
      --parts-hub-title: #ffffff;
      --parts-hub-muted: #d7d7d7;
      --parts-hub-icon-bg: rgba(255, 255, 0, 0.16);
      --parts-hub-icon: #ffff00;
      --parts-hub-close-bg: #101010;
    }

    .parts-hub-overlay.show {
      display: flex;
    }

    .parts-hub-modal {
      width: min(560px, 94vw);
      max-height: min(680px, 88vh);
      overflow: auto;
      border: 1px solid var(--parts-hub-border);
      border-radius: 12px;
      background: var(--parts-hub-surface);
      color: var(--parts-hub-title);
      box-shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
    }

    .parts-hub-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      padding: 18px 18px 12px;
      border-bottom: 1px solid var(--parts-hub-border);
    }

    .parts-hub-head h2 {
      margin: 0 0 4px;
      color: var(--parts-hub-title);
      font-size: 18px;
      line-height: 1.2;
    }

    .parts-hub-head p {
      margin: 0;
      color: var(--parts-hub-muted);
      font-size: 12px;
      line-height: 1.45;
    }

    .parts-hub-close {
      flex: 0 0 auto;
      width: 32px;
      height: 32px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: 1px solid var(--parts-hub-border) !important;
      border-radius: 7px;
      background: var(--parts-hub-close-bg) !important;
      color: var(--parts-hub-title) !important;
      font-family: Arial, sans-serif;
      font-size: 21px;
      line-height: 1;
      cursor: pointer;
    }

    .parts-hub-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      padding: 14px 18px 18px;
    }

    .parts-hub-card {
      display: grid;
      grid-template-columns: 34px 1fr;
      grid-template-rows: auto auto;
      align-items: center;
      column-gap: 10px;
      row-gap: 3px;
      min-height: 74px;
      padding: 12px;
      border: 1px solid var(--parts-hub-card-border) !important;
      border-radius: 9px;
      background: var(--parts-hub-card-bg) !important;
      color: var(--parts-hub-title) !important;
      text-align: left;
      cursor: pointer;
    }

    .parts-hub-card:hover {
      border-color: var(--parts-hub-card-border-hover) !important;
      background: var(--parts-hub-card-hover-bg) !important;
    }

    .parts-hub-card-disabled,
    .parts-hub-card:disabled {
      cursor: default;
      opacity: 0.64;
      border-color: var(--parts-hub-border) !important;
      background: var(--parts-hub-disabled-bg) !important;
    }

    .parts-hub-card-disabled:hover,
    .parts-hub-card:disabled:hover {
      border-color: var(--parts-hub-border) !important;
      background: var(--parts-hub-disabled-bg) !important;
    }

    .parts-hub-card .material-icons-round {
      grid-row: 1 / span 2;
      width: 34px;
      height: 34px;
      border-radius: 8px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: var(--parts-hub-icon-bg);
      color: var(--parts-hub-icon);
      font-size: 21px;
    }

    .parts-hub-card strong {
      color: var(--parts-hub-title);
      font-size: 13px;
      line-height: 1.25;
    }

    .parts-hub-card small {
      color: var(--parts-hub-muted);
      font-size: 11px;
      line-height: 1.35;
    }

    .line-manage-modal {
      width: min(820px, 96vw);
    }

    .line-manage-body {
      padding: 14px 18px 18px;
      display: grid;
      gap: 12px;
    }

    .line-manage-global {
      display: grid;
      grid-template-columns: minmax(180px, 260px) 1fr;
      gap: 12px;
      align-items: end;
      padding: 12px;
      border: 1px solid rgba(148, 163, 184, 0.16);
      border-radius: 8px;
      background: rgba(15, 23, 42, 0.52);
    }

    .line-manage-global label {
      display: grid;
      gap: 6px;
      color: rgba(226, 232, 240, 0.78);
      font-size: 11px;
      font-weight: 700;
    }

    .line-manage-global input,
    .line-manage-table input {
      width: 100%;
      height: 34px;
      box-sizing: border-box;
      border: 1px solid rgba(148, 163, 184, 0.22);
      border-radius: 6px;
      background: rgba(2, 6, 23, 0.78);
      color: #e5edf8;
      padding: 0 10px;
      font-size: 12px;
      outline: none;
    }

    .line-manage-global input:focus,
    .line-manage-table input:focus {
      border-color: rgba(96, 165, 250, 0.72);
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
    }

    .line-manage-note {
      color: rgba(203, 213, 225, 0.68);
      font-size: 11px;
      line-height: 1.5;
    }

    .line-manage-table-wrap {
      overflow: auto;
      border: 1px solid rgba(148, 163, 184, 0.16);
      border-radius: 8px;
      background: rgba(2, 6, 23, 0.35);
    }

    .line-manage-table {
      width: 100%;
      min-width: 640px;
      border-collapse: collapse;
      font-size: 12px;
    }

    .line-manage-table th,
    .line-manage-table td {
      padding: 9px 10px;
      border-bottom: 1px solid rgba(148, 163, 184, 0.12);
      text-align: left;
      vertical-align: middle;
    }

    .line-manage-table th {
      color: rgba(226, 232, 240, 0.72);
      background: rgba(15, 23, 42, 0.78);
      font-size: 11px;
      font-weight: 800;
      position: sticky;
      top: 0;
      z-index: 1;
    }

    .line-manage-base {
      width: 52px;
      color: #fbbf24;
      font-weight: 900;
    }

    .line-manage-preview {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .line-manage-preview strong {
      color: #bfdbfe;
      font-size: 12px;
    }

    .line-manage-preview span {
      border: 1px solid rgba(96, 165, 250, 0.28);
      border-radius: 6px;
      padding: 4px 8px;
      color: #e0f2fe;
      background: rgba(30, 64, 175, 0.22);
      font-weight: 800;
      line-height: 1;
    }

    .line-manage-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
    }

    .line-manage-actions button {
      min-width: 92px;
      height: 36px;
      border: 1px solid rgba(148, 163, 184, 0.22);
      border-radius: 7px;
      background: rgba(15, 23, 42, 0.9);
      color: #e5edf8;
      font-weight: 800;
      cursor: pointer;
    }

    .line-manage-actions .line-manage-apply {
      border-color: rgba(59, 130, 246, 0.55);
      background: #2563eb;
      color: #fff;
    }

    .line-manage-actions .line-manage-reset {
      margin-right: auto;
      border-color: rgba(248, 113, 113, 0.38);
      color: #fecaca;
    }

    .elbow-design-modal {
      width: min(520px, 94vw);
    }

    .elbow-design-body {
      padding: 16px 18px 18px;
    }

    .elbow-design-state {
      display: grid;
      grid-template-columns: 42px 1fr;
      gap: 8px 12px;
      align-items: center;
      padding: 14px;
      border: 1px solid rgba(148, 163, 184, 0.18);
      border-radius: 10px;
      background: rgba(15, 23, 42, 0.72);
    }

    .elbow-design-state .material-icons-round {
      grid-row: 1 / span 2;
      width: 42px;
      height: 42px;
      border-radius: 10px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: rgba(245, 158, 11, 0.18);
      color: #fbbf24;
      font-size: 24px;
    }

    .elbow-design-state strong {
      font-size: 14px;
      line-height: 1.3;
    }

    .elbow-design-state p {
      margin: 0;
      color: rgba(226, 232, 240, 0.72);
      font-size: 12px;
      line-height: 1.48;
    }

    .elbow-design-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 14px;
    }

    .elbow-design-actions button {
      min-height: 34px;
      padding: 0 12px;
      border: 1px solid rgba(96, 165, 250, 0.38);
      border-radius: 7px;
      background: rgba(15, 95, 184, 0.92);
      color: #fff;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
    }

    .elbow-design-actions button:last-child {
      background: rgba(15, 23, 42, 0.86);
      border-color: rgba(148, 163, 184, 0.28);
    }

    @media (max-width: 560px) {
      .parts-hub-grid {
        grid-template-columns: 1fr;
      }
      .line-manage-global {
        grid-template-columns: 1fr;
      }
    }

    #canvas3d {
      position: absolute;
      top: 36px;
      left: var(--panel-width);
      right: 0;
      bottom: 0;
      background: #000;
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    /* 세로 핸들바 — 패널 ↔ 캔버스 폭 조절 (데스크톱/태블릿) */
    #panel-resize-handle-v {
      display: none;
      position: fixed;
      top: 36px;
      left: var(--panel-width);
      bottom: 0;
      width: 14px;
      margin-left: -7px;
      z-index: 1001;
      align-items: center;
      justify-content: center;
      cursor: ew-resize;
      touch-action: none;
      background: transparent;
    }
    #panel-resize-handle-v .handle-grip {
      width: 5px;
      height: 48px;
      border-radius: 3px;
      background: #888;
      box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.3);
      pointer-events: none;
    }

    /* 모바일에서 입력창이 아래, 그래픽이 위로 오도록 레이아웃 변경 */
    @media (max-width: 600px) {
      #canvas3d {
        position: absolute;
        top: 36px;
        left: 0;
        right: 0;
        height: 50%;
        bottom: auto;
      }

      .panel {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: 50%;
        z-index: 1000;
        overflow-y: auto !important;
        background: white;
        padding: 10px;
        box-sizing: border-box;
        display: none;
      }

      .panel.active {
        display: block;
      }

      #panel-resize-handle {
        display: flex;
        position: fixed;
        left: 0; right: 0;
        top: 50%;
        height: 32px;
        margin-top: -16px;
        z-index: 1001;
        align-items: center;
        justify-content: center;
        cursor: ns-resize;
        touch-action: none;
        background: transparent;
      }
      .handle-grip {
        width: 48px;
        height: 5px;
        border-radius: 3px;
        background: #888;
        box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.3);
        pointer-events: none;
      }

      #panel-fitting #modeBtn,
      #panel-pipe #modeBtn {
        position: fixed;
        left: 50%;
        bottom: 16px;
        transform: translateX(-50%);
        z-index: 1001;
        width: 90vw;
        max-width: 400px;
        font-size: 1.2rem;
        display: block !important;
      }

    }

    /* [Performance] Improve scroll performance for long lists */
    #pipeInputRows,
    #pipeInputRows2,
    #pipeInputRows3,
    #pipeInputRows4,
    #pipeInputRows5 {
      content-visibility: auto;
      contain-intrinsic-size: 50px;
      /* 부모는 가로 스크롤 금지 — 행이 넘치면 .pipe-row 자체 overflow:auto 가 처리.
         overscroll-behavior-x:contain → 자식 스크롤 끝에서 부모로 swipe leak 차단. */
      overflow-x: hidden;
      overscroll-behavior-x: contain;
    }

    .pipe-row {
      display: flex;
      align-items: center;
      flex-wrap: nowrap;
      /* 줄바꿈 금지 (기본). EA 활성 시만 .has-extra-angle 가 wrap 허용 */
      margin-bottom: 6px;
      overflow-x: auto;
      /* 한 줄이 넘치면 가로 스크롤 — 행 단위로 가둠 */
      overscroll-behavior-x: contain;
      /* 행 스크롤이 부모/페이지로 leak 안 되게 */
    }

    .pipe-row>*,
    .pipe-row-inner>* {
      flex-shrink: 0;
      min-width: 0;
      max-width: none;
    }

    /* TEE 분기 아코디언 */
    .tee-branch-accordion {
      --tee-depth-color: #00d2ff;
      --tee-depth-rgb: 0, 210, 255;
      margin: 4px 0 4px 8px;
      border-left: 3px solid var(--tee-depth-color, rgba(0, 210, 255, 0.6));
      border-radius: 0 6px 6px 0;
      overflow: hidden;
    }
    .tee-branch-header {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 8px;
      background: rgba(var(--tee-depth-rgb), 0.15);
      cursor: pointer;
      font-size: 0.85em;
      color: var(--tee-depth-color);
      user-select: none;
    }
    .tee-branch-header .toggle-arrow {
      transition: transform 0.2s;
    }
    .tee-branch-header.collapsed .toggle-arrow {
      transform: rotate(-90deg);
    }
    .tee-branch-body {
      padding: 0 4px;
      background: rgba(var(--tee-depth-rgb), 0.06);
    }
    .tee-branch-body.collapsed {
      display: none;
    }
    .tee-branch-body .pipe-row {
      margin-left: 0 !important;
      border-left: none !important;
      background-color: transparent !important;
    }
    .tee-branch-add-btn {
      display: block;
      width: 100%;
      padding: 4px;
      margin: 2px 0;
      background: rgba(var(--tee-depth-rgb), 0.1);
      border: 1px dashed rgba(var(--tee-depth-rgb), 0.4);
      border-radius: 4px;
      color: var(--tee-depth-color);
      cursor: pointer;
      font-size: 0.8em;
    }
    .tee-branch-add-btn:hover {
      background: rgba(var(--tee-depth-rgb), 0.25);
    }
    .tee-branch-header-add-btn {
      margin-left: auto;
      background: rgba(var(--tee-depth-rgb), 0.2);
      border: 1px solid rgba(var(--tee-depth-rgb), 0.5);
      border-radius: 3px;
      color: var(--tee-depth-color);
      cursor: pointer;
      font-size: 0.85em;
      width: 22px;
      height: 22px;
      line-height: 1;
      padding: 0;
      font-weight: bold;
    }
    .tee-branch-header-add-btn:hover {
      background: rgba(var(--tee-depth-rgb), 0.4);
    }

    /* 뽕따기 분기 아코디언 — 색상은 인라인으로 세그먼트 컬러 적용 */
    .bulge-branch-accordion {
      margin: 4px 0 4px 16px;
      border-left: 3px solid #ff6666;
      border-radius: 0 6px 6px 0;
      overflow: hidden;
    }
    .bulge-branch-header {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 8px;
      background: rgba(255, 102, 102, 0.18);
      cursor: pointer;
      font-size: 0.85em;
      color: #fbb;
      user-select: none;
    }
    .bulge-branch-header .toggle-arrow {
      transition: transform 0.2s;
    }
    .bulge-branch-header.collapsed .toggle-arrow {
      transform: rotate(-90deg);
    }
    .bulge-branch-body {
      padding: 0 4px;
      background: rgba(255, 102, 102, 0.06);
    }
    .bulge-branch-body.collapsed {
      display: none;
    }
    .bulge-branch-body .pipe-row {
      margin-left: 0 !important;
      border-left: none !important;
      background-color: transparent !important;
    }
    .bulge-branch-add-btn {
      display: block;
      width: 100%;
      padding: 4px;
      margin: 2px 0;
      background: rgba(255, 102, 102, 0.12);
      border: 1px dashed rgba(255, 102, 102, 0.5);
      border-radius: 4px;
      color: #fbb;
      cursor: pointer;
      font-size: 0.8em;
    }
    .bulge-branch-add-btn:hover {
      background: rgba(255, 102, 102, 0.28);
    }
    .bulge-branch-header-add-btn {
      margin-left: auto;
      background: rgba(255, 102, 102, 0.2);
      border: 1px solid rgba(255, 102, 102, 0.5);
      border-radius: 3px;
      color: #fbb;
      cursor: pointer;
      font-size: 0.85em;
      width: 22px;
      height: 22px;
      line-height: 1;
      padding: 0;
      font-weight: bold;
    }
    .bulge-branch-header-add-btn:hover {
      background: rgba(255, 102, 102, 0.4);
    }

    .modeBtn {
      display: inline-flex !important;
      width: auto !important;
      min-width: 0 !important;
      max-width: none !important;
      white-space: nowrap !important;
      align-items: center;
      margin-left: 8px;
    }

    .dirSelectWrap {
      display: inline-flex !important;
      width: auto !important;
      min-width: 0 !important;
      max-width: none !important;
      align-items: center;
    }

    /* Control Group Logic for Responsive Layout */
    .control-group {
      display: inline-block;
      margin-right: 8px;
    }

    @media (max-width: 600px) {
      .control-group {
        display: block;
        /* 모바일에서는 줄바꿈 */
        margin-bottom: 8px;
        margin-right: 0;
      }
    }

    /* 캔버스 위 버튼/라벨: 모바일 터치 하이라이트 제거 + hover/active */
    #canvas-top-btns button,
    #canvas3d > label {
      -webkit-tap-highlight-color: transparent;
    }
    #canvas-top-btns button:hover,
    #canvas3d > label:hover {
      background: rgba(255, 255, 255, 0.95) !important;
    }
    #canvas-top-btns button:active,
    #canvas3d > label:active {
      background: rgba(200, 200, 200, 0.9) !important;
    }

    #assemblyAccessoryVisibilityBtn.is-active {
      outline: 1px solid rgba(0, 210, 190, 0.85);
      outline-offset: 1px;
    }

    @media (max-width: 600px) {
      #assemblyAccessoryVisibilityBtn {
        min-width: 44px;
        min-height: 36px;
        padding: 4px 6px !important;
        justify-content: center;
      }
      #assemblyAccessoryVisibilityBtn .assembly-accessory-visibility-label {
        font-size: 0.65rem;
      }
    }

    @media (max-width: 420px) {
      #assemblyAccessoryVisibilityBtn .assembly-accessory-visibility-label {
        display: none;
      }
    }

    /* 라이트 모드: 캔버스 위 버튼/라벨 가시성 보장 */
    #canvas3d.light-bg #canvas-top-btns button,
    #canvas3d.light-bg > label {
      background: rgba(0, 0, 0, 0.75) !important;
      color: #fff !important;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
    }
    #canvas3d.light-bg > label span {
      color: #fff !important;
    }
    #canvas3d.light-bg #canvas-top-btns button:hover,
    #canvas3d.light-bg > label:hover {
      background: rgba(0, 0, 0, 0.9) !important;
    }
    #canvas3d.light-bg #canvas-top-btns button:active,
    #canvas3d.light-bg > label:active {
      background: rgba(0, 0, 0, 0.95) !important;
    }
    #canvas3d.light-bg #modeLabel {
      color: #444 !important;
      background: rgba(0, 0, 0, 0.1) !important;
    }

    .isoDirBtn {
      width: 38px !important;
      height: 28px !important;
      border: 1px solid rgba(255,255,255,0.12) !important;
      border-radius: 6px !important;
      background: rgba(255,255,255,0.06) !important;
      color: rgba(255,255,255,0.5) !important;
      cursor: pointer !important;
      font-size: 0.72rem !important;
      font-weight: 600 !important;
      padding: 0 !important;
      margin: 0 !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      line-height: 1 !important;
      transition: all 0.2s ease !important;
    }
    .isoDirBtn:hover {
      background: rgba(255,255,255,0.15) !important;
      color: rgba(255,255,255,0.85) !important;
    }
    .isoDirBtn.active {
      background: rgba(66,133,244,0.85) !important;
      color: #fff !important;
      border-color: rgba(66,133,244,0.6) !important;
      box-shadow: 0 2px 10px rgba(66,133,244,0.35) !important;
    }


/* [ISO 축소 시 stroke 사라짐 fix 2026-06-05] vector-effect non-scaling-stroke */
/* 사용자 보고: 화면 축소 시 stroke=0.8 SVG 단위 × isoScale=0.1 = 0.08 px 사라짐. */
/* vector-effect: 축소 무관 stroke 두께 유지. 모든 SVG 그리기 element 적용. */
#isoSvg line,
#isoSvg path,
#isoSvg polyline,
#isoSvg polygon,
#isoSvg circle,
#isoSvg ellipse,
#isoSvg rect {
  vector-effect: non-scaling-stroke;
}
