/* The Dev stats page (/map?devstats, js/devStats.js): a page of its own, without the game's base.css, so it styles html
   and body itself and scopes the rest under #mapgame-devstats. Its colours, type and sizes are the game's tokens. */

html { background: var(--chrome); }
body { margin: 0; color: var(--ink); font: 400 var(--fs-body)/1.5 var(--font-body); }

#mapgame-devstats {
  max-width: 60rem;
  margin: 0 auto;
  padding: var(--sp-6) var(--gutter) var(--sp-12);
  display: grid;
  gap: var(--sp-4);
}
#mapgame-devstats [hidden] { display: none; }
#mapgame-devstats h1 { margin: 0; font: 700 var(--fs-title)/1 var(--font-display); letter-spacing: 0.01em; text-transform: uppercase; }
#mapgame-devstats h2 { margin: 0; font: 700 var(--fs-subheading)/1.15 var(--font-display); letter-spacing: 0.03em; text-transform: uppercase; }
#mapgame-devstats h3 { margin: 0; font: 600 var(--fs-body)/1.3 var(--font-body); }
#mapgame-devstats p { margin: 0; }
#mapgame-devstats b { font: 600 1em/1 var(--font-data); font-variant-numeric: tabular-nums; }
#mapgame-devstats a { color: var(--ink); }
#mapgame-devstats .ds-head { display: grid; gap: var(--sp-1); }
#mapgame-devstats .ds-meta, #mapgame-devstats .ds-quiet, #mapgame-devstats .ds-links { color: var(--muted); font-size: var(--fs-small); }
#mapgame-devstats .ds-partial { font-size: var(--fs-small); }
#mapgame-devstats .ds-seed { color: var(--muted); font: 500 var(--fs-small)/1 var(--font-data); text-transform: none; letter-spacing: 0; }

/* ---- a part of the page: a card, as the game's popups' quiet panels ---- */

#mapgame-devstats section {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border: var(--border);
  border-radius: var(--r-lg);
  background: var(--paper);
}

/* ---- tables: the scores of each kind, and a map on every version ---- */

#mapgame-devstats .ds-scroll { overflow-x: auto; }
#mapgame-devstats .ds-table { justify-self: start; border-collapse: collapse; font-size: var(--fs-small); }
#mapgame-devstats .ds-table th, #mapgame-devstats .ds-table td { padding: var(--sp-1) var(--sp-4) var(--sp-1) 0; text-align: right; white-space: nowrap; }
#mapgame-devstats .ds-table th[scope="row"] { text-align: left; font-weight: 400; color: var(--muted); }
#mapgame-devstats .ds-table th[scope="col"] { color: var(--muted); font: 600 var(--fs-label)/1.2 var(--font-data); letter-spacing: 0.08em; text-transform: uppercase; }
#mapgame-devstats .ds-table td { font: 600 var(--fs-data)/1.2 var(--font-data); font-variant-numeric: tabular-nums; }
#mapgame-devstats .ds-table tbody tr { border-top: var(--border); }
#mapgame-devstats .ds-table .ds-all th, #mapgame-devstats .ds-table .ds-all td { border-top: 2px solid var(--ink); color: var(--ink); }
/* A day's easy and hard practice maps, counted among the practice maps above them (R108) */
#mapgame-devstats .ds-table .ds-sub th[scope="row"] { padding-left: var(--sp-4); }
#mapgame-devstats .ds-table .ds-sub td { font-weight: 500; color: var(--muted); }

/* ---- where a bonus or practice map came from (R108): found (looked at in the Dev tools) solid, scheduled outlined in
   ink, random and not known quiet ---- */

#mapgame-devstats .ds-origin {
  display: inline-block;
  margin-left: var(--sp-1);
  padding: 2px var(--sp-2);
  border: var(--border);
  border-radius: var(--r-pill);
  color: var(--muted);
  font: 600 var(--fs-label)/1.2 var(--font-data);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 0.1em;
}
#mapgame-devstats .ds-origin.is-found { border-color: var(--ink); background: var(--ink); color: var(--paper); }
#mapgame-devstats .ds-origin.is-scheduled { border-color: var(--ink); color: var(--ink); }
#mapgame-devstats .ds-origin.is-unknown { border-style: dashed; }

