/* style-responsive.css - Mobile responsive layout */
/* Version: 9.9.3 (Latest Update) */

/* ======================================================= */
/* ======== 모바??반응???��???(?��? ?�이?�웃) ======== */
/* ======================================================= */
@media (max-width: 768px) {
    .lgu-special-discounts-row {
        flex-direction: row !important;
        gap: 2px !important;
        margin-bottom: 8px !important;
        padding: 0 !important;
    }
    .lgu-special-discounts-row .input-group {
        padding: 4px 1px !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: center !important;
        min-width: 0 !important;
        margin-bottom: 0 !important;
        background-color: #fef2f2 !important; /* 아주 연한 배경 */
        border: 1px solid #fee2e2 !important;
        border-radius: 4px !important;
    }
    body.dark-mode .lgu-special-discounts-row .input-group {
        background-color: #2d1b24 !important;
        border-color: #4b2c3a !important;
    }
    .lgu-special-discounts-row .input-group label {
        font-size: 0.55rem !important;
        margin-bottom: 3px !important;
        text-align: center !important;
        line-height: 1.0 !important;
        height: 2.0em !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        letter-spacing: -0.8px !important;
        color: #c2185b !important;
    }
    body.dark-mode .lgu-special-discounts-row .input-group label {
        color: #f472b6 !important;
    }
    .lgu-special-discounts-row .payment-method-options {
        width: 100% !important;
        margin-top: 0 !important;
        display: flex !important;
        gap: 1px !important;
    }
    .lgu-special-discounts-row .payment-button {
        padding: 3px 0 !important;
        font-size: 0.65rem !important;
        min-height: 26px !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 4px !important;
        white-space: nowrap !important;
    }
    .lgu-special-discounts-row .tooltip-icon {
        display: none !important;
    }
    #printButton { display: none !important; }
    html, body { width: 100% !important; margin: 0; padding: 0; overflow-x: hidden; }
    .container { width: 100% !important; padding: 10px !important; margin: 0 !important; border-radius: 0 !important; box-shadow: none !important; }

    /* 로고 �??�단 ?�더 축소 */
    h1 { margin-top: 40px !important; margin-bottom: 5px !important; }
    h1 img { max-width: 160px !important; }
    .intro-text { margin-bottom: 10px !important; padding: 0 10px !important; }
    .intro-text p { font-size: 0.75rem !important; }
    
    /* 좌우 ?�단 버튼 구석 밀�?배치 */
    .top-left-buttons { 
        top: 5px !important; 
        left: 5px !important; 
        display: flex !important;
        gap: 2px !important;
        transform: scale(0.75);
        transform-origin: top left;
    }
    .top-right-buttons { 
        top: 5px !important; 
        right: 5px !important; 
        transform: scale(0.75);
        transform-origin: top right;
    }
    .icon-button { width: 60px !important; height: 60px !important; }

    /* 6�?버튼 (2x2x2 배치) - 초기 ?�면??*/
    #calculator-choice-wrapper { 
        display: block; /* JS�??�어 가??*/
        padding: 10px 0; 
    }
    #choice-buttons-wrapper { display: block; }
    .grid-area { 
        display: grid !important; 
        grid-template-columns: 1fr 1fr !important; /* 메인 메뉴??2??2x2x2) ?��? */
        gap: 8px !important; 
        padding: 0 5px;
    }
    .choice-button { 
        min-height: 80px !important; /* ?�이 증�? */
        padding: 12px 8px !important; 
        border: 2px solid #1a73e8 !important;
        background-color: #f4f8ff !important;
        border-radius: 10px !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        max-width: none !important; /* 갤럭???�드 ???��? ?�면?�서 컬럼??가??채우?�록 ?�정 */
    }
    .choice-button strong { font-size: 0.9rem !important; margin-bottom: 5px !important; display: block; }
    .choice-button span { font-size: 0.7rem !important; line-height: 1.2; display: block; }

    /* 계산�?본문 ?�이?�웃 */
    .main-content { 
        display: none; 
        flex-direction: row; 
        flex-wrap: wrap; 
        gap: 8px; 
        padding: 5px 0;
    }
    /* 계산�??�성????(Phone �?Internet 공통 ?�?? */
    #main-calculator-content-wrapper[style*="display: flex"],
    #main-calculator-content-wrapper[style*="display: block"],
    #calculator-main-wrapper[style*="display: block"] .main-content {
        display: flex !important;
    }

    /* 기본 ?�션 (?�독 계산 ??: 가로로 ?�게 100% */
    .section { 
        flex: 0 0 100% !important; 
        width: 100% !important;
        padding: 10px !important;
        font-size: 0.75rem !important;
        margin-bottom: 15px !important;
        border-radius: 6px !important;
    }

    /* 비교 모드???�만 좌우 축소 배치 */
    .main-content.comparison-mode,
    #main-calculator-content-wrapper.comparison-mode { 
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .main-content.comparison-mode .section,
    #main-calculator-content-wrapper.comparison-mode .section { 
        flex: 0 0 48% !important; 
        min-width: 160px !important;
        margin-bottom: 0 !important;
        padding: 8px 5px !important;
        font-size: 0.7rem !important;
    }

    /* ?�신??�?결합 ?�인 ?�형 버튼 (?�연??Flex 배치 �??�스??최적?? */
    .carrier-buttons, .discount-type-buttons, .payment-method-options { 
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px !important; 
    }

    /* 기기�??��? 방식 버튼?� ?�외?�으�???�??��? �??�이 조절 */
    .device-payment-row .payment-method-options {
        flex-wrap: nowrap !important;
    }
    .device-payment-row input.number-input,
    .device-payment-row .payment-button {
        height: 34px !important; /* 모바?�에?�는 ?�짝 ??�� */
        min-height: 34px !important;
        font-size: 0.75rem !important;
    }
    .device-payment-row .input-group label {
        font-size: 0.65rem !important;
        height: 16px !important;
    }

    /* 비교 모드????기기�??�을 ?�로�??�아 ?�역 ?�보 */
    .comparison-mode .device-payment-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 5px !important;
    }
    .comparison-mode .device-payment-row .input-group {
        flex: none !important;
        width: 100% !important;
    }
    .comparison-mode .device-payment-row .input-group:last-child {
        min-width: 0 !important;
    }
    .comparison-mode .device-payment-row .payment-method-options {
        width: 100% !important;
    }

    /* ?��? 개월??버튼 3??배치 (비교 모드 최적?? */
    .comparison-mode .installment-months-container {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 4px !important;
        padding: 6px !important;
    }
    .comparison-mode .installment-month-button {
        padding: 4px 2px !important;
        font-size: 0.65rem !important;
        min-height: 30px !important;
    }

    .carrier-button, .discount-button, .payment-button, .maintenance-month-button { 
        flex: 1 1 30% !important; /* 기본 3개씩, ?�으�??�게 채�? */
        min-width: 0 !important;
        min-height: 34px !important; /* ?�이 ?�간 조절 */
        padding: 4px 2px !important; 
        font-size: 0.62rem !important; 
        line-height: 1.2 !important;
        letter-spacing: -0.5px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        text-align: center;
        white-space: normal !important; /* ?�동 줄바�??�용 */
        word-break: keep-all !important; /* ?�어 ?�위 줄바�?*/
    }
    .carrier-button img { max-height: 18px !important; max-width: 85% !important; }

    /* ?�력�?�?기�? UI 극소??*/
    /* [UX 개편 2026-07] NN/g 터치 타깃·가독성 기준 반영:
       - 입력창 font-size 16px: iOS에서 포커스 시 화면이 강제 확대되는 문제 방지 (16px 미만이 원인)
       - 입력창 높이 42px / 계산 버튼 최소 48px: 터치 타깃 최소 44px 권고에 맞춤 */
    .input-group label { font-size: 0.75rem !important; margin-bottom: 3px !important; }
    .input-group input, .input-group select { padding: 8px 10px !important; font-size: 16px !important; height: 42px !important; }
    .calc-button { padding: 13px !important; font-size: 1rem !important; border-radius: 12px !important; min-height: 48px !important; }
    
    /* ?�짜 계산�?모달 최적??(가�???줄이�?콤팩?�하�? */
    #dateCalcModal .modal-content {
        padding: 12px !important;
        width: 90% !important;
        max-width: 320px !important; /* ?�업 ?�체�??�게 고정 */
        max-height: 85vh !important;
        margin: 10% auto !important;
        overflow-y: auto !important;
    }
    #dateCalcModal h2 { font-size: 1rem; margin-bottom: 3px; }
    #dateCalcModal p { font-size: 0.65rem; margin-bottom: 8px; line-height: 1.2; }
    
    .date-calculator {
        display: flex !important;
        flex-direction: column !important; /* ?�로 배치�?공간 ?�약 */
        gap: 8px !important;
    }
    .date-calculator-section {
        padding: 8px !important;
        border-radius: 6px !important;
        background: #f8f9fa !important;
    }
    .date-calculator-section h3 { font-size: 0.8rem; margin-bottom: 5px; }
    .date-input-group { gap: 3px !important; }
    .date-input-group input { padding: 4px !important; font-size: 0.8rem !important; height: 28px !important; }
    .date-calculator-section .calc-button { padding: 6px !important; font-size: 0.8rem !important; margin-top: 5px !important; }
    .date-calculator-section .result { font-size: 0.8rem !important; margin-top: 5px !important; }
    .date-calculator-section .info-box { font-size: 0.65rem !important; padding: 5px !important; }
    
    /* 간편 계산�?모달 최적??*/
    #simple-calculator-content h1 { font-size: 1.2rem; margin-bottom: 10px; }
    #simple-calculator-content h2 { font-size: 0.9rem; margin-top: 15px; margin-bottom: 10px; }
    #simple-calculator-content .options-container { 
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 5px !important; 
    }
    #simple-calculator-content .option-button { 
        flex: 1 1 30% !important; 
        min-width: 0 !important;
        min-height: 35px !important; 
        padding: 5px 2px !important; 
        font-size: 0.65rem !important; 
        line-height: 1.2 !important;
        border-radius: 6px !important;
    }
    #simple-calculator-modal .simple-results-table { font-size: 0.7rem !important; }
    #simple-calculator-modal .simple-results-table th, 
    #simple-calculator-modal .simple-results-table td { padding: 6px 4px !important; }

    /* 모바???�치 즉각 반응???�한 최적??*/
    * { 
        -webkit-tap-highlight-color: transparent !important; /* ?�치 ??번쩍?�는 ?�색/?�색 ?�이?�이???�거 */
    }
    
    .choice-button { 
        transition: none !important; /* ?�니메이???�과 ?�거 */
        transform: none !important;
    }
    
    /* 모바???�치 ??버튼 ?�상 변??방�? */
    .choice-button:hover, .choice-button:active { 
        background-color: #f4f8ff !important; 
        color: #1a73e8 !important;
        transition: none !important;
    }
    
    /* ?�신??버튼: ?�택 ???�두리만 ?��???(기존 ?��???복구) */
    .carrier-button.active {
        background-color: #fff !important;
        border: 2px solid #1a73e8 !important;
        color: #333 !important;
        font-weight: bold !important;
    }
    
    /* 기�? 버튼?�의 ?�버 ?�과 ?�거 (?�치 지??방�?) */
    .payment-button:not(.active):hover, 
    .discount-button:not(.active):hover, 
    .option-button:not(.active):hover { 
        background-color: transparent !important; 
    }
    
    /* 계산 버튼?� ?�버 ?�에??배경???��? */
    .calc-button:hover {
        background-color: #1a73e8 !important; /* ?�래 ?�상 ?��? */
        color: #fff !important;
    }
    
    /* ?�치 ?�드백만 ?�짝 (?�르???�낌�??��?) */
    .choice-button:active, .carrier-button:active, .payment-button:active {
        opacity: 0.85;
        transform: scale(0.98);
    }

    /* 결합?�인 ?�세?�보 모달 ?�스??축소 */
    #combinationInfoModal .modal-content { width: 95% !important; padding: 0 !important; }
    .combination-table-wrapper h3 { font-size: 0.85rem !important; margin-bottom: 5px !important; padding-left: 8px !important; }
    .combination-table { font-size: 0.65rem !important; }
    .combination-table th, .combination-table td { padding: 5px 2px !important; line-height: 1.1 !important; }
    .combination-content { padding: 10px !important; max-height: 70vh !important; }

    /* ?별 ?금??(1~24개월) 모바??최적??*/
    .monthly-table {
        font-size: 0.65em !important; /* 글??기 ???축소 */
        width: 100% !important; /* 화면 너비에 꽉 맞춤 */
        max-width: 100% !important;
        margin: 0 auto !important;
        table-layout: fixed !important; /* 열 너비를 강제로 고정하여 5열 모두 표시 */
        border-collapse: collapse !important;
        box-sizing: border-box !important;
    }

    .monthly-table-wrapper {
        width: 100% !important;
        overflow-x: hidden !important; /* 가로 스크롤 강제 제거 */
        padding: 0 !important;
        margin: 15px 0 !important;
        box-sizing: border-box !important;
    }

    /* 단독 모드일 때만 콤팩트하게 축소 */
    .monthly-table.single-mode-table {
        width: auto !important;
        min-width: 260px !important;
        table-layout: auto !important;
    }

    .monthly-table th, .monthly-table td {
        padding: 4px 1px !important; /* 패딩을 극단적으로 줄여 공간 확보 */
        width: auto !important;
        white-space: nowrap !important;
        text-align: center !important;
        overflow: hidden;
        text-overflow: clip;
        box-sizing: border-box !important;
    }

    /* 개월?컬럼 ?비 고정 */
    .monthly-table th:first-child, .monthly-table td:first-child {
        width: 30px !important; 
        min-width: 30px !important;
    }

    /* 비교 모드에서 각 금액 열 너비 균등 배분 */
    .monthly-table:not(.single-mode-table) th, 
    .monthly-table:not(.single-mode-table) td {
        width: calc((100% - 30px) / 4) !important;
    }

    /* 통신사 선택 버튼은 항상 3열 고정 (SK, KT, LG) */
    .carrier-buttons {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        width: 100% !important;
        margin-bottom: 8px !important;
    }

    .carrier-buttons button {
        width: 100% !important;
        flex: none !important; /* flex 무시하고 grid 전용 배치 */
        min-width: 0 !important;
        padding: 10px 2px !important;
        font-size: 0.8rem !important; /* 통신사 로고나 텍스트가 잘 보이게 */
    }

    /* 인터넷 계산기 전용 버튼 유연한 배치 (2x2 또는 3x1) - 타 페이지 간섭 방지 */
    #carrier-1-section .payment-method-options, 
    #carrier-2-section .payment-method-options,
    #carrier-1-section .discount-type-buttons,
    #carrier-2-section .discount-type-buttons,
    #plan-change-options-1 .payment-method-options,
    #plan-change-options-2 .payment-method-options {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        width: 100% !important;
        margin-bottom: 5px;
    }

    #carrier-1-section .payment-method-options button, 
    #carrier-2-section .payment-method-options button,
    #carrier-1-section .discount-type-buttons button,
    #carrier-2-section .discount-type-buttons button,
    #plan-change-options-1 .payment-method-options button,
    #plan-change-options-2 .payment-method-options button {
        flex: 1 1 calc(33.33% - 10px) !important;
        min-width: 80px !important;
        padding: 6px 2px !important; 
        font-size: 0.68rem !important;
        margin: 0 !important;
        letter-spacing: -0.6px !important;
        line-height: 1.1 !important;
        word-break: break-all !important;
        white-space: normal !important;
        height: auto !important;
        min-height: 44px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        box-sizing: border-box !important;
    }

    /* 누적 금액 컬럼 강조 및 텍스트 정렬 */
    .monthly-table td:nth-child(even) {
        background-color: rgba(0,0,0,0.02); /* 가독성을 위한 미세한 배경색 */
    }

    /* 공�??�항 ?�이지 최적??*/
    .notice-link-item { padding: 0.8rem 1rem !important; }
    .notice-link-item h2 { font-size: 0.95rem !important; }
    .notice-link-item p { font-size: 0.75rem !important; }
    
    #notice-title { font-size: 1.25rem !important; margin-bottom: 0.5rem !important; }
    #notice-date { font-size: 0.75rem !important; margin-bottom: 1rem !important; padding-bottom: 1rem !important; }
    .ql-editor { font-size: 0.85rem !important; line-height: 1.5 !important; padding: 0 !important; }
    
    .bg-indigo-600 { padding: 6px 12px !important; font-size: 0.8rem !important; }
    h1.text-3xl { font-size: 1.5rem !important; }

    .footer-container { margin-top: 10px !important; padding-bottom: 20px !important; font-size: 0.7rem !important; }
}

