/* ============================================================
   移动端适配 - 全面修复布局问题
   ============================================================ */

/* ---------- 平板适配 (769px - 1024px) ---------- */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 0 32px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .about-grid {
        gap: 60px;
    }
    
    .product-showcase {
        gap: 40px;
    }
    
    .product-main-image {
        width: 360px;
        height: 360px;
    }
    
    .product-highlights {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---------- 手机适配 (max-width: 768px) ---------- */
@media (max-width: 768px) {
    /* ---- 容器 ---- */
    .container {
        padding: 0 20px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    body {
        overflow-x: hidden;
        width: 100%;
    }
    
    * {
        max-width: 100%;
    }
    
    img, video {
        max-width: 100%;
        height: auto;
    }

    /* ---- 导航栏 ---- */
    .mobile-menu-btn {
        display: block;
    }
    
    .main-nav {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        background: var(--bg-secondary);
        flex-direction: column;
        padding: 16px 20px;
        gap: 0;
        border-bottom: 1px solid var(--border);
        transform: translateY(-150%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: var(--shadow-lg);
        display: flex;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        z-index: 999;
    }
    
    .main-nav.open {
        transform: translateY(0);
    }
    
    .nav-link {
        padding: 14px 0;
        border-bottom: 1px solid var(--border);
        font-size: 0.95rem;
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    .site-header {
        height: 60px;
    }

    /* ---- Hero 区域 ---- */
    .hero-section {
        min-height: 100vh;
        min-height: 100dvh;
        padding: 80px 16px 40px;
        overflow: hidden;
    }
    
    .hero-content {
        margin-top: 20px;
        width: 100%;
        max-width: 100%;
    }
    
    .hero-title {
        font-size: 2.4rem;
        line-height: 1.1;
        letter-spacing: 0;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        letter-spacing: 2px;
    }
    
    .hero-desc {
        font-size: 0.9rem;
        padding: 0 8px;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
        padding: 0 8px;
        gap: 12px;
    }
    
    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    /* 赞助商横幅 - 移动端适配 */
    .sponsor-banners {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 32px;
    }

    .sponsor-banner {
        max-width: 100%;
        padding: 10px 14px;
        gap: 10px;
        flex: 1 1 100%;
    }

    .sponsor-text {
        font-size: 0.82rem;
    }

    .sponsor-cta {
        display: none;
    }

    /* Hero 装饰元素 - 移动端隐藏重元素 */
    .hero-beam,
    .hero-parallax-layer,
    .hero-title-glow {
        display: none !important;
    }
    
    .hero-mouse-trail {
        display: none !important;
    }
    
    .hero-rain {
        opacity: 0.3;
    }
    
    .hero-rings {
        display: none;
    }
    
    .hero-glow {
        opacity: 0.4;
        filter: blur(40px);
    }
    
    .hero-stars .hero-star {
        width: 2px;
        height: 2px;
    }
    
    .hero-particles .hero-particle {
        width: 3px;
        height: 3px;
    }

    /* 统计面板 */
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0 8px;
    }
    
    .stat-box {
        padding: 14px 10px;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .stat-name {
        font-size: 0.75rem;
    }

    /* 51.la 统计挂件 */
    #LA-DATA-WIDGET {
        max-width: 100%;
        margin: 20px 0;
    }

    /* 服务器监控 */
    .server-monitor {
        margin-top: 24px;
        padding: 16px;
        border-radius: 12px;
    }
    
    .server-monitor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .net-speed-display {
        align-self: flex-end;
    }
    
    .server-monitor-title {
        font-size: 14px;
    }
    
    .monitor-item {
        margin-bottom: 12px;
    }
    
    .monitor-label {
        font-size: 0.8rem;
    }
    
    .disk-io-row {
        flex-direction: column;
        gap: 4px;
        font-size: 0.8rem;
    }
    
    .net-speed-chart-container {
        margin-top: 12px;
    }
    
    .net-speed-chart {
        height: 120px;
    }

    /* 滚动指示器 */
    .scroll-indicator {
        display: none;
    }

    /* ---- Section 通用 ---- */
    .section {
        padding: 60px 0;
        overflow: hidden;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .section-desc {
        font-size: 0.9rem;
    }
    
    .section-header {
        margin-bottom: 32px;
    }

    /* ---- 特色产品展示 ---- */
    .product-showcase {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }
    
    .product-main-image {
        width: 240px;
        height: 240px;
    }
    
    .product-title {
        font-size: 2rem;
    }
    
    .product-subtitle {
        font-size: 0.95rem;
    }
    
    .product-description {
        font-size: 0.9rem;
    }
    
    .product-thumbs {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .thumb-btn {
        width: 50px;
        height: 50px;
    }
    
    .product-features {
        padding: 0 8px;
        text-align: left;
    }
    
    .feature-item {
        font-size: 0.9rem;
    }
    
    .product-highlights {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .highlight-card {
        padding: 20px 16px;
    }
    
    .highlight-card h3 {
        font-size: 1rem;
    }
    
    .highlight-card p {
        font-size: 0.8rem;
    }
    
    .product-stats {
        flex-direction: column;
        gap: 16px;
    }
    
    .stat-divider {
        width: 40px;
        height: 1px;
    }
    
    .product-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .product-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .floating-elements {
        display: none;
    }

    /* ---- 服务卡片 ---- */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .service-card:hover {
        transform: translateY(-4px);
    }
    
    .card-header {
        height: 120px;
    }
    
    .card-header span {
        font-size: 2.5rem;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .card-desc {
        font-size: 0.9rem;
    }

    /* ---- 展示轮播 ---- */
    .slider-track {
        height: 200px;
    }
    
    .slider-arrow {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .slider-prev { left: 8px; }
    .slider-next { right: 8px; }

    /* ---- 友情链接 ---- */
    .friends-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* ---- 关于区域 ---- */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .about-image {
        order: -1;
        transform: none;
        max-width: 280px;
        margin: 0 auto;
    }
    
    .about-image:hover {
        transform: none;
    }
    
    .about-image img {
        width: 100%;
    }
    
    .about-content h2 {
        font-size: 1.8rem;
    }
    
    .about-content .lead {
        font-size: 0.95rem;
    }
    
    .about-content p {
        font-size: 0.9rem;
    }
    
    .feature-cards {
        flex-direction: column;
        gap: 12px;
    }
    
    .f-card {
        padding: 16px;
    }
    
    .f-icon {
        font-size: 1.5rem;
    }
    
    .f-text h4 {
        font-size: 0.95rem;
    }
    
    .f-text p {
        font-size: 0.85rem;
    }

    /* 时间线 */
    .timeline {
        padding: 20px 0;
    }
    
    .timeline::before {
        left: 16px;
    }
    
    .timeline-item,
    .timeline-item:nth-child(even) {
        padding-left: 48px;
        padding-right: 0;
        justify-content: flex-start;
        margin-bottom: 24px;
    }
    
    .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }
    
    .timeline-content h4 {
        font-size: 0.95rem;
    }
    
    .timeline-content p {
        font-size: 0.85rem;
    }
    
    .timeline-date {
        left: 16px;
        transform: translateX(-50%);
        font-size: 0.75rem;
    }

    /* ---- 评论区 ---- */
    .comments-section {
        padding: 40px 0;
    }
    
    .waline-container {
        padding: 0 4px;
    }

    /* ---- 页脚 ---- */
    .site-footer {
        padding: 40px 0 24px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 28px;
        text-align: center;
    }
    
    .footer-brand {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .footer-logo {
        width: 48px;
        height: 48px;
    }
    
    .footer-brand h3 {
        font-size: 1.2rem;
    }
    
    .footer-links h4 {
        font-size: 1rem;
    }
    
    .footer-links h4::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .footer-links a {
        font-size: 0.85rem;
    }
    
    .footer-bottom {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        text-align: center;
        padding-top: 20px;
    }
    
    .footer-bottom p {
        width: 100%;
    }
    
    .footer-bottom a img {
        height: 18px;
    }

    /* ---- 回到顶部 ---- */
    .back-to-top {
        bottom: 80px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    /* ---- 鼠标光晕 ---- */
    .cursor-glow {
        display: none !important;
    }

    /* ---- 滚动进度条 ---- */
    .scroll-progress {
        height: 2px;
    }

    /* ---- 动画降级 ---- */
    .reveal-left, .reveal-right {
        transform: translateY(30px);
    }
    .reveal-left.revealed, .reveal-right.revealed {
        transform: translateY(0);
    }
    
    .site-header.shrink {
        height: 52px;
    }
    
    .site-header.shrink .logo-img {
        width: 30px;
        height: 30px;
    }

    /* ---- 演示面板 ---- */
    .demo-panel {
        bottom: 16px;
        right: 16px;
        top: auto;
    }
    
    .demo-controls {
        top: auto;
        bottom: 56px;
        right: 0;
        width: 200px;
    }
    
    .demo-toggle {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
    
    .demo-toggle::after {
        display: none;
    }

    /* ---- 加载动画 ---- */
    #page-loader {
        padding: 20px;
    }
    
    .loader-brand {
        font-size: 2rem;
        gap: 8px;
        letter-spacing: 4px;
    }
    
    .loader-progress-wrap {
        width: 260px;
    }
    
    .loader-progress-text {
        font-size: 0.85rem;
    }
    
    .loader-tip {
        font-size: 0.75rem;
    }
    
    .loader-energy-rings {
        width: 220px;
        height: 220px;
    }
    
    .ring-1 { width: 100px; height: 100px; }
    .ring-2 { width: 140px; height: 140px; }
    .ring-3 { width: 180px; height: 180px; }
    
    .loader-core {
        width: 80px;
        height: 80px;
    }
    
    .core-orb {
        width: 50px;
        height: 50px;
    }
    
    .orb-inner {
        width: 24px;
        height: 24px;
    }
    
    .core-glow {
        width: 120px;
        height: 120px;
    }
}

/* ---------- 小屏手机 (max-width: 480px) ---------- */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
        letter-spacing: 1px;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
    
    .section-header {
        margin-bottom: 24px;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .product-main-image {
        width: 200px;
        height: 200px;
    }
    
    .product-title {
        font-size: 1.6rem;
    }
    
    .product-highlights {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .highlight-icon {
        font-size: 1.5rem;
    }
    
    .stats-bar {
        gap: 8px;
        padding: 0 4px;
    }
    
    .stat-box {
        padding: 12px 8px;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    .slider-track {
        height: 160px;
    }
    
    .about-image {
        max-width: 220px;
    }
    
    .year-badge {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
    
    .footer-grid {
        gap: 20px;
    }
    
    .footer-bottom {
        gap: 8px;
    }
    
    .footer-bottom a img {
        height: 16px;
    }
    
    .back-to-top {
        bottom: 70px;
        right: 12px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .loader-brand {
        font-size: 1.6rem;
        gap: 6px;
    }
    
    .loader-progress-wrap {
        width: 220px;
    }
    
    .loader-content {
        gap: 20px;
    }
    
    .loader-energy-rings {
        width: 180px;
        height: 180px;
    }
    
    .ring-1 { width: 80px; height: 80px; }
    .ring-2 { width: 120px; height: 120px; }
    .ring-3 { width: 150px; height: 150px; }
    
    .loader-core {
        width: 60px;
        height: 60px;
    }
    
    .core-orb {
        width: 40px;
        height: 40px;
    }
}

/* ---------- 超小屏手机 (max-width: 360px) ---------- */
@media (max-width: 360px) {
    .container {
        padding: 0 10px;
    }

    .hero-section {
        padding: 70px 10px 32px;
    }

    .hero-title {
        font-size: 1.7rem;
    }

    .hero-subtitle {
        font-size: 0.8rem;
        letter-spacing: 1px;
    }

    .hero-desc {
        font-size: 0.82rem;
    }

    .sponsor-banner {
        padding: 8px 10px;
        gap: 8px;
    }

    .sponsor-icon {
        font-size: 1rem;
    }

    .sponsor-text {
        font-size: 0.74rem;
    }

    .sponsor-ad-tag {
        font-size: 10px;
        padding: 2px 5px;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .stat-value {
        font-size: 1rem;
    }

    .stat-name {
        font-size: 0.68rem;
    }

    .golden-partner-card {
        padding: 18px 14px;
    }

    .partner-name {
        font-size: 1.05rem;
    }

    .back-to-top {
        bottom: 64px;
        right: 10px;
        width: 38px;
        height: 38px;
    }

    .demo-panel {
        right: 10px;
        bottom: 10px;
    }
}

/* ---------- 大屏平板 / 小笔记本 (481px - 768px) 友链双列 ---------- */
@media (min-width: 481px) and (max-width: 768px) {
    .friends-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .friend-card {
        padding: 12px;
    }
}

/* ---------- 大屏桌面 (min-width: 1440px) ---------- */
@media (min-width: 1440px) {
    .container {
        max-width: 1320px;
    }

    .hero-title {
        font-size: 5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .hero-desc {
        font-size: 1.1rem;
        max-width: 640px;
    }

    .sponsor-banner {
        max-width: 640px;
        padding: 14px 22px;
    }

    .sponsor-text {
        font-size: 1rem;
    }

    .section-title {
        font-size: 2.6rem;
    }

    .golden-partners-grid {
        max-width: 1320px;
    }
}

/* ---------- 超宽屏 (min-width: 1920px) ---------- */
@media (min-width: 1920px) {
    .container {
        max-width: 1500px;
    }

    .hero-title {
        font-size: 5.5rem;
    }

    .services-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .friends-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* ---------- 横屏手机 (max-height: 500px 且 max-width: 900px) ---------- */
@media (max-height: 500px) and (max-width: 900px) {
    .hero-section {
        min-height: 100vh;
        min-height: 100dvh;
        padding: 70px 16px 24px;
        justify-content: flex-start;
    }

    .hero-content {
        margin-top: 8px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        margin-bottom: 8px;
    }

    .hero-desc {
        margin-bottom: 16px;
    }

    .hero-buttons {
        margin-bottom: 16px;
    }

    .sponsor-banner {
        margin-bottom: 20px;
    }

    .stats-bar {
        grid-template-columns: repeat(4, 1fr);
    }

    .scroll-indicator {
        display: none;
    }
}

/* ---------- 安全区域 (刘海屏 / 全面屏) ---------- */
@supports (padding: env(safe-area-inset-bottom)) {
    .site-footer {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    .back-to-top {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }

    .demo-panel {
        bottom: calc(16px + env(safe-area-inset-bottom));
    }

    @media (max-width: 768px) {
        .back-to-top {
            bottom: calc(70px + env(safe-area-inset-bottom));
        }
    }
}
