/* 이미지 형식 변환기 공통 스타일 */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #6b7385;
  --line: #e3e6ec;
  --accent: #f38020;
  --accent-ink: #ffffff;
  --accent-soft: #fff3e8;
  --ok: #1a8d5f;
  --err: #c43c3c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161b; --card: #1d2027; --text: #e8eaef; --muted: #9aa2b2;
    --line: #2e323c; --accent-soft: #2a2118; --ok: #3fbf8a; --err: #e46d6d;
  }
}
:root[data-theme="dark"] {
  --bg: #14161b; --card: #1d2027; --text: #e8eaef; --muted: #9aa2b2;
  --line: #2e323c; --accent-soft: #2a2118; --ok: #3fbf8a; --err: #e46d6d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  line-height: 1.6;
}
main { max-width: 960px; margin: 0 auto; padding: 32px 16px 72px; }
a { color: var(--accent); }

.crumb { font-size: .85rem; margin: 0 0 8px; }
.crumb a { color: var(--muted); text-decoration: none; }
h1 {
  font-size: 2rem; margin: 0 0 6px; line-height: 1.3; letter-spacing: -0.02em;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
}
/* 모든 페이지 제목 옆 "100% 무료" 배지.
   CSS로 붙여서, 형식을 고를 때 제목 글자가 바뀌어도 배지는 그대로 남아요 */
main > h1::after {
  content: "100% 무료";
  font-size: .9rem; font-weight: 800; letter-spacing: 0; line-height: 1;
  padding: 7px 12px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent);
}
/* 사이트 설명 (모든 페이지 공통) */
.lead { color: var(--muted); margin: 0 0 24px; font-size: 1.08rem; }
.lead b {
  color: var(--ok); font-weight: 800; padding: 0 2px;
  /* 형광펜으로 그은 듯한 밑줄 강조 */
  background: linear-gradient(transparent 58%, color-mix(in srgb, var(--ok) 22%, transparent) 58%);
}

/* ① 처음 화면: 드롭 영역 */
.cv-drop {
  display: block; background: var(--card); border: 2px dashed var(--line); border-radius: 14px;
  padding: 48px 16px; text-align: center; cursor: pointer; transition: background .15s, border-color .15s;
}
.cv-drop:hover, body.dragging .cv-drop { border-color: var(--accent); background: var(--accent-soft); }
.cv-drop svg { color: var(--accent); }
.cv-drop .big { font-size: 1.15rem; font-weight: 700; margin: 10px 0 4px; }
.cv-drop .small { color: var(--muted); font-size: .85rem; margin: 0; }

/* 화면 어디에 놓아도 되도록 드래그 중 전체 화면 안내 */
.cv-overlay {
  position: fixed; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 18%, transparent); border: 4px dashed var(--accent);
  font-size: 1.3rem; font-weight: 700; color: var(--text); pointer-events: none;
}
body.dragging .cv-overlay { display: flex; }

