/* ============================================
   鲁氏族谱系统 v74 - 移动端全方位优化样式
   适配：375px / 414px / 768px
   规范：正文14-16px、标题18-24px、卡片圆角8-12px
         按钮圆角6-8px、可点击元素最小44px、输入框44px高16px字
   ============================================ */

/* ========== 全局移动端基础规范 ========== */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    html {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
    }

    body {
        font-size: 14px;
        line-height: 1.6;
        overflow-x: hidden;
        padding-bottom: 60px; /* 底部导航高度 */
    }

    .container {
        width: 100%;
        max-width: 100%;
        padding: 0 12px;
        box-sizing: border-box;
    }

    h1 { font-size: 22px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
    h4 { font-size: 16px; }

    /* 所有可点击元素最小44px */
    a, button, input[type="submit"], input[type="button"],
    .nav-item, .mbn-item, .all-menu-link,
    .uc-btn, .admin-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* 输入框统一44px高、16px字体（防iOS缩放） */
    input[type="text"], input[type="email"], input[type="password"],
    input[type="tel"], input[type="number"], input[type="search"],
    input[type="date"], select, textarea {
        font-size: 16px !important;
        min-height: 44px;
        padding: 10px 12px !important;
        border-radius: 8px !important;
        box-sizing: border-box;
        width: 100%;
    }

    textarea {
        min-height: 80px;
        resize: vertical;
    }

    /* 卡片统一圆角 */
    .card, .admin-card, .uc-card, .member-card,
    .stat-card, .album-card, .fame-card, .event-item {
        border-radius: 10px !important;
    }

    /* 按钮统一圆角 */
    .btn, .uc-btn, .admin-btn, .nav-item, .mbn-item {
        border-radius: 8px !important;
    }

    /* 图片懒加载占位 */
    img[data-src] {
        background: #f0f0f0;
        min-height: 100px;
    }

    /* CSS transform 动画优化 */
    .nav, .all-menu-panel, .mbn-drawer,
    .dropdown-menu, .mobile-bottom-nav {
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
        will-change: transform;
    }
}

