/* 딸깍 솔루션 5-Step 마법사 — Notion-inspired 디자인 (design-md/notion)
   따뜻한 뉴트럴 + 차콜 잉크(#37352f) + 시그니처 퍼플(#5645d4, 주 CTA 전용)
   + 파스텔 feature 카드 · 8px 각진 버튼 · 12px 카드 · link-blue 링크 */

:root {
  /* 뉴트럴 */
  --canvas: #ffffff; --surface: #f6f5f4; --surface-soft: #fafaf9; --tint-gray: #f0eeec;
  --hairline: #e5e3df; --hairline-soft: #ede9e4; --hairline-strong: #c8c4be;
  /* 잉크 */
  --ink: #1a1a1a; --charcoal: #37352f; --slate: #5d5b54; --steel: #787671; --stone: #a4a097;
  /* 브랜드 */
  --primary: #5645d4; --primary-pressed: #4534b3; --on-primary: #ffffff;
  --link: #0075de; --link-pressed: #005bab;
  /* 파스텔 tint */
  --tint-peach: #ffe8d4; --tint-rose: #fde0ec; --tint-mint: #d9f3e1;
  --tint-lavender: #e6e0f5; --tint-sky: #dcecfa; --tint-cream: #f8f5e8;
  /* 시맨틱 */
  --success-ink: #166534; --warning: #dd5b00; --error: #c0303a;
  /* radii */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-full: 9999px;
  --ring: 0 0 0 3px rgba(86,69,212,.14);
  --shadow-card: 0 1px 2px rgba(15,15,15,.03), 0 10px 26px -18px rgba(15,15,15,.14);
}

* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", system-ui, sans-serif;
  margin: 0; background: var(--surface-soft); color: var(--charcoal); line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
header { text-align: center; padding: 34px 16px 8px; }
header h1 { margin: 0; font-size: 27px; font-weight: 700; color: var(--ink); letter-spacing: -.022em; }
header .sub { margin: 8px 0 0; color: var(--steel); font-size: 14px; }

.steps { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 16px 12px 8px; }
.chip {
  font-size: 12px; padding: 6px 13px; border-radius: var(--r-full);
  background: var(--tint-gray); color: var(--slate); font-weight: 500;
}
.chip.active { background: var(--primary); color: var(--on-primary); font-weight: 600; }

main { max-width: 720px; margin: 0 auto; padding: 8px 16px 64px; }
.step {
  display: none; background: var(--canvas); border: 1px solid var(--hairline-soft);
  border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-card);
}
.step.active { display: block; }
.step h2 { margin-top: 0; font-size: 20px; font-weight: 650; color: var(--ink); letter-spacing: -.012em; }

label { display: block; margin: 16px 0; font-weight: 600; font-size: 14px; color: var(--charcoal); }
input, textarea, select {
  width: 100%; margin-top: 7px; padding: 10px 12px; border: 1px solid var(--hairline);
  border-radius: var(--r-md); font-size: 14px; font-family: inherit; color: var(--ink);
  background: var(--canvas); transition: border-color .12s ease, box-shadow .12s ease;
}
select { background: var(--canvas); }
input::placeholder, textarea::placeholder { color: var(--stone); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
textarea { resize: vertical; }
.post-item textarea { min-height: 120px; }
.post-item { margin-bottom: 12px; }
.post-item .title-input { margin-bottom: 6px; }
.post-item .del { float: right; font-size: 12px; color: var(--error); background: none; border: none; cursor: pointer; font-weight: 600; }

.actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }
button {
  cursor: pointer; border-radius: var(--r-md); font-size: 14px; padding: 11px 18px;
  border: 1px solid transparent; font-family: inherit; font-weight: 600;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.primary { background: var(--primary); color: var(--on-primary); margin-left: auto; }
.primary:hover { background: var(--primary-pressed); }
.back, .ghost { background: var(--tint-gray); color: var(--charcoal); border-color: var(--hairline-soft); }
.back:hover, .ghost:hover { background: var(--hairline-soft); }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cards .card { background: var(--surface-soft); border: 1px solid var(--hairline-soft); border-radius: var(--r-lg); padding: 14px; }
/* Notion 파스텔 feature 카드 — 6패턴 로테이션 */
.cards .card:nth-child(6n+1) { background: var(--tint-peach); border-color: transparent; }
.cards .card:nth-child(6n+2) { background: var(--tint-lavender); border-color: transparent; }
.cards .card:nth-child(6n+3) { background: var(--tint-mint); border-color: transparent; }
.cards .card:nth-child(6n+4) { background: var(--tint-sky); border-color: transparent; }
.cards .card:nth-child(6n+5) { background: var(--tint-rose); border-color: transparent; }
.cards .card:nth-child(6n+6) { background: var(--tint-cream); border-color: transparent; }
.cards .card h4 { margin: 0 0 6px; font-size: 13px; color: var(--charcoal); font-weight: 700; }
.cards .card p { margin: 0; font-size: 13px; color: var(--slate); }

.box { background: var(--surface); border: 1px solid var(--hairline-soft); border-radius: var(--r-lg); padding: 16px; white-space: pre-wrap; font-size: 14px; color: var(--charcoal); }
.hint { color: var(--steel); font-size: 13px; }

.collect-box { background: var(--tint-lavender); border: 1px solid #d9cdf0; border-radius: var(--r-lg); padding: 14px; margin-bottom: 16px; }
.collect-box .row { display: flex; gap: 8px; margin-top: 6px; }
.collect-box .row input { margin-top: 0; background: var(--canvas); }
.collect-box .row button { white-space: nowrap; }
.collect-box .row select.recency { width: auto; margin-top: 0; flex-shrink: 0; background: var(--canvas); }

.loading { text-align: center; padding: 24px; color: var(--primary); font-weight: 500; }
.loading span {
  display: inline-block; width: 16px; height: 16px; border: 3px solid #d6cef5;
  border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading span { animation: none; } }

.error { background: var(--tint-rose); color: var(--error); border: 1px solid #f3c6d8; border-radius: var(--r-lg); padding: 14px; margin-top: 16px; }
.hidden { display: none; }

@media (max-width: 560px) { .cards { grid-template-columns: 1fr; } }

/* 설정 화면 */
.settings-link { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--link); text-decoration: none; }
.settings-link:hover { color: var(--link-pressed); text-decoration: underline; }
.radioline { display: inline-flex; align-items: center; gap: 6px; margin: 6px 16px 6px 0; font-weight: 500; }
.radioline input { width: auto; margin-top: 0; accent-color: var(--primary); }
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-full); margin-left: 6px; vertical-align: middle; }
.badge.set { background: var(--tint-mint); color: var(--success-ink); }
.badge.unset { background: var(--tint-rose); color: var(--error); }

