:root {
  --paper: #E9EEF0;
  --sheet: #F6F8F9;
  --ink: #17202B;
  --graphite: #5E6B78;
  --rule: #C9D2D8;
  --cobalt: #2B45C9;
  --cobalt-soft: #DCE2FA;
  --for: #2a78d6;
  --against: #e34948;

  --serif: "Literata", Georgia, serif;
  --sans: "Schibsted Grotesk", system-ui, sans-serif;

  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.0625rem;
  --step-2: 1.375rem;
  --step-3: 1.75rem;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }

.muted { color: var(--graphite); }

kbd {
  font: 500 var(--step--1) var(--sans);
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 0.3em;
  background: var(--sheet);
}

/* ---------- layout ---------- */

.app {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr) 22rem;
  height: 100vh;
}
.app:has(.profile[hidden]) { grid-template-columns: 17rem minmax(0, 1fr); }

/* ---------- accounts: login screen, account menu, dialogs ---------- */

body:not([data-role="admin"]) .admin-only, body:not([data-update]) .update-only { display: none; }

.login {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--paper);
}
.login[hidden] { display: none; }
.login form, .dialog form { display: grid; gap: 0.8rem; }
.login form {
  width: min(22rem, 100%);
  padding: 1.75rem;
  border: 1px solid var(--rule);
  border-top: 4px solid var(--cobalt);
  border-radius: 8px;
  background: #fff;
}
.login h1 { margin: 0; font: 600 var(--step-3)/1.1 var(--serif); letter-spacing: -0.01em; }
.login p, .dialog p { margin: 0; font-size: var(--step--1); }
.login label, .dialog label { display: grid; gap: 0.25rem; font-size: var(--step--1); font-weight: 500; }
.login input, .dialog input, .dialog select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--sheet);
  font-weight: 400;
}
.login .send, .dialog .send { justify-self: start; }
.dialog .actions { display: flex; align-items: center; gap: 0.75rem; }
.dialog code { padding: 0 0.25em; border-radius: 3px; background: var(--paper); }
.error { color: #A8281F; }
.error[hidden] { display: none; }

.account { position: relative; float: right; font-size: var(--step--1); }
.account summary { list-style: none; cursor: pointer; }
.account summary::-webkit-details-marker { display: none; }
.account summary::after { content: " ▾"; }
.account[open] summary { color: var(--ink); background: var(--paper); }
.account .menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  display: grid;
  width: 11rem;
  padding: 0.4rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgb(23 32 43 / 0.12);
}
.account .menu .text-btn { text-align: left; color: var(--ink); }

.dialog {
  width: min(32rem, calc(100vw - 2rem));
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 16px 48px rgb(23 32 43 / 0.2);
}
.dialog::backdrop { background: rgb(23 32 43 / 0.35); }
.dialog h2 { margin: 0; font: 600 var(--step-2)/1.2 var(--serif); }
.dialog h3 { margin: 0.5rem 0 0; font: 700 var(--step--1) var(--sans); color: var(--graphite); }
.dialog .detail-top { margin-bottom: 0.5rem; }
.users { width: 100%; margin: 1rem 0; border-collapse: collapse; font-size: var(--step--1); }
.users th, .users td { padding: 0.35rem 0.4rem 0.35rem 0; border-top: 1px solid var(--rule); text-align: left; }
.users th { font-weight: 500; }
.users th small { font-weight: 400; color: var(--graphite); }
.users td:nth-child(n+3) { text-align: right; }
.users .text-btn { color: var(--cobalt); }

