/* 누끼 따기 - 단순하고 깔끔한 디자인
   색은 흑백 위주, 강조색 하나(파랑)만 씁니다. */

:root {
  --ink: #111;
  --ink-2: #555;
  --ink-3: #8a8a8a;
  --line: #e4e4e4;
  --bg: #fafafa;
  --card: #fff;
  --accent: #1f6feb;
  --radius: 10px;
  --font: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  word-break: keep-all;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

/* ---------- 머리글 ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1200px; margin: 0 auto; padding: 16px 20px;
}
.logo { font-weight: 800; font-size: 22px; text-decoration: none; letter-spacing: -0.5px; }
.logo span { color: var(--accent); }
.site-header nav { display: flex; gap: 18px; font-size: 14px; }
.site-header nav a { text-decoration: none; color: var(--ink-2); }
.site-header nav a:hover { color: var(--ink); }

main { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---------- 첫 화면 ---------- */
.hero { padding: 40px 0 24px; text-align: center; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.25; letter-spacing: -1px; margin: 0 0 16px; font-weight: 800; }
.points {
  list-style: none; padding: 0; margin: 0 0 28px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px;
  color: var(--ink-2); font-size: 15px;
}
.points li::before { content: "✓ "; color: var(--accent); font-weight: 700; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  max-width: 640px; margin: 0 auto; min-height: 180px; padding: 24px;
  background: var(--card); border: 1.5px dashed #c8c8c8; border-radius: 14px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--ink); background: #f4f4f4; }
.drop-title {
  display: inline-block; background: var(--ink); color: #fff;
  padding: 12px 26px; border-radius: 999px; font-weight: 700; font-size: 16px;
}
.drop-sub { color: var(--ink-3); font-size: 13px; }

/* ---------- 광고 자리 (승인 전에는 보이지 않음) ---------- */
.ad-slot { margin: 24px auto; max-width: 970px; }
.ad-slot:empty { margin: 0; }
body.show-ad-slots .ad-slot:empty {
  min-height: 90px; margin: 24px auto; border: 1px dashed #c8c8c8; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
body.show-ad-slots .ad-slot:empty::after { content: "광고 자리 (" attr(data-ad) ")"; color: var(--ink-3); font-size: 13px; }

/* ---------- 작업 공간 ---------- */
.workspace {
  display: grid; gap: 16px;
  grid-template-columns: 96px minmax(0, 1fr) 320px;
  grid-template-areas: "queue stage panel";
  align-items: start;
  margin: 8px 0 24px;
}
.queue { grid-area: queue; display: flex; flex-direction: column; gap: 8px; max-height: 72vh; overflow-y: auto; }
.stage-wrap { grid-area: stage; min-width: 0; }
.panel { grid-area: panel; }

.thumb {
  position: relative; width: 100%; aspect-ratio: 1; padding: 0;
  border: 2px solid transparent; border-radius: 8px; overflow: hidden;
  background: #eee; cursor: pointer; flex-shrink: 0;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.active { border-color: var(--ink); }
.thumb .badge {
  position: absolute; left: 4px; bottom: 4px; right: 4px;
  font-size: 11px; line-height: 1.4; padding: 1px 4px; border-radius: 4px;
  background: rgba(0,0,0,.7); color: #fff; text-align: center;
}
.thumb .badge.done { display: none; }
.thumb .x {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; font-size: 12px; line-height: 20px; cursor: pointer; padding: 0;
}
.add-more {
  width: 100%; aspect-ratio: 1; border: 1.5px dashed #c8c8c8; border-radius: 8px; background: var(--card);
  color: var(--ink-3); font-size: 24px; cursor: pointer; flex-shrink: 0;
}

.stage-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.tab {
  border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-2);
  font-size: 14px;
}
.tab.active { background: var(--ink); color: #fff; }

.stage {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  min-height: 320px; display: flex; align-items: center; justify-content: center; overflow: hidden;
  /* 투명한 부분을 보여주는 체크무늬 */
  background-image:
    linear-gradient(45deg, #efefef 25%, transparent 25%), linear-gradient(-45deg, #efefef 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #efefef 75%), linear-gradient(-45deg, transparent 75%, #efefef 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
#view { display: block; max-width: 100%; max-height: 70vh; touch-action: none; }
.stage.editing #view { cursor: crosshair; }
.compare-slider {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize;
}
.stage-msg {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(255,255,255,.85); font-size: 15px; color: var(--ink-2); text-align: center; padding: 20px;
}
.progress { width: 220px; height: 6px; background: #e8e8e8; border-radius: 3px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .2s; }

.edit-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin-top: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}

/* ---------- 오른쪽 설정 패널 ---------- */
.panel { display: flex; flex-direction: column; gap: 12px; }
.group { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.group h2 { font-size: 15px; margin: 0 0 12px; }

.styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.style-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 0; background: transparent; padding: 0; cursor: pointer; font-size: 11px; color: var(--ink-2);
}
.style-btn canvas, .style-btn .sw {
  width: 100%; aspect-ratio: 1; border-radius: 8px; border: 2px solid var(--line); display: block;
}
.style-btn.active canvas, .style-btn.active .sw { border-color: var(--ink); }
.style-btn.active { color: var(--ink); font-weight: 600; }
.sw { position: relative; overflow: hidden; }
.sw input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.prompt { margin-top: 14px; }
.prompt label { font-size: 13px; color: var(--ink-2); }
.prompt-row { display: flex; gap: 6px; margin-top: 6px; }
.prompt-row input {
  flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.prompt-row input:focus, select:focus { outline: 2px solid var(--ink); outline-offset: -1px; }

select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}

.range { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.edit-tools .range { margin: 0; flex-direction: row; align-items: center; gap: 8px; }
input[type=range] { accent-color: var(--ink); width: 100%; }
.edit-tools input[type=range] { width: 140px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.group .seg { width: 100%; margin-bottom: 10px; }
.seg-btn { flex: 1; border: 0; background: #fff; padding: 8px 14px; cursor: pointer; font-size: 14px; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.active { background: var(--ink); color: #fff; }

.btn-primary, .btn-line {
  border-radius: 8px; padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.btn-primary { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.btn-primary:hover { background: #333; }
.btn-line { background: #fff; border: 1px solid #cfcfcf; }
.btn-line:hover { border-color: var(--ink); }
.btn-text {
  border: 0; background: none; padding: 6px 0; margin-top: 4px; cursor: pointer;
  color: var(--accent); font-size: 13px; text-decoration: underline; text-underline-offset: 3px;
}
button:disabled { opacity: .45; cursor: not-allowed; }
.full { width: 100%; margin-top: 8px; }
.check { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--ink-3); margin: 8px 0 0; }

/* ---------- 설명 글 ---------- */
.content { max-width: 820px; margin: 24px auto 40px; }
.content section { padding: 28px 0; border-top: 1px solid var(--line); }
.content h2 { font-size: 22px; margin: 0 0 12px; letter-spacing: -0.4px; }
.content p, .content li { color: #333; font-size: 15.5px; }
.content ol, .content ul { padding-left: 20px; }
.content li { margin-bottom: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td:last-child { white-space: normal; }
th { color: var(--ink-2); font-weight: 600; background: #f4f4f4; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 16px; }
.faq details p { margin: 8px 0 0; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 20px 40px; text-align: center; font-size: 13px; color: var(--ink-3); }
.site-footer nav { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.site-footer a { text-decoration: none; color: var(--ink-2); }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  max-width: calc(100% - 32px); background: var(--ink); color: #fff; font-size: 14px;
  padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 태블릿 ---------- */
@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas: "queue queue" "stage panel";
  }
  .queue { flex-direction: row; max-height: none; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
  .thumb, .add-more { width: 72px; }
}

/* ---------- 휴대폰 ---------- */
@media (max-width: 720px) {
  main { padding: 0 14px; }
  .site-header { padding: 12px 14px; }
  .site-header nav { gap: 12px; font-size: 13px; }
  .site-header nav a:nth-child(2) { display: none; }
  .hero { padding: 24px 0 16px; }
  .points { font-size: 13px; gap: 4px 12px; margin-bottom: 18px; }
  .drop { min-height: 150px; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-areas: "queue" "stage" "panel"; }
  .stage { min-height: 240px; }
  #view { max-height: 60vh; }
  .styles { grid-template-columns: repeat(5, 1fr); }
  .edit-tools input[type=range] { width: 110px; }
  .content h2 { font-size: 19px; }
}
