/* ================================================
   일심초대장 2.0 - 에디터 스타일
   ================================================ */

/* 에디터 전용 body */
.editor-body {
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f0ede8;
}
.editor-body .bg-deco { display: none; }

/* ── 상단 툴바 ── */
.ed-header {
    height: 52px;
    background: #fff;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 12px;
    flex-shrink: 0;
    z-index: 10;
}
.ed-header-left  { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ed-header-center { display: flex; align-items: center; gap: 4px; }
.ed-header-right  { display: flex; align-items: center; gap: 8px; }

.ed-logo {
    font-family: var(--font-serif);
    font-size: 16px;
    color: var(--gold);
    font-style: italic;
    white-space: nowrap;
}
.ed-sep { color: var(--text3); }
.ed-title-input {
    background: none;
    border: none;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text);
    font-weight: 500;
    min-width: 0;
    flex: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: 0.2s;
}
.ed-title-input:hover { background: rgba(0,0,0,0.04); }
.ed-title-input:focus { outline: none; background: rgba(0,0,0,0.06); }

.ed-view-btn {
    padding: 5px 14px;
    font-size: 13px;
    border-radius: 6px;
    color: var(--text3);
    font-family: var(--font-sans);
    transition: 0.2s;
    border: 1px solid transparent;
}
.ed-view-btn:hover { color: var(--text); background: rgba(0,0,0,0.05); }
.ed-view-btn.active { color: var(--text); background: rgba(0,0,0,0.08); border-color: rgba(0,0,0,0.1); }

/* ── 에디터 본문 ── */
.ed-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* ── 왼쪽 사이드바 (페이지 목록) ── */
.ed-sidebar {
    width: 120px;
    flex-shrink: 0;
    align-self: stretch;   /* ed-body 높이에 맞게 늘어남 → page-list 스크롤 작동 */
    background: #fff;
    border-right: 1px solid rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}
.ed-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.ed-add-page-btn {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.ed-add-page-btn:hover { background: var(--gold2); transform: scale(1.1); }

/* ── 뷰 모드 바 (사이드바 하단) ── */
.ed-view-mode-bar {
    flex-shrink: 0; /* 항상 하단 고정 */
    padding: 8px 10px;
    border-top: 1px solid rgba(0,0,0,0.06);
    background: #faf9f7;
}
.ed-view-mode-label {
    font-size: 10px;
    color: var(--text3);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 5px;
    font-weight: 500;
}
.ed-view-mode-btns {
    display: flex;
    gap: 4px;
}
.ed-view-mode-btn {
    flex: 1;
    padding: 5px 2px;
    font-size: 10px;
    font-family: var(--font-sans);
    border-radius: 5px;
    border: 1px solid rgba(0,0,0,0.1);
    background: #fff;
    color: var(--text3);
    cursor: pointer;
    transition: 0.15s;
    text-align: center;
    white-space: nowrap;
    font-weight: 400;
}
.ed-view-mode-btn:hover { border-color: var(--gold); color: var(--gold); }
.ed-view-mode-btn.active {
    background: var(--gold);
    color: #fff;
    border-color: var(--gold);
    font-weight: 500;
}

.ed-page-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
}
.ed-page-list::-webkit-scrollbar { width: 4px; }
.ed-page-list::-webkit-scrollbar-track { background: transparent; }
.ed-page-list::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
}
.ed-page-list::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.28); }

