跳到正文

剪贴板

剪贴板 j6b06r21

原文
剪贴板信息

剪贴板信息

收录
更新

如果你在保存站的话,记得先刷新再阅读hh

本作品仅供个人娱乐,无恶意代码

  • 最近更新:2025/10/01
  • 当前版本:V0.6.3.35

具体效果:

  1. 进入 https://www.luogu.com.cn 时,显示动画(随时可按 Esc 或 双击鼠标左键 结束):
时间段效果
11~2.52.5s淡入 miHoYo 背景
4.54.5~66s淡出 miHoYo 背景
77~8.58.5s淡入《原神·空月之歌》背景
11.511.5~12.2512.25s淡出《原神·空月之歌》背景
12.2512.25~1313s淡入《警告:游戏前详约》
1616~17.517.5s淡出《警告:游戏前详约》
1919~2020s淡出白色背景,进入Luogu
  1. 在 https://www.luogu.com.cn ,https://ti.luogu.com.cn,https://class.luogu.com.cn 以及它们的所有子域名下,鼠标将变为《原神·空月之歌》光标:

  2. 评测界面,AC变为草,WA变为火,RE变为雷,TLE变为冰,MLE变为岩

  3. 在个人主页可以正常显示个人简介

  4. 右下角存在一个设置图标,可控制

    • 是否在进入 https://www.luogu.com.cn 时播放 1. 中的启动图片
    • 控制启动图片的播放倍速
    • 启动《云·原神》
    • 设置备注,将会把页面上的所有文本按照备注进行替换
    • 可添加备忘录、倒计时,将会在备忘录或倒计时时间到时进行提醒
    • 可使用秒表功能进行正计时
