﻿:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #0f766e;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --warn-border: #fcd34d;
  --ok-bg: #ecfdf5;
  --ok-text: #065f46;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
}

html.dark {
  --bg: #0b1120;
  --surface: #111827;
  --surface-alt: #1e293b;
  --border: #263245;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: #172554;
  --accent: #2dd4bf;
  --warn-bg: #451a03;
  --warn-text: #fde68a;
  --warn-border: #92400e;
  --ok-bg: #022c22;
  --ok-text: #6ee7b7;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.92rem;
  flex-wrap: wrap;
}
.nav-links a { color: var(--text-muted); font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--primary); text-decoration: none; }
.theme-btn {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}

/* Main */
.page-shell {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
}
main { padding: 28px 0 64px; }

/* AdSense slots (non-intrusive, CLS-safe) */
.ad-banner {
  margin: 24px 0;
  padding: 12px 14px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  min-height: 112px;
  overflow: hidden;
}
.ad-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.75;
  margin-bottom: 6px;
}
.ad-banner ins.adsbygoogle {
  display: block;
  width: 100%;
  min-height: 90px;
}
.side-rail-ad {
  display: none;
}
@media (min-width: 1400px) {
  .side-rail-ad {
    display: block;
    position: absolute;
    top: 28px;
    height: calc(100% - 64px);
    width: 160px;
  }
  .side-rail-left { right: calc(100% + 20px); }
  .side-rail-right { left: calc(100% + 20px); }
  .side-rail-sticky {
    position: sticky;
    top: 84px;
  }
  .side-rail-sticky ins.adsbygoogle {
    display: block;
    width: 160px;
    height: 600px;
  }
}
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.hero h1 {
  margin: 8px 0 10px;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
}
.hero-intro {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}
.pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.stat-chip {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.84rem;
}
.stat-chip strong {
  display: block;
  font-size: 1rem;
  color: var(--text);
  margin-top: 2px;
}

/* Home cards */
.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filter-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.calc-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.calc-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  text-decoration: none;
}
.calc-card h2 {
  margin: 10px 0 8px;
  font-size: 1.15rem;
  color: var(--text);
}
.calc-card p {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
  flex: 1;
}
.calc-card .go-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
}

/* Calculator layout */
.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
@media (max-width: 780px) {
  .calc-grid { grid-template-columns: 1fr; }
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel-title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}
.input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }
.input-wrap input, .input-wrap select {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 12px;
  outline: none;
}
.input-unit {
  padding: 0 12px;
  font-size: 0.86rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.preset-btn {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}
.preset-btn:hover { border-color: var(--primary); color: var(--primary); }

.seg-group {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 10px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
}
.seg-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Result Panel */
.result-highlight {
  background: var(--primary-soft);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
.result-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.result-main {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  color: var(--primary);
  margin: 4px 0;
  letter-spacing: -0.02em;
}
.result-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.result-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.93rem;
}
.result-list li:last-child { border-bottom: 0; }
.result-list .k { color: var(--text-muted); }
.result-list .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.result-list li.total-row {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 12px;
  font-size: 0.98rem;
}

.notice-box {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.86rem;
}
.notice-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
}
.notice-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}
.share-row {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}
.copy-btn {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Content & tables */
.guide-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.guide-section h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
  line-height: 1.4;
}
.guide-section p { margin: 0 0 12px; color: var(--text-muted); }
.guide-section p:last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin-top: 14px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
th {
  background: var(--surface-alt);
  font-weight: 700;
  color: var(--text);
}
td.num, th.num { text-align: right; }

details.schedule-box {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
details.schedule-box summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
}

.faq-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.faq-item:last-child { border-bottom: 0; padding-bottom: 0; }
.faq-q { margin: 0 0 6px; font-size: 1rem; font-weight: 700; }
.faq-a { margin: 0; font-size: 0.92rem; color: var(--text-muted); }

.source-list {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 0.9rem;
}
.source-list li { margin-bottom: 6px; }

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.related-card {
  display: block;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 700;
}
.related-card span {
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
}

.hidden { display: none !important; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-links a { color: var(--text-muted); }