/* 페이지 썸네일 */
.ed-page-thumb {
    width: 100%;
    aspect-ratio: 9/16;
    min-height: 60px;      /* 이 이하로는 안 줄어들고 스크롤 발생 */
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: 0.2s;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.ed-page-thumb:hover { transform: scale(1.02); box-shadow: 0 4px 14px rgba(0,0,0,0.15); }
.ed-page-thumb.active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,74,0.2); }
.ed-page-thumb.dragging { opacity: 0.35; transform: scale(0.96); }
.ed-page-thumb.drag-over { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,74,0.4); transform: scale(1.04); }
.ed-page-drag-handle {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    cursor: grab;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.15s;
    user-select: none;
    line-height: 1;
}
.ed-page-thumb:hover .ed-page-drag-handle { opacity: 1; }
.bg-img-overlay {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.bg-img-overlay img { position: absolute; max-width: none; }
.ed-page-num {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    background: rgba(0,0,0,0.4);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
}
.ed-page-thumb-inner {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: rgba(0,0,0,0.2);
}

/* ── 중앙 캔버스 ── */
.ed-canvas-wrap {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 30px 56px 30px 20px;
    background: #e8e4de;
    box-sizing: border-box;
}

/* 캔버스 스케일러 — 레이아웃 폭은 380px로 고정한 채, 화면이 좁을 때는
   JS(transform:scale)로 시각적으로만 축소한다. 이렇게 해야 텍스트 줄바꿈이
   뷰 화면(.vw-page-scaler)과 항상 동일하게 계산된다. */
.ed-canvas-scaler {
    flex-shrink: 0;
    position: relative;
    margin: 0 auto;
}

.ed-canvas {
    width: 380px;
    min-height: 640px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    transition: background 0.3s;
    flex-shrink: 0;
}

/* 캔버스 배경 타입별 */
.ed-canvas.bg-image {
    background-size: cover;
    background-position: center;
}
.ed-canvas.bg-pattern {
    background-repeat: repeat;
}

/* 모듈 드롭존 */
.ed-drop-zone {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(0,0,0,0.1);
    border-radius: 8px;
    margin: 10px;
    color: rgba(0,0,0,0.2);
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
}
.ed-drop-zone:hover, .ed-drop-zone.dragover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(184,134,74,0.05);
}

/* 모듈 래퍼 */
.ed-module {
    margin: 8px 8px;
    position: relative;
    border-radius: 6px;
    outline: 2px solid transparent;
    outline-offset: -2px;
    transition: outline-color 0.15s;
    overflow: visible;
    z-index: 1;
    min-height: 36px;
}
.ed-module:hover { outline-color: rgba(184,134,74,0.4); }
.ed-module.selected { outline-color: var(--gold); z-index: 2; /* 툴바가 인접 모듈에 가려지지 않도록 */ }

/* 모듈 툴바 - 모듈 바로 위에 */
.ed-module-toolbar {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 3px;
    flex-direction: row;
    background: var(--gold);
    border-radius: 6px;
    padding: 4px;
    gap: 2px;
    z-index: 100;
    white-space: nowrap;
}
.ed-module.selected .ed-module-toolbar { display: flex; }

/* 첫 번째 모듈 선택 시 툴바를 아래로 뒤집기 (캔버스 상단 침범 방지) */
#edCanvas .ed-module:not(.ed-module ~ .ed-module) > .ed-module-toolbar {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 3px;
}
.ed-module-tb-btn {
    width: 24px; height: 24px;
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    transition: 0.15s;
}
.ed-module-tb-btn:hover { background: rgba(0,0,0,0.2); }

