/* Shared floating stats, loaded after each game's layout styles. */
#liveStatsPanel.live-stats-floating {
  position: fixed;
  z-index: 19;
  inset: auto;
  display: block;
  box-sizing: border-box;
  width: 312px;
  min-width: 0;
  max-width: calc(100vw - 16px);
  height: auto;
  min-height: 0;
  max-height: calc(100dvh - 16px);
  margin: 0;
  padding: 0 14px 14px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #344e5e;
  border-radius: 10px;
  background: #203744;
  color: #f1f6fa;
  box-shadow: 0 12px 36px #06131d66;
  transform: none;
}

#liveStatsPanel[hidden] { display: none; }

#liveStatsPanel .live-stats-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  margin: 0 -4px 6px;
  padding: 3px 4px;
  background: #203744;
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

#liveStatsPanel.is-dragging .live-stats-header { cursor: grabbing; }
#liveStatsPanel .live-stats-header:focus-visible { outline: 2px solid #8bc4e5; outline-offset: -2px; }

#liveStatsPanel .live-stats-header h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 700;
  text-transform: none;
}

#liveStatsPanel .live-stats-symbol { width: 19px; height: 20px; color: #a6c3d4; }
#liveStatsPanel svg { pointer-events: none; }

#liveStatsPanel .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #aac6d8;
  cursor: pointer;
}

#liveStatsPanel .icon-button svg { width: 20px; height: 20px; }
#liveStatsPanel .icon-button:hover { background: #365261; color: #fff; }
#liveStatsPanel .icon-button:focus-visible { outline: 2px solid #8bc4e5; outline-offset: 1px; }

#liveStatsPanel .stats-filter-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin: 0 0 12px;
  padding: 0;
}

#liveStatsPanel .live-stats-scope {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 6px;
  background: #3b586a;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  line-height: 20px;
}

#liveStatsPanel .live-stats-unit { flex: 1; color: #adc4d3; font-size: 11px; line-height: 1.4; }

#liveStatsPanel .live-stats-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 0;
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 0;
  border-radius: 8px;
  background: #152c38;
}

#liveStatsPanel .live-stats-metrics > div {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  order: 0;
  grid-column: auto;
  grid-row: auto;
  gap: 3px;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

#liveStatsPanel .live-stats-metrics > div:nth-child(1) { grid-area: 1 / 1; }
#liveStatsPanel .live-stats-metrics > div:nth-child(2) { grid-area: 1 / 2; }
#liveStatsPanel .live-stats-metrics > div:nth-child(3) { grid-area: 2 / 1; padding-top: 10px; }
#liveStatsPanel .live-stats-metrics > div:nth-child(4) { grid-area: 2 / 2; padding-top: 10px; }
#liveStatsPanel .live-stats-metrics > div:nth-child(odd) { padding-right: 12px; border-right: 1px solid #36515e; }
#liveStatsPanel .live-stats-metrics > div:nth-child(even) { padding-left: 16px; }

#liveStatsPanel .live-stats-metrics .label {
  display: block;
  margin: 0;
  padding: 0;
  color: #abc6d6;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

#liveStatsPanel .live-stats-metrics strong {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow: visible;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
}

#liveStatsPanel .credit-dot { display: none; }
#liveStatsPanel #winsMetric { color: #14f46a; }
#liveStatsPanel #lossesMetric { color: #ff5375; }

#liveStatsPanel .stats-chart {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  height: clamp(110px, 27vh, 205px);
  min-height: 0;
  margin: 0;
  padding: 16px 12px;
  border: 0;
  border-radius: 8px;
  background: #102733;
}

#liveStatsPanel .stats-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
#liveStatsPanel .chart-line, #liveStatsPanel .chart-loss-line { fill: none; stroke-width: 2.3; stroke-linejoin: round; stroke-linecap: round; }
#liveStatsPanel .chart-line { stroke: #14f46a; }
#liveStatsPanel .chart-loss-line { stroke: #ff2854; }
#liveStatsPanel .chart-fill { fill: #14f46a; fill-opacity: .17; stroke: none; }
#liveStatsPanel .chart-loss-fill { fill: #ff2854; fill-opacity: .18; stroke: none; }
#liveStatsPanel .chart-zero { stroke: #8196a2; stroke-width: 1; opacity: .4; }
