*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Scrollbar — dark mode friendly */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* Dark mode (default) — neutral gray */
:root, [data-theme="dark"] {
  --bg: #121212;
  --surface: #1a1a1a;
  --surface2: #242424;
  --surface3: #2e2e2e;
  --text: #d4d4d4;
  --text-strong: #f0f0f0;
  --text-muted: #7a7a7a;
  --accent: #ff6b81;
  --accent-subtle: rgba(255,107,129,0.08);
  --accent2: #484848;
  --border: #2a2a2a;
  --border-strong: #3a3a3a;
  --broll-bg: rgba(255,255,255,0.015);
  --tag-inactive-bg: rgba(255,255,255,0.04);
  --modal-overlay: rgba(0,0,0,0.65);
  --input-bg: #161616;
  --tag-screen: #c084fc;
  --tag-separate: #38bdf8;
  --tag-stock: #34d399;
  --tag-custom: #818cf8;
}

/* Light mode — warm cream */
[data-theme="light"] {
  --bg: #f8f5f0;
  --surface: #ffffff;
  --surface2: #f2ede6;
  --surface3: #e8e2da;
  --text: #37352f;
  --text-strong: #1a1a1a;
  --text-muted: #9b9689;
  --accent: #c9304e;
  --accent-subtle: rgba(201,48,78,0.06);
  --accent2: #d4cdc2;
  --border: #e3ddd4;
  --border-strong: #d1c9be;
  --broll-bg: rgba(0,0,0,0.018);
  --tag-inactive-bg: rgba(0,0,0,0.035);
  --modal-overlay: rgba(0,0,0,0.25);
  --input-bg: #faf8f5;
  --tag-screen: #9333ea;
  --tag-separate: #0284c7;
  --tag-stock: #059669;
  --tag-custom: #4f46e5;
}

body {
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 {
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.header-actions { display: flex; gap: 6px; align-items: center; }

/* ── Buttons ── */
.btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface3); border-color: var(--border-strong); }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent;
  border-radius: 6px; color: var(--text-muted); cursor: pointer; font-size: 14px;
  transition: all 0.15s;
}
.btn-icon:hover { color: var(--text); background: var(--surface3); border-color: var(--border); }
.btn-icon.danger:hover { color: var(--accent); }

/* ── Theme toggle ── */
.theme-toggle {
  width: 32px; height: 32px; border-radius: 6px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: all 0.15s;
}
.theme-toggle:hover { background: var(--surface3); color: var(--text); }

/* ── Upload area ── */
.upload-area {
  max-width: 700px; margin: 80px auto; padding: 60px 40px;
  border: 2px dashed var(--border); border-radius: 12px;
  text-align: center; transition: all 0.2s;
}
.upload-area.dragover { border-color: var(--accent); background: rgba(233,69,96,0.05); }
.upload-area h2 { font-size: 20px; margin-bottom: 8px; }
.upload-area p { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
.upload-area .file-types { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; }
.file-type-badge { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.file-type-badge.md { background: rgba(168,85,247,0.15); color: #a855f7; }
.file-type-badge.html { background: rgba(233,69,96,0.15); color: var(--accent); }
.upload-btn-wrapper { position: relative; display: inline-block; }
.upload-btn-wrapper input[type="file"] {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}

/* ── Main layout with TOC ── */
.app-layout {
  display: flex;
  min-height: calc(100vh - 48px);
}

/* ── TOC Sidebar ── */
.toc-sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 48px;
  height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 16px 0;
  transition: width 0.2s, min-width 0.2s, padding 0.2s;
}
.toc-sidebar.collapsed {
  width: 40px; min-width: 40px; padding: 16px 0;
}
.toc-sidebar.collapsed .toc-content { display: none; }

.toc-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 4px 0; margin-bottom: 12px;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px;
}
.toc-toggle:hover { color: var(--text); }

.toc-header {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-muted);
  padding: 0 16px; margin-bottom: 12px;
}

.toc-item {
  display: block; width: 100%;
  padding: 7px 16px; border: none; background: none;
  color: var(--text-muted); font-size: 12px; font-weight: 500;
  cursor: pointer; text-align: left;
  border-left: 2px solid transparent;
  transition: all 0.12s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toc-item:hover { color: var(--text); background: var(--accent-subtle); }
.toc-item.active {
  color: var(--accent); border-left-color: var(--accent);
  background: var(--accent-subtle); font-weight: 600;
}
.toc-item.meta-item {
  font-weight: 600; color: var(--text-muted); font-size: 11px;
  margin-bottom: 4px;
}
/* TOC drag */
.toc-item { display: flex; align-items: center; gap: 4px; }
.toc-item .toc-grip {
  cursor: grab; color: var(--border-strong); font-size: 10px;
  flex-shrink: 0; width: 14px; text-align: center;
  opacity: 0; transition: opacity 0.15s;
}
.toc-item:hover .toc-grip { opacity: 1; }
.toc-item .toc-grip:active { cursor: grabbing; }
.toc-item .toc-label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.toc-item.drag-over { border-bottom: 2px solid var(--accent); }
.toc-item.dragging { opacity: 0.4; }

.toc-item.toc-level-1 {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 10px 16px 5px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  margin-top: 6px;
}
.toc-item.toc-level-1:first-of-type { margin-top: 0; }
.toc-item.toc-level-2 { padding-left: 24px; }
.toc-item.toc-level-3 { padding-left: 36px; font-size: 11px; color: var(--text-muted); }

/* ── Main content ── */
.main-content { flex: 1; min-width: 0; }

/* ── Sticky meta area ── */
.meta-area {
  position: sticky;
  top: 48px;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
}
.meta-field { display: flex; align-items: center; gap: 10px; }
.meta-field label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  min-width: 42px; text-align: right;
  letter-spacing: 0.2px;
}
.meta-field input {
  flex: 1; padding: 7px 12px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 13px; font-family: inherit;
  transition: border-color 0.15s;
}
.meta-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.meta-field.full { grid-column: 1 / -1; }
.meta-field.full input { font-size: 15px; font-weight: 600; color: var(--text-strong); }

