:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #e5e7eb;
  --card: #151b2a;
  --card-soft: #20283a;
  --accent: #ffb000;
  --pink: #ec4899;
  --violet: #7c3aed;
  --green: #22c55e;
  --danger: #ef4444;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Noto Sans KR", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.sidebar {
  min-height: 100vh;
  padding: 22px 18px;
  background: #fff;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--violet), var(--pink));
}

.brand span,
.field span,
.preset-title,
small,
.eyebrow {
  color: var(--muted);
}

.brand strong {
  display: block;
  line-height: 1.1;
}

.brand span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.compact-field {
  margin-bottom: 10px;
}

.field span,
.preset-title {
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
  color: #334155;
  font-size: 14px;
}

.check input {
  width: auto;
}

.primary,
.secondary,
.presets button,
.icon-btn {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary {
  width: 100%;
  padding: 12px 14px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #ff7a18, #ec4899);
}

.secondary {
  padding: 11px 14px;
  color: #111827;
  background: #eef2f7;
  font-weight: 700;
}

.preset-title {
  margin: 24px 0 10px;
}

.presets {
  display: grid;
  gap: 8px;
}

/* ★결과 위로 올린 프리셋 — 사이드바에서는 세로로 쌓지만 여기서는 **가로로 흘린다.**
   세로로 두면 결과가 화면 아래로 밀려 내려가 정작 봐야 할 것이 안 보인다. */
.preset-bar { margin: 0 0 12px; }
.preset-bar .preset-title { margin: 0 0 8px; }
.preset-bar .presets { display: flex; flex-wrap: wrap; gap: 7px; }
.preset-bar .presets button { padding: 7px 12px; border-radius: 999px; font-size: 13px; }
.preset-bar .preset-tools { margin-top: 9px; }

.presets button {
  padding: 10px 11px;
  text-align: left;
  color: #334155;
  background: #f1f5f9;
}

.main {
  padding: 26px 30px 60px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.25;
}

.metrics {
  display: flex;
  gap: 10px;
}

.metrics div {
  min-width: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metrics span {
  display: block;
  font-size: 22px;
  font-weight: 900;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 12px;
  margin-bottom: 14px;
}

.status {
  padding: 14px 16px;
  margin-bottom: 18px;
  color: #475467;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  /* ★줄바꿈을 살린다 — 오류 안내가 여러 줄이다(키 문제는 "무엇을 하라"까지 적어야 한다).
     안 그러면 한 덩어리로 붙어 나와서 읽히지 않는다. */
  white-space: pre-line;
  line-height: 1.65;
}

.status.error {
  color: #991b1b;
  background: #fff1f2;
  border-color: #fecdd3;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  align-items: start;
}

.video-card {
  overflow: hidden;
  border-radius: 14px;
  color: #fff;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.video-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.18);
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 9 / 12;
  background: #0f172a;
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.82);
}

.thumb-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.05), rgba(15, 23, 42, 0.22));
}

.card-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  z-index: 2;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.round-btn {
  min-width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: rgba(17, 24, 39, 0.72);
  backdrop-filter: blur(10px);
  cursor: pointer;
  font-weight: 800;
}

.round-btn.active {
  color: #111827;
  background: var(--accent);
}

.script-btn {
  padding: 0 16px;
}

.mini-btn {
  min-width: 54px;
  padding: 0 12px;
  font-size: 13px;
}

.card-body {
  padding: 14px;
}

.meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.category {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: #111827;
  background: #bef264;
  font-size: 12px;
  font-weight: 800;
}

.score-pill {
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
}

