/* 예절 — 모바일 먼저. 바탕은 한지 빛, 글자는 먹빛, 단추는 쪽빛. */
:root {
  --paper: #f7f3ea;
  --card: #fffdf8;
  --ink: #1f1d1a;
  --ink2: #48443e;
  --muted: #736d65;
  --line: #e2dacb;
  --line2: #cfc5b2;
  --accent: #2d4f6c;
  --accent-ink: #ffffff;
  --accent-soft: #e6edf2;
  --red: #8c3a2b;
  --red-soft: #f6e9e4;
  --green: #2f6b4f;
  --green-soft: #e5f0ea;
  --radius: 12px;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", "Batang", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.75 var(--sans); word-break: keep-all; overflow-wrap: anywhere;
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 6px 10px; z-index: 9; }

/* 머리 · 메뉴 */
.site-head { background: var(--card); border-bottom: 1px solid var(--line); }
.head-row { display: flex; align-items: baseline; gap: 10px; padding-top: 12px; padding-bottom: 6px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.15rem; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--ink); color: var(--paper); font-family: var(--serif); font-size: 18px; line-height: 1; }
.brand-sub { color: var(--muted); font-size: .88rem; }
.site-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.nav-row { display: flex; gap: 6px; padding-top: 4px; padding-bottom: 10px; white-space: nowrap; }
.nav-row a { flex: none; padding: 6px 12px; border: 1px solid var(--line2); border-radius: 999px; color: var(--ink2); text-decoration: none; font-size: .92rem; background: var(--paper); }
.nav-row a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.crumbs { font-size: .85rem; color: var(--muted); margin: 14px 0 0; }
.crumbs a { color: var(--muted); }

/* 본문 */
main { padding-bottom: 40px; }
h1 { font-size: 1.6rem; line-height: 1.35; margin: 14px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 1.27rem; line-height: 1.4; margin: 34px 0 10px; padding-top: 6px; }
h3 { font-size: 1.08rem; margin: 22px 0 6px; }
p { margin: 0 0 12px; }
.lead { color: var(--ink2); font-size: 1.02rem; }
.note { color: var(--muted); font-size: .9rem; }
.small { font-size: .9rem; }
.hanja { font-family: var(--serif); }
ul, ol { padding-left: 1.3em; margin: 0 0 14px; }
li { margin: 4px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
strong { font-weight: 700; }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line2); border-radius: 5px; font-size: .88em; background: var(--card); }

/* 도구 상자 */
.tool { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0 20px; box-shadow: 0 1px 0 rgba(0,0,0,.03); }
.tool > :last-child { margin-bottom: 0; }
.field { margin: 0 0 14px; }
.field > label, .field > .label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .hint { display: block; color: var(--muted); font-size: .86rem; font-weight: 400; margin-top: 4px; }
input[type=date], input[type=text], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; font-size: 1.05rem; color: var(--ink);
  background: #fff; border: 1px solid var(--line2); border-radius: 10px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label { position: relative; }