/* ── Sections ── */
.sections-container { padding: 16px 20px; }

.section-block {
  margin-bottom: 6px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.15s;
}
.section-block:focus-within { border-color: var(--border-strong); }

/* Section control bar */
.section-control {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.section-title-input {
  flex: 1; padding: 5px 10px;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--accent); font-size: 14px; font-weight: 600; font-family: inherit;
  transition: all 0.15s;
}
.section-title-input:hover { background: var(--surface); border-color: var(--border); }
.section-title-input:focus { outline: none; background: var(--input-bg); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.section-control-spacer { flex: 1; }

/* Section body: 3 columns (script | handle | broll) */
.section-body {
  display: grid;
  grid-template-columns: var(--col-ratio, 60%) 6px 1fr;
}

/* Level 1: divider style — no body */
.section-block.level-1 {
  border: none; border-radius: 0;
  background: transparent;
  margin: 16px 0 4px;
}
.section-block.level-1 .section-control {
  background: transparent; border: none;
  padding: 4px 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-block.level-1 .section-title-input {
  font-size: 13px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1.5px;
}
.section-block.level-1 .section-body { display: none; }

/* Level 3: sub-item style */
.section-block.level-3 {
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  margin-left: 16px;
}
.section-block.level-3 .section-title-input {
  font-size: 13px; color: var(--text);
}

/* Resize handle */
.resize-handle {
  cursor: col-resize;
  background: var(--border);
  transition: background 0.15s;
  position: relative;
}
.resize-handle:hover, .resize-handle.dragging {
  background: var(--accent);
}
.resize-handle::after {
  content: ''; position: absolute;
  left: -4px; right: -4px; top: 0; bottom: 0;
}

/* Level badge in control bar */
.level-badge {
  padding: 2px 6px; font-size: 10px; font-weight: 700;
  background: var(--surface3); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 4px;
  cursor: pointer; user-select: none;
  min-width: 26px; text-align: center;
  transition: all 0.12s; line-height: 1.4;
}
.level-badge:hover { color: var(--text); border-color: var(--border-strong); }

/* Multi-select */
.section-check {
  width: 16px; height: 16px; accent-color: var(--accent);
  cursor: pointer; flex-shrink: 0;
}
.section-block.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.bulk-bar {
  position: sticky; bottom: 0; z-index: 60;
  display: none; align-items: center; gap: 10px;
  padding: 10px 20px;
  background: var(--surface); border-top: 1px solid var(--accent);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.2);
}
.bulk-bar.show { display: flex; }
.bulk-bar span { font-size: 12px; color: var(--text); font-weight: 600; }
.level-badge.l1 { color: var(--accent); border-color: var(--accent); background: var(--accent-subtle); }
.level-badge.l2 { }
.level-badge.l3 { font-size: 9px; }

.section-script {
  padding: 16px 20px;
  border-right: 1px solid var(--border);
}
.script-textarea {
  width: 100%; min-height: 100px;
  padding: 12px 14px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 13px; font-family: inherit;
  line-height: 1.85; resize: vertical;
  transition: border-color 0.15s;
}
.script-textarea:focus { outline: none; border-color: var(--accent2); box-shadow: 0 0 0 2px var(--accent-subtle); }
.script-textarea::placeholder { color: var(--text-muted); }

/* B-roll panel */
.section-broll {
  padding: 16px 20px;
  background: var(--broll-bg);
  display: flex;
  flex-direction: column;
}
.broll-label { display: none; }
.tags-area { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tag-btn {
  padding: 4px 11px; border-radius: 6px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1.5px solid transparent; transition: all 0.15s; user-select: none;
}
.tag-btn.inactive { background: var(--tag-inactive-bg); color: var(--text-muted); border-color: var(--border); }
.tag-btn.active[data-tag-type="screen"]    { background: var(--tag-screen); color: #fff; border-color: var(--tag-screen); }
.tag-btn.active[data-tag-type="separate"]  { background: var(--tag-separate); color: #fff; border-color: var(--tag-separate); }
.tag-btn.active[data-tag-type="stock"]     { background: var(--tag-stock); color: #fff; border-color: var(--tag-stock); }
.tag-btn.active[data-tag-type="custom"]    { background: var(--tag-custom); color: #fff; border-color: var(--tag-custom); }
.tag-btn:hover { opacity: 0.85; }
.add-tag-btn {
  padding: 4px 9px; border-radius: 6px; font-size: 11px;
  cursor: pointer; background: transparent; color: var(--text-muted);
  border: 1.5px dashed var(--border);
}
.add-tag-btn:hover { border-color: var(--text-muted); color: var(--text); }
.add-tag-input {
  padding: 3px 9px; border-radius: 6px; font-size: 11px;
  background: var(--input-bg); color: var(--text);
  border: 1.5px solid var(--accent); outline: none; width: 90px;
}
.broll-memo {
  width: 100%; min-height: 70px; flex: 1; padding: 10px 12px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 12px; font-family: inherit;
  line-height: 1.7; resize: vertical;
  transition: border-color 0.15s;
}
.tags-area { margin-top: 10px; }
.broll-memo:focus { outline: none; border-color: var(--accent2); box-shadow: 0 0 0 2px var(--accent-subtle); }
.broll-memo::placeholder { color: var(--text-muted); }

/* ── Add section button between blocks ── */
.add-section-divider {
  display: flex; align-items: center; justify-content: center;
  padding: 3px 0;
  opacity: 0;
  transition: opacity 0.2s;
}
.sections-container:hover .add-section-divider { opacity: 1; }
.add-section-divider:hover { opacity: 1 !important; }
.add-section-divider button {
  padding: 3px 14px; font-size: 11px; color: var(--text-muted);
  background: none; border: 1px dashed transparent; border-radius: 6px;
  cursor: pointer; transition: all 0.15s;
}
.add-section-divider button:hover {
  color: var(--accent); border-color: var(--accent); background: var(--accent-subtle);
}

/* ── Help modal ── */
.help-content { max-height: 70vh; overflow-y: auto; font-size: 13px; line-height: 1.7; }
.help-content h4 { font-size: 14px; color: var(--accent); margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.help-content h4:first-child { margin-top: 0; }
.help-content p { margin-bottom: 8px; color: var(--text); }
.help-content kbd {
  display: inline-block; padding: 1px 6px; font-size: 11px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 4px; font-family: inherit; color: var(--text-muted);
}
.help-content ul { margin: 4px 0 8px 16px; }
.help-content li { margin-bottom: 4px; }
.help-content .help-tag {
  display: inline-block; padding: 1px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; color: #fff; vertical-align: middle;
}

/* ── Export modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: var(--modal-overlay); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; width: 420px; max-width: 90vw;
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.modal label { font-size: 13px; color: var(--text-muted); display: block; margin-bottom: 6px; }
.modal input[type="text"] {
  width: 100%; padding: 9px 12px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px; margin-bottom: 16px;
  font-family: inherit;
}
.modal input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Runtime display ── */
.runtime-display {
  font-size: 11px; color: var(--text-muted); font-weight: 500;
  padding: 4px 10px; background: var(--surface2);
  border-radius: 5px; border: 1px solid var(--border);
  white-space: nowrap;
}
.section-runtime {
  font-size: 10px; color: var(--text-muted); font-weight: 500;
  margin-left: auto; white-space: nowrap;
}

/* ── Checklist modal ── */
.checklist-modal { max-height: 70vh; overflow-y: auto; }
.checklist-group { margin-bottom: 16px; }
.checklist-group-title {
  font-size: 12px; font-weight: 700; color: var(--accent);
  margin-bottom: 6px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.checklist-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 4px 0; font-size: 12px; color: var(--text);
}
.checklist-item input[type="checkbox"] { margin-top: 2px; accent-color: var(--accent); }
.checklist-item .cl-section { color: var(--text-muted); font-size: 11px; }

/* ── Script mode (teleprompter) ── */
.script-mode {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: #000; color: #e0e0e0;
  flex-direction: column;
}
.script-mode.show { display: flex; }

.script-mode-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px;
  background: #111; border-bottom: 1px solid #333;
  flex-shrink: 0;
}
.script-mode-toolbar button {
  padding: 6px 14px; border-radius: 6px; border: 1px solid #444;
  background: #222; color: #ccc; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.script-mode-toolbar button:hover { background: #333; color: #fff; }
.script-mode-toolbar button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.script-mode-toolbar .speed-label {
  font-size: 11px; color: #888; margin-left: auto;
}
.script-mode-toolbar .speed-value {
  font-size: 13px; color: #fff; font-weight: 600; min-width: 60px; text-align: center;
}

.script-mode-content {
  flex: 1; overflow-y: auto; padding: 60px 80px;
  font-size: 24px; line-height: 1.8;
  scroll-behavior: smooth;
}
.script-mode-content .sm-divider {
  text-align: center; padding: 30px 0 16px;
  font-size: 14px; font-weight: 700; color: #555;
  text-transform: uppercase; letter-spacing: 2px;
  border-top: 1px solid #333; margin-top: 20px;
}
.script-mode-content .sm-section-title {
  font-size: 18px; font-weight: 700; color: var(--accent);
  margin: 24px 0 12px; padding-bottom: 6px;
  border-bottom: 1px solid #333;
}
.script-mode-content .sm-sentence {
  display: inline;
  transition: color 0.3s, background 0.3s;
  border-radius: 4px; padding: 2px 0;
}
.script-mode-content .sm-sentence.dim { color: #444; }
.script-mode-content .sm-sentence.current {
  color: #fff; background: rgba(255,107,129,0.15);
}
.script-mode-content .sm-sentence.done { color: #666; }

/* ── Print styles ── */
@media print {
  body { background: #fff !important; color: #000 !important; font-size: 12pt; }
  .header, .toc-sidebar, .meta-area, #uploadScreen, .modal-overlay,
  .script-mode-toolbar, #saveIndicator, #recoveryBanner,
  .add-section-divider, .section-control, .resize-handle,
  .section-broll { display: none !important; }
  .app-layout { display: block !important; }
  .main-content { width: 100% !important; }
  .sections-container { padding: 0 !important; }
  .section-block { border: none !important; margin-bottom: 12pt !important; page-break-inside: avoid; }
  .section-body { display: block !important; }
  .section-script { border: none !important; padding: 0 !important; }
  .script-textarea { border: none !important; padding: 0 !important; background: transparent !important; font-size: 12pt; }
  .script-mode-content { padding: 20px !important; font-size: 12pt !important; color: #000 !important; }
  .script-mode-content .sm-sentence,
  .script-mode-content .sm-sentence.dim,
  .script-mode-content .sm-sentence.done { color: #000 !important; background: none !important; }
  .sm-divider { color: #666 !important; border-color: #ccc !important; }
  .sm-section-title { color: #333 !important; border-color: #ccc !important; }
}

/* ── Landing page ── */
.landing { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100vh - 48px); padding: 40px 20px; }
.landing-cards { display: flex; gap: 24px; max-width: 800px; width: 100%; }
.landing-card {
  flex: 1; padding: 40px 32px; background: var(--surface); border: 2px solid var(--border);
  border-radius: 16px; cursor: pointer; transition: all 0.2s; text-align: center;
}
.landing-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.landing-card.dragover { border-color: var(--accent); background: var(--accent-subtle); }
.landing-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--text-strong); }
.landing-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; }
.landing-card .drop-hint {
  padding: 12px; border: 1.5px dashed var(--border); border-radius: 8px;
  font-size: 12px; color: var(--text-muted); margin-top: 12px;
}
.landing-card .drop-hint strong { color: var(--text); }
.landing-card .file-input-wrap { position: relative; display: inline-block; margin-top: 8px; }
.landing-card .file-input-wrap input[type="file"] {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}

/* ── Writing mode ── */
.writing-layout {
  display: flex; min-height: calc(100vh - 48px);
}
.bench-panel {
  flex: 1; border-right: 1px solid var(--border); display: flex; flex-direction: column;
  min-width: 0;
}
.bench-tabs {
  display: flex; gap: 0; background: var(--surface2); border-bottom: 1px solid var(--border);
}
.bench-tab {
  padding: 8px 16px; font-size: 12px; font-weight: 600; cursor: pointer;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); transition: all 0.15s;
}
.bench-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.bench-tab:hover { color: var(--text); }
.bench-tab-add {
  padding: 8px 12px; font-size: 14px; color: var(--text-muted);
  background: none; border: none; cursor: pointer;
}
.bench-tab-add:hover { color: var(--accent); }
.bench-content {
  flex: 1; overflow-y: auto; padding: 20px; font-size: 13px; line-height: 1.8;
  color: var(--text); white-space: pre-wrap;
}
.bench-content .timestamp {
  display: inline-block; color: var(--accent); font-size: 11px;
  font-weight: 600; margin-right: 6px; opacity: 0.7;
}
.bench-upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; padding: 40px; text-align: center; color: var(--text-muted);
}
.bench-upload p { margin-bottom: 12px; font-size: 13px; }
.my-script-panel {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
}

/* ─────────────────────────────────────────────────
   v3: Home, Project Shell, Chapters
   ───────────────────────────────────────────────── */

/* ── Home ── */
.home-layout {
  max-width: 960px; margin: 0 auto; padding: 32px 24px;
}
.home-actions {
  display: flex; gap: 8px; margin-bottom: 32px;
}
.home-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.home-section-header h2 {
  font-size: 15px; font-weight: 700; color: var(--text-strong);
}
.project-list {
  display: flex; flex-direction: column; gap: 8px;
}
.project-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; transition: all 0.15s;
}
.project-card:hover { border-color: var(--border-strong); }
.project-card-main {
  flex: 1; cursor: pointer;
}
.project-card-title {
  font-size: 15px; font-weight: 600; color: var(--text-strong);
  margin-bottom: 4px;
}
.project-card-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-muted);
}
.chapter-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--tag-inactive-bg); border: 1px solid var(--border);
  font-size: 10px; font-weight: 700; color: var(--text-muted);
}
.chapter-dot.done {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.project-card-time { margin-left: 8px; }
.project-card-actions { display: flex; gap: 2px; }

.empty-state {
  text-align: center; padding: 60px 20px;
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: 10px; color: var(--text);
}
.empty-state p:first-child { font-size: 15px; font-weight: 600; color: var(--text-muted); }

.migration-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 24px;
  background: var(--accent-subtle); border-bottom: 1px solid var(--accent);
  font-size: 13px; color: var(--text);
}

/* ── Project Shell ── */
.project-name-input {
  padding: 6px 10px; font-size: 14px; font-weight: 600;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-strong); font-family: inherit;
  min-width: 280px; transition: all 0.15s;
}
.project-name-input:hover { border-color: var(--border); }
.project-name-input:focus {
  outline: none; background: var(--input-bg); border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

/* ── Context bar (sticky) ── */
.context-bar {
  position: sticky; top: 48px; z-index: 50;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.context-item {
  display: flex; align-items: baseline; gap: 6px;
  max-width: 28%; overflow: hidden;
}
.context-label {
  color: var(--text-muted); font-weight: 600; font-size: 11px;
  white-space: nowrap; flex-shrink: 0;
}
.context-value {
  color: var(--text); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.context-edit-btn {
  margin-left: auto; padding: 4px 10px; font-size: 11px; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 5px;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.context-edit-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Chapter tabs ── */
.chapter-tabs {
  position: sticky; top: 48px; z-index: 49;
  display: flex; gap: 0; padding: 0 24px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.chapter-panel:has(+ .context-bar) ~ .chapter-tabs,
.context-bar + .chapter-tabs { top: 86px; }

.chapter-tab {
  padding: 12px 20px; font-size: 13px; font-weight: 600;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 8px;
}
.chapter-tab:hover:not(.locked) { color: var(--text); }
.chapter-tab.active {
  color: var(--accent); border-bottom-color: var(--accent);
}
.chapter-tab.locked { opacity: 0.5; cursor: not-allowed; }
.chapter-tab.completed .chapter-tab-status { color: var(--accent); }
.chapter-tab-status { font-size: 10px; opacity: 0.7; }

/* ── Chapter panels ── */
.chapter-panel { min-height: calc(100vh - 140px); }
.chapter-body {
  max-width: 900px; margin: 0 auto; padding: 24px;
}
.chapter-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; border-top: 1px solid var(--border);
  background: var(--surface); position: sticky; bottom: 0;
}

/* ── Chapter 1 ── */
.c1-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px 24px; margin-bottom: 16px;
}
.c1-section h2 {
  font-size: 15px; font-weight: 700; color: var(--text-strong);
  margin-bottom: 6px;
}
.c1-section .section-desc {
  font-size: 12px; color: var(--text-muted); margin-bottom: 14px;
}
.c1-hint { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.c1-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
.c1-field { display: flex; flex-direction: column; gap: 6px; }
.c1-field label {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.c1-field input {
  padding: 9px 12px; font-size: 14px; font-family: inherit;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); transition: border-color 0.15s;
}
.c1-field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}
.c1-essence {
  border-left: 3px solid var(--accent);
}
.c1-essence .c1-field { margin-bottom: 10px; }

/* ── Ref grid (썸네일 수집 — 바둑판/전광판) ── */
/* Chapter 1에서는 콘텐츠 최대폭을 넓게 써서 썸네일을 더 크게 */
#chapter1 .chapter-body { max-width: 1400px; }

/* Quick add: YouTube URL input */
.ref-quick-add {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: 16px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color 0.15s;
}
.ref-quick-add:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle);
}
.ref-quick-add-icon {
  font-size: 14px; color: var(--text-muted); padding: 0 4px;
}
.ref-quick-add input {
  flex: 1; padding: 8px 10px; font-size: 13px;
  background: transparent; border: none; color: var(--text);
  font-family: inherit; outline: none;
}
.ref-quick-add input::placeholder { color: var(--text-muted); }
.ref-quick-add .btn { flex-shrink: 0; padding: 8px 18px; font-size: 13px; }

.ref-grid {
  display: grid;
  /* 카드 최소 너비 280px → 화면 크기에 따라 자동 2x2 / 3x3 / 4x4 */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.ref-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; position: relative;
  transition: border-color 0.15s, transform 0.15s;
}
.ref-card:hover {
  border-color: var(--border-strong);
}
.ref-image {
  position: relative;
  width: 100%; aspect-ratio: 16/9; background: var(--bg);
  border-radius: 8px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.ref-image img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.ref-placeholder { color: var(--text-muted); font-size: 11px; }
.ref-image-link {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); color: #fff;
  border-radius: 6px; text-decoration: none;
  font-size: 14px; font-weight: 600;
  transition: all 0.15s;
}
.ref-image-link:hover {
  background: var(--accent); transform: scale(1.08);
}

.ref-title {
  padding: 7px 10px; font-size: 14px; font-weight: 600;
  background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 6px; color: var(--text-strong);
  font-family: inherit;
  transition: border-color 0.15s;
}
.ref-title:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

.ref-url-row {
  display: flex; align-items: center; gap: 6px;
}
.ref-url-icon {
  font-size: 11px; color: var(--text-muted); flex-shrink: 0;
}
.ref-url {
  flex: 1; padding: 5px 8px; font-size: 11px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 5px;
  color: var(--text-muted); font-family: inherit;
  transition: all 0.15s;
}
.ref-url:focus {
  outline: none; color: var(--text); border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}
.ref-url-open {
  flex-shrink: 0; width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface2); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 4px;
  text-decoration: none; font-size: 11px;
  transition: all 0.15s;
}
.ref-url-open:hover {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

.ref-memo {
  padding: 7px 9px; font-size: 11px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 5px; color: var(--text);
  font-family: inherit; line-height: 1.55; resize: vertical; min-height: 40px;
  transition: border-color 0.15s;
}
.ref-memo:focus { outline: none; border-color: var(--accent); }
.ref-memo::placeholder, .ref-title::placeholder, .ref-url::placeholder {
  color: var(--text-muted);
}

.ref-delete {
  position: absolute; top: 8px; left: 8px;
  width: 24px; height: 24px;
  background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 5px;
  cursor: pointer; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: all 0.15s;
}
.ref-card:hover .ref-delete { opacity: 1; }
.ref-delete:hover { background: var(--accent); }

/* Ref card meta (channel · date · duration) */
.ref-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-muted); line-height: 1.4;
  padding: 0 2px;
}

/* Loading overlay */
.ref-loading {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.ref-loading-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: yw-spin 0.8s linear infinite;
}
@keyframes yw-spin { to { transform: rotate(360deg); } }

/* Add card — same size as ref cards */
.ref-add-card {
  display: flex; align-items: center; justify-content: center;
  min-height: 100%; cursor: pointer; border: 2px dashed var(--border);
  background: transparent; transition: all 0.15s;
  /* Match aspect of other cards by using image aspect + fields */
  aspect-ratio: auto;
}
.ref-add-card:hover, .ref-add-card.dragover {
  border-color: var(--accent); background: var(--accent-subtle);
}
.ref-add-content {
  text-align: center; color: var(--text-muted); padding: 24px 16px;
}
.ref-add-icon {
  font-size: 42px; font-weight: 300; color: var(--text-muted);
  margin-bottom: 12px; line-height: 1;
}
.ref-add-text strong {
  display: block; font-size: 14px; color: var(--text); margin-bottom: 6px;
}
.ref-add-text div { font-size: 11px; }
.ref-add-card input { display: none; }
.ref-limit {
  grid-column: 1 / -1; text-align: center; padding: 20px;
  color: var(--text-muted); font-size: 12px;
}

/* My thumbnail preview */
.my-thumb-preview {
  position: relative; display: inline-block; max-width: 300px;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--border);
}
.my-thumb-preview img { display: block; width: 100%; }
.my-thumb-remove {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  background: rgba(0,0,0,0.7); color: #fff; border: none; border-radius: 4px;
  cursor: pointer; font-size: 14px;
}
.my-thumb-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 300px; height: 120px;
  background: var(--input-bg); border: 2px dashed var(--border); border-radius: 8px;
  cursor: pointer; color: var(--text-muted); transition: all 0.15s;
}
.my-thumb-drop:hover, .my-thumb-drop.dragover {
  border-color: var(--accent); color: var(--text); background: var(--accent-subtle);
}

