    @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');
    @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');
    @import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&display=swap');
    @import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;700&display=swap');


    body {
        font-family: 'Noto Sans KR', sans-serif;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

   /* ==========================
       상단 메뉴바
    ========================== */
    .horizontal-responsive-nav {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      background-color: #333;
      padding: 0;
      box-sizing: border-box;
    }
    .horizontal-responsive-nav ul {
      list-style: none;
      margin: 0;
      padding: 0;
      text-align: center;
      overflow: hidden;
    }
    .horizontal-responsive-nav ul li {
      display: inline-block;
      width: 10%;
      box-sizing: border-box;
      text-align: center;
    }
    .horizontal-responsive-nav ul li a {
      display: block;
      color: white;
      text-decoration: none;
      padding: 15px 0;
      transition: background-color 0.3s;
    }
    .horizontal-responsive-nav ul li.active {
      background-color: #007bff;
    }
    .horizontal-responsive-nav ul li.active a.disabled-link {
      cursor: default;
      background-color: transparent !important;
      color: white;
    }
    .horizontal-responsive-nav ul li:not(.active) a:hover {
      background-color: #555;
    }

    /* ==================================== */
    /* 입력 컨트롤 영역 */
    /* ==================================== */
    #inputControls {
        width: 500px;
        max-width: 90%;
        background: #fff;
        padding: 20px;
        margin-bottom: 30px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    .controls-header {
        font-size: 18px;
        font-weight: 700;
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 2px solid #3498db;
    }

    .input-group {
        margin-bottom: 15px;
    }

    .input-group label {
        display: block;
        font-size: 14px;
        font-weight: 500;
        margin-bottom: 5px;
        color: #555;
    }

    .input-group input[type="text"], .input-group input[type="file"] {
        width: 100%;
        padding: 8px 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        box-sizing: border-box;
        font-size: 14px;
    }
    
    /* 색상 및 크기 조절기 공통 스타일 */
    .control-row {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 15px;
        padding: 10px;
        border: 1px solid #eee;
        border-radius: 4px;
        background-color: #fafafa;
    }
    .color-selector, .size-selector {
        display: flex;
        align-items: center;
        margin-right: 15px;
        /* 크기 조절기들을 한 줄에 여러 개 표시하기 위해 flex-basis를 줄임 */
        flex: 1 1 auto; 
        min-width: 180px;
    }
    .color-selector label, .size-selector label {
        margin-right: 8px;
        margin-bottom: 0;
        font-weight: 500;
        color: #333;
    }
    .color-selector input[type="color"] {
        width: 30px;
        height: 30px;
        border: none;
        padding: 0;
        cursor: pointer;
        border-radius: 4px;
    }
    .size-selector input[type="range"] {
        width: 100px;
        margin: 0;
    }
    .size-selector span {
        font-size: 12px;
        margin-left: 5px;
        color: #777;
    }
    
    /* 삭제 버튼 스타일 */
    .delete-button {
        background: #e74c3c;
        color: white;
        border: none;
        border-radius: 4px;
        padding: 6px 10px;
        font-size: 13px;
        cursor: pointer;
        transition: background 0.3s;
        margin-top: 10px; 
    }
    .delete-button:hover {
        background: #c0392b;
    }


    .template-selector {
        margin-bottom: 20px;
        padding: 10px;
        border: 1px dashed #ccc;
        border-radius: 4px;
    }
    .template-selector label {
        display: inline-block;
        margin-right: 15px;
        font-weight: 500;
        cursor: pointer;
        margin-bottom: 5px;
    }
    .template-selector span {
        margin-right: 5px;
        font-size: 16px;
    }

    .controls button {
        background: #3498db;
        color: white;
        border: none;
        border-radius: 6px;
        padding: 10px 15px;
        font-size: 15px;
        cursor: pointer;
        transition: background 0.3s;
        margin-right: 5px;
    }
    
    .controls button:hover {
        background: #2980b9;
    }

    /* ==================================== */
    /* 명함 미리보기 영역 공통 스타일 */
    /* ==================================== */
    .card-container {
        /* CSS 변수 기본값 */
        --main-color: #3498db;
        --secondary-color: #1abc9c; 
        --tertiary-color: #2c3e50; 
        --text-color: #222222;
        --contact-color: #666666; 
        --accent-color: #1abc9c;
        --base-font-size: 10px; 
        --vertical-offset: 0mm; 
        --horizontal-offset: 0mm; 
        --bg-image: none; 
        --bg-opacity: 0; 
        --overlay-color: rgba(0, 0, 0, 0.5); 

        width: 90mm; 
        height: 50mm;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        border-radius: 5px;
        overflow: hidden; 
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 10mm;
        box-sizing: border-box;
        transition: all 0.5s ease; 
        background-color: white; 
        position: relative;
        word-wrap: break-word; 
        hyphens: auto;
    }

    /* 배경 이미지 레이어 */
    .card-container::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-image: var(--bg-image);
        background-size: cover;
        background-position: center;
        opacity: 1; 
        z-index: 0;
        pointer-events: none;
    }
    
    /* 텍스트 가독성 향상을 위한 오버레이 (배경 이미지 위에 겹침) */
    .card-container::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: var(--overlay-color); 
        opacity: var(--bg-opacity);
        z-index: 0;
        pointer-events: none;
        transition: opacity 0.3s;
        display: none; 
    }

    /* 텍스트 요소들 */
    .company-logo, .person-info, .contact-info {
        position: relative;
        z-index: 1; 
        font-family: 'Noto Sans KR', sans-serif;
    }
    
    /* 위치 조절 변수 적용 (X, Y 동시 변환) */
    .company-logo { 
        transform: translate(var(--horizontal-offset), var(--vertical-offset)); 
    }
    .person-info { 
        transform: translate(var(--horizontal-offset), var(--vertical-offset)); 
    }
    .contact-info { 
        transform: translate(var(--horizontal-offset), var(--vertical-offset)); 
    }
    
    /* 템플릿 6은 구조가 달라 별도로 설정 */
    .template-6 .company-logo,
    .template-6 .person-info,
    .template-6 .contact-info { 
        /* 템플릿 6은 전체 명함 컨테이너가 flex: row 이므로 translate만 사용 */
        transform: translate(var(--horizontal-offset), var(--vertical-offset));
    }


    /* 연락처 정보 스타일 */
    .contact-info > div {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        max-width: 100%;
        font-size: var(--base-font-size); 
        color: var(--contact-color); 
    }


    /* ==================================== */
    /* 템플릿 별 스타일 (이전과 동일) */
    /* ==================================== */

    /* 템플릿 1: Right Bar */
    .template-1::after { display: block; width: 20%; background: var(--secondary-color); opacity: 1; right: 0; left: auto; }
    .template-1 .company-logo { font-size: calc(var(--base-font-size) * 1.6); font-weight: 700; color: var(--main-color); margin-bottom: calc(var(--base-font-size) * 0.5); }
    .template-1 .name { font-size: calc(var(--base-font-size) * 2.4); font-weight: 700; color: var(--text-color); margin-bottom: 2px; }
    .template-1 .title { font-size: calc(var(--base-font-size) * 1.6); font-weight: 500; color: var(--tertiary-color); margin-bottom: calc(var(--base-font-size) * 0.8); }
    .template-1 .contact-info { line-height: 1.4; text-align: right; margin-top: calc(var(--base-font-size) * 0.5); }
    
    /* 템플릿 2: Clean Center */
    .template-2 .company-logo { font-size: calc(var(--base-font-size) * 1.8); font-weight: 700; color: var(--main-color); margin-bottom: 5px; border-bottom: 1px solid var(--tertiary-color); padding-bottom: 5px; }
    .template-2 .name { font-size: calc(var(--base-font-size) * 2.8); font-weight: 700; color: var(--text-color); margin-bottom: 0; }
    .template-2 .title { font-size: calc(var(--base-font-size) * 1.4); font-weight: 500; color: var(--secondary-color); margin-bottom: 0; }
    
    /* 템플릿 3: Dark Minimal */
    .template-3 { color: white; padding: 10mm 15mm 10mm 10mm; }
    .template-3 .company-logo { font-size: calc(var(--base-font-size) * 1.4); font-weight: 500; color: var(--secondary-color); text-align: right; margin-bottom: calc(var(--base-font-size) * 1.0); }
    .template-3 .name { font-size: calc(var(--base-font-size) * 2.6); font-weight: 700; color: var(--text-color, white); margin-bottom: 0; }
    .template-3 .title { font-size: calc(var(--base-font-size) * 1.6); font-weight: 300; color: var(--accent-color); margin-bottom: 0; }
    
    /* 템플릿 4: Modern Left Bar */
    .template-4::before { display: block; width: 15mm; background-color: var(--secondary-color); background-image: none; opacity: 1; z-index: 0; }
    .template-4 .company-logo { font-family: 'Roboto', sans-serif; font-size: calc(var(--base-font-size) * 1.8); font-weight: 700; color: var(--main-color); margin-bottom: 10px; }
    .template-4 .title { font-family: 'Roboto', sans-serif; font-size: calc(var(--base-font-size) * 1.4); font-weight: 400; color: var(--tertiary-color); margin-bottom: 0; }
    
    /* 템플릿 5: Bottom Stripe */
    .template-5::after { display: block; top: auto; bottom: 0; height: 10px; background-color: var(--secondary-color); opacity: 1; }
    .template-5 .company-logo { font-family: 'Montserrat', sans-serif; font-size: calc(var(--base-font-size) * 1.4); font-weight: 700; color: var(--main-color); margin-bottom: calc(var(--base-font-size) * 2.0); }
    .template-5 .title { font-size: calc(var(--base-font-size) * 1.4); font-weight: 400; color: var(--tertiary-color); margin-bottom: 0; }

    /* 템플릿 6: Elegant Lines */
    .template-6 .contact-info { flex: 1; padding: 10mm; background-color: var(--secondary-color); line-height: 1.8; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; transform: translate(var(--horizontal-offset), var(--vertical-offset)); }
    .template-6 .person-info { flex: 2; padding: 10mm 5mm 10mm 10mm; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--tertiary-color); transform: translate(var(--horizontal-offset), var(--vertical-offset)); }
    .template-6 .company-logo { order: -1; font-size: calc(var(--base-font-size) * 1.2); font-weight: 500; color: var(--main-color); margin-bottom: 10px; transform: translate(var(--horizontal-offset), var(--vertical-offset)); }
    .template-6 .name { font-size: calc(var(--base-font-size) * 2.8); font-weight: 700; color: var(--main-color); margin-bottom: 0; }
    
    /* 템플릿 7: Diagonal Split */
    .template-7 { color: var(--text-color); }
    .template-7 .company-logo { font-size: calc(var(--base-font-size) * 1.2); font-weight: 700; color: var(--secondary-color); }
    .template-7 .name { font-size: calc(var(--base-font-size) * 2.4); font-weight: 700; color: var(--main-color); }
    .template-7 .title { font-size: calc(var(--base-font-size) * 1.4); font-weight: 400; color: var(--tertiary-color); }


    /* 템플릿 8: Stacked Bold */
    .template-8 { color: white; justify-content: flex-start; padding: 10mm 15mm; }
    .template-8 .company-logo { font-family: 'Oswald', sans-serif; font-size: calc(var(--base-font-size) * 2.0); font-weight: 700; color: var(--main-color); margin-bottom: 10px; }
    .template-8 .name { font-family: 'Oswald', sans-serif; font-size: calc(var(--base-font-size) * 3.2); font-weight: 700; color: var(--secondary-color); line-height: 1; }
    .template-8 .title { font-family: 'Oswald', sans-serif; font-size: calc(var(--base-font-size) * 1.6); font-weight: 400; color: var(--tertiary-color); }

    /* 템플릿 9: Simple Transparent */
    .template-9::before { border: 2px solid var(--secondary-color); }
    .template-9 .company-logo { font-size: calc(var(--base-font-size) * 1.4); color: var(--tertiary-color); }
    .template-9 .name { font-size: calc(var(--base-font-size) * 2.0); font-weight: 700; color: var(--main-color); }

    /* 템플릿 10: Corner Flag */
    .template-10::after { border-color: transparent transparent var(--secondary-color) transparent; }
    .template-10 .company-logo { font-family: 'Montserrat', sans-serif; font-size: calc(var(--base-font-size) * 1.4); font-weight: 700; color: var(--main-color); margin-bottom: 10px; order: unset; }
    .template-10 .name { font-size: calc(var(--base-font-size) * 2.6); font-weight: 700; color: var(--accent-color); }
    .template-10 .title { font-size: calc(var(--base-font-size) * 1.4); font-weight: 400; color: var(--tertiary-color); }


    /* 템플릿 11: Image Overlay */
    .template-11 {
        background-color: transparent !important; 
        color: white; 
        justify-content: center; 
        align-items: center; 
        text-align: center;
        padding: 5mm;
    }
    .template-11::after {
        display: block; 
        background: var(--tertiary-color); 
    }
    .template-11 .company-logo { 
        font-family: 'Oswald', sans-serif;
        font-size: calc(var(--base-font-size) * 1.8); 
        font-weight: 700; 
        color: var(--main-color); 
        margin-bottom: 10px;
        order: 0;
    }
    .template-11 .name { 
        font-size: calc(var(--base-font-size) * 3.2); 
        font-weight: 700; 
        color: var(--secondary-color); 
        margin-bottom: 0;
    }
    .template-11 .title { 
        font-size: calc(var(--base-font-size) * 1.6); 
        font-weight: 400; 
        color: var(--accent-color); 
        margin-bottom: 20px;
    }
    .template-11 .contact-info { 
        line-height: 1.4; 
        text-align: center; 
        margin-top: 15px; 
        order: 2;
    }
    .template-11 .contact-info > div { 
        color: white; 
        font-size: var(--base-font-size); 
    }
    .template-11 .person-info { order: 1; margin: 10px 0; }
