/* =========================================
   1. 기본 설정 및 변수 (Variables & Reset)
   ========================================= */
:root { 
    --primary: #6366f1; 
    --primary-dark: #4f46e5;
    --text-main: #111827; 
    --text-sub: #4b5563;
    --bg-sidebar: #ffffff; 
    --bg-stage: #2b2b2b; /* 포토샵 스타일 진한 회색 배경 */
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { 
    box-sizing: border-box; 
    outline: none; 
    user-select: none; 
    -webkit-tap-highlight-color: transparent; 
}

/* 입력창 텍스트 선택 및 터치 허용 */
input, textarea, select {
    user-select: text !important;
    -webkit-user-select: text !important;
    touch-action: manipulation !important;
    font-family: inherit;
}

body { 
    margin: 0; 
    height: 100vh; 
    height: 100dvh; 
    overflow: hidden; 
    background: var(--bg-sidebar); 
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Nanum Gothic', sans-serif; 
    color: var(--text-main);
}

button, input, textarea, select { font-family: inherit; }
.canvas-container { margin: auto !important; }

/* =========================================
   2. 로딩 화면 & 우클릭 메뉴
   ========================================= */
#loading { 
    position: fixed; inset: 0; 
    background: rgba(255,255,255,0.95); 
    z-index: 20000; 
    display: none; 
    justify-content: center; align-items: center; flex-direction: column; 
    backdrop-filter: blur(5px); 
}
.loading-spin { 
    width: 50px; height: 50px; 
    border: 5px solid #e5e7eb; border-top: 5px solid var(--primary); 
    border-radius: 50%; 
    animation: spin 1s infinite; 
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#contextMenu {
    display: none;
    position: fixed;
    z-index: 99999;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    padding: 6px 0;
    width: 160px;
    font-size: 13px;
    color: #333;
}
.ctx-item {
    padding: 8px 15px;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: background 0.1s;
}
.ctx-item:hover { background: #f3f4f6; color: var(--primary); }
.ctx-divider { height: 1px; background: #e5e7eb; margin: 5px 0; }

/* =========================================
   3. 시작 화면 (Start Screen)
   ========================================= */
#startScreen { 
    position: fixed; inset: 0; 
    background: #fff; 
    z-index: 9999; 
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; 
    overflow-y: auto; 
    padding-bottom: 80px;
}

/* 히어로 섹션 */
.hero-section {
    width: 100%; padding: 50px 20px 30px;
    text-align: center; background: #fff; margin-bottom: 0px;
}
.hero-title { 
    font-size: 54px; font-weight: 900; color: #111; 
    letter-spacing: -0.04em; line-height: 1.1; margin-bottom: 0px; 
}
.hero-title span { 
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-desc { 
    font-size: 18px; color: #6b7280; font-weight: 500; 
    background: #f3f4f6; padding: 10px 24px; border-radius: 30px; display: inline-block; 
}

/* 퀵 메뉴 (제품 선택) */
.quick-menu-wrapper {
    width: 98%; max-width: 1200px;
    margin-bottom: 40px; padding: 0 10px;
}
.quick-menu-label {
    font-size: 15px; font-weight: 800; color: #374151;
    margin-bottom: 15px; text-align: center; text-transform: uppercase; letter-spacing: 0.05em;
}
/* 기존 .quick-menu-track 부분을 아래 코드로 교체하세요 */
.quick-menu-track {
    display: flex;             /* grid에서 flex로 변경 */
    flex-wrap: wrap;           /* 줄바꿈 허용 */
    justify-content: center;   /* 가로축 완전 중앙 정렬 */
    gap: 15px;                 /* 간격 조정 */
    width: 100%;
}

.quick-item {
    display: flex; 
    flex-direction: column; 
    align-items: center;
    width: 110px;              /* 아이템 너비를 고정하여 균일하게 배치 */
    cursor: pointer;
    transition: transform 0.2s;
    margin-bottom: 5px; 
    background: #f9fafb;
    border-radius: 16px; 
    padding: 12px 5px; 
    border: 1px solid transparent;
}
.quick-item:hover { 
    transform: translateY(-5px); background: #fff; 
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}
.quick-icon {
    width: 60px; height: 60px; 
    background: #1f2937; border-radius: 18px; 
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-size: 26px; color: white;
    margin-bottom: 8px; transition: all 0.2s;
}
.quick-item:hover .quick-icon {
    background: var(--primary);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.4);
}
.quick-text {
    font-size: 13px; color: #374151; font-weight: 700;
    text-align: center; letter-spacing: -0.02em; white-space: nowrap;
}

/* 템플릿 갤러리 (시작화면) */
.gallery-section { width: 96%; max-width: 1600px; margin-top: 10px; }
.gallery-header { 
    text-align: center; margin-bottom: 30px; 
    font-size: 16px; font-weight: 800; color: #474747; 
    display: flex; align-items: center; justify-content: center; gap: 15px;
}
.gallery-header::before, .gallery-header::after { content: ''; height: 2px; width: 40px; background: #e5e7eb; }

.template-grid-start { 
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 가로 6개 강제 설정 */
    gap: 20px; 
    width: 100%; 
}

/* [수정] 정사각 프레임 적용 */
.tpl-card-start {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1; /* 정사각형 비율 강제 */
    background: #f8fafc; /* 이미지 로딩 전 배경색 */
    border-radius: 16px; overflow: hidden;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    position: relative; /* 뱃지 위치 기준 */
}

/* [수정] 이미지가 정사각형 영역을 꽉 채우도록 설정 */
.tpl-card-img { 
    width: 100%; 
    height: 100%;       /* 높이도 100% */
    object-fit: cover;  /* 비율 유지하며 꽉 채우기 (잘림 발생) */
    display: block; 
    transition: transform 0.3s; 
}
.tpl-card-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.05); opacity: 0; transition: 0.2s;
    pointer-events: none;
}
.tpl-card-start:hover .tpl-card-overlay { opacity: 1; }

/* =========================================
   4. 메인 에디터 레이아웃 (Editor UI)
   ========================================= */
#mainEditor { display: none; width: 100vw; height: 100vh; height: 100dvh; flex-direction: column; }

/* 상단바 (Topbar) */
.topbar { 
    height: 60px; display: flex; align-items: center; 
    padding: 0 25px; background: #fff; border-bottom: 1px solid var(--border); 
    gap: 10px; z-index: 100; justify-content: space-between; 
    overflow-x: auto; white-space: nowrap; 
}
.topbar::-webkit-scrollbar { display: none; }
.brand { font-weight: 800; font-size: 22px; color: var(--primary); cursor: pointer; flex-shrink: 0; }

.template-tabs { display: flex; gap: 5px; }
.tpl-tab { 
    padding: 8px 16px; border-radius: 8px; background: #f8fafc; 
    color: var(--text-sub); font-size: 13px; font-weight: 600; 
    cursor: pointer; border: 1px solid transparent; transition: 0.2s; white-space: nowrap; 
}
.tpl-tab:hover { background: #eff6ff; color: var(--primary); }
#btnMobileTemplateOpen { 
    display: none; padding: 8px 12px; border-radius: 8px; 
    background: #eff6ff; color: var(--primary); font-size: 13px; font-weight: 700; 
    border: 1px solid var(--primary); cursor: pointer; 
}

/* 버튼 스타일 공통 */
.btn { 
    padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; 
    cursor: pointer; transition: 0.2s; border: 1px solid transparent; 
    white-space: nowrap; flex-shrink: 0; 
}
.btn.primary { background: var(--primary); color: white; box-shadow: 0 4px 6px rgba(99, 102, 241, 0.2); }
.btn:hover:not(.primary) { background: #f1f5f9; }
.btn-save-top { background: #741e9c; color: white; display: flex; align-items: center; gap: 6px; }
#btnOpenSaveModal { 
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); color: white; 
    border: none; font-weight: 800; box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3); 
}

/* 에디터 메인 영역 */
.editor-wrap { 
    display: grid; grid-template-columns: 280px 1fr; 
    height: calc(100vh - 60px); width: 100vw; overflow: hidden; 
}
.side { 
    background: #fff; border-right: 1px solid var(--border); 
    padding: 20px; overflow-y: auto; z-index: 20; 
    display: flex; flex-direction: column; gap: 15px; 
}
.stage { 
    background: var(--bg-stage); width: 100%; height: 100%; 
    position: relative; overflow: hidden; 
    display: flex; justify-content: center; align-items: center; touch-action: none; 
}

