/* ==========================================================================
   청약 가점·신생아 특례대출 계산기 — styles.css
   모바일 퍼스트(375~430px 최적), 라이트/다크 카드 UI
   ========================================================================== */

/* ── 1. 디자인 토큰 ───────────────────────────────────────── */
:root {
  --bg: #eef2f8;
  --bg-1: #dbe7f8;
  --bg-2: #f7f9fc;
  --card: #ffffff;
  --card-2: #f5f8fd;
  --card-3: #eaf0fa;
  --text: #0e1726;
  --text-soft: #35455c;
  --muted: #64748b;
  --muted-2: #8294ab;
  --line: #e2e9f4;
  --line-strong: #cfdaea;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --brand-soft: #e8f0ff;
  --brand-ink: #1e40af;
  --mint: #0f9d76;
  --mint-soft: #e6f7f0;
  --mint-ink: #0b6b52;
  --gold: #c2872b;
  --gold-soft: #fdf3e0;
  --hot: #e8590c;
  --hot-soft: #fff2e7;
  --hot-ink: #b6460a;
  --violet: #7c5cff;
  --violet-soft: #efebff;
  --ok: #10b981;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 16px -10px rgba(15, 23, 42, .18);
  --shadow: 0 2px 4px rgba(15, 23, 42, .03), 0 14px 34px -18px rgba(15, 23, 42, .28);
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --ring: 0 0 0 3px rgba(37, 99, 235, .22);
  --header-h: 62px;
}

[data-theme="dark"] {
  --bg: #070c16;
  --bg-1: #0c1526;
  --bg-2: #080e19;
  --card: #101a2b;
  --card-2: #0c1524;
  --card-3: #16233a;
  --text: #e8eefb;
  --text-soft: #c3d0e4;
  --muted: #91a2bb;
  --muted-2: #7c8ea8;
  --line: #1d2a41;
  --line-strong: #2a3a55;
  --brand: #4f8cff;
  --brand-strong: #3b76e8;
  --brand-soft: #152540;
  --brand-ink: #a9c6ff;
  --mint: #34d399;
  --mint-soft: #102a23;
  --mint-ink: #86efc9;
  --gold: #e6b45c;
  --gold-soft: #2a2113;
  --hot: #fb923c;
  --hot-soft: #2a1a10;
  --hot-ink: #fdba74;
  --violet: #a78bfa;
  --violet-soft: #1e1936;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 18px -12px rgba(0, 0, 0, .8);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 18px 40px -22px rgba(0, 0, 0, .9);
  --ring: 0 0 0 3px rgba(79, 140, 255, .3);
}

/* ── 2. 기본 ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(120% 60% at 50% -10%, var(--bg-1) 0%, transparent 62%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3, p, ul, figure, table { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, button { font-family: inherit; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
::selection { background: var(--brand); color: #fff; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: 0 0 12px 12px;
  background: var(--brand); color: #fff; font-weight: 700;
  transition: top .2s ease;
}
.skip-link:focus { top: 0; }

/* ── 3. 레이아웃 ─────────────────────────────────────────── */
.app-shell {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 14px 40px;
}

/* ── 4. 헤더 ─────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--header-h);
  padding: 10px 16px;
  margin: 0 -14px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { display: block; width: 34px; height: 34px; flex: 0 0 34px; color: var(--brand); }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-text { min-width: 0; }
.brand-text h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text p {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, background .2s ease;
}
.icon-btn:hover { background: var(--card-2); }
.icon-btn:active { transform: scale(.95); }
.install-btn { font-size: 12.5px; color: var(--brand-ink); background: var(--brand-soft); border-color: transparent; }

/* ── 5. 탭 ───────────────────────────────────────────────── */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 14px 0 12px;
  padding: 4px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 72%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.tab {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 8px 6px;
  border: 0; border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -.02em;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.tab-emoji { font-size: 15px; }
.tab.is-active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 14px -10px rgba(15, 23, 42, .4);
}
.tab:active { transform: scale(.99); }