/* ── Chapter 2 layout ── */
.c2-layout, .c3-layout {
  display: flex; min-height: calc(100vh - 200px);
}
.c2-layout .toc-sidebar, .c3-layout .toc-sidebar {
  width: 180px; min-width: 180px; position: sticky;
  top: 140px; height: calc(100vh - 200px); overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 12px 0; display: flex; flex-direction: column;
}
.c2-layout .toc-sidebar #c2TocList,
.c3-layout .toc-sidebar #c3TocList { flex: 1; overflow-y: auto; }
.toc-footer {
  padding: 8px 12px; border-top: 1px solid var(--border); margin-top: auto;
}
.c2-layout .bench-panel {
  flex: 1; border-left: 1px solid var(--border); min-width: 0;
  display: flex; flex-direction: column;
}
.c2-layout .my-script-panel {
  flex: 1.4;  /* 주 작업 영역이라 조금 더 넓게 */
  min-width: 0; overflow-y: auto;
}

/* Hook banner */
.hook-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 24px; background: var(--accent-subtle);
  border-top: 1px solid var(--accent); border-bottom: 1px solid var(--accent);
  font-size: 12px; color: var(--text);
}

/* Hook section emphasis */
.section-block.hook-section {
  border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-subtle);
}
.section-block.hook-section .hook-label {
  padding: 6px 16px; background: var(--accent-subtle); color: var(--accent);
  font-size: 11px; border-bottom: 1px solid var(--accent);
}

