/* 잔치도구 공통 스타일 — 모든 페이지가 이 파일 하나를 씀 */
: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: 44px; height: 44px; border-radius: 12px; cursor: pointer; font-size: 17px;
}
/* 손가락으로 누르기 쉬운 크기 */
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; accent-color: var(--accent); vertical-align: middle; }
.nav a { min-height: 44px; display: inline-flex; align-items: center; }
.logo, .nav a { white-space: nowrap; }
@media (max-width: 560px) { .nav a.hide-sm { display: none; } }
@media (max-width: 400px) { .nav { gap: 0; } .nav a { padding: 8px 8px; } .logo { font-size: 17px; } }

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; height: 30px; display: flex; align-items: center; }
.tool-card .ico img { display: block; width: 1.12em; height: 1.12em; } /* 그림문자 아이콘과 같은 크기로 보이게 */
.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[data-slot="middle"] { margin-top: 72px; }
/* 넓은 PC 화면 좌우 여백 레일 (본문 980px 바깥) */
.ad-rail { position: fixed; top: 84px; width: 160px; z-index: 1; }
.ad-rail.left { left: calc(50% - 490px - 24px - 160px); }
.ad-rail.right { right: calc(50% - 490px - 24px - 160px); }
.ad-rail .ad-slot { margin: 0; min-height: 600px; }
@media (max-width: 1359px) { .ad-rail { display: none; } }
@media print { .ad-slot, .ad-rail, .install-btn, .site-header, .site-footer, .related { display: none !important; } }
.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; }
.footer-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.footer-tools strong { display: block; color: var(--text); margin-bottom: 6px; font-size: 14px; }
.footer-tools a { display: inline-block; margin: 0 14px 0 0; padding: 6px 0; min-height: 32px; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- 앱 설치 버튼 · 안내창 ---------- */
main.container { position: relative; }
.install-btn {
  position: absolute; top: 20px; right: 16px; z-index: 2;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
  height: 36px; padding: 0 14px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-text); box-shadow: var(--shadow);
}
.install-btn[hidden] { display: none; }
.breadcrumb.has-install { display: flex; align-items: center; white-space: pre; min-height: 32px; padding-top: 8px; }
.breadcrumb.has-install .install-btn { position: static; margin-left: auto; }
.install-guide {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
@media (min-width: 600px) { .install-guide { align-items: center; } }
.ig-card {
  position: relative; width: 100%; max-width: 420px; background: var(--surface); color: var(--text);
  border-radius: 18px; padding: 22px 20px 18px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.ig-card h2 { margin: 0 0 6px; font-size: 19px; }
.ig-sub { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.ig-card ol { margin: 0 0 14px; padding-left: 20px; }
.ig-card li { margin: 6px 0; }
.ig-card .btn-row { justify-content: flex-end; }
.ig-ico { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; font-size: 13px; }
.ig-arrow { position: absolute; left: 50%; bottom: -34px; transform: translateX(-50%); color: #fff; font-size: 28px; animation: ig-bob 1s ease-in-out infinite; }
@keyframes ig-bob { 50% { transform: translate(-50%, 6px); } }
@media (min-width: 600px) { .ig-arrow { display: none; } }

/* 전체 화면 도구(추첨 캔버스 등) */
.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; } }
