/* ============================================
   王子瓜的诗 — 样式表
   现代简约 · 宋体排版 · 米白底 + 墨绿点缀
   ============================================ */

/* ---------- 主题变量 ---------- */
:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --surface-hover: #fbfbf9;
  --text: #1a1a1a;
  --text-secondary: #444;
  --text-muted: #999;
  --accent: #2d6a4f;
  --accent-light: #d8f3dc;
  --accent-hover: #1b4332;
  --border: #e8e6e1;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1600px;
  --font-serif: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --surface: #252525;
  --surface-hover: #2a2a2a;
  --text: #e8e6e1;
  --text-secondary: #b0b0b0;
  --text-muted: #666;
  --accent: #74c69d;
  --accent-light: #1b3a2f;
  --accent-hover: #95d5b2;
  --border: #333;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.2);
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
}

/* Quill 暗色主题覆盖 */
[data-theme="dark"] .ql-snow .ql-stroke { stroke: #b0b0b0 !important; }
[data-theme="dark"] .ql-snow .ql-fill { fill: #b0b0b0 !important; }
[data-theme="dark"] .ql-snow .ql-picker-label { color: #b0b0b0 !important; }
[data-theme="dark"] .ql-snow .ql-picker-label:hover { color: var(--accent) !important; }
[data-theme="dark"] .ql-snow .ql-picker-item { color: var(--text) !important; }
[data-theme="dark"] .ql-snow.ql-toolbar button:hover .ql-stroke,
[data-theme="dark"] .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent) !important; }
[data-theme="dark"] .ql-snow.ql-toolbar button:hover .ql-fill,
[data-theme="dark"] .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--accent) !important; }
[data-theme="dark"] .ql-snow .ql-picker-label.ql-active { color: var(--accent) !important; }

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition), color var(--transition);
  overflow-wrap: break-word;
  word-break: break-word;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ---------- 导航栏 ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: background var(--transition), border-color var(--transition);
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
  transition: opacity var(--transition);
}
.navbar-logo:hover { opacity: 0.7; }

.navbar-logo-main {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text);
}

.navbar-logo-sub {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.navbar-link {
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.navbar-link:hover { color: var(--text); }
.navbar-link.active { color: var(--accent); border-bottom-color: var(--accent); }

.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* 写诗按钮 — 纯图标，与 theme-toggle 同尺寸 */
.btn-write {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-write:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* 导航栏搜索框 */
.navbar-search {
  position: relative;
  display: flex;
  align-items: center;
}
.navbar-search-icon {
  position: absolute;
  left: 9px;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
.navbar-search-input {
  width: 110px;
  height: 32px;
  padding: 0 10px 0 28px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  transition: all var(--transition);
}
.navbar-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  width: 150px;
}
.navbar-search-input::placeholder { color: var(--text-muted); }

/* ---------- 首页容器 ---------- */
.home-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 24px 120px;
}

/* ---------- 标签栏 ---------- */
.tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin-bottom: 32px;
}

.tag-chip {
  padding: 5px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.tag-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.tag-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---------- 首页布局：时间轴 + 卡片 ---------- */
.home-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.poem-grid-wrapper {
  flex: 1;
  min-width: 0;
}

/* ---------- 时间轴侧栏 ---------- */
.timeline-sidebar {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  padding-right: 4px;
}

.timeline-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-right: 20px;
  text-align: right;
}

.timeline {
  position: relative;
  padding-right: 20px;
}

/* 竖线 — 在右侧 */
.timeline::before {
  content: '';
  position: absolute;
  right: 4px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.timeline-group {
  margin-bottom: 20px;
  position: relative;
}

.timeline-date {
  position: relative;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-sans);
  margin-bottom: 6px;
  padding-right: 16px;
  text-align: right;
  letter-spacing: 0.5px;
}

/* 日期节点圆点 — 在右侧竖线上 */
.timeline-date::before {
  content: '';
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--surface);
  z-index: 1;
  transition: all var(--transition);
}

.timeline-group:hover .timeline-date::before {
  background: var(--accent);
  border-color: var(--accent-light);
}

