/* 이도랑 공통 스타일 — 모든 페이지가 함께 쓴다 (설계서 docs/DESIGN_SPEC.md 2·3·4절)
 * 원칙: 한 화면에 한 가지 일, 맨 아래에 끝내는 버튼 하나.
 *  - 카드 없음(구역 사이는 1px 선 하나), 테두리는 "써 넣는 곳"에만, 그림자는 "떠 있는 것"에만.
 *  - 글자 16px 미만 없음. 손가락 목표 44px 이상. 모서리는 8 / 4 / 0 세 값뿐.
 *  - 포인트색(초록) 뜻 하나: 눌러야 할 것·선택된 것.
 * 페이지 폭: body.narrow(720, 홈·공유받기·안내 글) · body.mid(960, 가리기) · 기본 1120(2열 페이지).
 * 저장 줄이 없는 페이지는 body.no-savebar.
 */

/* ===== 1. 색 토큰 ===== */
:root {
  /* 면 */
  --bg: #f4f6f5;            /* 바탕 */
  --surface: #ffffff;       /* 머리말·저장 줄·입력칸·미리보기 종이 */
  --surface-2: #e9eeeb;     /* 편집 화면 뒤판·썸네일 뒤판·목록 hover */
  /* 선 */
  --line: #cfd6d2;          /* 구분선·입력칸 테두리 */
  --line-strong: #93a09a;   /* 점선 넣기 칸·seg 테두리·미리보기 테두리 */
  /* 글자 */
  --text: #171c1a;
  --muted: #55615c;         /* 흰 바탕 대비 6.4:1 */
  /* 포인트(뜻 하나: 눌러야 할 것·선택된 것) */
  --primary: #1f6f5c;
  --primary-hover: #185a4a;
  --primary-ink: #ffffff;
  --primary-soft: #e3f0eb;  /* 선택된 행·끌어놓는 중 배경 */
  /* 경고(글자만. 상자는 사건이 있을 때만) */
  --warn: #8a5a00;
  --warn-bg: #fff6db;
  --warn-line: #e6c56a;
  --danger: #b42318;        /* 빼기·지우기 글자색만 */
  /* 호환용(값만 연결, JS·옛 CSS가 참조) */
  --accent: var(--warn);
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: none;                                   /* 카드 그림자 폐지 */
  --shadow-float: 0 -4px 16px rgba(0, 0, 0, .08);   /* 저장 줄(위로) */
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, .14);      /* 펼침 메뉴·알림 */
  --font: "Pretendard Variable", Pretendard, -apple-system, "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --header-h: 56px;
  --savebar-h: 64px;
  --page-w: 1120px;         /* 본문 최대폭(페이지별 body 클래스로 바꿈) */
  --col-w: 400px;           /* 2열 페이지 왼쪽 열 폭 */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111514; --surface: #1a1f1d; --surface-2: #242b28;
    --line: #3d4844; --line-strong: #647069;
    --text: #e9edeb; --muted: #a5b0ab;
    --primary: #4fb699; --primary-hover: #63c4a9; --primary-ink: #0d1412; --primary-soft: #1e3530;
    --warn: #e3b55a; --warn-bg: #332c14; --warn-line: #6b5a22; --danger: #f28b82;
    --shadow-float: 0 -4px 16px rgba(0, 0, 0, .5); --shadow-pop: 0 8px 24px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111514; --surface: #1a1f1d; --surface-2: #242b28;
  --line: #3d4844; --line-strong: #647069;
  --text: #e9edeb; --muted: #a5b0ab;
  --primary: #4fb699; --primary-hover: #63c4a9; --primary-ink: #0d1412; --primary-soft: #1e3530;
  --warn: #e3b55a; --warn-bg: #332c14; --warn-line: #6b5a22; --danger: #f28b82;
  --shadow-float: 0 -4px 16px rgba(0, 0, 0, .5); --shadow-pop: 0 8px 24px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
body.narrow { --page-w: 720px; }
body.mid { --page-w: 960px; }
body.no-savebar { --savebar-h: 0px; }
@media (max-width: 959px) { :root { --savebar-h: 72px; } body.no-savebar { --savebar-h: 0px; } }

