:root {
  --bg: #ffffff;
  --text: #1c2430;
  --muted: #5b6676;
  --line: #dfe4ea;
  --accent: #1f5fd1;
  --accent-text: #ffffff;
  --panel: #f5f7fa;
  --ad-bg: #fafbfc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --text: #e6eaf0;
    --muted: #9aa5b5;
    --line: #2a323d;
    --accent: #6ea0ff;
    --accent-text: #0b1220;
    --panel: #1a2029;
    --ad-bg: #161b22;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  line-height: 1.7;
  font-size: 16px;
}

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

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.nav a { margin-left: 14px; font-size: 14px; color: var(--muted); text-decoration: none; }

h1 { font-size: 26px; line-height: 1.35; margin: 28px 0 8px; }
h2 { font-size: 20px; margin: 36px 0 10px; }
h3 { font-size: 17px; margin: 22px 0 6px; }
.lead { color: var(--muted); margin: 0 0 20px; }

.tool { background: var(--panel); border: 1px solid var(--line); padding: 18px; margin: 18px 0; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button { flex: 1; padding: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 15px; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
input, select { width: 100%; padding: 12px; font-size: 18px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.field { margin-bottom: 14px; }
.btn { width: 100%; padding: 13px; font-size: 16px; font-weight: 700; border: 0; background: var(--accent); color: var(--accent-text); cursor: pointer; }

.result { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.result[hidden] { display: none; }
.result .main { font-size: 28px; font-weight: 700; margin: 4px 0 12px; }
.result dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 15px; }
.result dt { color: var(--muted); }
.result dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.error { color: #c0392b; font-size: 14px; margin-top: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 10px 0; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { background: var(--panel); }

details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 0; color: var(--muted); }

.notice { font-size: 13px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; margin: 24px 0; }
.related ul { padding-left: 18px; }

/* 광고 슬롯: 입력창·버튼과 떨어진 위치에 둔다. 승인 전에는 높이만 비워 둔다. */
.ad-slot { min-height: 0; margin: 32px 0; text-align: center; background: var(--ad-bg); }

.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 20px 0 40px; font-size: 13px; color: var(--muted); }
.site-footer a { color: var(--muted); margin-right: 14px; }

.tool-list { list-style: none; padding: 0; margin: 0; }
.tool-list li { border-bottom: 1px solid var(--line); }
.tool-list a { display: block; padding: 16px 0; text-decoration: none; color: var(--text); }
.tool-list strong { display: block; font-size: 18px; color: var(--accent); }
.tool-list span { font-size: 14px; color: var(--muted); }

/* 공통 보조 스타일 (도구 페이지 공통) */
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.disclaimer { font-size: 13px; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 10px; margin: 14px 0 0; }
.warn { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid #d98e00; padding: 10px 12px; font-size: 14px; margin: 12px 0; }
.warn[hidden] { display: none; }
.adv { margin-top: 12px; border-top: 1px solid var(--line); border-bottom: 0; padding-top: 10px; }
.adv .field { margin-top: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text); margin: 8px 0; }
.check input { width: 20px; height: 20px; flex: none; }
.btn.sub { background: var(--bg); color: var(--accent); border: 1px solid var(--accent); padding: 10px; font-size: 14px; margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.basis td, .basis th { font-size: 13px; text-align: left; }
.result .big-label { font-size: 14px; color: var(--muted); }
.result .total-row { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 700; }

/* 좁은 화면에서 넓은 표는 페이지가 아니라 표 자체가 가로로 스크롤된다 */
main table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