.timeline-item {
  display: block;
  padding: 3px 16px 3px 0;
  font-size: 13px;
  font-family: var(--font-serif);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.5;
  text-align: right;
  border-right: 2px solid transparent;
  margin-right: -2px;
  word-break: break-word;
  overflow-wrap: break-word;
}

.timeline-item:hover {
  color: var(--accent);
  border-right-color: var(--border);
}

.timeline-item.active {
  color: var(--accent);
  font-weight: 600;
  border-right-color: var(--accent);
}

/* 隐藏滚动条但保留滚动功能 */
.timeline-sidebar::-webkit-scrollbar { display: none; }
.timeline-sidebar { scrollbar-width: none; -ms-overflow-style: none; }

/* ---------- 瀑布流卡片 ---------- */
/* column-width: 400px 确保每张卡片内容区至少 352px (25个中文字 × 14px) */
.poem-grid {
  column-width: 400px;
  column-gap: 20px;
}

.poem-card {
  position: relative;
  break-inside: avoid;
  margin-bottom: 20px;
  scroll-margin-top: 72px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  cursor: pointer;
  transition: all var(--transition);
  display: block;
  text-decoration: none;
  color: inherit;
}

.poem-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 12px;
  color: var(--text);
}

.card-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 36px;
}

.card-content {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 2.0;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  user-select: text;
  -webkit-user-select: text;
  /* 续行缩进：自动换行的续行缩进 1em */
  padding-left: 0;
  text-indent: 0;
}

.card-content .poem-line {
  display: block;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.card-tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 100px;
  background: var(--accent-light);
  color: var(--accent);
}

/* 自定义颜色卡片 — 覆盖默认颜色变量 */
.poem-card.has-custom-color {
  background: var(--card-bg);
  border-color: var(--card-border);
}
.poem-card.has-custom-color .card-title { color: var(--card-text); }
.poem-card.has-custom-color .card-date { color: var(--card-text-muted); }
.poem-card.has-custom-color .card-content { color: var(--card-text); opacity: 0.85; }
.poem-card.has-custom-color .card-tags { border-top-color: var(--card-border); }
.poem-card.has-custom-color .card-tag {
  background: var(--card-tag-bg);
  color: var(--card-text);
}
.poem-card.has-custom-color .card-share { color: var(--card-text-muted); }

/* 卡片分享按钮 */
.card-share {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
  cursor: pointer;
}

.poem-card:hover .card-share { opacity: 0.6; }
.card-share:hover {
  opacity: 1 !important;
  background: var(--accent-light);
  color: var(--accent);
}

/* 分享弹窗 */
.share-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.share-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.share-modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px 28px;
  width: 300px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: scale(0.92);
  transition: transform 0.25s ease;
}

.share-overlay.show .share-modal {
  transform: scale(1);
}

.share-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color var(--transition);
}

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

.share-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.4;
}

.share-qrcode {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 200px;
  margin: 0 auto 16px;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
}

.share-qrcode svg {
  width: 100%;
  height: 100%;
}

.share-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.share-url {
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.5;
  padding: 0 8px;
}

/* ---------- 详情页 ---------- */
.detail-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 60px 24px 120px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 40px;
  cursor: pointer;
  transition: color var(--transition);
}
.back-link:hover { color: var(--accent); }

.detail-header {
  text-align: left;
  margin-bottom: 40px;
}

.detail-title {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 0;
  color: var(--text);
}

.detail-date {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-top: 48px;
}

