/*
  노드 기반 화이트보드 캔버스 스타일
  구조:
    .canvas-stage  : 뷰포트(고정). pan/zoom 이벤트 수신, 점 그리드 배경
    .canvas-world  : transform(translate+scale) 적용되는 무한 평면
    .wb-edges      : SVG 연결선 레이어
    .wb-node       : 절대 위치 노드
*/

.canvas-stage {
  position: fixed;
  inset: 0 0 0 var(--sidebar-w);
  overflow: hidden;
  background-color: var(--canvas-bg);
  background-image: radial-gradient(circle, #c8c8c8 1px, transparent 1px);
  background-size: 24px 24px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  /* iOS Safari: 롱프레스 시스템 콜아웃(텍스트/이미지 선택 메뉴) 차단 */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

.canvas-stage.is-panning {
  cursor: grabbing;
}

.canvas-stage.mode-select {
  cursor: default;
}

.canvas-world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  width: 0;
  height: 0;
}

/* ===== 돋보기(루페) ===== */
/* 활성 중에는 OS 커서를 숨겨 원형 돋보기가 커서를 대신하도록 함 */
.canvas-stage.is-magnifying {
  cursor: none;
}

/* 좌우만 둥근 직사각형(필) 형태, 보더 없음 */
.canvas-loupe {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  border-radius: 999px;
  overflow: hidden;
  pointer-events: none;
  background-color: var(--canvas-bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* 리퀴드 글래스 림: 상단 하이라이트 + 안쪽 밝은 림 + 하단 볼록 그림자 */
.canvas-loupe::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(130% 90% at 28% 18%, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 42%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.55),
    inset 0 0 16px 6px rgba(255, 255, 255, 0.3),
    inset 0 10px 24px rgba(255, 255, 255, 0.22),
    inset 0 -12px 26px rgba(0, 0, 0, 0.2);
}

.canvas-loupe-world {
  will-change: transform;
}

/* 루페 밖(아래) 안내 문구 — JS가 left/top으로 위치 지정 */
.canvas-loupe-label {
  position: fixed;
  top: 0;
  left: 0;
  transform: translateX(-50%);
  z-index: 200;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  pointer-events: none;
}

/* ===== 연결선(SVG) ===== */
.wb-edges {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

.wb-edge-path {
  fill: none;
  stroke: #1a1a1a;
  stroke-width: 2;
  pointer-events: stroke;
  cursor: pointer;
}

.wb-edge-path:hover {
  stroke: var(--accent);
  stroke-width: 3;
}

.wb-edge-path.selected {
  stroke: var(--link);
  stroke-width: 3;
}

.wb-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
  cursor: pointer;
}

/* 연결 중 미리보기 선 */
.wb-edge-preview {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

/* ===== 노드 ===== */
.wb-node {
  position: absolute;
  background-color: #fff;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: grab;
}

.wb-node.dragging {
  cursor: grabbing;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.wb-node.selected {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.wb-node.type-planning {
  border-color: var(--accent);
}

.wb-node.type-sticker {
  background-color: #c8ff00;
  border: none;
  border-radius: 16px;
}

.wb-node-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.wb-node-titlewrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.wb-node-emoji {
  font-size: 1.35rem;
  line-height: 1.2;
}

.wb-node-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #000;
  word-break: break-word;
}

.wb-node-type {
  font-size: 0.6875rem;
  color: var(--muted);
}

.wb-node-actions {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.wb-node:hover .wb-node-actions {
  opacity: 1;
}

.wb-node-action {
  border: none;
  background: transparent;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}

.wb-node-action:hover {
  background-color: #f1f1f1;
}

.wb-node-action.danger:hover {
  background-color: #fde8e8;
  color: var(--danger);
}

.wb-node-content {
  font-size: 0.75rem;
  color: #000;
  font-weight: 500;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.wb-node-content p {
  margin: 0;
}

.wb-node-content p + p {
  margin-top: 0.3em;
}

/* 노드 내 링크 프리뷰 카드 */
.wb-node-link {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background-color: #fff;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.wb-node-link:hover {
  border-color: var(--primary);
  text-decoration: none;
}

/* 상단 썸네일 */
.wb-node-link-thumb {
  display: block;
  width: 100%;
  max-height: 120px;
  overflow: hidden;
  background-color: #f3f4f6;
}

.wb-node-link-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 120px;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}

.wb-node-link-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
}

.wb-node-link-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #000;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 링크 부가설명 (요약) */
.wb-node-link-desc {
  font-size: 0.6875rem;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wb-node-link-site {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6875rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wb-node-photo {
  padding: 0;
  border: none;
  overflow: hidden;
}

.wb-node-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.wb-node-photo .wb-node-actions {
  position: absolute;
  top: 6px;
  bottom: auto;
  right: 6px;
}

/* 이미지 좌측 상단 제목 오버레이 (가독성 위해 어두운 레이어) */
.wb-photo-title {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  max-width: calc(100% - 16px);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.wb-node-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 160px;
  background-color: #f3f4f6;
  color: #9ca3af;
  font-size: 0.8125rem;
}

/* ===== 인덱스 탭 ===== */
/* 노드 우측 상단에 가로로 길게 붙는 인덱스 탭 (색상은 인라인 style로 주입) */
.wb-node-index {
  position: absolute;
  top: 14px;
  left: calc(100% - 18px);
  z-index: 4;
  height: 28px;
  min-width: 116px;
  max-width: 220px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  border: none;
  border-radius: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.wb-node-index-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #000;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 사진 노드는 overflow:hidden이라 탭이 잘리므로, 인덱스가 있을 때만 노출 허용 */
.wb-node-photo.has-index {
  overflow: visible;
}

/* 인덱스 에디터가 열린 노드는 다른 노드 위로 올려 팔레트가 가리지 않도록 함
   (각 노드가 z-index로 독자 stacking context를 만들어 에디터 z-index만으론 부족) */
.wb-node.index-editing {
  z-index: 9999 !important;
}

/* 인덱스 클릭 시 노드 위로 떠오르는 인라인 에디터 */
.wb-node-index-editor {
  position: absolute;
  top: -8px;
  right: 0;
  transform: translateY(-100%);
  z-index: 110;
  width: max-content;
  max-width: 260px;
  padding: 8px;
  background: #fff;
  border: none;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  cursor: default;
}

.wb-node-index-editor[hidden] {
  display: none;
}

.wb-index-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.wb-index-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

.wb-index-swatch.is-active {
  border-color: #000;
}

.wb-index-edit-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wb-index-input {
  flex: 1;
  min-width: 0;
  width: 150px;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  background: #f1f1f1;
  font-size: 13px;
  font-family: inherit;
}

.wb-index-input:focus {
  outline: none;
}

.wb-index-save {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

.wb-index-save:hover {
  background: var(--primary-hover);
}

/* ===== 파일(폴더) 노드 ===== */
/* 폴더에 담겨 캔버스에서 숨겨진 멤버 */
.wb-node-hidden {
  display: none !important;
}

/* 파일 노드는 카드가 아니라 폴더 그래픽 컨테이너 */
.wb-node.type-file {
  width: auto !important;
  height: auto !important;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* 노드를 폴더 위로 끌어 편입 대상이 된 상태 */
.wb-node.type-file.drop-target {
  outline: 2px dashed var(--link);
  outline-offset: 6px;
  border-radius: 10px;
}

.wb-folder {
  position: relative;
  width: 104px;
  height: 80px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

/* 뒷면 + 탭 (진한 파랑) */
.wb-folder-back {
  position: absolute;
  inset: 16px 0 0 0;
  background: #2f6fed;
  border-radius: 9px;
}

.wb-folder-back::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 0;
  width: 48px;
  height: 16px;
  background: #2f6fed;
  border-radius: 9px 9px 0 0;
}

/* 앞면 (밝은 파랑) */
.wb-folder-front {
  position: absolute;
  inset: 28px 0 0 0;
  background: #5b8def;
  border-radius: 9px;
  box-shadow: 0 3px 7px rgba(20, 50, 120, 0.22);
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.wb-folder:hover .wb-folder-front {
  background: #6f9cf6;
}

.wb-folder:active .wb-folder-front {
  transform: translateY(1px);
}

.wb-folder-count {
  position: absolute;
  top: 12px;
  right: -6px;
  z-index: 2;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.wb-folder-label {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 130px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
}

.wb-folder-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ===== 포트(연결점) ===== */
.wb-port {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  background-color: #fff;
  border: 2px solid #000;
  border-radius: 50%;
  transform: translateY(-50%);
  z-index: 5;
  cursor: crosshair;
}

.wb-port:hover {
  background-color: var(--accent);
  border-color: var(--accent);
}

.wb-port.in {
  left: -8px;
}

.wb-port.out {
  right: -8px;
}

.type-planning .wb-port {
  border-color: var(--accent);
}

/* ===== 리사이즈 핸들 ===== */
.wb-resize {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background-color: #000;
  border: 2px solid #fff;
  border-radius: 2px;
  cursor: nwse-resize;
  z-index: 6;
  opacity: 0;
}

.wb-node.selected .wb-resize {
  opacity: 1;
}

/* ===== 툴바 ===== */
/* 최상단 중앙: 커서를 따라가는 눈 위젯 */
.wb-eyes {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  z-index: 60;
  pointer-events: none;
}

/* 보드 캔버스: 사이드바 폭만큼 보정해 캔버스 영역 중앙에 정렬 */
.wb-eyes-canvas {
  left: calc(50% + var(--sidebar-w) / 2);
  /* 눈 위젯 클릭으로 돋보기를 토글 (트랙패드 친화 트리거) */
  pointer-events: auto;
  cursor: pointer;
}

/* 인라인 배치(랜딩 nav 브랜드 자리 등): 고정 해제 + 흐름 안에 표시 */
.wb-eyes-inline {
  position: static;
  top: auto;
  left: auto;
  transform: none;
  width: 56px;
  z-index: auto;
}

.wb-eyes svg {
  display: block;
  width: 100%;
  height: auto;
}

/* 깜빡임: 눈 크기는 그대로 두고 눈꺼풀이 상단 → 하단으로 내려와 덮음 */
.wb-eyes .wb-lid {
  transform: translateY(-104px);
  transition: transform 130ms ease;
}

/* 입력 필드 포커스 중: 눈을 약 1/3 감아 집중하는 표정 */
.wb-eyes.is-focusing .wb-lid {
  transform: translateY(-69px);
}

/* 비밀번호 입력 중(is-hiding) · 클릭/홀드(is-blinking)는 완전히 감김 */
.wb-eyes.is-hiding .wb-lid,
.wb-eyes.is-blinking .wb-lid {
  transform: translateY(0);
}

/* 놀람: 로그아웃 버튼 호버 시 동공이 작아짐 */
.wb-eyes .wb-pupil {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 120ms ease;
}

.wb-eyes.is-startled .wb-pupil {
  transform: scale(0.45);
}

/* 돋보기 사용 중: 눈 위젯 위에 커서 루페와 동일한 글래스를 씌움 */
.wb-eyes-loupe {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92px;
  height: 46px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease;
  background: radial-gradient(130% 90% at 28% 18%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 45%);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.25),
    inset 0 0 0 2px rgba(255, 255, 255, 0.6),
    inset 0 0 10px 4px rgba(255, 255, 255, 0.35),
    inset 0 6px 14px rgba(255, 255, 255, 0.25),
    inset 0 -8px 16px rgba(0, 0, 0, 0.18);
}

.wb-eyes.is-loupe .wb-eyes-loupe {
  opacity: 1;
}

.wb-toolbar {
  position: fixed;
  bottom: 16px;
  left: calc(50% + var(--sidebar-w) / 2);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #fff;
  border-radius: 12px;
  padding: 6px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 50;
}

.wb-toolbar .wb-toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wb-toolbar .wb-divider {
  width: 1px;
  height: 24px;
  background-color: var(--border);
  margin: 0 4px;
}

.wb-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background-color: transparent;
  border-radius: 8px;
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--foreground);
  cursor: pointer;
  white-space: nowrap;
}

.wb-tool-btn:hover {
  background-color: #f1f1f1;
}

.wb-tool-btn.active {
  background-color: #1a1a1a;
  color: #fff;
}

/* ===== 노드 실물 목업 (뒤에 흰색 바, 목업은 동일 크기·간격, 하단 이름) =====
   클릭 = 중앙 추가 / 캔버스로 드래그 = 드롭 위치 추가 */
.wb-mock-tray {
  position: fixed;
  bottom: 16px;
  left: calc(50% + var(--sidebar-w) / 2);
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding: 0 20px;
  z-index: 50;
  pointer-events: none;
}

/* 뒤에 깔리는 흰색 바 (최초 툴바와 동일한 외형) */
.wb-mock-tray::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 23px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 0;
}

.wb-mock {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: none;
  background-color: transparent;
  padding: 0;
  font-family: inherit;
  cursor: grab;
  pointer-events: auto;
  transition: transform 0.14s ease;
}

.wb-mock:hover {
  transform: translateY(-4px);
}

.wb-mock:active {
  cursor: grabbing;
}

.wb-mock-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 44px;
  pointer-events: none;
}

.wb-mock-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1;
  pointer-events: none;
}

/* Note / Planning: 흰 카드 + 본문 라인 (디자인 시스템: 2px solid #000) */
.wb-mock-note {
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 11px;
  background-color: #fff;
  border: 2px solid #000;
  border-radius: 8px;
}

.wb-mock-note .wb-mock-line {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background-color: #d4d4d8;
}

.wb-mock-note .wb-mock-line.short {
  width: 58%;
}

.wb-mock-planning {
  border-color: var(--accent);
}

/* File: 폴더 색 아이콘 (아이콘 한 개라 박스를 채우도록 더 크게) */
.wb-mock-file {
  color: #5b8def;
  font-size: 2.4rem;
}

/* Photo: 이미지 플레이스홀더 */
.wb-mock-photo {
  background-color: #f3f4f6;
  border: 2px solid #000;
  border-radius: 8px;
  color: #9ca3af;
  font-size: 1.2rem;
}

/* Sticker: 라임 스티커 (디자인 시스템: #c8ff00, radius 16px) */
.wb-mock-sticker {
  background-color: #c8ff00;
  border-radius: 16px;
}

/* 줌 컨트롤: 우측 하단(줌 표시 위)으로 분리 */
/* 전역 숨김 (마크업/JS는 유지, 표시만 비활성화) */
.wb-zoom-toolbar {
  left: auto;
  right: 16px;
  bottom: 60px;
  transform: none;
  display: none;
}

/* 상단 좌측: 보드 정보 */
.wb-topbar {
  position: fixed;
  top: 16px;
  left: calc(var(--sidebar-w) + 16px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  background-color: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 50;
}

.wb-topbar-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 보드명 아래 노드/파일 갯수 */
.wb-board-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.wb-board-meta-dot {
  opacity: 0.6;
}

.wb-topbar .wb-board-name {
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: text;
  padding: 2px 6px;
  border-radius: 6px;
}

.wb-topbar .wb-board-name:hover {
  background-color: var(--background);
}

.wb-topbar .wb-board-name-input {
  font-size: 0.9375rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--foreground);
  border: 2px solid #000;
  border-radius: 6px;
  padding: 1px 5px;
  outline: none;
  min-width: 120px;
}

/* 우측 하단: 줌 표시 */
/* 전역 숨김 (JS의 zoomLabel 갱신 로직은 유지, 표시만 비활성화) */
.wb-zoom-indicator {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background-color: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.8125rem;
  color: var(--muted);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 50;
  display: none;
}

/* ===== 모바일 카메라식 드래그 줌 바 (데스크톱 숨김) ===== */
.wb-zoom-bar {
  display: none;
}

/* ===== 모바일: 캔버스 풀-블리드 + 오버레이 UI 재배치 ===== */
@media (max-width: 768px) {
  /* 트레이 아래(화면 맨 아래) 중앙: 좌우로 끌어 축소/확대 */
  .wb-zoom-bar {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(280px, 74vw);
    padding: 10px 14px;
    background-color: #fff;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
    touch-action: none;
    user-select: none;
  }

  .wb-zoom-bar-icon {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    color: var(--muted);
  }

  .wb-zoom-bar-track {
    position: relative;
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background-color: #e4e4e7;
  }

  /* 애플 OS 토글 핸들식: 흰색 + 좌우로 긴 알약 모양 */
  .wb-zoom-bar-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 34px;
    height: 20px;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  }

  /* 사이드바가 오프캔버스로 빠지므로 캔버스/툴바 정렬 보정값을 0으로 */
  :root {
    --sidebar-w: 0px;
  }

  /* 상단 보드 정보(타이틀/개수): 모바일에서는 숨김 (눈 위젯과 겹침 방지) */
  .wb-topbar {
    display: none;
  }

  /* 줌 컨트롤/표시: 하단 트레이와 겹치지 않도록 우측 상단으로 이동 */
  .wb-zoom-toolbar {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    right: 12px;
    bottom: auto;
  }

  .wb-zoom-indicator {
    top: calc(env(safe-area-inset-top, 0px) + 58px);
    right: 12px;
    bottom: auto;
  }

  /* 하단 노드 트레이: 컴팩트 + 줌 바 위로 올림 */
  .wb-mock-tray {
    gap: 10px;
    padding: 0 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 74px);
  }

  .wb-mock-preview {
    width: 48px;
    height: 38px;
  }

  /* 눈 위젯: 상단 UI와 겹치지 않도록 축소 */
  .wb-eyes-canvas {
    width: 64px;
  }

  /* 인덱스 라벨 입력도 16px(자동확대 방지) — canvas.css 후순위 로드라 여기서 덮어씀 */
  .wb-index-input {
    font-size: 16px;
  }
}

/* ===== 터치 기기: hover 의존 액션 상시 노출 + 터치 타겟 확대 ===== */
@media (pointer: coarse) {
  .wb-node-actions {
    opacity: 1;
  }

  .wb-port {
    width: 20px;
    height: 20px;
  }

  .wb-port.in {
    left: -12px;
  }

  .wb-port.out {
    right: -12px;
  }

  .wb-resize {
    width: 20px;
    height: 20px;
    right: -10px;
    bottom: -10px;
  }
}
