:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0fa673;
  --accent-soft: #e3f8ef;
  --gold: #c58a00;
  --navy: #0b1220;
  --pin-before: #94a3b8;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 24px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --card: #121a2b; --text: #e5e7eb; --muted: #94a3b8; --line: #243047;
    --accent: #34e0a1; --accent-soft: #10302a; --gold: #ffd166; --pin-before: #64748b;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --card: #121a2b; --text: #e5e7eb; --muted: #94a3b8; --line: #243047;
  --accent: #34e0a1; --accent-soft: #10302a; --gold: #ffd166; --pin-before: #64748b;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
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;
  line-height: 1.55; word-break: keep-all;
}
a { color: inherit; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 18px; white-space: nowrap; }
.logo small { font-weight: 600; color: #34e0a1; font-size: 12px; margin-left: 2px; }
.top-nav { display: flex; gap: 14px; font-size: 14px; overflow-x: auto; }
.top-nav a { text-decoration: none; opacity: .8; white-space: nowrap; }
.top-nav a:hover { opacity: 1; }
@media (max-width: 520px) { .top-nav { display: none; } }

.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(24px, 6vw, 34px); line-height: 1.25; margin: 0 0 10px; letter-spacing: -.02em; }
.lead { margin: 0; color: var(--muted); }
.lead b { color: var(--text); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 20px; margin: 16px 0; border: 1px solid var(--line); }
.card h2 { font-size: 19px; margin: 0 0 12px; letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.unit { color: var(--muted); font-weight: 400; font-size: 13px; }

.field + .field { margin-top: 18px; }
.field > label { display: block; font-weight: 700; margin-bottom: 8px; }
.input-row { display: flex; align-items: center; border: 2px solid var(--line); border-radius: 14px; padding: 0 14px; background: var(--bg); transition: border-color .15s; }
.input-row:focus-within { border-color: var(--accent); }
.input-row input { flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 26px; font-weight: 800; padding: 10px 0; font-variant-numeric: tabular-nums; }
.suffix { color: var(--muted); font-weight: 700; }
input[type="range"] { width: 100%; margin: 14px 0 4px; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips button { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; font-family: inherit; }
.chips button:hover, .chips button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.adv { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 12px; }
.adv summary, .breakdown summary, .faq summary { cursor: pointer; font-weight: 600; color: var(--muted); font-size: 15px; }
.adv-grid, .rev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 520px) { .adv-grid, .rev-grid { grid-template-columns: 1fr; } }
.adv-grid label, .rev-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.adv-grid input, .adv-grid select, .rev-grid input, .sec-head select {
  font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}

.result { border: 2px solid var(--accent); }
.big { text-align: center; padding: 6px 0 16px; }
.big-label { color: var(--muted); font-weight: 600; }
.big-value { font-size: clamp(32px, 9vw, 46px); font-weight: 900; letter-spacing: -.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
.big-sub { font-weight: 700; }
.compare { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; background: var(--bg); border-radius: 14px; padding: 14px; text-align: center; }
.compare .arrow { font-size: 22px; color: var(--muted); }
.k { color: var(--muted); font-size: 13px; }
.v { font-size: clamp(17px, 4.6vw, 22px); font-weight: 800; font-variant-numeric: tabular-nums; }
.v.accent { color: var(--accent); }
.v.gold { color: var(--gold); }
.delta { text-align: center; font-weight: 700; margin: 14px 0 4px; }
.fun { text-align: center; color: var(--muted); margin: 0 0 6px; min-height: 1.5em; }

.rank { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.rank h2 { font-size: 17px; }
.rank-bar { position: relative; height: 34px; margin: 6px 4px 10px; }
.rank-track { position: absolute; left: 0; right: 0; top: 14px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) 0%, var(--accent-soft) 100%); }
.pin { position: absolute; top: 6px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: left .4s ease; }
.pin.before { background: var(--pin-before); }
.pin.after { background: var(--accent); }
.rank-nums { display: grid; grid-template-columns: 1fr 1fr; text-align: center; gap: 8px; }
.note { font-size: 13px; color: var(--muted); margin: 10px 0 0; text-align: center; }

.breakdown { margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr.sum td { font-weight: 800; }
tr.hl td { background: var(--accent-soft); }
.table-scroll { overflow-x: auto; }

.share-row { display: flex; gap: 8px; margin-top: 18px; }
.btn { flex: 1; font: inherit; font-weight: 700; padding: 13px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; cursor: pointer; }
:root[data-theme="dark"] .btn:not(.ghost) { color: #0b1220; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.ghost) { color: #0b1220; } }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }

.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-head h2 { margin: 0; }
.sec-head select { width: auto; }
#future .muted { margin-top: 8px; }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 560px) { .totals { grid-template-columns: 1fr; } }
.tot { background: var(--bg); border-radius: 14px; padding: 12px 14px; }
.milestone { font-weight: 700; margin: 14px 0 4px; }
.chart { margin-top: 8px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar.first { fill: var(--gold); }
.chart .lbl { fill: var(--muted); font-size: 11px; }
.chart .val { fill: var(--text); font-size: 10px; font-weight: 700; }
.chart .goal { stroke: var(--gold); stroke-dasharray: 4 4; }
.chart .goal-t { fill: var(--gold); font-size: 11px; font-weight: 700; }

.rev-out { margin: 14px 0 0; font-weight: 700; background: var(--bg); padding: 14px; border-radius: 12px; }
.rev-out b { color: var(--accent); font-size: 1.15em; }

.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { color: var(--text); }
.faq p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.ad { margin: 16px 0; min-height: 0; }
.foot { color: var(--muted); font-size: 13px; padding: 20px 0 40px; }
.foot p { margin: 4px 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.breakdown { overflow-x: auto; }
@media (max-width: 520px) { table { font-size: 13px; } th, td { padding: 7px 4px; } }

/* 집시쎄 바로가기 — 상단 메뉴 바로 아래에 매달린 후킹 버튼 */
.hook-row { position: relative; height: 0; }
.hook {
  position: absolute; right: 16px; top: 8px; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; text-decoration: none; white-space: nowrap;
  font-size: 14px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #2a78d6, #1f5fb0);
  box-shadow: 0 6px 18px rgba(42, 120, 214, .35); animation: hook-pulse 2.4s ease-in-out infinite;
}
.hook b { font-weight: 800; color: #ffd166; }
.hook:hover { animation: none; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(42, 120, 214, .45); }
@keyframes hook-pulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .hook { animation: none; } }
@media (max-width: 520px) { .hook { font-size: 13px; padding: 7px 12px; top: 6px; } }

.hook .short { display: none; }
@media (max-width: 520px) { .hook b:not(.short) { display: none; } .hook .short { display: inline; } }

/* 1인가구 / 부부합산 전환 — 페이지 왼쪽 위 */
.mode-row { display: inline-flex; gap: 4px; margin-top: 10px; padding: 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.mode { font: inherit; font-size: 15px; font-weight: 700; border: 0; border-radius: 999px; padding: 8px 16px; background: transparent; color: var(--muted); cursor: pointer; }
.mode.on { background: var(--navy); color: #fff; }
:root[data-theme="dark"] .mode.on { background: var(--accent); color: #0b1220; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mode.on { background: var(--accent); color: #0b1220; } }
@media (max-width: 520px) { .mode { font-size: 14px; padding: 7px 12px; } }
.hero { padding-top: 18px; }
[hidden] { display: none !important; }

/* 부부합산 입력 */
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg button { font: inherit; font-weight: 700; padding: 10px 0; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 18px; }
@media (max-width: 560px) { .duo { grid-template-columns: minmax(0, 1fr); } }
.person { background: var(--bg); border-radius: 14px; padding: 14px; }
.person-name { font-weight: 800; margin-bottom: 8px; }
.person > label { display: block; font-size: 13px; font-weight: 600; margin: 8px 0 4px; }
.input-row.sm { background: var(--card); padding: 0 12px; }
.input-row.sm input { font-size: 20px; padding: 7px 0; }
.person .chips button { padding: 4px 10px; font-size: 13px; }
.small { font-size: 13px; }

.rank-sub { font-size: 13.5px; text-align: center; margin: 6px 0 0; color: var(--text); }
.rank-sub span { white-space: nowrap; }

/* 아파트 예산 */
.home-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 640px) { .home-grid { grid-template-columns: 1fr 1fr; } }
.home-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.home-grid input, .home-grid select { font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
.check { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; font-size: 14px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
@media (max-width: 560px) { .tiers { grid-template-columns: 1fr; } }
.tier { background: var(--bg); border-radius: 14px; padding: 14px; border: 2px solid transparent; }
.tier.rec { border-color: var(--accent); background: var(--accent-soft); }
.tier-name { font-weight: 800; }
.tier-desc { color: var(--muted); font-size: 12.5px; }
.tier-price { font-size: clamp(20px, 5vw, 24px); font-weight: 900; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tier.rec .tier-price { color: var(--accent); }
.tier-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.home-note { font-weight: 700; margin: 14px 0 10px; }
.home-cta { display: block; text-align: center; text-decoration: none; font-weight: 800; padding: 13px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #2a78d6, #1f5fb0); margin-bottom: 12px; }
.home-cta:hover { filter: brightness(1.07); }
@media (max-width: 390px) { .mode { font-size: 13px; padding: 7px 9px; } .hook { padding: 7px 10px; font-size: 12.5px; right: 12px; } }
.home-grid label { display: block; }
.home-grid input, .home-grid select { display: block; margin-top: 6px; }
.check { display: block; }
.check input { vertical-align: -4px; margin-right: 6px; }
