:root {
  --bg: #ffffff;
  --surface: #f6f8fb;
  --text: #111827;
  --muted: #5b6474;
  --border: #e3e7ee;
  --primary: #1d3a8a;
  --primary-soft: #e8eefb;
  --accent: #4f7fe0;
  --radius: 14px;
  --max: 760px;
}

* { 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", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
}

a { color: var(--primary); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.logo { font-weight: 800; font-size: 18px; color: var(--primary); text-decoration: none; letter-spacing: -0.02em; }
.logo span { color: var(--text); font-weight: 600; }
.top-nav a { color: var(--muted); text-decoration: none; font-size: 15px; margin-left: 16px; }
.top-nav a:hover, .top-nav a[aria-current="page"] { color: var(--primary); }

/* Tabs */
.tabs { display: flex; gap: 6px; margin: 24px 0 8px; padding: 4px; background: var(--surface); border-radius: 12px; }
.tabs a { flex: 1; text-align: center; padding: 10px 6px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 600; }
.tabs a[aria-current="page"] { background: var(--bg); color: var(--primary); box-shadow: 0 1px 3px rgba(17, 24, 39, 0.1); }

h1 { font-size: 26px; line-height: 1.35; margin: 20px 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 21px; margin: 40px 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 17px; margin: 24px 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; }

/* Calculator form */
.calc { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.input-unit { position: relative; }
.input-unit input { padding-right: 44px; }
.input-unit .unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; pointer-events: none; }
input, select {
  width: 100%; height: 48px; padding: 0 14px; font: inherit; font-size: 17px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.amount-hint { color: var(--primary); font-size: 13px; margin-top: 4px; min-height: 1em; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn { display: block; width: 100%; height: 52px; border: 0; border-radius: 12px; background: var(--primary); color: #fff; font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--bg); color: var(--primary); border: 1px solid var(--border); height: 44px; font-size: 15px; font-weight: 600; margin-top: 12px; }

/* Results */
.result { margin-top: 20px; display: none; }
.result.show { display: block; }
.result-main { background: var(--primary); color: #fff; border-radius: var(--radius); padding: 22px 20px; }
.result-main .label { font-size: 14px; opacity: 0.85; }
.result-main .value { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.3; }
.result-main .sub { font-size: 15px; opacity: 0.9; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat { background: var(--surface); border-radius: 12px; padding: 14px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-weight: 700; font-size: 17px; }
.stat .sub { color: var(--muted); font-size: 13px; }
.chart-box { margin-top: 20px; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; height: 300px; }
.table-scroll { overflow-x: auto; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--surface); color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
.notice { color: var(--muted); font-size: 13px; margin-top: 12px; }

/* Content */
.content p, .content li { color: #263041; }
.content ul, .content ol { padding-left: 22px; }
.content table th, .content table td { text-align: left; white-space: normal; }
.content .table-scroll table th, .content .table-scroll table td { white-space: nowrap; }
.formula { background: var(--surface); border-radius: 12px; padding: 14px 16px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; overflow-x: auto; }
.callout { background: var(--primary-soft); border-radius: 12px; padding: 14px 16px; margin: 16px 0; }
details { border-bottom: 1px solid var(--border); padding: 12px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 0; }

.card-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.card-list a { display: block; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--text); }
.card-list a:hover { border-color: var(--accent); }
.card-list .t { font-weight: 700; }
.card-list .d { color: var(--muted); font-size: 14px; }

.meta { color: var(--muted); font-size: 14px; }
.breadcrumb { font-size: 14px; color: var(--muted); margin-top: 20px; }
.breadcrumb a { color: var(--muted); }

/* Footer */
.site-footer { margin-top: 64px; border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0 40px; font-size: 14px; color: var(--muted); }
.site-footer nav a { color: var(--muted); margin-right: 14px; text-decoration: none; }
.site-footer nav a:hover { color: var(--primary); }
.site-footer p { margin: 10px 0 0; }

@media (max-width: 520px) {
  h1 { font-size: 23px; }
  .top-nav a { margin-left: 12px; font-size: 14px; }
  .top-nav .hide-sm { display: none; }
  .row-2 { grid-template-columns: 1fr; gap: 0; }
  .result-main .value { font-size: 26px; }
  .tabs a { font-size: 14px; }
}
