:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #15181d;
  --muted: #5b6372;
  --line: #e2e5ea;
  --accent: #2f6fed;
  --accent-text: #ffffff;
  --accent-weak: #e8f0fe;
  --danger: #c93c3c;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.04), 0 1px 3px rgb(16 24 40 / 0.06);
  color-scheme: only light;
}


* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

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

/* 머리말·본문·꼬리말이 같은 가운데 칸을 쓴다 */
.wrap { max-width: 792px; margin: 0 auto; padding: 0 16px; }

/* 머리말 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { font-weight: 800; font-size: 18px; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-weak); font-weight: 600; }

/* 본문 */
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 24px 0 48px; }
@media (min-width: 720px) { .page { padding-top: 32px; } }
.content { min-width: 0; }

/* 도구 페이지: 머리말·꼬리말 없이 도구 하나만 화면 가운데에 둔다.
   광고 칸(rail)은 도구가 가운데에서 밀리지 않도록 오른쪽 여백에만 두고, 여백이 충분한 1400px 이상에서만 보인다. */
/* 맨 위 오른쪽: 다른 언어판 링크 */
.solo-top { display: flex; justify-content: flex-end; min-height: 44px; padding: 8px 12px 0; }
.lang-switch { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 14px; text-decoration: none; }
.lang-switch:hover { color: var(--text); border-color: var(--muted); }
.solo { display: grid; grid-template-columns: minmax(0, 720px); justify-content: center; padding: 4px 16px 8px; }
@media (min-width: 720px) { .solo { padding-top: 20px; } }
.solo > .content > h1, .solo > .content > .lead { text-align: center; }
.solo .hero-result { text-align: center; }
.rail { display: none; }
@media (min-width: 1400px) {
  .solo { grid-template-columns: 1fr minmax(0, 720px) 1fr; column-gap: 40px; align-items: start; }
  .solo > .content { grid-column: 2; }
  .solo > .rail { display: block; grid-column: 3; width: 300px; }
  .rail .ad { position: sticky; top: 24px; }
}
.solo-foot { text-align: center; font-size: 13px; color: var(--muted); padding: 8px 16px 32px; margin: 0; }
.solo-foot a { color: var(--muted); text-decoration: none; }
.solo-foot a:hover { color: var(--text); }

