.container { padding: 12px 12px 30px; gap: 12px; }
.subtitle { font-size: 0.7em; color: #888; text-align: center; margin-top: 2px; }

.panel { padding: 14px; max-width: 980px; width: 100%; }
.panel h3 { margin-bottom: 10px; font-size: 1em; color: #fff; }

/* Game picker */
.game-list { max-height: 280px; overflow-y: auto; border: 1px solid #26304f; border-radius: 6px; }
.game-row {
  display: grid; grid-template-columns: 96px 1fr auto auto auto; gap: 10px;
  align-items: center; padding: 7px 10px; cursor: pointer;
  border-bottom: 1px solid #1a1a2e; font-size: 0.85em;
}
.replay-link {
  color: #3498db; text-decoration: none; font-size: 0.85em;
  white-space: nowrap; padding: 2px 6px; border: 1px solid #26436b;
  border-radius: 10px;
}
.replay-link:hover { background: #1a2a50; text-decoration: none; }
.game-row:last-child { border-bottom: none; }
.game-row:hover { background: #1a2a50; }
.game-row.selected { background: #1f3060; box-shadow: inset 3px 0 0 #ffd700; }
.game-row .date { color: #aaa; font-variant-numeric: tabular-nums; }
.game-row .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-row .who .winner-name { color: #ffd700; font-weight: 600; }
.game-row .turns { color: #666; font-size: 0.9em; white-space: nowrap; }
.badge {
  font-size: 0.72em; padding: 2px 8px; border-radius: 10px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap;
}
.badge.finished { background: rgba(46,204,113,0.15); color: #2ecc71; border: 1px solid rgba(46,204,113,0.4); }
.badge.abandoned { background: rgba(160,160,160,0.12); color: #999; border: 1px solid #444; }
.badge.live { background: rgba(231,76,60,0.15); color: #e74c3c; border: 1px solid rgba(231,76,60,0.5); }
.badge.live::before {
  content: ''; display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: #e74c3c; margin-right: 5px;
  animation: pulse 1.6s ease-in-out infinite;
}

/* Chart */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-title .meta { font-size: 0.75em; color: #888; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 0.82em; }
.legend .item { display: flex; align-items: center; gap: 5px; }
.legend .swatch { width: 12px; height: 4px; border-radius: 2px; display: inline-block; }
.legend .tag { font-size: 0.72em; padding: 1px 6px; border-radius: 8px; font-weight: 700; }
.legend .tag.win { background: rgba(255,215,0,0.15); color: #ffd700; border: 1px solid rgba(255,215,0,0.5); }
.legend .tag.bust { background: rgba(231,76,60,0.12); color: #e74c3c; border: 1px solid rgba(231,76,60,0.4); }
.chart-tip {
  display: none; position: absolute; z-index: 50; pointer-events: none;
  background: #1a1a2e; border: 1px solid #555; border-radius: 6px;
  padding: 8px 10px; font-size: 0.78em; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6); min-width: 130px;
}
.chart-tip .tip-head { color: #fff; font-weight: 600; margin-bottom: 3px; }
.chart-tip .tip-ts { color: #666; font-size: 0.9em; margin-bottom: 4px; }
.chart-tip .tip-event { color: #f39c12; margin-bottom: 4px; max-width: 240px; white-space: normal; }
.chart-tip .tip-row { display: flex; justify-content: space-between; gap: 14px; padding: 1px 0; }
.chart-tip .tip-row .val { font-variant-numeric: tabular-nums; }
.chart-tip .tip-row.near { color: #fff; font-weight: 700; }

.empty-note { color: #888; font-size: 0.9em; text-align: center; padding: 26px 10px; }

/* Hall of Fame */
.records-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px;
}
.record-card {
  background: #1a2440; border: 1px solid #26304f; border-radius: 8px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.record-card.clickable { cursor: pointer; }
.record-card.clickable:hover { background: #1a2a50; border-color: #3498db; }
.record-card .rec-title {
  font-size: 0.7em; text-transform: uppercase; letter-spacing: 0.6px;
  color: #888; font-weight: 600;
}
.record-card .rec-value {
  font-size: 1.45em; font-weight: 700; color: #ffd700;
  font-variant-numeric: tabular-nums;
}
.record-card .rec-holder { font-size: 0.92em; font-weight: 600; color: #e0e0e0; }
.record-card .rec-date { font-size: 0.72em; color: #666; font-variant-numeric: tabular-nums; }
.record-card .rec-detail { font-size: 0.78em; color: #aaa; margin-top: 4px; }

/* Head-to-head */
.h2h-wrap { overflow: auto; max-height: 460px; border: 1px solid #26304f; border-radius: 6px; }
.h2h-table { border-collapse: separate; border-spacing: 0; font-size: 0.82em; min-width: 100%; }
.h2h-table th, .h2h-table td {
  padding: 6px 9px; white-space: nowrap; text-align: center;
  border-bottom: 1px solid #1a1a2e; border-right: 1px solid #1a1a2e;
}
.h2h-table thead th { position: sticky; top: 0; background: #1a2440; color: #aaa; z-index: 2; }
.h2h-table tbody th {
  position: sticky; left: 0; background: #1a2440; color: #e0e0e0;
  text-align: left; font-weight: 600; z-index: 1;
}
.h2h-table thead th:first-child { left: 0; z-index: 3; }
.h2h-table tbody th .wl { color: #888; font-weight: 400; font-size: 0.85em; margin-left: 6px; }
.h2h-cell { font-variant-numeric: tabular-nums; cursor: default; color: #e0e0e0; }
.h2h-cell.diag { background: #131b33; }
/* Muted, but still AA-readable: #a5adc0 over the strongest small-sample
   tint composites to >= 5.7:1 against the panel background. */
.h2h-cell.small { color: #a5adc0; font-size: 0.92em; }
.h2h-note { font-size: 0.72em; color: #666; margin-top: 8px; }

@media (max-width: 600px) {
  .game-row { grid-template-columns: 78px 1fr auto auto; }
  .game-row .turns { display: none; }
}

.record-card .rec-replay {
  font-size: 0.72em; color: #3498db; text-decoration: none; margin-top: 4px;
}
.record-card .rec-replay:hover { text-decoration: underline; }
