/* ─────────────────────────────────────────────────────────────
   벡터 아뜰리에 — ink · champagne · ivory
   기존 실무툴(파랑·화이트)과 다른 결: 갤러리 같은 어두운 무대 위
   아이보리 카드, 골드 포인트, 세리프 디스플레이.
   ───────────────────────────────────────────────────────────── */
:root {
  --ink: #161311;
  --ink-2: #211d1a;
  --ivory: #f6f1e7;
  --ivory-2: #efe8da;
  --gold: #c9a96a;
  --gold-deep: #a8874a;
  --line: #e2d9c8;
  --mut: #8d8577;
  --good: #3f7d54;
  --warn: #b07f2e;
  --bad: #a4433b;
  --serif: 'Didot', 'Bodoni MT', 'Playfair Display', 'Noto Serif KR', 'Apple SD Gothic Neo', serif;
  --sans: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--ink); }
body {
  font-family: var(--sans); color: #2b2620;
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(201,169,106,.14), transparent 60%),
    var(--ink);
  min-height: 100vh;
}
main { max-width: 880px; margin: 0 auto; padding: 44px 22px 80px; }
.hidden { display: none !important; }

/* ── header ── */
.at-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 30px;
}
.at-brand { display: flex; align-items: center; gap: 16px; }
.at-mono {
  width: 52px; height: 52px; border: 1px solid var(--gold);
  color: var(--gold); font-family: var(--serif); font-size: 28px;
  display: grid; place-items: center; border-radius: 2px;
}
.at-brand h1 {
  font-family: var(--serif); font-weight: 500; font-size: 30px;
  color: var(--ivory); letter-spacing: .02em;
}
.at-brand p {
  color: var(--gold); font-size: 11px; letter-spacing: .34em;
  margin-top: 5px; text-transform: uppercase;
}
.at-nav { display: flex; gap: 18px; padding-bottom: 6px; }
.at-nav a {
  color: #b6ad9c; text-decoration: none; font-size: 12.5px;
  border-bottom: 1px solid transparent; padding-bottom: 2px;
}
.at-nav a:hover { color: var(--gold); border-color: var(--gold); }

/* ── card ── */
.at-card {
  background: var(--ivory); border-radius: 4px;
  padding: 26px 28px 28px; margin-bottom: 18px;
  box-shadow: 0 1px 0 rgba(201,169,106,.35) inset, 0 18px 40px rgba(0,0,0,.35);
}
.at-step {
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 1px solid var(--line); padding-bottom: 13px; margin-bottom: 20px;
}
.at-step i {
  font-style: normal; font-family: var(--serif); color: var(--gold-deep);
  font-size: 15px; letter-spacing: .1em;
}
.at-step b { font-size: 16.5px; letter-spacing: .02em; }
.at-step small { color: var(--mut); font-size: 12px; margin-left: auto; text-align: right; }

