/* ────────────────────────────────────────
   디자인 토큰
   딥 네이비 포인트 + 슬레이트 중성 키
──────────────────────────────────────── */
:root {
  --primary:        #2A3F75;
  --primary-hover:  #213262;
  --primary-press:  #182549;
  --primary-tint:   #EEF1F8;
  --primary-tint-2: #DDE3F0;

  --success:        #1F7A52;
  --success-bg:     #EDF6F1;
  --success-border: #BBDDC8;
  --danger:         #B33B30;
  --danger-bg:      #FAEEEC;
  --danger-border:  #E8C0BA;
  --warning:        #8A5A12;
  --warning-bg:     #FBF4E6;
  --warning-border: #ECD7A9;

  --bg:        #F7F8FA;
  --surface:   #FFFFFF;
  --ink-900:   #131722;
  --ink-700:   #2C3340;
  --ink-500:   #5A6478;
  --ink-400:   #7C8699;
  --ink-300:   #ADB4C2;
  --line:      #EAECF1;
  --line-soft: #F1F3F6;

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
}

/* ────────────────────────────────────────
   리셋
──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink-900);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

button, input { font-family: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ────────────────────────────────────────
   레이아웃
──────────────────────────────────────── */
.page-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 20px 96px;
}

/* ────────────────────────────────────────
   헤더 — 큰 타이틀 + 넉넉한 호흡
──────────────────────────────────────── */
.site-header {
  text-align: left;
  margin-bottom: 40px;
  padding: 0 4px;
}
.site-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin-bottom: 14px;
  text-wrap: balance;
}
.site-header .subtitle {
  font-size: 15px;
  color: var(--ink-500);
  line-height: 1.65;
  text-wrap: pretty;
  word-break: keep-all;
}

/* ────────────────────────────────────────
   카드 — 넉넉한 padding, 그림자 제거
──────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.015em;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
  line-height: 1.4;
}

/* ────────────────────────────────────────
   관계 그룹 레이블
   [FIX] :first-of-type → :first-child (type 선택자는 class 무시)
──────────────────────────────────────── */
.rel-group-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-400);
  letter-spacing: 0.02em;
  margin-bottom: 10px;
  margin-top: 22px;
}
.rel-group-label:first-child { margin-top: 0; }

/* ────────────────────────────────────────
   관계 선택 버튼
──────────────────────────────────────── */
.relation-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.relation-btn {
  min-height: 68px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
  line-height: 1.45;
  text-align: center;
}
.relation-btn small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--ink-400);
  margin-top: 3px;
}
.relation-btn:hover {
  border-color: var(--primary-tint-2);
  background: var(--primary-tint);
}
.relation-btn.active {
  border-color: var(--primary);
  background: var(--primary-tint);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.relation-btn.active small { color: var(--primary); opacity: 0.78; }

/* ────────────────────────────────────────
   부양요건 패널
──────────────────────────────────────── */
.dep-section {
  border-top: 1px solid var(--line-soft);
  padding-top: 24px;
  margin-top: 24px;
}
.dep-section:first-child,
.card-title + .dep-section { border-top: none; padding-top: 0; margin-top: 0; }

.dep-question {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 14px;
  line-height: 1.6;
}
.dep-question strong { color: var(--primary); font-weight: 700; }

/* [FIX] .page-wrap p(명시도 0,1,1)보다 높게 — .card 선조 추가로 0,2,0 확보 */
.card .dep-hint {
  font-size: 12.5px;
  color: var(--ink-400);
  margin-top: 12px;
  line-height: 1.65;
}

/* 예/아니오 버튼 */
.yesno-group {
  display: flex;
  gap: 10px;
}
.yesno-btn {
  flex: 1;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.yesno-btn:hover {
  border-color: var(--primary-tint-2);
  background: var(--primary-tint);
}
.yesno-btn.active {
  border-color: var(--primary);
  background: var(--primary-tint);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

/* ────────────────────────────────────────
   배우자 소득 구분선
──────────────────────────────────────── */
.spouse-divider {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700);
  margin-bottom: 18px;
  letter-spacing: -0.005em;
}

/* ────────────────────────────────────────
   체크박스
──────────────────────────────────────── */
.sibling-checks {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-700);
  cursor: pointer;
  line-height: 1.55;
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ────────────────────────────────────────
   입력 필드
──────────────────────────────────────── */
.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.field-group.full { grid-column: 1 / -1; }

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-500);
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  letter-spacing: -0.005em;
}

