/* === reset === */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: #fafafa;
  color: #262626;
  line-height: 1.5;
  font-size: 14px;
}

/* === topbar === */
.topbar {
  background: white;
  border-bottom: 1px solid #dbdbdb;
  padding: 14px 20px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.version {
  color: #8e8e8e;
  font-size: 12px;
}

/* === layout (sidebar + main) === */
.layout {
  max-width: 980px;
  margin: 20px auto 60px;
  padding: 0 16px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

/* === sidebar === */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 70px;
}
.sidebar-card {
  padding: 16px;
}
.sidebar-brand {
  font-size: 12px;
  font-weight: 600;
  color: #8e8e8e;
  letter-spacing: 0.3px;
  text-transform: lowercase;
  padding: 0 4px 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid #efefef;
}

/* === container === */
.container {
  flex: 1;
  min-width: 0;
}
.screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* === screen header (with back button) === */
.screen-header { padding: 16px 20px; }
.screen-header .card-title { margin-top: 4px; }
.screen-header .muted { margin-bottom: 12px; }

/* 채널 제목 + ⚙ 설정(그림 스타일) */
.channel-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.channel-title-row .card-title { margin-top: 0; }
.btn-channel-settings {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
  color: #6b7280;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.btn-channel-settings:hover { background: #f0f0f0; color: #111; }
.btn-channel-settings:active { transform: rotate(45deg); }

/* 채널 설정 모달 내부 블록 */
.settings-block { display: flex; flex-direction: column; gap: 8px; }
.settings-block-label { font-weight: 700; font-size: 14px; color: #111; }
.settings-block .btn-secondary { align-self: flex-start; }
.btn-back {
  background: none;
  border: none;
  color: #8e8e8e;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  margin-bottom: 6px;
  font-family: inherit;
  display: inline-block;
}
.btn-back:hover { color: #262626; }

/* === stage progress bar === */
.stage-progress {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px;
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 12px;
  scrollbar-width: thin;
  scrollbar-color: #dbdbdb transparent;
}
.stage-progress::-webkit-scrollbar { height: 6px; }
.stage-progress::-webkit-scrollbar-thumb { background: #dbdbdb; border-radius: 3px; }
.stage-progress::-webkit-scrollbar-track { background: transparent; }
.stage-item {
  flex-shrink: 0;
  min-width: 62px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid #efefef;
  text-align: center;
  cursor: not-allowed;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.stage-item .stage-num {
  font-size: 10px;
  color: #8e8e8e;
  letter-spacing: 0.4px;
  font-weight: 500;
  line-height: 1.2;
}
.stage-item .stage-name {
  font-size: 12px;
  color: #262626;
  font-weight: 500;
  margin-top: 2px;
  line-height: 1.2;
  white-space: nowrap;
}
.stage-item.active {
  background: #262626;
  border-color: #262626;
}
.stage-item.active .stage-num { color: #b2b2b2; }
.stage-item.active .stage-name { color: white; }

/* 시작된 단계는 클릭 가능 (완료 ✓ 표시는 별도) */
.stage-item.clickable { cursor: pointer; }
.stage-item.clickable:hover:not(.active):not(.completed) {
  background: #efefef;
  border-color: #dbdbdb;
}

/* 완료된 단계 — 진행바 클릭 가능, ✓ 체크 표시 */
.stage-item.completed {
  background: #edf7ee;
  border-color: #c8e6c9;
  cursor: pointer;
}
.stage-item.completed .stage-num { color: #2e7d32; }
.stage-item.completed .stage-name { color: #2e7d32; font-weight: 600; }
.stage-item.completed .stage-num::after {
  content: ' ✓';
  font-size: 11px;
  color: #2e7d32;
}
.stage-item.completed:hover {
  background: #dcedc8;
  border-color: #2e7d32;
}
/* 완료 + 현재(visited) 같이 일 때는 active 가 우선 — 검정 배경 */
.stage-item.active.completed {
  background: #262626;
  border-color: #262626;
}
.stage-item.active.completed .stage-num,
.stage-item.active.completed .stage-name { color: white; }
.stage-item.active.completed .stage-num::after { color: #6ee48e; }

/* 단계 네비게이션 (top: 이전, bottom: 다음) */
.step-nav-top {
  display: flex;
  align-items: center;
  padding: 0 4px;
}
.step-nav-bottom {
  display: flex;
  justify-content: flex-end;
  padding: 0 4px;
}
.btn-step-nav {
  background: none;
  border: none;
  color: #8e8e8e;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 8px;
  font-family: inherit;
  transition: color 0.15s;
}
.btn-step-nav:hover:not(:disabled) { color: #262626; }
.btn-step-nav:disabled { color: #dbdbdb; cursor: not-allowed; }
.btn-next-step {
  background: #262626;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-next-step:hover:not(:disabled) { background: #000; }
.btn-next-step:disabled {
  background: #efefef;
  color: #c7c7c7;
  cursor: not-allowed;
}

/* === card === */
.card {
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 12px;
  padding: 18px 20px;
}
.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.step-num {
  background: #262626;
  color: white;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.result-tag {
  background: #edf7ee;
  color: #2e7d32;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

/* === text === */
.muted {
  color: #8e8e8e;
  margin: 0 0 14px 0;
  font-size: 13px;
}
.muted-small {
  color: #8e8e8e;
  font-size: 12px;
  font-weight: 400;
}

/* === chips (categories, sidebar nav) === */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chip {
  background: white;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  color: #262626;
  font-family: inherit;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: all 0.15s;
}
.chip::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c7c7c7;
  flex-shrink: 0;
}
.chip:hover:not(.disabled):not(.active) { background: #fafafa; }
.chip.active {
  background: #efefef;
  color: #262626;
  border-color: #efefef;
  font-weight: 600;
}
.chip.active::before { background: #0095f6; }
.chip.disabled {
  color: #c7c7c7;
  cursor: not-allowed;
  background: transparent;
}
.chip.disabled::before { background: #dbdbdb; }

/* === fields === */
.field { margin-bottom: 12px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 5px;
  color: #262626;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fafafa;
  transition: all 0.15s;
}
.field textarea {
  resize: vertical;
  min-height: 56px;
  line-height: 1.5;
}
.field select { cursor: pointer; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: #262626;
  background: white;
}

/* === buttons === */
.btn-primary {
  background: #0095f6;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  margin-top: 10px;
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: #1877f2; }
.btn-primary:disabled {
  background: #b2dffc;
  cursor: not-allowed;
}
.btn-secondary {
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  color: #262626;
  transition: all 0.15s;
}
.btn-secondary:hover:not(:disabled) {
  background: #fafafa;
  border-color: #8e8e8e;
}
.btn-secondary:disabled {
  color: #c7c7c7;
  border-color: #efefef;
  cursor: not-allowed;
}

/* === channel grid (screen 1) === */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.channel-card {
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
}
/* 대표 썸네일 — 주인공 시트의 상단(얼굴·상반신) 위주로 크롭 */
.channel-card-thumb {
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  border-radius: 12px;
  overflow: hidden;
  background: #f3effc;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ececec;
}
/* 백엔드가 이미 얼굴~상반신 정사각으로 잘라줌 — 그대로 채우기만 */
.channel-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.channel-thumb-ph { font-size: 30px; opacity: 0.45; }
.channel-card-info {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  flex: 1;
}
.channel-card-headline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.channel-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.channel-card-style {
  margin: 0;
  font-size: 13px;
  color: #262626;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
/* 그림 스타일 칩 — 영어 프롬프트 대신 한글 프리셋 이름을 부드러운 알약 모양으로 */
.channel-card-stylechip {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: #6d4bd8;
  background: #f3effc;
  border: 1px solid #e4dbf7;
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: -0.2px;
}
.channel-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  font-size: 12px;
  color: #8e8e8e;
  margin-top: auto;
}
.channel-card-meta .ccm-item { white-space: nowrap; }
.channel-card { position: relative; }
.channel-card .btn-secondary {
  align-self: flex-start;
  margin-top: 2px;
}
.channel-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: white;
  border: 1px solid #efefef;
  color: #8e8e8e;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 0;
  transition: all 0.15s;
  opacity: 0.5;
}
.channel-card:hover .channel-delete-btn { opacity: 1; }
.channel-delete-btn:hover {
  background: #ed4956;
  color: white;
  border-color: #ed4956;
}
/* 육아 채널 카드 삭제 버튼 — 호버 시 빨강 */
.channel-card-delete { transition: background 0.15s, color 0.15s; }
.channel-card-delete:hover {
  background: #ef4444 !important;
  color: white !important;
}

/* 위험 버튼 (삭제 확인) */
.btn-danger {
  background: #ed4956;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover:not(:disabled) { background: #c63846; }
.btn-danger:disabled { background: #f5b3b8; cursor: not-allowed; }

/* === entity grid (characters, locations) === */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.entity-grid:empty + .empty-inline,
.entity-empty {
  color: #8e8e8e;
  font-size: 13px;
  padding: 8px 4px;
}
.entity-card {
  position: relative;
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 12px 14px 12px 12px;
  background: #fafafa;
}
.entity-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
}
.entity-edit,
.entity-delete {
  background: none;
  border: none;
  color: #c7c7c7;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 0;
  transition: all 0.15s;
}
.entity-delete { font-size: 16px; }
.entity-edit:hover { background: #0095f6; color: white; }
.entity-delete:hover { background: #ed4956; color: white; }
.entity-title {
  font-weight: 600;
  margin-bottom: 2px;
  font-size: 14px;
  padding-right: 22px;
}
.entity-meta {
  font-size: 12px;
  color: #8e8e8e;
  margin-bottom: 6px;
}
.entity-row {
  font-size: 13px;
  margin-top: 3px;
  word-break: keep-all;
}
.entity-row strong {
  color: #8e8e8e;
  font-weight: 500;
  margin-right: 4px;
}

/* === sheet area (inside entity card) === */
.sheet-area {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #efefef;
}
.sheet-thumb-link {
  display: block;
  margin-bottom: 8px;
}
.sheet-thumb {
  width: 100%;
  border-radius: 6px;
  display: block;
  background: white;
  border: 1px solid #efefef;
}
.sheet-thumb-empty {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px dashed #dbdbdb;
  border-radius: 6px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c7c7c7;
  font-size: 12px;
  margin-bottom: 8px;
}
.sheet-thumb-empty.loc { aspect-ratio: 16 / 9; }
.sheet-loading {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #efefef;
  border-radius: 6px;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8e8e8e;
  font-size: 12px;
  gap: 10px;
  margin-bottom: 8px;
  text-align: center;
  padding: 12px;
}
.sheet-loading.loc { aspect-ratio: 16 / 9; }
.sheet-loading .loading-dark {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #c7c7c7;
  border-top-color: #262626;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.sheet-btn {
  width: 100%;
  text-align: center;
}

/* === section header (inside channel detail / screen 2) === */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}
.section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #262626;
}
.style-text {
  margin: 0;
  padding: 12px 14px;
  background: #fafafa;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: keep-all;
}

/* === empty state === */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #8e8e8e;
  font-size: 14px;
}

/* === checkbox group (step 2 캐릭터 선택) === */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid #efefef;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: all 0.15s;
}
.checkbox-item:hover { background: white; border-color: #dbdbdb; }
.checkbox-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  accent-color: #0095f6;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.checkbox-item:has(input:checked) {
  background: #e8f4fd;
  border-color: #0095f6;
}

/* === result list === */
.result-list {
  margin: 6px 0 6px;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px 12px;
}
.result-list dt {
  color: #8e8e8e;
  font-size: 13px;
  font-weight: 500;
}
.result-list dd {
  margin: 0;
  font-size: 14px;
  word-break: keep-all;
}
#idea-title { font-size: 19px; }

/* === section (inside result card) === */
.section { margin-top: 16px; }
.section h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #8e8e8e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.script-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: keep-all;
}
.beats {
  margin: 0;
  padding-left: 18px;
}
.beats li { margin-bottom: 4px; }

.cards-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sub-card {
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafafa;
}
.sub-card-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 14px;
}
.sub-card-meta {
  font-size: 12px;
  color: #8e8e8e;
  margin-bottom: 4px;
}
.sub-card-row {
  font-size: 13px;
  margin-top: 2px;
}
.sub-card-row strong {
  color: #8e8e8e;
  font-weight: 500;
  margin-right: 4px;
}
.next-step-hint {
  margin-top: 18px;
  padding: 10px 12px;
  background: #fafafa;
  border-radius: 8px;
  font-size: 12px;
  color: #8e8e8e;
}

/* === 채널 상세: 에피소드 목록 === */
.btn-new-episode-inline {
  width: auto;
  margin-top: 0;
  padding: 8px 14px;
  font-size: 13px;
}
.episode-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.episode-list:empty::after {
  content: '아직 만든 에피소드가 없어요. + 새 에피소드 만들기 로 시작해보세요.';
  display: block;
  color: #8e8e8e;
  font-size: 13px;
  padding: 12px 0 0;
}
.episode-card {
  display: flex;
  gap: 12px;
  border: 1px solid #efefef;
  border-radius: 10px;
  background: #fafafa;
  padding: 12px 14px;
  align-items: center;
  transition: all 0.15s;
}
.episode-card:hover {
  background: white;
  border-color: #dbdbdb;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.episode-thumb {
  width: 56px;
  height: 70px;
  border-radius: 6px;
  background: #efefef;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c7c7c7;
  font-size: 22px;
}
.episode-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.episode-title {
  font-weight: 600;
  font-size: 14px;
  color: #262626;
  word-break: keep-all;
}
.episode-meta {
  font-size: 12px;
  color: #8e8e8e;
}
.episode-mini-progress {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}
.episode-step-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #efefef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #b2b2b2;
  font-weight: 600;
  letter-spacing: -0.5px;
}
.episode-step-dot.done {
  background: #edf7ee;
  color: #2e7d32;
}
.episode-step-dot.done::after { content: '✓'; font-size: 10px; }
.episode-step-dot.done .step-num-label { display: none; }
.episode-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.episode-actions .btn-continue {
  background: #262626;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.episode-actions .btn-continue:hover { background: #000; }
.episode-actions .btn-delete-episode {
  background: none;
  border: none;
  color: #c7c7c7;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  font-family: inherit;
}
.episode-actions .btn-delete-episode:hover { color: #ed4956; }

/* 사이드바 하단 휴지통 버튼 (도구모음 밖, 별도) */
.sidebar-trash-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #ececec;
  border-radius: 10px;
  background: #fff;
  color: #8e8e8e;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.sidebar-trash-btn:hover { background: #fafafa; color: #ed4956; border-color: #f3c4cc; }

/* 전역 휴지통 */
.trash-list { display: flex; flex-direction: column; }
.trash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 6px;
  border-bottom: 1px solid #f2f2f2;
}
.trash-item:last-child { border-bottom: none; }
.trash-item-main { display: flex; align-items: center; gap: 9px; min-width: 0; flex-wrap: wrap; }
.trash-type-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef1f5;
  color: #5a6573;
}
.trash-type-badge.type-insta_toon { background: #fdeef3; color: #c2487c; }
.trash-type-badge.type-economy { background: #eaf6ee; color: #2f8a52; }
.trash-type-badge.type-parenting { background: #fff2e2; color: #b3691a; }
.trash-type-badge.type-parenting2 { background: #eef0ff; color: #5a52b5; }
.trash-item-title { font-size: 14px; font-weight: 600; color: #333; }
.trash-item-meta { font-size: 11.5px; color: #b0306a; }
.trash-item-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.trash-restore {
  border: 1px solid #cdd9f5; background: #f3f6ff; color: #2b4a9c;
  border-radius: 7px; padding: 5px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.trash-restore:hover { background: #e7eeff; }
.trash-purge {
  border: none; background: none; color: #c7c7c7; cursor: pointer;
  font-size: 12px; font-family: inherit; padding: 5px 6px;
}
.trash-purge:hover { color: #ed4956; }

@media (max-width: 600px) {
  .episode-card { flex-wrap: wrap; }
  .episode-info { width: 100%; }
  .episode-thumb { width: 44px; height: 56px; }
}

/* === Stage 03 패널 리스트 === */
.panels-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-card {
  border: 1px solid #efefef;
  border-radius: 10px;
  background: #fafafa;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* 패널 사이 '여기에 추가' 구분선 */
.panel-insert-divider {
  text-align: center;
  padding: 1px 0;
}
.panel-insert-divider .panel-insert-toggle {
  font-size: 12px;
  opacity: 0.55;
}
.panel-insert-divider .panel-insert-toggle:hover { opacity: 1; }
.panel-insert-form {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 4px 0 6px;
}
.panel-insert-form .panel-insert-brief {
  flex: 1;
  padding: 6px 9px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
}
.panel-delete { color: #dc2626; }
.panel-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.panel-num {
  background: #262626;
  color: white;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}
.panel-camera {
  background: #e8f4fd;
  color: #1877f2;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.panel-emotion {
  background: #fff3e0;
  color: #b85a00;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.panel-location {
  font-size: 12px;
  color: #8e8e8e;
  margin-left: auto;
}
.panel-moment {
  font-size: 13px;
  font-weight: 600;
  color: #262626;
  margin-top: 2px;
}
.panel-scene {
  font-size: 13px;
  color: #262626;
  line-height: 1.55;
  word-break: keep-all;
}
/* 패널별 보기/편집 토글 — 평소엔 일반 텍스트, [✏️ 수정] 누르면 편집칸 */
.panel-edit { display: none; }
.panel-card.editing .panel-edit { display: block; }
.panel-card.editing .panel-view { display: none; }
.panel-edit-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.panel-prompt-text {
  font-size: 12px;
  color: #555;
  line-height: 1.5;
  word-break: break-word;
  background: #fafafa;
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 8px 10px;
}
.btn-text {
  background: none;
  border: none;
  color: #8e8e8e;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  padding: 4px 6px;
}
.btn-text:hover { color: #262626; }

/* 패널별 직접 수정 UI (콘티·대본) */
.panel-edit-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #8e8e8e;
  margin: 8px 0 3px;
}
.panel-moment-edit, .panel-scene-edit {
  width: 100%;
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
  color: #262626;
  box-sizing: border-box;
  resize: vertical;
}
.panel-moment-edit:focus, .panel-scene-edit:focus,
.bubble-text-edit:focus { outline: none; border-color: #0095f6; }
.panel-storyboard-save, .panel-dialogue-save { margin-top: 8px; }
.bubble-text-edit {
  flex: 1;
  min-width: 120px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
  color: #262626;
}
.btn-mini.panel-ai-regen, .btn-mini.panel-script-regen {
  margin-left: auto;
  border: 1px solid #d6c4f5;
  background: #f6f1ff;
  color: #5b3aa6;
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-mini.panel-ai-regen:hover, .btn-mini.panel-script-regen:hover { background: #ece2ff; }
.panel-chars {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.panel-char-tag {
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 11px;
  color: #262626;
}

/* === Stage 04 대본 (image_prompt + bubbles) === */
.panel-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #efefef;
}
.panel-section-label {
  font-size: 11px;
  color: #8e8e8e;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.panel-image-prompt {
  background: white;
  border: 1px solid #efefef;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, "Menlo", "Consolas", monospace;
  font-size: 12px;
  color: #262626;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.panel-bubbles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bubble-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.bubble-badge {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.bubble-badge.speech { background: #e8f4fd; color: #1877f2; }
.bubble-badge.thought { background: #f3e8fd; color: #7c3aed; }
.bubble-badge.shout { background: #fde2e1; color: #d32f2f; }
.bubble-badge.narration { background: #f0f0f0; color: #555; }
.bubble-badge.caption_strip { background: #fff8e1; color: #b85a00; }
.bubble-badge.sfx { background: #fff3e0; color: #e65100; font-style: italic; }
.bubble-speaker {
  color: #8e8e8e;
  font-size: 12px;
  margin-right: 4px;
}
.bubble-speaker::after { content: ' ·'; }
.bubble-text {
  color: #262626;
  word-break: keep-all;
}
.bubble-text.emphasis {
  font-weight: 700;
}
.bubble-position {
  margin-left: auto;
  font-size: 10px;
  color: #b2b2b2;
  flex-shrink: 0;
}

/* === Stage 05 컨트롤 바 (시작/일시정지/재개/중지 + 남은 비용) === */
.image-result-banner {
  margin: 10px 0 2px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}
.image-result-banner.success {
  background: #e8f7ee;
  border: 1px solid #b6e6c8;
  color: #1f7a44;
}
.image-result-banner.warn {
  background: #fff4e5;
  border: 1px solid #ffd8a8;
  color: #b3540a;
}
.image-result-banner.warn b { color: #d6360b; }
.image-result-banner #btn-retry-failed-panels {
  margin-left: 8px;
  border: 1px solid #ffb155;
  background: #fff;
  color: #b3540a;
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.image-result-banner #btn-retry-failed-panels:hover { background: #fff0db; }

.image-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid #efefef;
  border-radius: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.image-control-info {
  font-size: 13px;
  color: #262626;
}
.image-control-info strong { font-weight: 700; }
.image-control-status {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.image-control-status.running { background: #e8f4fd; color: #1877f2; }
.image-control-status.paused { background: #fff3e0; color: #b85a00; }
.image-control-status.completed { background: #edf7ee; color: #2e7d32; }
.image-control-status.error { background: #fde2e1; color: #d32f2f; }
.image-control-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.image-model-pick {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: #444; font-weight: 600;
  padding: 4px 8px; background: #f6f8fa; border-radius: 8px; margin-right: 4px;
}
.image-model-label { color: #666; }
/* 모델 선택 토글 — 드롭다운 대신 클릭 버튼 2개 */
.model-toggle { display: inline-flex; gap: 4px; }
.model-toggle-btn {
  border: 1px solid #d0d7de; background: #fff; color: #555;
  padding: 5px 12px; font-size: 13px; font-weight: 600; border-radius: 7px;
  cursor: pointer; font-family: inherit; transition: background .12s, color .12s, border-color .12s;
}
.model-toggle-btn:hover { background: #eef1f4; }
.model-toggle-btn.active {
  background: #0095f6; color: #fff; border-color: #0095f6;
}
/* 선택된 버튼에 체크표시 — 파란색만으론 선택 여부 구분이 어려워서 ✓ 를 앞에 붙임 */
.model-toggle-btn.active::before { content: "✓ "; font-weight: 800; }
.narration-font-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #555;
}
.narration-font-control select {
  padding: 7px 8px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  max-width: 160px;
}
.narration-font-control select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 콘티 안의 스크립트 접이식 */
.script-collapse {
  margin-top: 16px;
  border-top: 1px solid #efefef;
  padding-top: 12px;
}
.script-collapse > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #6b6b6b;
  list-style: none;
  padding: 6px 0;
}
.script-collapse > summary::-webkit-details-marker { display: none; }
.script-collapse > summary::before { content: '▸ '; }
.script-collapse[open] > summary::before { content: '▾ '; }
.script-collapse > summary:hover { color: #262626; }
.script-collapse .script-feedback {
  margin-top: 8px;
  background: #fafafa;
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 10px;
}

/* 표지(썸네일) 카드 */
.cover-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cover-controls #cover-highlight {
  flex: 1;
  min-width: 200px;
  padding: 9px 11px;
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}
.cover-controls .btn-primary {
  width: auto;
  margin-top: 0;
  padding: 9px 16px;
  font-size: 13px;
  white-space: nowrap;
}
/* 표지 고급 옵션 — 하이라이트(표정) 직접 지정. 평소엔 접혀 있음. */
.cover-advanced {
  margin-bottom: 12px;
}
.cover-advanced > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.cover-advanced > summary::-webkit-details-marker { display: none; }
.cover-advanced #cover-highlight {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}
.cover-from-panel {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cover-from-panel select {
  padding: 7px 9px;
  border: 1px solid #dbdbdb;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  background: white;
}
.cover-from-panel .btn-secondary {
  width: auto;
  margin-top: 0;
  padding: 7px 12px;
  font-size: 13px;
}
.cover-preview-wrap {
  background: #fafafa;
  border: 1px solid #efefef;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 120px;
}
.cover-preview-wrap img {
  max-width: 320px;
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.cover-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.cover-actions .btn-secondary {
  width: auto;
  margin-top: 0;
  padding: 8px 14px;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.image-control-buttons .btn-primary,
.image-control-buttons .btn-secondary {
  width: auto;
  margin-top: 0;
  padding: 8px 14px;
  font-size: 13px;
}

/* === Stage 05 / 06 패널 이미지 그리드 === */
/* 미리보기가 또렷하게 보이도록 카드 자체를 키움.
   - 데스크탑: auto-fill 로 280~360px 사이에서 2~3열
   - 태블릿: minmax 가 자연스럽게 2열
   - 모바일은 아래 @media (max-width: 768px) 에서 1열로 (가장 크게) */
.image-panels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.image-panel {
  position: relative;
  border: 1px solid #efefef;
  border-radius: 10px;
  background: #fafafa;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.image-panel-thumb {
  width: 100%;
  aspect-ratio: 4 / 5;
  min-height: 280px;          /* 카드가 너무 작아져 흐릿해지는 케이스 방어 */
  background: white;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c7c7c7;
  font-size: 12px;
  cursor: default;
}
.image-panel-thumb.done {
  cursor: zoom-in;
  background: #fff;
}
.image-panel-thumb.done:hover { opacity: 0.92; }
.image-panel-thumb img {
  width: 100%;
  height: 100%;
  /* contain — 1080×1350 원본 비율 유지, 잘림/뭉개짐 없이 부드럽게 축소 */
  object-fit: contain;
  display: block;
  /* 기본 보간 (auto). pixelated 같은 강제 보간 모드를 쓰지 않음 — 부드럽게 */
  image-rendering: auto;
  /* contain 여백은 흰색 — 실제 익스포트(1080×1350)도 흰 여백으로 정규화하므로 동일하게 보이도록.
     (모델이 4:5 와 살짝 다른 비율로 그릴 때 좌우/상하에 검은 띠가 보이던 문제 해결) */
  background: #fff;
}
.image-panel-thumb-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #8e8e8e;
  font-size: 11px;
  text-align: center;
  padding: 12px;
}
.image-panel-thumb-state .loading-dark {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid #c7c7c7;
  border-top-color: #262626;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.image-panel-thumb.error {
  background: #fff5f5;
  border-color: #ed4956;
}
.image-panel-thumb.error .image-panel-thumb-state {
  color: #ed4956;
}
.image-panel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  font-size: 11px;
  background: white;
  border-top: 1px solid #efefef;
  gap: 6px;
}
.image-panel-num {
  font-weight: 600;
  color: #262626;
}
.image-panel-regen {
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  color: #262626;
  transition: all 0.15s;
}
.image-panel-regen:hover:not(:disabled) { background: #fafafa; border-color: #8e8e8e; }
.image-panel-regen:disabled { color: #c7c7c7; cursor: not-allowed; }

/* === 패널 편집 모달 — 화면을 거의 가득 채우는 큰 모달 === */
/* !important — 베이스 .modal 의 max-width: 480px 가 캐시되거나 우회되는 케이스 방어 */
.modal-edit {
  max-width: 1600px !important;
  width: 95vw !important;
  height: 90vh !important;
  max-height: 90vh !important;
  min-width: 800px;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  /* 우측 하단 corner 드래그로 사용자 리사이즈 — overflow auto/hidden 가 있어야 동작 */
  resize: both;
  overflow: hidden;
}
.modal-edit .modal-header { flex-shrink: 0; }
.modal-edit .modal-footer { flex-shrink: 0; }
.modal-edit .modal-close {
  width: 36px;
  height: 36px;
  font-size: 22px;
  background: #fafafa;
  border: 1px solid #dbdbdb;
}
.modal-edit .modal-close:hover { background: #ed4956; color: white; border-color: #ed4956; }
.image-panel-actions {
  display: flex;
  gap: 4px;
}
.image-panel-edit {
  background: #f3e8fd;
  border: 1px solid #d6c8ff;
  color: #6b46c1;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.image-panel-edit:hover:not(:disabled) {
  background: #ede8ff;
  border-color: #b794f6;
}
.image-panel-edit:disabled { color: #c7c7c7; background: #fafafa; border-color: #efefef; cursor: not-allowed; }

.edit-body {
  flex: 1;
  display: grid;
  grid-template-columns: 65fr 35fr;
  gap: 18px;
  padding: 16px 20px;
  min-height: 0; /* flex parent 안에서 children 의 overflow 가 동작하게 */
  overflow: hidden;
}
/* 좌측 — 미리보기: 컬럼을 가득 채우고 이미지는 contain 으로 비율 유지 */
.edit-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}
.edit-preview-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
  user-select: none;
  /* 이미지 비율은 onload 에서 aspectRatio 인라인 스타일로 세팅 — 기본 4:5 */
  aspect-ratio: 4 / 5;
  margin: 0 auto;
  max-width: 100%;
  max-height: 100%;
}
.edit-preview-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.edit-preview-hint {
  margin: 0;
  font-size: 12px;
  color: #8e8e8e;
  display: flex;
  align-items: center;
  gap: 6px;
}
.edit-preview-loading { color: #0095f6; font-weight: 600; }

/* 드래그 가능한 말풍선 핸들 — 미리보기 이미지 위에 absolute 배치 */
/* 말풍선 직접 드래그용 투명 오버레이 박스 — 합성된 이미지 위에 정확한 영역에 배치 */
.bubble-overlay {
  position: absolute;
  cursor: grab;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 6px;
  transition: background 0.1s, border-color 0.1s;
  user-select: none;
  touch-action: none;
  box-sizing: border-box;
}
.bubble-overlay:hover {
  background: rgba(0, 149, 246, 0.08);
  border-color: rgba(0, 149, 246, 0.6);
}
.bubble-overlay.dragging {
  cursor: grabbing;
  background: rgba(237, 73, 86, 0.15);
  border-color: #ed4956;
  border-style: dashed;
  z-index: 10;
}
/* 드래그 중: 베이크된 원본 글자는 살짝 페이드 → 따라오는 글자가 도드라지게 */
.edit-preview-wrap.live-dragging .edit-preview-img { opacity: 0.45; transition: opacity 0.1s; }
/* 드래그 중 오버레이가 들고 다니는 글자 (서버 왕복 없이 즉시 이동) */
.bubble-overlay__ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  box-sizing: border-box;
  color: #1a1a1a;
  font-weight: 700;
  line-height: 1.2;
  white-space: pre-wrap;
  overflow: hidden;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff;
  pointer-events: none;
}
.bubble-overlay.focused {
  background: rgba(237, 73, 86, 0.08);
  border-color: #ed4956;
}
/* 좌측 상단 번호 칩 — 어느 말풍선인지 식별 (호버 시만 표시) */
.bubble-overlay::before {
  content: attr(data-num);
  position: absolute;
  top: -10px;
  left: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 149, 246, 0.95);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.bubble-overlay:hover::before,
.bubble-overlay.focused::before,
.bubble-overlay.dragging::before {
  opacity: 1;
}
.bubble-overlay.focused::before,
.bubble-overlay.dragging::before {
  background: #ed4956;
}

/* === 리사이즈 핸들 (말풍선 박스 크기 조절) === */
.resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: white;
  border: 2px solid #0095f6;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s, transform 0.05s;
}
.bubble-overlay:hover .resize-handle,
.bubble-overlay.focused .resize-handle,
.bubble-overlay.resizing .resize-handle {
  opacity: 1;
  pointer-events: auto;
}
.resize-handle.focused-handle,
.resize-handle:hover {
  background: #0095f6;
  transform: scale(1.2);
}
.bubble-overlay.focused .resize-handle { border-color: #ed4956; }
.bubble-overlay.focused .resize-handle:hover { background: #ed4956; }

.resize-handle.nw { top: -6px;     left: -6px;   cursor: nwse-resize; }
.resize-handle.ne { top: -6px;     right: -6px;  cursor: nesw-resize; }
.resize-handle.sw { bottom: -6px;  left: -6px;   cursor: nesw-resize; }
.resize-handle.se { bottom: -6px;  right: -6px;  cursor: nwse-resize; }
.resize-handle.n  { top: -6px;     left: 50%;    transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.s  { bottom: -6px;  left: 50%;    transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.w  { left: -6px;    top: 50%;     transform: translateY(-50%); cursor: ew-resize; }
.resize-handle.e  { right: -6px;   top: 50%;     transform: translateY(-50%); cursor: ew-resize; }
/* hover scale 적용 시 base translate 유지 */
.resize-handle.n:hover { transform: translateX(-50%) scale(1.2); }
.resize-handle.s:hover { transform: translateX(-50%) scale(1.2); }
.resize-handle.w:hover { transform: translateY(-50%) scale(1.2); }
.resize-handle.e:hover { transform: translateY(-50%) scale(1.2); }

/* 우측 말풍선 편집 카드 리스트 — 영역 안에서 세로 스크롤 */
/* 표지 제목 추천 — 편집기에서 5개 제목 칩 */
.cover-title-suggest {
  background: #f6f4ff; border: 1px solid #e3dcff; border-radius: 10px; padding: 10px 12px;
}
.cover-title-suggest-head {
  font-size: 13px; font-weight: 700; color: #5b3fd6; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cover-title-refresh { margin-left: auto; font-size: 12px; }
.cover-title-suggest-list { display: flex; flex-direction: column; gap: 6px; }
.cover-title-chip {
  text-align: left; padding: 9px 12px; border: 1px solid #d9cffb; background: #fff;
  border-radius: 8px; font-size: 14px; font-weight: 600; color: #2a2a2a; cursor: pointer;
  font-family: inherit; line-height: 1.35; transition: background .12s, border-color .12s;
}
.cover-title-chip:hover { background: #efeaff; border-color: #8b6df0; }
.edit-bubbles-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.bubble-edit-card {
  border: 1px solid #efefef;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bubble-edit-card.focused {
  border-color: #ed4956;
  background: #fff5f5;
}
.bubble-edit-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}
.bubble-edit-header .bubble-idx {
  background: #0095f6;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.bubble-edit-header .bubble-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: #ed4956;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  padding: 2px 6px;
}
.bubble-edit-header .bubble-delete:hover { background: #fde2e1; border-radius: 4px; }
.bubble-edit-row { display: flex; flex-direction: column; gap: 3px; }
.bubble-edit-row label {
  font-size: 11px;
  color: #8e8e8e;
  font-weight: 500;
}
.bubble-edit-row input[type="text"],
.bubble-edit-row textarea,
.bubble-edit-row select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: white;
}
.bubble-edit-row textarea { resize: vertical; min-height: 44px; }
.bubble-edit-row input[type="range"] { width: 100%; }

/* 리치 텍스트 에디터 (contenteditable) + 서식 툴바 */
.bub-fmt-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}
.fmt-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: #262626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.fmt-btn:hover { background: #f0f0f0; }
.fmt-btn:active { background: #e4e4e4; }
.fmt-color-wrap {
  position: relative;
  width: 26px;
  height: 26px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fmt-color-swatch {
  font-size: 13px;
  font-weight: 700;
  color: #e23b3b;
  pointer-events: none;
}
.fmt-color {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  cursor: pointer;
}
.bub-text[contenteditable] {
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: white;
  line-height: 1.5;
  outline: none;
  word-break: break-all;
}
.bub-text[contenteditable]:focus { border-color: #a8a8ff; }
.bub-text[contenteditable]:empty::before {
  content: '대사 / 나레이션 입력';
  color: #c7c7c7;
}
.bubble-edit-row-inline { display: flex; align-items: center; gap: 8px; }
.bubble-edit-row-inline .range-val {
  font-size: 11px;
  color: #262626;
  font-weight: 600;
  min-width: 38px;
  text-align: right;
}
/* 폰트 크기 +/− 스테퍼 (슬라이더 대체) */
.bub-fontsize-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.bub-fontsize-stepper button {
  width: 30px;
  height: 28px;
  border: none;
  background: #fafafa;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: #262626;
  line-height: 1;
  padding: 0;
}
.bub-fontsize-stepper button:hover { background: #efefef; }
.bub-fontsize-stepper button:active { background: #e2e2e2; }
.bub-font-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.bub-font-row .bub-font { flex: 1; min-width: 0; }
.bub-font-upload {
  flex: 0 0 auto;
  white-space: nowrap;
  border: 1px solid #d6c4f5;
  background: #f6f1ff;
  color: #5b3aa6;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.bub-font-upload:hover { background: #ece2ff; }
.bub-fs-input {
  width: 54px;
  height: 28px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #262626;
  border: none;
  border-left: 1px solid #ececec;
  border-right: 1px solid #ececec;
  padding: 0 4px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.bub-fs-input::-webkit-outer-spin-button,
.bub-fs-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bub-fs-input:focus { outline: none; background: #fffbe6; }
.bubble-edit-pos {
  font-size: 11px;
  color: #8e8e8e;
  background: #f0f0f0;
  border-radius: 4px;
  padding: 3px 6px;
  display: inline-block;
}
.bubble-edit-card .bubble-edit-row:has(.bub-size-reset) {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}
.bub-size-reset {
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  color: #262626;
  transition: all 0.15s;
}
.bub-size-reset:hover:not(:disabled) { background: #fafafa; border-color: #8e8e8e; }
.bub-size-reset:disabled { color: #c7c7c7; cursor: not-allowed; }
.edit-add-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.edit-add-bubble {
  flex: 1 1 0;
  background: white;
  border: 1px dashed #dbdbdb;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: #0095f6;
  transition: all 0.15s;
}
.edit-add-bubble:hover { background: #f7fbff; border-color: #0095f6; }
#btn-add-narration { color: #b8860b; }
#btn-add-narration:hover { background: #fcf8e6; border-color: #b8860b; }

@media (max-width: 880px) {
  .modal-edit {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    min-width: 0;
    border-radius: 0;
    resize: none;
  }
  .edit-body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    overflow-y: auto;
  }
  .edit-preview-wrap { max-height: 50vh; }
  .edit-bubbles-panel { overflow-y: visible; }
}

/* 이미지 미리보기 모달 */
.image-preview-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-preview-content img {
  max-width: 100%;
  max-height: 90vh;
  display: block;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.image-preview-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 50%;
  font-size: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

/* 이미지 미리보기 — 갤러리 네비게이션 (이전/다음 + 카운터) */
.image-preview-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s;
}
.image-preview-nav:hover { background: rgba(0, 0, 0, 0.8); }
.image-preview-nav.prev { left: 24px; }
.image-preview-nav.next { right: 24px; }
.image-preview-counter {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  z-index: 2;
}
@media (max-width: 768px) {
  .image-preview-nav { width: 44px; height: 44px; font-size: 28px; }
  .image-preview-nav.prev { left: 8px; }
  .image-preview-nav.next { right: 8px; }
}

/* === 경제 페이지 미리보기 카드 — 클릭 가능 표시 === */
.econ-page-preview-thumb {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.econ-page-preview-thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.econ-page-preview-thumb.empty { cursor: default; }
.econ-page-preview-thumb.empty:hover { transform: none; box-shadow: none; }

/* === modal === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  animation: fadeIn 0.12s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: popIn 0.15s ease-out;
}
@keyframes popIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #efefef;
}
.modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: #8e8e8e;
  line-height: 1;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.modal-close:hover { background: #fafafa; color: #262626; }
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #efefef;
}
.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  width: auto;
  margin-top: 0;
}

/* === Stage 07 캡션 === */
.caption-options {
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 8px 0 12px;
  background: #fafafa;
}
.caption-options summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #262626;
  padding: 4px 0;
}
.caption-options > .field-row,
.caption-options > .field { margin-top: 10px; }

.caption-save-status {
  margin-left: auto;
  color: #2e7d32;
}
.caption-save-status.saving { color: #1877f2; }
.caption-save-status.error { color: #ed4956; }

.caption-layout {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 16px;
  margin-top: 8px;
}
.caption-main { min-width: 0; }
.caption-main textarea {
  font-size: 14px;
  line-height: 1.6;
  font-family: inherit;
}
.caption-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.caption-copy-btn {
  width: 100%;
  margin-top: 0;
  padding: 10px 12px;
  font-size: 13px;
}

.hashtag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  background: white;
  min-height: 44px;
}
.hashtag-chip {
  background: #e8f4fd;
  color: #1877f2;
  border: 1px solid #cfe6ff;
  border-radius: 14px;
  padding: 4px 10px 4px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.1s;
}
.hashtag-chip:hover {
  background: #ed4956;
  color: white;
  border-color: #ed4956;
}
.hashtag-chip::after { content: '×'; font-size: 13px; opacity: 0.7; }
.hashtag-add-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.hashtag-add-row input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
}
.hashtag-add-row .btn-secondary {
  margin-top: 0;
  padding: 6px 12px;
  font-size: 12px;
}

.caption-alts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.caption-alt-card {
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafafa;
  cursor: pointer;
  transition: all 0.15s;
}
.caption-alt-card:hover {
  border-color: #0095f6;
  background: white;
}
.caption-alt-tone {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #0095f6;
  background: #e8f4fd;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
}
.caption-alt-text {
  font-size: 13px;
  color: #262626;
  line-height: 1.5;
  word-break: keep-all;
}

@media (max-width: 760px) {
  .caption-layout {
    grid-template-columns: 1fr;
  }
}

/* === toast — 화면 우측 상단 === */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #262626;
  color: white;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 1000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  max-width: min(90vw, 420px);
  animation: toast-slide-in 0.18s ease-out;
}
@keyframes toast-slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.hidden { display: none !important; }

/* === modal-wide (preset 그리드용 넓은 모달) === */
.modal-wide { max-width: 720px; }

/* === preset 그리드 (채널 만들기 1단계) === */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}
.preset-card {
  border: 2px solid #dbdbdb;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.preset-card:hover {
  border-color: #b2dffc;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.preset-card.selected {
  border-color: #0095f6;
  box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.15);
}
.preset-card-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fafafa;
  display: block;
  object-fit: cover;
}
.preset-card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c7c7c7;
  font-size: 36px;
  border-bottom: 1px dashed #dbdbdb;
}
.preset-card-thumb-placeholder.missing {
  font-size: 11px;
  letter-spacing: 0.2px;
  text-align: center;
  padding: 8px;
}
.preset-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.preset-card-name {
  font-weight: 600;
  font-size: 13px;
  color: #262626;
  line-height: 1.3;
}
.preset-card-desc {
  font-size: 12px;
  color: #8e8e8e;
  line-height: 1.4;
}
.preset-card-refs {
  font-size: 11px;
  color: #b2b2b2;
  margin-top: 2px;
  line-height: 1.3;
}
.preset-card.custom {
  border-style: dashed;
  background: #fafafa;
}
.preset-card.custom:hover {
  background: #f0f0f0;
  border-color: #8e8e8e;
}
.preset-card.custom .preset-card-thumb-placeholder {
  background: #fafafa;
  border-bottom: 1px dashed #dbdbdb;
  font-size: 28px;
}

/* preset 배너 (2단계 상단 — 선택한 프리셋 표시) */
.preset-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f7fbff;
  border: 1px solid #cfe6ff;
  border-radius: 8px;
  margin-bottom: 14px;
}
.preset-banner-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #fafafa;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #8e8e8e;
}
.preset-banner-text { flex: 1; min-width: 0; }
.preset-banner-name { font-weight: 600; font-size: 13px; color: #262626; }
.preset-banner-desc { font-size: 12px; color: #8e8e8e; }
.preset-banner-change {
  background: none;
  border: none;
  color: #0095f6;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 6px;
}
.preset-banner-change:hover { text-decoration: underline; }

/* modal-footer 안의 step별 그룹 (양쪽 정렬 위해) */
.modal-footer-step {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}
.modal-footer-step .btn-primary,
.modal-footer-step .btn-secondary {
  width: auto;
  margin-top: 0;
}

/* === 모달 탭 (AI 추천 / 직접 입력) === */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid #efefef;
  background: #fafafa;
}
.modal-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #8e8e8e;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.modal-tab:hover { color: #262626; background: white; }
.modal-tab.active {
  color: #262626;
  background: white;
  border-bottom-color: #0095f6;
  font-weight: 600;
}

/* === 추천 받기 버튼 === */
.btn-recommend {
  width: 100%;
  background: linear-gradient(135deg, #0095f6 0%, #1877f2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  transition: filter 0.15s;
}
.btn-recommend:hover:not(:disabled) { filter: brightness(1.05); }
.btn-recommend:disabled {
  background: #b2dffc;
  cursor: not-allowed;
}
.btn-recommend .loading {
  border-color: rgba(255, 255, 255, 0.5);
  border-top-color: transparent;
  margin-right: 0;
}

/* === 추천 카드 === */
.recommend-card {
  margin-top: 14px;
  border: 1px solid #dbdbdb;
  border-radius: 10px;
  background: white;
  overflow: hidden;
}
.recommend-content { padding: 14px 16px; }
.recommend-name {
  font-size: 18px;
  font-weight: 700;
  color: #262626;
  margin-bottom: 4px;
}
.recommend-meta {
  font-size: 12px;
  color: #8e8e8e;
  margin-bottom: 10px;
}
.recommend-section { margin-top: 10px; }
.recommend-label-row {
  font-size: 11px;
  color: #8e8e8e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 3px;
}
.recommend-text {
  font-size: 13px;
  color: #262626;
  line-height: 1.55;
  word-break: keep-all;
}
.recommend-actions {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  background: #fafafa;
  border-top: 1px solid #efefef;
}
.recommend-actions .btn-secondary,
.recommend-actions .btn-primary {
  flex: 1;
  width: auto;
  margin-top: 0;
  padding: 9px 8px;
  font-size: 12px;
}

/* === AI 보강 (enrich) === */
.enrich-row {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed #efefef;
}
.btn-enrich {
  width: 100%;
  background: linear-gradient(135deg, #f5f3ff 0%, #faf5ff 100%);
  border: 1px solid #d6c8ff;
  color: #6b46c1;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.15s;
}
.btn-enrich:hover:not(:disabled) {
  background: linear-gradient(135deg, #ede8ff 0%, #f3ebff 100%);
  border-color: #b794f6;
}
.btn-enrich:disabled {
  background: #fafafa;
  border-color: #efefef;
  color: #8e8e8e;
  cursor: not-allowed;
}
.btn-enrich .enrich-icon { font-size: 14px; }
.btn-enrich .loading-purple {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid #d6c8ff;
  border-top-color: #6b46c1;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.enrich-hint {
  margin: 6px 0 0 0;
  font-size: 11px;
  color: #8e8e8e;
  text-align: center;
}

/* === loading === */
.loading {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === responsive (mobile) === */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
    gap: 14px;
  }
  .sidebar {
    width: 100%;
    position: static;
    top: auto;
  }
  .category-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .chip {
    width: auto;
    border: 1px solid #dbdbdb;
    border-radius: 18px;
    padding: 6px 11px;
    gap: 6px;
  }
  .chip.active { border-color: #efefef; }

  .channel-grid,
  .entity-grid {
    grid-template-columns: 1fr;
  }
  .modal { max-width: none; }
  .field-row { flex-direction: column; gap: 0; }
  .preset-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .preset-card-body { padding: 8px 10px 10px; }
}

/* ============================================================ */
/* Stage 08 — 게시 준비 (Export) */
/* ============================================================ */
.export-build {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fafafa;
  border: 1px solid #efefef;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.export-build.ready {
  background: #edf7ee;
  border-color: #c8e6c9;
}
/* 영상 빌드 — ready 일 때 보라 톤으로 구분 (ZIP=초록과 헷갈리지 않게) */
.video-build.ready {
  background: #f3f0fb;
  border-color: #ddd1f3;
}
.video-build:empty { display: none; }
/* 영상 박스 — 나레이션 음성 섹션 + 영상 섹션을 세로로 */
.video-build {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.vb-narration {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #ddd1f3;
}
.vb-video {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.video-preview {
  width: 100%;
  max-width: 260px;
  border-radius: 10px;
  background: #000;
  display: block;
  aspect-ratio: 4 / 5;
}

/* 나레이션 음성 박스 */
.narration-voice:empty { display: none; }
.narration-voice {
  margin: 10px 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fbf7ff;
  border: 1px solid #e8dcff;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.nv-title { font-weight: 700; font-size: 14px; color: #5b3aa6; }
.nv-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nv-voice {
  flex: 1;
  min-width: 160px;
  height: 34px;
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  padding: 0 8px;
  background: #fff;
  font-size: 13px;
}
.nv-style {
  flex: 1;
  min-width: 200px;
  height: 34px;
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
}
.nv-btn {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #d6c4f5;
  border-radius: 8px;
  background: #fff;
  color: #5b3aa6;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.nv-btn:hover:not(:disabled) { background: #f1e9ff; }
.nv-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.nv-preview { background: #6d4bd8; color: #fff; border-color: #6d4bd8; }
.nv-preview:hover:not(:disabled) { background: #5b3aa6; }
.nv-speed-row label { font-size: 12px; color: #6b7280; }
.nv-speed-row input[type="range"] { flex: 1; min-width: 90px; max-width: 160px; }
.nv-speed-val { font-size: 12px; font-weight: 600; color: #262626; min-width: 34px; }
.export-build-info {
  flex: 1;
  min-width: 160px;
  font-size: 13px;
  color: #262626;
}
.export-build-info strong { font-weight: 700; }
.export-build-info .muted-small { display: block; margin-top: 2px; }
.export-build-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-build-export {
  background: #0095f6;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  min-height: 48px;
  transition: background 0.15s;
}
.btn-build-export:hover:not(:disabled) { background: #1877f2; }
.btn-build-export:disabled { background: #b2dffc; cursor: not-allowed; }
.btn-zip-download {
  background: #2e7d32;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  min-height: 48px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.btn-zip-download:hover { background: #246a28; }
.btn-rebuild {
  background: white;
  border: 1px solid #dbdbdb;
  color: #262626;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  min-height: 48px;
  transition: all 0.15s;
}
.btn-rebuild:hover:not(:disabled) { background: #fafafa; border-color: #8e8e8e; }
.btn-rebuild:disabled { color: #c7c7c7; cursor: not-allowed; }

.export-guide details { background: white; border: 1px solid #efefef; border-radius: 8px; padding: 10px 12px; }
.export-guide summary { cursor: pointer; font-weight: 600; font-size: 13px; color: #262626; }
.export-guide-content { margin-top: 10px; font-size: 13px; color: #262626; }
.export-guide-content strong { display: block; margin-top: 8px; margin-bottom: 4px; color: #0095f6; }
.export-guide-content ol { margin: 4px 0 8px; padding-left: 20px; line-height: 1.7; }
.export-guide-content ol:last-child { margin-bottom: 0; }

.export-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.btn-copy-big {
  background: #262626;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 16px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  min-height: 56px;
  transition: background 0.15s, transform 0.05s;
}
.btn-copy-big:hover { background: #000; }
.btn-copy-big:active { transform: scale(0.97); }
.btn-copy-all-export {
  grid-column: 1 / -1;
  background: #0095f6;
}
.btn-copy-all-export:hover { background: #1877f2; }

.export-panels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.export-panel-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid #efefef;
  border-radius: 10px;
  padding: 7px;
  background: #fafafa;
}
.export-panel-img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  cursor: zoom-in;
  background: black;
}
.export-panel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}
.export-panel-num {
  font-size: 12px;
  font-weight: 600;
  color: #262626;
}
.btn-download-panel {
  background: #0095f6;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  min-height: 44px;
  transition: background 0.15s, transform 0.05s;
}
.btn-download-panel:hover { background: #1877f2; }
.btn-download-panel:active { transform: scale(0.97); }

.export-guide {
  margin-top: 18px;
  padding: 14px 16px;
  background: #f0f7ff;
  border: 1px solid #cfe6ff;
  border-radius: 10px;
}
.export-guide h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #1877f2;
}
.export-guide ol {
  margin: 0;
  padding-left: 22px;
  font-size: 13px;
  color: #262626;
  line-height: 1.7;
}

/* ============================================================ */
/* 주식·경제 카테고리                                                */
/* ============================================================ */

/* 톤 프리셋 카드 그리드 (채널 만들기 step 1) */
.tone-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding-top: 8px;
}
.tone-preset-card {
  border: 2px solid #efefef;
  border-radius: 12px;
  padding: 14px;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tone-preset-card:hover { border-color: #0095f6; transform: translateY(-1px); }
.tone-preset-card.selected {
  border-color: var(--accent, #0095f6);
  box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.12);
}
.tone-preset-swatch {
  width: 100%;
  height: 32px;
  border-radius: 8px;
  background: var(--accent, #0095f6);
}
.tone-preset-name { font-size: 15px; font-weight: 700; color: #111; }
.tone-preset-desc { font-size: 12px; color: #6b7280; line-height: 1.35; }
.tone-preset-sig { font-size: 11px; color: var(--accent, #0095f6); font-weight: 600; }

/* 채널 step 2 의 선택된 톤 배너 */
.tone-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid #efefef;
  border-radius: 10px;
  background: #fafafa;
  margin-bottom: 12px;
}
.tone-banner-color {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
}
.tone-banner-text { flex: 1; min-width: 0; }
.tone-banner-name { font-weight: 700; font-size: 14px; color: #111; }
.tone-banner-desc { font-size: 12px; color: #6b7280; }

/* 캐릭터 샘플 후보 카드 그리드 */
.character-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.character-suggestion {
  border: 2px solid #efefef;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}
.character-suggestion:hover { border-color: #0095f6; }
.character-suggestion.selected {
  border-color: #0095f6;
  box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.12);
}
.character-suggestion .thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 12px;
}
.character-suggestion .thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.character-suggestion .hint { font-size: 12px; color: #6b7280; margin-top: 6px; text-align: center; }

/* 채널 상세 — 시그니처 캐릭터 표시 */
.economy-character-display {
  display: flex;
  align-items: center;
  gap: 14px;
}
.economy-character-display .face {
  width: 96px; height: 96px;
  border-radius: 999px;
  overflow: hidden;
  background: #f3f4f6;
  flex-shrink: 0;
  border: 3px solid #e5e7eb;
}
.economy-character-display .face img { width: 100%; height: 100%; object-fit: cover; }
.economy-character-display .info { min-width: 0; }
.economy-character-display .info .name { font-weight: 700; font-size: 16px; color: #111; }
.economy-character-display .info .meta { font-size: 12px; color: #6b7280; }

/* 주제 추천 리스트 */
.topic-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.topic-card {
  border: 1px solid #efefef;
  border-radius: 10px;
  padding: 12px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.topic-card .cat {
  display: inline-block;
  font-size: 11px;
  color: #2563eb;
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  width: max-content;
}
.topic-card .ttl { font-weight: 700; font-size: 15px; color: #111; }
.topic-card .brief { font-size: 12px; color: #6b7280; line-height: 1.4; }
.topic-card .btn-pick {
  margin-top: 4px;
  padding: 8px 12px;
  background: #0095f6;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.topic-card .btn-pick:hover { background: #0078c4; }
.topic-card { transition: border-color 0.1s ease, box-shadow 0.1s ease, transform 0.1s ease; }
.topic-card:hover { border-color: #cbd5e1; transform: translateY(-1px); }
.topic-card.selected {
  border-color: #0095f6;
  box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.12);
  background: #eff6ff;
}

/* 모달 안 캐릭터 풀 그리드 — 기본 280px 제한 풀기 */
#modal-parenting-pick-character .char-pool-grid { max-height: calc(80vh - 200px); }

/* 에피소드(카드) 목록 */
.economy-episodes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.economy-episode-card {
  border: 1px solid #efefef;
  border-radius: 10px;
  padding: 10px;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
}
.economy-episode-card:hover { border-color: #0095f6; transform: translateY(-1px); }
.economy-episode-card .ep-thumb {
  aspect-ratio: 4 / 5;
  background: #f3f4f6;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 12px;
  overflow: hidden;
}
.economy-episode-card .ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.economy-episode-card .ep-title { font-weight: 700; font-size: 13px; color: #111; margin-top: 6px; }
.economy-episode-card .ep-cat { font-size: 11px; color: #6b7280; }

/* 에피소드 작업화면 — 리스트 콘텐츠 + 카드 미리보기 */
#economy-list-content {
  margin-top: 8px;
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
  min-height: 60px;
  font-size: 13px;
  color: #374151;
}
#economy-list-content .item-row {
  padding: 8px 0;
  border-bottom: 1px dashed #e5e7eb;
}
#economy-list-content .item-row:last-child { border-bottom: none; }
#economy-list-content .item-row .num {
  display: inline-block;
  font-weight: 700;
  color: #2563eb;
  margin-right: 6px;
}
#economy-list-content .item-row .head { font-weight: 600; }
#economy-list-content .item-row .det { color: #6b7280; font-size: 12px; margin-top: 2px; }

.economy-card-preview {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  background: #1f2937;
  padding: 14px;
  border-radius: 10px;
  min-height: 200px;
}
.economy-card-preview .placeholder {
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
}
.economy-card-preview img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* 사이드바 chip — disabled 가 아닌 항목은 클릭 가능 */
.category-list .chip:not(.disabled):not(.active) { cursor: pointer; }

/* 스티커 편집 레이어 — iframe 위에 absolute 로 얹어 드래그/리사이즈 핸들 표시.
   레이어 자체는 pointer-events: none — iframe 클릭 가능 영역 가리지 않음.
   핸들 div 만 pointer-events: auto. */
.econ-design-iframe-wrap { position: relative; }
.sticker-edit-layer {
  position: absolute;
  inset: 0;
  /* 이제 레이어가 클릭을 받음 — 빈 공간 클릭 시 선택 해제 처리.
     iframe 안 카드 내용은 정적 (클릭할 게 없음) 이라 무방. */
  pointer-events: auto;
  z-index: 5;
}
.sticker-edit-handle {
  position: absolute;
  pointer-events: auto;
  cursor: move;
  /* 기본: 거의 보이지 않음 — 카드 내용 가리지 않게 */
  border: 2px dashed transparent;
  background: transparent;
  box-sizing: border-box;
  transition: border-color 0.1s, background 0.1s;
  user-select: none;
}
.sticker-edit-handle:hover {
  /* hover: 옅은 점선 힌트 — "여기 편집 가능" 단서 */
  border-color: rgba(0, 149, 246, 0.3);
  background: rgba(0, 149, 246, 0.03);
}
.sticker-edit-handle.selected,
.sticker-edit-handle.dragging {
  /* 선택/드래그 중: 진한 점선 + 살짝 채움 */
  border: 2px dashed #0095f6;
  background: rgba(0, 149, 246, 0.08);
}
.sticker-edit-handle.dragging {
  cursor: grabbing;
}
/* 핸들 안 미리보기 — IDLE 일 땐 안 보임 (iframe sticker 와 겹쳐 이중으로 보이는 문제 방지).
   드래그 중 일때만 노출해서 사용자가 "무엇을 드래그 중인지" 식별. */
.sticker-edit-handle .seh-thumb {
  position: absolute;
  inset: 4px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  display: none;
}
.sticker-edit-handle.dragging .seh-thumb {
  display: block;
  opacity: 0.85;
}
/* SE 코너 리사이즈 핸들 — 선택/드래그 중에만 노출 */
.sticker-edit-handle .resize-se {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: #0095f6;
  border: 2px solid white;
  border-radius: 3px;
  cursor: nwse-resize;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  display: none;
}
.sticker-edit-handle.selected .resize-se,
.sticker-edit-handle.dragging .resize-se {
  display: block;
}
.sticker-edit-handle .resize-se:hover {
  background: #0077c4;
}

/* 스티커 라이브러리 모달 — 좌:캐릭터 선택 / 우:그 캐릭터의 8 스티커 */
.sticker-lib-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px;
  max-height: 60vh;
}
.sticker-lib-chars {
  overflow-y: auto;
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sticker-lib-char {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  background: white;
}
.sticker-lib-char:hover { border-color: #0095f6; }
.sticker-lib-char.selected { border-color: #0095f6; background: #f7fbff; }
.sticker-lib-char .slc-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #f3f4f6;
  flex-shrink: 0;
  overflow: hidden;
}
.sticker-lib-char .slc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sticker-lib-char .slc-name {
  font-size: 12px;
  font-weight: 600;
  color: #111;
}

.sticker-lib-stickers {
  overflow-y: auto;
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 10px;
}
.sticker-lib-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.sticker-lib-tile {
  border: 2px solid #efefef;
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
  background: #f9fafb;
  transition: all 0.15s;
}
.sticker-lib-tile:hover {
  border-color: #0095f6;
  background: white;
}
.sticker-lib-tile .slt-thumb {
  aspect-ratio: 1 / 1;
  background:
    repeating-conic-gradient(#e5e7eb 0 25%, #f3f4f6 0 50%) 0 0 / 12px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  overflow: hidden;
}
.sticker-lib-tile .slt-thumb img { max-width: 100%; max-height: 100%; }
.sticker-lib-tile .slt-label {
  text-align: center;
  font-size: 11px;
  color: #6b7280;
  padding: 4px 0 2px;
}

/* 디자인 패널 안 스티커 리스트 — 추가된 스티커들 (편집 폼) */
#design-sticker-list { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.design-sticker-item {
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 8px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.design-sticker-item:hover { border-color: #d6e8ff; }
.design-sticker-item.selected {
  border-color: #0095f6;
  box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.15);
}
.design-sticker-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.design-sticker-head .dsh-thumb {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background:
    repeating-conic-gradient(#e5e7eb 0 25%, #f3f4f6 0 50%) 0 0 / 8px 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.design-sticker-head .dsh-thumb img { width: 100%; height: 100%; }
.design-sticker-head .dsh-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: #111;
}
.design-sticker-head .dsh-del {
  background: none;
  border: 1px solid #dbdbdb;
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
  color: #ed4956;
}
.design-sticker-head .dsh-del:hover { background: #fef2f2; }
.design-sticker-pos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}
.design-sticker-pos button {
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 4px;
  font-size: 10px;
  padding: 4px 0;
  cursor: pointer;
  font-family: inherit;
}
.design-sticker-pos button.selected {
  background: #0095f6;
  color: white;
  border-color: #0095f6;
}
.design-sticker-size {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: #6b7280;
}
.design-sticker-size input[type="range"] { flex: 1; }
.design-sticker-size .dss-label { width: 36px; text-align: center; }

/* 스티커 세트 그리드 (캐릭터 상세 페이지) */
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}
@media (max-width: 600px) {
  .sticker-grid { grid-template-columns: repeat(2, 1fr); }
}
.sticker-cell {
  border: 1px solid #efefef;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.sticker-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.sticker-cell .st-thumb {
  aspect-ratio: 1 / 1;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sticker-cell .st-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sticker-cell .st-label {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #262626;
  padding: 6px 4px;
  border-top: 1px solid #efefef;
  background: #fafafa;
}
.sticker-empty {
  padding: 30px 20px;
  text-align: center;
  color: #6b7280;
  background: #fafafa;
  border-radius: 8px;
  margin-top: 12px;
}
.sticker-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  color: #6b7280;
  font-weight: 600;
}
.sticker-loading .spinner {
  width: 28px;
  height: 28px;
  border: 4px solid #e5e7eb;
  border-top-color: #0095f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ───── 스티커 수동 분할 모달 ───── */
/* modal-wide 는 기본 720px — 분할 모달은 큰 시트를 잘 보여야 해서 따로 키움. */
#modal-sticker-split .modal { max-width: 920px; width: calc(100vw - 40px); }
.sticker-split-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.sticker-split-stage-wrap {
  background: #fafafa;
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 8px;
  /* 모달 내부에서 스크롤 가능하게 — 시트가 너무 길면 안에서 스크롤 */
  max-height: calc(100vh - 240px);
  overflow: auto;
  display: flex;
  justify-content: center;
}
/* 시트 + 박스 오버레이 무대.
   - 너비를 컨테이너에 맞추고 높이는 이미지 비율 (object-fit:contain 으로 시트 표시).
   - position:relative + img absolute 가 아니라, 시트 이미지를 자연 비율로 두고
     박스들은 stage 안에서 % 좌표로 absolute 배치. */
.sticker-split-stage {
  position: relative;
  display: inline-block;
  /* 배경 체커보드 — 투명 영역 식별용 */
  background-image:
    linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #f8f8f8;
  border-radius: 6px;
}
.sticker-split-stage img {
  display: block;
  /* 화면 안에 들어가는 적당한 크기. 9:16 시트가 너무 크면 wrap 의 스크롤에 맡김. */
  max-width: 100%;
  max-height: calc(100vh - 260px);
  width: auto;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none; /* 박스 드래그가 이미지에 막히지 않게 */
}
.sticker-split-boxes {
  position: absolute;
  inset: 0;
  pointer-events: none; /* 빈 영역 클릭 = 통과 */
}
.split-box {
  position: absolute;
  border: 2px dashed #ff8a00;
  background: rgba(255, 138, 0, 0.06);
  box-sizing: border-box;
  cursor: move;
  pointer-events: auto;
  /* hover/selected 색 변경 */
  transition: background-color 0.1s ease, border-color 0.1s ease;
}
.split-box:hover { background: rgba(255, 138, 0, 0.12); }
.split-box.selected {
  border-color: #0095f6;
  background: rgba(0, 149, 246, 0.10);
  z-index: 2;
}
.split-box .split-label {
  position: absolute;
  top: -22px;
  left: 0;
  background: #ff8a00;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}
.split-box.selected .split-label { background: #0095f6; }
/* 8 방향 리사이즈 핸들 */
.split-box .sb-h {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ff8a00;
  border: 1px solid white;
  border-radius: 50%;
  pointer-events: auto;
  z-index: 3;
}
.split-box.selected .sb-h { background: #0095f6; }
.split-box .sb-h.nw { top: -6px; left: -6px; cursor: nwse-resize; }
.split-box .sb-h.ne { top: -6px; right: -6px; cursor: nesw-resize; }
.split-box .sb-h.sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.split-box .sb-h.se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.split-box .sb-h.n  { top: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.split-box .sb-h.s  { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.split-box .sb-h.w  { top: 50%; left: -6px; transform: translateY(-50%); cursor: ew-resize; }
.split-box .sb-h.e  { top: 50%; right: -6px; transform: translateY(-50%); cursor: ew-resize; }

/* ───── 스티커 투명 처리 조절 모달 ───── */
.modal-extra-wide { max-width: 1100px; width: calc(100vw - 40px); }
.sticker-process-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  padding: 12px;
}
@media (max-width: 880px) {
  .sticker-process-body { grid-template-columns: 1fr; }
}
.sticker-process-preview-col { display: flex; flex-direction: column; gap: 6px; }
.sticker-process-preview-wrap {
  position: relative;
  border-radius: 8px;
  border: 1px solid #efefef;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  max-height: calc(100vh - 280px);
  background-color: #f8f8f8;
}
/* 배경 variant — 캔버스 RGBA 와 저장 PNG 는 영향 없음, 표시용. */
.sticker-process-preview-wrap.bg-checker {
  background-image:
    linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #f8f8f8;
}
.sticker-process-preview-wrap.bg-white {
  background-image: none;
  background-color: #ffffff;
}
.sticker-process-preview-wrap.bg-black {
  background-image: none;
  background-color: #000000;
}
.sticker-process-preview-wrap.bg-green {
  background-image: none;
  background-color: #00b140;
}
.sticker-process-preview-wrap.bg-pink {
  background-image: none;
  background-color: #ff5ea8;
}
.sticker-process-preview-wrap img,
.sticker-process-preview-wrap canvas {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 300px);
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;       /* 모바일 스크롤 방지, 브러시 드래그 가능 */
  cursor: crosshair;
}
.sticker-process-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: #4b5563;
  font-weight: 600;
  border-radius: 8px;
}
.sticker-process-spinner .spinner {
  width: 32px;
  height: 32px;
  border: 4px solid #e5e7eb;
  border-top-color: #0095f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.sticker-process-controls { display: flex; flex-direction: column; gap: 14px; }
.control-group {
  background: #fafafa;
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.control-group-title {
  font-weight: 700;
  font-size: 13px;
  color: #262626;
}
.process-slider-row { display: flex; flex-direction: column; gap: 4px; }
.process-slider-row label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: #262626;
}
.process-slider-row .slider-val {
  font-weight: 700;
  color: #0095f6;
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}
.process-slider-row input[type=range] { width: 100%; }
.process-slider-row.disabled { opacity: 0.4; pointer-events: none; }
.toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #262626;
  cursor: pointer;
}
.toggle-row input[type=checkbox] { margin: 0; cursor: pointer; }
.toggle-row .muted-small { margin-left: auto; font-weight: 500; }
.process-dirty-hint {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 6px 8px;
}
#btn-process-recompute.dirty {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

/* 브러시 모드 토글 (복구 / 지우개) */
.brush-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.brush-mode-btn {
  padding: 8px 10px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.1s ease;
}
.brush-mode-btn:hover { background: #f9fafb; }
.brush-mode-btn.active {
  background: #0095f6;
  border-color: #0095f6;
  color: white;
}
.brush-undo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* 줌 quick 버튼 (➖ / Fit / 1:1 / ➕) */
.zoom-quick-row-4 {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr 1fr;
  gap: 6px;
}
.zoom-quick-row-4 .btn-secondary { padding: 6px 4px; font-size: 12px; }

/* 8 셀 + 전체 썸네일 strip */
.sticker-process-cell-strip {
  display: grid;
  grid-template-columns: repeat(9, 1fr);   /* 전체 + 8 셀 */
  gap: 6px;
  padding: 6px;
  background: #fafafa;
  border: 1px solid #efefef;
  border-radius: 8px;
  margin-bottom: 8px;
}
.cell-thumb {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border-radius: 6px;
  background: white;
  border: 2px solid transparent;
  transition: border-color 0.1s ease, background 0.1s ease;
}
.cell-thumb:hover { background: #f3f4f6; }
.cell-thumb.active {
  border-color: #0095f6;
  background: #eff6ff;
}
.cell-thumb-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  /* 체커보드 — 투명 영역 시각화 */
  background-image:
    linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  background-color: #f8f8f8;
}
.cell-thumb-label {
  font-size: 10px;
  font-weight: 600;
  color: #4b5563;
  line-height: 1.1;
  text-align: center;
}

/* 셀 모드 네비 (◀ 이전 / 라벨 / 다음 ▶) */
.cell-nav-row {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.cell-nav-row .btn-secondary { padding: 6px 8px; font-size: 13px; }
.cell-nav-label {
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: #0095f6;
}

/* 투명 조절 모달 — 미리보기 배경 스와치
   (※ 기존 .bg-swatch 는 캐릭터 카드 디자인의 다른 용도라 충돌 회피 위해 .process-bg-swatch) */
.process-bg-swatch-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.process-bg-swatch-label {
  font-size: 12px;
  font-weight: 700;
  color: #4b5563;
  margin-right: 2px;
}
.process-bg-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid #d1d5db;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  color: #6b7280;
  transition: transform 0.1s ease, border-color 0.1s ease;
  /* 기본 button 의 background 가 안 끼게 */
  background: transparent;
}
.process-bg-swatch:hover { transform: scale(1.1); border-color: #6b7280; }
.process-bg-swatch.active {
  border-color: #0095f6;
  box-shadow: 0 0 0 2px rgba(0, 149, 246, 0.25);
}
.process-bg-swatch-checker {
  background-image:
    linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 6px 6px;
  background-position: 0 0, 0 3px, 3px -3px, -3px 0;
  background-color: #f8f8f8;
  color: transparent; /* ▦ 글리프 안 보이게 */
}
.process-bg-swatch-white { background: #ffffff; }
.process-bg-swatch-black { background: #000000; }
.process-bg-swatch-green { background: #00b140; }
.process-bg-swatch-pink  { background: #ff5ea8; }

/* 캐릭터 모달 안 "풀에서" 탭 — 풀 캐릭터 작은 그리드 */
.char-pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}
.char-pool-mini {
  border: 2px solid #efefef;
  border-radius: 10px;
  background: white;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s;
}
.char-pool-mini:hover { border-color: #0095f6; }
.char-pool-mini.selected {
  border-color: #0095f6;
  box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.15);
}
.char-pool-mini .cpm-thumb {
  aspect-ratio: 16 / 9;
  background: #f3f4f6;
  overflow: hidden;
}
.char-pool-mini .cpm-thumb img { width: 100%; height: 100%; object-fit: cover; }
.char-pool-mini .cpm-name {
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #111;
}
.char-pool-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #efefef;
}

/* 초기 세팅 탭 (캐릭터/배경) */
.setup-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  border-bottom: 1px solid #efefef;
}
.setup-tab {
  background: none;
  border: 0;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.setup-tab:hover { color: #262626; }
.setup-tab.active { color: #0095f6; border-bottom-color: #0095f6; }

/* 초기 세팅 chip — 카테고리와 시각적으로 구분 */
.chip.chip-setup {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
  margin-bottom: 8px;
}
.chip.chip-setup.active { background: #fcd34d; color: #78350f; }
.chip.chip-setup::before { background: #f59e0b; }

/* === 캐릭터 풀 그리드 (목록) === */
.pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.pool-card {
  border: 1px solid #efefef;
  border-radius: 12px;
  background: white;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: all 0.15s;
}
.pool-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.pool-card .pool-thumb {
  aspect-ratio: 16 / 9;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #9ca3af;
}
.pool-card .pool-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.pool-card .pool-meta {
  padding: 10px 12px;
}
.pool-card .pool-name { font-weight: 700; font-size: 14px; color: #111; }
.pool-card .pool-style { font-size: 11px; color: #6b7280; margin-top: 2px; }
.pool-card .pool-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: white;
  border: 1px solid #efefef;
  color: #8e8e8e;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
}
.pool-card:hover .pool-delete { opacity: 1; }
.pool-card .pool-delete:hover { background: #ed4956; color: white; border-color: #ed4956; }

/* === 풀 캐릭터 상세 === */
.pool-detail-sheet {
  background: white;
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 10px;
}

/* === 위저드: 8 후보 그리드 === */
.pool-candidates-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
}
.pool-candidates-sheet-wrap {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
}
.pool-candidates-sheet-wrap img {
  width: 100%;
  display: block;
  border-radius: 10px;
  background: #f3f4f6;
}
.pool-candidates-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);   /* 가로 4 열 */
  grid-template-rows: repeat(2, 1fr);      /* 세로 2 행 */
  gap: 0;
}
.pool-candidate-cell {
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 6px;
  position: relative;
}
.pool-candidate-cell:hover {
  border-color: rgba(0, 149, 246, 0.6);
  background: rgba(0, 149, 246, 0.08);
}
.pool-candidate-cell.selected {
  border-color: #0095f6;
  background: rgba(0, 149, 246, 0.15);
}
.pool-candidate-cell .cell-num {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 8 후보 명단 — 그리드 이미지와 동일하게 4 열 × 2 행으로 매핑 (위치 번호 대응) */
.pool-candidates-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
@media (max-width: 760px) {
  .pool-candidates-list { grid-template-columns: 1fr 1fr; }
}
.pool-candidate-row {
  border: 1px solid #efefef;
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.1s;
}
.pool-candidate-row:hover { border-color: #0095f6; }
.pool-candidate-row.selected {
  border-color: #0095f6;
  background: #f7fbff;
}
.pool-candidate-row .pcn {
  font-weight: 700;
  font-size: 13px;
  color: #111;
}
.pool-candidate-row .pcn::before {
  content: attr(data-num) ".";
  color: #0095f6;
  margin-right: 4px;
}
.pool-candidate-row .pca { color: #6b7280; font-size: 11px; margin-top: 2px; line-height: 1.4; }

.modal-footer-inline {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

/* 풀 위저드 로딩 */
.pool-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  color: #6b7280;
  font-weight: 600;
}
.pool-loading .spinner {
  width: 56px;
  height: 56px;
  border: 5px solid #e5e7eb;
  border-top-color: #0095f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 풀 시트 결과 (step 4) */
.pool-finalize-result {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.pool-finalize-result img {
  max-width: 100%;
  max-height: 50vh;
  border-radius: 10px;
  border: 1px solid #efefef;
}
.pool-finalize-fields { width: 100%; max-width: 480px; }

/* 다중 생성 진행 — 완료된 것 누적 + 진행 중인 것 spinner */
.pool-finalize-progress {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pool-finalize-progress-head {
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  padding: 8px 0;
}
.pool-finalize-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.pool-finalize-item {
  border: 1px solid #efefef;
  border-radius: 10px;
  padding: 6px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.pool-finalize-item .pfi-thumb {
  aspect-ratio: 16 / 9;
  background: #f3f4f6;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 11px;
}
.pool-finalize-item .pfi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pool-finalize-item .pfi-thumb .small-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e5e7eb;
  border-top-color: #0095f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.pool-finalize-item .pfi-name {
  font-size: 12px;
  font-weight: 600;
  color: #111;
  text-align: center;
}
.pool-finalize-item.failed .pfi-thumb {
  background: #fef2f2;
  color: #ed4956;
}
.pool-finalize-item.pending .pfi-thumb { background: #f0f9ff; }
.pool-finalize-item.done .pfi-thumb { background: #f0fdf4; }

/* === 주식·경제 채널 카드 본문 (인스타툰 카드 베이스 위에 살짝 다듬음) === */
/* 인스타툰 채널 카드와 동일한 가로형(썸네일 + 이름 + 스타일칩). 카드 전체 클릭=입장 */
.econ-channel-card { position: relative; cursor: pointer; }
.econ-channel-card:hover { border-color: #2563eb; }
.econ-channel-tone {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  margin-top: 2px;
}
.econ-channel-char {
  display: flex;
  align-items: center;
  justify-content: center;   /* 아바타+이름을 카드 가운데로 */
  gap: 8px;
  margin: 4px 0;
}
.econ-channel-char-img {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid #efefef;
  flex-shrink: 0;
}
.econ-channel-char-name {
  font-size: 13px;
  font-weight: 600;
  color: #262626;
}
.econ-channel-char.muted .econ-channel-char-name { color: #9ca3af; }
.econ-channel-sig {
  font-size: 12px;
  color: #0095f6;
  font-style: italic;
  line-height: 1.4;
}

/* === 컷 수 선택 옵션 === */
.cut-count-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.cut-option {
  display: block;
  cursor: pointer;
}
.cut-option input[type="radio"] { display: none; }
.cut-option-card {
  border: 2px solid #efefef;
  border-radius: 10px;
  padding: 14px;
  background: white;
  transition: all 0.15s;
}
.cut-option:hover .cut-option-card { border-color: #0095f6; }
.cut-option input:checked + .cut-option-card {
  border-color: #0095f6;
  background: #f7fbff;
  box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.1);
}
.cut-option-num { font-size: 18px; font-weight: 800; color: #111; }
.cut-option-desc { font-size: 12px; color: #6b7280; margin-top: 4px; line-height: 1.4; }

/* === 콘텐츠 편집기 === */
.econ-content-controls,
.econ-render-controls,
.econ-caption-controls {
  margin-top: 12px;
}
#econ-content-editor { margin-top: 14px; }
.econ-page-block {
  border: 1px solid #efefef;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fafafa;
}
.econ-page-block-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.econ-page-num {
  background: #0095f6;
  color: white;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.econ-page-kind {
  font-size: 11px;
  color: #6b7280;
  background: #e5e7eb;
  padding: 2px 8px;
  border-radius: 999px;
}
.econ-page-title-input,
.econ-page-subtitle-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  background: white;
  margin-bottom: 6px;
}
.econ-page-title-input { font-weight: 700; }
.econ-items { margin-top: 6px; }
.econ-item-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 6px;
}
.econ-item-num {
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  font-weight: 700;
  color: #0095f6;
  padding-top: 4px;
}
.econ-item-body { flex: 1; min-width: 0; }
.econ-item-headline {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  background: transparent;
}
.econ-item-headline:focus { outline: none; background: white; border-color: #0095f6; }
.econ-item-detail {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  background: transparent;
  color: #6b7280;
  resize: vertical;
  min-height: 22px;
  margin-top: 2px;
}
.econ-item-detail:focus { outline: none; background: white; border-color: #0095f6; }
.econ-item-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.econ-item-actions button {
  background: none;
  border: 1px solid #dbdbdb;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 11px;
  color: #6b7280;
  padding: 0;
}
.econ-item-actions button:hover:not(:disabled) { background: #fafafa; }
.econ-item-actions .del:hover:not(:disabled) { background: #ed4956; color: white; border-color: #ed4956; }
.econ-item-actions button:disabled {
  color: #d1d5db;
  border-color: #efefef;
  background: #fafafa;
  cursor: not-allowed;
}
.econ-add-item {
  background: white;
  border: 1px dashed #dbdbdb;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: #0095f6;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  margin-top: 4px;
}
.econ-add-item:hover { background: #f7fbff; border-color: #0095f6; }

/* === 페이지 미리보기 (디자인 + 완성 단계) === */
.econ-pages-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.econ-page-preview-card {
  border: 1px solid #efefef;
  border-radius: 10px;
  background: white;
  overflow: hidden;
}
.econ-page-preview-thumb {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 12px;
}
.econ-page-preview-thumb img {
  width: 100%; height: 100%; object-fit: contain;
}
.econ-page-preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  font-size: 12px;
  border-top: 1px solid #efefef;
}
.econ-page-preview-meta .dl-btn {
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  color: #262626;
}
.econ-page-preview-meta .dl-btn:hover { background: #fafafa; }

.econ-autosave-status {
  margin-left: auto;
  font-style: italic;
  color: #6b7280;
}

/* === 04 디자인 단계: 좌측 미리보기 + 우측 옵션 === */
.econ-design-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 18px;
  margin-top: 12px;
}
.econ-design-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.econ-design-page-selector {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.econ-design-page-selector button {
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.econ-design-page-selector button.active {
  background: #0095f6;
  color: white;
  border-color: #0095f6;
}
.econ-design-iframe-wrap {
  position: relative;
  width: 100%;
  /* 카드 비율 1080×1350 = 4:5 → padding-top 125% */
  padding-top: 125%;
  background: #1f2937;
  border-radius: 10px;
  overflow: hidden;
}
.econ-design-iframe-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  /* 1080×1350 컨테이너 위에 scale 로 줄여서 표시 */
  width: 1080px;
  height: 1350px;
  border: 0;
  transform-origin: top left;
  /* JS 가 컨테이너 너비에 맞춰 transform: scale() 셋팅 */
}
.econ-render-controls {
  display: flex;
  gap: 8px;
}
.econ-render-controls button { white-space: nowrap; }
#btn-econ-design-reset { flex-shrink: 0; }

/* 옵션 패널 */
.econ-design-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px;
  background: #fafafa;
  border: 1px solid #efefef;
  border-radius: 10px;
  align-self: start;
  max-height: 80vh;
  overflow-y: auto;
}
.design-section { display: flex; flex-direction: column; gap: 6px; }
.design-label { font-size: 13px; font-weight: 700; color: #262626; }

/* 배경 테마 스와치 */
.bg-theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.bg-swatch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 2px solid #efefef;
  border-radius: 8px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}
.bg-swatch.selected { border-color: #0095f6; background: #f7fbff; }
.bg-swatch .sw {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}
.sw-white { background: white; }
.sw-cream { background: #fef7ec; }
.sw-navy { background: #1e293b; }
.sw-grad-pastel { background: linear-gradient(135deg, #fce7f3, #dbeafe); }
.sw-grad-strong { background: linear-gradient(135deg, #ec4899, #2563eb); }
.sw-custom {
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
}
.design-custom-bg { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.design-custom-bg .color-row { gap: 6px; }
.design-custom-bg .color-row label { margin-right: 4px; }

/* 슬라이더 + 숫자 입력 조합 */
.slider-row { display: flex; gap: 8px; align-items: center; }
.slider-row input[type="range"] { flex: 1; min-width: 0; }
.slider-num {
  width: 48px;
  padding: 4px 6px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  text-align: center;
}

/* 배경 이미지 영역 — 업로드 후 썸네일 */
#design-bg-image-area { display: flex; flex-direction: column; gap: 6px; }
.design-bg-thumb-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid #efefef;
  border-radius: 8px;
  background: white;
}
.design-bg-thumb {
  width: 60px;
  height: 75px;
  object-fit: cover;
  border-radius: 4px;
  background: #f3f4f6;
}
.design-bg-thumb-meta { flex: 1; min-width: 0; font-size: 11px; color: #6b7280; }
.btn-bg-remove {
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: #ed4956;
}
.btn-bg-remove:hover { background: #fef2f2; border-color: #ed4956; }

/* === 디자인 단계 전체화면 모드 ===
   body.econ-fullscreen 클래스가 붙으면 step4 카드가 화면 전체를 덮음.
   iframe 미리보기 + 옵션 패널 둘 다 더 큰 크기로 노출. ESC 키 / 토글 버튼으로 종료. */
body.econ-fullscreen { overflow: hidden; }
body.econ-fullscreen #econ-step4 {
  position: fixed;
  inset: 0;
  z-index: 100;
  margin: 0 !important;
  padding: 20px 28px;
  border-radius: 0;
  background: white;
  max-height: 100vh;
  overflow-y: auto;
}
body.econ-fullscreen #econ-step4 .card-header { margin-bottom: 10px; }
body.econ-fullscreen .econ-design-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
body.econ-fullscreen .econ-design-iframe-wrap {
  padding-top: 0;
  aspect-ratio: 4 / 5;
  max-height: 78vh;
  max-width: calc(78vh * 0.8);  /* 4:5 비율 (height × 0.8) */
  width: 100%;
  margin: 0 auto;
}
body.econ-fullscreen .econ-design-options {
  max-height: 86vh;
  overflow-y: auto;
}
/* 토글 버튼 — 활성 상태 강조 */
#btn-econ-design-fullscreen.active {
  background: #0095f6;
  color: white;
  border-color: #0095f6;
}
@media (max-width: 880px) {
  /* 모바일에선 가로 배치 → 세로 stack */
  body.econ-fullscreen .econ-design-layout {
    grid-template-columns: 1fr;
  }
  body.econ-fullscreen .econ-design-iframe-wrap {
    max-height: 60vh;
    max-width: calc(60vh * 0.8);
  }
}

/* 디자인 단계 — 변환 중 로딩 오버레이 */
.econ-design-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(31, 41, 55, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 5;
  color: white;
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
}
.econ-design-loading-overlay .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 오버플로 경고 칩 */
.econ-overflow-warning {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 10px;
  font-size: 13px;
  color: #78350f;
}
.econ-overflow-warning.severe {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #7f1d1d;
}
.econ-overflow-warning .warn-head {
  font-weight: 700;
  margin-bottom: 6px;
}
.econ-overflow-warning .warn-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.econ-overflow-warning .warn-actions button {
  border: 1px solid currentColor;
  background: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  color: inherit;
}
.econ-overflow-warning .warn-actions button:hover { background: rgba(255, 255, 255, 0.6); }

/* 컬러 인풋 */
.color-row { display: flex; gap: 6px; align-items: center; }
.color-row input[type="color"] {
  width: 40px;
  height: 32px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
}
.color-row input[type="text"] {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
}

/* 세그먼트 그룹 (정렬, 캐릭터 위치) */
.seg-group { display: flex; gap: 0; border: 1px solid #dbdbdb; border-radius: 6px; overflow: hidden; }
.seg-group button {
  flex: 1;
  background: white;
  border: 0;
  border-left: 1px solid #efefef;
  padding: 7px 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: #262626;
}
.seg-group button:first-child { border-left: 0; }
.seg-group button.selected { background: #0095f6; color: white; }

/* 체크박스 토글 */
.design-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.design-toggle input { width: 16px; height: 16px; }

/* 슬라이더 */
.design-section input[type="range"] { width: 100%; }

/* 모바일: 위·아래로 쌓기 */
@media (max-width: 880px) {
  .econ-design-layout { grid-template-columns: 1fr; }
  .econ-design-options { max-height: none; }
}

/* ============================================================ */
/* 피드백 재생성 박스 (2/3/4/7 단계 결과 하단)                      */
/* ============================================================ */
.feedback-box {
  margin-top: 18px;
  padding: 12px 14px;
  background: #f7fbff;
  border: 1px dashed #c7d8ed;
  border-radius: 10px;
}
.feedback-box summary {
  font-weight: 600;
  font-size: 14px;
  color: #0095f6;
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
}
.feedback-box summary::-webkit-details-marker { display: none; }
.feedback-box summary::before {
  content: "▶ ";
  font-size: 10px;
  margin-right: 4px;
  transition: transform 0.15s;
  display: inline-block;
}
.feedback-box[open] summary::before { transform: rotate(90deg); }
.feedback-box p.muted-small { margin: 6px 0 8px; }
.feedback-box textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  margin-bottom: 8px;
}
.feedback-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.feedback-actions .btn-primary,
.feedback-actions .btn-secondary {
  flex: 1 1 auto;
  font-size: 13px;
  padding: 8px 14px;
}

/* ============================================================ */
/* 모바일 종합 — 768px 이하 (사이트 전체) */
/* ============================================================ */
@media (max-width: 768px) {
  body { font-size: 15px; }

  /* 레이아웃: 사이드바를 상단 가로 칩 묶음으로 */
  .layout {
    flex-direction: column;
    gap: 10px;
    margin: 12px auto 80px;
  }
  .sidebar {
    width: 100%;
    position: static;
    top: auto;
  }
  .sidebar-card { padding: 10px; }
  .sidebar-brand { display: none; }
  .category-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .chip {
    width: auto;
    border: 1px solid #dbdbdb;
    border-radius: 18px;
    padding: 7px 12px;
    min-height: 36px;
  }

  /* 카드 패딩 줄여서 너비 확보 */
  .card { padding: 14px 14px; border-radius: 10px; }
  .card-title { font-size: 16px; }

  /* 모든 버튼 터치 친화적 — 최소 44px */
  .btn-primary, .btn-secondary, .btn-danger {
    min-height: 44px;
    font-size: 14px;
  }
  .btn-primary:active, .btn-secondary:active, .btn-danger:active {
    transform: scale(0.98);
  }

  /* 입력 필드 폰트 살짝 키움 (iOS 자동 줌 방지) */
  .field input,
  .field textarea,
  .field select { font-size: 16px; }

  /* 그리드 1열 */
  .channel-grid,
  .entity-grid {
    grid-template-columns: 1fr;
  }

  /* 모달 거의 풀스크린 */
  .modal-backdrop { padding: 10px; }
  .modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 10px;
  }
  .modal-header { padding: 12px 16px; }
  .modal-body { padding: 14px 16px; }
  .modal-footer { padding: 10px 14px; }

  /* 에피소드 진행바 — 가로 스크롤 (이미 있는 동작 유지) */
  .stage-progress { padding: 8px; gap: 4px; }
  .stage-item { min-width: 56px; padding: 6px 8px; }

  /* Stage 5/6 패널 그리드 — 1열로 더 크게 */
  .image-panels-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  /* 모바일에선 카드 폭에 따라 4:5 비율로 자연 확장 (min-height 가 비율을 깨지 않도록 해제) */
  .image-panel-thumb { min-height: 0; }

  /* Stage 4 패널 카드 폰트 약간 키움 */
  .panel-card { padding: 12px; }

  /* 패널 편집 모달은 이미 풀스크린 — 별도 처리 안 함 (max-width:880 미디어 쿼리 존재) */

  /* Stage 8 큰 복사 버튼 — 한 줄에 하나씩 */
  .export-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .btn-copy-all-export { grid-column: auto; }
  .btn-copy-big { min-height: 60px; font-size: 15px; }

  /* 토스트 살짝 더 잘 보이게 */
  .toast { top: 12px; right: 12px; left: 12px; max-width: none; }

  /* 에피소드 카드 액션 영역 보존 */
  .episode-actions .btn-continue { min-height: 44px; padding: 10px 14px; }

  /* hover 효과 → active 로 (모바일은 호버 없음) */
  .channel-card:hover { transform: none; box-shadow: none; }
  .channel-card:active { transform: scale(0.99); }
  .episode-card:hover { transform: none; box-shadow: none; }
  .episode-card:active { background: white; }
}

/* ===== 육아 (parenting) 카테고리 ===== */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.template-tile {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.1s ease, transform 0.1s ease;
}
.template-tile.selected { border-color: #0095f6; background: #eff6ff; }
.template-tile.disabled { opacity: 0.5; cursor: not-allowed; }
.template-icon { font-size: 28px; line-height: 1; }
.template-name { font-weight: 700; margin-top: 6px; font-size: 14px; color: #262626; }

.parenting-design-grid {
  display: grid;
  grid-template-columns: 1fr 240px;   /* 좌측 옵션 큰 영역 + 우측 작은 썸네일 */
  gap: 14px;
  /* 각 칼럼이 자기 콘텐츠 높이 유지 — 옵션 max-height 가 미리보기 stretch 시키지 않도록 */
  align-items: start;
}
@media (max-width: 780px) {
  .parenting-design-grid { grid-template-columns: 1fr; }
}
.parenting-design-controls {
  display: flex; flex-direction: column; gap: 6px;
  /* 옵션 패널 자체 스크롤 — viewport 안에서 독립적으로 */
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding-right: 6px;
}
.parenting-design-preview { display: flex; flex-direction: column; gap: 6px; }
.design-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.design-preview-label { font-size: 12px; font-weight: 700; color: #6b7280; }
.btn-secondary.btn-mini { padding: 4px 8px; font-size: 11px; font-weight: 600; }

/* 다장 미리보기 페이지 탭 */
.pa-page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.pa-page-tab {
  padding: 4px 8px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  transition: all 0.1s ease;
}
.pa-page-tab:hover { border-color: #cbd5e1; }
.pa-page-tab.active {
  background: #0095f6;
  border-color: #0095f6;
  color: white;
}
.pa-page-tab .tab-kind {
  font-size: 9px;
  color: #9ca3af;
  font-weight: 600;
  margin-left: 2px;
}
.pa-page-tab.active .tab-kind { color: rgba(255,255,255,0.85); }

/* 큰 모달 안 페이지 탭 — 가로 한 줄 강제 + 가로 스크롤 */
#pa-page-tabs-modal {
  flex-wrap: nowrap !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
  width: 100%;
  max-width: 800px;
  align-self: center;
}
#pa-page-tabs-modal .pa-page-tab {
  flex-shrink: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
#pa-page-tabs-modal .pa-page-tab .tab-kind {
  margin-left: 4px;
}
#pa-page-tabs-modal::-webkit-scrollbar { height: 6px; }
#pa-page-tabs-modal::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
#pa-page-tabs-modal::-webkit-scrollbar-track { background: transparent; }
/* 작은 썸네일 — 1080×1350 비율 유지하면서 잘리지 않게 */
.pa-preview-thumb {
  width: 100%;
  aspect-ratio: 1080 / 1350;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: zoom-in;
  position: relative;
  overflow: hidden;
  background: #fafafa;
}
.pa-preview-thumb iframe {
  width: 1080px;
  height: 1350px;
  border: none;
  /* scale 로 작은 썸네일 채움 — width:1080/240 = ~0.222 (JS 에서 계산) */
  transform-origin: 0 0;
  pointer-events: none;
}
.pa-preview-thumb::after {
  content: '🔍 클릭해서 크게';
  position: absolute;
  bottom: 8px; right: 8px;
  font-size: 11px;
  font-weight: 700;
  color: white;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
}

/* 큰 편집 모달 — 좌·우 각각 자체 스크롤 가능 (헤더/위쪽 콘텐츠 가려지지 않게) */
#modal-pa-design-edit .modal-body {
  display: grid;
  /* 옛 컨트롤(좌측) 모두 숨김 → 미리보기만 풀폭으로 */
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 24px 14px 14px;
  height: calc(100vh - 200px);
  overflow: hidden;
  place-items: center;
}
/* 단계 풀이형 일 때도 같음 — 옛 컨트롤 안 보이게 한 상태라 풀폭 */
#modal-pa-design-edit .modal-body.de-steps-mode {
  grid-template-columns: 1fr;
}
/* 좌측 세로 카테고리 메뉴 */
.de-side-menu {
  display: flex; flex-direction: column;
  gap: 4px;
  background: #f9fafb;
  border-radius: 10px;
  padding: 8px 6px;
  overflow-y: auto;
}
.de-menu-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 8px;
  font-size: 11px; font-weight: 700;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.1s;
}
.de-menu-item:hover { background: #e5e7eb; color: #1f2937; }
.de-menu-item.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.de-menu-icon { font-size: 20px; line-height: 1; }
/* 카테고리 패널 — 한 번에 한 개만 표시 */
.de-cat-panel { display: block; }
.de-cat-panel.hidden { display: none; }

/* === 레이아웃 미니 갤러리 === */
.vt-mini-section { margin-bottom: 14px; }
.vt-mini-section-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 800; color: #1f2937;
  margin-bottom: 8px;
}
.vt-more-btn {
  background: transparent; border: none;
  font-size: 11px; font-weight: 700; color: #2563eb;
  cursor: pointer; padding: 2px 4px;
}
.vt-more-btn:hover { text-decoration: underline; }
.vt-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.vt-gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.vt-mini-card {
  background: white;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 6px 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.vt-mini-card:hover { border-color: #93c5fd; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.vt-mini-card.selected {
  border-color: #0095f6;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(0, 149, 246, 0.20);
}
.vt-mini-preview {
  background: #fafafa;
  border-radius: 4px;
  height: 60px;
  position: relative;
  overflow: hidden;
  padding: 6px;
}
.vt-gallery-grid .vt-mini-preview { height: 80px; }
.vt-mini-label {
  margin-top: 5px;
  font-size: 10px; font-weight: 700;
  color: #4b5563;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vt-gallery-grid .vt-mini-label { font-size: 12px; }

/* === 17 mockup 시각 형태 (CSS 만으로 표현) === */
/* 공통 미니 박스 */
.vt-mini-preview > .b { background: #d1d5db; border-radius: 2px; }
.vt-mini-preview > .b-acc { background: #2563eb; }
.vt-mini-preview > .b-warn { background: #fca5a5; }
.vt-mini-preview > .b-ok { background: #86efac; }
.vt-mini-preview > .b-y { background: #fde68a; }
.vt-mini-preview > .b-p { background: #fbcfe8; }
.vt-mini-preview > .b-b { background: #bfdbfe; }

/* 1) stack — 세로 라인 3 */
.vt-mini-stack > .b { position: absolute; left: 8px; right: 8px; height: 7px; }
.vt-mini-stack > .b:nth-child(1) { top: 8px; }
.vt-mini-stack > .b:nth-child(2) { top: 22px; }
.vt-mini-stack > .b:nth-child(3) { top: 36px; }

/* 2) row3 — 가로 3 박스 */
.vt-mini-row3 { display: flex; gap: 4px; align-items: center; justify-content: center; }
.vt-mini-row3 > .b { width: 26px; height: 38px; }

/* 3) row2 — 가로 2 박스 */
.vt-mini-row2 { display: flex; gap: 6px; align-items: center; justify-content: center; }
.vt-mini-row2 > .b { width: 36px; height: 38px; }

/* 4) center-callout — 가운데 큰 박스 */
.vt-mini-callout { display: flex; align-items: center; justify-content: center; }
.vt-mini-callout > .b {
  width: 64px; height: 32px; border-radius: 14px;
  background: #fef9c3; border: 2px dashed #f59e0b;
}

/* 5) checklist — ✓ 3개 */
.vt-mini-checklist::before {
  content: '✓ ━━━\A✓ ━━━\A✓ ━━';
  white-space: pre; font-size: 10px;
  color: #16a34a; line-height: 1.5;
  position: absolute; top: 6px; left: 10px;
}

/* 6) arrow-flow — A→B→C */
.vt-mini-arrow-flow {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; font-weight: 800; color: #2563eb;
}
.vt-mini-arrow-flow > .b { width: 16px; height: 16px; background: #2563eb; border-radius: 3px; }

/* 7) number-list — 1 2 3 + 라인 */
.vt-mini-number-list::before {
  content: '① ━━\A② ━━\A③ ━━';
  white-space: pre; font-size: 10px;
  color: #2563eb; line-height: 1.5;
  position: absolute; top: 6px; left: 10px;
}

/* 8) box-arrow-summary — 3 색 박스 */
.vt-mini-box-arrow-summary > .b { position: absolute; left: 8px; right: 8px; height: 8px; border-radius: 4px; }
.vt-mini-box-arrow-summary > .b:nth-child(1) { top: 6px; background: #bfdbfe; }
.vt-mini-box-arrow-summary > .b:nth-child(2) { top: 18px; background: #fde68a; }
.vt-mini-box-arrow-summary > .b:nth-child(3) { top: 30px; background: #fbcfe8; }
.vt-mini-box-arrow-summary::after {
  content: '→ ━\A→ ━';
  white-space: pre; font-size: 8px; color: #6b7280;
  position: absolute; bottom: 4px; left: 10px;
}

/* 9) big-arrow-impact — 큰 글자 + ➡ */
.vt-mini-big-arrow-impact {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-weight: 900; color: #1f1f1f; font-size: 13px;
}
.vt-mini-big-arrow-impact::before { content: 'A'; }
.vt-mini-big-arrow-impact::after  { content: '➡ B'; color: #2563eb; }

/* 10) key-callout-bullets — 타원 + 불릿 */
.vt-mini-key-callout-bullets {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px;
}
.vt-mini-key-callout-bullets::before {
  content: '';
  width: 56px; height: 18px; border-radius: 14px;
  background: #fef9c3; border: 2px dashed #f59e0b;
}
.vt-mini-key-callout-bullets::after {
  content: '• ━━\A• ━━';
  white-space: pre; font-size: 8px; color: #6b7280;
  line-height: 1.3;
}

/* 11) center-image-slot — 큰 박스 (사진 아이콘) */
.vt-mini-center-image-slot {
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.vt-mini-center-image-slot::before { content: '🖼'; }

/* 12) compare-bad-good — 좌 X / 우 ✓ */
.vt-mini-compare-bad-good { display: flex; gap: 4px; align-items: center; justify-content: center; }
.vt-mini-compare-bad-good > .b {
  width: 30px; height: 38px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: white; font-weight: 900;
}
.vt-mini-compare-bad-good > .b:nth-child(1) { background: #f87171; }
.vt-mini-compare-bad-good > .b:nth-child(1)::before { content: '✕'; }
.vt-mini-compare-bad-good > .b:nth-child(2) { background: #34d399; }
.vt-mini-compare-bad-good > .b:nth-child(2)::before { content: '✓'; }

/* 13) timeline-vertical — 세로 선 + 점 */
.vt-mini-timeline-vertical::before {
  content: '';
  position: absolute; left: 14px; top: 8px; bottom: 8px;
  width: 2px; background: #2563eb; opacity: 0.4;
}
.vt-mini-timeline-vertical::after {
  content: '● ━━\A● ━━\A● ━━';
  white-space: pre; font-size: 10px; color: #2563eb;
  position: absolute; top: 6px; left: 8px; line-height: 1.5;
}

/* 14) q-and-a — Q/A 박스 */
.vt-mini-q-and-a {
  display: flex; flex-direction: column; gap: 4px; padding: 4px;
  font-size: 9px; font-weight: 800;
}
.vt-mini-q-and-a > .b {
  height: 16px; border-radius: 4px;
  display: flex; align-items: center; padding: 0 6px;
  color: white;
}
.vt-mini-q-and-a > .b:nth-child(1) { background: #2563eb; }
.vt-mini-q-and-a > .b:nth-child(1)::before { content: 'Q ━━━'; }
.vt-mini-q-and-a > .b:nth-child(2) { background: #10b981; }
.vt-mini-q-and-a > .b:nth-child(2)::before { content: 'A ━━━'; }

/* 15) warning-alert — ⚠ 빨간 박스 */
.vt-mini-warning-alert {
  display: flex; align-items: center; justify-content: center;
  background: #fee2e2 !important;
  border: 2px solid #dc2626; border-radius: 4px;
  font-size: 18px;
}
.vt-mini-warning-alert::before { content: '⚠️'; }

/* 16) chat-conversation — 좌/우 말풍선 */
.vt-mini-chat-conversation {
  display: flex; flex-direction: column; gap: 3px; padding: 4px;
}
.vt-mini-chat-conversation > .b {
  height: 9px; width: 60%; border-radius: 4px;
}
.vt-mini-chat-conversation > .b:nth-child(1) { background: #e5e7eb; align-self: flex-start; }
.vt-mini-chat-conversation > .b:nth-child(2) { background: #fde68a; align-self: flex-end; }
.vt-mini-chat-conversation > .b:nth-child(3) { background: #e5e7eb; align-self: flex-start; }

/* 17) post-it-stack — 기울어진 노란 박스 */
.vt-mini-post-it-stack { display: flex; flex-direction: column; gap: 2px; padding: 4px; }
.vt-mini-post-it-stack > .b { background: #fde047; height: 11px; border-radius: 2px; }
.vt-mini-post-it-stack > .b:nth-child(1) { transform: rotate(-2deg); }
.vt-mini-post-it-stack > .b:nth-child(2) { transform: rotate(1.5deg); }
.vt-mini-post-it-stack > .b:nth-child(3) { transform: rotate(-1deg); }

/* === 배경 미니 mockup 6 종 === */
.bg-mini-preview {
  height: 70px;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  padding: 0;
}
/* note — 크림 배경 + 흰 종이 + 좌측 빨간 세로선 + 가로 점선 줄 */
.bg-mini-preview.bg-mini-note {
  background: #f7efe0;
}
.bg-mini-preview.bg-mini-note::before {
  content: '';
  position: absolute;
  top: 6px; left: 8px; right: 8px; bottom: 6px;
  background: #fff8ea;
  border: 1.5px solid #2a2a2a;
  border-radius: 4px;
}
.bg-mini-preview.bg-mini-note::after {
  content: '';
  position: absolute;
  top: 6px; bottom: 6px;
  left: 18px;
  width: 1px;
  background: #e6a59c;
  z-index: 1;
}

/* postit — 베이지 + 노란 포스트잇 살짝 기울 */
.bg-mini-preview.bg-mini-postit {
  background: #f0e8d4;
}
.bg-mini-preview.bg-mini-postit::before {
  content: '';
  position: absolute;
  top: 10px; left: 14px; right: 14px; bottom: 10px;
  background: linear-gradient(135deg, #fff58e 0%, #ffe863 100%);
  border: 1.5px solid #2a2a2a;
  border-radius: 3px;
  transform: rotate(-1.5deg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* corkboard — 코르크 갈색 + 흰 종이 + 노란 압정 */
.bg-mini-preview.bg-mini-corkboard {
  background: #c8a77a;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0,0,0,0.10) 1px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(0,0,0,0.08) 1px, transparent 2px);
  background-size: 18px 18px, 24px 24px;
}
.bg-mini-preview.bg-mini-corkboard::before {
  content: '';
  position: absolute;
  top: 14px; left: 10px; right: 10px; bottom: 8px;
  background: white;
  border: 1.5px solid #2a2a2a;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.bg-mini-preview.bg-mini-corkboard::after {
  content: '';
  position: absolute;
  top: 5px; left: 50%;
  transform: translateX(-50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #ffd76b, #c98800);
  z-index: 2;
  box-shadow: 0 2px 3px rgba(0,0,0,0.3);
}

/* tape — 베이지 + 흰 종이 + 상단 누런 테이프 */
.bg-mini-preview.bg-mini-tape {
  background: #f7efe0;
}
.bg-mini-preview.bg-mini-tape::before {
  content: '';
  position: absolute;
  top: 12px; left: 8px; right: 8px; bottom: 6px;
  background: white;
  border: 1.5px solid #2a2a2a;
  border-radius: 2px;
}
.bg-mini-preview.bg-mini-tape::after {
  content: '';
  position: absolute;
  top: 3px; left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 38px; height: 12px;
  background: rgba(200, 180, 130, 0.85);
  z-index: 2;
}

/* custom — 큰 사진 아이콘 */
.bg-mini-preview.bg-mini-custom {
  background: #e0f2fe;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  border: 2px dashed #93c5fd;
}
.bg-mini-preview.bg-mini-custom::before { content: '🖼'; }

/* none — 회색 평면 */
.bg-mini-preview.bg-mini-none {
  background: #fafafa;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #9ca3af; font-weight: 600;
  border: 1px dashed #d1d5db;
}
.bg-mini-preview.bg-mini-none::before { content: '평면'; }

/* === 색상 팔레트 그리드 (3색 한 번에 적용) === */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.palette-card {
  display: flex; flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: white;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s;
}
.palette-card:hover { border-color: #93c5fd; transform: translateY(-1px); }
.palette-card.selected {
  border-color: #0095f6;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(0, 149, 246, 0.20);
}
.palette-swatches {
  display: flex; gap: 3px;
  height: 32px;
}
.palette-swatch {
  flex: 1;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.05);
}
.palette-name {
  font-size: 11px; font-weight: 700;
  color: #4b5563;
  text-align: center;
}

/* === 폰트 카드 그리드 === */
@import url('https://fonts.googleapis.com/css2?family=Gaegu:wght@400;700&family=Nanum+Pen+Script&family=Black+Han+Sans&family=Do+Hyeon&family=Jua&display=swap');

.font-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.font-card {
  background: white;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 6px 6px;
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
}
.font-card:hover { border-color: #93c5fd; }
.font-card.selected {
  border-color: #0095f6;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(0, 149, 246, 0.20);
}
.font-preview {
  font-size: 18px;
  line-height: 1.1;
  color: #1f1f1f;
  margin-bottom: 3px;
}
.font-name {
  font-size: 10px; font-weight: 700;
  color: #6b7280;
}
.font-pretendard { font-family: 'Pretendard', 'Noto Sans KR', sans-serif; font-weight: 700; }
.font-gaegu      { font-family: 'Gaegu', 'Pretendard', sans-serif; font-weight: 700; }
.font-nanum-pen  { font-family: 'Nanum Pen Script', 'Pretendard', sans-serif; }
.font-black-han  { font-family: 'Black Han Sans', 'Pretendard', sans-serif; }
.font-do-hyeon   { font-family: 'Do Hyeon', 'Pretendard', sans-serif; }
.font-jua        { font-family: 'Jua', 'Pretendard', sans-serif; }
#modal-pa-design-edit .parenting-design-controls {
  max-height: none;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding-right: 8px;
}
#modal-pa-design-edit .pa-design-edit-preview {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding: 12px 8px;
}
/* 페이지 탭 — 스크롤 컨테이너 안에서 확실히 위 경계와 떨어지게 */
#modal-pa-design-edit #pa-page-tabs-modal {
  margin-top: 6px;
  flex-shrink: 0;
}
@media (max-width: 880px) {
  #modal-pa-design-edit .modal-body { grid-template-columns: 1fr; height: auto; overflow: auto; }
  #modal-pa-design-edit .parenting-design-controls,
  #modal-pa-design-edit .pa-design-edit-preview { height: auto; overflow: visible; }
}
.pa-design-edit-preview {
  background: #fafafa;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;     /* 페이지 탭(위) → iframe(아래) 세로 배치 */
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  overflow: auto;
}
/* wrap = 비율 유지하는 표시 영역. iframe 은 1080×1350 자연크기 + scale 로 채움.
   width 후보 3 가지 min: 부모 100% / 800px / 가용 높이에서 역산한 너비.
   가용 높이는 viewport - 모달 헤더/푸터/탭/패딩(약 260px) 빼고. */
.pa-design-edit-preview-wrap {
  width: min(100%, 800px, calc((100vh - 260px) * 1080 / 1350));
  aspect-ratio: 1080 / 1350;
  position: relative;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  flex-shrink: 0;
}
.pa-design-edit-preview iframe {
  width: 1080px;
  height: 1350px;
  border: none;
  transform-origin: 0 0;
  display: block;
}
.parenting-design-controls .field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 0;
}
.parenting-design-controls .field-row label { font-size: 13px; font-weight: 600; color: #262626; flex: 1; }
.parenting-design-controls input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid #e5e7eb; border-radius: 4px; }
.parenting-design-controls select { padding: 4px 8px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 13px; }

/* 비교형 콘텐츠 편집 — 행 카드 (좌+vs+우 한 묶음) */
.compare-edit-headers {
  display: grid;
  grid-template-columns: 1fr 28px 1fr 36px;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}
.compare-edit-headers input {
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  background: #fafafa;
}
.compare-edit-headers .left-input  { border-left: 3px solid #dc2626; }
.compare-edit-headers .right-input { border-left: 3px solid #10b981; }
.compare-edit-headers .vs {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: #9ca3af;
  letter-spacing: 1px;
}

/* 행 한 단위 카드 */
.compare-row-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
  display: grid;
  grid-template-columns: 1fr 28px 1fr 36px;
  gap: 10px;
  align-items: start;
  transition: border-color 0.1s ease;
}
.compare-row-card:hover { border-color: #d1d5db; }
.compare-row-card .row-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.compare-row-card .row-side textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  overflow: hidden;
  min-height: 36px;
  box-sizing: border-box;
}
.compare-row-card .row-side textarea:focus { outline: none; border-color: #0095f6; }
/* 좌·우 표시는 작은 점 + 얇은 좌측 보더만 */
.compare-row-card .row-side.left  textarea { border-left: 3px solid #dc2626; }
.compare-row-card .row-side.right textarea { border-left: 3px solid #10b981; }
.compare-row-card .row-side .side-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 4px;
}
.compare-row-card .row-side.left  .side-label { color: #dc2626; }
.compare-row-card .row-side.right .side-label { color: #10b981; }
.compare-row-card .row-side .side-label::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.compare-row-card .row-vs {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: #9ca3af;
  margin-top: 24px;
  letter-spacing: 1px;
}
.compare-row-card .row-actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 18px;
}
.compare-row-card .row-actions button {
  width: 28px; height: 24px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  color: #6b7280;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compare-row-card .row-actions button:hover { background: #f3f4f6; border-color: #9ca3af; }
.compare-row-card .row-actions .btn-del:hover { background: #fef2f2; border-color: #dc2626; color: #dc2626; }
/* 부연 (sub) — 양 칸 아래 작은 input. 행 카드 내부 grid 끝에 column-span 으로 */
.compare-row-card .row-sub-wrap {
  grid-column: 1 / 4;
  margin-top: 4px;
}
.compare-row-card .row-sub-wrap input {
  width: 100%;
  padding: 6px 10px;
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  color: #6b7280;
  background: #fafafa;
  box-sizing: border-box;
}
.compare-row-card .row-sub-wrap input::placeholder { color: #c0c4cc; font-style: italic; }
.compare-row-card .row-sub-wrap input:focus { outline: none; border-style: solid; border-color: #0095f6; color: #1f2937; }

/* 단계 박스형 콘텐츠 편집 — 한 단계 카드 */
.step-row-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  gap: 10px;
  align-items: start;
}
.step-row-card:hover { border-color: #d1d5db; }
.step-row-no {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #2563eb;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  margin-top: 4px;
}
.step-row-body { display: flex; flex-direction: column; gap: 6px; }
.step-row-body textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  overflow: hidden;
  min-height: 36px;
  box-sizing: border-box;
}
.step-row-body textarea.step-head { font-weight: 700; }
.step-row-body textarea.step-detail { color: #6b7280; }
.step-row-body textarea:focus { outline: none; border-color: #0095f6; }
.step-row-body .step-sticker-pick {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
}
.step-row-body .step-sticker-pick select {
  flex: 1;
  padding: 4px 6px;
  border: 1px dashed #d1d5db;
  border-radius: 4px;
  font-size: 12px;
  background: #fafafa;
}
.step-row-card .row-actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.step-row-card .row-actions button {
  width: 28px; height: 24px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  color: #6b7280;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.step-row-card .row-actions button:hover { background: #f3f4f6; }
.step-row-card .row-actions .btn-del:hover { background: #fef2f2; border-color: #dc2626; color: #dc2626; }

/* 단계 풀이형 — 좌·우 캐릭터 페어 */
.step-row-card .step-side-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 6px 0;
}
.step-row-card .step-side-pair .side-left label,
.step-row-card .step-side-pair .side-right label {
  font-weight: 600;
}
.step-row-card .step-side-pair .side-left label::first-letter {
  color: #6b7280;
}
.step-row-card .step-side-pair .side-right label::first-letter {
  color: #0095f6;
}
.step-row-card input.step-title {
  font-weight: 700;
}
.step-row-card input.step-summary {
  font-weight: 700;
  background: #fff7ed;
}

/* visual_sections 요약 — 콘텐츠 편집 폼 (메타 라벨 없이 내용만) */
.vs-summary {
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vs-line {
  font-size: 13px;
  line-height: 1.5;
  color: #374151;
  font-weight: 500;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.vs-line.strong {
  font-weight: 800;
  color: #111827;
  font-size: 14px;
}
.vs-prefix {
  flex-shrink: 0;
  color: #0095f6;
  font-weight: 700;
  width: 16px;
  text-align: center;
}
.vs-line.strong .vs-prefix { color: #f59e0b; }

/* ============================================================
   인스타툰 2단계 — 등장인물·배경 자동 추천 / 풀 왕복 (B·C)
   ============================================================ */
.btn-link {
  background: none;
  border: none;
  color: #0095f6;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }

.cast-suggestions {
  border: 1px solid #dbeafe;
  background: #f5f9ff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

/* 주인공/조연 안내 힌트 + 분해 후 등장횟수 안내 */
.cast-hint {
  border: 1px solid #fde68a;
  background: #fffbeb;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
}
.cast-hint-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  line-height: 1.6;
}
.cast-hint-row .btn-secondary { margin-left: auto; padding: 4px 12px; font-size: 13px; }
.cast-hint-note { margin: 4px 0 6px; }

/* 조연 드롭다운 행 */
.supporting-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.supporting-row .supporting-select { flex: 1; }

/* 1단계 표현 방식 토글 (대사형 / 나레이션형) */
.story-style-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.story-style-opt { cursor: pointer; margin: 0; }
.story-style-opt input { position: absolute; opacity: 0; pointer-events: none; }
.story-style-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1.5px solid #e5e5ea;
  border-radius: 12px;
  background: #fff;
  height: 100%;
  transition: border-color .12s, background .12s;
}
.story-style-opt input:checked + .story-style-card {
  border-color: #0095f6;
  background: #f0f8ff;
}
.story-style-card strong { font-size: 14px; }
/* 표현 방식 변경 안내 배너 */
.story-style-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1.5px solid #ffd591;
  background: #fff7e6;
  border-radius: 12px;
}
.story-style-notice .ssn-text { flex: 1; min-width: 200px; }
.story-style-notice .ssn-text strong { display: block; font-size: 14px; color: #ad6800; }
.story-style-notice #ssn-apply { white-space: nowrap; }
@media (max-width: 560px) {
  .story-style-toggle { grid-template-columns: 1fr; }
}
.suggest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.suggest-group { margin-top: 10px; }
.suggest-group-label {
  font-size: 12px;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 6px;
}
.suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: white;
  border: 1px solid #e5edff;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.suggest-item-main { flex: 1; min-width: 0; }
.suggest-item .btn-secondary { flex-shrink: 0; padding: 6px 12px; font-size: 13px; }

/* 풀 카드 — [이 채널에 추가] */
.pool-add-to-channel {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 7px 8px;
  border: none;
  border-radius: 8px;
  background: #0095f6;
  color: white;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.pool-add-to-channel:hover { background: #1877cc; }

/* 풀 화면 상단 복귀 배너 */
.cast-return-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #fff7ed;
  border-bottom: 1px solid #fdba74;
  font-size: 13px;
  color: #7c2d12;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.cast-return-banner.hidden { display: none; }
.cast-return-banner .btn-link { color: #c2410c; white-space: nowrap; }

/* 대본(4단계) 패널별 배경 드롭박스 */
.panel-location-wrap { font-size: 13px; color: #6b7280; display: inline-flex; align-items: center; gap: 2px; }
.panel-location-select {
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  color: #374151;
  max-width: 160px;
}
.panel-location-select:focus { outline: none; border-color: #0095f6; }

/* 시리즈 분할 추천 (긴 내용 → 여러 화) */
.series-suggest {
  border: 1px solid #e9d5ff;
  background: #faf5ff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.series-suggest.hidden { display: none; }
.series-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.series-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: white;
  border: 1px solid #efe2ff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.series-item-main { flex: 1; min-width: 0; }

/* 1단계 고급 옵션 (장르·톤 접기) */
.adv-idea-options { margin: 4px 0 6px; }
.adv-idea-options > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 4px 0;
}
.adv-idea-options > summary::-webkit-details-marker { display: none; }

/* 캐스팅 지정 (콘티 등장인물 — 배우/배역) */
.cast-assign-select {
  padding: 5px 8px;
  border: 1px solid #c9b6f0;
  border-radius: 7px;
  font-size: 12px;
  font-family: inherit;
  background: white;
}
.cast-hint-row.cast-assigned { color: #2e7d32; }
.cast-hint-row .cast-arrow { font-size: 12px; }
.cast-hint-row .btn-cast-unassign { font-size: 11px; }

/* 재구성 영역 (추천 분할 아래) */
.series-recompose {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #e2d4f5;
}
.series-recompose > .muted-small { display: block; margin-bottom: 6px; }
.series-recompose #series-recompose-do { width: auto; margin: 0 0 0 6px; padding: 7px 14px; font-size: 13px; }
.series-recompose #split-keep-one { margin-top: 8px; display: inline-block; }

/* 화 수 지정 스테퍼 */
.series-count-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
.series-count-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #c9b6f0;
  background: white;
  border-radius: 7px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: #6b3fa0;
}
.series-count-btn:hover { background: #f3ecff; }
.series-count-val {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
}

/* 슬롯 칩 (분할 박스 / 이어 만들기 공용) */
.series-slot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.series-slot.done { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.series-slot.make {
  background: white;
  color: #6b3fa0;
  border: 1px solid #c9b6f0;
  cursor: pointer;
}
.series-slot.make:hover { background: #f3ecff; }

/* 이어 만들기 패널 (채널 화면) */
#series-resume .section-title { margin-bottom: 8px; }
.series-resume-item {
  border: 1px solid #efe2ff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #faf6ff;
}
.series-resume-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.series-resume-head strong { flex: 1; min-width: 0; }
.series-resume-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.series-item-title { font-weight: 700; font-size: 14px; color: #262626; }
.series-item-summary { font-size: 13px; color: #4b5563; margin-top: 4px; line-height: 1.5; }
.series-ep-badge {
  display: inline-block;
  background: #9333ea;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 4px;
}
.series-item .btn-secondary { flex-shrink: 0; padding: 6px 12px; font-size: 13px; white-space: nowrap; }
/* series-pick 은 btn-primary(width:100%) 라 그대로 두면 폭을 다 먹어 제목 칸이 0으로 찌그러져
   글자가 세로로 한 자씩 줄바꿈됨. 폭 자동 + 줄바꿈 금지로 고정. */
.series-item .series-pick {
  flex: 0 0 auto; width: auto; margin-top: 0;
  padding: 8px 14px; font-size: 13px; white-space: nowrap; align-self: center;
}
.series-choice { display: flex; gap: 8px; margin: 10px 0; }
.series-choice button { flex: 1; }

/* 사이드바 그룹 구분 (콘텐츠 / 도구모음) */
.nav-group-label,
.tool-section-label {
  font-size: 11px;
  font-weight: 800;
  color: #4b5563;
  letter-spacing: 0.06em;
  margin: 0 0 8px 4px;
}
.tool-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid #e5e5e5; }
.tool-list { display: flex; flex-direction: column; gap: 6px; }

/* 글자추출기 */
.ocr-thumb-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }

/* 추출 기록 */
.ocr-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ocr-history-header .btn-secondary {
  width: auto;
  margin-top: 0;
  padding: 5px 10px;
  font-size: 12px;
}
#ocr-history-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ocr-history-row {
  border: 1px solid #efefef;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafafa;
}
.ocr-history-meta { display: flex; gap: 6px; align-items: center; }
.ocr-history-ts { font-size: 12px; font-weight: 600; color: #444; }
.ocr-history-preview {
  font-size: 13px;
  color: #555;
  margin: 4px 0 8px;
  line-height: 1.4;
}
.ocr-history-actions { display: flex; gap: 6px; }
.ocr-history-actions .btn-icon {
  width: auto;
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  background: white;
  cursor: pointer;
}
.ocr-history-actions .btn-icon:hover { background: #f0f0f0; }
.ocr-thumb {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #efefef;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fafafa;
}
.ocr-thumb-idx {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: #0095f6; color: white;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.ocr-thumb img {
  width: 48px; height: 48px;
  object-fit: cover; border-radius: 8px;
  flex-shrink: 0; background: #fff; border: 1px solid #e5e5e5;
}
.ocr-thumb-name {
  flex: 1; min-width: 0;
  font-size: 13px; color: #374151;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ocr-thumb-actions { display: flex; gap: 4px; flex-shrink: 0; }
.btn-icon {
  width: 28px; height: 28px;
  border: 1px solid #dbdbdb; border-radius: 6px;
  background: white; cursor: pointer; font-size: 12px; color: #374151;
}
.btn-icon:hover:not(:disabled) { background: #f0f0f0; }
.btn-icon:disabled { opacity: 0.35; cursor: default; }
#ocr-result-text {
  width: 100%;
  border: 1px solid #dbdbdb; border-radius: 10px;
  padding: 12px; font-size: 14px; line-height: 1.6;
  resize: vertical; box-sizing: border-box; margin-bottom: 10px;
}
#ocr-result-text:focus { outline: none; border-color: #0095f6; }

/* 대본(4단계) 패널 이미지 프롬프트 편집 */
.panel-image-prompt-edit {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #374151;
  resize: vertical;
  font-family: inherit;
}
.panel-image-prompt-edit:focus { outline: none; border-color: #0095f6; }
.panel-prompt-save { margin-top: 6px; padding: 6px 12px; font-size: 13px; }

/* 배경 사진 갤러리 — 디자인 폼 안 */
.pa-bg-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  margin-bottom: 4px;
}
.pa-bg-thumb {
  position: relative;
  aspect-ratio: 1080/1350;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  background: #f3f4f6;
}
.pa-bg-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.pa-bg-thumb.selected { border-color: #0095f6; box-shadow: 0 0 0 2px rgba(0,149,246,0.25); }
.pa-bg-thumb .pa-bg-del {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}
.pa-bg-thumb .pa-bg-del:hover { background: #ef4444; }
.pa-bg-gallery-empty {
  grid-column: 1 / -1;
  padding: 10px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
}

/* 텍스트 편집 사이드바 — 디자인 폼 안 활성 영역 */
.pa-text-edit-side {
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  margin-top: 14px;
}
.pa-text-edit-side.active {
  background: #eff6ff;
  border-color: #93c5fd;
}

/* 시각화 템플릿 수평 탭 */
.vt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.vt-tab {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.1s;
}
.vt-tab:hover { background: #e5e7eb; }
.vt-tab.selected {
  background: #0095f6;
  border-color: #0095f6;
  color: white;
}

/* === parenting2 color palette collapse (편집 모달) === */
.p2-color-collapse summary { list-style: none; }
.p2-color-collapse summary::-webkit-details-marker { display: none; }
.p2-color-collapse summary::marker { content: ""; }
.p2-color-collapse[open] .p2-color-collapse-arrow { transform: rotate(180deg); }
.p2-color-collapse .p2-modal-card-color:hover { transform: scale(1.05); }
.p2-color-collapse summary:hover { background: #f3f4f6; }

/* === parenting2 테마 선택 그리드 (1단계) — 스크롤 박스로 세로 길이 제한 === */
.p2-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);   /* 2열 = 썸네일 크게 */
  gap: 10px;
  margin-top: 8px;
  max-height: 64vh;          /* 처음에 약 6개(3행)가 보이고 그 아래는 스크롤 */
  overflow-y: auto;
  padding: 4px 8px 4px 4px;
  border: 1px solid #eceae5;
  border-radius: 10px;
  background: #fbfaf7;
}
.p2-theme-grid::-webkit-scrollbar { width: 8px; }
.p2-theme-grid::-webkit-scrollbar-thumb { background: #d8d4cb; border-radius: 99px; }
.p2-theme-grid::-webkit-scrollbar-track { background: transparent; }
.p2-theme-card {
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.p2-theme-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
/* 화면이 아주 넓으면 3열까지 */
@media (min-width: 1500px) {
  .p2-theme-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 육아 채널 카드 — 채널명 크게, @핸들 작게, 눈에 잘 띄게 */
.p2-channel-card {
  cursor: pointer;
  padding: 22px 24px;
  background: #fff;
  border: 2px solid #e7e3da;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.p2-channel-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.10);
  border-color: #0095f6;
}
.p2-channel-card-name {
  font-size: 22px;
  font-weight: 900;
  color: #111827;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
}
.p2-channel-card-handle {
  font-size: 14px;
  font-weight: 600;
  color: #9aa0a6;
}

/* 육아 스텝 하단 네비 버튼 — 통일 크기·정렬, '이전' 줄바꿈 방지 */
.p2-nav-row { display: flex; gap: 8px; align-items: stretch; }
.p2-nav-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 13px 14px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;       /* '← 이전' 2줄 깨짐 방지 */
  border-radius: 10px;
  line-height: 1.2;
}
.p2-edit-btn {
  padding: 13px 14px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
}

/* ── 육아 AI HTML 편집기 패널 (통일 톤) ───────────────────── */
#p2-edit-modal-body { color: #1f2430; font-size: 13px; }
.p2h-sec { padding: 14px 0; border-bottom: 1px solid #eef0f3; }
.p2h-sec-title { font-size: 12px; font-weight: 800; color: #111827; display: flex; align-items: center; gap: 6px; margin-bottom: 9px; }
.p2h-sec-title .hint { font-weight: 500; font-size: 10.5px; color: #9aa0a6; }
.p2h-hint { font-size: 10.5px; color: #9aa0a6; line-height: 1.55; margin: 2px 0 10px; }
.p2h-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.p2h-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; min-width: 34px; padding: 0 12px;
  border: 1px solid #dfe3e8; border-radius: 9px; background: #fff;
  color: #374151; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.p2h-btn:hover { background: #f3f5f7; border-color: #cbd1d8; }
.p2h-btn.active { background: #e8f3ff; border-color: #0095f6; color: #0a6fc2; }
.p2h-color-wrap {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
  border: 1px solid #dfe3e8; border-radius: 9px; background: #fff; font-size: 12px; color: #6b7280;
}
.p2h-color-wrap input[type=color] { width: 22px; height: 22px; padding: 0; border: none; border-radius: 5px; background: none; cursor: pointer; }
.p2h-seg { display: inline-flex; border: 1px solid #dfe3e8; border-radius: 9px; overflow: hidden; }
.p2h-seg .p2h-btn { border: none; border-left: 1px solid #eef0f3; border-radius: 0; }
.p2h-seg .p2h-btn:first-child { border-left: none; }
.p2h-select { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #dfe3e8; border-radius: 9px; font-size: 13px; background: #fff; cursor: pointer; }
.p2h-subhead { font-size: 10.5px; font-weight: 700; color: #8a9099; margin: 12px 0 6px; letter-spacing: .3px; }
.p2h-colorbox { border: 1px solid #eef0f3; border-radius: 10px; background: #fafbfc; overflow: hidden; margin-bottom: 2px; }
.p2h-colorbox > summary { cursor: pointer; padding: 11px 13px; list-style: none; user-select: none; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: #111827; }
.p2h-colorbox > summary::-webkit-details-marker { display: none; }
.p2h-colorbox-body { padding: 2px 13px 14px; }
.p2h-pal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.p2h-pal { cursor: pointer; padding: 5px; border: 2px solid #e5e7eb; border-radius: 9px; background: #fff; display: flex; flex-direction: column; gap: 5px; transition: transform .12s, border-color .12s; }
.p2h-pal:hover { transform: translateY(-1px); }
.p2h-pal-sw { display: flex; height: 24px; border-radius: 5px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.p2h-pal-name { font-size: 10px; font-weight: 600; color: #4b5563; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p2h-save {
  width: 100%; margin-top: 18px; padding: 13px; border: none; border-radius: 11px;
  background: #0095f6; color: #fff; font-weight: 800; font-size: 14px; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,149,246,.25); transition: background .12s;
}
.p2h-save:hover { background: #0080d6; }
.p2h-save-note { font-size: 10px; text-align: center; margin-top: 8px; color: #9aa0a6; }

/* 카드별 미리보기 버튼 */
.p2-theme-preview-btn {
  width: 100%;
  margin-top: 6px;
  padding: 5px 0;
  font-size: 11px;
  font-weight: 700;
  color: #4b5563;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.p2-theme-preview-btn:hover { background: #0095f6; color: #fff; border-color: #0095f6; }

/* === 테마 미리보기 라이트박스 === */
.p2-theme-preview-ov {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(20, 20, 24, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: p2pvFade .15s ease;
}
@keyframes p2pvFade { from { opacity: 0; } to { opacity: 1; } }
.p2-theme-preview-box {
  background: #fff; border-radius: 16px;
  width: min(960px, 96vw); max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.p2-theme-preview-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px 12px; border-bottom: 1px solid #eee;
}
.p2-theme-preview-close {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px;
  border: none; background: #f1f1f3; color: #555; font-size: 15px; cursor: pointer;
}
.p2-theme-preview-close:hover { background: #e5e5e8; }
/* 슬라이드 무대 — 좌우 화살표(9시/3시)를 strip 위에 띄움 */
.p2-theme-preview-stage { position: relative; background: #f7f7f9; }
.p2-theme-preview-strip {
  display: flex; gap: 12px; align-items: stretch;
  height: 62vh; padding: 16px 56px; overflow-x: auto; overflow-y: hidden;
  scroll-behavior: smooth; scroll-snap-type: x proximity;
}
.p2-theme-preview-strip > img { scroll-snap-align: center; }
.p2-theme-preview-strip::-webkit-scrollbar { height: 9px; }
.p2-theme-preview-strip::-webkit-scrollbar-thumb { background: #c7c7cf; border-radius: 99px; }
/* 9시/3시 원형 화살표 버튼 */
.p2-theme-preview-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.95);
  box-shadow: 0 3px 12px rgba(0,0,0,0.25);
  color: #222; font-size: 26px; line-height: 1; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2; transition: background .12s, transform .12s;
}
.p2-theme-preview-nav:hover { background: #0095f6; color: #fff; transform: translateY(-50%) scale(1.08); }
.p2-theme-preview-nav.prev { left: 12px; padding-right: 3px; }
.p2-theme-preview-nav.next { right: 12px; padding-left: 3px; }
.p2-theme-preview-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px 16px;
}

/* ============================================================ */
/* 도구모음 — 모델 비교기                                        */
/* ============================================================ */
#screen-image-compare .field-label {
  display: block; font-size: 13px; font-weight: 600; color: #444; margin: 4px 0;
}
#imgcmp-prompt {
  width: 100%; box-sizing: border-box; font-size: 13px; line-height: 1.5;
  resize: vertical; padding: 10px 12px;
}
.imgcmp-ref-row {
  display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: 6px 0 4px;
}
.imgcmp-ref-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.imgcmp-ref-thumb { position: relative; width: 64px; height: 64px; }
.imgcmp-ref-thumb img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid #ddd;
}
.imgcmp-ref-thumb button {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: #222; color: #fff; font-size: 14px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.imgcmp-ref-thumb-pool img { border-color: #0095f6; }
.imgcmp-pool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px; margin-top: 12px;
}
.imgcmp-pool-cell {
  border: 2px solid #eee; border-radius: 10px; background: #fff; cursor: pointer;
  padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.imgcmp-pool-cell img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; background: #fafafa;
}
.imgcmp-pool-cell span { font-size: 12px; color: #444; font-weight: 600; }
.imgcmp-pool-cell.picked { border-color: #0095f6; box-shadow: 0 0 0 2px rgba(0,149,246,.2); }
.imgcmp-wrapper-row {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 12px;
  padding: 8px 12px; background: #f6f8fa; border-radius: 8px;
}
.imgcmp-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #333; cursor: pointer; }
.imgcmp-check input { margin: 0; }
.imgcmp-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px;
}
.imgcmp-controls .field-label { margin: 0; }
.imgcmp-controls select { padding: 6px 10px; }
.imgcmp-controls .btn-primary { margin-left: auto; }
.imgcmp-tabs { display: flex; gap: 6px; border-bottom: 2px solid #eee; margin-bottom: 16px; }
.imgcmp-tab {
  padding: 8px 16px; border: none; background: transparent; cursor: pointer;
  font-size: 14px; font-weight: 600; color: #888; border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.imgcmp-tab.active { color: #0095f6; border-bottom-color: #0095f6; }
.imgcmp-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.imgcmp-meta .field-label { margin: 0; }
.imgcmp-model {
  flex: 1; min-width: 220px; padding: 6px 10px; font-size: 13px; font-family: monospace;
}
.imgcmp-status { min-height: 18px; margin-bottom: 8px; }
.imgcmp-image { min-height: 120px; }
.imgcmp-result-img {
  max-width: 100%; width: 512px; border-radius: 10px; border: 1px solid #eee;
  display: block;
}


/* 1단계 아이디어 인라인 편집 + 부분 재생성 */
.idea-editable { outline: none; border-radius: 6px; padding: 2px 5px; transition: background .12s, box-shadow .12s; cursor: text; }
.idea-editable:hover { background: #f4f6f9; }
.idea-editable:focus { background: #fff8e6; box-shadow: 0 0 0 2px #ffd591; }
h2.idea-editable { display: inline-block; }
.idea-edit-hint { margin-top: 8px; }
.idea-regen-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.idea-regen-row #idea-regen-feedback { flex: 1; min-width: 220px; padding: 8px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; }
.idea-regen-row #btn-idea-regen { white-space: nowrap; }


/* 경제 디자인: 큰 파란 '저장하고 다음으로' CTA + 큰 화면 버튼 + 페이지 좌우 화살표 */
.econ-render-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.econ-render-controls .econ-cta-next {
  font-size: 17px; font-weight: 800; padding: 14px 24px; flex: 1 1 240px;
  background: #2563eb; border-color: #2563eb; color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
}
.econ-render-controls .econ-cta-next:hover { background: #1d4ed8; }
.econ-render-controls .econ-fullscreen-cta {
  font-size: 15px; font-weight: 700; padding: 14px 18px;
  background: #3b82f6; border-color: #3b82f6; color: #fff;
}
.econ-render-controls .econ-fullscreen-cta:hover { background: #2563eb; }
.econ-page-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.econ-page-nav button {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid #2563eb; background: #fff; color: #2563eb;
  font-size: 17px; cursor: pointer; line-height: 1;
}
.econ-page-nav button:disabled { opacity: .3; cursor: default; }
.econ-page-nav button:not(:disabled):hover { background: #eff6ff; }
.econ-page-nav .econ-page-label { font-weight: 700; min-width: 96px; text-align: center; }


/* 4단계에서 아래 [다음 단계로]가 저장+확정렌더+이동 CTA 가 될 때 — 크고 파랗게 */
#btn-econ-next-step.econ-next-cta {
  background: #2563eb; border-color: #2563eb; color: #fff;
  font-size: 16px; font-weight: 800; box-shadow: 0 4px 14px rgba(37,99,235,.35);
}
#btn-econ-next-step.econ-next-cta:hover { background: #1d4ed8; }


/* 큰 화면(전체화면) 캐러셀 좌우 화살표 — iframe 양옆 */
.econ-design-iframe-wrap { position: relative; }
.econ-fs-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 60;
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: rgba(37,99,235,.85); color: #fff; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.econ-fs-arrow:hover { background: #1d4ed8; }
.econ-fs-arrow:disabled { opacity: .25; cursor: default; }
.econ-fs-prev { left: 10px; }
.econ-fs-next { right: 10px; }
body.econ-fullscreen .econ-fs-arrow { width: 62px; height: 62px; font-size: 28px; }
body.econ-fullscreen .econ-fs-prev { left: 28px; }
body.econ-fullscreen .econ-fs-next { right: 28px; }


/* 경제 미리보기 글자 더블클릭 편집 모달 */
.econ-text-editor-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
}
.econ-text-editor-box {
  background: #fff; border-radius: 14px; padding: 18px 20px;
  width: min(520px, 92vw); box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.econ-text-editor-head { font-weight: 700; margin-bottom: 10px; }
.econ-text-editor-area {
  width: 100%; font-size: 15px; line-height: 1.5; padding: 10px 12px;
  border: 1.5px solid #ddd; border-radius: 10px; resize: vertical; font-family: inherit;
}
.econ-text-editor-area:focus { border-color: #2563eb; outline: none; }
.econ-text-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }


/* 큰 화면(전체화면)일 때만 우상단 X 닫기 버튼 */
.econ-fs-close { display: none; }
body.econ-fullscreen .econ-fs-close {
  display: flex; position: fixed; top: 18px; right: 22px; z-index: 10000;
  width: 50px; height: 50px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.55); color: #fff; font-size: 22px; cursor: pointer;
  align-items: center; justify-content: center; line-height: 1;
}
body.econ-fullscreen .econ-fs-close:hover { background: rgba(0,0,0,.82); }