/* 툴 패널 요소들 */
.section-title { 
    font-size: 13px; font-weight: 700; color: #b6b6b6; 
    margin-top: 10px; text-transform: uppercase; letter-spacing: 0.05em; 
}
.btn-round { 
    width: 100%; padding: 12px; border-radius: 10px; 
    border: 1px solid var(--border); background: #fff; 
    font-weight: 600; cursor: pointer; font-size: 13px; transition: 0.2s; 
    display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-main); 
}
.btn-round.primary { background: var(--primary); color: #fff; border: none; }
.btn-round.ai-red { background: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%); color: white; border: none; }
.btn-round.btn-secondary { background: white; border: 1px solid #ddd; color: #333; }

/* 모양 도구 */
.shape-panel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.shape-btn { 
    height: 40px; border: 1px solid var(--border); border-radius: 8px; 
    cursor: pointer; background: #fff; font-size: 16px; color: #64748b; 
    display: flex; align-items: center; justify-content: center; transition: 0.2s; 
}
.shape-btn:hover { border-color: var(--primary); color: var(--primary); background: #eff6ff; }

/* 업로드 박스 */
.upload-box { 
    border: 2px dashed #cbd5e1; border-radius: 12px; padding: 20px; 
    text-align: center; cursor: pointer; background: #f8fafc; color: #64748b; 
    font-size: 13px; display: flex; flex-direction: column; align-items: center; transition: 0.2s; 
}
.upload-box:hover { border-color: var(--primary); background: #eff6ff; color: var(--primary); }

/* 우측 레이어/속성 패널 */
.right-stack { 
    position: absolute; right: 20px; top: 20px; bottom: 20px; 
    width: 260px; display: flex; flex-direction: column; gap: 15px; 
    overflow-y: auto; z-index: 50; pointer-events: auto; 
}
.right-stack::-webkit-scrollbar { width: 6px; }
.right-stack::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 3px; }
.panel-box { 
    background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); 
    border-radius: 16px; padding: 15px; box-shadow: var(--shadow); 
    border: 2px solid transparent; flex-shrink: 0; 
}

/* 속성 툴 버튼 */
.tool-btn { 
    flex: 1; min-width: 0; padding: 8px; margin-top: 5px; 
    border-radius: 8px; border: 1px solid #eee; background: #fff; 
    color: #333; font-size: 12px; font-weight: 600; cursor: pointer; 
    display: flex; align-items: center; justify-content: center; gap: 6px; 
}
.tool-btn:hover { border-color: var(--primary); color: var(--primary); background: #f8fafc; }
.ai-tool-stack { display: flex; flex-direction: column; gap: 5px; width: 100%; }
#btnCutout { background: #fff9c4; color: #5d4037; border: 1px solid #fbc02d; }
#btnCutout:hover { background: #fff59d; transform: translateY(-1px); }

/* 정렬 그리드 */
.align-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 10px; }
.align-btn { 
    padding: 8px 0; border: 1px solid #eee; border-radius: 8px; background: #fff; 
    cursor: pointer; color: #555; display: flex; align-items: center; justify-content: center; 
    transition: 0.2s; font-size: 14px; 
}
.align-btn:hover { background: #f8fafc; color: var(--primary); border-color: var(--primary); }

/* 색상 선택기 */
.color-group { 
    display: flex; align-items: center; justify-content: space-between; 
    margin-top: 5px; border: 1px solid #e2e8f0; padding: 5px 10px; 
    border-radius: 8px; font-size: 12px; color: #666; 
}
.color-picker { 
    -webkit-appearance: none; appearance: none; width: 32px; height: 32px; 
    border: 1px solid #e2e8f0; background: none; cursor: pointer; padding: 0; 
    border-radius: 50%; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); 
    transition: transform 0.2s; box-sizing: border-box; 
}
.color-picker::-webkit-color-swatch-wrapper { padding: 0; border: none; }
.color-picker::-webkit-color-swatch { border: none; border-radius: 50%; padding: 0; }
.color-picker:hover { transform: scale(1.1); }

/* 하단 독 (Zoom) */
.bottom-dock { 
    position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); 
    background: #fff; padding: 8px 20px; border-radius: 50px; 
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 15px; 
    z-index: 100; white-space: nowrap; 
}
.zoom-btn { 
    width: 32px; height: 32px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 16px; cursor: pointer; color: #555; background: #f1f5f9; border:none; 
}
.zoom-btn:hover { background: #e2e8f0; color: #000; }
.divider { width: 1px; height: 16px; background: #ddd; }
#guideToggle.active { background: var(--primary); color: white; }
.help-text { font-size: 12px; color: #666; margin-left: 10px; font-weight: 500; white-space: nowrap; }

/* 가벽 높이 컨트롤 */
#wallHeightControls { 
    position: absolute; top: 85px; left: 50%; transform: translateX(-50%); 
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(8px); 
    padding: 8px 15px; border-radius: 50px; 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12); display: none; 
    align-items: center; gap: 12px; z-index: 40; 
    border: 1px solid rgba(0,0,0,0.1); white-space: nowrap; 
}
.wall-label { font-size: 13px; font-weight: 700; color: #475569; display: flex; align-items: center; gap: 6px; }
.height-btn { 
    padding: 6px 16px; border-radius: 20px; border: 1px solid #e2e8f0; 
    background: #fff; color: #64748b; font-size: 13px; font-weight: 600; 
    cursor: pointer; transition: all 0.2s; white-space: nowrap; 
}
.height-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 칼선 도구 */
.tool-box-group {
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; 
    padding: 12px; margin-bottom: 20px;
}
.tool-box-group button:hover {
    background: #fff; border-color: var(--primary); color: var(--primary); 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* =========================================
   5. 장바구니 페이지 (Cart) - PC/Mobile 반응형
   ========================================= */
#cartPage { z-index: 120000; padding-top: 40px; }
#cartListArea { overflow-y: auto; max-height: 70vh; }

/* 장바구니 아이템 그리드 */
.cart-item {
    display: grid;
    /* 좌측(정보), 우측(옵션 340px) */
    grid-template-columns: 1fr 340px; 
    gap: 30px; 
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; 
    padding: 20px; margin-bottom: 20px; align-items: start;
}
.cart-left-col { display: flex; gap: 20px; }
.cart-thumb {
    width: 100px; height: 100px; object-fit: cover;
    border-radius: 10px; border: 1px solid #f1f5f9; flex-shrink: 0;
}
/* 이미지 강제 축소 (필수) */
.cart-item img {
    width: 80px !important; height: 80px !important;
    object-fit: contain !important;
    background-color: #f8fafc; border: 1px solid #e2e8f0;
}

.cart-info-box {
    flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between;
}
.cart-badges { margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.cart-badge { font-size: 11px; padding: 3px 6px; border-radius: 4px; font-weight: 600; }
.badge-design { background: #e0e7ff; color: #4338ca; }
.badge-file { background: #f1f5f9; color: #475569; }

.cart-title { font-size: 17px; font-weight: 700; color: #1e293b; margin: 0 0 5px 0; line-height: 1.35; word-break: keep-all; }
.cart-filename { font-size: 13px; color: #64748b; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;}
.cart-price { font-size: 16px; font-weight: 800; color: #6366f1; margin-bottom: 12px; }

/* 수량/삭제 버튼 */
.cart-ctrl-row { display: flex; align-items: center; gap: 10px; }
.qty-wrapper { display: flex; align-items: center; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; overflow: hidden; }
.qty-btn { width: 32px; height: 32px; border: none; background: #fff; cursor: pointer; color: #64748b; display: flex; align-items: center; justify-content: center; }
.qty-btn:hover { background: #f8fafc; color: #333; }
.qty-val { width: 40px; text-align: center; font-size: 14px; font-weight: 700; border-left: 1px solid #f1f5f9; border-right: 1px solid #f1f5f9; line-height: 32px; }
.del-btn { width: 34px; height: 34px; border-radius: 6px; border: 1px solid #fee2e2; background: #fff; color: #ef4444; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.del-btn:hover { background: #fee2e2; }

/* 장바구니 우측 옵션 */
.cart-right-col {
    background: #f9fafb; border: 1px solid #eee; border-radius: 10px; 
    padding: 15px; min-height: 100px;
}
.cart-opt-box {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; 
    padding: 15px; margin-top: 10px; position: relative;
}
.cart-opt-box.required { border-left: 4px solid #6366f1; }
.cart-opt-box.optional { border-left: 4px solid #94a3b8; }

.cart-opt-group {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; 
    padding: 15px; margin-top: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.cart-opt-group.required-group { border-left: 4px solid #6366f1; }
.cart-opt-group.optional-group { border-left: 4px solid #94a3b8; }

.opt-box-title, .opt-group-header {
    font-size: 13px; font-weight: 800; color: #334155;
    margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center;
}
.badge-req { font-size: 10px; background: #fee2e2; color: #ef4444; padding: 2px 6px; border-radius: 4px; font-weight: normal; }
.badge-opt, .badge-sel { font-size: 10px; background: #f1f5f9; color: #64748b; padding: 2px 6px; border-radius: 4px; }

.opt-select-box { width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; background-color: #fff; }
.opt-checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-checkbox-label {
    display: flex; align-items: center; font-size: 12px; cursor: pointer;
    padding: 8px; border: 1px solid #eee; border-radius: 6px; background: #fff;
}
.opt-checkbox-label:hover { border-color: #6366f1; }
.opt-checkbox-label input { accent-color: #6366f1; width: 16px; height: 16px; margin-right: 10px; flex-shrink: 0; }
.opt-name { flex: 1; font-size: 13px; color: #334155; font-weight: 500; word-break: keep-all; line-height: 1.3;}
.opt-price { font-size: 13px; font-weight: 700; color: #6366f1; white-space: nowrap; margin-left: 5px; }

/* =========================================
   6. 모달 및 팝업 (Modals)
   ========================================= */
.modal-bg { 
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); 
    backdrop-filter: blur(4px); display: none; 
    justify-content: center; align-items: center; z-index: 10000; 
}
.modal-box { 
    background: #fff; padding: 30px; border-radius: 20px; 
    width: 400px; text-align: center; 
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); 
    max-height: 90vh; overflow-y: auto; 
}
.ai-input-pretty { 
    width: 100%; padding: 12px 15px; border: 2px solid #e2e8f0; 
    border-radius: 10px; font-size: 14px; background: #f9f9f9; 
    margin-bottom: 10px; outline: none; 
}
.ai-input-pretty:focus { border-color: var(--primary); background: #fff; }

/* AI 드로어 */
.ai-drawer { 
    position: fixed; top: 60px; right: 0; width: 360px; height: calc(100vh - 60px); 
    background: #fff; border-left: 1px solid #e2e8f0; padding: 25px; 
    z-index: 9000; transform: translateX(100%); transition: 0.3s; 
    box-shadow: -5px 0 15px rgba(0,0,0,0.05); overflow-y: auto; 
}
.ai-drawer.open { transform: translateX(0); }

/* 템플릿 오버레이 */
#templateOverlay { 
    position: fixed; inset: 0; background: rgba(255,255,255,0.6); 
    backdrop-filter: blur(15px); z-index: 9999; display: none; 
    justify-content: center; align-items: center; 
}
.tpl-modal-box { 
    width: 90%; max-width: 1200px; height: 85%; 
    background: #fff; border-radius: 24px; 
    box-shadow: 0 20px 60px rgba(0,0,0,0.15); 
    border: 1px solid rgba(255,255,255,0.5); display: flex; overflow: hidden; 
}
.tpl-sidebar { 
    width: 240px; background: #f8fafc; border-right: 1px solid #e2e8f0; 
    padding: 30px 20px; display: flex; flex-direction: column; gap: 10px; 
}
.tpl-cate-btn { 
    text-align: left; padding: 12px 16px; border-radius: 12px; 
    font-size: 14px; font-weight: 600; color: #64748b; 
    cursor: pointer; transition: 0.2s; border: none; background: transparent; 
    display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; 
}
.tpl-cate-btn:hover { background: #e2e8f0; color: var(--text-main); }
.tpl-cate-btn.active { background: #fff; color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.tpl-content { flex: 1; display: flex; flex-direction: column; background: #fff; }
.tpl-grid { 
    display: block !important; column-count: 3 !important; column-gap: 20px; 
    width: 100%; padding: 20px; box-sizing: border-box; height: auto !important; 
    flex: 1; overflow-y: auto !important; overflow-x: hidden; scrollbar-width: thin; 
    background-color: #f1f5f9; 
}
.tpl-item { 
    position: relative; background-color: #ffffff; border-radius: 16px; 
    overflow: hidden; cursor: pointer; border: none !important; 
    padding: 0 !important; margin-bottom: 20px; break-inside: avoid; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); 
}
.tpl-item-img { width: 100%; height: auto !important; object-fit: contain; display: block; background-color: #fff; margin: 0 !important; padding: 0 !important; }
.tpl-item.selected { box-shadow: 0 0 0 3px var(--primary); }
.tpl-item div:not(:has(img)) { display: none !important; }

/* 선택 모달 (PC/Mobile 공통) */
.choice-layout { display: flex; gap: 30px; text-align: left; }
.choice-left { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.choice-right { 
    width: 350px; display: flex; align-items: center; justify-content: center; 
    background: #f8fafc; border-radius: 12px; border: 1px solid #e2e8f0; 
    padding: 10px; flex-shrink: 0; 
}
.choice-right img { width: 100%; height: 100%; object-fit: contain; max-height: 300px; }

/* 로고 업로드 모달 */
.upload-drop-zone {
    width: 100%; height: 150px; border: 2px dashed #cbd5e1; border-radius: 12px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    background: #f8fafc; color: #64748b; cursor: pointer; transition: all 0.2s;
    margin-bottom: 20px; position: relative; overflow: hidden;
}
.upload-drop-zone:hover, .upload-drop-zone.dragover {
    border-color: #6366f1; background: #eff6ff; color: #6366f1;
}
.upload-icon { font-size: 32px; margin-bottom: 10px; }
.upload-text { font-size: 14px; font-weight: 600; }
.upload-sub { font-size: 12px; opacity: 0.7; margin-top: 4px; }
#previewImage {
    display: none; max-height: 100%; max-width: 100%; object-fit: contain;
    position: absolute; inset: 0; margin: auto; padding: 10px; background: #fff; z-index: 10;
}
#removeFileBtn {
    display: none; position: absolute; top: 10px; right: 10px;
    background: rgba(0,0,0,0.6); color: white; border-radius: 50%;
    width: 24px; height: 24px; align-items: center; justify-content: center;
    cursor: pointer; z-index: 20; font-size: 12px;
}

/* 달력 모달 */
.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 10px;
}
.cal-day-header { text-align: center; font-weight: bold; font-size: 12px; color: #64748b; padding-bottom: 5px; }
.cal-day {
    aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; cursor: pointer; font-size: 13px; transition: 0.2s;
}
.cal-day:hover:not(.disabled) { background: #eff6ff; color: #6366f1; }
.cal-day.selected { background: #6366f1; color: white !important; font-weight: bold; box-shadow: 0 2px 5px rgba(99,102,241,0.4); }
.cal-day.disabled { color: #cbd5e1; cursor: not-allowed; }

/* 심플 제품 카드 & 팝업 */
.simple-prod-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 20px; cursor: pointer; transition: all 0.2s; position: relative;
    min-height: 160px;
}
.simple-prod-card:hover {
    border-color: #6366f1; box-shadow: 0 8px 20px rgba(99, 102, 241, 0.15);
    transform: translateY(-3px);
}
.prod-icon-box {
    width: 50px; height: 50px; background: #f1f5f9; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: #475569; margin-bottom: 10px;
}
.prod-title { font-size: 15px; font-weight: bold; color: #333; margin-bottom: 5px; text-align: center; }
.prod-desc { font-size: 12px; color: #888; margin-bottom: 12px; text-align: center; }
.prod-price { font-size: 14px; font-weight: 800; color: #6366f1; margin-bottom: 10px; }
.btn-detail-green {
    padding: 6px 14px; background: #22c55e; color: white;
    font-size: 12px; font-weight: bold; border-radius: 20px; border: none;
    cursor: help; transition: 0.2s; display: flex; align-items: center; gap: 5px;
}
.btn-detail-green:hover { background: #16a34a; }

.hover-img-popup {
    display: none; position: absolute; bottom: 80%; left: 50%;
    transform: translateX(-50%); width: 220px; height: 220px;
    background: white; border: 2px solid #6366f1;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3); border-radius: 12px; z-index: 9999; padding: 5px;
}
.hover-img-popup img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; background: #f8fafc; }

/* =========================================
   7. 푸터 (Footer)
   ========================================= */
.footer-wrap {
    width: 100%; background: #f9fafb; border-top: 1px solid #e5e7eb;
    padding: 40px 20px; margin-top: 50px; color: #4b5563; font-size: 13px;
}
.footer-inner {
    max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap;
    gap: 30px; justify-content: space-between;
}
.foot-menu ul { list-style: none; padding: 0; margin: 0 0 20px 0; display: flex; gap: 20px; }
.foot-menu a { text-decoration: none; color: #374151; font-weight: 600; }
.foot-menu a:hover { color: var(--primary); }
.foot-info dl { display: flex; flex-wrap: wrap; margin: 5px 0; gap: 5px; }
.foot-info dt { font-weight: 700; color: #111; }
.foot-info dd { color: #666; margin: 0; margin-right: 10px; }
.copyright { margin-top: 15px; color: #9ca3af; font-size: 12px; }
.cs-center h3 { margin: 0 0 10px 0; font-size: 16px; color: #111; }
.cs-center strong { font-size: 24px; color: var(--primary); display: block; margin-bottom: 5px; }
.cs-center p { margin: 0; line-height: 1.5; color: #666; }

/* =========================================
   8. 모바일 반응형 (Mobile, max-width: 768px)
   ========================================= */
#mobileControlDock { display: none; } /* PC에선 숨김 */

@media (max-width: 768px) {
    /* [1] 상단 메뉴바 (Topbar) - 버튼 복구 및 가로 스크롤 */
    .topbar {
        display: flex !important; align-items: center !important; justify-content: flex-start !important;
        gap: 8px !important; padding: 0 10px !important; height: 50px !important;
        overflow-x: auto !important; white-space: nowrap !important; background: #fff !important;
    }
    .topbar::-webkit-scrollbar { display: none; }
    .brand { order: 1 !important; margin-right: 5px !important; flex-shrink: 0 !important; }
    .brand { display: none !important; } /* 로고 숨김 요청 반영 */
    
    #btnLoginBtn { order: 3 !important; flex-shrink: 0 !important; padding: 8px 12px !important; }
    
    .template-tabs {
        order: 4 !important; display: flex !important; flex-shrink: 0 !important;
        margin: 0 5px !important; opacity: 1 !important; visibility: visible !important;
    }
    #btnMobileTemplateOpen {
        display: flex !important; align-items: center !important; height: 34px !important;
        padding: 0 12px !important; background: #eff6ff !important;
        color: #6366f1 !important; border: 1px solid #6366f1 !important;
        border-radius: 8px !important; font-weight: 700 !important; font-size: 13px !important;
        white-space: nowrap !important;
    }
    .tpl-tab { display: none !important; } /* PC용 탭 숨김 */

    #btnOrderTop { order: 5 !important; flex-shrink: 0 !important; }
    .btn-save-top { order: 6 !important; flex-shrink: 0 !important; }
    .topbar > div[style*="flex:1"] { display: none !important; }

    /* [2] 에디터 화면 (좌우 패널 정리) */
    .editor-wrap {
        display: flex !important; flex-direction: column !important;
        width: 100vw !important; height: calc(100vh - 50px) !important;
        overflow: hidden !important; position: relative !important;
    }
    .stage {
        order: 1 !important; width: 100% !important; height: 100% !important;
        position: absolute !important; top: 0; left: 0; z-index: 1;
        background: #e5e5e5; border-bottom: 2px solid #ddd;
    }

    /* 사이드바 & 우측 스택 -> 모바일 슬라이드 패널로 변환 */
    .side {
        order: 2 !important; position: fixed !important;
        top: 50px; bottom: 0; left: 0;
        width: 85% !important; max-width: 320px;
        background: #fff !important; z-index: 10000 !important;
        border-right: none !important; box-shadow: 5px 0 15px rgba(0,0,0,0.1);
        transform: translateX(-120%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important; flex-direction: column; padding: 15px !important;
    }
    .side.open { transform: translateX(0); }

    .right-stack {
        display: flex !important; position: fixed !important;
        top: 50px; bottom: 0; right: 0;
        width: 85% !important; max-width: 320px;
        background: #fff !important; z-index: 10000 !important;
        border-left: 1px solid #ddd; box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 20px !important; pointer-events: auto !important;
    }
    .right-stack.open { transform: translateX(0); }

    /* 플로팅 버튼 (FAB) */
    #mobileControlDock {
        display: flex; position: fixed; bottom: 20px;
        left: 0; right: 0; justify-content: space-between;
        padding: 0 20px; z-index: 9000; pointer-events: none;
    }
    .mobile-fab {
        pointer-events: auto; width: 60px; height: 60px;
        border-radius: 50%; border: none; color: white; font-size: 20px;
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3); cursor: pointer; transition: transform 0.1s;
    }
    .mobile-fab:active { transform: scale(0.95); }
    .mobile-fab span { font-size: 10px; margin-top: 2px; font-weight: bold; }
    .mobile-fab.left { background: #6366f1; }
    .mobile-fab.right { background: #111827; }

    /* [3] 템플릿 모달 (카테고리 잘림 해결) */
    .tpl-modal-box {
        width: 100% !important; height: 100% !important;
        border-radius: 0 !important; flex-direction: column !important;
        display: flex !important; overflow: hidden !important;
    }
    .tpl-sidebar {
        flex-direction: row !important; height: auto !important;
        padding: 10px 10px 10px 15px !important; padding-right: 40px !important;
        overflow-x: auto !important; white-space: nowrap !important;
        border-right: none !important; border-bottom: 1px solid #eee;
        flex-shrink: 0 !important; width: 100% !important; box-sizing: border-box !important;
    }
    .tpl-cate-btn {
        margin-right: 10px !important; flex: 0 0 auto !important;
        background: #f1f5f9; padding: 8px 15px !important; border-radius: 20px !important;
    }
    .tpl-content { display: flex !important; flex-direction: column !important; height: 100% !important; overflow: hidden !important; }
    .tpl-content > div:first-child { display: flex !important; align-items: center !important; padding: 10px 15px !important; flex-shrink: 0 !important; }
    #tplSearchInput { width: auto !important; flex: 1 !important; margin-bottom: 0 !important; }
    .tpl-grid { flex: 1 !important; overflow-y: auto !important; column-count: 2 !important; padding: 10px !important; }
    #btnUseTpl { width: 100% !important; height: 50px !important; font-size: 16px !important; font-weight: bold !important; }

    /* [4] 장바구니 화면 모바일 최적화 */
    #cartPage { padding-top: 50px !important; background: #f1f5f9 !important; }
    #cartPage > div { display: flex !important; flex-direction: column !important; padding: 0 !important; height: 100% !important; }
    #cartListArea { height: auto !important; max-height: none !important; padding: 15px 15px 280px 15px !important; overflow-y: auto !important; }

    .cart-item {
        display: flex !important; flex-direction: column !important;
        padding: 20px !important; background: #fff !important;
        border-radius: 16px !important; margin-bottom: 20px !important;
        position: relative !important;
    }
    .cart-item > div:nth-child(2) { order: 1 !important; margin-bottom: 20px !important; width: 100% !important; }
    .cart-item > div:nth-child(2) > div:first-child { display: block !important; width: 100% !important; margin-bottom: 10px !important; text-align: left !important; }
    
    .cart-item > div:first-child {
        order: 2 !important; margin-bottom: 15px !important;
        padding-top: 15px !important; border-top: 1px solid #f3f4f6;
        display: flex !important; align-items: flex-start !important;
    }
    .cart-item > div:first-child > div { display: flex !important; flex-direction: column !important; justify-content: flex-start !important; padding-left: 5px !important; }
    .cart-item > div:first-child > div > div:last-child { margin-top: 15px !important; font-size: 16px !important; display: block !important; }
    
    .cart-item > div:last-child { order: 3 !important; width: 100% !important; }
    #cartPage > div > div > div:last-child { 
        position: fixed !important; bottom: 0 !important; left: 0 !important; 
        width: 100% !important; background: #fff !important; padding: 20px !important; 
        z-index: 12500 !important; border-radius: 20px 20px 0 0 !important; 
        box-shadow: 0 -5px 10px rgba(0,0,0,0.05) !important; 
    }

    /* 선택 모달 모바일 */
    .choice-layout { flex-direction: column; }
    .choice-right { width: 100%; height: 250px; margin-top: 20px; order: 2; }
    .choice-left { order: 1; }
    .choice-left button.btn-round { height: 100px !important; }

    /* 푸터 모바일 */
    .footer-inner { flex-direction: column; gap: 20px; }
    .foot-menu ul { flex-wrap: wrap; gap: 10px; }

    /* 기타 */
    .hero-title { font-size: 26px !important; word-break: keep-all; }
    .quick-menu-track { grid-template-columns: repeat(2, 1fr) !important; }
    .template-grid-start { column-count: 2 !important; }
    #startScreen { padding-top: 20px !important; }
    .bottom-dock { display: none !important; }
}

/* 모바일 텍스트 에디터 (항상 최상위) */
#mobileTextEditor {
    position: fixed; top: 0; left: 0; width: 100%; height: 140px; 
    background: #fff; z-index: 999999; padding: 15px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    display: none; flex-direction: column; gap: 10px;
}
.m-text-header {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: bold; color: #333;
}
#mobileTextInput {
    width: 100%; flex: 1; border: 1px solid #ddd; border-radius: 8px;
    padding: 10px; font-size: 16px; outline: none; resize: none; font-family: inherit;
}
#mobileTextInput:focus { border-color: #6366f1; }

/* =========================================
   [추가] 결제 모달 계좌정보 스타일
   ========================================= */
.bank-transfer-container {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    text-align: center;
}

.bank-title {
    font-size: 13px;
    font-weight: 800;
    color: #475569;
    margin-bottom: 8px;
}

.bank-info {
    font-size: 16px;
    font-weight: 800;
    color: #333;
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.bank-name {
    color: #f59e0b; /* 국민은행 느낌의 노란/주황 계열 포인트 */
}

.bank-num {
    color: #1e293b;
    letter-spacing: 0.5px;
}

.bank-owner {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 600;
}

.bank-note {
    font-size: 11px;
    color: #6366f1; /* 브랜드 컬러(Primary) 사용 */
    background: #eff6ff;
    padding: 5px 8px;
    border-radius: 4px;
    display: inline-block;
    line-height: 1.4;
}
/* [추가] 입금 확인 버튼 스타일 */
.btn-bank-confirm {
    margin-top: 15px;
    background-color: #10b981; /* 신뢰감을 주는 초록색 */
    color: white;
    border: none;
    font-weight: bold;
    font-size: 14px;
    height: 45px;
    width: 100%;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
    transition: all 0.2s;
}

.btn-bank-confirm:hover {
    background-color: #059669;
    transform: translateY(-2px);
}
/* =========================================
   [추가] 메인 검색창 디자인 (크고 예쁘게)
   ========================================= */
.hero-search-wrap {
    width: 100%;
    max-width: 600px; /* 검색창 전체 너비 */
    margin: 10px auto 40px; /* 위아래 여백 */
    position: relative;
    display: flex;
    align-items: center;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.15); /* 부드러운 보라색 그림자 */
    border-radius: 50px;
    background: #fff;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

/* 마우스 올리거나 클릭했을 때 강조 */
.hero-search-wrap:hover,
.hero-search-wrap:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.25);
    border-color: var(--primary); /* 보라색 테두리 */
}

.hero-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 18px 25px; /* 내부 여백을 키워서 통통하게 */
    font-size: 16px;
    font-weight: 600;
    color: #333;
    border-radius: 50px 0 0 50px;
    outline: none !important;
}

.hero-search-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.hero-search-btn {
    background: var(--primary); /* 보라색 배경 */
    color: white;
    border: none;
    padding: 12px 25px;
    margin: 5px; /* 입력창 안쪽으로 살짝 들어온 느낌 */
    border-radius: 40px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    /* 오류가 있던 부분 */
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-search-btn:hover {
    background: var(--primary-dark);
}
/* =========================================
   [수정됨] 리얼 후기 (Marquee) 섹션
   ========================================= */
.review-section {
    width: 100%;
    padding: 60px 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    overflow: hidden;
}

.review-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 0 20px;
}

.review-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 10px 0;
}

.review-header p {
    font-size: 16px;
    color: #64748b;
    margin: 0;
}

/* 무한 스크롤 트랙 */
.marquee-wrapper {
    width: 100%;
    overflow: hidden;
    padding: 10px 0 30px 0; /* 높이 확보를 위한 패딩 */
}

.marquee-track {
    display: flex;
    gap: 20px;
    width: max-content;
    animation: scroll 40s linear infinite;
}

.marquee-track:hover {
    animation-play-state: paused;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* 개별 후기 카드 */
.review-card {
    width: 300px; /* 카드 너비 고정 */
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    flex-shrink: 0; /* 찌그러짐 방지 */
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.review-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.15);
    border-color: #6366f1;
}

/* 후기 이미지 영역 (이미지 없어도 높이 유지) */
.review-img {
    width: 100%;
    height: 180px; /* 높이값 필수 지정 */
    background-color: #cbd5e1; /* 이미지 로딩 실패 시 회색 배경 */
    background-size: cover;
    background-position: center;
    position: relative;
}

/* 후기 내용 */
.review-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.review-stars {
    color: #f59e0b;
    font-size: 14px;
    margin-bottom: 10px;
}

.review-text {
    font-size: 14px;
    color: #334155;
    line-height: 1.5;
    margin: 0 0 15px 0;
    flex: 1;
    word-break: keep-all;
    font-weight: 500;
}

.review-user {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 15px;
    font-size: 12px;
}

.u-name { font-weight: 700; color: #1e293b; }
.u-date { color: #94a3b8; }

/* 모바일 대응 */
@media (max-width: 768px) {
    .review-card { width: 260px; }
    .review-img { height: 150px; }
}
/* =========================================
   [추가] 대분류(Top Category) 탭 스타일
   ========================================= */
/* =========================================
   [수정됨] 카테고리 탭 (PC: 중앙, 모바일: 왼쪽 정렬)
   ========================================= */
.category-tabs {
    display: flex;
    justify-content: center; /* PC 기본: 중앙 정렬 */
    gap: 8px;
    padding: 0 5px 15px 5px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 10px;
    scrollbar-width: none; 
}
.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 700;
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.cat-tab:hover {
    background: #f8fafc;
    color: #334155;
    transform: translateY(-2px);
}

.cat-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

/* 모바일 화면 (768px 이하)에서만 왼쪽 정렬 강제 */
@media (max-width: 768px) {
    .category-tabs {
        justify-content: flex-start !important;
        padding: 0 20px 15px 20px !important;
    }
}
/* 썸네일 이미지를 감싸는 박스 */
.quick-icon-img-box {
    width: 65px; height: 65px; 
    border-radius: 18px; 
    overflow: hidden;
    margin-bottom: 10px;
    background: #f1f5f9; 
    border: 1px solid #e2e8f0;
    display: flex; align-items: center; justify-content: center;
}

/* 실제 이미지 스타일 */
.quick-icon-img-box img {
    width: 100%; height: 100%;
    object-fit: cover; /* 이미지를 박스에 꽉 차게 (잘림 허용) */
}

/* 마우스 올렸을 때 효과 */
.quick-item:hover .quick-icon-img-box {
    border-color: #6366f1; /* 보라색 테두리 */
    transform: translateY(-3px); /* 살짝 위로 */
}
/* [추가] 팝업창(모달) 전용 상품 그리드 스타일 */
#catProductGrid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important; /* 한 줄에 4개 강제 고정 */
    gap: 20px !important; /* 간격 넓게 */
    padding: 10px !important;
}

/* 팝업창 안의 개별 상품 박스 */
#catProductGrid .quick-item {
    width: 100% !important; /* 너비를 그리드 칸에 꽉 채움 */
    height: auto !important;
    margin-bottom: 0 !important;
    padding: 15px !important; /* 내부 여백 추가 */
    background: #fff;
    border: 1px solid #eee;
}

/* [수정됨] 팝업창 안의 상품 이미지 박스 (정사각형 & 중앙 정렬) */
#catProductGrid .quick-icon-img-box {
    width: 100% !important;  /* 가로 꽉 채움 */
    height: auto !important; /* 높이는 자동으로 (비율에 맞춤) */
    aspect-ratio: 1 / 1 !important; /* ★ 핵심: 1:1 정사각형 비율 강제 */
    margin-bottom: 15px !important;
    border-radius: 12px !important;
    background: #f8fafc;
    border: 1px solid #eee;
    overflow: hidden; /* 네모 밖으로 나간 이미지 숨김 */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* [수정됨] 이미지 스타일 (잘려서 중앙이 보이게) */
#catProductGrid .quick-icon-img-box img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* ★ 핵심: 박스에 꽉 차게 (넘치면 잘림) */
    object-position: center !important; /* 잘릴 때 중앙을 보여줌 */
    padding: 0 !important; /* 패딩 제거 */
}

/* 팝업창 안의 텍스트 크기 조정 */
#catProductGrid .quick-text {
    font-size: 16px !important; /* 글자도 조금 크게 */
    margin-bottom: 5px !important;
}

    /* =========================================
       [팝업창 상품 목록 디자인 수정 - PC/모바일 완벽 분리]
       ========================================= */

    /* ----------------------------------------------------
       [1] PC 및 공통 설정 (기본값) 
       화면이 클 때 이 스타일이 먼저 적용됩니다.
       ---------------------------------------------------- */
    
    /* 1. 팝업창 크기 확장 (PC에서 4개가 넉넉하게 들어가도록) */
    /* =========================================
   [수정완료] 팝업창 상품 목록 디자인 (PC/모바일 완벽 분리)
   ========================================= */

/* ----------------------------------------------------
   [1] PC 및 공통 설정 (기본값)
   ---------------------------------------------------- */

/* 1. 팝업창 크기 */
#categoryDetailModal .modal-box {
    width: 1000px !important;
    max-width: 95% !important;
    max-height: 90vh !important; /* 화면 높이 넘치지 않게 */
    overflow-y: auto !important; /* 내용 많으면 스크롤 */
    padding: 20px 10px !important; /* 패딩 조정 */
}

/* 2. 그리드 레이아웃 (PC: 한 줄에 4개) */
#catProductGrid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
    padding: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 3. 개별 상품 박스 (높이 통일) */
#catProductGrid .quick-item {
    width: 100% !important;
    height: 100% !important; /* 높이 꽉 채우기 */
    min-height: auto !important; /* 강제 높이 제거 */
    margin-bottom: 0 !important;
    padding: 15px !important;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    display: flex !important;
    flex-direction: column !important; /* 세로 정렬 */
    justify-content: flex-start !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05) !important;
    transition: transform 0.2s;
    box-sizing: border-box !important;
}

#catProductGrid .quick-item:hover {
    transform: translateY(-5px);
    border-color: #6366f1;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.15) !important;
    z-index: 5;
}

/* 4. 이미지 & 아이콘 박스 (정사각형 비율 강제 통일) */
#catProductGrid .quick-icon-img-box,
#catProductGrid .quick-icon { /* 아이콘만 있는 경우도 포함 */
    width: 100% !important;
    aspect-ratio: 1 / 1 !important; /* ★ 핵심: 무조건 정사각형 */
    height: auto !important;
    margin-bottom: 12px !important;
    border-radius: 10px !important;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0 !important; /* 찌그러짐 방지 */
}

/* 큐브 아이콘 크기 키우기 */
#catProductGrid .quick-icon {
    font-size: 40px !important; /* 아이콘 크기 확대 */
    color: #cbd5e1;
}

/* 5. 이미지 (꽉 차게) */
#catProductGrid .quick-icon-img-box img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    padding: 0 !important;
    display: block !important;
}

/* 6. 상품명 텍스트 (높이 고정하여 들쑥날쑥 방지) */
#catProductGrid .quick-text {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #111;
    margin-bottom: 8px !important;
    line-height: 1.4 !important;
    
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important; /* 2줄 말줄임 */
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    
    height: 42px !important; /* ★ 핵심: 2줄 높이로 고정 */
    text-align: center !important;
    white-space: normal !important; /* 줄바꿈 허용 */
}

/* 7. 가격 정보 (항상 바닥에 붙기) */
#catProductGrid .quick-item > div:last-child {
    margin-top: auto !important; /* 위쪽 여백을 최대로 밀어서 바닥 고정 */
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #6366f1;
    text-align: center !important;
}


/* ----------------------------------------------------
   [2] 모바일 전용 설정 (화면 너비 768px 이하)
   ---------------------------------------------------- */
@media (max-width: 768px) {
    
    /* 모달창 크기 최적화 */
    #categoryDetailModal .modal-box {
        width: 90% !important; /* 화면 꽉 차게 */
        max-width: 360px !important;
        padding: 15px !important;
    }

    /* 2칸 그리드 (모바일) */
    #catProductGrid {
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 10px !important;
        padding: 5px !important;
    }

    /* 카드 크기 줄이기 */
    #catProductGrid .quick-item {
        padding: 10px !important;
        min-height: auto !important; /* 높이 강제 제거 */
    }
    
    /* 텍스트 크기 조정 */
    #catProductGrid .quick-text {
        font-size: 13px !important;
        height: 36px !important; /* 모바일은 조금 더 작게 고정 */
        margin-bottom: 5px !important;
    }
    
    /* 가격 텍스트 */
    #catProductGrid .quick-item > div:last-child {
        font-size: 12px !important;
    }
}
/* =========================================
   10. 마이페이지 추가 스타일 (업데이트)
   ========================================= */

/* 2) 6칸 그리드 (PC 기준) */
/* =========================================
   10. 마이페이지 추가 스타일 (수정됨)
   ========================================= */

/* [수정] 가로 4칸 그리드 (4x4 구조) */
.mp-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); /* 가로 4개 강제 */
    gap: 20px; /* 간격 넓힘 */
    padding-bottom: 50px;
}

/* 모바일/태블릿 반응형 처리 */
@media (max-width: 1200px) { .mp-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px) { .mp-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .mp-grid { grid-template-columns: 1fr; } }

/* [수정] 디자인 카드 스타일 개선 (이미지 강조) */
.mp-design-card { 
    border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; 
    background: #fff; transition: all 0.2s ease; position: relative;
    display: flex; flex-direction: column;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02); /* 부드러운 그림자 추가 */
}

.mp-design-card:hover { 
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.15); /* 마우스 올리면 뜨는 효과 */
    transform: translateY(-5px); 
    border-color: #6366f1; 
}

/* 썸네일 영역 - 꽉 차게 보이도록 설정 */
.mp-design-thumb { 
    width: 100%; 
    aspect-ratio: 1 / 1; /* 정사각형 비율 고정 */
    object-fit: cover; /* 이미지를 꽉 채움 (여백 없음) */
    /* 만약 이미지가 잘리는 게 싫다면 object-fit: contain; 으로 변경하고 background: #f8fafc; 추가 */
    background: #f1f5f9; 
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

.mp-design-body { padding: 15px; display: flex; flex-direction: column; gap: 8px; }
.mp-design-title { font-size: 15px; font-weight: 800; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 5) 계좌번호 입력 섹션 */
.bank-section {
    background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 12px; padding: 20px;
    margin-bottom: 30px; display: flex; flex-direction: column; gap: 10px;
}
.bank-header { display: flex; justify-content: space-between; align-items: center; }
.bank-notice { font-size: 13px; color: #0369a1; font-weight: 600; }
.bank-form { display: flex; gap: 10px; flex-wrap: wrap; }
.bank-input { 
    padding: 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; flex: 1;
}

/* 수익 에셋 리스트 */
.asset-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.asset-item { 
    display: flex; align-items: center; gap: 15px; background: white; 
    padding: 15px; border: 1px solid #e2e8f0; border-radius: 8px; 
}
.asset-thumb { width: 60px; height: 60px; border-radius: 6px; object-fit: cover; background: #f1f5f9; border: 1px solid #eee; }
.asset-info { flex: 1; }
.asset-revenue { font-size: 16px; font-weight: 800; color: #16a34a; }
/* =========================================
   1. 기본 설정 및 변수 (수정됨)
   ========================================= */
body { 
    margin: 0; 
    height: 100vh; 
    overflow: hidden; /* 스크롤은 내부 div에서 처리 */
    background: var(--bg-sidebar); 
    padding-top: 60px; /* ★ 탑바 높이만큼 여백 확보 */
    box-sizing: border-box;
}

/* =========================================
   4. 메인 에디터 레이아웃 (수정됨)
   ========================================= */
/* 탑바 고정 스타일 */
.topbar { 
    position: fixed; top: 0; left: 0; right: 0; /* ★ 상단 고정 */
    height: 60px; display: flex; align-items: center; 
    padding: 0 25px; background: #fff; border-bottom: 1px solid var(--border); 
    gap: 10px; z-index: 1000; /* z-index 높임 */
    overflow-x: auto; white-space: nowrap; 
}

/* 시작 화면 스크롤 처리 */
#startScreen { 
    position: absolute; inset: 0; top: 60px; /* ★ 탑바 아래부터 시작 */
    background: #fff; 
    z-index: 9999; 
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; 
    overflow-y: auto; /* ★ 내부 스크롤 활성화 */
    padding-bottom: 80px;
    height: calc(100vh - 60px); /* 높이 계산 */
}

/* 에디터 화면 높이 조정 */
#mainEditor { 
    display: none; width: 100vw; height: 100%; /* 부모 높이(body-padding 제외) */
    flex-direction: column; 
}

.editor-wrap { 
    display: grid; grid-template-columns: 280px 1fr; 
    height: 100%; /* ★ 꽉 채우기 */
    width: 100vw; overflow: hidden; 
}

/* 가벽 컨트롤 위치 조정 (탑바 아래로) */
#wallHeightControls { 
    top: 75px; /* 60px(탑바) + 15px(여백) */
}
@media (max-width: 768px) {
        .hero-search-wrap {
            display: flex !important;
            align-items: center !important;
            height: 50px !important; /* 높이 고정 */
            padding: 0 !important;
            border-radius: 50px !important;
            overflow: hidden !important;
            border: 2px solid #6366f1; /* 테두리 강조 */
            background: #fff;
        }

        .hero-search-input {
            flex: 1 !important; /* 남은 공간 모두 차지 */
            height: 100% !important;
            border: none !important;
            padding: 0 15px !important;
            font-size: 14px !important;
            margin: 0 !important;
            border-radius: 0 !important;
        }

        .hero-search-btn {
            width: 50px !important; /* 버튼 너비 고정 */
            height: 100% !important;
            border: none !important;
            background: #6366f1 !important;
            color: white !important;
            margin: 0 !important;
            padding: 0 !important;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 0 !important;
        }
        
        /* 검색 버튼 안의 텍스트 숨기고 돋보기만 보여주기 (공간 확보) */
        .hero-search-btn span {
            display: none; 
        }
        .hero-search-btn i {
            font-size: 18px;
            margin: 0 !important;
        }
    }

    /* [2번 해결] 에디터 조절 버튼(양쪽) 기본적으로 숨기기 */
    #mobileControlDock {
        display: none !important; /* 시작 화면 등에서는 안 보이게 설정 */
    }
    
    /* 에디터가 켜졌을 때만 보이게 하는 클래스 */
    body.editor-active #mobileControlDock {
        display: flex !important;
    }
    /* 핫딜 섹션 스타일 */
.hotdeal-wrapper {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    animation: fadeIn 0.5s ease-in-out;
}

.hotdeal-header {
    margin-bottom: 20px;
}

.hotdeal-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: #111;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 5px 0;
}

.hotdeal-header p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

.badge-hot {
    background: #ef4444;
    color: white;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    animation: pulse 2s infinite;
}

.hotdeal-grid {
        display: grid;
        gap: 15px;
        /* PC 화면: 한 줄에 6개 */
        grid-template-columns: repeat(6, 1fr); 
        margin-top: 20px;
    }

    /* 모바일 화면 (768px 이하) */
    @media (max-width: 768px) {
        .hotdeal-grid {
            /* 모바일: 한 줄에 2개 */
            grid-template-columns: repeat(2, 1fr); 
            gap: 10px;
        }
        
        /* 모바일에서 카드 내용 간소화 (선택사항) */
        .hotdeal-title { font-size: 13px; }
        .hotdeal-price { font-size: 14px; }
    }

.hotdeal-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.hotdeal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: #6366f1;
}

.hotdeal-img-box {
    width: 100%;
    height: 180px;
    background: #f8fafc;
    overflow: hidden;
    position: relative;
}

.hotdeal-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.hotdeal-card:hover .hotdeal-img-box img {
    transform: scale(1.05);
}

.hotdeal-info {
    padding: 15px;
}

.hotdeal-title {
    font-weight: bold;
    font-size: 15px;
    color: #333;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hotdeal-meta {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

.hotdeal-price {
    font-size: 16px;
    font-weight: 800;
    color: #6366f1;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
/* 모바일 화면 (폭 768px 이하) */
@media (max-width: 768px) {
    .hotdeal-grid {
        /* 한 줄에 2개씩 배치 */
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px;
    }
}
/* 모바일 화면 (768px 이하) 설정 */
    @media (max-width: 768px) {
        
        /* 퀵메뉴(카테고리) 컨테이너를 3칸으로 설정 */
        #quickMenuContainer {
            display: grid !important;
            grid-template-columns: repeat(3, 1fr) !important; /* 핵심: 1줄에 3개 */
            gap: 8px !important; /* 간격을 조금 좁게 조정 */
        }

        /* 3개씩 배치되면 공간이 좁아지므로 폰트 크기 미세 조정 */
        .quick-item .quick-text {
            font-size: 11px !important; 
            letter-spacing: -0.5px;
            white-space: nowrap; /* 글자가 두 줄로 안 떨어지게 */
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        /* 아이콘 박스 크기도 화면에 맞게 유동적으로 */
        .quick-item .quick-icon-img-box {
            height: auto !important;
            aspect-ratio: 1 / 1; /* 정사각형 비율 유지 */
        }
    }
    /* 커뮤니티 버튼 스타일 */
.community-nav-wrapper { max-width: 1200px; margin: 20px auto 40px; padding: 0 10px; }
.comm-grid { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.comm-btn { display: flex; flex-direction: column; align-items: center; text-decoration: none; width: 90px; cursor: pointer; transition: transform 0.2s; }
.comm-btn:hover { transform: translateY(-5px); }
.comm-icon { width: 70px; height: 70px; border-radius: 50%; background: #fff; border: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: center; font-size: 28px; color: #475569; margin-bottom: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); transition: all 0.2s; }
.comm-btn:hover .comm-icon { border-color: #6366f1; color: #6366f1; box-shadow: 0 10px 15px rgba(99,102,241,0.2); }
.comm-btn.blog .comm-icon { background: #6366f1; color: white; border: none; }
.comm-btn span { font-size: 13px; font-weight: 700; color: #333; text-align: center; line-height: 1.3; }
@media (max-width: 768px) {
    .comm-grid { gap: 10px; display: grid; grid-template-columns: repeat(3, 1fr); }
    .comm-btn { width: 100%; margin-bottom: 10px; }
    .comm-icon { width: 60px; height: 60px; font-size: 24px; }
}
/* 세련된 커뮤니티 버튼 스타일 (Glassmorphism + Gradient) */
.community-nav-wrapper { max-width: 1200px; margin: 30px auto 50px; padding: 0 20px; }
.comm-grid { display: flex; justify-content: center; gap: 25px; flex-wrap: wrap; }

.comm-btn {
    display: flex; flex-direction: column; align-items: center; text-decoration: none;
    width: 100px; cursor: pointer; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

/* 아이콘 박스: 그라데이션 테두리와 그림자 효과 */
.comm-icon {
    width: 75px; height: 75px; border-radius: 24px;
    background: #ffffff;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; color: #64748b; margin-bottom: 12px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05), 0 6px 6px rgba(0,0,0,0.05);
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
    transition: all 0.3s ease;
}

/* 호버 시 둥둥 뜨는 효과와 색상 변경 */
.comm-btn:hover { transform: translateY(-8px); }

.comm-btn:hover .comm-icon {
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.25);
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6); /* 보라색 그라데이션 */
    border-color: transparent;
}

/* 블로그 버튼은 처음부터 강조 */
.comm-btn.blog .comm-icon {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}
.comm-btn.blog:hover .comm-icon {
    transform: scale(1.05);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.4);
}

.comm-btn span {
    font-size: 14px; font-weight: 700; color: #475569;
    text-align: center; line-height: 1.4; transition: color 0.2s;
}
.comm-btn:hover span { color: #6366f1; }

/* 모바일 대응 */
@media (max-width: 768px) {
    .comm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
    .comm-btn { width: 100%; }
    .comm-icon { width: 65px; height: 65px; font-size: 26px; border-radius: 20px; }
}

/* =========================================
   [모바일 탑바 버튼 순서 수정]
   ========================================= */
@media (max-width: 768px) {
    /* 1. 브랜드 로고 숨김 (공간 확보) */
    .brand { display: none !important; }

    /* 2. 버튼 순서 강제 지정 (Flexbox Order) */
    #btnHomeTop   { order: 1 !important; } /* HOME */
    #btnOrderTop  { order: 2 !important; } /* 장바구니 담기 */
    #btnViewCart  { order: 3 !important; } /* 장바구니 */
    #btnLoginBtn  { order: 4 !important; } /* 로그인 */
    #btnMyLibrary { order: 5 !important; } /* 보관함 */

    /* 템플릿 버튼 등 기타 요소는 맨 뒤로 */
    .template-tabs { order: 6 !important; }
    .btn-save-top { order: 7 !important; }

    /* 3. 좁은 화면을 위한 스타일 최적화 */
    .topbar {
        justify-content: space-between !important; /* 간격 균등 배치 */
        padding: 0 5px !important;
    }
    
    .topbar .btn {
        margin: 0 2px !important;      /* 버튼 간격 좁힘 */
        padding: 0 8px !important;     /* 내부 여백 줄임 */
        font-size: 12px !important;    /* 글자 크기 줄임 */
        height: 36px !important;       /* 높이 통일 */
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    /* (선택사항) 공간이 너무 좁으면 글자 숨기고 아이콘만 보이게 처리 */
    /* 필요시 아래 주석을 해제하세요 */
    /*
    .topbar .btn span { display: none !important; }
    .topbar .btn i { margin: 0 !important; font-size: 14px; }
    */
}
/* 떠있는(Floating) 텍스트 마법사 툴바 */
.wizard-toolbar.floating-bar {
    position: absolute;       /* 캔버스 위에 둥둥 뜨게 설정 */
    top: 20px;                /* 상단 여백 */
    left: 50%;                /* 가로 중앙 */
    transform: translateX(-50%); /* 정중앙 맞춤 */
    z-index: 100;             /* 캔버스보다 위에 */
    
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95); /* 살짝 투명한 흰색 */
    border: 1px solid #e2e8f0;
    border-radius: 50px;      /* 둥근 알약 모양 */
    padding: 8px 25px;        /* 패딩을 줄여서 작게 만듦 */
    height: 65px;             /* 전체 높이 축소 */
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15); /* 그림자 예쁘게 */
    width: auto;              /* 내용만큼만 크기 잡기 */
    max-width: 90%;
}

/* 브랜드 아이콘 (타이틀 글씨 제거하고 아이콘만 심플하게) */
.wiz-brand {
    padding-right: 15px;
    margin-right: 15px;
    border-right: 2px solid #f1f5f9;
}
.wiz-brand .wiz-icon { font-size: 28px; animation: bounce 2s infinite; }
.wiz-brand .wiz-title { display: none; } /* 타이틀 글씨 숨김 (심플하게) */

/* 스크롤 영역 */
.wiz-scroll-track {
    display: flex;
    gap: 10px;       /* 간격 좁힘 */
    overflow-x: auto;
    align-items: center;
}
.wiz-scroll-track::-webkit-scrollbar { display: none; } /* 스크롤바 숨김 */

/* 버튼 스타일 (작게 수정) */
.wiz-btn {
    background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    min-width: 50px; /* 너비 줄임 */
    transition: all 0.2s;
    position: relative;
}
.wiz-btn:hover { transform: translateY(-3px); }

.wiz-btn .icon-box {
    width: 34px; height: 34px; /* 아이콘 박스 크기 축소 */
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; /* 아이콘 크기 축소 */
    color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 텍스트 크기 축소 */
.wiz-btn span { font-size: 10px; font-weight: 600; color: #64748b; letter-spacing: -0.5px; margin-top: 2px; }

/* 구분선 */
.wiz-divider { width: 1px; height: 30px; background: #e2e8f0; margin: 0 5px; }

/* 색상 및 효과는 기존 유지 */
.c-indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.c-red { background: linear-gradient(135deg, #f87171, #ef4444); }
.c-green { background: linear-gradient(135deg, #34d399, #10b981); }
.c-orange { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.c-blue { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.c-purple { background: linear-gradient(135deg, #a78bfa, #8b5cf6); }
.c-pink { background: linear-gradient(135deg, #f472b6, #ec4899); }
.c-teal { background: linear-gradient(135deg, #2dd4bf, #14b8a6); }

/* New 뱃지 위치 조정 */
.new-badge::after {
    content: 'N';
    position: absolute;
    top: -3px; right: 0px;
    background: #ef4444; color: white;
    font-size: 8px; font-weight: bold;
    padding: 1px 4px; border-radius: 8px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}
/* [슬림형] 떠있는 마법사 툴바 */
.wizard-toolbar.floating-island {
    position: absolute;
    top: 15px;                /* 상단 여백 축소 */
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    
    display: flex;
    align-items: center;
    
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    border: 1px solid #e2e8f0;
    border-radius: 40px;      /* 더 둥글게 */
    padding: 5px 20px;        /* 패딩을 대폭 줄여 슬림하게 */
    height: 56px;             /* 높이를 56px로 고정 (매우 슬림) */
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.1);
    width: auto;
    max-width: 95%;
    overflow: hidden;
}

/* 브랜드 아이콘 (작게) */
.wizard-toolbar.floating-island .wiz-brand {
    border-right: 1px solid #eee;
    margin-right: 10px;
    padding-right: 10px;
    display: flex;
    align-items: center;
}
.wizard-toolbar.floating-island .wiz-brand .wiz-icon {
    font-size: 20px; /* 아이콘 크기 축소 */
    animation: bounce 2s infinite;
}
.wizard-toolbar.floating-island .wiz-brand .wiz-title {
    display: none;
}

/* 스크롤 영역 */
.wiz-scroll-track {
    display: flex;
    gap: 8px; /* 버튼 간격 축소 */
    align-items: center;
}

/* 버튼 스타일 (슬림화) */
.wiz-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px; /* 아이콘과 글씨 사이 간격 최소화 */
    min-width: 45px;
    transition: all 0.2s;
    padding: 0;
}
.wiz-btn:hover {
    transform: translateY(-2px);
}

/* 아이콘 박스 (작게) */
.wiz-btn .icon-box {
    width: 28px;  /* 42px -> 28px 로 축소 */
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px; /* 내부 아이콘 크기 축소 */
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 텍스트 (작게) */
.wiz-btn span {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: -0.5px;
}

/* 구분선 */
.wiz-divider {
    width: 1px;
    height: 20px; /* 구분선 높이 축소 */
    background: #e2e8f0;
    margin: 0 5px;
}

/* 색상 테마 (유지) */
.c-indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.c-red { background: linear-gradient(135deg, #f87171, #ef4444); }
.c-green { background: linear-gradient(135deg, #34d399, #10b981); }
.c-orange { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.c-blue { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.c-purple { background: linear-gradient(135deg, #a78bfa, #8b5cf6); }
.c-pink { background: linear-gradient(135deg, #f472b6, #ec4899); }
.c-teal { background: linear-gradient(135deg, #2dd4bf, #14b8a6); }

/* 바운스 애니메이션 */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
/* ========================================================= */
/* [1] 모바일 (기본값): 원래대로 깔끔하게 복구 */
/* ========================================================= */

/* 가로 스크롤 방지 (필수) */
body {
    overflow-x: hidden; 
}

.quick-menu-wrapper {
    /* 모바일에서는 배경색 투명 (원래대로) */
    background-color: transparent !important; 
    
    /* 여백 및 크기 초기화 */
    padding: 0;               
    margin: 20px 0;           
    width: 100%; /* 부모 너비에 딱 맞춤 */
    
    /* 위치 강제 초기화 (PC 설정 무시) */
    position: static;
    left: auto;
    transform: none;
    margin-left: 0 !important;
    margin-right: 0 !important;
    
    box-shadow: none;
    border-radius: 0;
}

/* 모바일에서는 캐릭터 및 타이틀 숨김 */
.bouncing-char, .quick-title-box {
    display: none !important; 
}

/* 모바일 내부 여백 미세 조정 */
.quick-menu-wrapper > div {
    padding: 0 10px;
    width: 100%;
    box-sizing: border-box;
}


/* ========================================================= */
/* [2] PC 화면 (1000px 이상): 디자인 전면 수정 (파란색 라운드 스타일) */
/* ========================================================= */
@media screen and (min-width: 1000px) {

    .quick-menu-wrapper {
        /* 1. 배경 디자인: 노란색 -> 진한 파란색 그라데이션 */
        background: linear-gradient(135deg, #ffc60b 0%, #ffd61e 100%) !important;
        
        /* 2. 크기 및 위치: 화면 꽉 참 방지 & 중앙 정렬 */
        width: 100% !important;
        max-width: 1200px !important; /* 최대 너비 제한 */
        margin: 40px auto !important; /* 위아래 여백 & 중앙 정렬 */
        padding: 50px 40px !important;
        
        /* 3. 테두리 및 그림자: 둥글고 세련되게 */
        border-radius: 30px !important; /* 둥근 모서리 */
        box-shadow: 0 20px 50px rgba(89, 103, 138, 0.2), 
                    0 0 0 1px rgba(139, 112, 112, 0.1) !important; /* 은은한 테두리 */
        
        /* 위치 초기화 */
        position: relative !important;
        left: 0 !important;
        transform: none !important;
        margin-left: auto !important;
        margin-right: auto !important;
        overflow: visible !important; /* 캐릭터가 튀어나올 수 있게 */
    }

    /* 배경 장식 (선택사항: 은은한 빛 효과) */
    .quick-menu-wrapper::before {
        content: '';
        position: absolute;
        top: -150px; right: -150px;
        width: 500px; height: 500px;
        background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
        border-radius: 50%;
        pointer-events: none;
    }

    /* 타이틀 박스 */
    .quick-title-box {
        display: block !important;
        text-align: center;
        margin-bottom: 40px;
        position: relative;
        z-index: 2;
    }
    
    /* 뱃지 스타일 변경 (노랑 -> 파랑 포인트) */
    .qt-badge {
        background-color: #111111 !important; /* 브랜드 컬러 */
        color: #ffffff !important;
        padding: 6px 15px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        display: inline-block;
        margin-bottom: 15px;
        box-shadow: 0 4px 15px rgba(209, 209, 209, 0.671);
    }

    /* 텍스트 색상 변경 (검정 -> 흰색) */
    .qt-text {
        font-size: 36px;
        font-weight: 700;
        margin: 0;
        color: #ffffff !important; /* 흰색 텍스트 */
        letter-spacing: -1px;
        text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }

    /* 내부 아이템들 배치 */
    .quick-menu-wrapper > div {
        padding: 0;
        position: relative;
        z-index: 2;
    }

    /* 캐릭터 이미지 위치 조정 (박스 위로 얹기) */
    .bouncing-char {
        display: block !important;
        position: absolute;
        z-index: 10;
        width: 280px; /* 크기 적당히 조절 */
        
        /* 박스 오른쪽 상단에 걸치게 배치 */
        right: -30px; 
        top: -50px; 
        
        animation: bounceUpDn 3s ease-in-out infinite;
        pointer-events: none;
        filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
    }
}

/* 바운스 애니메이션 */
@keyframes bounceUpDn {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-30px); }
}
/* --- 디자인 판매 모달 스타일 시작 --- */

/* 배경 (어두운 영역) */
#sellModal.modal-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002; /* 기존 코드 유지 */
}

/* 모달 박스 본체 */
#sellModal .modal-box {
    background: #fff;
    width: 90%;          /* 모바일 대응 */
    max-width: 400px;    /* PC 최대 너비 */
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    text-align: center;
    font-family: 'Pretendard', sans-serif; /* 폰트가 없다면 기본 폰트 사용됨 */
    box-sizing: border-box;
}

/* 제목 */
#sellModal .modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #111;
    margin-bottom: 20px;
    margin-top: 0;
}

/* 혜택 안내 박스 (회색/파란색 박스 영역) */
#sellModal .benefit-box {
    background: #f0f7ff;
    border-radius: 12px;
    padding: 15px;
    text-align: left;
    margin-bottom: 25px;
}

#sellModal .benefit-item {
    font-size: 13px;
    color: #444;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    line-height: 1.4;
}

#sellModal .benefit-item:last-child {
    margin-bottom: 0;
}

#sellModal .benefit-icon {
    margin-right: 8px;
    font-size: 14px;
}

#sellModal .highlight {
    color: #007bff; /* 포인트 컬러 (파랑) */
    font-weight: 700;
}

/* 입력창 영역 */
#sellModal .input-group {
    text-align: left;
    margin-bottom: 20px;
}

#sellModal .input-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

#sellModal .ai-input-pretty {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    transition: 0.2s;
}

#sellModal .ai-input-pretty:focus {
    border-color: #007bff;
    outline: none;
}

/* 버튼 영역 */
#sellModal .btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

#sellModal .btn-round {
    flex: 1;
    padding: 12px 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s;
    display: flex;       /* 기존 플렉스 스타일 유지 */
    justify-content: center;
    align-items: center;
}

#sellModal .btn-round.primary {
    background: #007bff;
    color: white;
}

#sellModal .btn-round.primary:hover {
    background: #0056b3;
}

#sellModal .btn-round.cancel {
    background: #f1f3f5;
    color: #333;
}

#sellModal .btn-round.cancel:hover {
    background: #e9ecef;
}
/* 파트너스 콘솔 스타일 */
.partner-order-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.partner-order-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-color: #6366f1;
}
.poc-header {
    display: flex; justify-content: space-between; align-items: start;
    margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #f1f5f9;
}
.poc-badge {
    background: #ef4444; color: white; font-size: 11px; font-weight: bold;
    padding: 3px 8px; border-radius: 4px; animation: pulse 2s infinite;
}
.poc-address {
    font-size: 15px; font-weight: 800; color: #1e293b; margin-bottom: 5px;
}
.poc-items {
    font-size: 13px; color: #64748b; margin-bottom: 15px;
    background: #f8fafc; padding: 10px; border-radius: 6px;
}
.poc-price {
    font-size: 18px; font-weight: 900; color: #0f172a; text-align: right;
    margin-bottom: 15px;
}
.btn-dibs {
    width: 100%; padding: 12px; background: #6366f1; color: white;
    font-weight: 800; border-radius: 8px; border: none; cursor: pointer;
    font-size: 14px; transition: background 0.2s;
}
.btn-dibs:hover { background: #4f46e5; }

/* 탭 활성화 스타일 */
.nav-item.active { background: #eff6ff !important; color: #6366f1 !important; }
.nav-item:not(.active):hover { background: #f8fafc !important; }
/* =========================================
   [모바일 탑바 버튼 순서 수정] (맨 아래에 추가)
   ========================================= */
@media (max-width: 768px) {
    /* 1. 브랜드 로고 숨김 */
    .brand { display: none !important; }

    /* 2. 버튼 순서 재배치 (템플릿을 1번으로!) */
    .template-tabs { order: 1 !important; } /* ★ 템플릿 버튼을 맨 앞으로 */
    
    #btnOrderTop   { order: 2 !important; } /* 장바구니 담기 (노란색) */
    #btnLoginBtn   { order: 3 !important; } /* 로그인/로그아웃 */
    #btnMyLibrary  { order: 4 !important; } /* MY Page (보관함) */
    
    /* 나머지 버튼들 (필요시 순서 조정) */
    #btnHomeTop    { order: 5 !important; } 
    #btnViewCart   { order: 6 !important; } 
    .btn-save-top  { order: 7 !important; }

    /* 3. 좁은 화면을 위한 스타일 최적화 */
    .topbar {
        justify-content: space-between !important;
        padding: 0 5px !important;
    }
    
    .topbar .btn {
        margin: 0 2px !important;
        padding: 0 8px !important;
        font-size: 12px !important;
        height: 36px !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
}
/* =========================================
   [신규] 기여자 시스템 (Contributor) 스타일
   ========================================= */
.contributor-section {
    max-width: 1000px;
    margin: 0 auto 40px auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

/* 상단 그라데이션 바 */
.contributor-section::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
}

.contributor-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 15px; border-bottom: 1px solid #d5eaff; padding-bottom: 15px;
}

.contributor-title {
    font-size: 20px; font-weight: 800; color: #1e293b;
    display: flex; align-items: center; gap: 10px;
}

.contributor-badge {
    font-size: 11px; padding: 4px 8px; border-radius: 20px;
    background: #f1f5f9; color: #64748b; font-weight: bold; border: 1px solid #e2e8f0;
}
/* 등급별 뱃지 컬러 */
.badge-hero { background: linear-gradient(135deg, #ef4444, #f97316); color: white; border: none; box-shadow: 0 2px 5px rgba(239,68,68,0.3); }
.badge-excellent { background: linear-gradient(135deg, #3b82f6, #6366f1); color: white; border: none; box-shadow: 0 2px 5px rgba(59,130,246,0.3); }

.contributor-balance-box { text-align: right; }
.live-money { font-size: 24px; font-weight: 900; color: #16a34a; letter-spacing: -0.5px; }

.contributor-desc {
    font-size: 14px; color: #666; margin-bottom: 20px; background: #f8fafc;
    padding: 10px 15px; border-radius: 8px; line-height: 1.5;
}

.contributor-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px;
}

.contrib-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 20px 10px; cursor: pointer; transition: all 0.2s; position: relative;
}
.contrib-btn:hover {
    transform: translateY(-5px); border-color: #6366f1;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.1);
}

.c-icon-box {
    width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: white; margin-bottom: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.bg-blue { background: #3b82f6; }
.bg-purple { background: #8b5cf6; }
.bg-orange { background: #f59e0b; }
.bg-green { background: #10b981; }

.c-info { text-align: center; }
.c-name { display: block; font-size: 14px; font-weight: 700; color: #334155; margin-bottom: 4px; }
.c-reward { display: block; font-size: 13px; font-weight: 800; color: #6366f1; }
.tier-bonus { font-size: 10px; color: #ef4444; margin-left: 2px; }

/* 모바일 대응 */
@media (max-width: 768px) {
    .contributor-grid { grid-template-columns: repeat(2, 1fr); }
    .contributor-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .contributor-balance-box { width: 100%; text-align: right; background: #f0fdf4; padding: 10px; border-radius: 8px; }
}
/* [공통] 카테고리 텍스트 기본 스타일 */
.quick-text {
    margin-top: 6px;
    font-size: 13px;           /* 한국어 기본 크기 */
    font-weight: 600;
    color: #334155;
    line-height: 1.35;         /* 줄 간격 */
    
    /* 2줄 넘어가면 ... 처리 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    
    height: 36px;              /* 높이 고정 (글자 짤림 방지) */
    padding: 0 2px;
    word-break: keep-all;      /* 단어 단위 줄바꿈 (한국어용) */
}

/* [추가] 영어/일본어일 때 적용되는 스타일 (글씨 축소) */
.long-text-mode .quick-text {
    font-size: 10px !important;  /* 글자 크기 11px로 축소 */
    line-height: 1.25 !important; /* 줄 간격 더 좁게 */
    letter-spacing: -0.5px;      /* 자간 좁히기 */
    word-break: break-all;       /* 긴 영어 단어 강제 줄바꿈 허용 */
    white-space: normal;         /* 줄바꿈 허용 */
    height: 28px !important;     /* 높이 재조정 */
}

/* 모바일 화면에서는 더 작게 */
@media (max-width: 768px) {
    .quick-text { font-size: 12px; height: 32px; }
    .long-text-mode .quick-text { font-size: 10px !important; height: 26px !important; }
}
/* 상단 퀵메뉴 아이템 스타일 (크기 고정) */
.quick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 12px;
    cursor: pointer;
    
    /* ★ 핵심 수정: 너비를 강제로 고정시킵니다 ★ */
    width: 100px !important;      /* 고정 너비 */
    min-width: 100px !important;  /* 줄어들지 않도록 최소폭 지정 */
    flex-shrink: 0;               /* 공간이 좁아도 절대 찌그러지지 않음 */
    
    text-align: center;
    vertical-align: top;
}

/* 이미지 박스 스타일도 꽉 차게 */
.quick-icon {
    width: 100%;       /* 부모(100px)에 꽉 차게 */
    height: 100px;     /* 높이도 고정 (정사각형) */
    border-radius: 18px;
    background: #fff;
    border: 1px solid #f1f5f9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    transition: transform 0.2s;
}