/* 툴팁 */
.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--line);
  color: var(--ink-500);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease;
}
.tooltip-icon:hover { background: var(--primary-tint-2); color: var(--primary); }
.tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  transform: none;
  background: var(--ink-900);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 400;
  padding: 9px 12px;
  border-radius: 8px;
  width: 280px;
  line-height: 1.55;
  z-index: 10;
  white-space: normal;
  word-break: keep-all;
  letter-spacing: 0;
  box-shadow: 0 8px 20px rgba(19,23,34,0.18);
}
.tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 3px;
  transform: none;
  border: 5px solid transparent;
  border-top-color: var(--ink-900);
}
.tooltip-wrap:hover .tooltip-text,
.tooltip-wrap:focus-within .tooltip-text { display: block; }

.input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.input-row .input-wrap { flex: 1; min-width: 0; }

.input-wrap { position: relative; }
.input-wrap input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 70px 0 18px;
  font-size: 15px;
  font-family: inherit;
  font-feature-settings: 'tnum';
  color: var(--ink-900);
  background: var(--surface);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input-wrap input:hover { border-color: var(--ink-300); }
.input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}
.input-wrap input::placeholder { color: var(--ink-300); }

.input-unit {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--ink-400);
  pointer-events: none;
}

.steppers {
  position: absolute;
  right: 36px;
  top: 4px;
  bottom: 4px;
  width: 22px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
}
.stepper-btn {
  flex: 1;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 8px;
  color: var(--ink-400);
  line-height: 1;
  transition: background 0.12s ease, color 0.12s ease;
}
.stepper-btn:first-child { border-bottom: 1px solid var(--line); }
.stepper-btn:hover { background: var(--primary-tint); color: var(--primary); }

.manwon-hint {
  font-size: 12px;
  color: var(--ink-400);
  white-space: nowrap;
  min-width: 78px;
  font-feature-settings: 'tnum';
}

/* ────────────────────────────────────────
   계산 버튼 (CTA)
──────────────────────────────────────── */
.calc-btn {
  width: 100%;
  height: 60px;
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.06s ease;
  margin-top: 12px;
}
.calc-btn:hover { background: var(--primary-hover); }
.calc-btn:active { background: var(--primary-press); transform: translateY(1px); }

/* ────────────────────────────────────────
   결과 카드
──────────────────────────────────────── */
.result-section { display: none; }
.result-section.visible { display: block; }

.result-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 32px 28px;
  margin-bottom: 14px;
  background: var(--surface);
}
.result-card.pass {
  background: var(--success-bg);
  border-color: var(--success-border);
}
.result-card.fail {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.result-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.result-icon { font-size: 32px; line-height: 1; flex-shrink: 0; }
.result-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.35;
}
.result-subtitle {
  font-size: 13px;
  color: var(--ink-500);
  margin-top: 6px;
  line-height: 1.6;
}
.result-card.pass .result-title { color: var(--success); }
.result-card.fail .result-title { color: var(--danger); }

/* 체크리스트 */
.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--ink-900);
}
.check-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.check-label { font-weight: 600; }
.check-detail { color: var(--ink-500); margin-top: 2px; font-size: 13px; line-height: 1.6; }

/* 주의사항 카드 */
.notice-card {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  font-size: 13px;
  color: var(--warning);
  line-height: 1.7;
}
.notice-card strong { display: block; margin-bottom: 4px; font-size: 14px; }
.notice-card a { color: var(--warning); text-decoration: underline; font-weight: 600; }

/* 다시 계산 */
.reset-btn {
  width: 100%;
  height: 50px;
  background: var(--surface);
  color: var(--ink-700);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
  margin-top: 6px;
}
.reset-btn:hover { border-color: var(--ink-300); color: var(--ink-900); }

