/* ==========================================================================
   editor.css — 학습지 편집기 (we- 접두사, 캔바/스마티심볼즈 문법)
   레이아웃: 상단 문서 바 + 컨텍스트 바 / 좌측 레일+탭패널 / 중앙 캔버스 / 우측 페이지 패널.
   화면: A4를 transform: scale(--we-scale)로 축소 미리보기.
   인쇄: @media print에서 편집 UI를 숨기고 transform만 해제, 전 페이지 출력.
   ========================================================================== */

/* 디자인 토큰 — 색·테두리·그림자·모서리를 한곳에서.
   테마: 라이트 크롬 + 한그루 브랜드(딥틸 #1F5F5B·웜 뉴트럴) — 도구는 조용히, 흰 종이가 주인공(2026-07-11).
   팝오버·갤러리·확인모달은 body 직속이라 :root에 정의한다(we- 접두사로 앱 전역과 충돌 없음).
   캔버스 위 기능색(선택 파랑·스냅선)은 가시성 우선으로 하드코딩 유지. */
:root {
  --we-accent: #1F5F5B;         /* 브랜드 액센트 = 마스터키 딥틸 (--nav-teal) */
  --we-accent-strong: #174A47;
  --we-accent-soft: #d5e5e2;
  --we-accent-tint: #ecf3f2;    /* 액센트 옅은 채움 (hover·선택 배경) */
  --we-search-icon: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2220%22 height=%2220%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%23433d33%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2211%22 cy=%2211%22 r=%227%22/%3E%3Cpath d=%22m20 20-3.5-3.5%22/%3E%3C/svg%3E");
  --we-text: #2b261e;           /* 웜 뉴트럴 텍스트 (홈 --text-primary 계열) */
  --we-text-2: #4c4539;
  --we-muted: #6b6355;
  --we-muted-soft: #8a8172;
  --we-app-bg: #e8e4dc;         /* 캔버스 배경 — 따뜻한 연회색, 흰 종이가 뜬다 */
  --we-panel-bg: #faf9f6;
  --we-surface: #ffffff;
  --we-surface-2: #f1eee8;
  --we-border: #e5e0d6;         /* 기본 테두리 (카드·미세 구분) */
  --we-border-strong: #c9c1b1;  /* 또렷한 테두리 (입력·컨트롤·버튼) */
  --we-divider: #d9d3c7;        /* 패널·바·팝오버 구분선 */
  --we-shadow-card: 0 1px 2px rgba(60, 50, 30, 0.09), 0 5px 14px rgba(60, 50, 30, 0.06);
  --we-shadow-lift: 0 2px 6px rgba(60, 50, 30, 0.13), 0 12px 26px rgba(60, 50, 30, 0.12);
  --we-shadow-bar: 0 1px 4px rgba(60, 50, 30, 0.08);
  --we-radius-card: 8px;
  --we-radius-ctl: 7px;
}

.we-app {
  display: grid;
  /* 데스크톱은 편집 영역을 세로로 온전히 쓰고 페이지 탐색을 우측 고정 패널로 둔다. */
  grid-template-rows: 56px 1fr;
  grid-template-columns: 80px 360px minmax(0, 1fr) 184px;
  grid-template-areas:
    'bar1 bar1 bar1 bar1'
    'rail panel viewport pages';
  position: relative; /* 플로팅 컨텍스트바(.we-bar2 absolute)의 기준 */
  height: 100vh;
  font-family: 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  color: var(--we-text);
  background: var(--we-app-bg);
}

/* ── 상단 문서 바 ── */
.we-bar1 {
  grid-area: bar1;
  position: relative; /* 용지 방향 세그먼트(.we-bar-center absolute)의 기준 */
  display: grid;
  grid-template-columns: 1fr auto; /* 좌(도구) · 우(이름·저장·인쇄) — 방향 세그먼트는 캔버스 축 절대배치 */
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--we-surface);
  color: var(--we-text);
  border-bottom: 1px solid var(--we-border);
  box-shadow: var(--we-shadow-bar);
  position: relative;
  z-index: 3;
}
.we-bar-left,
.we-main-actions,
.we-bar-right {
  display: flex;
  align-items: center;
  min-width: 0;
}
.we-bar-left { gap: 8px; }
.we-bar-left {
  grid-column: 1;
  overflow: visible;
}
.we-bar-left::-webkit-scrollbar { display: none; }
.we-bar-left > *,
.we-main-actions > *,
.we-bar-right > * { flex: none; }
.we-main-actions {
  grid-column: 2;
  justify-content: center;
  gap: 8px;
}
.we-bar-right {
  grid-column: 2;
  justify-content: flex-end;
  gap: 8px;
  overflow: visible;
}
/* 용지 방향 세그먼트 — 플로팅바(.we-bar2)와 같은 캔버스 중앙 축에 정렬(2026-07-16, 사용자).
   상단바 자체 중앙이 아니라 편집 뷰포트 중앙: 좌 도구 440px·우 페이지 184px 제외 축. */
.we-bar-center {
  position: absolute;
  top: 50%;
  left: calc((100% + 256px) / 2);
  transform: translate(-50%, -50%);
  z-index: 5;
}
.we-app.we-pages-collapsed .we-bar-center { left: calc((100% + 440px) / 2); }
/* 1280px 이하: 캔버스 축이 우측으로 치우쳐 이름 입력과 겹침(실측 1280 −79px, 1024 −207px)
   — 좌·우 그룹 사이 흐름 배치로 후퇴 (세로 축 정렬은 1281px+ 전용) */
@media (max-width: 1280px) {
  .we-bar1 { grid-template-columns: 1fr auto 1fr; }
  .we-bar-center { position: static; transform: none; grid-column: 2; display: flex; justify-content: center; min-width: 0; }
  .we-bar-right { grid-column: 3; }
}
.we-orient-seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--we-border-strong);
  border-radius: 999px;
  background: var(--we-surface);
}
.we-bar1 .we-orient-seg button.we-orient-btn {
  min-width: 64px;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--we-muted);
  box-shadow: none;
}
.we-bar1 .we-orient-seg button.we-orient-btn:hover { background: var(--we-accent-tint); }
.we-bar1 .we-orient-seg button.we-orient-btn.we-on {
  background: var(--we-accent-soft);
  color: var(--we-accent-strong);
  box-shadow: inset 0 0 0 1.5px var(--we-accent);
}
.we-bar1 .we-orient-seg button.we-orient-btn.we-disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.we-bar1 .we-orient-seg button.we-orient-btn.we-disabled:hover { background: transparent; }
.we-orient-seg.we-locked::after {
  content: '고정';
  margin: 0 5px 0 2px;
  color: var(--we-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.we-title {
  font-size: 16px;
  font-weight: 800;
  margin-right: 8px;
  white-space: nowrap;
}
/* 문서 이름 인라인 편집 — 항상 보이는 연한 필드 + 연필 아이콘으로 "고칠 수 있음"을 명확히 (2026-07-11) */
.we-doc-title {
  width: 208px;
  max-width: 30vw;
  /* 좁은 화면에서 우측 그룹이 1fr 열을 넘치면 중앙 방향 세그먼트를 덮는다 —
     이름 입력만 수축 허용(.we-bar-right > * { flex:none } 예외) */
  flex: 0 1 auto;
  min-width: 72px;
  margin-right: 0;
  padding: 7px 10px 7px 32px;
  font-size: 15px;
  font-weight: 700;
  color: var(--we-text);
  /* 흰 바탕 + 또렷한 테두리 — 연한 베이지 필드는 존재감이 없어 이름을 고칠 수 있는지 모름(2026-07-16) */
  background-color: var(--we-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256' fill='%234c4539'%3E%3Cpath d='M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  border: 1px solid var(--we-border-strong);
  border-radius: 8px;
  outline: none;
  text-overflow: ellipsis;
  transition: background-color 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.we-doc-title::placeholder { color: var(--we-muted); font-weight: 600; }
.we-doc-title:hover { border-color: var(--we-accent); }
.we-doc-title:focus {
  background-color: var(--we-surface);
  border-color: var(--we-accent);
  box-shadow: 0 0 0 3px var(--we-accent-tint);
}
/* 바 버튼 기본 = 고스트(보더 없음, hover에만 옅은 배경) — 위계는 채움 버튼(저장·인쇄) 1–2개만 */
.we-bar1 button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--we-text-2);
  cursor: pointer;
}
/* 아이콘 전용 바 버튼(실행취소·다시실행·스냅·격자·눈금자·단축키) — 캔바식 정사각, 라벨은 툴팁으로 */
.we-bar1 button.we-bar-ico { width: 38px; height: 38px; padding: 0; justify-content: center; gap: 0; }
.we-bar1 button .we-ico { width: 17px; height: 17px; opacity: 0.9; }
.we-bar1 button.we-bar-ico .we-ico { width: 19px; height: 19px; }
.we-bar1 button:hover {
  background: var(--we-surface-2);
  color: var(--we-text);
}
.we-bar1 button.we-orient-btn { min-width: 74px; justify-content: center; }
.we-bar1 button.we-on {
  background: var(--we-accent-soft);
  color: var(--we-accent-strong);
  box-shadow: inset 0 0 0 1.5px var(--we-accent);
}
/* 채움 버튼 — 홈·저장·인쇄 (문서 열고 닫는 핵심 행동). 딥틸 채움으로 또렷하게 */
.we-bar1 button[data-we-act='go-home'],
.we-bar1 button[data-we-act='save-doc'],
.we-bar1 button[data-we-act='print'] {
  background: var(--we-accent);
  color: #fff;
  font-weight: 700;
}
.we-bar1 button[data-we-act='go-home']:hover,
.we-bar1 button[data-we-act='save-doc']:hover,
.we-bar1 button[data-we-act='print']:hover {
  background: var(--we-accent-strong);
  color: #fff;
}
.we-main-sep {
  width: 1px;
  height: 28px;
  background: var(--we-border);
  margin: 0 2px;
  flex: none;
}
.we-bar1 select {
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--we-border-strong);
  border-radius: 8px;
  background: var(--we-surface);
  color: var(--we-text-2);
  font-weight: 650;
}
/* 줌 위젯 (무루식 − % + ↺, 2026-07-11) — 드롭다운 대체 */
.we-zoom {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
}
.we-zoom-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--we-text-2);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.we-zoom-btn:hover { background: var(--we-surface-2); color: var(--we-text); }
.we-zoom-pct {
  min-width: 44px;
  height: 30px;
  padding: 0 4px;
  border: none;
  border-radius: 7px;
  background: transparent;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--we-text-2);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.we-zoom-pct:hover { background: var(--we-surface-2); color: var(--we-text); }
