/* ==========================================================================
   Critical CSS & Reset (Pretendard 폰트 & 모바일 최적화 적용)
   ========================================================================== */
:root {
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fb;
    --bg-tertiary: #f9fafb;
    --text-primary: #1f2937; /* 가독성을 위해 333 -> 1f2937 (약간 더 부드러운 검정) */
    --text-secondary: #4b5563;
    --text-tertiary: #6b7280;
    --border-primary: #e5e7eb;
    --border-secondary: #d1d5db;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    /* 폰트 변경: Pretendard 최우선 적용 */
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;

    background: var(--bg-secondary);
    color: var(--text-primary);

    /* 모바일 가독성 핵심 설정 */
    line-height: 1.6;        /* 줄 간격 확보 */
    word-break: keep-all;    /* 단어 단위 줄바꿈 (한글 최적화) */
    overflow-wrap: anywhere; /* 긴 영문/URL 강제 줄바꿈 허용 */
    letter-spacing: -0.025em; /* 자간 좁힘 (텍스트 밀도 향상) */

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    min-height: 100vh;

    /* 모바일 터치 최적화 */
    touch-action: manipulation;  /* 더블탭 줌 방지, 핀치줌은 허용 */
    overflow-x: hidden;          /* 좌우 스크롤 방지 */
    -webkit-tap-highlight-color: transparent;
}

/* 브레드크럼 */
.breadcrumb {
    background: var(--bg-primary);
    padding: 0.5rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-primary);
}

.breadcrumb-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-base);
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: var(--text-secondary);
}

/* 메인 타이틀 섹션 */
.main-title-section {
    background: var(--bg-primary);
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--border-primary);
}

.main-title-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    text-align: center;
}

.main-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    line-height: 1.3;
    letter-spacing: -0.03em;
}

.main-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 500;
    word-break: keep-all;
}

/* 메인 레이아웃 */
.main-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 1.75rem;
    padding: 2rem 1.5rem;
    min-height: 800px;
    align-items: flex-start;
}

.calculator-wrapper {
    width: 380px;
    flex-shrink: 0;
    position: sticky;
    top: 72px;
}

.calculator-card {
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 90px);
    border: 1px solid var(--border-primary);
}

/* 계산기 헤더 */
.calculator-header {
    background: var(--bg-primary);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-primary);
}

.calculator-header.compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3b82f6;
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.author-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.update-badge {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    font-weight: 500;
    white-space: nowrap;
}

.calculator-body {
    background: var(--bg-primary);
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* 폼 요소 스타일 */
input[type="text"], select, .date-input {
    width: 100%;
    height: 48px;
    padding: 0 1rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color var(--transition-base);
    background: #fff;
    color: var(--text-primary);
    font-family: inherit;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.form-row, .form-row-split {
    margin-bottom: 1.25rem;
}

.form-row-split {
    display: flex;
    gap: 1rem;
}

.split-left, .split-right {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.label-with-error {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.label-with-error label {
    margin-bottom: 0;
}

/* 날짜 입력 컨테이너 */
.date-input-container {
    position: relative;
    width: 100%;
}

.date-input {
    padding-right: 2.5rem;
    cursor: text;
}

.calendar-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
    display: flex;
    align-items: center;
}

.cursor-blink {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
    background-color: #333;
    opacity: 0;
    pointer-events: none;
}

/* 내국인 버튼 그룹 */
.nationality-buttons {
    display: flex;
    border: 1px solid #ced4da;
    border-radius: 8px;
    overflow: hidden;
    height: 48px;
}

.nationality-buttons input {
    display: none;
}

.nationality-buttons label {
    flex: 1;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    cursor: pointer;
    border-right: 1px solid #ced4da;
    transition: all var(--transition-base);
    font-weight: 500;
    font-size: 0.95rem;
}

.nationality-buttons label:last-child {
    border-right: none;
}

.nationality-buttons input:checked + label {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* 보육시설 선택 애니메이션 */
.care-select-container {
    display: flex;
    gap: 0;
    align-items: center;
    width: 100%;
}

#careUsage {
    flex: 1;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

#careUsage.compressed {
    flex: 0 0 auto;
    width: 120px;
}

.care-month-compact {
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    margin-left: 0;
}

.care-month-compact.expanded {
    width: calc(100% - 132px);
    opacity: 1;
    margin-left: 12px;
}

.care-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
}

.care-divider {
    color: #ccc;
}

/* 툴팁 */
.tooltip-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    padding: 0;
    margin-left: 0.25rem;
    vertical-align: middle;
    display: inline-flex;
}

.tooltip-text {
    display: none;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    border: 1px solid var(--border-primary);
    line-height: 1.5;
}

.tooltip-text.visible {
    display: block;
}

/* 에러 메시지 */
.error-message {
    font-size: 0.75rem;
    color: var(--danger-color);
    margin-top: 0.25rem;
    min-height: 1.2em;
    display: block;
}

/* 구분선 (놓친 수당 찾아보기) */
.divider {
    margin: 1.5rem 0 1rem;
    position: relative;
    text-align: left;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-primary);
    z-index: 0;
}

