/*
 * edittool 스타일. 프레임워크 없이 직접 씁니다.
 * 휴대폰(390px)이 기본이고, 900px 이상에서 왼쪽 고정 메뉴가 나타납니다.
 */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #16191d;
  --muted: #5d6570;
  --line: #e2e5ea;
  --side-bg: #111418;
  --side-text: #c9ced6;
  --side-muted: #7c8591;
  --accent: #2f6df6;
  --accent-strong: #1d57d8;
  --accent-soft: #e8f0ff;
  --good: #11875a;
  --bad: #c2410c;
  --warn-bg: #fff6e5;
  --warn-line: #f2cf8b;
  --radius: 12px;
  --side-w: 240px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1215;
    --surface: #181c21;
    --text: #e9ecf0;
    --muted: #9aa3ae;
    --line: #2a3038;
    --side-bg: #0a0c0e;
    --accent: #5a8cff;
    --accent-strong: #7aa2ff;
    --accent-soft: #1b2640;
    --good: #3ecf8e;
    --bad: #fb923c;
    --warn-bg: #2b2311;
    --warn-line: #6b5520;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 8px 12px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- 레이아웃: 휴대폰 ---------- */
.app { min-height: 100vh; }
.main { padding: 16px 16px 48px; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 8px;
  background: var(--side-bg); color: #fff;
}
.brand { color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: -0.01em; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px; color: #fff; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); }

/* 체크박스는 화면에 안 보이지만, 포커스 표시를 햄버거 버튼에 옮겨 키보드로도 열 수 있게 합니다. */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle:focus-visible ~ .topbar .icon-btn { outline: 2px solid var(--accent); }

.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  width: min(80vw, var(--side-w));
  display: flex; flex-direction: column;
  padding: 16px 12px;
  background: var(--side-bg); color: var(--side-text);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
}
.nav-backdrop {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.nav-toggle:checked ~ .sidebar { transform: none; }
.nav-toggle:checked ~ .nav-backdrop { opacity: 1; pointer-events: auto; }

.brand-side { display: block; padding: 6px 12px 18px; }
.nav-caption { margin: 0 12px 6px; font-size: 12px; color: var(--side-muted); letter-spacing: 0.04em; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 8px 12px; border-radius: 10px;
  color: var(--side-text); text-decoration: none; font-size: 15px;
}
a.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.is-active { background: rgba(90, 140, 255, 0.18); color: #fff; font-weight: 600; }
.nav-item.is-disabled { color: var(--side-muted); cursor: default; }
.nav-icon { flex: none; }
.badge {
  margin-left: auto; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; background: rgba(255, 255, 255, 0.08); color: var(--side-muted);
}
.nav-foot { margin: auto 12px 0; padding-top: 16px; font-size: 12px; color: var(--side-muted); }

/* ---------- 레이아웃: PC ---------- */
@media (min-width: 900px) {
  .topbar, .nav-backdrop { display: none; }
  .sidebar { transform: none; width: var(--side-w); transition: none; }
  .main { margin-left: var(--side-w); padding: 40px 48px 64px; }
}

/* ---------- 공통 요소 ---------- */
.page { max-width: 720px; margin: 0 auto; }
.page-title { margin: 8px 0 6px; font-size: 26px; line-height: 1.3; letter-spacing: -0.02em; }
.page-lead { margin: 0 0 20px; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
@media (min-width: 600px) { .card { padding: 24px; } }

.notice { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.notice-warn { background: var(--warn-bg); border: 1px solid var(--warn-line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: 10px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-primary:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn:focus-visible, .nav-item:focus-visible, .preset input:focus-visible + .preset-body,
.check input:focus-visible, .dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 업로드 ---------- */
.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 168px; padding: 20px 16px;
  border: 2px dashed var(--line); border-radius: var(--radius);
  text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); }
/* 파일 입력은 숨기지만 display:none은 쓰지 않습니다. 그러면 일부 브라우저에서 label 클릭이 안 먹습니다. */
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone-icon { color: var(--accent); }
.dropzone-title { font-weight: 700; font-size: 17px; max-width: 100%; }
.dropzone-hint { color: var(--muted); font-size: 14px; }

.field { border: 0; margin: 20px 0 0; padding: 0; min-width: 0; }
.field-label { padding: 0; margin-bottom: 8px; font-weight: 700; }
.preset-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 600px) { .preset-list { grid-template-columns: repeat(3, 1fr); } }
.preset { position: relative; cursor: pointer; }
.preset input { position: absolute; opacity: 0; }
.preset-body {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 56px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 10px;
}
.preset input:checked + .preset-body { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.preset-name { font-weight: 600; }
.preset-desc { font-size: 13px; color: var(--muted); }

.check { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 12px 0; cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); }
.check-title { display: block; font-weight: 600; }
.check-desc { display: block; font-size: 14px; color: var(--muted); }

.form-actions { margin-top: 16px; }
/* 휴대폰에서는 버튼을 화면 아래에 붙여 둡니다. 옵션을 내려 보다가 버튼을 찾느라 다시 올라가지 않게. */
@media (max-width: 599px) {
  .form-actions {
    position: sticky; bottom: 0;
    margin: 16px -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

/* ---------- 진행 ---------- */
.progress-label { margin: 0 0 10px; font-weight: 600; }
.progress { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.3s ease; }
.progress-sub { margin: 8px 0 0; font-size: 14px; color: var(--muted); min-height: 1.5em; }

/* ---------- 결과 ---------- */
.result-saving { margin: 0; font-size: 22px; font-weight: 800; color: var(--good); }
.result-saving.is-bad { color: var(--bad); }
.result-note { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.compare {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  margin: 16px 0; padding: 12px; border-radius: 10px; background: var(--bg);
}
.compare-col { min-width: 0; }
.compare dt { font-size: 13px; color: var(--muted); }
.compare dd { margin: 0; }
.compare strong { display: block; font-size: 20px; }
.compare dd span { display: block; font-size: 13px; color: var(--muted); }
.compare-after strong { color: var(--good); }
.compare-arrow { color: var(--muted); font-size: 20px; }

.preview { margin-bottom: 16px; border-radius: 10px; overflow: hidden; background: #000; }
.preview video { display: block; width: 100%; max-height: 60vh; background: #000; }

.result-actions { display: grid; gap: 8px; margin-bottom: 16px; }

.snippet { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; }
.snippet summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.snippet-help { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.snippet-code {
  margin: 0 0 10px; padding: 12px; border-radius: 8px;
  background: var(--bg); font-size: 13px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.snippet .btn { margin-bottom: 14px; }

/* ---------- 모달 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0, 0, 0, 0.5);
}
.modal[hidden] { display: none; }
.modal-box {
  width: 100%; max-width: 380px; padding: 20px;
  border-radius: 14px; background: var(--surface); color: var(--text);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.modal-title { margin: 0 0 8px; font-size: 18px; }
.modal-body { margin: 0 0 18px; color: var(--muted); white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; }
.modal-actions .btn { min-width: 96px; }

/* ---------- 메뉴 추가 요소 ---------- */
.nav-caption-gap { margin-top: 18px; }
.nav-sub { list-style: none; margin: 12px 0 0; padding: 0 12px; display: grid; gap: 0; }
.nav-sub a {
  display: flex; align-items: center; min-height: 44px;
  color: var(--side-muted); font-size: 14px; text-decoration: none;
}
.nav-sub a:hover, .nav-sub a[aria-current="page"] { color: #fff; }

/* ---------- 하단 ---------- */
.site-foot {
  max-width: 720px; margin: 48px auto 0; padding-top: 20px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.site-foot nav { display: flex; flex-wrap: wrap; gap: 0 16px; }
.site-foot nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }
.site-foot p { margin: 4px 0 0; }

/* ---------- 도구 화면 추가 요소 ---------- */
.trust-note {
  display: flex; align-items: center; gap: 6px;
  margin: -8px 0 16px; font-size: 14px; color: var(--good);
}
.trust-note svg { flex: none; }
.file-meta { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.file-meta.is-bad, .range-length.is-bad { color: var(--bad); }

.range-box { margin-top: 16px; }
.source-preview { margin-bottom: 12px; }
.source-preview video { display: block; width: 100%; max-height: 50vh; border-radius: 10px; background: #000; }
.range-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.range-buttons .btn { padding: 8px; font-size: 14px; }
.range-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.time-field { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
/* 입력칸 글자 16px 이상: 더 작으면 아이폰이 입력할 때 화면을 확대합니다. */
.time-field input {
  width: 100%; min-height: 48px; padding: 8px 12px;
  font: inherit; font-size: 16px; font-weight: 400;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
}
.time-field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.range-sliders { display: grid; gap: 4px; margin-top: 10px; }
.range-sliders input { width: 100%; min-height: 32px; accent-color: var(--accent); }
.range-length { margin: 6px 0 0; font-size: 14px; font-weight: 600; }

.preview img { display: block; max-width: 100%; height: auto; margin: 0 auto; background: #fff; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- 설명 글 ---------- */
.content { margin-top: 32px; }
.content h2, .article h2 { font-size: 20px; line-height: 1.4; margin: 28px 0 10px; letter-spacing: -0.01em; }
.content h2:first-child { margin-top: 0; }
.steps { padding-left: 1.3em; margin: 0; }
.steps li { margin-bottom: 6px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; align-items: center; min-height: 48px; padding: 8px 0;
  font-weight: 600; cursor: pointer;
}
.faq p { margin: 0 0 14px; color: var(--muted); }
.link-list { padding-left: 1.2em; margin: 0; }
.link-list li { margin-bottom: 8px; }
.link-list a, .guide-list a { font-weight: 600; }

.tool-cards { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 12px; }
@media (min-width: 600px) { .tool-cards { grid-template-columns: repeat(3, 1fr); } }
.tool-card {
  display: flex; flex-direction: column; gap: 4px; height: 100%;
  padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
.tool-card:hover { border-color: var(--accent); }
.tool-card-icon { color: var(--accent); }
.tool-card-title { font-weight: 700; font-size: 17px; }
.tool-card-desc { font-size: 14px; color: var(--muted); }
.feature-list { padding-left: 1.2em; margin: 0; }
.feature-list li { margin-bottom: 8px; }
.guide-list { list-style: none; margin: 0; padding: 0; }
.guide-list li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.guide-list a { display: inline-block; padding: 4px 0; }
.guide-list p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }

.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); display: inline-block; padding: 10px 0; }
.article { line-height: 1.75; }
.article-meta { margin: 0 0 20px; font-size: 14px; color: var(--muted); }
.article ul, .article ol { padding-left: 1.3em; }
.article li { margin-bottom: 6px; }
.formula { padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-weight: 700; }
.article .snippet-code { margin: 8px 0 12px; }
.article-next { margin-top: 36px; padding-top: 12px; border-top: 1px solid var(--line); }
.article-next h2 { margin-top: 12px; }

/* 표: 좁은 화면에서는 카드로 바꾸고, 각 값 앞에 항목 이름(data-label)을 붙입니다. */
.table-wrap { margin: 12px 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.data-table th, .data-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { font-size: 14px; color: var(--muted); }
@media (max-width: 599px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { margin-bottom: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
  .data-table td { padding: 4px 0; border: 0; }
  .data-table td::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); }
}

.contact-card { margin-top: 12px; }
.contact-label { margin: 0; font-size: 13px; color: var(--muted); }
.contact-value { margin: 4px 0; font-size: 18px; font-weight: 700; }
.contact-help { margin: 0; font-size: 14px; color: var(--muted); }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
