/* ==========================================
   书籍人物关系图谱分析器 - 主样式
   ========================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #0f0f23;
  color: #e0e0e0;
  overflow: hidden;
  height: 100vh;
  padding-top: 60px;
}

/* ========== 搜索面板 ========== */
#search-panel {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(180deg, #1a1a3e 0%, rgba(26, 26, 62, 0.95) 100%);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #2a2a5c;
  backdrop-filter: blur(10px);
}

#search-panel h1 {
  font-size: 20px;
  font-weight: 600;
  color: #8b8bff;
  white-space: nowrap;
  letter-spacing: 1px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 500px;
}

/* 确保按钮可见 */
#edit-btn, #restore-btn {
  display: inline-block !important;
  visibility: visible !important;
}

#analyze-btn {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #6b6bff 0%, #8b5cf6 100%);
  color: white;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

#analyze-btn:hover {
  background: linear-gradient(135deg, #7b7bff 0%, #9b6cf6 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(107, 107, 255, 0.3);
}

#analyze-btn:active {
  transform: translateY(0);
}

#analyze-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 历史记录 */
#history-list {
  display: flex;
  gap: 8px;
  margin-left: auto;
  overflow-x: auto;
  max-width: 400px;
}

.history-tag {
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(107, 107, 255, 0.1);
  border: 1px solid #3a3a6c;
  color: #a0a0ff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s;
}

.history-tag:hover {
  background: rgba(107, 107, 255, 0.2);
  border-color: #6b6bff;
}

/* ========== 加载状态 ========== */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: rgba(15, 15, 35, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

#loading-overlay.hidden {
  display: none;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #2a2a5c;
  border-top-color: #6b6bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-text {
  margin-top: 20px;
  font-size: 16px;
  color: #8b8bff;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ========== 主内容区 ========== */
#main-content {
  display: flex;
  height: 100vh;
  padding-top: 65px;
}

#graph-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#graph-svg {
  width: 100%;
  height: 100%;
  cursor: grab;
}

#graph-svg:active {
  cursor: grabbing;
}

/* 图例 */
#graph-legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(26, 26, 62, 0.9);
  border: 1px solid #2a2a5c;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 12px;
  backdrop-filter: blur(5px);
}

#graph-legend h4 {
  margin-bottom: 8px;
  color: #8b8bff;
  font-size: 13px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.legend-line {
  width: 30px;
  height: 2px;
}

/* 缩放控件 */
#graph-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#graph-controls button {
  width: 40px;
  height: 40px;
  border: 1px solid #3a3a6c;
  border-radius: 8px;
  background: rgba(26, 26, 62, 0.9);
  color: #a0a0ff;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s;
  backdrop-filter: blur(5px);
}

#graph-controls button:hover {
  background: rgba(107, 107, 255, 0.2);
  border-color: #6b6bff;
}

/* ========== 信息面板 ========== */
#info-panel {
  width: 360px;
  background: linear-gradient(180deg, #1a1a3e 0%, #151530 100%);
  border-left: 1px solid #2a2a5c;
  padding: 24px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  position: relative;
}

#info-panel.visible {
  transform: translateX(0);
}

#close-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 1px solid #3a3a6c;
  border-radius: 6px;
  background: transparent;
  color: #8a8aaa;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

#close-panel:hover {
  background: rgba(255, 100, 100, 0.1);
  border-color: #ff6464;
  color: #ff6464;
}

/* 头像 */
#character-portrait {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 20px;
  overflow: hidden;
  border: 3px solid #4a4a8c;
  box-shadow: 0 0 30px rgba(107, 107, 255, 0.2);
}

#portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#character-name {
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  color: #e0e0ff;
  margin-bottom: 16px;
}

#character-bio {
  font-size: 14px;
  line-height: 1.8;
  color: #b0b0d0;
  margin-bottom: 20px;
  padding: 12px;
  background: rgba(107, 107, 255, 0.05);
  border-radius: 8px;
  border: 1px solid #2a2a5c;
}

/* 基本信息 */
#character-basic-info {
  margin-bottom: 20px;
}

#character-basic-info h3 {
  font-size: 15px;
  color: #8b8bff;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #2a2a5c;
}

.info-row {
  display: flex;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(42, 42, 92, 0.5);
}

