:root {
  --bg: #0f1012; --panel: #17181b; --surface: #1f2125; --raise: #282b30; --line: #2e3138;
  --text: #ecedef; --muted: #9a9fa8; --dim: #6b7079;
  --accent: #4c8dff; --accent-ink: #fff; --ok: #46c37b; --ask: #f2b33d; --off: #7b808a; --danger: #ff5a5f;
  --g: 12px; --pad: 16px; --r: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 Pretendard, "Apple SD Gothic Neo", -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: .4; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[hidden] { display: none !important; }
.sp { flex: 1; }
.tnum { font-variant-numeric: tabular-nums; }

/* 상단 */
.top {
  height: 56px; padding: 0 var(--pad); display: flex; align-items: center; gap: var(--g);
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.brand:hover { color: var(--text); }
.top .sep { width: 1px; height: 20px; background: var(--line); }
.ttl { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ttl b { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ttl span { color: var(--muted); white-space: nowrap; }
.top select {
  height: 32px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface);
}
.hint { color: var(--muted); white-space: nowrap; }
.hint b { color: var(--ask); font-weight: 600; }
.btn {
  height: 36px; padding: 0 16px; border-radius: var(--r); font-weight: 600; white-space: nowrap;
  background: var(--raise); border: 1px solid var(--line);
}
.btn:hover:not(:disabled) { background: #31353b; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: #6a9fff; }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; font-weight: 500; border-radius: 6px; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--raise); color: var(--text); }

/* 본문 2단 */
.main { height: calc(100% - 56px); display: grid; grid-template-columns: minmax(0, 1fr) 384px; }
.work { display: flex; flex-direction: column; gap: var(--g); padding: var(--pad); min-width: 0; min-height: 0; }
.note {
  padding: 10px 14px; border-radius: var(--r); background: var(--surface); border-left: 3px solid var(--accent);
  white-space: pre-wrap;
}
.note b { color: var(--muted); font-weight: 600; margin-right: 8px; }
.oldver { padding: 8px 14px; border-radius: var(--r); background: #3a2f17; color: #f6d28a; }
.stage {
  position: relative; flex: 1; min-height: 0; background: #000; border-radius: var(--r); overflow: hidden;
  outline: none;
}
.stage video, .stage img, .stage svg { position: absolute; display: block; }
.stage svg { touch-action: none; user-select: none; -webkit-user-select: none; }
.stage svg g[data-id] { cursor: pointer; }
.stage svg g.hot { filter: drop-shadow(0 0 5px rgba(255, 255, 255, .9)); }
body[data-tool="select"] .stage svg { cursor: default; }
body:not([data-tool="select"]) .stage svg { cursor: crosshair; }
.textin {
  position: absolute; z-index: 5; min-width: 180px; height: 34px; padding: 0 10px; border-radius: 6px;
  border: 2px solid var(--accent); background: rgba(0, 0, 0, .8); font-weight: 700;
}

/* 타임라인 */
.timeline { height: 40px; position: relative; cursor: pointer; touch-action: none; }
.timeline .bar { position: absolute; left: 0; right: 0; top: 24px; height: 6px; border-radius: 3px; background: var(--raise); }
.timeline .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--dim); }
.timeline .head { position: absolute; top: 18px; width: 2px; height: 18px; margin-left: -1px; background: #fff; pointer-events: none; }
.timeline .rng { position: absolute; top: 24px; height: 6px; border-radius: 3px; background: var(--accent); opacity: .55; pointer-events: none; }
.timeline .rng.draft { background: #fff; opacity: .5; }
.mark {
  position: absolute; top: 0; min-width: 20px; height: 20px; margin-left: -10px; padding: 0 5px; border-radius: 10px;
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; color: #fff; background: var(--accent);
}
.mark:hover, .mark.hot { z-index: 2; outline: 2px solid #fff; }
.mark[data-st="done"] { background: var(--ok); color: #06250f; }
.mark[data-st="confirmed"] { background: #2a3a30; color: var(--ok); }
.mark[data-st="question"] { background: var(--ask); color: #2b1d00; }
.mark[data-st="wontfix"] { background: var(--off); }

/* 이미지 스트립 */
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.strip button {
  position: relative; flex: 0 0 auto; height: 64px; border-radius: 6px; overflow: hidden; border: 2px solid transparent;
  background: var(--surface);
}
.strip button.on { border-color: var(--accent); }
.strip img { height: 100%; display: block; }
.strip i {
  position: absolute; right: 4px; top: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  font-size: 11px; font-weight: 700; line-height: 18px; font-style: normal; background: var(--accent); color: #fff;
}

/* 조작줄: [재생 묶음] [시간 묶음] — [도구 묶음] [색 묶음] [보기 묶음] */
.ctrl { display: flex; align-items: center; gap: var(--pad); height: 40px; }
.grp { display: flex; align-items: center; gap: 4px; }
.ib {
  width: 36px; height: 36px; border-radius: 6px; display: grid; place-items: center; color: var(--muted);
  font-size: 13px; font-weight: 600;
}
.ib:hover { background: var(--raise); color: var(--text); }
.ib.on { background: var(--accent); color: #fff; }
.ib svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ib svg .f { fill: currentColor; stroke: none; }
.tc { font-size: 18px; font-weight: 600; letter-spacing: .02em; }
.fr { color: var(--muted); }
.sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; outline: 1px solid rgba(255, 255, 255, .15); }
.sw.on { border-color: var(--bg); outline: 2px solid #fff; }
body[data-kind="image"] .only-video { display: none !important; }
body[data-kind="video"] .only-image { display: none !important; }

/* 의견 패널 */
.panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--panel); }
.phead { display: flex; align-items: center; gap: 8px; padding: var(--pad) var(--pad) var(--g); }
.phead b { font-size: 15px; }
.phead .cnt { color: var(--muted); }
.seg { display: flex; margin-left: auto; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { height: 28px; padding: 0 10px; font-size: 13px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--raise); color: var(--text); }
.plist { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--pad) var(--pad); display: flex; flex-direction: column; gap: var(--g); }
.empty { color: var(--muted); text-align: center; padding: 40px 12px; line-height: 1.8; }
.empty kbd, .help kbd {
  display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 4px; background: var(--raise);
  border: 1px solid var(--line); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}

.card { padding: 12px; border-radius: var(--r); background: var(--surface); border: 1px solid transparent; display: flex; flex-direction: column; gap: 8px; }
.card.here { border-color: var(--line); background: #24272c; }
.card.hot, .card.focus { border-color: var(--accent); }
.card.dim { opacity: .6; }
.chead { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.no {
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; font-size: 12px; font-weight: 700; line-height: 24px; text-align: center;
  background: var(--accent); color: #fff;
}
.card[data-st="done"] .no { background: var(--ok); color: #06250f; }
.card[data-st="confirmed"] .no { background: #2a3a30; color: var(--ok); }
.card[data-st="question"] .no { background: var(--ask); color: #2b1d00; }
.card[data-st="wontfix"] .no { background: var(--off); }
.when { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { margin-left: auto; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--accent); }
.card[data-st="done"] .pill, .card[data-st="confirmed"] .pill { color: var(--ok); }
.card[data-st="question"] .pill { color: var(--ask); }
.card[data-st="wontfix"] .pill { color: var(--off); }
.card .pill.unsent { color: var(--dim); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 0 8px; border-radius: 10px; font-size: 12px; line-height: 20px; background: var(--raise); color: var(--muted); }
.body { white-space: pre-wrap; overflow-wrap: anywhere; }
.fix { padding: 6px 10px; border-radius: 6px; background: var(--bg); }
.fix small { color: var(--muted); margin-right: 6px; }
.thread { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg b { margin-right: 6px; font-weight: 600; color: var(--muted); }
.msg.ai b { color: var(--accent); }
.cact { display: flex; align-items: center; gap: 6px; }
.cact input {
  flex: 1; min-width: 0; height: 28px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); font-size: 13px;
}

/* 작성 중 */
.draft { margin: 0 var(--pad) var(--g); padding: 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--accent); display: flex; flex-direction: column; gap: 10px; }
.dhead { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.dhead .no { background: none; color: var(--accent); outline: 2px dashed var(--accent); outline-offset: -2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips small { width: 34px; color: var(--dim); line-height: 26px; }
.chip { height: 26px; padding: 0 10px; border-radius: 13px; font-size: 13px; background: var(--raise); color: var(--muted); }
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent); color: #fff; }
.draft textarea, .draft input {
  width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); resize: vertical;
}
.draft textarea { min-height: 72px; }
.dfoot { display: flex; align-items: center; gap: 6px; }
.dfoot small { color: var(--muted); }

.carry { margin: 0 var(--pad) var(--g); border-radius: var(--r); background: var(--surface); }
.carry summary { padding: 10px 12px; cursor: pointer; color: var(--muted); }
.carry a { display: block; padding: 6px 12px; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carry a:hover { background: var(--raise); }
.carry a b { color: var(--accent); margin-right: 6px; }

/* 알림·도움말 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 20; max-width: 70vw;
  padding: 10px 16px; border-radius: var(--r); background: #fff; color: #111; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
.help { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; background: rgba(0, 0, 0, .6); }
.help > div { width: 640px; max-width: 92vw; padding: 24px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.help h3 { margin: 0 0 16px; font-size: 16px; }
.help dl { margin: 0; display: grid; grid-template-columns: 150px 1fr 150px 1fr; gap: 8px 12px; }
.help dt { white-space: nowrap; }
.help dd { margin: 0; color: var(--muted); }

/* 목록(첫 화면) */
.home { height: calc(100% - 56px); overflow-y: auto; }
.wrap { max-width: 960px; margin: 0 auto; padding: 32px var(--pad) 48px; display: flex; flex-direction: column; gap: 32px; }
.wrap h2 { margin: 0 0 var(--g); font-size: 15px; color: var(--muted); font-weight: 600; }
.drop {
  padding: 20px; border-radius: 12px; border: 1px dashed var(--line); background: var(--panel);
  display: flex; flex-direction: column; gap: var(--g);
}
.drop.over { border-color: var(--accent); background: #18202e; }
.drop p { margin: 0; color: var(--muted); }
.drop p b { color: var(--text); font-weight: 600; }
.drop .dim { color: var(--dim); }
.drop .dim code { padding: 1px 6px; border-radius: 4px; background: var(--raise); font-size: 12px; }
.row.end { justify-content: flex-end; }
/* 올리기 진행 */
.upl { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: var(--r); background: var(--bg); }
.upname { display: flex; justify-content: space-between; gap: var(--g); font-size: 13px; }
.upname span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upname span:last-child { color: var(--muted); white-space: nowrap; }
.uprow { display: flex; align-items: center; gap: 8px; }
.upl progress { flex: 1; min-width: 0; width: 100%; height: 6px; border: 0; border-radius: 3px; overflow: hidden; background: var(--raise); appearance: none; -webkit-appearance: none; }
.upl progress::-webkit-progress-bar { background: var(--raise); }
.upl progress::-webkit-progress-value { background: var(--accent); }
.upl progress::-moz-progress-bar { background: var(--accent); }
/* 검토 화면: 새 버전 올리기 */
.help > .nv { width: 480px; display: flex; flex-direction: column; gap: var(--g); }
.nv h3 { margin: 0; }
.nv p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.nv p b { color: var(--text); font-weight: 600; }
.nv small { color: var(--dim); }
body.dropping .stage { outline: 2px dashed var(--accent); outline-offset: -2px; }
.row { display: flex; gap: 8px; }
.row input {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg);
}
.files { display: flex; flex-wrap: wrap; gap: 6px; }
.rlist { display: flex; flex-direction: column; gap: 8px; }
.ritem {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--pad);
  padding: 14px 16px; border-radius: var(--r); background: var(--panel); border: 1px solid transparent;
  color: inherit; text-decoration: none;
}
.ritem:hover { border-color: var(--line); background: var(--surface); }
.ritem .t { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ritem .t b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ritem .t span, .ritem time { color: var(--muted); white-space: nowrap; font-size: 13px; }
.stat { display: flex; gap: 6px; }
.stat span { padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 600; line-height: 24px; background: var(--raise); color: var(--muted); white-space: nowrap; }
.stat .a { background: #3a2f17; color: var(--ask); }
.stat .u { background: #18263f; color: #8fb6ff; }
.stat .k { background: #173022; color: var(--ok); }

/* 역할별 표시 */
body[data-role="guest"] .only-staff { display: none !important; }
body[data-role="staff"] .only-guest { display: none !important; }
.top { position: relative; }
.btn.live { border-color: var(--ok); color: var(--ok); }
.btn.small.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pop {
  position: absolute; right: var(--pad); top: 52px; z-index: 12; width: 400px; max-width: calc(100vw - 2 * var(--pad));
  padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .55); display: flex; flex-direction: column; gap: var(--g);
}
.pop p { margin: 0; color: var(--muted); }
.pop p.warn { color: var(--ask); }
.pop small { color: var(--dim); }
.prow { display: flex; align-items: center; gap: 8px; }
.prow input:not([type]) {
  flex: 1; min-width: 0; height: 28px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); font-size: 13px;
}
.who { display: flex; align-items: center; gap: 8px; margin: 0 var(--pad) var(--g); color: var(--muted); font-size: 13px; }
.who input {
  flex: 1; min-width: 0; height: 32px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text);
}
.tag.from { background: none; outline: 1px solid var(--line); outline-offset: -1px; color: var(--text); }
.card.attn { border-color: var(--ask); }
.card[data-st="accepted"] .pill { color: var(--text); }
.decide { display: flex; gap: 6px; }
.decide .btn { flex: 1; padding: 0; }
.msg i { margin-right: 6px; padding: 0 6px; border-radius: 8px; font-size: 11px; font-style: normal; background: var(--raise); color: var(--dim); }

.gen {
  margin: 0 var(--pad) var(--g); height: 36px; border-radius: var(--r); border: 1px dashed var(--line);
  color: var(--text); font-weight: 600; font-size: 13px; text-align: center;
}
.gen:hover { border-color: var(--accent); background: var(--surface); }
.gen small { margin-left: 6px; color: var(--dim); font-weight: 400; }

/* 수정 회차 */
.help > .rounds { width: 760px; max-height: 86vh; display: flex; flex-direction: column; padding: 0; }
.rtop { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 12px; }
.rtop h3 { margin: 0; }
#roundsBody { overflow-y: auto; padding: 0 24px 24px; display: flex; flex-direction: column; gap: var(--pad); }
.round { padding: var(--pad); border-radius: var(--r); background: var(--surface); display: flex; flex-direction: column; gap: var(--g); }
.rhead { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px var(--g); color: var(--muted); font-size: 13px; }
.rhead b { font-size: 15px; color: var(--text); }
.rhead .ok { color: var(--ok); }
.rmemo { width: 100%; padding: 8px 10px; border-radius: 6px; background: var(--bg); white-space: pre-wrap; overflow-wrap: anywhere; }
textarea.rmemo { min-height: 60px; border: 1px solid var(--line); resize: vertical; }
.rlist2 { display: flex; flex-direction: column; }
.rlist2 a { display: flex; align-items: baseline; gap: 10px; padding: 6px 4px; color: var(--text); text-decoration: none; border-top: 1px solid var(--line); }
.rlist2 a:hover { background: var(--raise); }
.rlist2 b { min-width: 28px; color: var(--muted); }
.rlist2 .rtext { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rlist2 i { font-style: normal; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--accent); }
.rlist2 a[data-st="done"] i, .rlist2 a[data-st="confirmed"] i { color: var(--ok); }
.rlist2 a[data-st="question"] i { color: var(--ask); }
.rlist2 a[data-st="wontfix"] i { color: var(--off); }
.prow input[type="date"] { height: 28px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); font-size: 13px; }

.inbox { display: flex; flex-direction: column; gap: 6px; }
.inbox small { color: var(--muted); }
.inbox code { padding: 1px 6px; border-radius: 4px; background: var(--raise); font-size: 12px; }
.ibx { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; background: var(--bg); cursor: pointer; }
.ibx span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 로그인 */
.login { height: 100%; display: grid; place-items: center; }
.login form { width: 320px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: var(--g); }
.login h1 { margin: 0 0 4px; font-size: 18px; }
.login input { height: 40px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); }
.login p { margin: 0; min-height: 21px; color: var(--danger); }

/* 좁은 화면(휴대폰): 영상 위, 의견 아래로 쌓는다 */
@media (max-width: 900px) {
  html, body { height: auto; }
  body { overflow: auto; }
  .top { position: sticky; top: 0; z-index: 10; height: auto; min-height: 56px; flex-wrap: wrap; padding: 8px var(--g); gap: 8px; }
  .top .sep, .hint, .brand { display: none; }
  .ttl { flex: 1 1 100%; }
  .main { height: auto; display: block; }
  .work { padding: var(--g); }
  .stage { flex: none; aspect-ratio: var(--ar, 16 / 9); max-height: 62vh; }
  .ctrl { height: auto; flex-wrap: wrap; gap: 8px var(--g); }
  .ctrl .sp { display: none; }
  #bHelp { display: none; }
  .panel { border-left: 0; border-top: 1px solid var(--line); min-height: 50vh; }
  .plist { overflow: visible; }
  .empty kbd { display: none; }
  input, textarea, select { font-size: 16px !important; }
  .toast { max-width: 92vw; bottom: 16px; }
  .home { height: auto; }
  .ritem { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .stat { flex-wrap: wrap; }
  .row { flex-wrap: wrap; }
}
