:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-strong: #f0f3f7;
  --text: #172033;
  --muted: #687386;
  --line: #d9e0ea;
  --blue: #1c64f2;
  --green: #087f5b;
  --amber: #b45309;
  --red: #c2410c;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.2;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  gap: 10px;
}

.stats div {
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stats span {
  display: block;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.stats small {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 22px;
  width: min(1220px, calc(100% - 36px));
  margin: 24px auto 48px;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-self: start;
  position: sticky;
  top: 118px;
}

.filters section,
.searchBox {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.searchBox {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.searchBox span,
.filters h2 {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filters h2 {
  margin: 0;
  padding: 14px 14px 8px;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-strong);
  font: inherit;
}

input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(28, 100, 242, 0.14);
}

.tagList,
.sourceList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}

button,
.chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover,
.chip:hover,
.chip.active {
  border-color: var(--blue);
  color: var(--blue);
}

#refreshButton {
  border-radius: 6px;
  background: var(--text);
  color: white;
}

#refreshButton:hover {
  border-color: var(--text);
  color: white;
}

.feed {
  min-width: 0;
}

.feedHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.articleList {
  display: grid;
  gap: 12px;
}

.article {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.articleTop {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.article h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.article h3 a {
  text-decoration: none;
}

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

.source {
  flex: 0 0 auto;
  align-self: start;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--green);
  background: rgba(8, 127, 91, 0.1);
  font-size: 12px;
  font-weight: 800;
}

.summary,
.why {
  margin: 0;
  color: #2e394c;
  line-height: 1.7;
}

.why {
  color: var(--amber);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.tag {
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-strong);
  color: #3d4758;
  font-weight: 700;
}

.state {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.state.error {
  color: var(--red);
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    width: 100%;
  }

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

  .filters {
    position: static;
  }

  .articleTop {
    flex-direction: column;
  }
}
