@import url('https://fonts.googleapis.com/css2?family=Nanum+Gothic:wght@400;700&family=Nanum+Myeongjo:wght@400;700&family=RIDIBatang&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

/* ===================== RESET & BASE ===================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', sans-serif;
  color: #222;
  background: #f5f7fa;
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== 분할 ���이지: 전체 스크롤 방지 ===== */
body.split-page {
  overflow: hidden;
  height: 100vh;
}

body.split-page .page-wrapper {
  height: 100vh;
  overflow: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: 0.95rem;
}

/* ===================== MAIN LANDING ===================== */
.landing-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: #ffffff;
}

.landing-header {
  text-align: center;
  margin-bottom: 3rem;
}

.landing-header h1 {
  font-size: 2.4rem;
  font-weight: 700;
  color: #333;
}

.landing-header p {
  font-size: 1.05rem;
  color: #777;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.8rem;
  width: 100%;
  max-width: 900px;
}

.tool-card {
  background: #fff;
  border-radius: 20px;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
  color: #222;
}

.tool-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

.tool-card .card-icon {
  font-size: 3rem;
  margin-bottom: 1.2rem;
  display: block;
}

.tool-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
  color: #333;
}

.tool-card p {
  font-size: 0.9rem;
  color: #777;
  line-height: 1.6;
}

.tool-card .card-btn {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.6rem 1.8rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #4A90D9, #764ba2);
  transition: opacity 0.2s;
}

.tool-card:hover .card-btn {
  opacity: 0.9;
}

.landing-footer {
  margin-top: 3rem;
  color: #aaa;
  font-size: 0.85rem;
}

/* ===================== TOOL PAGE LAYOUT ===================== */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  background: #fff;
  border-bottom: 1px solid #e8eaf0;
  padding: 0.9rem 1.6rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: #4A90D9;
  font-weight: 500;
  transition: opacity 0.2s;
}

.back-link:hover { opacity: 0.75; }

.page-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #333;
  flex: 1;
}

.split-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 400px 1fr;
  overflow: hidden;
  min-height: 0;
}