/* ── 오른쪽 패널 ── */
.ed-panel {
    width: 240px;
    flex-shrink: 0;
    background: #fff;
    border-left: 1px solid rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ed-panel-tabs {
    display: flex;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}
.ed-tab {
    flex: 1;
    padding: 12px;
    font-size: 13px;
    font-family: var(--font-sans);
    color: var(--text3);
    border-bottom: 2px solid transparent;
    transition: 0.2s;
}
.ed-tab:hover { color: var(--text); }
.ed-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.ed-tab-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.ed-panel-section {
    padding: 16px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.ed-panel-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

/* 배경 유형 버튼 */
.ed-bg-type-btns { display: flex; gap: 6px; }
.ed-bg-type {
    flex: 1;
    padding: 7px;
    font-size: 12px;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    font-family: var(--font-sans);
    color: var(--text2);
    transition: 0.2s;
}
.ed-bg-type:hover { border-color: var(--gold); color: var(--gold); }
.ed-bg-type.active { background: var(--gold); border-color: var(--gold); color: #fff; }

/* 색상 피커 */
.ed-color-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ed-color-row input[type="color"] {
    width: 44px; height: 36px;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    flex-shrink: 0;
}
.ed-color-text {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    background: var(--bg2);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 6px;
    padding: 7px 8px;
    font-size: 12px;
    font-family: monospace;
    color: var(--text);
}
.ed-color-text:focus { outline: none; border-color: var(--gold); }

/* 색상 프리셋 */
.ed-color-presets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-top: 4px;
}
.ed-color-preset {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;   /* 원 → 둥근 사각 — 더 크게 보임 */
    border: 2px solid rgba(0,0,0,0.08);
    cursor: pointer;
    transition: 0.15s;
}
.ed-color-preset:hover { transform: scale(1.08); border-color: var(--gold); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.ed-color-preset.active { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }

/* 업로드 영역 */
.ed-upload-area {
    border: 2px dashed rgba(0,0,0,0.12);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    color: var(--text3);
    font-size: 13px;
    transition: 0.2s;
    position: relative;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ed-upload-area:hover { border-color: var(--gold); color: var(--gold); }
.ed-remove-btn {
    position: absolute; top: 6px; right: 6px;
    background: rgba(0,0,0,0.5); color: #fff;
    width: 22px; height: 22px;
    border-radius: 50%; font-size: 11px;
    display: flex; align-items: center; justify-content: center;
}

/* select */
.ed-select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg2);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font-sans);
    color: var(--text);
}
.ed-select:focus { outline: none; border-color: var(--gold); }

/* 패턴 그리드 */
.ed-pattern-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.ed-pattern-item {
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    overflow: hidden;
    background-size: 30px;
    transition: 0.2s;
}
.ed-pattern-item:hover { border-color: var(--gold); transform: scale(1.05); }
.ed-pattern-item.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,134,74,0.3); }

/* 모듈 추가 리스트 */
/* 모듈 추가 그리드 */
.ed-module-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.ed-module-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 8px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    text-align: center;
    transition: 0.2s;
    cursor: pointer;
    background: var(--bg2);
    font-family: var(--font-sans);
    gap: 4px;
}
.ed-module-item:hover { border-color: var(--gold); background: rgba(184,134,74,0.05); }
.ed-module-icon { font-size: 24px; line-height: 1; }
.ed-module-name { font-size: 12px; font-weight: 500; color: var(--text); }
.ed-module-desc { display: none; }
.ed-module-coming { opacity: 0.45; cursor: not-allowed; }
.ed-module-coming:hover { border-color: rgba(0,0,0,0.08); background: var(--bg2); }

/* ── 미리보기 모드 ── */
.ed-body.preview-mode .ed-sidebar,
.ed-body.preview-mode .ed-panel { display: none; }
.ed-body.preview-mode .ed-canvas-wrap { padding: 20px; }
.ed-body.preview-mode .ed-module { border-color: transparent !important; }
.ed-body.preview-mode .ed-drop-zone { display: none; }

