/*
 * Dashboard styles.
 *
 * Colour roles come from the validated dark palette, checked against this
 * page's actual surface (#1b1f26) rather than a generic one:
 *   categorical 3 slots -> CVD worst-pair dE 9.4, normal-vision 20.9, all >= 3:1
 * Sequential magnitude uses one blue ramp, running dark (near the surface) to
 * light, because on a dark surface "more" has to mean brighter.
 */

.viz {
  --series-1: #3987e5;   /* 1-player */
  --series-2: #d95926;   /* 2-player */
  --series-3: #199e70;   /* 0-player */

  --seq-100: #104281;
  --seq-200: #184f95;
  --seq-300: #256abf;
  --seq-400: #2a78d6;
  --seq-500: #3987e5;
  --seq-600: #6da7ec;
  --seq-700: #9ec5f4;

  --div-low: #e66767;    /* losing record */
  --div-mid: #383835;    /* even */
  --div-high: #3987e5;   /* winning record */

  --grid: #2c2c2a;
  --axis: #383835;
  --ink-muted: #898781;
}

.wide { max-width: 1220px; margin: 0 auto; padding: 22px; display: block; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.tile .value { font-size: 30px; font-weight: 640; line-height: 1.1; }
.tile .label { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tile .sub { font-size: 11.5px; color: var(--ink-muted); margin-top: 2px; }
.tile.accent .value { color: var(--series-1); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }

figure.chart {
  margin: 0 0 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px 17px;
}
figure.chart figcaption { margin-bottom: 3px; font-size: 14px; font-weight: 600; }
figure.chart .note { font-size: 12px; color: var(--muted); margin-bottom: 13px; }

/* ── Horizontal bars ──────────────────────────────────────────────────── */

.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: 108px 1fr auto; align-items: center; gap: 10px; }
.hbar .name { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { background: #23282f; border-radius: 4px; height: 16px; overflow: hidden; }
.hbar .fill {
  display: block;    /* <i> is inline by default, and width/height do not apply to it */
  height: 100%;
  border-radius: 0 4px 4px 0;   /* 4px rounded data-end, square against the baseline */
  background: var(--series-1);
  min-width: 2px;
  transition: width 0.35s ease;
}
.hbar .val { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }

/* ── Column chart ─────────────────────────────────────────────────────── */

.columns { display: flex; align-items: flex-end; gap: 2px; height: 150px; border-bottom: 1px solid var(--axis); }
.columns .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; cursor: default; }
.columns .col i {
  display: block;
  background: var(--series-1);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: filter 0.12s ease;
}
.columns .col:hover i { filter: brightness(1.3); }
.col-labels { display: flex; gap: 2px; margin-top: 5px; }
.col-labels span { flex: 1; text-align: center; font-size: 10.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* ── Board heatmap ────────────────────────────────────────────────────── */

.heatboard {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;                       /* surface gap between cells */
  max-width: 330px;
  aspect-ratio: 1;
}
.heatboard .cell {
  border-radius: 3px;
  background: #23282f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: #dfe6ef;
  cursor: default;
}
.heatboard .cell.zero { color: #4b535f; }
.heatboard .cell.on-light { color: #0d1116; font-weight: 650; }

.ramp { display: flex; align-items: center; gap: 7px; margin-top: 11px; font-size: 11.5px; color: var(--muted); }
.ramp .steps { display: flex; gap: 2px; }
.ramp .steps i { width: 20px; height: 10px; border-radius: 2px; display: block; }

/* ── Matrix ───────────────────────────────────────────────────────────── */

.matrix { border-collapse: separate; border-spacing: 2px; font-size: 12px; width: 100%; }
.matrix th { color: var(--muted); font-weight: 500; font-size: 11.5px; padding: 3px; text-align: center; }
.matrix th.row { text-align: right; padding-right: 7px; white-space: nowrap; }
.matrix td {
  text-align: center;
  padding: 7px 4px;
  border-radius: 3px;
  background: #23282f;
  color: #dfe6ef;
  font-variant-numeric: tabular-nums;
  cursor: default;
}
.matrix td.self { background: transparent; color: #3a414c; }
.matrix td.none { color: #4b535f; }

/* ── Table ────────────────────────────────────────────────────────────── */

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
}
table.data td { padding: 6px 8px; border-bottom: 1px solid #232830; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { text-align: right; }
table.data a { text-decoration: none; }
.pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 11px;
  background: #262c35;
  color: var(--muted);
}
.pill.ai { background: rgb(57 135 229 / 18%); color: #8bbcf2; }
.pill.win { background: rgb(12 163 12 / 16%); color: #6fd06f; }
.pill.draw { background: rgb(137 135 129 / 18%); color: #b6b4ad; }

/* ── Tooltip ──────────────────────────────────────────────────────────── */

#tip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: #0d1116;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 12px;
  color: var(--text);
  box-shadow: 0 6px 18px rgb(0 0 0 / 50%);
  opacity: 0;
  transition: opacity 0.1s ease;
  max-width: 240px;
}
#tip.on { opacity: 1; }
#tip b { color: #fff; }

.legend-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.legend-row span { display: flex; align-items: center; gap: 5px; }
.legend-row i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.empty-state { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty-state p { margin: 6px 0; }