/* ===== 2. 바탕·글자 단계 ===== */
* { 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: 17px; line-height: 1.55;
  word-break: keep-all; overflow-wrap: anywhere;
  overflow-x: hidden;
}
a { color: var(--primary); }
img, canvas { max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: 24px; line-height: 1.3; letter-spacing: -0.01em; margin-bottom: 8px; }
h2 { font-size: 20px; line-height: 1.3; letter-spacing: -0.01em; margin-bottom: 16px; }
h3 { font-size: 17px; line-height: 1.4; margin-bottom: 8px; }
p { margin: 0 0 8px; }
small, .small { font-size: 16px; }
.muted { color: var(--muted); }
.num, .tabular, .status { font-variant-numeric: tabular-nums; }
.status { font-size: 16px; color: var(--muted); font-weight: 400; }
.hidden { display: none !important; }
/* 한 덩어리 낱말을 줄 끝에서 가르지 않음 — 가운뎃점으로 셋 이상 이은 말("사진·엑셀·PDF")은 점 앞뒤에서 꺾이므로 이것으로 감싼다 */
.nowrap { white-space: nowrap; }
.mobile-only { display: none; }
body.is-mobile .mobile-only { display: block; }
.warn-text { color: var(--warn); font-size: 16px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ===== 3. 머리말·이동 ===== */
.site-header {
  position: sticky; top: 0; z-index: 20; height: var(--header-h);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.site-header .inner {
  max-width: var(--page-w); margin: 0 auto; height: var(--header-h); padding: 0 16px;
  display: flex; align-items: center; gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  font-size: 17px; font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand svg { width: 24px; height: 24px; flex: none; }
/* PC: 글자 링크 5개 */
.site-nav { margin-left: auto; display: flex; gap: 0; }
.site-nav a {
  display: inline-flex; align-items: center; height: 44px; padding: 0 12px;
  font-size: 16px; color: var(--muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--text); }
.site-nav a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
/* 휴대폰: "다른 도구 ▾" 펼침 메뉴 */
.nav-menu { margin-left: auto; position: relative; }
.nav-menu > summary {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  font-size: 16px; color: var(--text); cursor: pointer; list-style: none; white-space: nowrap; user-select: none;
}
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu .menu {
  position: absolute; right: 0; top: calc(100% + 4px); min-width: 220px; z-index: 25;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 4px 0;
}
.nav-menu .menu a {
  display: flex; align-items: center; min-height: 52px; padding: 0 16px;
  font-size: 17px; color: var(--text); text-decoration: none; white-space: nowrap;
}
.nav-menu .menu a:hover { background: var(--surface-2); }
.nav-menu .menu a.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
@media (min-width: 960px) {
  .site-header .inner { padding: 0 24px; }
  .nav-menu { display: none; }
}
@media (max-width: 959px) { .site-nav { display: none; } }

/* ===== 4. 본문 틀·화면 제목·개인정보 한 줄 ===== */
main { max-width: var(--page-w); margin: 0 auto; padding: 24px 16px 40px; }
@media (min-width: 960px) { main { padding: 32px 24px 40px; } }
.page-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 24px; margin: 0 0 24px; }
.page-title h1 { flex: 1 1 100%; margin: 0; }
.page-title > div:not([data-privacy]):not(.privacy) { flex: 1 1 100%; }   /* 옛 구조(div 안 h1+p) 호환 */
.page-title .icon { display: none; }                                       /* 아이콘 타일 폐지 */
.page-title p, .lead { margin: 0; font-size: 16px; color: var(--muted); }
.privacy {
  display: inline-flex; align-items: flex-start; gap: 4px; margin: 0 0 24px;
  font-size: 16px; line-height: 1.5; color: var(--muted); background: none; border: 0; padding: 0; font-weight: 400;
}
.page-title .privacy { margin: 0; }
.privacy svg { flex: none; width: 16px; height: 16px; margin-top: 4px; }   /* 두 줄로 꺾여도 첫 줄에 맞춤 */
/* 끝의 "안내"(privacy.html) 링크: 글자 크기는 그대로, 누르는 영역만 위아래 44px로 넓힘(줄 높이는 안 바뀜) */
.privacy a { padding: 10px 8px; margin: -10px -8px; text-underline-offset: 3px; }
/* 휴대폰: 뒤 절반(" · 서버로 보내지 않음")을 숨겨 한 줄로 */
@media (max-width: 599px) { .privacy .pc-only { display: none; } }

/* 옛 카드: 비움(상자·그림자 없음). 남은 참조를 위해 간격만 남긴다 */
.card { background: none; border: 0; box-shadow: none; padding: 0; margin: 0 0 32px; border-radius: 0; }

/* ===== 5. 단계 구역 ===== */
.step { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.step:first-child, .page-title + .step, .privacy + .step, [data-privacy] + .step, .step.first { margin-top: 0; padding-top: 0; border-top: 0; }
.step-title {
  display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px;
  font-size: 20px; font-weight: 700; line-height: 1.3; margin: 0 0 24px;
}
.step-title[data-no]::before { content: attr(data-no) ".\00a0"; }
.step-title[data-no-pc]::before { content: attr(data-no-pc) ".\00a0"; }
.step-title > * { margin-left: 8px; }
.step-title > :first-child { margin-left: auto; }        /* 상태 줄·보조 버튼은 오른쪽 */
.step-title .status { font-size: 16px; font-weight: 400; color: var(--muted); }
.step-title .btn { font-weight: 400; }
/* 제목 줄 안 보조 버튼 묶음: <span class="tools">[버튼][버튼]</span> → 항상 오른쪽 끝 */
.step-title > .tools { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.step-title > .tools > * { margin-left: 0; }
.step h3 { margin: 24px 0 8px; }
.step h3:first-child { margin-top: 0; }
@media (max-width: 959px) {
  .step { margin-top: 32px; }
  .step-title[data-no-m]::before { content: attr(data-no-m) ".\00a0"; }
}
@media (max-width: 599px) {
  h1 { font-size: 22px; }
  .step-title .status { flex: 1 1 100%; margin-left: 0; order: 9; }   /* 휴대폰: 상태 줄은 제목 아래 */
  /* 상태가 아래로 내려가면 그 뒤 버튼·seg 가 오른쪽 끝을 이어받는다(숨은 버튼 1개는 건너뜀) */
  .step-title > .status:first-child + *, .step-title > .status:first-child + .hidden + * { margin-left: auto; }
}

/* 2열(PC): 왼쪽 설정 │ 오른쪽 결과. 휴대폰은 한 기둥 격자(자식의 order 로 순서를 바꿀 수 있게 grid 유지) */
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; align-items: start; }
@media (min-width: 960px) {
  .layout-2 { grid-template-columns: minmax(0, var(--col-w)) minmax(0, 1fr); gap: 24px; }
}

/* 옛 번호 목록: 도움말 안에서만. 동그라미 없음 */
ol.steps, .steps { list-style: decimal; padding-left: 1.4em; margin: 8px 0 0; counter-reset: none; }
.steps li { position: static; padding: 0; margin: 0 0 8px; color: var(--text); font-size: 17px; }
.steps li::before { content: none; }

/* ===== 6. 파일 넣는 칸 ===== */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 144px; padding: 16px; text-align: center;
  border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface);
  color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s;
}
.drop strong { display: block; font-size: 20px; font-weight: 700; color: var(--text); margin: 0; }
.drop span, .drop .drop-sub, .drop small { display: block; font-size: 16px; color: var(--muted); }
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-soft); }
.drop:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.drop input[type=file] { display: none; }
/* 파일이 들어온 뒤: 한 줄로 접힘 "사진 3장 · 더 넣기 +" */
.drop.compact { flex-direction: row; gap: 8px; min-height: 52px; height: 52px; padding: 0 16px; }
.drop.compact strong { font-size: 17px; font-weight: 600; }
.drop.compact span, .drop.compact .drop-sub, .drop.compact small, .drop.compact p, .drop.compact br { display: none; }
@media (min-width: 960px) { .drop { min-height: 176px; } .drop.compact { min-height: 52px; } }
@media (max-width: 599px) { .drop { min-height: 128px; } .drop.compact { min-height: 52px; } }

