:root {
  --bg: #0b0b0f; --panel: #15151c; --line: #26262f; --text: #ececf1; --muted: #8a8a99;
  --hot: #ff4d2e; --hot2: #ffb020; --ig: #e1306c; --tt: #25f4ee; --yt: #ff0033; --ok: #3ddc84;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, "Pretendard", "Apple SD Gothic Neo", sans-serif; }
button, select, input, textarea { font: inherit; color: inherit; }
button { background: var(--hot); border: 0; border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 600; }
button.ghost { background: transparent; border: 1px solid var(--line); }
button:disabled { opacity: .5; cursor: default; }
select, input[type=search], textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.muted { color: var(--muted); }

.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 12px; align-items: center; padding: 12px 16px; background: rgba(11,11,15,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-size: 18px; white-space: nowrap; }
.brand b { color: var(--hot); }
.brand span { margin-left: 8px; font-size: 12px; color: var(--muted); }
.top input { flex: 1; min-width: 0; }
.top-actions { display: flex; gap: 6px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.filters label { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { background: transparent; border-radius: 0; font-weight: 500; color: var(--muted); padding: 6px 11px; }
.seg button.on { background: #2a2a35; color: var(--text); }
.status { padding: 0 16px; color: var(--muted); font-size: 12px; }
.status:not(:empty) { padding: 8px 16px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: #3a3a48; }
.thumb { position: relative; aspect-ratio: 9/16; background: #1d1d26 center/cover no-repeat; }
.thumb .pf { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: rgba(0,0,0,.65); }
.pf.instagram { color: var(--ig); } .pf.tiktok { color: var(--tt); } .pf.youtube { color: var(--yt); }
.thumb .x { position: absolute; top: 8px; right: 8px; font-weight: 800; font-size: 13px; padding: 2px 8px; border-radius: 6px; background: var(--hot); }
.thumb .x.mid { background: var(--hot2); color: #111; }
.thumb .x.low { background: rgba(0,0,0,.65); color: var(--muted); }
.thumb .big { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 10px 8px; background: linear-gradient(transparent, rgba(0,0,0,.85)); display: flex; justify-content: space-between; align-items: end; }
.thumb .big b { font-size: 18px; }
.thumb .saved { position: absolute; top: 34px; left: 8px; font-size: 11px; background: var(--ok); color: #000; border-radius: 6px; padding: 1px 6px; font-weight: 700; }
.meta { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 5px; }
.meta .who { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .cap { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.stats { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.stats .hotc { color: var(--hot2); font-weight: 700; }
.empty { grid-column: 1/-1; padding: 60px 20px; text-align: center; color: var(--muted); }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgba(0,0,0,.7); }
.dlg { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dlg h2 { margin: 0; }
#src-form { display: grid; grid-template-columns: repeat(3, auto) 1fr auto; gap: 8px; align-items: start; }
#src-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#src-table td { padding: 6px 4px; border-top: 1px solid var(--line); }
#providers { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line); }
.pill.ok { color: var(--ok); border-color: #1f5a3a; } .pill.no { color: var(--muted); }

.detail { display: grid; grid-template-columns: 340px 1fr; gap: 20px; padding: 20px; }
.detail .player { aspect-ratio: 9/16; background: #000 center/cover no-repeat; border-radius: 10px; overflow: hidden; }
.detail .player iframe { width: 100%; height: 100%; border: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kpi { background: #1d1d26; border-radius: 10px; padding: 10px; }
.kpi small { display: block; color: var(--muted); font-size: 11px; }
.kpi b { font-size: 18px; }
.detail textarea { width: 100%; min-height: 90px; }
.cap-full { white-space: pre-wrap; color: #cfcfda; max-height: 180px; overflow: auto; background: #1d1d26; padding: 10px; border-radius: 10px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spark { width: 100%; height: 60px; }
.tags a { color: var(--tt); margin-right: 6px; font-size: 12px; cursor: pointer; }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; } .brand span { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px; }
  .detail { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  #src-form { grid-template-columns: 1fr 1fr 1fr; } #src-form textarea, #src-form button { grid-column: 1/-1; }
}
.meta .origin { font-size: 11px; color: var(--tt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#src-tabs { align-self: flex-start; }
#src-table td:last-child { white-space: nowrap; }

#bench-form { display: flex; flex-direction: column; gap: 10px; }
#bench-form input[type=url] { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
#bench-people .tab { margin: 4px 0 2px; font-size: 12px; color: var(--muted); }
#bench-people label { display: inline-flex; gap: 5px; align-items: center; margin: 3px 12px 3px 0; cursor: pointer; }
#bench-people label small { color: var(--muted); }
#bench-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#bench-table td { padding: 7px 4px; border-top: 1px solid var(--line); vertical-align: middle; }
#bench-table img { width: 34px; height: 60px; object-fit: cover; border-radius: 4px; display: block; }
#bench-table tr[data-id] { cursor: pointer; } #bench-table tr[data-id]:hover { background: #1d1d26; }
.st { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; }
.st.done { color: var(--ok); border-color: #1f5a3a; } .st.running { color: var(--hot2); } .st.hold, .st.error { color: var(--hot); }
.bench-out { white-space: pre-wrap; background: #1d1d26; border-radius: 10px; padding: 12px; font-size: 13.5px; line-height: 1.6; position: relative; }
.bench-out button { position: absolute; top: 8px; right: 8px; font-size: 12px; padding: 3px 9px; }
#bench-view-body h4 { margin: 6px 0 -4px; font-size: 13px; color: var(--muted); }
.bench-out.cut { display: flex; gap: 10px; padding-right: 60px; }
.bench-out.cut b { color: var(--hot2); min-width: 16px; }
#bench-view-body hr { border: 0; border-top: 1px solid var(--line); width: 100%; }
#bench-view-body details { margin-top: 6px; } #bench-view-body details .bench-out { margin-top: 8px; }
.bench-out.head-opt { display: flex; gap: 10px; align-items: center; padding-right: 60px; cursor: pointer; }
.bench-out.head-opt span { font-weight: 700; font-size: 15px; flex: 1; }
.bench-out.head-opt small { white-space: nowrap; }
.bench-out.head-opt:has(input:checked) { outline: 2px solid var(--hot); }

/* 인물·팀 레퍼런스·컷 표 */
.cats { display: flex; flex-wrap: wrap; gap: 6px; }
.cats label { border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; display: inline-flex; gap: 4px; align-items: center; }
.people-cat { margin-top: 14px; color: var(--muted); font-size: 12px; font-weight: 700; }
.person-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.person-row:hover { background: #1a1a22; }
.person-row .tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.pform { display: grid; gap: 8px; }
.pform label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.pform input, .pform textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; }
.cut-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cut-table th, .cut-table td { border-bottom: 1px solid var(--line); padding: 6px; vertical-align: top; text-align: left; }
.cut-table td.bench-out { display: table-cell; }
#teamrefs-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
/* 로그인 · 인플루언서 화면 (모바일 우선) */
.login { max-width: 360px; margin: 18vh auto 0; padding: 0 16px; display: grid; gap: 16px; }
.login form { display: grid; gap: 10px; }
.login label, .me-field { display: grid; gap: 6px; color: var(--muted); }
.login input, .me-field input, .me-field textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; font-size: 16px; }
.me-list, .me-item { max-width: 640px; margin: 0 auto; padding: 16px; display: grid; gap: 12px; }
.me-card { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; }
.me-thumb { width: 64px; aspect-ratio: 9/16; border-radius: 8px; background: #1d1d26 center/cover no-repeat; flex: none; }
.me-player iframe { width: 100%; aspect-ratio: 9/16; max-height: 70vh; border: 0; border-radius: 12px; background: #000; }
.me-cut { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.me-cut p { margin: 0; white-space: pre-wrap; }
.me-item h3 { margin: 14px 0 0; font-size: 15px; }
/* 좁은 화면(폰): 머리줄 버튼이 찌그러지지 않게 줄바꿈 */
.top-actions button { white-space: nowrap; }
@media (max-width: 720px) {
  .top { flex-wrap: wrap; }
  .top input { flex-basis: 100%; order: 3; }
  .top-actions { flex-wrap: wrap; order: 2; }
  dialog { max-width: calc(100vw - 16px); }
  .cut-table { font-size: 12px; }
}
.dlg, .me-item, .me-list { overflow-wrap: anywhere; }
#teamrefs-table, #bench-table { width: 100%; }
@media (max-width: 720px) { #teamrefs-table td:first-child { width: 64px; } .dlg input, .dlg textarea, .dlg select { max-width: 100%; } }

/* ── 인물 화면·로그인: 밝은 화면, 큰 글씨 (폰에서 오래 읽어도 편하게) */
body.me {
  --bg: #f6f6f8; --panel: #ffffff; --line: #e4e4ea; --text: #16161d; --muted: #6b6b78; --hot: #ff4d2e;
  color-scheme: light; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.65;
}
body.me .top { background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); }
body.me .top .brand span { display: inline; font-size: 13px; color: var(--muted); }
body.me button { color: #fff; }
body.me button.ghost, body.me .back { background: #fff; color: var(--text); border: 1px solid var(--line); }
body.me input, body.me textarea { background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; font-size: 16px; }
body.me input:disabled, body.me textarea:disabled { background: #f0f0f3; color: var(--muted); }
body.me .me-list, body.me .me-item { max-width: 640px; margin: 0 auto; padding: 14px 16px 60px; display: grid; gap: 14px; }
body.me .hint, body.me .sub { color: var(--muted); font-size: 14px; margin: 0; }
body.me .me-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; gap: 12px; align-items: center; cursor: pointer; }
body.me .me-card-body { display: grid; gap: 6px; font-size: 16px; }
body.me .tag { justify-self: start; font-size: 13px; padding: 2px 10px; border-radius: 99px; background: #eee; color: var(--muted); }
body.me .tag.mid { background: #fff3d6; color: #8a5a00; } body.me .tag.ok { background: #dcf5e6; color: #1a6b3c; }
body.me .card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
body.me .card h3 { margin: 0; font-size: 17px; } body.me .card h4 { margin: 6px 0 0; font-size: 15px; }
body.me .card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
body.me .head { margin: 0; white-space: pre-wrap; font-size: 22px; font-weight: 800; line-height: 1.4; }
body.me .txt { margin: 0; white-space: pre-wrap; }
body.me .mini { background: #16161d; color: #fff; font-size: 13px; padding: 6px 12px; border-radius: 99px; white-space: nowrap; }
body.me .primary { background: var(--hot); color: #fff; padding: 12px 18px; font-size: 16px; border-radius: 12px; }
body.me .back { justify-self: start; padding: 8px 14px; }
body.me .notice { background: #fff3d6; color: #6b4600; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
body.me .script { margin: 0; padding: 0; list-style: none; counter-reset: cut; display: grid; gap: 16px; }
body.me .script li { position: relative; padding-left: 32px; display: grid; gap: 6px; }
body.me .script li::before { counter-increment: cut; content: counter(cut); position: absolute; left: 0; top: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--hot); color: #fff; font-size: 13px; font-weight: 800; display: grid; place-items: center; }
body.me .todo { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; color: #3a3a46; background: #f6f6f8; border-radius: 10px; padding: 8px 10px; cursor: pointer; }
body.me .todo input { width: 20px; height: 20px; flex: none; margin: 2px 0 0; accent-color: var(--hot); }
body.me .field { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
body.me details summary { list-style: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
body.me details summary::-webkit-details-marker { display: none; }
body.me details[open] summary { margin-bottom: 10px; }
body.me .me-player iframe { width: 100%; aspect-ratio: 9/16; max-height: 70vh; border: 0; border-radius: 12px; background: #000; }
body.me .btn-line { display: inline-block; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none; }
body.me .edit { font-size: 16px; line-height: 1.6; resize: vertical; border-color: #ffb9a8; background: #fffaf8; }
body.me .login .brand { font-size: 22px; }
body.me a { color: #2456d6; }
body.me .top { justify-content: space-between; }

/* 카테고리 접기 */
details.cat { border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; }
details.cat summary { cursor: pointer; padding: 8px 12px; font-weight: 600; list-style: none; display: flex; gap: 8px; align-items: center; }
details.cat summary::-webkit-details-marker { display: none; }
details.cat summary::before { content: '▸'; color: var(--muted); } details.cat[open] summary::before { content: '▾'; }
details.cat summary small { color: var(--muted); font-weight: 400; }
details.cat .picked { color: var(--hot); font-size: 12px; }
details.cat .cat-body { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 12px 10px; }
details.cat .person-row { padding: 8px 12px; }
