const css = `
.m-cplx{flex:none;display:inline-block;font-family:var(--mono);font-size:10px;font-weight:700;letter-spacing:.14em;padding:1px 7px;border:1px solid;border-radius:var(--radius-xs,3px)}
.m-cplx--hard{color:var(--red);border-color:var(--red-dim);background:rgba(255,93,93,.07)}
.m-cplx--medium{color:var(--amber);border-color:var(--amber-dim);background:rgba(240,180,41,.07)}
.m-cplx--easy{color:var(--green);border-color:var(--green-dim);background:rgba(95,221,125,.07)}
`;
function ensureCss() {
  if (typeof document === 'undefined' || document.getElementById('m-cplx-css')) return;
  const s = document.createElement('style'); s.id = 'm-cplx-css'; s.textContent = css;
  document.head.appendChild(s);
}
const LABEL = { hard: 'HARD', medium: 'MED', easy: 'EASY' };

export function ComplexityBadge({ complexity = 'medium' }) {
  ensureCss();
  return <span className={'m-cplx m-cplx--' + complexity}>{LABEL[complexity] || complexity}</span>;
}
