"""Render a GradeReport as color-coded HTML for the Gradio Space.
This is the presentation layer over the deterministic grader in
space.ocr.grading (spec §7): the diff and score are computed there; here we
only turn the report into spans the learner can read. Pure, no network.
"""
import html
try: # package context (space.diff_html, e.g. tests at repo root)
from .ocr.grading import GradeReport
except ImportError: # flat context (HF Space root, app.py)
from ocr.grading import GradeReport
# Inline styles (Gradio sanitizes