/* 복�??�인 ?�내 모달 ?��???*/
.welfare-guide-section {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-bottom: 15px;
}
.welfare-step {
    font-size: 1.05em;
    margin: 10px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.step-badge {
    background: #e8f0fe;
    color: #1a73e8;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    border: 1px solid #1a73e8;
}
.welfare-desc {
    font-size: 0.9em;
    color: #666;
    margin: 5px 0 0 5px;
    line-height: 1.5;
}

/* 복�??�인 ?�터?�티�??��???*/
.welfare-step-title {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}
.welfare-step-title span {
    background: #1a73e8;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
}
.welfare-carrier-btn {
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: popIn 0.4s ease backwards;
}
.welfare-carrier-btn:nth-child(1) { animation-delay: 0.1s; }
.welfare-carrier-btn:nth-child(2) { animation-delay: 0.2s; }
.welfare-carrier-btn:nth-child(3) { animation-delay: 0.3s; }

.welfare-carrier-btn.active {
    border-color: #1a73e8;
    background-color: #e8f0fe;
    box-shadow: 0 0 0 2px #1a73e8;
    transform: scale(1.05);
}

/* 결합 ?�품 버튼 �?복�? ?�형 버튼 ?�니메이??*/
.welfare-combo-btn, .welfare-type-btn {
    animation: popIn 0.4s ease backwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ?�계 컨테?�너가 ?��????�의 ?�니메이??*/
#welfare-combo-selection, #welfare-type-selection, #welfare-detail-result {
    animation: fadeInSlide 0.5s ease-out forwards;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welfare-type-btn {
    padding: 12px 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95em;
    font-weight: 500;
    white-space: normal;
    word-break: keep-all;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    text-align: center;
}
.welfare-type-btn:hover { background: #f8f9fa; }
.welfare-type-btn.active {
    background: #1a73e8;
    color: #fff;
    border-color: #1a73e8;
}

.welfare-result-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
.welfare-example-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    background: #fff;
    border: 1px solid #eee;
}
.welfare-example-card.high .card-header { background: #e3f2fd; color: #1a73e8; border-bottom: 1px solid #bbdefb; }
.welfare-example-card.low .card-header { background: #f1f8e9; color: #388e3c; border-bottom: 1px solid #dcedc8; }
.card-header { padding: 10px 15px; font-weight: bold; font-size: 0.9em; }
.card-body { padding: 20px; }
.card-body h5 { margin: 0 0 5px 0; font-size: 1.2em; color: #333; }
.base-fee { font-size: 0.95em; color: #666; margin-bottom: 15px; }

/* 복�??�인 ?�세 ?�술???��???*/
.narrative-container {
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    font-size: 0.9em;
    word-break: keep-all;
    overflow-wrap: break-word;
}
.narrative-step {
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    line-height: 1.5;
    color: #444;
    opacity: 0; /* 초기 ?�태: ?�명 */
    transform: translateY(10px); /* 초기 ?�태: ?�간 ?�래 */
    animation: fadeInUp 0.4s ease forwards;
}

/* 복�??�인 ?�레?�션 ?�크모드 */
body.dark-mode .narrative-container {
    background-color: #111827 !important;
    border-color: #374151 !important;
}

body.dark-mode .narrative-step {
    color: #e5e7eb !important;
    border-bottom-color: #374151 !important;
}

body.dark-mode .narrative-step strong {
    color: #ffffff !important;
}

body.dark-mode .narrative-step .step-num {
    background-color: #4b5563 !important;
    color: #ffffff !important;
}

body.dark-mode .narrative-step.final {
    border-top-color: #4b5563 !important;
    color: #ffffff !important;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.narrative-step:nth-child(1) { animation-delay: 0.1s; }
.narrative-step:nth-child(2) { animation-delay: 0.3s; }
.narrative-step:nth-child(3) { animation-delay: 0.5s; }
.narrative-step:nth-child(4) { animation-delay: 0.7s; }
.narrative-step:nth-child(5) { animation-delay: 0.9s; }
.narrative-step:nth-child(6) { animation-delay: 1.1s; }

.narrative-step:last-child { border-bottom: none; }
.narrative-step .step-num {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #777;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-size: 0.75em;
    margin-right: 6px;
    vertical-align: middle;
}
.narrative-step.final .step-num { background: #d32f2f; }
.narrative-step.final {
    border-top: 1px solid #ddd;
    margin-top: 5px;
    padding-top: 10px;
    color: #000;
}
.minus-val { color: #d93025; font-weight: bold; }

.order-info { background: #f8f9fa; padding: 8px; border-radius: 4px; font-size: 0.85em; color: #555; margin-bottom: 15px; border-left: 3px solid #ddd; }
.card-body ul { list-style: none; padding: 0; margin: 0 0 20px 0; }
.card-body li { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95em; }
.card-body li .label { color: #777; }
.card-body li .val { font-weight: bold; color: #d93025; }
.total-row { border-top: 2px solid #eee; padding-top: 15px; font-weight: bold; font-size: 1.1em; display: flex; justify-content: space-between; align-items: center; }
.total-row span { color: #1a73e8; font-size: 1.2em; }

/* 결합 ?�품 버튼 ?�용 ?��???*/
.welfare-combo-btn {
    border-color: #e0e0e0;
    background: #fafafa;
}
.welfare-combo-btn.active {
    background: #34a853; /* 결합 버튼?� 초록?�으�?구분 */
    color: #fff;
    border-color: #34a853;
}

@media (max-width: 600px) {
    .welfare-result-container { grid-template-columns: 1fr; }
}



/* 복�??�인 ???��???*/
.welfare-tab-content {
    display: none;
}
.welfare-tab-content.active {
    display: block;
}
.formula-box {
    background: #f1f3f4;
    padding: 10px;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.95em;
    margin: 15px 0;
    border-left: 4px solid #5f6368;
}
.example-box {
    background: #fff8e1;
    padding: 15px;
    border-radius: 8px;
    border: 1px dashed #ffc107;
    margin-top: 15px;
}
.example-box ul {
    margin: 10px 0 0 20px;
    padding: 0;
}
.example-box li {
    margin-bottom: 5px;
    font-size: 0.9em;
}

/* ======================================================= */
/* ?�▼??[?�정?? 모바??결과 ?�면 ?��???개선 ?�▼??*/
/* ======================================================= */

/* 결과 ?�약 ?�스??기본 ?��???(PC) */
.result-summary-text {
    font-size: 1.2em;
    font-weight: bold;
}

/* 모바???�면 (768px ?�하) ?�??*/
@media (max-width: 768px) {
    /* 결과 요약 섹션: 비교 시 2열, 단독 시 1열 자동 조정 */
    #result-summary-section {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 8px !important;
        padding: 10px 5px !important;
        width: 100% !important;
    }

    .result-summary-text {
        font-size: 0.8em !important;
        margin: 0 !important;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 4px !important;
        background-color: rgba(0,0,0,0.03);
        border-radius: 8px;
        min-width: 0 !important;
    }

    body.dark-mode .result-summary-text {
        background-color: rgba(255,255,255,0.05);
    }
    
    /* 요금제 이름 (strong 태그) */
    .result-summary-text strong {
        font-size: 0.75em !important; /* 레이블 크기 약간 더 축소 */
        margin-bottom: 5px;
        word-break: keep-all; /* 공백 기준 줄바꿈 */
        line-height: 1.2;
        display: block;
        width: 100%;
        text-align: center;
        white-space: normal !important;
    }

    /* 결과값(span 태그) 글자 축소 및 강조 */
    #storeTotal, #unlockedTotal, #carrier1-total, #carrier2-total {
        font-size: 1.05em !important; 
        font-weight: bold;
        color: #1a73e8;
        display: block;
        width: 100%;
        text-align: center;
        word-break: break-word;
    }

    /* 계산?�기 버튼 ?�라�?방�? (강력?�게 ?�용) */
    #mainCalcButton {
        /* display: block !important; ?�거??- JS ?�어 ?�름 */
        position: relative;
        z-index: 9999; /* ?�이??최상??*/
        margin-top: 20px;
        opacity: 1 !important;
        visibility: visible !important;
        width: 100% !important; /* 가�?�?차게 */
        background-color: #1a73e8 !important; /* 배경??강제 지??*/
        color: white !important; /* 글?�색 강제 지??*/
        padding: 15px !important; /* ?�딩 ?�보 */
    }

    /* 인터넷 결과 카드/표 전용 최적화 */
    .monthly-table-wrapper {
        overflow-x: auto !important; /* 가로 스크롤 명시 */
        -webkit-overflow-scrolling: touch;
        margin-bottom: 20px;
    }

    /* 인터넷 표 헤더 글자 크기 추가 축소 */
    .result-table th {
        font-size: 0.9em !important;
        white-space: nowrap !important;
    }

    #discount-breakdown {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 8px !important;
        justify-content: center !important;
        align-items: stretch !important;
        overflow: visible !important;
        padding-top: 15px !important;
    }

    .breakdown-card {
        padding: 8px 4px !important;
        font-size: 0.62em !important;
        margin: 0 !important;
        border-radius: 6px !important;
        display: flex;
        flex-direction: column;
        min-width: 0 !important;
        height: 100%;
    }

    /* 카드 요소 축소 */
    .breakdown-card h5 {
        font-size: 0.85em !important;
        margin: 2px 0 !important;
    }

    .breakdown-card li {
        padding: 1px 0 !important;
        line-height: 1.1 !important;
        font-size: 0.95em !important;
    }

    .breakdown-card .total-cost-section strong {
        font-size: 1.05em !important; /* 총금액 글자 크기 더 축소 */
        margin-top: 2px !important;
        word-break: keep-all;
    }

    .breakdown-card .total-cost-section p {
        font-size: 0.8em !important; /* "총 비용" 라벨 축소 */
        margin: 0 !important;
    }

    .breakdown-card .device-price-section strong {
        font-size: 0.95em !important;
    }

    /* 인터넷/기타 요약 총액 영역 글자 축소 */
    .summary-total {
        font-size: 0.9em !important;
    }

    .summary-total strong {
        font-size: 1.05em !important;
        word-break: keep-all;
    }
    .winner-badge {
        padding: 2px 5px !important;
        font-size: 0.65em !important;
        top: -12px !important; /* ?�로 조금 ???�림 */
        right: 0 !important; /* ?�른�??�에 맞춤 */
        border-radius: 4px !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
    }

    /* ?�▼??복�??�인 모달 모바??최적??(?�규 추�?) ?�▼??*/
    
    /* 1. 버튼 3??배치 (??줄에 3개씩) */
    .welfare-type-buttons, #welfare-combo-buttons {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important; /* 3??강제 */
        gap: 5px !important;
    }

    /* 버튼 글???�기 축소 */
    .welfare-type-btn, .welfare-combo-btn {
        padding: 8px 2px !important;
        font-size: 0.7em !important; /* 글???�기 줄임 */
        min-height: 40px !important; /* ?�이 줄임 */
        line-height: 1.2 !important;
    }

    /* 2. 결과 카드 좌우 배치 (비교 상태 시 자동 대응) */
    .welfare-result-container {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 8px !important;
        margin-top: 15px !important;
    }

    /* 결과 카드 ?��? ?��???축소 */
    .welfare-example-card {
        border-radius: 8px !important;
        font-size: 0.75em !important; /* ?�체 글�?축소 */
    }

    .card-header {
        padding: 8px 5px !important;
        font-size: 0.9em !important;
        text-align: center;
        white-space: nowrap;
    }

    .card-body {
        padding: 10px 5px !important;
    }

    .card-body h5 {
        font-size: 1.1em !important;
        margin-bottom: 5px !important;
        text-align: center;
    }

    .base-fee {
        font-size: 0.9em !important;
        margin-bottom: 8px !important;
        text-align: center;
    }

    .card-body ul {
        margin: 0 !important;
        padding: 0 !important;
    }

    .card-body li {
        font-size: 0.9em !important;
        margin-bottom: 4px !important;
    }

    .total-row {
        padding-top: 8px !important;
        font-size: 1em !important;
        flex-direction: column !important; /* 총액 부분�? 공간 부�????�아?�로 */
        align-items: flex-end !important;
    }
    
    .total-row span {
        font-size: 1.2em !important;
    }
}

/* PC 버전 ?�용 맨위�?버튼 ?��???*/
.pc-scroll-top-container.fixed {
    position: fixed;
    bottom: 50px;
    right: calc(50% - 600px); /* 중앙 컨테?�너 ?�에 ?�치?�도�?조정 (컨테?�너 ?�비???�라 조절 가?? */
    z-index: 1000;
    display: none; /* ?�크립트�??�어 */
    opacity: 0;
    transition: opacity 0.3s ease, right 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ?�면???�아?�서 버튼??컨테?�너?� 겹칠 경우�??��?*/
@media (max-width: 1300px) {
    .pc-scroll-top-container.fixed {
        right: 20px;
    }
}

.pc-scroll-top-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background-color: white; /* 가?�성???�해 배경??추�? */
    border: 2px solid #ff4d4f; /* 붉�????�모�?*/
    border-radius: 8px;
    color: #ff4d4f; /* 붉�? 글??*/
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    font-weight: bold;
    gap: 5px;
}

.pc-scroll-top-btn:hover {
    background-color: #fff1f0;
    transform: translateY(-5px);
}

.pc-scroll-top-btn i {
    font-size: 24px;
}

/* 결과 패널이 표시된 상태: 컨테이너가 1800px로 확장되므로 맨위로 버튼도 우측으로 따라 이동 */
@media (min-width: 1820px) {
    body:has(> .container > #result.result-section[style*="block"]) .pc-scroll-top-container.fixed {
        right: calc(50% - 910px);
    }
}

/* 결과 패널 표시 + 좁은 PC 화면: 1800px 컨테이너가 뷰포트보다 넓으므로 우측 가장자리 고정 */
@media (min-width: 769px) and (max-width: 1819.98px) {
    body:has(> .container > #result.result-section[style*="block"]) .pc-scroll-top-container.fixed {
        right: 20px;
    }
}

/* 모바?에?는 ?? */
@media (max-width: 768px) {
    .pc-scroll-top-container.fixed {
        display: none !important;
    }

    /* 각종 계산기 비교 결과 카드 모바일 좌우 배치 (비교 시 자동 대응) */
    .installation-fee-comparison {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 8px !important;
        flex-wrap: nowrap !important;
    }

    .installation-fee-comparison > .result-card,
    .breakdown-card.compact,
    .carrier-breakdown-column,
    .result-card,
    .family-card-result {
        min-width: 0 !important;
        padding: 8px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    #discount-breakdown {
        flex-wrap: wrap !important; /* nowrap에서 wrap으로 변경하여 auto-fit이 작동하게 함 */
    }

    .result-breakdown {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 8px !important;
    }
}

/* ======================================================= */
/* ===== PC/태블릿(769px+) 메인 계산기: 계산기 → 좌측 / 결과 → 우측 슬라이드 ===== */
/* ======================================================= */
/* 자동 계산 도입으로 메인 계산하기 버튼은 어떤 환경에서도 노출하지 않음
   (JS가 inline display를 지정하더라도 !important로 차단) */
#mainCalcButton {
    display: none !important;
}

/* 일할계산 토글: 계산기 본체(#main-calculator-content-wrapper) 안 맨 위에서
   전체 폭을 차지하고, 그 아래로 입력 섹션들이 배치되도록 */
#main-calculator-content-wrapper > #prorate-option-group {
    flex: 1 0 100%;
    order: -1;
    margin-top: 0 !important;
    margin-bottom: 12px !important;
}

/* 닫기 버튼: 모바일에서는 항상 숨김 */
.result-slide-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 14px;
    width: 34px;
    height: 34px;
    line-height: 1;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    color: #333;
    font-size: 1.4em;
    font-weight: bold;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 3;
    transition: background 0.2s ease;
}
.result-slide-close:hover { background: rgba(0, 0, 0, 0.16); }
body.dark-mode .result-slide-close { background: rgba(255, 255, 255, 0.12); color: #eee; }
body.dark-mode .result-slide-close:hover { background: rgba(255, 255, 255, 0.22); }

@media (min-width: 769px) {
    /* 계산기 영역에 트랜지션 — 결과가 켜질 때 폭이 줄어드는 동작을 부드럽게 */
    body > .container > #main-calculator-content-wrapper {
        transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                    max-width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* === 결과가 표시된 상태(#result의 inline style에 "block" 포함)일 때만 2단 레이아웃 활성화 ===
       좌측은 비교 모드의 두 입력 섹션이 가로로 나란히 들어가도록 더 넓게 잡음 */
    body:has(> .container > #result.result-section[style*="block"]) > .container {
        max-width: 1800px;
        display: grid;
        grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr);
        grid-auto-flow: dense;
        column-gap: 28px;
        row-gap: 0;
        align-items: start;
    }

    /* 기본은 전체 폭(헤더/공지 등) */
    body:has(> .container > #result.result-section[style*="block"]) > .container > * {
        grid-column: 1 / -1;
        min-width: 0;
    }

    /* 좌측 컬럼: 계산기 본체 + 오류 메시지 (일할계산 토글은 이제 계산기 안으로 이동, 계산하기 버튼은 자동 계산으로 대체되어 숨김) */
    body:has(> .container > #result.result-section[style*="block"]) > .container > #main-calculator-content-wrapper,
    body:has(> .container > #result.result-section[style*="block"]) > .container > #error-message {
        grid-column: 1 / 2;
        max-width: 100%;
    }

    /* 우측 컬럼: 결과 패널 (dense 배치로 계산기와 같은 행에 자동 정렬) */
    body:has(> .container > #result.result-section[style*="block"]) > .container > #result.result-section {
        grid-column: 2 / 3;
        margin-top: 0;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        overflow-x: hidden;
        position: sticky;
        top: 20px;
        padding-top: 50px; /* 우상단 닫기 버튼 자리 */
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
        animation: phoneResultSideSlideIn 1.1s cubic-bezier(0.16, 1, 0.3, 1);
    }
    body.dark-mode:has(> .container > #result.result-section[style*="block"]) > .container > #result.result-section {
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
    }

    /* 결과 보일 때:
       - 일할계산 토글(#prorate-option-group)은 flex: 1 0 100%로 첫 행을 차지
       - 그 아래 입력 섹션 두 개는 같은 행에 좌우로 나란히 배치 (flex-basis 0 + flex-grow 1) */
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.main-content {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px 16px;
    }
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.main-content > .section {
        flex: 1 1 0;
        min-width: 0; /* 기본 min-width: 300px를 풀어 좁아져도 줄바꿈되지 않게 */
        padding: 14px;
    }

    /* 우측 패널 안의 월별표는 폭이 좁아도 가로 스크롤로 볼 수 있게 */
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .monthly-table-wrapper {
        overflow-x: auto;
    }

    /* PC/태블릿에서만 닫기(×) 버튼 노출 — 클릭 시 결과 숨기면 자동으로 계산기 풀폭 복귀 */
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .result-slide-close {
        display: flex;
    }

    /* 결합/할인 상세 카드(#discount-breakdown) — 결과 패널이 좁아져도
       세로로 떨어지지 않고 항상 좌우(grid)로 배치, 카드 내부만 축소 */
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section #discount-breakdown {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
        gap: 10px !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
    }
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section #discount-breakdown > * {
        flex: none;
        min-width: 0;
        width: auto;
    }

    /* ===========================================================
       결과 패널이 열려 있을 때(2단 레이아웃) + 비교 모드 →
       좌측 계산기 한 섹션이 절반 폭으로 줄어 "초기 요금제 | 유지기간"이
       가로로 다 안 들어감. 이때만 .plan-maintenance-row를 세로 스택으로
       바꿔서 초기 요금제 아래에 요금제 유지기간이 오도록 함.
       =========================================================== */
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .plan-maintenance-row,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .plan-maintenance-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .plan-maintenance-row .input-group,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .plan-maintenance-row .input-group,
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .plan-maintenance-row .maintenance-group,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .plan-maintenance-row .maintenance-group {
        flex: none;
        width: 100%;
    }

    /* 통신사 선택 버튼(.carrier-buttons) — 비교+결과 패널로 섹션이 좁아져도
       2열로 떨어지지 않게 통신사 개수만큼 고정 컬럼으로 강제.
       매장 섹션은 3개(SKT/KT/LGU) → 3열,
       자급제는 4개(SKT/KT/LGU/MVNO) → 4열 일렬. */
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode #carrier-buttons-store,
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode #carrier-buttons-store-b,
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode #carrier-buttons-seonyak-comp,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode #carrier-buttons-store,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode #carrier-buttons-store-b,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode #carrier-buttons-seonyak-comp {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 4px !important;
    }
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode #carrier-buttons-unlocked,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode #carrier-buttons-unlocked {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 3px !important;
    }
    /* 좁은 칸에 4개가 들어가도록 버튼 padding과 로고 크기 축소 (자급제 우선) */
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .carrier-buttons .carrier-button,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .carrier-buttons .carrier-button {
        padding: 6px 2px !important;
        min-width: 0 !important;
    }
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode #carrier-buttons-unlocked .carrier-button,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode #carrier-buttons-unlocked .carrier-button {
        padding: 5px 1px !important;
    }
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .carrier-buttons .carrier-button img,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .carrier-buttons .carrier-button img {
        max-height: 26px !important;
        max-width: 90% !important;
    }
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode #carrier-buttons-unlocked .carrier-button img,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode #carrier-buttons-unlocked .carrier-button img {
        max-height: 22px !important;
    }

    /* 기기값 납부방식(.device-payment-row) — 비교+결과 패널일 때
       "기기 구매가 | 일시불/할부"가 한 줄에 다 안 들어가므로
       모바일 비교모드처럼 세로 스택으로 떨어뜨림 */
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .device-payment-row,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .device-payment-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .device-payment-row .input-group,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .device-payment-row .input-group {
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important;
    }
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .device-payment-row .payment-method-options,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .device-payment-row .payment-method-options {
        width: 100% !important;
    }

    /* "+ 요금제 추가 변경 (선택사항)" 토글 버튼 — 비교+결과 패널 좁은 폭에서
       텍스트가 안 줄바꿈되어 오버플로우. white-space normal + 패딩/폰트 축소 */
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .toggle-button.btn-additional-plan,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .toggle-button.btn-additional-plan {
        padding: 8px 8px !important;
        font-size: 0.78em !important;
        white-space: normal !important;
        word-break: keep-all !important;
        line-height: 1.25 !important;
        min-width: 0;
    }
    /* 옆에 ?(도움말) 버튼 — 위치 고정, 크기만 살짝 축소 */
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .toggle-button-group .additional-plan-help,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .toggle-button-group .additional-plan-help {
        width: 22px !important;
        height: 22px !important;
        font-size: 0.8em !important;
    }

    /* 할부 개월 버튼(installment-months-container) — 비교+결과 패널이라
       섹션이 좁을 때 3열 그리드로 강제, 버튼 크기 축소
       (display는 건드리지 않음 — 일시불일 때 JS가 display:none으로 숨김) */
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .installment-months-container,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .installment-months-container {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 5px !important;
        padding: 6px !important;
    }
    body:has(> .container > #result.result-section[style*="block"]) .comparison-mode .installment-month-button,
    body:has(> .container > #result.result-section[style*="block"]) #main-calculator-content-wrapper.comparison-mode .installment-month-button {
        padding: 6px 2px !important;
        font-size: 0.78em !important;
        min-height: 32px !important;
        min-width: 0 !important;
    }

    /* ===========================================================
       결과 패널(우측) — 카드는 그대로 좌우 배치 유지하고
       전체적인 텍스트 크기만 줄여서 좁은 폭에 맞춤
       =========================================================== */
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section #result-summary-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        align-items: stretch;
    }
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .result-summary-text {
        font-size: 0.95em;
        margin: 0;
        word-break: keep-all;
    }
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .result-summary-text strong {
        font-size: 0.9em;
    }
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section #storeTotal,
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section #unlockedTotal,
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section #carrier1-total,
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section #carrier2-total {
        font-size: 1.05em;
        word-break: break-word;
    }
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .winner {
        font-size: 1.05em !important;
    }
    /* 할인 상세 카드 — 좌우 grid 유지, 카드 도형 자체를 축소 */
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .breakdown-card {
        padding: 10px 8px;
        font-size: 0.82em;
        min-width: 0;
        border-radius: 6px;
    }
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .breakdown-card h4 {
        font-size: 0.95em;
        margin: 0 0 6px;
    }
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .breakdown-card h5 {
        font-size: 0.9em;
        margin: 6px 0 3px;
    }
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .breakdown-card li {
        padding: 3px 0;
        font-size: 0.95em;
    }
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .breakdown-card ul {
        margin: 6px 0 0;
    }
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .breakdown-card p {
        margin: 4px 0;
    }
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .summary-total {
        font-size: 1em;
    }
    /* 카드 안의 우승 뱃지(winner-badge)도 같이 축소 */
    body:has(> .container > #result.result-section[style*="block"]) #result.result-section .winner-badge {
        padding: 2px 6px;
        font-size: 0.7em;
    }

    @keyframes phoneResultSideSlideIn {
        0%   { transform: translateX(28%) scale(0.985); opacity: 0; filter: blur(2px); }
        55%  { opacity: 1; filter: blur(0); }
        100% { transform: translateX(0)   scale(1);    opacity: 1; filter: blur(0); }
    }
}

/* ===========================================================
   인터넷 계산기 2단 레이아웃 (PC 전용)
   #calculator-main-wrapper 내부에 #result가 들어있는 구조이므로
   wrapper 자체를 grid로 만들고 result를 우측에 sticky로 배치한다.
   =========================================================== */
@media (min-width: 769px) {
    /* 컨테이너 폭 확장: 결과 패널이 열렸을 때 좌우로 펼치기 위함 */
    body:has(#calculator-main-wrapper > #result.result-section[style*="block"]) > .container {
        max-width: 1800px;
    }

    /* 폭 전환 트랜지션 */
    #calculator-main-wrapper {
        transition: max-width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* 결과가 표시된 상태일 때만 2단 그리드 활성화 */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) {
        display: grid !important;
        grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr);
        column-gap: 28px;
        align-items: start;
    }

    /* 기본은 모든 자식이 전체 폭 (탭 버튼 등) */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > * {
        grid-column: 1 / -1;
        min-width: 0;
    }

    /* 좌측 컬럼: 입력 영역(.main-content), 오류 메시지, (숨겨진) 계산 버튼 */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > .main-content,
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #error-message,
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #calculate-internet-btn {
        grid-column: 1 / 2;
    }

    /* 우측 컬럼: 결과 패널 (sticky + 슬라이드인 애니메이션) */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section {
        grid-column: 2 / 3;
        grid-row: 2 / span 99;
        margin-top: 0;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        overflow-x: hidden;
        position: sticky;
        top: 20px;
        padding-top: 50px;
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
        animation: phoneResultSideSlideIn 1.1s cubic-bezier(0.16, 1, 0.3, 1);
    }
    body.dark-mode #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section {
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
    }

    /* 좁아진 결과 패널 내부의 월별표는 가로 스크롤 허용 */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .monthly-table-wrapper {
        overflow-x: auto;
    }

    /* PC에서만 닫기(×) 버튼 노출 */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .result-slide-close {
        display: flex;
    }

    /* 우측 패널이 좁아져도 할인 카드가 세로로 떨어지지 않도록 grid로 강제 */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section #discount-breakdown {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
        gap: 10px !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section #discount-breakdown > * {
        flex: none;
        min-width: 0;
        width: auto;
    }

    /* ===========================================================
       우측 패널 — 텍스트/카드/표 전반적 축소로 좁은 폭에 맞춤
       (phone 패널의 축소 패턴을 인터넷용으로 이식)
       =========================================================== */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section {
        padding: 50px 14px 16px;
        font-size: 0.92em;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section #result-title {
        font-size: 1.15em;
        margin: 0 0 10px;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .result-summary-text {
        font-size: 0.95em !important;
        margin: 4px 0;
        word-break: keep-all;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section #support-info-display-1,
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section #support-info-display-2 {
        font-size: 0.9em !important;
        margin: 4px 0 !important;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .winner {
        font-size: 1.1em !important;
        margin-top: 8px !important;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .action-buttons {
        margin-top: 12px !important;
        gap: 8px;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .action-buttons button {
        font-size: 0.88em;
        padding: 8px 12px;
    }

    /* 카드 도형 자체를 축소 */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .breakdown-card,
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .result-card {
        padding: 10px 8px;
        font-size: 0.85em;
        min-width: 0;
        border-radius: 6px;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .breakdown-card h4,
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .result-card h4 {
        font-size: 0.95em;
        margin: 0 0 6px;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .breakdown-card li,
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .result-card li {
        padding: 2px 0;
        font-size: 0.95em;
    }

    /* 월별표 — 패널 폭에 딱 맞춰 컬럼 균등 분할.
       style-extra.css의 .result-table { min-width: 600px; padding: 12px }를 덮어써야 함 */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .monthly-table-wrapper {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .monthly-table {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        table-layout: auto !important;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .monthly-table th,
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .monthly-table td {
        font-size: 0.78em !important;
        padding: 4px 6px !important;
        white-space: nowrap !important;
        text-align: center !important;
    }

    /* 단독 모드 결과 카드(.single-result-card)도 축소 */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .single-result-card {
        padding: 12px;
    }
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .single-result-card .result-item.main .value {
        font-size: 1.2em;
    }

    /* 월별 토글 버튼 자체도 살짝 축소 */
    #calculator-main-wrapper:has(> #result.result-section[style*="block"]) > #result.result-section .monthly-detail-toggle-button {
        padding: 8px 14px;
        font-size: 0.9em;
    }
}

/* 인쇄 시에는 2단 레이아웃 해제 (style-print.css의 !important가 이미 강제하지만 명시적으로 보강) */
@media print {
    body > .container {
        display: block !important;
        max-width: none !important;
    }
    body > .container > #result.result-section,
    #calculator-main-wrapper > #result.result-section {
        animation: none !important;
        position: absolute !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding-top: 0 !important;
        max-height: none !important;
        width: 100% !important;
        overflow: visible !important;
    }
    #calculator-main-wrapper {
        display: block !important;
    }
    .result-slide-close { display: none !important; }
}

