* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f2430;
  --border: #2a3140;
  --text: #e6e9ef;
  --muted: #97a0b0;
  --accent: #6ea8fe;
  --accent-2: #ff7aa2;
  --ok: #57d38c;
  --warn: #f4b740;
  --err: #ff6b6b;
}

body {
  font-family: "Pretendard", "Malgun Gothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}
html, body { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { width: 0; height: 0; display: none; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.hidden { display: none !important; }
a { color: inherit; }

/* =========================== 상단바 =========================== */
.topbar {
  display: flex; align-items: center; justify-content: flex-start; gap: 32px;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.topnav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-link {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 7px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
  font-family: inherit;
}
.nav-link:hover { color: var(--text); background: var(--panel-2); }
.nav-link.active { color: var(--text); background: var(--panel-2); border-color: var(--accent); }

/* =========================== 페이지 공통 =========================== */
.page { height: calc(100vh - 57px); overflow-y: auto; padding: 28px 32px 60px; }
.page-inner { max-width: 1400px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-title { font-size: 22px; margin-bottom: 6px; }
.page-hint { font-size: 13px; color: var(--muted); line-height: 1.6; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin: 26px 0 10px; }
.section-head h3 { font-size: 15px; color: var(--muted); }

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}

button { font-family: inherit; }
/* 테두리는 늘 1px 자리를 차지한다(평소엔 투명) — 테두리가 생겨도 크기가 변하지 않게 */
.primary-btn {
  background: var(--accent); color: #0b1023; border: 1px solid transparent;
  padding: 8px 17px; border-radius: 8px; font-size: 14px; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: filter .12s ease;
}
.primary-btn:hover { filter: brightness(1.08); }
/* 이미 확정된 것을 되돌리는 자리 — 실행 버튼처럼 보이지 않게 (크기는 그대로) */
.primary-btn.undo { background: transparent; border-color: var(--border); color: var(--muted); }
.primary-btn.undo:hover { border-color: var(--err); color: var(--err); filter: none; }

/* =========================== 홈 =========================== */
.stat-row { display: flex; gap: 16px; margin: 22px 0 4px; flex-wrap: wrap; }
.stat-card {
  flex: 1 1 170px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px;
}
.stat-num { font-size: 30px; font-weight: 700; color: var(--accent); }
.stat-num.dim { color: var(--muted); }
.stat-lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat-sub { font-size: 11.5px; color: var(--muted); margin-top: 6px; opacity: .8; }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.menu-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; cursor: pointer; text-align: left; color: var(--text);
  transition: border-color .12s ease, background .12s ease;
}
.menu-card:hover { border-color: var(--accent); background: var(--panel-2); }
.menu-ico { font-size: 22px; margin-bottom: 4px; }
.menu-name { font-size: 15px; font-weight: 700; }
.menu-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.menu-state {
  margin-top: 10px; font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
}
.menu-state.ready { color: var(--ok); border-color: rgba(87, 211, 140, .5); }

/* =========================== 테이블 =========================== */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.search-input {
  flex: 0 1 340px; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); padding: 9px 12px; border-radius: 8px; font-size: 13.5px;
  font-family: inherit; outline: none;
}
.search-input:focus { border-color: var(--accent); }
.count-badge {
  font-size: 12px; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--border); padding: 5px 10px; border-radius: 999px;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 12px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--panel-2);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--panel-2); }
.td-no { color: var(--muted); font-size: 12.5px; }
.td-cover {
  width: 40px; height: 56px; border-radius: 5px; object-fit: cover;
  border: 1px solid var(--border); display: block; background: var(--panel-2);
}
.td-cover.none {
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; color: #5d6678; text-align: center; line-height: 1.2;
}
/* 작품명(한/영)은 항상 한 줄 — 부족한 폭은 링크 열이 두 줄로 접히며 양보한다 */
.td-ko { font-weight: 600; white-space: nowrap; }
.td-en { color: var(--muted); white-space: nowrap; }
.td-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
/* 등록된 캐릭터 수 — 행을 클릭하면 캐릭터 관리로 들어간다 */
.td-char {
  display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px;
  border-radius: 999px; background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--border); white-space: nowrap;
}
.td-char.on { color: var(--ok); border-color: rgba(87, 211, 140, .5); }
.data-table tbody tr[data-open] { cursor: pointer; }
.dash { color: #4b5468; }

/* 링크는 최대 두 줄까지 접히고 넘치면 … 처리 (긴 URL 이 표 폭을 늘리지 않게) */
.site-link {
  color: var(--accent); text-decoration: none; font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-width: 100%;
  /* 되도록 / 나 - 같은 자연스러운 지점에서 접고, 정 안 되면 그때만 단어 중간을 자른다 */
  word-break: normal; overflow-wrap: anywhere;
}
.site-link:hover { text-decoration: underline; }

.row-actions { display: flex; gap: 6px; }
.icon-btn {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 5px 10px; border-radius: 6px; font-size: 12px; cursor: pointer;
  white-space: nowrap; transition: all .12s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); background: var(--panel-2); }
.icon-btn.del:hover { color: var(--err); border-color: var(--err); }

.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.7; }