/* ===== 7. 버튼 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 48px; padding: 0 16px;
  font: inherit; font-size: 17px; font-weight: 600; line-height: 1.2;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: none;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); min-height: 56px; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
@media (min-width: 960px) { .btn.primary { min-height: 48px; } }
.btn.small { min-height: 44px; padding: 0 12px; font-weight: 400; }
.btn.text { background: none; border-color: transparent; color: var(--primary); min-height: 44px; padding: 0 12px; }
.btn.text:hover { background: var(--primary-soft); }
.btn.icon-btn { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; }
.btn.danger { color: var(--danger); }
.btn.strong { font-weight: 600; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* 글자 버튼에는 아이콘 없음(옛 아이콘 span 숨김). 아이콘 전용 버튼만 보임 */
.btn svg, .btn .ic { display: none; }
.btn.icon-btn svg { display: block; width: 20px; height: 20px; }
.btn.icon-btn .ic { display: inline-flex; }
.btn.icon-btn .ic svg { display: block; width: 20px; height: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.stack > .btn { flex: 1 1 100%; }

/* ===== 8. 입력칸 ===== */
input[type=text], input[type=number], input[type=date], input[type=time], input[type=search], input[type=email], input[type=tel], input[type=url], select, textarea {
  width: 100%; min-height: 48px; font: inherit; font-size: 17px; line-height: 1.3; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; margin: 0;
}
textarea { min-height: 96px; padding: 12px; line-height: 1.55; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
input[type=date], input[type=number], input[type=time] { font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; height: 44px; margin: 0; accent-color: var(--primary); background: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }
.range-ends { display: flex; justify-content: space-between; font-size: 16px; color: var(--muted); }
/* 슬라이더 + 오른쪽 값 한 줄: <div class="range-row"><input type="range"><span class="val">30</span></div> (옛 <b> 도 같은 모양) */
.range-row { display: flex; align-items: center; gap: 8px; }
.range-row input[type=range] { flex: 1 1 auto; min-width: 0; }
.range-row .val, .range-row b {
  flex: none; min-width: 2.5ch; text-align: right;
  font-size: 17px; font-weight: 400; color: var(--text); font-variant-numeric: tabular-nums;
}
label.field { display: block; margin: 0 0 16px; }
label.field > span, .field > .lbl, .lbl { display: block; font-size: 16px; color: var(--muted); margin: 0 0 8px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
/* 서식 2단: 왼쪽 라벨 112px │ 오른쪽 칸, 줄마다 괘선 */
.form-table { display: block; }
.form-table > .field, .form-table > label.field, .form-table > .frow {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; column-gap: 16px;
  padding: 12px 0; margin: 0; border-bottom: 1px solid var(--line);
}
.form-table > :last-child { border-bottom: 0; }
.form-table > .field > span:first-child, .form-table > .frow > span:first-child, .form-table > .field > .lbl {
  margin: 0; font-size: 16px; color: var(--muted); text-align: left;
}
.form-table .seg, .form-table .check { margin: 0; }
.form-table .field-note { grid-column: 2; font-size: 16px; color: var(--muted); margin: 4px 0 0; }
/* 오른쪽 칸이 두 줄 이상(칸 2개·슬라이더+양끝 설명 등)인 줄: <div class="frow top"> → 라벨을 첫 부품 높이(44~48)의 가운데에 맞춤 */
.form-table > .top { align-items: start; }
.form-table > .top > :first-child { padding-top: 11px; }
@media (max-width: 599px) {
  .form-table > .field, .form-table > label.field, .form-table > .frow { grid-template-columns: 1fr; row-gap: 8px; }
  .form-table .field-note { grid-column: 1; }
  .form-table > .top > :first-child { padding-top: 0; }
}

/* ===== 9. 선택 묶음(seg) ===== */
.seg {
  display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface); padding: 0; gap: 0; flex-wrap: nowrap; width: 100%;
}
.seg.full { width: 100%; }
.seg button, .seg .chip {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 8px;
  font: inherit; font-size: 17px; font-weight: 400; color: var(--text); background: var(--surface);
  border: 0; border-right: 1px solid var(--line-strong); border-radius: 0; cursor: pointer; white-space: nowrap; box-shadow: none;
}
.seg button:last-child, .seg .chip:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); }
.seg button.on, .seg .chip.on { background: var(--primary); color: var(--primary-ink); font-weight: 600; }
.seg button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
/* 칸이 넘치면 2열 격자(2줄로 꺾인 seg 금지) */
.seg.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
.seg.grid2 button { border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.seg.grid2 button:nth-child(2n) { border-right: 0; }
.seg.grid2 button:nth-last-child(-n+2) { border-bottom: 0; }

/* ===== 10. 체크 ===== */
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; font-size: 17px; cursor: pointer; border: 0; background: none; padding: 0; }
.check input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--primary); }
/* 전체 폭 한 줄 체크: 선 없음. 구역 제목 바로 아래 첫 줄로 시작(제목이 선 사이에 갇히지 않게).
 * 아래 선은 뒤따르는 서식 2단이 보일 때만 그 위 선으로 생기고, 꺼져 있으면 다음 구역 윗선이 경계가 된다(겹선 없음) */
