/* EloTracker Broadcast Intelligence Suite — WDL Bar, Board Arrows, Insights Tab */

.elo-wdl-wrap {
  margin-top: 7px;
}
.elo-wdl-bar {
  display: flex;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
}
.dark .elo-wdl-bar {
  border-color: #475569;
  background: #334155;
}
.elo-wdl-seg {
  transition: width 0.35s ease;
  min-width: 0;
}
.elo-wdl-w {
  background: #ffffff;
}
.elo-wdl-d {
  background: #94a3b8;
}
.elo-wdl-b {
  background: #1e293b;
}
.dark .elo-wdl-w {
  background: #f1f5f9;
}
.dark .elo-wdl-d {
  background: #64748b;
}
.dark .elo-wdl-b {
  background: #0f172a;
}
.elo-wdl-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: #475569;
  font-variant-numeric: tabular-nums;
}
.dark .elo-wdl-legend {
  color: #cbd5e1;
}
.elo-wdl-key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.elo-wdl-swatch {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex: none;
}
.elo-wdl-swatch.is-w {
  background: #ffffff;
  border: 1px solid #94a3b8;
}
.elo-wdl-swatch.is-d {
  background: #94a3b8;
}
.elo-wdl-swatch.is-b {
  background: #1e293b;
}
.dark .elo-wdl-swatch.is-b {
  background: #0f172a;
  border: 1px solid #64748b;
}

/* Arrow toggle button inside engine panel header */
.elo-arrow-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.elo-arrow-toggle:hover {
  background: #f1f5f9;
  color: #0f766e;
}
.elo-arrow-toggle[aria-pressed="true"] {
  background: #ccfbf1;
  color: #0f766e;
  border-color: #99f6e4;
}
.dark .elo-arrow-toggle {
  color: #94a3b8;
}
.dark .elo-arrow-toggle:hover {
  background: #334155;
  color: #2dd4bf;
}
.dark .elo-arrow-toggle[aria-pressed="true"] {
  background: rgba(20, 184, 166, 0.2);
  color: #2dd4bf;
  border-color: rgba(45, 212, 191, 0.45);
}

/* SVG arrows overlay directly on inner chessboard grid (.board-b72b1) for exact centering */
#board,
#board .board-b72b1 {
  position: relative;
}
.elo-pred-arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
}

/* Insights panel below board (aligned with --viewer-layout-width) */
.broadcast-viewer[data-broadcast-view="overview"] #focus-insights-panel,
html.embedded-viewer #focus-insights-panel {
  display: none !important;
}
.elo-insights-panel {
  width: 100%;
  max-width: min(100%, var(--viewer-layout-width, 1180px));
  margin: 12px auto 0;
  box-sizing: border-box;
}
.elo-insights-panel[hidden] {
  display: none !important;
}
.elo-insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 820px) {
  .elo-insights-grid {
    grid-template-columns: 1fr;
  }
}
.elo-insight-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  min-width: 0;
}
.dark .elo-insight-card {
  background: #1f2937;
  border-color: #374151;
}
.elo-insight-card.is-wide {
  grid-column: 1 / -1;
}
.elo-insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.elo-insight-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dark .elo-insight-title {
  color: #cbd5e1;
}
.elo-insight-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.elo-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  white-space: nowrap;
}
.dark .elo-pill {
  background: #334155;
  color: #e2e8f0;
}
.elo-pill-teal {
  background: #ccfbf1;
  color: #0f766e;
}
.dark .elo-pill-teal {
  background: rgba(20, 184, 166, 0.22);
  color: #5eead4;
}
.elo-pill-amber {
  background: #fef3c7;
  color: #92400e;
}
.dark .elo-pill-amber {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}
.elo-pill-red {
  background: #fee2e2;
  color: #991b1b;
}
.dark .elo-pill-red {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
.elo-pill-purple {
  background: #ede9fe;
  color: #5b21b6;
}
.dark .elo-pill-purple {
  background: rgba(139, 92, 246, 0.22);
  color: #c4b5fd;
}

/* Predicted human moves rows */
.elo-pred-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.elo-pred-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 44px auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid #eef2f6;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.12s, border-color 0.12s;
}
.elo-pred-row:hover {
  background: #f0fdfa;
  border-color: #99f6e4;
}
.dark .elo-pred-row {
  background: #111827;
  border-color: #1f2937;
}
.dark .elo-pred-row:hover {
  background: rgba(20, 184, 166, 0.12);
  border-color: rgba(45, 212, 191, 0.4);
}
.elo-pred-san {
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.dark .elo-pred-san {
  color: #f8fafc;
}
.elo-pred-bar-track {
  height: 7px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.dark .elo-pred-bar-track {
  background: #334155;
}
.elo-pred-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0d9488, #14b8a6);
  transition: width 0.25s ease;
}
.elo-pred-row.is-trap .elo-pred-bar-fill {
  background: linear-gradient(90deg, #dc2626, #f59e0b);
}
.elo-pred-pct {
  font-size: 12px;
  font-weight: 700;
  color: #0f766e;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dark .elo-pred-pct {
  color: #5eead4;
}
.elo-pred-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}
.dark .elo-pred-meta {
  color: #94a3b8;
}

/* Position history & sample games */
.elo-pos-summary {
  font-size: 13px;
  color: #1e293b;
  margin-bottom: 8px;
  line-height: 1.45;
}
.dark .elo-pos-summary {
  color: #e2e8f0;
}
.elo-player-hist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.elo-player-hist-line {
  font-size: 12px;
  color: #334155;
  padding: 5px 8px;
  border-radius: 6px;
  background: #f8fafc;
  border-left: 3px solid #0d9488;
}
.dark .elo-player-hist-line {
  background: #111827;
  color: #cbd5e1;
}
.elo-sample-games {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.elo-sample-game-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: #1e293b;
  text-decoration: none;
  background: #f8fafc;
  border: 1px solid #eef2f6;
}
.elo-sample-game-link:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.dark .elo-sample-game-link {
  background: #111827;
  border-color: #1f2937;
  color: #e2e8f0;
}
.dark .elo-sample-game-link:hover {
  background: #1e293b;
  border-color: #3b82f6;
  color: #93c5fd;
}

/* Last 5 moves strip */
.elo-last5-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.elo-last5-item {
  flex: 1 0 110px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s;
}
.elo-last5-item:hover {
  border-color: #0d9488;
  background: #f0fdfa;
}
.elo-last5-item.is-current {
  border-color: #0d9488;
  background: #ecfdf5;
}
.dark .elo-last5-item {
  background: #111827;
  border-color: #334155;
}
.dark .elo-last5-item.is-current {
  border-color: #14b8a6;
  background: rgba(20, 184, 166, 0.14);
}
.elo-last5-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-weight: 700;
  font-size: 12px;
  color: #0f172a;
}
.dark .elo-last5-top {
  color: #f8fafc;
}
.elo-last5-sub {
  font-size: 11px;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.dark .elo-last5-sub {
  color: #94a3b8;
}

/* Time-spent SVG bar chart */
.elo-time-chart-wrap {
  width: 100%;
  overflow-x: auto;
}
.elo-time-svg {
  display: block;
  width: 100%;
  height: 112px;
}
.elo-time-bar {
  cursor: pointer;
  transition: opacity 0.12s;
}
.elo-time-bar:hover {
  opacity: 0.78;
}
.elo-time-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #475569;
  margin-top: 6px;
}
.dark .elo-time-summary {
  color: #cbd5e1;
}
.elo-empty-note {
  font-size: 12px;
  color: #64748b;
  padding: 6px 0;
}
.dark .elo-empty-note {
  color: #94a3b8;
}
