:root {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f3f4fa;
  --bg-input: #f1f3f9;
  --border: #e4e6ef;
  --border-strong: #d1d5e0;
  --text: #161827;
  --text-dim: #5a6079;
  --text-faint: #8a90a8;
  --accent: #7c5cff;
  --accent-2: #4ea1ff;
  --accent-grad: linear-gradient(135deg, #7c5cff 0%, #4ea1ff 100%);

  --cat-model: #6346d6;
  --cat-product: #2575d6;
  --cat-industry: #c46a1f;
  --cat-research: #1f8b5a;
  --cat-tips: #c43677;

  --shadow: 0 8px 32px rgba(40,50,90,0.08);
  --shadow-card: 0 2px 12px rgba(40,50,90,0.06);
  --shadow-card-h: 0 8px 24px rgba(124,92,255,0.12);

  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 260px;
  --max-w: 1100px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="dark"] {
  --bg: #0a0b14;
  --bg-elev: #11131f;
  --bg-card: #161827;
  --bg-card-hover: #1c1f30;
  --bg-input: #0e1018;
  --border: #232636;
  --border-strong: #2d3147;
  --text: #e7e9f0;
  --text-dim: #9ba1b6;
  --text-faint: #6b7290;
  --cat-model: #a991ff;
  --cat-product: #7eb8ff;
  --cat-industry: #ffb87e;
  --cat-research: #7ee8b8;
  --cat-tips: #ff8fb8;
  --shadow: 0 8px 32px rgba(0,0,0,0.45);
  --shadow-card: 0 4px 16px rgba(0,0,0,0.25);
  --shadow-card-h: 0 8px 28px rgba(124,92,255,0.15);
}

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

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes liveFlash {
  0%   { background: var(--bg-card); }
  30%  { background: rgba(94,224,166,0.18); }
  100% { background: var(--bg-card); }
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.8); }
}
@keyframes fadeInText { from { opacity: 0.3; } to { opacity: 1; } }

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  flex-shrink: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 0 8px;
}

.logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-grad);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: white;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 16px rgba(124,92,255,0.4);
}

.logo-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

.nav { flex: 1; overflow-y: auto; padding-right: 4px; }

.nav-section { margin-bottom: 24px; }

.nav-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  text-align: left;
  font-family: inherit;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--bg-card-hover);
  color: var(--text);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 3px;
  height: 18px;
  background: var(--accent-grad);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 16px;
  display: inline-block;
  text-align: center;
  font-size: 14px;
}

.nav-badge {
  margin-left: auto;
  background: var(--bg-input);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  min-width: 24px;
  text-align: center;
}

.nav-item.active .nav-badge {
  background: var(--accent);
  color: white;
}

.cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.cat-dot.all      { background: linear-gradient(135deg, #7c5cff, #4ea1ff); }
.cat-dot.model    { background: var(--cat-model); }
.cat-dot.product  { background: var(--cat-product); }
.cat-dot.industry { background: var(--cat-industry); }
.cat-dot.research { background: var(--cat-research); }
.cat-dot.tips     { background: var(--cat-tips); }

.sidebar-footer {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.15s var(--ease);
  text-align: left;
}

.footer-btn:hover { color: var(--text); border-color: var(--border-strong); }

.footer-icon { font-size: 14px; }
.chev { margin-left: auto; font-size: 10px; color: var(--text-faint); }

.theme-icon-light, .theme-icon-dark { font-size: 14px; }
html[data-theme="dark"]  .theme-icon-light { display: none; }
html[data-theme="light"] .theme-icon-dark  { display: none; }

.version {
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Main ─── */
.main {
  flex: 1;
  padding: 32px 40px 80px;
  max-width: 100%;
  overflow-x: hidden;
  animation: fadeIn 0.4s var(--ease);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
  max-width: var(--max-w);
}

.header h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.6px;
  margin-bottom: 6px;
}

.page-sub {
  color: var(--text-dim);
  font-size: 14px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.18s var(--ease);
  flex-shrink: 0;
}

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

.icon-btn.spinning svg { animation: spin 0.7s linear infinite; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  width: 340px;
  transition: all 0.18s var(--ease);
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,92,255,0.15);
}

.search-icon { color: var(--text-faint); margin-right: 8px; }

.search input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 10px 0;
  outline: none;
  min-width: 0;
}

.search input::placeholder { color: var(--text-faint); }

.search kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Stats ─── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
  max-width: var(--max-w);
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 16px 18px;
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease);
  animation: fadeUp 0.4s var(--ease) both;
}
.stat:nth-child(1) { animation-delay: 0.05s; }
.stat:nth-child(2) { animation-delay: 0.1s; }
.stat:nth-child(3) { animation-delay: 0.15s; }
.stat:nth-child(4) { animation-delay: 0.2s; }
.stat:hover { border-color: var(--border-strong); }

.stat-val {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', monospace;
}

.stat-label {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
}

.live-flash { animation: liveFlash 1.2s var(--ease); }

.stat:last-child .stat-val::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #1f8b5a;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  box-shadow: 0 0 8px rgba(31,139,90,0.6);
  animation: livePulse 2s infinite;
}

/* ─── API banner ─── */
.api-banner {
  background: linear-gradient(90deg, rgba(196,106,31,0.1), rgba(196,106,31,0.02));
  border: 1px solid rgba(196,106,31,0.25);
  color: var(--cat-industry);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  max-width: var(--max-w);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeUp 0.3s var(--ease);
}
.api-banner::before { content: "⚠"; font-size: 14px; }

