/* AI로 팜플렛 초안 만들기 — 질문 화면 (editor-ai.js) */
.ai-open { display: flex; align-items: center; gap: 8px; width: 100%; margin: 0 0 12px; padding: 12px 14px; border: 1.5px solid var(--brand); border-radius: 12px; background: var(--brand-light); color: var(--brand); font-weight: 700; font-size: 14px; text-align: left; cursor: pointer; }
.ai-open:hover { background: #e3e6ff; }
.ai-open svg { width: 20px; height: 20px; fill: var(--brand); flex: 0 0 auto; }
.ai-open small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }

.ai-wiz { position: fixed; inset: 0; z-index: 170; background: rgba(20,24,50,.5); display: grid; place-items: center; padding: 16px; }
.ai-wiz[hidden] { display: none; }
.ai-box { background: #fff; border-radius: 18px; width: min(820px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(0,0,0,.3); overflow: hidden; }
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 6px; }
.ai-head h2 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.ai-head h2 svg { width: 22px; height: 22px; fill: var(--brand); }
.ai-beta { font-size: 11px; font-weight: 700; color: #8a5a00; background: #fff3cd; border-radius: 999px; padding: 3px 8px; }
.ai-x { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--bg-soft); font-size: 20px; cursor: pointer; }
.ai-steps { display: flex; gap: 6px; list-style: none; margin: 6px 20px 4px; padding: 0; counter-reset: s; }
.ai-steps li { flex: 1; font-size: 12px; color: var(--muted); border-top: 3px solid var(--line); padding-top: 6px; counter-increment: s; }
.ai-steps li::before { content: counter(s) '. '; }
.ai-steps li.on { color: var(--brand); border-color: var(--brand); font-weight: 700; }
.ai-steps li.done { color: var(--text); border-color: #a9adf0; }
.ai-body { padding: 10px 20px 16px; overflow: auto; flex: 1; }
.ai-foot { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.ai-foot .btn { display: inline-flex; align-items: center; gap: 6px; }
.ai-foot .btn svg { width: 18px; height: 18px; fill: currentColor; }
.ai-err { flex: 1; color: #c0392b; font-size: 13px; text-align: right; }
.ai-q { font-weight: 700; font-size: 15px; margin: 14px 0 8px; }
.ai-q.sm { font-size: 13px; margin: 12px 0 6px; }
.ai-hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.6; }

.ai-folds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ai-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.ai-card svg { width: 64px; height: 44px; fill: none; stroke: var(--muted); stroke-width: 1.6; }
.ai-card b { font-size: 14px; }
.ai-card small { font-size: 12px; color: var(--muted); }
.ai-card.on { border-color: var(--brand); background: var(--brand-light); }
.ai-card.on svg { stroke: var(--brand); }
.ai-card.off { opacity: .5; cursor: not-allowed; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-chips button, .ai-side button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 13.5px; cursor: pointer; }
.ai-chips button.on, .ai-side button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }

.ai-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ai-f { display: block; margin: 8px 0 0; }
.ai-f span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.ai-f input, .ai-item input, .ai-item textarea, .ai-raw { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 14px; background: #fff; }
.ai-f input:focus, .ai-item input:focus, .ai-item textarea:focus, .ai-raw:focus { outline: 2px solid #c9ccff; border-color: var(--brand); }
.ai-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 10px; }
.ai-tabs button { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 11px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: 14px; cursor: pointer; }
.ai-tabs button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ai-tabs button.on { border-color: var(--brand); background: var(--brand-light); color: var(--brand); font-weight: 700; }
.ai-raw { min-height: 200px; resize: vertical; line-height: 1.6; }
/* 원고 파일 가져오기 */
.ai-doc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 8px; }
.ai-doc small { font-size: 12px; color: var(--muted); flex: 1 1 260px; line-height: 1.5; }
.ai-docbtn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border: 1.5px solid var(--brand); border-radius: 10px; background: #fff; color: var(--brand); font-weight: 700; font-size: 14px; cursor: pointer; }
.ai-docbtn:hover { background: var(--brand-light); }
.ai-docbtn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ai-docbtn.busy { cursor: wait; opacity: .8; }
.ai-docbtn .ai-spin { width: 16px; height: 16px; border-width: 2px; }
.ai-docmsg { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; background: #eef7f0; border: 1px solid #b9dfc4; color: #1f5b33; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.ai-docmsg.err { background: #fff1f0; border-color: #f3b8b2; color: #a12a1f; }
.ai-link { border: 0; background: none; padding: 0; color: var(--brand); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.ai-rawlen b { color: #a15c00; }
.ai-wiz.ai-dragging .ai-raw { outline: 3px dashed var(--brand); outline-offset: 2px; background: var(--brand-light); }
.ai-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 8px; margin-bottom: 8px; }
.ai-item textarea { resize: vertical; min-height: 40px; }
.ai-ups { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 14px; }
.ai-up-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 92px; height: 72px; border: 1.5px dashed #b9bdd6; border-radius: 10px; font-size: 12px; color: var(--muted); cursor: pointer; text-align: center; }
.ai-drop svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ai-drop:hover { border-color: var(--brand); color: var(--brand); }
.ai-thumb { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-soft); }
.ai-thumb.logo { width: 92px; }
.ai-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ai-thumb.logo img { object-fit: contain; padding: 6px; box-sizing: border-box; }
.ai-thumb button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; line-height: 22px; padding: 0; cursor: pointer; }

.ai-moods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ai-mood { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.ai-mood b { font-size: 16px; font-weight: 700; }
.ai-mood.on { border-color: var(--brand); background: var(--brand-light); }
.ai-sw { display: flex; }
.ai-sw i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; margin-left: -6px; }
.ai-sw i:first-child { margin-left: 0; }
.ai-colors { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ai-colors button, .ai-colors .pick { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; cursor: pointer; }
.ai-colors .sw { padding: 0 8px; }
.ai-colors .sw i { width: 20px; height: 20px; border-radius: 50%; display: inline-block; }
.ai-colors .on { border-color: var(--brand); box-shadow: 0 0 0 2px #c9ccff; }
.ai-colors .pick input { width: 22px; height: 22px; border: 0; padding: 0; background: none; cursor: pointer; }

.ai-side { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.ai-warn { background: #fff7e0; border: 1px solid #f1d36b; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; color: #6b4e00; }
.ai-warn p { margin: 2px 0; }
.ai-drafts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ai-draft { border: 1.5px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.ai-draft:hover { border-color: #a9adf0; }
.ai-prev { aspect-ratio: 301 / 214; background: var(--bg-soft); border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.ai-prev { position: relative; }
.ai-prev img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 1px 3px rgba(0,0,0,.16)); }
/* 소책자: 세로 쪽은 칸 가운데, 펼침면은 두 쪽을 가운데에서 맞붙여 나란히 */
.ai-prev.two img { width: 50%; }
.ai-prev.two img:first-child { object-position: right center; }
.ai-prev.two img + img { left: 50%; object-position: left center; }
.ai-prev:not(.two) img + img { display: none; }
.ai-dmeta { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; }
.ai-dmeta small { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.ai-dmeta small i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.ai-dbtns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 6px; }
.ai-dbtns .btn { padding: 8px 6px; font-size: 13px; }
.ai-spin { width: 26px; height: 26px; border: 3px solid #d9dcef; border-top-color: var(--brand); border-radius: 50%; animation: ai-spin .8s linear infinite; flex: 0 0 auto; }
/* 서버 AI (2단계) */
.ai-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ai-status { display: flex; align-items: center; gap: 12px; background: var(--brand-light); border: 1px solid #c9ccff; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.ai-status[hidden] { display: none; }
.ai-status p { margin: 0; font-size: 14px; color: var(--brand); }
.ai-status small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ai-note { background: #eef7f0; border: 1px solid #b9dfc4; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; color: #1f5b33; }
.ai-note[hidden] { display: none; }
.ai-note p { margin: 2px 0; line-height: 1.55; }
.ai-note b { display: inline-flex; align-items: center; gap: 4px; }
.ai-note svg { width: 16px; height: 16px; fill: currentColor; }
.ai-note .ai-tips { color: #6b4e00; }
.ai-note.off { background: #f4f5f9; border-color: var(--line); color: #4b4f60; }
.ai-retry { margin-left: 6px; border: 1px solid var(--brand); background: #fff; color: var(--brand); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; }
.ai-wiz.ai-busy .ai-drafts, .ai-wiz.ai-busy .ai-side { opacity: .45; pointer-events: none; }
.ai-wiz.ai-busy [data-act=again] { opacity: .45; pointer-events: none; }
.ai-designer { display: block; width: 100%; border: 0; background: none; color: var(--brand); font-size: 13px; font-weight: 700; padding: 4px 0 0; cursor: pointer; text-align: center; }
.ai-designer:hover { text-decoration: underline; }

/* 편집기 글자 AI 도우미 (속성 창) */
.ai-help { background: var(--brand-light, #eef0ff); border: 1px solid #c9ccff; border-radius: 12px; padding: 10px; margin: 4px 0 8px; }.ai-help .prop-label { display: flex; align-items: center; gap: 5px; color: var(--brand); font-weight: 700; flex-wrap: wrap; }
.ai-help .prop-label svg { width: 16px; height: 16px; fill: var(--brand); flex: 0 0 auto; }
.ai-help .prop-label small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.ai-help .action-grid button { background: #fff; }
.ai-help .action-grid button.on { background: #fff; border-color: var(--brand); color: var(--brand); font-weight: 700; }
.ai-help .action-grid button:disabled { opacity: .5; cursor: wait; }
.ai-help-tones { margin-top: 6px; }
.ai-help-out:empty { display: none; }
.ai-help-out { margin-top: 8px; }
.ai-help-wait { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--brand); }
.ai-help-wait .ai-spin { width: 18px; height: 18px; border-width: 2px; }
.ai-help-wait small { color: var(--muted); }
.ai-help-hint { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.ai-help-msg { margin: 0; font-size: 12.5px; color: #6b4e00; background: #fff7e0; border-radius: 8px; padding: 6px 8px; }
.ai-opt { display: block; width: 100%; text-align: left; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; font: inherit; font-size: 13px; line-height: 1.5; cursor: pointer; }
.ai-opt:hover, .ai-opt:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 2px #c9ccff; outline: none; }
.ai-help-close { border: 0; background: none; color: var(--muted); font-size: 12.5px; cursor: pointer; padding: 2px 0; }
@keyframes ai-spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .ai-wiz { padding: 0; }
  .ai-box { width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .ai-head { padding: 12px 14px 4px; }
  .ai-head h2 { font-size: 16px; }
  .ai-steps { margin: 4px 14px; }
  .ai-steps li { font-size: 11px; }
  .ai-body { padding: 8px 14px 14px; }
  .ai-foot { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
  .ai-folds { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .ai-card { padding: 10px 4px; }
  .ai-card svg { width: 48px; height: 34px; }
  .ai-grid2, .ai-ups, .ai-item { grid-template-columns: minmax(0, 1fr); }
  .ai-moods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-drafts { grid-template-columns: minmax(0, 1fr); }
  .ai-tabs button { font-size: 13px; padding: 10px 6px; }
}

/* 충전금(유료) — 휴대폰 인증·잔액·충전 (2026-11-18) */
.ai-wallet { margin-top: 14px; border: 1.5px solid #c9ccff; background: #f7f8ff; border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.ai-wtest { display: inline-block; font-size: 11.5px; font-weight: 700; color: #8a5a00; background: #fff3cd; border-radius: 999px; padding: 2px 8px; margin-bottom: 6px; }
.ai-wt { margin: 0 0 8px; } .ai-wt b { display: block; font-size: 15px; } .ai-wt small { color: var(--muted); font-size: 12.5px; }
.ai-wrow { display: flex; gap: 8px; margin: 6px 0; }
.ai-wrow input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 15px; background: #fff; }
.ai-wrow .btn { white-space: nowrap; }
.ai-wagree { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: #4b4f60; line-height: 1.5; margin-top: 6px; }
.ai-wme { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.ai-wme p { margin: 0; } .ai-wbal { color: var(--brand); font-size: 17px; }
.ai-wfree { color: #1f7a3a; font-weight: 700; }
.ai-wbtns { display: flex; gap: 6px; align-items: center; }
.ai-wlink { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 4px; }
.ai-wprice { margin: 8px 0 0; font-size: 12.5px; color: #4b4f60; }
.ai-wmsg { margin: 6px 0 0; font-size: 13px; color: #1f5b33; } .ai-wmsg.warn { color: #a12a1f; }
.ai-whist { margin-top: 8px; border-top: 1px solid #dfe2f5; padding-top: 6px; max-height: 180px; overflow: auto; }
.ai-whist p { display: grid; grid-template-columns: 84px 1fr auto; gap: 8px; margin: 3px 0; font-size: 12.5px; }
.ai-whist p span:first-child { color: var(--muted); } .ai-whist b.m { color: #a12a1f; } .ai-whist b.p { color: #1f7a3a; }

/* ===== 큰 글씨 · 한 화면에 질문 하나 (2026-11-19 워렌님) — 위 규칙보다 뒤에 와서 덮어씀 ===== */
.ai-box { width: min(760px, 100%); border-radius: 22px; }
.ai-wiz.ai-wide .ai-box { width: min(980px, 100%); }
.ai-head { padding: 22px 30px 4px; }
.ai-head h2 { font-size: 19px; color: var(--muted); font-weight: 700; }
.ai-x { width: 42px; height: 42px; font-size: 24px; }
.ai-prog { display: flex; align-items: center; gap: 14px; margin: 10px 30px 0; }
.ai-bar { flex: 1; height: 8px; background: #e7e8f3; border-radius: 99px; overflow: hidden; }
.ai-bar i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .25s; }
.ai-cnt { font-size: 16px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.ai-body { padding: 26px 30px 24px; min-height: 340px; }
.ai-q1 { font-size: 30px; line-height: 1.35; font-weight: 800; margin: 4px 0 8px; color: var(--text); letter-spacing: -.02em; }
.ai-sub { font-size: 18px; color: var(--muted); margin: 0 0 24px; }
.ai-q { font-size: 18px; } .ai-q.sm { font-size: 16px; }
.ai-hint { font-size: 15.5px; }
.ai-foot { padding: 18px 30px 22px; }
.ai-foot .btn { font-size: 19px; padding: 14px 28px; border-radius: 14px; }
.ai-foot .btn svg { width: 22px; height: 22px; }
.ai-err { font-size: 16px; }
.ai-card { padding: 24px 12px; border-width: 2px; border-radius: 18px; gap: 8px; }
.ai-card svg { width: 76px; height: 52px; }
.ai-card b { font-size: 22px; } .ai-card small { font-size: 16px; }
.ai-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ai-chips button { font-size: 21px; padding: 22px 16px; border-radius: 18px; border-width: 2px; font-weight: 700; }
.ai-big { width: 100%; box-sizing: border-box; font: inherit; font-size: 26px; padding: 18px 20px; border: 2px solid var(--line); border-radius: 16px; background: #fff; }
.ai-big:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px #e3e6ff; }
.ai-tabs button { font-size: 18px; padding: 15px 12px; border-radius: 14px; }
.ai-docbtn { font-size: 18px; padding: 13px 18px; border-radius: 14px; }
.ai-doc small { font-size: 14px; }
.ai-raw { font-size: 17px; min-height: 220px; border-radius: 14px; }
.ai-f span { font-size: 15px; } .ai-f input, .ai-item input, .ai-item textarea { font-size: 16px; padding: 11px 13px; }
.ai-drop { width: 120px; height: 100px; font-size: 15px; border-radius: 14px; }
.ai-drop svg { width: 26px; height: 26px; }
.ai-thumb { width: 100px; height: 100px; } .ai-thumb.logo { width: 120px; }
.ai-moods { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ai-mood { padding: 22px 10px; border-radius: 18px; border-width: 2px; }
.ai-mood b { font-size: 24px; } .ai-sw i { width: 28px; height: 28px; }
.ai-colors { gap: 12px; }
.ai-colors button, .ai-colors .pick { height: 56px; font-size: 18px; padding: 0 18px; border-width: 2px; }
.ai-colors .sw { padding: 0 10px; } .ai-colors .sw i { width: 34px; height: 34px; }
.ai-sum { list-style: none; margin: 0 0 16px; padding: 14px 18px; background: #f7f8ff; border-radius: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.ai-sum li { display: flex; gap: 12px; font-size: 17px; min-width: 0; } .ai-sum span { color: var(--muted); flex: 0 0 auto; } .ai-sum b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-wallet { font-size: 16px; } .ai-wt b { font-size: 18px; } .ai-wrow input { font-size: 18px; padding: 12px 14px; }
.ai-side button { font-size: 16px; padding: 10px 16px; }
@media (max-width: 760px) {
  .ai-head { padding: 14px 16px 2px; } .ai-prog { margin: 8px 16px 0; } .ai-body { padding: 18px 16px; min-height: 0; }
  .ai-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); } .ai-foot .btn { font-size: 18px; padding: 13px 20px; }
  .ai-q1 { font-size: 25px; } .ai-sub { font-size: 16px; margin-bottom: 18px; }
  .ai-folds { grid-template-columns: minmax(0, 1fr); } .ai-card { flex-direction: row; justify-content: flex-start; padding: 16px 18px; gap: 14px; text-align: left; }
  .ai-card svg { width: 56px; height: 40px; flex: 0 0 auto; } .ai-card small { margin-left: auto; }
  .ai-chips { grid-template-columns: minmax(0, 1fr); } .ai-chips button { font-size: 19px; padding: 18px 14px; }
  .ai-big { font-size: 22px; } .ai-sum { grid-template-columns: minmax(0, 1fr); }
}
