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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f13;
  color: #e0e0e8;
  min-height: 100vh;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #16161e;
  border-bottom: 1px solid #2a2a3a;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 16px;
}


h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

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

.header-right-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.status {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.status.connected { background: #1a3a1a; color: #5dcc6a; }
.status.connecting { background: #2a2a10; color: #ccb85d; }
.status.error { background: #3a1a1a; color: #cc5d5d; }

#last-updated { font-size: 0.68rem; color: #555; }


.filter-bar {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  align-items: center;
  flex: 1;
  min-width: 0;
  margin-left: 24px;
}
.filter-bar::-webkit-scrollbar { display: none; }

.sep {
  width: 1px;
  height: 18px;
  background: #2a2a3a;
  flex-shrink: 0;
  margin: 0 2px;
}

.filter-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  background: #1e1e2a;
  border: 1px solid #2a2a3a;
  color: #888;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.filter-btn:hover { background: #252535; color: #bbb; border-color: #383850; }
.filter-btn.active { background: #1e2245; border-color: #4455bb; color: #99aaff; }
.filter-btn-all { padding: 4px 18px; }

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

.sources-wrapper {
  position: relative;
  flex-shrink: 0;
}

.sources-dropdown {
  position: fixed;
  background: #1a1a24;
  border: 1px solid #2a2a3a;
  border-radius: 10px;
  padding: 8px;
  z-index: 500;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.sources-dropdown.hidden { display: none !important; }
.sources-dropdown .filter-btn {
  width: 100%;
  justify-content: flex-start;
  border-radius: 6px;
}

.sources-category-header {
  font-size: 0.65rem;
  font-weight: 700;
  color: #556;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 6px 6px 2px;
  margin-top: 2px;
}

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 16px;
}

.new-banner {
  background: #1a2a4a;
  border: 1px solid #334488;
  color: #99bbff;
  padding: 9px 16px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  text-align: center;
}
.new-banner a { color: #6699ff; }
.new-banner.hidden { display: none; }

.article {
  background: #16161e;
  border: 1px solid #2e2e42;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.15s, background 0.15s;
  animation: fadeIn 0.25s ease;
}
.article:hover { border-color: #44445a; background: #1a1a24; }
.article.new-article { animation: spitIn 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both, borderFlash 2s ease 0.3s; }
.article.latest-article { border-color: #4a6acc; box-shadow: 0 0 0 1px rgba(74,106,204,0.35); }

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

@keyframes spitIn {
  0%   { opacity: 0;   transform: translateY(-36px) scale(0.94); }
  52%  { opacity: 1;   transform: translateY(8px)   scale(1.01); }
  72%  { transform: translateY(-4px) scale(1.0); }
  88%  { transform: translateY(2px); }
  100% { opacity: 1;   transform: translateY(0)     scale(1); }
}

@keyframes borderFlash {
  0%   { border-color: #7ab8f5; box-shadow: 0 0 0 1px #7ab8f5, 0 0 18px 2px rgba(100,160,255,0.3); }
  60%  { border-color: #4a6acc; box-shadow: 0 0 0 1px #4a6acc, 0 0 6px 1px rgba(80,120,255,0.1); }
  100% { border-color: #2e2e42; box-shadow: none; }
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.source-badge {
  font-size: 0.67rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 11px;
  color: #fff;
  letter-spacing: 0.2px;
  opacity: 0.92;
}

.cat-tag {
  font-size: 0.65rem;
  color: #556;
  background: #1e1e28;
  border: 1px solid #2a2a38;
  padding: 1px 7px;
  border-radius: 10px;
}

.article-datetime {
  font-size: 0.72rem;
  color: #8899cc;
  white-space: nowrap;
  font-weight: 500;
}

.article-meta .translate-btn {
  margin-left: auto;
}

.article-title {
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 7px;
}
.article-title a {
  color: #7ab8f5;
  text-decoration: none;
  transition: color 0.12s;
}
.article-title a:hover { color: #aad4ff; }

.article-summary {
  font-size: 0.82rem;
  color: #e8e8f0;
  line-height: 1.65;
}
.article-summary.ai {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-summary.pending {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #44445a;
  font-style: italic;
  font-size: 0.78rem;
}
.analyzing-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #44446a;
  animation: pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.25); }
}

.summary-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.translate-btn {
  align-self: flex-start;
  background: #1e1e2e;
  border: 1px solid #333350;
  color: #8899cc;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.3px;
}
.translate-btn:hover { background: #252540; color: #aabbff; border-color: #4455aa; }
.translate-btn:disabled { opacity: 0.5; cursor: default; }

.help-btn {
  background: #1e1e2e;
  border: 1px solid #3a3a58;
  color: #99aadd;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: all 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}
.help-btn:hover { border-color: #6677cc; color: #bbccff; background: #252545; }

.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.help-overlay.hidden { display: none; }

.help-modal {
  background: #1a1a26;
  border: 1px solid #33335a;
  border-radius: 14px;
  max-width: 580px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 28px 24px;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #333355 transparent;
}

.help-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: #556;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.12s, background 0.12s;
}
.help-close:hover { color: #aab; background: #252535; }

.help-title {
  font-size: 1rem;
  font-weight: 700;
  color: #dde;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-section h3 {
  font-size: 0.8rem;
  font-weight: 700;
  color: #8899cc;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.help-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.help-section ul li {
  font-size: 0.82rem;
  color: #b0b0c8;
  line-height: 1.6;
  padding-left: 12px;
  position: relative;
}
.help-section ul li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: #4455aa;
  font-weight: 700;
}
.help-section ul li strong { color: #dde; }

.help-divider {
  border: none;
  border-top: 1px solid #2a2a3a;
  margin: 20px 0;
}

.article-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.article-overlay.hidden { display: none; }

.article-modal {
  background: #1a1a26;
  border: 1px solid #33335a;
  border-radius: 14px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 28px 24px;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #333355 transparent;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.article-modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.article-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e8e8f8;
  line-height: 1.5;
}


.article-modal-link {
  display: inline-block;
  color: #6677bb;
  font-size: 0.72rem;
  text-decoration: none;
  transition: color 0.15s;
}
.article-modal-link:hover { color: #99aaff; }


.article-modal-body {
  font-size: 0.88rem;
  color: #c0c0d8;
  line-height: 1.85;
  white-space: pre-wrap;
}

.article-clickable { cursor: pointer; }
.article-clickable:hover { background: #1c1c28; }

.loading {
  text-align: center;
  color: #444;
  padding: 40px;
  font-size: 0.88rem;
}
.loading.hidden { display: none; }

@media (max-width: 600px) {
  h1 { font-size: 1.05rem; }
  .article { padding: 11px 13px; }
  .article-title { font-size: 0.88rem; }
}
