:root {
  --bg: #f8fafc; --panel: #fff; --border: #e2e8f0; --text: #0f172a; --muted: #64748b;
  --accent: #2554e0; --accent-hover: #1d43b8; --accent-soft: #eef4ff; --accent-strong: #1d43b8; --danger: #dc2626;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.6;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 헤더 */
.site-header {
  background: var(--panel); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 50;
}
.site-header .inner { width: 100%; margin: 0; padding: 12px 24px; display: flex; align-items: center; gap: 16px; flex-wrap: nowrap; }
.site-header .logo { font-weight: 700; font-size: 18px; color: var(--accent); white-space: nowrap; flex: none; }
.site-header nav { display: flex; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
.site-header nav::-webkit-scrollbar { height: 4px; }
.site-header nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.site-header nav a { font-size: 13.5px; font-weight: 500; color: var(--muted); padding: 6px 10px; border-radius: 8px; white-space: nowrap; flex: none; transition: background .12s, color .12s; }
.site-header nav a:hover { background: #f1f5f9; text-decoration: none; color: var(--text); }
.site-header nav a.active { color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }
.site-header .header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.site-header .privacy-chip { font-size: 11.5px; color: #047857; background: #ecfdf5; border: 1px solid #a7f3d0; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.lang-switch-link { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; transition: border-color .12s, color .12s; }
.lang-switch-link:hover { border-color: #93c5fd; color: var(--accent); text-decoration: none; }

/* 공유 버튼 */
.share-row { display: flex; justify-content: center; margin: 48px 0; }
.share-btn { font: inherit; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--muted); padding: 7px 14px; font-size: 14px; font-weight: 500; cursor: pointer; transition: border-color .12s, color .12s; }
.share-btn:hover { border-color: #93c5fd; color: var(--accent); }

/* 도구 페이지 레이아웃 */
main.tool { max-width: 896px; margin: 0 auto; padding: 32px 20px 28px; }
.tool h1 { font-size: 28px; font-weight: 700; margin: 0; text-align: left; }
.tool .sub { text-align: left; color: #475569; margin: 8px 0 0; font-size: 18px; }
.tool-card { margin-top: 24px; padding: 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); }

/* 랜딩(허브) 히어로 */
.hero { max-width: 896px; margin: 0 auto; padding: 56px 20px 8px; text-align: center; }
.hero h1 { font-size: 36px; font-weight: 700; letter-spacing: -.5px; color: var(--text); margin: 0 0 12px; }
.hero .sub { font-size: 18px; line-height: 1.55; color: #475569; margin: 0; }

/* 버튼 */
.btn {
  font: inherit; font-size: 14px; border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 9px 16px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: #f0f1f3; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.lg { font-size: 14px; font-weight: 600; padding: 10px 20px; }

/* 드롭존 */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 2px dashed #cbd5e1; border-radius: 16px; padding: 48px 24px; background: var(--bg);
  cursor: pointer; transition: border-color .12s, background .12s; text-align: center;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { color: #3b6ef6; }
.drop h2 { margin: 8px 0 2px; font-size: 16px; font-weight: 500; color: #334155; }
.drop p { margin: 0; color: var(--muted); font-size: 14px; }
.privacy-hint { margin: 10px 0 0; color: #94a3b8; font-size: 12px; }

/* 파일 리스트 */
.filelist { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 8px; }
.filelist li {
  display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.filelist li .name { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist li .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.filelist li button { border: 1px solid var(--border); background: var(--panel); border-radius: 6px; width: 30px; height: 30px; cursor: pointer; font-size: 14px; padding: 0; }
.filelist li button:hover:not(:disabled) { background: #f0f1f3; }
.filelist li button:disabled { opacity: .3; cursor: not-allowed; }
.filelist li .del:hover { color: var(--danger); border-color: var(--danger); }

.actions { display: flex; justify-content: center; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.opts { display: flex; justify-content: center; gap: 16px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.opts label { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.opts input[type=text], .opts input[type=number], .opts select { font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; }
.opts input[type=number] { width: 70px; }

/* 결과/썸네일 */
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 20px; }
.result-grid .cell { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: center; }
.result-grid .cell img, .result-grid .cell canvas { width: 100%; border: 1px solid var(--border); border-radius: 4px; }
.result-grid .cell .cap { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* 페이지 썸네일 그리드 (삭제·회전 등 시각 편집) */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; margin-top: 20px; }
.pcard { position: relative; background: var(--panel); border: 2px solid var(--border); border-radius: 10px; padding: 8px; text-align: center; }
.pcard canvas { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 3px; transition: transform .18s; }
.pcard .pnum { font-size: 12px; color: var(--muted); margin-top: 6px; }
.pcard.sel-del { border-color: var(--danger); }
.pcard.sel-del canvas { opacity: .4; }
.pcard.sel-del::after { content: "삭제"; position: absolute; left: 8px; right: 8px; top: 8px; bottom: 26px; background: rgba(220,38,38,.30); border-radius: 3px; display: flex; align-items: center; justify-content: center; color: #b91c1c; font-weight: 800; font-size: 18px; pointer-events: none; }
.pcard.clickable { cursor: pointer; }
.pcard.clickable:hover { border-color: #93c5fd; }
.pcard .rot-btn { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border); background: rgba(255,255,255,.96); cursor: pointer; font-size: 15px; padding: 0; box-shadow: var(--shadow); }
.pcard .rot-btn:hover { background: #fff; border-color: var(--accent); }

/* 콘텐츠(SEO) 섹션 */
.content { max-width: 896px; margin: 0 auto; padding: 10px 20px 40px; }
.content > *:first-child { margin-top: 0; }
.content a { color: var(--accent); text-decoration: none; }
.content a:hover { text-decoration: underline; }
/* 섹션 제목 — 파스텔 아이콘 배지 (이미지툴 톤 통일) */
.content h2 { font-size: 20px; font-weight: 700; color: var(--text); margin: 32px 0 14px; padding: 0; border: 0; display: flex; align-items: center; gap: 12px; }
.content h2[class^="s-"]::before, .content .guide-head::before {
  flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft);
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1;
}
.content h2.s-how::before { content: "📋"; }
.content h2.s-faq::before { content: "💬"; }
.content h2.s-more::before { content: "🧩"; }
.content h2.s-about::before { content: "🧰"; }
.content .guide-usecase .guide-head::before { content: "🎯"; }
.content .guide-safe .guide-head::before { content: "🛡️"; }
/* 가이드 아티클 (도구 아래 콘텐츠 카드) */
.content .guide { margin: 36px 0 10px; }
.content .guide-head { font-size: 20px; font-weight: 700; color: var(--text); margin: 0 0 10px; padding: 0; border: 0; display: flex; align-items: center; gap: 12px; }
.content .guide-head::before { content: "💡"; }
.content .guide-intro { font-size: 15px; color: var(--muted); line-height: 1.75; margin: 0 0 18px; }
.content .guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.content .tip { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px; box-shadow: none; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.content .tip:hover { border-color: #93c5fd; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.content .tip h3 { display: flex; align-items: center; gap: 10px; font-size: 15.5px; font-weight: 600; color: var(--text); margin: 0 0 8px; padding: 0; border: 0; }
.content .tip h3 .ico { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); display: inline-flex; align-items: center; justify-content: center; font-size: 17px; line-height: 1; }
.content .tip p { margin: 0; font-size: 14.5px; line-height: 1.65; color: var(--muted); }
.content p, .content li { font-size: 15px; color: #475569; }
.content .lead { font-size: 16px; line-height: 1.75; color: #334155; margin: 4px 0 8px; }
/* 정보 카드 (about/why 등 단일 카드형 섹션) */
.content .guide-card { margin: 32px 0; border-radius: 16px; border: 1px solid var(--border); background: var(--panel); padding: 24px; transition: border-color .15s, box-shadow .15s; }
.content .guide-card:hover { border-color: #bcd3ff; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.content .guide-card > h2 { margin: 0; padding: 0; border: 0; }
.content .guide-card p { margin: 14px 0 0; }
.content .guide-card ul { list-style: disc; margin: 14px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 16px; line-height: 1.6; color: #334155; }
.content .guide-card ul strong { color: var(--text); }
.content .guide-card ul::marker, .content .guide-card li::marker { color: #93b4fb; }
.content .guide-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1; }
/* 방법(순서) — 흰 카드 */
.content ol { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px 24px 20px 46px; margin: 12px 0; }
.content ol li { margin: 4px 0; }
.content ul:not(.tool-grid):not(.filelist) { padding-left: 22px; }
/* FAQ — 항상 펼쳐진 카드 목록 */
.faq-list { margin: 16px 0 0; display: flex; flex-direction: column; gap: 16px; }
.faq-item { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.faq-item dt { margin: 0; font-size: 17px; font-weight: 600; color: var(--text); }
.faq-item dd { margin: 6px 0 0; font-size: 16px; line-height: 1.7; color: #334155; }

/* "왜 안심하고 쓸 수 있나요" — 불릿 리스트 카드 */
.why-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 17px; line-height: 1.8; color: #334155; }
.why-list strong { color: var(--text); }

/* 도구 그리드 (허브) */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 16px 0; }
.tool-grid a {
  display: block; background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px; text-decoration: none; color: var(--text); transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.tool-grid a:hover { border-color: #93c5fd; box-shadow: 0 4px 12px rgba(0,0,0,.06); transform: translateY(-2px); text-decoration: none; }
.tool-grid a .ico { font-size: 30px; }
.tool-grid a .t { font-weight: 600; font-size: 18px; margin: 12px 0 6px; }
.tool-grid a .d { font-size: 15px; line-height: 1.5; color: var(--muted); }

/* 푸터 */
.site-footer { text-align: center; color: var(--muted); font-size: 14px; padding: 24px; border-top: 1px solid var(--border); line-height: 1.7; background: var(--panel); }
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: 4px; }
.site-footer p.feedback-row { margin-top: 14px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

.toast { position: fixed; top: 24px; right: 24px; max-width: min(340px, calc(100vw - 48px)); transform: translateY(-12px); background: #1f2328; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 400; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-accent { background: var(--accent); }
.toast.toast-danger { background: var(--danger); }

/* 의견 남기기 */
.feedback-btn { font: inherit; display: inline-flex; align-items: center; gap: 6px; border: none; border-radius: 999px; background: var(--accent); color: #fff; padding: 9px 20px; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(37,84,224,.35); transition: background .12s, transform .12s; }
.feedback-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.feedback-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 300; padding: 20px; }
.feedback-overlay[hidden] { display: none; }
.feedback-dialog { background: var(--panel); border-radius: 16px; padding: 24px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.feedback-dialog h3 { margin: 0 0 14px; font-size: 17px; }
.feedback-dialog textarea { width: 100%; min-height: 110px; resize: vertical; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; color: var(--text); background: var(--bg); }
.feedback-dialog textarea:focus { outline: none; border-color: var(--accent); }
.feedback-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.ad-block { display: flex; justify-content: center; margin: 30px 0; min-height: 90px; align-items: center; }
.ad-block .ad-mo { display: none; }
@media (max-width: 768px) { .ad-block .ad-pc { display: none; } .ad-block .ad-mo { display: block; } }

/* 하단 앵커(스티키) 광고 */
.anchor-ad {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(0,0,0,.07); display: flex; justify-content: center; align-items: center;
  padding: 6px 0; min-height: 96px;
}
.anchor-ad .ad-mo { display: none; }
body.has-anchor { padding-bottom: 108px; }
/* 편집기(app-shell, 100vh 고정 레이아웃)는 body padding이 안 먹으므로 자체 높이를 줄여 공간 확보 (상단 site-header 70px도 함께 제외) */
body.has-anchor .app-shell { height: calc(100vh - 70px - 108px); }
@media (max-width: 768px) {
  .anchor-ad { min-height: 106px; }
  .anchor-ad .ad-pc { display: none; }
  .anchor-ad .ad-mo { display: block; }
  body.has-anchor { padding-bottom: 118px; }
  body.has-anchor .app-shell { height: calc(100vh - 70px - 118px); }
}

/* 단위 변환기 */
.conv-row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; justify-content: center; }
.conv-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 220px; min-width: 200px; }
.conv-field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.conv-field .row { display: flex; gap: 8px; }
.conv-field input { font: inherit; font-size: 18px; font-weight: 600; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; width: 100%; min-width: 0; color: var(--text); background: var(--panel); }
.conv-field input:focus { outline: none; border-color: var(--accent); }
.conv-field input[readonly] { background: var(--accent-soft); color: var(--accent-strong); }
.conv-field select { font: inherit; font-size: 14px; padding: 10px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); flex: none; max-width: 160px; }
.conv-swap { flex: none; width: 42px; height: 42px; border-radius: 50%; font-size: 18px; padding: 0; margin-bottom: 1px; justify-content: center; }
.conv-table-wrap { margin-top: 28px; overflow-x: auto; }
.conv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.conv-table th, .conv-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.conv-table th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.conv-table td.val { font-variant-numeric: tabular-nums; color: var(--text); }
