diff --git a/.serena/.gitignore b/.serena/.gitignore
new file mode 100644
index 0000000..14d86ad
--- /dev/null
+++ b/.serena/.gitignore
@@ -0,0 +1 @@
+/cache
diff --git a/.serena/memories/done_checklist.md b/.serena/memories/done_checklist.md
new file mode 100644
index 0000000..a22d98b
--- /dev/null
+++ b/.serena/memories/done_checklist.md
@@ -0,0 +1,7 @@
+# 任务完成检查单
+1. 本地跑通 `npm test`(或至少相关模块的 Jest 套件),并根据修改范围补充端到端 HTML 测试页或手动流程。
+2. 若涉及前端逻辑或样式,执行 `npm run build` 确认 PostCSS/webpack 成功,必要时运行 `npm run build:css` / `npm run build:js` 独立定位错误。
+3. 有网络/API 交互改动时,用 `npm start` 或 `npm run netlify-dev` 回归关键 eSIM 流程(Giffgaff OAuth+短信、Simyo 登录+设备更换),观察控制台和 Network。
+4. 涉及静态资源或脚本体积变化时,运行 `npm run optimize-images` / `npm run compress` 并检查 `dist/` 输出及 `sw.js` 预缓存列表。
+5. 进行 `npm run security-check` 确保 CSP/依赖未被破坏,确认 `.env` 示例与文档同步,必要时更新 `docs/` 指南。
+6. 提交前更新相关文档(README/docs)与配置(如 `netlify.toml`, `manifest.webmanifest`),并记录变更影响。
\ No newline at end of file
diff --git a/.serena/memories/project_overview.md b/.serena/memories/project_overview.md
new file mode 100644
index 0000000..3389380
--- /dev/null
+++ b/.serena/memories/project_overview.md
@@ -0,0 +1,6 @@
+# eSIM-Tools 项目概览
+- 目标:为 Giffgaff(英国)与 Simyo(荷兰)用户提供一站式 eSIM 申请、激活、二维码交付流程,涵盖 OAuth PKCE、MFA、短信激活与 GraphQL API 交互。
+- 前端:原生 JavaScript(ES6+ 模块)、Bootstrap 5、PostCSS/Autoprefixer、Service Worker + Workbox 提供 PWA 与离线能力,资源通过 Webpack/Terser/Compression 插件优化。
+- 后端:本地用 Node.js/Express(`server.js`)模拟 Netlify Functions、代理 Simyo API;正式环境托管在 Netlify(静态+Functions),并提供 Cloudflare Turnstile、CSP、CORS 收敛。
+- 目录:`src/` 含 giffgaff、simyo、js 模块(utilities、API service、middleware、performance);`netlify/functions/` 为后端逻辑;`scripts/` 包含图像压缩、安全审计等 Node 工具;`docs/` 提供架构、指南、故障排查;`tests/` 含 Jest 配置与浏览器端测试页。
+- 关键功能:自动 Cookie 登录、短信验证码激活、二维码生成、Simyo 设备更换支持、性能监控仪表盘、资源提示工具等。
\ No newline at end of file
diff --git a/.serena/memories/style_and_conventions.md b/.serena/memories/style_and_conventions.md
new file mode 100644
index 0000000..f1db6b2
--- /dev/null
+++ b/.serena/memories/style_and_conventions.md
@@ -0,0 +1,8 @@
+# 代码风格与约定
+- JavaScript 采用 ES6+ 模块化与 Webpack alias(`@modules`, `@utils` 等),入口 `src/js/main.js` 注重单一职责;公用逻辑放在 `src/js/modules/` 与 `middleware/`,优先复用 debounce/throttle、API service、performance monitor 等工具以符合 DRY。
+- 所有网络调用必须经过封装的 API service(含重试、缓存、去重)或 Netlify Function 代理,禁止在 UI 组件内直接写裸 `fetch`;Simyo 代理需保留必要头部与日志。
+- UI 主要基于 Bootstrap 5 + 自定义 CSS(`src/styles/`),遵循响应式与 mobile-first 设计;懒加载图片以 `data-src` 搭配 `performance.js` 的 Intersection Observer。
+- 安全默认开启:严格 CSP、Cloudflare Turnstile token、输入验证(手机号/验证码/ Cookie)、中间件限流与 XSS 清理;新增逻辑需沿用 `src/js/middleware` 的校验与错误边界。
+- Service Worker + Workbox 负责缓存策略,新增资源需更新 `sw.js` 预缓存清单并维持 500KB bundle 预算;脚本中使用 `console` 需守护日志噪音(已有 performance dashboard,可复用)。
+- Node/Netlify Functions 暴露 `handler` 并保持纯函数式输入/输出;Express 本地服务器使用 `wrapNetlifyFunction` 包装,新增函数需注册路由且遵循 30s timeout、统一错误响应结构。
+- 注释倾向解释意图(为何这样设计),避免冗余;命名沿用 provider + action 语义(如 `giffgaffSmsActivate`, `simyoDeviceFlow`)。
\ No newline at end of file
diff --git a/.serena/memories/suggested_commands.md b/.serena/memories/suggested_commands.md
new file mode 100644
index 0000000..c4fe7cf
--- /dev/null
+++ b/.serena/memories/suggested_commands.md
@@ -0,0 +1,12 @@
+# 常用命令
+- `npm install`:安装依赖(Node >= 18, npm >= 8)。
+- `npm start` / `npm run dev`:启动本地 Express 服务器(含 Netlify Function 模拟与 Simyo 代理)。
+- `npm run build`:运行 `build:css` + `build:js`(PostCSS 输出到 `dist/css`,Webpack 生产构建、含压缩与 SW 更新)。
+- `npm run build:css` / `npm run build:js`:单独构建样式或脚本;`build:js` 需要 `NODE_OPTIONS=--max-old-space-size=1536`。
+- `npm test` / `npm run test:watch` / `npm run test:coverage`:Jest + jsdom 单元/集成测试。
+- `npm run netlify-dev`:使用最新 `netlify-cli` 在本地模拟 Functions + 重定向。
+- `npm run deploy`:先构建、再通过 `netlify-cli` 生产部署。
+- `npm run optimize-images` / `npm run compress`:Node 工具批量优化图片与生成 Brotli/Gzip 资产。
+- `npm run security-check`:执行脚本 `scripts/security-check.js` 做依赖和配置审计。
+- `npm run deploy-prepare` / `npm run deploy-analyze` / `npm run deploy-test`:部署前检查及配置验证。
+- 浏览器端手动测试:`open tests/test_giffgaff_esim.html`、`open tests/test_simyo_esim.html`。
\ No newline at end of file
diff --git a/.serena/project.yml b/.serena/project.yml
new file mode 100644
index 0000000..cb90d1f
--- /dev/null
+++ b/.serena/project.yml
@@ -0,0 +1,84 @@
+# list of languages for which language servers are started; choose from:
+# al bash clojure cpp csharp csharp_omnisharp
+# dart elixir elm erlang fortran go
+# haskell java julia kotlin lua markdown
+# nix perl php python python_jedi r
+# rego ruby ruby_solargraph rust scala swift
+# terraform typescript typescript_vts yaml zig
+# Note:
+# - For C, use cpp
+# - For JavaScript, use typescript
+# Special requirements:
+# - csharp: Requires the presence of a .sln file in the project folder.
+# When using multiple languages, the first language server that supports a given file will be used for that file.
+# The first language is the default language and the respective language server will be used as a fallback.
+# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
+languages:
+- typescript
+
+# the encoding used by text files in the project
+# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
+encoding: "utf-8"
+
+# whether to use the project's gitignore file to ignore files
+# Added on 2025-04-07
+ignore_all_files_in_gitignore: true
+
+# list of additional paths to ignore
+# same syntax as gitignore, so you can use * and **
+# Was previously called `ignored_dirs`, please update your config if you are using that.
+# Added (renamed) on 2025-04-07
+ignored_paths: []
+
+# whether the project is in read-only mode
+# If set to true, all editing tools will be disabled and attempts to use them will result in an error
+# Added on 2025-04-18
+read_only: false
+
+# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
+# Below is the complete list of tools for convenience.
+# To make sure you have the latest list of tools, and to view their descriptions,
+# execute `uv run scripts/print_tool_overview.py`.
+#
+# * `activate_project`: Activates a project by name.
+# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
+# * `create_text_file`: Creates/overwrites a file in the project directory.
+# * `delete_lines`: Deletes a range of lines within a file.
+# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
+# * `execute_shell_command`: Executes a shell command.
+# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
+# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
+# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
+# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
+# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
+# * `initial_instructions`: Gets the initial instructions for the current project.
+# Should only be used in settings where the system prompt cannot be set,
+# e.g. in clients you have no control over, like Claude Desktop.
+# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
+# * `insert_at_line`: Inserts content at a given line in a file.
+# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
+# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
+# * `list_memories`: Lists memories in Serena's project-specific memory store.
+# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
+# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
+# * `read_file`: Reads a file within the project directory.
+# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
+# * `remove_project`: Removes a project from the Serena configuration.
+# * `replace_lines`: Replaces a range of lines within a file with new content.
+# * `replace_symbol_body`: Replaces the full definition of a symbol.
+# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
+# * `search_for_pattern`: Performs a search for a pattern in the project.
+# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
+# * `switch_modes`: Activates modes by providing a list of their names
+# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
+# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
+# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
+# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
+excluded_tools: []
+
+# initial prompt for the project. It will always be given to the LLM upon activating the project
+# (contrary to the memories, which are loaded on demand).
+initial_prompt: ""
+
+project_name: "eSIM-Tools"
+included_optional_tools: []
diff --git a/env.example b/env.example
index 2032d52..3ec352a 100644
--- a/env.example
+++ b/env.example
@@ -20,7 +20,7 @@ ALLOWED_ORIGIN=https://esim.cosr.eu.org
# 安全配置
COOKIE_SECRET=your-secret-key-here
# 受保护函数访问密钥(要求调用方在 Header x-esim-key 或 body.authKey / ?authKey 携带匹配值)
-ACCESS_KEY=please_change_me
+ACCESS_KEY=please_change_me # 必填:Server 与 Functions/BFF 共享的访问密钥
# 可选:自定义API超时时间(毫秒)
-API_TIMEOUT=30000
\ No newline at end of file
+API_TIMEOUT=30000
diff --git a/index.html b/index.html
index 41bcce7..ee52163 100644
--- a/index.html
+++ b/index.html
@@ -32,8 +32,6 @@
-
-