/* saved chats: a menu in the room's header */
.chats { position: relative; }
.chats summary { list-style: none; cursor: pointer; white-space: nowrap; }
.chats summary::-webkit-details-marker { display: none; }
.chats summary::after { content: " ▾"; }
.chats[open] summary { color: var(--ink); background: var(--paper); }
.chats .menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  width: 22rem;
  max-height: 70vh;
  overflow-y: auto;
  padding: 0.4rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgb(23 32 43 / 0.12);
  font-size: var(--step--1);
}
#new-chat { width: 100%; text-align: left; color: var(--cobalt); font-weight: 500; }
#chat-list { list-style: none; margin: 0.3rem 0 0; padding: 0.3rem 0 0; border-top: 1px solid var(--rule); }
#chat-list li { display: flex; align-items: center; border-radius: 5px; }
#chat-list li:hover { background: var(--paper); }
#chat-list li[aria-current="true"] { background: var(--cobalt-soft); }
#chat-list .open { flex: 1; min-width: 0; padding: 0.35rem 0.4rem; border: 0; background: none; text-align: left; cursor: pointer; }
#chat-list .name { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
#chat-list small { color: var(--graphite); }
#chat-list .icon-btn { visibility: hidden; }
#chat-list li:hover .icon-btn, #chat-list .icon-btn:focus-visible { visibility: visible; }

/* ---------- roster ---------- */

.roster {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--rule);
}

.roster-head { padding: 1.25rem 1.25rem 0.75rem; }

.roster-head h1 {
  margin: 0;
  font: 600 var(--step-3)/1.1 var(--serif);
  letter-spacing: -0.01em;
}

.roster-head p { margin: 0.25rem 0 0.9rem; font-size: var(--step--1); }

.update { margin: -0.6rem 0 0.9rem; font-size: var(--step--1); }
.update .text-btn { padding-left: 0; color: var(--cobalt); }
.update .text-btn:disabled { color: var(--graphite); cursor: default; background: none; }
.roster-head .update p { margin: 0.1rem 0 0; overflow-wrap: anywhere; }

#guest-filter {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--sheet);
}

.guest-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0.5rem 1.5rem;
  overflow-y: auto;
}

.guest-list button {
  display: grid;
  grid-template-columns: 3px 1fr auto;
  gap: 0 0.7rem;
  width: 100%;
  padding: 0.4rem 0.75rem 0.4rem 0.5rem;
  border: 0;
  border-radius: 6px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.guest-list button:hover { background: var(--sheet); }
.guest-list button[aria-current="true"] { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); }

.guest-list .swatch { grid-row: span 2; border-radius: 2px; background: var(--hue); }
.guest-list .name { font-weight: 500; }
.guest-list .count { grid-row: span 2; align-self: center; font-size: var(--step--1); color: var(--graphite); }
.guest-list .area { font-size: var(--step--1); color: var(--graphite); }

/* ---------- room ---------- */

.room {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--sheet);
}

.room-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.room-hint { flex: 1; margin: 0; font-size: var(--step--1); color: var(--graphite); }

.text-btn, .icon-btn {
  border: 0;
  background: none;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  color: var(--graphite);
  cursor: pointer;
}
.text-btn:hover, .icon-btn:hover { color: var(--ink); background: var(--paper); }

.settings { position: relative; }
.settings summary { list-style: none; cursor: pointer; white-space: nowrap; }
.settings summary::-webkit-details-marker { display: none; }
.settings[open] summary { color: var(--ink); background: var(--paper); }
.settings form {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  display: grid;
  gap: 0.6rem;
  width: 16rem;
  padding: 0.9rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(23 32 43 / 0.12);
  font-size: var(--step--1);
}
.settings p { margin: 0; color: var(--graphite); }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.settings select, .settings input[type="number"] {
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--sheet);
}
.settings input[type="number"] { width: 3.5rem; }

.messages {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 1.5rem 1.5rem 0.5rem;
  overflow-y: auto;
}

.messages > li { max-width: 46rem; margin: 0 auto 1.75rem; }

.empty { max-width: 34rem; margin: 12vh auto 0; }
.empty h2 { font: 600 var(--step-2)/1.25 var(--serif); margin: 0 0 0.5rem; }
.empty p { color: var(--graphite); }
.empty ul { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 0.5rem; }
.empty ul button {
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
  font-family: var(--serif);
}
.empty ul button:hover { border-color: var(--cobalt); }

