* { box-sizing: border-box; }
body {
  margin: 0; padding: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  background: #fafaf7; color: #222;
  font-size: 15px; line-height: 1.4;
}
.page { max-width: 760px; margin: 0 auto; padding: 24px 18px 80px; }
.topnav {
  margin-bottom: 18px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.topnav a { color: #555; text-decoration: none; font-size: 14px; }
.topnav a:hover { color: #111; }
.toggle { display: flex; align-items: center; gap: 6px; }
.toggle-label { font-size: 12px; color: #777; margin-right: 4px; }
.toggle-btn {
  font: inherit; font-size: 12px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid #ccc; background: white; color: #555;
  cursor: pointer;
}
.toggle-btn:hover { color: #111; border-color: #888; }
.toggle-btn.active {
  background: #222; color: white; border-color: #222;
}

.index-head h1 { margin: 0 0 6px; font-size: 26px; }
.index-head .meta { color: #666; margin: 0 0 18px; }
.version-list { list-style: none; padding: 0; margin: 24px 0; }
.version-list li { margin: 8px 0; }
.version-list a {
  display: block; padding: 14px 18px; border: 1px solid #ddd;
  border-radius: 8px; background: white; color: #222;
  text-decoration: none; font-size: 15px;
}
.version-list a:hover { border-color: #888; background: #fafaf7; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.mini-card {
  display: block; padding: 12px 14px; border: 1px solid #ddd;
  border-radius: 8px; background: white; text-decoration: none; color: #222;
  transition: transform .08s ease, border-color .08s ease;
}
.mini-card:hover { transform: translateY(-1px); border-color: #888; }
.mini-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.mini-meta { color: #777; font-size: 12px; }
.mini-top { color: #7e3f8f; font-size: 12px; margin-top: 4px; }
.mini-chips {
  display: flex; gap: 4px; margin-top: 6px;
  font-size: 16px; line-height: 1;
}
.chip {
  position: relative; display: inline-block; cursor: help;
}
/* CSS-only tooltip that pops up instantly on hover */
.chip:hover::after {
  content: attr(title);
  position: absolute; bottom: 130%; left: 50%;
  transform: translateX(-50%);
  background: #222; color: #fff;
  padding: 3px 7px; border-radius: 4px;
  font-size: 11px; white-space: nowrap;
  pointer-events: none; z-index: 100;
}
.chip:hover::before {
  content: ""; position: absolute; bottom: 118%; left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: #222;
  pointer-events: none; z-index: 100;
}

/* Emoji legend body */
.legend-body { padding: 4px 14px 14px; }
.legend-section { margin: 14px 0; }
.legend-section:first-child { margin-top: 6px; }
.legend-header {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600; margin: 0 0 6px;
}
.legend-rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 16px;
}
.legend-row {
  display: grid; grid-template-columns: 24px 1fr;
  align-items: baseline; gap: 6px;
  font-size: 12.5px; padding: 2px 0;
}
.legend-emoji { font-size: 16px; line-height: 1; }
.legend-label { color: #333; }
.legend-key {
  display: none;  /* dim key hidden by default; reveal on hover of row */
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px; color: #888;
}
.legend-row:hover .legend-key { display: inline; }

.card {
  background: white; border: 1px solid #ddd; border-radius: 10px;
  padding: 26px 30px 24px;
}
.card-head h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -0.01em; }
.card-head .meta { color: #666; font-size: 13px; margin: 0 0 6px; }
.card-head .meta a { color: #555; }
.card-head .meta a:hover { color: #111; }

.block { margin-top: 20px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-col .block { margin-top: 20px; }

.block-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  font-weight: 600; color: #444; margin: 0 0 8px;
  display: flex; align-items: baseline; gap: 8px;
}
.block-title.cause   { color: #7e3f8f; }
.block-title.dist    { color: #117733; }
.block-title.style   { color: #1f77b4; }
.block-title.stance  { color: #d97706; }
.block-title.tone    { color: #d97706; }
.block-title.quality { color: #117733; }
.block-title.post    { color: #1f77b4; }
.block-sub {
  font-size: 10.5px; color: #999; font-weight: 400; text-transform: none;
  letter-spacing: 0;
}

/* horizontal bar rows */
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row {
  display: grid; grid-template-columns: 140px 1fr 56px;
  align-items: center; gap: 10px; font-size: 13px;
}
.bar-label { color: #444; }
.bar-track {
  position: relative; height: 10px; background: #eee; border-radius: 3px;
  overflow: hidden;
}
.bar-fill { position: absolute; top: 0; height: 100%; opacity: 0.85; }
.bar-fill.raw   { left: 0; }
.bar-fill.zfill { display: none; }
.bar-midline {
  position: absolute; top: -2px; bottom: -2px; left: 50%;
  width: 1px; background: #bbb; display: none;
}
.bar-value { font-variant-numeric: tabular-nums; color: #555; font-size: 12px; }

/* raw mode: show raw fill + raw value */
body.mode-raw .bar-fill.raw   { display: block; }
body.mode-raw .bar-fill.zfill { display: none; }
body.mode-raw .bar-midline    { display: none; }
body.mode-raw .v-raw          { display: inline; }
body.mode-raw .v-z            { display: none; }

/* relative mode: hide raw, show z fill + midline + z value */
body.mode-rel .bar-fill.raw   { display: none; }
body.mode-rel .bar-fill.zfill { display: block; }
body.mode-rel .bar-midline    { display: block; }
body.mode-rel .v-raw          { display: none; }
body.mode-rel .v-z            { display: inline; }
/* z bar positioning: pos extends right from center, neg extends left */
.bar-fill.zfill.pos { left: 50%; }
.bar-fill.zfill.neg { right: 50%; }
/* tint negative bars red, positive green */
body.mode-rel .bar-fill.zfill.neg { background: #c33 !important; opacity: 0.75; }
body.mode-rel .bar-fill.zfill.pos { background: #117733 !important; opacity: 0.75; }

/* distinguishing dim rows */
.dims { display: flex; flex-direction: column; gap: 4px; }
.dim-row {
  display: grid; grid-template-columns: 18px 1fr 70px;
  align-items: center; gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.dim-row.pos .arrow, .dim-row.pos .dim-name, .dim-row.pos .dim-z { color: #117733; }
.dim-row.neg .arrow, .dim-row.neg .dim-name, .dim-row.neg .dim-z { color: #c33; }
.dim-z { text-align: right; }

/* stance rows */
.stances { display: flex; flex-direction: column; gap: 4px; }
.stance-row {
  display: grid; grid-template-columns: 1fr 60px 160px;
  align-items: center; gap: 8px;
  font-size: 13px;
}
.stance-name { color: #444; }
.stance-val { font-variant-numeric: tabular-nums; color: #555; }
.stance-dir { color: #777; font-size: 12px; }
.stance-dir.up   { color: #117733; }
.stance-dir.down { color: #c33; }

.neighbors p { margin: 4px 0; font-size: 14px; }
.nb-label { color: #777; font-size: 12px; margin-right: 8px; }

.post-title {
  margin: 4px 0 2px; font-size: 14px; font-weight: 500;
}
.post-title a { color: #1f77b4; text-decoration: none; }
.post-title a:hover { text-decoration: underline; }
.post-meta { color: #888; font-size: 12px; margin: 0 0 6px; }
blockquote {
  margin: 6px 0 0; padding: 8px 12px;
  border-left: 3px solid #ddd; background: #f7f6ee;
  font-size: 13px; color: #444; line-height: 1.45;
  font-style: italic;
}

/* methodology + rubric */
.card-divider {
  border: none; border-top: 1px solid #eee; margin: 28px 0 0;
}
.methodology p {
  font-size: 13px; color: #444; line-height: 1.55; margin: 6px 0;
}
.methodology .meta-fineprint {
  color: #888; font-size: 12px;
}
.rubric {
  margin-top: 18px; border: 1px solid #eee; border-radius: 6px;
  background: #fafaf7;
}
.top-detail { margin: 8px 0 0; }
/* Two adjacent dropdowns: no gap between, share a border edge */
.top-detail + .top-detail {
  margin-top: 0;
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.top-detail:has(+ .top-detail) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.top-detail > summary {
  padding: 12px 14px;
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.top-detail .summary-label {
  font-weight: 600; font-size: 13px; color: #222;
}
.top-detail .summary-teaser {
  font-size: 12.5px; color: #666; font-weight: 400;
}
.top-detail[open] > summary { border-bottom: 1px solid #eee; }
/* match the inter-card gap (.grid uses gap: 12px) */
.grid { margin-top: 12px; }
.rubric > summary {
  cursor: pointer; padding: 10px 14px; font-size: 13px; color: #444;
  font-weight: 500; list-style: none;
  user-select: none;
}
.rubric > summary::-webkit-details-marker { display: none; }
.rubric > summary::before {
  content: "▸ "; color: #888; margin-right: 4px;
  transition: transform .12s ease;
  display: inline-block;
}
.rubric[open] > summary::before { content: "▾ "; }
.rubric > summary:hover { color: #111; }
.rubric-hint { color: #aaa; font-weight: 400; font-size: 11px; }
.rubric-body {
  padding: 4px 14px 14px;
  border-top: 1px solid #eee;
}
.rubric-section { margin: 12px 0; }
.rubric-header {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  color: #555; font-weight: 600; margin: 0 0 6px;
}
.rubric-sub {
  text-transform: none; letter-spacing: 0;
  color: #888; font-weight: 400; font-size: 11.5px;
}
.rubric-row {
  display: grid; grid-template-columns: 200px 1fr;
  gap: 12px; padding: 2px 0;
  font-size: 12px; line-height: 1.45;
}
.rubric-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #555; font-size: 11.5px;
}
.rubric-desc { color: #444; }

/* "show more" details inside a block */
.more-block { margin-top: 8px; }
.more-block > summary {
  cursor: pointer; list-style: none; user-select: none;
  font-size: 11.5px; color: #777; padding: 4px 0;
  border-top: 1px dashed #e3e3e3;
  width: 100%;
}
.more-block > summary::-webkit-details-marker { display: none; }
.more-block > summary::before {
  content: "▸ "; color: #aaa; margin-right: 2px;
}
.more-block[open] > summary::before { content: "▾ "; }
.more-block > summary:hover { color: #222; }
.more-block .more-bars { margin-top: 6px; }

/* rubric concise/raw toggle */
.rubric-mode-toggle {
  display: flex; align-items: center; gap: 6px; margin: 4px 0 14px;
  flex-wrap: wrap;
}
.rubric-toggle-btn {
  font: inherit; font-size: 11.5px;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid #ccc; background: white; color: #555;
  cursor: pointer;
}
.rubric-toggle-btn:hover { color: #111; border-color: #888; }
.rubric-toggle-btn.active {
  background: #222; color: white; border-color: #222;
}

/* raw prompt pre block */
.raw-prompt-block .rubric-header { margin-top: 14px; }
.raw-prompt-block .rubric-header:first-child { margin-top: 0; }
.prompt-pre {
  background: white; border: 1px solid #ddd; border-radius: 4px;
  padding: 10px 12px; margin: 6px 0 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; color: #222; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  overflow-x: auto;
}
