:root {
  color-scheme: light dark;
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f2430;
  --text: #edf0f7;
  --muted: #8e98aa;
  --line: #2a303d;
  --accent: #8bd3ff;
  --danger: #ff8b8b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input { font: inherit; }
button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  padding: .65rem .8rem;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button:disabled { cursor: progress; opacity: .6; }
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b0d12;
  color: var(--text);
  padding: .7rem .8rem;
}
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
a { color: inherit; text-decoration: none; }

.shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 16px;
}
.brand, .toolbar, .feed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand h1 { margin: 0; font-size: 1.4rem; letter-spacing: -.03em; }
#counts, .toolbar span, .status, .article-head span, .article-head time, .summary { color: var(--muted); }
.add-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 16px 0 10px; }
.primary { width: 100%; background: linear-gradient(135deg, #265d80, #28405d); }
.status { min-height: 1.4em; margin: 10px 0 14px; }
.error { color: var(--danger); }
.filters { display: grid; gap: 10px; margin-bottom: 18px; }
.filters label { color: var(--muted); user-select: none; }
.sidebar h2 { color: var(--muted); font-size: .8rem; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .08em; }
.feeds, .articles { list-style: none; margin: 0; padding: 0; }
.feed-row {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.all-feeds { font-weight: 650; }
.feed-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  cursor: pointer;
}
.feed-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-count { color: var(--muted); font-size: .82rem; }
.source-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--source);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--source) 18%, transparent);
}
.feed-actions { display: flex; align-items: center; gap: 4px; }
.feed-refresh {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--muted);
}
.feed-refresh:hover { color: var(--accent); }
.feed-refresh svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.remove { color: var(--danger); padding: .25rem .45rem; }
.content { min-width: 0; }
.toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  padding: 12px 18px;
}
.articles { max-width: 1080px; margin: 0 auto; }
.article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  border-left: 3px solid transparent;
}
.article:hover { background: rgba(255,255,255,.025); border-left-color: var(--source); }
.article.read { opacity: .55; }
.article.read .unread-dot { visibility: hidden; }
.article-source {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-top: 2px;
}
.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}
.source-badge {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--source) 22%, var(--panel-2));
  border: 1px solid color-mix(in srgb, var(--source) 48%, var(--line));
  color: var(--text);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .03em;
}
.article-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}
.article-head span:first-of-type {
  color: color-mix(in srgb, var(--source) 70%, var(--text));
  font-weight: 700;
}
.article-head span::before, .article-head time::before { content: "· "; color: var(--muted); font-weight: 400; }
.article h3 { margin: 0; font-size: 1.04rem; line-height: 1.27; letter-spacing: -.01em; }
.summary { margin: 6px 0 0; max-width: 80ch; }
.read-toggle { align-self: center; white-space: nowrap; padding: .45rem .65rem; }
.empty { color: var(--muted); padding: 32px 18px; }
.sentinel { height: 1px; }

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fb;
    --panel: #ffffff;
    --panel-2: #eef2f7;
    --text: #151923;
    --muted: #657083;
    --line: #dbe1ea;
    --accent: #166fa7;
  }
  input { background: #fff; }
}

@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .feed-row { padding: 8px 0; }
  .toolbar { top: 0; }
  .article { grid-template-columns: auto minmax(0, 1fr); padding: 13px 14px; }
  .summary { display: none; }
  .read-toggle { grid-column: 2; justify-self: start; }
}