/* ── Chapter 3 ── */
.c3-layout .main-content {
  flex: 1; min-width: 0;
}
.c3-section-header {
  background: var(--surface2);
}
.c3-section-title {
  font-size: 14px; font-weight: 600; color: var(--accent);
}
.c3-script-readonly {
  background: rgba(0,0,0,0.03);
}
.script-readonly {
  padding: 12px 14px; font-family: inherit; font-size: 13px;
  line-height: 1.85; white-space: pre-wrap; color: var(--text);
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px;
  margin: 0;
}
[data-theme="dark"] .c3-script-readonly { background: rgba(255,255,255,0.015); }
.broll-block .section-broll { padding: 12px 16px; }

/* ─────────────────────────────────────────────────
   Warehouse (썸네일 창고)
   ───────────────────────────────────────────────── */
.wh-layout {
  display: flex; gap: 20px;
  max-width: 1700px; margin: 0 auto; padding: 20px 24px;
  align-items: flex-start;
}
.wh-main { flex: 1; min-width: 0; }

/* Sidebar */
.wh-sidebar {
  width: 220px; flex-shrink: 0;
  position: sticky; top: 68px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 0;
}
.wh-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px 10px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.wh-folder-new {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 5px;
  color: var(--text-muted); cursor: pointer;
  width: 22px; height: 22px; font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.wh-folder-new:hover { color: var(--accent); border-color: var(--accent); }

.wh-folder-tree {
  padding: 6px 0;
  display: flex; flex-direction: column; gap: 1px;
}
.wh-folder {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  font-size: 12px; color: var(--text);
  cursor: pointer; user-select: none;
  border-left: 2px solid transparent;
  transition: all 0.1s;
}
.wh-folder:hover { background: var(--surface2); }
.wh-folder.active {
  background: var(--accent-subtle);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.wh-folder.drag-over {
  background: var(--accent);
  color: #fff;
}
.wh-folder.drag-over .wh-folder-count { color: #fff; }
.wh-folder.dragging {
  opacity: 0.4;
}
.wh-folder[draggable="true"] { cursor: grab; }
.wh-folder[draggable="true"]:active { cursor: grabbing; }

.wh-folder-child { padding-left: 30px; font-size: 11.5px; }
.wh-folder-child::before {
  content: '└'; color: var(--text-muted); margin-right: 4px;
  font-size: 10px; opacity: 0.7;
}
.wh-folder-child .wh-folder-icon { display: none; }

.wh-folder-icon { font-size: 12px; flex-shrink: 0; }
.wh-folder-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wh-folder-count {
  font-size: 10px; color: var(--text-muted); font-weight: 500;
  padding: 1px 6px; background: var(--surface2); border-radius: 9px;
  flex-shrink: 0;
}
.wh-folder.active .wh-folder-count {
  background: var(--accent); color: #fff;
}

.wh-folder-actions {
  display: inline-flex; gap: 2px; opacity: 0; transition: opacity 0.15s;
}
.wh-folder:hover .wh-folder-actions { opacity: 1; }
.wh-folder-action {
  width: 18px; height: 18px; padding: 0;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 11px; line-height: 1;
  border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
}
.wh-folder-action:hover { background: rgba(0,0,0,0.15); color: var(--text); }
.wh-folder.active .wh-folder-action { color: var(--accent); }

.wh-folder-divider {
  height: 1px; background: var(--border); margin: 6px 0;
}

/* Folder badge on card */
.wh-card-folder-row {
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px;
}
.wh-folder-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 10px;
  font-size: 10px; font-weight: 600;
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wh-folder-badge.unassigned {
  color: var(--text-muted);
  background: transparent;
  border-style: dashed;
}
.wh-folder-badge-rm {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 13px; line-height: 1;
  padding: 0 2px; opacity: 0.5; transition: opacity 0.1s;
}
.wh-folder-badge-rm:hover { opacity: 1; color: var(--accent); }

/* Dragging card */
.wh-card.dragging {
  opacity: 0.45;
  transform: scale(0.97);
}
.wh-card { cursor: grab; }
.wh-card.dragging { cursor: grabbing; }

/* Header heading */
.header h1 { font-size: 14px; font-weight: 700; color: var(--text-strong); }

/* Filter bar */
.wh-filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px;
  position: sticky; top: 48px; z-index: 10;
}
.wh-search {
  flex: 1; min-width: 220px; padding: 8px 12px; font-size: 13px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-family: inherit;
  transition: border-color 0.15s;
}
.wh-search:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}
.wh-select {
  padding: 8px 10px; font-size: 12px; font-weight: 500;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-family: inherit; cursor: pointer;
}
.wh-select:focus { outline: none; border-color: var(--accent); }
.wh-fav-filter {
  padding: 8px 14px; font-size: 12px; font-weight: 600;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
  font-family: inherit;
}
.wh-fav-filter:hover { color: var(--text); }
.wh-fav-filter.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* Grid */
.wh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Card */
.wh-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  transition: border-color 0.15s, transform 0.12s;
}
.wh-card:hover { border-color: var(--border-strong); }

