import React from 'react';
import { createRoot } from 'react-dom/client';
import '@tamagui/core/reset.css';
import '../../css/app.css';
import { initializeTheme } from '@/hooks/use-appearance';
import App from './App';

const rootElement = document.getElementById('root');

if (!rootElement) {
  throw new Error('Guest v2 root element not found.');
}

initializeTheme();

if (typeof window !== 'undefined' && !window.localStorage.getItem('theme')) {
  window.localStorage.setItem('theme', 'light');
  initializeTheme();
}

createRoot(rootElement).render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);