/* ========== 顶部导航优化 ========== */
@media (max-width: 768px) {
    .top-bar {
        display: none;
    }

    .header {
        height: 54px;
        padding: 0;
        position: sticky;
        top: 0;
        z-index: 1000;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    .header .container {
        height: 54px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 12px;
    }

    .logo {
        gap: 8px;
    }

    .logo-icon img {
        width: 36px;
        height: 36px;
    }

    .logo-text h1 {
        font-size: 16px;
        margin: 0;
    }

    .logo-text p {
        display: none;
    }

    /* 汉堡菜单按钮 */
    .mobile-menu-btn {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        cursor: pointer;
        gap: 5px;
        padding: 0;
    }

    .mobile-menu-btn span {
        display: block;
        width: 22px;
        height: 2px;
        background: #2C1810;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* 主导航：移动端全屏抽屉 */
    .nav {
        position: fixed;
        top: 54px;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        flex-direction: column;
        padding: 16px;
        gap: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        z-index: 999;
        visibility: hidden;
    }

    .nav.open {
        transform: translateX(0);
        visibility: visible;
    }

    .nav-item {
        width: 100%;
        padding: 14px 16px;
        font-size: 15px;
        border-bottom: 1px solid #f0f0f0;
        justify-content: flex-start;
        min-height: 48px;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown .dropdown-toggle {
        width: 100%;
        justify-content: space-between;
    }

    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 20px;
        display: none;
    }

    .nav-dropdown.open .dropdown-menu {
        display: block;
    }

    .dropdown-menu a {
        padding: 12px 16px;
        font-size: 14px;
        border-bottom: 1px solid #f5f5f5;
        min-height: 44px;
        justify-content: flex-start;
    }

    .all-menu-btn {
        display: none !important;
    }

    .nav-mobile-user {
        display: flex;
        flex-direction: column;
        margin-top: 16px;
        padding-top: 16px;
        border-top: 2px solid #f0f0f0;
    }

    .nav-mobile-user .nav-item {
        color: #C8102E;
    }
}

/* ========== 底部导航优化 ========== */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 58px;
        background: #fff;
        border-top: 1px solid #e8e8e8;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .mbn-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #999;
        font-size: 10px;
        gap: 2px;
        min-height: 58px;
        padding: 4px 0;
        position: relative;
    }

    .mbn-shape {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
    }

    .mbn-label {
        font-size: 10px;
        line-height: 1;
    }

    .mbn-item.active {
        color: #C8102E;
    }

    .mbn-item.active .mbn-shape {
        transform: scale(1.1);
    }

    .mbn-shape-menu {
        font-size: 22px;
    }

    /* 抽屉菜单 */
    .mbn-drawer-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1001;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

    .mbn-drawer-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .mbn-drawer {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 82%;
        max-width: 340px;
        background: #fff;
        z-index: 1002;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        display: flex;
        flex-direction: column;
        box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    }

    .mbn-drawer.show {
        transform: translateX(0);
    }

    .mbn-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px;
        border-bottom: 1px solid #f0f0f0;
        background: linear-gradient(135deg, #C8102E, #8B0000);
        color: #fff;
        min-height: 56px;
    }

    .mbn-drawer-title {
        font-size: 17px;
        font-weight: 600;
    }

    .mbn-drawer-close {
        background: none;
        border: none;
        color: #fff;
        font-size: 28px;
        cursor: pointer;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .mbn-drawer-body {
        flex: 1;
        overflow-y: auto;
        padding: 12px;
    }

    .mbn-drawer-group {
        margin-bottom: 16px;
    }

    .mbn-drawer-group-title {
        font-size: 12px;
        color: #999;
        padding: 8px 4px;
        font-weight: 600;
        text-transform: uppercase;
    }

    .mbn-drawer-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .mbn-drawer-link {
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 10px 6px;
        background: #f8f8f8;
        border-radius: 8px;
        text-decoration: none;
        color: #333;
        font-size: 12px;
        min-height: 48px;
        line-height: 1.3;
        transition: background 0.2s;
    }

    .mbn-drawer-link:active {
        background: #ffe0e0;
        color: #C8102E;
    }
}

/* ========== 首页优化 ========== */
@media (max-width: 768px) {
    .home-hero {
        padding: 24px 12px;
        text-align: center;
    }

    .home-hero h1 {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .home-hero p {
        font-size: 14px;
    }

    /* 统计卡片2列 */
    .stats-grid, .home-stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .stat-card {
        padding: 16px 12px !important;
        text-align: center;
    }

    .stat-card .stat-number {
        font-size: 24px !important;
    }

    .stat-card .stat-label {
        font-size: 12px !important;
    }

    /* 快捷导航3-4列网格 */
    .quick-nav, .home-quick-links {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
    }

    .quick-nav-item, .quick-link-item {
        padding: 12px 4px !important;
        font-size: 12px !important;
        text-align: center;
        min-height: 64px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .quick-nav-item .icon, .quick-link-item .icon {
        font-size: 24px;
    }

    /* 搜索框100%宽 */
    .search-box, .home-search {
        width: 100% !important;
        margin: 12px 0 !important;
    }

    .search-box input, .home-search input {
        font-size: 16px !important;
        height: 44px !important;
    }

    /* 名人精选横向滚动 */
    .fame-scroll, .hall-of-fame-scroll {
        display: flex !important;
        overflow-x: auto !important;
        gap: 12px !important;
        padding: 8px 0 !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .fame-card, .fame-scroll-item {
        flex: 0 0 140px !important;
        scroll-snap-align: start;
    }

    /* 相册2列 */
    .album-grid, .photo-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .album-card, .photo-card {
        aspect-ratio: 1;
        overflow: hidden;
    }

    .album-card img, .photo-card img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* ========== 家族树优化 ========== */
@media (max-width: 768px) {
    .family-tree-container, #familyTree, .tree-container {
        height: 55vh !important;
        min-height: 300px;
        width: 100% !important;
        touch-action: none;
        overflow: hidden;
        position: relative;
    }

    .tree-node, .family-tree-node {
        width: 100px !important;
        min-height: 50px;
        font-size: 12px;
        padding: 6px 8px;
    }

    .tree-node-name, .node-name {
        font-size: 13px;
        font-weight: 600;
    }

    .tree-controls, .tree-toolbar {
        position: fixed;
        right: 12px;
        bottom: 70px;
        flex-direction: column;
        gap: 8px;
        z-index: 100;
    }

    .tree-controls button, .tree-toolbar button {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        font-size: 18px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }

    .tree-legend {
        font-size: 11px;
        padding: 8px;
    }
}

/* ========== 族人名录优化 ========== */
@media (max-width: 768px) {
    .member-filter-bar, .filter-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
        background: #f8f8f8;
        border-radius: 8px;
        margin-bottom: 12px;
    }

    .member-filter-bar select, .filter-bar select,
    .member-filter-bar input, .filter-bar input {
        flex: 1;
        min-width: calc(50% - 4px);
        font-size: 14px !important;
        height: 40px !important;
    }

    /* 族人卡片1列 */
    .member-list, .members-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .member-card, .member-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
        background: #fff;
        border-radius: 10px;
        border: 1px solid #eee;
        width: 100%;
        box-sizing: border-box;
    }

    .member-card-avatar, .member-avatar {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        flex-shrink: 0;
        overflow: hidden;
    }

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

    .member-card-info, .member-info {
        flex: 1;
        min-width: 0;
    }

    .member-card-name, .member-name {
        font-size: 15px;
        font-weight: 600;
        color: #2C1810;
        margin-bottom: 2px;
    }

    .member-card-meta, .member-meta {
        font-size: 12px;
        color: #888;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .member-list-pagination {
        display: flex;
        justify-content: center;
        gap: 8px;
        margin-top: 16px;
    }

    .member-list-pagination a, .member-list-pagination span {
        min-width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        font-size: 14px;
    }
}

/* ========== 族人详情优化 ========== */
@media (max-width: 768px) {
    .member-detail-header, .detail-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px 16px;
        gap: 12px;
    }

    .member-detail-photo, .detail-photo {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        overflow: hidden;
    }

    .member-detail-photo img, .detail-photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .member-detail-name, .detail-name {
        font-size: 22px;
        font-weight: 700;
    }

    /* 列表式布局 */
    .detail-info-list, .member-info-section {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .detail-info-item, .info-item {
        display: flex;
        padding: 12px 16px;
        border-bottom: 1px solid #f0f0f0;
        font-size: 14px;
    }

    .detail-info-item .label, .info-item .label {
        width: 90px;
        color: #888;
        flex-shrink: 0;
    }

    .detail-info-item .value, .info-item .value {
        flex: 1;
        color: #333;
        word-break: break-all;
    }

    /* 家族信息卡片式 */
    .family-section, .relations-section {
        background: #fff;
        border-radius: 10px;
        margin: 12px;
        padding: 16px;
        border: 1px solid #eee;
    }

    .family-section h3, .relations-section h3 {
        font-size: 16px;
        margin: 0 0 12px;
        padding-bottom: 8px;
        border-bottom: 2px solid #C8102E;
        display: inline-block;
    }

    /* 谱文行高1.6 */
    .biography-content, .genealogy-text, .puwen-content {
        line-height: 1.6 !important;
        font-size: 14px;
        padding: 16px;
        background: #faf8f5;
        border-radius: 10px;
    }
}

/* ========== 聊天室优化 ========== */
@media (max-width: 768px) {
    .chat-container, #chatRoom {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 54px - 58px);
        min-height: 400px;
    }

    .chat-header {
        padding: 12px 16px;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #C8102E;
        color: #fff;
        flex-shrink: 0;
    }

    .chat-header h3 {
        font-size: 16px;
        margin: 0;
    }

    .chat-messages, .message-list {
        flex: 1;
        overflow-y: auto;
        padding: 12px;
        background: #f5f5f5;
        -webkit-overflow-scrolling: touch;
    }

    /* 消息气泡 */
    .chat-message, .message-item {
        display: flex;
        margin-bottom: 12px;
        gap: 8px;
        max-width: 85%;
    }

    .chat-message.self, .message-item.self {
        flex-direction: row-reverse;
        margin-left: auto;
    }

    .message-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        flex-shrink: 0;
        overflow: hidden;
    }

    .message-bubble {
        padding: 10px 14px;
        border-radius: 12px;
        font-size: 14px;
        line-height: 1.5;
        word-break: break-word;
        position: relative;
    }

    .chat-message:not(.self) .message-bubble,
    .message-item:not(.self) .message-bubble {
        background: #fff;
        border-top-left-radius: 4px;
    }

    .chat-message.self .message-bubble,
    .message-item.self .message-bubble {
        background: #C8102E;
        color: #fff;
        border-top-right-radius: 4px;
    }

    .message-sender {
        font-size: 11px;
        color: #999;
        margin-bottom: 2px;
    }

    .message-time {
        font-size: 10px;
        color: #bbb;
        margin-top: 4px;
    }

    /* 输入框固定底部适配键盘 */
    .chat-input-area, .message-input-bar {
        display: flex;
        gap: 8px;
        padding: 8px 12px;
        background: #fff;
        border-top: 1px solid #eee;
        flex-shrink: 0;
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }

    .chat-input-area input, .message-input-bar input {
        flex: 1;
        height: 40px !important;
        font-size: 15px !important;
        border-radius: 20px !important;
        padding: 0 16px !important;
    }

    .chat-input-area button, .message-input-bar button {
        width: 44px;
        height: 40px;
        border-radius: 20px;
        background: #C8102E;
        color: #fff;
        border: none;
        font-size: 16px;
        flex-shrink: 0;
    }

    /* 成员面板侧边抽屉 */
    .chat-members-panel, .member-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 75%;
        max-width: 300px;
        background: #fff;
        z-index: 1003;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    }

    .chat-members-panel.show, .member-panel.show {
        transform: translateX(0);
    }
}