/* ===================== EDITOR PANEL ===================== */
.editor-panel {
  background: #fff;
  border-right: 1px solid #e8eaf0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.editor-panel::-webkit-scrollbar { width: 6px; }
.editor-panel::-webkit-scrollbar-track { background: #f1f1f1; }
.editor-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.section-block {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid #f0f2f5;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title i { color: #4A90D9; }

/* ===================== FORM ELEMENTS ===================== */
.form-group {
  margin-bottom: 0.9rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.3rem;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid #e0e3ea;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #333;
  background: #fafbfc;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: #4A90D9;
  box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
  background: #fff;
}

.form-textarea {
  resize: vertical;
  min-height: 72px;
}

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary { background: #4A90D9; color: #fff; }
.btn-primary:hover { background: #3a7bc8; }

.btn-success { background: #22c55e; color: #fff; }
.btn-success:hover { background: #16a34a; }

.btn-secondary { background: #f0f2f5; color: #555; }
.btn-secondary:hover { background: #e2e5eb; }

.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }

.btn-warning { background: #fef3c7; color: #d97706; }
.btn-warning:hover { background: #fde68a; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; border-radius: 6px; }

.btn-icon {
  padding: 0.3rem 0.5rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #999;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: #f0f2f5; color: #555; }
.btn-icon.danger:hover { background: #fee2e2; color: #dc2626; }
.btn-icon:disabled { opacity: 0.3; cursor: default; }
.btn-icon:disabled:hover { background: transparent; color: #999; }

.btn-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ===================== TOGGLE SWITCH ===================== */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.toggle-label { font-size: 0.88rem; font-weight: 500; color: #444; }

.toggle-switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: #4A90D9; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===================== CHARACTER CARDS (프로필 카드 - 에디터) ===================== */
.character-card {
  border: 1.5px solid #e8eaf0;
  border-radius: 10px;
  padding: 0;
  margin-bottom: 0.6rem;
  background: #fafbfc;
  position: relative;
  overflow: hidden;
}

.character-card .form-group { margin-bottom: 0.6rem; }
.character-card .form-group:last-child { margin-bottom: 0; }

.character-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  border-bottom: 1px solid #f0f2f5;
}

.character-card-header:hover { background: #f0f2f5; }

/* 카드 본문 영역 — 패딩 추가 */
.character-card-body {
  padding: 0.7rem 0.8rem 0.8rem;
}

.char-card-body {
  padding: 0.7rem 0.8rem 0.8rem;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.char-card-body.collapsed {
  max-height: 0 !important;
  padding-top: 0;
  padding-bottom: 0;
}

.character-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: #4A90D9;
  background: #e8f1fb;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
}

.char-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* 프로필 이미지 업로드 영역 콤팩트 */
.char-img-upload-area { display: flex; align-items: center; gap: 0.5rem; }
.char-img-preview { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.char-img-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8eaf0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 0.7rem;
  flex-shrink: 0;
}

/* ===================== MESSAGE ITEMS ===================== */
.message-item {
  border: 1.5px solid #e8eaf0;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.7rem;
  background: #fafbfc;
  cursor: grab;
}
.message-item:active { cursor: grabbing; }

.message-item-header { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.6rem; flex-wrap: wrap; }

.message-type-badge { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 20px; text-transform: uppercase; }
.badge-chat { background: #dbeafe; color: #2563eb; }
.badge-scene { background: #fef3c7; color: #d97706; }
.badge-system { background: #fef3c7; color: #d97706; }

.drag-handle { color: #ccc; cursor: grab; font-size: 0.85rem; }

/* ===================== NODE ITEMS ===================== */
.node-item {
  border: 1.5px solid #e8eaf0;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.7rem;
  background: #fafbfc;
  cursor: grab;
}
.node-item:active { cursor: grabbing; }

.node-item-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.7rem; }

/* 노드 에디터 도트 프리뷰 (텍스트 기반) */
.node-dot-preview {
  width: auto !important;
  height: auto !important;
  border: none !important;
  border-radius: 0 !important;
  background: none !important;
  flex-shrink: 0;
  line-height: 1;
  font-size: 14px;
}

.node-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.5rem; }
.node-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }

/* ===================== PROFILE CARDS ===================== */
.profile-card {
  border: 1.5px solid #e8eaf0;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.7rem;
  background: #fafbfc;
}

.profile-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }

.profile-img-upload { display: flex; align-items: center; gap: 0.5rem; }
.char-count { font-size: 0.72rem; color: #aaa; text-align: right; margin-top: 2px; }

/* ===================== PREVIEW PANEL ===================== */
.preview-panel {
  background: #f5f7fa;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  padding: 1.5rem;
}

.preview-panel::-webkit-scrollbar { width: 6px; }
.preview-panel::-webkit-scrollbar-track { background: #f1f1f1; }
.preview-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.preview-inner { width: 100%; max-width: 480px; }

/* ===================== MESSENGER PREVIEW ===================== */
.messenger-preview { border-radius: 20px; overflow: hidden; box-shadow: 0 8px 40px rgba(0,0,0,0.15); min-height: 400px; display: flex; flex-direction: column; }
.messenger-header { padding: 1rem 1.2rem; display: flex; align-items: center; gap: 0.8rem; }
.messenger-header .room-name { font-size: 1rem; font-weight: 700; }
.messenger-body { flex: 1; padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.6rem; }

/* Bubble layout */
.bubble-row { display: flex; align-items: flex-end; gap: 0.5rem; }
.bubble-row.right { flex-direction: row-reverse; }
.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}
.bubble-content { display: flex; flex-direction: column; max-width: 70%; }
.bubble-row.right .bubble-content { align-items: flex-end; }
.bubble-name { font-size: 0.72rem; font-weight: 600; margin-bottom: 0.2rem; color: inherit; opacity: 0.7; }
.bubble-text { padding: 0.5rem 0.85rem; border-radius: 18px; font-size: 0.9rem; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }

/* Scene / System message */
.scene-block { display: flex; align-items: center; gap: 0.7rem; padding: 0.4rem 0.6rem; }
.scene-block::before, .scene-block::after { content: ''; flex: 1; height: 1px; opacity: 0.3; }
.scene-text { font-size: 0.8rem; font-weight: 600; white-space: nowrap; opacity: 0.75; }

/* ===================== THEMES: MESSENGER ===================== */
.theme-kakao .messenger-preview { background: #B2C7D9; }
.theme-kakao .messenger-header { background: #a8bfcf; }
.theme-kakao .messenger-header .room-name { color: #fff; }
.theme-kakao .bubble-row.left .bubble-text { background: #fff; color: #222; border-radius: 0 18px 18px 18px; }
.theme-kakao .bubble-row.right .bubble-text { background: #FEE500; color: #222; border-radius: 18px 0 18px 18px; }
.theme-kakao .bubble-name { color: #333; }
.theme-kakao .scene-block::before, .theme-kakao .scene-block::after { background: #666; }
.theme-kakao .scene-text { color: #444; }

.theme-line .messenger-preview { background: #f5f5f5; }
.theme-line .messenger-header { background: #06C755; }
.theme-line .messenger-header .room-name { color: #fff; }
.theme-line .bubble-row.left .bubble-text { background: #fff; color: #222; border-radius: 0 18px 18px 18px; }
.theme-line .bubble-row.right .bubble-text { background: #06C755; color: #fff; border-radius: 18px 0 18px 18px; }
.theme-line .bubble-name { color: #555; }
.theme-line .scene-block::before, .theme-line .scene-block::after { background: #999; }
.theme-line .scene-text { color: #666; }

.theme-twitter .messenger-preview { background: #fff; }
.theme-twitter .messenger-header { background: #fff; border-bottom: 1px solid #e7e7e7; }
.theme-twitter .messenger-header .room-name { color: #0f1419; }
.theme-twitter .bubble-row.left .bubble-text { background: #eff3f4; color: #0f1419; border-radius: 4px 18px 18px 18px; }
.theme-twitter .bubble-row.right .bubble-text { background: #1D9BF0; color: #fff; border-radius: 18px 4px 18px 18px; }
.theme-twitter .bubble-name { color: #536471; }
.theme-twitter .scene-block::before, .theme-twitter .scene-block::after { background: #cfd9de; }
.theme-twitter .scene-text { color: #536471; }

.theme-light .messenger-preview { background: #f8f9fb; }
.theme-light .messenger-header { background: #fff; border-bottom: 1px solid #e8eaf0; }
.theme-light .messenger-header .room-name { color: #333; }
.theme-light .bubble-row.left .bubble-text { background: #e8f4fe; color: #2c3e50; border-radius: 4px 18px 18px 18px; }
.theme-light .bubble-row.right .bubble-text { background: #c8e6ff; color: #1a2c3d; border-radius: 18px 4px 18px 18px; }
.theme-light .bubble-name { color: #666; }
.theme-light .scene-block::before, .theme-light .scene-block::after { background: #bbb; }
.theme-light .scene-text { color: #888; }

.theme-dark .messenger-preview { background: #1a1a2e; }
.theme-dark .messenger-header { background: #16213e; }
.theme-dark .messenger-header .room-name { color: #e0e0e0; }
.theme-dark .bubble-row.left .bubble-text { background: #2a2a4a; color: #ddd; border-radius: 4px 18px 18px 18px; }
.theme-dark .bubble-row.right .bubble-text { background: #0f3460; color: #e0e0e0; border-radius: 18px 4px 18px 18px; }
.theme-dark .bubble-name { color: #aaa; }
.theme-dark .scene-block::before, .theme-dark .scene-block::after { background: #555; }
.theme-dark .scene-text { color: #aaa; }

/* ===================== TIMELINE PREVIEW ===================== */
.timeline-wrapper {
  background: #fdf8f0;
  border-radius: 16px;
  padding: 2rem 1.5rem;
  box-shadow: 0 4px 30px rgba(0,0,0,0.1);
}

.profiles-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.profile-chip { display: flex; align-items: center; gap: 0.6rem; background: #fff; border-radius: 12px; padding: 0.5rem 0.9rem; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.profile-avatar { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.profile-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.profile-info strong { display: block; font-size: 0.85rem; font-weight: 700; color: #333; }
.profile-info span { font-size: 0.75rem; color: #888; }

/* Timeline */
.timeline-list { position: relative; }
.timeline-line-container { position: absolute; left: 9px; top: 0; }

/* 타임라인 노드 */
.timeline-node {
  position: relative;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.node-marker { position: absolute; left: 0; top: 6px; border-radius: 50%; border: 2px solid #4A90D9; background: transparent; flex-shrink: 0; }
.node-marker.last { background: currentColor; border-color: currentColor; }

/* 우측 정렬 */
.timeline-node.align-right {
  padding-left: 0;
  padding-right: 24px;
  text-align: right;
}
.timeline-node.align-right .node-marker {
  left: auto;
  right: 0;
}

/* 중앙 정렬 - 좌측 노드 */
.timeline-node.align-center-left {
  padding-left: 0;
  padding-right: calc(50% + 14px);
  text-align: right;
}
.timeline-node.align-center-left .node-marker {
  left: auto;
  right: calc(50% - 7px);
}

/* 중앙 정렬 - 우측 노드 */
.timeline-node.align-center-right {
  padding-left: calc(50% + 14px);
  padding-right: 0;
  text-align: left;
}
.timeline-node.align-center-right .node-marker {
  left: calc(50% - 7px);
  right: auto;
}

.node-time { font-size: 0.85rem; font-weight: 700; color: #555; margin-bottom: 0.25rem; }
.node-desc { font-size: 0.88rem; color: #666; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }

/* ===================== EXPORT SECTION ===================== */
.export-section { padding: 1.2rem 1.4rem; background: #f9fafb; border-top: 1px solid #e8eaf0; margin-top: auto; flex-shrink: 0; }
.export-section .section-title { margin-bottom: 0.8rem; }

/* ===================== ACCORDION ===================== */
.accordion-section { border-bottom: 1px solid #f0f2f5; }
.accordion-header { padding: 0.85rem 1.4rem; display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; transition: background 0.15s; }
.accordion-header:hover { background: #f8f9fb; }
.accordion-title { font-size: 0.82rem; font-weight: 700; color: #555; display: flex; align-items: center; gap: 0.5rem; }
.accordion-title i { color: #4A90D9; }
.accordion-toggle-icon { font-size: 0.75rem; color: #aaa; transition: transform 0.2s; }
.accordion-body { padding: 0 1.4rem 1rem; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; }
.accordion-section.collapsed .accordion-body { max-height: 0 !important; padding-top: 0; padding-bottom: 0; overflow: hidden; }
.accordion-section.collapsed .accordion-toggle-icon { transform: rotate(-90deg); }

/* ===================== MOBILE TABS ===================== */
.mobile-tabs {
  display: none;
  border-bottom: 1px solid #e8eaf0;
  background: #fff;
  flex-shrink: 0;
}
.mobile-tab-btn {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 600;
  color: #999;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  text-align: center;
}
.mobile-tab-btn.active { color: #4A90D9; border-bottom-color: #4A90D9; }

/* ===================== SORTABLE GHOST ===================== */
.sortable-ghost { opacity: 0.4; background: #e8f1fb !important; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  body.split-page .page-wrapper { height: 100vh; overflow: hidden; }
  .split-layout { grid-template-columns: 1fr; overflow: hidden; min-height: 0; }
  .mobile-tabs { display: flex; }
  .editor-panel, .preview-panel { overflow-y: auto; min-height: 0; }
  .editor-panel[data-hidden="true"] { display: none; }
  .preview-panel[data-hidden="true"] { display: none; }
  .preview-panel { padding: 1rem; }
  .preview-inner { max-width: 100%; }
  .landing-header h1 { font-size: 1.8rem; }
  .card-grid { grid-template-columns: 1fr; }
  .char-row, .node-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .page-header { padding: 0.7rem 1rem; }
  .section-block { padding: 1rem; }
}

/* ===================== PROFILE V2 + RELATIONS ===================== */
.profiles-row-v2 {
  margin-bottom: 2rem;
}

/* 한 줄 가로 배치 (항상 인물1 ←→ 인물2 ←→ 인물3) */
.profiles-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0;
  width: 100%;
}

.profile-chip-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.profile-avatar-v2 {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar-v2 img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.profile-name-v2 {
  font-size: 0.78rem;
  font-weight: 600;
  color: #333;
  text-align: center;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 인접 인물 관계 화살표 (가운데 정렬) */
.relation-arrow-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 0.5rem;
  gap: 0.1rem;
  margin-bottom: 1.1rem;
  flex-shrink: 0;
}

.relation-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #555;
  white-space: nowrap;
}

.relation-label-preview {
  font-size: 0.68rem;
  font-weight: 700;
  color: #555;
  white-space: nowrap;
  text-align: center;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.relation-label-empty {
  height: 0.85rem;
}

.relation-arrows {
  font-size: 0.6rem;
  color: #aaa;
  letter-spacing: 1px;
  text-align: center;
}

/* 에디터: 관계 설정 행 */
.relation-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.relation-pair {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.relation-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #4A90D9;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===================== NODE SHAPE MARKER ===================== */
.node-shape-marker {
  position: absolute;
  font-size: 14px;
  line-height: 1;
  width: 14px;
  text-align: center;
}

/* left 정렬 (기본) */
.timeline-node .node-shape-marker {
  left: 0;
  top: 2px;
}

/* right 정렬 */
.timeline-node.align-right .node-shape-marker {
  left: auto;
  right: 0;
}

/* center 정렬 — 마커를 연결선(50%) 기준 정확히 중앙 배치 */
.timeline-node.align-center-left .node-shape-marker {
  left: auto;
  right: calc(50% - 7px);
}

.timeline-node.align-center-right .node-shape-marker {
  left: calc(50% - 7px);
  right: auto;
}

/* 연결선 */
.timeline-vertical-line {
  position: absolute;
  top: 7px;
  width: 2px;
  height: calc(100% - 14px);
  border-radius: 2px;
}

/* ===================== CUSTOM THEME OPTIONS ===================== */
#customThemeOptions { display: none; margin-top: 0.6rem; padding: 0.8rem; background: #f8f9fb; border: 1.5px solid #e8eaf0; border-radius: 10px; }
#customThemeOptions.visible { display: block; }
.color-picker-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.color-picker-row:last-child { margin-bottom: 0; }
.color-picker-row label { font-size: 0.8rem; font-weight: 500; color: #555; flex: 1; }
.color-picker-row input[type="color"] { width: 32px; height: 32px; flex-shrink: 0; }

/* ===================== CUSTOM THEME ===================== */
.theme-custom .messenger-header .room-name { color: #fff; }
.theme-custom .bubble-row.left .bubble-text { border-radius: 0 18px 18px 18px; }
.theme-custom .bubble-row.right .bubble-text { border-radius: 18px 0 18px 18px; }
.theme-custom .bubble-name { opacity: 0.7; }
.theme-custom .scene-block::before, .theme-custom .scene-block::after { background: currentColor; opacity: 0.3; }
.theme-custom .scene-text { opacity: 0.75; }

/* ===================== UTILITIES ===================== */
.text-muted { color: #999; font-size: 0.82rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ===================== RANGE SLIDER ===================== */
input[type="range"] { -webkit-appearance: none; width: 100%; height: 4px; border-radius: 4px; background: #e0e3ea; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #4A90D9; cursor: pointer; }

/* ===================== COLOR PICKER ===================== */
input[type="color"] { -webkit-appearance: none; width: 36px; height: 36px; border: 1.5px solid #e0e3ea; border-radius: 8px; padding: 2px; cursor: pointer; background: #fff; }

/* ===================== EMPTY STATE ===================== */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: #aaa; }
.empty-state i { font-size: 2.5rem; margin-bottom: 0.8rem; display: block; }
.empty-state p { font-size: 0.9rem; }

/* ===================== AVATAR COLOR PALETTE ===================== */
.avatar-color-0 { background: #4A90D9; }
.avatar-color-1 { background: #e9658b; }
.avatar-color-2 { background: #f5a623; }
.avatar-color-3 { background: #7ed321; }
.avatar-color-4 { background: #9b59b6; }
.avatar-color-5 { background: #1abc9c; }

/* ===================== TIMELINE TITLE ===================== */
.timeline-title { text-align: center; font-size: 1.3rem; font-weight: 700; color: #333; margin-bottom: 1.5rem; }
