:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #1a2233;
  --muted: #6b7689;
  --line: #e4e9f2;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --accent: #0ea5e9;
  --shadow: 0 8px 30px rgba(20, 40, 80, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.site-header {
  text-align: center;
  padding: 40px 20px 24px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  color: #fff;
}
.site-header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
}
.subtitle {
  margin: 0 auto;
  max-width: 600px;
  font-size: 0.98rem;
  opacity: 0.95;
  word-break: keep-all;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 6px;
}
.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  background: #fbfcfe;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.hint {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.btn-calc {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn-calc:hover { background: var(--brand-dark); }
.btn-calc:active { transform: scale(0.99); }

.result {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px dashed var(--line);
}
.result-main {
  text-align: center;
  padding: 18px;
  background: linear-gradient(135deg, #eff6ff, #e0f2fe);
  border-radius: 12px;
  margin-bottom: 16px;
}
.result-label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.result-value {
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  color: var(--brand-dark);
  letter-spacing: -0.02em;
}
.result-detail {
  list-style: none;
  margin: 0;
  padding: 0;
}
.result-detail li {
  display: flex;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.result-detail li:last-child { border-bottom: none; }
.result-detail span { color: var(--muted); }
.result-detail b { font-weight: 700; }
.disclaimer {
  margin: 14px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.faq details p {
  margin: 8px 0 14px;
  color: #3a4458;
  font-size: 0.93rem;
}
.faq h2 { margin-top: 0; }

/* ===== 본문 콘텐츠 ===== */
.content h2 {
  font-size: 1.15rem;
  margin: 28px 0 12px;
  letter-spacing: -0.01em;
}
.content h2:first-child { margin-top: 0; }
.content p { font-size: 0.95rem; color: #3a4458; }
.content-lead { margin-top: 0; }
.content-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 8px 0 0;
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 4px 0;
}
.content th,
.content td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.content thead th {
  background: #f1f5fb;
  font-weight: 700;
  color: var(--ink);
}
.content tbody tr:last-child td { border-bottom: none; }
.content td:first-child { font-weight: 600; }
.tip-list {
  margin: 4px 0;
  padding-left: 20px;
}
.tip-list li {
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: #3a4458;
}
.tip-list strong { color: var(--ink); }

/* ===== 광고 슬롯 ===== */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(45deg, #f0f2f6, #f0f2f6 10px, #eceff4 10px, #eceff4 20px);
  border: 1px dashed #cfd6e2;
  border-radius: 10px;
}
.ad-placeholder {
  font-size: 0.8rem;
  color: #9aa4b4;
  letter-spacing: 0.05em;
}

/* 인라인(결과 하단) 광고 */
.ad-inline {
  max-width: 640px;
  margin: 0 auto 20px;
  min-height: 90px;
}

/* 최하단 광고 */
.ad-bottom {
  max-width: 640px;
  margin: 0 auto 28px;
  min-height: 100px;
}

/* 좌/우 사이드 광고 (데스크탑 전용, 화면 폭 충분할 때만 노출) */
.ad-rail {
  display: none;
}
.ad-rail .ad-vertical {
  width: 160px;
  height: 100%;
  flex-direction: column;
}
/* 본문(640) + 좌우 레일(160*2) + 여백을 담을 폭이 될 때만 표시 */
@media (min-width: 1100px) {
  .ad-rail {
    display: block;
    position: fixed;
    /* 헤더 높이(약 180px) 기준선.
       창이 크면 calc(50vh - 300px)로 세로 중앙,
       창이 작으면 최소 180px(헤더 바로 아래)에서 멈춰 상단을 침범하지 않음 */
    top: clamp(180px, calc(50% - 300px), 50%);
    /* 창 높이에 맞춰 가변: 최대 600px, 헤더(180) + 하단(20) 여백 확보 */
    height: min(600px, calc(100vh - 200px));
    z-index: 10;
  }
  .ad-rail-left {
    left: max(16px, calc(50% - 320px - 16px - 160px));
  }
  .ad-rail-right {
    right: max(16px, calc(50% - 320px - 16px - 160px));
  }
}
/* 창이 극단적으로 낮으면(세로 광고가 의미 없을 만큼) 사이드 광고 숨김 */
@media (min-width: 1100px) and (max-height: 360px) {
  .ad-rail { display: none; }
}

.site-footer {
  text-align: center;
  padding: 28px 16px 44px;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  margin: 0 0 8px;
}
.footer-nav .copyright {
  color: var(--muted);
}
.footer-nav .sep {
  color: #cdd4e0;
}
.footer-nav a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}
.footer-nav a:hover {
  text-decoration: underline;
}
.footer-related {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
}
.footer-related a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}
.footer-related a:hover {
  text-decoration: underline;
}
.footer-keywords {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 420px) {
  .row { grid-template-columns: 1fr; }
}
