/* 任正非知识库 - 主样式表 */
:root {
  --bg: #faf8f5;
  --card-bg: #fff;
  --text: #2c2c2c;
  --text-light: #666;
  --border: #e8e4dd;
  --accent: #8b4513;
  --accent-light: #d4a574;
  --accent-bg: #fdf6ee;
  --mm-color: #1a5276;
  --mm-bg: #eaf2f8;
  --link: #8b4513;
  --link-hover: #5c2e0b;
  --header-bg: #2c1810;
  --header-text: #f0e6d3;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--header-text);
  text-decoration: none;
  letter-spacing: 0.05em;
}

.logo span {
  font-weight: 300;
  opacity: 0.7;
  margin-left: 4px;
  font-size: 0.95rem;
}

.main-nav { display: flex; gap: 1.5rem; }

.main-nav a {
  color: rgba(240,230,211,0.75);
  text-decoration: none;
  font-size: 0.92rem;
  transition: color 0.2s;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.main-nav a:hover, .main-nav a.active {
  color: var(--header-text);
  border-bottom-color: var(--accent-light);
}

/* Main */
main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* Page header */
.page-header {
  margin-bottom: 2rem;
  text-align: center;
}

.page-header h1 {
  font-size: 2rem;
  color: var(--header-bg);
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-light);
  font-size: 1.05rem;
}

/* Timeline */
.timeline-layout {
  display: flex;
  gap: 2rem;
}

