/* Agent Cheat Index: one stylesheet, light and dark through CSS variables. No external resources. */

:root {
  color-scheme: light dark;
  --bg: #fcfcfb;
  --surface: #ffffff;
  --surface-2: #f3f2ef;
  --text: #0b0b0b;
  --text-2: #3f3e3b;
  --muted: #5f5e5a;
  --line: #e1dfda;
  --link: #1b5fb4;
  --focus: #1b5fb4;
  --bar: #2a78d6;
  --bar-soft: rgba(42, 120, 214, 0.35);
  --track: #d4d2cc;
  --add-bg: #e3f4e6;
  --del-bg: #fde8e6;
  --o-tampered-bg: #fde4e1;
  --o-tampered-fg: #8a1c13;
  --o-disclosed-bg: #fdecd0;
  --o-disclosed-fg: #6f4300;
  --o-false-bg: #ece6fb;
  --o-false-fg: #47299a;
  --o-honest-bg: #e0edfb;
  --o-honest-fg: #12497f;
  --o-solved-bg: #dff2e3;
  --o-solved-fg: #0d5a1d;
  --o-unsolved-bg: #ebeae6;
  --o-unsolved-fg: #43423f;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --surface: #1d1d1c;
    --surface-2: #262625;
    --text: #f0efec;
    --text-2: #d3d2cb;
    --muted: #a9a8a0;
    --line: #36352f;
    --link: #7db4f2;
    --focus: #7db4f2;
    --bar: #3987e5;
    --bar-soft: rgba(57, 135, 229, 0.55);
    --track: #4a4943;
    --add-bg: #17331d;
    --del-bg: #3d1c19;
    --o-tampered-bg: #4a1e1a;
    --o-tampered-fg: #ffb9b0;
    --o-disclosed-bg: #473412;
    --o-disclosed-fg: #ffd68a;
    --o-false-bg: #33285a;
    --o-false-fg: #d0c3ff;
    --o-honest-bg: #183759;
    --o-honest-fg: #b0d2f8;
    --o-solved-bg: #173b21;
    --o-solved-fg: #a3dfae;
    --o-unsolved-bg: #2d2d2b;
    --o-unsolved-fg: #c9c8c0;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 var(--sans);
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--surface);
  z-index: 10;
}

.skip:focus {
  left: 0;
}

.wrap {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* header and footer */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  color: var(--text);
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.9375rem;
}

.site-header nav a {
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  text-decoration: underline;
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  padding-bottom: 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

/* text */

main {
  padding-top: 1.5rem;
}

h1 {
  margin: 0.5rem 0 0.75rem;
  font-size: 2rem;
  line-height: 1.2;
}

h1 code {
  font-size: 0.72em;
  font-weight: 500;
}

h2 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.375rem;
  line-height: 1.3;
}

h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.125rem;
  line-height: 1.35;
}

h4 {
  margin: 1rem 0 0.35rem;
  font-size: 0.9375rem;
}

p,
ul,
ol,
dl {
  margin: 0.75rem 0;
}

.lead {
  max-width: 46rem;
  font-size: 1.125rem;
  color: var(--text-2);
}

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

.small {
  font-size: 0.875rem;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  padding: 0.05em 0.3em;
  border-radius: 4px;
  background: var(--surface-2);
  overflow-wrap: anywhere;
}

pre {
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  font: 0.8125rem/1.5 var(--mono);
  tab-size: 4;
}

pre code {
  padding: 0;
  background: none;
  font-size: inherit;
  overflow-wrap: normal;
}

pre .l {
  display: block;
}

pre .add {
  background: var(--add-bg);
}

pre .del {
  background: var(--del-bg);
}

pre .hunk {
  color: var(--muted);
}

blockquote {
  margin: 0.75rem 0;
  padding: 0.1rem 1rem;
  border-left: 3px solid var(--line);
  color: var(--text-2);
}

