/* Stats tab */
/* the Stats tab (state of the market, the core's app/core/src/jobs/stats.rs): headline numbers, then tables per book */
#statsView {
  display: grid;
  gap: var(--s6);
  padding-block: var(--s4) 56px;
  font-variant-numeric: tabular-nums;
}
#statsView h1 {
  margin: 0;
  font: 700 var(--t-2xl)/1.05 var(--display);
  letter-spacing: 0.02em;
  text-wrap: balance;
}
#statsView .lede {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 70ch;
}
#statsView h2 {
  margin: 0 0 var(--s3);
  font: 700 var(--t-lg)/1 var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
#statsView .sub {
  margin: -4px 0 var(--s3);
  font-size: var(--t-sm);
  color: var(--muted);
  max-width: 80ch;
}
#statsView .tabs {
  display: flex;
  gap: var(--s1);
  margin-top: var(--s4);
  border-bottom: 1px solid var(--line);
}
#statsView .tabs button {
  border: 0;
  background: none;
  padding: var(--s3) var(--s4) 13px;
  cursor: pointer;
  font: 500 var(--t-lg)/1 var(--body);
  color: var(--muted);
  box-shadow: inset 0 -2px 0 transparent;
}
#statsView .tabs button:hover {
  color: var(--ink);
}
#statsView .tabs button.on {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--ink);
}
#statsView .nums {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s3);
}
#statsView .num {
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}
#statsView .num b {
  display: block;
  font: 700 32px/1 var(--display);
  letter-spacing: 0.01em;
}
#statsView .num small {
  display: block;
  margin-top: 6px;
  font: 500 var(--t-sm)/1.2 var(--body);
  color: var(--muted);
}
:is(#statsView, .bview) .stp {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  box-shadow: var(--panel-shadow);
  overflow-x: auto;
}
:is(#statsView, .bview) table {
  width: 100%;
  border-collapse: collapse;
}
:is(#statsView, .bview) th {
  padding: 10px 12px;
  background: var(--raised);
  border-bottom: 1px solid var(--line);
  font: 600 var(--t-xs)/1.2 var(--body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
:is(#statsView, .bview) th:first-child,
:is(#statsView, .bview) td:first-child {
  text-align: left;
}
:is(#statsView, .bview) td {
  padding: 0 12px;
  height: 44px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}
:is(#statsView, .bview) tr:last-child td {
  border-bottom: 0;
}
:is(#statsView, .bview) td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
}
:is(#statsView, .bview) th:first-child {
  position: sticky;
  left: 0;
}
:is(#statsView, .bview) .sbk {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
:is(#statsView, .bview) .sbk img {
  width: 22px;
  height: 22px;
  border-radius: 5px;
}
:is(#statsView, .bview) .sbk small {
  font: 600 10px/1 var(--body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  border: 1px solid var(--line-strong);
  padding: 3px 4px;
  border-radius: 3px;
}
:is(#statsView, .bview) .dim {
  color: var(--faint);
}
:is(#statsView, .bview) .sbar {
  display: inline-grid;
  gap: 4px;
  justify-items: end;
  min-width: 120px;
}
:is(#statsView, .bview) .sbar i {
  display: block;
  height: 4px;
  width: 120px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--ink) var(--w), var(--sunk) var(--w));
}
#statsView td.sh {
  background: color-mix(in srgb, var(--ink) var(--a, 0%), var(--surface));
}
#statsView .heat td:not(:first-child),
#statsView .cov td:not(:first-child) {
  min-width: 76px;
}
#statsView .heat tr.all td {
  font-weight: 600;
  border-bottom: 1px solid var(--line-strong);
}
#statsView .heat th img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  vertical-align: -4px;
}
#statsView .cov th {
  white-space: normal;
  min-width: 76px;
}
#statsView .two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
}
#statsView .card {
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  display: grid;
  gap: var(--s2);
}
#statsView .card h3 {
  margin: 0 0 4px;
  font: 700 var(--t-lg)/1 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#statsView .kv {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  padding-block: 6px;
  border-bottom: 1px solid var(--line);
}
#statsView .kv b {
  font-weight: 600;
}
#statsView .kv:last-of-type {
  border-bottom: 0;
}
#statsView .pairs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
#statsView .pairs span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: var(--t-sm);
}
#statsView .pairs img {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
#statsView .pairs em {
  font-style: normal;
  color: var(--muted);
  margin-left: 2px;
}
#statsView .trend svg {
  display: block;
  width: 100%;
  height: 120px;
}
#statsView .trend .ax {
  font: 500 var(--t-xs)/1 var(--body);
  fill: var(--faint);
}
#statsView .empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
}
@media (max-width: 640px) {
  #statsView .nums,
  #statsView .two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #statsView .two {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Books (a game's tab, tabs-books.js): its tables stacked */
.bview {
  display: grid;
  gap: 16px;
}