/* ─── Feed ─── */
.feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: var(--max-w);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
  animation: fadeUp 0.35s var(--ease) both;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-h);
}

.card-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 11.5px;
  flex-wrap: wrap;
}

.card-clock {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text);
  padding: 2px 8px;
  background: var(--bg-input);
  border-radius: 5px;
  letter-spacing: -0.2px;
  font-variant-numeric: tabular-nums;
}

.cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
}

.cat-tag.model    { background: rgba(124,92,255,0.12); color: var(--cat-model); }
.cat-tag.product  { background: rgba(37,117,214,0.12); color: var(--cat-product); }
.cat-tag.industry { background: rgba(196,106,31,0.15); color: var(--cat-industry); }
.cat-tag.research { background: rgba(31,139,90,0.15); color: var(--cat-research); }
.cat-tag.tips     { background: rgba(196,54,119,0.12); color: var(--cat-tips); }

html[data-theme="dark"] .cat-tag.model    { background: rgba(124,92,255,0.15); color: #a991ff; }
html[data-theme="dark"] .cat-tag.product  { background: rgba(78,161,255,0.15); color: #7eb8ff; }
html[data-theme="dark"] .cat-tag.industry { background: rgba(255,157,78,0.15); color: #ffb87e; }
html[data-theme="dark"] .cat-tag.research { background: rgba(94,224,166,0.15); color: #7ee8b8; }
html[data-theme="dark"] .cat-tag.tips     { background: rgba(255,107,157,0.15); color: #ff8fb8; }

.card-source {
  color: var(--text-dim);
  font-weight: 500;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-time { color: var(--text-faint); }

.card-tier {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-faint);
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.tier-T1  { color: #1f8b5a; border-color: rgba(31,139,90,0.3); }
.tier-T15 { color: #2575d6; border-color: rgba(37,117,214,0.3); }
.tier-T2  { color: var(--text-faint); }

html[data-theme="dark"] .tier-T1  { color: #5ee0a6; border-color: rgba(94,224,166,0.3); }
html[data-theme="dark"] .tier-T15 { color: #4ea1ff; border-color: rgba(78,161,255,0.3); }

.card-score {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.score-hi  { color: #1f8b5a; border-color: rgba(31,139,90,0.3); }
.score-mid { color: #2575d6; border-color: rgba(37,117,214,0.3); }
.score-lo  { color: var(--text-dim); }

html[data-theme="dark"] .score-hi  { color: #5ee0a6; border-color: rgba(94,224,166,0.3); }
html[data-theme="dark"] .score-mid { color: #4ea1ff; border-color: rgba(78,161,255,0.3); }

.card-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 6px;
  color: var(--text);
  line-height: 1.4;
}

.card-summary {
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-row3 {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-faint);
  flex-wrap: wrap;
}

.card-link {
  color: var(--accent-2);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-link:hover { text-decoration: underline; }

.card-cluster {
  font-size: 11px;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.toggle-original {
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 4px;
  color: var(--text-faint);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.toggle-original::before { content: "⇄"; font-size: 10px; }
.toggle-original:hover {
  color: var(--accent-2);
  border-color: var(--accent);
  background: rgba(124,92,255,0.08);
}

.card-title.translating, .card-summary.translating {
  position: relative;
  opacity: 0.6;
}
.card-title.translating::after, .card-summary.translating::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border: 2px solid var(--text-faint);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

.fade-in-text { animation: fadeInText 0.5s var(--ease); }

/* ─── Daily Report ─── */
.daily-report {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  max-width: var(--max-w);
  animation: fadeUp 0.4s var(--ease);
}
.daily-report[hidden] { display: none; }

.daily-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.daily-header h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.daily-date {
  color: var(--text-faint);
  font-size: 13px;
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.btn-ghost {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.daily-section { margin-bottom: 24px; }
.daily-section:last-child { margin-bottom: 0; }

.daily-section-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.daily-list { list-style: none; }
.daily-list li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13.5px;
  animation: fadeUp 0.3s var(--ease) both;
}
.daily-list li:last-child { border: none; }
.daily-list a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.daily-list a:hover { color: var(--accent-2); }
.daily-list .src { color: var(--text-faint); font-size: 11.5px; margin-left: 8px; }

/* ─── Empty ─── */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
  animation: fadeUp 0.3s var(--ease);
}
.empty-mark { font-size: 48px; opacity: 0.3; margin-bottom: 12px; }
.empty h3 { font-size: 18px; margin-bottom: 6px; color: var(--text); }

/* ─── Skeleton ─── */
.skeleton-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: var(--max-w);
}
.skeleton-card {
  height: 108px;
  background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-card-hover) 50%, var(--bg-card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ─── Modal ─── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 0.2s var(--ease);
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

.modal-body {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: var(--shadow);
  animation: slideInUp 0.25s var(--ease-out);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  transition: all 0.15s;
}
.modal-close:hover { color: var(--text); background: var(--bg-card); }

/* ─── Lang menu ─── */
.lang-menu {
  position: fixed;
  bottom: 130px;
  left: 16px;
  width: 228px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow);
  z-index: 50;
  animation: fadeUp 0.18s var(--ease-out);
}
.lang-menu[hidden] { display: none; }

.lang-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.lang-opt:hover { background: var(--bg-card-hover); }
.lang-opt.active { background: var(--bg-card); color: var(--accent-2); }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 24px 20px 60px; }
  .header { flex-direction: column; }
  .search { width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