/* ── 6. 카드 ─────────────────────────────────────────────── */
.card {
  position: relative;
  margin-bottom: 12px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.card-head { margin-bottom: 16px; }
.card h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.3;
}
.card-sub { margin-top: 3px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ── 7. 입력 필드 ────────────────────────────────────────── */
.field { margin-top: 18px; }
.field:first-of-type { margin-top: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.field-row .field { margin-top: 0; }
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: -.01em;
}
.field-label small { font-weight: 600; color: var(--muted); font-size: 11px; margin-left: 4px; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-label-row .field-label { margin-bottom: 8px; }
.field-help { margin-top: 7px; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.field-help strong { color: var(--text-soft); font-weight: 700; }

.input-wrap {
  display: flex; align-items: center; gap: 8px;
  height: 60px; padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.input-wrap:focus-within { border-color: var(--brand); box-shadow: var(--ring); background: var(--card); }
.input-wrap input {
  width: 100%; min-width: 0; border: 0; background: transparent; color: var(--text);
  font-size: 24px; font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.input-wrap input:focus { outline: none; box-shadow: none; }
.input-wrap .unit { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: var(--muted); }
.input-wrap-sm { height: 50px; }
.input-wrap-sm input { font-size: 17px; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute; right: 14px; top: 50%;
  width: 7px; height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select-wrap select {
  width: 100%; height: 50px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  color: var(--text);
  font-size: 15px; font-weight: 700;
  appearance: none; -webkit-appearance: none;
}
.select-wrap select:focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }

/* 세그먼트 버튼 */
.segmented {
  display: flex; gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
}
.segmented button {
  flex: 1 1 0;
  min-height: 48px;
  padding: 7px 6px;
  border: 0; border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px; font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.segmented button span { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted-2); margin-top: 1px; }
.segmented button.is-active {
  background: var(--card);
  color: var(--brand-ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .07), 0 4px 10px -8px rgba(15, 23, 42, .5);
}
.segmented button.is-active span { color: var(--brand); }
.segmented-sm button { min-height: 42px; font-size: 12.5px; }

/* 슬라이더 */
.range {
  --fill: 35%;
  width: 100%;
  height: 34px;
  margin: 8px 0 0;
  padding: 0;
  background: transparent;
  appearance: none; -webkit-appearance: none;
}
.range::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0 var(--fill), var(--line) var(--fill) 100%);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px;
  margin-top: -9px;
  border: 3px solid var(--brand);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .22);
  transition: transform .15s ease;
}
[data-theme="dark"] .range::-webkit-slider-thumb { background: #e8eefb; }
.range:active::-webkit-slider-thumb { transform: scale(1.08); }
.range::-moz-range-track { height: 6px; border-radius: 999px; background: var(--line); }
.range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--brand); }
.range::-moz-range-thumb {
  width: 18px; height: 18px; border: 3px solid var(--brand); border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(15, 23, 42, .22);
}
.range:focus-visible { box-shadow: none; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chips button {
  flex: 1 1 0;
  min-width: 48px; min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  color: var(--text-soft);
  font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: all .15s ease;
}
.chips button:hover { border-color: var(--brand); color: var(--brand-ink); }
.chips button:active { transform: scale(.96); }
.chips button.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }

/* 토글 */
.toggle {
  display: flex; align-items: center; gap: 9px;
  min-height: 48px; padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track {
  position: relative; flex: 0 0 34px;
  width: 34px; height: 20px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background .2s ease;
}
.toggle-track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .3);
  transition: transform .2s ease;
}
.toggle input:checked + .toggle-track { background: var(--brand); }
.toggle input:checked + .toggle-track::after { transform: translateX(14px); }
.toggle input:focus-visible + .toggle-track { box-shadow: var(--ring); }
.toggle:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.toggle-text { font-size: 12px; font-weight: 700; color: var(--text-soft); line-height: 1.3; }
.toggle-text small { display: block; font-size: 10px; font-weight: 600; color: var(--muted); margin-top: 1px; }
.toggle-line { margin-top: 10px; background: var(--card-2); }
.toggle-grid { display: grid; gap: 8px; }
@media (min-width: 480px) {
  .toggle-grid { grid-template-columns: 1fr 1fr; }
}

/* 부양가족 스테퍼 */
.stepper {
  display: flex; align-items: center; gap: 10px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card-2);
}
.stepper button {
  flex: 0 0 46px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  color: var(--brand-ink);
  font-size: 20px; font-weight: 800; line-height: 1;
  transition: transform .15s ease, background .2s ease;
}
.stepper button:active { transform: scale(.94); }
.stepper button:disabled { color: var(--muted-2); opacity: .55; cursor: not-allowed; }
.stepper output {
  flex: 1 1 auto;
  text-align: center;
  font-size: 22px; font-weight: 800;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

/* 접이식 작은 박스 */
.mini-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  overflow: hidden;
}
.mini-box > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 13px 14px;
  list-style: none;
  cursor: pointer;
  font-size: 13px; font-weight: 700;
  color: var(--text-soft);
}
.mini-box > summary::-webkit-details-marker { display: none; }
.mini-box > summary::after {
  content: "";
  width: 7px; height: 7px; margin-left: 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s ease;
}
.mini-box[open] > summary::after { transform: rotate(-135deg); }
.mini-box > .toggle,
.mini-box > .input-wrap,
.mini-box > .table-wrap,
.mini-box > .field-help { margin: 0 12px 12px; }
.mini-box > .toggle { background: var(--card); }
.mini-box .field-help { padding: 0; }
.summary-hint { font-size: 10.5px; font-weight: 600; color: var(--muted-2); }

