:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #e4e9f1;
  --primary: #3157d5;
  --primary-dark: #2444ac;
  --primary-soft: #edf2ff;
  --accent: #13a77b;
  --accent-soft: #e9fbf5;
  --warning: #c77b15;
  --warning-soft: #fff7e8;
  --danger: #cc3d4d;
  --danger-soft: #fff0f2;
  --shadow: 0 14px 40px rgba(35, 52, 89, 0.08);
  --shadow-sm: 0 5px 18px rgba(35, 52, 89, 0.07);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", Arial, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; }

.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 9999;
  padding: 10px 14px;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
}
.skip-link:focus { top: 12px; }

.container { width: min(calc(100% - 32px), var(--max)); margin: 0 auto; }
.narrow { width: min(calc(100% - 32px), 820px); margin: 0 auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.94);
  border-bottom: 1px solid rgba(228,233,241,0.9);
  backdrop-filter: blur(16px);
}
.header-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 900; letter-spacing: -0.03em; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), #6e8fff);
  box-shadow: 0 8px 20px rgba(49,87,213,.25);
  color: #fff;
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: 18px; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: -0.01em; }

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  padding: 9px 11px;
  border-radius: 10px;
  color: #465066;
  font-size: 14px;
  font-weight: 700;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 74px 0 54px;
  background:
    radial-gradient(circle at 12% 10%, rgba(107,137,255,.18), transparent 36%),
    radial-gradient(circle at 88% 20%, rgba(19,167,123,.14), transparent 30%),
    linear-gradient(180deg,#fff 0%,#f5f7fb 100%);
}
.hero::after {
  content: "";
  position: absolute;
  width: 440px;
  height: 440px;
  right: -220px;
  bottom: -260px;
  border: 74px solid rgba(49,87,213,.04);
  border-radius: 50%;
}
.hero-inner { position: relative; z-index: 1; text-align: center; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid #dce4ff;
  border-radius: 999px;
  color: var(--primary);
  background: #f8faff;
  font-size: 13px;
  font-weight: 800;
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(19,167,123,.12); }
.hero h1 { margin: 20px 0 12px; font-size: clamp(34px, 5.4vw, 62px); line-height: 1.16; letter-spacing: -0.055em; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero-lead { max-width: 720px; margin: 0 auto; color: var(--muted); font-size: clamp(16px, 2vw, 20px); letter-spacing: -0.02em; }
.hero-search {
  position: relative;
  max-width: 700px;
  margin: 30px auto 0;
}
.hero-search input {
  width: 100%;
  height: 62px;
  padding: 0 58px 0 22px;
  border: 1px solid #dce3ef;
  border-radius: 18px;
  outline: none;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 16px;
}
.hero-search input:focus { border-color: #9eb2ff; box-shadow: 0 0 0 4px rgba(49,87,213,.1), var(--shadow); }
.hero-search svg { position: absolute; right: 20px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); color: var(--primary); }
.hero-stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero-stats span { padding: 7px 11px; border-radius: 999px; color: #59647a; background: rgba(255,255,255,.78); border: 1px solid rgba(228,233,241,.9); font-size: 12px; font-weight: 700; }

.section { padding: 58px 0; }
.section-white { background: #fff; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-size: clamp(25px, 3vw, 34px); line-height: 1.25; letter-spacing: -0.045em; }
.section-heading p { margin: 8px 0 0; color: var(--muted); }

.category-tabs { display: flex; gap: 9px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: thin; }
.category-tab {
  flex: 0 0 auto;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #526078;
  font-weight: 800;
  font-size: 14px;
}
.category-tab:hover, .category-tab.active { color: #fff; border-color: var(--primary); background: var(--primary); }

.calculator-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.calculator-card {
  position: relative;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 1px 0 rgba(20,33,61,.02);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.calculator-card:hover { transform: translateY(-4px); border-color: #cbd6ff; box-shadow: var(--shadow-sm); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 19px;
  font-weight: 900;
}
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 900; }
.calculator-card h3 { margin: 17px 0 7px; font-size: 19px; letter-spacing: -0.035em; }
.calculator-card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.card-link { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-size: 13px; font-weight: 900; }
.card-link::after { content: "→"; transition: transform .15s ease; }
.calculator-card:hover .card-link::after { transform: translateX(3px); }
.no-results { display: none; padding: 48px 20px; text-align: center; color: var(--muted); border: 1px dashed #ccd4e2; border-radius: var(--radius-lg); background: #fff; }

.category-overview { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.category-box { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-soft); }
.category-box strong { display: block; margin-bottom: 5px; font-size: 18px; }
.category-box p { margin: 0; color: var(--muted); font-size: 14px; }
.category-box a { display: inline-flex; margin-top: 14px; color: var(--primary); font-weight: 800; font-size: 13px; }

.breadcrumb-wrap { padding: 18px 0; background: #fff; border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; align-items: center; gap: 7px; overflow-x: auto; color: #697389; font-size: 13px; white-space: nowrap; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span:not(:last-child)::after, .breadcrumb a::after { content: "/"; margin-left: 7px; color: #b0b7c4; }

.page-hero { padding: 50px 0 34px; background: linear-gradient(180deg,#fff,#f7f9fd); }
.page-hero-inner { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 28px; }
.page-kicker { color: var(--primary); font-size: 13px; font-weight: 900; }
.page-hero h1 { margin: 8px 0 10px; font-size: clamp(32px,4.6vw,48px); line-height: 1.18; letter-spacing: -0.055em; }
.page-hero p { max-width: 720px; margin: 0; color: var(--muted); font-size: 17px; }
.page-hero-icon { width: 84px; height: 84px; display: grid; place-items: center; border-radius: 24px; color: var(--primary); background: var(--primary-soft); font-size: 34px; font-weight: 900; }

.calc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px; align-items: start; padding: 32px 0 60px; }
.calc-main { min-width: 0; }
.calc-sidebar { position: sticky; top: 94px; display: grid; gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-xl); background: #fff; box-shadow: var(--shadow-sm); }
.panel-body { padding: 24px; }
.panel-title { margin: 0 0 5px; font-size: 21px; letter-spacing: -0.035em; }
.panel-subtitle { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

.calc-card { overflow: hidden; }
.calc-card-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg,#fff,#fbfcff); }
.calc-card-header strong { font-size: 18px; }
.calc-card-header span { color: var(--muted); font-size: 12px; }
.calc-form { padding: 24px; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; margin-bottom: 22px; border-radius: 13px; background: #eef1f6; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { min-height: 42px; display: grid; place-items: center; padding: 8px 12px; border-radius: 10px; color: #616b7f; font-size: 13px; font-weight: 800; text-align: center; transition: .15s ease; }
.segmented input:checked + span { color: var(--primary); background: #fff; box-shadow: 0 2px 10px rgba(28,42,75,.08); }

.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.field-grid.cols-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label, .field-label { color: #364154; font-size: 13px; font-weight: 850; }
.input-wrap { position: relative; }
.input-wrap input, .input-wrap select, .field > input, .field > select, .field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid #d9e0eb;
  border-radius: 12px;
  outline: none;
  color: var(--text);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-wrap input { padding-right: 46px; }
.input-wrap input:focus, .input-wrap select:focus, .field > input:focus, .field > select:focus, .field textarea:focus { border-color: #8ca5ff; box-shadow: 0 0 0 4px rgba(49,87,213,.09); }
.input-unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: #7a8497; font-size: 13px; font-weight: 700; pointer-events: none; }
.field-help { margin: 0; color: #8a93a5; font-size: 11px; line-height: 1.45; }
.inline-check { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.inline-check input { width: 17px; height: 17px; accent-color: var(--primary); }
.inline-check span { font-size: 13px; font-weight: 750; }

.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 850;
  transition: transform .1s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { flex: 1; color: #fff; background: var(--primary); box-shadow: 0 8px 20px rgba(49,87,213,.2); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { color: #4e596d; border-color: var(--line); background: #fff; }
.btn-secondary:hover { border-color: #bdc8db; background: #f8fafc; }
.btn-small { min-height: 38px; padding: 7px 12px; font-size: 12px; }

.result-box { margin-top: 24px; padding: 22px; border: 1px solid #dce5ff; border-radius: 18px; background: linear-gradient(135deg,#f8faff,#f0f5ff); }
.result-box[hidden] { display: none; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.result-head strong { font-size: 17px; }
.result-summary { padding: 18px; margin-bottom: 14px; border-radius: 15px; color: #fff; background: linear-gradient(135deg,var(--primary),#5477ef); box-shadow: 0 10px 24px rgba(49,87,213,.22); }
.result-summary small { display: block; opacity: .85; font-weight: 750; }
.result-summary b { display: block; margin-top: 4px; font-size: clamp(25px,4vw,34px); letter-spacing: -0.04em; line-height: 1.25; }
.result-list { display: grid; gap: 0; border: 1px solid #e1e7f1; border-radius: 14px; overflow: hidden; background: #fff; }
.result-row { display: flex; justify-content: space-between; gap: 20px; padding: 12px 14px; border-bottom: 1px solid #edf0f5; font-size: 13px; }
.result-row:last-child { border-bottom: 0; }
.result-row span { color: #687388; }
.result-row strong { color: #253049; text-align: right; }
.result-note { margin: 14px 0 0; color: #6e788a; font-size: 12px; }
.result-alert { margin-top: 12px; padding: 11px 13px; border-radius: 11px; font-size: 12px; font-weight: 700; }
.result-alert.good { color: #087658; background: var(--accent-soft); }
.result-alert.warn { color: #9b5b0c; background: var(--warning-soft); }
.result-alert.danger { color: #a62b3a; background: var(--danger-soft); }

.table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #edf0f5; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: #59657a; background: #f8fafc; font-weight: 850; }
tr:last-child td { border-bottom: 0; }

.chart { display: grid; gap: 9px; margin-top: 16px; }
.chart-row { display: grid; grid-template-columns: 48px minmax(0,1fr) 110px; gap: 10px; align-items: center; font-size: 12px; }
.chart-track { height: 9px; overflow: hidden; border-radius: 999px; background: #e8edf7; }
.chart-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--primary),#7e9aff); }
.chart-value { text-align: right; color: #4f5b70; font-weight: 750; }

.info-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.info-card h3 { margin: 0 0 10px; font-size: 16px; letter-spacing: -0.025em; }
.info-card p, .info-card li { color: var(--muted); font-size: 13px; }
.info-card p { margin: 0; }
.info-card ul { margin: 0; padding-left: 18px; }
.info-card li + li { margin-top: 6px; }
.info-card.source { background: #fbfcff; }
.source-link { display: inline-flex; margin-top: 10px; color: var(--primary); font-size: 12px; font-weight: 850; }

.content-section { margin-top: 24px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: #fff; }
.content-section h2 { margin: 0 0 14px; font-size: 24px; letter-spacing: -0.04em; }
.content-section h3 { margin: 24px 0 9px; font-size: 18px; letter-spacing: -0.03em; }
.content-section p, .content-section li { color: #596579; font-size: 15px; }
.content-section ol, .content-section ul { padding-left: 22px; }
.formula { margin: 14px 0; padding: 15px 17px; border-left: 4px solid var(--primary); border-radius: 0 12px 12px 0; color: #364154; background: var(--primary-soft); font-weight: 800; }
.notice { display: flex; gap: 11px; margin-top: 18px; padding: 15px 16px; border-radius: 13px; color: #78500b; background: var(--warning-soft); font-size: 13px; }
.notice::before { content: "!"; flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #d48b18; font-weight: 900; }

.related-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.related-link { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: .15s ease; }
.related-link:hover { border-color: #bdcaff; transform: translateY(-2px); }
.related-link strong { display: block; font-size: 14px; }
.related-link span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }

.ad-slot { display: none; min-height: 90px; align-items: center; justify-content: center; margin: 22px 0; border: 1px dashed #cbd3e1; border-radius: 14px; color: #9aa3b3; background: #fafbfc; font-size: 11px; }
.ad-slot.is-configured { display: flex; }

.static-page { padding: 52px 0 76px; }
.static-page article { padding: 34px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: #fff; box-shadow: var(--shadow-sm); }
.static-page h1 { margin: 0 0 20px; font-size: 34px; letter-spacing: -0.05em; }
.static-page h2 { margin: 32px 0 10px; font-size: 22px; }
.static-page p, .static-page li { color: #596579; }
.static-page code { padding: 2px 6px; border-radius: 6px; background: #eef2f7; }

.site-footer { padding: 38px 0 28px; color: #b7c0d2; background: #182238; }
.footer-top { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 36px; padding-bottom: 28px; border-bottom: 1px solid rgba(255,255,255,.09); }
.footer-brand strong { color: #fff; font-size: 19px; }
.footer-brand p { max-width: 420px; margin: 8px 0 0; color: #9ba6ba; font-size: 13px; }
.footer-links h3 { margin: 0 0 10px; color: #fff; font-size: 13px; }
.footer-links a { display: block; margin-top: 7px; color: #aeb8ca; font-size: 12px; }
.footer-links a:hover { color: #fff; }
.footer-bottom { display: flex; justify-content: space-between; gap: 20px; padding-top: 22px; font-size: 11px; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 1000; transform: translate(-50%, 30px); padding: 11px 15px; border-radius: 12px; color: #fff; background: #25324b; box-shadow: var(--shadow); font-size: 13px; font-weight: 750; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translate(-50%,0); opacity: 1; }

[hidden] { display: none !important; }

@media (max-width: 1060px) {
  .calculator-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .calc-layout { grid-template-columns: minmax(0,1fr) 280px; }
}

@media (max-width: 860px) {
  .menu-button { display: grid; place-items: center; }
  .main-nav { position: absolute; left: 16px; right: 16px; top: 63px; display: none; flex-direction: column; align-items: stretch; padding: 10px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow); }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 11px 13px; }
  .calculator-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .category-overview { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .calc-layout { grid-template-columns: 1fr; }
  .calc-sidebar { position: static; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .page-hero-inner { grid-template-columns: 1fr; }
  .page-hero-icon { display: none; }
  .footer-top { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .container, .narrow { width: min(calc(100% - 24px), var(--max)); }
  .header-inner { min-height: 62px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .brand-copy strong { font-size: 16px; }
  .brand-copy small { display: none; }
  .hero { padding: 52px 0 38px; }
  .hero-search input { height: 56px; border-radius: 15px; }
  .section { padding: 42px 0; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .calculator-grid { grid-template-columns: 1fr; }
  .calculator-card { min-height: 190px; }
  .category-overview { grid-template-columns: 1fr; }
  .page-hero { padding: 36px 0 25px; }
  .calc-layout { padding-top: 20px; }
  .panel { border-radius: 18px; }
  .calc-card-header, .calc-form, .panel-body { padding: 18px; }
  .field-grid, .field-grid.cols-3 { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .form-actions { flex-wrap: wrap; }
  .btn-primary { flex-basis: 100%; order: -1; }
  .segmented { grid-auto-flow: row; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .calc-sidebar { grid-template-columns: 1fr; }
  .content-section { padding: 21px; border-radius: 18px; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr; }
  .footer-brand { grid-column: auto; }
  .footer-bottom { flex-direction: column; }
  .chart-row { grid-template-columns: 42px minmax(0,1fr); }
  .chart-value { grid-column: 2; text-align: left; }
}

@media print {
  .site-header, .site-footer, .calc-sidebar, .form-actions, .ad-slot, .related-grid, .breadcrumb-wrap { display: none !important; }
  body { background: #fff; }
  .calc-layout { display: block; padding: 0; }
  .panel, .content-section { box-shadow: none; break-inside: avoid; }
}