.check.row { width: 100%; min-height: 56px; border-top: 0; border-bottom: 0; padding: 0; }
.check.row + .form-table { border-top: 1px solid var(--line); }
.check.big { padding: 0; border: 0; background: none; }

/* ===== 11. 결과 미리보기 ===== */
.preview-list { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.preview-list.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.preview-item { width: 100%; max-width: 560px; }
.preview-list.grid .preview-item { max-width: none; }
.preview-item .cap { display: block; margin: 0 0 8px; font-size: 16px; color: var(--muted); text-align: left; font-variant-numeric: tabular-nums; }
.preview-item canvas, .preview-item img {
  display: block; width: 100%; height: auto; background: #fff;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.preview-item.sel canvas, .preview-item.sel img { border: 2px solid var(--primary); }
.preview-item .actions { margin-top: 8px; justify-content: flex-start; }
.empty { text-align: center; color: var(--muted); font-size: 16px; padding: 32px 16px; border: 0; background: none; }
@media (max-width: 959px) { .preview-item { max-width: none; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .preview-item canvas, :root:not([data-theme="light"]) .preview-item img { filter: brightness(.92); }
}
:root[data-theme="dark"] .preview-item canvas, :root[data-theme="dark"] .preview-item img { filter: brightness(.92); }

/* ===== 12. 저장/보내기 줄 (화면 아래 고정, 주 버튼 1개) ===== */
.savebar, .actions.sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; border-radius: 0;
  display: flex; flex-wrap: nowrap; align-items: center; gap: 8px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--shadow-float);
}
.savebar > .inner, .actions.sticky > .inner { display: contents; }
.savebar .btn, .actions.sticky .btn { min-height: 56px; }
.savebar .btn.primary { flex: 1 1 auto; min-width: 0; }
.savebar .btn:not(.primary), .actions.sticky .btn:not(.primary) { flex: 0 0 auto; }
.savebar .more-btn, .actions.sticky .more-btn {
  background: none; border-color: transparent; color: var(--primary); min-height: 44px; padding: 0 8px; font-weight: 600;
}
.savebar .more, .actions.sticky .more {
  position: absolute; left: 0; right: 0; bottom: 100%; display: none; flex-direction: column; gap: 8px;
  padding: 16px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--shadow-pop);
}
.savebar.open .more, .actions.sticky.open .more { display: flex; }
.savebar .more .btn, .actions.sticky .more .btn { width: 100%; min-height: 52px; flex: 0 0 auto; }
@media (min-width: 960px) {
  .savebar, .actions.sticky { padding-left: max(24px, calc((100% - var(--page-w)) / 2 + 24px)); padding-right: max(24px, calc((100% - var(--page-w)) / 2 + 24px)); }
  .savebar .btn, .actions.sticky .btn { min-height: 48px; }
  .savebar .btn.primary { flex: 0 0 auto; }
  .savebar .more-btn, .actions.sticky .more-btn { display: none; }
  .savebar .more, .actions.sticky .more, .savebar.open .more, .actions.sticky.open .more { display: contents; }
  .savebar .more .btn, .actions.sticky .more .btn { width: auto; min-height: 48px; }
}
/* 휴대폰(<600, 360~390 폭): [주][보조 1][더 보기 ▾] 세 덩어리가 항상 한 줄.
 *  - 여백·간격을 줄이고, 주 버튼은 저장 줄의 38% 이상(항상 가장 넓게), 보조는 34% 이하.
 *  - 그래도 넘치면 글자 끝을 말줄임(…)으로 자름 — 상자 밖으로 글자가 나가지 않음.
 *  - 보조 버튼 글자는 휴대폰에서 5자 안팎이 알맞다(360 폭에서 보조 칸 ≈ 110px). */