/* ══════════════════════════════════════
   모바일 - 하단 탭바 방식
══════════════════════════════════════ */
@media (max-width: 768px) {

    .editor-body { height: 100dvh; }

    /* 모바일 툴바 z-index - 페이지바 위에 */
    .ed-module-toolbar { z-index: 200; }

    /* 헤더 간소화 */
    .ed-header { padding: 0 12px; gap: 8px; }
    .ed-header-center { display: none; }
    .ed-logo { font-size: 14px; }
    .ed-title-input { font-size: 13px; }

    /* 본문 세로 배치 */
    .ed-body { flex-direction: column; overflow: hidden; min-height: 0; padding-bottom: 52px; box-sizing: border-box; }

    /* 사이드바 → 상단 가로 스크롤 (기본 숨김) */
    .ed-sidebar {
        width: 100%;
        height: 88px;
        max-height: 88px;
        align-self: auto;  /* 데스크탑 stretch 리셋 */
        flex-shrink: 0;
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.08);
        flex-direction: row;
        align-items: center;
        position: relative;
        z-index: 1;
        display: none;
        overflow: visible;
    }
    .ed-sidebar.mobile-open {
        display: flex;
    }
    .ed-view-mode-bar { display: none; }
    .ed-sidebar-head {
        width: auto; padding: 0 10px; border-bottom: none;
        border-right: 1px solid rgba(0,0,0,0.08);
        height: 100%; flex-direction: column;
        justify-content: center; gap: 6px; flex-shrink: 0;
    }
    .ed-sidebar-head span { writing-mode: vertical-rl; font-size: 10px; }
    .ed-add-page-btn { width: 26px; height: 26px; font-size: 18px; }
    .ed-page-list {
        flex-direction: row; overflow-x: auto; overflow-y: hidden;
        padding: 8px 10px; gap: 8px; align-items: center;
        -webkit-overflow-scrolling: touch;
    }
    .ed-page-thumb { width: 44px; min-width: 44px; aspect-ratio: 9/16; flex-shrink: 0; }
    .ed-page-num { font-size: 9px; padding: 1px 4px; }

    /* 캔버스 */
    .ed-canvas-wrap {
        flex: 1; padding: 44px 10px 10px; overflow: auto;
        display: flex; justify-content: center; align-items: flex-start;
        box-sizing: border-box; width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    .ed-canvas {
        min-height: 480px;
        border-radius: 8px;
        overflow: visible;
        /* width는 항상 380px 고정(기본 규칙 유지) — 줄바꿈이 뷰와 100% 동일해짐.
           화면이 좁을 때 축소는 .ed-canvas-scaler에 적용되는 JS transform이 담당한다. */
    }

    /* 모듈 선택시 하단 액션바 */
    .ed-module-actionbar {
        display: none;
        position: fixed;
        bottom: calc(52px + env(safe-area-inset-bottom)); /* 탭바 높이만큼 */
        left: 0; right: 0;
        background: #fff;
        border-top: 1px solid rgba(0,0,0,0.1);
        padding: 8px 16px;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        z-index: 100;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
    }
    .ed-module-actionbar.visible { display: flex; }
    .ed-module-actionbar-label {
        flex: 1;
        font-size: 12px;
        color: var(--text3);
        font-family: var(--font-sans);
    }
    .ed-module-actionbar .act-btn {
        display: flex; align-items: center; justify-content: center;
        width: 36px; height: 36px;
        border-radius: 8px;
        border: 1px solid rgba(0,0,0,0.1);
        font-size: 16px;
        background: var(--bg2);
        color: var(--text2);
        transition: 0.15s;
    }
    .ed-module-actionbar .act-btn:hover { background: rgba(184,134,74,0.1); border-color: var(--gold); }
    .ed-module-actionbar .act-btn.del { color: var(--rose); border-color: rgba(192,96,122,0.2); }

    /* 하단 패널 */
    .ed-panel {
        width: 100%; height: 0; border-left: none;
        border-top: 1px solid rgba(0,0,0,0.1);
        transition: height 0.3s cubic-bezier(0.4,0,0.2,1);
        overflow: hidden; flex-shrink: 0; position: relative;
    }
    .ed-panel.open { height: 45vh; }
    .ed-panel-handle {
        display: flex; justify-content: center; padding: 8px; cursor: pointer;
        position: sticky; top: 0; background: #fff; z-index: 1;
    }
    .ed-panel-handle::after {
        content: ''; width: 36px; height: 4px;
        background: rgba(0,0,0,0.15); border-radius: 2px;
    }

    /* 하단 탭바 - fixed로 항상 화면 하단 고정 */
    .ed-bottom-tabbar {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        display: flex !important;
        height: 52px;
        background: #fff;
        border-top: 1px solid rgba(0,0,0,0.08);
        z-index: 500;
        /* iOS 홈바 safe area 대응 */
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(52px + env(safe-area-inset-bottom));
    }
    .ed-bottom-tab {
        flex: 1; display: flex; flex-direction: column;
        align-items: center; justify-content: center; gap: 3px;
        font-size: 10px; color: var(--text3); transition: 0.2s;
        border: none; background: none; font-family: var(--font-sans);
    }
    .ed-bottom-tab .tab-icon { font-size: 18px; line-height: 1; }
    .ed-bottom-tab.active { color: var(--gold); }

    /* 탭 버튼 영역 배경 명시 — 투명하게 보이는 현상 방지 */
    .ed-panel-tabs {
        background: #fff;
        flex-shrink: 0;
        border-bottom: 1px solid rgba(0,0,0,0.1);
    }
    .ed-tab {
        padding: 10px 8px;
        background: transparent;
    }

    /* 탭 콘텐츠 — 하단 탭바(52px)에 가려지지 않도록 여백 */
    .ed-tab-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(52px + env(safe-area-inset-bottom) + 8px);
    }
    .ed-panel-section { padding: 12px 14px; }

    /* 미리보기 모드 */
    .ed-body.preview-mode .ed-sidebar { display: none; }
    .ed-body.preview-mode .ed-bottom-tabbar { display: none !important; }
    .ed-body.preview-mode .ed-panel { display: none; }
}

