* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
}

a {
  color: inherit;
}

.lb-main,
.lb-footer {
  max-width: 960px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.lb-main {
  padding-top: 48px;
  padding-bottom: 48px;
}

.lb-main h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lb-lead {
  margin: 0 0 32px;
  max-width: 70ch;
  color: var(--muted);
}

.lb-table-wrap {
  overflow-x: auto;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.lb-table th,
.lb-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.lb-table th {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.lb-table .num {
  text-align: right;
}

.lb-table td:first-child,
.lb-table th:first-child {
  width: 1%;
  color: var(--muted);
}

.lb-table tbody tr:hover {
  background: var(--row-hover);
}

.lb-table td.user {
  color: var(--muted);
}


.lb-table th button {
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.lb-table th button:hover,
.lb-table th button[aria-pressed="true"] {
  color: var(--fg);
}

.lb-table th button[aria-pressed="true"]::after {
  content: " ↓";
}

.lb-tag {
  margin-left: 8px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
}

.lb-notes {
  margin: 28px 0 0;
  padding-left: 18px;
  max-width: 80ch;
  font-size: 12px;
  color: var(--muted);
}

.lb-notes li {
  margin-bottom: 6px;
}

.lb-notes b {
  color: var(--fg);
  font-weight: 500;
}

.lb-footer {
  padding-top: 20px;
  padding-bottom: 32px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.lb-footer a {
  text-decoration: none;
}

.lb-footer a:hover {
  color: var(--fg);
}

.lb-score {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.lb-bar {
  display: block;
  width: 96px;
  height: 8px;
  background: var(--track);
  border-radius: 2px;
  overflow: hidden;
}

.lb-bar span {
  display: block;
  height: 100%;
  background: var(--bar);
  border-radius: 2px;
}

.lb-val {
  min-width: 4ch;
  text-align: right;
}

@media (max-width: 720px) {
  .lb-bar {
    width: 64px;
  }
}

.lb-meta {
  margin: -20px 0 28px;
  font-size: 12px;
  color: var(--muted);
}

/* Centre rank and score columns */
.lb-table .num,
.lb-table td:first-child,
.lb-table th:first-child {
  text-align: center;
}

.lb-score {
  justify-content: center;
}

.lb-val.sorted,
.lb-top td:first-child {
  font-weight: 700;
  color: var(--fg);
}

.lb-table td.user {
  font-size: 12px;
}

@media (max-width: 720px) {
  .col-user {
    display: none;
  }
}

/* Phones: numbers only, names may wrap */
@media (max-width: 560px) {
  .lb-table .lb-bar {
    display: none;
  }

  .lb-table {
    font-size: 13px;
  }

  .lb-table th,
  .lb-table td {
    padding: 10px 6px;
  }

  .lb-table td {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .lb-table th {
    font-size: 11px;
    letter-spacing: 0.02em;
  }

  .lb-table th button[aria-pressed="true"]::after {
    content: "↓";
  }
}

/* ---- Shared-scale performance column ---- */
.lb-legend {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}

.lb-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lb-key {
  display: inline-block;
  width: 14px;
  height: 10px;
  border-radius: 2px;
}

.lb-key-p3 {
  background: var(--bar);
}

.lb-key-p1 {
  background: var(--bar);
  opacity: 0.3;
}

.lb-table th.col-perf,
.lb-table td.col-perf {
  width: 42%;
  min-width: 240px;
}

.lb-axis {
  position: relative;
  height: 14px;
  font-size: 10px;
  letter-spacing: 0;
}

.lb-axis span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}

.lb-axis span:nth-child(1) { left: 0; transform: none; }
.lb-axis span:nth-child(2) { left: 25%; }
.lb-axis span:nth-child(3) { left: 50%; }
.lb-axis span:nth-child(4) { left: 75%; }
.lb-axis span:nth-child(5) { left: 100%; transform: translateX(-100%); }

.lb-track {
  position: relative;
  height: 14px;
  border-radius: 2px;
  background:
    linear-gradient(to right, transparent calc(25% - 0.5px), var(--line) calc(25% - 0.5px), var(--line) calc(25% + 0.5px), transparent calc(25% + 0.5px)),
    linear-gradient(to right, transparent calc(50% - 0.5px), var(--line) calc(50% - 0.5px), var(--line) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to right, transparent calc(75% - 0.5px), var(--line) calc(75% - 0.5px), var(--line) calc(75% + 0.5px), transparent calc(75% + 0.5px)),
    var(--track);
}

.lb-track span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 2px;
  background: var(--bar);
}

.lb-track .lb-p1 {
  opacity: 0.3;
}

.lb-table td.num.sorted {
  font-weight: 700;
  color: var(--fg);
}

.lb-table td.num {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .lb-table th.col-perf,
  .lb-table td.col-perf {
    min-width: 140px;
  }
}

@media (max-width: 560px) {
  .col-perf,
  .lb-legend {
    display: none;
  }
}

/* Fit all six columns in the 960px layout */
.lb-table th,
.lb-table td {
  padding: 10px 8px;
}

.lb-table th.col-perf,
.lb-table td.col-perf {
  width: 210px;
  min-width: 210px;
}

.lb-table th.num,
.lb-table td.num {
  width: 64px;
}

.lb-table td:first-child,
.lb-table th:first-child {
  width: 48px;
}

/* Company column; bar column narrows to make room */
.lb-table td.company {
  color: var(--muted);
}

.lb-table th.col-perf,
.lb-table td.col-perf {
  width: 180px;
  min-width: 180px;
}

@media (max-width: 900px) {
  .col-company {
    display: none;
  }
}

/* Long agent names wrap so the score columns stay on screen */
.lb-table td:nth-child(2) {
  white-space: normal;
  min-width: 170px;
}

.lb-table .lb-tag {
  white-space: nowrap;
}

/* Narrower screens: the "thinking" tag drops under the name so short names don't break */
@media (max-width: 900px) {
  .lb-table .lb-tag {
    display: table;
    margin: 4px 0 0;
  }
}

/* ---- User-agent switch ---- */
.lb-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.lb-control-label {
  font-size: 12px;
  color: var(--muted);
}

.lb-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--fg);
  border-radius: 4px;
  overflow: hidden;
}

.lb-segmented button {
  font: inherit;
  font-size: 12px;
  padding: 5px 12px;
  color: var(--fg);
  background: none;
  border: 0;
  border-right: 1px solid var(--fg);
  cursor: pointer;
}

.lb-segmented button:last-child {
  border-right: 0;
}

.lb-segmented button[aria-pressed="true"] {
  color: var(--bg);
  background: var(--fg);
}

.lb-controls + .lb-legend {
  margin-top: -36px;
}

@media (max-width: 720px) {
  .lb-controls + .lb-legend {
    margin-top: 0;
  }
}
