:root {
  --bg: #0d1117;
  --bg-elev: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --good: #3fb950;
  --warn: #d29922;
  --chip: #21262d;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(960px, 100% - 1.5rem); margin-inline: auto; }

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}
h1 { margin: 0; font-size: 1.45rem; letter-spacing: -0.02em; }
.tagline { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.9rem; }

.tabs { display: flex; gap: 0.35rem; }
.tab {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}
.tab:hover { text-decoration: none; color: var(--text); border-color: #484f58; }
.tab.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 650;
}

.disclaimer {
  margin: 1rem 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--muted);
  font-size: 0.85rem;
}

.view.hidden { display: none; }
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: 1.25rem;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.panel-head h2 { margin: 0; font-size: 1.15rem; }
.muted { color: var(--muted); font-size: 0.88rem; }
.books-intro { margin: 0 0 1rem; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.chip:hover { color: var(--text); border-color: #484f58; }
.chip.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 650;
}
.chip-group-label {
  width: 100%;
  margin: 0.35rem 0 0.1rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.card-list { display: grid; gap: 0.75rem; }
.card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  background: rgba(13, 17, 23, 0.45);
  color: inherit;
}
a.card:hover {
  text-decoration: none;
  border-color: #484f58;
  background: rgba(88, 166, 255, 0.06);
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge.cat-investing { border-color: #1f6feb; color: #79b8ff; }
.badge.cat-retirement { border-color: #8957e5; color: #d2a8ff; }
.badge.cat-macro { border-color: #bf8700; color: #e3b341; }
.badge.cat-mining { border-color: #3fb950; color: #56d364; }
.badge.cat-mindset { border-color: #db61a2; color: #f778ba; }
.badge.type-short { border-color: #484f58; }

.card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}
.blurb { margin: 0; color: var(--muted); font-size: 0.9rem; }
.theme-row, .ticker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}
.pill {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: #21262d;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
}
.pill.theme { font-family: var(--font); color: var(--muted); }

.back-link { font-size: 0.9rem; }
.detail-title { margin: 0.35rem 0 0.5rem; font-size: 1.35rem; letter-spacing: -0.02em; }
.detail-actions { margin: 0.75rem 0 1rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #0d1117;
  font-weight: 650;
  font-size: 0.9rem;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--accent); }

.recap { margin: 0; padding-left: 1.1rem; }
.recap li { margin: 0.35rem 0; }
.table-wrap { overflow-x: auto; margin-top: 0.75rem; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th, td {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.sym { font-family: var(--mono); color: var(--accent); white-space: nowrap; }
.source-note { margin-top: 1rem; font-size: 0.8rem; color: var(--muted); }

.site-footer {
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 560px) {
  h1 { font-size: 1.25rem; }
  .panel { padding: 0.85rem; }
}