.wh-card-image {
  position: relative;
  width: 100%; aspect-ratio: 16/9; background: var(--bg);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.wh-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.wh-fav {
  position: absolute; top: 8px; left: 8px;
  width: 32px; height: 32px;
  background: rgba(0,0,0,0.55); color: rgba(255,255,255,0.5);
  border: none; border-radius: 6px; cursor: pointer;
  font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.wh-fav:hover { color: #fff; }
.wh-fav.on { color: #fcd34d; background: rgba(0,0,0,0.7); }

.wh-card-body {
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.wh-card-title {
  font-size: 14px; font-weight: 600; color: var(--text-strong);
  line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.wh-card-meta {
  font-size: 11px; color: var(--text-muted); line-height: 1.4;
}
.wh-card-project-memo {
  padding: 6px 9px; font-size: 11px; color: var(--text);
  background: var(--surface2); border-left: 2px solid var(--accent2);
  border-radius: 4px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tags */
.wh-tags {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
}
.wh-tag {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 4px 2px 8px;
  font-size: 10px; font-weight: 600;
  background: var(--accent-subtle); color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 10px;
}
.wh-tag-rm {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 13px; line-height: 1;
  padding: 0 4px; opacity: 0.6; transition: opacity 0.1s;
}
.wh-tag-rm:hover { opacity: 1; }
.wh-tag-add {
  padding: 2px 8px; font-size: 10px; font-weight: 600;
  background: transparent; color: var(--text-muted);
  border: 1px dashed var(--border); border-radius: 10px;
  cursor: pointer; transition: all 0.15s;
  font-family: inherit;
}
.wh-tag-add:hover { color: var(--accent); border-color: var(--accent); }
.wh-tag-input {
  padding: 2px 8px; font-size: 10px;
  background: var(--input-bg); border: 1.5px solid var(--accent);
  border-radius: 10px; color: var(--text);
  outline: none; width: 80px; font-family: inherit;
}

/* Memo */
.wh-memo {
  width: 100%; padding: 6px 8px;
  font-size: 11px; font-family: inherit; line-height: 1.5;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text);
  resize: vertical; min-height: 36px;
  transition: border-color 0.15s;
}
.wh-memo:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}
.wh-memo::placeholder { color: var(--text-muted); }

/* Footer */
.wh-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px; color: var(--text-muted);
  padding-top: 4px; border-top: 1px solid var(--border);
  gap: 8px;
}
.wh-collected { white-space: nowrap; }
.wh-project-link {
  color: var(--text-muted); text-decoration: none;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface2); border: 1px solid var(--border);
  transition: all 0.15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 150px;
}
.wh-project-link:hover { color: var(--accent); border-color: var(--accent); }

/* Warehouse-only badge (ref has no linked project) */
.wh-warehouse-only {
  padding: 2px 8px; font-size: 10px; font-weight: 600;
  background: var(--tag-inactive-bg); color: var(--text-muted);
  border: 1px dashed var(--border); border-radius: 4px;
  cursor: pointer; font-family: inherit;
  white-space: nowrap; transition: all 0.15s;
}
.wh-warehouse-only:hover {
  color: var(--text); border-color: var(--border-strong);
}

/* Warehouse quick-add bar */
.wh-quick-add {
  margin-bottom: 16px;
}

/* ─────────────────────────────────────────────────
   Chapter 4 — 편집 계획 (Edit Planning)
   ───────────────────────────────────────────────── */

/* 전체 편집 브리프 카드 */
.edit-brief-card {
  margin: 14px 20px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.edit-brief-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--surface2);
  cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--border);
}
.edit-brief-header h3 {
  font-size: 14px; font-weight: 700; color: var(--text-strong);
  margin: 0;
}
.edit-brief-toggle {
  font-size: 13px; color: var(--text-muted); width: 16px;
}
.edit-brief-hint {
  font-size: 11px; color: var(--text-muted);
  margin-left: auto;
}
.edit-brief-body { padding: 18px; }

.edit-brief-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.edit-brief-field { display: flex; flex-direction: column; gap: 5px; }
.edit-brief-field.full { grid-column: 1 / -1; }
.edit-brief-field label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.edit-brief-field input, .edit-brief-field textarea {
  padding: 8px 11px; font-size: 13px; font-family: inherit;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  transition: border-color 0.15s;
}
.edit-brief-field input:focus, .edit-brief-field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}
.edit-brief-field textarea { resize: vertical; min-height: 60px; line-height: 1.5; }

