/* 머니저울 — 벤토 카드 스타일
   회색 바탕 위에 둥근 흰 카드, 페리윙클 블루 + 라임 포인트, 남색 결과 카드, 빗금 패턴 */
:root {
  --bg: #e3e5e9;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --text: #1d2433;
  --muted: #747b88;
  --line: #e6e8ec;
  --accent: #6c78f5;
  --accent-ink: #ffffff;
  --accent-soft: #eceeff;
  --lime: #a6ef3e;
  --lime-ink: #1d2433;
  --ink-card: #1d2433;
  --warn: #9a4b00;
  --warn-soft: #fff3e3;
  --plus: #4f5ce8;
  --minus: #d6402f;
  --hatch: repeating-linear-gradient(135deg, #c9ccd3 0 2px, transparent 2px 6px);
  --radius: 28px;
  --radius-sm: 16px;
  --shadow: none;
  color-scheme: light;
}
/* 다크 모드 없음: 기기 설정과 상관없이 항상 밝은 화면 */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, "Pretendard Variable", Inter, -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: 1120px; margin: 0 auto; padding: 0 16px; }

/* header — 떠 있는 흰 알약 막대 */
.site-header { position: sticky; top: 0; z-index: 10; padding: 12px 0 8px; background: linear-gradient(var(--bg) 75%, transparent); }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 60px; background: var(--surface); border-radius: 999px; max-width: 1088px; width: calc(100% - 32px); padding: 0 8px 0 18px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; color: var(--text); text-decoration: none; letter-spacing: -.02em; white-space: nowrap; }
.logo svg { width: 32px; height: 32px; }
.nav { display: flex; gap: 2px; 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; font-weight: 500; padding: 8px 14px; border-radius: 999px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: #fff; background: var(--ink-card); }
@media (max-width: 720px) {
  .site-header { padding-top: 8px; }
  .site-header .wrap { flex-wrap: wrap; gap: 0; padding: 10px 6px 6px 16px; border-radius: 24px; width: calc(100% - 24px); }
  .nav { margin: 6px 0 0 -10px; padding: 0 0 2px; width: calc(100% + 10px); }
}

/* breadcrumb + heading */
.crumb { font-size: 14px; color: var(--muted); margin: 20px 0 4px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--text); }
h1 { font-size: clamp(28px, 4.4vw, 40px); font-weight: 600; line-height: 1.22; letter-spacing: -.035em; margin: 6px 0 10px; }
.lead { color: var(--muted); margin: 0 0 22px; max-width: 760px; }
.badge { display: inline-block; vertical-align: middle; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--text); background: var(--surface-2); padding: 3px 12px; border-radius: 999px; }
.section-title .badge { background: var(--surface); color: var(--muted); }

