/* 시험지 지우개: 사이트 공통(머리말·꼬리말) + 글 페이지(.site) */
:root {
  --s-bg: #f2f5f6; --s-surface: #ffffff; --s-ink: #1b242a; --s-muted: #5a6872; --s-line: #d7dfe3;
  --s-accent: #1d5b78; --s-accent-ink: #ffffff; --s-soft: #e2eef4; --s-todo: #fff1b8;
  --s-display: "Nanum Myeongjo", "AppleMyungjo", "Batang", serif;
  --s-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --s-bg: #11171b; --s-surface: #182026; --s-ink: #e5ebee; --s-muted: #9aa8b1; --s-line: #2a343b; --s-accent: #72b6d6; --s-accent-ink: #0d1a21; --s-soft: #1d2f39; --s-todo: #5a4a10; color-scheme: dark; }
}
:root[data-theme="dark"] { --s-bg: #11171b; --s-surface: #182026; --s-ink: #e5ebee; --s-muted: #9aa8b1; --s-line: #2a343b; --s-accent: #72b6d6; --s-accent-ink: #0d1a21; --s-soft: #1d2f39; --s-todo: #5a4a10; color-scheme: dark; }

/* 모든 페이지 공통: 브라우저 기본 여백 제거 (도구 페이지와 글 페이지 폭을 같게) */
html, body { margin: 0; }
/* 스크롤바가 있는 페이지와 없는 페이지의 폭 차이(약 15px)로 화면이 옆으로 튀지 않게 자리를 항상 비워 둠 */
html { scrollbar-gutter: stable; }
/* 도구 페이지와 같은 크기 계산(테두리·안쪽 여백 포함). 이게 없으면 글 페이지의 배너가 1280보다 30px 넓어짐 */
.lang-banner, .inapp-banner, .site-header, .site-footer, body.site *, body.site *::before, body.site *::after { box-sizing: border-box; }
/* 한글은 단어 단위로 줄바꿈 (긴 주소·영단어는 넘치지 않게 끊음) */
body { word-break: keep-all; overflow-wrap: break-word; }

/* 머리말 */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-block: 4px 12px; border-bottom: 1px solid var(--s-line); font-family: var(--s-body); }
.site-brand { display: block; line-height: 0; text-decoration: none; }
.site-brand img { height: 40px; width: auto; display: block; }
.brand-hero { margin: 8px 0 20px; line-height: 0; }
.brand-hero img { width: min(100%, 520px); height: auto; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-left: auto; }
.site-header nav a { color: var(--s-muted); text-decoration: none; font-size: 14.5px; padding: 6px 0; border-bottom: 2px solid transparent; white-space: nowrap; }
/* 휴대폰: 1줄 로고 + 언어 전환, 2줄 메뉴 (넘치면 옆으로 밀어서 보기) */
@media (max-width: 640px) {
  .site-header { gap: 6px 12px; }
  .site-brand img { height: 32px; }
  .site-header nav { order: 3; flex: 1 0 100%; margin-left: 0; flex-wrap: nowrap; gap: 0 14px; overflow-x: auto; scrollbar-width: none; }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav a { font-size: 14px; }
}
.site-header nav a:hover { color: var(--s-ink); }
.site-header nav a[aria-current="page"] { color: var(--s-accent); border-bottom-color: var(--s-accent); font-weight: 600; }

.site-header .lang-switch { border: 1px solid var(--s-line); border-radius: 999px; padding: 3px 12px; color: var(--s-ink); text-decoration: none; font-size: 14px; white-space: nowrap; }
.site-header .lang-switch:hover { border-color: var(--s-accent); }