/* 레퍼런스 영상 목록 */
.eb-refs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.eb-refs-empty {
  padding: 10px; text-align: center;
  font-size: 11px; color: var(--text-muted);
  background: var(--input-bg); border: 1px dashed var(--border); border-radius: 6px;
}
.eb-ref-row {
  display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 6px;
  align-items: center;
}
.eb-ref-url, .eb-ref-note {
  padding: 6px 10px; font-size: 12px; font-family: inherit;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px;
}
.eb-ref-url:focus, .eb-ref-note:focus {
  outline: none; border-color: var(--accent);
}
.eb-ref-del {
  width: 26px; height: 26px; padding: 0;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text-muted); cursor: pointer;
  font-size: 11px;
}
.eb-ref-del:hover { color: var(--accent); border-color: var(--accent); }

/* 챕터 4 레이아웃 (TOC + 콘텐츠) */
.c4-layout {
  display: flex; min-height: calc(100vh - 380px);
  margin-top: 14px;
}
.c4-layout .toc-sidebar {
  width: 180px; min-width: 180px; position: sticky;
  top: 140px; height: calc(100vh - 200px); overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 12px 0; display: flex; flex-direction: column;
}
.c4-layout .toc-sidebar #c4TocList { flex: 1; overflow-y: auto; }
.c4-layout .main-content { flex: 1; min-width: 0; }

