:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #132238;
  --muted: #5f6f86;
  --primary: #4f46e5;
  --primary-dark: #312e81;
  --line: rgba(19, 34, 56, 0.08);
  --shadow: 0 20px 45px rgba(31, 41, 55, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: linear-gradient(180deg, #f7f8fd 0%, #eef3ff 100%);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.container {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(245, 247, 251, 0.85);
  border-bottom: 1px solid var(--line);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 1rem;
}

.brand {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

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

.nav-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.last-updated {
  font-size: 0.82rem;
  color: var(--muted);
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.refresh-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Intro */
.news-intro {
  padding: 2.75rem 0 1.5rem;
}

.news-intro h1 {
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}

.news-intro p {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0;
  max-width: 640px;
}

/* News sections */
.news-section {
  padding: 1.5rem 0;
}

.news-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.news-section-head h2 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin: 0;
}

.news-section-sources {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.news-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.2rem;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.news-source {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary-dark);
}

.news-card h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-time {
  margin-top: auto;
  font-size: 0.74rem;
  color: var(--muted);
}

.news-skeleton {
  min-height: 168px;
  background: linear-gradient(90deg, rgba(19, 34, 56, 0.05) 25%, rgba(19, 34, 56, 0.09) 37%, rgba(19, 34, 56, 0.05) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.news-error {
  grid-column: 1 / -1;
  padding: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.news-retry {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.5rem;
  margin-top: 1.5rem;
}

.footer-inner p {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 640px;
}

.footer-copyright {
  font-size: 0.78rem;
}

@media (max-width: 1080px) {
  .news-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .navbar {
    flex-wrap: wrap;
    min-height: auto;
    padding: 0.9rem 0;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }
}
