export const readBrowserStorage = (key: string): string | null => { try { return typeof localStorage === 'undefined' ? null : localStorage.getItem(key); } catch { return null; } }; export const writeBrowserStorage = (key: string, value: string): void => { try { if (typeof localStorage !== 'undefined') { localStorage.setItem(key, value); } } catch { // Storage can be unavailable in private browsing or embedded contexts. } };