.detail-body {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 2.2;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  letter-spacing: 0.03em;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.detail-tag {
  font-size: 13px;
  padding: 4px 14px;
  border-radius: 100px;
  background: var(--accent-light);
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
}
.detail-tag:hover { background: var(--accent); color: #fff; }

/* 详情页浮动按钮组 */
.fab-group {
  position: fixed;
  bottom: 28px;
  right: 48px;
  z-index: 50;
  display: flex;
  gap: 12px;
}

.fab-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab-edit {
  background: var(--accent);
  color: #fff;
  font-size: 20px;
}
.fab-edit:hover {
  transform: scale(1.1);
  background: var(--accent-hover);
}

.fab-share {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.fab-share:hover {
  transform: scale(1.1);
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- 编辑器模态框 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  padding: 32px;
  margin: auto;
  animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-sm {
  max-width: 400px;
  padding: 28px;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 1px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }

/* 编辑器表单 */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-label-hint {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: all var(--transition);
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ---------- Quill 富文本编辑器主题覆盖 ---------- */
/* 工具栏 */
.ql-toolbar.ql-snow {
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--surface);
  padding: 6px 8px;
}

/* 工具栏按钮 */
.ql-toolbar.ql-snow button {
  color: var(--text-secondary);
}
.ql-toolbar.ql-snow button:hover {
  color: var(--accent);
  background: var(--accent-light);
  border-radius: 4px;
}
.ql-toolbar.ql-snow button.ql-active {
  color: var(--accent);
  background: var(--accent-light);
  border-radius: 4px;
}

/* picker 下拉 */
.ql-toolbar.ql-snow .ql-picker {
  color: var(--text-secondary);
}
.ql-toolbar.ql-snow .ql-picker-label:hover {
  color: var(--accent);
}

/* 编辑器容器 */
.ql-container.ql-snow {
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--bg);
  font-family: var(--font-serif);
}

/* 编辑器内容区域 */
.ql-editor {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 2.0;
  color: var(--text);
  padding: 16px;
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* 编辑器聚焦 */
.ql-container.ql-snow:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* placeholder */
.ql-editor.ql-blank::before {
  color: var(--text-muted);
  font-style: normal;
  font-family: var(--font-serif);
  font-size: 15px;
  white-space: pre-wrap;
  left: 16px;
  right: 16px;
}

/* 字号 picker 中文标签 */
.ql-picker.ql-size .ql-picker-label::before { content: '字号'; }
.ql-picker.ql-size .ql-picker-item[data-value="false"]::before { content: '正常'; }
.ql-picker.ql-size .ql-picker-item[data-value="sm"]::before { content: '小'; }
.ql-picker.ql-size .ql-picker-item[data-value="md"]::before { content: '中'; }
.ql-picker.ql-size .ql-picker-item[data-value="lg"]::before { content: '大'; }
.ql-picker.ql-size .ql-picker-label[data-value="false"]::before { content: '正常'; }
.ql-picker.ql-size .ql-picker-label[data-value="sm"]::before { content: '小'; }
.ql-picker.ql-size .ql-picker-label[data-value="md"]::before { content: '中'; }
.ql-picker.ql-size .ql-picker-label[data-value="lg"]::before { content: '大'; }

/* 颜色 picker 标签 — 已移除，改为自定义按钮 */

/* 灰色字切换按钮 */
.ql-snow.ql-toolbar .ql-gray-toggle {
  width: 28px;
  height: 24px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ql-snow.ql-toolbar .ql-gray-toggle::before {
  content: '灰';
}
.ql-snow.ql-toolbar .ql-gray-toggle.ql-active {
  color: #999999;
  background: var(--accent-light);
  border-radius: 4px;
}

/* 编辑器内字号 — 固定像素值，不会因嵌套而累积放大 */
.ql-editor .ql-size-sm { font-size: 12px; }
.ql-editor .ql-size-md { font-size: inherit; }
.ql-editor .ql-size-lg { font-size: 19px; }

/* ---------- 富文本格式类（卡片 + 详情页通用） ---------- */
/* 固定字号：小=12px, 中=继承上下文默认值, 大=19px */
.fmt-sm { font-size: 12px; }
.fmt-md { font-size: inherit; }
.fmt-lg { font-size: 19px; }
.fmt-gray { color: var(--text-muted); }

/* Quill 输出的 <p> 标签在展示区域无额外间距 */
.card-content p, .detail-body p {
  margin: 0;
}

/* 标签编辑器 */
.tag-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  min-height: 48px;
  align-items: center;
}

.tag-editor .tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
}

.tag-editor .tag-remove {
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity var(--transition);
}
.tag-editor .tag-remove:hover { opacity: 1; }

.tag-editor input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-sans);
  min-width: 120px;
  flex: 1;
}

/* 标签建议下拉 */
.tag-suggestions {
  position: relative;
}

/* ---------- 颜色选择器 ---------- */
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: all 0.2s ease;
  position: relative;
}

