/* pdf-editor 페이지 전용 CSS — 2026-07-30 인라인 <style>에서 외부화(방침: 인라인 제거 → assets/css/<slug>/<slug>.css).
   공통 컴포넌트는 common.css가 담당하며 여기엔 이 페이지(클러스터) 고유 규칙만 둔다. */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700&family=Noto+Serif+KR:wght@400;700&family=Nanum+Gothic:wght@400;700&family=Nanum+Myeongjo:wght@400;700&family=Gowun+Dodum&family=Gowun+Batang&family=Gaegu&family=Nanum+Pen+Script&family=Black+Han+Sans&family=Jua&display=swap');

.btn-main:disabled{opacity:0.5;cursor:not-allowed;transform:none;box-shadow:none;}

.btn-sub:disabled{opacity:0.45;cursor:not-allowed;transform:none;}
.tip-box{max-width:1000px;margin:12px auto 0;padding:12px 15px;border-radius:12px;background:rgba(var(--blue-rgb),0.05);border:1px solid rgba(var(--blue-rgb),0.08);}
/* PDF Upload */
.pdf-upload-area{width:100%;min-height:200px;border:2.5px dashed rgba(var(--heading-rgb),0.18);border-radius:var(--radius-lg);background:linear-gradient(135deg,rgba(var(--point-rgb),0.02),rgba(var(--blue-rgb),0.02));cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;transition:all 0.25s ease;text-align:center;padding:20px;}
.pdf-upload-area:hover, .pdf-upload-area.drag-over{border-color:var(--point);background:linear-gradient(135deg,rgba(var(--point-rgb),0.05),rgba(var(--blue-rgb),0.04));box-shadow:0 0 0 4px rgba(var(--point-rgb),0.08);}
.drop-zone-btn{display:inline-flex;align-items:center;gap:6px;padding:10px 20px;border-radius:999px;background:linear-gradient(135deg,var(--point),var(--point-dark));color:var(--surface);font-size:0.9rem;font-weight:700;border:0;cursor:pointer;box-shadow:0 8px 18px rgba(var(--point-rgb),0.22);pointer-events:none}
.pdf-upload-icon{font-size:2.6rem;line-height:1;margin-bottom:0;}

/* Top toolbar — Word/Acrobat style ribbon across the editor */
.doc-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:10px 12px;background:rgba(var(--surface-rgb),0.92);backdrop-filter:blur(8px);border:1px solid rgba(var(--heading-rgb),0.06);border-radius:14px;box-shadow:var(--shadow-sm);margin-bottom:14px;}
.doc-toolbar .tb-group{display:flex;align-items:center;gap:4px;}
.doc-toolbar .tb-divider{width:1px;height:22px;background:rgba(var(--heading-rgb),0.12);margin:0 4px;}
.doc-toolbar .tb-spacer{flex:1 1 auto;min-width:8px;}
.doc-toolbar button{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:36px;padding:0 10px;border:1.5px solid rgba(var(--heading-rgb),0.1);border-radius:8px;background:var(--surface);font-size:0.84rem;font-weight:700;color:var(--text-main);cursor:pointer;transition:all 0.15s;white-space:nowrap;}
.doc-toolbar button:hover:not(:disabled){border-color:rgba(var(--point-rgb),0.4);background:rgba(var(--point-rgb),0.04);color:var(--point);}
.doc-toolbar button:disabled{opacity:0.4;cursor:not-allowed;}
.doc-toolbar .tb-shape{min-width:34px;padding:0 6px;font-size:1rem;}
.doc-toolbar .tb-primary{background:linear-gradient(135deg,var(--point),var(--point-dark));color:var(--surface);border-color:transparent;box-shadow:0 6px 14px rgba(var(--point-rgb),0.22);}
.doc-toolbar .tb-primary:hover:not(:disabled){background:linear-gradient(135deg,var(--point-dark),var(--point));color:var(--surface);border-color:transparent;transform:translateY(-1px);}
@media(max-width:768px){
  .doc-toolbar{padding:8px 8px;gap:4px;overflow-x:auto;flex-wrap:nowrap;}
  .doc-toolbar button{padding:0 8px;font-size:0.8rem;min-height:34px;}
}

