/* =====================================================================
 * /css/qk-vstats.css — Versus stats page
 *
 * Cleaner layout: a hero header with the net-all-time call-out on the
 * right, a 4-tile overview strip, and a 2-card per-game grid below.
 * Body-scoped via [data-page="versus-stats"]. No :root — tokens come
 * from stake.css.
 * =================================================================== */

body[data-page="versus-stats"] {
  background: var(--s-bg);
}

.vstats-page {
  min-height: 100vh;
  padding: 28px 0 64px;
  max-width: 1100px;
  margin: 0 auto;
}

/* =====================================================================
 * Header — title left, net all-time + back link right
 * =================================================================== */
.vstats-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: end;
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--s-line);
}
.vstats-head-l { min-width: 0; }
.vstats-head-kicker {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--s-muted-2);
  font-weight: 800;
  margin-bottom: 6px;
}
.vstats-head-title {
  margin: 0;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -.025em;
  line-height: 1.05;
}
.vstats-head-title .accent { color: var(--s-green); }
.vstats-deck {
  margin: 10px 0 0;
  max-width: 520px;
  color: var(--s-muted);
  font-size: 14px;
  line-height: 1.5;
}

.vstats-head-r {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}
.vstats-net {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.vstats-net-lbl {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--s-muted-2);
  font-weight: 800;
}
.vstats-net-val {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  color: var(--s-green);
  letter-spacing: -.02em;
}
.vstats-net-val.is-neg { color: #ff7687; }
.vstats-net-sub {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--s-muted);
}
.vstats-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--s-bg-3);
  border: 1px solid var(--s-line);
  color: var(--s-muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: .04em;
  transition: background .15s, color .15s, border-color .15s;
}
.vstats-back:hover {
  background: var(--s-bg-4);
  color: var(--s-text);
  border-color: rgba(127,248,0,.35);
}
.vstats-back::before {
  content: "‹";
  font-weight: 900;
  font-size: 14px;
  margin-right: 2px;
  color: var(--s-green);
}

/* =====================================================================
 * Overview strip — 4 big tiles (matches / win-rate / biggest / net)
 * =================================================================== */
.vstats-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
.vstats-tile {
  background: var(--s-bg-2);
  border: 1px solid var(--s-line);
  border-radius: 14px;
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: border-color .15s;
}
.vstats-tile:hover { border-color: rgba(127,248,0,.22); }
.vstats-tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--s-green);
  opacity: .55;
}
.vstats-tile.is-matches::before { background: #fff; opacity: .25; }
.vstats-tile.is-winrate::before { background: var(--qk-cyan); opacity: .65; }
.vstats-tile.is-biggest::before { background: var(--qk-gold); opacity: .65; }
.vstats-tile.is-net::before     { background: var(--s-green); opacity: .65; }
.vstats-tile-lbl {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--s-muted-2);
  font-weight: 800;
}
.vstats-tile-val {
  font-size: 28px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
  color: var(--s-text);
}
.vstats-tile-val.is-pos { color: var(--s-green); }
.vstats-tile-val.is-neg { color: #ff7687; }
.vstats-tile-sub {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--s-muted);
  letter-spacing: .03em;
  min-height: 14px; /* keeps tile heights aligned even when sub is empty */
}

/* =====================================================================
 * Section heading
 * =================================================================== */
.vstats-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0 14px;
}
.vstats-section-head h2 {
  margin: 0;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--s-muted);
  font-weight: 900;
}
.vstats-section-head .vstats-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--s-muted-2);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 800;
}

/* =====================================================================
 * Favorite game pill
 * =================================================================== */
.vstats-fav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--s-bg-3);
  border: 1px solid var(--s-line);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--s-text);
}
.vstats-fav-pill .vstats-fav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}
.vstats-fav-pill.rps        .vstats-fav-dot { background: var(--qk-gold); color: var(--qk-gold); }
.vstats-fav-pill.battleship .vstats-fav-dot { background: var(--qk-cyan); color: var(--qk-cyan); }
.vstats-fav-pill.none {
  color: var(--s-muted);
}
.vstats-fav-pill.none .vstats-fav-dot { background: var(--s-muted-2); color: var(--s-muted-2); box-shadow: none; }

/* =====================================================================
 * Per-game KPI cards
 * =================================================================== */
.vstats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.vstats-kpi {
  background: var(--s-bg-2);
  border: 1px solid var(--s-line);
  border-radius: 14px;
  padding: 18px 20px 16px;
  position: relative;
  overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.vstats-kpi:hover {
  border-color: rgba(127,248,0,.22);
  transform: translateY(-2px);
}
.vstats-kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--vstats-game-color, var(--s-green));
  opacity: .85;
}
.vstats-kpi.battleship { --vstats-game-color: var(--qk-cyan); }
.vstats-kpi.rps        { --vstats-game-color: var(--qk-gold); }

.vstats-kpi .vstats-ghead {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--s-line);
}
.vstats-kpi .vstats-glyph {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  background: var(--s-bg-3);
  border: 1px solid var(--s-line);
  color: var(--s-text);
}
.vstats-kpi.battleship .vstats-glyph { background: rgba(102,255,229,.12); border-color: rgba(102,255,229,.3); color: var(--qk-cyan); }
.vstats-kpi.rps        .vstats-glyph { background: rgba(255,209,102,.12); border-color: rgba(255,209,102,.3); color: var(--qk-gold); }

.vstats-kpi .vstats-gname {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  color: var(--s-text);
  flex: 1 1 auto;
  min-width: 0;
}
.vstats-kpi .vstats-gname small {
  display: block;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--s-muted-2);
  font-weight: 700;
  margin-top: 2px;
}
.vstats-kpi .vstats-gtotal {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--s-muted);
  font-weight: 700;
  white-space: nowrap;
}
.vstats-kpi .vstats-gtotal b { color: var(--s-text); font-weight: 900; }

.vstats-kpi-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.vstats-kpi-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vstats-kpi-stat .l {
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--s-muted-2);
  font-weight: 800;
}
.vstats-kpi-stat .v {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--s-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.vstats-kpi-stat .v.pos { color: var(--s-green); }
.vstats-kpi-stat .v.neg { color: #ff7687; }
.vstats-kpi-stat .sub {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--s-muted-2);
  letter-spacing: .04em;
  margin-top: 1px;
}
.vstats-kpi-stat .v.empty {
  color: var(--s-muted-2);
  font-size: 18px;
  font-weight: 700;
}

/* =====================================================================
 * Loading / empty / error
 * =================================================================== */
.vstats-loading {
  padding: 44px 18px;
  text-align: center;
  color: var(--s-muted);
  font-size: 13px;
  background: var(--s-bg-2);
  border: 1px dashed var(--s-line);
  border-radius: 14px;
}
.vstats-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--s-muted);
  font-size: 13px;
  background: var(--s-bg-2);
  border: 1px dashed var(--s-line);
  border-radius: 14px;
}
.vstats-empty b { color: var(--s-text); font-weight: 800; }

/* =====================================================================
 * Responsive
 * =================================================================== */
@media (max-width: 900px) {
  .vstats-overview { grid-template-columns: repeat(2, 1fr); }
  .vstats-kpi-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .vstats-head {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .vstats-head-r {
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
  }
  .vstats-net { align-items: flex-start; }
  .vstats-head-title { font-size: 28px; }
  .vstats-net-val { font-size: 24px; }
  .vstats-tile-val { font-size: 22px; }
  .vstats-tile { padding: 14px 16px; }
}
