:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #222636;
  --border: #2a2e3d;
  --text: #e4e6ef;
  --text-muted: #8b8fa3;
  --accent: #00b4d8;
  --accent-dim: #0090ad;
  --iot: #00b4d8;
  --telecom: #7c5cbf;
  --g5: #e07c3a;
  --networking: #2dd4bf;
  --hardware: #f472b6;
  --security: #ef4444;
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #141620 0%, #1a1d27 100%);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
}

.header-inner h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.accent { color: var(--accent); }

.subtitle {
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-size: 0.95rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

#refresh-btn {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

#refresh-btn:hover { background: var(--accent); color: #fff; }
#refresh-btn.spinning { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

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

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.article-card:hover {
  border-color: var(--accent-dim);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.article-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.article-card .category-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-iot { background: rgba(0,180,216,0.15); color: var(--iot); }
.badge-telecom { background: rgba(124,92,191,0.15); color: var(--telecom); }
.badge-5g { background: rgba(224,124,58,0.15); color: var(--g5); }
.badge-networking { background: rgba(45,212,191,0.15); color: var(--networking); }
.badge-hardware { background: rgba(244,114,182,0.15); color: var(--hardware); }
.badge-security { background: rgba(239,68,68,0.15); color: var(--security); }
.badge-general { background: rgba(139,143,163,0.15); color: var(--text-muted); }

.article-card .source {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.article-card h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.article-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.article-card h3 a:hover { color: var(--accent); }

.article-card .summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.topic-tag {
  font-size: 0.65rem;
  font-weight: 500;
  background: rgba(0,180,216,0.1);
  color: var(--accent);
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

.article-card .date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

#load-more-wrap {
  text-align: center;
  padding: 2rem;
}

#load-more-btn {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 0.6rem 2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

#load-more-btn:hover { background: var(--accent); color: #fff; }

footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

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

@media (max-width: 600px) {
  header { padding: 1.5rem 1rem; }
  .header-inner h1 { font-size: 1.5rem; }
  .controls { flex-direction: column; align-items: stretch; }
  .meta { justify-content: center; }
  .articles-grid { grid-template-columns: 1fr; }
}
