export const PROGRESS_KEY = 'ejm.progress.v1';
export const LAST_RESULT_KEY = 'ejm.lastResult.v1';
/** Fired on window when an assessment is completed, so open pages can update their buttons. */
export const RESULT_SAVED_EVENT = 'ejm:result-saved';

/** localStorage can be missing or throw (private windows, blocked site data). */
export function safeStorage(): Storage | null {
  try {
    return typeof window === 'undefined' ? null : window.localStorage;
  } catch {
    return null;
  }
}