/* 하단 탭바: 데스크탑에서만 숨김 */
@media (min-width: 769px) {
    .ed-bottom-tabbar { display: none; }
}

/* ══════════════════════════════════════
   모듈 설정 모달
══════════════════════════════════════ */
.msm-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 9000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.msm-box {
    background: #fff;
    border-radius: 14px;
    width: 100%; max-width: 480px;
    max-height: 88vh;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.msm-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
}
.msm-title { font-size: 14px; font-weight: 600; font-family: var(--font-sans); }
.msm-close {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(0,0,0,0.06); color: var(--text2);
    font-size: 12px; display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.msm-close:hover { background: rgba(0,0,0,0.12); }
.msm-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
    overscroll-behavior: contain;
}
.msm-foot {
    padding: 12px 20px;
    border-top: 1px solid rgba(0,0,0,0.08);
    display: flex; justify-content: flex-end;
    flex-shrink: 0;
}

/* ── 모바일 (900px 이하): 바텀시트 ── */
@media (max-width: 900px) {
    .msm-overlay {
        align-items: flex-end;
        justify-content: stretch;
        padding: 0;
        background: rgba(0,0,0,0.25);   /* 캔버스 보이도록 반투명 */
    }
    .msm-overlay > .msm-box {
        width: 100%;
        max-width: 100%;
        /* 화면 절반 + 핸들 */
        max-height: 55vh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
    }
    /* 핸들 바 */
    .msm-head::before {
        content: '';
        position: absolute;
        top: 7px; left: 50%;
        transform: translateX(-50%);
        width: 36px; height: 4px;
        border-radius: 2px;
        background: rgba(0,0,0,0.15);
    }
    .msm-head {
        position: relative;
        padding-top: 18px;
    }
}

/* ── 1100px 이상: 우측 고정 사이드 패널 ── */
@media (min-width: 1100px) {
    .msm-overlay {
        inset: 0 0 0 auto;
        width: 420px;
        background: rgba(0,0,0,0.04);
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
        z-index: 8000;
        pointer-events: none;
        backdrop-filter: none;
    }
    .msm-overlay > .msm-box {
        width: 420px;
        max-width: 420px;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: -4px 0 24px rgba(0,0,0,0.14);
        border-left: 1px solid rgba(0,0,0,0.09);
        pointer-events: all;
    }
    .ed-body.msm-side-open .ed-canvas-wrap {
        padding-right: 436px;
        transition: padding-right 0.2s ease;
    }
}