.divider-content {
    background: white;
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    padding: 0.4rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
    transition: all var(--transition-fast);
}

.divider-content:hover {
    background: var(--bg-tertiary);
}

.arrow-icon {
    transition: transform 0.2s ease;
}

/* 상세 입력 섹션 */
.detail-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    margin-bottom: 1rem;
}

.detail-section.expanded {
    max-height: 500px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

/* 버튼 그룹 */
.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 30px;
}

.btn {
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 500;
    color: #374151;
    gap: 8px;
    padding: 0.75rem 1rem;
    min-height: 48px; /* 터치 타겟 확보 */
}

.btn:hover {
    border-color: var(--border-secondary);
    background: var(--bg-tertiary);
}

.btn:active {
    transform: scale(0.98);
}

.btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.share-btn {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #ea580c;
}

.share-btn:hover {
    background: #ffedd5;
    border-color: #fdba74;
}

.reset-btn {
    background: #f9fafb;
    border-color: var(--border-primary);
    color: #6b7280;
}

.reset-btn:hover {
    background: #f3f4f6;
}

.calculate-btn {
    grid-column: 1 / -1;
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
    min-height: 52px; /* 계산하기 버튼 더 크게 */
    font-size: 16px;
}

.calculate-btn:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* 결과 영역 스타일 */
#resultCard {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.total-amount-box {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.total-label {
    font-size: 0.9rem;
    color: #1e40af;
    margin-bottom: 0.5rem;
}

.total-value {
    font-size: 2rem;
    font-weight: 800;
    color: #1e3a8a;
    letter-spacing: -0.02em;
}

.result-details-box {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 1.25rem;
}

.result-item {
    background: #fff;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-item .result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    text-align: left;
}

.result-item .result-header strong {
    font-size: 1rem;
    color: var(--text-primary);
}

.result-item .amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.result-detail {
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.875rem 1rem;
    margin-top: 0.5rem;
}

.result-detail h4 {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.result-detail ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.result-detail li {
    font-size: 0.85rem;
    color: #475569;
    padding: 0.25rem 0;
    line-height: 1.5;
}

.calculation-basis {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e2e8f0;
}

.calculation-basis h5 {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.375rem;
    font-weight: 600;
}

.calculation-basis p {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0.25rem 0;
    line-height: 1.4;
    padding-left: 0.8em;
    text-indent: -0.8em;
}

.total-amount-small {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
    color: white;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    padding: 1.25rem;
    border-radius: 12px;
    margin: 1.5rem 0 1rem;
}

.button-grid-result {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 1rem;
}

.button-grid-result .btn {
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    min-height: 48px;
}

.additional-benefits {
    background: #fefce8;
    border-color: #fef08a;
}

.additional-benefits .benefit-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.additional-benefits .benefit-list li {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: #713f12;
    border-bottom: 1px solid #fef08a;
}

.additional-benefits .benefit-list li:last-child {
    border-bottom: none;
}

.inline-link {
    color: #ca8a04;
    text-decoration: none;
    font-size: 0.8rem;
}

.inline-link:hover {
    text-decoration: underline;
}

.result-item-label {
    color: var(--text-secondary);
}

.result-item-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* 가이드 영역 스타일 */
.guide-wrapper {
    flex: 1;
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    min-width: 0;
}

/* 수당 네비게이션 그리드 */
.benefit-nav-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 1.5rem;
}

/* 수당 네비게이션 - 4열 그리드 (가이드 페이지용) */
.benefit-nav-scroll {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 1.5rem;
}

