:root {
  --bg: #121214; --panel: #1b1b1f; --panel2: #232328; --line: #2f2f36; --text: #d9d9de;
  --dim: #8a8a93; --accent: #e0a64a; --accent2: #5aa0d8; --danger: #e0605a; --ok: #6cc28a;
  --action: #3d5a7a; --trans: #6a5a8a; --blend: #4a6a5a;
  font-size: 13px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif; }
h2 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin: 0 0 8px; font-weight: 600; }
h3 { margin: 0 0 10px; font-size: 14px; }
code { background: var(--panel2); padding: 0 4px; border-radius: 3px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.dim { color: var(--dim); }
.hint { color: var(--dim); font-size: 11px; margin: 8px 0 0; line-height: 1.4; }

.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 4px;
  padding: 5px 10px; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { border-color: #4a4a55; background: #2a2a31; }
.btn.primary { background: #3b4f66; border-color: #4f6a88; }
.btn.primary:hover { background: #46607d; }
.btn.warn { border-color: #6b5530; }
.btn.danger { border-color: #6b3330; color: #f0a8a4; }
.btn.small { padding: 2px 7px; font-size: 12px; }
.btn.ghost { background: transparent; }
.btn.icon { width: 30px; padding: 4px 0; }
.btn.seg { border-radius: 0; margin-left: -1px; }
.btn.seg:first-child { border-radius: 4px 0 0 4px; }
.btn.seg:last-child { border-radius: 0 4px 4px 0; }
.btn.seg.on { background: #3b4f66; border-color: #4f6a88; }
.btn:disabled { opacity: .5; cursor: default; }
.chk { color: var(--dim); display: inline-flex; gap: 4px; align-items: center; }
.badge { font-size: 10px; color: #f3d39a; border: 1px solid #6b5530; padding: 2px 6px; border-radius: 10px; }

.toolbar { height: 46px; display: flex; align-items: center; gap: 16px; padding: 0 12px;
  background: #18181b; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: .04em; color: var(--accent); }
.brand span { color: var(--dim); font-weight: 400; margin-left: 4px; }
.transport { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 260px; }
.transport input[type=range] { flex: 1; accent-color: var(--accent); }
.viewtoggle { display: flex; }
.exports { display: flex; gap: 6px; align-items: center; }

.layout { display: grid; height: calc(100vh - 46px);
  grid-template-columns: 290px 1fr 230px; grid-template-rows: 1fr 210px;
  grid-template-areas: "left center right" "bottom bottom bottom"; }
.left { grid-area: left; overflow: auto; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.right { grid-area: right; overflow: auto; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.center { grid-area: center; position: relative; min-width: 0; min-height: 0; }
.bottom { grid-area: bottom; border-top: 1px solid var(--line); background: #161619; padding: 8px 12px; min-height: 0; display: flex; flex-direction: column; }
.panel { padding: 12px; border-bottom: 1px solid var(--line); }
.panel.grow { flex: 1 0 auto; }
.left .panel, .right .panel { flex-shrink: 0; }
.row { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

textarea { width: 100%; background: #0f0f11; color: var(--text); border: 1px solid var(--line); border-radius: 4px;
  padding: 8px; font: inherit; resize: vertical; line-height: 1.45; }
textarea:focus, input:focus { outline: 1px solid #4f6a88; }
input[type=number] { width: 70px; background: #0f0f11; color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 2px 4px; }

.matchinfo { margin-top: 8px; font-size: 12px; }
.matchinfo .chip { display: inline-block; padding: 1px 6px; border-radius: 3px; margin: 2px 3px 2px 0; background: var(--action); }
.matchinfo .unk { background: #4a2a2a; color: #f0b0a8; }

.library .grp { color: var(--dim); font-size: 11px; margin: 8px 0 4px; }
.mode { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 4px; margin-bottom: 5px; background: var(--panel); border-left: 3px solid var(--action); }
.mode.transition { border-left-color: var(--trans); }
.mode .nm { font-weight: 600; }
.mode .meta { grid-column: 1 / 2; color: var(--dim); font-size: 11px; }
.mode .tags span { display: inline-block; font-size: 10px; color: #b5b5bd; background: var(--panel2); border-radius: 3px; padding: 0 4px; margin-right: 3px; }
.mode button { grid-row: 1 / 3; grid-column: 2; align-self: center; }

.consent label { display: flex; gap: 6px; align-items: center; padding: 4px 0; }
.consent .path { color: var(--dim); font-size: 11px; margin-left: auto; }

.stage-wrap { position: absolute; inset: 0; background: #141416; overflow: hidden; }
#stage { width: 100%; height: 100%; display: block; touch-action: none; }
.frame-guide { position: absolute; pointer-events: none; border: 1px solid rgba(255, 210, 120, .85);
  box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.frame-guide .thirds { position: absolute; background: rgba(255,255,255,.14); }
.frame-guide .v1, .frame-guide .v2 { top: 0; bottom: 0; width: 1px; }
.frame-guide .h1, .frame-guide .h2 { left: 0; right: 0; height: 1px; }
.frame-guide .v1 { left: 33.33%; } .frame-guide .v2 { left: 66.66%; }
.frame-guide .h1 { top: 33.33%; } .frame-guide .h2 { top: 66.66%; }
.frame-guide .safe { position: absolute; inset: 5%; border: 1px dashed rgba(255,255,255,.18); }
.fg-label { position: absolute; left: 6px; top: 5px; font-size: 11px; color: #ffd78a; text-shadow: 0 1px 2px #000; font-family: ui-monospace, monospace; }
.fg-block { position: absolute; left: 6px; bottom: 6px; right: 6px; font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000; }
.fg-block .auto { color: #c9b6ff; }
.pip-frame { position: absolute; pointer-events: none; border: 1px solid rgba(255,159,67,.9); }
.pip-frame span { position: absolute; top: 2px; left: 4px; font-size: 10px; color: #ffb26b; text-shadow: 0 1px 2px #000; }
.stage-msg { position: absolute; left: 12px; top: 10px; color: var(--dim); font-size: 12px; pointer-events: none; }

.shotinfo { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; margin: 0; font-size: 12px; }
.shotinfo dt { color: var(--dim); }
.shotinfo dd { margin: 0; word-break: break-all; }
.log { font-family: ui-monospace, monospace; font-size: 11px; line-height: 1.5; color: #b9b9c0; overflow: auto; max-height: 100%; }
.log .err { color: var(--danger); } .log .ok { color: var(--ok); }

.tl-head { display: flex; gap: 12px; align-items: baseline; }
.timeline { flex: 1; display: grid; grid-template-columns: 1fr 260px; gap: 12px; min-height: 0; }
.tl-main { display: flex; flex-direction: column; min-width: 0; }
.tl-wrap { position: relative; padding-top: 18px; cursor: col-resize; user-select: none; }
.tl-ruler { position: absolute; left: 0; right: 0; top: 0; height: 18px; }
.tick { position: absolute; top: 10px; height: 8px; border-left: 1px solid #3a3a42; }
.tick.major { top: 4px; height: 14px; border-left-color: #55555f; }
.tick span { position: absolute; left: 3px; top: -3px; font-size: 10px; color: var(--dim); }
.tl-track { position: relative; height: 64px; background: #0f0f11; border: 1px solid var(--line); border-radius: 4px; }
.tl-empty { color: var(--dim); padding: 22px; text-align: center; }
.blk { position: absolute; top: 6px; bottom: 6px; border-radius: 4px; overflow: hidden; cursor: pointer;
  border: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; }
.blk-action { background: var(--action); }
.blk-trans { background: var(--trans); }
.blk-blend { background: var(--blend); top: 14px; bottom: 14px; }
.blk-auto { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.14) 0 4px, transparent 4px 8px);
  border: 1px dashed rgba(255,255,255,.55); }
.blk.active { box-shadow: inset 0 0 0 1px #ffd78a; }
.blk.sel { outline: 2px solid var(--accent); outline-offset: 0; z-index: 2; }
.blk-label { padding: 0 6px; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.blk-label b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk-label small { font-size: 10px; color: rgba(255,255,255,.7); }
.blk-blend .blk-label b, .blk-auto.blk-blend .blk-label small { display: none; }
.tl-marks { position: absolute; left: 0; right: 0; bottom: -2px; height: 0; }
.tl-warnmark { position: absolute; bottom: 0; transform: translateX(-50%); width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger); color: #fff; font-weight: 700; font-size: 11px; text-align: center; line-height: 16px; z-index: 3; }
.tl-playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); pointer-events: none; z-index: 4; }
.tl-playhead::before { content: ""; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: var(--accent); }
.tl-warnings { margin-top: 10px; overflow: auto; font-size: 12px; }
.warn-row { padding: 3px 0; display: flex; gap: 8px; align-items: baseline; }
.warn-badge { background: var(--danger); color: #fff; font-size: 10px; padding: 0 5px; border-radius: 3px; }
.ok-row { color: var(--ok); }
.tl-side { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; overflow: auto; font-size: 12px; }
.side-title { font-weight: 700; font-size: 13px; }
.side-meta { color: var(--dim); margin-top: 3px; }
.side-reason { margin-top: 6px; color: #c9b6ff; }
.side-hint { color: var(--dim); margin-top: 6px; line-height: 1.4; }
.side-actions { display: flex; gap: 4px; margin-top: 8px; }
.side-dur { display: block; margin-top: 8px; color: var(--dim); }
.legend { margin-top: 10px; color: var(--dim); line-height: 2; }
.lg { display: inline-block; width: 14px; height: 10px; border-radius: 2px; vertical-align: middle; margin: 0 4px 0 8px; }
.lg:first-child { margin-left: 0; }
.lg-action { background: var(--action); } .lg-trans { background: var(--trans); } .lg-blend { background: var(--blend); }
.lg-auto { background: repeating-linear-gradient(135deg, #888 0 3px, transparent 3px 6px); border: 1px dashed #aaa; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; max-width: 720px; width: 90vw; }
dialog::backdrop { background: rgba(0,0,0,.55); }
#jobBody pre { background: #0f0f11; padding: 8px; border-radius: 4px; font-size: 11px; overflow: auto; max-height: 220px; white-space: pre-wrap; }
#jobBody .note { color: #f3d39a; }
#jobBody .error { color: var(--danger); }
