:root {
  --board: #dfe8df;
  --ink: #17241c;
  --card: #f7faf6;
  --line: #c5d4c8;
  --muted: #4d6356;
  --live: #0c6b45;
  --shadow: 0 1px 0 rgba(23, 36, 28, 0.04);
  --radius: 16px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Anek Tamil", "Noto Sans Tamil", sans-serif;
  color: var(--ink);
  background: var(--board);
}

button,
a {
  font: inherit;
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 20px;
  align-items: end;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 0 12px;
  background: var(--board);
}

.brand h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
  max-width: 28rem;
}

.meter {
  grid-column: 1 / -1;
  height: 3px;
  background: #c9d7cc;
  border-radius: 99px;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--live);
  transform-origin: left center;
}

.meter span.running {
  animation: drain var(--cycle, 300s) linear forwards;
}

@keyframes drain {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

button,
.filter {
  border: 1px solid #9fb3a4;
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

#refresh {
  background: var(--ink);
  color: #f4faf6;
  border-color: var(--ink);
  min-height: 40px;
}

#refresh:disabled {
  opacity: 0.6;
  cursor: progress;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 14px;
}

.search {
  width: min(240px, 100%);
  min-height: 40px;
  border: 1px solid #9fb3a4;
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
}

.search::placeholder {
  color: #6d8276;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  flex: 1;
}

.filter[aria-pressed="true"] {
  background: var(--ink);
  color: #f4faf6;
  border-color: var(--ink);
}

.filter .count {
  opacity: 0.75;
}

.source-note {
  margin: 0 0 14px;
  color: #8a3b16;
  font-size: 0.92rem;
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 12px 16px;
  border-left: 6px solid var(--source, var(--live));
  flex: 1;
}

.card img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #e7eee8;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  font-size: 0.86rem;
}

.source {
  font-weight: 700;
  color: var(--source, var(--ink));
}

.when {
  color: var(--muted);
  white-space: nowrap;
}

.card h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card h2 a {
  color: inherit;
  text-decoration: none;
}

.card h2 a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card footer {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

.copy {
  border-radius: 10px;
  min-height: 40px;
  padding: 8px 12px;
}

.copy.done {
  background: var(--live);
  border-color: var(--live);
  color: #f4faf6;
}

.empty,
.error {
  grid-column: 1 / -1;
  margin: 24px 0;
  font-size: 1.05rem;
}

.skeleton {
  height: 220px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #e7eee8 25%, #f7faf6 50%, #e7eee8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

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

:focus-visible {
  outline: 2px solid var(--live);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .app {
    width: min(100% - 24px, 1180px);
  }

  .top {
    grid-template-columns: 1fr;
    position: static;
  }

  .tools {
    justify-content: space-between;
  }

  .status {
    text-align: left;
  }

  .brand h1 {
    font-size: 1.7rem;
  }

  .search {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .meter span.running,
  .skeleton {
    animation: none;
  }
}