/* 홈 최근 목록 */
.recent-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13.5px;
}
.recent-row:last-child { border-bottom: none; }
.recent-row:hover { background: var(--panel-2); }
.recent-ko { font-weight: 600; }
.recent-en { color: var(--muted); font-size: 12.5px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-date { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* 준비 중 페이지 */
.soon-card { padding: 56px 20px; text-align: center; }
.soon-ico { font-size: 40px; margin-bottom: 14px; }
.soon-msg { color: var(--muted); font-size: 14px; line-height: 1.7; margin-bottom: 20px; }

/* =========================== 배너 관리: 작품 카드 그리드 =========================== */
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(318px, 1fr)); gap: 14px; }
.work-card {
  display: flex; gap: 14px; align-items: stretch;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; cursor: pointer; text-align: left; color: var(--text);
  transition: border-color .12s ease, background .12s ease;
}
.work-card:hover { border-color: var(--accent); background: var(--panel-2); }
.wc-cover {
  flex: 0 0 90px; width: 90px; height: 126px;        /* 300x420 비율 */
  border-radius: 8px; overflow: hidden; background: var(--panel-2);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
}
.wc-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wc-cover-none { font-size: 10.5px; color: #5d6678; text-align: center; line-height: 1.4; }
.wc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
/* 작품명은 두 줄까지 보여준다 (한 줄로 잘라 …로 끝나면 어떤 작품인지 알기 어려움) */
.wc-ko {
  font-size: 15px; font-weight: 700; line-height: 1.35; word-break: keep-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wc-en {
  font-size: 12.5px; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wc-foot { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: auto; flex-wrap: wrap; }
.wc-assets {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
}
.wc-assets.on { color: var(--ok); border-color: rgba(87, 211, 140, .5); }
.wc-go { margin-left: auto; font-size: 12px; color: var(--accent); }

/* =========================== 배너 관리: 상세(좌측 서브메뉴 + 본문) =========================== */
.detail-layout { display: flex; gap: 24px; align-items: flex-start; max-width: 1400px; margin: 0 auto; }
.submenu {
  flex: 0 0 236px; position: sticky; top: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px;
}
.submenu-back {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  font-size: 12.5px; padding: 2px 0 10px; font-weight: 600;
}
.submenu-back:hover { color: var(--text); }
.submenu-work { border-top: 1px solid var(--border); padding: 12px 2px 14px; }
.submenu-ko { font-size: 15px; font-weight: 700; line-height: 1.4; }
.submenu-en { font-size: 12px; color: var(--muted); margin-top: 3px; }
.submenu-link {
  display: block; margin-top: 8px; font-size: 11.5px; color: var(--accent);
  text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.submenu-link:hover { text-decoration: underline; }
.submenu-nav { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--border); padding-top: 12px; }
/* 캐릭터 목록 머리말 + 추가 버튼 */
.submenu-head {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); padding: 12px 2px 8px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.submenu-nav .smi-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
/* 캐릭터 목록의 작은 세로형 썸네일 */
.smi-thumb {
  flex: 0 0 22px; width: 22px; height: 30px; border-radius: 4px;
  overflow: hidden; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
}
.smi-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* 캐릭터 대표 이미지 — 비율이 제각각(3:4~9:16)이라 자르지 않고 틀 안에 전체가 보이도록.
   .cover-drop img 의 object-fit:cover(작품 대표 이미지용)를 덮어야 하므로 선택자를 더 좁게 준다. */
.char-cover-drop { height: 240px; }
.cover-drop.char-cover-drop img { width: 100%; height: 100%; object-fit: contain; }
/* 전체 보기 — 캐릭터 순서대로 시트를 묶어 나열 */
.smi-all { padding-left: 13px; }
.char-group + .char-group { margin-top: 26px; }
.cg-head {
  display: flex; align-items: center; gap: 10px;
  padding: 0 2px 10px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.cg-thumb {
  flex: 0 0 34px; width: 34px; height: 46px; border-radius: 5px;
  overflow: hidden; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
}
.cg-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* 이름·대표 이미지를 누르면 그 캐릭터의 시트 관리 화면으로 (시트 관리 버튼과 같은 곳) */
.cg-go {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: none; padding: 0; margin: 0;
  color: inherit; font: inherit; cursor: pointer; text-align: left;
}
.cg-name { font-size: 15px; font-weight: 700; }
.cg-go:hover .cg-name { color: var(--accent); }
.cg-go:hover .cg-thumb { border-color: var(--accent); }
.cg-en { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.cg-head .count-badge { margin-left: 4px; font-weight: 400; }
.cg-head .icon-btn { margin-left: auto; }
.cg-empty { font-size: 12.5px; color: var(--muted); padding: 2px 2px 4px; }

.char-head { align-items: flex-start; gap: 16px; }
.char-head-text { flex: 1; min-width: 0; }
.char-cover-box {
  flex: 0 0 96px; width: 96px; height: 128px;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.char-cover-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.submenu-add {
  width: 100%; margin-top: 10px; padding: 9px 10px;
  background: var(--panel-2); border: 1px dashed var(--border); color: var(--muted);
  border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all .12s ease;
}
.submenu-add:hover { color: var(--text); border-color: var(--accent); background: var(--bg); }
.submenu-item {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 9px 11px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; text-align: left;
}
.submenu-item:hover { color: var(--text); background: var(--panel-2); }
.submenu-item.active { color: var(--text); background: var(--panel-2); border-color: var(--accent); }
.submenu-badge {
  margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px;
  border-radius: 999px; background: var(--bg); color: var(--accent); border: 1px solid var(--border);
}
.submenu-soon {
  margin-left: auto; font-size: 10px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 6px;
}
.detail-main { flex: 1; min-width: 0; }

/* =========================== 업로드 드롭존 =========================== */
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; background: var(--panel);
  padding: 26px 20px; text-align: center; cursor: pointer; margin-bottom: 18px;
  transition: border-color .12s ease, background .12s ease;
}
.dropzone:hover { border-color: var(--accent); background: var(--panel-2); }
.dropzone.over { border-color: var(--accent); background: rgba(110, 168, 254, .1); }
.dz-ico { font-size: 24px; margin-bottom: 8px; }
.dz-main { font-size: 14px; font-weight: 600; }
.dz-sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.dz-kind { margin-top: 14px; font-size: 12.5px; color: var(--muted); cursor: default; }
.dz-kind select {
  margin-left: 8px; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px;
  font-size: 12.5px; font-family: inherit; cursor: pointer; outline: none;
}
.dz-kind select:focus { border-color: var(--accent); }
.dz-progress { margin-top: 12px; font-size: 12.5px; color: var(--accent); font-weight: 600; }

/* =========================== 종류 필터 =========================== */
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.filter-btn:hover { color: var(--text); background: var(--panel-2); }
.filter-btn.active { color: var(--text); border-color: var(--accent); background: var(--panel-2); }
.filter-c { color: var(--muted); font-size: 11px; margin-left: 3px; }

/* =========================== 에셋 그리드 =========================== */
/* 투명 배경(컷 이미지) 확인용 체커보드 */
.checker {
  background-color: #20242e;
  background-image:
    linear-gradient(45deg, #2b3140 25%, transparent 25%, transparent 75%, #2b3140 75%),
    linear-gradient(45deg, #2b3140 25%, transparent 25%, transparent 75%, #2b3140 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
/* 이미지 갤러리 — 세로형·가로형이 섞여도 각자 비율을 유지한 채 빈틈 없이 쌓이도록
   multi-column(메이슨리) 배치. 카드 높이는 이미지 비율이 정한다. */
/* 열 개수를 창 너비로 못박는다 — column-width 로 두면 남는 폭에 따라 2열/3열이 오락가락해
   작품마다 다르게 보인다. 어느 작품이든 같은 화면 크기면 같은 개수가 나오도록 고정. */
.asset-grid { column-count: 3; column-gap: 14px; }
/* 좁은 화면에서만 줄인다 — 넓은 화면에서도 4열로 늘리지 않는다(이미지가 작아짐) */
@media (max-width: 999px) { .asset-grid { column-count: 2; } }
@media (max-width: 699px) { .asset-grid { column-count: 1; } }
.asset-card {
  position: relative; display: block; width: 100%;
  break-inside: avoid; -webkit-column-break-inside: avoid;
  margin: 0 0 14px; border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer;
  transition: border-color .12s ease;
}
.asset-card:hover { border-color: var(--accent); }
.asset-card img { display: block; width: 100%; height: auto; }

/* 이미지 크기 — 좌측 하단에 작은 뱃지로. 평소엔 숨기고 마우스를 올렸을 때만 표시.
   (그라데이션으로 이미지 아래를 덮지 않고 뱃지 자체에만 배경을 준다) */
.ac-size {
  position: absolute; left: 8px; bottom: 8px;
  /* 박스·외곽선 없이 글자만. 딱딱한 1px 테두리 대신 글자에 바짝 붙는 부드러운
     검정 음영을 여러 겹 겹쳐, 흰 배경 위에서도 읽히되 진해 보이지 않게 한다. */
  color: #fff; font-size: 10.5px; font-weight: 500; letter-spacing: .3px;
  text-shadow:
    0 0 2px rgba(0, 0, 0, .95), 0 0 3px rgba(0, 0, 0, .85),
    0 1px 2px rgba(0, 0, 0, .9), 0 0 6px rgba(0, 0, 0, .55);
  opacity: 0; transition: opacity .14s ease; pointer-events: none;
}
.asset-card:hover .ac-size { opacity: 1; }

/* 삭제 — 이미지 우측 상단 (x) */
.ac-del {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 17px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .14s ease, background .12s ease;
}
.asset-card:hover .ac-del { opacity: 1; }
.ac-del:hover { background: var(--err); border-color: var(--err); }

/* =========================== 비율별 이미지 =========================== */
/* 원본 썸네일 좌측 상단 — 이 원본으로 만들어 둔 배너 비율만 표시한다(없으면 아무것도 안 보임) */
/* 확정된 배너 사이즈 — 어떤 그림 위에서도 읽히도록 사이즈마다 뱃지로 */
.ac-made { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; pointer-events: none; }
.ac-made span {
  font-size: 9.5px; font-weight: 700; letter-spacing: .2px; line-height: 1.5;
  color: #4fae7a; background: rgba(8, 11, 16, .7);
  padding: 1px 5px; border-radius: 4px;
}
/* 내려받기 — 이미지 우측 상단, 마우스를 올렸을 때만 (삭제 (×) 와 같은 자리·같은 모양) */
.ac-dl {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 15px; line-height: 1; text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .14s ease, background .12s ease;
}
.asset-card:hover .ac-dl { opacity: 1; }
.ac-dl:hover { background: var(--accent); border-color: var(--accent); color: #0b0f14; }

/* 확장 이미지를 그리고 있는 원본 — 목록에서도 진행 중임을 알 수 있게 */
.ac-busy {
  position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; color: var(--accent); pointer-events: none;
  text-shadow: 0 0 3px rgba(0, 0, 0, .95), 0 1px 2px rgba(0, 0, 0, .9);
}
.ac-busy i {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid rgba(110, 168, 254, .3); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
/* 차례를 기다리는 중 — 도는 대신 조용히 깜박인다 */
.ac-busy.wait { color: var(--muted); }
.ac-busy.wait i {
  border-color: rgba(255, 255, 255, .25); animation: blink 1.6s infinite;
}

/* 업로드 뒤 자동으로 준비하는 확장 이미지 진행 상황 */
.exp-queue {
  margin-left: auto; display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 5px 8px 5px 11px; border-radius: 999px;
}
.exp-queue b { color: var(--accent); font-weight: 700; }
.eq-spin {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid rgba(110, 168, 254, .25); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
.eq-sub { margin-left: 7px; font-size: 11px; opacity: .8; }
.exp-queue .av-btn { padding: 3px 9px; font-size: 11.5px; }
.warn { color: var(--err); }
/* --------------------------- 자르기 화면 --------------------------- */
.crop-editor {
  width: 92vw; max-width: 1180px; height: 90vh;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
}
.ce-head, .ce-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; flex-shrink: 0;
}
.ce-head { border-bottom: 1px solid var(--border); }
.ce-foot { border-top: 1px solid var(--border); }
.ce-main { flex: 1; min-height: 0; display: flex; }

/* 상단 — 자를 대상 고르기 (원본 / 확장 이미지 3종) */
.ce-src { display: flex; gap: 6px; flex: 1; min-width: 0; flex-wrap: wrap; }
.ce-srcbtn {
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  padding: 5px 12px; border-radius: 8px; cursor: pointer; text-align: left;
}
.ce-srcbtn:hover { color: var(--text); }
.ce-srcbtn.active { color: var(--text); border-color: var(--accent); }
.ce-srcbtn.none { border-style: dashed; }
/* 지금 그리고 있는 모양 / 만들지 못한 모양 */
.ce-srcbtn.busy { border-style: dashed; border-color: var(--accent); }
.ce-srcbtn.busy .csb-sub { color: var(--accent); font-weight: 700; animation: blink 1.4s infinite; }
.ce-srcbtn.wait { border-style: dashed; }
.ce-srcbtn.wait .csb-sub { color: var(--muted); font-weight: 700; }
.ce-srcbtn.fail .csb-sub { color: var(--err); }
.csb-name { font-size: 12.5px; font-weight: 700; }
.csb-sub { font-size: 10px; color: var(--muted); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* 확장 이미지 채우기 방식 */
.ce-expbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--panel-2);
  flex-shrink: 0;
}
.ce-expbar-t { font-size: 11.5px; color: var(--muted); }
/* 어떻게 넓힐지 — 비워 두면 AI 가 이미지를 보고 정한다 */
.ce-note {
  flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 12px;
  padding: 6px 10px; border-radius: 7px; outline: none;
}
.ce-note:focus { border-color: var(--accent); }
.ce-note::placeholder { color: #6b7486; }
.ce-note:disabled { opacity: .6; }
.ce-drawing { font-size: 12px; color: var(--accent); font-weight: 700; white-space: nowrap; }
.ce-fills { display: flex; gap: 6px; }
.ce-fill {
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  padding: 4px 10px; border-radius: 7px; font-size: 11.5px; cursor: pointer;
}
.ce-fill:hover { color: var(--text); border-color: var(--muted); }
.ce-fill.active { color: var(--text); border-color: var(--accent); }
.ce-fill:disabled { opacity: .5; cursor: default; }
.ce-fill.go { color: var(--accent); border-color: var(--accent); font-weight: 700; padding: 5px 14px; }
.ce-fill.go:hover { background: var(--bg); }
.ce-expbar-t b { color: var(--text); font-weight: 700; }
#ceExpDel { margin-left: auto; }
.av-btn.del:hover { border-color: var(--err); color: var(--err); }

/* 아직 만들지 않은 확장 이미지 자리 */
.ce-none { text-align: center; color: var(--muted); font-size: 13px; line-height: 1.7; }
.ce-none b { color: var(--text); }
.cn-shape {
  width: 120px; margin: 0 auto 16px; border: 1px dashed var(--border); border-radius: 8px;
  background: rgba(255, 255, 255, .02);
  display: flex; align-items: center; justify-content: center;
}
/* 그리는 중 — 그 모양 그대로 두고 안에서 돌려 준다 */
.cn-shape.busy { border-color: var(--accent); animation: blink 1.8s infinite; }
.cn-spin {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(110, 168, 254, .25); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
/* 차례를 기다리는 중 — 아직 그리지 않으므로 돌리지 않는다 */
.cn-spin.wait {
  border-color: rgba(255, 255, 255, .22); animation: blink 1.6s infinite;
}
.cn-sub { font-size: 12px; margin-top: 6px; }
.ce-work { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* 좌측 — 배너 사이즈별 결과. 틀 자체가 그 비율이라 어떤 모양인지 바로 보인다. */
.ce-side {
  flex: 0 0 186px; border-right: 1px solid var(--border);
  padding: 12px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.ce-size {
  border: 1px solid transparent; border-radius: 10px; padding: 8px;
}
.ce-size:hover { background: var(--panel-2); }
.ce-size.active { border-color: var(--accent); background: var(--panel-2); }
.cs-pick {
  display: flex; flex-direction: column; gap: 6px; width: 100%;
  background: transparent; border: none; padding: 0; color: inherit;
  cursor: pointer; text-align: left; font: inherit;
}
/* 만들어진 경우에만 — 크기 · 내려받기 · 삭제 */
.cs-acts { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.cs-acts a, .cs-acts button {
  background: none; border: none; padding: 0; cursor: pointer;
  font-size: 10.5px; color: var(--accent); text-decoration: none; font-family: inherit;
}
.cs-acts button { color: var(--muted); }
.cs-acts a:hover { text-decoration: underline; }
.cs-acts button:hover { color: var(--err); }
.cs-px { font-size: 10px; color: var(--muted); margin-right: auto; }
.cs-px.warn { color: var(--err); }
.cs-head { display: flex; align-items: baseline; gap: 6px; }
.cs-key { font-size: 13px; font-weight: 700; color: var(--text); }
.cs-use { font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.cs-n {
  margin-left: auto; font-size: 10px; font-weight: 700; color: var(--accent);
  border: 1px solid var(--border); border-radius: 999px; padding: 0 6px;
}
/* 이 영역으로 확정된 배너 사이즈 */
.cs-ok {
  font-size: 9.5px; font-weight: 700; color: var(--ok);
  border: 1px solid rgba(87, 211, 140, .5); border-radius: 4px; padding: 0 4px;
}
.ce-size.ok .cs-box { border-color: rgba(87, 211, 140, .5); }
.ce-size.ok.active { border-color: var(--ok); }
/* 확장 이미지에서 잘라 만든 것 표시 */
.cs-from, .cc-from {
  font-size: 9.5px; font-weight: 700; color: var(--accent);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 4px;
}
/* 틀을 그 배너 사이즈의 비율 그대로 — 어떤 모양인지 한눈에 보이게.
   (높이를 고정하고 너비는 비율이 정한다. 너비 100% + max-height 로 두면
   비율이 무시돼 정사각형처럼 보인다) */
.cs-box {
  display: flex; align-items: center; justify-content: center; align-self: center;
  width: auto; max-width: 100%; margin-top: 2px;      /* 높이는 비율에 맞춰 JS 가 정한다 */
  border-radius: 6px; overflow: hidden; border: 1px solid var(--border);
}
.cs-box.none { border-style: dashed; background: var(--bg); }
.cs-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-none { font-size: 10px; color: var(--muted); text-align: center; padding: 0 4px; }

.ce-body {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 22px; background: #0d1017; overflow: hidden;   /* 모서리 손잡이가 잘리지 않게 여백 */
}
.ce-frame { position: relative; line-height: 0; }
/* 이미지 크기 한도는 화면 기준으로 직접 준다 — 부모(틀)는 이미지 크기를 그대로 따라야
   자를 영역 상자가 이미지와 정확히 겹친다. %로 주면 틀↔이미지가 서로를 참조해
   세로로 긴 이미지가 아래로 잘려 나간다. (편집창 92vw/최대 1100px · 90vh 기준) */
/* 이미지 크기 한도 — 편집창(가로 92vw·최대 1180px, 세로 90vh)에서
   좌측 목록·상단 탭·채우기 줄·하단 줄·안쪽 여백을 뺀 값.
   여기에 여유를 더 둬서 이미지가 가장자리에 닿지 않게 한다. 닿아 버리면
   자를 영역이 이미지 전체일 때 테두리와 모서리 손잡이가 보이지 않는다. */
.ce-frame img {
  max-width: calc(min(92vw, 1180px) - 280px);
  max-height: calc(90vh - 220px);
  display: block; user-select: none; -webkit-user-drag: none;
}
/* 자를 영역 — 바깥은 어둡게(box-shadow 로 덮는다), 안쪽은 선 없이 그대로.
   경계선은 border 가 아니라 outline 으로 그린다. border 는 상자 안쪽에 그려져
   잘릴 영역의 바깥 1px 을 가리지만, outline 은 상자 바깥에 그려지므로
   선이 감싼 그대로가 결과물이 된다. */
.ce-box {
  position: absolute; box-sizing: border-box; border: none;
  outline: 1px solid rgba(255, 255, 255, .95); cursor: move;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .58);
  touch-action: none;
}
/* 모서리 손잡이 — 꽉 찬 네모로 두면 정작 그 부분이 어떻게 잘리는지 가려진다.
   경계선에 딱 붙는 ㄱ자 꺾쇠로 그려 자를 지점이 그대로 보이게 한다.
   (칠하지 않은 안쪽까지 요소 영역이라 잡기는 예전만큼 쉽다) */
.ce-h {
  position: absolute; width: 22px; height: 22px; box-sizing: border-box;
  background: transparent; touch-action: none;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, .9));
}
/* 꺾쇠는 자를 영역 **바깥**에 붙인다 (-4px = 상자 테두리 1px + 꺾쇠 두께 3px).
   안쪽에 그리면 정작 쓰게 될 그림을 가린다. */
.ce-h.nw { left: -4px; top: -4px; cursor: nwse-resize;
  border-left: 3px solid #fff; border-top: 3px solid #fff; }
.ce-h.ne { right: -4px; top: -4px; cursor: nesw-resize;
  border-right: 3px solid #fff; border-top: 3px solid #fff; }
.ce-h.sw { left: -4px; bottom: -4px; cursor: nesw-resize;
  border-left: 3px solid #fff; border-bottom: 3px solid #fff; }
.ce-h.se { right: -4px; bottom: -4px; cursor: nwse-resize;
  border-right: 3px solid #fff; border-bottom: 3px solid #fff; }
.ce-info { font-size: 12.5px; color: var(--muted); }
.ce-info b { color: var(--text); font-weight: 700; }
.ce-foot .av-btn { margin-left: auto; }

/* =========================== 에셋 원본 뷰어 =========================== */
.asset-viewer {
  width: 92vw; max-width: 1100px; height: 88vh;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
}
.av-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.av-title { font-size: 14px; font-weight: 700; }
.av-meta { font-size: 12px; color: var(--muted); flex: 1; }
.av-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 7px; font-size: 12.5px; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.av-btn:hover { border-color: var(--accent); }
/* 보고 있는 이미지 영역을 클릭하면 닫히므로 zoom-out 커서로 알려준다 */
.av-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; cursor: zoom-out; }
.av-body img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* =========================== 모달 =========================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal-card {
  width: 600px; max-width: 92vw; max-height: 90vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 22px 24px;
}
.modal-card h3 { font-size: 17px; margin-bottom: 8px; }
.modal-desc { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin-bottom: 18px; }
.modal-desc code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* 작품 대표 이미지 (300x420) — 모달 안 드래그앤드롭 영역 */
.field-size {
  font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; margin-left: 6px;
}
.cover-row { display: flex; gap: 16px; align-items: flex-start; }
.cover-drop {
  flex: 0 0 150px; width: 150px; height: 210px;      /* 300x420 과 같은 5:7 비율 */
  border: 2px dashed var(--border); border-radius: 10px;
  background: var(--panel-2); cursor: pointer; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .12s ease, background .12s ease;
}
.cover-drop:hover { border-color: var(--accent); }
.cover-drop.over { border-color: var(--accent); background: rgba(110, 168, 254, .12); }
.cover-drop img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-ph { text-align: center; color: var(--muted); padding: 8px; }
.cover-ph-ico { font-size: 20px; margin-bottom: 6px; }
.cover-ph-t { font-size: 12.5px; font-weight: 600; }
.cover-ph-s { font-size: 11px; margin-top: 3px; opacity: .75; }
.cover-side { flex: 1; min-width: 0; }
.cover-hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.cover-hint b { color: var(--text); }
.cover-btns { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.cover-info { font-size: 11.5px; color: var(--accent); margin-top: 10px; word-break: break-all; line-height: 1.5; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field-label em { color: var(--accent-2); font-style: normal; }
.field input, .field textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); padding: 10px 12px; border-radius: 8px;
  font-size: 13.5px; font-family: inherit; outline: none; resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field input::placeholder, .field textarea::placeholder { color: #5d6678; }

.modal-err {
  background: rgba(255, 107, 107, .1); border: 1px solid var(--err); color: #ffb3b3;
  padding: 9px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 14px;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.modal-actions button {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 18px; border-radius: 8px; font-size: 13.5px; cursor: pointer;
}
.modal-actions button:hover { border-color: var(--muted); }
.modal-actions .primary { background: var(--accent); border-color: var(--accent); color: #0b1023; font-weight: 700; }
.modal-actions .primary:hover { filter: brightness(1.08); }
.modal-actions .danger-btn { background: var(--err); border-color: var(--err); color: #fff; font-weight: 700; }
.modal-actions .danger-btn:hover { filter: brightness(1.08); }

/* =========================== 배너 제작 (문구 기획) =========================== */
/* 작품 재료 — 모든 카피가 이 훅으로 수렴한다 */
.brief-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.brief-row { display: flex; gap: 12px; align-items: flex-start; }
.brief-row label {
  flex: 0 0 92px; font-size: 12.5px; color: var(--muted); padding-top: 8px; font-weight: 600;
}
.brief-row input, .brief-row textarea {
  flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 13px; line-height: 1.6;
  padding: 7px 10px; border-radius: 7px; resize: vertical;
}
.brief-row input:focus, .brief-row textarea:focus { outline: none; border-color: var(--accent); }
.brief-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.brief-hint { font-size: 12px; color: var(--ok); }

/* 문구 기획 상태 — 원본 목록의 확정 뱃지와 같은 자리·같은 모양(우측 하단) */
.ac-plan {
  position: absolute; right: 8px; bottom: 8px; pointer-events: none;
  font-size: 9.5px; font-weight: 700; letter-spacing: .2px; line-height: 1.5;
  color: #7f9bd6; background: rgba(8, 11, 16, .7);
  padding: 1px 5px; border-radius: 4px;
}
.ac-plan.ok { color: #4fae7a; }

/* =========================== 광고 영상 =========================== */
/* 지금 GPU 로 만들 수 있는 상태인지 — 페이지 머리 오른쪽에 한 줄 */
.gpu-state { font-size: 12px; white-space: nowrap; }
.gpu-state .ok { color: #4fae7a; }
.gpu-state .no { color: var(--warn); }

/* 만든 영상 카드 — 배너 카드와 같은 형태에, 가운데 재생 표시만 */
.vid-card video { display: block; width: 100%; height: auto; }
.vid-card.busy { opacity: .72; }
.ac-play {
  position: absolute; inset: 0; margin: auto; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(8, 11, 16, .55); color: #fff;
  font-size: 17px; padding-left: 3px; pointer-events: none;
  opacity: 0; transition: opacity .14s ease;
}
.asset-card:hover .ac-play { opacity: 1; }
.ac-busy.err { color: var(--err); }

/* 진행 표시를 담는 자리 — 카드를 다시 그리지 않고 이 안의 글자만 갈아 끼운다.
   카드와 같은 크기로 겹쳐 두어, 안의 뱃지들이 쓰던 좌표가 그대로 통하게 한다. */
.ac-mark { position: absolute; inset: 0; pointer-events: none; }

/* 만들기 화면 왼쪽 — 방식·길이 */
.ve-opt { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.ve-opt > label { font-size: 11.5px; color: var(--muted); }
.ve-opt > label b { color: var(--text); }
.ve-tag {
  margin-left: 5px; font-size: 10px; color: #b98a6a;
  background: rgba(8, 11, 16, .7); padding: 1px 5px; border-radius: 4px;
}
.ve-kinds { display: flex; gap: 4px; }
.ve-hint { font-size: 11px; color: var(--muted); line-height: 1.6; }

/* 연출 한 안 */
.vp-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px;
  margin-bottom: 10px; cursor: pointer; background: var(--panel-2);
  transition: border-color .12s ease;
}
.vp-card:hover { border-color: #3c4b66; }
.vp-card.on { border-color: var(--accent); }
.vp-card.manual { cursor: default; border-style: dashed; }
.vp-top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.vp-no {
  width: 19px; height: 19px; border-radius: 50%; background: var(--panel);
  border: 1px solid var(--border); color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}
.vp-card.on .vp-no { border-color: var(--accent); color: var(--accent); }
.vp-note { font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 6px; }

/* 대사 한 줄과, 그때 하는 동작·상대의 반응 */
.vp-lines { margin-top: 9px; display: flex; flex-direction: column; gap: 7px; }
.vp-line { border-left: 2px solid var(--border); padding-left: 9px; }
.vl-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; font-size: 12px; }
.vl-at { color: var(--muted); font-size: 10.5px; }
.vl-head em { font-style: normal; color: var(--accent); font-size: 11px; }
.vl-head b { color: var(--text); font-size: 12px; letter-spacing: .2px; }
.vl-act { font-size: 11.5px; color: var(--muted); line-height: 1.7; margin-top: 2px; }
.vl-act span {
  display: inline-block; min-width: 26px; margin-right: 6px;
  color: #7f9bd6; font-size: 10px; font-weight: 700;
}
.vl-act.re span { color: #b98a6a; }
.vp-audio { font-size: 11px; color: var(--muted); line-height: 1.6; margin-top: 8px; }
.vp-audio span { color: #7f9bd6; font-weight: 700; margin-right: 6px; }

/* 왼쪽에 미리 보여 주는 이 배너의 대사 */
.ve-lines { display: flex; flex-direction: column; gap: 5px; }
.ve-line {
  display: flex; align-items: baseline; gap: 6px; font-size: 11.5px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 8px; line-height: 1.5;
}
.ve-line span { color: var(--muted); font-size: 10px; }
.ve-line em { font-style: normal; color: var(--accent); font-size: 10.5px; }
.ve-line.none { color: var(--muted); }
.vp-prompt {
  width: 100%; margin-top: 9px; background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px;
  font-family: inherit; font-size: 11.5px; line-height: 1.6; resize: vertical; outline: none;
}
.vp-prompt:focus { border-color: var(--accent); }

/* 영상 크게 보기 */
/* 영상은 그림과 똑같이 남은 자리 안에만 놓인다 (박스를 넘지 않게) */
.av-body.video { cursor: default; }
.av-body.video video { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }

/* 기획 화면 */
.plan-editor {
  width: 92vw; max-width: 1180px; height: 90vh;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
}
.pe-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--panel-2); flex-shrink: 0;
}
.pe-title { font-size: 13px; color: var(--muted); }
.pe-title b { color: var(--text); font-size: 14px; margin-right: 6px; }
.pe-vers { display: flex; gap: 4px; margin-left: auto; }
.pe-ver {
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  padding: 3px 9px; border-radius: 6px; font-size: 11.5px; cursor: pointer;
}
.pe-ver.active { color: var(--text); border-color: var(--accent); }
.pe-head .primary-btn { padding: 6px 14px; font-size: 13px; }
.pe-vers:empty + .primary-btn { margin-left: auto; }
.pe-main { flex: 1; min-height: 0; display: flex; }
.pe-side {
  flex: 0 0 300px; border-right: 1px solid var(--border); padding: 16px;
  display: flex; flex-direction: column; gap: 10px; overflow-y: auto; background: #0d1017;
}
/* 사이즈를 바꿔도 자리가 흔들리지 않게 정사각 틀을 고정하고 그 안에 맞춰 넣는다 */
.pe-shot {
  width: 100%; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; cursor: zoom-in;
}
.pe-shot img { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }
/* 확정한 배너 사이즈 골라 보기 */
.pe-sizes { display: flex; flex-wrap: wrap; gap: 4px; }
.pe-size {
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  padding: 3px 9px; border-radius: 6px; font-size: 11.5px; cursor: pointer; font-family: inherit;
}
.pe-size:hover { color: var(--text); }
.pe-size.active { color: var(--text); border-color: var(--accent); background: var(--panel-2); }
.pe-body { flex: 1; min-width: 0; overflow-y: auto; padding: 16px 18px; }
.pe-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 60px 20px;
  line-height: 1.8; }
.pe-empty b { color: var(--text); }
.pe-empty .cn-spin { margin: 0 auto 14px; }
.pe-sub { font-size: 12.5px; margin-top: 8px; }
.pe-sub.warn { color: var(--err); }
.pe-read, .pe-fit {
  font-size: 12.5px; color: var(--muted); line-height: 1.7; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; margin-bottom: 10px;
}
.pe-read b, .pe-fit b { color: var(--text); margin-right: 6px; }
.pe-fit.bad { border-color: var(--warn); }
.pe-fit.bad b { color: var(--warn); }
.pe-note { font-size: 11.5px; color: var(--muted); margin-top: 12px; text-align: center; }

/* 카피 한 안 */
.pe-list { display: flex; flex-direction: column; gap: 10px; }
.prop {
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px;
  background: var(--panel-2);
}
.prop.on { border-color: var(--ok); background: rgba(87, 211, 140, .07); }
.pr-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.pr-no {
  font-size: 11px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--border); border-radius: 50%; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pr-level {
  font-size: 10px; font-weight: 700; color: var(--accent);
  border: 1px solid rgba(110, 168, 254, .45); border-radius: 4px; padding: 1px 5px;
}
.pr-level.hot { color: var(--accent-2); border-color: rgba(255, 122, 162, .45); }
.pr-angle { font-size: 11.5px; color: var(--muted); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-pick {
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  padding: 3px 11px; border-radius: 6px; font-size: 11.5px; cursor: pointer; flex-shrink: 0;
}
.pr-pick:hover { color: var(--text); border-color: var(--muted); }
.prop.on .pr-pick { color: var(--ok); border-color: var(--ok); font-weight: 700; }
.pr-lines { display: flex; flex-direction: column; gap: 6px; }
.pr-line { display: flex; align-items: baseline; gap: 8px; }
.pr-tail { flex-shrink: 0; font-size: 12px; }
.pr-who { flex: 0 0 auto; font-size: 11px; color: var(--muted); min-width: 22px; }
.pr-text { font-size: 14px; font-weight: 700; letter-spacing: .2px; line-height: 1.5; }

/* =========================== 배너 조판 (말풍선) =========================== */
@font-face {
  font-family: "AnimeAce";
  src: url("/fonts/animeace2_reg.otf") format("opentype");
  font-display: block;
}
.lay-editor {
  width: 94vw; max-width: 1500px; height: 92vh;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
}
.lay-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--panel-2); flex-shrink: 0;
}
.lay-title { font-size: 13px; color: var(--muted); }
.lay-title b { color: var(--text); font-size: 14px; margin-right: 6px; }
.lay-dim { opacity: .7; }
.lay-msg { font-size: 12px; color: var(--accent); margin-left: auto; }
.lay-head .primary-btn { padding: 6px 14px; font-size: 13px; }
.lay-main { flex: 1; min-height: 0; display: flex; }
.lay-body {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  padding: 18px; background: #0d1017;
}
/* 그림과 말풍선이 같은 좌표계를 쓰도록 겹쳐 둔다 */
.lay-stage { position: relative; line-height: 0; }
.lay-stage img {
  display: block; max-width: calc(94vw - 360px); max-height: calc(92vh - 110px);
  width: auto; height: auto; user-select: none;
}
.lay-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lb-body { cursor: move; }
/* 꼬리 손잡이 — 끝점(파란 점)과 붙는 자리(주황 점). 흰 말풍선 위에서도 보이게 */
.lb-h { cursor: grab; }
.lb-h.tip { fill: var(--accent); stroke: #101418; stroke-width: 1.5; }
.lb-h.base { fill: #ff9f2e; stroke: #101418; stroke-width: 1.5; }
.lb-h:hover { filter: brightness(1.2); }

.lay-side {
  flex: 0 0 340px; border-left: 1px solid var(--border); padding: 14px;
  overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
}
.lb-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  background: var(--panel-2); display: flex; flex-direction: column; gap: 8px; cursor: pointer;
}
.lb-card.on { border-color: var(--accent); }
.lb-top { display: flex; align-items: center; gap: 8px; }
.lb-no {
  font-size: 11px; font-weight: 700; color: var(--muted); width: 20px; height: 20px;
  border: 1px solid var(--border); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.lb-who { font-size: 11.5px; color: var(--muted); flex: 1; }
.lb-x {
  background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer;
  line-height: 1; padding: 0 2px;
}
.lb-x:hover { color: var(--err); }
.lb-text {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  font-family: inherit; font-size: 12.5px; line-height: 1.5; padding: 6px 8px;
  border-radius: 6px; resize: vertical; font-weight: 700;
}
.lb-text:focus { outline: none; border-color: var(--accent); }
.lb-row { display: flex; gap: 5px; }
.lb-t {
  flex: 1; background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  padding: 4px 6px; border-radius: 6px; font-size: 11px; cursor: pointer; font-family: inherit;
}
.lb-t.on { color: var(--text); border-color: var(--accent); }
.lb-lbl { font-size: 11px; color: var(--muted); align-self: center; margin-right: 2px; }
.lb-slide { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.lb-slide b { color: var(--text); font-weight: 700; }
.lb-slide input { width: 100%; accent-color: var(--accent); }
.lb-info { font-size: 10.5px; color: var(--muted); opacity: .85; }
.lb-tip { font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.lb-tip b { color: var(--text); }
.pr-make {
  background: var(--panel); border: 1px solid var(--accent); color: var(--accent);
  padding: 3px 10px; border-radius: 6px; font-size: 11.5px; cursor: pointer;
  font-weight: 700; flex-shrink: 0;
}
.pr-make:hover { background: var(--bg); }

/* =========================== 토스트 =========================== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 8px; font-size: 14px; z-index: 300;
}
.toast.err { border-color: var(--err); }
.toast.ok { border-color: var(--ok); }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .page { padding: 20px 16px 50px; }
  /* 좁은 화면에선 작품명도 줄바꿈 허용 (가로 스크롤 방지) */
  .td-ko, .td-en { white-space: normal; }
}

/* =========================== i2i 이미지 생성 =========================== */
/* 자르기 모달 머리의 생성 버튼 — 다른 버튼과 구분되게 살짝 강조 */
.av-btn.gen { color: var(--accent); border-color: rgba(110, 168, 254, .45); }
.av-btn.gen:hover { background: var(--accent); color: #0b0f14; border-color: var(--accent); }

.gi-editor .pe-main { display: flex; min-height: 0; }
.gi-left {
  flex: 0 0 330px; border-right: 1px solid var(--border); padding: 16px;
  display: flex; flex-direction: column; gap: 12px; overflow-y: auto; background: #0d1017;
}
.gi-left .ve-opt.gi-grow { flex: 1; min-height: 160px; }
.gi-select {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 7px 10px; border-radius: 7px; font-size: 12.5px; font-family: inherit; outline: none;
}
.gi-select:focus { border-color: var(--accent); }
.gi-prompt {
  flex: 1; width: 100%; background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
  font-family: inherit; font-size: 12.5px; line-height: 1.7; resize: none; outline: none;
}
.gi-prompt:focus { border-color: var(--accent); }
/* 도우미가 프롬프트를 갈아 끼웠을 때 한 번 반짝 */
.gi-flash { animation: giflash .7s ease; }
@keyframes giflash { from { border-color: var(--accent); background: #1b2740; } }
.gi-hint { font-size: 11px; color: var(--muted); line-height: 1.6; }
.gi-hint b { color: var(--text); }

/* 참고 이미지 줄 */
.gi-refs { display: flex; flex-wrap: wrap; gap: 6px; }
.gi-ref {
  position: relative; width: 60px; height: 60px; border-radius: 7px; overflow: hidden;
  border: 1px solid var(--border); display: block; background: var(--panel-2);
}
.gi-ref img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gi-ref b {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: center;
  font-size: 9px; font-weight: 700; color: #fff; background: rgba(8, 11, 16, .75); padding: 1px 0;
}
.gi-ref-x {
  position: absolute; top: 2px; right: 2px; width: 17px; height: 17px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .3); background: rgba(0, 0, 0, .6); color: #fff;
  font-size: 11px; line-height: 1; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}
.gi-ref-x:hover { background: var(--err); border-color: var(--err); }
.gi-ref.add {
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--muted); font-size: 17px; border-style: dashed;
}
.gi-ref.add:hover { color: var(--accent); border-color: var(--accent); }
/* 참고로 넣을 원본 고르기 (확인창을 갤러리로 잠시 빌려 쓴다) */
.gi-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 46vh; overflow-y: auto; }
.gi-pick-card {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden; padding: 0;
  background: var(--panel-2); cursor: pointer; aspect-ratio: 1/1;
}
.gi-pick-card:hover { border-color: var(--accent); }
.gi-pick-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 오른쪽 — 프롬프트 도우미 */
.gi-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gi-chat-head {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 700;
}
.gi-chat-head .av-btn { margin-left: auto; }
.gi-chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex;
  flex-direction: column; gap: 9px; }
.gi-msg {
  max-width: 82%; padding: 9px 12px; border-radius: 10px; font-size: 12.5px;
  line-height: 1.75; white-space: pre-wrap; word-break: break-word;
}
.gi-msg.user { align-self: flex-end; background: #24406b; color: #e6ecf7; }
.gi-msg.ai { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); }
.gi-msg.empty {
  align-self: center; max-width: 100%; text-align: center; color: var(--muted);
  background: transparent; border: none; margin-top: 22vh;
}
.gi-chat-bar { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.gi-chat-input {
  flex: 1; background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 11px; font-family: inherit; font-size: 12.5px;
  line-height: 1.6; resize: none; outline: none;
}
.gi-chat-input:focus { border-color: var(--accent); }
.gi-chat-send {
  width: 38px; border-radius: 9px; border: 1px solid transparent; background: var(--accent);
  color: #0b1023; font-size: 15px; font-weight: 700; cursor: pointer;
}
.gi-chat-send:disabled { opacity: .5; cursor: default; }

/* 목록에서 아직 그리는 중인 원본 — 파일이 없어 자리만 잡아 둔다 */
.asset-card.gen-wait {
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); border-style: dashed; cursor: default;
}
.asset-card.gen-wait .ac-busy, .asset-card.gen-wait .ac-size { opacity: 1; position: static; }
.asset-card.gen-wait .ac-size { position: absolute; left: 8px; bottom: 8px; }
.asset-card.gen-wait.err { border-color: rgba(255, 107, 107, .45); }

/* 좌측 목록 맨 위 '원본' — 생김새는 비율 칸과 똑같이 두고, 구분선만 카드 **바깥**에 그린다.
   (카드에 border-bottom 을 주면 골랐을 때 파란 테두리의 아랫변을 덮어써 잘려 보인다) */
.ce-size.orig { position: relative; margin-bottom: 13px; }
.ce-size.orig::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -7px;
  height: 1px; background: var(--border);
}

/* =========================== 로그인 · 회원 관리 =========================== */
/* 로그인 — 인증 전에는 화면 전체를 덮는다. 프로젝트 색을 그대로 쓰되 카드만 조금 밝게. */
.login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15, 17, 21, .96);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.login-overlay.hidden { display: none; }
.login-card {
  width: 380px; max-width: 90vw;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 40px 32px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; gap: 12px;
}
.login-brand {
  font-size: 22px; font-weight: 800; text-align: center;
  background: linear-gradient(135deg, var(--accent), #8b5cf6, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: -4px;
}
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.login-card input {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; color: var(--text); font-size: 14px;
  outline: none; font-family: inherit; transition: border-color .15s ease;
}
.login-card input:focus { border-color: var(--accent); }
.login-card input.hidden { display: none; }
#loginCodeBox { display: flex; flex-direction: column; gap: 12px; }
#loginCodeBox.hidden { display: none; }
#loginBtn {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff; border: none; border-radius: 10px; font-family: inherit;
  padding: 12px; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: transform .1s ease;
}
#loginBtn:hover { transform: translateY(-1px); }
#loginBtn:disabled { opacity: .5; cursor: wait; transform: none; }
#loginBtn.hidden { display: none; }
.login-reset {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.login-reset:hover { border-color: var(--accent); color: var(--text); }
.login-reset.hidden { display: none; }
.login-msg { color: var(--err); font-size: 12px; min-height: 16px; text-align: center; }
.login-msg.ok { color: var(--ok); }
.login-sep {
  text-align: center; color: var(--muted); font-size: 11px; margin: 8px 0; position: relative;
}
.login-sep::before, .login-sep::after {
  content: ""; position: absolute; top: 50%;
  width: calc(50% - 30px); height: 1px; background: var(--border);
}
.login-sep::before { left: 0; }
.login-sep::after { right: 0; }
.login-sep.hidden { display: none; }
#googleBtnContainer { display: flex; justify-content: center; }

/* 상단 우측 — 누구로 들어와 있는지 + 로그아웃 */
.user-info { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-email { color: var(--muted); font-size: 12.5px; }
.user-email b { color: var(--accent); font-weight: 700; }
.user-logout {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 5px 11px; font-size: 12px; border-radius: 7px; cursor: pointer; font-family: inherit;
}
.user-logout:hover { color: var(--err); border-color: var(--err); }

/* 회원 목록 */
.u-mail { color: var(--text); }
.u-how { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.u-dim { color: var(--muted); font-size: 12.5px; }
.u-role {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 5px 8px; font-size: 12.5px; font-family: inherit;
}
.u-role:disabled { opacity: .5; }
.u-tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--panel-2); color: var(--muted);
}
.u-tag.ok { color: var(--ok); }
.u-tag.wait { color: var(--warn); }
.u-tag.me { color: var(--accent); }
.u-switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; }
.u-switch.off { cursor: default; opacity: .55; }
.link-btn {
  background: transparent; border: none; padding: 0; cursor: pointer; font-family: inherit;
  color: var(--accent); font-size: 12.5px; text-align: left;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #6ea8fe55;
}
.link-btn:hover { text-decoration-color: var(--accent); }

/* 회원 추가 */
.user-add { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ua-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ua-row .search-input { flex: 1; min-width: 160px; }
.ua-sel {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 12px; font-size: 13.5px; font-family: inherit;
}

/* 볼 수 있는 메뉴 고르기 */
.up-page-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 14px 0 4px;
}
.up-page-item {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 12px; font-size: 13.5px;
}
.up-page-item:hover { border-color: var(--accent); }