/* Editor layout — 3-column: thumbnails | canvas | sidebar.
   넓이 확보를 위해 사이드 컬럼을 슬림화했고, gap도 줄였음. */
.editor-layout{display:grid;grid-template-columns:140px minmax(0,1fr) 240px;gap:14px;margin-top:14px;}
.editor-layout.sidebar-collapsed{grid-template-columns:140px minmax(0,1fr) 0;gap:0 14px;}
.editor-layout.sidebar-collapsed .editor-sidebar{display:none;}
.editor-layout.thumbs-collapsed{grid-template-columns:0 minmax(0,1fr) 240px;gap:0 14px;}
.editor-layout.thumbs-collapsed.sidebar-collapsed{grid-template-columns:0 minmax(0,1fr) 0;gap:0;}
.editor-layout.thumbs-collapsed .thumbs-panel{display:none;}
.editor-layout > div:nth-child(2){min-width:0;}
/* 화면이 충분히 넓으면 사이드 컬럼을 더 키워 좋은 균형 */
@media(min-width:1400px){
  .editor-layout{grid-template-columns:160px minmax(0,1fr) 280px;gap:18px;}
  .editor-layout.sidebar-collapsed{grid-template-columns:160px minmax(0,1fr) 0;}
  .editor-layout.thumbs-collapsed{grid-template-columns:0 minmax(0,1fr) 280px;}
}