h1 { font-size: 26px; line-height: 1.3; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 20px; line-height: 1.35; margin: 36px 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 16px; margin: 20px 0 6px; }
.lead { color: var(--muted); margin: 0 0 20px; }
@media (min-width: 720px) { h1 { font-size: 30px; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
@media (min-width: 720px) { .card { padding: 24px; } }
.card + .card { margin-top: 16px; }

/* 입력 */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span, .field-label { font-size: 14px; color: var(--muted); font-weight: 600; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .row { grid-template-columns: 1fr 1fr; } }

input, select, button, textarea { font: inherit; color: inherit; }
input[type="text"], input[type="date"], input[type="datetime-local"], input[type="number"], select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font-size: 17px; /* 16px 미만이면 iOS가 확대한다 */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  appearance: none;
  -webkit-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% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.copied { color: var(--accent); }

textarea {
  display: block;
  width: 100%;
  min-height: 200px;
  padding: 12px;
  font-size: 17px;
  line-height: 1.6;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.check { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.checks { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin-bottom: 14px; }
@media (min-width: 560px) { .checks { grid-template-columns: 1fr 1fr; } }
input[type="range"] { width: 100%; accent-color: var(--accent); }

/* 버튼 줄 */
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }

/* 탭처럼 고르는 버튼 묶음 */
.seg { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 16px; }
.seg button { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: var(--accent-text); }

/* 숫자 상자 묶음 */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; text-align: center; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat span { font-size: 13px; color: var(--muted); }

/* 문장처럼 읽히는 계산 줄: [200]의 [15]%는 */
.eq { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; font-size: 16px; }
.eq input { width: 88px !important; text-align: right; }
@media (min-width: 560px) { .eq { gap: 8px; } .eq input { width: 128px !important; } }
.eq-out { margin-top: 12px; text-align: center; font-size: 15px; color: var(--muted); }
.eq-out b { font-size: 26px; color: var(--text); font-variant-numeric: tabular-nums; margin: 0 4px; }

/* 생성된 값 (비밀번호, 뽑은 숫자) */
.output { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; margin-bottom: 12px; }
.output > :first-child { flex: 1; min-width: 0; font-size: 20px; font-weight: 600; word-break: break-all; font-variant-numeric: tabular-nums; }

/* 도구 안의 작은 제목, 남은 글자 안내 */
.calc-title { text-align: center; margin: 0 0 12px; }
.note.limit { text-align: center; margin: 0 0 12px; }
.note.over { color: var(--danger); font-weight: 600; }
.strength { text-align: center; margin: -4px 0 14px; }
.strength[data-level="0"] { color: var(--danger); }
.strength[data-level="3"] { color: #1f7a52; }

/* 뽑은 값 */
.picks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.picks:empty { display: none; }
.pick { padding: 6px 14px; border-radius: 999px; background: var(--accent-weak); color: var(--accent); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.order { margin: 0; padding-left: 28px; text-align: left; width: 100%; }
.order li { padding: 4px 0; font-weight: 600; }

/* 파일 고르기 줄 */
.file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; }
.file-row label.btn { cursor: pointer; }
.note.ok { color: #1f7a52; font-weight: 600; }

/* 결과 표 */
.results { display: grid; gap: 0; margin-top: 4px; }
.result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.result:first-child { border-top: 0; }
.result .label { color: var(--muted); font-size: 14px; flex: none; width: 104px; }
.result .value { flex: 1; min-width: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.result .value small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.result .btn { flex: none; }

.big { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.big small { font-size: 18px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.hero-result { padding: 4px 0 14px; }
.hero-result .caption { color: var(--muted); font-size: 14px; }

.note { font-size: 14px; color: var(--muted); }
.error { color: var(--danger); font-size: 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* 설명 글 */
.prose { color: var(--text); }
.prose p, .prose li { color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.prose ul { padding-left: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }
details { border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; background: var(--surface); }
details + details { margin-top: 8px; }
summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 8px; }


/* 홈 */
.hero { padding: 32px 0 8px; text-align: center; }
.hero h1 { font-size: 34px; line-height: 1.25; }
@media (min-width: 720px) { .hero { padding: 56px 0 16px; } .hero h1 { font-size: 44px; } }
.hero .lead { font-size: 18px; max-width: 560px; margin-left: auto; margin-right: auto; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 40px 0 14px; }
.section-title h2 { margin: 0; }
.section-title a { font-size: 14px; text-decoration: none; }
.apps { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .apps { grid-template-columns: repeat(auto-fit, minmax(0, 372px)); justify-content: center; } }
.home .section-title { justify-content: center; }
.home > .prose, .home > .note { text-align: center; }
.principles { display: grid; gap: 12px; grid-template-columns: 1fr; text-align: center; }
@media (min-width: 720px) { .principles { grid-template-columns: repeat(3, 1fr); } }
.principles .card { padding: 18px; }
/* 격자 안의 카드는 .card + .card 의 위 여백을 쓰지 않는다 (같은 줄 카드 높이가 어긋난다) */
.apps .card + .card, .principles .card + .card { margin-top: 0; }
.principles strong { font-size: 17px; }
.principles p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.app { display: flex; gap: 16px; align-items: flex-start; }
.app-icon {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #2f9e6b, #1f7a52);
}
.app h3 { margin: 0 0 2px; font-size: 18px; }
.app p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: 2px; margin-left: 4px; }

/* 도구 목록: 개수가 많으니 작은 카드를 여러 줄로 */
.tools-list { text-align: center; }
.tools-list .lead { max-width: 560px; margin-left: auto; margin-right: auto; }
.tools-list h2 { font-size: 15px; color: var(--muted); margin: 24px 0 8px; text-align: left; }
.tools { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); text-align: left; }
@media (min-width: 720px) { .tools { grid-template-columns: repeat(3, 1fr); } }
.tool {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.tool:hover { border-color: var(--accent); }
.tool strong { display: block; font-size: 15px; line-height: 1.35; }
.tool span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }

/* 광고 자리: 광고 코드가 없으면 공간을 차지하지 않는다 */
.ad { display: none; }
.ad.on { display: block; margin: 24px 0; text-align: center; }
.ad.on.top { height: 100px; margin: 0 0 20px; overflow: hidden; }
.ad.on.inline { min-height: 280px; }
.ad.on.middle { min-height: 280px; }
.ad.on.bottom { min-height: 250px; }
.rail .ad.on { margin: 0; min-height: 600px; }
/* 오른쪽 칸이 보이는 넓은 화면에서는 본문 중간 광고를 빼서 광고 수를 맞춘다 */
@media (min-width: 1400px) { .ad.on.middle { display: none; } }
.ad.preview {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-2);
}

/* 언어 안내 띠 (site.js) */
.lang-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px; padding: 8px 40px; position: relative; background: var(--accent-weak); font-size: 14px; text-align: center; }
.lang-bar a { font-weight: 600; }
.lang-bar button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; }

/* 꼬리말 */
.site-footer { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
