:root {
  --bg: #ffffff;
  --text: #222222;
  --muted: #666666;
  --rule: #dddddd;
  --link: #23417a;
  --red: #8f2a1d;
  --code-bg: #f4f4f4;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.6;
}
body.home { background: linear-gradient(180deg, #eef2f9 0, #f7f9fc 340px, var(--bg) 760px) no-repeat; }

main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 56px 20px 40px;
}

/* Text keeps a readable measure; figures break out wider, each to its own width */
main:not(.demo) > section > *,
main:not(.demo) > footer {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}
main:not(.demo) > header > figure.intro-video {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
header { text-align: center; margin-bottom: 48px; }

h1 {
  font-size: 38px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  text-align: left;
}
h1 .name { font-variant: small-caps; letter-spacing: 0.01em; }

.subtitle {
  font-size: 23px;
  line-height: 1.35;
  margin: 0 0 20px;
}

.authors {
  margin: 0;
  font-size: 18px;
  width: min(900px, calc(100vw - 32px));
  margin-left: 50%;
  transform: translateX(-50%);
}
.authors span, .affiliations span { display: inline-block; white-space: nowrap; }
.authors span { margin: 0 7px; }
.authors sup, .affiliations sup { font-size: 0.65em; margin-left: 1px; }
.affiliations { margin: 14px 0 0; font-size: 14.5px; color: var(--muted); line-height: 1.65; }
.affiliations span { margin: 0 8px; }
.equal { margin: 10px 0 0; font-size: 14px; color: var(--muted); font-style: italic; }

.links {
  margin: 28px 0 0;
  font-size: 17px;
}
.links a, .links span {
  display: inline-block;
  margin: 4px 5px;
  padding: 5px 14px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  white-space: nowrap;
}
.links a, .links span { color: #fff; border: 0; }
.links a:hover { filter: brightness(0.85); text-decoration: none; }
.links span { opacity: 0.55; cursor: default; }
.btn-paper { background: #8f2a1d; }
.btn-code { background: #3a3a3a; }
.btn-demo { background: #23417a; }
.btn-bib { background: #2e6b45; }

.title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 26px;
  width: min(1000px, calc(100vw - 32px));
  margin-left: 50%;
  transform: translateX(-50%);
}
.title-row h1 { margin: 0; }
.emblem { height: 96px; width: auto; }

/* Sections */
h2 {
  font-size: 25px;
  font-weight: 600;
  margin: 52px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-size: 19px;
  font-weight: 600;
  margin: 30px 0 6px;
}

p { margin: 0 0 14px; }

/* Icons */
.icon {
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.14em;
}
.links .icon { margin-right: 6px; }
.home h2 .icon { width: 0.85em; height: 0.85em; margin-right: 10px; color: var(--red); vertical-align: -0.08em; }
.family-name .icon { width: 1.2em; height: 1.2em; margin-right: 6px; vertical-align: -0.24em; }

.highlights { padding-left: 20px; margin: 0; }
.highlights li { margin-bottom: 10px; }
.highlights li::marker { color: var(--red); }

/* Media */
video {
  display: block;
  width: 100%;
  border: 1px solid var(--rule);
  background: #f4f4f4;
}

figure { margin: 26px 0 30px; }
.home video, .home figure > a > img {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(20, 30, 60, 0.08), 0 6px 22px rgba(20, 30, 60, 0.10);
}
.home h2 { position: relative; }
.home h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 44px;
  height: 2px;
  background: var(--red);
}
.intro-video { margin: 22px 0 18px; }

figure > figcaption:first-child { margin: 0 0 14px; }
main:not(.demo) > section > figure.norm-figure {
  margin-top: 34px;
  padding: 16px 16px 18px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: #fafbfd;
}
.norm-figure > figcaption {
  font-size: 16.5px;
  color: var(--text);
}
.norm-figure > figcaption .icon { color: var(--link); margin-right: 4px; }
.norm-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.norm-family { display: flex; flex-direction: column; gap: 4px; }
.norm-family span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-bottom: 3px;
  border-bottom: 2px solid var(--fam);
  margin-bottom: 2px;
}
.norm-family button {
  flex: 1;
  font: inherit;
  font-size: 14px;
  line-height: 1.3;
  text-align: left;
  padding: 6px 9px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.norm-family button:hover { border-color: var(--fam); }
.norm-family button[aria-pressed="true"] {
  background: var(--fam);
  border-color: var(--fam);
  color: #fff;
}
@media (max-width: 600px) {
  .norm-picker { grid-template-columns: 1fr 1fr; }
}



figure img {
  display: block;
  width: 100%;
  height: auto;
}

figcaption {
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 10px;
}
figcaption b { color: var(--text); font-weight: 600; }

/* Lists */
.families {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0 24px;
}
.family {
  padding: 14px 14px 12px;
  border-radius: 8px;
  border-top: 3px solid var(--fam);
  background: #f5f6f9;
}
.family-name { display: block; font-weight: 600; font-size: 18px; color: var(--fam); }
.family-count { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
.family p { margin: 0; font-size: 14.5px; line-height: 1.45; }
@media (max-width: 700px) {
  .families { grid-template-columns: 1fr 1fr; }
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 18px 0 8px; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 5px 7px;
  text-align: center;
  white-space: nowrap;
}
th:first-child, td:first-child { text-align: left; }

thead tr:first-child th { border-top: 1.5px solid var(--text); }
thead tr:last-child th { border-bottom: 1px solid var(--text); font-weight: 600; }
thead th { font-weight: 600; }
tbody tr:last-child td { border-bottom: 1.5px solid var(--text); }
tr.sep td { border-top: 1px solid var(--rule); }
td.ref, tr.ref td { color: var(--muted); }

.table-note { font-size: 15px; color: var(--muted); }

table.small { width: auto; margin: 0 auto; }

/* Bar chart */
.bars { font-size: 14px; font-variant-numeric: tabular-nums; }
.bar-legend { display: flex; gap: 18px; margin-bottom: 10px; color: var(--muted); }
.bar-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; }
.bar-rows { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 10px; }
.bar-row.sep { border-top: 1px solid var(--rule); padding-top: 6px; }
.bar-label { white-space: nowrap; }
.bar-pair { display: grid; gap: 2px; padding-right: 40px; }
.bar {
  position: relative;
  height: 10px;
  width: calc(var(--v) * 1%);
}
.bar em {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  padding-left: 5px;
  font-style: normal;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
}
.seen { background: var(--link); }
.unseen { background: #8ea3c8; }
.bar-row.ref .bar-label { color: var(--muted); }
.bar-row.ref .seen { background: #8a8a8a; }
.bar-row.ref .unseen { background: #c4c4c4; }

/* Findings */
.finding-num { color: var(--red); margin-right: 6px; }

/* BibTeX */
.bib { position: relative; }
pre {
  background: var(--code-bg);
  padding: 16px 18px;
  overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0;
}
.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  font: inherit;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 14px;
  color: var(--link);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 4px 6px;
}
.copy:hover { text-decoration: underline; }

footer {
  margin-top: 60px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  main { padding: 36px 16px 32px; }
  h1 { font-size: 24px; }
  h1 br.lg { display: none; }
  .title-row { flex-direction: column; gap: 10px; }
  h1 { text-align: center; }
  .subtitle { font-size: 19px; }
  h2 { font-size: 22px; margin-top: 40px; }
  .links a, .links span { margin: 3px 3px; padding: 4px 10px; }
  .affiliations span { white-space: normal; display: block; margin: 0 0 2px; }
  .authors span { margin: 0 6px; }
  .emblem { height: 64px; }
  .bar-row { grid-template-columns: 112px 1fr; gap: 8px; }
  .bars { font-size: 13px; }
}


/* Demo page */
main.demo { max-width: 1440px; }
.back { font-size: 16px; margin: 0 0 8px; }
.back .name { font-variant: small-caps; }
.demo-head { text-align: left; margin-bottom: 20px; }
h2.demo-title { margin-top: 0; }

.player video { border: 0; cursor: pointer; }

.scrub { position: relative; margin: 14px 0 4px; height: 28px; }
.marks { position: absolute; inset: 0 7px; pointer-events: none; }
.mark {
  position: absolute;
  top: 2px;
  width: 4px;
  height: 24px;
  margin-left: -2px;
  padding: 0;
  border: 0;
  border-radius: 1px;
  cursor: pointer;
  pointer-events: auto;
  z-index: 2;
}
.ev-new { background: #c8372d; }
.ev-other { background: #d68a1c; }
.ev-ok { background: #2e8a4a; }

#slider {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --p: 0%;
}
#slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--text) var(--p), var(--rule) var(--p));
}
#slider::-moz-range-track { height: 6px; border-radius: 3px; background: var(--rule); }
#slider::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--text); }
#slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--text);
  position: relative;
  z-index: 3;
}
#slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--text);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}
.controls button, .events button {
  font: inherit;
  color: var(--text);
  background: none;
  cursor: pointer;
}
.controls button {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 3px 12px;
  min-width: 40px;
}
.controls button:hover { border-color: var(--muted); }
#play { min-width: 76px; }
.tval { min-width: 110px; text-align: center; font-variant-numeric: tabular-nums; }
.speed { margin-left: auto; display: flex; gap: 4px; }
.speed button { padding: 3px 8px; font-size: 14px; color: var(--muted); }
.speed button.on { color: var(--text); border-color: var(--text); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.legend .keys { margin-left: auto; font-size: 13px; }
.legend i { display: inline-block; width: 4px; height: 14px; margin-right: 6px; vertical-align: -2px; }

ol.events { list-style: none; padding: 0; margin: 0; font-size: 15px; }
.events li { border-top: 1px solid var(--rule); }
.events li:last-child { border-bottom: 1px solid var(--rule); }
.events button {
  display: grid;
  grid-template-columns: 64px 290px 1fr;
  gap: 10px;
  width: 100%;
  padding: 7px 4px;
  border: 0;
  text-align: left;
  color: var(--muted);
}
.events button:hover { background: var(--code-bg); }
.events li.past button { color: var(--text); }
.events li.cur button { background: var(--code-bg); }
.et { font-variant-numeric: tabular-nums; }
.ek { background: none; font-weight: 600; }
.ek.ev-new { color: #c8372d; }
.ek.ev-other { color: #b06f10; }
.ek.ev-ok { color: #2e8a4a; }

/* Demo dashboard panels */
.dash { display: grid; grid-template-columns: 290px minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.reason-panel { margin-top: 14px; }
.events-panel .events button { grid-template-columns: 52px 1fr; gap: 2px 8px; padding: 6px 2px; }
.events-panel .ed { grid-column: 2; font-size: 13.5px; line-height: 1.4; }
.events-panel .events { font-size: 14px; position: relative; }
.panel { border: 1px solid var(--rule); border-radius: 6px; padding: 12px 14px; font-size: 14.5px; line-height: 1.5; }
.panel h4 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel h4 .count { letter-spacing: 0; }
.panel p { margin: 0; }
.muted { color: var(--muted); }
.star { color: #d4a017; margin-right: 4px; }
.nc-name { font-size: 18px; font-weight: 600; }
.nc-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 8px !important; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; margin-left: 8px; padding: 0 6px; border-radius: 3px; font-size: 12px; font-weight: 600; vertical-align: 2px; }
.tag-bad { background: #c8372d; color: #fff; }

ul.agents { list-style: none; padding: 0; margin: 0; }
.agents li {
  display: grid;
  grid-template-columns: 12px 1fr auto 76px;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-top: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}
.agents li:first-child { border-top: 0; }
.agents li.muted { display: block; }
.agents li.is-nc .an { font-weight: 600; }
.agents i, .groups i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.ap { color: var(--muted); }
.as { text-align: right; color: var(--muted); font-size: 13px; }
.as .tag { margin-left: 0; }
.groups { margin-top: 8px !important; font-size: 12.5px; color: var(--muted); }
.groups span { margin-right: 8px; }
.groups i { width: 8px; height: 8px; margin-right: 4px; }
.g-green { background: #3f9a4e; }
.g-orange { background: #e0892b; }
.g-blue { background: #3d6fc4; }

/* Panel tints: amber for the newcomer's own state, grey for its reasoning, blue for customers, purple for events */
.panel.tint { border-color: var(--tint-rule); border-left: 4px solid var(--tint-accent); background: var(--tint-bg); }
.panel.tint h4 { color: var(--tint-head); }
.tint-nc { --tint-bg: #fbf6e9; --tint-rule: #eadcb2; --tint-accent: #c9971c; --tint-head: #8a6508; }
.tint-cust { --tint-bg: #eff4fb; --tint-rule: #c9d7ec; --tint-accent: #3d6fc4; --tint-head: #2f5597; }
.tint-grey { --tint-bg: #f5f5f5; --tint-rule: #dddddd; --tint-accent: #8a8a8a; --tint-head: #555555; }
.tint-ev { --tint-bg: #f5f1fa; --tint-rule: #dbd0ec; --tint-accent: #6b4fa3; --tint-head: #563d88; }
.panel.tint .agents li, .panel.tint .events li { border-color: var(--tint-rule); }
.panel.tint .events button:hover, .panel.tint .events li.cur button { background: rgba(0, 0, 0, 0.05); }
.panel.tint .conf-bar { background: var(--tint-rule); }
.panel.tint-nc .conf-bar div { background: var(--tint-accent); }

.reason { white-space: pre-wrap; }
.panel.truth {
  border-color: #b9d9c2;
  border-left: 4px solid #2e8a4a;
  background: #eef6f0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
}
.truth-label {
  display: block;
  margin-bottom: 2px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2e6b45;
}
.truth-label i { font-weight: 400; letter-spacing: 0; text-transform: none; }
.belief { font-style: italic; }
.conf { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13.5px; color: var(--muted); }
.conf-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.conf-bar div { height: 100%; background: var(--link); transition: width 0.15s; }
.conf b { color: var(--text); font-weight: 600; min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }

/* On a desktop-sized screen the title, back link and intro share one compact header row. */
@media (min-width: 1100px) {
  main.demo { padding: 14px 24px 40px; }
  .demo-head { display: flex; align-items: baseline; gap: 18px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--rule); }
  .demo-head .back { margin: 0; white-space: nowrap; }
  .demo-head h2.demo-title { margin: 0; padding: 0; border: 0; font-size: 22px; white-space: nowrap; }
  .demo-head .demo-intro { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--muted); }
  .scrub { margin-top: 10px; }
}
@media (max-width: 1399px) {
  .legend .keys { display: none; }
}

@media (max-width: 1099px) {
  .dash { grid-template-columns: 1fr; }
  .dash .player { order: -1; }
}

@media (max-width: 600px) {
  .events button { grid-template-columns: 56px 1fr; }
  .ed { grid-column: 2; }
  .speed { margin-left: 0; }
}
