:root {
  color-scheme: dark;
  --bg: #0c1a20;
  --panel: #12262c;
  --line: #2c4a4c;
  --text: #dce8e3;
  --muted: #93aaa4;
  --accent: #79ddbb;
  /* Charts: gridlines one step off the panel, and a neutral for marks with no ideology. */
  --grid: #223d42;
  --neutral: #7d8f8b;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 0 16px 48px;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.5 system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
}
header,
main {
  max-width: 900px;
  margin: 0 auto;
}
header {
  padding: 20px 0 4px;
}
header a {
  color: var(--muted);
  text-decoration: none;
}
h1 {
  margin: 4px 0 0;
  font-size: 24px;
}
h2 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #a8e5c7;
}
section {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
#state {
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
.scroll {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
th,
td {
  padding: 7px 12px 7px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
thead th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
tbody th {
  font-weight: 500;
}
td b {
  font-size: 15px;
}
td small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
tr.total th,
tr.total td {
  border-top: 2px solid var(--line);
  border-bottom: 0;
}
/* Version and kind of match: one row above everything they filter. */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 14px;
}
.filters select {
  margin-left: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips input {
  position: absolute;
  opacity: 0;
}
.chips span {
  display: block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.chips input:checked + span {
  border-color: var(--accent);
  background: #1d3f3b;
  color: #fff;
}
.chips input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* The colour key of a chart: marks carry the colour, the names stay in text colour. */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
#when .legend i,
#results .legend i {
  border-radius: 50%;
}
/* The kinds of win in the time chart: a circle for a solo win, a triangle for a coalition
   win, and a line one standard deviation to either side. The key shows them in neutral. */
.legend .mark,
.legend .whisker {
  background: var(--neutral);
}
#when .legend .mark.coalition,
#results .mark.coalition,
.lanes .mark.coalition {
  width: 12px;
  height: 11px;
  border-radius: 0;
  box-shadow: none;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
#when .legend .whisker {
  width: 18px;
  height: 2px;
  border-radius: 1px;
}
/* The win-rate table: an ideology's rate in its colour in the middle of its column, the
   part won alone to its left and the part won in a coalition to its right. */
#table th + th,
#table td {
  padding-right: 20px;
  text-align: center;
}
.rate {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 10px;
}
.rate b {
  font-size: 18px;
}
.rate span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}
.rate span:first-child {
  justify-content: flex-end;
}
.rate span.none {
  opacity: 0.45;
}
.rate i {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
#results .rate .mark.coalition {
  width: 9px;
  height: 8px;
}
/* One row per map: its name, the marks, a figure at the end. */
.chart {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chart li,
.axis {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 12px;
}
.chart li {
  padding: 5px 6px;
  margin: 0 -6px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.chart li:hover,
.chart li:focus-visible {
  background: #17323a;
}
.chart li:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}
.chart li > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* A small picture of the map before its name. */
.chart li > span img,
#table th img {
  margin-right: 8px;
  border-radius: 2px;
  vertical-align: middle;
}
.chart li.all {
  margin-bottom: 6px;
  font-weight: 600;
}
.chart li > b {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
/* A map's wins split by ideology: segments from the left edge, a gap of panel between them. */
.stack {
  display: flex;
  gap: 2px;
  height: 20px;
}
.stack i {
  position: relative;
  flex: 1 1 0;
  min-width: 3px;
}
.stack i:last-child {
  border-radius: 0 4px 4px 0;
}
.stack span {
  position: absolute;
  top: 0;
  left: 6px;
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}
.stack .neutral span {
  color: #0b0b0b;
}
/* Average win time: a dot per ideology, each on its own lane, over hairlines every 15 min. */
.lanes {
  position: relative;
  height: calc(10px + (var(--lanes, 3) - 1) * 9px + 8px);
  border-right: 1px solid var(--grid);
  background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px);
  background-size: var(--step, 25%) 100%;
}
.lanes i {
  position: absolute;
  top: calc(4px + var(--lane, 0) * 9px);
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--panel);
}
.chart li:hover .lanes i,
.chart li:focus-visible .lanes i {
  box-shadow: 0 0 0 2px #17323a;
}
.lanes .mark.coalition {
  margin-left: -6px;
}
.chart li:hover .lanes .mark.coalition,
.chart li:focus-visible .lanes .mark.coalition {
  box-shadow: none;
}
/* One standard deviation to either side of a mark, behind it. */
.lanes u {
  position: absolute;
  top: calc(8px + var(--lane, 0) * 9px);
  height: 2px;
  border-radius: 1px;
  opacity: 0.55;
}
.axis {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.axis div {
  position: relative;
  height: 16px;
}
.axis div span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}
.axis div span:first-child {
  transform: none;
}
.axis div span:last-child {
  transform: translateX(-100%);
}
/* The time chart has no figure at the end of a row: the dots sit on the axis. */
#when .chart li,
#when .axis {
  grid-template-columns: 164px minmax(0, 1fr);
}
#victory-chart {
  margin-bottom: 14px;
}
/* A share with its bar, in a table cell. */
.meter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
}
.meter > div {
  flex: 1 1 48px;
  min-width: 48px;
  max-width: 180px;
  height: 8px;
  border-radius: 4px;
  background: var(--grid);
}
.meter i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--neutral);
}
.meter b {
  font-size: 14px;
  font-weight: 600;
}
/* The readout of a chart row: every ideology's figure, value first. */
.tip {
  position: fixed;
  z-index: 10;
  max-width: calc(100vw - 16px);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b171c;
  box-shadow: 0 6px 18px rgb(0 0 0 / 45%);
  font-size: 12px;
  pointer-events: none;
}
.tip strong {
  display: block;
  margin-bottom: 4px;
}
.tip div {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.tip i {
  width: 10px;
  height: 3px;
  border-radius: 2px;
}
.tip b {
  min-width: 36px;
  font-variant-numeric: tabular-nums;
}
.tip span {
  color: var(--muted);
}
@media (max-width: 520px) {
  .chart li,
  .axis {
    grid-template-columns: 124px minmax(0, 1fr) 52px;
    gap: 8px;
  }
  #when .chart li,
  #when .axis {
    grid-template-columns: 124px minmax(0, 1fr);
  }
}
#ships {
  margin-top: 16px;
}
#totals th[scope='row'] {
  font-weight: 500;
}