.msm-section {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.msm-label {
    font-size: 11px; font-weight: 500; color: var(--text3);
    letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 8px;
}
.msm-input, .msm-select, .msm-textarea {
    width: 100%; padding: 8px 10px;
    background: #f7f5f2; border: 1px solid rgba(0,0,0,0.1);
    border-radius: 7px; font-size: 13px;
    font-family: var(--font-sans); color: var(--text);
    box-sizing: border-box;
}
.msm-textarea { resize: vertical; min-height: 72px; }
.msm-input:focus, .msm-select:focus, .msm-textarea:focus {
    outline: none; border-color: var(--gold);
}
.msm-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.msm-field { display: flex; flex-direction: column; gap: 8px; }
.msm-field .msm-label { margin-bottom: 0; padding-bottom: 2px; border-bottom: 1px solid rgba(0,0,0,0.06); }
.msm-range { width: 100%; accent-color: var(--gold); cursor: pointer; }
/* 슬라이더 전용 행 - 슬라이더 먼저, 제목이 줄 아래 */
.msm-slider-row {
    display: flex; flex-direction: column; gap: 4px;
    padding: 10px 0 6px;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.msm-slider-row:first-of-type { border-top: none; }
.msm-slider-label {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 11px; color: var(--text3);
}
.msm-slider-label span {
    font-size: 11px; font-weight: 500; color: var(--gold);
}
.msm-color {
    width: 38px; height: 36px; border: 1px solid rgba(0,0,0,0.1);
    border-radius: 7px; padding: 2px; cursor: pointer; flex-shrink: 0;
}
.msm-count-btn {
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.12); font-size: 18px; line-height: 1;
    background: #f7f5f2; color: var(--text); transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.msm-count-btn:hover { background: var(--gold); color: #fff; border-color: var(--gold); }
.msm-upload-area {
    border: 2px dashed rgba(0,0,0,0.12); border-radius: 8px;
    padding: 16px; text-align: center; cursor: pointer;
    color: var(--text3); font-size: 13px; transition: 0.2s;
}
.msm-upload-area:hover { border-color: var(--gold); color: var(--gold); }

/* 세그먼트 버튼 (포스터 테두리 위치 등) */
.msm-seg-group { display: flex; gap: 6px; margin-bottom: 10px; }
.msm-seg {
    flex: 1; padding: 7px 4px; font-size: 12px;
    border: 1px solid rgba(0,0,0,0.12); border-radius: 7px;
    background: #f7f5f2; color: var(--text2);
    cursor: pointer; transition: 0.2s; text-align: center;
}
.msm-seg.active { background: var(--gold); color: #fff; border-color: var(--gold); }

/* 포스터 프레임 모양 선택 버튼 */
.psm-frame-btn {
    display: flex; flex-direction: column; align-items: center;
    padding: 7px 4px 5px; border-radius: 8px; cursor: pointer;
    transition: 0.15s; gap: 4px;
    border: 1.5px solid rgba(0,0,0,0.1);
    background: #f7f5f2;
}
.psm-frame-btn:hover { border-color: rgba(184,134,74,0.5) !important; }
.psm-frame-btn.active { border-color: var(--gold) !important; background: rgba(184,134,74,0.08) !important; }

/* 레이어 카드 */
.msm-layer-card {
    background: #f7f5f2; border-radius: 10px;
    padding: 12px; margin-top: 10px;
    border: 1px solid rgba(0,0,0,0.06);
}

/* 포스터 이미지 드래그 오버레이 */
#psmDragOv { cursor: grab; }
#psmDragOv:active { cursor: grabbing; }

/* ── 포스터 레이어 핸들 ── */
.ed-layer-handle {
    touch-action: none;
    z-index: 10;
}
.ed-layer-handle:hover {
    border-color: var(--gold) !important;
    box-shadow: 0 0 0 2px rgba(184,134,74,0.35), inset 0 0 0 1px rgba(255,255,255,0.2) !important;
}
.ed-layer-popup {
    touch-action: none;
}
/* T 버튼 (레이어 추가) */
.ed-module-tb-layer {
    font-weight: 700;
    font-size: 12px;
    color: var(--gold) !important;
    border: 1px solid var(--gold) !important;
    border-radius: 4px;
    padding: 0 5px;
}
/* ── 탭 모듈 ── */
.ed-tabs-wrap {
    overflow: visible;
}
.ed-tabs-header {
    overflow: hidden;
}
.ed-tabs-btn {
    transition: background 0.15s, color 0.15s, font-weight 0.15s;
    outline: none;
    word-break: keep-all;
    line-height: 1.3;
}
.ed-tabs-btn:hover {
    opacity: 0.85;
}
.ed-tabs-body {
    min-height: 60px;
}
/* ── 계좌정보 설정 모달 ── */
.acc-del-grp, .acc-del-acc {
    background: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
    line-height: 1;
}
.acc-del-grp:hover, .acc-del-acc:hover { opacity: 0.6; }

.acc-bank { appearance: auto; }