@import url("/pub/theme.css");
:root { font-family: var(--font-ui); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* 상단 */
.topbar { height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.logo { background: var(--accent); color: var(--accent-ink); border-radius: 4px; padding: 2px 6px; font-size: 13.5px; }
.badge { background: var(--warn); color: #221800; border-radius: 10px; font-size: 12.5px; padding: 2px 8px; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 12px; }
.queue { color: var(--muted); font-size: 14.5px; }
.queue b { color: var(--accent); }
.user { white-space: nowrap; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14.5px; }
.user input { width: 110px; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }

.ghost { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.ghost:hover { border-color: #444a53; }
.ghost.small { padding: 3px 8px; font-size: 13.5px; }
.icon { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); font-size: 18px; line-height: 1; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 10px 18px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.primary:disabled { opacity: .5; cursor: default; }
kbd { font-size: 12px; background: rgba(0,0,0,.15); border-radius: 4px; padding: 1px 4px; font-family: inherit; }

/* 레이아웃 */
.layout { display: grid; grid-template-columns: 270px 1fr; height: calc(100% - 52px); }
.sidebar { border-right: 1px solid var(--line); background: var(--panel); overflow: auto; padding: 14px; }
.side-head { display: flex; gap: 8px; }
.side-head select { flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; }
.project-meta { margin: 10px 2px 14px; color: var(--muted); font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.project-meta { flex-direction: column; align-items: stretch; }
.pm-row { display: flex; justify-content: space-between; gap: 8px; }
.project-meta a { color: var(--accent); text-decoration: none; }
.pm-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pm-links a { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; text-align: center; color: var(--text); font-size: 13.5px; }
.pm-links a:hover { border-color: var(--accent); }
.chip.rv-ok { color: var(--ok); border-color: #5fd38d55; }
.chip.rv-change { color: var(--danger); border-color: #ff6b6b55; }
.side-sub { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13.5px; margin-bottom: 6px; }
.shot-list { list-style: none; margin: 0; padding: 0; }
.shot-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.shot-list li:hover { background: var(--panel2); }
.shot-list li.on { background: #23272e; box-shadow: inset 2px 0 0 var(--accent); }
.shot-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot-list .ct { color: var(--muted); font-size: 13.5px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.star { color: var(--accent); }
.spin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

main { overflow: auto; padding: 20px 24px 60px; }
.empty { text-align: center; color: var(--muted); margin-top: 18vh; }
.empty h2 { color: var(--text); font-weight: 600; }

.shot-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
#shotTitle { margin: 0; font-size: 22px; outline: none; }
.shot-desc { color: var(--muted); margin-top: 4px; outline: none; min-width: 300px; }
.shot-desc:empty::before { content: attr(data-placeholder); color: #555b64; }
.shot-stats { color: var(--muted); font-size: 14.5px; text-align: right; white-space: nowrap; }

/* 생성 폼 */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.gen { padding: 14px; margin-bottom: 22px; }
.model-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.model-row button { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; font-size: 14.5px; }
.model-row button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.model-row .sep { width: 1px; background: var(--line); margin: 2px 4px; }
.gen-body { display: grid; grid-template-columns: 1fr 300px; gap: 14px; }
.gen-main textarea { width: 100%; min-height: 128px; resize: vertical; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; line-height: 1.5; }
.gen-main textarea:focus, .field input:focus, .field select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > span { color: var(--muted); font-size: 13.5px; }
.field input, .field select { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle { display: flex; align-items: center; justify-content: space-between; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; margin-bottom: 10px; cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.drop { border: 1px dashed #3a3f47; border-radius: 6px; min-height: 84px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; padding: 8px; color: var(--muted); font-size: 13.5px; cursor: pointer; position: relative; background: var(--panel2); }
.drop.over { border-color: var(--accent); color: var(--accent); }
.drop img { height: 64px; border-radius: 4px; }
.thumb { position: relative; }
.thumb button { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: #000c; font-size: 12.5px; line-height: 18px; padding: 0; }
.gen-foot { flex-wrap: wrap; display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.takes { color: var(--muted); font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.takes select { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
.estimate { color: var(--muted); font-size: 14.5px; }
.estimate b { color: var(--text); }
.res-note { margin-top: 10px; font-size: 13.5px; color: var(--warn); }

/* 갤러리 */
.gallery-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tabs, .size-toggle { display: flex; gap: 4px; }
.tabs button, .size-toggle button { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 5px 10px; color: var(--muted); }
.tabs button.on, .size-toggle button.on { border-color: var(--line); color: var(--text); background: var(--panel); }
.gallery { display: grid; gap: 14px; }
.gallery.s { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.gallery.m { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.gallery.l { grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); }
.take { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.take.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.media { position: relative; background: #000; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; }
.media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.media .state { color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 14.5px; text-align: center; padding: 10px; }
.media .state.err { color: var(--danger); }
.media .tno { position: absolute; top: 8px; left: 8px; background: #000b; border-radius: 4px; padding: 2px 7px; font-size: 13.5px; font-weight: 700; }
.media .selbtn { position: absolute; top: 6px; right: 6px; background: #000b; border: 0; border-radius: 6px; width: 34px; height: 30px; font-size: 17px; color: #aaa; }
.media .selbtn.on { color: var(--accent-ink); background: var(--accent); }
.take-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 12.5px; background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--muted); }
.chip.st-completed { color: var(--ok); }
.chip.st-failed, .chip.st-nsfw { color: var(--danger); }
.chip.st-queued, .chip.st-in_progress, .chip.st-waiting, .chip.st-downloading { color: var(--accent); }
.prompt { color: #c4c8ce; font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.prompt.open { -webkit-line-clamp: unset; }
.refs { display: flex; gap: 4px; }
.refs img { height: 34px; border-radius: 4px; }
.note { background: transparent; border: 0; border-bottom: 1px dashed var(--line); color: var(--text); font-size: 13.5px; padding: 3px 0; width: 100%; }
.note:focus { outline: none; border-bottom-color: var(--accent); }
.take-foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13.5px; }
.acts { display: flex; gap: 2px; }
.acts button, .acts a { background: transparent; border: 0; color: var(--muted); padding: 4px 6px; border-radius: 4px; font-size: 13.5px; text-decoration: none; }
.acts button:hover, .acts a:hover { color: var(--text); background: var(--panel2); }
.dl-err { color: var(--warn); font-size: 12.5px; }

/* 다이얼로그 */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 0; width: min(760px, 94vw); }
dialog::backdrop { background: #000a; }
.dlg { padding: 18px; }
.dlg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.dlg-head h3 { margin: 0; flex: 1; }
.dlg-head input { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; color-scheme: dark; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--panel2); border-radius: 6px; padding: 12px; }
.kpi span { color: var(--muted); font-size: 13.5px; }
.kpi b { display: block; font-size: 22px; margin-top: 4px; }
.utbl { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 14.5px; }
.utbl th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding: 6px; }
.utbl td { padding: 6px; border-bottom: 1px solid #202329; }
.utbl td.n, .utbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 13.5px; margin: 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #2a2e35; border: 1px solid #3a3f47; padding: 10px 16px; border-radius: 6px; z-index: 20; max-width: 80vw; }
.toast.err { border-color: var(--danger); color: #ffd1d1; }

.pm-team { font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pm-team span { background: var(--panel2); border-radius: 10px; padding: 1px 8px; color: var(--text); }
.pm-team span.me { background: var(--accent); color: var(--accent-ink); }
.pm-dates { display: flex; align-items: center; gap: 4px; font-size: 13.5px; }
.pm-dates input { flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 3px 4px; font-size: 12.5px; color-scheme: dark; }

/* 모델 묶음 (영상 / 이미지 / Higgsfield) */
.model-row { flex-direction: column; gap: 8px; }
.model-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.model-group .mg-name { width: 72px; color: var(--muted); font-size: 13.5px; }
.model-group.hf button { font-size: 13.5px; padding: 4px 10px; opacity: .8; }
.model-row button .mk { font-style: normal; font-size: 12px; margin-left: 5px; padding: 0 4px; border-radius: 4px; background: #f5b94233; color: var(--warn); }
.model-row button.on .mk { background: #0002; color: var(--accent-ink); }

/* 이미지 테이크 */
.media > a { display: block; width: 100%; height: 100%; }
.media img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* 이미지 넣는 칸: 작은 타일 */
.layout > * { min-width: 0; }
.img-fields { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.img-fields .field { width: 180px; margin: 0; }
.img-fields .field.multi { width: auto; flex: 1; min-width: 260px; }
.img-fields .drop { min-height: 104px; justify-content: flex-start; padding: 8px; }
.img-fields .field:not(.multi) .drop { justify-content: center; }
.img-fields .drop img { height: 86px; max-width: 150px; object-fit: cover; }
.drop .add { font-size: 12.5px; line-height: 1.5; text-align: center; min-width: 80px; }

/* 이미지 끌기 */
.hf-drag { cursor: grab; }
.refs img.hf-drag:hover { outline: 2px solid var(--accent); }
body.dragging-img .drop { border-color: var(--accent); background: #6f7bdc12; }

/* 이미지함 */
.tray-head { margin-top: 18px; }
.tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; min-height: 70px; border: 1px dashed #3a3f47; border-radius: 6px; padding: 6px; background: var(--panel2); }
.tray.over { border-color: var(--accent); background: #6f7bdc12; }
.tray:focus { outline: 1px solid var(--accent); }
.tray-it { position: relative; }
.tray-it img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; display: block; }
.tray-it button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: #000c; font-size: 12px; line-height: 18px; padding: 0; display: none; }
.tray-it:hover button { display: block; }
.tray-empty { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; text-align: center; align-self: center; line-height: 1.6; }
body.dragging-img .tray { border-color: var(--accent); }

/* 테이크 메뉴 */
.media .menubtn { position: absolute; top: 6px; right: 6px; background: #000b; border: 0; border-radius: 6px; width: 30px; height: 30px; font-size: 16px; color: #ddd; line-height: 1; }
.media .menubtn:hover { background: #000; color: #fff; }
.media .selbtn { right: 42px; }
.ctx { position: fixed; z-index: 50; background: #1e2126; border: 1px solid #3a3f47; border-radius: 6px; padding: 5px; min-width: 220px; box-shadow: 0 10px 30px #0008; display: flex; flex-direction: column; }
.ctx-title { font-size: 12.5px; color: var(--muted); padding: 3px 10px 5px; }
.ctx button { background: none; border: 0; text-align: left; padding: 7px 10px; border-radius: 4px; font-size: 14.5px; }
.ctx button:hover { background: #2c3139; }
.ctx button.danger { color: var(--danger); }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; width: auto; }

/* 아래에 떠 있는 생성 입력줄 (힉스필드 방식) */
#shotView { min-height: 100%; display: flex; flex-direction: column; }
#gallery { flex: 1; padding-bottom: 20px; }
.composer { position: sticky; bottom: 14px; z-index: 6; margin: 18px auto 0; width: min(1080px, 100%); background: #17191df2; backdrop-filter: blur(10px); border: 1px solid #30343b; border-radius: 10px; padding: 12px 14px 10px; box-shadow: 0 14px 40px #000b; display: flex; flex-direction: column; gap: 8px; }
.cmp-main { display: flex; flex-direction: column; gap: 8px; }
.cmp-main textarea { width: 100%; resize: none; background: transparent; border: 0; padding: 4px 2px; line-height: 1.55; font-size: 15px; min-height: 44px; max-height: 220px; }
.cmp-main textarea:focus { outline: none; }
.slots { display: flex; gap: 8px; flex-wrap: wrap; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.slot > span { font-size: 12px; color: var(--muted); }
.slot .drop { width: 60px; height: 60px; min-height: 0; padding: 0; border-radius: 6px; overflow: hidden; justify-content: center; gap: 4px; }
.slot.multi .drop { width: auto; min-width: 60px; max-width: 520px; padding: 0 4px; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; }
.slot .drop img { height: 52px; width: 52px; object-fit: cover; border-radius: 4px; max-width: none; }
.slot .drop .thumb button { top: 1px; right: 1px; }
.slot .drop .add { font-size: 20px; min-width: 52px; color: var(--muted); }
.cmp-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.opts { display: contents; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px; border-radius: 6px; background: #23262c; border: 1px solid #30343b; font-size: 14.5px; white-space: nowrap; }
.pill:hover { border-color: #454b55; }
.pill select { background: transparent; border: 0; padding: 0; font-size: 14.5px; cursor: pointer; }
.pill select:focus { outline: none; }
.pill select option { background: #23262c; }
.pill.num input { width: 38px; background: transparent; border: 0; font-size: 14.5px; text-align: right; }
.pill.num input:focus { outline: none; }
.pill.num span, .pill.tog span { color: var(--muted); }
.pill.tog { cursor: pointer; } .pill.tog input { accent-color: var(--accent); margin: 0; }
.pill.model { font-weight: 600; } .pill.model .kind { font-size: 12px; color: var(--accent); border: 1px solid #6f7bdc55; border-radius: 5px; padding: 0 4px; font-weight: 500; }
.pill .caret { color: var(--muted); font-size: 12px; }
.pill.count { padding: 0 4px; gap: 0; } .pill.count button { background: none; border: 0; width: 26px; height: 28px; font-size: 16px; color: var(--muted); } .pill.count span { min-width: 30px; text-align: center; }
.gen-btn { height: 44px; padding: 0 22px; border-radius: 8px; font-size: 16px; flex-direction: column; justify-content: center; gap: 0; line-height: 1.15; }
.gen-btn .estimate { font-size: 12.5px; color: #ffffffb3; font-weight: 500; font-family: var(--font-num); }
.composer .res-note { margin: 0; }
/* 이 씬 콘티: 고른 씬의 스토리보드 이미지 (생성 창 위에 늘 보임). 생성 창이 길어지지 않게 작은 썸네일 한 줄로 두고, 마우스를 올리면 옆에 크게 뜸(.sb-big) */
.shot-sb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.shot-sb[hidden] { display: none; }
.shot-sb .lbl { font-size: 12.5px; color: var(--muted); white-space: nowrap; margin-right: 2px; }
.shot-sb img { height: 68px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 5px; cursor: pointer; display: block; }
.shot-sb img:hover { outline: 2px solid var(--accent); }
.sb-big { position: fixed; z-index: 50; max-width: min(640px, 46vw); max-height: 70vh; border-radius: 8px; box-shadow: 0 12px 40px #000c; pointer-events: none; }
.pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); background: #1b1e23; border: 1px solid #30343b; border-radius: 8px; padding: 12px; box-shadow: 0 14px 40px #000b; max-height: 55vh; overflow: auto; }
.pop-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.composer .model-row { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.composer .model-row[hidden] { display: none; }
.tray-pop .tray { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); min-height: 90px; }
.gallery-head { position: sticky; top: -20px; z-index: 4; background: var(--bg); padding: 8px 0; margin-top: -8px; }

/* ===== 결과 타일 (힉스필드식: 영상·이미지만 크게, 정보는 마우스를 올리면) ===== */
.gallery { gap: 8px; }
.gallery.s { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.gallery.m { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.gallery.l { grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); }
.gallery .day { grid-column: 1 / -1; font-weight: 700; font-size: 16px; padding: 14px 2px 4px; }
.gallery .day:first-child { padding-top: 2px; }
.empty-list { color: var(--muted); grid-column: 1 / -1; }
.take { border: 0; border-radius: 8px; background: #000; position: relative; }
.take.sel { box-shadow: 0 0 0 2px var(--accent); border: 0; }
.take .media { aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #0c0d0f; }
.take.img .media img { object-fit: cover; }
.take .media .state { gap: 6px; }
.take .media .state small { font-size: 12.5px; color: var(--muted); max-width: 90%; }
.take .media .state.err small { color: #ff9b9b; }
.ov-top, .ov-bot { position: absolute; left: 0; right: 0; display: flex; padding: 8px; pointer-events: none; transition: opacity .15s; }
.ov-top { top: 0; align-items: center; gap: 5px; }
.ov-top > * { pointer-events: auto; }
.ov-top .tno { position: static; }
.ov-top .selbtn, .ov-top .menubtn { position: static; }
.ov-bot { bottom: 0; flex-direction: column; gap: 4px; padding: 30px 10px 9px; background: linear-gradient(transparent, #000d 45%); opacity: 0; cursor: zoom-in; }
.ov-bot > * { pointer-events: auto; }
.ov-bot .p { font-size: 14px; line-height: 1.45; color: #eee; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ov-bot .m { font-size: 12.5px; color: #bbb; }
.ov-bot .refs img { height: 34px; border-radius: 5px; }
.take .ov-top .tno, .take .ov-top .chip { background: #000b; border: 0; color: #eee; }
.take .ov-top .menubtn, .take .ov-top .selbtn:not(.on), .take .ov-top .chip:not(.rv-ok):not(.rv-change) { opacity: 0; transition: opacity .15s; }
.take:hover .ov-bot, .take:hover .ov-top > * { opacity: 1; }
.take .play-hint { opacity: .8; }
.take:hover .play-hint { opacity: 0; }

/* ===== 생성 창 배치 ===== */
.work { flex: 1; display: flex; flex-direction: column; }
.results { order: 1; flex: 1; display: flex; flex-direction: column; }
.mode-image .composer { order: 2; }
/* 영상 모델: 왼쪽 세로 패널 */
.mode-video .work { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.mode-video .composer { order: 0; position: sticky; top: 0; bottom: auto; margin: 0; width: auto; max-height: calc(100vh - 110px); overflow: visible; padding: 12px; gap: 10px; box-shadow: none; background: var(--panel); }
.mode-video .results { order: 1; }
.mode-video .slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-video .slots.n1 { grid-template-columns: 1fr; }
.mode-video .slot { align-items: stretch; }
.mode-video .slot .drop { width: 100%; height: auto; aspect-ratio: 4 / 3; }
.mode-video .slot .drop img { width: 100%; height: 100%; border-radius: 6px; }
.mode-video .slot .drop .thumb { width: 100%; height: 100%; }
.mode-video .slot.multi { grid-column: 1 / -1; }
.mode-video .slot.multi .drop { aspect-ratio: auto; min-height: 90px; max-width: none; flex-wrap: wrap; padding: 6px; }
.mode-video .slot.multi .drop img { width: 72px; height: 72px; }
.mode-video .slot.multi .drop .thumb { width: auto; height: auto; }
.mode-video .slot > span { font-size: 12.5px; text-align: center; }
.mode-video .cmp-main textarea { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 10px; min-height: 100px; max-height: 40vh; resize: vertical; }
.mode-video .cmp-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mode-video .cmp-bar .pill { width: 100%; height: 38px; justify-content: space-between; }
.mode-video #modelBtn, .mode-video #trayBtn, .mode-video .gen-btn { grid-column: 1 / -1; }
.mode-video .cmp-bar .grow { display: none; }
.mode-video .gen-btn { height: 50px; width: 100%; flex-direction: row; gap: 10px; }
.mode-video .gen-btn .estimate { font-size: 14.5px; }
.mode-video .pop { left: calc(100% + 10px); right: auto; bottom: auto; top: 0; width: min(760px, 60vw); }
.mode-video .pill.sel select, .mode-video .pill.num input { flex: 1; }
@media (max-width: 1100px) { .mode-video .work { grid-template-columns: 1fr; } .mode-video .composer { position: static; max-height: none; } .mode-video .pop { left: 0; right: 0; width: auto; top: auto; bottom: calc(100% + 8px); } }

.pill .k { color: var(--muted); font-size: 13.5px; }
.mode-image .pill .k { display: none; }
.mode-video .cmp-bar .pill { justify-content: flex-start; }
.mode-video .pill.sel select { text-align: right; }
.mode-video .pill.num input { text-align: right; }
.mode-video #modelBtn { justify-content: flex-start; }
.mode-video #modelBtn .caret { margin-left: auto; }

.tray-pop.picking { border-color: var(--accent); }
.tray-pop.picking .tray-it img { cursor: pointer; }
.tray-pop.picking .tray-it img:hover { outline: 2px solid var(--accent); }
.tray-pop.picking #trayTarget { color: var(--accent); }
.tray-empty b { color: var(--text); }

/* 모델 고르기 (힉스필드식 목록) */
.composer .pop.mp { width: 470px; right: auto; padding: 0; display: flex; flex-direction: column; gap: 0; max-height: 64vh; overflow: hidden; }
.composer .pop.mp[hidden] { display: none; }
.mode-video .composer .pop.mp { width: 470px; }
.mp-search { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.mp-search input { flex: 1; background: transparent; border: 0; font-size: 16px; }
.mp-search input:focus { outline: none; }
.mp-list { overflow: auto; padding: 6px; }
.mp-group { font-size: 13.5px; color: var(--muted); padding: 10px 10px 4px; }
.mp-item { width: 100%; display: flex; align-items: center; gap: 12px; background: none; border: 0; border-radius: 6px; padding: 8px 10px; text-align: left; }
.mp-item:hover { background: #262a31; }
.mp-item.on { background: #2a3318; }
.mp-item:disabled { opacity: .45; cursor: not-allowed; }
.mp-item:disabled:hover { background: none; }
.mp-item .mk.off { background: #ffffff14; color: var(--muted); }
.mp-ico { width: 38px; height: 38px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; background: #2a2e35; color: #cfd3d9; flex: none; }
.mp-ico.sm { width: 20px; height: 20px; border-radius: 4px; font-size: 12.5px; }
.mp-ico.p-byteplus { color: #7ab8ff; } .mp-ico.p-kling { color: #6ee7b7; } .mp-ico.p-google { color: #fbbf24; } .mp-ico.p-openai { color: #e5e7eb; } .mp-ico.p-higgsfield { color: #a3a3a3; }
.mp-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mp-txt b { font-size: 15px; font-weight: 600; }
.mp-txt small { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-price { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.mp-check { color: var(--accent); font-weight: 700; }
.mp-item .mk { font-style: normal; font-size: 12px; margin-left: 6px; padding: 0 4px; border-radius: 4px; background: #f5b94233; color: var(--warn); }

/* 로그인 계정 */
.me { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.me img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }

/* 크게 보기 (힉스필드식 오른쪽 정보 패널) */
dialog.viewer { width: min(1600px, 97vw); max-height: 94vh; }
dialog.viewer .vw { grid-template-columns: 1fr 380px; max-height: 94vh; }
.vw-media { min-height: 520px; }
.vw-media video, .vw-media img { width: 100%; max-height: 94vh; object-fit: contain; }
.vw-count { position: absolute; top: 12px; left: 14px; background: #000a; border-radius: 6px; padding: 3px 9px; font-size: 13.5px; }
.vw-side { gap: 12px; padding: 14px; }
.vw-head { gap: 10px; }
.vw-head div { display: flex; flex-direction: column; } .vw-head small { color: var(--muted); font-size: 12.5px; }
.vw-av { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.vw-sec { display: flex; flex-direction: column; gap: 6px; }
.vw-sec-h { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); letter-spacing: .04em; }
.vw-box { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.vw-refs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.vw-ref { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.vw-ref img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.vw-ref:hover img { outline: 2px solid var(--accent); }
.vw-ref i { font-style: normal; font-size: 12px; color: var(--accent); }
.vw-box .vw-prompt { background: none; padding: 0; font-size: 14.5px; line-height: 1.6; max-height: 26vh; overflow: auto; }
.vw-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.vw-tbl td { padding: 3px 0; } .vw-tbl td:first-child { color: var(--muted); } .vw-tbl td:last-child { text-align: right; }
.vw-side .note { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.vw-side .vw-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.vw-side .vw-acts > .primary { grid-column: 1 / -1; }
.vw-side .vw-acts-row > * { grid-column: auto; min-width: 0; }
.vw-side .vw-acts > * { height: 42px; border-radius: 6px; justify-content: center; display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.vw-side .vw-acts .ghost { background: var(--panel2); text-decoration: none; color: var(--text); }
.vw-media video:focus { outline: none; }
.vw-side .vw-acts-row { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 46px; gap: 8px; }
.vw-acts-row > * { height: 42px; border-radius: 6px; }
@media (max-width: 900px) { dialog.viewer .vw { grid-template-columns: 1fr; } dialog.viewer { height: auto; } }

/* 크게 보기 (이전) */
.media .open { cursor: zoom-in; }
.media .play-hint { position: absolute; bottom: 8px; right: 10px; background: #000a; border-radius: 10px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; pointer-events: none; }
.take-foot { flex-wrap: wrap; gap: 4px; }
.acts { flex-wrap: wrap; }
.acts button, .acts a { white-space: nowrap; }
dialog.viewer { width: min(1500px, 96vw); max-height: 94vh; padding: 0; background: #0b0c0e; }
.vw { display: grid; grid-template-columns: 1fr 340px; max-height: 94vh; }
.vw-media { position: relative; background: #000; display: flex; align-items: center; justify-content: center; min-height: 50vh; }
.vw-media video, .vw-media img { max-width: 100%; max-height: 94vh; display: block; }
.vw-nav { position: absolute; top: 50%; transform: translateY(-50%); background: #000a; border: 1px solid #fff2; color: #fff; width: 40px; height: 64px; border-radius: 6px; font-size: 28px; }
.vw-nav.prev { left: 10px; } .vw-nav.next { right: 10px; }
.vw-side { padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow: auto; border-left: 1px solid var(--line); background: var(--panel); }
.vw-head { display: flex; align-items: center; gap: 8px; }
.vw-prompt { font-size: 14.5px; line-height: 1.55; background: var(--panel2); border-radius: 6px; padding: 8px 10px; white-space: pre-wrap; }
.vw-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.vw-acts a { text-decoration: none; color: var(--text); }
@media (max-width: 900px) { .vw { grid-template-columns: 1fr; } }

/* AI 대화창 */
.layout.with-chat { grid-template-columns: 270px 1fr 400px; }
.ghost.on { border-color: var(--accent); color: var(--accent); }
.icon.small { width: 28px; height: 28px; font-size: 14.5px; }
.primary.small { padding: 6px 12px; font-size: 14.5px; border-radius: 6px; }
.grow { flex: 1; }
.chat { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; height: 100%; }
.chat.over { box-shadow: inset 0 0 0 2px var(--accent); }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-sub { color: var(--muted); font-size: 13.5px; }
.chat-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-empty { color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.chat-empty b { color: var(--text); }
.chat-empty .ex { background: var(--panel2); border-radius: 6px; padding: 6px 10px; margin: 6px 0; font-size: 13.5px; }
.msg { display: flex; flex-direction: column; max-width: 92%; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.ai { align-self: flex-start; }
.msg .who { color: var(--muted); font-size: 12.5px; margin-bottom: 2px; }
.bubble { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; line-height: 1.55; font-size: 14.5px; word-break: break-word; }
.msg.me .bubble { background: #2a3318; border-color: #3d4a1f; }
.bubble code { background: #0006; border-radius: 4px; padding: 0 4px; font-size: 13.5px; }
.bubble.thinking { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.msg.img img { max-width: 180px; max-height: 140px; border-radius: 6px; border: 1px solid var(--line); }
.prop { border: 1px solid #3d4a1f; background: #1a1f14; border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.prop.generated { border-color: var(--line); background: var(--panel2); }
.prop-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.prop-reason { color: var(--muted); font-size: 13.5px; }
.prop-prompt { font-size: 14px; line-height: 1.45; color: #d6dae0; background: #0003; border-radius: 6px; padding: 6px 8px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.prop-prompt.open { -webkit-line-clamp: unset; }
.prop-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prop-cost { font-size: 13.5px; color: var(--text); }
.prop-done { color: var(--ok); font-size: 13.5px; }
.act-done { align-self: flex-start; font-size: 13.5px; color: var(--ok); background: #1a2a1a; border: 1px solid #2c4a2c; border-radius: 10px; padding: 3px 10px; }
.chat-form { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-form textarea { width: 100%; resize: vertical; min-height: 64px; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; line-height: 1.5; }
.chat-form textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.chat-attach { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-attach:empty { display: none; }
.chat-attach img { height: 48px; border-radius: 4px; }
.chat-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
@media (max-width: 1200px) { .layout.with-chat { grid-template-columns: 220px 1fr 340px; } }

@media (max-width: 900px) {
  .layout, .layout.with-chat { grid-template-columns: 1fr; height: auto; }
  .chat { height: 80vh; border-left: 0; border-top: 1px solid var(--line); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .gen-body { grid-template-columns: 1fr; }
  main { padding: 16px; }
  .user input { width: 80px; }
  .queue, .user > span, #usageBtn .lbl { display: none; }
  .layout > * { min-width: 0; }
  .topbar { padding: 0 12px; }
  .badge, .ghost, .user { white-space: nowrap; }
  .topbar { gap: 8px; }
  .shot-head { flex-direction: column; }
  .shot-stats { text-align: left; }
  .gallery.m, .gallery.l { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

/* 생성 버튼: 합친 모델이 어느 쪽(텍스트→영상 / 이미지→영상)으로 갈지 */
.gen-mode { font-size: 12.5px; font-weight: 600; margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: #0002; }

/* 위쪽 화면 이동: 보드 · 생성 · 시퀀스 (보드가 첫 번째 = 메인) */
.mainnav { display: flex; gap: 2px; margin-left: 12px; }
/* 세 화면 모두 위쪽 막대 정가운데 같은 자리 (왼쪽 글자 길이와 상관없이) */
.topbar, .cbar { position: relative; }
.topbar > .mainnav, .cbar > .mainnav { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; z-index: 1; }
@media (max-width: 1100px) { .topbar > .mainnav, .cbar > .mainnav { position: static; transform: none; margin-left: 12px; } }
.mainnav a { display: flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14.5px; white-space: nowrap; }
.mainnav a:hover { color: var(--text); background: #ffffff0a; }
.mainnav a.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }
.mainnav a.disabled { opacity: .4; pointer-events: none; }
.notice { color: var(--danger) !important; border-color: #ff6b6b66 !important; text-decoration: none; }

/* 👤 인물 (BytePlus 가상 인물 자산) */
.chars-head { margin-top: 18px; }
.chars-head small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.char-list { list-style: none; margin: 0; padding: 0; }
.char-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 14.5px; }
.char-list li:hover { background: var(--panel2); }
.char-list li.muted { color: var(--muted); cursor: default; font-size: 13.5px; }
.char-list img, .char-list .ph { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--panel2); display: grid; place-items: center; flex: none; }
.char-list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-list .st, .cd .st { font-size: 12.5px; padding: 1px 6px; border-radius: 4px; }
.st.ok { color: var(--ok); background: #5fd38d1f; } .st.bad { color: var(--danger); background: #ff6b6b1f; } .st.wait { color: var(--warn); background: #f5b9421f; }
.cd input.cd-name, .cd input.cd-note, .cd input.cd-asset { width: 100%; box-sizing: border-box; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; color: inherit; font: inherit; }
.cd-have { display: flex; gap: 10px; flex-wrap: wrap; }
.cd-img { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cd-img img, .cd-img .ph { width: 88px; height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: grid; place-items: center; background: var(--panel2); }
.cd-img button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #000c; color: #fff; cursor: pointer; }
#charPick { min-width: 240px; }
#charPick .cp { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; font-size: 14.5px; }
#charPick .cp small { color: var(--muted); margin-left: auto; }
#charPick .cp.off { opacity: .5; cursor: default; }

/* 이미지 올리는 중: 흐린 미리보기 + 가운데 로딩 */
.thumb.loading, .tray-it.loading, .rp .thumbs .loading { position: relative; pointer-events: none; }
.thumb.loading img, .tray-it.loading img, .rp .thumbs .loading img { opacity: .4; filter: blur(1px); }
.up-spin { position: absolute; inset: 0; display: grid; place-items: center; }
.up-spin .spin { width: 22px; height: 22px; border-width: 3px; }

/* 레퍼런스(@) / 시작·끝 프레임 방식 */
.mode-tog { display: flex; gap: 4px; background: #0000004d; border: 1px solid var(--line); border-radius: 6px; padding: 3px; margin-bottom: 8px; }
.mode-tog button { flex: 1; height: 30px; border: 0; border-radius: 4px; background: none; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; }
.mode-tog button.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.mode-tog button b { color: var(--accent); }
.ref-no { position: absolute; left: 4px; top: 4px; z-index: 1; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font: 700 12.5px/18px system-ui; text-align: center; font-style: normal; }
.ref-map { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.ref-map .rm { display: inline-flex; align-items: center; gap: 5px; background: var(--panel2); border-radius: 10px; padding: 2px 8px 2px 2px; }
.ref-map .rm img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
.ref-map .rm.warn { color: var(--warn); padding-left: 8px; }
.mention-pop { min-width: 220px; max-height: 320px; overflow: auto; }
.mention-pop button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; }
.mention-pop button img { width: 26px; height: 26px; border-radius: 4px; object-fit: cover; }
.mention-pop button.on { background: var(--panel2); }
/* 이미지함: 종류 탭 · 이름 */
.tray-kinds { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.tray-kinds button { height: 26px; padding: 0 9px; border-radius: 10px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: 13.5px; cursor: pointer; }
.tray-kinds button.on { background: var(--panel2); color: var(--text); border-color: #4a505a; }
.tray-kinds small { color: var(--muted); }
.tray-nm { display: block; font-size: 12.5px; color: var(--text); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.tray-nm i { color: var(--muted); font-style: normal; }
.tray-nm:hover { color: var(--accent); }
.tray-edit { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.tray-edit input { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; color: inherit; font: inherit; }
.tray-edit .kinds { display: flex; gap: 4px; flex-wrap: wrap; }
.tray-edit .kinds button { height: 28px; padding: 0 9px; border-radius: 6px; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; }
.tray-edit .kinds button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tray-edit .row { display: flex; justify-content: flex-end; }

/* 🎥 카메라 프리셋 */
.cam-pop { display: grid; grid-template-columns: 1fr 1fr; min-width: 380px; }
.cam-pop .ctx-title { grid-column: 1 / -1; }
.cam-pop button.on { background: var(--accent); color: var(--accent-ink); }
.cam-pop button.danger { grid-column: 1 / -1; }
.pill.cam-pick b { color: var(--accent); font-weight: 600; margin-left: 4px; }

/* 🎬 Kling 멀티샷 */
.shots { margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 6px; background: #0002; }
.shots-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.shots-head .warn { color: var(--danger); }
.shot-row { display: flex; gap: 6px; align-items: flex-start; }
.shot-row .no { flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 12.5px/20px system-ui; text-align: center; margin-top: 6px; }
.shot-row textarea { flex: 1; min-height: 32px; resize: vertical; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; color: inherit; font: inherit; font-size: 14px; }
.shot-row .sec { flex: none; display: flex; align-items: center; gap: 3px; font-size: 13.5px; color: var(--muted); }
.shot-row .sec input { width: 44px; background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 5px; color: inherit; }
.shot-row button { flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; margin-top: 6px; }
.pill.shots-tog.on { background: var(--accent); color: var(--accent-ink); }

/* ✨ 프롬프트 다듬기 (프롬프트 칸 바로 아래 오른쪽) */
.prompt-wrap { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.prompt-wrap textarea { width: 100%; box-sizing: border-box; }
.refine-btn, .refine-undo { height: 24px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 13.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.refine-btn { padding: 0 9px; order: 2; }
.refine-undo { width: 26px; justify-content: center; order: 1; }
.refine-btn:hover { border-color: var(--accent); color: var(--accent); }
.refine-btn:disabled { opacity: .7; }

/* @ 강조: 글상자 뒤 판에 색칠 (글자는 글상자가 그대로 보여 줌) */
.ta-box { position: relative; width: 100%; }
.ta-box textarea { position: relative; z-index: 1; }
.ta-box .hl-back { position: absolute; inset: 0; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; color: transparent; pointer-events: none; }
.hl-back mark { color: transparent; border-radius: 4px; }
.hl-back mark.ok { background: #6f7bdc59; box-shadow: 0 0 0 1px #6f7bdcaa; }
.hl-back mark.bad { background: #ff6b6b40; box-shadow: 0 0 0 1px #ff6b6baa; }
/* 프롬프트에서 부른 레퍼런스 썸네일 */
.drop .thumb.used img { outline: 2px solid var(--accent); outline-offset: -2px; }
.drop .thumb:not(.used) .ref-no { background: #8b919b; }
.ref-map .rm.used { color: var(--text); box-shadow: inset 0 0 0 1px #6f7bdc80; }

/* ---- 이름표·제목 글꼴 ---- */
.brand { font-family: var(--font-mark); font-weight: 400; font-size: 16px; letter-spacing: 0; }
/* 회사 로고(The Ape Squad): 작은 자리에는 얼굴 마크, 로그인 화면에는 전체 로고 (public/pub/brand/) */
.logo { display: inline-block; width: 28px; height: 28px; border-radius: 50%; background: #fff url("/pub/brand/ape-mark.png") center / cover no-repeat; font-size: 0; padding: 0; flex: none; vertical-align: middle; }
.brand-full { display: block; width: min(260px, 70%); height: auto; margin: 0 auto 14px; }
.badge { font-family: var(--font-ui); }
h1 { font-family: var(--font-title); font-weight: 300; letter-spacing: -.01em; }
#shotTitle { font-size: 26px; }
.ghost { font-weight: 500; font-size: 14.5px; }
.primary { font-weight: 600; }
.tno, .cost, .queue b { font-variant-numeric: tabular-nums; }
.brand-full ~ .brand .logo { display: none; } /* 로그인 화면은 전체 로고가 있으니 작은 마크는 뺌 */

/* 왼쪽 위 로고·이름을 누르면 생성 화면으로 */
.brand a.home { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; cursor: pointer; }
a.logo { text-decoration: none; cursor: pointer; }
.brand a.home:hover, a.logo:hover { opacity: .8; }

/* 레퍼런스 칸이 비어 있으면 ＋를 가운데에 (이미지가 들어가면 왼쪽부터 채움) */
.slot.multi .drop:not(:has(.thumb)) { justify-content: center; }
/* 톤앤매너 칸: 레퍼런스 칸 오른쪽에 작은 칸 하나 */
.mode-video .slots.has-tone { grid-template-columns: 1fr 96px; }
.mode-video .slots.has-tone .slot.multi { grid-column: auto; }
.mode-video .slot.tone .drop { aspect-ratio: auto; height: 100%; min-height: 90px; }

/* 왼쪽 프로젝트 칸: 대표 이미지 · 팀장 · 팀원 고르기 */
.pm-cover { position: relative; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--panel2); border: 1px solid var(--line); }
.pm-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-cover .blank { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 13.5px; color: var(--muted); }
.pm-cover .acts { position: absolute; inset: auto 0 0 0; display: flex; gap: 4px; padding: 6px; background: linear-gradient(transparent, #000a); opacity: 0; transition: opacity .12s; }
.pm-cover:hover .acts, .pm-cover:not(:has(img)) .acts { opacity: 1; }
.pm-cover .acts button { flex: 1; border: 0; border-radius: 4px; padding: 4px 6px; font-size: 13px; background: #ffffffe6; color: #111; cursor: pointer; }
.pm-team b { font-weight: 600; color: var(--muted); margin-right: 2px; }
.pm-team i { font-style: normal; color: var(--muted); }
.pm-team span { display: inline-flex; align-items: center; gap: 2px; }
.pm-team span.lead { border: 1px solid var(--accent); }
.pm-team span button { border: 0; background: none; color: inherit; opacity: .55; cursor: pointer; padding: 0 0 0 2px; font-size: 14.5px; line-height: 1; }
.pm-team span button:hover { opacity: 1; }
.pm-team .pm-add { flex: 1; min-width: 90px; background: transparent; border: 0; border-bottom: 1px dashed var(--line); color: var(--text); font-size: 13.5px; padding: 2px 2px; outline: none; }
.pm-team .pm-add:focus { border-bottom-color: var(--accent); }
.pp-pop { position: fixed; z-index: 9600; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px #0008; padding: 4px; max-height: 320px; overflow: auto; }
.pp-pop button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; color: var(--text); padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.pp-pop button.on, .pp-pop button:hover { background: var(--panel2); }
.pp-pop img, .pp-pop i { width: 26px; height: 26px; border-radius: 50%; flex: none; object-fit: cover; }
.pp-pop i { display: flex; align-items: center; justify-content: center; background: var(--panel2); border: 1px solid var(--line); font-style: normal; font-size: 13.5px; font-weight: 700; }
.pp-pop b { font-size: 14.5px; font-weight: 600; } .pp-pop em { font-style: normal; font-size: 12.5px; color: var(--accent); }
.pp-pop small { display: block; font-size: 13px; color: var(--muted); }
.pm-danger { justify-content: flex-end; }
.pm-danger button { border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 0; }
.pm-danger button:hover { color: var(--danger); text-decoration: underline; }
.del-dlg { background: var(--panel); color: var(--text); border: 1px solid var(--line2, var(--line)); border-radius: 8px; padding: 22px; width: min(420px, 90vw); }
.del-dlg::backdrop { background: #000a; }
.del-dlg h3 { margin: 0 0 10px; font-size: 18px; font-weight: 600; }
.del-dlg p { margin: 0 0 14px; font-size: 14.5px; color: var(--muted); line-height: 1.5; } .del-dlg p b { color: var(--text); }
.del-dlg label { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
.del-dlg input, .del-dlg textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; color: var(--text); font: inherit; font-size: 15px; resize: vertical; }
.del-dlg input:focus, .del-dlg textarea:focus { outline: none; border-color: var(--accent); }
.del-dlg .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.del-dlg .danger { background: var(--danger); color: #fff; border: 0; border-radius: 6px; padding: 7px 16px; font-weight: 600; cursor: pointer; }
.del-dlg .danger:disabled { opacity: .35; cursor: default; }
/* 기간 칸: 글자를 키우면서 날짜가 잘리지 않게 '기간'을 윗줄로 올리고 날짜 두 칸이 한 줄을 다 씀 */
.pm-dates { flex-wrap: wrap; }
.pm-dates > span:first-child { flex-basis: 100%; }
.pm-dates input { padding: 4px 6px; }

/* 날짜 칸 공통 (2026-10-08): 끝자리가 잘리지 않게 — 달력 아이콘은 칸 전체를 덮는 투명 단추로(어디를 눌러도 달력), 칸이 날짜 폭보다 좁아지면 줄을 바꿈 */
input[type=date] { position: relative; min-width: 100px; font-variant-numeric: tabular-nums; }
input[type=date]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.pm-dates input { flex: 1 1 100px; min-width: 100px; padding: 4px 5px; }

/* 위 막대 화면 이동 메뉴(보드·생성·시퀀스·계정현황): 가운데에 띄우지 않고 로고 옆에 둠 (2026-10-08).
   가운데 떠 있으면 오른쪽에 접속자·배지·단추가 늘 때 메뉴 위로 겹쳐서 '계정현황'이 가려짐. 이제 흐름 안에 있어 겹치지 않음 */
.topbar > .mainnav { position: static; transform: none; margin: 0 auto 0 16px; }
.topbar .top-right { flex: none; }

/* 레퍼런스 칸 안의 영상 (@video1…): 이미지와 같은 칸에 같이 들어감. 번호 배지는 V1, V2 */
.slot .drop .thumb.vthumb video, .mode-video .slot.multi .drop .thumb.vthumb video { width: 128px; height: 72px; object-fit: cover; display: block; border-radius: 6px; background: #000; }
.slot .drop .thumb.vthumb.loading { width: 128px; height: 72px; display: inline-flex; align-items: center; justify-content: center; background: var(--panel2); border-radius: 6px; }
.slot .drop .thumb .ref-no.vno { background: #2a8f6a; min-width: 22px; }

/* 레퍼런스 · 톤앤매너 칸 (2026-10-08): 반반으로 나누고 그림은 16:9. 레퍼런스 칸 안은 두 줄 격자라 빈 곳 없이 채워짐 (이미지·영상·＋ 모두 같은 16:9 칸) */
.mode-video .slots.has-tone { grid-template-columns: 1fr 1fr; align-items: start; }
.mode-video .slot.tone .drop { aspect-ratio: 16 / 9; height: auto; min-height: 0; }
.mode-video .slot.multi .drop { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 6px; aspect-ratio: auto; min-height: 0; align-content: start; overflow: visible; }
.mode-video .slots.has-tone .slot.multi .drop { grid-template-columns: repeat(2, 1fr); }
.mode-video .slot.multi .drop:not(:has(.thumb)) { grid-template-columns: 1fr; padding: 0; }
.mode-video .slot.multi .drop > * { aspect-ratio: 16 / 9; width: 100%; height: auto; min-width: 0; }
.mode-video .slot.multi .drop .thumb, .mode-video .slot.multi .drop .thumb.vthumb.loading { width: 100%; height: auto; }
.mode-video .slot.multi .drop img, .mode-video .slot.multi .drop .thumb.vthumb video { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; display: block; }
.mode-video .slot.multi .drop .add { display: flex; align-items: center; justify-content: center; min-width: 0; border-radius: 6px; }
.mode-video .slot.multi .drop:has(.thumb) .add { border: 1px dashed #3a3f47; }

/* 레퍼런스 · 톤앤매너 두 칸을 늘 같은 크기로 (2026-10-08 고침): 앞 규칙이 빈 칸일 때 2열로 남아 레퍼런스 칸이 반 높이로 줄던 것.
   두 칸 모두 최소 16:9 상자(--box-h, 묶음 너비에서 계산)이고 높이는 늘 서로 같음 — 레퍼런스가 여러 줄로 늘면 톤앤매너도 같이 늘어남.
   레퍼런스가 비었으면 ＋ 가 한가운데, 하나면 그 그림이 상자를 다 채우고(＋는 오른쪽 아래 작은 단추), 둘 이상이면 2열 격자 */
.mode-video .slots.has-tone { align-items: stretch; container-type: inline-size; }
.mode-video .slots.has-tone .slot { display: flex; flex-direction: column; }
.mode-video .slots.has-tone .slot .drop { flex: 1 1 auto; aspect-ratio: auto; height: auto; min-height: calc((100cqw - 8px) * 9 / 32); position: relative; }
.mode-video .slots.has-tone .slot.multi .drop:not(:has(.thumb)) { display: flex; align-items: center; align-content: center; justify-content: center; padding: 0; }
.mode-video .slots.has-tone .slot.tone .drop img { object-fit: contain; background: #000; } /* 레퍼런스가 여러 줄이라 칸이 길어져도 톤앤매너 그림이 잘리지 않게 */
.mode-video .slots.has-tone .slot.multi .drop:not(:has(.thumb)) > .add { aspect-ratio: auto; width: auto; height: auto; }
.mode-video .slots.has-tone .slot.multi .drop:has(> .thumb:first-child:nth-last-child(2)),
.mode-video .slots.has-tone .slot.multi .drop:has(> .thumb:only-child) { display: block; padding: 0; }
.mode-video .slots.has-tone .slot.multi .drop:has(> .thumb:first-child:nth-last-child(2)) > .thumb,
.mode-video .slots.has-tone .slot.multi .drop:has(> .thumb:only-child) > .thumb { position: absolute; inset: 0; width: auto; height: auto; aspect-ratio: auto; }
.mode-video .slots.has-tone .slot.multi .drop:has(> .thumb:first-child:nth-last-child(2)) > .thumb img,
.mode-video .slots.has-tone .slot.multi .drop:has(> .thumb:first-child:nth-last-child(2)) > .thumb video,
.mode-video .slots.has-tone .slot.multi .drop:has(> .thumb:only-child) > .thumb img,
.mode-video .slots.has-tone .slot.multi .drop:has(> .thumb:only-child) > .thumb video { width: 100%; height: 100%; object-fit: cover; }
.mode-video .slots.has-tone .slot.multi .drop:has(> .thumb:first-child:nth-last-child(2)) > .add { position: absolute; right: 6px; bottom: 6px; width: 30px; height: 30px; aspect-ratio: auto; min-width: 0; border-radius: 50%; border: 0; background: #000b; color: #fff; font-size: 18px; z-index: 2; display: flex; align-items: center; justify-content: center; }


/* AI 대화 [＋ 이미지] → 이미지함에서 고르기 (2026-10-14) */
.chat-form { position: relative; }
.chat-tray { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; box-shadow: 0 8px 24px #0008; }
.chat-tray-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 13.5px; color: var(--muted, #8b919b); }
.chat-tray-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; }
.chat-tray-list img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; cursor: pointer; outline: 2px solid transparent; }
.chat-tray-list img:hover { outline-color: var(--line); }
.chat-tray-list img.on { outline-color: var(--accent); }
.prop-prompt.copied { outline: 1px solid var(--accent); }
#shotList .done-ck { color: var(--accent); font-weight: 700; font-size: 14px; margin-right: 2px; }
.tray-pop .tray-it.in-slot img { outline: 2px solid var(--accent); outline-offset: -2px; }
/* 멀티샷 켬 단추: 보라 바탕에 흰 굵은 글씨 + ✕ (글씨가 안 보이던 것, 2026-10-14). 멀티샷 칸 머리에도 [끄기 ✕] */
.pill.shots-tog.on, .pill.shots-tog.on span { color: #fff; font-weight: 600; }
.pill.shots-tog.on .x { font-weight: 700; margin-left: 4px; opacity: .9; }
.pill.shots-tog.on:hover { filter: brightness(1.1); }
.shots-head .shots-off { margin-left: 8px; padding: 2px 8px; }
.shots-head .hint, .shots-head .warn { margin-left: auto; }
.shots-head { gap: 8px; }
.shots-head > b, .shots-head .shots-off { white-space: nowrap; flex: none; }
.shots-head .hint, .shots-head .warn { font-size: 13px; text-align: right; }

/* 프로젝트 고르기 (직접 그린 목록 — 더블클릭으로 이름 바꾸기) */
.side-head .proj-pick { flex: 1; min-width: 0; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 26px 7px 9px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; cursor: pointer; font: inherit; }
.side-head .proj-pick::after { content: ''; position: absolute; right: 10px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-70%) rotate(45deg); opacity: .6; }
.side-head .proj-pick.open { border-color: var(--accent); }
.proj-pop { position: fixed; z-index: 1000; max-height: 60vh; max-width: 420px; overflow: auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: 0 10px 30px #0008; }
.proj-pop .grp { font-size: 12px; color: var(--muted); padding: 8px 10px 4px; }
.proj-pop button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: 5px; padding: 7px 10px; color: var(--text); cursor: pointer; font: inherit; }
.proj-pop button:hover { background: #ffffff10; }
.proj-pop button.on { color: var(--accent); font-weight: 700; }
.proj-pop button .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-pop button small { color: var(--muted); font-size: 12px; }
.proj-pop .pp-edit { flex: 1; min-width: 0; background: var(--bg, #111); color: var(--text); border: 1px solid var(--accent); border-radius: 4px; padding: 3px 6px; font: inherit; }
.side-head .proj-pick[hidden] { display: none; }
.side-head .proj-pick-edit { cursor: text; border-color: var(--accent); padding-right: 9px; }
.side-head .proj-pick-edit::after { content: none; }
.slot .thumb img.ref-pick { cursor: pointer; }
/* 이미지 용도 메뉴 (레퍼런스·시작·끝·크게 보기) */
.role-menu button { display: flex; align-items: center; gap: 10px; }
.role-menu .ri { width: 22px; color: var(--muted); font-size: 13px; text-align: center; flex: none; }
.role-menu .ck { margin-left: auto; color: var(--accent); }
.slot .thumb .role-badge { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); background: #000a; color: #fff; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; pointer-events: none; }
.img-full { position: fixed; inset: 0; z-index: 3000; background: #000d; display: grid; place-items: center; cursor: zoom-out; }
.img-full img { max-width: 94vw; max-height: 92vh; object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px #000; }
