:root {
  --bg: #fbfaf6;
  --ink: #2a2a2a;
  --muted: #6c6760;
  --rule: #d9d4c8;
  --accent: #7a3b2e;
  --accent-soft: #c98a78;
  --highlight: #f1e7d3;
  --grid: #e8e3d6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.55 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color: var(--ink);
  background: var(--bg);
}

header {
  padding: 1.5rem 2rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}
header h1 {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.01em;
  font-size: 1.6rem;
}
header .subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

nav#tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0 2rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.tab {
  background: transparent;
  border: none;
  padding: 0.7rem 1rem;
  color: var(--muted);
  font: inherit;
  font-size: 0.93rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

main {
  padding: 1.5rem 2rem 4rem;
  max-width: 1300px;
}
.panel { display: none; }
.panel.active { display: block; }

h2 {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 1.25rem;
}
h3 { font-size: 1.05rem; margin: 1.25rem 0 0.4rem; }
p.lede {
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 1.25rem;
}

table {
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0.5rem 0 1.5rem;
}
th, td {
  padding: 0.35rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}
th { font-weight: 600; color: var(--muted); }
tr:hover td { background: var(--highlight); }

.legend {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.25rem 0 0.75rem;
}
.legend .swatch {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: -2px;
}

.controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 0.5rem 0 1rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.controls label { color: var(--muted); }
.controls select, .controls input {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: white;
}

svg { font: inherit; }

footer {
  padding: 1rem 2rem 2rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.82rem;
}

.banner {
  background: var(--highlight);
  border-left: 3px solid var(--accent-soft);
  padding: 0.5rem 0.8rem;
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--ink);
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(20,20,20,0.92);
  color: #f6f1e6;
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  font-size: 0.82rem;
  max-width: 300px;
  z-index: 100;
}

.scene-card {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  margin: 0.6rem 0;
  background: white;
}
.scene-card h4 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}
.scene-card .meta {
  font-size: 0.83rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.scene-card .event {
  font-size: 0.86rem;
  padding: 0.25rem 0;
  border-top: 1px dashed var(--rule);
}
.scene-card .event:first-of-type { border-top: 0; }
.kind-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.05rem 0.4rem;
  border-radius: 2px;
  margin-right: 0.35rem;
  background: var(--highlight);
  color: var(--accent);
}

.chapter-card {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.6rem;
  background: white;
}
.chapter-card h4 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}
.chapter-card .summary {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0.2rem 0 0.5rem;
}
.chapter-card .stats {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--muted);
}
.chapter-card .stats b { color: var(--ink); font-weight: 600; }
.lint-pass { color: #2c6e3f; font-weight: 600; }
.lint-fail { color: #b73a2a; font-weight: 600; }
