/* 잔치도구 공통 스타일 — 모든 페이지가 이 파일 하나를 씀 */
:root {
  --navy: #1F2F4A;
  --beige: #B9A27A;
  --bg: #FBFAF7;
  --surface: #FFFFFF;
  --surface-2: #F3F0EA;
  --text: #2E3440;
  --muted: #6B6F78;
  --line: #E6E1D8;
  --accent: #1F2F4A;
  --accent-text: #FFFFFF;
  --point: #B9A27A;
  --danger: #C25555;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31,47,74,.06), 0 4px 16px rgba(31,47,74,.06);
  --font: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #12161D;
  --surface: #1B212B;
  --surface-2: #232B37;
  --text: #E7E9ED;
  --muted: #A0A6B1;
  --line: #2E3644;
  --accent: #D9C49E;
  --accent-text: #1B212B;
  --point: #D9C49E;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.65;
  word-break: keep-all; overflow-wrap: anywhere;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }

/* ---------- 레이아웃 ---------- */
.container { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { font-weight: 800; font-size: 19px; text-decoration: none; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.logo-mark { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 15px; }
:root[data-theme="dark"] .logo-mark { background: var(--accent); color: var(--accent-text); }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-size: 15px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 17px;
}
@media (max-width: 560px) { .nav a.hide-sm { display: none; } }

main { padding: 28px 0 48px; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
h1 { font-size: clamp(26px, 5vw, 36px); line-height: 1.25; margin: 0 0 8px; letter-spacing: -.02em; }
h2 { font-size: 22px; margin: 40px 0 12px; letter-spacing: -.01em; }
h3 { font-size: 18px; margin: 24px 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; font-size: 17px; }

/* ---------- 카드 · 도구 목록 ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tool-card {
  display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--point); }
.tool-card .ico { font-size: 28px; line-height: 1; }
.tool-card h3 { margin: 10px 0 4px; font-size: 17px; }
.tool-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.section-title { display: flex; align-items: baseline; gap: 8px; }
.section-title small { color: var(--muted); font-weight: 400; font-size: 14px; }

/* ---------- 도구 화면 ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-weight: 600; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--point); outline-offset: 1px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
.btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 12px;
  padding: 12px 20px; background: var(--accent); color: var(--accent-text);
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.result {
  margin-top: 16px; padding: 18px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px dashed var(--point);
}
.result .big { font-size: clamp(28px, 7vw, 44px); font-weight: 800; color: var(--accent); line-height: 1.2; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 20px; font-weight: 800; }

table.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table-wrap { overflow-x: auto; }

/* ---------- 본문 설명 · FAQ (검색 노출에 중요) ---------- */
.content { margin-top: 8px; }
.content p, .content li { color: var(--text); }
.content ul, .content ol { padding-left: 22px; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 8px 0 0; color: var(--muted); }
.related { margin-top: 40px; }

/* ---------- 광고 칸 ---------- */
.ad-slot { margin: 24px 0; min-height: 100px; text-align: center; }
.ad-slot:empty { display: none; }
.ad-slot .ad-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; letter-spacing: .05em; }
.ad-slot.placeholder {
  display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 12px;
  color: var(--muted); font-size: 13px; background: var(--surface-2);
}

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

/* 전체 화면 도구(추첨 캔버스 등) */
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage:fullscreen { border: 0; border-radius: 0; aspect-ratio: auto; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