@media (max-width: 599px) {
  .savebar, .actions.sticky { gap: 6px; }
  .savebar .btn, .actions.sticky .btn { padding: 0 8px; font-size: 16px; overflow: hidden; }
  .savebar .btn.primary, .actions.sticky .btn.primary { flex: 1 1 auto; min-width: 38%; font-size: 17px; }
  .savebar > .btn:not(.primary):not(.more-btn),
  .savebar > .inner > .btn:not(.primary):not(.more-btn),
  .actions.sticky > .btn:not(.primary):not(.more-btn) { flex: 0 1 auto; min-width: 0; max-width: 34%; }
  .savebar .more-btn, .actions.sticky .more-btn { flex: none; padding: 0 4px; }
  .savebar .more .btn, .actions.sticky .more .btn { max-width: none; padding: 0 16px; font-size: 17px; }
  /* 말줄임: 글자를 <span>에 넣은 버튼은 span 이, 글자만 있는 버튼은 버튼 자신이 자른다 */
  .savebar .btn > span, .actions.sticky .btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .savebar .btn, .actions.sticky .btn { text-overflow: ellipsis; }
}
/* 꼬리말 한 줄. 위 선은 안쪽 p 에 그려 본문 기둥(좌우 여백 안쪽)과 끝을 맞춘다.
 * 저장 줄이 꼬리말을 가리지 않게: 꼬리말 아래에 저장 줄 높이만큼 여백 */
