:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eef2ef;
  --text: #17201b;
  --muted: #5b6760;
  --line: #dde3df;
  --accent: #0e6b4f;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ea;
  --warn: #9a4b00;
  --warn-soft: #fff3e3;
  --plus: #0e6b4f;
  --minus: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .05), 0 6px 20px rgba(16, 24, 20, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101412;
    --surface: #171d1a;
    --surface-2: #1e2622;
    --text: #e6ece8;
    --muted: #9aa69f;
    --line: #2a332e;
    --accent: #4cc497;
    --accent-ink: #08130e;
    --accent-soft: #183128;
    --warn: #ffb35c;
    --warn-soft: #2d2213;
    --plus: #4cc497;
    --minus: #ff8a80;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--accent); }
img, svg { max-width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; color: var(--text); text-decoration: none; letter-spacing: -.02em; white-space: nowrap; }
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
@media (max-width: 720px) {
  .site-header .wrap { flex-wrap: wrap; gap: 0; padding-top: 8px; }
  .nav { margin: 0 -16px; padding: 4px 12px 8px; width: calc(100% + 32px); }
}

/* breadcrumb + heading */
.crumb { font-size: 14px; color: var(--muted); margin: 20px 0 4px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
h1 { font-size: clamp(26px, 4vw, 34px); line-height: 1.3; letter-spacing: -.03em; margin: 4px 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; max-width: 760px; }
.badge { display: inline-block; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 10px; border-radius: 999px; }

/* calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .calc { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.result { position: sticky; top: 76px; }
@media (max-width: 860px) { .result { position: static; } }
.card h2 { font-size: 17px; margin: 0 0 14px; letter-spacing: -.01em; }

.field { margin-bottom: 14px; }
.field label, .field .label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field .hint { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; min-height: 1em; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }

.input { position: relative; display: flex; align-items: center; }
.input input, .input select, select.input-el {
  width: 100%;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 46px;
  outline: none;
  appearance: none;
}
.input select { padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input input:focus, .input select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input .unit { position: absolute; right: 12px; color: var(--muted); font-size: 15px; pointer-events: none; }
.input input.has-unit { padding-right: 44px; text-align: right; }

.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg label { flex: 1; text-align: center; margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 6px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

.check { display: flex; gap: 8px; align-items: center; font-size: 15px; margin: 6px 0 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

details.more { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 15px; padding: 6px 0 10px; color: var(--accent); }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; width: 100%; font: inherit; font-weight: 700; font-size: 16px; color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 10px; min-height: 48px; cursor: pointer; }
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 600; }

/* result */
.big { margin: 2px 0 14px; }
.big .k { font-size: 14px; color: var(--muted); }
.big .v { font-size: clamp(28px, 5vw, 36px); font-weight: 800; letter-spacing: -.03em; line-height: 1.25; font-variant-numeric: tabular-nums; }
.big .v.plus { color: var(--plus); }
.big .v.minus { color: var(--minus); }
.big .s { font-size: 14px; color: var(--muted); }
.lines { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.lines li span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.lines li.sum { border-bottom: 0; font-weight: 700; }
.lines li.sub { color: var(--muted); font-size: 14px; padding-left: 10px; }
.bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin: 4px 0 14px; }
.bar i { display: block; height: 100%; }
.note { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.alert { font-size: 14px; background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 10px; margin: 10px 0 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--surface-2); font-weight: 700; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
.scroll-y { max-height: 360px; overflow-y: auto; }

/* content */
.content { margin-top: 36px; }
.content article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 36px); }
.content h2 { font-size: 22px; letter-spacing: -.02em; margin: 32px 0 10px; line-height: 1.4; }
.content h2:first-child { margin-top: 0; }
.content h3 { font-size: 18px; margin: 22px 0 6px; }
.content p, .content li { color: var(--text); }
.content ul, .content ol { padding-left: 22px; }
.formula { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: 15px; margin: 10px 0; }
.toc { background: var(--surface-2); border-radius: 10px; padding: 14px 18px; margin-bottom: 24px; font-size: 15px; }
.toc strong { display: block; margin-bottom: 4px; }
.toc ol { margin: 0; }

.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 700; padding: 10px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 12px; color: var(--muted); }

.related { margin: 28px 0; }
.related h2 { font-size: 20px; margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile .t { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.tile .d { color: var(--muted); font-size: 14px; margin-top: 4px; line-height: 1.55; }
.tile .ico { width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 17px; flex: none; }

.disclaimer { font-size: 13px; color: var(--muted); margin: 24px 0; }

/* home */
.hero { padding: 36px 0 20px; }
.hero h1 { font-size: clamp(28px, 5vw, 40px); }
.section-title { font-size: 20px; margin: 30px 0 12px; letter-spacing: -.02em; }

.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 28px 0 40px; font-size: 14px; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media print { .site-header, .site-footer, .related, .nav { display: none; } }

/* ───── 광고 (애드센스) ─────
   자리를 미리 확보해 광고가 늦게 떠도 화면이 밀리지 않게(CLS) 하고,
   '광고' 표시와 여백으로 계산 버튼·링크와 확실히 구분합니다(실수 클릭 방지 정책). */
.ad { margin: 36px auto; text-align: center; clear: both; }
.ad-label { display: block; font-size: 11px; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.ad-calcBelow, .ad-home { min-height: 280px; }
.ad-calcBelow { margin-top: 56px; }
.ad-inArticle { min-height: 200px; margin: 32px 0; }
.ad-bottom { min-height: 320px; }
.ad-preview .ad-box { display: flex; align-items: center; justify-content: center; height: 250px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); font-size: 14px; }
.ad-inArticle.ad-preview .ad-box { height: 180px; }
@media (min-width: 861px) { .ad-calcBelow, .ad-home { min-height: 120px; } .ad-preview.ad-calcBelow .ad-box, .ad-preview.ad-home .ad-box { height: 100px; } }
@media print { .ad { display: none; } }
