/* 숏폼 스튜디오 UI — 외부 CDN 없이 동작 (자막 미리보기용 폰트만 API 에서 지연 로드) */
@font-face { font-family: 'P-Jua'; src: url('../api/fonts/Jua-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'P-Black'; src: url('../api/fonts/BlackHanSans-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'P-DoHyeon'; src: url('../api/fonts/DoHyeon-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'P-XBold'; src: url('../api/fonts/GothicA1-ExtraBold.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'P-Bold'; src: url('../api/fonts/GothicA1-Bold.ttf') format('truetype'); font-display: swap; }

:root, html[data-theme='dark'] {
  --bg: #0d1017;
  --panel: #141923;
  --panel2: #1a2130;
  --side: #0a0d13;
  --input: #0f141d;
  --elev: #11161f;
  --line: #3d4a63;
  --line2: #55627d;
  --frame: rgba(53, 214, 176, 0.45);
  --text: #e8ebf2;
  --muted: #929bb0;
  --faint: #6a7590;
  --accent: #35d6b0;
  --accent-ink: #04231c;
  --accent-soft: rgba(53, 214, 176, 0.13);
  --blue: #5aa9ff;
  --warn: #ffc65a;
  --cost-y: #ffd84d;
  --danger: #ff6f7d;
  --btn-hover: #232c40;
  --btn-hover-line: #475674;
  --input-hover: #43506b;
  --toast: #202a3d;
  --shadow: rgba(0, 0, 0, 0.45);
  --logout: #f0a0a8;
  --logout-bg: rgba(240, 113, 120, 0.12);
  --radius: 12px;
  --font: 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

html[data-theme='light'] {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel2: #eef2f7;
  --side: #ffffff;
  --input: #ffffff;
  --elev: #f7f9fc;
  --line: #b8c2d4;
  --line2: #9aa6bb;
  --frame: rgba(13, 159, 130, 0.55);
  --text: #1a2233;
  --muted: #5c677c;
  --faint: #8791a5;
  --accent: #0d9f82;
  --accent-ink: #ffffff;
  --accent-soft: rgba(13, 159, 130, 0.12);
  --blue: #2b79e0;
  --warn: #b86a00;
  --cost-y: #c99500;
  --danger: #d13b4c;
  --btn-hover: #e7edf6;
  --btn-hover-line: #aeb8ca;
  --input-hover: #9aa6bb;
  --toast: #ffffff;
  --shadow: rgba(26, 34, 51, 0.14);
  --logout: #c53b4c;
  --logout-bg: rgba(209, 59, 76, 0.1);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───────── 레이아웃 ───────── */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.main { padding: 22px 28px 60px; max-width: 1360px; width: 100%; }

.brand {
  display: flex; align-items: center; gap: 11px; padding: 2px 8px 20px;
  width: 100%; background: none; border: 0; color: inherit; text-align: left;
  cursor: pointer; border-radius: 10px; font: inherit;
}
.brand:hover { background: var(--panel); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: block; flex: none; object-fit: cover; background: #ececef; }
.brand-text b { display: block; font-size: 15px; }
.brand-text small { color: var(--muted); font-size: 11.5px; }
.side-hello {
  margin: -6px 8px 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
}
.side-hello[hidden] { display: none; }
.side-hello b { display: block; font-size: 13px; margin-bottom: 4px; }
.side-hello span { display: block; font-size: 12px; color: var(--muted); line-height: 1.45; }

.nav-group { padding: 10px 0; border-top: 1px solid var(--line); }
.nav-group:first-child { border-top: 0; padding-top: 0; }
.nav-title { color: var(--faint); font-size: 11px; letter-spacing: 0.04em; padding: 4px 10px 6px; }
.nav-parent { padding: 6px 10px 2px; font-weight: 700; font-size: 13px; }
.nav-item + .nav-parent { margin-top: 8px; }
.nav-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; background: none; border: 0; color: var(--muted); padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.nav-item:hover:not(:disabled) { background: var(--panel); color: var(--text); }
.nav-item.sub { padding-left: 22px; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav-item:disabled { cursor: default; opacity: 0.55; }
.nav-group.bottom #btnSideLogout { margin-top: 8px; border-radius: 999px; }
.theme-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  text-align: left; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; margin-top: 8px;
}
.theme-toggle:hover { border-color: var(--btn-hover-line); background: var(--btn-hover); }
.theme-toggle .sw {
  display: inline-flex; flex: none; gap: 4px; padding: 2px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line);
}
.theme-toggle .sw i {
  min-width: 40px; height: 22px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center;
  font-style: normal; font-size: 11px; font-weight: 800; color: var(--faint);
  white-space: nowrap; line-height: 1;
}
html[data-theme='dark'] .theme-toggle .sw i[data-t='dark'],
html[data-theme='light'] .theme-toggle .sw i[data-t='light'] {
  background: var(--accent); color: var(--accent-ink);
}
.soon { font-size: 10.5px; color: var(--faint); border: 1px solid var(--line2); border-radius: 999px; padding: 0 7px; line-height: 17px; flex: none; }
.count { font-size: 11px; background: var(--panel2); border-radius: 999px; padding: 0 7px; color: var(--text); line-height: 18px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; }
.top .sep { color: var(--faint); margin: 0 4px; font-weight: 400; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--panel); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.chip.ok i { background: var(--accent); }
.chip.warn i { background: var(--warn); }
.chip.bad i { background: var(--danger); }

/* ───────── 카드 ───────── */
.card {
  background: var(--panel); border: 1.5px solid var(--line2); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 16px;
  box-shadow: 0 0 0 1px rgba(53, 214, 176, 0.08);
}
html[data-theme='light'] .card { box-shadow: 0 0 0 1px rgba(13, 159, 130, 0.12); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head.tight { margin-bottom: 12px; }
.card-head h2 { font-size: 15px; font-weight: 700; }
.step { width: 22px; height: 22px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.hint { color: var(--muted); font-size: 12.5px; }
.hint.small { font-size: 11.5px; margin-top: 10px; line-height: 1.55; }
.card-head .hint { margin-left: auto; }

/* ───────── 폼 ───────── */
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.field.grow { flex: 1; min-width: 240px; }
.field > span { font-size: 12px; color: var(--muted); }
.field input[readonly] { opacity: 0.72; cursor: default; background: var(--elev); }

/* ───────── 1:1 문의 ───────── */
.inq-form { display: grid; gap: 12px; }
.inq-form textarea {
  width: 100%; min-height: 140px; resize: vertical; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  font: inherit; line-height: 1.5;
}
.inq-list { display: grid; gap: 10px; }
.inq-item {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel2);
  padding: 12px 14px; display: grid; gap: 8px;
}
.inq-item .ih {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between;
}
.inq-item .ih b { font-size: 14px; }
.inq-item .meta { font-size: 12px; color: var(--faint); }
.inq-item .body, .inq-item .answer {
  font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--text);
}
.inq-item .answer {
  padding: 10px 12px; border-radius: 10px; background: var(--elev); border: 1px solid var(--line);
}
.inq-item .answer b { display: block; font-size: 12px; color: var(--accent); margin-bottom: 4px; }
.inq-st {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: rgba(99, 140, 255, 0.14); color: var(--blue);
}
.inq-st.answered { background: rgba(45, 212, 191, 0.16); color: var(--accent); }
.inq-st.closed { background: var(--panel); color: var(--faint); }

.source-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
  padding: 0; border: 0; background: transparent;
}
.source-tabs .stab {
  border: 1.5px solid var(--line2); background: var(--panel2); color: var(--muted); cursor: pointer;
  padding: 0 14px; min-height: 36px; border-radius: 9px; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.source-tabs .stab:hover { color: var(--text); background: var(--btn-hover); border-color: var(--btn-hover-line); }
.source-tabs .stab.on {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  box-shadow: none;
}
html[data-theme='light'] .source-tabs .stab.on {
  color: #fff;
}
.auth-form { display: grid; gap: 12px; max-width: 420px; }
.quota { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.qitem { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.qitem b { display: block; font-size: 20px; font-weight: 800; }
.qitem span { color: var(--muted); font-size: 12px; }

select, input[type='text'], input[type='number'], input[type='password'], input[type='email'], textarea {
  background: var(--input); border: 1.5px solid var(--line2); border-radius: 8px; padding: 9px 11px; width: 100%; min-height: 38px;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
select option:disabled { color: var(--faint); }
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--faint); }
select:hover, input:hover, textarea:hover { border-color: var(--input-hover); }

.btn { background: var(--panel2); border: 1px solid var(--line2); border-radius: 9px; padding: 0 16px; min-height: 38px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; transition: background 0.12s, border-color 0.12s; }
.btn:hover:not(:disabled):not([aria-disabled='true']) { background: var(--btn-hover); border-color: var(--btn-hover-line); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.45; cursor: default; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; }
/* hover: 배경은 일반 버튼과 같이 바뀌고, 글자만 흰색으로 (어두운 배경에서도 읽히게) */
.btn.primary:hover:not(:disabled):not([aria-disabled='true']) {
  background: var(--btn-hover); border-color: var(--btn-hover-line); color: #fff; filter: none;
}
.btn.danger {
  background: rgba(255, 111, 125, 0.12);
  border-color: rgba(255, 111, 125, 0.45);
  color: var(--danger);
  font-weight: 700;
}
/* 단독 삭제 버튼(폼 하단 등)만 위 여백. 키 목록의 보기·삭제 줄에서는 쓰지 않는다. */
form > .btn.danger,
.dlg-actions .btn.danger,
.card-head .btn.danger {
  margin-top: 10px;
}
.btn.danger:hover:not(:disabled):not([aria-disabled='true']) {
  background: var(--danger); border-color: var(--danger); color: #fff; filter: none;
}
.btn.ghost { background: transparent; border-style: dashed; color: var(--muted); }
.btn.wide { width: 100%; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 6px 0; font-size: 12.5px; }
.link:hover { color: var(--text); }

.check { display: flex; gap: 8px; align-items: center; cursor: pointer; color: var(--text); }
.check.small { align-items: flex-start; font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 8px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; margin: 0; }
.check.small input { margin-top: 2px; }

.note { margin-top: 12px; font-size: 12.5px; color: var(--warn); background: rgba(255, 198, 90, 0.08); border: 1px solid rgba(255, 198, 90, 0.25); border-radius: 8px; padding: 8px 12px; }
.err { color: var(--danger); font-size: 12.5px; margin-top: 8px; }
#heygenRecover { display: grid; gap: 8px; margin-top: 10px; }
#heygenRecover[hidden] { display: none; }
#heygenRecover .hint { margin: 0; }
#heygenRecover input { width: 100%; }
.empty { color: var(--faint); font-size: 13px; padding: 24px 6px; text-align: center; line-height: 1.7; }
.verify { font-size: 12.5px; align-self: center; }
.verify.ok { color: var(--accent); }
.verify.bad { color: var(--danger); }

/* ───────── 상품 선택 ───────── */
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.pick { background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 8px; cursor: pointer; text-align: left; position: relative; transition: border-color 0.12s; }
.pick:hover { border-color: #475674; }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
.pick.in { border-color: rgba(53, 214, 176, 0.5); }
.pick img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #fff; display: block; }
.pick .pick-ph {
  width: 100%; aspect-ratio: 1; border-radius: 8px; display: grid; place-content: center;
  background: var(--elev); border: 1.5px dashed var(--frame); color: var(--accent);
  font-size: 12px; font-weight: 800; line-height: 1.35; text-align: center;
}
.pick.wait { border-style: dashed; }
.pick .t { font-size: 12px; margin-top: 7px; line-height: 1.4; height: 34px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pick .p { font-size: 12.5px; font-weight: 700; margin-top: 4px; }
.pick .rk { position: absolute; top: 12px; left: 12px; background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.pick .tag { font-size: 10.5px; color: var(--accent); margin-left: 6px; font-weight: 600; }
.pick .demo { position: absolute; top: 12px; right: 12px; background: rgba(255, 198, 90, 0.95); color: #2b2100; font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }

.mprods { display: grid; gap: 12px; margin-top: 14px; }
.mprod { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.mprod .img { aspect-ratio: 1; border-radius: 10px; border: 1px dashed var(--line2); display: grid; place-items: center; overflow: hidden; background: var(--input); position: relative; text-align: center; color: var(--faint); font-size: 12px; cursor: pointer; }
.mprod .img img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.mprod .img input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mprod .grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mprod .span2 { grid-column: 1 / -1; }
.mprod .checks { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.mprod .rm { justify-self: end; }

/* ───────── 옵션 4열 ───────── */
/* 행 높이는 음성·컨셉·인물(내용) 중 가장 큰 쪽에 맞춤. 네 카드 바닥을 같은 선에 맞춤 */
.opt-length { margin: 0 0 14px; overflow: visible; }
.len-row { display: flex; flex-wrap: wrap; gap: 8px; }
.len-row .ropt { flex: 1 1 88px; border: 1px solid var(--line); padding: 8px 12px; background: var(--panel); }
.opt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.opt {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 8px; margin: 0; min-width: 0;
  background: var(--elev); display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.opt legend { font-size: 12.5px; font-weight: 700; padding: 0 8px; color: var(--text); flex: none; }
.use-flag { margin: 0 0 8px; font-size: 12.5px; font-weight: 700; }
.hook-int .use-flag { margin: 0; }
.opt.is-off #optVoice,
.opt.is-off #optConcept,
.hook-int.is-off input[type="range"],
.hook-int.is-off .hi-scale,
.hook-int.is-off .hint { opacity: 0.45; }
.photo-use { margin: 0 0 4px; font-weight: 700; }
#photoUseNote { margin: 0 0 10px; }
/* 자막·음성 카드: 행 높이 계산에는 넣지 않고(height:0), 컨셉·인물 높이에 맞춰 채운 뒤 목록만 스크롤 */
.opt-grid > .opt:nth-child(1),
.opt-grid > .opt:nth-child(2) {
  height: 0;
  min-height: 100%;
}
#optConcept {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
#optSubtitle,
#optVoice {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-gutter: stable;
}
.opt > .capsize { flex: none; margin-top: 8px; }
#optSubtitle::-webkit-scrollbar,
#optVoice::-webkit-scrollbar { width: 8px; }
#optSubtitle::-webkit-scrollbar-thumb,
#optVoice::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 8px; }
#optSubtitle::-webkit-scrollbar-thumb:hover,
#optVoice::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.voice-group { margin-top: 6px; }
.voice-group:first-child { margin-top: 0; }
.vg-title { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; margin: 2px 0 4px 2px; }
.voice-list { display: flex; flex-direction: column; }
.ropt { display: flex; gap: 9px; align-items: flex-start; padding: 8px 6px; border-radius: 8px; cursor: pointer; position: relative; }
.ropt:hover { background: var(--panel); }
.ropt input { accent-color: var(--accent); width: 16px; height: 16px; margin: 2px 0 0; flex: none; }
.ropt .tx { min-width: 0; flex: 1; }
.ropt .nm { display: block; font-weight: 600; font-size: 13.5px; }
.ropt .ds { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; line-height: 1.4; }
.ropt:has(input:checked) { background: var(--accent-soft); }
.ropt:has(input:checked) .nm { color: var(--accent); }
.ropt.dis, .ropt:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
.ropt.dis:hover, .ropt:has(input:disabled):hover { background: transparent; }
/* 컨셉 말투 예 — 오른쪽 풍선 도움말 */
.ropt[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  bottom: auto;
  right: auto;
  z-index: 60;
  width: min(260px, 42vw);
  padding: 10px 12px;
  border-radius: 10px;
  background: #10151e;
  color: #f4f6fa;
  border: 2px solid rgba(53, 214, 176, 0.85);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 10px 28px rgba(0, 0, 0, 0.45);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translate(-6px, -50%);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.ropt[data-tip]::before {
  content: '';
  position: absolute;
  left: calc(100% + 1px);
  top: 50%;
  bottom: auto;
  z-index: 61;
  border: 7px solid transparent;
  border-right-color: rgba(53, 214, 176, 0.85);
  filter: drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.45));
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.ropt[data-tip]:hover::after,
.ropt[data-tip]:hover::before,
.ropt[data-tip]:focus-within::after,
.ropt[data-tip]:focus-within::before {
  opacity: 1;
}
.ropt[data-tip]:hover::after,
.ropt[data-tip]:focus-within::after {
  transform: translate(0, -50%);
}
/* 컨셉 카드·그리드는 오른쪽 풍선이 잘리지 않게 */
.opt-grid,
.opt-grid > .opt:nth-child(3),
#optConcept { overflow: visible; }
.opt-grid > .opt:nth-child(3) { z-index: 6; }
/* 컨셉 클릭 때 위쪽(상품·이미지) 높이 변화로 브라우저가 스크롤을 자동 보정하지 않게 */
#optCard,
#sourceCard,
#imgBox,
#picks,
#optConcept,
#optConcept .ropt {
  overflow-anchor: none;
}
#optConcept .ropt input {
  scroll-margin: 0;
}
.play { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); cursor: pointer; display: grid; place-items: center; font-size: 10px; padding: 0 0 0 2px; }
.play:hover { border-color: var(--accent); color: var(--accent); }
.play.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.play.on:hover { background: var(--btn-hover); border-color: var(--btn-hover-line); color: #fff; filter: none; }
.sample { display: block; margin-top: 7px; padding: 8px 10px; border-radius: 8px; background: linear-gradient(160deg, #0f4d46, #12303a); text-align: center; font-size: 17px; line-height: 1.25; color: #fff; }
.sample mark { background: none; color: #ffe23d; }
.sample.s-basic { font-family: 'P-XBold', var(--font); -webkit-text-stroke: 5px #0e0e12; paint-order: stroke fill; }
.sample.s-pop { font-family: 'P-Jua', var(--font); font-size: 19px; -webkit-text-stroke: 6px #1a1033; paint-order: stroke fill; }
.sample.s-impact { font-family: 'P-Black', var(--font); font-size: 19px; -webkit-text-stroke: 6px #000; paint-order: stroke fill; }
.sample.s-box { font-family: 'P-Bold', var(--font); background: linear-gradient(160deg, #0f4d46, #12303a); }
.sample.s-box span { background: rgba(10, 10, 20, 0.78); padding: 3px 10px; border-radius: 8px; }
.sample.s-yellow { font-family: 'P-XBold', var(--font); color: #ffe14d; -webkit-text-stroke: 5px #1b1200; paint-order: stroke fill; }
.sample.s-yellow mark { color: #fff; }
.sample.s-neon { font-family: 'P-Black', var(--font); font-size: 19px; color: #7cffe4; -webkit-text-stroke: 5px #052b2f; paint-order: stroke fill; text-shadow: 0 0 10px rgba(60, 255, 214, 0.55); }
.sample.s-neon mark { color: #fff36b; }
.sample.s-pink { font-family: 'P-Jua', var(--font); font-size: 19px; color: #ff5fa8; -webkit-text-stroke: 5px #3a0a24; paint-order: stroke fill; }
.sample.s-pink mark { color: #fff; }
.sample.s-orange { font-family: 'P-Black', var(--font); font-size: 19px; color: #ff8a3d; -webkit-text-stroke: 5px #2a1200; paint-order: stroke fill; }
.sample.s-orange mark { color: #fff; }
.sample.s-comic { font-family: 'P-DoHyeon', var(--font); font-size: 19px; -webkit-text-stroke: 5px #0b3a7a; paint-order: stroke fill; }
.sample.s-comic mark { color: #ffe23d; }
.sample.s-soft { font-family: 'P-Bold', var(--font); text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75); }
.sample.s-soft mark { color: #7cffe4; }
.sample.s-banner { font-family: 'P-XBold', var(--font); color: #141414; background: linear-gradient(160deg, #0f4d46, #12303a); }
.sample.s-banner span { background: rgba(255, 224, 70, 0.94); color: #141414; padding: 3px 10px; border-radius: 8px; }
.sample.s-banner mark { color: #c62828; }
.sample.s-mintbox { font-family: 'P-XBold', var(--font); background: linear-gradient(160deg, #0f4d46, #12303a); }
.sample.s-mintbox span { background: rgba(15, 120, 100, 0.82); padding: 3px 10px; border-radius: 8px; }
.sample.s-mintbox mark { color: #052b2f; }

/* 자막 크기 슬라이더 (자막 스타일 칸 아래) */
.capsize { margin: 8px 4px 10px; padding-top: 10px; border-top: 1px dashed var(--line2); }
.cs-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; font-weight: 700; }
.cs-head b { color: var(--accent); font-size: 13px; }
.cs-prev { display: grid; place-items: center; min-height: 64px; overflow: hidden; border-radius: 8px; background: linear-gradient(160deg, #0f4d46, #12303a); margin-top: 7px; }
.cs-prev .sample { margin: 0; background: none; white-space: nowrap; max-width: 100%; overflow: hidden; }
.capsize input[type='range'] { width: 100%; margin: 10px 0 2px; accent-color: var(--accent); }
.cs-scale { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--faint); }
.cs-scale .link { font-size: 11px; padding: 0; }

/* ───────── 영상에 쓸 이미지 상자 (상품 선택 아래) ───────── */
.pick.more {
  display: grid; place-items: center; gap: 6px; text-align: center;
  color: #0b3d34; font-weight: 800; font-size: 14.5px; line-height: 1.4; min-height: 150px;
  border: 2px solid rgba(53, 214, 176, 0.55);
  background: linear-gradient(135deg, #ffffff 0%, #e7fff7 42%, #ffffff 84%);
  background-size: 220% 220%;
  animation: moreFloat 2.6s ease-in-out infinite;
  box-shadow: 0 8px 22px rgba(53, 214, 176, 0.18);
}
.pick.more .more-ico {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 22px; font-weight: 700; line-height: 1;
  animation: moreBounce 1.6s ease-in-out infinite;
}
.pick.more:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 28px rgba(53, 214, 176, 0.28);
}
.pick.more:disabled { opacity: 0.6; cursor: default; animation: none; }
@keyframes moreFloat {
  0%, 100% { background-position: 0% 40%; transform: translateY(0); }
  50% { background-position: 100% 60%; transform: translateY(-4px); }
}
@keyframes moreBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.08); }
}
.imgbox {
  margin-top: 16px; border: 1.5px solid var(--frame); border-radius: 12px; background: var(--elev);
  padding: 14px 16px 12px; transition: box-shadow 0.15s, border-color 0.15s;
  box-shadow: inset 0 0 0 1px rgba(53, 214, 176, 0.08);
}
.ib-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ib-main .gallery-grid { margin: 0; }
.ib-main .gallery-drop.inline {
  padding: 12px; border-style: dashed; border-width: 1.5px; border-color: var(--frame);
}
.ib-main.drop-over { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.imgbox.drag-out { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(255, 93, 115, 0.25); }
.imgbox.drag-out::after {
  content: '밖으로 놓으면 삭제';
  display: block; margin-top: 8px; text-align: center; font-size: 12.5px; font-weight: 700; color: #ff9aa8;
}
.ib-head { display: flex; gap: 10px 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ib-head b { font-size: 13.5px; }
.ib-head .hint { flex: 1 1 100%; }
.ib-head .btn.sm { padding: 4px 10px; font-size: 12px; margin-left: auto; }
.gallery-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.gallery-sec-head b { margin: 0; flex: 1; }
.gallery-sec-head .btn {
  min-height: 30px; padding: 0 10px; font-size: 12px;
  border-color: rgba(255, 93, 115, 0.45); color: #ff9aa8; background: rgba(255, 93, 115, 0.08);
}
.gallery-sec-head .btn:hover:not(:disabled) {
  border-color: var(--danger); background: rgba(255, 93, 115, 0.16); color: #ffb4be;
}
.gallery-grid .itile img { cursor: zoom-in; }
.eimg .ph { cursor: zoom-in; }
.eimg .ph img { cursor: zoom-in; }

dialog.imgzoom-dlg { width: min(920px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
dialog.imgzoom-dlg.is-native { width: max-content; }
.imgzoom { gap: 12px; }
.imgzoom-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.imgzoom-head h3 { margin: 0; font-size: 15px; }
.imgzoom-frame {
  display: grid; place-items: center; max-height: min(78vh, 820px); overflow: auto;
  background: #05070a; border-radius: 12px; border: 1px solid var(--line); padding: 10px;
}
.imgzoom-frame img {
  max-width: 100%; max-height: min(74vh, 780px); width: auto; height: auto;
  object-fit: contain; display: block;
}
.imgzoom-dlg.is-native .imgzoom-frame { max-height: calc(100vh - 120px); max-width: calc(100vw - 48px); }
.imgzoom-dlg.is-native .imgzoom-frame img { max-width: none; max-height: none; }
.ib-desc {
  margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line);
}
.ib-desc-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.ib-desc-head b { font-size: 13.5px; }
.ib-desc textarea {
  width: 100%; min-height: 110px; resize: vertical;
  font-size: 13px; line-height: 1.55;
}
.story-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px;
}
.story-tab {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 999px; padding: 3px 4px 3px 4px; font-size: 12px; font-weight: 700;
}
.story-tab:hover { border-color: var(--accent); color: var(--text); }
.story-tab.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.story-tab.filled:not(.on) { color: var(--text); }
.story-tab.use { box-shadow: 0 0 0 1px var(--accent); }
.story-tab-label {
  border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700;
  padding: 4px 8px; border-radius: 999px; cursor: pointer; line-height: 1.2;
}
.story-tab-label:hover { color: var(--text); }
.story-use-tog {
  border: 0; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 800;
  cursor: pointer; line-height: 1.2; font-family: inherit;
  background: rgba(255, 255, 255, 0.06); color: var(--muted);
}
.story-use-tog:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.story-use-tog.on {
  background: var(--accent); color: #06251f;
}
.story-use-tog.empty,
.story-use-tog:disabled {
  opacity: 0.45; cursor: not-allowed;
}
.story-pane {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel);
}
.story-pane-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px;
}
.story-pane-head .hint { flex: 1; font-weight: 700; color: var(--text); }
.story-pane-head #descCount { color: var(--muted); font-size: 12px; }
.ib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.itile { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); background: #fff; cursor: grab; display: block; }
.itile.dragging { opacity: 0.45; cursor: grabbing; }
.itile img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.itile .tools { position: absolute; top: 6px; left: 6px; right: 6px; display: flex; gap: 5px; align-items: center; justify-content: space-between; z-index: 2; pointer-events: none; }
.itile .tools input,
.itile .tools .del { pointer-events: auto; }
.itile .tools input { position: static; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.itile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.itile:not(.on) img { opacity: 0.62; }
.itile .kind { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 10.5px; font-weight: 800; padding: 1px 8px; border-radius: 999px; }
.itile.gif .kind { background: #ff5d73; }
.itile .del {
  width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(20, 24, 32, 0.82); color: #fff; font-size: 15px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.itile .del:hover { background: var(--danger); }
.itile.add {
  cursor: pointer; color: #0b3d34; font-weight: 800; font-size: 13.5px; line-height: 1.35;
  display: grid; place-items: center; gap: 6px; text-align: center;
  border: 2px dashed rgba(53, 214, 176, 0.7);
  background: linear-gradient(145deg, #ffffff 0%, #e9fff8 45%, #ffffff 100%);
  background-size: 200% 200%;
  animation: addGlow 2.4s ease-in-out infinite;
  box-shadow: 0 6px 18px rgba(53, 214, 176, 0.16);
}
.itile.add .add-ico {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 22px; font-weight: 700; line-height: 1;
  animation: addSpin 2.8s ease-in-out infinite;
}
.itile.add:hover:not(:disabled) {
  border-color: var(--accent); border-style: solid;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 24px rgba(53, 214, 176, 0.28);
}
.itile.add:disabled { opacity: 0.5; cursor: default; animation: none; }
@keyframes addGlow {
  0%, 100% { background-position: 0% 50%; box-shadow: 0 6px 18px rgba(53, 214, 176, 0.12); }
  50% { background-position: 100% 50%; box-shadow: 0 10px 26px rgba(53, 214, 176, 0.28); }
}
@keyframes addSpin {
  0%, 100% { transform: rotate(0deg) scale(1); }
  40% { transform: rotate(12deg) scale(1.08); }
  70% { transform: rotate(-8deg) scale(1.04); }
}
.ib-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* 크롬 확장 설치 안내 */
.ext-install {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.ext-install b { display: block; font-size: 13.5px; margin-bottom: 6px; }
.ext-install p { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.ext-install ol { margin: 0 0 10px; padding-left: 18px; font-size: 12.5px; line-height: 1.6; color: var(--text); }
.ext-install code { font-size: 12px; }
.ext-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.ib-warn { margin-top: 10px; padding: 9px 12px; border-radius: 8px; background: rgba(255, 93, 115, 0.1); border: 1px solid rgba(255, 93, 115, 0.4); color: #ff9aa8; font-size: 12.5px; line-height: 1.6; }
.ib-warn b { color: #ff8fa0; }
.ib-warn[hidden], .imgbox[hidden] { display: none; }
#fCustom { margin-top: 8px; font-size: 12.5px; }
.avatar-persona { margin: 2px 4px 8px; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--muted); }
.avatar-persona[hidden] { display: none; }
.avatar-persona b { color: var(--text); font-weight: 600; }

/* ───────── AI 인물 소개: 인물 고르기(여성 5·남성 5) / 내 사진 올리기 ───────── */
/* 화면 구성(레퍼런스형/기본형) + 상품 상세 설명 */
.ref-panel { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.4fr); gap: 18px; align-items: stretch; margin-top: 14px; }
.opt-layout #optLayout { display: grid; gap: 4px; }
.opt-layout .hint { margin: 6px 2px 6px; font-size: 12px; line-height: 1.5; }
.opt-layout .ropt.dis { opacity: 0.55; cursor: not-allowed; }
.opt-detail textarea { width: 100%; box-sizing: border-box; min-height: 108px; resize: vertical; font-size: 13px; line-height: 1.55; }
.opt-detail .desc-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.opt-detail .desc-meta .check { margin: 0; }
.opt-detail .hint { margin: 4px 2px 8px; font-size: 12px; line-height: 1.5; }
.opt-prompt { margin-top: 14px; }
.opt-prompt textarea { width: 100%; box-sizing: border-box; min-height: 78px; resize: vertical; font-size: 13px; line-height: 1.55; }
.opt-prompt .desc-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.opt-prompt .desc-meta .hint { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.opt-tag { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.prompt-preview { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; line-height: 1.55; color: var(--muted); }
.prompt-preview b { display: block; margin-bottom: 4px; color: var(--text); font-size: 12px; }
.prompt-preview ul { margin: 0; padding-left: 16px; }
.prompt-preview p { margin: 0; }
.ref-panel[hidden], .opt-detail[hidden] { display: none; }
.presenter-panel { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--elev); }
.presenter-panel[hidden] { display: none; }
.presenter-panel .avatar-persona { margin: 12px 0 0; }
.pp-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; margin-bottom: 10px; }
.pp-head b { font-size: 13.5px; }
.pp-head .hint { font-size: 12px; line-height: 1.5; }
.persona-group { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: start; margin-top: 8px; }
.pg-title { font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 22px; }
.persona-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ptile { position: relative; display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); cursor: pointer; min-width: 0; transition: border-color 0.12s, background 0.12s; }
.ptile:hover { border-color: var(--line2); }
.ptile input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ptile img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: 50% 30%; flex: none; background: var(--input); border: 2px solid var(--line2); }
.ptile .pt { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.ptile .pn { font-weight: 700; font-size: 13px; }
.ptile .pa { font-size: 11.5px; color: var(--muted); }
.ptile .pd { font-size: 11px; color: var(--faint); }
.ptile:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.ptile:has(input:checked) img { border-color: var(--accent); }
.ptile:has(input:checked) .pn { color: var(--accent); }
.ptile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.self-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.self-drop { position: relative; flex: none; width: 150px; aspect-ratio: 3 / 4; border: 1px dashed var(--line2); border-radius: 12px; background: var(--input); display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.5; cursor: pointer; overflow: hidden; }
.self-drop:hover { border-color: var(--accent); color: var(--accent); }
.self-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.self-drop img[hidden] { display: none; }
.self-drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.self-side { flex: 1 1 280px; min-width: 0; }
.self-tips { margin: 0 0 6px; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.self-tips b { color: var(--text); font-weight: 600; }
.self-ok { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--panel); }
.self-ok b { color: var(--text); font-weight: 600; }
.self-lib { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.self-lib-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; margin-bottom: 10px; }
.self-lib-head b { font-size: 13px; }
.self-lib-head .hint { font-size: 12px; }
.self-lib-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px;
}
.self-lib-grid:empty { display: none; }
#selfLibEmpty { margin: 0; font-size: 12px; }
#selfLibEmpty[hidden] { display: none; }
.stile {
  position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden;
  border: 2px solid var(--line); background: var(--input); cursor: pointer; padding: 0;
  display: block; width: 100%;
}
.stile img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.stile:hover { border-color: var(--line2); }
.stile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.stile .del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.35); background: rgba(8, 12, 18, 0.78); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.stile .del:hover { background: #c0392b; border-color: #c0392b; }

.opt-avatar { display: flex; flex-direction: column; gap: 10px; }
.opt-avatar #optAvatar { display: grid; gap: 4px; }
.tier-pick { display: grid; gap: 6px; padding: 8px 8px 6px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.tier-pick[hidden] { display: none; }
.tier-pick .tp-label { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.tier-pick .tp-opts { display: grid; gap: 4px; }
.tier-pick .ropt { padding: 7px 8px; }
.tier-pick .ropt .nm { font-size: 12.5px; }
.tier-pick .ropt .ds { font-size: 11px; }
.avatar-extras { display: grid; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--line); }
.avatar-extras .field { min-width: 0; }
.avatar-extras .check { min-height: 34px; align-items: flex-start; }
.hook-int { display: grid; gap: 6px; padding: 8px 10px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.hook-int .hi-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.hook-int .hi-head b { color: var(--accent); font-size: 12.5px; }
.hook-int input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }
.hook-int .hi-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; font-size: 10.5px; color: var(--muted); text-align: center; }
.hook-int .hint { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.hook-int .hint b { color: var(--text); font-weight: 600; }
.extras { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.extras-estimate { align-items: center; }
.extras .check { min-height: 38px; }
.ref-panel:not(:has(#layoutField:not([hidden]))) { display: none; }
.script-picks {
  margin: 14px 0 0; align-self: stretch; box-sizing: border-box;
  padding: 14px 16px; border: 1px solid var(--line2); border-radius: 12px; background: var(--elev);
}
.script-picks .sp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.script-picks .sp-head b { font-size: 13px; }
.script-picks .sp-head .hint { margin: 0; font-size: 12px; line-height: 1.45; }
.sp-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sp-list:empty { display: none; }
.sp-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; text-align: left;
  min-height: 180px; max-height: 280px; padding: 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer;
}
.sp-card b { font-size: 13px; color: var(--accent); }
.sp-card .sp-title { font-size: 12.5px; font-weight: 700; line-height: 1.4; }
.sp-card .sp-lines {
  overflow: auto; font-size: 12px; line-height: 1.55; color: var(--muted);
}
.sp-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sp-card:disabled { cursor: default; opacity: 0.7; }
@media (max-width: 980px) {
  .sp-list { grid-template-columns: 1fr; }
}

/* ───────── 작업대 ───────── */
.bench { display: grid; grid-template-columns: 320px minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.bench .card { margin-bottom: 16px; }
.preview-card { position: sticky; top: 16px; }
.phone { aspect-ratio: 9 / 16; width: 100%; max-width: 276px; margin: 0 auto 14px; border-radius: 24px; background: #05070a; border: 1px solid var(--line2); overflow: hidden; position: relative; }
.phone video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.phone-empty, .phone-busy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.7; padding: 20px; gap: 12px; }
.phone-empty b { color: var(--text); }
.ph-icon { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line2); display: grid; place-items: center; color: var(--faint); padding-left: 3px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .btn:not(.primary) { padding: 0 6px; font-size: 13px; }
.actions .primary { grid-column: 1 / -1; min-height: 44px; font-size: 15px; }
.thumb-dlg { width: min(1180px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
.thumb-ed { gap: 14px; }
.thumb-ed-head h3 { margin: 0; }
.thumb-ed-grid {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(220px, 280px) minmax(200px, 260px);
  gap: 14px; align-items: start;
}
.thumb-ed-label { display: block; font-size: 12.5px; margin-bottom: 8px; }
.thumb-frame-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
  max-height: 320px; overflow: auto; padding: 2px;
}
.thumb-frame {
  position: relative; border: 2px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--input); cursor: pointer; padding: 0; aspect-ratio: 9 / 16;
}
.thumb-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-frame .miss {
  display: grid; place-items: center; width: 100%; height: 100%;
  color: var(--muted); font-size: 11px; background: var(--panel2);
}
.thumb-frame .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 10.5px; text-align: center;
}
.thumb-frame.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.thumb-time-row { display: flex; gap: 8px; align-items: center; }
.thumb-time-row input[type="range"] { flex: 1; accent-color: var(--accent); }
#btnThumbBare { width: 100%; margin-top: 4px; }
#btnThumbBare.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.thumb-stage-box {
  border: 1px solid var(--line2); border-radius: 14px; background: #05070a;
  overflow: hidden; display: grid; place-items: center;
}
#thumbCanvas { width: 100%; max-width: 270px; height: auto; display: block; cursor: grab; touch-action: none; }
#thumbCanvas.drag { cursor: grabbing; }
.thumb-ed-tools { display: grid; gap: 8px; }
.thumb-colors {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
}
.thumb-colors button {
  width: 100%; aspect-ratio: 1; border-radius: 5px; border: 1px solid rgba(255,255,255,0.15);
  padding: 0; cursor: pointer;
}
.thumb-colors button.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.thumb-align, .thumb-style { display: flex; gap: 6px; flex-wrap: wrap; }
.tbtn {
  min-height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line2);
  background: var(--panel2); color: var(--text); cursor: pointer; font-size: 12px;
}
.tbtn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
@media (max-width: 980px) {
  .thumb-ed-grid { grid-template-columns: 1fr; }
  .thumb-frame-list { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: 180px; }
}
.script-dl-body { display: flex; flex-direction: column; gap: 12px; }
.script-dl-scene {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: var(--elev);
}
.script-dl-scene .sh {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px;
  font-weight: 700; font-size: 13.5px;
}
.script-dl-scene .sh .n { color: var(--accent); }
.script-dl-scene .sh .ty { color: var(--muted); font-weight: 600; font-size: 12px; }
.script-dl-scene .hl {
  font-size: 12.5px; color: var(--muted); margin-bottom: 6px; line-height: 1.4;
}
.script-dl-scene .hl b { color: var(--text); font-weight: 600; }
.script-dl-scene .nr {
  font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.script-view-tabs { display: flex; gap: 6px; }
.script-prompt-view {
  margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--elev); color: var(--text); font: 13px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; max-height: min(62vh, 640px); overflow: auto;
}
.script-prompt-view .heygen-final { color: #ffd84a; }
html[data-theme='light'] .script-prompt-view .heygen-final { color: #8a6500; background: #fff4c2; }

.script-card { min-height: 420px; }
.script-edit { display: grid; gap: 10px; }
.script-edit-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; position: sticky; bottom: 0; padding: 10px 0 2px; background: linear-gradient(180deg, transparent, var(--panel) 28%); }
.scenes { display: grid; gap: 8px; }
.scene { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; align-items: start; cursor: pointer; }
.scene:hover { border-color: var(--line2); }
.scene.active { border-color: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.scene .no { width: 26px; height: 26px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.scene .ty { font-size: 11px; color: var(--accent); font-weight: 700; margin-bottom: 2px; }
.scene .hd { font-size: 14.5px; font-weight: 700; line-height: 1.4; }
.scene .hd mark { background: none; color: #ffe23d; }
.scene .nr { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.scene .tm { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-title { font-size: 12px; font-weight: 700; color: var(--muted); margin: 18px 0 8px; }
.compliance-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.compliance-toggle {
  min-height: 26px; padding: 0 10px; font-size: 11.5px; font-weight: 800;
  border-radius: 999px; letter-spacing: 0.02em; flex: 0 0 auto;
}
.compliance-toggle[aria-pressed='true'] {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.checks li { font-size: 12.5px; color: var(--muted); padding: 3px 0 3px 22px; position: relative; line-height: 1.5; }
.checks li::before { content: ''; position: absolute; left: 3px; top: 8px; width: 9px; height: 5px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.warnbox { margin-top: 8px; font-size: 12.5px; border: 1px solid rgba(255, 198, 90, 0.3); background: rgba(255, 198, 90, 0.07); color: var(--warn); border-radius: 8px; padding: 8px 12px; line-height: 1.6; }
.costbox { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.costbox b { font-size: 20px; color: var(--text); }

.overall { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.overall .pct { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.overall .state { font-size: 12.5px; color: var(--muted); }
.overall .state.run { color: var(--blue); }
.overall .state.done { color: var(--accent); }
.overall .state.bad { color: var(--danger); }
.bar { height: 6px; background: var(--input); border-radius: 99px; overflow: hidden; }
.bar.big { height: 8px; margin-bottom: 14px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.35s ease; }
.stages li { display: grid; grid-template-columns: 74px minmax(0, 1fr) 40px; gap: 10px; align-items: center; padding: 6px 0; font-size: 12.5px; color: var(--muted); }
.stages li .bar { height: 4px; }
.stages li.run { color: var(--text); }
.stages li.run .bar i { background: var(--blue); }
.stages li .pc { text-align: right; font-variant-numeric: tabular-nums; }
.stages li.done .pc { color: var(--accent); }

.channels li { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.channels select { min-height: 34px; padding: 6px 28px 6px 10px; font-size: 12.5px; background-position: calc(100% - 17px) 14px, calc(100% - 12px) 14px; }
.channels .api { grid-column: 2; font-size: 11px; color: var(--faint); margin-top: -4px; line-height: 1.4; }
#btnUpload { margin-top: 12px; min-height: 42px; }

/* ───────── 내 영상 ───────── */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; align-items: start; }
.vcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; align-self: start; }
.vcard .th { aspect-ratio: 9 / 16; width: 100%; height: auto; flex: none; background: #05070a; position: relative; color: var(--faint); font-size: 12px; cursor: pointer; }
.vcard .th img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.vcard .st { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.7); }
.vcard .st.done { color: var(--accent); }
.vcard .st.bad { color: var(--danger); }
.vcard .st.run { color: var(--blue); }
.vcard .st.mid { top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 13px; padding: 6px 12px; white-space: nowrap; }
.vcard .bd { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.vcard .tt { font-size: 13px; font-weight: 700; line-height: 1.4; min-height: calc(1.4em * 2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vcard .mt { font-size: 11.5px; color: var(--faint); }
.vcard .mt.owner { color: var(--accent); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcard .mt-cost { font-size: 11.5px; line-height: 1.35; margin-top: 1px; }
.cost-y { color: var(--cost-y); font-weight: 600; }
#feedPlayMeta .cost-y { color: var(--cost-y); }
.vcard .ac { display: flex; gap: 5px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.vcard .ac + .ac { margin-top: 0; padding-top: 4px; }
.vcard .ac .btn { min-height: 30px; padding: 0 8px; font-size: 12px; flex: 1 1 auto; min-width: 0; }
.vcard .ac.split { flex-wrap: nowrap; gap: 4px; }
.vcard .ac.split .btn { flex: 1 1 0; padding: 0 6px; white-space: nowrap; }
.vcard .play-badge {
  position: absolute; inset: 0; margin: auto; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55); border: 2px solid rgba(255, 255, 255, 0.85);
  display: grid; place-items: center; pointer-events: none; opacity: 0.92;
}
.vcard .play-badge::before {
  content: ''; display: block; width: 0; height: 0;
  border-style: solid; border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent #fff; margin-left: 3px;
}
.vcard:hover .play-badge { background: rgba(45, 212, 191, 0.35); border-color: var(--accent); }
.feed-dlg { width: min(420px, calc(100vw - 24px)); }
.feed-play { gap: 10px; }
.feed-play-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.feed-play-head h3 { font-size: 15px; line-height: 1.35; margin: 0; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feed-phone {
  margin: 0 auto; width: min(320px, 100%); aspect-ratio: 9 / 16;
  background: #05070a; border-radius: 14px; overflow: hidden; border: 1px solid var(--line);
}
.feed-phone video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }

/* ───────── 다이얼로그 · 토스트 ───────── */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 16px; padding: 0; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
#dlgNeedKey, #dlgHeygen { width: min(480px, calc(100vw - 32px)); }
#dlgNeedKey .hint, #dlgHeygen .hint { margin: 0; line-height: 1.6; font-size: 13.5px; }
.heygen-steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.heygen-need { margin: 0 0 8px; }
#dlgHeygen .ai-add { margin-top: 4px; }
dialog::backdrop { background: rgba(3, 5, 9, 0.7); }
#dlgGallery { width: min(920px, calc(100vw - 32px)); }
.dlg-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 50px); overflow-y: auto; }
.dlg-body h3 { font-size: 17px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }

/* 상세이미지 호출 — 실제 화면 영상 안내 */
.gal-howto {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.8fr); gap: 12px 16px;
  align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--elev);
}
.gal-howto[hidden] { display: none !important; }
.imgbox .img-howto { margin: 0 0 12px; }
.howto-video {
  position: relative; border-radius: 10px; overflow: hidden;
  border: 2px solid var(--line2); background: #0a0e14;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.howto-video video {
  display: block; width: 100%; height: auto; max-height: 300px; object-fit: contain;
  background: #0a0e14; cursor: pointer;
}
.howto-video .howto-full {
  position: absolute; right: 8px; top: 8px; z-index: 2;
  padding: 4px 9px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(5, 8, 12, 0.72); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer;
  opacity: 0.85; transition: opacity 0.15s;
}
.howto-video .howto-full:hover { opacity: 1; }
.gal-howto-steps {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 8px;
}
.gal-howto-steps li {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--muted); line-height: 1.35;
  opacity: 0.5; transition: opacity 0.2s, color 0.2s;
}
.gal-howto-steps li b {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px;
  background: var(--panel2); border: 1px solid var(--line2); color: var(--faint);
}
.gal-howto-steps li.on {
  opacity: 1; color: var(--text);
}
.gal-howto-steps li.on b {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}
@media (max-width: 720px) {
  .gal-howto { grid-template-columns: 1fr; }
  .howto-video video { max-height: 240px; }
}

.gallery-drop {
  display: grid; gap: 6px; place-items: center; text-align: center;
  padding: 18px 14px; border: 2px dashed var(--line2); border-radius: 12px;
  background: var(--input); color: var(--muted); font-size: 13px; line-height: 1.55;
  outline: none; transition: border-color 0.12s, background 0.12s;
}
.gallery-drop:hover, .gallery-drop:focus-visible { border-color: var(--accent); }
.gallery-drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.gallery-drop b { color: var(--text); font-size: 14.5px; }
.gallery-drop kbd {
  display: inline-block; padding: 0 5px; border: 1px solid var(--line2); border-radius: 4px;
  background: var(--panel2); font: 600 11.5px/1.6 var(--font); color: var(--text);
}
.gallery-drop-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.gallery-grid { display: flex; flex-direction: column; gap: 14px; max-height: min(48vh, 440px); overflow: auto; padding: 8px; border: 1px solid transparent; border-radius: 10px; transition: border-color 0.15s, box-shadow 0.15s; }
.gallery-grid.drag-out { border-color: var(--danger); box-shadow: inset 0 0 0 1px rgba(255, 93, 115, 0.35); }
.gallery-grid.drag-out::after {
  content: '밖으로 놓으면 삭제';
  display: block; margin-top: 6px; text-align: center; font-size: 12.5px; font-weight: 700; color: #ff9aa8;
}
.gallery-sec b { font-size: 12.5px; color: var(--muted); }
.gallery-sec > b { display: block; margin-bottom: 8px; }
.gallery-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.gallery-grid .itile { aspect-ratio: 1; cursor: grab; }
.gallery-grid .itile .kind { font-size: 10px; }
.gallery-advanced { border-top: 1px solid var(--line); padding-top: 10px; font-size: 12.5px; color: var(--muted); }
.gallery-advanced summary { cursor: pointer; color: var(--faint); margin-bottom: 8px; }
.gallery-advanced summary:hover { color: var(--accent); }
.gallery-advanced .hint { margin: 0 0 8px; }
.edit-rows { display: grid; gap: 10px; }
.erow { display: grid; grid-template-columns: 36px 84px minmax(0, 1fr) 30px; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.edit-rows.no-preview .erow { grid-template-columns: 36px minmax(0, 1fr) 30px; }
/* 장면 사진(지금 쓰일 사진) + 사진 바꾸기 */
.erow .eimg { display: grid; gap: 6px; align-content: start; }
.erow .eimg .ph { width: 84px; height: 84px; border-radius: 9px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; color: var(--faint); font-size: 11px; text-align: center; padding: 4px; }
.erow .eimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.erow .eimg .chg { appearance: none; font: inherit; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 7px; padding: 4px 0; cursor: pointer; width: 100%; }
.erow .eimg .chg:hover { filter: brightness(1.1); }
.erow .eimg .chg:disabled { opacity: 0.5; cursor: default; }
.erow .eimg .kd { font-size: 10px; color: var(--faint); text-align: center; line-height: 1.3; }
.erow .eimg .kd.custom { color: var(--accent); font-weight: 700; }
.pick-sec { display: grid; gap: 8px; }
.pick-sec > b { font-size: 12.5px; color: var(--muted); }
.pick-row { display: flex; gap: 12px; align-items: center; }
.pick-row img { width: 72px; height: 72px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); background: #fff; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pick-grid button { appearance: none; padding: 0; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; cursor: pointer; aspect-ratio: 1; }
.pick-grid button:hover { border-color: var(--accent); }
.pick-grid button.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.pick-grid button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-grid button:disabled { opacity: 0.5; cursor: default; }
.pick-sec .sub { font-size: 11.5px; color: var(--faint); }
@media (max-width: 560px) {
  .erow { grid-template-columns: 30px 64px minmax(0, 1fr) 24px; gap: 8px; }
  .edit-rows.no-preview .erow { grid-template-columns: 30px minmax(0, 1fr) 24px; }
  .erow .eimg .ph { width: 64px; height: 64px; }
}
.erow.active { border-color: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.erow .no { appearance: none; background: none; border: 0; font: inherit; font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 0 0; text-align: center; cursor: pointer; line-height: 1.25; width: 100%; }
.erow .no:hover { color: var(--accent); }
.erow .no small { display: block; font-size: 10px; font-weight: 600; color: var(--faint); margin-top: 2px; font-variant-numeric: tabular-nums; }
.erow .fs { display: grid; gap: 6px; }
.erow .ty { font-size: 11px; color: var(--accent); font-weight: 700; }
.erow .x { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 18px; line-height: 1; align-self: start; padding: 8px 0 0; }
.erow .x:hover { color: var(--danger); }
.erow.off { opacity: 0.4; }
.erow input[type='text'], .erow textarea { width: 100%; min-height: 36px; }
/* 연출 메모(선택) + 「이 지시로 AI 컷 만들기」 · 「AI 영상컷으로」 */
.erow textarea.dir { min-height: 32px; font-size: 12px; border-style: dashed; color: var(--muted); }
.erow textarea.dir:focus { color: var(--text); border-style: solid; }
.erow textarea.dir:disabled { opacity: 0.5; }
.erow .dirrow { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.erow .mini { appearance: none; font: inherit; font-size: 11.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 7px; padding: 4px 10px; cursor: pointer; }
.erow .mini:hover:not(:disabled) { filter: brightness(1.1); }
.erow .mini:disabled { opacity: 0.55; cursor: default; }
.erow .mini-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); cursor: pointer; }
.erow .mini-check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.erow .mini-check small { color: var(--faint); font-size: 11px; }
/* 레퍼런스형: 특징 장면의 강조 문구(콜아웃) */
.erow .callout-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); }
.erow .callout-row input[type='text'] { min-height: 32px; font-weight: 700; }
/* 레퍼런스형: 화면 위 고정 제목 + 영상이 말하는 내용의 근거 */
.ref-edit { display: grid; gap: 10px; }
.ref-top { display: grid; gap: 6px; background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; font-size: 12.5px; }
.ref-top .hint { font-size: 11.5px; }
.ref-top-in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ref-top-in input { min-height: 36px; font-weight: 700; }
.brief { background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 12px; font-size: 12.5px; }
.brief > summary { cursor: pointer; font-weight: 700; padding: 2px 0; }
.brief-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.brief-tag.weak { background: rgba(255, 198, 90, 0.14); color: var(--warn); }
.brief .bnote { margin: 8px 0 6px; font-size: 12px; color: var(--muted); line-height: 1.55; }
.brief .bwarn { margin: 4px 0; font-size: 12px; color: var(--warn); line-height: 1.5; }
.brief ul.bfeat { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.brief .bfeat li { border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; background: var(--panel); line-height: 1.5; }
.brief .bfeat li.chk { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.brief .bfeat .nm { font-weight: 700; }
.brief .bfeat .ev { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.brief .bfeat .ev.web { background: rgba(90, 169, 255, 0.14); color: #5aa9ff; }
.brief .bfeat .ev.image { background: rgba(176, 124, 255, 0.16); color: #b07cff; }
.brief .bfeat .ev.title { background: rgba(160, 160, 160, 0.16); color: var(--muted); }
.brief .bfeat .q { display: block; margin-top: 2px; font-size: 11.5px; color: var(--faint); }
.brief .bfeat .need { color: var(--warn); font-size: 11.5px; font-weight: 700; margin-left: 6px; }
.brief .bsrc { margin: 8px 0 0; font-size: 11.5px; color: var(--faint); line-height: 1.5; }
.meta-body { display: grid; gap: 14px; }
.mch { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--panel2); }
.mch h4 { margin: 0 0 10px; font-size: 14px; }
.mfield { margin-bottom: 10px; }
.mfield .lb { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.mfield pre { margin: 0; white-space: pre-wrap; word-break: break-word; background: var(--input); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: 12.5px/1.6 var(--font); max-height: 180px; overflow: auto; }
.mfield .copy { background: none; border: 1px solid var(--line2); border-radius: 6px; color: var(--muted); font-size: 11.5px; padding: 1px 9px; cursor: pointer; }
.mfield .copy:hover { color: var(--accent); border-color: var(--accent); }
.mnotes { font-size: 12px; color: var(--muted); line-height: 1.65; padding-left: 14px; }
.mnotes li { list-style: disc; }

#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--toast); border: 1px solid var(--line2); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--text); box-shadow: 0 8px 28px var(--shadow); animation: pop 0.18s ease-out; }
.toast.bad { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }

/* ───────── 쿠팡 상품 가져오기 (API 키 없이 북마크로) ───────── */
.import { border: 1px solid rgba(53, 214, 176, 0.35); background: rgba(53, 214, 176, 0.05); border-radius: 12px; margin-bottom: 16px; }
.import > summary { cursor: pointer; padding: 11px 14px; display: flex; gap: 6px 12px; align-items: baseline; flex-wrap: wrap; list-style: none; }
.import > summary::-webkit-details-marker { display: none; }
.import > summary::before { content: '▸'; color: var(--accent); font-size: 12px; }
.import[open] > summary::before { content: '▾'; }
.import > summary b { font-size: 14px; }
.import > summary span { font-size: 12px; color: var(--muted); }
.import-body { padding: 2px 14px 14px; display: grid; gap: 14px; }
.istep { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 10px; }
.istep .n { height: 22px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 11.5px; display: grid; place-items: center; white-space: nowrap; margin-top: 1px; }
.istep > div > b { font-size: 13.5px; }
.istep p { color: var(--muted); font-size: 12.5px; line-height: 1.65; margin-top: 3px; }
.istep p b { color: var(--text); font-weight: 600; }
kbd { background: var(--panel2); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 11px; font-weight: 600; color: var(--text); }
.bm { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 9px 18px; border-radius: 9px; background: #2f6bff; border: 1px solid #5a8bff; color: #fff; font-weight: 800; text-decoration: none; cursor: grab; user-select: none; box-shadow: 0 2px 10px rgba(47, 107, 255, 0.35); }
.bm::before { content: '★'; font-size: 13px; }
.bm:active { cursor: grabbing; }
.bm.off { background: var(--panel2); border-color: var(--line2); color: var(--faint); box-shadow: none; cursor: not-allowed; }
.irow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.import-note { font-size: 11.5px; color: var(--faint); line-height: 1.65; border-top: 1px dashed var(--line2); padding-top: 10px; }

.pick-links { margin-top: 14px; border: 1px solid var(--line); background: var(--panel2); border-radius: 11px; padding: 12px 14px; display: grid; gap: 12px; }
.pl-head { font-size: 12px; color: var(--muted); line-height: 1.6; }
.pl-head > b { color: var(--text); margin-right: 8px; }
.pl-head span b { color: var(--text); font-weight: 600; }
.pl-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr) minmax(0, 1fr); gap: 10px; align-items: end; }
.pl-row .field { min-width: 0; }
.pl-t { display: flex; gap: 8px; align-items: center; min-width: 0; font-size: 12.5px; min-height: 38px; }
.pl-t i { flex: none; width: 20px; height: 20px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-style: normal; font-weight: 800; font-size: 11.5px; display: grid; place-items: center; }
.pl-t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.pl-t a, .srcrow a { flex: none; color: var(--accent); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.pl-t a:hover, .srcrow a:hover { text-decoration: underline; }
.srcrow { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* ───────── 요금제 · 멤버십 · AI 크레딧 ───────── */
.estimate .credit-line { color: var(--accent); }
.costbox .credit-line { color: var(--accent); flex-basis: 100%; }
.costbox .credit-line b { font-size: 13px; color: var(--accent); }
.note.info { color: var(--muted); background: rgba(90, 169, 255, 0.07); border-color: rgba(90, 169, 255, 0.25); line-height: 1.7; }

/* 제작 화면 위쪽 한 줄 현황 */
.qstrip { display: flex; gap: 6px 16px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; padding: 9px 14px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.qstrip b { color: var(--text); }
.qstrip i { font-style: normal; color: var(--faint); }
.qstrip .pb b { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 1px 9px; font-size: 12px; }
.qstrip.bad { border-color: rgba(255, 111, 125, 0.45); background: rgba(255, 111, 125, 0.06); }
.qstrip.bad .pb b { background: rgba(255, 111, 125, 0.15); color: var(--danger); }
.qstrip .why { color: var(--warn); flex-basis: 100%; }
.qstrip .link { margin-left: auto; padding: 0; }

.qitem small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.55; margin-top: 7px; }
.qitem .bar { margin-top: 8px; }
.member-top { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.mt-text { display: grid; gap: 1px; }
.mt-text b { font-size: 14px; }
.mt-text span { color: var(--muted); font-size: 12.5px; }
.pbadge { display: inline-block; background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(53, 214, 176, 0.4); border-radius: 9px; padding: 3px 14px; font-weight: 800; font-size: 14px; letter-spacing: 0.02em; }
.pbadge.trial { background: rgba(90, 169, 255, 0.12); color: var(--blue); border-color: rgba(90, 169, 255, 0.4); }
.pbadge.expired { background: rgba(255, 111, 125, 0.1); color: var(--danger); border-color: rgba(255, 111, 125, 0.4); }
.pbadge.sm { font-size: 12px; padding: 1px 10px; }
#memberNote { margin-bottom: 4px; line-height: 1.7; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.plan { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 16px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); }
.plan.pick { border-color: rgba(53, 214, 176, 0.45); }
.plan.current { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--panel2) 60%); }
.plan h3 { font-size: 16px; letter-spacing: 0.02em; }
.plan .price b { font-size: 24px; font-weight: 800; }
.plan .price span { color: var(--muted); font-size: 12.5px; margin-left: 4px; }
.plan ul { display: grid; gap: 7px; font-size: 12.5px; color: var(--muted); flex: 1; }
.plan li::before { content: '✓'; color: var(--accent); margin-right: 7px; font-weight: 800; }
.plan li b { color: var(--text); }
.plan li.eq { color: var(--accent); }
.ptag { position: absolute; top: 14px; right: 14px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 9px; font-size: 11px; font-weight: 800; line-height: 20px; }
.reqbox { display: grid; gap: 8px; margin-top: 14px; }
.req { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 9px 13px; border-radius: 9px; background: var(--panel2); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.req b { color: var(--text); }
.req.pending { border-color: rgba(255, 198, 90, 0.4); color: var(--warn); }
.req.pending b { color: var(--warn); }
.req.approved { border-color: rgba(53, 214, 176, 0.4); }
.req.rejected { border-color: rgba(255, 111, 125, 0.4); }
.req .link { padding: 0; }
.reqmemo { margin-top: 12px; max-width: 520px; }

/* ───────── 회원 관리 (운영자) ───────── */
.req-item { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(200px, 1.4fr) minmax(160px, 1fr) auto; gap: 10px 14px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.req-item:first-child { border-top: 0; padding-top: 0; }
.req-item .who { display: grid; gap: 1px; min-width: 0; }
.req-item .who span, .subtext { color: var(--muted); font-size: 12px; font-weight: 400; }
.req-item .what { display: flex; gap: 6px 10px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.req-item .memo { color: var(--text); }
.req-item .note-in { min-height: 34px; padding: 6px 10px; font-size: 12.5px; }
.req-item .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.req-item .acts .btn { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.tbl-wrap { overflow-x: auto; margin-top: 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr[data-id] { cursor: pointer; }
.tbl tbody tr[data-id]:hover, .tbl tbody tr[data-id]:focus-visible { background: var(--panel2); outline: 0; }
.tbl.mini { font-size: 12px; }
.tbl.mini td, .tbl.mini th { padding: 6px 8px; }
.tbl .st-active { color: var(--accent); }
.tbl .st-trial { color: var(--blue); }
.tbl .st-expired, .tbl .st-none { color: var(--danger); }
.dot { display: inline-block; background: var(--warn); color: #231a04; border-radius: 999px; padding: 0 7px; font-size: 10.5px; font-weight: 800; line-height: 17px; vertical-align: middle; }
.uform { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: var(--panel2); display: grid; gap: 10px; }
.dlg-body h4 { font-size: 13px; margin-top: 8px; }
.uform h4 { margin-top: 0; }
.dlg-body h3 .subtext { margin-left: 8px; }

/* ───────── 환경 설정 ───────── */
.set-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.set-tab { border: 1px solid var(--line2); background: var(--panel); color: var(--text); border-radius: 10px; padding: 8px 14px; font-weight: 700; }
.set-tab.on { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); border-color: var(--accent); }
.set-tab:disabled { opacity: 0.55; cursor: default; }
.set-lead { margin: 0 0 16px; line-height: 1.6; color: var(--muted); font-size: 13px; }
.set-block { border: 1px solid var(--line2); border-radius: 12px; padding: 16px; background: var(--elev); margin-top: 14px; }
.set-block-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.set-block-h b { font-size: 14px; }
.pill { font-size: 11px; font-weight: 800; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 7px; }
.set-actions { margin: 10px 0; }
.ai-keys { display: grid; gap: 8px; }
.ai-key { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.ai-key .n { color: var(--muted); font-weight: 700; }
.ai-key code { font-size: 13px; }
.ai-key small { display: block; color: var(--muted); font-size: 11.5px; }
.ai-key .acts { display: flex; gap: 6px; align-items: center; }
.ai-key .acts .btn {
  margin-top: 0;
  min-width: 64px;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
  box-sizing: border-box;
}
.ai-add { display: flex; gap: 8px; margin-top: 10px; }
.ai-add input { flex: 1; min-width: 0; }
.set-models { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.set-models small { color: var(--muted); font-size: 11.5px; }

/* ───────── 분야별 인기 검색 ───────── */
.trend-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: start; }
.trend-filters { display: grid; gap: 12px; }
.trend-filters .field { min-width: 0; }
.trend-board { border: 1px solid var(--line2); border-radius: 12px; background: var(--elev); padding: 16px 18px 12px; min-height: 280px; }
.trend-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 8px; flex-wrap: wrap; }
.trend-head b { font-size: 15px; }
.trend-head span { color: var(--muted); font-size: 12.5px; }
.trend-list { list-style: none; margin: 0; padding: 0; }
.trend-list li { display: flex; gap: 12px; align-items: baseline; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.trend-list .rk { width: 28px; flex: none; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.trend-list .trend-empty { color: var(--muted); border-bottom: 0; }
.trend-board .hint { margin-top: 12px; }

/* ───────── 반응형 ───────── */
@media (max-width: 1280px) {
  .bench { grid-template-columns: 300px minmax(0, 1fr); }
  .side-col { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .side-col .card { margin-bottom: 0; }
  .opt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 2열 이하: 자막·음성 카드도 일반 높이로 (행 공유 트릭 해제) */
  .opt-grid > .opt:nth-child(1),
  .opt-grid > .opt:nth-child(2) { height: auto; min-height: 0; }
  #optSubtitle,
  #optVoice { max-height: 400px; }
  .persona-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; }
  .brand { padding: 0 4px 10px; }
  /* 모바일: 준비중 메뉴는 숨기고 사용 가능한 메뉴만 한 줄로 */
  .nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .nav-group, .nav-group:first-child { display: contents; padding: 0; border: 0; }
  .nav-title, .nav-parent, .nav-item:disabled { display: none; }
  .nav-item, .nav-item.sub { width: auto; padding: 8px 14px; border: 1px solid var(--line); }
  .main { padding: 16px 14px 48px; min-width: 0; }
  .bench { grid-template-columns: minmax(0, 1fr); }
  .preview-card { position: static; }
  .side-col { grid-template-columns: minmax(0, 1fr); }
  .opt-grid { grid-template-columns: minmax(0, 1fr); }
  .ref-panel { grid-template-columns: minmax(0, 1fr); }
  .trend-layout { grid-template-columns: minmax(0, 1fr); }
  .set-models { grid-template-columns: minmax(0, 1fr); }
  .ai-add { flex-direction: column; }
  .mprod { grid-template-columns: minmax(0, 1fr); }
  .mprod .img { max-width: 220px; }
  .pl-row { grid-template-columns: minmax(0, 1fr); }
  .req-item { grid-template-columns: minmax(0, 1fr); }
  .qstrip .link { margin-left: 0; }
  .card-head .hint { margin-left: 0; width: 100%; }
  .field, .field.grow { min-width: 0; flex: 1 1 140px; }
  /* 모바일: 인물 타일을 세로로 쌓은 2열로, 내 사진 칸은 가로 전체 */
  .persona-group { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pg-title { padding-top: 0; }
  .persona-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ptile { flex-direction: column; text-align: center; padding: 10px 6px; gap: 6px; }
  .ptile .pt { align-items: center; }
  .self-drop { width: 100%; max-width: 220px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

html[data-theme='light'] dialog::backdrop { background: rgba(26, 34, 51, 0.45); }
html[data-theme='light'] .chip { background: var(--panel); }
html[data-theme='light'] .btn.primary:hover:not(:disabled):not([aria-disabled='true']),
html[data-theme='light'] .play.on:hover {
  background: var(--btn-hover); border-color: var(--btn-hover-line); color: #1a2233; filter: none;
}
html[data-theme='light'] .import { border-color: rgba(13, 159, 130, 0.35); background: rgba(13, 159, 130, 0.06); }
html[data-theme='light'] .pick:hover { border-color: var(--btn-hover-line); }
html[data-theme='light'] .howto-video,
html[data-theme='light'] .howto-video video { background: #111; border-color: var(--line2); }
html[data-theme='light'] .gallery-drop {
  background: var(--input); color: var(--muted);
}