/* the user's question */
.msg-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.msg-user .quote {
  max-width: 100%;
  margin-bottom: 0.25rem;
  padding: 0;
  border: 0;
  background: none;
  text-align: right;
  font-size: var(--step--1);
  color: var(--graphite);
  cursor: pointer;
}
.msg-user .quote:hover { color: var(--ink); }
.msg-user p {
  margin: 0;
  max-width: 34rem;
  padding: 0.6rem 0.9rem;
  border-radius: 10px 10px 2px 10px;
  background: var(--cobalt);
  color: #fff;
  white-space: pre-wrap;
}
.msg-user .mention { font-weight: 700; }

/* a guest's reply: a coloured spine in the guest's hue */
.msg-guest {
  padding-left: 1rem;
  border-left: 3px solid var(--hue);
}

.speaker {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.6rem;
  margin-bottom: 0.4rem;
}
.speaker button {
  border: 0;
  padding: 0;
  background: none;
  font: 600 var(--step-1) var(--serif);
  cursor: pointer;
}
.speaker button:hover { text-decoration: underline; text-underline-offset: 3px; }
.speaker .name { font: 600 var(--step-1) var(--serif); }

/* the moderator's summary that closes a discussion */
.msg-summary {
  padding: 0.8rem 1rem 0.2rem;
  border-left-color: var(--ink);
  border-radius: 0 8px 8px 0;
  background: var(--paper);
}
.speaker .role { font-size: var(--step--1); color: var(--graphite); }
.speaker .reply { margin-left: auto; font: 400 var(--step--1) var(--sans); color: var(--graphite); }
.speaker .reply:hover { color: var(--cobalt); text-decoration: none; }

.answer { font: 400 var(--step-1)/1.65 var(--serif); margin: 0; }

.passage { margin: 0 0 1rem; }

.passage blockquote {
  margin: 0;
  font: 400 var(--step-1)/1.65 var(--serif);
  max-width: 68ch;
}
.passage blockquote.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}
.passage mark {
  background: color-mix(in srgb, var(--hue) 22%, transparent);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.source {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  margin-top: 0.3rem;
  font-size: var(--step--1);
  color: var(--graphite);
}
.source a { color: var(--cobalt); text-decoration: none; font-weight: 500; }
.source a:hover { text-decoration: underline; }

.typing {
  max-width: 46rem;
  width: calc(100% - 3rem);
  margin: 0 auto 0.5rem;
  font: italic var(--step-0) var(--serif);
  color: var(--graphite);
}

.reply-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 46rem;
  width: calc(100% - 3rem);
  margin: 0 auto 0.4rem;
  padding-left: 0.6rem;
  border-left: 3px solid var(--cobalt);
  font-size: var(--step--1);
  color: var(--graphite);
}
.reply-bar[hidden] { display: none; }

/* ---------- composer ---------- */

.composer {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  width: calc(100% - 3rem);
  max-width: 46rem;
  margin: 0 auto 1.25rem;
}

.composer-box { position: relative; flex: 1; }

#input {
  display: block;
  width: 100%;
  resize: none;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  font-size: var(--step-1);
}
#input:focus { border-color: var(--cobalt); outline: none; box-shadow: 0 0 0 3px var(--cobalt-soft); }

.send {
  padding: 0.7rem 1.2rem;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
}
.send:hover { background: var(--cobalt); }

.mention-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: min(22rem, 100%);
  max-height: 16rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(23 32 43 / 0.12);
}
.mention-menu li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  border-radius: 5px;
  cursor: pointer;
}
.mention-menu li::before {
  content: "";
  width: 3px;
  height: 1.1em;
  border-radius: 2px;
  background: var(--hue);
}
.mention-menu li small { margin-left: auto; color: var(--graphite); }
.mention-menu li[aria-selected="true"] { background: var(--cobalt-soft); }