.title {
  margin: 0 0 10px;
  min-height: 42px;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 900;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.channel {
  color: #cbd5e1;
  font-size: 12px;
  margin-bottom: 12px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  background: var(--card-soft);
  border-radius: 8px;
}

.stat-row small {
  display: block;
  color: #94a3b8;
  font-size: 11px;
}

.stat-row strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.score-row {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.score-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: #cbd5e1;
  font-size: 13px;
}

.score-line strong {
  color: var(--accent);
  font-size: 15px;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #334155;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #f97316, #fde047);
}

.dialog {
  width: min(760px, calc(100vw - 32px));
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.dialog h2 {
  margin: 0;
  font-size: 20px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  color: #475467;
  background: #eef2f7;
  font-size: 24px;
}

.script-body {
  max-height: 62vh;
  overflow: auto;
  padding: 22px;
  white-space: pre-wrap;
  line-height: 1.62;
  color: #263244;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px 22px;
}

.link-btn {
  width: auto;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.image-dialog {
  width: min(1120px, calc(100vw - 32px));
}

.source-workbench {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 16px;
  padding: 18px 22px 0;
  background: #f8fafc;
}

.source-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.source-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.source-list {
  display: grid;
  gap: 10px;
}

.source-wide-btn {
  margin-top: 12px;
}

.source-wide-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.source-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.source-item strong,
.source-item span {
  display: block;
}

.source-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.source-item-actions,
.source-actions {
  display: flex;
  gap: 8px;
}

.tiny-btn {
  width: auto;
  padding: 8px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.source-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.source-message {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #166534;
  background: #dcfce7;
  font-size: 13px;
  line-height: 1.45;
}

.source-message.warning {
  color: #92400e;
  background: #fef3c7;
}

.origin-results {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.origin-result-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.origin-result {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.origin-result img {
  width: 92px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  background: #111827;
}

.origin-result strong,
.origin-result span,
.origin-result small {
  display: block;
}

.origin-result strong {
  font-size: 13px;
  line-height: 1.35;
}

.origin-result span,
.origin-result small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.origin-preview-wrap {
  padding: 16px 22px 0;
  background: #f8fafc;
}

.origin-preview-wrap iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 0;
  border-radius: 10px;
  background: #111827;
}

.canvas-wrap {
  padding: 18px 22px 0;
  background: #f8fafc;
}

.canvas-wrap canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border-radius: 10px;
  background: #111827;
}

/* ── 프리셋 편집 ──────────────────────────────────────────────────── */
.preset-edit-btn { float: right; font-size: 11px; font-weight: 400; }
.preset-row { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 4px; align-items: center; }
.preset-row input { padding: 7px 8px; font-size: 12px; border-radius: 6px; }
.preset-del {
  width: 26px; height: 26px; padding: 0; font-size: 13px; line-height: 1;
  color: #94a3b8; background: transparent; border: 0; cursor: pointer;
}
.preset-del:hover { color: #ef4444; }
.preset-tools { margin-top: 10px; display: grid; gap: 6px; }
.preset-add {
  width: 100%; padding: 9px 10px; font-size: 12px; cursor: pointer;
  color: #b45309; background: rgba(245, 179, 1, 0.1);
  border: 1px dashed #f59e0b; border-radius: 8px;
}
.preset-note { margin: 2px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted); }

/* ── 레퍼런스 해부 ([대본] 다이얼로그) ────────────────────────────── */
.ref-metrics {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 16px 22px; background: #fff7ed; border-bottom: 1px solid var(--line);
}
.ref-m { min-width: 92px; }
.ref-m small { display: block; font-size: 11px; color: #92714a; }
.ref-m b { font-size: 17px; color: #1f2937; }
.ref-m.accent b { color: #b45309; }
.ref-read { flex-basis: 100%; margin: 4px 0 0; font-size: 12px; color: #92714a; }

.ref-setup { padding: 16px 22px; background: #f8fafc; }
.ref-honest {
  margin: 0 0 12px; padding: 10px 12px; font-size: 12px; line-height: 1.6; color: #475467;
  background: #fff; border: 1px dashed var(--line); border-radius: 8px;
}
.ref-honest b { color: #b45309; }
.ref-setup .field > span { color: #374151; font-size: 13px; }
.ref-setup .field small { color: #6b7280; font-weight: 400; }
.ref-setup .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px;
  background: #fff; color: #1f2937; font: inherit; line-height: 1.6; resize: vertical;
}
.ref-actions { display: flex; align-items: center; gap: 12px; }
.ref-actions button { width: auto; padding: 11px 18px; }
.ref-actions button:disabled { opacity: 0.7; cursor: wait; }
.ref-status { font-size: 12px; color: #6b7280; line-height: 1.5; }
.ref-status.error { color: #dc2626; }

/* 댓글 가져오기 — 「덧붙일 것」 칸 바로 위. 손으로 적던 일을 대신한다. */
.ref-comments { margin-bottom: 12px; }
.ref-comments-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* 구글 오류 안내는 여러 줄로 온다(키 다시 붙여넣는 방법까지 알려준다) → 줄바꿈을 살린다 */
.ref-comments-head .ref-status { flex: 1 1 240px; min-width: 0; white-space: pre-line; }
.ref-comments-preview {
  margin-top: 9px; padding: 10px 12px; background: #fff;
  border: 1px solid #e5e7eb; border-radius: 8px;
  max-height: 190px; overflow-y: auto;
}
.ref-comments-preview .rc-lane {
  font-size: 11px; color: #6b7280; font-weight: 700;
  letter-spacing: .03em; margin: 8px 0 4px;
}
.ref-comments-preview .rc-lane:first-child { margin-top: 0; }
.ref-comments-preview .rc-row {
  font-size: 12.5px; color: #374151; line-height: 1.55;
  padding: 3px 0; border-top: 1px solid #f3f4f6;
}
.ref-comments-preview .rc-row:first-of-type { border-top: 0; }
.ref-comments-preview .rc-like { color: #9ca3af; font-size: 11.5px; }

/* 유튜브 자동완성 — 사람들이 뭘 찾나 (발굴 화면 왼쪽) */
.sugg { margin: -4px 0 14px; }
.sugg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sugg-head .refbox-mini { flex: 0 0 auto; }
.sugg-head .ref-status { flex: 1 1 120px; min-width: 0; }
.sugg-list { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
/* 누르면 그 말이 검색 키워드가 된다 — 보고 끝나는 목록이 아니라 다음 걸음이 붙어 있어야 쓴다 */
/* ★칩 색은 프리셋 버튼(.presets button)과 같은 값을 쓴다 — 나란히 놓이는 자리라
   여기만 다른 색이면 "다른 종류의 물건"으로 보인다. */
.sugg-item {
  padding: 6px 11px; font-size: 12.5px; line-height: 1.4; cursor: pointer;
  border: 0; border-radius: 999px; background: #f1f5f9; color: #64748b;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sugg-item:hover { background: #e2e8f0; }

/* 클립 소재 — 잘라 쓸 해외 원본 찾기 (발굴 화면 왼쪽) */
.clip-regions { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 2px 0 8px; }
.clip-regions .check { margin: 0; }
/* AI가 만든 영어 검색어를 그대로 보여준다 — 무엇으로 찾았는지 안 보이면 결과를 못 믿는다.
   ★누르면 그 검색어 하나로 다시 찾는다(칩은 보는 물건이 아니라 다음 걸음이다). */
.clip-queries { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.clip-q {
  display: flex; align-items: baseline; gap: 7px; text-align: left;
  padding: 7px 10px; border: 0; border-radius: 9px; cursor: pointer;
  background: #f1f5f9; color: #334155; font-size: 12.5px; line-height: 1.4;
}
.clip-q:hover { background: #e2e8f0; }
.clip-q b { font-weight: 600; flex: 0 0 auto; }

/* 결과 거르기 칩 — 누르기 전에 몇 개 남는지 보인다(릴박스 차용) */
.chiprow { display: flex; align-items: baseline; gap: 8px; margin-top: 9px; }
.chiprow > b { flex: 0 0 62px; font-size: 12px; font-weight: 600; color: #64748b; }
.chiprow .chips { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; min-width: 0; }
.chip {
  padding: 4px 9px; font-size: 12px; line-height: 1.35; cursor: pointer;
  border: 0; border-radius: 999px; background: #f1f5f9; color: #475569; white-space: nowrap;
}
.chip:hover { background: #e2e8f0; }
.chip.on { background: #4f46e5; color: #fff; }
/* 남는 게 0이면 눌러도 빈 화면이 된다 — 흐리게 해서 미리 알려준다(막지는 않는다) */
.chip.empty { opacity: .45; }
.chip i { font-style: normal; opacity: .7; margin-left: 4px; font-size: 11px; }
.chip.on i { opacity: .85; }

/* 썸네일 길이 배지 — 유튜브와 같은 자리(오른쪽 아래).
   ★롱폼은 색을 달리한다. 짜집기 원본은 대개 롱폼이라, 목록에서 바로 골라내야 한다. */
.dur-badge {
  position: absolute; right: 6px; bottom: 6px; z-index: 2;
  padding: 1px 6px; border-radius: 5px; font-size: 11.5px; font-weight: 600; line-height: 1.5;
  background: rgba(0, 0, 0, .78); color: #fff; letter-spacing: .2px;
}
.dur-badge.long { background: #4f46e5; }

/* 채널 국가 — 지역을 골라 찾는데 결과에 나라가 안 보였다(릴박스는 채널명 옆에 단다) */
.cc {
  display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 4px;
  font-size: 10.5px; font-weight: 600; line-height: 1.55; vertical-align: 1px;
  background: rgba(148, 163, 184, .22); color: #94a3b8;
}
.clip-q small { color: #64748b; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 앞의 이름은 매 줄 똑같아 읽을 게 못 된다 — 뒤에 붙은 말만 진하게 */
.sugg-item b { color: #0f172a; font-weight: 800; }
.sugg-empty {
  font-size: 12px; color: #b45309; line-height: 1.6;
  padding: 9px 11px; background: #fffbeb; border-left: 3px solid #f59e0b; border-radius: 0 8px 8px 0;
}

/* 분석 결과는 구조화된 HTML이라 pre-wrap을 풀어야 한다(기본 .script-body는 평문 전용) */
.script-body.ref-rendered { white-space: normal; max-height: none; }
.script-body h4 { margin: 22px 0 6px; font-size: 14px; color: #b45309; }
.script-body.ref-rendered p { margin: 0 0 8px; }
.ref-vic { padding: 14px; background: #fffbeb; border-left: 3px solid #f59e0b; border-radius: 0 8px 8px 0; }
.ref-vic b { font-size: 12px; color: #b45309; }
.ref-vic-main { margin: 6px 0 0 !important; font-size: 16px; font-weight: 700; color: #111827; line-height: 1.6; }
.ref-vic-formula { margin: 6px 0 0 !important; font-size: 12px; color: #6b7280; }
.ref-hint { font-size: 12px; color: #6b7280; }
.ref-topics { display: grid; gap: 8px; }
.ref-topic { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.ref-topic b { display: block; color: #111827; line-height: 1.5; }
.ref-topic span { display: block; margin-top: 4px; font-size: 12px; color: #6b7280; }

/* 팩트체크 — 판정만 크게 보이고 근거(출처·검색어)가 바로 아래 붙어야 사람이 확인한다 */
.amp-who { color: #b45309; font-weight: 700; margin-right: 4px; }
.ref-fact-src { margin-top: 9px; font-size: 11.5px; color: #6b7280; line-height: 1.7; word-break: break-all; }
.ref-fact-src a { color: #2563eb; }

/* 감정 곡선 — 어디서 덜 올라갔는지를 눈으로 보게 한다(03 강화가 손댈 자리) */
.ref-curve { margin: 8px 0 14px; padding-left: 0; list-style: none; }
.ref-curve li { position: relative; padding: 8px 12px; margin-bottom: 6px; background: #fff;
  border: 1px solid var(--line); border-left: 3px solid #93c5fd; border-radius: 8px;
  font-size: 13px; line-height: 1.6; }
.rc-at { font-size: 11.5px; font-weight: 800; color: #2563eb; margin-right: 7px; }
.rc-feel { color: #111827; margin-right: 7px; }
.rc-why { color: #6b7280; }

/* ★"언제 이걸 누르나"를 카드 맨 위에 먼저 말해준다.
   박스가 여러 개면 사람은 제목만 보고 못 고른다(대표님: "나도 처음엔 뭘 눌러야 하지 했어"). */
.ref-when { display: inline-block; margin-bottom: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; background: rgba(0,0,0,.06); color: #374151; }
.ref-amp .ref-when { background: #fee2e2; color: #b91c1c; }
.ref-find .ref-when { background: #dcfce7; color: #15803d; }

/* 03 강화 — 소재를 바꾸지 않고 더 세게. 큰제로 워크플로우의 정석 경로라 **맨 위·제일 눈에 띄게**.
   빨강 = "이미 검증된 걸 그대로 쓴다". 아래 두 문(주황=내 물건 / 초록=다른 소재)과 구분된다. */
.ref-amp { margin: 14px 0; padding: 15px; border: 2px solid #f87171; border-radius: 12px; background: #fef2f2; }
.ref-amp h4 { color: #b91c1c; }
.amp-strategy { margin: 10px 0; padding: 10px 12px; background: #fff; border-radius: 9px;
  border: 1px solid #fecaca; font-size: 13.5px; line-height: 1.6; }
.amp-beats { margin: 10px 0; padding-left: 0; list-style: none; counter-reset: amp; }
.amp-beats li { position: relative; padding: 10px 12px 10px 14px; margin-bottom: 7px; background: #fff;
  border-radius: 9px; border: 1px solid var(--line); border-left: 3px solid #f87171; }
.amp-at { font-size: 12px; font-weight: 800; color: #b91c1c; }
.amp-purpose { font-size: 12px; color: #6b7280; margin-left: 6px; }
.amp-line { font-size: 14px; color: #111827; margin-top: 5px; line-height: 1.55; }
.amp-visual { font-size: 12px; color: #6b7280; margin-top: 4px; line-height: 1.5; }

/* 나가는 문 두 개 — 상품 쇼츠 / 이야기 쇼츠. 좁은 화면에서는 위아래로 쌓인다 */
.amp-go { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.amp-go button { flex: 1 1 190px; }
/* ★확인할 것은 눈에 띄어야 한다 — 틀린 숫자가 올라가면 되돌릴 수 없다 */
.amp-check { margin-top: 10px; padding: 10px 12px; border-radius: 9px;
  background: #fffbeb; border: 1px solid #fbbf24; font-size: 13px; line-height: 1.6; }
.amp-check ul { margin: 6px 0 4px; padding-left: 18px; }

/* 내 물건으로 만들기 — 팔 게 정해진 사람(분양·매장·학원)이 나가는 문.
   「실제 사례 찾기」(초록=남의 이야기 찾기)와 **눈으로 구분돼야** 한다. 하는 일이 정반대다. */
.ref-mine { margin: 14px 0; padding: 14px; border: 1px solid #fbbf24; border-radius: 11px; background: #fffbeb; }
.ref-mine h4 { color: #92400e; }

/* 실제 사례 찾기 — 지어낸 소재와 눈으로 구분돼야 한다(초록=검색으로 확인된 것) */
.ref-find { margin: 14px 0; padding: 14px; border: 1px solid #86efac; border-radius: 11px; background: #f0fdf4; }
/* 라디오를 카드 두 장으로 — flex로 두면 제목이 "같은 인/물로"처럼 쪼개져 보였다 */
.ref-who { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin: 10px 0 12px; }
.ref-who label { display: grid; grid-template-columns: 18px 1fr; grid-template-rows: auto auto;
  column-gap: 8px; row-gap: 2px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; cursor: pointer; }
.ref-who label:has(input:checked) { border-color: #16a34a; background: #f0fdf4; }
.ref-who input { grid-row: 1 / span 2; margin: 3px 0 0; accent-color: #16a34a; }
.ref-who .rw-t { font-size: 13.5px; font-weight: 700; color: #111827; }
.ref-who .rw-d { font-size: 12px; color: #6b7280; line-height: 1.5; }

/* AI가 지어낸 소재 — 접어 둔다. 기본은 검색으로 찾은 실제 사례를 쓴다 */
.ref-made { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fafafa; padding: 0 12px; }
.ref-made > summary { padding: 11px 0; cursor: pointer; font-size: 13px; font-weight: 600; color: #6b7280; }
.ref-made > summary span { font-weight: 400; font-size: 12px; }
.ref-made[open] { padding-bottom: 12px; }
.ref-case { margin-top: 9px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.ref-case-h { line-height: 1.6; }
.ref-case-h span { color: #111827; font-weight: 600; }
.ref-case p { margin: 5px 0 0; font-size: 12.5px; color: #4b5563; line-height: 1.6; }
.ref-case-why { color: #16a34a !important; }
.ref-case button { margin-top: 9px; }
.ref-queries { display: flex; flex-wrap: wrap; gap: 6px; }
.ref-q {
  width: auto; padding: 6px 12px; font-size: 12px; color: #475467;
  background: #fff; border: 1px solid var(--line); border-radius: 20px; cursor: pointer;
}
.ref-q:hover { border-color: #f59e0b; color: #b45309; }
/* ★.ref-hooks / .ref-script / .ref-copy-script 는 지웠다 —
   "① 이 소재를 그대로 쓴다면"(첫 줄 후보·대본 초안)을 없앴다(2026-08-09, app.js 주석 참고) */

/* 원본 받아쓰기 — AI가 영상을 직접 보고 옮겨 적은 것. 길어서 접어 둔다 */
.ref-tr { margin: 14px 0; border: 1px solid #d7dce6; border-radius: 10px; background: #f7f9fc; }
.ref-tr > summary {
  padding: 11px 14px; cursor: pointer; font-size: 13.5px; font-weight: 700; color: #334155;
  list-style: none;
}
.ref-tr > summary::-webkit-details-marker { display: none; }
.ref-tr > summary::before { content: "▸ "; color: #64748b; }
.ref-tr[open] > summary::before { content: "▾ "; }
.ref-tr > summary:hover { color: #0f172a; }
.ref-tr-body {
  max-height: 320px; overflow-y: auto; padding: 4px 14px 10px;
  border-top: 1px solid #e2e8f0;
}
.ref-tr-body p {
  margin: 0 0 5px !important; color: #1e293b; font-size: 13.5px; line-height: 1.65;
}
.ref-copy-tr { width: auto; margin: 0 14px 12px; padding: 7px 13px; font-size: 12.5px; }
.ref-caution {
  margin-top: 20px; padding: 12px; font-size: 12px; line-height: 1.6; color: #92400e;
  background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px;
}

/* ── 네이버 홈피드 글 (블로그 다이얼로그) ─────────────────────────── */
/* 이 다이얼로그는 흰 바탕이다(셸은 다크지만 대화상자는 원래 라이트). 새 요소도 라이트로 맞춘다. */
.hf-source {
  padding: 16px 22px;
  background: #fff7ed;
  border-bottom: 1px solid var(--line);
}
.hf-src-title { font-weight: 700; color: #1f2937; line-height: 1.45; }
.hf-src-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-size: 12px; color: #6b7280; }
.hf-ratio { color: #b45309; font-weight: 700; }

.hf-setup { padding: 18px 22px; background: #f8fafc; }
.hf-setup h3 { margin: 0 0 10px; font-size: 15px; color: #1f2937; }
.hf-setup .field { margin-top: 14px; }
.hf-setup .field > span { color: #374151; font-size: 13px; }
.hf-setup .field small { color: #6b7280; font-weight: 400; }
/* 셸(shell.css)이 모든 input·textarea를 다크로 덮는다. 이 다이얼로그는 흰 바탕이라
   그대로 두면 흰 패널 위에 검은 칸이 박힌다 → 클래스 선택자로 되돌린다(우선순위가 더 높다). */
.hf-setup .field input,
.hf-setup .field textarea {
  background: #fff; color: #1f2937; border: 1px solid var(--line);
}
/* textarea는 이 화면의 기본 스타일(input·select)에 없다 → 크기·여백을 직접 준다 */
.hf-setup .field textarea {
  width: 100%; border-radius: 8px; padding: 11px 12px;
  font: inherit; line-height: 1.6; resize: vertical;
}

/* 고르는 자리는 드롭다운이 아니라 설명이 보이는 카드로 (UI 원칙) */
.hf-kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hf-kind {
  display: block; text-align: left; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer;
}
.hf-kind b { display: block; font-size: 14px; color: #111827; }
.hf-kind span { display: block; margin-top: 4px; font-size: 12px; line-height: 1.5; color: #6b7280; }
.hf-kind.on { border-color: #f59e0b; background: #fffbeb; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2); }

.hf-len { display: flex; align-items: center; gap: 14px; margin-top: 14px; font-size: 13px; color: #374151; }
.hf-len > span { font-weight: 700; }
.hf-len label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

.hf-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hf-chips button {
  width: auto; padding: 5px 10px; font-size: 12px; color: #475467;
  background: #fff; border: 1px solid var(--line); border-radius: 20px; cursor: pointer;
}
.hf-chips button:hover { border-color: #f59e0b; color: #b45309; }

.hf-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.hf-actions button { width: auto; padding: 11px 18px; }
.hf-actions button:disabled { opacity: 0.7; cursor: wait; }
.hf-status { font-size: 12px; color: #6b7280; line-height: 1.5; }
.hf-status.error { color: #dc2626; }

/* 스크롤 영역을 따로 두지 않는다 — 다이얼로그가 이미 스크롤된다.
   안쪽에 또 스크롤을 만들면 글을 읽다가 스크롤이 두 겹으로 걸려 답답해진다. */
.hf-result { padding: 18px 22px; background: #fff; }
.hf-result h3 { margin: 20px 0 10px; font-size: 15px; color: #1f2937; }
.hf-vicarious {
  padding: 12px 14px; border-left: 3px solid #f59e0b; background: #fffbeb; border-radius: 0 8px 8px 0;
}
.hf-vicarious b { display: block; font-size: 12px; color: #b45309; margin-bottom: 4px; }
.hf-vicarious span { color: #1f2937; line-height: 1.6; }

.hf-titles { display: grid; gap: 8px; }
.hf-title {
  display: block; text-align: left; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer;
}
.hf-title b { display: block; font-size: 15px; color: #111827; line-height: 1.45; }
.hf-title span { display: block; margin-top: 4px; font-size: 12px; color: #6b7280; }
.hf-title.on { border-color: #f59e0b; background: #fffbeb; }

.hf-thumb { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px; background: #f8fafc; border-radius: 10px; }
.hf-thumb b { font-size: 12px; color: #6b7280; }
.hf-thumb-main { font-size: 20px; font-weight: 800; color: #111827; }
.hf-thumb-sub { font-size: 13px; color: #475467; }

.hf-body { color: #263244; line-height: 1.75; }
.hf-body h4 { margin: 20px 0 8px; font-size: 16px; color: #111827; }
.hf-body p { margin: 0 0 12px; }
.hf-photo { margin: 0 0 14px; padding: 8px 12px; font-size: 12px; color: #6b7280; background: #f1f5f9; border-radius: 8px; }

.hf-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.hf-tags span { font-size: 12px; color: #475467; background: #f1f5f9; border-radius: 20px; padding: 4px 10px; }
.hf-disclosure { margin-top: 12px; padding: 10px 12px; font-size: 12px; color: #6b7280; border: 1px dashed var(--line); border-radius: 8px; }

.hf-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.hf-copy button { width: auto; padding: 9px 16px; }
.hf-photo-toggle { display: inline-flex; align-items: center; gap: 5px; margin-right: auto; font-size: 12px; color: #475467; }
.hf-note { margin: 10px 0 0; font-size: 12px; color: #6b7280; }

/* 기존 원본 추적 도구는 접어 둔다 — 글쓰기가 주인공이고 이건 보조 도구다 */
.hf-origin { border-top: 1px solid var(--line); background: #f8fafc; }
.hf-origin > summary { padding: 14px 22px; font-size: 13px; color: #475467; cursor: pointer; }

@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
  }

  .hf-kinds {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .topbar,
  .toolbar,
  .source-workbench,
  .origin-result {
    grid-template-columns: 1fr;
    display: grid;
  }

  .metrics {
    width: 100%;
  }

  .metrics div {
    flex: 1;
  }

  .main {
    padding: 20px 16px 44px;
  }
}

/* 분석 결과 안의 작은 소제목 — h4보다 한 단계 아래 */
.ref-sub { margin: 14px 0 6px; font-size: 12px; font-weight: 700; color: #6b7280; }

/* 분석 보관함 — 해부 결과는 다시 만들 수 없는 자산이라 목록으로 꺼내 쓴다 */
.refbox { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }
.refbox-empty { margin: 0; padding: 10px 2px; font-size: 12px; color: #6b7280; line-height: 1.6; }
.refbox-row { display: grid; grid-template-columns: 1fr 28px; gap: 4px; align-items: stretch; }
.refbox-open { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; width: 100%; }
.refbox-open:hover { border-color: var(--accent, #2563eb); }
.refbox-open b { font-size: 12.5px; color: #111827; line-height: 1.45; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.refbox-open span { font-size: 11.5px; color: #6b7280; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.refbox-open small { font-size: 10.5px; color: #9ca3af; }
.refbox-del { border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #9ca3af;
  cursor: pointer; font-size: 12px; padding: 0; }
.refbox-del:hover { color: #ef4444; border-color: #fca5a5; }
.refbox-bar { display: flex; gap: 6px; margin: 6px 0 8px; }
.refbox-mini { flex: 1; padding: 6px 8px; font-size: 11.5px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: #4b5563; cursor: pointer; }
.refbox-mini:hover { border-color: var(--accent, #2563eb); color: #111827; }