.info-label {
  width: 80px;
  color: #7a7aaa;
  flex-shrink: 0;
}

.info-value {
  color: #c0c0e0;
  flex: 1;
}

/* 关系列表 */
#character-relations h3 {
  font-size: 15px;
  color: #8b8bff;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #2a2a5c;
}

#relations-list {
  list-style: none;
}

#relations-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: 6px;
  font-size: 13px;
  transition: background 0.3s;
}

/* 有时间线的关系 - 可点击 */
#relations-list li.has-timeline {
  cursor: pointer;
  background: rgba(107, 107, 255, 0.05);
  border: 1px solid rgba(107, 107, 255, 0.2);
  position: relative;
}

#relations-list li.has-timeline::before {
  content: '●';
  position: absolute;
  left: 4px;
  color: #6366f1;
  font-size: 8px;
  animation: pulse 2s ease-in-out infinite;
}

#relations-list li.has-timeline:hover {
  background: rgba(107, 107, 255, 0.15);
  border-color: rgba(107, 107, 255, 0.4);
  box-shadow: 0 0 10px rgba(107, 107, 255, 0.2);
  transform: translateX(2px);
}

#relations-list li.has-timeline .rel-type {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #ffffff;
  font-weight: 600;
}

#relations-list li.has-timeline .rel-name {
  color: #ffffff;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 无时间线的关系 - 不可点击 */
#relations-list li.no-timeline {
  cursor: default;
  opacity: 0.6;
  background: transparent;
}

#relations-list li.no-timeline:hover {
  background: transparent;
}

#relations-list li.no-timeline .rel-type {
  background: rgba(107, 107, 255, 0.1);
  color: #8080a0;
}

#relations-list li.no-timeline .rel-name {
  color: #9090b0;
}

.rel-type {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  white-space: nowrap;
}

.rel-name {
  font-weight: 500;
}

/* ========== 底部信息栏 ========== */
#book-info-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(26, 26, 62, 0.95);
  border-top: 1px solid #2a2a5c;
  padding: 10px 24px;
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: #8a8aaa;
  backdrop-filter: blur(10px);
}

#book-info-bar.hidden {
  display: none;
}

#book-info-bar span {
  display: flex;
  align-items: center;
  gap: 6px;
}

#book-info-bar .label {
  color: #5a5a8c;
}

#book-info-bar .value {
  color: #b0b0ff;
}

/* ========== 欢迎页 ========== */
#welcome-screen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #5a5a8c;
}

#welcome-screen h2 {
  font-size: 28px;
  color: #4a4a8c;
  margin-bottom: 16px;
  font-weight: 300;
}

#welcome-screen p {
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 24px;
}

.example-books {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.example-book {
  padding: 8px 20px;
  border: 1px solid #3a3a6c;
  border-radius: 20px;
  color: #8b8bff;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
}

.example-book:hover {
  background: rgba(107, 107, 255, 0.15);
  border-color: #6b6bff;
  transform: translateY(-2px);
}

/* ========== 错误提示 ========== */
#error-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: #3a1a1a;
  border: 1px solid #6a2a2a;
  color: #ff8888;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  display: none;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ========== D3 图形样式 ========== */
.node-circle {
  stroke: #fff;
  stroke-width: 2px;
  cursor: pointer;
  transition: stroke-width 0.3s;
}

.node-circle:hover {
  stroke-width: 3px;
  filter: brightness(1.2);
}

.node-label {
  font-size: 12px;
  fill: #d0d0f0;
  text-anchor: middle;
  pointer-events: none;
  text-shadow: 0 0 4px #0f0f23, 0 0 8px #0f0f23;
  font-weight: 500;
}

.link-line {
  stroke-opacity: 0.25;
}

.link-label {
  font-size: 13px;
  fill: #8a8aaa;
  text-anchor: middle;
  pointer-events: none;
  opacity: 0.9;
  font-weight: 600;
  text-shadow: 0 0 3px rgba(26, 26, 62, 0.8), 0 0 6px rgba(26, 26, 62, 0.6);
}

.dimmed {
  opacity: 0.1 !important;
}

.highlighted {
  opacity: 1 !important;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #3a3a6c;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #5a5a8c;
}

/* ========== 自定义角色节点 ========== */
.node-label-custom {
  fill: #00e5ff !important;
  font-weight: 600;
}

/* ========== 编辑按钮 ========== */
#edit-btn {
  padding: 10px 18px;
  border: 1px solid #3a3a6c;
  border-radius: 8px;
  background: transparent;
  color: #a0a0ff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

#edit-btn:hover {
  background: rgba(107, 107, 255, 0.15);
  border-color: #6b6bff;
}