/* ---------- profile ---------- */

.profile {
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 2rem;
  border-left: 1px solid var(--rule);
}

.profile-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-top: 0.25rem;
  border-top: 4px solid var(--hue);
}

.profile h2 { margin: 0.6rem 0 0.2rem; font: 600 var(--step-2)/1.2 var(--serif); }
.profile .role { margin: 0; color: var(--graphite); }

.profile h3 {
  margin: 1.6rem 0 0.5rem;
  font: 700 var(--step--1) var(--sans);
  color: var(--graphite);
}

.ask-btn {
  margin-top: 1rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: none;
  font-weight: 500;
  cursor: pointer;
}
.ask-btn:hover { background: var(--ink); color: #fff; }

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tags span {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  font-size: var(--step--1);
}

.profile .tags { margin: 0.5rem 0 0; }
.profile .about { margin: 1rem 0 0; font: var(--step-0)/1.55 var(--serif); }

/* a position: what they hold, why, and the passage it rests on */
.stands { margin: 0; }
.stands dt { font-weight: 500; }
.stands dd { margin: 0 0 0.9rem; font-size: var(--step--1); }
.stands dd strong { display: block; font-weight: 500; color: var(--cobalt); }
.stands dd strong + small { color: var(--graphite); }
.stands dd span { display: block; color: var(--graphite); }
.stands .stance { display: inline-block; padding-left: 0.6rem; border-left: 3px solid var(--rule); color: var(--ink); }
.stands .stance.originated, .stands .stance.advocates { border-color: var(--for); }
.stands .stance.criticises { border-color: var(--against); }
.stands .stance.mixed { border-left-style: dashed; border-color: var(--ink); }
.evidence { display: block; margin-top: 0.2rem; color: var(--ink); font: italic var(--step--1)/1.45 var(--serif); text-decoration: none; }
.evidence:hover { color: var(--cobalt); }
.evidence small { margin-left: 0.4rem; font: var(--step--1) var(--sans); color: var(--graphite); }
.relations { list-style: none; margin: 0; padding: 0; font-size: var(--step--1); }
.relations li { margin-bottom: 0.6rem; }
.relations li::first-letter { text-transform: uppercase; }
.link { padding: 0; border: 0; background: none; font-weight: 500; color: var(--cobalt); cursor: pointer; }
.link:hover { text-decoration: underline; }

.claims { margin: 0; padding-left: 1.1rem; font: var(--step-0)/1.55 var(--serif); }
.claims li { margin-bottom: 0.45rem; }

.episodes { list-style: none; margin: 0; padding: 0; }
.episodes li { padding: 0.55rem 0; border-top: 1px solid var(--rule); }
.episodes a { color: var(--ink); text-decoration: none; font-weight: 500; }
.episodes a:hover { color: var(--cobalt); }
.episodes small { display: block; color: var(--graphite); }

.theories dt { font-weight: 500; }
.theories dd { margin: 0 0 0.6rem; color: var(--graphite); font-size: var(--step--1); }

/* ---------- views ---------- */

.views {
  display: flex;
  gap: 2px;
  margin: 0 0 0.9rem;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--sheet);
}
.views a {
  flex: 1;
  padding: 0.25rem 0;
  border-radius: 5px;
  text-align: center;
  text-decoration: none;
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--graphite);
}
.views a:hover { color: var(--ink); }
.views a[aria-current="page"] { background: var(--ink); color: #fff; }

.room[hidden], .explore[hidden] { display: none; }

/* ---------- explore ---------- */

.explore {
  min-height: 0;
  overflow-y: auto;
  background: var(--sheet);
}
.explore-inner { max-width: 76rem; margin: 0 auto; padding: 1.5rem 2rem 4rem; }

.explore h2 { margin: 0; font: 600 var(--step-3)/1.15 var(--serif); letter-spacing: -0.01em; }
.explore h3 { margin: 2.75rem 0 0.2rem; font: 600 var(--step-2)/1.25 var(--serif); }
.explore h2 + p, .explore h3 + p { margin: 0.3rem 0 1rem; max-width: 68ch; font-size: var(--step--1); }

.filters {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-size: var(--step--1);
}
.filters label { font-weight: 500; }
.filters select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: inherit;
}
.filters p { flex: 1 1 20rem; margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.75rem; margin: 1.25rem 0 0; }
.tile { padding: 0.7rem 0.9rem; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
.tile dt { font-size: var(--step--1); color: var(--graphite); }
.tile dd { margin: 0; font: 600 var(--step-3)/1.2 var(--sans); }

/* the questionnaire: a card per question, a bar per answer */
.questions { display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.question { padding: 0.9rem 1rem; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
.question h4 { margin: 0; font: 600 var(--step-1)/1.25 var(--serif); }
.question p { margin: 0.2rem 0 0.6rem; font-size: var(--step--1); }
.question .note { margin: 0.5rem 0 0; }
.question .chips { margin-top: 0.6rem; }
.answers { list-style: none; margin: 0; padding: 0; }
.answers button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2rem;
  gap: 0.15rem 0.5rem;
  align-items: center;
  width: 100%;
  padding: 0.3rem 0.4rem;
  border: 0;
  border-radius: 5px;
  background: none;
  text-align: left;
  font-size: var(--step--1);
  cursor: pointer;
}
.answers button:hover:enabled { background: var(--paper); }
.answers button[aria-pressed="true"] { background: var(--cobalt-soft); }
.answers button:disabled { color: var(--graphite); cursor: default; }
.answers .label { grid-column: 1 / -1; line-height: 1.3; }
.answers .bar-mark { width: calc(var(--w) * 100%); height: 8px; }
.answers .aside .bar-mark { background: var(--graphite); }
.answers .bar-val { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* topic areas: a bar per area, then a heat cell per year */
.area-table { width: 100%; border-spacing: 2px; font-size: var(--step--1); }
.area-table caption { caption-side: top; text-align: right; color: var(--graphite); padding-bottom: 0.2rem; }
.area-table thead th { font-weight: 500; color: var(--graphite); text-align: left; padding: 0 0.3rem 0.2rem; }
.area-table thead th.year { text-align: center; }
.area-table tbody th { width: 15rem; padding: 0; text-align: left; font-weight: 400; }
.area-table tbody th button {
  width: 100%;
  padding: 0.15rem 0.4rem;
  border: 0;
  border-radius: 4px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.area-table tbody th button:hover { background: var(--paper); }
.area-table tr[aria-selected="true"] th button { background: var(--ink); color: #fff; font-weight: 500; }

.area-table .bar { padding: 0 0.6rem 0 0.3rem; white-space: nowrap; }
.bar-mark {
  display: inline-block;
  vertical-align: middle;
  width: calc(var(--w) * (100% - 2.5rem));
  min-width: 2px;
  height: 10px;
  border-radius: 0 4px 4px 0;
  background: var(--cobalt);
}
.bar-val { margin-left: 0.4rem; font-variant-numeric: tabular-nums; }
.area-table tbody tr:hover .bar-mark { background: var(--ink); }

.area-table .heat {
  width: 3.4rem;
  padding: 0.15rem 0;
  border-radius: 3px;
  background: color-mix(in oklab, var(--cobalt) calc(var(--v) * 100%), var(--paper));
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.area-table .heat.deep { color: #fff; }
.area-table .heat:hover { outline: 2px solid var(--ink); outline-offset: -1px; }

/* theories: the graph beside the ranked list */
.theory-layout { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1.5rem; align-items: start; }

.graph { margin: 0; min-width: 0; }
.graph > div { border: 1px solid var(--rule); border-radius: 8px; background: #fff; overflow: hidden; }
.graph > div > p { margin: 0; padding: 2rem; }
.graph svg { display: block; }
.graph figcaption { display: flex; flex-wrap: wrap; gap: 0.2rem 1.25rem; margin-top: 0.5rem; font-size: var(--step--1); color: var(--graphite); }
.key { display: inline-block; width: 10px; height: 10px; margin-right: 0.4rem; }
.key-theory { border-radius: 50%; background: var(--cobalt); }
.key-guest { border-radius: 2px; background: var(--ink); }

.edge { stroke: var(--graphite); opacity: 0.22; }
/* what the guest makes of the theory: for and against as opposite hues, in part dashed */
.edge.for { stroke: var(--for); opacity: 0.75; }
.edge.against { stroke: var(--against); opacity: 0.75; }
.edge.mixed { stroke: var(--ink); opacity: 0.6; stroke-dasharray: 4 3; }
.key-for, .key-against, .key-mixed, .key-none { width: 16px; height: 0; vertical-align: middle; border-top: 3px solid var(--rule); }
.key-for { border-color: var(--for); }
.key-against { border-color: var(--against); }
.key-mixed { border-top: 3px dashed var(--ink); }
.node { cursor: pointer; outline: none; }
.node .hit { fill: transparent; }
.node circle { fill: var(--cobalt); stroke: #fff; stroke-width: 2; }
.node .mark { fill: var(--ink); stroke: #fff; stroke-width: 2; }
.node text { font: 500 11px var(--sans); fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.node.guest text { font-weight: 400; fill: var(--graphite); }
.node.selected circle, .node:focus-visible circle, .node:focus-visible .mark { stroke: var(--ink); }
svg.focus .node:not(.on) { opacity: 0.18; }
svg.focus .edge:not(.on) { opacity: 0.05; }
svg.focus .edge.on { opacity: 0.9; }
svg.focus .edge.none.on { stroke: var(--ink); opacity: 0.55; }
svg.focus .node.guest.on text { fill: var(--ink); }

.theory-side { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
#theory-filter { width: 100%; padding: 0.45rem 0.7rem; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }

.theory-list { list-style: none; margin: 0; padding: 0; max-height: 44rem; overflow-y: auto; }
.theory-list button {
  display: block;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 0;
  border-radius: 5px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.theory-list button:hover { background: var(--paper); }
.theory-list button[aria-pressed="true"] { background: var(--cobalt-soft); }
.theory-list .name { display: block; font-weight: 500; }
.theory-list small { color: var(--graphite); }
.theory-list .more { color: var(--cobalt); font-size: var(--step--1); }

.theory-detail { padding: 0.9rem 1rem; border: 1px solid var(--rule); border-top: 4px solid var(--cobalt); border-radius: 8px; background: #fff; }
.detail-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.theory-detail h4 { margin: 0; font: 600 var(--step-1)/1.25 var(--serif); }
.theory-detail h5 { margin: 1rem 0 0.4rem; font: 700 var(--step--1) var(--sans); color: var(--graphite); }
.theory-detail p { margin: 0.2rem 0 0; font-size: var(--step--1); }
.theory-detail .episodes { max-height: 16rem; overflow-y: auto; font-size: var(--step--1); }

.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.chips button {
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--sheet);
  font-size: var(--step--1);
  cursor: pointer;
}
.chips button:hover { border-color: var(--ink); }
.chips small { margin-left: 0.3rem; color: var(--graphite); }

.tip {
  position: fixed;
  z-index: 20;
  max-width: 20rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: var(--step--1);
  line-height: 1.4;
  pointer-events: none;
}
.tip[hidden] { display: none; }
.tip strong, .tip span { display: block; }
.tip span { opacity: 0.85; }

/* ---------- small screens ---------- */

.only-mobile { display: none; }

@media (max-width: 1300px) {
  .theory-layout { grid-template-columns: minmax(0, 1fr); }
  .theory-list { max-height: 24rem; }
}

@media (max-width: 1100px) {
  .app, .app:has(.profile[hidden]) { grid-template-columns: 15rem minmax(0, 1fr); }
  .profile:not([hidden]) {
    position: fixed; inset: 0 0 0 auto; width: min(24rem, 92vw);
    background: var(--paper); box-shadow: -12px 0 32px rgb(23 32 43 / 0.15); z-index: 10;
  }
}

@media (max-width: 720px) {
  .app, .app:has(.profile[hidden]) { grid-template-columns: minmax(0, 1fr); }
  .only-mobile { display: inline-block; }
  .roster {
    position: fixed; inset: 0 auto 0 0; width: min(20rem, 88vw); z-index: 10;
    background: var(--paper); box-shadow: 12px 0 32px rgb(23 32 43 / 0.15);
    transform: translateX(-105%); transition: transform 0.2s ease;
  }
  .roster.open { transform: none; }
  .room-hint { font-size: 0.75rem; }
  .explore-inner { padding: 1rem 1rem 3rem; }
  .area-table tbody th { width: auto; }
  .area-table .bar { padding: 0 0.3rem; }
  .area-table .bar-mark { display: none; }
  .area-table .bar-val { margin: 0; }
  .area-table .heat { width: 2rem; }
  .messages { padding: 1rem; }
  .composer, .reply-bar { width: calc(100% - 2rem); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- LLM answers ---------- */

.answer p { margin: 0 0 0.8rem; font: 400 var(--step-1)/1.65 var(--serif); max-width: 68ch; }
.answer p.pending { color: var(--graphite); font-style: italic; }
.answer sup { line-height: 0; margin-left: 1px; }
.answer sup a {
  font: 500 0.7rem var(--sans);
  color: var(--cobalt);
  text-decoration: none;
  padding: 0 0.15em;
  border-radius: 3px;
}
.answer sup a:hover { background: var(--cobalt-soft); }

.sources { margin-top: 0.2rem; }
.sources summary {
  cursor: pointer;
  width: fit-content;
  font-size: var(--step--1);
  color: var(--graphite);
}
.sources summary:hover { color: var(--ink); }
.sources[open] summary { margin-bottom: 0.8rem; }
.sources .passage blockquote { font-size: var(--step-0); }
.source .ref {
  font-weight: 700;
  color: var(--ink);
}

/* ---------- guest photos ---------- */

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  border: 2px solid var(--hue, var(--graphite));
  border-radius: 50%;
  object-fit: cover;
  background: var(--hue, var(--graphite));
  color: #fff;
  font: 500 0.7rem/1 var(--sans);
}

.guest-list button { grid-template-columns: 2.1rem 1fr auto; align-items: center; }
.guest-list .avatar { grid-row: span 2; }
.guest-list .name { align-self: end; }
.guest-list .area { align-self: start; }

.speaker { align-items: center; }
.speaker .avatar { width: 1.9rem; height: 1.9rem; margin-left: -0.15rem; }

.mention-menu li::before { content: none; }
.mention-menu .avatar { width: 1.6rem; height: 1.6rem; font-size: 0.6rem; }

.profile .avatar { display: grid; width: 6rem; height: 6rem; margin-top: 0.9rem; border-width: 3px; font-size: 1.6rem; }

.chips button { display: inline-flex; align-items: center; gap: 0.3rem; }
.chips .avatar { width: 1.3rem; height: 1.3rem; margin-left: -0.35rem; border-width: 1px; font-size: 0.5rem; }
.chips small { margin-left: 0; }

.node image { clip-path: circle(50%); }
.node .ring { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.node:focus-visible .ring { stroke: var(--cobalt); stroke-width: 3; }
.key-guest { border-radius: 50%; }