.benefit-nav-scroll .benefit-stat-card {
    min-height: 68px;
    padding: 12px 8px;
    background: var(--bg-secondary, #ffffff);
    border: 1px solid var(--border-primary, #e5e7eb);
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 부모급여(통합계산기) 탭 강조 - CTA 유도 */
.benefit-nav-scroll .benefit-stat-card.primary-cta {
    border: 2px solid #ec4899;
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
    position: relative;
}

.benefit-nav-scroll .benefit-stat-card.primary-cta::before {
    content: "통합계산기";
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.benefit-nav-scroll .benefit-stat-card:hover {
    border-color: var(--primary-color, #ec4899);
    background: var(--bg-tertiary, #f8f9fa);
}

.benefit-nav-scroll .benefit-stat-card.active {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    border-color: #ec4899;
}

.benefit-nav-scroll .benefit-stat-card.active .stat-label,
.benefit-nav-scroll .benefit-stat-card.active .stat-value {
    color: #fff;
}

.benefit-nav-scroll .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 2px;
}

.benefit-nav-scroll .stat-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.benefit-stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    min-height: 72px;
}

.benefit-stat-card:hover {
    border-color: #b0b8c4;
    background: #f8f9fa;
    transform: translateY(-1px);
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

/* Active 상태 */
.benefit-stat-card.active {
    background: #f0f9ff;
    border: 1.5px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.08);
}

.benefit-stat-card.active .stat-label {
    color: var(--primary-color);
}

/* 가이드 섹션 스타일 */
.guide-section {
    margin-bottom: 3.5rem;
}

.guide-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.guide-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin: 1.75rem 0 0.75rem;
    line-height: 1.4;
    padding-left: 0.75rem;
    border-left: 4px solid var(--primary-color);
}

/* 본문 가독성 개선 */
.guide-section p {
    line-height: 1.75;
    color: #4b5563;
    margin-bottom: 1rem;
    font-size: 1rem;
    word-break: keep-all; /* 한글 최적화 */
}

.guide-section ul {
    margin: 1rem 0;
    padding-left: 1.25rem;
}

.guide-section ul li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    color: #4b5563;
    font-size: 1rem;
}

/* 정보 박스 스타일 */
.info-box, .warning-box, .case-story {
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-radius: 12px;
    line-height: 1.6;
    border: 1px solid;
}

.info-box {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #475569;
}

.info-box.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.info-box.warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.warning-box {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.case-story {
    background: #fffbeb;
    border-color: #fde68a;
}

.case-story h4 {
    color: #92400e;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.case-story p {
    color: #78350f;
    margin: 0;
}

/* 테이블 스타일 */
.table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    -webkit-overflow-scrolling: touch;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 100%;
    white-space: nowrap; /* 기본은 줄바꿈 안 함 */
}

.table-container th,
.table-container td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
}

.table-container th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* 모바일 테이블 최적화 */
@media (max-width: 600px) {
    .table-container table {
        white-space: normal; /* 모바일에서는 줄바꿈 허용 */
        font-size: 0.85rem;
    }
    .table-container th,
    .table-container td {
        padding: 0.75rem 0.5rem;
        word-break: keep-all; /* 단어 단위 줄바꿈 */
    }
}

.table-total {
    background: #eff6ff;
}

.table-total td {
    color: #1e3a8a;
    font-weight: 700;
}

/* 관련 수당 카드 */
.related-benefits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.related-card {
    display: block;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-primary);
    transition: all var(--transition-base);
}

.related-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.related-content h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.related-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0 0 1rem;
    word-break: keep-all;
}

.related-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* FAQ 아이템 */
.faq-item {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.faq-item h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    word-break: keep-all;
}

.faq-item p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 목차 네비게이션 */
.toc-nav {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
}

.toc-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1.5rem;
}

.toc-list li a {
    font-size: 0.9rem;
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s;
    display: block;
    padding: 0.25rem 0;
}

.toc-list li a:hover {
    color: var(--primary-color);
}

/* 출처 박스 */
.source-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem;
    margin: 1.25rem 0;
}

.source-box strong {
    display: block;
    font-size: 0.95rem;
    color: #374151;
    margin-bottom: 0.75rem;
}

.source-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.source-list li {
    font-size: 0.9rem;
    padding: 0.25rem 0;
    color: #64748b;
}

.source-list li a {
    color: #64748b;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.source-list li a:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* 공유 팝업 등 부가요소 */
.share-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.share-overlay.active {
    display: block;
    opacity: 1;
    visibility: visible;
}

.share-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: white;
    padding: 2rem;
    border-radius: 16px;
    width: 90%;
    max-width: 360px;
    z-index: 1501;
    display: none;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.share-popup.active {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.share-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
    text-align: center;
}

.share-icons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.share-icons .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
    overflow: visible;
}

.share-icons .icon .icon-text {
    font-size: 32px;
    font-weight: bold;
    line-height: 1;
    color: white;
}