.badge-soft {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--card-3);
  color: var(--muted);
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.badge-soft.is-on { background: var(--brand-soft); color: var(--brand-ink); }

.link-btn {
  border: 0; padding: 0;
  background: transparent;
  color: var(--brand-ink);
  font-size: 11.5px; font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mini-check {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  cursor: pointer;
}
.mini-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }

.rate-readout {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  padding: 12px 14px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
}
.rate-readout strong {
  font-size: 26px; font-weight: 900; letter-spacing: -.03em;
  color: var(--brand-ink);
  font-variant-numeric: tabular-nums;
}
.rate-readout span { font-size: 11.5px; font-weight: 700; color: var(--brand-ink); opacity: .85; }

/* ── 8. 결과 카드 ────────────────────────────────────────── */
.result-card { padding-bottom: 14px; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.result-label { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: -.01em; }
.result-amount {
  display: flex; align-items: baseline; gap: 2px;
  margin-top: 2px;
  font-size: 40px; font-weight: 900;
  letter-spacing: -.045em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.result-amount .won { font-size: 17px; font-weight: 800; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.result-sub { margin-top: 3px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.tier-badge {
  flex: 0 0 auto;
  margin-top: 2px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px; font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--brand) 32%, transparent);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: color-mix(in srgb, var(--brand) 76%, var(--text));
}
.tier-badge[data-tier="1"] {
  background: color-mix(in srgb, var(--mint) 16%, transparent);
  color: color-mix(in srgb, var(--mint) 76%, var(--text));
  border-color: color-mix(in srgb, var(--mint) 34%, transparent);
}
.tier-badge[data-tier="2"] {
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  color: color-mix(in srgb, var(--gold) 78%, var(--text));
  border-color: color-mix(in srgb, var(--gold) 34%, transparent);
}
.tier-badge[data-tier="3"] {
  background: color-mix(in srgb, var(--hot) 15%, transparent);
  color: color-mix(in srgb, var(--hot) 78%, var(--text));
  border-color: color-mix(in srgb, var(--hot) 34%, transparent);
}

/* 항목별 점수 막대 */
.score-bar {
  display: flex;
  gap: 4px;
  height: 14px;
  margin-top: 20px;
}
.score-seg {
  display: block;
  position: relative;
  height: 100%;
  border-radius: 999px;
  background: var(--card-3);
  overflow: hidden;
}
.score-seg[data-item="house"] { flex: 32 1 0; }
.score-seg[data-item="family"] { flex: 35 1 0; }
.score-seg[data-item="account"] { flex: 17 1 0; }
.score-seg i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width .4s cubic-bezier(.22, .68, 0, 1);
}
.score-seg[data-item="house"] i { background: linear-gradient(180deg, #60a5fa, #2563eb); }
.score-seg[data-item="family"] i { background: linear-gradient(180deg, #34d399, #0f9d76); }
.score-seg[data-item="account"] i { background: linear-gradient(180deg, #fbbf24, #d97706); }
.score-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 8px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.score-legend span { display: inline-flex; align-items: center; gap: 4px; }
.score-legend b { color: var(--text); font-weight: 800; }
.score-legend em { font-style: normal; color: var(--muted-2); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot[data-item="house"] { background: var(--brand); }
.dot[data-item="family"] { background: var(--mint); }
.dot[data-item="account"] { background: var(--gold); }

/* 점수 상세 */
.breakdown { margin-top: 14px; }
.bd-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  font-size: 12.5px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.bd-row:last-child { border-bottom: 0; }
.bd-row .bd-label { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.bd-row .bd-label small { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.bd-row .bd-value { font-weight: 700; white-space: nowrap; }
.bd-row.total {
  margin-top: 4px;
  padding-top: 11px;
  border-top: 1.5px solid var(--line-strong);
  border-bottom: 0;
  font-size: 14px;
  color: var(--text);
  font-weight: 800;
}
.bd-row.total .bd-value { font-weight: 900; font-size: 16px; }
.bd-row.is-dim { color: var(--muted); }

/* 인사이트 */
.insight {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -.01em;
}
.insight strong { font-weight: 800; }
.insight.is-warn { background: var(--hot-soft); color: var(--hot-ink); }
.insight.is-ok { background: var(--mint-soft); color: var(--mint-ink); }

/* 버튼 */
.result-actions { display: flex; gap: 8px; margin-top: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; min-height: 50px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 14px; font-weight: 800;
  letter-spacing: -.02em;
  transition: transform .15s ease, background .2s ease, opacity .2s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; filter: none; }

/* ── 9. 표 ───────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.data-table caption { text-align: left; }
.data-table th, .data-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.data-table thead th {
  background: var(--card-3);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}
.data-table tbody th {
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}
.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td small { font-size: 9.5px; color: var(--muted-2); }
.data-table--num tbody td { text-align: right; white-space: nowrap; }
.data-table--num thead th:not(:first-child) { text-align: right; }
.card > .table-wrap { margin-top: 4px; }

/* 팁 */
.tips-card h2 { margin-bottom: 10px; }
.tips { display: grid; gap: 10px; margin-top: 12px; }
.tips li {
  position: relative;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}
.tips li::before {
  content: "";
  position: absolute; left: 2px; top: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand);
  opacity: .65;
}
.tips strong { color: var(--text-soft); font-weight: 800; }

/* FAQ */
.faq-card h2 { margin-bottom: 8px; }
.faq {
  border-top: 1px solid var(--line);
  padding: 11px 0 0;
  margin-top: 10px;
}
.faq:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.faq > summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 800; color: var(--text-soft);
  letter-spacing: -.02em;
}
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::after {
  content: "+";
  flex: 0 0 auto;
  font-size: 16px; font-weight: 700; color: var(--muted-2);
}
.faq[open] > summary::after { content: "−"; }
.faq > p {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}
.faq > p strong { color: var(--text-soft); }

/* ── 10. 광고 슬롯 ───────────────────────────────────────── */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 80px;
  margin: 12px 0;
  border: 1px dashed color-mix(in srgb, var(--line-strong) 65%, transparent);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-2);
  font-size: 10px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase;
  overflow: hidden;
  opacity: .8;
}
.ad-slot:empty { min-height: 0; border: 0; margin: 0; }
.ad-slot--live { display: block; min-height: 0; border: 0; margin: 14px 0; background: transparent; }
.ad-slot--live ins { display: block; width: 100%; }

/* ── 11. 자격 체크리스트 ─────────────────────────────────── */
.elig-list { display: grid; gap: 6px; margin-top: 16px; }
.elig-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card-2);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}
.elig-mark {
  flex: 0 0 18px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-top: 1px;
  border-radius: 50%;
  font-size: 11px; font-weight: 900;
  background: var(--card-3);
  color: var(--muted);
}
.elig-item.is-pass .elig-mark { background: var(--mint-soft); color: var(--mint-ink); }
.elig-item.is-fail { border-color: color-mix(in srgb, var(--hot) 32%, transparent); background: var(--hot-soft); }
.elig-item.is-fail .elig-mark { background: color-mix(in srgb, var(--hot) 18%, transparent); color: var(--hot-ink); }
.elig-body { min-width: 0; }
.elig-name { display: block; font-size: 12px; font-weight: 800; color: var(--text-soft); }
.elig-note { display: block; font-size: 10.5px; color: var(--muted-2); margin-top: 1px; }

/* ── 12. 한도 박스 ───────────────────────────────────────── */
.cap-box {
  margin-top: 16px;
  padding: 12px 13px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
}
.cap-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cap-head span { font-size: 11.5px; font-weight: 700; color: var(--brand-ink); }
.cap-head strong { font-size: 17px; font-weight: 900; letter-spacing: -.03em; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.cap-rows { margin-top: 8px; display: grid; gap: 3px; }
.cap-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 11px; font-weight: 600; color: var(--brand-ink); opacity: .9;
  font-variant-numeric: tabular-nums;
}
.cap-row b { font-weight: 800; }
.cap-row.is-min { opacity: 1; }
.cap-row.is-min b { text-decoration: underline; text-underline-offset: 2px; }
.cap-box .field-help { color: var(--brand-ink); opacity: .8; margin-top: 7px; }

/* ── 13. 통계 그리드 ─────────────────────────────────────── */
.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line);
  overflow: hidden;
}
.stat-cell { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--card-2); }
.stat-cell span { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.stat-cell strong { font-size: 14px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* 특례 종료 안내 */
.after-box {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--card-2);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
}
.after-title { font-size: 11px; font-weight: 800; color: var(--text-soft); margin-bottom: 3px; }
.after-box strong { color: var(--text-soft); font-weight: 800; }

/* 상환 스케줄 */
.breakdown-box { margin-top: 14px; border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.breakdown-box > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 0;
  list-style: none; cursor: pointer;
  font-size: 12.5px; font-weight: 800; color: var(--text-soft);
}
.breakdown-box > summary::-webkit-details-marker { display: none; }
.breakdown-box > summary::after {
  content: "";
  width: 7px; height: 7px; margin-left: auto;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s ease;
}
.breakdown-box[open] > summary::after { transform: rotate(-135deg); }
.breakdown-box .table-wrap { margin-top: 8px; }

/* ── 14. 제휴 카드 ───────────────────────────────────────── */
.promo-card .card-head { margin-bottom: 12px; }
.promo-grid { display: grid; gap: 8px; }
.promo-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.promo-thumb {
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 48px; width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--brand-soft);
  font-size: 20px;
}
.promo-body { min-width: 0; flex: 1 1 auto; }
.promo-name { font-size: 13px; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; }
.promo-meta { margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.promo-cta {
  flex: 0 0 auto;
  padding: 8px 9px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 11px; font-weight: 800;
  white-space: nowrap;
}
.promo-cta:hover { text-decoration: none; background: color-mix(in srgb, var(--brand) 16%, transparent); }
.ad-disclosure { margin-top: 10px; font-size: 10.5px; line-height: 1.45; color: var(--muted-2); }

/* ── 15. 푸터 ────────────────────────────────────────────── */
.app-footer {
  margin-top: 18px;
  padding: 18px 4px 8px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.6;
}
.app-footer .disclaimer { margin-bottom: 10px; }
.app-footer strong { color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; font-weight: 700; }
.footer-links a { color: var(--muted); }
.footer-meta { display: flex; flex-wrap: wrap; gap: 6px; font-variant-numeric: tabular-nums; }

/* ── 16. 토스트 · 기타 ───────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: min(88vw, 380px);
  padding: 12px 18px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--text) 92%, transparent);
  color: var(--card);
  font-size: 12.5px; font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.noscript {
  margin: 20px auto; max-width: 480px; padding: 16px;
  border-radius: 14px; background: #fff3cd; color: #664d03;
  font-size: 13px; text-align: center;
}

/* ── 17. 반응형 ──────────────────────────────────────────── */
@media (min-width: 420px) {
  body { font-size: 15.5px; }
  .brand-text h1 { font-size: 17px; }
  .result-amount { font-size: 44px; }
  .data-table { font-size: 12px; }
}
@media (min-width: 768px) {
  body { padding: 18px 0 48px; }
  .app-shell { padding: 0 20px 40px; }
  .app-header { border-radius: 18px; margin: 0 0 4px; position: relative; background: transparent; backdrop-filter: none; border-bottom: 0; }
  .card { padding: 22px 22px; margin-bottom: 14px; }
  .result-amount { font-size: 48px; }
  .tabs { margin-top: 4px; }
  .app-footer { padding: 22px 6px 10px; font-size: 11px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .app-shell { max-width: 640px; }
}

/* ── 18. 모션 최소화 ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ── 19. 인쇄 ────────────────────────────────────────────── */
@media print {
  .app-header, .tabs, .ad-slot, .promo-card, .result-actions, .toast, .tips, .faq, .link-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}

/* ── 함께 많이 쓰는 계산기 ─────────────────────────────────── */
.related-apps { margin: 18px 0 14px; }
.related-apps h2 { color: var(--text); font-size: 14px; font-weight: 800; margin: 0 2px 9px; }
.related-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.related-app {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  text-decoration: none;
  transition: border-color .14s ease, transform .14s ease;
}
.related-app:hover { border-color: var(--brand); transform: translateY(-2px); }
.related-app strong { color: var(--text); font-size: 13px; font-weight: 800; }
.related-app span { color: var(--muted); font-size: 11px; line-height: 1.5; }
@media (max-width: 360px) { .related-grid { grid-template-columns: 1fr; } }

/* 좁은 화면에서 상품명이 단어 중간에서 끊기지 않도록 합니다 */
@media (max-width: 430px) {
  .promo-name, .promo-meta { word-break: keep-all; overflow-wrap: break-word; }
  .promo-cta { padding-left: 8px; padding-right: 8px; }
}