/* 恢复按钮 */
#restore-btn {
  padding: 10px 18px;
  border: 1px solid #2a4a6a;
  border-radius: 8px;
  background: transparent;
  color: #6ab7ff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

#restore-btn:hover {
  background: rgba(68, 138, 255, 0.15);
  border-color: #4a9aff;
}

/* 已删除角色区域 */
#deleted-chars-section h4 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: #8a8aaa;
}

#deleted-chars-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.deleted-char-tag {
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 11px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ff8a8a;
  cursor: pointer;
  transition: all 0.3s;
}

.deleted-char-tag:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ffb4b4;
}

/* 恢复弹窗样式 */
#restore-chars-list {
  max-height: 350px;
  overflow-y: auto;
  margin-top: 12px;
}

.select-all-container {
  display: flex;
  align-items: center;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 6px;
  background: rgba(107, 107, 255, 0.08);
  border: 1px solid rgba(42, 42, 92, 0.5);
}

.select-all-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.select-all-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.select-all-checkbox span {
  color: #b0b0ff;
  font-size: 14px;
  font-weight: 500;
}

.batch-restore-btn {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 1px solid #4a9c6c;
  border-radius: 8px;
  background: rgba(74, 156, 108, 0.15);
  color: #7dd9af;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.batch-restore-btn:hover:not(:disabled) {
  background: rgba(74, 156, 108, 0.25);
  border-color: #5cad8f;
}

.batch-restore-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.restore-char-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: rgba(107, 107, 255, 0.05);
  border: 1px solid rgba(42, 42, 92, 0.5);
  transition: all 0.3s;
}

.restore-char-item:hover {
  background: rgba(107, 107, 255, 0.1);
  border-color: rgba(107, 107, 255, 0.3);
}

.restore-char-checkbox {
  width: 18px;
  height: 18px;
  margin-right: 12px;
  cursor: pointer;
}

.restore-char-name {
  font-size: 14px;
  color: #e0e0ff;
  font-weight: 500;
  flex: 1;
}

.restore-char-faction {
  font-size: 11px;
  color: #8a8aaa;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(138, 138, 170, 0.15);
}

.restore-single-btn {
  padding: 6px 12px;
  border: 1px solid #2a4a6a;
  border-radius: 6px;
  background: rgba(68, 138, 255, 0.1);
  color: #6ab7ff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
  margin-left: 8px;
}

.restore-single-btn:hover {
  background: rgba(68, 138, 255, 0.2);
  border-color: #4a9aff;
  color: #8cc8ff;
}

/* 信息面板中的按钮组 */
.panel-buttons {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

#delete-char-btn,
#edit-char-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid #6a2a2a;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  color: #ff6b6b;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

#edit-char-btn {
  border-color: #2a4a6a;
  background: rgba(68, 138, 255, 0.1);
  color: #6ab7ff;
}

#delete-char-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

#edit-char-btn:hover {
  background: rgba(68, 138, 255, 0.25);
  border-color: #4a9aff;
}

/* 阵营标签 */
.character-faction {
  text-align: center;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.character-faction .faction-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #b4a6ff;
  transition: all 0.3s;
}

.character-faction .clickable-faction {
  cursor: pointer;
}

.character-faction .clickable-faction:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: rgba(139, 92, 246, 0.6);
  color: #c0c0ff;
  transform: scale(1.05);
}

/* 详细信息部分 */
#character-details {
  margin-bottom: 20px;
}

.detail-section {
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(107, 107, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(42, 42, 92, 0.5);
}

.detail-section h4 {
  font-size: 13px;
  color: #8b8bff;
  margin-bottom: 8px;
  font-weight: 500;
}

.detail-section p {
  font-size: 13px;
  line-height: 1.6;
  color: #a0a0c0;
}

/* 技能列表 */
.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-tag {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* 台词列表 */
.quotes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quote-item {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #c0c0e0;
  background: rgba(251, 191, 36, 0.05);
  border-left: 3px solid rgba(251, 191, 36, 0.4);
  font-style: italic;
}

/* 自定义标签 */
.custom-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.3);
  margin-left: 8px;
  vertical-align: middle;
}