.we-spacer { flex: 1; }
/* 수동 저장 버튼 상태 (저장 중… / 저장됨) — 옆 텍스트 상태 문구는 쓰지 않음 */
.we-bar1 button[data-we-act='save-doc'].we-save-busy {
  opacity: 0.88;
  cursor: wait;
}
.we-bar1 button[data-we-act='save-doc'].we-save-done {
  background: #1a7f37;
  border-color: #1a7f37;
}
.we-bar1 button[data-we-act='save-doc'].we-save-done:hover {
  background: #166c2e;
  border-color: #166c2e;
  color: #fff;
}
/* 하단 플로팅 토스트 — 실패·안내 (홈 ehome-toast와 동일 톤) */
.we-toast,
.ehome-toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 1200;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 17px;
  border-radius: 10px;
  background: #1F5F5B;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
  animation: we-toast-in 0.16s ease-out;
  pointer-events: none;
}
.we-toast.is-error,
.ehome-toast.is-error { background: #B42318; }
@keyframes we-toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.we-contact-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fee500;
  color: #111;
  text-decoration: none;
  box-sizing: border-box;
}
.we-contact-bubble {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 18px;
  border-radius: 50%;
  background: #111;
  color: #fee500;
  font-size: 7px;
  font-weight: 900;
  line-height: 1;
}
.we-contact-bubble::after {
  content: '';
  position: absolute;
  left: 5px;
  bottom: -4px;
  width: 8px;
  height: 6px;
  background: #111;
  clip-path: polygon(18% 0, 100% 0, 0 100%);
  transform: rotate(-7deg);
}
.we-contact-link:hover { background: #fee500; transform: translateY(-1px); }
.we-contact-link:focus-visible { outline: 2px solid var(--we-accent); outline-offset: 1px; }
.we-pages-reveal[hidden] { display: none !important; }
.we-sep {
  width: 1px;
  height: 22px;
  background: var(--we-border);
  margin: 0 4px;
}

/* 스냅·격자·눈금자 묶음 메뉴 (상단 바 왼쪽 — 보기/정렬 옵션)
   열릴 때 body로 포털(weUiToggleSnapMenu). bar1 z-index:3 스택 안에 있으면
   아래 그림 패널에 가려져 맨 아래 항목만 보이던 문제를 피한다.
   셀렉터는 body 포털 후에도 먹도록 .we-bar1 의존을 제거한다. */
.we-snap-wrap { position: relative; flex: none; }
.we-bar1 button.we-bar-ico.has-active::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--we-accent);
  box-shadow: 0 0 0 2px var(--we-surface);
}
.we-bar1 button.we-bar-ico { position: relative; }
.we-snap-menu {
  position: fixed;
  z-index: 600;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--we-border);
  border-radius: 12px;
  background: var(--we-surface);
  box-shadow: 0 10px 28px rgba(48, 45, 40, 0.16);
  font-family: 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  color: var(--we-text);
}
.we-snap-menu[hidden] { display: none !important; }
.we-snap-menu-hint {
  margin: 4px 8px 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--we-muted);
  line-height: 1.4;
}
.we-snap-menu button.we-snap-menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--we-text);
  box-shadow: none;
  font-size: 13.5px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}
.we-snap-menu button.we-snap-menu-item:hover {
  background: var(--we-surface-2);
  color: var(--we-text);
}
.we-snap-menu button.we-snap-menu-item.we-on {
  background: var(--we-accent-tint);
  color: var(--we-accent-strong);
  box-shadow: none;
}
.we-snap-menu button.we-snap-menu-item .we-ico {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: 0.9;
}
.we-snap-menu button.we-snap-menu-item.we-on .we-ico { opacity: 1; }
.we-snap-check {
  margin-left: auto;
  font-size: 14px;
  font-weight: 800;
  color: var(--we-accent);
  opacity: 0;
}
.we-snap-menu button.we-snap-menu-item.we-on .we-snap-check { opacity: 1; }

/* ── 컨텍스트 속성 바 (선택 요소 도구) ── */
.we-bar2 {
  /* 캔바식 플로팅 바 — 요소를 선택하면 캔버스 위에 알약으로 뜬다(빈 선택이면 숨김) */
  position: absolute;
  top: 86px; /* bar1 56 + 눈금자 22 + 여백 8 */
  /* 편집 뷰포트 중앙: 왼쪽 도구 440px과 오른쪽 페이지 패널 184px을 모두 제외한다. */
  left: calc((100% + 256px) / 2);
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  max-width: calc(100% - 440px - 16px);
  background: var(--we-surface);
  border: 1px solid var(--we-divider);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(60, 50, 30, 0.18), 0 1px 3px rgba(60, 50, 30, 0.10);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}