C++
// ==UserScript==
// @name         《原神·空月之歌》,启动!
// @namespace    http://tampermonkey.net/
// @version      0.6.3.35
// @description  模拟启动《原神·空月之歌》,支持Esc键或双击结束动画,带自定义光标,并美化评测界面状态,同时显示个人主页隐藏的介绍并移除维护提示,添加设置图标和对话框,支持备注功能,可调节动画倍速,新增备忘录和定时器功能
// @author       MRRlly
// @match        https://www.luogu.com.cn
// @match        https://www.luogu.com.cn/*
// @match        https://ti.luogu.com.cn/*
// @match        https://class.luogu.com.cn/*
// @icon         https://www.luogu.com.cn/favicon.ico
// @grant        GM_addStyle
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    console.log('原神启动动画脚本开始执行...');

    // ==================== 自定义光标功能 ====================
    // 添加自定义鼠标样式
    const style = document.createElement('style');
    style.textContent = `
        /* 隐藏默认鼠标指针 */
        body, body * {
            cursor: none !important;
        }

        /* 选择文本时显示默认光标 */
        body.selecting-text, body.selecting-text * {
            cursor: text !important;
        }

        /* 在编辑对话框内显示默认鼠标指针 */
        .notes-edit-dialog,
        .notes-edit-dialog *,
        .memo-edit-dialog,
        .memo-edit-dialog *,
        .timer-edit-dialog,
        .timer-edit-dialog *,
        .reminder-dialog,
        .reminder-dialog * {
            cursor: auto !important;
        }

        /* 自定义鼠标指针 */
        .custom-cursor {
            position: fixed;
            top: 0;
            left: 0;
            width: 32px;
            height: 32px;
            pointer-events: none;
            z-index: 1000000;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/p5mcgxhq.png');
            background-size: contain;
            background-repeat: no-repeat;
        }

        /* 选择文本时隐藏自定义光标 */
        body.selecting-text .custom-cursor {
            display: none;
        }

        /* 鼠标离开页面时隐藏光标 */
        .custom-cursor.hidden {
            display: none;
        }

        /* 设置图标样式 */
        .settings-icon {
            position: fixed;
            bottom: 20px;
            right: 20px;
            opacity: 0.5;
            transition: opacity 0.3s ease, filter 0.2s ease;
            z-index: 999998;
            cursor: pointer;
            user-select: none;
            -webkit-user-drag: none;
            width: auto;
            height: 50px; /* 固定高度 */
        }

        .settings-icon:hover {
            opacity: 1;
            transition: opacity 0.3s ease;
        }

        .settings-icon:active {
            filter: brightness(1.2); /* 点击时增加亮度 */
        }

        /* 闪烁动画 */
        @keyframes blink {
            0% { opacity: 1; }
            50% { opacity: 0.3; }
            100% { opacity: 1; }
        }

        .settings-icon.blinking {
            animation: blink 1s infinite;
            opacity: 1 !important;
        }

        /* 一级对话框样式 */
        .dialog-box {
            position: fixed;
            right: 80px; /* 在设置图标左侧,几乎紧贴 */
            bottom: 20px;
            z-index: 999999;
            width: 250px; /* 增加宽度以容纳更多控件 */
            height: 240px; /* 增加高度以容纳更多控件 */
            opacity: 0;
            transition: opacity 0.3s ease;
            pointer-events: none;
            background-color: rgba(255, 255, 255, 0.9);
            border-radius: 10px;
            padding: 15px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            align-items: center;
        }

        .dialog-box.show {
            opacity: 1;
            pointer-events: auto;
        }

        .dialog-box img {
            display: none; /* 隐藏原始图片 */
        }

        /* 二级对话框样式 */
        .secondary-dialog-box {
            position: fixed;
            right: 340px; /* 在一级对话框左侧 */
            bottom: 20px;
            z-index: 999999;
            width: 200px;
            height: 120px;
            opacity: 0;
            transition: opacity 0.3s ease;
            pointer-events: none;
            background-color: rgba(255, 255, 255, 0.9);
            border-radius: 10px;
            padding: 10px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .secondary-dialog-box.show {
            opacity: 1;
            pointer-events: auto;
        }

        /* 开关样式 */
        .switch-container {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            width: 100%;
            justify-content: space-between;
        }

        .switch-label {
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 14px;
            color: #333;
            margin-right: 10px;
        }

        .switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 24px;
        }

        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 24px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 3px;
            bottom: 3px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked + .slider {
            background-color: #4CAF50;
        }

        input:checked + .slider:before {
            transform: translateX(26px);
        }

        /* 动画倍速控制样式 */
        .speed-control-container {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            width: 100%;
            justify-content: space-between;
        }

        .speed-label {
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 14px;
            color: #333;
            margin-right: 10px;
            white-space: nowrap;
        }

        .speed-input {
            width: 60px;
            padding: 4px 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 14px;
            text-align: center;
        }

        .speed-input:disabled {
            background-color: #f5f5f5;
            color: #999;
            cursor: not-allowed;
        }

        .speed-slider {
            width: 80px; /* 缩短滑动条 */
            margin: 0 10px;
            height: 5px;
            background: #ddd;
            border-radius: 5px;
            outline: none;
            -webkit-appearance: none;
        }

        .speed-slider:disabled {
            background: #eee;
            cursor: not-allowed;
        }

        .speed-slider:disabled::-webkit-slider-thumb {
            background: #999;
            cursor: not-allowed;
        }

        .speed-slider:disabled::-moz-range-thumb {
            background: #999;
            cursor: not-allowed;
        }

        .speed-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 16px;
            height: 16px;
            background: #4CAF50;
            border-radius: 50%;
            cursor: pointer;
        }

        .speed-slider::-moz-range-thumb {
            width: 16px;
            height: 16px;
            background: #4CAF50;
            border-radius: 50%;
            cursor: pointer;
            border: none;
        }

        /* 按钮样式 */
        .cloud-genshin-btn, .notes-settings-btn, .modify-notes-btn, .memo-timer-btn {
            display: block;
            width: 100%;
            padding: 8px 12px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 14px;
            cursor: pointer;
            transition: background-color 0.3s ease;
            text-align: center;
            text-decoration: none;
            margin-bottom: 10px;
        }

        .cloud-genshin-btn:hover, .notes-settings-btn:hover, .modify-notes-btn:hover, .memo-timer-btn:hover {
            background-color: #45a049;
        }

        .cloud-genshin-btn:active, .notes-settings-btn:active, .modify-notes-btn:active, .memo-timer-btn:active {
            background-color: #3d8b40;
        }

        /* 备注设置对话框样式 */
        .notes-dialog-box {
            position: fixed;
            right: 340px; /* 在主对话框左侧 */
            bottom: 20px;
            z-index: 999999;
            width: 200px;
            height: 100px; /* 较小的高度,只包含开关和按钮 */
            opacity: 0;
            transition: opacity 0.3s ease;
            pointer-events: none;
            background-color: rgba(255, 255, 255, 0.9);
            border-radius: 10px;
            padding: 10px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .notes-dialog-box.show {
            opacity: 1;
            pointer-events: auto;
        }

        /* 提醒对话框样式 */
        .reminder-dialog {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 10000001;
            width: 300px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            padding: 20px;
            display: none;
            flex-direction: column;
        }

        .reminder-dialog.show {
            display: flex;
        }

        .reminder-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid #eee;
        }

        .reminder-title {
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 18px;
            font-weight: bold;
            color: #333;
        }

        .reminder-close {
            width: 20px;
            height: 20px;
            cursor: pointer;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/mzcwqoob.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        .reminder-content {
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 16px;
            color: #333;
            margin-bottom: 20px;
        }

        .reminder-actions {
            display: flex;
            justify-content: flex-end;
        }

        .reminder-confirm {
            padding: 8px 15px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 14px;
        }

        .reminder-confirm:hover {
            background-color: #45a049;
        }

        /* 备注编辑对话框样式 */
        .notes-edit-dialog {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 10000000;
            width: 500px;
            max-width: 90%;
            max-height: 80%;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            display: none;
            flex-direction: column;
            overflow: hidden;
        }

        .notes-edit-dialog.show {
            display: flex;
        }

        .notes-edit-header {
            display: flex;
            justify-content: flex-end;
            padding: 10px;
            background-color: #f5f5f5;
            border-bottom: 1px solid #ddd;
        }

        .notes-edit-close {
            width: 20px;
            height: 20px;
            cursor: pointer;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/mzcwqoob.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        .notes-edit-content {
            padding: 20px;
            overflow-y: auto;
            flex-grow: 1;
        }

        .notes-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 15px;
        }

        .notes-table th, .notes-table td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }

        .notes-table th {
            background-color: #f2f2f2;
        }

        .notes-table input {
            width: 100%;
            padding: 5px;
            border: 1px solid #ccc;
            border-radius: 3px;
            box-sizing: border-box;
        }

        .notes-edit-buttons {
            display: flex;
            justify-content: space-between;
            margin-top: 15px;
        }

        .add-row-btn, .save-notes-btn {
            padding: 8px 15px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 14px;
        }

        .add-row-btn:hover, .save-notes-btn:hover {
            background-color: #45a049;
        }

        .delete-row-btn {
            padding: 5px 10px;
            background-color: #f44336;
            color: white;
            border: none;
            border-radius: 3px;
            cursor: pointer;
            font-size: 12px;
        }

        .delete-row-btn:hover {
            background-color: #d32f2f;
        }

        /* 备忘录编辑对话框样式 */
        .memo-edit-dialog {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 10000000;
            width: 700px;
            max-width: 90%;
            max-height: 80%;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            display: none;
            flex-direction: column;
            overflow: hidden;
        }

        .memo-edit-dialog.show {
            display: flex;
        }

        .memo-edit-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 20px;
            background-color: #f5f5f5;
            border-bottom: 1px solid #ddd;
        }

        .memo-edit-title {
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 18px;
            font-weight: bold;
            color: #333;
        }

        .memo-edit-close {
            width: 20px;
            height: 20px;
            cursor: pointer;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/mzcwqoob.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        .memo-edit-content {
            padding: 20px;
            overflow-y: auto;
            flex-grow: 1;
        }

        .memo-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 15px;
        }

        .memo-table th, .memo-table td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }

        .memo-table th {
            background-color: #f2f2f2;
        }

        .memo-table input[type="text"] {
            width: 100%;
            padding: 5px;
            border: 1px solid #ccc;
            border-radius: 3px;
            box-sizing: border-box;
        }

        .memo-table input[type="datetime-local"] {
            width: 100%;
            padding: 5px;
            border: 1px solid #ccc;
            border-radius: 3px;
            box-sizing: border-box;
        }

        .memo-edit-buttons {
            display: flex;
            justify-content: space-between;
            margin-top: 15px;
        }

        .add-memo-row-btn, .save-memo-btn {
            padding: 8px 15px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 14px;
        }

        .add-memo-row-btn:hover, .save-memo-btn:hover {
            background-color: #45a049;
        }

        /* 定时器编辑对话框样式 */
        .timer-edit-dialog {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 10000000;
            width: 400px;
            max-width: 90%;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            display: none;
            flex-direction: column;
            overflow: hidden;
        }

        .timer-edit-dialog.show {
            display: flex;
        }

        .timer-edit-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 20px;
            background-color: #f5f5f5;
            border-bottom: 1px solid #ddd;
        }

        .timer-edit-title {
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 18px;
            font-weight: bold;
            color: #333;
        }

        .timer-edit-close {
            width: 20px;
            height: 20px;
            cursor: pointer;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/mzcwqoob.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        .timer-edit-content {
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .timer-type-selector {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
        }

        .timer-type-btn {
            padding: 8px 15px;
            background-color: #e0e0e0;
            color: #333;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 14px;
            flex: 1;
        }

        .timer-type-btn.active {
            background-color: #4CAF50;
            color: white;
        }

        .timer-input-group {
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .timer-input {
            width: 60px;
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
            text-align: center;
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 14px;
        }

        .timer-input-label {
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 14px;
            color: #333;
        }

        .timer-display {
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 24px;
            text-align: center;
            margin: 10px 0;
            padding: 10px;
            background-color: #f5f5f5;
            border-radius: 5px;
        }

        .timer-controls {
            display: flex;
            gap: 10px;
            justify-content: center;
        }

        .timer-start-btn, .timer-stop-btn, .timer-reset-btn {
            padding: 8px 15px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 14px;
        }

        .timer-start-btn {
            background-color: #4CAF50;
            color: white;
        }

        .timer-stop-btn {
            background-color: #f44336;
            color: white;
        }

        .timer-reset-btn {
            background-color: #ff9800;
            color: white;
        }

        /* AC状态美化样式 */
        .ac-image-replacement {
            display: inline-block;
            width: 80px;
            height: 32px;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/e6nuh9n0.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            vertical-align: middle;
        }

        /* WA状态美化样式 */
        .wa-image-replacement {
            display: inline-block;
            width: 80px;
            height: 32px;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/z1t5zhdl.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            vertical-align: middle;
        }

        /* RE状态美化样式 */
        .re-image-replacement {
            display: inline-block;
            width: 80px;
            height: 32px;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/tgiky6r6.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            vertical-align: middle;
        }

        /* TLE状态美化样式 - 修改为只显示图片 */
        .tle-image-replacement {
            display: inline-block;
            width: 80px;
            height: 32px;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/lltewjds.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            vertical-align: middle;
        }

        /* MLE状态美化样式 - 修改为只显示图片 */
        .mle-image-replacement {
            display: inline-block;
            width: 80px;
            height: 32px;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/4yinxvkr.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            vertical-align: middle;
        }

        /* 保持原有布局不变 */
        .record-status .lg-badge {
            min-width: 80px;
            text-indent: -9999px;
            overflow: hidden;
            position: relative;
            height: 32px;
        }

        .record-status .lg-badge.ac-replaced::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/e6nuh9n0.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        .record-status .lg-badge.wa-replaced::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/z1t5zhdl.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        .record-status .lg-badge.re-replaced::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/tgiky6r6.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        /* TLE状态在record-status中的样式 */
        .record-status .lg-badge.tle-replaced::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/lltewjds.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        /* MLE状态在record-status中的样式 */
        .record-status .lg-badge.mle-replaced::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/4yinxvkr.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        /* 针对其他可能包含状态的元素 */
        .status.ac, .result.ac, [class*="status"].ac, [class*="result"].ac,
        .status.wa, .result.wa, [class*="status"].wa, [class*="result"].wa,
        .status.re, .result.re, [class*="status"].re, [class*="result"].re,
        .status.tle, .result.tle, [class*="status"].tle, [class*="result"].tle,
        .status.mle, .result.mle, [class*="status"].mle, [class*="result"].mle {
            min-width: 80px;
            text-indent: -9999px;
            overflow: hidden;
            position: relative;
            height: 32px;
        }

        .status.ac::after, .result.ac::after,
        [class*="status"].ac::after, [class*="result"].ac::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/e6nuh9n0.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        .status.wa::after, .result.wa::after,
        [class*="status"].wa::after, [class*="result"].wa::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/z1t5zhdl.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        .status.re::after, .result.re::after,
        [class*="status"].re::after, [class*="result"].re::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/tgiky6r6.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        .status.tle::after, .result.tle::after,
        [class*="status"].tle::after, [class*="result"].tle::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/lltewjds.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        .status.mle::after, .result.mle::after,
        [class*="status"].mle::after, [class*="result"].mle::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url('https://cdn.luogu.com.cn/upload/image_hosting/4yinxvkr.png');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }
    `;
    document.head.appendChild(style);

    // ==================== 动画倍速功能 ====================
    // 加载动画倍速设置
    function loadAnimationSpeed() {
        const speed = parseFloat(localStorage.getItem('animationSpeed') || '1.00');
        // 确保速度在有效范围内
        return Math.min(Math.max(speed, 0.1), 20.00);
    }

    // 保存动画倍速设置
    function saveAnimationSpeed(speed) {
        // 限制速度在0.1到20之间,保留两位小数
        const clampedSpeed = Math.min(Math.max(parseFloat(speed), 0.1), 20.00);
        const roundedSpeed = Math.round(clampedSpeed * 100) / 100;
        localStorage.setItem('animationSpeed', roundedSpeed.toString());
        return roundedSpeed;
    }

    // 格式化速度为两位小数
    function formatSpeed(speed) {
        return parseFloat(speed).toFixed(2);
    }

    // ==================== 备忘录功能相关函数 ====================
    // 加载备忘录设置
    function loadMemoSettings() {
        const memoData = JSON.parse(localStorage.getItem('memoData') || '[]');
        return memoData;
    }

    // 保存备忘录设置
    function saveMemoSettings(memoData) {
        localStorage.setItem('memoData', JSON.stringify(memoData));
    }

    // 检查备忘录提醒
    function checkMemoReminders() {
        const memoData = loadMemoSettings();
        const now = new Date().getTime();

        memoData.forEach(memo => {
            if (memo.enabled && !memo.triggered) {
                const memoTime = new Date(memo.time).getTime();
                if (memoTime <= now) {
                    // 触发提醒
                    triggerReminder(memo.event, 'memo');
                    // 标记为已触发
                    memo.triggered = true;
                    saveMemoSettings(memoData);
                }
            }
        });
    }

    // ==================== 定时器功能相关函数 ====================
    // 加载定时器设置
    function loadTimerSettings() {
        const timerData = JSON.parse(localStorage.getItem('timerData') || '{}');
        return timerData;
    }

    // 保存定时器设置
    function saveTimerSettings(timerData) {
        localStorage.setItem('timerData', JSON.stringify(timerData));
    }

    // 检查定时器提醒
    function checkTimerReminders() {
        const timerData = loadTimerSettings();

        if (timerData.active && timerData.endTime && !timerData.triggered) {
            const now = new Date().getTime();
            if (timerData.endTime <= now) {
                // 触发提醒
                triggerReminder('时间到', 'timer');
                // 标记为已触发
                timerData.triggered = true;
                saveTimerSettings(timerData);
            }
        }
    }

    // ==================== 后台计时器功能 ====================
    // 全局定时器变量
    let backgroundTimerInterval = null;

    // 启动后台计时器
    function startBackgroundTimer() {
        // 清除现有的后台计时器
        if (backgroundTimerInterval) {
            clearInterval(backgroundTimerInterval);
        }

        // 每秒检查一次定时器和秒表状态
        backgroundTimerInterval = setInterval(() => {
            // 检查定时器提醒
            checkTimerReminders();

            // 更新正在运行的秒表
            updateRunningStopwatches();

            // 更新正在运行的倒计时
            updateRunningCountdowns();
        }, 1000);
    }

    // 更新正在运行的秒表
    function updateRunningStopwatches() {
        const timerData = loadTimerSettings();

        // 检查是否有正在运行的秒表
        if (timerData.type === 'stopwatch' && timerData.status === 'running' && timerData.startTime) {
            const currentTime = new Date().getTime();
            const elapsed = currentTime - timerData.startTime;

            // 更新秒表时间
            timerData.elapsed = elapsed;
            saveTimerSettings(timerData);
        }
    }

    // 更新正在运行的倒计时
    function updateRunningCountdowns() {
        const timerData = loadTimerSettings();

        // 检查是否有正在运行的倒计时
        if (timerData.type === 'countdown' && timerData.status === 'running' && timerData.endTime) {
            const currentTime = new Date().getTime();
            const remaining = timerData.endTime - currentTime;

            if (remaining <= 0) {
                // 倒计时结束
                timerData.status = 'stopped';
                timerData.triggered = true;
                saveTimerSettings(timerData);

                // 触发提醒
                triggerReminder('时间到', 'timer');
            }
        }
    }

    // ==================== 提醒功能相关函数 ====================
    let isBlinking = false;
    let reminderActive = false;

    // 触发提醒
    function triggerReminder(content, type) {
        // 开始闪烁
        startBlinking();
        reminderActive = true;

        // 显示提醒对话框
        showReminderDialog(content, type);
    }

    // 开始闪烁
    function startBlinking() {
        if (isBlinking) return;

        isBlinking = true;
        const settingsIcon = document.querySelector('.settings-icon');
        if (settingsIcon) {
            settingsIcon.classList.add('blinking');
        }
    }

    // 停止闪烁
    function stopBlinking() {
        isBlinking = false;
        reminderActive = false;
        const settingsIcon = document.querySelector('.settings-icon');
        if (settingsIcon) {
            settingsIcon.classList.remove('blinking');
        }
    }

    // 显示提醒对话框
    function showReminderDialog(content, type) {
        // 创建或获取提醒对话框
        let reminderDialog = document.querySelector('.reminder-dialog');

        if (!reminderDialog) {
            reminderDialog = document.createElement('div');
            reminderDialog.className = 'reminder-dialog';

            const header = document.createElement('div');
            header.className = 'reminder-header';

            const title = document.createElement('div');
            title.className = 'reminder-title';
            title.textContent = '提醒';

            const closeBtn = document.createElement('div');
            closeBtn.className = 'reminder-close';
            closeBtn.title = '关闭';

            header.appendChild(title);
            header.appendChild(closeBtn);

            const contentDiv = document.createElement('div');
            contentDiv.className = 'reminder-content';

            const actions = document.createElement('div');
            actions.className = 'reminder-actions';

            const confirmBtn = document.createElement('button');
            confirmBtn.className = 'reminder-confirm';
            confirmBtn.textContent = '确定';

            actions.appendChild(confirmBtn);

            reminderDialog.appendChild(header);
            reminderDialog.appendChild(contentDiv);
            reminderDialog.appendChild(actions);

            document.body.appendChild(reminderDialog);

            // 事件监听
            closeBtn.addEventListener('click', () => {
                reminderDialog.classList.remove('show');
                stopBlinking();
            });

            confirmBtn.addEventListener('click', () => {
                reminderDialog.classList.remove('show');
                stopBlinking();
            });
        }

        // 设置内容
        const contentDiv = reminderDialog.querySelector('.reminder-content');
        contentDiv.textContent = content;

        // 显示对话框
        reminderDialog.classList.add('show');
    }

    // ==================== 定期检查提醒 ====================
    function startReminderCheck() {
        // 启动后台计时器
        startBackgroundTimer();

        // 每秒检查一次备忘录
        setInterval(() => {
            checkMemoReminders();
        }, 1000);
    }

    // ==================== 备注功能相关函数 ====================
    // 加载备注设置
    function loadNotesSettings() {
        const notesEnabled = localStorage.getItem('notesEnabled') !== 'false'; // 默认开启
        const notesData = JSON.parse(localStorage.getItem('notesData') || '[]');
        return { notesEnabled, notesData };
    }

    // 保存备注设置
    function saveNotesSettings(notesEnabled, notesData) {
        localStorage.setItem('notesEnabled', notesEnabled.toString());
        localStorage.setItem('notesData', JSON.stringify(notesData));
    }

    // 替换文本中的原名
    function replaceOriginalNames() {
        const { notesEnabled, notesData } = loadNotesSettings();

        if (!notesEnabled || notesData.length === 0) {
            return;
        }

        // 遍历所有文本节点
        const walker = document.createTreeWalker(
            document.body,
            NodeFilter.SHOW_TEXT,
            null,
            false
        );

        let node;
        while (node = walker.nextNode()) {
            let text = node.textContent;
            let replaced = false;

            // 对每个备注规则进行替换
            notesData.forEach(note => {
                if (note.original && note.note && text.includes(note.original)) {
                    text = text.replace(new RegExp(escapeRegExp(note.original), 'g'), note.note);
                    replaced = true;
                }
            });

            if (replaced) {
                node.textContent = text;
            }
        }
    }

    // 转义正则表达式特殊字符
    function escapeRegExp(string) {
        return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    }

    // 创建备注编辑对话框
    function createNotesEditDialog() {
        const dialog = document.createElement('div');
        dialog.className = 'notes-edit-dialog';

        // 头部 - 关闭按钮
        const header = document.createElement('div');
        header.className = 'notes-edit-header';

        const closeBtn = document.createElement('div');
        closeBtn.className = 'notes-edit-close';
        closeBtn.title = '关闭';

        header.appendChild(closeBtn);
        dialog.appendChild(header);

        // 内容区域
        const content = document.createElement('div');
        content.className = 'notes-edit-content';

        // 创建表格
        const table = document.createElement('table');
        table.className = 'notes-table';

        // 表头
        const thead = document.createElement('thead');
        const headerRow = document.createElement('tr');

        const th1 = document.createElement('th');
        th1.textContent = '原名';

        const th2 = document.createElement('th');
        th2.textContent = '备注名';

        const th3 = document.createElement('th');
        th3.textContent = '操作';

        headerRow.appendChild(th1);
        headerRow.appendChild(th2);
        headerRow.appendChild(th3);
        thead.appendChild(headerRow);
        table.appendChild(thead);

        // 表体
        const tbody = document.createElement('tbody');
        table.appendChild(tbody);

        content.appendChild(table);

        // 按钮区域
        const buttons = document.createElement('div');
        buttons.className = 'notes-edit-buttons';

        const addRowBtn = document.createElement('button');
        addRowBtn.className = 'add-row-btn';
        addRowBtn.textContent = '添加行';

        const saveBtn = document.createElement('button');
        saveBtn.className = 'save-notes-btn';
        saveBtn.textContent = '保存';

        buttons.appendChild(addRowBtn);
        buttons.appendChild(saveBtn);
        content.appendChild(buttons);

        dialog.appendChild(content);

        document.body.appendChild(dialog);

        // 加载现有数据
        const { notesData } = loadNotesSettings();
        populateTable(tbody, notesData);

        // 事件监听
        closeBtn.addEventListener('click', () => {
            dialog.classList.remove('show');
        });

        addRowBtn.addEventListener('click', () => {
            addTableRow(tbody);
        });

        saveBtn.addEventListener('click', () => {
            saveTableData(tbody);
            dialog.classList.remove('show');
        });

        return dialog;
    }

    // 填充表格数据
    function populateTable(tbody, notesData) {
        tbody.innerHTML = '';

        if (notesData.length === 0) {
            addTableRow(tbody);
        } else {
            notesData.forEach(note => {
                addTableRow(tbody, note.original, note.note);
            });
        }
    }

    // 添加表格行
    function addTableRow(tbody, original = '', note = '') {
        const row = document.createElement('tr');

        // 原名输入框
        const td1 = document.createElement('td');
        const input1 = document.createElement('input');
        input1.type = 'text';
        input1.value = original;
        input1.placeholder = '输入原名';
        td1.appendChild(input1);

        // 备注名输入框
        const td2 = document.createElement('td');
        const input2 = document.createElement('input');
        input2.type = 'text';
        input2.value = note;
        input2.placeholder = '输入备注名';
        td2.appendChild(input2);

        // 删除按钮
        const td3 = document.createElement('td');
        const deleteBtn = document.createElement('button');
        deleteBtn.className = 'delete-row-btn';
        deleteBtn.textContent = '删除';
        deleteBtn.addEventListener('click', () => {
            if (tbody.children.length > 1) {
                tbody.removeChild(row);
            } else {
                // 如果是最后一行,清空输入框
                input1.value = '';
                input2.value = '';
            }
        });
        td3.appendChild(deleteBtn);

        row.appendChild(td1);
        row.appendChild(td2);
        row.appendChild(td3);
        tbody.appendChild(row);
    }

    // 保存表格数据
    function saveTableData(tbody) {
        const notesData = [];
        const rows = tbody.querySelectorAll('tr');

        rows.forEach(row => {
            const inputs = row.querySelectorAll('input');
            if (inputs.length >= 2) {
                const original = inputs[0].value.trim();
                const note = inputs[1].value.trim();

                if (original && note) {
                    notesData.push({ original, note });
                }
            }
        });

        const { notesEnabled } = loadNotesSettings();
        saveNotesSettings(notesEnabled, notesData);

        // 重新应用文本替换
        replaceOriginalNames();

        console.log('备注数据已保存:', notesData);
    }

    // ==================== 备忘录编辑对话框 ====================
    function createMemoEditDialog() {
        const dialog = document.createElement('div');
        dialog.className = 'memo-edit-dialog';

        // 头部
        const header = document.createElement('div');
        header.className = 'memo-edit-header';

        const title = document.createElement('div');
        title.className = 'memo-edit-title';
        title.textContent = '备忘录管理';

        const closeBtn = document.createElement('div');
        closeBtn.className = 'memo-edit-close';
        closeBtn.title = '关闭';

        header.appendChild(title);
        header.appendChild(closeBtn);
        dialog.appendChild(header);

        // 内容区域
        const content = document.createElement('div');
        content.className = 'memo-edit-content';

        // 创建表格
        const table = document.createElement('table');
        table.className = 'memo-table';

        // 表头
        const thead = document.createElement('thead');
        const headerRow = document.createElement('tr');

        const th1 = document.createElement('th');
        th1.textContent = '事件';

        const th2 = document.createElement('th');
        th2.textContent = '时间';

        const th3 = document.createElement('th');
        th3.textContent = '开启';

        const th4 = document.createElement('th');
        th4.textContent = '删除';

        headerRow.appendChild(th1);
        headerRow.appendChild(th2);
        headerRow.appendChild(th3);
        headerRow.appendChild(th4);
        thead.appendChild(headerRow);
        table.appendChild(thead);

        // 表体
        const tbody = document.createElement('tbody');
        table.appendChild(tbody);

        content.appendChild(table);

        // 按钮区域
        const buttons = document.createElement('div');
        buttons.className = 'memo-edit-buttons';

        const addRowBtn = document.createElement('button');
        addRowBtn.className = 'add-memo-row-btn';
        addRowBtn.textContent = '添加行';

        const saveBtn = document.createElement('button');
        saveBtn.className = 'save-memo-btn';
        saveBtn.textContent = '保存';

        buttons.appendChild(addRowBtn);
        buttons.appendChild(saveBtn);
        content.appendChild(buttons);

        dialog.appendChild(content);

        document.body.appendChild(dialog);

        // 加载现有数据
        const memoData = loadMemoSettings();
        populateMemoTable(tbody, memoData);

        // 事件监听
        closeBtn.addEventListener('click', () => {
            dialog.classList.remove('show');
        });

        addRowBtn.addEventListener('click', () => {
            addMemoTableRow(tbody);
        });

        saveBtn.addEventListener('click', () => {
            saveMemoTableData(tbody);
            dialog.classList.remove('show');
        });

        return dialog;
    }

    // 填充备忘录表格数据
    function populateMemoTable(tbody, memoData) {
        tbody.innerHTML = '';

        if (memoData.length === 0) {
            addMemoTableRow(tbody);
        } else {
            memoData.forEach(memo => {
                addMemoTableRow(tbody, memo.event, memo.time, memo.enabled);
            });
        }
    }

    // 添加备忘录表格行
    function addMemoTableRow(tbody, event = '', time = '', enabled = true) {
        const row = document.createElement('tr');

        // 事件输入框
        const td1 = document.createElement('td');
        const input1 = document.createElement('input');
        input1.type = 'text';
        input1.value = event;
        input1.placeholder = '输入事件';
        td1.appendChild(input1);

        // 时间输入框
        const td2 = document.createElement('td');
        const input2 = document.createElement('input');
        input2.type = 'datetime-local';

        // 设置默认时间为当前时间+1小时
        const now = new Date();
        now.setHours(now.getHours() + 1);
        const defaultTime = now.toISOString().slice(0, 16);

        input2.value = time || defaultTime;
        td2.appendChild(input2);

        // 开启开关
        const td3 = document.createElement('td');
        const switchLabel = document.createElement('label');
        switchLabel.className = 'switch';

        const switchInput = document.createElement('input');
        switchInput.type = 'checkbox';
        switchInput.checked = enabled;

        const switchSlider = document.createElement('span');
        switchSlider.className = 'slider';

        switchLabel.appendChild(switchInput);
        switchLabel.appendChild(switchSlider);
        td3.appendChild(switchLabel);

        // 删除按钮
        const td4 = document.createElement('td');
        const deleteBtn = document.createElement('button');
        deleteBtn.className = 'delete-row-btn';
        deleteBtn.textContent = '删除';
        deleteBtn.addEventListener('click', () => {
            if (tbody.children.length > 1) {
                tbody.removeChild(row);
            } else {
                // 如果是最后一行,清空输入框
                input1.value = '';
                input2.value = defaultTime;
                switchInput.checked = true;
            }
        });
        td4.appendChild(deleteBtn);

        row.appendChild(td1);
        row.appendChild(td2);
        row.appendChild(td3);
        row.appendChild(td4);
        tbody.appendChild(row);
    }

    // 保存备忘录表格数据
    function saveMemoTableData(tbody) {
        const memoData = [];
        const rows = tbody.querySelectorAll('tr');

        rows.forEach(row => {
            const inputs = row.querySelectorAll('input');
            if (inputs.length >= 3) {
                const event = inputs[0].value.trim();
                const time = inputs[1].value;
                const enabled = inputs[2].checked;

                if (event && time) {
                    memoData.push({
                        event,
                        time,
                        enabled,
                        triggered: false
                    });
                }
            }
        });

        saveMemoSettings(memoData);
        console.log('备忘录数据已保存:', memoData);
    }

    // ==================== 定时器编辑对话框 ====================
    function createTimerEditDialog() {
        const dialog = document.createElement('div');
        dialog.className = 'timer-edit-dialog';

        // 头部
        const header = document.createElement('div');
        header.className = 'timer-edit-header';

        const title = document.createElement('div');
        title.className = 'timer-edit-title';
        title.textContent = '定时器';

        const closeBtn = document.createElement('div');
        closeBtn.className = 'timer-edit-close';
        closeBtn.title = '关闭';

        header.appendChild(title);
        header.appendChild(closeBtn);
        dialog.appendChild(header);

        // 内容区域
        const content = document.createElement('div');
        content.className = 'timer-edit-content';

        // 定时器类型选择
        const typeSelector = document.createElement('div');
        typeSelector.className = 'timer-type-selector';

        const countdownBtn = document.createElement('button');
        countdownBtn.className = 'timer-type-btn active';
        countdownBtn.textContent = '倒计时';
        countdownBtn.dataset.type = 'countdown';

        const stopwatchBtn = document.createElement('button');
        stopwatchBtn.className = 'timer-type-btn';
        stopwatchBtn.textContent = '秒表';
        stopwatchBtn.dataset.type = 'stopwatch';

        typeSelector.appendChild(countdownBtn);
        typeSelector.appendChild(stopwatchBtn);
        content.appendChild(typeSelector);

        // 倒计时输入区域
        const countdownInput = document.createElement('div');
        countdownInput.className = 'timer-input-group';
        countdownInput.id = 'countdown-input';

        const hoursInput = document.createElement('input');
        hoursInput.type = 'number';
        hoursInput.className = 'timer-input';
        hoursInput.min = '0';
        hoursInput.max = '23';
        hoursInput.value = '0';
        hoursInput.placeholder = '0';

        const hoursLabel = document.createElement('span');
        hoursLabel.className = 'timer-input-label';
        hoursLabel.textContent = '时';

        const minutesInput = document.createElement('input');
        minutesInput.type = 'number';
        minutesInput.className = 'timer-input';
        minutesInput.min = '0';
        minutesInput.max = '59';
        minutesInput.value = '0';
        minutesInput.placeholder = '0';

        const minutesLabel = document.createElement('span');
        minutesLabel.className = 'timer-input-label';
        minutesLabel.textContent = '分';

        const secondsInput = document.createElement('input');
        secondsInput.type = 'number';
        secondsInput.className = 'timer-input';
        secondsInput.min = '0';
        secondsInput.max = '59';
        secondsInput.value = '10';
        secondsInput.placeholder = '0';

        const secondsLabel = document.createElement('span');
        secondsLabel.className = 'timer-input-label';
        secondsLabel.textContent = '秒';

        countdownInput.appendChild(hoursInput);
        countdownInput.appendChild(hoursLabel);
        countdownInput.appendChild(minutesInput);
        countdownInput.appendChild(minutesLabel);
        countdownInput.appendChild(secondsInput);
        countdownInput.appendChild(secondsLabel);
        content.appendChild(countdownInput);

        // 秒表显示区域
        const stopwatchDisplay = document.createElement('div');
        stopwatchDisplay.className = 'timer-display';
        stopwatchDisplay.id = 'stopwatch-display';
        stopwatchDisplay.style.display = 'none';
        stopwatchDisplay.textContent = '00:00:00';
        content.appendChild(stopwatchDisplay);

        // 倒计时显示区域
        const countdownDisplay = document.createElement('div');
        countdownDisplay.className = 'timer-display';
        countdownDisplay.id = 'countdown-display';
        countdownDisplay.textContent = '00:00:10';
        content.appendChild(countdownDisplay);

        // 控制按钮
        const controls = document.createElement('div');
        controls.className = 'timer-controls';

        const startBtn = document.createElement('button');
        startBtn.className = 'timer-start-btn';
        startBtn.textContent = '开始';

        const stopBtn = document.createElement('button');
        stopBtn.className = 'timer-stop-btn';
        stopBtn.textContent = '停止';
        stopBtn.disabled = true;

        const resetBtn = document.createElement('button');
        resetBtn.className = 'timer-reset-btn';
        resetBtn.textContent = '重置';

        controls.appendChild(startBtn);
        controls.appendChild(stopBtn);
        controls.appendChild(resetBtn);
        content.appendChild(controls);

        dialog.appendChild(content);

        document.body.appendChild(dialog);

        // 定时器状态
        let timerInterval = null;
        let currentType = 'countdown';
        let countdownTime = 10; // 默认10秒
        let stopwatchTime = 0;
        let isRunning = false;

        // 加载保存的定时器状态
        const savedTimerData = loadTimerSettings();
        if (savedTimerData.type) {
            currentType = savedTimerData.type;

            // 更新按钮状态
            if (currentType === 'countdown') {
                countdownBtn.classList.add('active');
                stopwatchBtn.classList.remove('active');
                countdownInput.style.display = 'flex';
                countdownDisplay.style.display = 'block';
                stopwatchDisplay.style.display = 'none';
            } else {
                stopwatchBtn.classList.add('active');
                countdownBtn.classList.remove('active');
                countdownInput.style.display = 'none';
                countdownDisplay.style.display = 'none';
                stopwatchDisplay.style.display = 'block';
            }

            // 恢复计时器状态
            if (savedTimerData.status === 'running') {
                isRunning = true;
                startBtn.disabled = true;
                stopBtn.disabled = false;

                if (currentType === 'countdown' && savedTimerData.endTime) {
                    const now = new Date().getTime();
                    const remaining = Math.max(0, Math.ceil((savedTimerData.endTime - now) / 1000));
                    countdownTime = remaining;
                    updateCountdownDisplay(remaining);

                    timerInterval = setInterval(() => {
                        const now = new Date().getTime();
                        const remaining = Math.max(0, Math.ceil((savedTimerData.endTime - now) / 1000));
                        updateCountdownDisplay(remaining);

                        if (remaining <= 0) {
                            stopTimer();
                            triggerReminder('时间到', 'timer');
                        }
                    }, 1000);
                } else if (currentType === 'stopwatch' && savedTimerData.startTime) {
                    const now = new Date().getTime();
                    stopwatchTime = now - savedTimerData.startTime;
                    updateStopwatchDisplay(stopwatchTime);

                    timerInterval = setInterval(() => {
                        const now = new Date().getTime();
                        stopwatchTime = now - savedTimerData.startTime;
                        updateStopwatchDisplay(stopwatchTime);
                    }, 10);
                }
            }
        }

        // 事件监听
        closeBtn.addEventListener('click', () => {
            dialog.classList.remove('show');
            // 注意:这里不停止计时器,让它在后台继续运行
        });

        // 类型切换
        countdownBtn.addEventListener('click', () => {
            if (currentType === 'countdown') return;

            countdownBtn.classList.add('active');
            stopwatchBtn.classList.remove('active');
            countdownInput.style.display = 'flex';
            countdownDisplay.style.display = 'block';
            stopwatchDisplay.style.display = 'none';

            stopTimer();
            currentType = 'countdown';

            // 保存类型设置
            const timerData = loadTimerSettings();
            timerData.type = 'countdown';
            saveTimerSettings(timerData);
        });

        stopwatchBtn.addEventListener('click', () => {
            if (currentType === 'stopwatch') return;

            stopwatchBtn.classList.add('active');
            countdownBtn.classList.remove('active');
            countdownInput.style.display = 'none';
            countdownDisplay.style.display = 'none';
            stopwatchDisplay.style.display = 'block';

            stopTimer();
            currentType = 'stopwatch';

            // 保存类型设置
            const timerData = loadTimerSettings();
            timerData.type = 'stopwatch';
            saveTimerSettings(timerData);
        });

        // 输入变化
        hoursInput.addEventListener('change', updateCountdownTime);
        minutesInput.addEventListener('change', updateCountdownTime);
        secondsInput.addEventListener('change', updateCountdownTime);

        function updateCountdownTime() {
            const hours = parseInt(hoursInput.value) || 0;
            const minutes = parseInt(minutesInput.value) || 0;
            const seconds = parseInt(secondsInput.value) || 0;

            countdownTime = hours * 3600 + minutes * 60 + seconds;
            updateCountdownDisplay(countdownTime);
        }

        function updateCountdownDisplay(seconds) {
            const hrs = Math.floor(seconds / 3600);
            const mins = Math.floor((seconds % 3600) / 60);
            const secs = seconds % 60;

            countdownDisplay.textContent =
                `${hrs.toString().padStart(2, '0')}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
        }

        function updateStopwatchDisplay(milliseconds) {
            const totalSeconds = Math.floor(milliseconds / 1000);
            const hrs = Math.floor(totalSeconds / 3600);
            const mins = Math.floor((totalSeconds % 3600) / 60);
            const secs = totalSeconds % 60;
            const ms = Math.floor((milliseconds % 1000) / 10);

            stopwatchDisplay.textContent =
                `${hrs.toString().padStart(2, '0')}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}.${ms.toString().padStart(2, '0')}`;
        }

        // 控制按钮
        startBtn.addEventListener('click', startTimer);
        stopBtn.addEventListener('click', stopTimer);
        resetBtn.addEventListener('click', resetTimer);

        function startTimer() {
            if (isRunning) return;

            isRunning = true;
            startBtn.disabled = true;
            stopBtn.disabled = false;

            if (currentType === 'countdown') {
                let remaining = countdownTime;
                updateCountdownDisplay(remaining);

                // 计算结束时间
                const endTime = new Date().getTime() + remaining * 1000;

                // 保存定时器设置
                saveTimerSettings({
                    type: 'countdown',
                    status: 'running',
                    endTime: endTime,
                    initialDuration: countdownTime,
                    triggered: false
                });

                timerInterval = setInterval(() => {
                    const now = new Date().getTime();
                    remaining = Math.max(0, Math.ceil((endTime - now) / 1000));
                    updateCountdownDisplay(remaining);

                    if (remaining <= 0) {
                        stopTimer();
                        triggerReminder('时间到', 'timer');
                    }
                }, 1000);
            } else {
                const startTime = new Date().getTime();

                // 保存定时器设置
                saveTimerSettings({
                    type: 'stopwatch',
                    status: 'running',
                    startTime: startTime,
                    elapsed: 0
                });

                timerInterval = setInterval(() => {
                    const currentTime = new Date().getTime();
                    stopwatchTime = currentTime - startTime;
                    updateStopwatchDisplay(stopwatchTime);
                }, 10);
            }
        }

        function stopTimer() {
            isRunning = false;
            startBtn.disabled = false;
            stopBtn.disabled = true;

            if (timerInterval) {
                clearInterval(timerInterval);
                timerInterval = null;
            }

            const timerData = loadTimerSettings();

            if (currentType === 'countdown') {
                // 停止定时器时保存状态
                const now = new Date().getTime();
                const remaining = Math.max(0, Math.ceil((timerData.endTime - now) / 1000));

                saveTimerSettings({
                    type: 'countdown',
                    status: 'stopped',
                    initialDuration: countdownTime,
                    remaining: remaining,
                    triggered: timerData.triggered || false
                });
            } else {
                // 停止秒表时保存状态
                saveTimerSettings({
                    type: 'stopwatch',
                    status: 'stopped',
                    elapsed: stopwatchTime
                });
            }
        }

        function resetTimer() {
            stopTimer();

            if (currentType === 'countdown') {
                updateCountdownTime();
                // 重置时清除存储的定时器数据
                saveTimerSettings({});
            } else {
                stopwatchTime = 0;
                updateStopwatchDisplay(0);
                // 重置时清除存储的定时器数据
                saveTimerSettings({});
            }
        }

        // 初始化显示
        updateCountdownTime();

        return dialog;
    }

    // ==================== 设置图标和对话框功能 ====================
    function createSettingsIcon() {
        console.log('创建设置图标和对话框...');

        // 创建设置图标
        const settingsIcon = document.createElement('img');
        settingsIcon.src = 'https://cdn.luogu.com.cn/upload/image_hosting/dhp24mp5.png'; // 更换为新图标
        settingsIcon.className = 'settings-icon';
        settingsIcon.alt = '设置图标';

        document.body.appendChild(settingsIcon);

        // 创建一级对话框
        const dialog = document.createElement('div');
        dialog.className = 'dialog-box';

        // 创建开关容器
        const switchContainer = document.createElement('div');
        switchContainer.className = 'switch-container';

        // 创建开关标签
        const switchLabel = document.createElement('span');
        switchLabel.className = 'switch-label';
        switchLabel.textContent = '播放启动动画';

        // 创建开关
        const switchElement = document.createElement('label');
        switchElement.className = 'switch';

        const switchInput = document.createElement('input');
        switchInput.type = 'checkbox';

        // 检查是否是第一次使用插件
        const isFirstTime = localStorage.getItem('genshinSplashFirstTime') === null;

        if (isFirstTime) {
            // 第一次使用,默认开启启动动画
            switchInput.checked = true;
            localStorage.setItem('playSplashAnimation', 'true');
            localStorage.setItem('genshinSplashFirstTime', 'false'); // 标记已不是第一次使用
            console.log('第一次使用插件,默认开启启动动画');
        } else {
            // 不是第一次使用,从localStorage加载设置
            const playSplashAnimation = localStorage.getItem('playSplashAnimation');
            switchInput.checked = playSplashAnimation !== 'false'; // 默认开启,除非明确设置为false
        }

        const switchSlider = document.createElement('span');
        switchSlider.className = 'slider';

        switchElement.appendChild(switchInput);
        switchElement.appendChild(switchSlider);

        switchContainer.appendChild(switchLabel);
        switchContainer.appendChild(switchElement);

        dialog.appendChild(switchContainer);

        // 创建动画倍速控制容器
        const speedContainer = document.createElement('div');
        speedContainer.className = 'speed-control-container';

        // 创建动画倍速标签
        const speedLabel = document.createElement('span');
        speedLabel.className = 'speed-label';
        speedLabel.textContent = '动画倍速';

        // 创建动画倍速输入框
        const speedInput = document.createElement('input');
        speedInput.type = 'number';
        speedInput.className = 'speed-input';
        speedInput.min = '0.1';
        speedInput.max = '20';
        speedInput.step = '0.1';
        speedInput.value = formatSpeed(loadAnimationSpeed());

        // 创建动画倍速滑动条
        const speedSlider = document.createElement('input');
        speedSlider.type = 'range';
        speedSlider.className = 'speed-slider';
        speedSlider.min = '0.1';
        speedSlider.max = '20';
        speedSlider.step = '0.1';
        speedSlider.value = loadAnimationSpeed();

        speedContainer.appendChild(speedLabel);
        speedContainer.appendChild(speedSlider);
        speedContainer.appendChild(speedInput);

        dialog.appendChild(speedContainer);

        // 创建启动云原神按钮
        const cloudGenshinBtn = document.createElement('button');
        cloudGenshinBtn.className = 'cloud-genshin-btn';
        cloudGenshinBtn.textContent = '启动云原神';

        // 添加点击事件
        cloudGenshinBtn.addEventListener('click', function() {
            window.open('https://ys.mihoyo.com/cloud/?utm_source=default#/', '_blank');
            console.log('启动云原神');
        });

        dialog.appendChild(cloudGenshinBtn);

        // 创建设置备注按钮
        const notesSettingsBtn = document.createElement('button');
        notesSettingsBtn.className = 'notes-settings-btn';
        notesSettingsBtn.textContent = '设置备注';

        dialog.appendChild(notesSettingsBtn);

        // 创建备忘录和定时器按钮
        const memoTimerBtn = document.createElement('button');
        memoTimerBtn.className = 'memo-timer-btn';
        memoTimerBtn.textContent = '备忘录与定时器';

        dialog.appendChild(memoTimerBtn);

        document.body.appendChild(dialog);

        // 创建备注设置对话框(二级对话框)
        const notesDialog = document.createElement('div');
        notesDialog.className = 'notes-dialog-box';

        // 创建备注开关容器
        const notesSwitchContainer = document.createElement('div');
        notesSwitchContainer.className = 'switch-container';

        // 创建备注开关标签
        const notesSwitchLabel = document.createElement('span');
        notesSwitchLabel.className = 'switch-label';
        notesSwitchLabel.textContent = '是否开启备注';

        // 创建备注开关
        const notesSwitchElement = document.createElement('label');
        notesSwitchElement.className = 'switch';

        const notesSwitchInput = document.createElement('input');
        notesSwitchInput.type = 'checkbox';

        // 加载备注设置
        const { notesEnabled } = loadNotesSettings();
        notesSwitchInput.checked = notesEnabled;

        const notesSwitchSlider = document.createElement('span');
        notesSwitchSlider.className = 'slider';

        notesSwitchElement.appendChild(notesSwitchInput);
        notesSwitchElement.appendChild(notesSwitchSlider);

        notesSwitchContainer.appendChild(notesSwitchLabel);
        notesSwitchContainer.appendChild(notesSwitchElement);

        notesDialog.appendChild(notesSwitchContainer);

        // 创建修改备注按钮
        const modifyNotesBtn = document.createElement('button');
        modifyNotesBtn.className = 'modify-notes-btn';
        modifyNotesBtn.textContent = '修改备注';

        notesDialog.appendChild(modifyNotesBtn);

        document.body.appendChild(notesDialog);

        // 创建备忘录和定时器对话框(二级对话框)
        const memoTimerDialog = document.createElement('div');
        memoTimerDialog.className = 'secondary-dialog-box';

        // 创建备忘录按钮
        const memoBtn = document.createElement('button');
        memoBtn.className = 'memo-timer-btn';
        memoBtn.textContent = '备忘录';

        // 创建定时器按钮
        const timerBtn = document.createElement('button');
        timerBtn.className = 'memo-timer-btn';
        timerBtn.textContent = '定时器';

        memoTimerDialog.appendChild(memoBtn);
        memoTimerDialog.appendChild(timerBtn);

        document.body.appendChild(memoTimerDialog);

        // 创建备注编辑对话框
        const notesEditDialog = createNotesEditDialog();

        // 创建备忘录编辑对话框
        const memoEditDialog = createMemoEditDialog();

        // 创建定时器编辑对话框
        const timerEditDialog = createTimerEditDialog();

        // 对话框状态
        let isDialogVisible = false;
        let isNotesDialogVisible = false;
        let isMemoTimerDialogVisible = false;

        // 根据动画开关状态更新倍速控制的启用状态
        function updateSpeedControlState() {
            const enabled = switchInput.checked;
            speedInput.disabled = !enabled;
            speedSlider.disabled = !enabled;
        }

        // 初始化倍速控制状态
        updateSpeedControlState();

        // 设置图标点击事件 - 切换对话框显示/隐藏
        settingsIcon.addEventListener('click', function(e) {
            e.stopPropagation();

            if (reminderActive) {
                // 如果有提醒活动,点击图标停止闪烁并关闭提醒对话框
                stopBlinking();
                const reminderDialog = document.querySelector('.reminder-dialog');
                if (reminderDialog) {
                    reminderDialog.classList.remove('show');
                }
            } else if (isDialogVisible) {
                hideAllDialogs();
            } else {
                showDialog();
            }
        });

        // 设置备注按钮点击事件 - 显示备注设置对话框
        notesSettingsBtn.addEventListener('click', function(e) {
            e.stopPropagation();
            if (isNotesDialogVisible) {
                hideNotesDialog();
            } else {
                showNotesDialog();
                // 隐藏其他二级对话框
                hideMemoTimerDialog();
            }
        });

        // 备忘录和定时器按钮点击事件 - 显示备忘录和定时器对话框
        memoTimerBtn.addEventListener('click', function(e) {
            e.stopPropagation();
            if (isMemoTimerDialogVisible) {
                hideMemoTimerDialog();
            } else {
                showMemoTimerDialog();
                // 隐藏其他二级对话框
                hideNotesDialog();
            }
        });

        // 修改备注按钮点击事件 - 显示备注编辑对话框
        modifyNotesBtn.addEventListener('click', function(e) {
            e.stopPropagation();
            notesEditDialog.classList.add('show');
            hideNotesDialog();
        });

        // 备忘录按钮点击事件 - 显示备忘录编辑对话框
        memoBtn.addEventListener('click', function(e) {
            e.stopPropagation();
            memoEditDialog.classList.add('show');
            hideMemoTimerDialog();
        });

        // 定时器按钮点击事件 - 显示定时器编辑对话框
        timerBtn.addEventListener('click', function(e) {
            e.stopPropagation();
            timerEditDialog.classList.add('show');
            hideMemoTimerDialog();
        });

        // 动画倍速输入框变化事件
        speedInput.addEventListener('change', function() {
            let value = parseFloat(this.value);
            if (isNaN(value)) {
                value = 1.00;
            }
            const clampedValue = saveAnimationSpeed(value);
            this.value = formatSpeed(clampedValue);
            speedSlider.value = clampedValue;
            console.log('动画倍速已更新:', clampedValue);
        });

        // 动画倍速滑动条变化事件
        speedSlider.addEventListener('input', function() {
            const value = parseFloat(this.value);
            speedInput.value = formatSpeed(value);
            saveAnimationSpeed(value);
            console.log('动画倍速已更新:', value);
        });

        // 动画开关变化事件
        switchInput.addEventListener('change', function() {
            // 保存设置到localStorage
            localStorage.setItem('playSplashAnimation', this.checked.toString());
            // 更新倍速控制状态
            updateSpeedControlState();
            console.log('播放启动动画设置已更新:', this.checked);
        });

        // 对话框鼠标离开事件 - 修改为只在离开所有对话框区域时才隐藏
        let dialogLeaveTimer = null;

        dialog.addEventListener('mouseleave', function() {
            // 延迟检查,避免快速移动时误隐藏
            dialogLeaveTimer = setTimeout(() => {
                if (!isMouseOverAnyDialog()) {
                    hideAllDialogs();
                }
            }, 300);
        });

        notesDialog.addEventListener('mouseleave', function() {
            dialogLeaveTimer = setTimeout(() => {
                if (!isMouseOverAnyDialog()) {
                    hideAllDialogs();
                }
            }, 300);
        });

        memoTimerDialog.addEventListener('mouseleave', function() {
            dialogLeaveTimer = setTimeout(() => {
                if (!isMouseOverAnyDialog()) {
                    hideAllDialogs();
                }
            }, 300);
        });

        // 鼠标进入对话框时清除定时器
        dialog.addEventListener('mouseenter', function() {
            if (dialogLeaveTimer) {
                clearTimeout(dialogLeaveTimer);
                dialogLeaveTimer = null;
            }
        });

        notesDialog.addEventListener('mouseenter', function() {
            if (dialogLeaveTimer) {
                clearTimeout(dialogLeaveTimer);
                dialogLeaveTimer = null;
            }
        });

        memoTimerDialog.addEventListener('mouseenter', function() {
            if (dialogLeaveTimer) {
                clearTimeout(dialogLeaveTimer);
                dialogLeaveTimer = null;
            }
        });

        // 检查鼠标是否在任何对话框上
        function isMouseOverAnyDialog() {
            const dialogs = [dialog, notesDialog, memoTimerDialog];
            return dialogs.some(d => d.classList.contains('show'));
        }

        // 文档点击事件 - 点击其他地方隐藏所有对话框
        document.addEventListener('click', function(e) {
            if (isDialogVisible &&
                e.target !== settingsIcon &&
                !dialog.contains(e.target) &&
                !notesDialog.contains(e.target) &&
                !memoTimerDialog.contains(e.target)) {
                hideAllDialogs();
            }
        });

        // 备注开关变化事件
        notesSwitchInput.addEventListener('change', function() {
            const { notesData } = loadNotesSettings();
            saveNotesSettings(this.checked, notesData);

            if (this.checked) {
                // 如果开启备注,立即应用替换
                replaceOriginalNames();
            } else {
                // 如果关闭备注,刷新页面以恢复原名
                window.location.reload();
            }

            console.log('备注功能设置已更新:', this.checked);
        });

        // 鼠标悬停事件
        settingsIcon.addEventListener('mouseenter', function() {
            if (!reminderActive) {
                settingsIcon.style.opacity = '1';
            }
        });

        settingsIcon.addEventListener('mouseleave', function() {
            if (!reminderActive) {
                // 鼠标离开时立即变为50%透明度
                settingsIcon.style.opacity = '0.5';
            }
        });

        function showDialog() {
            isDialogVisible = true;
            dialog.classList.add('show');
            console.log('一级对话框显示');
        }

        function hideDialog() {
            isDialogVisible = false;
            dialog.classList.remove('show');
            console.log('一级对话框隐藏');
        }

        function showNotesDialog() {
            isNotesDialogVisible = true;
            notesDialog.classList.add('show');
            console.log('备注设置对话框显示');
        }

        function hideNotesDialog() {
            isNotesDialogVisible = false;
            notesDialog.classList.remove('show');
            console.log('备注设置对话框隐藏');
        }

        function showMemoTimerDialog() {
            isMemoTimerDialogVisible = true;
            memoTimerDialog.classList.add('show');
            console.log('备忘录和定时器对话框显示');
        }

        function hideMemoTimerDialog() {
            isMemoTimerDialogVisible = false;
            memoTimerDialog.classList.remove('show');
            console.log('备忘录和定时器对话框隐藏');
        }

        function hideAllDialogs() {
            hideDialog();
            hideNotesDialog();
            hideMemoTimerDialog();
            console.log('所有对话框已隐藏');
        }

        console.log('设置图标和对话框创建完成');
        return { settingsIcon, dialog, switchInput, notesDialog, notesSwitchInput, speedInput, speedSlider };
    }

    // ==================== 创建自定义光标元素 ====================
    const cursor = document.createElement('div');
    cursor.className = 'custom-cursor';
    document.body.appendChild(cursor);

    // 鼠标移动事件监听 - 左上角对齐
    document.addEventListener('mousemove', (e) => {
        cursor.style.left = e.clientX + 'px';
        cursor.style.top = e.clientY + 'px';
        cursor.style.display = 'block';
    });

    // 鼠标离开页面时立即隐藏光标
    document.addEventListener('mouseleave', () => {
        cursor.style.display = 'none';
    });

    // 鼠标进入页面时显示光标
    document.addEventListener('mouseenter', () => {
        cursor.style.display = 'block';
    });

    // 检测文本选择
    document.addEventListener('mousedown', function(e) {
        // 检查是否在可编辑元素上点击
        const editable = e.target.isContentEditable ||
                         e.target.tagName === 'INPUT' ||
                         e.target.tagName === 'TEXTAREA';

        if (editable) {
            document.body.classList.add('selecting-text');
        }
    });

    document.addEventListener('mouseup', function() {
        document.body.classList.remove('selecting-text');
    });

    // 监听选择变化
    document.addEventListener('selectionchange', function() {
        const selection = window.getSelection();
        if (selection.toString().length > 0) {
            document.body.classList.add('selecting-text');
        } else {
            document.body.classList.remove('selecting-text');
        }
    });

    // ==================== 评测状态美化功能 ====================
    // 主要函数:替换状态文本为图片
    function replaceStatus() {
        // 查找所有状态元素
        const statusElements = document.querySelectorAll('.record-status .lg-badge, .status, [class*="status"], [class*="result"]');

        statusElements.forEach(element => {
            const statusText = element.textContent.trim();

            // 检查AC状态
            if (statusText === 'AC' && !element.classList.contains('ac-replaced')) {
                // 标记为已替换
                element.classList.add('ac-replaced');
                element.classList.add('ac');

                // 保存原始类名和样式
                const originalClasses = element.className;
                const originalStyle = element.getAttribute('style') || '';

                // 创建图片替换元素
                const replacement = document.createElement('span');
                replacement.className = `${originalClasses} ac-image-replacement`;
                replacement.setAttribute('style', originalStyle);
                replacement.title = 'Accepted';

                // 替换元素
                element.parentNode.replaceChild(replacement, element);
            }
            // 检查WA状态
            else if (statusText === 'WA' && !element.classList.contains('wa-replaced')) {
                // 标记为已替换
                element.classList.add('wa-replaced');
                element.classList.add('wa');

                // 保存原始类名和样式
                const originalClasses = element.className;
                const originalStyle = element.getAttribute('style') || '';

                // 创建图片替换元素
                const replacement = document.createElement('span');
                replacement.className = `${originalClasses} wa-image-replacement`;
                replacement.setAttribute('style', originalStyle);
                replacement.title = 'Wrong Answer';

                // 替换元素
                element.parentNode.replaceChild(replacement, element);
            }
            // 检查RE状态
            else if (statusText === 'RE' && !element.classList.contains('re-replaced')) {
                // 标记为已替换
                element.classList.add('re-replaced');
                element.classList.add('re');

                // 保存原始类名和样式
                const originalClasses = element.className;
                const originalStyle = element.getAttribute('style') || '';

                // 创建图片替换元素
                const replacement = document.createElement('span');
                replacement.className = `${originalClasses} re-image-replacement`;
                replacement.setAttribute('style', originalStyle);
                replacement.title = 'Runtime Error';

                // 替换元素
                element.parentNode.replaceChild(replacement, element);
            }
            // 检查TLE状态 - 修改为只显示图片
            else if (statusText === 'TLE' && !element.classList.contains('tle-replaced')) {
                // 标记为已替换
                element.classList.add('tle-replaced');
                element.classList.add('tle');

                // 保存原始类名和样式
                const originalClasses = element.className;
                const originalStyle = element.getAttribute('style') || '';

                // 创建图片替换元素
                const replacement = document.createElement('span');
                replacement.className = `${originalClasses} tle-image-replacement`;
                replacement.setAttribute('style', originalStyle);
                replacement.title = 'Time Limit Exceeded';

                // 替换元素
                element.parentNode.replaceChild(replacement, element);
            }
            // 检查MLE状态 - 修改为只显示图片
            else if (statusText === 'MLE' && !element.classList.contains('mle-replaced')) {
                // 标记为已替换
                element.classList.add('mle-replaced');
                element.classList.add('mle');

                // 保存原始类名和样式
                const originalClasses = element.className;
                const originalStyle = element.getAttribute('style') || '';

                // 创建图片替换元素
                const replacement = document.createElement('span');
                replacement.className = `${originalClasses} mle-image-replacement`;
                replacement.setAttribute('style', originalStyle);
                replacement.title = 'Memory Limit Exceeded';

                // 替换元素
                element.parentNode.replaceChild(replacement, element);
            }
        });
    }

    // 初始化评测状态美化功能
    function initStatusReplacement() {
        console.log('评测状态美化功能初始化...');

        // 初始替换
        replaceStatus();

        // 使用MutationObserver监听DOM变化
        const observer = new MutationObserver(function(mutations) {
            let shouldCheck = false;

            mutations.forEach(function(mutation) {
                if (mutation.addedNodes.length > 0) {
                    shouldCheck = true;
                }
            });

            if (shouldCheck) {
                replaceStatus();
            }
        });

        // 开始观察DOM变化
        observer.observe(document.body, {
            childList: true,
            subtree: true
        });

        // 添加一个定时器,确保动态内容也被处理
        setInterval(replaceStatus, 2000);
    }

    // ==================== 原神启动动画功能 ====================
    // 初始化启动动画 - 仅在www.luogu.com.cn根域名下生效
    if (window.location.hostname === 'www.luogu.com.cn' &&
        (window.location.pathname === '/' || window.location.pathname === '')) {
        if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', function() {
                // 检查是否启用启动动画
                const playSplashAnimation = localStorage.getItem('playSplashAnimation');
                const isFirstTime = localStorage.getItem('genshinSplashFirstTime') === null;

                // 第一次使用或设置不为false时播放动画
                if (isFirstTime || playSplashAnimation !== 'false') {
                    initSplash();
                }
            });
        } else {
            setTimeout(function() {
                // 检查是否启用启动动画
                const playSplashAnimation = localStorage.getItem('playSplashAnimation');
                const isFirstTime = localStorage.getItem('genshinSplashFirstTime') === null;

                // 第一次使用或设置不为false时播放动画
                if (isFirstTime || playSplashAnimation !== 'false') {
                    initSplash();
                }
            }, 100);
        }
    }

    // 移除启动动画的函数
    function removeSplash(splash, splashTimeouts) {
        console.log('结束动画播放');

        // 清除所有定时器
        if (splashTimeouts) {
            splashTimeouts.forEach(clearTimeout);
        }

        // 立即隐藏所有图片
        const mihoyoImg = document.getElementById('mihoyo-img');
        const startupImg = document.getElementById('startup-img');
        const sq = document.querySelector('#luogu-splash img:last-child');

        if (mihoyoImg) mihoyoImg.style.opacity = '0';
        if (startupImg) startupImg.style.opacity = '0';
        if (sq) sq.style.opacity = '0';

        // 淡出并移除启动层
        if (splash) {
            splash.style.transition = 'opacity 0.5s ease-out';
            splash.style.opacity = '0';

            setTimeout(() => {
                if (splash && splash.parentNode) {
                    document.body.removeChild(splash);
                }
            }, 500);
        }
    }

    function initSplash() {
        console.log('初始化启动动画...');

        if (document.getElementById('luogu-splash')) {
            console.log('启动动画层已存在,跳过创建');
            return;
        }

        const splash = document.createElement('div');
        splash.id = 'luogu-splash';

        splash.style.position = 'fixed';
        splash.style.top = '0';
        splash.style.left = '0';
        splash.style.width = '100%';
        splash.style.height = '100%';
        splash.style.backgroundColor = 'white';
        splash.style.zIndex = '999999';
        splash.style.display = 'flex';
        splash.style.justifyContent = 'center';
        splash.style.alignItems = 'center';

        document.body.appendChild(splash);
        console.log('启动动画层已创建');

        const mihoyoImg = document.createElement('img');
        mihoyoImg.id = 'mihoyo-img';
        mihoyoImg.src = 'https://cdn.luogu.com.cn/upload/image_hosting/21i8jnbt.png';
        mihoyoImg.alt = 'miHoYo';
        mihoyoImg.style.position = 'absolute';
        mihoyoImg.style.opacity = '0';
        mihoyoImg.style.maxWidth = '100%';
        mihoyoImg.style.maxHeight = '100%';
        mihoyoImg.style.width = 'auto';
        mihoyoImg.style.height = 'auto';
        mihoyoImg.style.objectFit = 'contain';
        mihoyoImg.style.top = '50%';
        mihoyoImg.style.left = '50%';
        mihoyoImg.style.transform = 'translate(-50%, -50%)';
        splash.appendChild(mihoyoImg);
        console.log('miHoYo图片已添加');

        const startupImg = document.createElement('img');
        startupImg.id = 'startup-img';
        startupImg.src = 'https://cdn.luogu.com.cn/upload/image_hosting/u1ecpv6w.png';
        startupImg.alt = '启动图';
        startupImg.style.position = 'absolute';
        startupImg.style.opacity = '0';
        startupImg.style.maxWidth = '100%';
        startupImg.style.maxHeight = '100%';
        startupImg.style.width = 'auto';
        startupImg.style.height = 'auto';
        startupImg.style.objectFit = 'contain';
        startupImg.style.top = '50%';
        startupImg.style.left = '50%';
        startupImg.style.transform = 'translate(-50%, -50%)';
        splash.appendChild(startupImg);
        console.log('启动图片已添加');

        const sq = document.createElement('img');
        sq.id = 'startup-img';
        sq.src = 'https://cdn.luogu.com.cn/upload/image_hosting/vw02b1j3.png';
        sq.alt = '启动图';
        sq.style.position = 'absolute';
        sq.style.opacity = '0';
        sq.style.maxWidth = '100%';
        sq.style.maxHeight = '100%';
        sq.style.width = 'auto';
        sq.style.height = 'auto';
        sq.style.objectFit = 'contain';
        sq.style.top = '50%';
        sq.style.left = '50%';
        sq.style.transform = 'translate(-50%, -50%)';
        splash.appendChild(sq);
        console.log('第三张图片已添加');

        const splashTimeouts = [];

        // 获取动画倍速
        const animationSpeed = loadAnimationSpeed();
        console.log('当前动画倍速:', animationSpeed);

        // 计算基于倍速的延迟时间
        const getDelayedTime = (baseTime) => baseTime / animationSpeed;

        splashTimeouts.push(setTimeout(() => {
            console.log('开始miHoYo淡入动画');
            mihoyoImg.style.transition = `opacity ${getDelayedTime(1.5)}s ease-in`;
            mihoyoImg.style.opacity = '1';
        }, getDelayedTime(1000)));

        splashTimeouts.push(setTimeout(() => {
            console.log('开始miHoYo淡出动画');
            mihoyoImg.style.transition = `opacity ${getDelayedTime(1.5)}s ease-out`;
            mihoyoImg.style.opacity = '0';
        }, getDelayedTime(4500)));

        splashTimeouts.push(setTimeout(() => {
            console.log('开始启动图片淡入动画');
            startupImg.style.transition = `opacity ${getDelayedTime(1.5)}s ease-in`;
            startupImg.style.opacity = '1';
        }, getDelayedTime(7000)));

        splashTimeouts.push(setTimeout(() => {
            console.log('开始启动图片淡出动画');
            startupImg.style.transition = `opacity ${getDelayedTime(0.75)}s ease-out`;
            startupImg.style.opacity = '0';
        }, getDelayedTime(11500)));

        splashTimeouts.push(setTimeout(() => {
            console.log('开始图片3淡入动画');
            sq.style.transition = `opacity ${getDelayedTime(0.75)}s ease-in`;
            sq.style.opacity = '1';
        }, getDelayedTime(12250)));

        splashTimeouts.push(setTimeout(() => {
            console.log('开始图片3淡出动画');
            sq.style.transition = `opacity ${getDelayedTime(1.5)}s ease-out`;
            sq.style.opacity = '0';
        }, getDelayedTime(16000)));

        splashTimeouts.push(setTimeout(() => {
            console.log('开始背景淡出动画');
            splash.style.transition = `opacity ${getDelayedTime(1)}s ease-out`;
            splash.style.opacity = '0';
        }, getDelayedTime(19000)));

        splashTimeouts.push(setTimeout(() => {
            console.log('移除启动动画层');
            try {
                if (splash && splash.parentNode) {
                    document.body.removeChild(splash);
                }
            } catch (e) {
                console.error('移除启动动画层时出错:', e);
            }
        }, getDelayedTime(20000)));

        // ESC键监听
        document.addEventListener('keydown', function handleEsc(e) {
            if (e.key === 'Escape') {
                removeSplash(splash, splashTimeouts);
                document.removeEventListener('keydown', handleEsc);
            }
        });

        // 双击监听
        let lastClickTime = 0;
        splash.addEventListener('click', function handleDoubleClick(e) {
            const currentTime = new Date().getTime();
            const timeDiff = currentTime - lastClickTime;

            if (timeDiff < 500 && timeDiff > 0) {
                // 双击事件
                removeSplash(splash, splashTimeouts);
                splash.removeEventListener('click', handleDoubleClick);
            }

            lastClickTime = currentTime;
        });
    }

    // ==================== 个人主页介绍显示功能 ====================
    function showUserIntroduction() {
        // 检查是否在用户主页
        if (window.location.hostname === 'www.luogu.com.cn' &&
            window.location.pathname.startsWith('/user/')) {

            // 查找隐藏的个人介绍元素
            const introElements = document.querySelectorAll('.introduction.marked[style*="display: none"]');

            introElements.forEach(element => {
                console.log('找到隐藏的个人介绍元素,正在显示...');
                // 移除display: none样式
                element.style.display = '';
            });

            // 移除系统维护提示
            removeMaintenanceNotice();
        }
    }

    // 移除系统维护提示
    function removeMaintenanceNotice() {
        // 查找系统维护提示元素
        const noticeElements = document.querySelectorAll('div[data-v-69e27492][data-v-f9624136]');

        noticeElements.forEach(element => {
            // 检查元素样式和内容是否符合系统维护提示的特征
            const style = element.getAttribute('style') || '';
            const textContent = element.textContent.trim();

            if (style.includes('background-color: rgb(255, 235, 236)') &&
                style.includes('border: 1px solid rgb(225, 50, 56)') &&
                textContent.includes('系统维护,该内容暂不可见')) {

                console.log('找到系统维护提示,正在移除...');
                element.remove();
            }
        });
    }

    // 初始化个人主页介绍显示功能
    function initUserIntroduction() {
        console.log('个人主页介绍显示功能初始化...');

        // 初始检查
        showUserIntroduction();

        // 使用MutationObserver监听DOM变化
        const observer = new MutationObserver(function(mutations) {
            let shouldCheck = false;

            mutations.forEach(function(mutation) {
                if (mutation.addedNodes.length > 0) {
                    shouldCheck = true;
                }
            });

            if (shouldCheck) {
                showUserIntroduction();
            }
        });

        // 开始观察DOM变化
        observer.observe(document.body, {
            childList: true,
            subtree: true
        });

        // 添加定时检查,确保动态内容也被处理
        setInterval(showUserIntroduction, 1000);
    }

    // ==================== 主初始化函数 ====================
    // 等待页面加载完成后执行
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', function() {
            // 创建设置图标和对话框(在所有界面)
            createSettingsIcon();

            // 初始化评测状态美化功能(如果在评测页面)
            if (window.location.pathname.includes('/record/')) {
                setTimeout(initStatusReplacement, 500);
            }

            // 初始化个人主页介绍显示功能
            if (window.location.hostname === 'www.luogu.com.cn' &&
                window.location.pathname.startsWith('/user/')) {
                setTimeout(initUserIntroduction, 500);
            }

            // 初始化备注功能 - 每秒执行一次
            const { notesEnabled } = loadNotesSettings();
            if (notesEnabled) {
                // 初始执行一次
                setTimeout(replaceOriginalNames, 1000);
                // 然后每秒执行一次
                setInterval(replaceOriginalNames, 1000);
            }

            // 开始定期检查提醒
            startReminderCheck();
        });
    } else {
        // 创建设置图标和对话框(在所有界面)
        createSettingsIcon();

        // 初始化评测状态美化功能(如果在评测页面)
        if (window.location.pathname.includes('/record/')) {
            setTimeout(initStatusReplacement, 500);
        }

        // 初始化个人主页介绍显示功能
        if (window.location.hostname === 'www.luogu.com.cn' &&
            window.location.pathname.startsWith('/user/')) {
            setTimeout(initUserIntroduction, 500);
        }

        // 初始化备注功能 - 每秒执行一次
        const { notesEnabled } = loadNotesSettings();
        if (notesEnabled) {
            // 初始执行一次
            setTimeout(replaceOriginalNames, 1000);
            // 然后每秒执行一次
            setInterval(replaceOriginalNames, 1000);
        }

        // 开始定期检查提醒
        startReminderCheck();
    }
})();