/* ────────────────────────────────────────
   설명글 섹션
──────────────────────────────────────── */
.info-section { margin-top: 32px; }

.info-text {
  font-size: 14px;
  color: var(--ink-500);
  line-height: 1.85;
  margin-bottom: 18px;
  text-wrap: pretty;
  text-align: justify;
  text-justify: inter-character;
  word-break: keep-all;
}
.info-text strong { color: var(--ink-900); font-weight: 700; }

.info-sub-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-900);
  margin: 28px 0 12px;
  letter-spacing: -0.01em;
}

.info-rel-list {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.info-rel-list li {
  font-size: 13px;
  color: var(--ink-500);
  line-height: 1.7;
  padding: 13px 16px;
  border-left: 3px solid var(--primary);
  background: var(--primary-tint);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.info-rel-list li strong {
  color: var(--ink-900);
  font-weight: 700;
  margin-right: 4px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 8px;
}
.info-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
.info-item-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-400);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.info-item-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  letter-spacing: -0.015em;
  font-feature-settings: 'tnum';
}
.info-item-note {
  font-size: 11.5px;
  color: var(--ink-400);
  line-height: 1.6;
}

.info-legal {
  font-size: 12px;
  color: var(--ink-400);
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  line-height: 1.7;
}

/* ────────────────────────────────────────
   FAQ
──────────────────────────────────────── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.12s ease;
  background: var(--surface);
}
.faq-item[open] { border-color: var(--primary-tint-2); }

.faq-q {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after {
  content: '+';
  font-size: 22px;
  font-weight: 300;
  color: var(--ink-400);
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.12s ease;
}
.faq-item[open] > .faq-q { color: var(--primary); }
.faq-item[open] > .faq-q::after { content: '−'; color: var(--primary); }
.faq-a {
  font-size: 14px;
  color: var(--ink-500);
  padding: 16px 20px 20px;
  line-height: 1.8;
  border-top: 1px solid var(--line-soft);
  background: var(--bg);
}

/* ────────────────────────────────────────
   푸터
──────────────────────────────────────── */
.site-footer {
  text-align: center;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-400);
  line-height: 1.9;
  word-break: keep-all;
}
.site-footer p + p { margin-top: 2px; }
.site-footer a { color: var(--ink-500); text-decoration: underline; }
.site-footer a:hover { color: var(--primary); }
.footer-site-desc {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 8px;
  text-wrap: balance;
}
.footer-disclaimer { color: var(--ink-500); }

/* ────────────────────────────────────────
   privacy.html 보조 본문
──────────────────────────────────────── */
.page-wrap p { line-height: 1.8; }
.page-wrap h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink-900);
  margin: 28px 0 12px;
  letter-spacing: -0.015em;
}
.page-wrap h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-900);
  margin: 20px 0 8px;
}
.page-wrap ul, .page-wrap ol {
  padding-left: 22px;
  color: var(--ink-500);
  line-height: 1.8;
}

/* ────────────────────────────────────────
   반응형
──────────────────────────────────────── */
@media (max-width: 640px) {
  .page-wrap { padding: 36px 18px 72px; }
  .card { padding: 30px 24px; }
  .site-header h1 { font-size: 27px; }
}

@media (max-width: 480px) {
  body { font-size: 14px; }
  .page-wrap { padding: 24px 14px 60px; }
  .site-header { margin-bottom: 28px; }
  .site-header h1 { font-size: 23px; line-height: 1.35; margin-bottom: 10px; }
  .site-header .subtitle { font-size: 13.5px; }

  .card { padding: 24px 18px; margin-bottom: 12px; }
  .card-title { font-size: 16px; margin-bottom: 18px; padding-bottom: 14px; }

  .relation-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .relation-btn { min-height: 64px; font-size: 13px; }

  .fields-grid { grid-template-columns: 1fr; gap: 16px; }
  .field-group.full { grid-column: 1; }

  .info-grid { grid-template-columns: 1fr; }

  .yesno-btn { height: 46px; font-size: 14px; }
  .calc-btn { height: 54px; font-size: 15px; }

  .result-card { padding: 24px 20px; }
  .result-title { font-size: 19px; }

  .tooltip-text { width: 180px; }
}