blockquote p {
  margin: 0.5rem 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

details {
  margin: 1rem 0;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

.legend-box dl {
  max-width: 46rem;
  margin: 0.5rem 0;
}

.legend-box dt {
  margin-top: 0.6rem;
  font-weight: 600;
}

.legend-box dd {
  margin: 0.1rem 0 0;
  color: var(--text-2);
}

.prose {
  max-width: 46rem;
}

.prose h1 {
  margin-bottom: 1rem;
}

.prose li {
  margin: 0.25rem 0;
}

/* tables */

.table-wrap.fit {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}

.table-wrap {
  margin: 0.75rem 0 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

th,
td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

thead th {
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  vertical-align: bottom;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td,
tbody tr:hover th {
  background: var(--surface-2);
}

.leaderboard th,
.leaderboard td {
  white-space: nowrap;
  vertical-align: middle;
}

.leaderboard thead th {
  white-space: normal;
}

.leaderboard td.free {
  white-space: normal;
  min-width: 13rem;
}

.nb {
  white-space: nowrap;
}

.num,
td.r,
th.r {
  text-align: right;
}

td.c,
th.c {
  text-align: center;
}

table.sortable th button {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}

table.sortable th button::after {
  content: "\00a0\2195";
  color: var(--muted);
  opacity: 0.6;
  font-size: 0.8em;
}

table.sortable th[aria-sort="ascending"] button::after {
  content: "\00a0\25B2";
  opacity: 1;
}

table.sortable th[aria-sort="descending"] button::after {
  content: "\00a0\25BC";
  opacity: 1;
}

.agent a {
  font-weight: 600;
}

.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.rank {
  font-weight: 700;
}

/* ACI interval mark: the point and its 95% interval on one shared scale */

.iv {
  position: relative;
  display: inline-block;
  width: 6rem;
  height: 0.5rem;
  margin-right: 0.6rem;
  background: linear-gradient(var(--track), var(--track)) center / 100% 3px no-repeat;
  vertical-align: middle;
}

.iv::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--lo) * 1%);
  width: calc((var(--hi) - var(--lo)) * 1%);
  min-width: 2px;
  border-radius: 4px;
  background: var(--bar-soft);
}

.iv::after {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(var(--p) * 1%);
  width: 0.625rem;
  height: 0.625rem;
  margin: -0.3125rem 0 0 -0.3125rem;
  border-radius: 50%;
  background: var(--bar);
  box-shadow: 0 0 0 2px var(--surface);
}

.aci-val {
  display: inline-block;
  min-width: 8.5em;
  font-weight: 600;
  text-align: right;
}

/* outcome labels */

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 0.65rem;
  background: var(--b-bg, var(--o-unsolved-bg));
  color: var(--b-fg, var(--o-unsolved-fg));
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.o-tampered {
  --b-bg: var(--o-tampered-bg);
  --b-fg: var(--o-tampered-fg);
}

.o-disclosed {
  --b-bg: var(--o-disclosed-bg);
  --b-fg: var(--o-disclosed-fg);
}

.o-false {
  --b-bg: var(--o-false-bg);
  --b-fg: var(--o-false-fg);
}

.o-honest {
  --b-bg: var(--o-honest-bg);
  --b-fg: var(--o-honest-fg);
}

.o-solved {
  --b-bg: var(--o-solved-bg);
  --b-fg: var(--o-solved-fg);
}

.o-errored {
  --b-bg: transparent;
  --b-fg: var(--muted);
  border: 1px dashed var(--muted);
}

.grid {
  width: auto;
  min-width: 22rem;
}

.grid th[scope="row"] {
  font-weight: 400;
}

table code {
  overflow-wrap: normal;
}

.grid .fam th {
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
}

.grid td {
  min-width: 8.5rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  margin: 0.5rem 0 1rem;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
}

/* facts on a configuration page */

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1.25rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.9375rem;
}

.facts dt {
  color: var(--muted);
}

.facts dt:first-child {
  margin-top: 0;
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.cell-n {
  display: block;
  font-weight: 600;
}

.cell-ci {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.detectors {
  padding-left: 1.25rem;
}

/* evidence cards */

.card {
  margin: 1rem 0;
  padding: 0.5rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.card h3 {
  margin-top: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.card .kind {
  margin: 0.75rem 0 0;
}

.card .ev {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.875rem;
}

.card .result {
  margin: 0.5rem 0 0;
}

.notice {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--bar);
  border-radius: 8px;
  background: var(--surface);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding: 0;
  list-style: none;
}

/* phones */

@media (max-width: 40rem) {
  .grid td {
    min-width: 0;
  }

  .grid .badge {
    white-space: normal;
  }

  h1 {
    font-size: 1.625rem;
  }

  .lead {
    font-size: 1.0625rem;
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .facts dt {
    margin-top: 0.6rem;
    font-size: 0.8125rem;
  }
}

/* wide screens: keep the rank and agent columns in view while the table scrolls sideways */

@media (min-width: 48rem) {
  .leaderboard th:nth-child(1),
  .leaderboard td:nth-child(1),
  .leaderboard th:nth-child(2),
  .leaderboard td:nth-child(2) {
    position: sticky;
    z-index: 1;
    background: var(--surface);
  }

  .leaderboard th:nth-child(1),
  .leaderboard td:nth-child(1) {
    left: 0;
    min-width: 4.5rem;
  }

  .leaderboard th:nth-child(2),
  .leaderboard td:nth-child(2) {
    left: 4.5rem;
    box-shadow: 1px 0 0 var(--line);
  }

  .leaderboard thead th:nth-child(1),
  .leaderboard thead th:nth-child(2) {
    background: var(--surface-2);
  }

  .leaderboard tbody tr:hover td:nth-child(1),
  .leaderboard tbody tr:hover td:nth-child(2) {
    background: var(--surface-2);
  }
}

@media print {
  .site-header nav,
  .skip {
    display: none;
  }

  .table-wrap {
    overflow: visible;
  }
}
