/* ====== 手机端适配覆盖（≤1024px） ====== */
@media (max-width: 1024px) {
    /* 1. 基础全局设置 */
    html, body { overflow-x: hidden !important; }
    .scroll-container {
        overflow-x: hidden !important;
        background: linear-gradient(135deg, #e0f2f1 0%, #e1f5fe 100%) !important;
    }
    .nav-links { display: none !important; }
    .hamburger { display: flex !important; }
    .nav-underline { display: none !important; }
    .navbar { position: fixed !important; z-index: 2000 !important; }
    .side-menu { z-index: 2500 !important; transform: translateX(105%); }
    .side-menu.open { transform: translateX(0) !important; }
    .side-backdrop { z-index: 2400 !important; }
    .page { padding-top: 80px !important; }
    .hamburger-bar { background: var(--accent-teal) !important; }
    h3 {
        color: #3496d7 !important;
        text-align: center !important;
    }

    /* 教育背景内的学校名称等标题强制左对齐 */
    .education-item h3, .courses-title{
        color: #26a69a !important;
        text-align: left !important;
    }
    /* 教育卡片整体文本左对齐 */
    .education-item {
        text-align: left !important;
    }

    .courses-list{
        margin-bottom: 30px !important;
    }

    /* 2. 页面通用布局调整 */
    #page2, #page3, #page4, #page5, #page6, #page7{ padding: 20px 12px !important; }
    /* 统一 2-7 页背景，防止视觉割裂 */
    #page2, #page3, #page4, #page5, #page6, #page7 {background: transparent !important;}

    .portfolio-container {
        flex-direction: column !important;
        padding: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        align-items: center !important;
        gap: 10px !important;
    }

    /* 3. 文本区域对齐修正 */
    #page2 .info-section,
    #page3 .info-section,
    #page4 .info-section {
        padding: 0 12px !important;
        width: 100% !important;
        text-align: center !important;
        margin-bottom: 0 !important;
    }

    /* 第五页（教育背景）内容区左对齐 */
    #page5 .info-section {
        padding: 0 12px !important;
        width: 100% !important;
        text-align: left !important;
        margin-bottom: 0 !important;
    }

    /* 所有页面的大标题及其下划线保持居中 */
    #page2 .project-title,
    #page3 .project-title,
    #page4 .project-title,
    #page5 .project-title,
    #page6 .project-title,
    #page7 .project-title{
        text-align: center !important;
        margin-bottom: 15px !important;
    }

    #page2 .project-title{margin-top: 40px !important;}

    #page2 .project-title::after,
    #page3 .project-title::after,
    #page4 .project-title::after,
    #page5 .project-title::after,
    #page6 .project-title::after,
    #page7 .project-title::after {
        left: 50%;
        color: #26a69a;
        transform: translateX(-50%);
    }

    /* 正文左对齐 */
    #page2 .project-description,
    #page3 .project-description,
    #page4 .project-description {
        text-align: left !important;
        margin-bottom: 30px !important;
    }

    /* 小标题居中 */
    #page2 .info-section h3,
    #page3 .info-section h3,
    #page4 .info-section h3 {
        text-align: center !important;
        color: #26a69a;
        margin-bottom: 10px !important;
    }

    #page1 .tags-container, #page4 .tags-container {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        padding-left: 0 !important;
        margin: 10px auto !important;
        width: 100%;
        gap: 8px;
    }

    /* 2. 特性列表（Page 2, 3, 4）去圆点、居中、紧凑化 */
    #page2 .features, #page3 .features, #page4 .features {
        display: flex !important;
        flex-direction: column !important; /* 纵向排列 */
        align-items: center !important;    /* 容器内项居中 */
        text-align: center !important;     /* 文本居中 */
        list-style: none !important;       /* 彻底去掉小圆点 */
        padding-left: 0 !important;        /* 去掉缩进 */
        margin: 10px auto !important;
        width: 100% !important;
    }

    #page2 .features li, #page3 .features li, #page4 .features li {
        line-height: 0.2 !important;       /* 极小行间距 */
        margin-bottom: 3px !important;     /* 极小项间距 */
        font-size: 0.85rem !important;
        display: block !important;         /* 确保没有列表标记 */
    }

    /* PPT 展示页标签颜色修改 */
    #page4 .ppt-styles .tag {
        color: #e0f2f1 !important;
    }

    /* 4. 通用滚动图片样式 (Page 2 & Page 4) */
    #page2 .gallery-section,
    #page4 .gallery-section {
        width: 100% !important;
        overflow: visible !important;
        display: block !important;
    }

    #page2 .carousel,
    #page4 .carousel {
        display: block;
        width: 100% !important;
        height: 55vh !important;
        max-height: 420px !important;
        position: relative;
        overflow: hidden;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        touch-action: pan-y;
        margin-bottom: 15px !important;
    }

    /* ====== 第 3 页（人脸识别）布局调整：文字在上，图片在下 ====== */

    #page3 .portfolio-container {
        display: flex !important;
        flex-direction: column !important; /* 纵向排列 */
    }

    /* 1. 文字区域排在第一 */
    #page3 .info-section {
        order: 1 !important;
        margin-bottom: 25px !important; /* 增加与下方图片的间距 */
        width: 100% !important;
    }

    /* 2. 图片区域排在第二 */
    #page3 .gallery-section {
        order: 2 !important;
        width: 100% !important;
        padding: 0 !important;
    }

    /* 3. 图片框放大并保持拉伸 */
    #page3 .image-placeholder {
        width: calc(100% - 24px) !important; /* 与正文左右边距对齐 */
        height: 250px !important;            /* 适当放大高度 */
        margin-bottom: 30px !important;
        background: transparent !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
        border-radius: 15px !important;
        overflow: hidden;
    }

    #page3 .image-placeholder img {
        width: 100% !important;
        height: 100% !important;
        object-fit: fill !important; /* 强制拉伸填充 */
        display: block;
    }

    #page4 .gallery-section {
        order: 2 !important;
        margin-top: -30px !important;
    }

    #page4 .carousel-ppt {
        aspect-ratio: auto !important;
        width: 100% !important;
    }

    /* 通用卡片项位置重置 */
    #page2 .carousel-item,
    #page4 .carousel-item {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%);
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        display: flex;
        justify-content: center;
        align-items: center;
        background: transparent !important;
    }

    /* 图片本体样式优化 */
    #page2 .carousel-item img,
    #page4 .carousel-item img {
        display: block;
        width: auto;
        max-width: 80vw !important;
        height: auto;
        max-height: 45vh !important;
        object-fit: contain;
        border-radius: 12px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.15);
        pointer-events: none;
    }

    /* 隐藏所有轮播控制点 */
    #page2 .carousel-controls,
    #page4 .carousel-controls { display: none !important; }

    /* ====== Page 1 首页修正 ====== */
    #page1 {
        align-items: center !important;
        justify-content: center !important;
        padding-bottom: 120px !important;
    }
    #page1 .cover-content {
        margin-left: 0 !important;
        padding: 0 15px !important;
        text-align: center !important;
        display: flex; flex-direction: column; align-items: center;
    }
    #page1 .name { font-size: 2.8rem !important; margin-bottom: 5px !important; }
    #page1 .intro {
        font-size: 0.9rem !important;
        line-height: 1.8 !important;
        white-space: pre-line !important;
        text-align: center !important;
    }

    /* 2. 技能卡片样式：模仿第五页教育背景 */
    .skill-category {
        background: rgba(255, 255, 255, 0.9) !important;
        border-radius: 15px !important;
        padding: 15px 20px !important;
        margin-bottom: 15px !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.05) !important;
        width: 100% !important;
        box-sizing: border-box;
        text-align: left !important;
    }

    /* 缩小标题和正文，提高观感 */
    .skill-title {
        font-size: 1.1rem !important;
        margin-bottom: 5px !important;
        color: #3496d7 !important;
        text-align: left !important;
    }

    .skill-list {
        list-style: none !important;
        padding-left: 0 !important; /* 确保文字贴左对齐 */
        margin: 0 !important;
    }

    .skill-item {
        font-size: 0.85rem !important;
        line-height: 1.4 !important; /* 进一步缩小行高 */
        margin-bottom: 4px !important; /* 缩小段落间的上下边距 */
        padding: 0 !important;
        text-align: left !important;
    }
    /* 彻底隐藏可能存在的自定义小圆点伪元素 */
    .skill-item::before {
        display: none !important;
    }
    /* 5. 证书图片区域优化（第6页） */
    .certificates-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        width: 100% !important;
        align-items: center !important;
        margin-top: -30px !important;
    }

    .certificate-item {
        width: 100% !important;
        background: transparent !important; /* 隐藏透明卡片底色 */
        box-shadow: none !important; /* 隐藏卡片阴影 */
        padding: 0 !important;
        display: flex;
        justify-content: center;
    }

    .certificate-item img {
        width: 100% !important; /* 图片完全契合容器宽度 */
        max-width: 100% !important;
        height: auto !important;
        border-radius: 12px;
        box-shadow: 0 8px 25px rgba(0,0,0,0.15); /* 让阴影只在图片周围 */
        cursor: pointer;
    }

    /* 4. 查看大图的层样式 (Lightbox) */
    .lightbox-overlay {
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(0,0,0,0.9);
        display: none;
        justify-content: center;
        align-items: center;
        z-index: 3000;
    }
    .lightbox-overlay.active { display: flex; }
    .lightbox-overlay img {
        max-width: 95%;
        max-height: 85%;
        border-radius: 4px;
        box-shadow: 0 0 30px rgba(0,0,0,0.5);
    }

    /* ====== 第七页（联系方式）紧凑优化版 ====== */
    #page7 {
        padding: 10px 12px !important; /* 缩小页面上下内边距 */
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    #page7 .contact-container {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }

    #page7 .contact-card {
        width: 94% !important;
        max-width: 380px !important;
        padding: 15px 15px !important; /* 大幅缩小卡片内边距 */
        background: #ffffff !important;
        border-radius: 20px !important;
        box-shadow: 0 8px 30px rgba(0,0,0,0.05) !important;
        text-align: left !important;
    }

    #page7 .contact-title {
        text-align: center !important; /* 强制标题居中 */
        margin-bottom: 15px !important;
        margin-top: 10px !important;
        font-size: 1.4rem !important;
        width: 100%; /* 确保标题占满宽度以便居中 */
    }
    /* 确保下划线也跟随标题居中 */
    #page7 .contact-title::after {
        left: 50% !important;
        width: 20px;
        transform: translateX(-50%) !important;
    }
    /* 信息条目：缩小间距 */
    #page7 .contact-item {
        display: flex !important;
        align-items: center !important;
        margin-bottom: 8px !important; /* 缩小条目间距 */
        gap: 10px !important;
    }

    #page7 .contact-icon {
        font-size: 1.1rem !important; /* 缩小图标 */
        width: 25px !important;
        text-align: center !important;
        flex-shrink: 0 !important;
        margin-left: 10px !important;
    }

    #page7 .contact-info {
        font-size: 0.9rem !important; /* 缩小字体 */
        line-height: 1.3 !important;
        color: #333 !important;
        word-break: keep-all !important; /* 防止邮箱中途断开换行 */
    }

    /* 结语/备注框：缩小尺寸 */
    #page7 .contact-note {
        text-align: center !important;
        font-size: 0.8rem !important;
        margin: 12px 0 !important; /* 缩小外边距 */
        padding: 8px 12px !important; /* 缩小内边距 */
        background: #f0f7f6 !important;
        border-radius: 10px !important;
        color: #26a69a !important;
        border-left: 3px solid #26a69a !important;
        line-height: 1.4 !important;
    }

    /* 底部社交图标：缩小按钮 */
    #page7 .social-icons {
        margin-top: 10px !important;
        display: flex !important;
        justify-content: center !important;
        gap: 20px !important;
    }

    #page7 .social-icon {
        width: 40px !important; /* 缩小按钮尺寸 */
        height: 40px !important;
        background: #f8f9fa !important;
        border-radius: 50% !important;
        font-size: 1.1rem !important;
        box-shadow: 0 3px 8px rgba(0,0,0,0.04) !important;
    }

    /* 下滑提示文字居中 */
    .scroll-hint {
        bottom: 40px !important;
        font-size: 0.85rem !important;
        left: 50% !important;
        transform: translateX(-50%);
        width: auto !important;
        white-space: nowrap;
        z-index: 10;
    }
}