/* 편집 섹션 블록 */
.edit-section-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.edit-note-panel {
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--broll-bg);
}
.edit-note-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin-top: 2px;
}
.edit-note-label:first-child { margin-top: 0; }

/* 편집 태그 */
.edit-tags-area { margin-bottom: 4px; }
.edit-tag-btn {
  display: inline-flex; align-items: center; gap: 4px;
}
.edit-tag-icon { font-size: 12px; }
.tag-btn.edit-tag-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.tag-btn.edit-tag-btn.active[data-edit-tag="fastPace"]   { background: #ef4444; border-color: #ef4444; }
.tag-btn.edit-tag-btn.active[data-edit-tag="slowPace"]   { background: #0ea5e9; border-color: #0ea5e9; }
.tag-btn.edit-tag-btn.active[data-edit-tag="emphasize"]  { background: #f59e0b; border-color: #f59e0b; color: #000; }
.tag-btn.edit-tag-btn.active[data-edit-tag="cut"]        { background: #6b7280; border-color: #6b7280; }
.tag-btn.edit-tag-btn.active[data-edit-tag="zoom"]       { background: #a855f7; border-color: #a855f7; }
.tag-btn.edit-tag-btn.active[data-edit-tag="transition"] { background: #ec4899; border-color: #ec4899; }
.tag-btn.edit-tag-btn.active[data-edit-tag="bgmChange"]  { background: #10b981; border-color: #10b981; }
.tag-btn.edit-tag-btn.active[data-edit-tag="sfx"]        { background: #f472b6; border-color: #f472b6; }
.tag-btn.edit-tag-btn.active[data-edit-tag="subtitle"]   { background: #6366f1; border-color: #6366f1; }

/* 자막 input */
.edit-subtitle-input {
  width: 100%; padding: 8px 11px; font-size: 13px; font-family: inherit;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  transition: border-color 0.15s;
}
.edit-subtitle-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}
.edit-subtitle-input::placeholder { color: var(--text-muted); }

.edit-memo {
  min-height: 70px;
}
.edit-block { background: var(--surface); }

/* ─────────────────────────────────────────────────
   Chapter 2 — 원고 작성: 시작 방법 선택 카드
   ───────────────────────────────────────────────── */
.start-picker {
  padding: 40px 24px;
  max-width: 860px; margin: 0 auto;
  text-align: center;
}
.start-picker h3 {
  font-size: 18px; font-weight: 700; color: var(--text-strong);
  margin-bottom: 6px;
}
.start-picker-desc {
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.65;
}
.start-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  .start-cards { grid-template-columns: 1fr; }
}
.start-card {
  position: relative;
  padding: 24px 18px 22px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer; text-align: center;
  font-family: inherit; color: inherit;
  transition: all 0.2s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.start-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.start-card.recommended {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.start-card-badge {
  position: absolute; top: -8px; right: 12px;
  padding: 2px 10px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 10px;
  letter-spacing: 0.5px;
}
.start-card-icon { font-size: 32px; line-height: 1; }
.start-card-title {
  font-size: 15px; font-weight: 700; color: var(--text-strong);
}
.start-card-desc {
  font-size: 12px; color: var(--text-muted);
  line-height: 1.65;
}

/* 벤치마킹 패널 접기 */
.bench-collapse-btn {
  width: 28px; height: 28px;
  padding: 0; margin-right: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text-muted);
  font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.bench-collapse-btn:hover { color: var(--accent); border-color: var(--accent); }

.bench-panel.bench-collapsed { flex: 0 0 40px; }
.bench-panel.bench-collapsed #c2BenchContent { display: none; }
.bench-panel.bench-collapsed .bench-tabs {
  flex-direction: column; padding: 8px 6px;
}
.bench-panel.bench-collapsed .bench-tab,
.bench-panel.bench-collapsed .bench-tab-add { display: none; }

.bench-upload-hint {
  font-size: 11px; color: var(--text-muted);
  margin-top: 16px; padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* BPT 템플릿 가이드 인용문 (script textarea는 그대로, 렌더 미리보기는 X) */
/* 사용자는 textarea 안의 > 시작 라인을 그대로 보게 됨 - 별도 스타일 없이 자연스럽게 */