/* ---- the days, today first, then all time: each a card of maps, two side by side where there's room ---- */

#mapgame-devstats .ds-days { display: grid; gap: var(--sp-4); }
#mapgame-devstats .ds-maps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: var(--sp-4) var(--sp-6); }

/* ---- a map: its people and its bars (David: the biggest group fills its bar, the rest in proportion) ---- */

#mapgame-devstats .ds-map { display: grid; align-content: start; gap: var(--sp-2); padding-top: var(--sp-3); border-top: var(--border); }
#mapgame-devstats .ds-bars { display: grid; gap: var(--sp-1); margin: var(--sp-1) 0 0; padding: 0; list-style: none; }
#mapgame-devstats .ds-bars li {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) 6.5rem;
  align-items: center;
  gap: var(--sp-3);
  font: 500 var(--fs-small)/1.2 var(--font-data);
  font-variant-numeric: tabular-nums;
}
#mapgame-devstats .ds-bar-label { color: var(--muted); text-align: right; }
#mapgame-devstats .ds-bar { position: relative; height: 0.75rem; border-radius: var(--r-pill); background: var(--line); }
#mapgame-devstats .ds-bar i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--ink); }
/* Where all time puts the group, on the same scale (David, 13/10/2026): a dash across the bar, paper edged in ink, so it
   shows on the ink and on the track without the player's orange or the answer's blue. */
#mapgame-devstats .ds-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 1px;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
}
#mapgame-devstats .ds-bar-count { color: var(--ink); }

/* ---- a map's heatmap under its bars (R120): where everyone guessed, at config.heatmap.thumbnail px (set on the canvas
   by js/devStats.js), a grey square while it's drawn; just its words when there's none ---- */

#mapgame-devstats .ds-heat { display: grid; justify-items: start; gap: var(--sp-1); margin: var(--sp-2) 0 0; }
#mapgame-devstats .ds-heat canvas { display: block; max-width: 100%; height: auto; border: var(--border); border-radius: var(--r-xs); background: var(--line); }
#mapgame-devstats .ds-heat.is-drawn canvas { background: var(--paper); }
#mapgame-devstats .ds-heat.is-empty canvas { display: none; }
#mapgame-devstats .ds-heat figcaption { color: var(--muted); font-size: var(--fs-small); }

/* ---- a day's plays by hour (David, 13/10/2026): 24 columns filling upwards, the busiest hour filling its column.
   Today's hour now is light grey, as it isn't over, and the hours still to come have no column and no baseline ---- */

#mapgame-devstats .ds-cols {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 2px;
  margin: var(--sp-1) 0 0;
  padding: 0;
  list-style: none;
  font: 500 var(--fs-label)/1.2 var(--font-data);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
#mapgame-devstats .ds-cols li { position: relative; display: grid; gap: var(--sp-1); min-width: 0; }
/* A column is 6rem for the busiest hour's bar, with room over it for that hour's plays, which sit on top of each bar */
#mapgame-devstats .ds-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 6rem;
  padding-top: calc(1.2em + 2px);
  border-bottom: 1px solid var(--muted);
}
#mapgame-devstats .ds-col i { flex-shrink: 0; min-height: 2px; border-radius: var(--r-xs) var(--r-xs) 0 0; background: var(--ink); }
#mapgame-devstats .ds-col-count { flex-shrink: 0; margin-bottom: 2px; color: var(--ink); white-space: nowrap; }
#mapgame-devstats .ds-cols .is-now i { background: var(--line); }
#mapgame-devstats .ds-cols .is-now .ds-col-count { color: var(--muted); }
#mapgame-devstats .ds-cols .is-later .ds-col { border-bottom-color: transparent; }
#mapgame-devstats .ds-col-hour { color: var(--muted); }
/* Each column in words, for screen readers (the hover's title isn't read everywhere) */
#mapgame-devstats .ds-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Narrower than this the plays don't fit over their columns (a hover gives them), and only every third hour is named */
@media (max-width: 45rem) {
  #mapgame-devstats .ds-col { padding-top: 0; }
  #mapgame-devstats .ds-col-count { display: none; }
  #mapgame-devstats .ds-cols .is-minor .ds-col-hour { visibility: hidden; }
}