.choices input { position: absolute; opacity: 0; inset: 0; }
.choices span { display: inline-block; padding: 9px 14px; border: 1px solid var(--line2); border-radius: 999px; background: #fff; cursor: pointer; font-size: .97rem; }
.choices input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.choices input:focus-visible + span { outline: 3px solid var(--accent-soft); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.line { background: #fff; color: var(--accent); }
.btn.wide { flex: 1 1 100%; }
.btn:active { transform: translateY(1px); }

/* 결과 */
.result { margin-top: 16px; }
.answer { font-size: 1.12rem; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); margin: 0 0 12px; }
.answer b { font-size: 1.22rem; }
.warn { padding: 10px 12px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: .95rem; }
table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: .98rem; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-weight: 700; color: var(--ink2); background: rgba(0,0,0,.02); }
td.num, th.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
tr.hl td { background: var(--accent-soft); font-weight: 700; }
tr.past td { color: var(--muted); }
.tag { display: inline-block; padding: 0 7px; border-radius: 6px; font-size: .8rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.green { background: var(--green-soft); color: var(--green); }

/* 그림(도해) */
figure { margin: 16px 0 20px; }
figure .fig { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; overflow-x: auto; }
figure svg { display: block; margin: 0 auto; height: auto; }
figcaption { color: var(--muted); font-size: .88rem; margin-top: 6px; }

/* 단계 · 체크 */
ol.steps { list-style: none; padding: 0; counter-reset: s; }
ol.steps > li { counter-increment: s; position: relative; padding: 2px 0 10px 40px; margin: 0; }
ol.steps > li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-size: .9rem; font-weight: 700; }
ul.check { list-style: none; padding: 0; }
ul.check li { padding-left: 30px; position: relative; }
ul.check li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 16px; height: 16px; border: 2px solid var(--line2); border-radius: 4px; background: #fff; }

/* 다음 할 일 */
.next { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 14px 16px; margin: 28px 0 8px; }
.next h2 { margin: 0 0 8px; padding: 0; font-size: 1.1rem; }
.next ul { margin: 0; }

/* 홈 */
.axis { display: grid; gap: 12px; margin: 14px 0 6px; }
.axis a.card { display: block; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.axis a.card b { display: block; font-size: 1.07rem; margin-bottom: 2px; color: var(--accent); }
.axis a.card span { color: var(--ink2); font-size: .94rem; }
.today-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; }
.today-box .big { font-size: 1.18rem; font-weight: 700; }

.todo { border: 2px dashed var(--red); color: var(--red); padding: 8px 12px; border-radius: 8px; font-weight: 700; }

/* 바닥 */
.site-foot { border-top: 1px solid var(--line); background: var(--card); padding: 18px 0 26px; font-size: .9rem; color: var(--muted); }
.site-foot p { margin: 0 0 6px; }
.site-foot a { color: var(--ink2); }

/* 알림 */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: .95rem; z-index: 20; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; }

/* 미리보기 칸(봉투 · 지방) */
.preview { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; background: #ece6d9; border-radius: var(--radius); padding: 14px; }
.preview svg { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.preview .cap { text-align: center; font-size: .82rem; color: var(--muted); margin-top: 4px; }

/* 봉투 문구 카드 */
.phrases { display: grid; gap: 10px; margin: 12px 0 18px; }
.phrase { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.phrase .face { flex: none; background: #ece6d9; border-radius: 8px; padding: 6px; line-height: 0; }
.phrase .face svg { background: #fff; }
.phrase h3 { margin: 0 0 2px; font-size: 1.06rem; }
.phrase h3 .hanja { font-size: 1.15rem; margin-right: 4px; }
.phrase p { margin: 0 0 6px; font-size: .94rem; color: var(--ink2); }
.phrase a.go { font-size: .92rem; font-weight: 700; }
@media (min-width: 640px) { .phrases { grid-template-columns: 1fr 1fr; } }

/* 인사말 목록 */
.insa-list { list-style: none; padding: 0; margin: 8px 0 18px; }
.insa-list li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; }
.insa-btns { display: flex; gap: 6px; margin-top: 8px; }
.insa-btns .btn { min-height: 38px; padding: 6px 14px; font-size: .92rem; }

/* 인사 그림 */
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; -webkit-overflow-scrolling: touch; }
.thumb { flex: none; padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; line-height: 0; }
.thumb img { width: 64px; height: 80px; border-radius: 6px; object-fit: cover; }
.thumb.on { border-color: var(--accent); }
.card-canvas { width: 100%; height: auto; display: block; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,.18); background: #eee; }

@media (min-width: 640px) {
  body { font-size: 17.5px; }
  h1 { font-size: 1.9rem; }
  .axis { grid-template-columns: 1fr 1fr; }
  .btn.wide { flex: 0 1 auto; }
}

/* 인쇄: 인쇄할 때 JS 가 #print-root 에 인쇄할 것만 옮겨 담는다 */
#print-root { display: none; }
@media print {
  body { background: #fff; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  body:not(.printing) .site-head, body:not(.printing) .site-foot, body:not(.printing) .no-print, body:not(.printing) .crumbs { display: none; }
  .print-sheet { break-after: page; page-break-after: always; overflow: hidden; }
  .print-sheet:last-child { break-after: auto; page-break-after: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