.share-icons .icon.facebook { background: #1877f2; }
.share-icons .icon.facebook .icon-text {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 36px;
    font-weight: bold;
}

.share-icons .icon.x { background: #000; }
.share-icons .icon.x .icon-text {
    font-family: 'Arial Black', Arial, sans-serif;
    font-weight: 900;
    font-size: 30px;
}

.share-icons .icon.kakao { background: #fee500; }
.share-icons .icon.kakao svg { width: 32px; height: 32px; }

.share-icons .icon.naver { background: #03c75a; color: white; }
.share-icons .icon.naver .icon-text {
    font-family: 'Arial Black', Arial, sans-serif;
    font-weight: 900;
    font-size: 32px;
}

.share-icons .icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.share-link-section {
    border-top: 1px solid #eee;
    padding-top: 16px;
}

.share-link-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

#shareLinkInput {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: #f8f9fa;
    color: #666;
}

.copy-btn {
    padding: 10px 16px;
    border: none;
    background: #4285f4;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copy-btn:hover { background: #3367d6; }
.copy-btn.copied { background: #34a853; }

/* 문의처 링크 버튼 */
.contact-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color var(--transition-base);
}

.link-btn:hover {
    background: var(--primary-hover);
}

.link-btn.outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.link-btn.outline:hover {
    background: #eff6ff;
}

.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ==========================================================================
   [중요] 반응형 미디어 쿼리 (Mobile 최적화)
   ========================================================================== */
@media (max-width: 900px) {
    .main-wrapper {
        flex-direction: column;
        padding: 0.75rem;
        gap: 1.5rem;
    }

    .calculator-wrapper {
        width: 100%;
        position: static;
    }

    .guide-wrapper {
        width: 100%;
        padding: 1rem;
    }

    /* 모바일에서 계산기 세로 스크롤 제거 */
    .calculator-card {
        max-height: none;
        overflow: visible;
    }

    .calculator-body {
        overflow-y: visible;
        padding: 1rem;
    }

    .calculator-header {
        padding: 0.875rem 1rem;
    }
}

/* 작은 모바일 화면 대응 (480px 이하) */
@media (max-width: 480px) {
    body {
        font-size: 15px; /* 기본 폰트 살짝 축소 */
    }

    .main-wrapper {
        padding: 0.5rem;
    }

    .calculator-body {
        padding: 0.875rem;
    }

    .calculator-header {
        padding: 0.75rem 0.875rem;
    }
    
    /* 모바일에서 헤더 한 줄 유지 */
    .calculator-header.compact {
        flex-wrap: nowrap;
    }
    
    .author-name {
        font-size: 0.8rem;
    }
    
    .update-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    .guide-wrapper {
        padding: 0.875rem;
    }

    .main-title {
        font-size: 1.6rem;
    }
    
    .guide-section h2 {
        font-size: 1.35rem;
        padding-bottom: 0.5rem;
        border-bottom: 2px solid var(--primary-color);
    }
    
    .guide-section h3 {
        font-size: 1.15rem;
        margin-top: 1.5rem;
    }

    /* 폼 요소 세로 배치 */
    .form-row-split {
        flex-direction: column;
        gap: 1rem;
    }
    
    .button-grid {
        gap: 8px;
    }
    
    /* 모바일에서 버튼 텍스트 줄바꿈 방지 */
    .btn {
        white-space: nowrap;
        padding: 0.5rem;
    }
    
    .toc-list {
        grid-template-columns: 1fr; /* 목차 한 줄에 하나씩 */
    }
    
    /* 네비게이션 카드 작게 */
    .benefit-nav-grid {
        gap: 8px;
    }
    .benefit-stat-card {
        padding: 10px 8px;
        min-height: 60px;
    }
    .stat-label {
        font-size: 0.7rem;
    }
    .stat-value {
        font-size: 0.8rem;
    }
}
/* 모바일 반응형 - benefit-nav-scroll */
@media (max-width: 600px) {
    .benefit-nav-scroll {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .benefit-nav-scroll .benefit-stat-card {
        min-height: 60px;
        padding: 10px 6px;
    }
    .benefit-nav-scroll .stat-label {
        font-size: 0.7rem;
    }
    .benefit-nav-scroll .stat-value {
        font-size: 0.75rem;
    }
}
/* ==========================================
   푸터 (Footer)
   ========================================== */
.footer {
    background: var(--bg-secondary, #f8fafc);
    border-top: 1px solid var(--border-primary, #e2e8f0);
    padding: 2rem 1rem;
    margin-top: 3rem;
    text-align: center;
}

.footer-container {
    max-width: 900px;
    margin: 0 auto;
}

.footer-brand {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin-bottom: 0.5rem;
}

.footer-info {
    font-size: 0.9rem;
    color: var(--text-secondary, #64748b);
    margin-bottom: 0.5rem;
}

.footer-contact a {
    color: var(--primary-color, #3b82f6);
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-contact a:hover {
    text-decoration: underline;
}

.footer-copy {
    font-size: 0.85rem;
    color: var(--text-tertiary, #94a3b8);
    margin-top: 1rem;
}

@media (max-width: 480px) {
    .footer {
        padding: 1.5rem 1rem;
    }
    
    .footer-brand {
        font-size: 1rem;
    }
    
    .footer-info,
    .footer-contact a {
        font-size: 0.85rem;
    }
}