/* charts.css — the player charts page (charts.html, js/charts.js).
 *
 * Two series at most: players and agents. Both were run through the
 * categorical palette check against --store-panel (#161b17), dark mode:
 * lightness band, chroma, colour-blind separation and contrast all pass.
 * --g-live itself sits just above the band, so the line uses a step down.
 */
.charts {
  --ch-players: #00b305;
  --ch-agents: #4f97e6;
  --ch-surface: var(--store-panel);
  padding-bottom: 40px;
}

/* the headline numbers */
.ch-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 18px 0 6px;
}
.ch-tile {
  background: var(--store-panel);
  border: 1px solid var(--store-line);
  border-radius: var(--r);
  box-shadow: var(--bevel);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ch-tile-n { font-size: 1.7rem; line-height: 1.1; color: var(--store-ink); }
.ch-tile-l { color: var(--store-muted); font-size: .8rem; }
.ch-tile-s { color: var(--store-dim); font-size: .76rem; }
.ch-tiles-sm .ch-tile-n { font-size: 1.25rem; }
.ch-tile abbr, .ch-table abbr { text-decoration: none; color: var(--store-muted); cursor: help; }

/* a section */
.ch-panel { margin-top: 26px; }
.ch-panel > .row-head { margin-bottom: 10px; }

/* the range bar, one row above the chart */
.ch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 8px;
}
.ch-ranges { display: flex; flex-wrap: wrap; gap: 4px; }
.ch-range {
  font: inherit;
  font-size: .78rem;
  color: var(--store-muted);
  background: var(--store-pit);
  border: 1px solid var(--store-line);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  min-height: 30px;
  cursor: pointer;
}
.ch-range:hover { color: var(--store-ink); border-color: var(--store-line-2); }
.ch-range[aria-pressed="true"] { color: var(--store-ink); border-color: var(--g-live); background: var(--g-wash); }
.ch-range:focus-visible, .ch-sort:focus-visible, .ch-svg:focus-visible { outline: 2px solid var(--g-live); outline-offset: 2px; }
.ch-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: .78rem; color: var(--store-muted); }
.ch-key { display: inline-flex; align-items: center; gap: 6px; }
.ch-key[hidden] { display: none; }
.ch-key i { display: inline-block; width: 14px; height: 2px; border-radius: 1px; }
.ch-key-p { background: var(--ch-players); }
.ch-key-a { background: var(--ch-agents); }
.ch-csv { color: var(--store-link); }

/* the chart */
.ch-box {
  position: relative;
  background: var(--ch-surface);
  border: 1px solid var(--store-line);
  border-radius: var(--r);
  padding: 8px 4px 2px;
  min-height: 120px;
}
.ch-svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.ch-grid { stroke: var(--store-line); stroke-width: 1; }
.ch-axis { fill: var(--store-dim); font-family: var(--mono); font-size: 10px; }
.ch-area { fill: var(--ch-players); fill-opacity: .12; stroke: none; }
.ch-line { fill: none; stroke: var(--ch-players); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-line.ch-agents { stroke: var(--ch-agents); }
.ch-dot { fill: var(--ch-players); stroke: var(--ch-surface); stroke-width: 2; }
.ch-dot.ch-agents { fill: var(--ch-agents); }
.ch-hair { stroke: var(--store-muted); stroke-width: 1; stroke-dasharray: 2 3; }
.ch-hit { fill: transparent; cursor: crosshair; }
.ch-empty { padding: 40px 16px; text-align: center; }

.ch-tip {
  position: absolute;
  top: 6px;
  pointer-events: none;
  background: var(--store-hull);
  border: 1px solid var(--store-line-2);
  border-radius: var(--r);
  padding: 7px 10px;
  font-size: .78rem;
  color: var(--store-muted);
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  z-index: 2;
}
.ch-tip[hidden] { display: none; }
.ch-tip-h { color: var(--store-dim); margin-bottom: 3px; }
.ch-tip-r b { color: var(--store-ink); font-weight: 700; }
.ch-tip-r::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 2px;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--ch-players);
}
.ch-tip-r.ch-tip-sub::before { background: transparent; }
.ch-tip-r.ch-tip-agents::before { background: var(--ch-agents); }

/* tables */
.ch-scroll { overflow-x: auto; }
.ch-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.ch-table th, .ch-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--store-line);
  vertical-align: middle;
}
.ch-table thead th {
  color: var(--store-dim);
  font-weight: 400;
  font-size: .76rem;
  border-bottom-color: var(--store-line-2);
  white-space: nowrap;
}
.ch-table tbody th { font-weight: 600; color: var(--store-ink); }
.ch-table tbody tr:hover { background: var(--g-wash); }
.ch-table .ch-n { text-align: right; }
.ch-c-rank { width: 2.5em; color: var(--store-dim); }
.ch-c-spark { width: 104px; }
.ch-sort {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
}
.ch-sort:hover { color: var(--store-ink); }
.ch-spark { display: block; }
.ch-spark path { fill: none; stroke: var(--ch-players); stroke-width: 1.5; stroke-linejoin: round; }
.ch-tag {
  font-size: .68rem;
  font-weight: 400;
  color: var(--store-muted);
  border: 1px solid var(--store-line-2);
  border-radius: var(--r-sm);
  padding: 1px 5px;
  margin-left: 4px;
}
/* the change column: the sign carries it, so colour is never alone */
.ch-up { color: var(--g-live); }
.ch-down { color: var(--store-muted); }

/* at a glance, and the copy price beside it */
.ch-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 24px; }
.ch-kv { width: 100%; border-collapse: collapse; font-size: .86rem; }
.ch-kv th, .ch-kv td { padding: 8px 10px; border-bottom: 1px solid var(--store-line); text-align: left; }
.ch-kv th { color: var(--store-muted); font-weight: 400; width: 42%; }

.ch-updates { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.ch-updates li { padding: 8px 0; border-bottom: 1px solid var(--store-line); }
.ch-updates .num { margin-right: 8px; }

.ch-head .lede a { color: var(--store-link); }

/* a phone keeps the game, the count now, the 24-hour peak and the spark */
@media (max-width: 680px) {
  .ch-c-opt, .ch-c-rank { display: none; }
  .ch-table th, .ch-table td { padding: 8px 6px; }
  .ch-tile-n { font-size: 1.4rem; }
  .ch-c-spark { width: 68px; }
  .ch-spark { width: 64px; height: 20px; }
}
@media (forced-colors: active) {
  .ch-line, .ch-spark path { stroke: CanvasText; }
  .ch-line.ch-agents { stroke: LinkText; stroke-dasharray: 4 3; }
  .ch-area { fill: none; }
}
