/**
 * Build an ECharts theme object from the active CSS custom properties.
 * Reads from document.documentElement so it always reflects the current theme.
 */
export function buildEChartsTheme(): Record<string, unknown> {
  const root = getComputedStyle(document.documentElement);
  const get = (prop: string) => root.getPropertyValue(prop).trim();

  return {
    backgroundColor: 'transparent',
    textStyle: {
      color: get('--foreground'),
    },
    line: {
      symbol: 'none',
    },
    gauge: {
      itemStyle: {
        color: undefined, // per-gauge override
      },
    },
  };
}
