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

:root {
  --bg: #0b0d14;
  --bg2: #12141e;
  --bg3: #1a1d2a;
  --border: #252836;
  --text: #e1e4ed;
  --text2: #7c829a;
  --text3: #53586e;
  --accent: #6c8cff;
  --accent2: #48d6a2;
  --danger: #ff5c6c;
  --warning: #f5b45a;
  --creative: #6c8cff;
  --news: #48d6a2;
  --plugins: #f5b45a;
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Noto Sans SC', sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Header ===== */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.site-logo {
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.site-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}
.nav-btn {
  background: none;
  border: none;
  color: var(--text2);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all .2s;
}
.nav-btn:hover { background: var(--bg3); color: var(--text); }
.nav-btn.active { background: var(--bg3); color: var(--text); font-weight: 600; }

/* ===== Main ===== */
.main-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

/* ===== Views ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== Tag Bar ===== */
.tag-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.tag-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all .2s;
}
.tag-btn:hover { border-color: rgba(108,140,255,0.3); color: var(--text); background: var(--bg2); }
.tag-btn .tag-count {
  font-size: 0.7rem;
  background: var(--bg);
  color: var(--text3);
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.tag-btn.active { border-color: var(--accent); color: #fff; background: rgba(108,140,255,0.12); }
.tag-btn.active .tag-count { background: rgba(108,140,255,0.2); color: var(--accent); }

.tag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== Tag Detail View ===== */
.tag-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.tag-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}
.btn-back {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all .2s;
}
.btn-back:hover { background: var(--border); color: var(--text); }

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding-left: 40px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--border), var(--bg));
}

.timeline-day {
  margin-bottom: 36px;
}

.timeline-day-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  position: relative;
}
.timeline-day-header::before {
  content: '';
  position: absolute;
  left: -33px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}
.timeline-day-date {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.timeline-day-count {
  font-size: 0.78rem;
  color: var(--text3);
  background: var(--bg3);
  padding: 2px 10px;
  border-radius: 12px;
}

.timeline-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.entry-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: all .25s ease;
  position: relative;
}
.entry-card::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 24px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg2);
}
.entry-card:hover {
  border-color: rgba(108,140,255,0.3);
  background: var(--bg3);
  transform: translateX(4px);
}
.entry-card:hover::before {
  border-color: var(--accent);
  background: var(--accent);
}

.entry-card.cat-creative { border-left: 3px solid var(--creative); }
.entry-card.cat-news { border-left: 3px solid var(--news); }
.entry-card.cat-plugins { border-left: 3px solid var(--plugins); }

.entry-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.entry-card .card-title {
  font-size: 1.05rem;
  font-weight: 600;
  flex: 1;
  line-height: 1.4;
}
.entry-card .card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.card-badge {
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}
.card-badge.creative { background: rgba(108,140,255,0.15); color: var(--creative); }
.card-badge.news { background: rgba(72,214,162,0.15); color: var(--news); }
.card-badge.plugins { background: rgba(245,180,90,0.15); color: var(--plugins); }

.entry-card .card-preview {
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text2);
}
.empty-state p { margin-bottom: 8px; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 780px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header {
  padding: 20px 24px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.modal-close:hover { background: var(--bg3); color: var(--text); }
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.detail-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text2);
}
.detail-content {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
}
.detail-content h1, .detail-content h2, .detail-content h3 { margin: 24px 0 12px; color: var(--accent2); }
.detail-content h1 { font-size: 1.3rem; }
.detail-content h2 { font-size: 1.15rem; }
.detail-content h3 { font-size: 1.05rem; }
.detail-content h4 { margin: 18px 0 8px; font-size: 0.95rem; color: var(--accent); }
.detail-content p { margin-bottom: 12px; }
.detail-content ul, .detail-content ol { margin: 8px 0 12px 20px; }
.detail-content li { margin-bottom: 4px; }
.detail-content code {
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent2);
}
.detail-content pre {
  background: var(--bg3);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 14px 0;
  border: 1px solid var(--border);
}
.detail-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 12px 0;
  color: var(--text2);
}
.detail-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.88rem;
}
.detail-content th, .detail-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.detail-content th { background: var(--bg3); color: var(--text2); font-weight: 600; }
.detail-content hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.detail-content strong { color: var(--text); }
.detail-content img { max-width: 100%; border-radius: var(--radius-sm); }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: slideIn .3s ease;
}
.toast.success { border-color: var(--accent2); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .header-inner { padding: 12px 16px; }
  .main-container { padding: 16px; }
  .timeline { padding-left: 28px; }
  .timeline::before { left: 10px; }
  .timeline-day-header::before { left: -25px; width: 10px; height: 10px; }
  .entry-card { padding: 16px; }
  .entry-card::before { left: -20px; top: 20px; width: 6px; height: 6px; }
  .entry-card .card-header { flex-direction: column; gap: 6px; }
  .entry-card .card-badges { align-self: flex-start; }
  .tag-bar { gap: 8px; }
  .tag-btn { font-size: 0.78rem; padding: 5px 12px; }
}