/* 인증 */
.authbar { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.authbar .hi { color: var(--charcoal); font-weight: 600; }
.authlink { color: var(--link); text-decoration: none; }
.authlink:hover { text-decoration: underline; }
.authlink.need-key { color: var(--error); font-weight: 700; }
.tabs { display: flex; gap: 6px; }
.tab { flex: 1; background: var(--tint-gray); color: var(--charcoal); }
.tab.active { background: var(--primary); color: var(--on-primary); font-weight: 600; }

/* STEP 5 이미지 배치 미리보기 */
.imgprev-box { margin-top: 24px; border-top: 1px dashed var(--hairline-strong); padding-top: 16px; }
.imgprev-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.imgprev-head h3 { margin: 0; font-size: 16px; font-weight: 650; color: var(--ink); letter-spacing: -.01em; }
.prev-btns { display: flex; gap: 8px; }
.rec-blue { color: var(--primary); }
.preview { background: var(--canvas); border: 1px solid var(--hairline-soft); border-radius: var(--r-lg); padding: 18px; margin-top: 10px; }
.preview .prev-text { font-size: 15px; line-height: 1.85; margin: 0 0 4px; white-space: pre-wrap; word-break: break-word; color: var(--charcoal); }
.preview h3.prev-text { font-size: 17px; font-weight: 700; margin: 22px 0 8px; color: var(--ink); letter-spacing: -.01em; }
.img-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.prev-img { position: relative; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.img-copy { font-size: 12px; padding: 5px 8px; background: var(--tint-lavender); color: var(--primary); border: 1px solid #d9cdf0; border-radius: var(--r-sm); font-weight: 600; }
.img-copy:hover { background: #ddd2f2; }
.prev-img img { max-width: 240px; max-height: 190px; border-radius: var(--r-md); display: block; border: 1px solid var(--hairline); }
.img-del { position: absolute; top: 5px; right: 5px; background: rgba(26,26,26,.62); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: 12px; line-height: 1; }
.img-del:hover { background: rgba(26,26,26,.85); }
.img-add { border-radius: var(--r-md); cursor: pointer; white-space: nowrap; }
/* 추천 위치: 라벤더 tint 로 강조 */
.img-add-rec { background: var(--tint-lavender); color: var(--primary); border: 1px dashed #b9a6ec; padding: 9px 14px; font-size: 13px; font-weight: 600; }
.img-add-rec:hover { background: #ddd2f2; }
/* 그 외 위치: 작고 은은하게 */
.img-add-min { background: var(--tint-gray); color: var(--steel); border: 1px dashed var(--hairline); padding: 4px 10px; font-size: 12px; }
.img-add-min:hover { background: var(--hairline-soft); color: var(--slate); }