/* Thumbnail panel */
.thumbs-panel{background:rgba(var(--surface-rgb),0.88);border:1px solid rgba(var(--heading-rgb),0.06);border-radius:14px;padding:10px;box-shadow:var(--shadow-sm);max-height:calc(100vh - 180px);overflow-y:auto;display:flex;flex-direction:column;gap:8px;}
.thumbs-panel .thumb-header{font-size:0.74rem;font-weight:700;color:var(--text-sub);text-transform:uppercase;letter-spacing:0.07em;padding:2px 4px;}
.thumb-item{position:relative;cursor:pointer;border:2px solid transparent;border-radius:8px;background:var(--surface);overflow:hidden;transition:border-color 0.12s,transform 0.12s;}
.thumb-item:hover{border-color:rgba(var(--point-rgb),0.3);}
.thumb-item.active{border-color:var(--point);box-shadow:0 4px 12px rgba(var(--point-rgb),0.18);}
.thumb-item.deleted{opacity:0.4;}
.thumb-item.deleted::after{content:'삭제';position:absolute;top:4px;right:4px;padding:1px 6px;background:var(--point);color:var(--surface);font-size:0.66rem;font-weight:700;border-radius:4px;}
.thumb-item canvas, .thumb-item img{display:block;width:100%;height:auto;}
.thumb-item .thumb-num{position:absolute;bottom:2px;left:4px;font-size:0.68rem;font-weight:700;color:var(--text-main);background:rgba(var(--surface-rgb),0.85);padding:0 4px;border-radius:3px;}
.thumb-item .thumb-actions{position:absolute;top:3px;right:3px;display:flex;gap:2px;opacity:0;transition:opacity 0.12s;}
.thumb-item:hover .thumb-actions, .thumb-item.active .thumb-actions{opacity:1;}
.thumb-item .thumb-act{width:20px;height:20px;padding:0;border:none;border-radius:50%;background:rgba(31,41,55,0.85);color:var(--surface);font-size:0.78rem;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background 0.12s,transform 0.12s;}
.thumb-item .thumb-act:hover{background:var(--text-main);transform:scale(1.1);}
.thumb-item .thumb-act-del{background:rgba(220,53,69,0.85);}
.thumb-item .thumb-act-del:hover{background:#dc3545;}
.thumb-item.dragging{opacity:0.4;}
.thumb-item.drop-before{box-shadow:0 -3px 0 var(--blue);}
.thumb-item.drop-after{box-shadow:0 3px 0 var(--blue);}
.thumb-item.inserted::before{content:'NEW';position:absolute;top:3px;left:3px;padding:1px 4px;background:var(--blue);color:var(--surface);font-size:0.6rem;font-weight:700;border-radius:3px;z-index:2;}
/* 빈 페이지 추가 버튼 */
.thumbs-add-btn{width:100%;min-height:50px;padding:8px;border:2px dashed rgba(var(--blue-rgb),0.3);border-radius:8px;background:rgba(var(--blue-rgb),0.04);color:var(--blue);font-weight:700;font-size:0.82rem;cursor:pointer;transition:all 0.15s;margin-top:6px;}
.thumbs-add-btn:hover{border-color:rgba(var(--blue-rgb),0.6);background:rgba(var(--blue-rgb),0.09);}
/* Canvas wrap defines the visible viewport. Zooming makes the canvas grow
   inside this box (with scrollbars) rather than expanding the box itself. */
.editor-canvas-wrap{background:rgba(var(--surface-rgb),0.88);border:1px solid rgba(var(--heading-rgb),0.06);border-radius:14px;padding:14px;box-shadow:var(--shadow-sm);min-height:460px;max-height:calc(100vh - 220px);overflow:auto;display:block;text-align:center;scrollbar-gutter:stable;min-width:0;max-width:100%;}
.editor-canvas-wrap::-webkit-scrollbar{width:10px;height:10px;}
.editor-canvas-wrap::-webkit-scrollbar-thumb{background:rgba(var(--heading-rgb),0.18);border-radius:999px;}
.editor-canvas-wrap::-webkit-scrollbar-thumb:hover{background:rgba(var(--heading-rgb),0.3);}
.editor-canvas-wrap::-webkit-scrollbar-track{background:transparent;}
/* Signature drawing modal — uses the same look as the stamp page's 서명 tab */
.sign_wrapper{position:relative;max-width:900px;margin:0 auto;padding:14px;background:rgba(var(--surface-rgb),0.9);border:1px solid rgba(var(--heading-rgb),0.06);border-radius:18px;box-shadow:var(--shadow-sm);}
#signaturePadCanvas{width:100%;height:280px;display:block;border:2px dashed rgba(var(--heading-rgb),0.15);border-radius:14px;background:linear-gradient(180deg,rgba(var(--surface-rgb),0.97),rgba(var(--surface-rgb),0.92));touch-action:none;cursor:crosshair;}
.sign-color-row{display:flex;justify-content:center;align-items:center;gap:10px;margin-top:10px;}
/* Shape drawing mode — drag-to-create */
.pdf-stage.drawing-mode{cursor:crosshair;}
.pdf-stage.drawing-mode #pdfCanvas, .pdf-stage.drawing-mode .overlay-layer{cursor:crosshair;}
.shape-add-btn.active{background:rgba(var(--point-rgb),0.12)!important;color:var(--point)!important;border-color:var(--point)!important;}

/* Spacebar pan mode — disables overlay interactions and shows grab cursor */
.editor-canvas-wrap.pan-mode, .editor-canvas-wrap.pan-mode *{cursor:grab!important;user-select:none;-webkit-user-select:none;}
.editor-canvas-wrap.pan-mode.panning, .editor-canvas-wrap.pan-mode.panning *{cursor:grabbing!important;}
.editor-canvas-wrap.pan-mode .overlay-item{pointer-events:none!important;}
.pdf-stage{position:relative;display:inline-block;background:#e8e8e8;background-image:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0;border-radius:8px;box-shadow:0 8px 24px rgba(var(--heading-rgb),0.12);overflow:hidden;vertical-align:top;}
.pdf-stage.page-deleted::after{content:'삭제 예약됨 — 다운로드 시 제외';position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);padding:10px 18px;background:rgba(220,53,69,0.92);color:var(--surface);font-weight:700;font-size:0.95rem;border-radius:8px;box-shadow:0 8px 22px rgba(220,53,69,0.4);pointer-events:none;}
.pdf-stage.page-deleted #pdfCanvas{opacity:0.35;filter:grayscale(0.6);}
#pdfCanvas{display:block;height:auto;border-radius:8px;}
/* z-index:2 = textLayer(z1) 위 — 텍스트 선택 레이어가 텍스트박스/이미지 아이템의 클릭·드래그를 가로채지 않게(2026-08-10) */
.overlay-layer{position:absolute;inset:0;pointer-events:none;z-index:2;}
/* Detection hints (form fields / signature spots) */
.hint-layer{position:absolute;inset:0;pointer-events:none;z-index:5;}
.hint-marker{position:absolute;pointer-events:auto;border:2px solid rgba(var(--blue-rgb),0.85);border-radius:4px;background:rgba(var(--blue-rgb),0.18);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background 0.12s,box-shadow 0.12s;box-shadow:0 0 0 2px rgba(var(--blue-rgb),0.18);animation:hintPulse 1.5s ease-in-out infinite;}
.hint-marker:hover{background:rgba(var(--blue-rgb),0.32);box-shadow:0 0 0 4px rgba(var(--blue-rgb),0.25);}
.hint-marker .hint-label{position:absolute;top:-22px;left:0;padding:1px 6px;background:var(--blue);color:var(--surface);font-size:0.68rem;font-weight:700;border-radius:4px;white-space:nowrap;box-shadow:0 2px 6px rgba(0,0,0,0.15);}
.hint-marker.sign-spot{border-color:rgba(220,53,69,0.85);background:rgba(220,53,69,0.18);box-shadow:0 0 0 2px rgba(220,53,69,0.18);}
.hint-marker.sign-spot:hover{background:rgba(220,53,69,0.32);box-shadow:0 0 0 4px rgba(220,53,69,0.25);}
.hint-marker.sign-spot .hint-label{background:var(--point);}
@keyframes hintPulse{0%,100%{opacity:1;}50%{opacity:0.7;}}
.overlay-item{position:absolute;pointer-events:auto;cursor:move;border:1.5px dashed transparent;transition:border-color 0.15s;user-select:none;}
.overlay-item.selected{border-color:var(--point);background:rgba(var(--point-rgb),0.04);}
.overlay-item.text-item{padding:2px 4px;line-height:1.15;font-family:'Noto Sans KR',sans-serif;color:var(--text-main);display:flex;align-items:center;}
.overlay-item .text-inner{display:inline-block;width:100%;min-height:1em;white-space:pre-wrap;word-break:break-word;pointer-events:none;outline:none;}
.overlay-item.text-item.editing{border-color:var(--blue);background:rgba(var(--blue-rgb),0.06);cursor:text;box-shadow:0 0 0 2px rgba(var(--blue-rgb),0.15);}
.overlay-item.text-item.editing .text-inner{pointer-events:auto;cursor:text;user-select:text;-webkit-user-select:text;}
.overlay-item.editing .resize-handle, .overlay-item.editing .rotate-handle, .overlay-item.editing .rotate-line, .overlay-item.editing .delete-btn{display:none!important;}
.overlay-item img{width:100%;height:100%;display:block;pointer-events:none;-webkit-user-drag:none;}
.overlay-item .resize-handle{position:absolute;width:14px;height:14px;background:var(--surface);border:2px solid var(--point);border-radius:50%;box-shadow:0 2px 6px rgba(var(--point-rgb),0.3);display:none;}
.overlay-item.selected .resize-handle{display:block;}
.overlay-item .resize-handle.br{right:-7px;bottom:-7px;cursor:nwse-resize;}
.overlay-item .rotate-handle{position:absolute;top:-32px;left:50%;width:16px;height:16px;margin-left:-8px;background:var(--blue);border:2px solid var(--surface);border-radius:50%;cursor:grab;box-shadow:0 2px 6px rgba(var(--blue-rgb),0.3);display:none;}
.overlay-item.selected .rotate-handle{display:block;}
.overlay-item .rotate-line{position:absolute;top:-20px;left:50%;width:1.5px;height:20px;background:var(--blue);opacity:0.5;display:none;}
.overlay-item.selected .rotate-line{display:block;}
.overlay-item .delete-btn{position:absolute;top:-12px;right:-12px;width:24px;height:24px;background:var(--point);color:var(--surface);border:2px solid var(--surface);border-radius:50%;font-size:14px;line-height:18px;text-align:center;cursor:pointer;font-weight:700;box-shadow:0 3px 8px rgba(var(--point-rgb),0.35);display:none;}
.overlay-item.selected .delete-btn{display:block;}

.editor-sidebar{display:flex;flex-direction:column;gap:12px;}
.sidebar-card{padding:14px 16px;background:rgba(var(--surface-rgb),0.88);border:1px solid rgba(var(--heading-rgb),0.06);border-radius:14px;box-shadow:var(--shadow-sm);}
.sidebar-card h3{margin:0 0 10px;font-size:0.95rem;font-weight:700;color:var(--heading);}
.sidebar-actions{display:flex;flex-direction:column;gap:8px;}
.sidebar-actions .btn-sub, .sidebar-actions .btn-main{width:100%;min-width:0;line-height:1;}

.page-nav{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:12px;flex-wrap:wrap;}
.page-nav button{min-width:42px;min-height:38px;padding:0 12px;border:1.5px solid rgba(var(--heading-rgb),0.1);border-radius:8px;background:var(--surface);cursor:pointer;font-weight:700;font-size:0.88rem;color:var(--text-main);transition:all 0.15s;}
.page-nav button:hover:not(:disabled){border-color:rgba(var(--point-rgb),0.4);background:rgba(var(--point-rgb),0.04);}
.page-nav button:disabled{opacity:0.4;cursor:not-allowed;}
.page-indicator{font-size:0.92rem;font-weight:700;color:var(--text-sub);padding:0 12px;}
.zoom-nav{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:8px;flex-wrap:wrap;}
.zoom-nav .zoom-btn{min-width:34px;min-height:34px;padding:0 10px;border:1.5px solid rgba(var(--heading-rgb),0.1);border-radius:8px;background:var(--surface);cursor:pointer;font-weight:700;font-size:0.85rem;color:var(--text-main);transition:all 0.15s;}
.zoom-nav .zoom-btn:hover:not(:disabled){border-color:rgba(var(--blue-rgb),0.4);background:rgba(var(--blue-rgb),0.04);color:var(--blue);}
.zoom-nav .zoom-btn:disabled{opacity:0.35;cursor:not-allowed;}
.zoom-indicator{font-size:0.85rem;font-weight:700;color:var(--text-sub);min-width:48px;text-align:center;}
.zoom-divider{width:1px;height:22px;background:rgba(var(--heading-rgb),0.12);margin:0 4px;}

.font-row{display:flex;gap:8px;align-items:center;margin-top:8px;}
.font-row label{font-size:0.78rem;font-weight:700;color:var(--text-sub);white-space:nowrap;cursor:pointer;}
.font-row select{flex:1;height:34px;min-width:0;padding:0 10px;font-size:0.85rem;}
.font-row input[type="checkbox"]{cursor:pointer;}
.shortcut-hint{display:block;margin-top:6px;font-size:0.72rem;color:var(--text-sub);line-height:1.5;}
.shortcut-hint kbd{display:inline-block;padding:1px 5px;font-family:'SF Mono',Menlo,monospace;font-size:0.7rem;border:1px solid rgba(var(--heading-rgb),0.18);border-bottom-width:2px;border-radius:4px;background:var(--surface);color:var(--text-main);}

.slider-section{padding:10px 12px;background:rgba(var(--surface-rgb),0.78);border:1px solid rgba(var(--heading-rgb),0.05);border-radius:10px;display:flex;flex-direction:column;gap:8px;margin-bottom:8px;}
.slider-section-title{font-size:0.74rem;font-weight:700;color:var(--text-sub);text-transform:uppercase;letter-spacing:0.07em;padding-bottom:4px;border-bottom:1px solid rgba(var(--heading-rgb),0.07);}
.slider-lbl span:first-child{font-size:0.84rem;font-weight:600;color:var(--text-main);}
.slider-val{font-size:0.78rem;font-weight:700;color:var(--point);min-width:44px;text-align:right;}

input[type="text"], input[type="number"], textarea, select{height:38px;padding:0 12px;font-size:0.92rem;border:1px solid rgba(var(--heading-rgb),0.1);border-radius:10px;outline:none;background:var(--surface);transition:border-color 0.2s,box-shadow 0.2s;width:100%;font-family:inherit;}
textarea{height:auto;min-height:70px;padding:8px 12px;line-height:1.5;resize:vertical;}
input:focus, textarea:focus, select:focus{border-color:rgba(var(--blue-rgb),0.35);box-shadow:0 0 0 4px rgba(var(--blue-rgb),0.08);}

.element-list{display:flex;flex-direction:column;gap:6px;max-height:280px;overflow-y:auto;}
.element-list-item{display:flex;align-items:center;gap:8px;padding:8px 10px;background:rgba(var(--surface-rgb),0.78);border:1px solid rgba(var(--heading-rgb),0.06);border-radius:8px;cursor:pointer;transition:all 0.15s;}
.element-list-item:hover{border-color:rgba(var(--point-rgb),0.3);background:rgba(var(--point-rgb),0.03);}
.element-list-item.selected{border-color:var(--point);background:rgba(var(--point-rgb),0.06);box-shadow:0 0 0 1.5px rgba(var(--point-rgb),0.2);}
.element-list-item .el-icon{font-size:1rem;}
.element-list-item .el-label{flex:1;font-size:0.82rem;font-weight:600;color:var(--text-main);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.element-list-item .el-page{font-size:0.72rem;color:var(--text-sub);font-weight:700;}
.element-list-empty{padding:14px 8px;text-align:center;font-size:0.82rem;color:var(--text-sub);font-weight:600;}

.color-presets{display:flex;gap:8px;}
.color-btn{width:26px;height:26px;border-radius:50%;border:2px solid var(--surface);cursor:pointer;box-shadow:0 0 0 1px rgba(0,0,0,0.1);transition:transform 0.1s;}
/* 투명 표시: 작은 체커보드 패턴 + 사선 */
.color-btn.bg-transparent{background-color:var(--surface);background-image:linear-gradient(45deg,#d1d5db 25%,transparent 25%),linear-gradient(-45deg,#d1d5db 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#d1d5db 75%),linear-gradient(-45deg,transparent 75%,#d1d5db 75%);background-size:8px 8px;background-position:0 0,0 4px,4px -4px,-4px 0;}

.toolbar-row{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:10px;}
.empty-canvas-msg{padding:60px 20px;text-align:center;color:var(--text-sub);}
.empty-canvas-msg .icon{font-size:3rem;margin-bottom:8px;}

/* Download promo layer (matches Untitled-3 design) */

.ck-preview-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px;}
.ck-preview-actions .btn-main, .ck-preview-actions .btn-sub{flex:1 1 0;}

/* Mobile action bar — fixed at bottom on small screens for quick access */
.mobile-action-bar{position:fixed;bottom:0;left:0;right:0;display:none;align-items:stretch;gap:6px;padding:8px 8px calc(8px + env(safe-area-inset-bottom,0px));background:rgba(var(--surface-rgb),0.97);backdrop-filter:blur(10px);border-top:1px solid rgba(var(--heading-rgb),0.1);box-shadow:0 -8px 22px rgba(var(--heading-rgb),0.08);z-index:200;}
.mobile-action-bar button{flex:1;min-width:0;min-height:50px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border:1.5px solid rgba(var(--heading-rgb),0.08);border-radius:12px;background:var(--surface);font-size:1.15rem;line-height:1;color:var(--text-main);cursor:pointer;padding:6px 4px;transition:transform 0.12s,box-shadow 0.12s,border-color 0.12s;}
.mobile-action-bar button span{font-size:0.66rem;font-weight:700;color:var(--text-sub);}
.mobile-action-bar button.primary{background:linear-gradient(135deg,var(--point),var(--point-dark));color:var(--surface);border-color:transparent;box-shadow:0 6px 14px rgba(var(--point-rgb),0.25);}
.mobile-action-bar button.primary span{color:var(--surface);}
.mobile-action-bar button:active:not(:disabled){transform:translateY(1px);}
.mobile-action-bar button:disabled{opacity:0.4;}
/* 미리보기·다운로드 모달이 열리면 하단 액션바 숨김(전체화면 z-index 10001이 모달을 뚫고 겹치던 문제) */
body.ck-pdf-modal .mobile-action-bar{display:none!important;}

@media(max-width:900px){
  
  /* 단일 컬럼 — 썸네일 → 캔버스 → 사이드바 순으로 누적 */
  .editor-layout, .editor-layout.sidebar-collapsed, .editor-layout.thumbs-collapsed, .editor-layout.thumbs-collapsed.sidebar-collapsed{
    grid-template-columns:1fr;
    gap:10px;
  }
  /* 썸네일 패널 — 가로 스크롤 띠로 변환 */
  .thumbs-panel{
    max-height:none;
    padding:8px 10px;
  }
  .thumbs-panel .thumb-header{font-size:0.7rem;margin-bottom:2px;}
  .thumbs-panel #thumbsList{
    display:flex;
    flex-direction:row;
    gap:6px;
    overflow-x:auto;
    overflow-y:hidden;
    padding-bottom:4px;
    -webkit-overflow-scrolling:touch;
  }
  .thumbs-panel #thumbsList .thumb-item{
    flex:0 0 88px;
    width:88px;
  }
  .thumbs-add-btn{min-height:40px;font-size:0.78rem;}
  .thumbs-panel > p{display:none;} /* 도움말 텍스트 모바일에서는 숨김 */
  /* 사이드바 — 단축키 카드는 모바일에서 의미 적으므로 숨김 */
  .editor-sidebar > .sidebar-card:first-child{display:none;}
  /* 캔버스 wrap — 모바일에서 더 짧게 */
  .editor-canvas-wrap{min-height:50vh;max-height:calc(100vh - 280px);}
}
@media(max-width:768px){
  
  #pdf-editor-tool{padding:16px 12px 96px;}
  
  /* Show mobile action bar */
  .mobile-action-bar{display:flex;}
  /* Hide the sidebar toggle button on mobile (sidebar already stacks below) */
  #sidebarToggleBtn{display:none;}
  /* Larger touch targets for handles */
  .overlay-item .resize-handle{width:20px;height:20px;right:-10px;bottom:-10px;}
  .overlay-item .rotate-handle{width:22px;height:22px;margin-left:-11px;top:-36px;}
  .overlay-item .delete-btn{width:28px;height:28px;font-size:16px;line-height:22px;}
  .page-nav button, .zoom-nav .zoom-btn{min-height:42px;font-size:0.9rem;}
  /* Keep the canvas-area top toolbar compact */
  .zoom-nav{gap:4px;}
  /* 모바일 도구 모음 — 더 컴팩트 */
  .doc-toolbar{margin-bottom:8px;}
  .doc-toolbar .tb-divider{margin:0 2px;height:18px;}
  /* 히어로 카드 모바일 압축 */

  /* 캔버스 wrap — 더 컴팩트 패딩 */
  .editor-canvas-wrap{padding:10px;}
  /* 썸네일 항목 — 더 작게 */
  .thumbs-panel #thumbsList .thumb-item{flex:0 0 76px;width:76px;}
}
@media(max-width:480px){
  /* Hide secondary labels on tight screens */
  .zoom-nav .zoom-btn{padding:0 8px;font-size:0.8rem;}
  #undoBtn, #redoBtn{font-size:0;min-width:38px;padding:0;}
  #undoBtn::before{content:'↶';font-size:1rem;}
  #redoBtn::before{content:'↷';font-size:1rem;}
  #zoomFitBtn{font-size:0.78rem;}
  .ck-preview-layer{padding:16px;}
  .ck-preview-box{width:100%;padding:24px 22px;border-radius:18px;}
  .ck-preview-actions{flex-direction:column;}
  .ck-preview-actions .btn-main, .ck-preview-actions .btn-sub{width:100%;}
  /* 미리보기 모달은 모바일에서 화면 꽉 채워 iframe에 최대 공간 확보 */
  #pdfPreviewLayer{padding:0;}
  #pdfPreviewLayer .ck-preview-box{width:100%;max-width:100%;height:100%;max-height:100%;border-radius:0;padding:14px 14px calc(14px + env(safe-area-inset-bottom,0px));}
  #pdfPreviewLayer #pdfPreviewFrame{min-height:0;}
  #pdfPreviewLayer .ck-preview-actions{flex-direction:row;}
  #pdfPreviewLayer .ck-preview-actions .btn-main, #pdfPreviewLayer .ck-preview-actions .btn-sub{width:auto;}
  /* 도구 모음 — 좁은 화면에서 도형 라벨/구분선 슬림화 */
  .doc-toolbar .tb-shape{min-width:30px;padding:0 4px;}
  .doc-toolbar .tb-divider{display:none;} /* 좁은 화면에서 구분선 숨김 */
  .doc-toolbar button{font-size:0.78rem;padding:0 6px;min-height:32px;gap:2px;}
  /* 초기화 버튼은 라벨 숨기고 아이콘만 */
  #resetEditorBtn{font-size:0;min-width:32px;padding:0;}
  #resetEditorBtn::before{content:'↺';font-size:1rem;}
  /* 페이지 nav 컴팩트 */
  .page-nav{gap:4px;}
  .page-nav button{padding:0 8px;font-size:0.82rem;}
  .page-indicator{font-size:0.82rem;padding:0 6px;}
  /* 썸네일 항목 더 작게 */
  .thumbs-panel #thumbsList .thumb-item{flex:0 0 64px;width:64px;}
  /* 캔버스 wrap — 액션 바 자리까지 고려 */
  .editor-canvas-wrap{min-height:45vh;max-height:calc(100vh - 240px);}
}

/* pdf-editor — 인라인 style 이관(2026-08-04). 선택자 반복은 특정도 조절이다(오타 아님). */
.pdfx-1.pdfx-1{text-align:center;margin-top:16px}
.pdfx-2.pdfx-2.pdfx-2{font-size:0.7rem;color:var(--text-sub);margin:6px 4px 0;line-height:1.45}
.pdfx-3.pdfx-3{display:inline-block;padding:0 3px;font-size:0.7rem;border:1px solid #ccc;border-radius:2px;background:var(--surface)}
#selPageRow.pdfx-4{margin:0 0 12px;padding:10px 12px;background:#f1f5f9;border-radius:10px}
.pdfx-5.pdfx-5{display:block;font-size:0.8rem;color:var(--text-sub);margin-bottom:5px}
#selPage.pdfx-6{width:100%;padding:7px 10px;border:1px solid #cbd5e1;border-radius:8px;font-size:0.9rem;background:var(--surface);cursor:pointer}
.pdfx-7.pdfx-7.pdfx-7{font-size:0.78rem;color:var(--text-sub);margin:0 0 8px;line-height:1.5}
.pdfx-8.pdfx-8{display:inline-block;padding:0 4px;font-family:inherit;font-size:0.7rem;border:1px solid rgba(var(--heading-rgb),0.18);border-radius:3px;background:var(--surface)}
#selFontBold.pdfx-9{width:auto;height:auto;margin:0}
.pdfx-10.pdfx-10{margin-top:8px;margin-bottom:8px}
.pdfx-11.pdfx-11{background:var(--surface);box-shadow:0 0 0 1px rgba(var(--heading-rgb),0.18)}
#textBgCustom.pdfx-12, #shapeStrokeCustom.pdfx-12, #shapeFillCustom.pdfx-12{width:26px;height:26px;border:2px solid var(--surface);border-radius:50%;cursor:pointer;padding:0;box-shadow:0 0 0 1px rgba(var(--heading-rgb),0.18);background:transparent}
.pdfx-13.pdfx-13.pdfx-13{font-size:0.72rem;color:var(--text-sub);margin:6px 0 0;line-height:1.5}
#duplicateBtn.pdfx-14{flex:1;min-width:0}
#deleteBtn.pdfx-15{flex:1;min-width:0;border-color:rgba(var(--point-rgb),0.3);color:var(--point)!important}
.pdfx-16.pdfx-16{max-width:900px;width:min(100%,900px);display:flex;flex-direction:column;max-height:92vh}
.pdfx-17.pdfx-17{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;gap:8px;flex-wrap:wrap}
#pdfPreviewFrame.pdfx-18{flex:1;width:100%;min-height:60vh;border:1px solid rgba(var(--heading-rgb),0.1);border-radius:12px;background:#f9fafb}
.pdfx-19.pdfx-19{max-width:760px;width:min(100%,760px)}
.pdfx-20.pdfx-20{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;gap:8px}
.pdfx-21.pdfx-21.pdfx-21{margin:0 0 12px;font-size:0.92rem;color:var(--text-sub);line-height:1.6}

/* 원문 텍스트 선택·복사 레이어(pdf.js textLayer, 2026-08-08) — 캔버스 위·오버레이 아래 */
.textLayer{position:absolute;left:0;top:0;overflow:hidden;line-height:1;z-index:1;pointer-events:auto;forced-color-adjust:none;}
.textLayer span,.textLayer br{position:absolute;color:transparent;white-space:pre;transform-origin:0 0;cursor:text;}
.textLayer span::selection{background:rgba(37,99,235,0.32);}
/* 도형 그리기·팬 모드에서는 드로잉/이동이 우선 — 텍스트 레이어 이벤트 차단 */
.pdf-stage.drawing-mode .textLayer,.editor-canvas-wrap.pan-mode .textLayer{pointer-events:none;}