/* ── dropzone ── */
.at-drop {
  width: 100%; border: 1px dashed #cbbfa6; background: var(--ivory-2);
  border-radius: 3px; padding: 46px 20px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font: inherit; transition: border-color .15s, background .15s;
}
.at-drop:hover, .at-drop.over { border-color: var(--gold); background: #ece2cd; }
.at-drop-ico {
  width: 40px; height: 40px; border: 1px solid var(--gold); border-radius: 50%;
  display: grid; place-items: center; color: var(--gold-deep); font-size: 20px;
  margin-bottom: 4px;
}
.at-drop b { font-size: 14.5px; }
.at-drop small { color: var(--mut); font-size: 12px; }

/* ── source compare ── */
.at-src-figs { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 14px; flex-wrap: nowrap; }
.at-src-figs figure { display: flex; flex-direction: column; gap: 7px; align-items: center; flex: 0 0 auto; }
.at-src-figs figcaption {
  font-size: 11px; color: var(--mut); letter-spacing: .12em;
}
.at-src-figs canvas {
  width: auto; height: auto; max-height: 180px; max-width: 220px;
  border-radius: 3px; border: 1px solid var(--line);
  background:
    conic-gradient(#e9e2d2 90deg,#f2ecdf 90deg 180deg,#e9e2d2 180deg 270deg,#f2ecdf 270deg) 0 0/14px 14px;
}
.at-arrow { color: var(--gold-deep); font-size: 18px; }
.at-src-meta {
  text-align: center; color: var(--mut); font-size: 12px; margin: 13px 0 14px; line-height: 1.7;
}
.at-src-meta b { color: #2b2620; }

/* ── 복원 브러시 ── */
.at-src-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.at-src-actions .at-ghost { flex: 0 1 auto; min-width: 0; padding: 10px 16px; }
.at-src-actions small { color: var(--mut); font-size: 10.5px; margin-left: 4px; }
.at-brush { margin-top: 14px; }
.at-brush-tools {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.at-brush-tools label {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mut);
}
.at-brush-tools input[type=range] { width: 110px; accent-color: var(--gold-deep); }
.at-brush-done { flex: 0 0 auto; min-width: 0; padding: 8px 18px; font-size: 13px; }
.at-brush-tools b { color: var(--gold-deep); font-size: 12px; min-width: 24px; }
.at-brush-tools .at-pill:disabled { opacity: .4; cursor: default; }
.at-brush-scroll {
  overflow: auto; max-height: 560px; border: 1px solid var(--gold); border-radius: 3px;
  /* 확대 시 캔버스가 커져도 이 안에서만 스크롤 */
}
#atBrushCv {
  display: block; width: 100%; height: auto;
  cursor: crosshair; touch-action: none;
  background:
    conic-gradient(#e9e2d2 90deg,#f2ecdf 90deg 180deg,#e9e2d2 180deg 270deg,#f2ecdf 270deg) 0 0/14px 14px;
}

/* ── presets & moods ── */
.at-presets, .at-moods { display: flex; gap: 8px; flex-wrap: wrap; }
.at-presets { margin-bottom: 18px; }
.at-pill {
  border: 1px solid var(--line); background: #fff; color: #4c4437;
  border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 12.5px;
  cursor: pointer; transition: all .13s;
}
.at-pill:hover { border-color: var(--gold); }
.at-pill.on {
  background: var(--ink); color: var(--ivory); border-color: var(--ink);
}
.at-pill small { color: inherit; opacity: .55; margin-left: 5px; font-size: 11px; }

/* ── svg stage ── */
.at-stage { display: flex; justify-content: center; }
.at-svg-wrap {
  width: min(430px, 100%); min-height: 260px; border: 1px solid var(--line);
  border-radius: 3px; display: grid; place-items: center; padding: 14px;
  background:
    conic-gradient(#e9e2d2 90deg,#f2ecdf 90deg 180deg,#e9e2d2 180deg 270deg,#f2ecdf 270deg) 0 0/14px 14px;
}
.at-svg-wrap svg { max-width: 100%; height: auto; display: block; }
.at-wait { color: var(--mut); font-size: 13px; letter-spacing: .06em; }
.at-stats {
  display: flex; justify-content: center; gap: 26px; flex-wrap: wrap;
  margin-top: 16px; color: var(--mut); font-size: 12px;
}
.at-stats b { color: #2b2620; font-family: var(--serif); font-size: 16px; margin-right: 3px; }

/* ── palette ── */
.at-verdict {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-radius: 3px; margin-bottom: 15px; font-size: 13px;
  border: 1px solid;
}
.at-verdict.good { color: var(--good); border-color: #bcd8c5; background: #eef6f0; }
.at-verdict.warn { color: var(--warn); border-color: #e8d3ab; background: #faf3e3; }
.at-verdict.bad  { color: var(--bad);  border-color: #e5c0bb; background: #f9edeb; }
.at-verdict b { font-family: var(--serif); font-size: 17px; }
.at-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 17px; }
.at-chip {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: pointer; border: none; background: none; font: inherit; padding: 0;
}
.at-chip i {
  width: 44px; height: 44px; border-radius: 3px;
  border: 1px solid rgba(0,0,0,.14); box-shadow: 0 2px 8px rgba(0,0,0,.09);
  transition: transform .12s;
}
.at-chip:hover i { transform: translateY(-2px); }
.at-chip small { font-size: 10px; color: var(--mut); letter-spacing: .03em; }
.at-adv { margin-top: 14px; }
.at-adv summary {
  cursor: pointer; color: var(--gold-deep); font-size: 12.5px; user-select: none;
}
.at-adv[open] summary { margin-bottom: 10px; }
.at-range { display: block; font-size: 12.5px; color: var(--mut); }
.at-range b { color: #2b2620; }
.at-range input { width: 100%; margin-top: 7px; accent-color: var(--gold-deep); }
.at-hint { color: var(--mut); font-size: 12px; margin-top: 10px; line-height: 1.7; }

/* ── 곡선 정리 슬라이더 ── */
.at-smooth { margin: 10px 0 18px; }
.at-smooth b { color: var(--ink); font-family: var(--serif); font-size: 15px; margin: 0 4px; }
.at-smooth small { color: var(--mut); font-size: 11px; margin-left: 6px; }

/* ── 그림 위 색 강조 (PerfectVector 벤치마킹) ── */
.at-svg-wrap svg path { transition: filter .12s; cursor: pointer; }
/* 마우스 올린 색과 같은 fill을 가진 모든 패스가 노랗게 빛난다.
   data-highlight="색"으로 대상 fill을 지정하면 그 색만 노랑으로 오버레이. */
.at-svg-wrap[data-highlight] svg path { opacity: .55; }
.at-svg-wrap[data-highlight] svg path.at-highlight-on {
  opacity: 1;
  filter: drop-shadow(0 0 2px rgba(255,212,0,.85));
}
/* 클릭으로 "고정된" 강조 — 은은한 골드 한 겹만 (그림을 뒤덮지 않게) */
.at-svg-wrap svg path.at-picked-on {
  filter: drop-shadow(0 0 2px rgba(233,171,26,.8));
}

.at-pick-hint {
  margin-top: 12px; padding: 9px 12px; border-radius: 3px;
  background: rgba(201,169,106,.08); color: var(--mut); font-size: 12px; line-height: 1.6;
}
.at-pick-hint b { color: #2b2620; }
.at-pick-hint small { display: block; margin-top: 3px; color: var(--mut); font-size: 11px; }

/* ── 색 편집 팝업 ── */
.at-colorpop {
  margin-top: 14px; padding: 16px; border-radius: 4px;
  background: #fff; border: 1px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.at-cp-head {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 13px;
}
.at-cp-head i {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
}
.at-cp-head b { font-size: 14px; }
.at-cp-head button {
  margin-left: auto; border: none; background: none; font-size: 16px;
  color: var(--mut); cursor: pointer; padding: 4px 8px; border-radius: 3px;
}
.at-cp-head button:hover { background: var(--ivory-2); color: var(--ink); }

.at-cp-scope {
  display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
  padding: 10px 12px; margin-bottom: 13px; border-radius: 3px;
  background: rgba(201,169,106,.09); border: 1px solid rgba(201,169,106,.35);
}
.at-cp-scope input { width: 15px; height: 15px; margin-top: 2px; accent-color: var(--gold-deep); }
.at-cp-scope b { font-size: 13px; }
.at-cp-scope small { display: block; margin-top: 2px; color: var(--mut); font-size: 11px; }

.at-cp-sec { margin-bottom: 13px; }
.at-cp-sec > small {
  display: block; margin-bottom: 6px; color: var(--mut); font-size: 11px;
}
.at-cp-sec > small em { font-style: normal; color: var(--gold-deep); }

.at-cp-row { display: flex; gap: 6px; flex-wrap: wrap; }
.at-cp-row i {
  width: 30px; height: 30px; border-radius: 3px; cursor: pointer;
  border: 1px solid rgba(0,0,0,.14); transition: transform .1s;
}
.at-cp-row i:hover { transform: translateY(-1px); border-color: var(--gold); }

.at-cp-grid {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px;
}
.at-cp-grid i {
  aspect-ratio: 1; border-radius: 3px; cursor: pointer;
  border: 1px solid rgba(0,0,0,.1);
}
.at-cp-grid i:hover { transform: scale(1.12); border-color: var(--gold); }

.at-cp-custom {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 3px; background: var(--ivory-2);
  font-size: 12px; color: var(--mut);
}
.at-cp-custom input {
  width: 34px; height: 28px; padding: 2px; border: 1px solid var(--line);
  border-radius: 3px; cursor: pointer; background: none;
}

/* 벡터 변환 스위치 — 따내기만 쓸지, SVG까지 갈지 고르는 갈림길 */
.at-vec-toggle {
  margin: 18px 0 0; padding: 13px 15px;
  border: 1px solid var(--gold); border-radius: 3px;
  background: rgba(201,169,106,.09);
}
.at-vec-toggle b { font-size: 13.5px; }
.at-vec-toggle small { display: block; margin-top: 3px; }

/* ── export options ── */
.at-check {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13px; margin-bottom: 12px; cursor: pointer; line-height: 1.6;
}
.at-check input[type=checkbox] { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--gold-deep); }
.at-check small { color: var(--mut); font-size: 11.5px; }
.at-num {
  width: 46px; border: 1px solid var(--line); border-radius: 3px;
  padding: 2px 5px; font: inherit; font-size: 11.5px; text-align: center;
  background: #fff;
}

/* ── export ── */
.at-export { display: flex; gap: 12px; flex-wrap: wrap; }
.at-gold, .at-ghost {
  border-radius: 3px; padding: 14px 22px; font: inherit; font-size: 14px;
  cursor: pointer; letter-spacing: .04em;
}
.at-gold {
  flex: 1; min-width: 180px; border: none; color: var(--ink); font-weight: 700;
  background: linear-gradient(135deg, #d9bc82, var(--gold) 55%, #b8955426);
  background-color: var(--gold);
  box-shadow: 0 6px 18px rgba(201,169,106,.35);
}
.at-gold:hover { filter: brightness(1.06); }
.at-ghost {
  flex: 1; min-width: 160px; background: #fff; border: 1px solid var(--line); color: #4c4437;
}
.at-ghost:hover { border-color: var(--gold); }
.at-ghost small { color: var(--mut); margin-left: 4px; font-size: 11px; }

.at-foot {
  text-align: center; color: #6d6557; font-size: 11.5px;
  margin-top: 34px; letter-spacing: .06em;
}

/* ── toast ── */
.at-toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--ink-2); color: var(--ivory); border: 1px solid var(--gold-deep);
  padding: 11px 20px; border-radius: 3px; font-size: 13px; opacity: 0;
  pointer-events: none; transition: all .25s; max-width: 90vw; z-index: 50;
}
.at-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 일괄 처리 ── */
.at-batch-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.at-batch-bar b { color: var(--ink); font-size: 15px; }
.at-batch-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.at-batch-actions .at-ghost,
.at-batch-actions .at-gold { padding: 9px 14px; font-size: 13px; }
.at-batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}
.at-batch-card {
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s;
}
.at-batch-card:hover { border-color: var(--gold); }
.at-batch-thumb {
  width: 100%; height: auto; aspect-ratio: 1 / 1;
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  border-radius: 3px;
}
.at-batch-meta {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.at-batch-meta b {
  font-size: 12.5px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.at-batch-meta small { color: var(--mut); font-size: 11px; }
.at-batch-row {
  display: flex; gap: 4px;
}
.at-batch-row .at-pill {
  flex: 1; padding: 6px 4px; font-size: 11.5px;
  border-radius: 3px;
}
.at-batch-row .at-batch-del { flex: 0 0 30px; color: var(--bad); }

/* ── 요소 진단 패널 ── */
.at-diag {
  margin: 14px 0 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fcf8ef;
  font-size: 13px;
  line-height: 1.7;
}
.at-diag-row { margin-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.at-diag-row:last-child { margin-bottom: 0; }
.at-diag-badge {
  display: inline-block; padding: 2px 10px; border-radius: 3px; color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; flex-shrink: 0;
}
.at-diag-btn { padding: 5px 12px !important; font-size: 12px !important; }
.at-diag-thumbs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px;
}
.at-diag-thumb {
  text-align: center; font-size: 11px; color: var(--mut);
}
.at-diag-cv {
  display: block; width: 72px; height: 72px; object-fit: contain;
  border: 1px solid var(--line); border-radius: 3px;
  background:
    conic-gradient(#e9e2d2 90deg,#f2ecdf 90deg 180deg,#e9e2d2 180deg 270deg,#f2ecdf 270deg) 0 0/10px 10px;
}

.at-diag-tip {
  display: inline-block; font-size: 12px; color: var(--gold-deep);
  padding: 4px 10px; background: #fff8ec; border-radius: 3px;
  border: 1px dashed var(--gold);
}
.at-diag-line-preview {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  padding: 10px;
  text-align: center;
}
.at-diag-line-preview svg { display: block; margin: 0 auto; }

@media (max-width: 480px) {
  .at-src-figs { flex-direction: column; }
  .at-arrow { transform: rotate(90deg); }
  .at-step small { display: none; }
  .at-batch-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