/* ========== 用户中心优化 ========== */
@media (max-width: 768px) {
    .usercenter-header, .uc-header {
        background: linear-gradient(135deg, #C8102E, #8B0000);
        padding: 24px 16px;
        color: #fff;
        display: flex;
        align-items: center;
        gap: 14px;
        margin: -12px -12px 16px;
    }

    .usercenter-avatar, .uc-avatar {
        width: 64px;
        height: 64px;
        border-radius: 50%;
        border: 3px solid rgba(255,255,255,0.3);
        overflow: hidden;
        flex-shrink: 0;
    }

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

    .usercenter-info h2, .uc-info h2 {
        font-size: 18px;
        margin: 0 0 4px;
    }

    .usercenter-info p, .uc-info p {
        font-size: 13px;
        opacity: 0.85;
        margin: 0;
    }

    /* 菜单列表每项50px高+箭头 */
    .uc-menu-list, .usercenter-menu {
        background: #fff;
        border-radius: 10px;
        overflow: hidden;
        margin-bottom: 16px;
    }

    .uc-menu-item, .menu-item {
        display: flex;
        align-items: center;
        height: 50px;
        padding: 0 16px;
        border-bottom: 1px solid #f5f5f5;
        text-decoration: none;
        color: #333;
        font-size: 14px;
        gap: 12px;
        transition: background 0.2s;
    }

    .uc-menu-item:last-child, .menu-item:last-child {
        border-bottom: none;
    }

    .uc-menu-item:active, .menu-item:active {
        background: #f5f5f5;
    }

    .uc-menu-item .icon, .menu-item .icon {
        font-size: 18px;
        width: 24px;
        text-align: center;
    }

    .uc-menu-item .label, .menu-item .label {
        flex: 1;
    }

    .uc-menu-item .arrow, .menu-item .arrow {
        color: #ccc;
        font-size: 14px;
    }

    /* 退出登录底部全宽红色 */
    .uc-logout-btn, .logout-btn {
        display: flex;
        width: 100%;
        height: 50px;
        align-items: center;
        justify-content: center;
        background: #C8102E;
        color: #fff;
        border: none;
        border-radius: 10px;
        font-size: 15px;
        font-weight: 500;
        cursor: pointer;
        margin-top: 16px;
        text-decoration: none;
    }

    .uc-logout-btn:active, .logout-btn:active {
        background: #A00D24;
    }
}

/* ========== 名人堂/祭奠堂优化 ========== */
@media (max-width: 768px) {
    .fame-grid, .memorial-grid, .hall-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .fame-card, .memorial-card, .hall-card {
        padding: 12px;
        text-align: center;
    }

    .fame-card img, .memorial-card img, .hall-card img {
        width: 70px;
        height: 70px;
        border-radius: 50%;
        object-fit: cover;
        margin-bottom: 8px;
    }

    .fame-card-name, .memorial-card-name {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 4px;
    }

    .fame-card-title, .memorial-card-title {
        font-size: 11px;
        color: #888;
    }
}

/* ========== 大事记时间线优化 ========== */
@media (max-width: 768px) {
    .timeline, .event-timeline {
        padding-left: 24px;
        position: relative;
    }

    .timeline::before, .event-timeline::before {
        content: '';
        position: absolute;
        left: 8px;
        top: 0;
        bottom: 0;
        width: 2px;
        background: #C8102E;
    }

    .timeline-item, .event-item {
        position: relative;
        padding: 12px 16px;
        background: #fff;
        border-radius: 10px;
        margin-bottom: 12px;
        border: 1px solid #eee;
    }

    .timeline-item::before, .event-item::before {
        content: '';
        position: absolute;
        left: -20px;
        top: 16px;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: #C8102E;
        border: 2px solid #fff;
    }

    .timeline-date, .event-date {
        font-size: 12px;
        color: #C8102E;
        font-weight: 600;
        margin-bottom: 4px;
    }

    .timeline-title, .event-title {
        font-size: 15px;
        font-weight: 600;
        margin-bottom: 4px;
    }

    .timeline-content, .event-content {
        font-size: 13px;
        color: #666;
        line-height: 1.6;
    }
}

/* ========== 登录注册优化 ========== */
@media (max-width: 768px) {
    .auth-container, .login-container, .register-container {
        min-height: calc(100vh - 54px);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px 16px;
    }

    .auth-card, .login-card, .register-card {
        width: 100%;
        max-width: 380px;
        background: #fff;
        border-radius: 16px;
        padding: 28px 24px;
        box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    }

    .auth-card h2, .login-card h2, .register-card h2 {
        text-align: center;
        font-size: 22px;
        margin-bottom: 24px;
        color: #2C1810;
    }

    .auth-form-group, .form-group {
        margin-bottom: 16px;
    }

    .auth-form-group label, .form-group label {
        display: block;
        font-size: 14px;
        margin-bottom: 6px;
        color: #333;
    }

    .auth-form-group input, .form-group input {
        width: 100%;
        height: 48px !important;
        font-size: 16px !important;
        border-radius: 10px !important;
        padding: 0 14px !important;
        border: 1px solid #ddd;
        box-sizing: border-box;
    }

    .auth-submit-btn, .submit-btn {
        width: 100%;
        height: 48px;
        background: linear-gradient(135deg, #C8102E, #8B0000);
        color: #fff;
        border: none;
        border-radius: 10px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        margin-top: 8px;
    }

    .auth-links {
        text-align: center;
        margin-top: 16px;
        font-size: 13px;
    }

    .auth-links a {
        color: #C8102E;
        text-decoration: none;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* ========== 相册瀑布流优化 ========== */
@media (max-width: 768px) {
    .album-waterfall, .photo-masonry {
        column-count: 2;
        column-gap: 8px;
    }

    .album-waterfall-item, .photo-masonry-item {
        break-inside: avoid;
        margin-bottom: 8px;
        border-radius: 8px;
        overflow: hidden;
    }

    .album-waterfall-item img, .photo-masonry-item img {
        width: 100%;
        display: block;
    }
}

/* ========== 表格横向滚动优化 ========== */
@media (max-width: 768px) {
    .table-responsive, .admin-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }

    table {
        min-width: 600px;
        font-size: 13px;
    }

    th, td {
        padding: 10px 8px !important;
        white-space: nowrap;
    }
}

/* ========== 通用组件移动端优化 ========== */
@media (max-width: 768px) {
    /* 分页 */
    .pagination, .page-nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        margin-top: 16px;
    }

    .pagination a, .pagination span,
    .page-nav a, .page-nav span {
        min-width: 38px;
        height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        font-size: 13px;
        padding: 0 10px;
    }

    /* 标签页 */
    .tabs, .tab-nav {
        display: flex;
        overflow-x: auto;
        gap: 0;
        border-bottom: 2px solid #f0f0f0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar, .tab-nav::-webkit-scrollbar {
        display: none;
    }

    .tab-item, .tabs a {
        flex-shrink: 0;
        padding: 12px 16px;
        font-size: 14px;
        white-space: nowrap;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* 弹窗 */
    .modal, .dialog {
        width: calc(100% - 32px);
        max-width: 360px;
        border-radius: 14px;
        padding: 20px;
    }

    .modal-header, .dialog-header {
        font-size: 17px;
        margin-bottom: 12px;
    }

    .modal-actions, .dialog-actions {
        display: flex;
        gap: 10px;
        margin-top: 20px;
    }

    .modal-actions button, .dialog-actions button {
        flex: 1;
        height: 44px;
        border-radius: 8px;
        font-size: 15px;
    }

    /* 面包屑 */
    .breadcrumb {
        font-size: 12px;
        padding: 8px 0;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* 空状态 */
    .empty-state, .no-data {
        padding: 40px 20px;
        text-align: center;
    }

    .empty-state .icon, .no-data .icon {
        font-size: 48px;
        margin-bottom: 12px;
    }

    .empty-state p, .no-data p {
        font-size: 14px;
        color: #999;
    }
}

/* ========== 小屏专项优化 (≤375px) ========== */
@media (max-width: 375px) {
    body {
        font-size: 13px;
    }

    .container {
        padding: 0 10px;
    }

    .quick-nav, .home-quick-links {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .stat-card .stat-number {
        font-size: 20px !important;
    }

    .mbn-drawer-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .fame-grid, .memorial-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========== 平板优化 (768px-1024px) ========== */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }

    .quick-nav, .home-quick-links {
        grid-template-columns: repeat(5, 1fr) !important;
    }

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

    .album-grid, .photo-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .fame-grid, .memorial-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ========== 性能优化：减少重绘 ========== */
@media (max-width: 768px) {
    .nav.open, .mbn-drawer.show, .all-menu-panel.open {
        transform: translateX(0);
    }

    /* 图片懒加载过渡 */
    img.lazy {
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    img.lazy.loaded {
        opacity: 1;
    }

    /* 点击反馈 */
    .uc-menu-item:active, .menu-item:active,
    .mbn-item:active, .nav-item:active,
    .member-card:active, .quick-nav-item:active {
        background: #f0f0f0;
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* ========== 打印样式（保持PC端不受影响） ========== */
@media print {
    .mobile-bottom-nav, .mobile-menu-btn, .mbn-drawer {
        display: none !important;
    }
}

/* ========== v75: 移动端隐藏页脚（仅PC/平板显示） ========== */
@media (max-width: 768px) {
    .footer {
        display: none !important;
    }
    body {
        padding-bottom: 70px;
    }
}

/* ========== v75: 用户中心统一返回按钮样式 ========== */
.uc-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #fff, #FFFBF0);
    border-radius: 12px;
    border: 1px solid #E8DDD0;
}
.uc-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: linear-gradient(135deg, #C8102E, #8B0000);
    color: #fff !important;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    border: none;
    cursor: pointer;
    min-height: 36px;
}
.uc-back-btn:hover {
    background: linear-gradient(135deg, #8B0000, #6B0000);
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(200,16,46,.3);
}
.uc-back-btn::before {
    content: '←';
    font-size: 16px;
    font-weight: bold;
}
.uc-page-title {
    font-size: 18px;
    font-weight: 600;
    color: #2C1810;
    margin: 0;
}
@media (max-width: 768px) {
    .uc-page-header {
        padding: 10px 14px;
        gap: 8px;
    }
    .uc-back-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    .uc-page-title {
        font-size: 16px;
    }
}

/* ========== v75: 首页名人精选横向滚动优化 ========== */
.fame-scroll-container {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 8px 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #D4AF37 #f0f0f0;
}
.fame-scroll-container::-webkit-scrollbar {
    height: 4px;
}
.fame-scroll-container::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 2px;
}
.fame-scroll-container::-webkit-scrollbar-thumb {
    background: #D4AF37;
    border-radius: 2px;
}
.fame-scroll-item {
    flex: 0 0 130px;
    min-width: 0;
    scroll-snap-align: start;
    text-align: center;
    padding: 16px 10px;
    background: linear-gradient(180deg, #fff, #FFFBF0);
    border-radius: 14px;
    border: 1px solid #E8DDD0;
    text-decoration: none;
    color: inherit;
    transition: all .2s;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.fame-scroll-item:hover {
    border-color: #D4AF37;
    box-shadow: 0 4px 12px rgba(212,175,55,.2);
    transform: translateY(-2px);
}
.fame-scroll-item .fame-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    overflow: hidden;
}
.fame-scroll-item .fame-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.fame-scroll-item .fame-avatar.martyr {
    background: linear-gradient(135deg, #C8102E, #8B0000);
}
.fame-scroll-item .fame-avatar.honor {
    background: linear-gradient(135deg, #D4AF37, #B8860B);
}
.fame-scroll-item .fame-avatar.education {
    background: linear-gradient(135deg, #17A2B8, #117A8B);
}
.fame-scroll-item .fame-name {
    font-size: 15px;
    font-weight: bold;
    color: #2C1810;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fame-scroll-item .fame-title {
    font-size: 11px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}
@media (max-width: 375px) {
    .fame-scroll-item {
        flex: 0 0 115px;
        padding: 12px 6px;
    }
    .fame-scroll-item .fame-avatar {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
}
@media (min-width: 769px) {
    .fame-scroll-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        overflow-x: visible;
        gap: 16px;
    }
    .fame-scroll-item {
        flex: none;
    }
}

/* ===== v83: 通讯录移动端布局优化 ===== */
@media (max-width: 768px) {
    .contact-page form[method="get"] {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .contact-page form[method="get"] > div {
        min-width: 100% !important;
        flex: none !important;
    }
    .contact-page form[method="get"] > div:nth-child(4) {
        min-width: 60% !important;
    }
    .contact-page form[method="get"] > button {
        width: 100% !important;
        padding: 12px !important;
        font-size: 15px !important;
    }
    .contact-page .contact-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .contact-page .contact-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }
}
@media (max-width: 480px) {
    .contact-page form[method="get"] > div:nth-child(4) {
        min-width: 100% !important;
    }
    .contact-page form[method="get"] input,
    .contact-page form[method="get"] select {
        height: 42px !important;
        font-size: 15px !important;
    }
}

/* ===== v83: 移动端抽屉菜单滚动修复 ===== */
@media (max-width: 767px) {
    .mbn-drawer {
        height: 100vh !important;
        height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    .mbn-drawer-body {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 80px !important;
        max-height: calc(100vh - 56px) !important;
    }
    .mbn-drawer-body::-webkit-scrollbar {
        width: 4px;
    }
    .mbn-drawer-body::-webkit-scrollbar-thumb {
        background: #D4AF37;
        border-radius: 2px;
    }
    /* 确保抽屉打开时body不滚动但抽屉可滚 */
    body.drawer-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }
}
