:root {
  --bg: #0e1013;
  --surface: #14171c;
  --raised: #1a1e24;
  --border: #252a32;
  --text: #e8ebef;
  --muted: #8a919b;
  --accent: #39d353;
  --accent-dim: #1f6f35;
  --l0: #1b1f25;
  --l1: #0e4429;
  --l2: #006d32;
  --l3: #26a641;
  --l4: #39d353;
  --cell: 12px;
  --gap: 3px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); font-size: .9em; }
.wrap { width: min(1040px, 100% - 40px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #04130a; padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14, 16, 19, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.bar { display: flex; align-items: center; gap: 24px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.mark {
  width: 16px; height: 16px; border-radius: 4px;
  background:
    linear-gradient(var(--l4), var(--l4)) 0 0 / 7px 7px no-repeat,
    linear-gradient(var(--l2), var(--l2)) 9px 0 / 7px 7px no-repeat,
    linear-gradient(var(--l2), var(--l2)) 0 9px / 7px 7px no-repeat,
    linear-gradient(var(--l0), var(--l0)) 9px 9px / 7px 7px no-repeat;
}
nav { display: flex; gap: 4px; margin-right: auto; }
nav a { padding: 6px 12px; border-radius: 6px; color: var(--muted); font-size: .9rem; transition: color .15s, background .15s; }
nav a:hover { color: var(--text); background: var(--raised); }
.bar-end { display: flex; align-items: center; gap: 14px; font-size: .85rem; }
.repo { border: 1px solid var(--border); padding: 5px 12px; border-radius: 6px; color: var(--muted); transition: color .15s, border-color .15s; }
.repo:hover { color: var(--text); border-color: var(--muted); }

/* Hero */
.hero { padding: 64px 0 36px; }
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.4rem); line-height: 1.08; letter-spacing: -.03em; font-weight: 750; max-width: 14em; }
.lede { margin-top: 14px; color: var(--muted); font-size: 1.1rem; max-width: 36em; }
.meta { margin-top: 20px; display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(57, 211, 83, .18); }

/* Status */
.status { padding: 56px 0; text-align: center; color: var(--muted); }
.status h2 { color: var(--text); font-size: 1.15rem; margin-bottom: 8px; }
.status code { background: var(--raised); padding: 2px 6px; border-radius: 4px; }
.status.error { border: 1px dashed var(--border); border-radius: 12px; padding: 40px 24px; }
.spinner { width: 22px; height: 22px; margin: 0 auto 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.stat dt { color: var(--muted); font-size: .8rem; order: 2; }
.stat dd { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat { display: flex; flex-direction: column; }

/* Cards & sections */
section.wrap { margin-top: 28px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.card-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h2 { font-size: 1.15rem; letter-spacing: -.01em; }
#heatmap-summary { margin: 2px 0 16px; }

/* Form controls */
.field { display: block; }
.field.grow { flex: 1; min-width: 0; }
input, select {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font: inherit; font-size: .9rem;
  transition: border-color .15s;
}
input:hover, select:hover { border-color: #3a414c; }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(57, 211, 83, .15); }
select { width: auto; padding-right: 8px; }

/* Heatmap */
.heatmap-scroll { overflow-x: auto; padding-bottom: 8px; }
.heatmap { --weeks: 53; display: grid; grid-template-columns: 30px auto; width: max-content; min-width: 100%; }
.hm-months { grid-column: 2; display: grid; grid-template-columns: repeat(var(--weeks), var(--cell)); column-gap: var(--gap); height: 18px; font-size: .72rem; color: var(--muted); }
.hm-months span { white-space: nowrap; }
.hm-days { display: grid; grid-template-rows: repeat(7, var(--cell)); row-gap: var(--gap); font-size: .68rem; color: var(--muted); line-height: var(--cell); }
.hm-grid { display: grid; grid-template-rows: repeat(7, var(--cell)); grid-auto-flow: column; grid-auto-columns: var(--cell); gap: var(--gap); }
.cell { display: block; width: var(--cell); height: var(--cell); border-radius: 2px; background: var(--l0); padding: 0; border: 0; }
.cell.l1 { background: var(--l1); } .cell.l2 { background: var(--l2); }
.cell.l3 { background: var(--l3); } .cell.l4 { background: var(--l4); }
.cell.spacer { background: none; }
.cell.future { opacity: .55; }
button.cell { cursor: pointer; transition: transform .1s, outline-color .1s; }
button.cell:hover { outline: 1px solid var(--text); outline-offset: 1px; }
.legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; font-size: .72rem; color: var(--muted); }
.legend span:first-child { margin-right: 4px; } .legend span:last-child { margin-left: 4px; }

.tip {
  position: fixed; z-index: 50; pointer-events: none;
  background: #0a0c0f; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; font-size: .78rem; white-space: nowrap;
  transform: translate(-50%, -100%);
}
.tip b { color: var(--accent); font-weight: 600; }

/* Filters */
.filters { display: flex; gap: 10px; margin: 14px 0 8px; }

/* Timeline */
.group { margin-top: 28px; }
.group-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; font-size: .95rem; font-weight: 600; }
.group-title span { color: var(--muted); font-weight: 400; font-size: .82rem; }
.group-list { border-left: 1px solid var(--border); margin-left: 4px; padding-left: 22px; display: grid; gap: 12px; }
.entry {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; transition: border-color .15s, background .4s;
}
.entry::before {
  content: ""; position: absolute; left: -28px; top: 22px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--bg);
}
.entry:hover { border-color: #353c47; }
.entry.flash { border-color: var(--accent); background: #13211a; }
.entry time { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.entry h3 { font-size: 1.05rem; letter-spacing: -.01em; margin-top: 2px; }
.acts { margin-top: 10px; display: grid; gap: 4px; }
.acts li { position: relative; padding-left: 16px; font-size: .94rem; }
.acts li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; border-radius: 1px; background: var(--accent-dim); }
.learning { margin-top: 12px; padding: 8px 12px; border-left: 2px solid var(--accent-dim); background: var(--bg); border-radius: 0 6px 6px 0; font-size: .9rem; }
.learning b { color: var(--muted); font-weight: 500; margin-right: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { font-size: .75rem; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); background: transparent; font-family: inherit; cursor: pointer; transition: color .15s, border-color .15s; }
.tag:hover { color: var(--accent); border-color: var(--accent-dim); }
.empty { margin-top: 24px; padding: 40px 20px; text-align: center; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 1.05rem; margin-bottom: 6px; }
mark { background: rgba(57, 211, 83, .22); color: inherit; border-radius: 2px; }

.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 64px; padding: 20px 0 32px; border-top: 1px solid var(--border); }

/* Responsive */
@media (max-width: 720px) {
  .wrap { width: calc(100% - 28px); }
  .bar { gap: 8px; }
  nav { overflow-x: auto; }
  nav a { padding: 6px 8px; }
  #header-year { display: none; }
  .hero { padding: 40px 0 24px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .filters { flex-direction: column; }
  select { width: 100%; }
  .card-head select { width: auto; }
  .group-list { padding-left: 16px; }
  .entry::before { left: -22px; }
  .entry { padding: 14px; }
}
@media (max-width: 420px) { .brand { font-size: .95rem; } .repo { display: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