.year-nav {
  width: 120px;
  flex-shrink: 0;
  position: sticky;
  top: 72px;
  height: fit-content;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.year-nav h3 {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.year-nav-item {
  display: block;
  padding: 0.3rem 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 4px;
  transition: all 0.15s;
}

.year-nav-item:hover {
  background: var(--accent-bg);
  color: var(--accent);
}

.timeline-main { flex: 1; min-width: 0; }

.year-section {
  margin-bottom: 2rem;
  scroll-margin-top: 72px;
}

.year-title {
  font-size: 1.4rem;
  color: var(--header-bg);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-light);
  margin-bottom: 1rem;
}

.year-title span {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: normal;
  margin-left: 0.5rem;
}

.article-list { display: flex; flex-direction: column; gap: 0.5rem; }

.article-card {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.article-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.article-date {
  color: var(--accent-light);
  font-size: 0.85rem;
  min-width: 3rem;
  text-align: right;
}

.article-title {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  flex: 1;
}

.article-title:hover { color: var(--accent); }

.article-subtitle {
  color: var(--text-light);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.article-chars {
  color: var(--text-light);
  font-size: 0.78rem;
  min-width: 3rem;
  text-align: right;
}

/* Concept cards */
.concepts-page { max-width: 1000px; margin: 0 auto; }

.concept-domain {
  margin-bottom: 2.5rem;
}

.concept-domain h2 {
  font-size: 1.3rem;
  color: var(--header-bg);
  margin-bottom: 1rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--border);
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.concept-card {
  display: block;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  border: 1px solid transparent;
}

.concept-card:hover {
  border-color: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.concept-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.concept-card-header h3 {
  font-size: 1.1rem;
  color: var(--header-bg);
}

.tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  background: var(--border);
  color: var(--text-light);
  white-space: nowrap;
}

.mm-tag {
  background: var(--mm-bg);
  color: var(--mm-color);
}

.concept-card-def {
  font-size: 0.88rem;
  color: var(--text-light);
  margin-bottom: 0.8rem;
}

.concept-card-meta {
  display: flex;
  gap: 0.8rem;
  font-size: 0.78rem;
  color: var(--accent-light);
}

/* Concept detail */
.concept-detail {
  max-width: 800px;
  margin: 0 auto;
}

.domain-badge {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 0.2rem 0.8rem;
  border-radius: 12px;
  margin-right: 0.5rem;
}

.concept-definition {
  background: var(--accent-bg);
  border-left: 4px solid var(--accent);
  padding: 1.2rem 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1.5rem;
}

.definition-text {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.8;
}

.concept-aliases { margin-bottom: 1.5rem; }

.alias-tag {
  display: inline-block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 0.2rem 0.7rem;
  border-radius: 12px;
  font-size: 0.85rem;
  margin: 0.2rem;
}

.concept-meta {
  display: flex;
  gap: 2rem;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.meta-item { font-size: 0.9rem; }

blockquote {
  background: var(--card-bg);
  border-left: 3px solid var(--accent-light);
  padding: 0.8rem 1.2rem;
  margin: 0.8rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-light);
  font-size: 0.92rem;
}

.concept-articles ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.concept-articles li a {
  color: var(--link);
  text-decoration: none;
}

.concept-articles li span {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

/* Article detail */
.article-detail {
  max-width: 800px;
  margin: 0 auto;
}

.back-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.article-meta {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.article-body {
  background: var(--card-bg);
  padding: 2rem 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  line-height: 2;
  font-size: 1.02rem;
  margin: 1.5rem 0;
}

.article-body p {
  margin-bottom: 1rem;
  text-indent: 2em;
}

.article-body h2, .article-body h3 {
  margin: 1.5rem 0 0.8rem;
  color: var(--header-bg);
}

.article-footer-nav {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s;
}

.btn:hover {
  background: var(--accent-bg);
  border-color: var(--accent-light);
  color: var(--accent);
}

/* Search */
.search-page {
  max-width: 800px;
  margin: 0 auto;
}

.search-box {
  margin-bottom: 2rem;
}

.search-box input {
  width: 100%;
  padding: 0.8rem 1.2rem;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--accent-light);
}

.search-count {
  display: block;
  color: var(--text-light);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.search-result {
  background: var(--card-bg);
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}

.search-result:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-result h3 {
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
  color: var(--link);
}

.search-result .result-meta {
  font-size: 0.82rem;
  color: var(--text-light);
}

/* Graph page */
.graph-page {
  max-width: 1000px;
  margin: 0 auto;
}

#graph-container {
  width: 100%;
  height: 70vh;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.graph-legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-light);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.article-dot { background: var(--accent-light); }
.concept-dot { background: var(--mm-color); }

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
  font-size: 0.85rem;
  margin-top: auto;
}

.credit {
  font-size: 0.78rem;
  margin-top: 0.3rem;
  opacity: 0.7;
}

/* ── 书签按钮 ── */
.bookmark-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  color: var(--accent-light);
  transition: all 0.2s;
  margin-top: 0.5rem;
}

.bookmark-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

.bookmark-btn.bookmark-animate {
  animation: bookmarkPulse 0.4s ease;
}

@keyframes bookmarkPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ── 批注工具栏（浮动）── */
.anno-toolbar {
  position: absolute;
  z-index: 200;
  background: var(--header-bg);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  padding: 4px;
  transform: translateX(-50%);
  animation: annoToolbarIn 0.15s ease;
}

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

.anno-toolbar-btn {
  background: none;
  border: none;
  color: var(--header-text);
  padding: 6px 14px;
  font-size: 0.88rem;
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s;
}

.anno-toolbar-btn:hover {
  background: rgba(255,255,255,0.12);
}

/* ── 批注模态框 ── */
.anno-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.anno-modal {
  background: var(--card-bg);
  border-radius: 12px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  overflow: hidden;
  animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.anno-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

.anno-modal-header h3 {
  font-size: 1.05rem;
  color: var(--header-bg);
}

.anno-modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.anno-modal-close:hover { color: var(--text); }

.anno-modal-body {
  padding: 1.2rem;
}

.anno-selected-text {
  background: var(--accent-bg);
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 1rem;
  border-left: 3px solid var(--accent-light);
}

.anno-color-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.anno-color-label {
  font-size: 0.85rem;
  color: var(--text-light);
}

.anno-color-opt {
  cursor: pointer;
}

.anno-color-opt input {
  display: none;
}

.anno-color-opt span {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.anno-color-opt input:checked + span {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.anno-note-input {
  width: 100%;
  padding: 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.anno-note-input:focus {
  border-color: var(--accent-light);
}

.anno-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  padding: 0.8rem 1.2rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.anno-btn-cancel {
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-light);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.anno-btn-cancel:hover {
  background: var(--border);
}

.anno-btn-save {
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

.anno-btn-save:hover {
  background: var(--link-hover);
}

/* ── 批注高亮 ── */
.annotation-highlight {
  cursor: pointer;
  border-radius: 2px;
  padding: 0 2px;
  transition: filter 0.15s;
  text-decoration: underline;
  text-decoration-color: rgba(0,0,0,0.15);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

.annotation-highlight:hover {
  filter: brightness(0.92);
}

/* ── 批注弹出层 ── */
.anno-popup {
  position: absolute;
  z-index: 300;
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.18);
  width: 300px;
  overflow: hidden;
  animation: annoPopupIn 0.15s ease;
}

@keyframes annoPopupIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.anno-popup-text {
  padding: 0.8rem 1rem;
  background: var(--accent-bg);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.anno-popup-note {
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

.anno-popup-note.empty {
  color: var(--text-light);
  font-style: italic;
}

.anno-popup-time {
  padding: 0 1rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-light);
}

.anno-popup-actions {
  display: flex;
  border-top: 1px solid var(--border);
}

.anno-popup-actions button {
  flex: 1;
  padding: 0.6rem;
  border: none;
  background: none;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}

.anno-popup-actions button:first-child {
  border-right: 1px solid var(--border);
}

.anno-popup-actions button:hover {
  background: var(--bg);
}

.anno-action-delete {
  color: #c0392b !important;
}

/* ── 书签汇总页 ── */
.bookmarks-page, .annotations-page {
  max-width: 800px;
  margin: 0 auto;
}

.bookmark-count, .anno-summary-count {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.bookmark-list, .anno-summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bookmark-item {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

.bookmark-item-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  text-decoration: none;
  color: var(--text);
}

.bookmark-item-link:hover .bookmark-item-title {
  color: var(--accent);
}

.bookmark-item-year {
  color: var(--accent-light);
  font-size: 0.85rem;
  min-width: 4rem;
}

.bookmark-item-title {
  font-weight: 500;
  transition: color 0.15s;
}

.bookmark-item-subtitle {
  color: var(--text-light);
  font-size: 0.8rem;
}

.bookmark-item-remove {
  padding: 0.8rem;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
}

.bookmark-item:hover .bookmark-item-remove {
  opacity: 1;
}

.bookmark-item-remove:hover {
  color: #c0392b;
}

/* ── 批注汇总页 ── */
.anno-summary-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.anno-summary-highlight {
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 0.6rem;
  border-left: 3px solid rgba(0,0,0,0.1);
}

.anno-summary-note {
  padding: 0.5rem 0.8rem;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  background: var(--bg);
  border-radius: 6px;
  line-height: 1.5;
}

.anno-summary-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.anno-summary-article {
  color: var(--accent);
  text-decoration: none;
}

.anno-summary-article:hover {
  text-decoration: underline;
}

.anno-summary-time {
  color: var(--text-light);
}

/* ── 空状态 ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.empty-hint {
  font-size: 0.85rem !important;
  opacity: 0.7;
}

/* ── 对话页面 ── */
.chat-page {
  max-width: 820px;
  margin: 0 auto;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px - 4rem - 80px);
  min-height: 500px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
  flex-shrink: 0;
}

.chat-header h2 {
  font-size: 1.2rem;
  color: var(--header-bg);
  margin-bottom: 0.3rem;
}

.chat-header p {
  font-size: 0.85rem;
  color: var(--text-light);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  display: flex;
  gap: 0.5rem;
  max-width: 100%;
  animation: msgIn 0.3s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-user {
  justify-content: flex-end;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-bubble {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.75;
  word-break: break-word;
}

.ai-bubble {
  background: var(--bg);
  max-width: 85%;
  white-space: pre-wrap;
}

.user-bubble {
  background: var(--accent);
  color: #fff;
  max-width: 75%;
}

.chat-bubble.thinking {
  display: flex;
  gap: 4px;
  padding: 0.6rem 1rem;
}

.thinking-dot {
  animation: blink 1.4s infinite;
  font-size: 0.5rem;
  color: var(--text-light);
}

.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

.chat-system {
  justify-content: center;
}

.chat-system-text {
  font-size: 0.85rem;
  color: var(--text-light);
  background: var(--bg);
  padding: 0.5rem 1rem;
  border-radius: 20px;
}

.chat-sources {
  margin-top: 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.6;
}

.chat-sources-label {
  color: var(--text-light);
}

.chat-source-link {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.chat-source-link:hover {
  text-decoration: underline;
}

.chat-welcome {
  text-align: center;
  padding: 1.5rem 2rem !important;
  max-width: 90% !important;
}

.chat-welcome p {
  margin-bottom: 0.6rem;
}

.chat-welcome-hints {
  font-size: 0.82rem !important;
  color: var(--accent-light);
  margin-top: 0.8rem !important;
}

.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 1.2rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input-area textarea {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.5;
}

.chat-input-area textarea:focus {
  border-color: var(--accent-light);
}

.chat-input-area textarea:disabled {
  background: var(--bg);
  cursor: not-allowed;
}

#chat-send-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

#chat-send-btn:hover {
  background: var(--link-hover);
}

#chat-send-btn:disabled {
  background: var(--border);
  cursor: not-allowed;
}

.chat-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1.2rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-clear-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  transition: all 0.15s;
}

.chat-clear-btn:hover {
  background: #fdecea;
  color: #c0392b;
}

.chat-footer-note {
  font-size: 0.75rem;
  color: var(--text-light);
  opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
  .timeline-layout { flex-direction: column; }
  .year-nav { width: 100%; position: static; max-height: none;
    display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.8rem; }
  .year-nav h3 { display: none; }
  .year-nav-item { padding: 0.2rem 0.5rem; font-size: 0.8rem; }
  .concept-grid { grid-template-columns: 1fr; }
  .article-card { flex-wrap: wrap; gap: 0.3rem; }
  .article-body { padding: 1rem; }
}
