:root {
  --bg: #0f111a;
  --sidebar: #1a1d29;
  --chat-bg: #0f111a;
  --card: #232736;
  --border: #343a4f;
  --text: #e9ecf5;
  --text-muted: #8b9bb4;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --actor-bubble: #2b344d;
  --model-bubble: #3a7bd5;
  --target-glow: rgba(255, 214, 10, 0.5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* 顶部导航 */
.navbar {
  height: 50px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}
.navbar__title { font-weight: 700; font-size: 14px; }
.navbar__meta { font-size: 12px; color: var(--text-muted); margin-left: 10px; }
.navbar__right { display: flex; align-items: center; gap: 10px; }

.annotator-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(0,0,0,0.15);
}
.annotator-label { font-size: 12px; color: var(--text-muted); }
.input-small {
  width: 110px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
}
.input-small:focus { border-color: rgba(99, 102, 241, 0.8); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15); }
.nav-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.nav-btn:hover { background: rgba(255,255,255,0.05); }
.nav-progress { font-family: monospace; font-size: 13px; margin: 0 12px; }

/* 主布局：三栏 */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr 480px; /* 左侧加宽至 380px */
  height: calc(100vh - 50px);
}

/* 左侧：画像速写 */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px; /* 稍微紧凑 */
}
.persona-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.persona-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.persona-avatar { font-size: 28px; background: rgba(255,255,255,0.1); width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.persona-name { font-weight: 700; font-size: 16px; }
.persona-tag { font-size: 12px; color: var(--text-muted); }

.persona-section {
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.05);
}
.section-title { font-size: 11px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; letter-spacing: 0.5px; }
.section-body { font-size: 13px; line-height: 1.5; color: #d1d5db; }
.highlight-text { color: #818cf8; font-weight: 500; }

.text-btn { background: none; border: none; color: var(--text-muted); text-decoration: underline; cursor: pointer; font-size: 12px; padding: 0; }

/* Persona Card Optimization */
.persona-card { gap: 12px; }

.persona-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.p-tag {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  color: #94a3b8;
}

/* 核心板块样式 */
.p-section {
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
}

/* 处境 - 默认深色 */
.p-section--situation {
  background: rgba(30, 41, 59, 0.5); /* slate-800 */
  border: 1px solid rgba(255,255,255,0.05);
}

/* 核心诉求 - 高亮 (重点) */
.p-section--needs {
  background: rgba(79, 70, 229, 0.15); /* indigo-600 */
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #e0e7ff;
}
.p-section--needs .section-title { color: #818cf8; }

/* 雷区/阈值 - 警示 */
.p-section--pref {
  background: rgba(180, 83, 9, 0.15); /* amber-700 */
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fef3c7;
}
.p-section--pref .section-title { color: #fbbf24; }

/* EPM 优先级条 */
.epm-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(0,0,0,0.2);
  padding: 8px;
  border-radius: 6px;
  margin-top: 4px;
}
.epm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.epm-label { color: #94a3b8; }
.epm-val { font-weight: 600; }
.epm-val.high { color: #f87171; } /* Red */
.epm-val.mid { color: #fbbf24; }  /* Amber */
.epm-val.low { color: #9ca3af; }  /* Gray */
.epm-desc {
  font-size: 12px;
  color: #a1a1aa;
  line-height: 1.45;
  margin: -2px 0 6px 0;
  word-break: break-word;
}

/* 中间：对话流 */
.chat-container {
  background: var(--chat-bg);
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  overflow: hidden;
}
.chat-header {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(15, 17, 26, 0.85);
  backdrop-filter: blur(4px);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.select-small { background: transparent; border: none; color: var(--text); font-size: 12px; outline: none; cursor: pointer; }

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 60px 20px 40px; /* 上留空给header，下留空 */
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 气泡样式复用之前的 iMessage 风格 */
.bubbleRow { display: flex; width: 100%; }
.bubbleRow--actor { justify-content: flex-start; }
.bubbleRow--test_model { justify-content: flex-end; }

.bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.bubble--actor { background: var(--actor-bubble); color: #fff; border-bottom-left-radius: 4px; }
.bubble--test_model { background: var(--model-bubble); color: #fff; border-bottom-right-radius: 4px; }
.bubble--target { 
  box-shadow: 0 0 0 3px var(--target-glow); 
  z-index: 2; 
}
.bubble-meta { font-size: 10px; opacity: 0.5; margin-bottom: 4px; display: flex; justify-content: space-between; }

/* Guidelines & Checklist - NEW OPTIMIZATION */
.warning-banner {
  background: rgba(40, 20, 20, 0.4); /* 更深的背景 */
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #fca5a5;
  margin-bottom: 8px; /* 减少底部间距 16px -> 8px */
}
.warning-header {
  color: #818cf8; /* indigo-400 */
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 4px;
}

.warning-item {
  margin-bottom: 12px;
}
.warning-item:last-child { margin-bottom: 0; }

.w-title {
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}
.w-content {
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.5;
  margin-bottom: 6px;
}
/* 警示块 */
.w-alert {
  background: rgba(220, 38, 38, 0.15);
  border-left: 3px solid #ef4444;
  padding: 8px 10px;
  border-radius: 0 4px 4px 0;
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.5;
}
/* 例子块 */
.w-example {
  background: rgba(99, 102, 241, 0.15);
  border-left: 3px solid #818cf8;
  padding: 8px 10px;
  border-radius: 0 4px 4px 0;
  color: #c7d2fe;
  font-size: 12px;
  line-height: 1.5;
}


.checklist-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}
.checklist-title {
  font-size: 13px;
  font-weight: 700;
  color: #818cf8; /* indigo-400 */
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 4px;
}
.checklist-ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.6;
}
.checklist-ul li { margin-bottom: 8px; }
.checklist-term { color: #e2e8f0; font-weight: 600; display: block; margin-bottom: 2px; }
.checklist-desc { color: #94a3b8; font-size: 12px; }

/* 模态框内容样式 */
.guide-section { margin-bottom: 24px; }
.guide-h { color: #818cf8; font-size: 16px; font-weight: 700; margin-bottom: 12px; border-bottom: 1px solid #333; padding-bottom: 8px; }
.guide-p { color: #cbd5e1; font-size: 14px; line-height: 1.6; margin-bottom: 12px; }
.guide-ul { color: #cbd5e1; font-size: 14px; line-height: 1.6; padding-left: 20px; margin-bottom: 12px; }
.guide-li { margin-bottom: 6px; }
.guide-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.guide-table td { padding: 8px; border-bottom: 1px solid #333; vertical-align: top; }
.guide-table tr:last-child td { border-bottom: none; }
.guide-highlight { background: rgba(255,255,255,0.05); border-radius: 4px; padding: 2px 4px; color: #fff; }

/* 右侧：评分面板 */
.scoring-panel {
  background: var(--sidebar);
  border-left: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
}
.scoring__inner { display: flex; flex-direction: column; gap: 8px; }
.scoring-title { font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.scoring-question { font-size: 13px; line-height: 1.5; color: #d1d5db; background: rgba(255,255,255,0.05); padding: 10px; border-radius: 8px; }

/* 引导式评分选项 */
.rubric-list { display: flex; flex-direction: column; gap: 8px; }
.rubric-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255,255,255,0.02);
}
.rubric-item:hover { background: rgba(255,255,255,0.05); border-color: #6366f1; }
.rubric-item--active { background: rgba(99, 102, 241, 0.15); border-color: #6366f1; box-shadow: 0 0 0 1px #6366f1; }
.rubric-score { font-weight: 900; font-size: 16px; color: #818cf8; width: 24px; text-align: center; }
.rubric-desc { font-size: 12px; color: #9ca3af; line-height: 1.3; flex: 1; }
.rubric-label { font-weight: 600; color: #e5e7eb; font-size: 13px; display: block; margin-bottom: 2px; }

.input-label { font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.input-area {
  width: 100%;
  height: 80px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}
.input-area:focus { outline: none; border-color: var(--primary); }

.btn { border: none; border-radius: 6px; padding: 8px 16px; cursor: pointer; font-size: 13px; font-weight: 500; transition: 0.2s; }
.btn--primary { background: var(--primary); color: white; }
.btn--primary:hover { background: var(--primary-hover); }
.btn--block { width: 100%; padding: 12px; font-size: 14px; margin-top: 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--small { padding: 4px 12px; font-size: 12px; }
.btn--outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
}
.btn--outline:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
}

.confidence-selector {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: #cbd5e1;
}
.confidence-selector label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.confidence-selector input { margin: 0; }

.tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-left: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
}
.tag--good { background: rgba(16, 185, 129, 0.15); border-color: rgba(16, 185, 129, 0.4); color: #6ee7b7; }
.tag--bad { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.tag--mid { background: rgba(59, 130, 246, 0.15); border-color: rgba(59, 130, 246, 0.4); color: #93c5fd; }

/* 模态框 */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 100; display: flex; justify-content: center; align-items: center; }
.modal.hidden { display: none; }
.modal-content { background: var(--card); width: 600px; max-height: 80vh; border-radius: 12px; display: flex; flex-direction: column; border: 1px solid var(--border); box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
.modal-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 16px; overflow-y: auto; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.close-btn { background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }

/* Grid Styles */
.grid-legend { margin-bottom: 16px; display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.dot-done { background: rgba(16, 185, 129, 0.2); border: 1px solid rgba(16, 185, 129, 0.5); }
.dot-todo { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); }
.dot-current { border: 2px solid #6366f1; }

.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 8px;
}
.grid-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  transition: all 0.1s;
}
.grid-cell:hover { background: rgba(255,255,255,0.1); }
.grid-cell.done {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}
.grid-cell.active {
  border: 2px solid #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
  color: #fff;
  font-weight: bold;
}

/* Onboarding Spotlight */
#guide-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9000;
  pointer-events: auto; /* 拦截非高亮区域点击 */
  display: block;
}
#guide-overlay.hidden { display: none; }

/* 
  高亮框实现原理：
  使用一个巨大的 box-shadow (0 0 0 9999px) 作为遮罩背景。
  框内部是透明的。
  pointer-events: none 让鼠标能穿过高亮框点到下面的元素。
*/
#guide-highlight {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75); /* 遮罩颜色 */
  border-radius: 6px;
  z-index: 9001;
  pointer-events: none; /* 关键：允许点击穿透 */
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  /* 可选：加个发光边框 */
  outline: 2px solid #6366f1;
  outline-offset: 4px;
}

/* 
  为了让目标元素可点击，我们需要把它临时提升到遮罩之上。
  但这需要改动 DOM 属性 (position/z-index)。
  app.js 会动态给目标元素添加这个类。
*/
.guide-target-active {
  position: relative !important;
  z-index: 9002 !important;
  pointer-events: auto !important;
}

#guide-popover {
  position: absolute;
  top: 0;
  left: 0;
  width: 320px;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 16px;
  z-index: 9003;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: all 0.3s ease-out;
  color: #f1f5f9;
}

.guide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
#guide-title { font-weight: 700; font-size: 14px; color: #fff; }
#guide-counter { font-size: 12px; color: #94a3b8; font-family: monospace; }

.guide-body {
  font-size: 13px;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.guide-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.guide-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.guide-check {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