.site-footer {
  max-width: var(--page-w); margin: 0 auto; color: var(--muted); font-size: 16px;
  padding: 0 16px calc(24px + var(--savebar-h) + env(safe-area-inset-bottom));
  border-top: 0;
}
.site-footer p { margin: 0; padding-top: 24px; border-top: 1px solid var(--line); }
@media (min-width: 960px) { .site-footer { padding-left: 24px; padding-right: 24px; } }

/* ===== 13. 알림(PC 머리말 아래 · 휴대폰 저장 줄 위)·사건 메모·다음 할 일 ===== */
.toast {
  position: fixed; top: calc(var(--header-h) + 8px); left: 50%; z-index: 100;
  transform: translateX(-50%) translateY(-8px); opacity: 0; pointer-events: none;
  /* 폭 = 글자 폭(left:50% 때문에 화면 절반에서 꺾이던 문제 방지), 최대 화면 폭 − 32 */
  width: max-content; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: var(--radius);
  background: var(--text); color: var(--bg); font-size: 16px; line-height: 1.5; text-align: center;
  box-shadow: var(--shadow-pop); transition: opacity .2s, transform .2s;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* 휴대폰·태블릿(<960): 머리말 아래에 띄우면 제목(h1)을 덮으므로 저장 줄 바로 위에 띄운다.
 * 저장 줄 위라서 버튼은 덮지 않는다(4-11 의도 유지). 저장 줄 없는 페이지는 --savebar-h 가 0 이라 화면 아래 12px.
 * 저장 줄 위에 다른 것이 떠 있으면 그 위로 올라간다(common.js 가 body 에 높이를 적음, 없으면 0):
 *   --tip-h  "다음 할 일"(.next-tip) 줄 높이 / --more-h  "더 보기 ▾"로 펼친 버튼 칸 높이 → 둘 중 큰 값만큼 */
@media (max-width: 959px) {
  .toast {
    top: auto; bottom: calc(var(--savebar-h) + max(var(--tip-h, 0px), var(--more-h, 0px)) + 12px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(8px);
  }
}
.note {
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius);
  padding: 12px 16px; margin: 0 0 16px; font-size: 17px; color: var(--text);
}
.next-tip {
  position: fixed; left: 0; right: 0; bottom: calc(var(--savebar-h) + env(safe-area-inset-bottom)); z-index: 29;
  padding: 12px 16px; background: var(--primary-soft); color: var(--text); font-size: 17px; text-align: center;
  border-top: 1px solid var(--line); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.next-tip.show { opacity: 1; transform: none; }

/* ===== 14. 접힘 구역(도움말·자세한 설정) ===== */
details.help, details.opts { margin: 24px 0 0; }
details.help > summary, details.opts > summary {
  display: flex; align-items: center; min-height: 44px; cursor: pointer; list-style: none; user-select: none;
  font-size: 17px; font-weight: 600; color: var(--primary); padding: 0;
}
details.help > summary::-webkit-details-marker, details.opts > summary::-webkit-details-marker { display: none; }
details.help > summary:focus-visible, details.opts > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
details.help > *:not(summary) { margin-top: 8px; }
details.help p { margin: 0 0 8px; }
details.opts > *:not(summary) { margin-top: 8px; }
/* 페이지 맨 아래 도움말: 앞 구역과 1px 선 하나로 나눈다(단계 구역 .step 과 같은 간격 — PC 40 / 휴대폰 32) */
main > details.help { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
@media (max-width: 959px) { main > details.help { margin-top: 32px; } }

/* ===== 15. 홈·공유받기 목록(행형) ===== */
.tool-card {
  display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 16px;
  min-height: 72px; padding: 12px 0; margin: 0; border-bottom: 1px solid var(--line);
  color: var(--text); text-decoration: none; background: none; box-shadow: none; border-radius: 0;
}
.tool-card:hover { background: var(--surface-2); }
.tool-card:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.tool-card .icon { width: 24px; height: 24px; background: none; border-radius: 0; color: var(--muted); display: block; }
.tool-card .icon svg { width: 24px; height: 24px; display: block; }
.tool-card h2 { font-size: 20px; margin: 0; line-height: 1.3; }
.tool-card p { margin: 0; font-size: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-card::after { content: "\203A"; font-size: 20px; color: var(--muted); }
.tool-card .tag { display: none; }
.tool-list > .tool-card:last-child { border-bottom: 0; }
/* 이어서 하기·다른 사용법 행(홈 .flow-list, 안내 글 .doc-links 공통): 도구 행과 같은 모양 — 줄마다 아래 1px 선, 마지막 줄은 선 없음.
 * 글자는 <span> 하나에 넣는다(a 가 flex 라서 글자 사이 span 이 따로 떨어지지 않게). 꺾이면 안 되는 낱말은 .nw */
.flow {
  display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 8px 0; margin: 0;
  font-size: 17px; color: var(--text); text-decoration: none; background: none;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
}
.flow:last-child { border-bottom: 0; }
.flow:hover { background: var(--surface-2); }
.flow::after { content: "\203A"; flex: none; margin-left: auto; font-size: 20px; color: var(--muted); }
.flow .nw { white-space: nowrap; }
@media (max-width: 599px) {
  .tool-card p { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
/* 좁은 휴대폰(360 등): 글자 16·간격 8 로 "이어서 하기" 세 줄이 각각 한 줄에 들어가게 */
@media (max-width: 379px) { .flow { font-size: 16px; gap: 8px; } }

/* ===== 16. 편집 캔버스(모서리 조정·가리기 등) ===== */
.stage { position: relative; width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage canvas { display: block; width: 100%; height: auto; border-radius: 0; }

/* ===== 17. 안내 글(privacy.html·guide-*.html): <main class="doc"> =====
 * 구조: .page-title(h1 + p.lead [+ data-privacy]) → (사용법만) p.cta 도구로 가는 주 버튼 1개 → section.step + h2.step-title …
 * 카드 없음. 구역 사이는 .step 의 1px 선. 본문 글은 17px, 목록은 들여쓰기 1.4em. */
main.doc p { margin: 0 0 12px; }
main.doc .page-title p { margin: 0; }
main.doc ol, main.doc ul { margin: 0 0 12px; padding-left: 1.4em; }
main.doc li { margin: 0 0 8px; }
main.doc .step > :last-child { margin-bottom: 0; }
.cta { margin: 0; }
@media (max-width: 599px) { .cta .btn { width: 100%; } }
.doc-links { display: flex; flex-direction: column; }   /* 행 선은 .flow 기본(15절) */

/* ===== 18. 인쇄 ===== */
@media print {
  .site-header, .site-footer, .savebar, .actions.sticky, .toast, .next-tip, .no-print { display: none !important; }
  body { background: #fff; }
  main { padding-bottom: 0; }
}