/* 언어 제안 배너 */
.lang-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; background: var(--s-soft); color: var(--s-ink); border: 1px solid var(--s-line); border-radius: 10px; padding: 10px 14px; margin: 0 auto 14px; max-width: 1280px; font-family: var(--s-body); font-size: 14.5px; line-height: 1.5; /* 페이지마다 다른 줄 간격을 물려받지 않게 고정 */ }
.lang-banner a, .lang-banner button, .inapp-banner a, .inapp-banner button { line-height: 1.5; display: inline-block; min-height: 0; margin: 0; }
.lang-banner span { flex: 1 1 220px; }
.lang-banner .lang-go { background: var(--s-accent); color: var(--s-accent-ink); text-decoration: none; font-weight: 600; padding: 6px 14px; border-radius: 8px; }
.lang-banner button { font: inherit; background: transparent; color: var(--s-muted); border: 1px solid var(--s-line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }

/* 앱 안 브라우저 안내 (화면 위에 고정) */
.inapp-banner { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: #3a2f0b; color: #fbeec4; border: 1px solid #6b5716; border-radius: 10px; padding: 10px 14px; margin: 0 auto 14px; max-width: 1280px; font-family: var(--s-body); font-size: 14.5px; line-height: 1.5; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.inapp-banner span { flex: 1 1 220px; }
.inapp-banner .inapp-go { background: #f2c94c; color: #2a2105; text-decoration: none; font-weight: 700; padding: 7px 14px; border-radius: 8px; white-space: nowrap; }
.inapp-banner button { font: inherit; background: transparent; color: #e8d9a8; border: 1px solid #6b5716; border-radius: 8px; padding: 6px 12px; cursor: pointer; }

/* 공유 줄 (꼬리말 위) · 저장 후 카드 */
.share-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; border: 1px solid var(--s-line); background: var(--s-surface); border-radius: 10px; padding: 12px 16px; margin-top: 24px; font-family: var(--s-body); font-size: 14.5px; line-height: 1.5; color: var(--s-ink); }
.share-strip > p { margin: 0; flex: 1 1 260px; }
.share-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btns button { font: inherit; font-size: 14px; line-height: 1.5; min-height: 0; margin: 0; cursor: pointer; border-radius: 8px; border: 1px solid var(--s-line); background: transparent; color: var(--s-ink); padding: 6px 12px; }
.share-btns button.primary { background: var(--s-accent); border-color: var(--s-accent); color: var(--s-accent-ink); font-weight: 600; }
.share-btns button:hover { border-color: var(--s-accent); }
.fav-help { flex-basis: 100%; margin: 4px 0 0; font-size: 13.5px; color: var(--s-muted); }
.share-card { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 40; width: min(360px, calc(100% - 32px)); background: var(--s-surface); color: var(--s-ink); border: 1px solid var(--s-accent); border-radius: 12px; padding: 16px 16px 14px; box-shadow: 0 8px 28px rgba(0,0,0,.45); font-family: var(--s-body); font-size: 14.5px; line-height: 1.5; display: grid; gap: 8px; box-sizing: border-box; }
.share-card strong { font-size: 15.5px; padding-right: 28px; }
.share-card p { margin: 0; color: var(--s-muted); }
.share-card .share-x { position: absolute; top: 6px; right: 8px; width: 32px; height: 32px; min-height: 0; padding: 0; margin: 0; border: 0; background: transparent; color: var(--s-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.share-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; background: var(--s-ink); color: var(--s-bg); padding: 10px 16px; border-radius: 8px; font-family: var(--s-body); font-size: 14px; max-width: calc(100% - 32px); }
.share-toast[hidden] { display: none; }
@media (max-width: 640px) { .share-card { left: 16px; right: 16px; width: auto; } }

/* 꼬리말 */
.site-footer { border-top: 1px solid var(--s-line); margin-top: 32px; padding-top: 16px; color: var(--s-muted); font-size: 13px; font-family: var(--s-body); display: grid; gap: 6px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: var(--s-muted); }
.site-footer p { margin: 0; }

/* 앱 페이지 안내 영역 */
.site-intro { background: var(--s-surface); border: 1px solid var(--s-line); border-radius: 10px; padding: 18px 20px; display: grid; gap: 10px; font-family: var(--s-body); }
.site-intro h2 { font-family: var(--s-display); font-weight: 800; font-size: 20px; margin: 6px 0 0; }
.site-intro ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.site-intro ol strong { margin-right: 6px; }
.site-intro dl { margin: 0; display: grid; gap: 4px; }
.site-intro dt { font-weight: 600; margin-top: 8px; }
.site-intro dd { margin: 0; color: var(--s-muted); }
.site-intro .more { color: var(--s-muted); font-size: 14px; }
/* 양식 전용 페이지: 설정·미리보기를 먼저, 전체 양식 목록은 그 아래로 */
.wrap.preset > .groups, .wrap.preset > nav.picker, .wrap.preset > .about, .wrap.preset > .site-intro, .wrap.preset > .share-strip, .wrap.preset > .site-footer { order: 1; }
.site-intro .tpl-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.site-intro a { color: var(--s-accent); }

/* 글 페이지 */
body.site {
  margin: 0; background: var(--s-bg); color: var(--s-ink); font-family: var(--s-body); font-size: 16.5px; line-height: 1.75;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 20px 40px;
}
/* 모든 페이지 폭을 시험지 지우기(1280px)에 맞춤. 글 본문도 같은 폭을 다 씀 (오너 요청 2026-11-08) */
body.site > * { max-width: 1280px; margin-left: auto; margin-right: auto; }
.doc { padding-top: 24px; }
.doc h1 { font-family: var(--s-display); font-weight: 800; font-size: clamp(28px, 5vw, 36px); line-height: 1.3; margin: 0 0 12px; text-wrap: balance; }
.doc h2 { font-family: var(--s-display); font-weight: 800; font-size: 22px; line-height: 1.4; margin: 36px 0 8px; text-wrap: balance; }
.doc h3 { font-size: 17px; margin: 24px 0 4px; }
.doc p, .doc li { max-width: none; }
.doc .lead { font-size: 18px; color: var(--s-muted); }
.doc .crumb { margin: 0 0 6px; font-size: 14px; }
.doc .crumb a, .doc a { color: var(--s-accent); }
.doc .meta { color: var(--s-muted); font-size: 14px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; }
.doc .table { overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--s-line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--s-soft); }
.doc .tip { background: var(--s-soft); border-radius: 8px; padding: 12px 16px; }
.doc .next { margin-top: 40px; border-top: 1px solid var(--s-line); padding-top: 8px; }
.doc .cta { display: inline-block; background: var(--s-accent); color: var(--s-accent-ink); text-decoration: none; font-weight: 600; padding: 10px 18px; border-radius: 8px; }
.doc .table { max-width: none; }
.doc .cards { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.doc .cards li { background: var(--s-surface); border: 1px solid var(--s-line); border-radius: 10px; padding: 14px 16px; max-width: none; }
.doc .cards p { margin: 4px 0 0; color: var(--s-muted); font-size: 15px; }
mark.todo { background: var(--s-todo); color: inherit; padding: 0 4px; border-radius: 3px; }
a:focus-visible { outline: 2px solid var(--s-accent); outline-offset: 2px; }
