diff --git a/web/index.html b/web/index.html
index d097f46fd4..b91e7b6b5e 100644
--- a/web/index.html
+++ b/web/index.html
@@ -14,6 +14,23 @@
/>
+
+
diff --git a/web/src/context/__tests__/theme-boot-script.test.ts b/web/src/context/__tests__/theme-boot-script.test.ts
new file mode 100644
index 0000000000..88361668b7
--- /dev/null
+++ b/web/src/context/__tests__/theme-boot-script.test.ts
@@ -0,0 +1,95 @@
+/*
+Copyright (C) 2023-2026 QuantumNous
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .
+
+For commercial licensing, please contact support@quantumnous.com
+*/
+import { readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+import { THEME_STORAGE_KEYS } from '@/lib/theme-storage'
+
+// The inline script in index.html must apply the theme class before React
+// mounts; Dark Reader checks `html.dark` only once while the page loads.
+const html = readFileSync(
+ resolve(import.meta.dirname, '../../../index.html'),
+ 'utf8'
+)
+const bootScript = html.match(/