.color-swatch:hover {
  transform: scale(1.12);
  border-color: var(--accent);
}

.color-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
  transform: scale(1.08);
}

.color-swatch.color-default {
  background: var(--surface) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
}

.color-swatch.color-default::after {
  content: '默认';
  font-size: 9px;
}

.color-swatch.color-custom {
  background: conic-gradient(from 0deg, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.color-swatch.color-custom input[type="color"] {
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border: none;
}

.tag-suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 160px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}
.tag-suggestions-list.active { display: block; }

.tag-suggestion-item {
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition);
}
.tag-suggestion-item:hover { background: var(--accent-light); }

/* 模态框底部按钮 */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-danger {
  background: transparent;
  color: #c0392b;
  border-color: #c0392b;
}
.btn-danger:hover { background: #c0392b; color: #fff; }

/* ---------- 关于页 ---------- */
.about-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 80px 24px 120px;
}

.about-title {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 8px;
  text-align: center;
}

.about-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 48px;
  letter-spacing: 1px;
}

.about-content {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 2.4;
  color: var(--text-secondary);
}

.about-content p { margin-bottom: 24px; }

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state-text { font-size: 15px; }

/* ---------- Toast 提示 ---------- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error { background: #c0392b; color: #fff; }
.toast.success { background: var(--accent); color: #fff; }

/* ---------- 加载动画 ---------- */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .timeline-sidebar { width: 160px; }
}

@media (max-width: 768px) {
  /* 时间轴直接消失，不堆叠到卡片上方 */
  .timeline-sidebar { display: none; }
  /* 触屏设备无 hover，分享按钮常显 */
  .card-share { opacity: 0.5; }
  /* 分享弹窗自适应 */
  .share-modal { width: 90vw; max-width: 300px; }
}

@media (max-width: 640px) {
  .home-container { padding: 20px 16px 80px; }
  .detail-container { padding: 40px 20px 100px; }
  .detail-title { font-size: 28px; }
  .detail-body { font-size: 16px; line-height: 2.2; }
  .card-content { font-size: 13px; }
  .navbar-inner { padding: 0 12px; }
  .navbar-logo { gap: 4px; }
  .navbar-logo-main { font-size: 15px; letter-spacing: 0; white-space: nowrap; }
  .navbar-logo-sub { display: none; }
  .navbar-links { gap: 6px; white-space: nowrap; flex-shrink: 0; }
  .navbar-link { font-size: 13px; }
  .btn-write { width: 28px; height: 28px; font-size: 13px; }
  .theme-toggle { width: 28px; height: 28px; font-size: 13px; }
  .navbar-search-input { width: 64px; height: 28px; font-size: 11px; padding: 0 6px 0 24px; }
  .navbar-search-input:focus { width: 90px; }
  .navbar-search-icon { font-size: 10px; left: 6px; }
  .modal { padding: 24px 20px; }
  .fab-group { bottom: 20px; right: 20px; }
}

@media (max-width: 380px) {
  .navbar-logo-main { font-size: 13px; }
  .navbar-link { font-size: 12px; }
  .navbar-search-input { width: 52px; font-size: 10px; }
  .navbar-search-input:focus { width: 72px; }
  .navbar-links { gap: 4px; }
}

/* ---------- 微信内嵌优化 ---------- */
/* 微信 WebView 的特殊处理 */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
  .detail-body {
    -webkit-text-size-adjust: 100%;
  }
}

/* 确保移动端字号不会过小 */
@media (max-width: 640px) {
  .card-content { font-size: 14px; }
  .navbar-search-input { font-size: 16px; } /* 防 iOS 缩放 */
  .form-input { font-size: 16px; } /* 防 iOS 缩放 */
}

/* 选中文本颜色 */
::selection {
  background: var(--accent-light);
  color: var(--accent);
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