/* 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-radius: var(--radius); padding: clamp(20px, 3vw, 28px); }
.card h2 { font-size: 20px; font-weight: 600; margin: 0 0 18px; letter-spacing: -.02em; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* 결과 카드: 남색 바탕에 큰 숫자 */
.result {
  position: sticky; top: 96px;
  --surface: var(--ink-card);
  --surface-2: #2b3346;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .62);
  --line: rgba(255, 255, 255, .14);
  --accent: #a9b0ff;
  --plus: var(--lime);
  --minus: #ff9b8f;
  --warn: #ffc77f;
  --warn-soft: rgba(255, 179, 92, .14);
  --hatch: repeating-linear-gradient(135deg, rgba(255,255,255,.32) 0 2px, transparent 2px 6px);
  background: var(--surface); color: var(--text);
}
@media (max-width: 860px) { .result { position: static; } }
.result .badge { background: rgba(255, 255, 255, .12); color: #fff; }

.field { margin-bottom: 16px; }
.field label, .field .label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.field .hint { display: block; font-size: 13px; color: var(--muted); margin-top: 5px; 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;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  min-height: 50px;
  outline: none;
  appearance: none;
  transition: border-color .15s, background-color .15s;
}
.input select { padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 17px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input input:focus, .input select:focus { border-color: var(--accent); background-color: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.input .unit { position: absolute; right: 16px; color: var(--muted); font-size: 15px; pointer-events: none; }
.input input.has-unit { padding-right: 46px; text-align: right; font-variant-numeric: tabular-nums; }

.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.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 8px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); transition: background-color .15s, color .15s; }
.seg input:checked + span { background: var(--ink-card); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.check { display: flex; gap: 10px; align-items: center; font-size: 15px; margin: 6px 0 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; 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: 600; font-size: 16px; color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 999px; min-height: 54px; cursor: pointer; margin-top: 4px; transition: filter .15s, transform .15s; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.99); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }

/* result */
.big { margin: 2px 0 18px; }
.big .k { font-size: 14px; color: var(--muted); }
.big .v { font-size: clamp(36px, 6vw, 48px); font-weight: 600; letter-spacing: -.04em; line-height: 1.15; margin: 4px 0 6px; 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; }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid 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: 12px; }
/* 막대: 둥근 조각 사이에 틈, 남은 부분은 빗금 */
.bar { display: flex; gap: 4px; height: 26px; padding: 4px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 6px 0 18px; }
.bar i { display: block; height: 100%; border-radius: 999px; min-width: 6px; }
.note { font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.alert { font-size: 14px; background: var(--warn-soft); color: var(--warn); padding: 12px 16px; border-radius: var(--radius-sm); margin: 12px 0 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 14px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 14px; 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: 600; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
.scroll-y { max-height: 360px; overflow-y: auto; }

/* content */
.content { margin-top: 16px; }
.content article { background: var(--surface); border-radius: var(--radius); padding: clamp(22px, 4vw, 44px); }
.content h2 { font-size: 24px; font-weight: 600; letter-spacing: -.03em; margin: 36px 0 10px; line-height: 1.35; }
.content h2:first-child { margin-top: 0; }
.content h3 { font-size: 18px; font-weight: 600; margin: 24px 0 6px; }
.content p, .content li { color: var(--text); }
.content ul, .content ol { padding-left: 22px; }
.formula { background: var(--surface-2); border-left: 4px solid var(--lime); border-radius: var(--radius-sm); padding: 14px 18px; font-size: 15px; margin: 12px 0; }
.toc { background: var(--surface-2); border-radius: var(--radius-sm); padding: 16px 22px; margin-bottom: 28px; 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: 600; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; color: var(--text); font-weight: 400; font-size: 18px; line-height: 1; transition: background-color .15s; }
.faq summary:hover::after { background: var(--surface-2); }
.faq details[open] summary::after { content: "−"; background: var(--ink-card); border-color: var(--ink-card); color: #fff; }
.faq details p { margin: 0 0 14px; color: var(--muted); }

.related { margin: 32px 0; }
.related h2 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tile { position: relative; display: block; background: var(--surface); border-radius: 24px; padding: 20px 22px 22px; text-decoration: none; color: var(--text); transition: transform .15s, box-shadow .15s; }
.tile::after { content: "↗"; position: absolute; top: 20px; right: 20px; font-size: 18px; color: var(--muted); transition: color .15s, transform .15s; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(29, 36, 51, .08); }
.tile:hover::after { color: var(--accent); transform: translate(2px, -2px); }
.tile .t { font-weight: 600; font-size: 17px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding-right: 24px; letter-spacing: -.01em; }
.tile .d { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; line-height: 1.55; }
.tile .ico { width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-size: 18px; flex: none; }
.grid .tile:nth-child(3n+2) .ico { background: var(--lime); color: var(--lime-ink); }
.grid .tile:nth-child(3n) .ico { background: var(--ink-card); color: #fff; }
@media (max-width: 560px) {
  .grid { gap: 10px; }
  .tile { padding: 16px 18px; }
  .tile::after { top: 16px; right: 16px; }
  .tile .t { flex-direction: row; align-items: center; gap: 12px; }
  .tile .ico { width: 40px; height: 40px; }
  .tile .d { margin-left: 52px; }
}

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

/* home */
.hero { position: relative; overflow: hidden; background: var(--surface); border-radius: var(--radius); padding: clamp(28px, 5vw, 56px); margin: 16px 0 8px; }
.hero::before { content: ""; position: absolute; width: 420px; height: 420px; right: -120px; top: -160px; border-radius: 50%; background: var(--surface-2); }
.hero::after { content: ""; position: absolute; right: clamp(24px, 5vw, 56px); bottom: clamp(24px, 4vw, 44px); width: 160px; height: 14px; border-radius: 999px; background: linear-gradient(90deg, var(--accent) 0 45%, transparent 45% 48%, var(--lime) 48% 76%, transparent 76% 79%, var(--surface-2) 79%), var(--surface-2); }
.hero > * { position: relative; }
.hero .badge { background: var(--lime); color: var(--lime-ink); }
.hero h1 { font-size: clamp(34px, 6vw, 58px); line-height: 1.12; margin-top: 18px; }
.hero h1 em { font-style: normal; color: var(--muted); }
.hero .lead { margin-bottom: 0; }
@media (max-width: 560px) { .hero::after { display: none; } }
.section-title { font-size: 22px; font-weight: 600; margin: 36px 0 14px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.site-footer { margin-top: 48px; padding: 28px 0 40px; font-size: 14px; color: var(--muted); }
.site-footer .wrap { border-top: 1px solid rgba(29, 36, 51, .1); padding-top: 24px; }
.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; } .result { --surface: #fff; --text: #000; --muted: #555; --line: #ccc; } }

/* ───── 광고 (애드센스) ─────
   자리를 미리 확보해 광고가 늦게 떠도 화면이 밀리지 않게(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(--muted); border-radius: var(--radius); background: var(--hatch), 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; } }
