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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #f2f2ef;
  color: #1c1c1e;
  line-height: 1.5;
  min-height: 100vh;
}

header {
  background: #1c1c1e;
  color: #fff;
  padding: 20px 0 18px;
}

.header-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tagline {
  color: #888;
  font-size: 0.8rem;
  margin-top: 2px;
}

.notif-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid #444;
  border-radius: 6px;
  color: #aaa;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 6px 11px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.notif-btn:hover {
  border-color: #888;
  color: #fff;
}

.notif-btn.active {
  background: #fff;
  border-color: #fff;
  color: #1c1c1e;
}

.tabs-wrap {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tabs {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
}

.tab {
  background: none;
  border: none;
  padding: 13px 14px 11px;
  font-size: 0.875rem;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.1s;
  font-family: inherit;
}

.tab:hover {
  color: #1c1c1e;
}

.tab.active {
  color: #1c1c1e;
  border-bottom-color: #1c1c1e;
  font-weight: 500;
}

.tag-cloud {
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 20px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-cloud:empty {
  display: none;
}

.tag-pill {
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 3px 9px;
  font-size: 0.72rem;
  color: #777;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: border-color 0.1s, color 0.1s, background 0.1s;
}

.tag-pill:hover {
  border-color: #aaa;
  color: #1c1c1e;
}

.tag-pill.active {
  background: #1c1c1e;
  border-color: #1c1c1e;
  color: #fff;
}

.tag-pill-count {
  font-size: 0.65rem;
  opacity: 0.55;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 20px 40px;
}

.loading,
.error-msg {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 0.9rem;
}

.error-msg {
  color: #c0392b;
}

.story {
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px solid #e8e8e8;
}

.story-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.story-num {
  color: #bbb;
  font-size: 0.78rem;
  min-width: 22px;
  text-align: right;
  padding-top: 3px;
  flex-shrink: 0;
}

.story-body {
  flex: 1;
  min-width: 0;
}

.story-title {
  font-size: 0.96rem;
  font-weight: 500;
  line-height: 1.4;
}

.story-title a {
  color: #1c1c1e;
  text-decoration: none;
}

.story-title a:hover {
  color: #0055cc;
}

.story-teaser {
  font-size: 0.82rem;
  color: #666;
  margin-top: 3px;
  line-height: 1.45;
}

.story-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 3px;
  color: #fff;
  flex-shrink: 0;
}

.badge-hn {
  background: #ff6600;
}

.badge-lobsters {
  background: #ac130d;
}

.meta-item {
  font-size: 0.78rem;
  color: #999;
}

.meta-dot {
  color: #d0d0d0;
  font-size: 0.78rem;
}

.discuss-link {
  font-size: 0.78rem;
  color: #0055cc;
  text-decoration: none;
}

.discuss-link:hover {
  text-decoration: underline;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.tag {
  font-size: 0.68rem;
  background: #f0f0f0;
  color: #666;
  padding: 1px 5px;
  border-radius: 3px;
}

.digest-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
  padding-left: 32px;
}

.digest-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 0.78rem;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.1s, color 0.1s;
}

.digest-btn:hover:not(:disabled) {
  border-color: #aaa;
  color: #1c1c1e;
}

.digest-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.digest-text {
  margin-top: 8px;
  font-size: 0.875rem;
  color: #444;
  line-height: 1.65;
  max-width: 680px;
}

.digest-text p {
  font-style: italic;
  margin-bottom: 6px;
}

.digest-text ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.digest-text li {
  padding-left: 16px;
  position: relative;
}

.digest-text li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: #bbb;
}

.digest-text strong {
  font-weight: 600;
  color: #1c1c1e;
}

.digest-error {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #c0392b;
}

footer {
  text-align: center;
  padding: 20px;
  font-size: 0.75rem;
  color: #bbb;
}