/* ========== 编辑弹窗 ========== */
#edit-modal,
#relation-detail-modal,
#restore-modal,
#password-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  background: rgba(10, 10, 25, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

#edit-modal.hidden,
#relation-detail-modal.hidden,
#restore-modal.hidden,
#password-modal.hidden {
  display: none;
}

/* 密码验证弹窗特殊样式 - 居中并醒目 */
#password-modal .modal-content {
  background: linear-gradient(135deg, #2a1a3e 0%, #1a2a4e 100%);
  border: 2px solid #6366f1;
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.5), 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: passwordPulse 2s ease-in-out infinite;
}

@keyframes passwordPulse {
  0%, 100% {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5), 0 20px 60px rgba(0, 0, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.8), 0 20px 60px rgba(0, 0, 0, 0.5);
  }
}

#password-modal h2 {
  color: #818cf8;
  text-shadow: 0 0 10px rgba(129, 140, 248, 0.5);
}

#password-modal #password-input {
  background: rgba(99, 102, 241, 0.1);
  border: 2px solid #6366f1;
  font-size: 18px;
  padding: 12px 16px;
  transition: all 0.3s ease;
}

#password-modal #password-input:focus {
  background: rgba(99, 102, 241, 0.15);
  border-color: #818cf8;
  box-shadow: 0 0 15px rgba(129, 140, 248, 0.3);
  outline: none;
}

#password-modal #password-confirm-btn {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  font-weight: 600;
  transition: all 0.3s ease;
}

#password-modal #password-confirm-btn:hover {
  background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

.modal-content {
  background: #1a1a3e;
  border: 1px solid #3a3a6c;
  border-radius: 14px;
  padding: 28px;
  width: 460px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
  font-size: 20px;
  color: #e0e0ff;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid #3a3a6c;
  border-radius: 6px;
  background: transparent;
  color: #8a8aaa;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(255, 100, 100, 0.1);
  color: #ff6464;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: #8a8aaa;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #3a3a6c;
  border-radius: 8px;
  background: #12122a;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: #6b6bff;
}

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

/* 关系行 */
.relation-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.relation-row select,
.relation-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #3a3a6c;
  border-radius: 6px;
  background: #12122a;
  color: #e0e0e0;
  font-size: 13px;
  outline: none;
}

.relation-row .remove-rel-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #ff6b6b;
  border-radius: 6px;
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: bold;
  transition: all 0.2s;
}

.relation-row .remove-rel-btn:hover {
  background: rgba(255, 107, 107, 0.25);
  border-color: #ff8787;
  transform: scale(1.05);
}

#add-relation-btn {
  padding: 6px 14px;
  border: 1px dashed #3a3a6c;
  border-radius: 6px;
  background: transparent;
  color: #8a8aaa;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 16px;
}

#add-relation-btn:hover {
  border-color: #6b6bff;
  color: #a0a0ff;
}

#submit-char-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #00b8d4 0%, #00e5ff 100%);
  color: #0a0a19;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

#submit-char-btn:hover {
  box-shadow: 0 4px 20px rgba(0, 229, 255, 0.3);
  transform: translateY(-1px);
}

/* 密码弹窗按钮 */
.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

.modal-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

#password-confirm-btn {
  background: #6366f1;
  color: white;
}

#password-confirm-btn:hover {
  background: #5558e3;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

#password-cancel-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
}

#password-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  #search-panel {
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  #search-panel h1 {
    font-size: 16px;
    width: 100%;
  }

  .search-box {
    max-width: 100%;
  }

  #history-list {
    display: none;
  }

  #info-panel {
    position: fixed;
    top: 65px;
    right: 0;
    bottom: 0;
    width: 300px;
    z-index: 150;
  }
}

/* ========== 关系详情弹窗 ========== */
.relation-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(107, 107, 255, 0.05);
  border-radius: 10px;
}

.relation-actors {
  font-size: 18px;
  font-weight: 600;
  color: #e0e0ff;
  transition: color 0.3s;
}

.relation-actors.clickable-actor:hover {
  color: #6b6bff;
  text-decoration: underline;
  text-decoration-color: #6b6bff;
}