.we-bar2.we-ctx-empty { display: none; }
.we-bar2 button {
  padding: 7px 13px;
  font-size: 13.5px;
  font-weight: 650;
  min-height: 38px;
  border: 1px solid var(--we-border-strong);
  border-radius: 8px;
  background: var(--we-surface);
  color: var(--we-text);
  cursor: pointer;
  flex: none;
}
.we-bar2 button:hover { background: var(--we-accent-tint); border-color: var(--we-border-strong); }
.we-bar2 button.we-on {
  background: var(--we-accent);
  border-color: var(--we-accent);
  color: #fff;
  box-shadow: 0 1px 5px rgba(31, 95, 91, 0.22);
}
.we-bar2 button.we-danger { color: #c0392b; border-color: #e4b6b0; }
.we-bar2 input[type='number'] { width: 62px; height: 38px; padding: 5px 8px; font-size: 13.5px; font-weight: 600; border: 1px solid var(--we-border-strong); border-radius: 8px; box-sizing: border-box; color: var(--we-text); background: var(--we-surface); }
.we-bar2 input[type='number'].we-ctx-mm { width: 58px; }
/* 크기 콤보 (캔바식): [−][입력][+] 스테퍼 + 클릭 시 프리셋 드롭다운(we-popover 재활용) */
.we-ctx-size-wrap { display: inline-flex; align-items: center; height: 38px; border: 1px solid var(--we-border-strong); border-radius: 8px; background: var(--we-surface); flex: none; box-sizing: border-box; overflow: hidden; }
.we-ctx-size-wrap:focus-within { border-color: var(--we-accent); }
.we-bar2 button.we-ctx-size-step { width: 27px; height: 100%; min-height: 0; border: none; background: transparent; cursor: pointer; color: var(--we-text); font-size: 17px; line-height: 1; padding: 0; display: flex; align-items: center; justify-content: center; flex: none; border-radius: 0; }
.we-bar2 button.we-ctx-size-step:hover { background: var(--we-accent-tint); color: var(--we-accent); }
.we-bar2 input.we-ctx-size { width: 40px; height: 100%; border: none; border-left: 1px solid var(--we-border); border-right: 1px solid var(--we-border); background: transparent; padding: 5px 2px; font-size: 13.5px; font-weight: 650; text-align: center; box-sizing: border-box; outline: none; cursor: pointer; color: var(--we-text); }
.we-popover.we-size-pop { padding: 4px 0; min-width: 78px; max-height: 300px; overflow-y: auto; }
.we-size-opt { display: block; width: 100%; text-align: center; border: none; background: transparent; padding: 7px 16px; font-size: 14px; line-height: 1.3; cursor: pointer; color: #1c1c1c; min-height: 0; border-radius: 0; position: relative; }
.we-size-opt:hover { background: #eef4ff; }
.we-size-opt.we-on { background: var(--we-accent-soft); color: var(--we-accent-strong); font-weight: 850; }
.we-bar2 button.we-ctx-rmpic { display: inline-flex; align-items: center; gap: 5px; }
.we-ctx-rmpic .we-ico { width: 14px; height: 14px; }
/* 칸 모양 변경 — 플로팅 바 트리거 + 12종 선택 팝오버 */
.we-bar2 button.we-ctx-shape { display: inline-flex; align-items: center; justify-content: center; width: auto; padding: 0 4px; font-weight: 700; }
.we-ctx-shape-caret { color: var(--we-muted); font-size: 10px; margin-left: 3px; flex: none; }
.we-shape-icon {
  width: 24px; height: 24px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  color: currentColor; box-sizing: border-box;
}
.we-ctx-shape .we-shape-icon { width: 19px; height: 19px; }
.we-shape-icon-rect { border: 1.8px solid currentColor; border-radius: 2px; }
.we-shape-icon-ellipse { border: 1.8px solid currentColor; border-radius: 50%; }
.we-shape-icon svg { width: 100%; height: 100%; overflow: visible; }
.we-shape-icon path { fill: none; stroke: currentColor; stroke-width: 6; stroke-linejoin: round; }
.we-popover.we-shape-pop { width: 304px; max-width: calc(100vw - 16px); padding: 10px; }
.we-shape-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.we-popover button.we-shape-opt {
  min-width: 0; min-height: 64px; padding: 7px 4px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px; border: 1px solid transparent;
  border-radius: 8px; background: #fff; color: var(--we-text); font-size: 11.5px;
  font-weight: 700; line-height: 1.15; cursor: pointer;
}
.we-popover button.we-shape-opt:hover { background: var(--we-accent-tint); border-color: var(--we-border-strong); }
.we-popover button.we-shape-opt.we-on {
  background: var(--we-accent-soft); border-color: var(--we-accent); color: var(--we-accent-strong);
  box-shadow: inset 0 0 0 1px rgba(31, 95, 91, 0.15);
}
/* 폰트 선택 — 각 폰트 미리보기(weUiPopover 재활용) */
.we-bar2 button.we-ctx-font { display: inline-flex; align-items: center; gap: 8px; height: 38px; min-height: 0; padding: 5px 11px; font-size: 13.5px; }
.we-ctx-font-name { max-width: 116px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.we-ctx-font-caret { color: var(--we-muted); font-size: 10px; flex: none; }
.we-popover.we-font-pop { padding: 5px 0; min-width: 168px; max-height: 340px; overflow-y: auto; }
.we-font-opt { display: block; width: 100%; text-align: left; border: none; background: transparent; padding: 9px 18px; font-size: 15.5px; line-height: 1.25; cursor: pointer; color: #1c1c1c; min-height: 0; border-radius: 0; }
.we-font-opt:hover { background: var(--we-accent-tint); }
.we-font-opt.we-on { background: var(--we-accent); color: #fff; }
/* 테두리 팝오버 (캔바식): 없음+스타일 버튼 줄 + 굵기 슬라이더 */
.we-popover.we-line-pop { min-width: 226px; }
.we-line-pop input[type='color'] { width: 42px; height: 30px; padding: 2px; border: 1px solid var(--we-border-strong); border-radius: 6px; background: #fff; cursor: pointer; }
.we-popover button.we-line-color-none { min-height: 30px; padding: 4px 10px; border: 1px solid var(--we-border-strong); border-radius: 6px; background: #fff; color: var(--we-text); cursor: pointer; }
.we-popover button.we-line-color-none.we-on { background: var(--we-accent-soft); border-color: var(--we-accent); color: var(--we-accent-strong); }
.we-line-row { display: flex; gap: 6px; margin-bottom: 12px; }
.we-line-btn.we-line-none { font-size: 16px; color: #556; }
.we-line-btn.we-line-none.we-on { color: var(--we-accent); }
.we-line-slabel { margin-bottom: 7px; min-width: 0; }
.we-slider { display: flex; align-items: center; gap: 10px; }
.we-slider-range { flex: 1; accent-color: var(--we-accent); height: 20px; cursor: pointer; }
.we-slider-val { min-width: 26px; text-align: right; font-size: 13px; color: #33415a; flex: none; }
.we-bar2 button.we-ctx-border,
.we-bar2 button.we-ctx-text-style { width: auto; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.we-bar2 button.we-ctx-flip { width: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.we-border-preview { width: 19px; height: 16px; display: flex; flex-direction: column; justify-content: space-between; color: #1c1c1c; }
.we-border-preview i { width: 19px; border-top-color: currentColor; display: block; }
.we-border-preview i:nth-child(1) { border-top-width: 2px; }
.we-border-preview i:nth-child(2) { border-top-width: 3px; }
.we-border-preview i:nth-child(3) { border-top-width: 5px; }
.we-border-preview.we-border-none { position: relative; opacity: 0.55; }
.we-border-preview.we-border-none::after { content: ''; position: absolute; width: 23px; height: 2px; left: -2px; top: 7px; background: #d45353; transform: rotate(-35deg); border-radius: 2px; }
/* 이름표 글자 버튼 — 무지개 밑줄은 A 글리프에만 (캡션 '글자'까지 번지지 않게) */
.we-ctx-a { position: relative; font-size: 17px; font-weight: 850; line-height: 1; padding-bottom: 6px; flex: none; }
.we-ctx-a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: linear-gradient(90deg,#ef4444 0 16%,#f59e0b 16% 32%,#eab308 32% 48%,#22c55e 48% 64%,#2563eb 64% 80%,#7c3aed 80% 100%); }
.we-bar2 button.we-ctx-flip { width: auto; padding: 0 4px; font-size: 13.5px; line-height: 1; font-weight: 700; }
.we-popover.we-text-style-pop { min-width: 230px; }
.we-text-style-pop .we-pop-row { justify-content: space-between; }
.we-text-style-pop select { min-width: 150px; }
.we-text-style-pop input[type='number'] { width: 70px; }
.we-text-style-pop input[type='color'] { width: 42px; height: 30px; padding: 2px; border: 1px solid var(--we-border-strong); border-radius: 6px; background: #fff; cursor: pointer; }
.we-bar2 input[type='text'].we-ctx-text { width: 130px; height: 38px; padding: 5px 9px; font-size: 13.5px; font-weight: 600; border: 1px solid var(--we-border-strong); border-radius: 8px; box-sizing: border-box; color: var(--we-text); background: var(--we-surface); }
.we-bar2 select { height: 38px; padding: 5px 8px; font-size: 13.5px; font-weight: 600; border: 1px solid var(--we-border-strong); border-radius: 8px; background: var(--we-surface); color: var(--we-text); flex: none; }
.we-ctx-label { font-size: 12.5px; font-weight: 800; color: var(--we-muted); flex: none; }
.we-ctx-check { display: inline-flex; align-items: center; gap: 7px; flex: none; font-size: 13.5px; font-weight: 650; color: var(--we-text); cursor: pointer; }
.we-ctx-check input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--we-accent); }
/* 글자 표시 = 휴대폰식 토글 스위치 — 체크박스 문법으론 "켜고 끄는 기능"임이 전달 안 됨(2026-07-16).
   input[type=checkbox]는 유지하고 생김새만 스위치(접근성·스모크 계약 보존). */
.we-ctx-switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 20px;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: var(--we-border-strong);
  position: relative;
  transition: background 0.15s ease;
}
.we-ctx-switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  transition: left 0.15s ease;
}
.we-ctx-switch input:checked { background: var(--we-accent); }
.we-ctx-switch input:checked::after { left: calc(100% - 18px); } /* 트랙 폭이 좁아져도(1100px↓) 노브가 안 넘치게 */
/* 혼합 선택에서 일부만 켜짐 — 중간 위치 + 중간 색 */
.we-ctx-switch input:indeterminate { background: var(--we-accent-soft); }
.we-ctx-switch input:indeterminate::after { left: calc(50% - 8px); }
.we-ctx-msg { font-size: 13px; font-weight: 600; color: var(--we-muted); }
.we-ctx-spacer { flex: 1; }
.we-ctx-sep { width: 1px; height: 28px; background: var(--we-divider); flex: none; margin: 0 2px; }
/* 구역 칩: 기능 묶음(그림/텍스트)을 흰 도구 박스로 띄워 컨트롤 소속을 분명히 한다. */
/* 그룹은 상자 없이 구분선으로만 나눈다(2026-07-11, 사용자 — '박스 안 박스' 제거). */
.we-ctx-group { display: inline-flex; align-items: center; gap: 8px; flex: none; }
/* 구역 라벨: 배지 대신 작은 섹션 탭처럼 처리해 버튼·선택상태와 혼동을 줄인다. */
.we-ctx-group-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 850; color: #1e40af; background: transparent; border-radius: 0; padding: 0 2px 0 0; flex: none; letter-spacing: 0; }
.we-ctx-group-label::before { content: ''; width: 4px; height: 18px; border-radius: 999px; background: var(--we-accent); }

/* ── 캔바식 아이콘 버튼 ── */
/* 아이콘 SVG는 항상 명시 크기 (viewBox 256 Phosphor가 0px로 찌부러지는 버그 방지) */
.we-ico { width: 20px; height: 20px; flex: none; display: block; }
.we-ico-btn,
.we-bar2 button.we-ico-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; flex: none;
  border: 1px solid var(--we-border-strong); border-radius: 8px; background: var(--we-surface); color: var(--we-text); cursor: pointer;
}
.we-ico-btn:hover,
.we-bar2 button.we-ico-btn:hover { background: var(--we-accent-tint); border-color: var(--we-border-strong); }
.we-ico-btn.we-on,
.we-bar2 button.we-ico-btn.we-on { background: var(--we-accent); border-color: var(--we-accent); color: #fff; }
/* 선 스타일 견본 버튼 (실선/대시/도트) */
.we-line-btn .we-line-swatch { width: 18px; border-top: 2.5px solid currentColor; display: block; }

/* ── 상호작용 폴리시 (ui-ux-pro-max ux-guidelines: 150ms 전환 + active 눌림) ── */
.we-bar1 button, .we-bar2 button, .we-ico-btn, .we-ctx-pos-btn,
.we-rail button, .we-pos-btn, .we-menu-item, .we-ctx-check,
#weAddPageBtn, #weAddPageBtnBottom, .we-tpl-card, .we-elem-card, .we-text-preset {
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}
.we-bar2 button:active, .we-ico-btn:active, .we-ctx-pos-btn:active,
.we-pos-btn:active, #weAddPageBtn:active, #weAddPageBtnBottom:active,
.we-tpl-card:active, .we-elem-card:active, .we-text-preset:active { transform: scale(0.97); }
:focus-visible { outline: 2px solid var(--we-accent); outline-offset: 1px; }
.we-sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
/* [위치] 버튼 */
.we-bar2 button.we-ctx-pos-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none; min-height: 38px;
  width: auto; padding: 0 4px; font-size: 13.5px; font-weight: 700;
  border: 1px solid var(--we-border-strong); border-radius: 8px; background: var(--we-surface); color: var(--we-text); cursor: pointer;
}
.we-ctx-pos-btn .we-ico { width: 18px; height: 18px; }
.we-bar2 button.we-ctx-pos-btn:hover { background: var(--we-accent-tint); border-color: var(--we-border-strong); }
.we-bar2 button.we-ctx-pos-btn.we-on { background: var(--we-accent-soft); border-color: var(--we-accent); color: var(--we-accent-strong); box-shadow: inset 0 0 0 1px rgba(31, 95, 91, 0.16); }

/* 플로팅 바 가독성 보정 (2026-07-14, 사용자) — 평면 구조의 폭은 유지하고
   높이·아이콘·클릭 영역만 한 단계 키운다(.we-bar2 스코프라 상단바엔 무영향). */
.we-bar2 { padding: 6px; gap: 4px; overflow-x: visible; scrollbar-width: none; }
.we-bar2 button { min-height: 36px; padding: 5px 10px; }
.we-bar2 input[type='number'],
.we-bar2 select,
.we-bar2 .we-ctx-size-wrap,
.we-bar2 button.we-ctx-font,
.we-bar2 input[type='text'].we-ctx-text,
.we-bar2 button.we-ico-btn,
.we-bar2 button.we-ctx-pos-btn { height: 36px; min-height: 36px; box-sizing: border-box; }
.we-bar2 button.we-ico-btn { width: 34px; }
.we-bar2 .we-ctx-group { gap: 6px; }
.we-bar2 .we-swatch-btn { width: 32px; height: 32px; }
.we-bar2 button.we-ctx-font { padding: 5px 8px; gap: 6px; }
.we-bar2 .we-ctx-font-name { max-width: 88px; }
.we-bar2 .we-ctx-check { gap: 6px; font-size: 13.5px; }
.we-bar2 .we-ctx-check { min-height: 36px; }
.we-bar2 .we-ctx-check input { width: 18px; height: 18px; }
.we-bar2 .we-ctx-switch input { width: 34px; height: 20px; }
.we-bar2 .we-ctx-rmpic .we-ico { width: 16px; height: 16px; }
.we-bar2 .we-border-preview { width: 21px; height: 18px; }
.we-bar2 .we-border-preview i { width: 21px; }
.we-bar2 .we-ctx-a { font-size: 18px; }

/* 캔바식 평면 도구: 바깥 플로팅 바가 이미 그룹을 만들므로 개별 기능마다 상자를 반복하지 않는다. */
.we-bar2 button.we-ctx-shape,
.we-bar2 button.we-ctx-rmpic,
.we-bar2 button.we-ctx-border,
.we-bar2 button.we-ctx-text-style,
.we-bar2 button.we-ctx-flip,
.we-bar2 button.we-ctx-bold,
.we-bar2 button.we-align-trigger,
.we-bar2 button.we-ctx-pos-btn,
.we-bar2 button.we-swatch-text,
.we-bar2 button.we-swatch-circle {
  border-color: transparent; background: transparent; box-shadow: none;
}
.we-bar2 button.we-ctx-shape:hover,
.we-bar2 button.we-ctx-rmpic:hover,
.we-bar2 button.we-ctx-border:hover,
.we-bar2 button.we-ctx-text-style:hover,
.we-bar2 button.we-ctx-flip:hover,
.we-bar2 button.we-ctx-bold:hover,
.we-bar2 button.we-align-trigger:hover,
.we-bar2 button.we-ctx-pos-btn:hover,
.we-bar2 button.we-swatch-text:hover,
.we-bar2 button.we-swatch-circle:hover { border-color: transparent; background: var(--we-accent-tint); }
.we-bar2 button.we-ctx-flip.we-on,
.we-bar2 button.we-ctx-bold.we-on,
.we-bar2 button.we-align-trigger.we-on,
.we-bar2 button.we-ctx-pos-btn.we-on { color: var(--we-accent-strong); background: var(--we-accent-soft); border-color: transparent; box-shadow: none; }
.we-bar2 button.we-swatch-circle { width: 34px; height: 34px; padding: 4px; border-radius: 50%; }
.we-bar2 button.we-swatch-circle .we-swatch-fill { width: 24px; height: 24px; border-radius: 50%; }
.we-bar2 button.we-swatch-circle .we-swatch-fill.we-swatch-none {
  border-radius: 50%;
  border-color: #7f8996;
  background: conic-gradient(#aeb6c2 25%, #f7f8fa 0 50%, #aeb6c2 0 75%, #f7f8fa 0) 0 0 / 8px 8px;
}
.we-bar2 button.we-swatch-text .we-swatch-bar { background: linear-gradient(90deg,#ef4444 0 16%,#f59e0b 16% 32%,#eab308 32% 48%,#22c55e 48% 64%,#2563eb 64% 80%,#7c3aed 80% 100%) !important; }
/* 그림 꺼내기 — 앱 고유 액션은 테두리 칩으로 위계를 준다(2026-07-16). 가로/세로 세그먼트와 같은 알약 문법 */
.we-bar2 button.we-ctx-rmpic {
  border: 1px solid var(--we-accent);
  background: var(--we-accent-tint);
  color: var(--we-accent-strong);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 700;
}
.we-bar2 button.we-ctx-rmpic:hover { background: var(--we-accent-soft); border-color: var(--we-accent); }
/* 좁은 화면: 칩 아이콘·여백·스위치 폭을 줄여 플로팅바 1024px 무넘침 계약을 지킨다 */
@media (max-width: 1100px) {
  .we-bar2 .we-ctx-rmpic .we-ico { display: none; }
  .we-bar2 button.we-ctx-rmpic { padding: 5px 9px; }
  .we-bar2 .we-ctx-switch input { width: 30px; }
}
/* 아이콘 옆 이름 병기(채움·테두리·글자) — 자체 발명 아이콘은 글자로 가르친다(2026-07-16) */
.we-ctx-cap { font-size: 13px; font-weight: 650; color: var(--we-text); line-height: 1; flex: none; }
.we-bar2 button.we-ctx-capped { width: auto; display: inline-flex; align-items: center; gap: 4px; padding: 0 5px; border-radius: 8px; }
/* 혼합 선택: 그룹 캡션('칸'/'텍스트')이 대상을 말해주므로 아이콘 캡션은 숨기고
   간격·콤보 폭을 한 단계 줄여 1024px 폭을 지킨다 */
.we-bar2.we-ctx-mixed .we-ctx-cap { display: none; }
.we-bar2.we-ctx-mixed button.we-ctx-capped,
.we-bar2.we-ctx-mixed button.we-ctx-border { padding: 0 4px; }
.we-bar2.we-ctx-mixed .we-ctx-font-name { max-width: 56px; }
.we-bar2.we-ctx-mixed .we-ctx-group { gap: 3px; }
.we-bar2.we-ctx-mixed .we-ctx-sep { margin: 0; }
.we-bar2.we-ctx-mixed button.we-ctx-font { padding: 5px 6px; gap: 4px; }
.we-bar2.we-ctx-mixed button.we-ctx-size-step { width: 21px; }
.we-bar2.we-ctx-mixed input.we-ctx-size { width: 34px; }
.we-bar2.we-ctx-mixed .we-ctx-check { gap: 4px; }
.we-bar2.we-ctx-mixed .we-ctx-group-label { font-size: 12px; gap: 4px; }

#weAlignChordHud {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 900;
  max-width: calc(100vw - 32px); padding: 9px 14px; border-radius: 999px;
  background: #172238; color: #fff; box-shadow: 0 7px 24px rgba(20, 30, 50, 0.25);
  font-size: 12.5px; font-weight: 700; white-space: nowrap; pointer-events: none;
}

/* ── 팝오버 (이름표·선 세부) ── */
.we-popover {
  position: fixed; z-index: 600;
  background: #fff; border: 1px solid var(--we-divider); border-radius: 10px;
  box-shadow: 0 8px 26px rgba(20, 30, 50, 0.18); padding: 10px 12px; min-width: 150px;
  animation: wePopIn 0.13s ease-out;
  transform-origin: top left;
}
@keyframes wePopIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.we-pop-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.we-pop-row:last-child { margin-bottom: 0; }
.we-pop-label { font-size: 12px; color: #667; min-width: 30px; flex: none; }
.we-popover input[type='number'] { width: 58px; padding: 5px 7px; font-size: 13px; border: 1px solid var(--we-border-strong); border-radius: 6px; }
.we-popover select { padding: 5px 7px; font-size: 13px; border: 1px solid var(--we-border-strong); border-radius: 6px; background: #fff; }
/* 내 템플릿 저장 팝오버 — 이름 입력 + 저장 버튼 */
.we-pop-input { width: 210px; max-width: 60vw; padding: 7px 9px; font-size: 13.5px; border: 1px solid var(--we-border-strong); border-radius: 6px; }
.we-pop-input:focus { outline: none; border-color: var(--we-accent); box-shadow: 0 0 0 3px rgba(31,95,91,0.16); }
.we-pop-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.we-pop-btn { padding: 7px 16px; font-size: 13px; font-weight: 700; border: 1px solid var(--we-border-strong); border-radius: 6px; background: #fff; color: #334; cursor: pointer; }
.we-pop-btn-primary { background: var(--we-accent); border-color: var(--we-accent); color: #fff; }
.we-pop-btn-primary:hover { background: var(--we-accent-strong); }
.we-pop-btn:disabled { opacity: 0.55; cursor: default; }

/* 갤러리 멀티페이지 배지 (내 템플릿 관리 UI 본체는 시작 화면 editor-home이 담당) */
.we-gal-pagebadge {
  position: absolute; left: 10px; bottom: 42px; z-index: 2;
  padding: 2px 8px; border-radius: 999px; background: rgba(31, 95, 91, 0.92); color: #fff;
  font-size: 11px; font-weight: 700;
}

/* ── 색상 피커 팝오버 ── */
.we-popover.we-colorpicker { min-width: 0; padding: 10px; }
.we-cp-row { display: flex; gap: 6px; margin-bottom: 7px; align-items: center; }
.we-cp-swatch {
  width: 24px; height: 24px; flex: none; padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 6px; cursor: pointer;
  transition: transform 0.08s;
}
.we-cp-swatch:hover { transform: scale(1.12); }
.we-cp-swatch.we-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--we-accent); }
.we-cp-swatch.we-cp-white { border-color: var(--we-border-strong); }
.we-cp-none, .we-swatch-none {
  background:
    linear-gradient(45deg, transparent 45%, #e5484d 45%, #e5484d 55%, transparent 55%),
    #fff;
  background-size: 100% 100%;
}
.we-cp-none-label { font-size: 12px; color: #667; }
.we-cp-custom {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef1f5; font-size: 12px; color: #667; cursor: pointer;
}
.we-cp-custom input[type='color'] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--we-border-strong); border-radius: 6px; cursor: pointer; }

/* 색 스와치 버튼 (바에 표시) */
.we-swatch-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; flex: none;
  border: 1px solid var(--we-border-strong); border-radius: 8px; background: #fff; cursor: pointer;
}
.we-swatch-btn:hover { background: #f2f6fb; }
.we-swatch-fill { width: 22px; height: 22px; flex: none; border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.14); display: block; box-sizing: border-box; }
/* 글자 색: 캔바식 A + 색 밑줄 (면 색 사각형과 구분) */
.we-swatch-btn.we-swatch-text { flex-direction: column; gap: 2px; }
.we-swatch-a { font-size: 15px; font-weight: 800; line-height: 1; color: #1c1c1c; }
.we-swatch-bar { width: 20px; height: 4px; flex: none; border-radius: 1.5px; display: block; box-sizing: border-box; }
.we-swatch-bar.we-swatch-none { border: 1px solid rgba(0, 0, 0, 0.14); }

/* ── 우클릭 컨텍스트 메뉴 ── */
.we-popover.we-menu { padding: 5px; min-width: 190px; }
.we-menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 10px; border: none; border-radius: 7px;
  background: none; color: #222c3d; font-size: 13.5px; cursor: pointer; text-align: left;
}
.we-menu-item:hover { background: #f0f4fa; }
.we-menu-item .we-ico { width: 16px; height: 16px; flex: none; color: #5a6778; }
.we-menu-label { flex: 1; }
.we-menu-keys { font-size: 11.5px; color: #6b7688; flex: none; }
.we-menu-sep { height: 1px; background: var(--we-border); margin: 4px 8px; }

/* ── 편집기 확인 모달 ── */
.we-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 76px 18px 18px;
  box-sizing: border-box;
  background: rgba(20, 30, 50, 0.22);
  animation: weConfirmFade 0.14s ease-out;
}
.we-confirm-box {
  width: min(460px, 100%);
  background: var(--we-surface);
  border: 1px solid var(--we-border);
  border-radius: 12px;
  box-shadow: 0 16px 44px rgba(60, 50, 30, 0.22);
  padding: 24px 26px 20px;
  color: var(--we-text);
  animation: weConfirmIn 0.16s ease-out;
}
.we-confirm-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  text-align: center;
}
.we-confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 9px;
  background: var(--we-accent-tint);
  color: var(--we-accent);
}
.we-confirm-icon .we-ico { width: 21px; height: 21px; }
.we-confirm-head h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: 0;
  word-break: keep-all;
  color: var(--we-text);
}
.we-confirm-message {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--we-text-2);
  word-break: keep-all;
  white-space: pre-line;
  text-align: center;
}
.we-confirm-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--we-surface-2);
  border: 1px solid var(--we-border);
  color: var(--we-muted);
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-line;
  text-align: center;
}
.we-confirm-input {
  width: 100%;
  margin: 6px 0 2px;
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
  color: var(--we-text);
  background: var(--we-surface);
  border: 1px solid var(--we-border-strong);
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;
}
.we-confirm-input:focus { border-color: var(--we-accent); box-shadow: 0 0 0 3px var(--we-accent-tint); }
.we-confirm-dontask {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--we-muted);
  cursor: pointer;
  user-select: none;
  margin-right: auto; /* 버튼 행 왼쪽 끝 고정 (관례: 좌 체크박스·우 버튼) */
}
.we-confirm-dontask input { width: 15px; height: 15px; accent-color: var(--we-accent); cursor: pointer; margin: 0; }
.we-confirm-actions-split { justify-content: flex-end; }
.we-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.we-confirm-actions button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 9px;
  border: 1px solid var(--we-border-strong);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}
.we-confirm-actions button:active { transform: scale(0.98); }
.we-confirm-cancel { background: var(--we-surface); color: var(--we-text-2); }
.we-confirm-cancel:hover { background: var(--we-surface-2); border-color: var(--we-border-strong); }
.we-confirm-ok {
  background: var(--we-accent);
  border-color: var(--we-accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(31, 95, 91, 0.22);
}
.we-confirm-ok:hover { background: var(--we-accent-strong); border-color: var(--we-accent-strong); }
.we-confirm-ok.we-confirm-danger {
  background: #c4473a;
  border-color: #c4473a;
  box-shadow: 0 4px 12px rgba(196, 71, 58, 0.20);
}
.we-confirm-ok.we-confirm-danger:hover { background: #aa392f; border-color: #aa392f; }
@keyframes weConfirmFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes weConfirmIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 위치 사이드 패널 ── */
.we-pos-panel {
  position: absolute; top: 8px; left: 8px; z-index: 40; width: 256px;
  max-height: calc(100% - 16px); overflow-y: auto;
  background: #fff; border: 1px solid var(--we-divider); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(20, 30, 50, 0.16); padding: 14px 16px;
}
.we-pos-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.we-pos-head span { font-size: 15px; font-weight: 600; color: #223; }
.we-pos-close { border: none; background: none; font-size: 16px; color: #889; cursor: pointer; padding: 2px 4px; }
.we-pos-sec { margin-bottom: 14px; }
.we-pos-sec:last-child { margin-bottom: 0; }
.we-pos-sectitle { font-size: 12.5px; color: #6b7688; margin-bottom: 7px; }
.we-pos-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.we-pos-btn {
  display: flex; align-items: center; gap: 7px; padding: 9px 10px;
  border: 1px solid var(--we-divider); border-radius: 8px; background: #fff; color: #33415a; cursor: pointer; font-size: 13px;
}
.we-pos-btn:hover { background: #f2f6fb; }
.we-pos-btn .we-ico { width: 17px; height: 17px; flex: none; }
.we-pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.we-pos-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #6b7688; }
.we-pos-field input { width: 100%; padding: 8px 9px; font-size: 13.5px; border: 1px solid var(--we-border-strong); border-radius: 7px; box-sizing: border-box; }

/* 그림 패널 카테고리 select */
#weCatSel {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--we-border-strong);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 8px;
  box-sizing: border-box;
}

/* 화살표선 미니 */
.we-mini-arrowline {
  position: relative;
  height: 0;
  border-top: 2px solid #444;
  margin-top: 16px;
  width: 24px;
  margin-left: 2px;
}
.we-mini-arrowline::after {
  content: '';
  position: absolute;
  right: -8px;
  top: -6px;
  border: 5px solid transparent;
  border-left-color: #444;
}

/* 단축키 팝업 */
#weHelpPop {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 500;
  background: #fff;
  border: 1px solid var(--we-divider);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(20, 30, 50, 0.22);
  padding: 14px 16px;
  width: 320px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
}
#weHelpPop h4 { margin: 0 0 10px; font-size: 14px; }
#weHelpPop div { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
#weHelpPop kbd {
  flex: none;
  min-width: 128px;
  font-size: 11.5px;
  background: #f2f5f9;
  border: 1px solid var(--we-divider);
  border-radius: 5px;
  padding: 2px 6px;
  font-family: inherit;
}
#weHelpPop span { font-size: 12.5px; color: #445; }

/* ── 좌측 레일 (탭) ── */
.we-rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  background: var(--we-surface);
  padding-top: 6px;
  box-shadow: inset -1px 0 0 var(--we-border);
}
.we-rail button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 11px 4px;
  border: none;
  background: transparent;
  color: var(--we-muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.we-rail button .we-rail-ico { font-size: 19px; line-height: 1; }
.we-rail button .we-rail-ico .we-ico { width: 21px; height: 21px; margin: 0 auto; }
.we-rail button:hover { color: var(--we-text); background: var(--we-surface-2); }
.we-rail button.we-on {
  color: var(--we-accent);
  background: var(--we-accent-tint);
  box-shadow: inset 3px 0 0 var(--we-accent);
}

/* ── 탭 패널 ── */
.we-panel {
  grid-area: panel;
  background: var(--we-panel-bg);
  border-right: 1px solid var(--we-divider);
  overflow-y: auto;
  min-height: 0;
}
.we-panel > div { padding: 14px; }
.we-panel-caption {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--we-muted);
  margin: 0 0 10px;
}

/* 템플릿 패널 */
.we-tpl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.we-tpl-card {
  position: relative;
  border: 1px solid var(--we-border-strong);
  border-radius: var(--we-radius-card);
  background: var(--we-surface);
  padding: 8px;
  cursor: pointer;
  text-align: center;
  box-shadow: var(--we-shadow-card);
  transition: box-shadow 0.14s, border-color 0.14s, transform 0.14s;
}
.we-tpl-card:hover { border-color: var(--we-accent); box-shadow: var(--we-shadow-lift); transform: translateY(-1px); }
.we-tpl-mini {
  aspect-ratio: 210 / 297;
  border: 1px solid var(--we-border-strong);
  border-radius: 4px;
  padding: 8px;
  background: var(--we-surface);
  box-sizing: border-box;
}
.we-tpl-mini span {
  border: 1.5px solid #444;
  border-radius: 2px;
  display: block;
}
.we-tpl-name {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--we-text-2);
}
/* 갤러리 카드 이름은 한 단계 크게(2026-07-16, 사용자) — 528개 실측상 14px에서 4%만 두 줄.
   긴 이름은 자르지 않고 어절 단위로 줄바꿈(이름이 곧 정보). */
.we-gal-card .we-tpl-name { font-size: 14px; line-height: 1.35; word-break: keep-all; overflow-wrap: break-word; }
/* 실전 템플릿 미니어처 — build() 요소를 mm→% 축소해 절대 배치 */
.we-tpl-mini-design { position: relative; padding: 0; overflow: hidden; }
.we-tpl-mini-design i { position: absolute; display: block; box-sizing: border-box; }
.we-dm-template-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: saturate(0.48) brightness(1.06) contrast(0.94);
}
.we-dm-box { border: 1px solid #64748c; border-radius: 1px; }
.we-dm-dash { border-style: dashed; }
.we-dm-line { border: 0; }
.we-dm-line::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid #94a2b3; }
.we-dm-text { background: #cbd4df; border-radius: 1px; }
.we-dm-num { background: #8e9aab; border-radius: 50%; }

/* 사이드바 템플릿 도구줄 (검색 + 전체 보기) */
/* 전체 템플릿 보기 — 사이드바 최상단 강조 CTA(전체 갤러리 진입이 핵심 동선) */
.we-tpl-all-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--we-accent-strong);
  color: #fff;
  background: var(--we-accent);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(31, 95, 91, 0.20);
}
.we-tpl-all-btn:hover { background: var(--we-accent-strong); border-color: var(--we-accent-strong); }
.we-tpl-all-btn .we-ico { width: 19px; height: 19px; flex: none; }

/* 전체화면 템플릿 갤러리 (캔바·미리캔버스 문법) */
.we-gallery {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: var(--we-app-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  --gal-pad: clamp(20px, 2.2vw, 40px);
  --we-accent: #1F5F5B;
  --we-text: #2b261e;
  --we-border: #e5e0d6;
  --we-border-strong: #c9c1b1;
}
.we-gallery:focus { outline: none; }
/* 전체(헤더+카테고리+그리드) 중앙 프레임 — 넓은 모니터(32")에서 좌우 여백을 확보하는 시트(2026-07-10).
   프레임 밖은 오버레이 배경, 안쪽 3요소(헤더·사이드바·그리드)는 기존 스타일 유지. */
.we-gal-frame {
  width: 100%;
  max-width: 1280px; /* 시트 자체를 좁혀 좌우 여백 확보(사용자 확정 2026-07-16) — 1640은 와이드에서 과했다 */
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 0 0 1px var(--we-border);
}
/* 표준형 헤더(사용자 확정 2026-07-10): [제목 왼쪽] ──── [즐겨찾기·검색] ─간격─ [✕].
   닫기 ✕는 검색창과 확실히 띄운다 — 붙여두면 검색어 지우기 버튼으로 오독돼 눌린다. */
.we-gal-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--gal-pad);
  background: #fff;
  border-bottom: 1px solid var(--we-border);
}
.we-gal-title-wrap {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  margin-right: auto; /* 제목 왼쪽 고정 — 나머지는 오른쪽으로 밀림 */
}
.we-gal-head strong {
  font-size: 22px;
  font-weight: 850;
  letter-spacing: 0;
  color: var(--we-text);
}
.we-gal-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
.we-gal-tools-right { margin-left: 26px; } /* 검색창과 닫기 ✕ 사이 오독 방지 간격 */
.we-search-wrap {
  position: relative;
}
.we-search-ico {
  position: absolute;
  left: 13px;
  top: 50%;
  z-index: 1;
  width: 18px;
  height: 18px;
  color: var(--we-text-2);
  transform: translateY(-50%);
  pointer-events: none;
}
.we-search-ico .we-ico {
  width: 18px;
  height: 18px;
  display: block;
}
.we-gal-search-wrap {
  flex: none;
  width: 240px;
  max-width: 100%;
  min-width: 0;
}
.we-gal-head input[type='search'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 38px;
  padding: 9px 14px 9px 42px;
  font-size: 14px;
  font-weight: 600;
  color: var(--we-text);
  background: #fff;
  border: 1px solid var(--we-border-strong);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65), 0 1px 2px rgba(15,23,42,0.06);
  outline: none;
  box-sizing: border-box;
}
.we-gal-head input[type='search']::placeholder { color: #5f6f85; font-weight: 500; }
.we-gal-head input[type='search']:focus {
  border-color: var(--we-accent);
  box-shadow: 0 0 0 3px rgba(31,95,91,0.18), 0 1px 2px rgba(60,50,30,0.08);
}
.we-gal-count {
  flex: none;
  padding: 3px 8px;
  border: 1px solid #d1dae7;
  border-radius: 999px;
  color: #475569;
  background: #f8fafc;
  font-size: 12.5px;
  font-weight: 750;
}
.we-gal-close {
  flex: none;
  width: 38px;
  height: 38px;
  border: 2px solid #e0453c;
  background: #fff;
  color: #e0453c;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.we-gal-close:hover { background: #e0453c; color: #fff; }
/* 본문 2단 — 왼쪽 카테고리 사이드바 + 오른쪽 카드 그리드. 각자 세로 스크롤. */
.we-gal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
/* 카테고리 세로 사이드바(2026-07-10): 카테고리가 늘어도 좌우 스크롤 없이 세로로 훑는다.
   왼쪽 여백은 헤더 제목과 같은 --gal-pad로 맞춰 시선 라인을 정렬한다. */
.we-gal-chips {
  flex: none;
  width: 216px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 14px 10px 18px var(--gal-pad);
  background: #fff;
  border-right: 1px solid var(--we-border);
}
.we-gal-chip {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  padding: 9px 13px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: #445;
  cursor: pointer;
}
.we-gal-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.we-gal-chip-count {
  flex: none;
  font-size: 12px;
  font-weight: 650;
  color: #98a2b3;
  font-variant-numeric: tabular-nums;
}
.we-gal-chip:hover { background: var(--we-surface-2); }
.we-gal-chip.we-on {
  background: var(--we-accent-tint);
  color: var(--we-accent);
  font-weight: 750;
  box-shadow: inset 3px 0 0 var(--we-accent); /* 선택 카테고리 좌측 인디케이터 */
}
.we-gal-chip.we-on .we-gal-chip-count { color: var(--we-accent); }
/* 사이드바 구분선 (전체 / 즐겨찾기·최근 / 카테고리들 사이) */
.we-gal-chip-div { height: 1px; margin: 6px 10px; background: var(--we-border); }
.we-gal-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  /* 최소 165px → 1280 프레임에서 6열(카드 ~185px). 이름 14px 기준 528개 전수 한 줄 유지
     (최장 '주장·근거 정리하고 요약' 145px). 150px 7열은 14px에서 21개가 두 줄로 지저분(2026-07-16, 사용자). */
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 14px;
  padding: 18px 24px; /* 폭 제한은 .we-gal-frame이 담당 */
  align-content: start;
  background: #f4f2ed; /* 흰 카드가 뜨도록 — 프레임(흰색)과 구분 */
}
.we-gal-card {
  position: relative;
  border: 1px solid var(--we-border);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  text-align: center;
}
.we-gal-card:hover { border-color: var(--we-accent); box-shadow: 0 3px 10px rgba(60, 50, 30, 0.08); }
.we-gal-card:focus-visible {
  outline: 3px solid rgba(31, 95, 91, 0.28);
  outline-offset: 2px;
  border-color: var(--we-accent);
}
.we-gal-card .we-tpl-mini { width: 100%; }
/* 카드 카테고리 라벨 — 카테고리가 섞이는 문맥(전체·검색·즐겨찾기·최근)에서만 그리드 클래스로 노출 */
.we-gal-cat { display: none; }
.we-gal-grid.we-gal-showcat .we-gal-cat {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--we-muted);
}
.we-gal-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #64748b;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}
.we-gal-fav:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: #fff;
}
.we-gal-fav.we-on {
  border-color: #ef4444;
  color: #ef4444;
  background: #fff5f5;
}
/* 내 템플릿 삭제 버튼(cat:'mine' 카드 전용) — 좌상단, 호버 시 노출 */
.we-gal-del {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid #d6c0bd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #b4453c;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}
.we-gal-card:hover .we-gal-del,
.we-gal-del:focus-visible { opacity: 1; }
.we-gal-del .we-ico { width: 15px; height: 15px; }
.we-gal-del:hover { background: #b4453c; border-color: #b4453c; color: #fff; }
.we-gal-mini-ph { background: #f2f5f9; }
/* 즐겨찾기 토글 — 카테고리와 조합되는 유일한 축이라 칩이 아니라 검색창 옆 토글 버튼 */
.we-gal-favtoggle {
  flex: none;
  height: 38px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.we-gal-favtoggle:hover { border-color: #ef4444; color: #ef4444; }
.we-gal-favtoggle.we-on { border-color: #ef4444; color: #ef4444; background: #fff5f5; }
.we-gal-empty { grid-column: 1 / -1; text-align: center; color: #6b7688; padding: 40px 0; }

/* 그림(검색) 패널 */
#wePicMode { margin-bottom: 10px; }
.we-panel .we-search-wrap { margin-bottom: 10px; }
.we-panel input[type='search'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 40px;
  padding: 9px 12px 9px 40px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--we-border-strong);
  border-radius: 8px;
  box-sizing: border-box;
  margin-bottom: 0;
  color: var(--we-text);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65), 0 1px 2px rgba(15,23,42,0.05);
  outline: none;
}
.we-panel input[type='search']::placeholder { color: #5f6f85; font-weight: 500; }
.we-panel input[type='search']:focus {
  border-color: var(--we-accent);
  box-shadow: 0 0 0 3px rgba(31,95,91,0.18), 0 1px 2px rgba(60,50,30,0.08);
}
.we-panel select {
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 650;
  color: var(--we-text);
  background: var(--we-surface);
  border: 1px solid var(--we-border-strong);
  border-radius: 8px;
  box-sizing: border-box;
}
/* 그림 팔레트 헤더(카테고리 드롭다운 + 검색창)를 스크롤해도 상단에 고정.
   부모(.we-panel > div)의 14px 패딩을 음수 마진으로 상쇄해 배경이 패널 폭을 꽉 채우고,
   같은 값을 안쪽 패딩으로 되살려 쉬는 위치는 그대로. 하단 10px 간격도 배경 안에 넣어
   그리드가 헤더 바로 아래에서 깔끔히 사라지게 한다. */
[data-we-panel='pictures'] .we-pic-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--we-panel-bg);
  margin: -14px -14px 0;
  padding: 14px 14px 10px;
}
[data-we-panel='pictures'] .we-pic-head .we-search-wrap { margin-bottom: 0; }
.we-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
  align-content: start;
}
.we-result {
  border: 1px solid var(--we-border-strong);
  border-radius: 8px;
  background: var(--we-surface);
  padding: 6px 4px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.we-result:hover { border-color: var(--we-accent); background: var(--we-accent-tint); box-shadow: 0 3px 10px rgba(15, 23, 42, 0.10); }
.we-result img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
}
.we-result span {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
  margin-top: 3px;
  color: var(--we-text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.we-palette-msg {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--we-muted);
  line-height: 1.5;
  margin: 4px 2px;
}

/* See All 섹션 (스마티/캔바 패널 문법) */
.we-sec { margin-bottom: 16px; }
.we-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.we-sec-head h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--we-text);
}
.we-sec-toggle {
  border: none;
  background: none;
  font-size: 12.5px;
  color: var(--we-accent-strong);
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
}
/* hidden 속성이 display:flex 규칙(.we-elem-card 등)에 지지 않게 — 접기 정상화 */
.we-panel [hidden] { display: none !important; }
.we-sec-toggle { display: inline-flex; align-items: center; gap: 3px; }
.we-sec-toggle .we-ico { width: 13px; height: 13px; }
.we-sec-toggle:hover { color: #1e40af; }
.we-sec-empty {
  padding: 14px 12px;
  border: 1px dashed var(--we-border-strong);
  border-radius: 8px;
  color: var(--we-muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.we-sec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
/* 넓어진 패널: 템플릿·도형은 3열 (길쭉함 해소) */
[data-we-panel='templates'] .we-sec-grid { grid-template-columns: repeat(3, 1fr); }

/* 텍스트 패널 */
.we-text-preset {
  display: block;
  width: 100%;
  border: 1px solid var(--we-border-strong);
  border-radius: var(--we-radius-card);
  background: var(--we-surface);
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
  color: var(--we-text);
  box-shadow: var(--we-shadow-card);
  transition: box-shadow 0.14s, border-color 0.14s, transform 0.14s;
}
.we-text-preset:hover { border-color: var(--we-accent); box-shadow: var(--we-shadow-lift); transform: translateY(-1px); }

/* 요소 패널 */
.we-elem-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--we-border-strong);
  border-radius: var(--we-radius-card);
  background: var(--we-surface);
  padding: 10px;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--we-shadow-card);
  transition: box-shadow 0.14s, border-color 0.14s, transform 0.14s;
}
.we-elem-card:hover { border-color: var(--we-accent); box-shadow: var(--we-shadow-lift); transform: translateY(-1px); }
.we-elem-body { min-width: 0; }
.we-elem-body strong { display: block; font-size: 13.5px; color: var(--we-text); font-weight: 800; }
.we-elem-body span { display: block; font-size: 12px; color: var(--we-muted); margin-top: 2px; font-weight: 600; }
.we-elem-mini {
  flex: none;
  width: 34px;
  height: 34px;
  display: block;
}
.we-mini-rect { border: 2px solid #444; border-radius: 4px; }
.we-mini-circle { border: 2px solid #444; border-radius: 50%; }
.we-mini-speech {
  border: 2px solid #444;
  border-radius: 8px;
  position: relative;
  height: 26px;
  margin-top: 2px;
}
.we-mini-speech::after {
  content: '';
  position: absolute;
  left: 7px;
  bottom: -7px;
  border: 5px solid transparent;
  border-top-color: #444;
}
.we-mini-line { border-top: 2px solid #444; height: 0; margin-top: 16px; }
.we-mini-dashline { border-top: 2px dashed #444; height: 0; margin-top: 16px; }
.we-mini-arrow {
  position: relative;
  height: 0;
  border-top: 3px solid #444;
  margin-top: 15px;
  width: 26px;
  margin-left: 2px;
}
.we-mini-arrow::after {
  content: '';
  position: absolute;
  right: -9px;
  top: -7.5px;
  border: 6px solid transparent;
  border-left-color: #444;
}
.we-mini-star {
  background: #444;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* ── 캔버스 영역 (눈금자 + 뷰포트) ── */
.we-canvas-area {
  grid-area: viewport;
  position: relative;
  min-height: 0;
  min-width: 0;
  background: var(--we-app-bg);
}
.we-viewport {
  width: 100%;
  height: 100%;
  overflow: auto;
  /* scale된 페이지 안 contenteditable 타이핑마다 Chrome 스크롤 앵커링이
     앵커 위치를 오계산해 스크롤이 저절로 밀린다(2026-07-17 실측: 키 입력당 ±14px 드리프트).
     요소가 전부 절대배치라 앵커링이 이로울 상황이 없어 끈다. */
  overflow-anchor: none;
  padding: 30px;
  box-sizing: border-box;
  /* 종이를 뷰포트 중앙에 — 맞으면 중앙, 넘치면 margin auto가 0으로 접혀 상단부터 스크롤 */
  display: flex;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 120px),
    var(--we-app-bg);
}
.we-ruler-top,
.we-ruler-left,
.we-ruler-corner {
  position: absolute;
  z-index: 20;
  pointer-events: none;
}
.we-ruler-top { top: 0; left: 22px; height: 22px; }
.we-ruler-left { top: 22px; left: 0; width: 22px; }
.we-ruler-corner {
  top: 0; left: 0; width: 22px; height: 22px;
  background: var(--we-app-bg);
  border-right: 1px solid var(--we-divider);
  border-bottom: 1px solid var(--we-divider);
}
#wePageWrap { margin: auto; flex: none; position: relative; }
.we-page-slot {
  position: relative;
  flex: none;
  overflow: visible;
}
.we-page {
  position: absolute;
  inset: 0 auto auto 0;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.16), 0 14px 34px rgba(15, 23, 42, 0.22);
  outline: 1px solid #cbd5e1;
  transform: scale(var(--we-scale, 1));
  transform-origin: top left;
  touch-action: none;
  overflow: hidden;
}
/* 모든 페이지를 한 흐름에서 편집하는 이어 보기 전용 화면. */
.we-viewport { display: block; }
#wePageWrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  margin: 0 auto;
  padding: 18px 0 42px;
}
#wePageWrap > .we-page-slot {
  display: block;
  content-visibility: auto;
  contain: layout paint style;
}
.we-page.we-current {
  outline: 2px solid var(--we-accent);
  box-shadow: 0 0 0 4px rgba(31, 95, 91, 0.13), 0 14px 34px rgba(15, 23, 42, 0.22);
}

/* 5mm 격자 점 배경 (격자 스냅 켜짐 시각화, 비인쇄) */
.we-page.we-grid-dots {
  background-image: radial-gradient(circle, #c9d2dd 0.35mm, transparent 0.4mm);
  background-size: 5mm 5mm;
  background-position: 0 0;
}

/* 빈 페이지 안내 (비인쇄) */
.we-empty-hint {
  position: absolute;
  inset: 34% 12%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4mm;
  text-align: center;
  color: #8a95a6;
  font-size: 5mm;
  font-weight: 650;
  pointer-events: none;
  user-select: none;
}
.we-empty-hint .we-empty-ico { width: 16mm; height: 16mm; opacity: 0.62; }

/* marquee (빈 곳 드래그 다중 선택) */
.we-marquee {
  position: absolute;
  border: 1.5px dashed var(--we-accent);
  background: rgba(37, 99, 235, 0.09);
  pointer-events: none;
  z-index: 60;
}
/* 마퀴 중엔 page 클리핑 해제 — 회색 여백에서 시작한 선택 박스가 보이게 */
.we-page.we-marqueeing { overflow: visible; }

/* 정렬 가이드선 (드래그 스냅) */
.we-guides { position: absolute; inset: 0; pointer-events: none; z-index: 55; }
.we-guide-v {
  position: absolute;
  top: 0; bottom: 0;
  border-left: 1px dashed #e0457b;
}
.we-guide-h {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px dashed #e0457b;
}
.we-spacing-guide {
  position: absolute;
  color: #fff;
  pointer-events: none;
  z-index: 2;
}
.we-spacing-guide-x {
  height: 0;
  border-top: 2px solid #d500d8;
}
.we-spacing-guide-y {
  width: 0;
  border-left: 2px solid #d500d8;
}
.we-spacing-label {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: #d500d8;
  color: #fff;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(76, 0, 92, 0.25);
  white-space: nowrap;
  box-sizing: border-box;
}
.we-spacing-guide-x .we-spacing-label {
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
}
.we-spacing-guide-y .we-spacing-label {
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* ── 페이지 위 요소 ── */
.we-el { position: absolute; box-sizing: border-box; }
.we-image-group { overflow: visible; }
.we-image-group-root { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.we-image-group-child { position: absolute; box-sizing: border-box; transform-origin: center center; pointer-events: none; }
.we-image-group-child.we-image-composite { overflow: hidden; }
.we-cell-image-group-stage { position: relative; width: 100%; height: 100%; min-height: 0; flex: 1; overflow: hidden; }
.we-cell-image-group-inner { position: absolute; overflow: visible; pointer-events: none; }
#weSelection.we-profile-image-group .we-handle[data-dir='n'],
#weSelection.we-profile-image-group .we-handle[data-dir='e'],
#weSelection.we-profile-image-group .we-handle[data-dir='s'],
#weSelection.we-profile-image-group .we-handle[data-dir='w'] { display: none; }

.we-content-group { overflow: visible; }
.we-content-group-root { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.we-content-group-child { position: absolute; box-sizing: border-box; transform-origin: center center; pointer-events: none; }
.we-content-group-child.we-image-composite { overflow: hidden; }
.we-content-group-text { width: 100%; white-space: pre-wrap; word-break: break-word; }
.we-cell-content-group-stage { position: relative; width: 100%; height: 100%; min-height: 0; flex: 1; overflow: hidden; }
.we-cell-content-group-inner { position: absolute; overflow: visible; pointer-events: none; }
#weSelection.we-profile-content-group .we-handle[data-dir='n'],
#weSelection.we-profile-content-group .we-handle[data-dir='e'],
#weSelection.we-profile-content-group .we-handle[data-dir='s'],
#weSelection.we-profile-content-group .we-handle[data-dir='w'] { display: none; }
.we-image-composite {
  overflow: hidden;
}
.we-image-frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.we-img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.we-img-missing { background: repeating-linear-gradient(45deg, #f6f7f9, #f6f7f9 6px, #eceff3 6px, #eceff3 12px); }
.we-image-cropping .we-image-frame { cursor: grab; box-shadow: inset 0 0 0 0.6mm var(--we-accent); }
.we-image-cropping .we-image-frame:active { cursor: grabbing; }
.we-crop-active .we-handle, .we-crop-active .we-rotate { display: none !important; }
.we-crop-zoom { width: 150px; accent-color: var(--we-accent); }
.we-crop-pct { min-width: 42px; font-size: 12.5px; font-weight: 750; color: var(--we-muted); }
.we-bar2 button.we-crop-done { background: var(--we-accent); border-color: var(--we-accent); color: #fff; }

.we-type-text { display: flex; align-items: center; }
.we-text-content {
  width: 100%;
  outline: none;
  line-height: 1.35;
  word-break: break-word;
  white-space: pre-wrap; /* 줄바꿈 보존 */
  cursor: default;
}
.we-text-content[contenteditable='true'] {
  cursor: text;
  background: rgba(47, 111, 189, 0.06);
}

.we-cell-box {
  border: 0.4mm solid #333;
  border-radius: 1mm;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.we-cell-guide { color: #c3c9d1; }

.we-line-svg { width: 100%; height: 100%; display: block; }

/* ── cell(칸) — 그림·이름표를 품는 컨테이너 (보드메이커 Button 방식) ──
   기본 외형: 검정 실선 + 둥근 모서리 + 배경 없음. 테두리·채움은 인쇄물의 일부다.
   내용물은 칸 모양(border-radius)대로 clip — 타원 칸에서 그림이 테두리를 덮지 않게. */
.we-type-cell { box-sizing: border-box; overflow: hidden; }
.we-cell-bg-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.we-cell-body {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}
.we-cell-img-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.we-cell-crop-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
  pointer-events: none;
}
.we-cell-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  pointer-events: none;
}
.we-cell-label {
  flex: none;
  text-align: center;
  line-height: 1.25;
  color: #1c1c1c;
  word-break: break-word;
  white-space: pre-wrap; /* 이름표 줄바꿈 보존 (화면=인쇄) */
  outline: none;
}
.we-label-center { justify-content: center; }
.we-label-center .we-cell-label { flex: none; }
.we-cell-hint {
  margin: auto;
  padding: 0 6%;
  font-size: 3.6mm;
  line-height: 1.3;
  text-align: center;
  word-break: keep-all; /* 좁은 칸에서 어절 단위 줄바꿈 — 행동 유도 문구가 어디서나 같게 */
  color: #c9cfd8;
  user-select: none;
}
.we-cell-hot {
  outline: 1mm solid var(--we-accent);
  outline-offset: 1mm;
}
.we-cell-hot::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(47, 111, 189, 0.14);
  border-radius: inherit;
  pointer-events: none;
}

/* 팔레트 드래그 고스트 (45×45, 커서 추적) */
.we-drag-ghost {
  position: fixed;
  width: 45px;
  height: 45px;
  object-fit: contain;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1000;
  filter: drop-shadow(0 2px 6px rgba(20, 30, 50, 0.35));
}
/* 텍스트·요소 카드 드래그 고스트 (라벨만 담은 작은 칩) */
.we-drag-ghost-card {
  position: fixed;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3000;
  padding: 5px 11px;
  background: #fff;
  border: 1px solid var(--we-accent);
  border-radius: 8px;
  font-size: 13px;
  color: #1c1c1c;
  white-space: nowrap;
  box-shadow: var(--we-shadow-lift);
  opacity: 0.92;
}
/* 요소 드래그 고스트는 모양 미리보기를 담는다 (글자 대신 도형) */
.we-drag-ghost-card.we-drag-ghost-shape { display: flex; align-items: center; justify-content: center; padding: 7px; }

/* ── 캔바형 선택 오버레이: 모서리 원형 + 변 중앙 타원 + 명시적 회전 ── */
#weSelection {
  position: absolute;
  border: 1.7px solid var(--we-accent);
  pointer-events: none;
  z-index: 50;
}
/* 다중 선택: 그룹 bbox는 점선이며 모서리 비율 조절과 회전만 제공한다. */
#weSelection.we-group { border-style: dashed; }
.we-sel-lite { outline: 1.3px solid rgba(37, 99, 235, 0.82); outline-offset: 0.5mm; }
.we-handle {
  position: absolute;
  pointer-events: auto;
  width: 18px;
  height: 18px;
  background: #fff;
  border: 1.5px solid var(--we-accent);
  border-radius: 50%;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(18, 48, 46, 0.16);
}
.we-handle::after {
  content: '';
  position: absolute;
  inset: -10px;
}
/* 회전 핸들: 프레임 아래에 독립된 원형 화살표 버튼으로 표시한다. */
.we-handle.we-rotate {
  bottom: -60px;
  left: calc(50% - 16px);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--we-accent);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}
.we-handle.we-rotate:active { cursor: grabbing; }

.we-handle[data-dir='nw'] { left: -9px; top: -9px; cursor: nwse-resize; }
.we-handle[data-dir='ne'] { right: -9px; top: -9px; cursor: nesw-resize; }
.we-handle[data-dir='se'] { right: -9px; bottom: -9px; cursor: nwse-resize; }
.we-handle[data-dir='sw'] { left: -9px; bottom: -9px; cursor: nesw-resize; }
.we-handle[data-dir='n'], .we-handle[data-dir='s'] {
  left: calc(50% - 13px);
  width: 26px;
  height: 10px;
  border-radius: 999px;
  cursor: ns-resize;
}
.we-handle[data-dir='n'] { top: -6px; }
.we-handle[data-dir='s'] { bottom: -6px; }
.we-handle[data-dir='e'], .we-handle[data-dir='w'] {
  top: calc(50% - 13px);
  width: 10px;
  height: 26px;
  border-radius: 999px;
  cursor: ew-resize;
}
.we-handle[data-dir='e'] { right: -6px; }
.we-handle[data-dir='w'] { left: -6px; }

/* 타입별로 의미 없는 핸들은 감춰 잘못된 조작 가능성을 줄인다. */
#weSelection.we-profile-cell .we-handle[data-dir='n'],
#weSelection.we-profile-cell .we-handle[data-dir='e'],
#weSelection.we-profile-cell .we-handle[data-dir='s'],
#weSelection.we-profile-cell .we-handle[data-dir='w'] {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
#weSelection.we-profile-cell .we-handle[data-dir='n'],
#weSelection.we-profile-cell .we-handle[data-dir='s'] { left: calc(50% - 9px); }
#weSelection.we-profile-cell .we-handle[data-dir='e'],
#weSelection.we-profile-cell .we-handle[data-dir='w'] { top: calc(50% - 9px); }
#weSelection.we-profile-cell .we-handle[data-dir='n'] { top: -9px; }
#weSelection.we-profile-cell .we-handle[data-dir='e'] { right: -9px; }
#weSelection.we-profile-cell .we-handle[data-dir='s'] { bottom: -9px; }
#weSelection.we-profile-cell .we-handle[data-dir='w'] { left: -9px; }
#weSelection.we-profile-text .we-handle[data-dir='n'],
#weSelection.we-profile-text .we-handle[data-dir='s'],
#weSelection.we-profile-group .we-handle[data-dir='n'],
#weSelection.we-profile-group .we-handle[data-dir='e'],
#weSelection.we-profile-group .we-handle[data-dir='s'],
#weSelection.we-profile-group .we-handle[data-dir='w'] { display: none; }
#weSelection.we-profile-line .we-handle[data-dir='nw'],
#weSelection.we-profile-line .we-handle[data-dir='n'],
#weSelection.we-profile-line .we-handle[data-dir='ne'],
#weSelection.we-profile-line .we-handle[data-dir='se'],
#weSelection.we-profile-line .we-handle[data-dir='s'],
#weSelection.we-profile-line .we-handle[data-dir='sw'] { display: none; }
#weSelection.we-profile-line .we-handle[data-dir='e'],
#weSelection.we-profile-line .we-handle[data-dir='w'] {
  width: 18px;
  height: 18px;
  top: calc(50% - 9px);
  border-radius: 50%;
}
#weSelection.we-profile-line .we-handle[data-dir='e'] { right: -9px; }
#weSelection.we-profile-line .we-handle[data-dir='w'] { left: -9px; }

/* ── 우측 페이지 패널 ── */
.we-app.we-pages-collapsed { grid-template-columns: 80px 360px minmax(0, 1fr) 0; }
.we-app.we-pages-collapsed .we-pages { display: none; }
.we-app.we-pages-collapsed .we-bar2 { left: calc((100% + 440px) / 2); }
.we-pages-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--we-divider);
  border-radius: 7px;
  background: var(--we-surface);
  color: var(--we-text-2);
  cursor: pointer;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}
.we-pages-toggle:hover { color: var(--we-accent); background: var(--we-accent-tint); }

.we-pages {
  grid-area: pages;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--we-panel-bg);
  border-left: 1px solid var(--we-divider);
  padding: 12px 10px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  scrollbar-width: thin;
}
.we-pages-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.we-pages-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--we-text);
  white-space: nowrap;
}
#weAddPageBtn,
#weAddPageBtnBottom {
  flex: none;
  white-space: nowrap;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 750;
  border: 1px solid var(--we-border-strong);
  border-radius: 8px;
  background: var(--we-surface);
  color: var(--we-text);
  cursor: pointer;
}
#weAddPageBtnBottom { width: 100%; min-height: 44px; }
#weAddPageBtn:hover,
#weAddPageBtnBottom:hover { border-color: var(--we-accent); background: var(--we-accent-tint); color: var(--we-accent-strong); }
#wePageList {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  align-items: stretch;
  padding: 3px;
}
/* 마지막 페이지도 패널 중앙 부근까지 올릴 수 있게 만드는 비가시 완충 공간. */
#wePageList::after {
  content: '';
  display: block;
  flex: 0 0 clamp(180px, 28vh, 250px);
  pointer-events: none;
}
.we-page-thumb {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  border: 2px solid var(--we-border-strong);
  border-radius: 8px;
  background: var(--we-surface);
  padding: 4px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.07);
}
.we-page-thumb { transition: border-color 0.15s, box-shadow 0.15s; }
.we-page-thumb:hover { border-color: var(--we-border-strong); box-shadow: 0 3px 10px rgba(15, 23, 42, 0.13); }
.we-page-thumb.we-current { border-color: var(--we-accent); box-shadow: 0 0 0 3px rgba(31, 95, 91, 0.20), 0 4px 12px rgba(60, 50, 30, 0.14); }
.we-page-thumb.we-page-sel { border-color: var(--we-accent); background: var(--we-accent-tint); }
.we-page-thumb.we-thumb-dragging {
  opacity: 0.42;
  transform: scale(0.985);
  border-style: dashed;
  box-shadow: none;
}
.we-page-drop-marker {
  flex: none;
  position: relative;
  border-radius: 999px;
  background: rgba(31, 95, 91, 0.10);
  box-shadow: inset 0 0 0 1px rgba(31, 95, 91, 0.26);
  pointer-events: none;
}
.we-page-drop-marker::before {
  content: '';
  position: absolute;
  border-radius: 999px;
  background: var(--we-accent);
  box-shadow: 0 0 0 4px rgba(31, 95, 91, 0.16), 0 2px 8px rgba(60, 50, 30, 0.18);
}
.we-page-drop-marker-y {
  width: 100%;
  height: 14px;
  margin: -1px 0;
}
.we-page-drop-marker-y::before {
  left: 10px;
  right: 10px;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
}
.we-page-drop-marker-x {
  width: 14px;
  align-self: stretch;
  min-height: 48px;
  margin: 0 -1px;
}
.we-page-drop-marker-x::before {
  top: 8px;
  bottom: 8px;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
}
.we-thumb-drag-ghost {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 132px;
  opacity: 0.92;
  transform: scale(0.88);
  transform-origin: top left;
  border-color: var(--we-accent);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.28);
  pointer-events: none;
}
.we-thumb-canvas {
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  pointer-events: none;
  background: #fff;
}
.we-thumb-canvas > .we-page { position: relative; inset: auto; }
.we-thumb-label {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--we-text-2);
  margin-top: 3px;
}
/* 썸네일 hover 버튼 — 새 페이지/복제/삭제를 작은 액션 묶음으로 노출 */
.we-thumb-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  gap: 4px;
}
.we-thumb-add,
.we-thumb-del,
.we-thumb-dup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--we-border-strong);
  border-radius: 7px;
  background: var(--we-surface);
  color: var(--we-text-2);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(20, 30, 50, 0.14);
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.we-thumb-add:hover,
.we-thumb-dup:hover { background: var(--we-accent-tint); color: var(--we-accent-strong); border-color: var(--we-accent); }
.we-thumb-del:hover { background: #fdecea; color: #c0392b; border-color: #f0c8c2; }
.we-thumb-add:active,
.we-thumb-del:active,
.we-thumb-dup:active { transform: scale(0.92); }
.we-thumb-add .we-ico,
.we-thumb-del .we-ico,
.we-thumb-dup .we-ico { width: 15px; height: 15px; }
.we-page-thumb:hover .we-thumb-actions { display: flex; }

/* ── 좁은 화면: 레일·패널을 아래로 ── */
@media (max-width: 900px) {
  .we-popover.we-shape-pop { width: 238px; }
  .we-shape-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .we-app {
    grid-template-rows: auto auto 1fr 62px 52px 34vh;
    grid-template-columns: 1fr;
    grid-template-areas:
      'bar1'
      'bar2'
      'viewport'
      'pages'
      'rail'
      'panel';
    height: 100dvh;
  }
  .we-app.we-pages-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr 0 52px 34vh;
  }
  .we-bar1 {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
  .we-bar-left { grid-column: 1; }
  .we-main-actions { grid-column: 2; }
  .we-bar-right { grid-column: 3; }
  .we-bar2 {
    justify-content: flex-start;
    min-height: 44px;
    padding: 0 10px;
  }
  .we-bar2 .we-ctx-msg {
    max-width: calc(100vw - 24px);
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
  }
  .we-bar-left {
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .we-title,
  .we-bar-left button[data-we-act='help'] { display: none; }
  .we-rail { flex-direction: row; justify-content: space-around; padding: 0; }
  .we-rail button { flex: 1; padding: 7px 2px; }
  .we-pages { flex-direction: row; align-items: center; gap: 10px; border-left: none; border-top: 1px solid var(--we-divider); padding: 6px 10px; overflow-x: auto; overflow-y: hidden; }
  .we-pages-head { flex-direction: row; align-items: center; }
  .we-pages-title { display: none; }
  .we-contact-link { width: 34px; height: 34px; }
  #wePageList { flex: none; min-height: auto; flex-direction: row; overflow: visible; padding: 0; }
  #wePageList::after { flex-basis: 120px; }
  #weAddPageBtnBottom { width: auto; min-height: 44px; }
  .we-page-thumb { width: auto; }
  .we-page-thumb .we-thumb-canvas { height: 40px !important; width: auto !important; aspect-ratio: 210 / 297; }
  .we-panel { border-right: none; border-top: 1px solid var(--we-divider); }
  .we-gal-head {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
  }
  .we-gal-title-wrap { padding-right: 48px; } /* 우상단 닫기와 겹침 방지 */
  .we-gal-head strong { font-size: 18px; }
  .we-gal-tools { flex: 1 1 100%; justify-content: space-between; }
  .we-gal-tools-right { position: absolute; top: 10px; right: 14px; flex: none; margin-left: 0; }
  .we-gal-search-wrap {
    flex: 1;
    width: auto;
  }
  .we-confirm-overlay { padding-top: 64px; }
  .we-confirm-box { padding: 18px 18px 16px; }
  .we-confirm-actions { justify-content: center; }
  .we-confirm-actions button { flex: none; padding: 0 12px; }
}

@media (min-width: 901px) and (max-width: 1199px) {
  .we-bar-left { gap: 6px; }
  .we-title,
  .we-bar-left button[data-we-act='help'] { display: none; }
  .we-bar1 select { max-width: 88px; }
}

/* ── 인쇄: 편집 UI 숨기고 전 페이지 A4 원본 크기로 출력 ── */
@media print {
  /* body { margin:0 }은 다른 화면 인쇄에 간섭하지 않게 편집기 진입 중에만
     런타임 주입(#wePrintOrient, weUiSyncPrintOrientation)으로 적용한다. */
  /* 편집기에서 인쇄할 때(beforeprint에서 클래스 부여) 편집기 밖 요소 전부 비인쇄 —
     본편의 점검 공지·모달·다른 화면이 같이 찍히는 것 방지 (sentence-workbook 패턴) */
  body.we-print-active > :not(#screen-editor) { display: none !important; }
  .we-bar1,
  .we-bar2,
  .we-rail,
  .we-panel,
  .we-pages,
  .we-pages-toggle,
  .we-ruler-top,
  .we-ruler-left,
  .we-ruler-corner,
  .we-pos-panel,
  .we-popover,
  .we-gallery,
  .we-confirm-overlay,
  .we-page-drop-marker,
  .we-thumb-drag-ghost,
  #weSelection,
  .no-print { display: none !important; }
  /* 숨겨진 편집기 루트를 다른 화면 인쇄에서 되살리지 않는다.
     router의 inline display:none보다 !important가 강하므로 인쇄 활성 범위를 반드시 제한한다. */
  body.we-print-active .we-app {
    /* 본편 router가 인라인 display:grid를 주므로 !important — grid 트랙(바 높이)이
       마지막 페이지 뒤에 빈 인쇄 페이지를 만든다 */
    display: block !important;
    height: auto;
    background: #fff;
  }
  .we-canvas-area { position: static; }
  .we-viewport {
    display: block; /* 화면용 flex 중앙정렬 해제 — 인쇄는 페이지가 세로로 쌓여 페이지당 1장 */
    overflow: visible;
    padding: 0;
    width: auto;
    height: auto;
  }
  #wePageWrap { display: block !important; width: auto !important; height: auto !important; margin: 0; padding: 0 !important; }
  #wePageWrap > .we-page-slot {
    display: block !important;
    width: auto !important;
    height: auto !important;
    content-visibility: visible !important;
    contain: none !important;
    page-break-after: always;
    page-break-inside: avoid;
  }
  #wePageWrap > .we-page-slot > .we-page {
    display: block !important;
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    box-shadow: none;
    margin: 0;
    background-image: none !important; /* 격자 점 비인쇄 */
  }
  #wePageWrap > .we-page-slot:last-child { page-break-after: auto; }
  #weSelection,
  .we-marquee,
  .we-guides,
  .we-empty-hint,
  .we-drag-ghost { display: none !important; }
  .we-sel-lite { outline: none !important; }
  /* 칸 테두리·채움·이름표는 인쇄물의 일부 — 안내 문구·하이라이트만 제거 */
  .we-cell-hint { display: none; }
  .we-cell-hot { outline: none !important; }
  .we-cell-hot::after { display: none !important; }
}

/* ==========================================================================
   카테고리 허브 — '새 학습지' 첫 화면 오버레이 (2026-07-16 UX 개편, 시안 A-3)
   갤러리(.we-gallery) 베이스 위에 허브 전용 레이아웃만 얹는다.
   ========================================================================== */
/* 갤러리와 동일한 전체화면 시트(사용자 확정 2026-07-16) — 별도 크기의 라운드 팝업 아님 */
.we-hub { background: var(--we-app-bg); }
.we-hub-frame {
  height: 100%;
  background: #fff;
  box-shadow: 0 0 0 1px var(--we-border);
  overflow: hidden;
}
.we-hub-head { position: relative; padding: 20px 44px 0; text-align: center; flex: none; }
.we-hub-close { position: absolute; right: 20px; top: 18px; }
.we-hub-title { display: block; font-size: 25px; font-weight: 800; letter-spacing: -0.3px; color: var(--we-text); }
.we-hub-sub { margin: 7px 0 0; font-size: 14px; color: #6b6355; }
.we-hub-search {
  margin: 12px auto 0;
  width: min(520px, 90%);
  height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--we-border-strong);
  background: #fff;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
}
.we-hub-search { position: relative; padding-left: 40px; } /* we-search-ico가 absolute라 입력칸을 아이콘 뒤로 밀어준다 */
.we-hub-search input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--we-text);
}
.we-hub-search input::placeholder { color: #8a8172; }
.we-hub-search:focus-within { border-color: var(--we-accent); }
.we-hub-quick { display: flex; gap: 8px; justify-content: center; margin-top: 11px; }
.we-hub-chip {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--we-border-strong);
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #4c4539;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.we-hub-chip:hover { border-color: var(--we-accent); color: var(--we-accent); }
.we-hub-chip-count { color: #8a8172; font-weight: 600; }
.we-hub-chip-strong { border-color: var(--we-accent); color: var(--we-accent); }
.we-hub-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 44px 22px; }
.we-hub-sec { font-size: 13.5px; font-weight: 800; color: #6b6355; margin: 8px 0 9px; letter-spacing: 0.2px; }
.we-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 11px; } /* 1280 프레임에서 7열 — 카테고리 13이 2행, 기본 틀 1행으로 한 화면 수렴 */
.we-hub-card {
  display: block;
  text-align: left;
  background: #fff;
  border: 1px solid var(--we-border);
  border-radius: 13px;
  box-shadow: 0 1px 2px rgba(60, 50, 30, 0.09), 0 5px 14px rgba(60, 50, 30, 0.06);
  padding: 11px 11px 10px;
  font: inherit;
  color: var(--we-text);
  cursor: pointer;
}
.we-hub-card:hover, .we-hub-card:focus-visible { border-color: var(--we-accent); outline: none; }
.we-hub-card-base { border-style: dashed; background: #f1eee8; }
.we-hub-thumbs { display: flex; gap: 8px; }
.we-hub-mini-wrap {
  flex: 1;
  min-width: 0;
  aspect-ratio: 210 / 297; /* A4 세로 비율 그대로 — 납작하게 누르지 않는다(사용자 피드백) */
  height: auto;
  background: #fff;
  border: 1px solid var(--we-border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.we-hub-mini-wrap .we-tpl-mini { width: 100%; height: 100%; }
.we-hub-mini-blank { background: #fff; }
.we-hub-card-name { display: block; font-size: 16px; font-weight: 800; margin-top: 10px; text-align: center; }
.we-hub-card-cnt { display: block; font-size: 12.5px; color: #8a8172; margin-top: 2px; text-align: center; }


/* 갤러리 = 대문의 결과 화면 (2026-07-16 UX 개편) — 사이드바 폐지, 뒤로가기 + 제목 + 넓은 여백 */
.we-gal-back {
  height: 34px;
  padding: 0 13px;
  margin-right: 14px;
  border-radius: 999px;
  border: 1px solid var(--we-border-strong);
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #4c4539;
  cursor: pointer;
  flex: none;
}
.we-gal-back:hover { border-color: var(--we-accent); color: var(--we-accent); }
.we-gal-title-count { margin-left: 8px; font-size: 14px; font-weight: 600; color: #8a8172; }
.we-gal-grid-wide { padding: 18px clamp(24px, 3.5vw, 56px) 30px; } /* 사이드바가 빠진 자리 — 좌우 숨쉴 여백(프레임 1280 기준) */
