:root {
  --bg: #eeeeee;
  --surface: #ffffff;
  --ink: #222;
  --muted: #777;
  --border: #d8d8d8;
  --primary: #013369;       /* NFL navy */
  --accent:  #d50a0a;       /* NFL red */
  --hover-tint: rgba(187,187,187,0.55);
  --header-tint: #fff36b;   /* sticky-header hover yellow */
  --select-ring: magenta;
  --cell-w: 56px;
  --cell-h: 14px;
  --label-w: 44px;
  --header-h: 28px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

header {
  padding: 24px 24px 8px;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 20px;
}
header h1 {
  font-family: 'Arvo', serif;
  font-weight: 700;
  font-size: 2.2em;
  margin: 0;
  letter-spacing: 0.02em;
}
.subtitle { margin: 0; color: var(--muted); }
.latest-pill {
  margin-left: auto;
  background: var(--accent);
  color: white;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.latest-pill::before { content: "🟥 "; }

.controls {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 8px 24px 16px;
  flex-wrap: wrap;
}
.toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.era-buttons { display: flex; gap: 4px; }
.era-buttons button {
  background: white;
  border: 1px solid var(--border);
  padding: 4px 10px;
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
}
.era-buttons button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

main#chart {
  padding: 0 24px 24px;
  max-width: max-content;
}
.grid {
  display: grid;
  grid-template-rows: var(--header-h);
  grid-auto-rows: var(--cell-h);
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  width: max-content;
}
.col-headers,
.row {
  display: contents;
}
.col-header,
.row-label {
  background: var(--surface);
  font-weight: 600;
  color: var(--ink);
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: sticky;
}
.col-header {
  top: 0;
  height: var(--header-h);
  width: var(--cell-w);
  font-size: 13px;
  font-family: 'Arvo', serif;
  letter-spacing: 0.04em;
  color: var(--ink);
  z-index: 1;
}
.row-label {
  left: 0;
  width: var(--label-w);
  justify-content: flex-end;
  padding-right: 8px;
  z-index: 2;
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--muted);
}
.row-label--dim { color: #c0c0c0; }
.col-header.hi, .row-label.hi { background: var(--header-tint); color: black; }
.corner-cell {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 3;
  width: var(--label-w);
  height: var(--header-h);
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cell {
  width: var(--cell-w);
  height: var(--cell-h);
  border-right: 1px solid #f1f1f1;
  border-bottom: 1px solid #f1f1f1;
  background: white;
  position: relative;
}
.cell.has { background: var(--primary); }
.cell.cross { box-shadow: inset 0 0 0 9999px var(--hover-tint); }
.cell.selected { box-shadow: inset 0 0 0 3px var(--select-ring); }

.loading { color: var(--muted); padding: 24px 0; }

dialog#cell-modal {
  border: none;
  border-radius: 8px;
  padding: 20px 24px;
  max-width: 480px;
  width: 90vw;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
dialog#cell-modal::backdrop { background: rgba(0,0,0,0.4); }
dialog .close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; font-size: 22px; cursor: pointer;
}
dialog h2 { font-family: 'Arvo', serif; margin: 0 0 4px; font-size: 1.1em; }
dialog .muted { color: var(--muted); margin: 0 0 12px; }
dialog ul { margin: 0; padding: 0; list-style: none; max-height: 300px; overflow-y: auto; }
dialog li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
}
dialog li .yr { color: var(--muted); font-variant-numeric: tabular-nums; }
dialog #copy-link {
  margin-top: 12px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
}

.faq { padding: 24px; max-width: 720px; }
.faq h2 { font-family: 'Arvo', serif; font-size: 1.2em; }
.faq details { border-top: 1px solid var(--border); padding: 8px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: 8px; }
.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 12px 0;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

footer {
  padding: 16px 24px 32px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  .grid { font-size: 10px; }
}