.relation-arrow {
  font-size: 20px;
  color: #8b8bff;
}

.relation-type-display {
  text-align: center;
  margin-bottom: 20px;
}

.relation-type-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 12px;
  font-size: 14px;
  background: rgba(139, 139, 255, 0.2);
  border: 1px solid rgba(139, 139, 255, 0.4);
  color: #b4a6ff;
}

.relation-description-section {
  margin-bottom: 16px;
  padding: 16px;
  background: rgba(251, 191, 36, 0.05);
  border-radius: 8px;
  border-left: 3px solid rgba(251, 191, 36, 0.4);
}

.relation-description-section h4 {
  font-size: 13px;
  color: #fbbf24;
  margin-bottom: 8px;
  font-weight: 500;
}

.relation-description {
  font-size: 14px;
  line-height: 1.8;
  color: #c0c0e0;
  font-style: italic;
}

.relation-meta {
  text-align: center;
  font-size: 12px;
  color: #7a7aaa;
  margin-bottom: 16px;
}

.relation-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.relation-action-btn {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid #3a3a6c;
  border-radius: 8px;
  background: rgba(107, 107, 255, 0.1);
  color: #b0b0ff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s;
}

.relation-action-btn:hover {
  background: rgba(107, 107, 255, 0.2);
  border-color: #6b6bff;
  color: #e0e0ff;
}

/* ========== 关系时间线样式 ========== */
.timeline-modal {
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
}

.relation-timeline-header {
  text-align: center;
  padding: 16px;
  background: rgba(107, 107, 255, 0.05);
  border-radius: 10px;
  margin-bottom: 20px;
}

.relation-actors-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.relation-actor-name {
  font-size: 18px;
  font-weight: 600;
  color: #e0e0ff;
}

.relation-actor-arrow {
  font-size: 20px;
  color: #8b8bff;
}

.relation-type-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 12px;
  background: rgba(139, 139, 255, 0.2);
  border: 1px solid rgba(139, 139, 255, 0.4);
  color: #b4a6ff;
}

/* 时间线样式 */
.timeline {
  position: relative;
  padding: 20px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #6b6bff, #8b5cff);
  border-radius: 1px;
}

.timeline-event {
  position: relative;
  padding: 16px 0 16px 50px;
  margin-bottom: 12px;
}

.timeline-event::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1a1a3e;
  border: 3px solid #6b6bff;
  z-index: 1;
}

.timeline-event.high-importance::before {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.2);
}

.timeline-event.medium-importance::before {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.2);
}

.timeline-event.low-importance::before {
  border-color: #6b7280;
  background: rgba(107, 114, 128, 0.2);
}

.timeline-event-content {
  background: rgba(107, 107, 255, 0.05);
  border-radius: 10px;
  padding: 16px;
  border: 1px solid rgba(42, 42, 92, 0.5);
  transition: all 0.3s ease;
}

.timeline-event-content:hover {
  background: rgba(107, 107, 255, 0.1);
  border-color: rgba(107, 107, 255, 0.3);
}

.timeline-event-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.timeline-event-year {
  font-size: 12px;
  font-weight: 600;
  color: #8b8bff;
  white-space: nowrap;
}

.timeline-event-book {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(139, 139, 255, 0.15);
  border: 1px solid rgba(139, 139, 255, 0.3);
  color: #b4a6ff;
  white-space: nowrap;
}

.timeline-event-text {
  font-size: 14px;
  line-height: 1.6;
  color: #c0c0e0;
}

.timeline-importance-high {
  border-left: 3px solid #f59e0b;
}

.timeline-importance-medium {
  border-left: 3px solid #10b981;
}

.timeline-importance-low {
  border-left: 3px solid #6b7280;
}

.timeline-empty {
  text-align: center;
  padding: 40px 20px;
  color: #7a7aaa;
  font-size: 14px;
}

/* 滚动条样式 */
.timeline-modal::-webkit-scrollbar {
  width: 8px;
}

.timeline-modal::-webkit-scrollbar-track {
  background: rgba(26, 26, 62, 0.5);
  border-radius: 4px;
}

.timeline-modal::-webkit-scrollbar-thumb {
  background: rgba(107, 107, 255, 0.3);
  border-radius: 4px;
}

.timeline-modal::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 107, 255, 0.5);
}