/* ② 파일 목록 */
.cv-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.cv-link {
  background: none; border: none; color: var(--accent); font: inherit; font-size: .9rem; font-weight: 600;
  cursor: pointer; padding: 4px 6px;
}
.cv-link:disabled { color: var(--muted); cursor: default; }
.cv-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.cv-item {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.cv-thumb {
  width: 52px; height: 52px; border-radius: 6px; object-fit: cover;
  background: repeating-conic-gradient(#d9dce3 0 25%, #ffffff 0 50%) 0 0 / 12px 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; color: #4a5160;
}
.cv-info { min-width: 0; }
.cv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-meta { font-size: .82rem; color: var(--muted); }
.cv-badge {
  display: inline-block; font-size: .7rem; font-weight: 700; padding: 0 6px; border-radius: 4px;
  background: var(--line); color: var(--text); margin-right: 6px;
}
.cv-meta .down { color: var(--ok); }
.cv-meta .up { color: var(--err); }
.cv-meta .err { color: var(--err); }
.cv-meta .busy { color: var(--accent); }
.cv-x { background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 4px 8px; }

/* ③ 형식 선택·변환 패널 */
.cv-panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.cv-q { font-weight: 700; margin: 0 0 10px; }
.cv-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cv-chip {
  border: 1.5px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px;
  padding: 8px 18px; font: inherit; font-weight: 700; cursor: pointer;
}
.cv-chip small { font-weight: 500; font-size: .72rem; margin-left: 6px; color: var(--accent); }
.cv-chip[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cv-chip[aria-checked="true"] small { color: var(--accent-ink); opacity: .85; }
.cv-chip:disabled { opacity: .6; cursor: default; }
.cv-hint { color: var(--muted); font-size: .86rem; margin: 10px 0 0; }

.cv-opts { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.cv-opts summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.cv-opt { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: .9rem; color: var(--muted); flex-wrap: wrap; }
.cv-opt input[type=range] { flex: 0 1 160px; accent-color: var(--accent); }
.cv-opt input[type=color] { width: 36px; height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 0; background: none; }
.cv-opt input[type=number] {
  width: 96px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit;
}

.cv-actions { margin-top: 18px; display: flex; gap: 8px; }
.cv-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px;
  padding: 8px 14px; font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer;
  text-decoration: none; white-space: nowrap; text-align: center;
}
.cv-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cv-actions .cv-btn { flex: 1; padding: 14px; font-size: 1rem; }
.cv-btn:disabled { opacity: .6; cursor: default; }

/* ④ 변환 결과: 초록 테두리 상자 + 파일마다 다운로드 버튼 */
.cv-results {
  margin-top: 20px; background: var(--card); border: 2px solid var(--ok); border-radius: 14px;
  padding: 18px 20px; animation: cv-pop .35s ease;
}
.cv-results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cv-results-title { margin: 0; font-weight: 800; font-size: 1.1rem; color: var(--ok); }
.cv-results-head .cv-btn { padding: 10px 18px; font-size: .95rem; }
.cv-results .cv-list { margin: 0; }
.cv-results .cv-item { background: var(--bg); }
.cv-get { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; font-size: .95rem; }
.cv-get:hover { filter: brightness(1.06); }
.cv-item.is-error .cv-thumb { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); font-size: 1.2rem; }
@keyframes cv-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.cv-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 20;
  background: rgba(20, 22, 27, .88); color: #fff; padding: 10px 18px; border-radius: 20px;
  font-size: .88rem; opacity: 0; transition: opacity .25s; pointer-events: none; max-width: calc(100% - 32px);
}
.cv-toast.show { opacity: 1; }

/* 설명 글: 페이지마다 내용이 달라도 같은 모양이 되도록 태그 구조에 맞춰 꾸며요 */
article { margin-top: 64px; font-size: 1rem; }
article h2 {
  font-size: 1.3rem; margin: 48px 0 16px; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 10px;
}
article h2::before { content: ""; width: 5px; height: 1.1em; border-radius: 3px; background: var(--accent); }
article h2:first-child { margin-top: 0; }
article p, article li { color: var(--text); line-height: 1.75; }
article p { margin: 0 0 12px; }
article b { color: var(--text); }
article a { font-weight: 600; }

/* 사용 방법 (번호 목록) → 번호가 크게 보이는 단계 카드 */
article ol {
  list-style: none; counter-reset: step; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px;
}
article ol li {
  counter-increment: step; position: relative;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 56px 20px 20px;
}
article ol li::before {
  content: counter(step); position: absolute; top: 18px; left: 20px;
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem;
}

/* 이럴 때 좋아요 / 알아 둘 점 (점 목록) → 체크 표시 카드 */
article ul {
  list-style: none; margin: 0; padding: 4px 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
article ul li { position: relative; padding: 12px 0 12px 30px; border-bottom: 1px solid var(--line); }
article ul li:last-child { border-bottom: none; }
article ul li::before {
  content: "✓"; position: absolute; left: 0; top: 12px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: .75rem; font-weight: 800; display: flex; align-items: center; justify-content: center;
}

/* 형식 비교표 */
article table {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: .95rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
article th, article td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--line); }
article tr:last-child td { border-bottom: none; }
article th { background: var(--accent-soft); color: var(--text); font-size: .85rem; }
article td:first-child { font-weight: 800; color: var(--accent); white-space: nowrap; }
article tr:hover td { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }

/* 자주 묻는 질문 (굵은 질문 + 줄바꿈 + 답) → Q 카드 */
article p:has(> b + br) {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px 18px 60px; position: relative; margin-bottom: 10px;
}
article p:has(> b + br) > b:first-of-type { font-size: 1.02rem; }
article p:has(> b + br)::before {
  content: "Q"; position: absolute; left: 20px; top: 18px;
  width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem;
}

.more { margin-top: 40px; }
.more h2 { font-size: 1rem; margin: 0 0 10px; }
.more ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.more a {
  display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 600;
}
.more a:hover { border-color: var(--accent); }
.more a[aria-current="page"] { border-color: var(--accent); color: var(--accent); }

@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  main > h1::after { font-size: .78rem; padding: 6px 10px; }
  article { margin-top: 48px; }
  article h2 { font-size: 1.15rem; margin-top: 36px; }
  article th, article td { padding: 10px 12px; }
  article p:has(> b + br) { padding: 16px 16px 16px 52px; }
  article p:has(> b + br)::before { left: 16px; top: 16px; }
  .cv-drop { padding: 40px 16px; }
  .cv-item { grid-template-columns: 44px 1fr auto; gap: 10px; }
  .cv-thumb { width: 44px; height: 44px; }
  .cv-panel { padding: 16px; }
  .cv-results { padding: 14px; }
  .cv-get { padding: 9px 12px; font-size: .88rem; }
  .cv-results-head .cv-btn { width: 100%; }
}
