:root {
  --bg: #f7f7f8;        /* 미드에디와 같은 중성 라이트 배경 */
  --panel: #ffffff;     /* 카드 흰색 */
  --panel-2: #f3f3f5;   /* 연회색 */
  --border: #e6e6ea;
  --text: #1f2226;      /* 진한 차콜 — 전사 글자 또렷하게 */
  --muted: #868b92;
  --accent: #e5483d;    /* 케첩 레드 — 미드에디와 통일 */
  --accent-2: #14a3a3;  /* 청록 (보조) */
  --danger: #b3261e;
  --warn: #d98324;      /* 밝은 배경에서도 보이는 앰버 */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
}

.app { display: flex; flex-direction: column; height: 100vh; }

/* 상단 단계 표시줄 */
.steps {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.step-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}
.step-pill .num {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel-2);
  font-size: 12px;
}
.step-pill.active { color: var(--text); background: var(--panel-2); }
.step-pill.active .num { background: var(--accent); color: #fff; }
.step-pill.done .num { background: var(--accent-2); color: #08231f; }

.content { flex: 1; overflow: auto; padding: 24px; }

.footer {
  display: flex;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

button {
  font: inherit;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; }

h2 { margin: 0 0 4px; }
.subtitle { color: var(--muted); margin: 0 0 24px; }

/* 업로드 카드 */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.drop {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
  background: var(--panel);
}
.drop h3 { margin: 0 0 12px; }
.drop video { width: 100%; border-radius: 8px; background: #000; }
.meta { color: var(--muted); font-size: 13px; margin-top: 10px; line-height: 1.6; }

.sync-box {
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.badge { padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.badge.good { background: rgba(20, 163, 163, 0.15); color: #0d7a7a; }
.badge.warn { background: rgba(217, 131, 36, 0.16); color: #a5600f; }

/* 모드 선택 */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mode-card {
  padding: 24px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
}
.mode-card.selected { border-color: var(--accent); background: var(--panel-2); }
.mode-card h3 { margin: 0 0 8px; font-size: 18px; }
.mode-card p { color: var(--muted); margin: 0; line-height: 1.6; }
/* 2단계 모드: 카드(선택 상자) + 그 아래 장식 그래픽 */
.mode-col { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.mode-col .mode-card { width: 100%; }
/* 카드 밖 아래 장식(고양이+쥐)을 틸 색 원 안에 — 더 아래로 */
.mode-scene {
  box-sizing: border-box;
  width: 330px;
  height: 330px;
  max-width: 100%;
  border-radius: 50%;
  border: 5px solid var(--accent-2);
  background: transparent;
  margin: 60px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 높이 고정 → 단독·인터뷰 고양이 크기 동일 */
.mode-scene img { display: block; height: 88px; width: auto; }
/* 6단계: 왼쪽 컨트롤 / 오른쪽 내보내기 애니메이션 */
.export-row { display: flex; gap: 24px; align-items: flex-start; }
.export-controls { flex: 0 0 auto; width: 440px; max-width: 100%; }
.export-motion-panel { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; }

/* 내보내기 모션(무한 반복): 왼쪽 아래에서 중앙~약간 오른쪽까지 걸어옴 → 원 위 탑승 → 풍선(실) → 날아감 */
.em-stage { position: relative; width: 560px; max-width: 100%; height: 300px; overflow: hidden; }
.em-cat {
  position: absolute; left: 42%; bottom: 24px; height: 92px; width: auto;
  transform-origin: bottom center; animation: emCat2 9s ease-in-out infinite;
}
.em-mouse { position: absolute; left: 52%; bottom: 22px; animation: emMouse2 9s ease-in-out infinite; }
.em-mouse svg { display: block; transform: scaleX(-1); }
.em-balloon {
  position: absolute; left: 76%; bottom: 30px;
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--accent-2); background-color: transparent;
  transform-origin: bottom center; animation: emBalloon2 9s ease-in-out infinite;
}
/* 풍선 아래 구불구불한 실 — 부풀어 올라가기 직전에 생김(둥근 라인엔 없음: scaleY 0) */
.em-string {
  position: absolute; top: 100%; left: 50%;
  transform-origin: top center;
  transform: translateX(-50%) scaleY(0);
  opacity: 0; animation: emStringRise 9s ease-in-out infinite;
}
@keyframes emCat2 {
  0% { transform: translateX(-420px); opacity: 0; }
  6% { opacity: 1; }
  26% { transform: translateX(0); opacity: 1; }
  90% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(-24px); opacity: 0; }
}
@keyframes emMouse2 {
  0% { transform: translateX(-430px) translateY(0); opacity: 0; }
  6% { opacity: 1; }
  26% { transform: translateX(0) translateY(0); opacity: 1; }
  38% { transform: translateX(136px) translateY(-46px); opacity: 1; }
  48% { transform: translateX(142px) translateY(-90px); opacity: 1; }
  74% { transform: translateX(160px) translateY(-300px); opacity: 1; }
  80% { transform: translateX(166px) translateY(-352px); opacity: 0; }
  100% { transform: translateX(166px) translateY(-352px); opacity: 0; }
}
@keyframes emBalloon2 {
  0% { transform: translateY(0) scale(0.85); opacity: 0; background-color: transparent; }
  8% { transform: translateY(0) scale(1); opacity: 1; background-color: transparent; }
  36% { transform: translateY(0) scale(1); opacity: 1; background-color: transparent; }
  48% { transform: translateY(-8px) scale(2.2); opacity: 1; background-color: var(--accent-2); }
  74% { transform: translateY(-292px) translateX(20px) scale(2.3); opacity: 1; background-color: var(--accent-2); }
  80% { transform: translateY(-346px) translateX(26px) scale(2.3); opacity: 0; background-color: var(--accent-2); }
  100% { transform: translateY(0) scale(0.85); opacity: 0; background-color: transparent; }
}
@keyframes emStringRise {
  0%, 48% { opacity: 0; transform: translateX(-50%) scaleY(0); }
  54%, 100% { opacity: 1; transform: translateX(-50%) scaleY(1); }
}

/* 편집기 */
.editor { display: grid; grid-template-rows: auto auto 1fr; gap: 16px; height: 100%; }
.preview { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preview video { width: 100%; border-radius: 8px; background: #000; }
.timeline {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.track { position: relative; height: 56px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.cut-block {
  position: absolute; top: 4px; bottom: 4px;
  background: var(--accent);
  border-radius: 5px;
  opacity: 0.85;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff;
  cursor: pointer;
  overflow: hidden;
}
.cut-block.selected { outline: 2px solid #fff; opacity: 1; }
.cut-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.cut-row {
  display: grid;
  grid-template-columns: 30px 1fr 1fr 150px auto;
  gap: 10px; align-items: center;
  padding: 8px 10px; background: var(--panel-2); border-radius: 8px;
}
.cut-row input, .cut-row select {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; width: 100%;
}
.toolbar { display: flex; gap: 10px; align-items: center; }

/* 진행/내보내기 */
.progress-wrap { max-width: 600px; }
.bar { height: 14px; background: var(--panel-2); border-radius: 7px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); transition: width 0.2s; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { color: var(--muted); font-size: 13px; }
.field input, .field select {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
}
.row { display: flex; gap: 16px; }
.row > .field { flex: 1; }
.error { color: var(--danger); margin-top: 12px; }
.success { color: var(--accent-2); margin-top: 12px; }
.mono { font-family: 'Consolas', monospace; font-size: 12px; }
.env-bad { border-color: var(--warn); }

/* 음절 편집기 */
.edit-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; height: 100%; }
/* 5단계: 미리보기 영상을 크게 보기 위해 우측 패널을 넓힘 */
.edit-wide { grid-template-columns: minmax(360px, 1fr) 640px; }
.edit-main { overflow: auto; outline: none; }
.edit-side { border-left: 1px solid var(--border); padding-left: 18px; overflow: auto; }
.edit-wide .edit-side video { max-height: 64vh; object-fit: contain; }

.transcript {
  font-size: 19px;
  line-height: 2.1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.chapter-head { font-weight: 700; font-size: 15px; margin: 14px 0 6px; }
.sentence { }
.sentence.spk-side { } /* 화자 측면 문장(필요시 배경 강조) */
/* 단어 사이에서 줄바꿈되도록 nowrap 제거. 한글 음절은 keep-all 로 묶임. */
.word { }
.syl {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 1px;
}
.syl:hover { background: rgba(245,149,43,0.22); }
.syl.sel { background: var(--accent); color: #fff; }
.syl.playing { background: var(--accent-2); color: #08231f; box-shadow: 0 0 0 2px var(--accent-2); border-radius: 3px; }
.syl.cut { text-decoration: line-through; opacity: 0.4; }
.syl.filler { text-decoration: line-through; color: var(--warn); opacity: 0.6; }
.syl.flagged { border-bottom: 2px solid var(--warn); }
.syl.interp { } /* 보간 정렬 음절(필요시 점선 표시 가능) */

.stat-card {
  margin-top: 14px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  line-height: 1.9;
  font-size: 14px;
}

/* 5단계: 좌(영상+상태) / 우(전사 패널) 가로 레이아웃 */
.edit-v { display: flex; flex-direction: row; height: 100%; gap: 16px; outline: none; }
/* 왼쪽: 영상 + 상태/컨트롤 — 화면 크기에 맞춰 적당한 폭 */
.edit-left {
  flex: 0 0 auto;
  width: 46vw;
  max-width: 720px;
  min-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.preview-main { display: flex; flex-direction: column; gap: 8px; }
.preview-canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 50vh;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
  display: block;
}
.preview-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.preview-side { width: 100%; }

/* 오른쪽: 전사 패널 — 남는 폭 전부, 줄바꿈 + 세로 스크롤 */
.transcript-full {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  word-break: keep-all;       /* 한국어 단어 중간에서 끊지 않음 */
  overflow-wrap: anywhere;    /* 넘치면 줄바꿈 → 가로 스크롤 방지 */
}
.syl-wrap { display: inline; }
.gapchip {
  display: inline-block;
  margin: 0 3px;
  padding: 0 5px;
  border: 1px dashed var(--muted);
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  cursor: pointer;
  vertical-align: middle;
  user-select: none;
}
.gapchip:hover { border-color: var(--accent); color: var(--text); }
.gapchip.cut {
  background: rgba(255, 92, 92, 0.16);
  border-color: var(--danger);
  border-style: solid;
  color: var(--danger);
  text-decoration: line-through;
}
.gapchip.excluded {
  background: rgba(245, 177, 76, 0.14);
  border-color: var(--warn);
  color: var(--warn);
}

.cfg-h {
  margin: 20px 0 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.spec-box {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--muted);
}

/* ── Cutcat 브랜드 ── */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 0.2px;
  color: var(--text);
  margin-right: 18px;
  user-select: none;
}
.brand .brand-cat { display: block; object-fit: contain; transform-origin: 50% 100%; animation: brandBounce 3.2s ease-in-out infinite; }
@keyframes brandBounce {
  0%, 86%, 100% { transform: translateY(0) scaleY(1) scaleX(1); }
  93% { transform: translateY(0) scaleY(0.87) scaleX(1.05); }
}
.brand .wordmark {
  background: linear-gradient(92deg, #ef8a1e 0%, #f5a63f 40%, #e6c49a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── 고양이 진행표시 (끝점의 쥐를 향해 달리는 고양이) ── */
.catprog { max-width: 100%; margin-top: 14px; }
.catprog-track { position: relative; height: 78px; }
.catprog-rail {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 12px; background: var(--panel-2); border-radius: 7px;
}
.catprog-fill {
  position: absolute; left: 0; bottom: 0;
  height: 12px; border-radius: 7px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}
/* 끝점의 쥐 — 살짝 떨며 고양이를 기다린다 */
.catprog-mouse { position: absolute; right: 0; bottom: 9px; }
.catprog-mouse svg { display: block; }
.catprog-mouse { animation: mouseTwitch 0.5s ease-in-out infinite; }
@keyframes mouseTwitch {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-1.5px); }
}
/* 달리는 고양이 — 진행률만큼 오른쪽으로, 멈춰 보여도 계속 달린다 */
.catprog-cat {
  position: absolute; bottom: 7px; left: 0;
  transform: translateX(-50%);
  transition: left 0.35s ease;
  will-change: left;
}
.catprog-cat svg { display: block; }
/* 첨부 얼굴 그대로(좌우 반전, 작게) */
.catprog-cat-img { display: block; width: 76px; height: auto; }
.catprog-cat.running { animation: catRun 0.34s ease-in-out infinite; }
@keyframes catRun {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-3px); }
}
.cat-leg { transform-box: fill-box; transform-origin: 50% 0%; }
.catprog-cat.running .legA { animation: gallop 0.34s linear infinite; }
.catprog-cat.running .legB { animation: gallop 0.34s linear infinite; animation-delay: -0.17s; }
@keyframes gallop {
  0%, 100% { transform: rotate(34deg); }
  50% { transform: rotate(-34deg); }
}
.cat-tail { transform-box: fill-box; transform-origin: 85% 90%; }
.catprog-cat.running .cat-tail { animation: tailFlick 0.5s ease-in-out infinite; }
@keyframes tailFlick {
  0%, 100% { transform: rotate(-7deg); }
  50% { transform: rotate(11deg); }
}
.catprog-label {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; font-size: 13px; color: var(--muted);
}
.catprog-pct { font-weight: 700; color: var(--accent-2); font-variant-numeric: tabular-nums; }

/* 웹 모드: 내보내기 다운로드 링크 */
.download-link {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--accent, #e8632a);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.download-link:hover {
  filter: brightness(1.08);
}

/* ── 1단계: 드래그&드롭 (로컬 파일 등록 — 업로드 없음) ── */
.step1.drag-over .dropzone,
.step1.drag-over .drop {
  border-color: var(--accent);
  background: #fff7ec;
}
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  background: var(--panel);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone-icon { font-size: 40px; }
.dropzone-title { font-size: 20px; font-weight: 600; margin-top: 10px; }
.dropzone-sub { color: var(--muted); margin-top: 6px; }

.drop.relink { border: 2px dashed var(--warn); }
.relink-box { text-align: center; padding: 18px 8px; }

.prep-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.prep-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--panel-2);
  overflow: hidden;
  display: inline-block;
}
.prep-bar > span {
  display: block;
  height: 100%;
  background: var(--accent-2);
  transition: width 0.2s;
}

/* ═══════ 에디터 셸(기본 화면) — 다크 NLE 룩 ═══════
   CSS 변수 오버라이드로 내부의 기존 컴포넌트들도 자동 재스킨된다. */
.nle {
  --bg: #f2f2f4;
  --panel: #ffffff;
  --panel-2: #f3f3f5;
  --border: #e4e4e8;
  --text: #1f2226;
  --muted: #82868d;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.nle-menubar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
/* 고양이 원본은 가로형(260×206) — 반드시 비율 유지(찌그러짐 금지) */
.nle-cat { filter: drop-shadow(0 1px 2px rgba(0,0,0,.2)); object-fit: contain; }
.home-hero img { object-fit: contain; }
/* 로고 글씨는 고양이 이미지와 같은 주황(악센트 레드와 무관) */
.nle-brand { font-weight: 800; color: #f5952b; letter-spacing: -0.02em; margin-right: 10px; }
.nle-grow { flex: 1; }
.nle-dim { color: var(--muted); font-weight: 400; }
.nle-badge {
  font-size: 12px; color: #1d7a3e; border: 1px solid #9fd4ae;
  border-radius: 20px; padding: 2px 10px;
}
.nle-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 13.5px;
  cursor: pointer;
}
.nle-btn:hover:not(:disabled) { border-color: var(--accent); }
.nle-btn:disabled { opacity: 0.4; cursor: default; }
.nle-btn.on { border-color: var(--accent); color: var(--accent); background: #fdecea; }
.nle-btn.pri {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 700;
}
.nle-btn.pri:hover:not(:disabled) { background: #ef6555; }

.nle-drawer {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  max-height: 46vh;
  overflow-y: auto;
  padding: 14px 20px 8px;
  position: relative;
}
.nle-drawer-body { max-width: 1100px; }
.nle-drawer-close {
  position: sticky; bottom: 6px; left: 100%;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--muted); border-radius: 8px; padding: 4px 10px; cursor: pointer;
}
.nle-switch { display: flex; flex-direction: column; gap: 10px; }
.nle-switch-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nle-label { color: var(--muted); font-size: 13px; width: 64px; }

.nle-content { flex: 1; min-height: 0; padding: 12px 14px; display: flex; flex-direction: column; overflow-y: auto; }
.nle-content > * { flex: 1; min-height: 0; }
.nle-ingest { overflow-y: auto; }
.nle-cta {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center; overflow-y: auto;
}
.nle-cta h2 { margin: 6px 0 0; }
.nle-cta-panel {
  margin-top: 14px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px 22px 18px; max-width: 760px; text-align: left;
  flex: none;
}

/* Step5 + 타임라인 래퍼 */
.edit-v-wrap { height: 100%; display: flex; flex-direction: column; gap: 8px; }
.edit-v-wrap > .edit-v { flex: 1; min-height: 0; }

/* 타임라인 */
.tl-root {
  flex: none;
  background: #fafafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 6px 2px;
}
.tl-scroll { position: relative; overflow-x: auto; overflow-y: hidden; cursor: crosshair; }
.tl-canvas { position: sticky; left: 0; top: 0; display: block; }
.tl-scroll > div:first-child { position: absolute; top: 0; left: 0; }
.tl-zoom { display: flex; align-items: center; gap: 6px; padding: 3px 4px; }
.tl-zoom button {
  background: #f3f3f5; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 1px 9px; font-size: 12px; cursor: pointer;
}
.tl-zoom button:hover { border-color: var(--accent); }
.tl-hint { color: var(--muted); font-size: 11px; margin-left: auto; }

/* 다크 셸 안의 기존 컴포넌트 소소한 보정 */
.nle .drop video { background: #000; }
.nle .step-pill { display: none; }
.nle input, .nle select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
}
.nle .spec-box { background: var(--panel-2); }

/* 내보내기 모달 */
.nle-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.nle-modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  width: min(860px, 92vw); max-height: 86vh; overflow-y: auto; padding: 16px 22px 22px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.16);
}
.nle-modal-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}

/* ═══════ 셀렉츠형 화면 (홈/미디어 준비/분석 중) ═══════ */
.home {
  display: flex; flex-direction: column; align-items: center;
  overflow-y: auto; padding: 40px 20px;
}
.home.drag-over { outline: 2px dashed var(--accent); outline-offset: -12px; border-radius: 16px; }
.home-hero { text-align: center; margin-top: 6vh; }
.home-hero h1 { font-size: 28px; margin: 14px 0 6px; letter-spacing: -0.01em; }
.home-sub { color: var(--muted); margin: 0 0 20px; }
.nle-btn.big { font-size: 16px; padding: 12px 26px; }
.home-recent { margin-top: 7vh; width: min(560px, 92%); }
.home-recent-label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.home-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
}
.home-card-thumb {
  width: 56px; height: 40px; border-radius: 6px; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.home-card-body { flex: 1; min-width: 0; }

/* 미디어 준비 */
.prep { display: flex; flex-direction: column; gap: 10px; height: 100%; min-height: 0; }
.prep-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
/* 가로 배치: 좌 컨트롤(타임라인 옆까지 전체 높이) | 우측(컬럼들 + 타임라인).
   폭이 모자라면 하단 가로 스크롤(컬럼 최소폭 유지). 경계는 드래그로 조절. */
.prep-main { display: flex; gap: 4px; flex: 1; min-height: 0; overflow-x: auto; }
/* 자막/미리보기 영역을 수동으로 키운 상태(tall): 화면에 맞추는 대신
   자연 높이로 커지고, 넘치는 만큼 페이지 전체가 위아래로 스크롤된다 */
.nle-content > .prep.tall { flex: none; height: auto; min-height: 100%; }
.prep.tall .prep-main { flex: none; min-height: 0; }
.prep-right {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  gap: 4px; min-height: 0;
}
.prep-cols { display: flex; gap: 4px; flex: 1; min-height: 0; }
.prep-ctrl, .prep-pool, .prep-preview, .prep-subs {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; overflow-y: auto; min-height: 0;
}
/* 폭: 드래그로 조절(flex-basis) + 창이 좁아지면 min-width 까지 함께 축소
   — 자막 줄 전체가 가로 스크롤 없이 보이게 한다 */
.prep-ctrl { flex: 0 1 355px; min-width: 236px; display: flex; flex-direction: column; gap: 14px; }
.prep-pool { flex: 0 1 260px; min-width: 176px; }
.prep-preview { flex: 1 1 280px; min-width: 280px; }
.prep-subs { flex: 0 1 365px; min-width: 220px; padding: 0; display: flex; }
/* 가로 리사이저(자막 영역 상하 높이 조절) */
.row-resize {
  flex: none; height: 6px; cursor: ns-resize; border-radius: 3px;
  transition: background .12s;
}
.row-resize:hover, .row-resize.active { background: var(--accent); opacity: .55; }
.col-resize {
  flex: 0 0 6px; cursor: col-resize; border-radius: 3px; align-self: stretch;
  transition: background .12s;
}
.col-resize:hover, .col-resize.active { background: var(--accent); opacity: .55; }
.pool-empty {
  border: 2px dashed var(--border); border-radius: 10px; padding: 26px 10px;
  text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px;
}
.pool-empty p { margin: 0; line-height: 1.6; }
.pool-row[draggable='true'] { cursor: grab; }
.pool-assign { display: flex; gap: 3px; }
.pool-assign .nle-btn { padding: 2px 6px; font-size: 11px; }
.pool-badge.hint { border-style: dashed; opacity: .75; }
.trk-area.over { outline: 2px dashed var(--accent); outline-offset: -2px; background: #fdecea; }
.trk-cut {
  position: absolute; top: 0; bottom: 0; z-index: 3; pointer-events: none;
  background: repeating-linear-gradient(-45deg, rgba(255,255,255,.78) 0 6px, rgba(229,72,61,.4) 6px 12px);
}
.ctrl-group { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ctrl-label { color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .3px; }
.ctrl-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ctrl-hint { margin: 0; font-size: 11.5px; line-height: 1.5; }
.ctrl-nudge { display: flex; flex-direction: column; gap: 4px; }
.ctrl-nudge-pair { display: flex; align-items: center; gap: 6px; }
.ctrl-nudge-pair .nle-btn { padding: 2px 9px; font-size: 12px; }
.ctrl-nudge-pair > .nle-dim { width: 52px; text-align: center; font-size: 11.5px; }
.ctrl-progress {
  width: 100%; height: 10px; border-radius: 5px; background: #ececef;
  border: 1px solid var(--border); overflow: hidden;
}
.ctrl-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), #f2705f);
  transition: width .6s ease;
}
.prep-list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pool-row {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; margin: 6px 0; cursor: pointer; font-size: 13.5px;
}
.pool-row:hover, .pool-row.sel { border-color: var(--accent); }
.pool-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-meta { color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.pool-badge {
  font-style: normal; font-size: 11px; border-radius: 4px; padding: 0 5px;
  border: 1px solid #aabde0; color: #3d5a94;
}
.pool-badge.side { border-color: #dab77a; color: #9c6b1f; }
.pool-badge.side.ok { border-color: #9fd4ae; color: #1d7a3e; }
.pool-prog { font-size: 12px; color: var(--accent); }
.pool-del {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid transparent; background: none; color: var(--muted);
  font-size: 12px; line-height: 1; cursor: pointer; opacity: 0;
  transition: opacity .12s;
}
.pool-row:hover .pool-del, .pool-row.sel .pool-del { opacity: 1; }
.pool-del:hover { color: #d5443c; border-color: #f0b1ac; background: rgba(229, 72, 61, .08); }
.prep-preview { display: flex; align-items: center; justify-content: center; padding: 8px; overflow: hidden; }
.prep-preview-empty { color: var(--muted); margin: auto; }

/* 멀티캠 A/B 미리보기 */
.mcp { display: flex; flex-direction: column; gap: 8px; width: 100%; height: 100%; min-height: 0; }
.mcp-stage {
  position: relative; flex: 1; min-height: 0; background: #000;
  border-radius: 8px; overflow: hidden; cursor: pointer;
}
.mcp-stage video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; /* 전환은 하드컷(디졸브 없음) */
}
.mcp-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 6px;
  background: rgba(40, 70, 140, .85); color: #cfe0ff; pointer-events: none;
}
.mcp-badge.b { background: rgba(140, 95, 30, .85); color: #ffe2b0; }
.mcp-playhint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 44px; color: rgba(255,255,255,.75); pointer-events: none; z-index: 1;
}
.mcp-bar { display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; }
.mcp-bar input[type=range] { flex: 1; min-width: 120px; accent-color: var(--accent); }
.mcp-time { font-variant-numeric: tabular-nums; font-size: 12px; }
.mcp-jumps { display: flex; gap: 4px; }

/* 자막 패널 */
.subs { display: flex; flex-direction: column; min-height: 0; width: 100%; outline: none; }
.subs-head {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border); flex: none;
}
.subs-body { flex: 1; overflow-y: auto; padding: 10px 14px; min-height: 0; user-select: none; }
.subs-sent { margin: 0 0 10px; line-height: 1.9; font-size: 14.5px; }
.subs-spk {
  font-style: normal; font-size: 10.5px; font-weight: 700; color: #9c6b1f;
  border: 1px solid #dab77a; border-radius: 4px; padding: 0 4px; margin-right: 6px;
  vertical-align: 2px;
}
.subs-word { margin-right: .35em; display: inline-block; }
/* 단어(어절) 단위 선택·하이라이트 */
.subs-word-unit { cursor: pointer; border-radius: 4px; padding: 1px 2px; }
.subs-word-unit:hover { background: rgba(229, 72, 61, .1); }
.subs-word-unit.off { opacity: .38; }
.subs-word-unit.sel { background: var(--accent); }
.subs-word-unit.sel .subs-syl { color: #fff; }
.subs-word-unit.sel.off { background: #eba59d; opacity: .8; }
.subs-word-unit.play { background: rgba(70, 130, 240, .18); box-shadow: 0 0 0 1px rgba(70,130,240,.45); }
.subs-syl { border-radius: 3px; }
.subs-syl.off { color: #a6a29d; text-decoration: line-through; }
.subs-syl.off.auto-filler { color: #c2691f; }
.subs-syl.off.auto-retake, .subs-syl.off.auto-meta { color: #8a8a8a; }
.subs-syl.flag { border-bottom: 2px solid #d1a41f; }
/* 삭제 "후보"(자동으로 지우지 않음 — 사용자 결정): 글자는 정상, 점선 밑줄로만 힌트 */
.subs-syl.cand-filler { border-bottom: 2px dotted #c2691f; }
.subs-syl.cand-retake, .subs-syl.cand-meta { border-bottom: 2px dotted #9a9a9a; }
/* 소리 칩(〰): 자막에 없는 실측 소리 — 무음(…)과 구분되는 보라 계열 */
.subs-gap.snd { color: #7a5bd6; border-color: #b9a7ef; background: #f2edff; }
/* 무음 '…' 칩 — 단어처럼 선택·Backspace 삭제 */
.subs-gap {
  display: inline-block; cursor: pointer; margin: 0 2px; padding: 0 6px;
  border-radius: 8px; font-size: 11.5px; color: #8b8680;
  background: #f4f3f1; border: 1px dashed #cfc9c0; vertical-align: 1px;
}
.subs-gap:hover { border-color: var(--accent); color: var(--accent); }
.subs-gap.auto { border-style: solid; border-color: #e3bc80; color: #b06a1c; background: #fdf4e6; }
.subs-gap.keep { border-style: solid; border-color: #9fd4ae; color: #1d7a3e; background: #eef8f0; }
.subs-gap.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
.subs-gap.off { opacity: .38; text-decoration: line-through; }
.subs-gap.off.sel { opacity: .75; }
.subs-legend { padding: 0 3px; }
.subs-legend.auto-filler { color: #c2691f; }
.subs-legend.auto-retake { color: #9a9a9a; }
.subs-foot {
  margin: 0; padding: 8px 14px 12px; font-size: 11.5px; line-height: 1.5;
  border-top: 1px solid var(--border); flex: none;
}
.subs-wait { padding: 14px 16px; }
.subs-wait p { font-size: 13px; line-height: 1.6; }

/* 준비 화면 간이 타임라인 */
.prep-tl {
  flex: none; background: #fafafb; border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px;
}
.prep-tl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; }
.tl-zoom-ctl { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.tl-zoom-ctl .nle-btn { padding: 1px 9px; font-size: 12px; }
/* 확대된 타임라인의 가로 스크롤 컨테이너 — 라벨은 왼쪽에 고정(sticky) */
.prep-tl-scroll { overflow-x: auto; }
.trk-row { display: flex; align-items: center; gap: 10px; margin: 5px 0; }
.trk-label {
  width: 110px; text-align: right; color: var(--muted); font-size: 11px; flex: none;
  position: sticky; left: 0; z-index: 5; background: #fafafb;
}
.trk-area { position: relative; flex: 1; height: 48px; background: #ececef; border-radius: 5px; overflow: hidden; }
.trk-row.video .trk-area { height: 54px; }
.trk-thumbs {
  position: absolute; inset: 0; display: flex; overflow: hidden;
}
.trk-thumbs img {
  flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover;
  pointer-events: none; user-select: none;
}
.trk-name {
  position: absolute; left: 6px; bottom: 3px; font-size: 10px;
  color: rgba(255,255,255,.9); background: rgba(0,0,0,.45);
  padding: 1px 6px; border-radius: 4px; max-width: 70%;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.trk-wave { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.trk-clip {
  position: absolute; top: 0; height: 100%; border-radius: 4px;
  font-size: 10px; color: rgba(255,255,255,.85); padding: 4px 8px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.trk-clip.v1 { background: repeating-linear-gradient(90deg, #35507e 0 16px, #3d5a8c 16px 32px); }
.trk-clip.v2 { background: repeating-linear-gradient(90deg, #7e5a24 0 16px, #8c6529 16px 32px); }
.trk-clip.a, .trk-clip.a2 { background: linear-gradient(180deg, #2c4066, #1d2b45); color: #7ba2e0; letter-spacing: 2px; }
.trk-clip.a2 { background: linear-gradient(180deg, #5d451c, #3c2d13); color: #d9a75c; }
.trk-empty { color: var(--muted); font-size: 11px; line-height: 48px; padding-left: 10px; }
.nle-brand-wrap { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* 분석 중 */
.analyze {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; overflow-y: auto;
}
.analyze h2 { margin: 0; }
.analyze-steps { font-size: 14px; }

/* 배포 확인 배지 — 모든 화면 우하단 상시 표시(요청: 새 배포 적용 여부를
   어느 화면에서든 즉시 확인). 클릭 방해 없도록 포인터 통과 */
.ver-badge {
  position: fixed;
  right: 10px;
  bottom: 8px;
  z-index: 60;
  font-size: 11.5px;
  color: #9a938a;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid #eee6da;
  border-radius: 999px;
  padding: 3px 10px;
  pointer-events: none;
  user-select: none;
}

/* 새 버전이 방금 적용된 순간 — 8초간 크게 강조(변화가 눈에 보이게) */
.ver-badge.fresh {
  font-size: 15px;
  color: #fff;
  background: #e2483d;
  border-color: #e2483d;
  padding: 8px 16px;
  box-shadow: 0 4px 16px rgba(226, 72, 61, 0.35);
}
