:root {
  --font-base: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Dark Theme Palette */
  --bg-dark: #0f1115;
  --bg-panel: #16181d;
  --bg-input: #1e2026;

  --text-main: #ededed;
  --text-muted: #949a9f;

  --accent-primary: #3b82f6;
  /* Blue for primary actions */
  --accent-glow: rgba(59, 130, 246, 0.5);
  --accent-revenue: #10b981;
  /* Green for money */

  --border: #2a2d35;
  --border-hover: #3f424c;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-base);
  background-color: var(--bg-dark);
  color: var(--text-main);
  /* Cool subtle background mesh/gradient */
  background-image:
    radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.06), transparent 25%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  text-decoration: underline;
  color: #60a5fa;
}

/* Layout */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* Hero Section */
.hero {
  margin-bottom: 48px;
  animation: fade-in 0.6s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.8;
}

#thread-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: monospace;
  opacity: 0.6;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 16px;
  background: linear-gradient(to right, #ffffff, #949a9f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}

.hero h1 .year {
  color: var(--accent-primary);
  -webkit-text-fill-color: var(--accent-primary);
}

.lede {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.6;
  margin: 0 0 40px;
}

/* Controls */
.controls-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.search-outer {
  flex: 1;
  max-width: 420px;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.search-wrap:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.controls-row input[type="search"] {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 12px 40px 12px 40px;
  flex: 1;
  font-size: 0.95rem;
  outline: none;
  min-width: 0;
}

.btn-clear {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  margin-right: 4px;
}

.btn-clear:hover {
  color: var(--text-main);
}

.count-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-md);
}

/* Cards Grid */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  animation: fade-in 0.5s ease-out both;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: var(--border-hover);
}

/* Card Header */
.card-header {
  margin-bottom: 16px;
}

.card h3 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text-main);
}

/* Card Body */
.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-revenue {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.stat-revenue .label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--accent-revenue);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.stat-revenue .value {
  color: #d1fae5;
  font-weight: 600;
  font-size: 0.95rem;
}

.summary {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.5;
  margin: 0;
}

.content-text p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 10px 0;
}

.content-text p:last-child {
  margin-bottom: 0;
}

/* Card Footer & Actions */
.card-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-actions {
  display: flex;
  gap: 12px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  border: 1px solid transparent;
}

.btn-primary:hover {
  background: #2563eb;
  text-decoration: none;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-input);
  color: var(--text-main);
  border-color: var(--text-muted);
  text-decoration: none;
}

.hn-icon {
  color: #ff6600;
  /* Hacker News Orange */
}

/* Raw details */
.raw {
  margin-top: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

.raw summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  opacity: 0.7;
}

.raw pre {
  background: #000;
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  color: #a3a3a3;
  font-size: 0.8rem;
  margin-top: 8px;
}

/* Footer & Utilities */
.footer {
  margin-top: 60px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.source-link {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 4px;
}

.source-link:hover {
  color: var(--text-main);
  text-decoration-color: var(--text-main);
}

.empty {
  text-align: center;
  padding: 60px;
  font-size: 1.1rem;
  color: var(--text-muted);
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 2.2rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
    background: transparent;
    border: none;
    padding: 0;
  }

  .controls input[type="search"] {
    width: 100%;
  }

  .toggle {
    border-left: none;
    justify-content: center;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 8px;
  }
}

.badge-year {
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.card-title-link {
  color: var(--text-main);
  text-decoration: none;
  transition: color 0.15s;
}

.card-title-link:hover {
  color: var(--accent-primary);
  text-decoration: none;
}

.author-link {
  color: var(--text-muted);
  text-decoration: none;
}

.author-link:hover {
  text-decoration: underline;
  color: var(--text-main);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  flex: 0 0 auto;
}