* {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (min-width: 768px) and (max-width: 1180px) {
    .modal {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-content {
        margin: 5vh auto;
        max-height: 85vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        width: 95%;
        max-width: 43.75rem;
    }

    .modal-body {
        max-height: none;
        overflow-y: visible;
    }

    body,
    html {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #loginModal .modal-content {
        margin: 3vh auto;
        max-height: 90vh;
        overflow-y: auto;
        max-width: 37.5rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 1rem;
        padding: 0.75rem 0.9375rem;
    }

    .btn {
        min-height: 2.75rem;
        padding: 0 1.25rem;
    }

    .nav-container {
        padding: 0.625rem 1.25rem;
        max-width: 100%;
    }

    .nav-actions {
        gap: 0.75rem;
    }

    .nav-erp-link {
        padding: 0.5rem 1.125rem;
        font-size: 0.8125rem;
    }

    .hero-section {
        height: 17.5rem;
    }

    .categories-grid .category-card {
        min-width: calc(33.333% - 0.875rem);
    }

    .recommend-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }

    .content-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }

    .admin-content {
        padding: 1.25rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        position: static;
        height: auto;
    }

    .admin-menu {
        display: flex;
        overflow-x: auto;
        padding: 0.625rem 0.9375rem;
        gap: 0.625rem;
        -webkit-overflow-scrolling: touch;
    }

    .admin-menu li {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.625rem 0.9375rem;
        border-radius: 0.5rem;
    }

    .admin-content {
        padding: 0.9375rem;
    }

    .user-layout {
        flex-direction: column;
    }

    .user-sidebar {
        width: 100%;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.875rem;
    }

    .nav-actions {
        gap: 0.9375rem;
    }

    .categories-grid .category-card {
        min-width: calc(33.333% - 0.875rem);
    }

    .recommend-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5625rem;
    }

    .content-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5625rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }

    .nav-container {
        padding: 0.625rem 0.75rem;
    }

    .nav-bar {
        margin: 0;
    }

    .logo-wrapper {
        gap: 8px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-container table {
        min-width: 100%;
    }

    th, td {
        padding: 0.625rem;
        font-size: 0.8125rem;
    }

    .action-btns {
        flex-wrap: wrap;
    }

    .action-btns .btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.9375rem;
    }

    .panel-toolbar {
        flex-wrap: wrap;
    }

    .goods-filter,
    .order-filter,
    .shipping-filter {
        flex-direction: column;
    }

    .goods-filter .search-input,
    .order-filter .search-input,
    .shipping-filter .search-input {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .merchant-stats-grid {
        grid-template-columns: 1fr;
    }

    .logo-text h1 {
        font-size: 1.125rem;
    }

    .logo-text p {
        font-size: 0.6875rem;
    }

    .btn {
        padding: 0 1rem;
        font-size: 0.8125rem;
        height: 2.25rem;
    }

    .panel-header,
    .panel-toolbar {
        padding: 0.9375rem;
    }

    .admin-content {
        padding: 0.625rem;
    }

    .image-upload-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #detailImageGrid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-section {
        height: 13.75rem;
        margin: 0 0.75rem;
        border-radius: 0.75rem;
    }

    .carousel-slide-title {
        font-size: 0.875rem;
        padding: 0.25rem 0.75rem;
        top: 0.625rem;
    }


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

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

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

    .categories-section {
        margin-top: -1.875rem;
    }

    .categories-grid {
        gap: 0.75rem;
    }

    .categories-grid .category-card {
        min-width: calc(50% - 0.375rem);
        padding: 1.5625rem 0.9375rem;
    }

    .category-icon {
        width: 4.375rem;
        height: 4.375rem;
        font-size: 1.875rem;
        border-radius: 1rem;
        margin-bottom: 0.9375rem;
    }

    .category-card h3 {
        font-size: 1rem;
    }

    .recommend-card-img {
        height: 9.375rem;
    }

    .office-content h2 {
        font-size: 1.75rem;
    }

    .office-content > p {
        font-size: 1rem;
        margin-bottom: 1.875rem;
    }

    .office-cards {
        gap: 1.25rem;
        flex-direction: column;
        align-items: center;
    }

    .office-card {
        width: 100%;
        max-width: 16.25rem;
        padding: 1.5625rem 1.875rem;
    }

    .office-card i {
        font-size: 2rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5625rem;
    }

    .footer-section h3 {
        font-size: 1rem;
    }

    .footer-links a {
        font-size: 0.875rem;
    }

    .footer-contact-item {
        font-size: 0.875rem;
    }

    .footer-social a {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1rem;
    }

    .nav-actions {
        gap: 0.625rem;
    }

    .nav-erp-link {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    .notification-panel {
        width: 18.75rem;
        right: -3.125rem;
    }

    .notification-item {
        padding: 0.75rem 0.9375rem;
        min-height: auto;
        height: auto;
    }

    .notification-icon {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1rem;
    }

    .notification-title {
        font-size: 0.8125rem;
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .notification-text {
        font-size: 0.75rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        overflow: visible;
    }

    .notification-time {
        font-size: 0.6875rem;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.625rem;
    }

    .nav-container {
        padding: 0.5rem 0.625rem;
    }

    .logo-wrapper {
        gap: 6px;
    }

    .hero-section {
        height: 11.25rem;
        margin: 0 0.5rem;
        border-radius: 0.5rem;
    }

    .hero-title {
        font-size: 1.375rem;
        padding: 0.5rem 1rem;
    }

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

    .carousel-btn {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.875rem;
    }

    .carousel-btn.prev {
        left: 0.625rem;
    }

    .carousel-btn.next {
        right: 0.625rem;
    }

    .carousel-dots {
        bottom: 0.9375rem;
    }

    .carousel-dot {
        width: 0.625rem;
        height: 0.625rem;
    }

    .section-title {
        font-size: 1.125rem;
        margin-bottom: 1.5625rem;
    }

    .categories-grid {
        gap: 0.625rem;
    }

    .categories-grid .category-card {
        min-width: calc(50% - 0.3125rem);
        padding: 1.25rem 0.625rem;
    }

    .category-icon {
        width: 3.4375rem;
        height: 3.4375rem;
        font-size: 1.5rem;
        border-radius: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .category-card h3 {
        font-size: 0.875rem;
    }

    .recommended-section {
        padding: 2.5rem 0;
    }

    .recommend-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .recommend-card-img {
        height: 7.5rem;
    }

    .recommend-card-content {
        padding: 0.75rem;
    }

    .recommend-card-title {
        font-size: 0.875rem;
    }

    .recommend-card-price {
        font-size: 1rem;
    }

    .recommend-card-meta {
        font-size: 0.75rem;
    }

    .recommend-card-stats {
        font-size: 0.6875rem;
    }

    .office-section {
        padding: 2.5rem 0;
        margin: 0 0.5rem;
        border-radius: 0.75rem;
    }

    .office-content {
        padding: 2.5rem 0.9375rem;
    }

    .office-content h2 {
        font-size: 1.5rem;
    }

    .office-content > p {
        font-size: 0.875rem;
        margin-bottom: 1.5625rem;
    }

    .office-card {
        padding: 1.25rem 1.5625rem;
        max-width: 15rem;
    }

    .office-card h3 {
        font-size: 1rem;
    }

    .apply-btn {
        padding: 0.75rem 2.1875rem;
        font-size: 1rem;
    }

    .footer {
        padding: 2.5rem 0 1.25rem;
        margin-top: 2.5rem;
    }

    .footer-section h3 {
        font-size: 0.9375rem;
    }

    .footer-links a {
        font-size: 0.8125rem;
    }

    .footer-contact-item {
        font-size: 0.8125rem;
        margin-bottom: 0.75rem;
    }

    .footer-social {
        gap: 0.625rem;
    }

    .footer-social a {
        width: 2.125rem;
        height: 2.125rem;
        font-size: 0.875rem;
    }

    .footer-bottom p {
        font-size: 0.75rem;
    }

    .footer-admin-link {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .logo-image {
        width: 3.125rem;
        height: 3.125rem;
    }

    .logo-icon {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1.25rem;
    }

    .logo-text h1 {
        font-size: 1rem;
    }

    .logo-text p {
        font-size: 0.625rem;
    }

    .login-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }

    .nav-erp-link {
        padding: 0.375rem 0.75rem;
        font-size: 0.6875rem;
    }

    .notification-panel {
        width: 17.5rem;
        right: -5rem;
    }

    .notification-header {
        padding: 0.75rem 0.9375rem;
    }

    .notification-header h3 {
        font-size: 0.875rem;
    }

    .notification-item {
        padding: 0.75rem 0.9375rem;
        min-height: auto;
        height: auto;
    }

    .notification-icon {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1rem;
    }

    .notification-title {
        font-size: 0.8125rem;
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .notification-text {
        font-size: 0.75rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        overflow: visible;
    }

    .notification-time {
        font-size: 0.6875rem;
    }

    .modal-content {
        padding: 0.75rem;
        border-radius: 0.5rem;
    }

    .modal-header {
        padding-bottom: 0.75rem;
        margin-bottom: 0.9375rem;
    }

    .modal-header h3 {
        font-size: 0.9375rem;
    }

    .form-group {
        margin-bottom: 0.9375rem;
    }

    .form-group label {
        font-size: 0.8125rem;
        margin-bottom: 0.375rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
    }

    .main-content {
        padding: 0;
    }

    .page-header {
        padding: 0 1.25rem;
        height: 6.25rem;
        margin: 0.9375rem 0.9375rem 1.25rem 0.9375rem;
        border-radius: 0.75rem;
    }

    .page-header .container {
        padding: 0;
        margin: 0;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    .page-content {
        padding: 0 0.9375rem;
    }

    .page-content .container {
        padding: 0;
        max-width: 100%;
        margin: 0;
        width: 100%;
    }

    .filter-bar {
        padding: 0.9375rem;
        margin-bottom: 1.25rem;
    }

    .card-content {
        padding: 0.9375rem;
    }

    .card-title {
        font-size: 0.875rem;
    }

    .card-price {
        font-size: 1.125rem;
    }
}

@media (max-width: 360px) {
    .logo-image {
        width: 2.5rem;
        height: 2.5rem;
    }

    .logo-text h1 {
        font-size: 0.875rem;
    }

    .logo-text p {
        font-size: 0.5625rem;
    }

    .mobile-menu-toggle {
        width: 2.375rem;
        height: 2.375rem;
    }

    .category-card {
        padding: 0.9375rem 0.5rem;
    }

    .category-icon {
        width: 3rem;
        height: 3rem;
        font-size: 1.25rem;
    }

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

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

    .nav-erp-link {
        padding: 0.3125rem 0.625rem;
        font-size: 0.625rem;
    }

    .notification-panel {
        width: 16.25rem;
        right: -6.25rem;
    }

    .notification-item {
        padding: 0.75rem 0.9375rem;
        min-height: auto;
        height: auto;
    }

    .notification-title {
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .notification-text {
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        overflow: visible;
    }
}

@media (min-width: 1600px) {
    .container,
    .nav-container {
        max-width: 93.75rem;
    }

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

@media (min-width: 1920px) {
    .container,
    .nav-container {
        max-width: 112.5rem;
    }

    .categories-grid,
    .recommend-grid,
    .content-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

::-webkit-scrollbar {
    width: 0.5rem;
    height: 0.5rem;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0.25rem;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 0.25rem;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ══════════════════════════════════════════════════════════════════
   ★ 2026-11-05 移动端修复（viewport 由 width=1400 改为 device-width 后）
   1) index.html 内联样式用 position:relative !important 压掉了 style.css
      里 .nav-actions 的移动抽屉定位 → 抽屉变成 260x844 的相对定位块，
      把 header 撑满整屏。此处以同等 !important + 更靠后的顺序恢复 fixed。
   2) .mobile-menu-toggle 上原有内联 display:none，导致手机上无法打开
      下载/通知/登录抽屉；这里用 !important 覆盖（桌面端仍由
      style.css 的 display:none !important 隐藏）。
   3) 两个开关统一收到顶栏右侧，避免压住下方分类条。
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .nav-actions {
        position: fixed !important;
    }
    .mobile-menu-toggle {
        display: inline-flex !important;
        position: fixed !important;
        top: 3px !important;
        right: 8px !important;
        left: auto !important;
        width: 34px !important;
        height: 34px !important;
        z-index: 1400 !important;
        border-radius: 10px !important;
        padding: 0 !important;
        margin: 0 !important;
        font-size: 15px !important;
    }
    .tc-sidebar-toggle {
        top: 3px !important;
        left: auto !important;
        right: 50px !important;
        width: 34px !important;
        height: 34px !important;
        z-index: 1400 !important;
    }
}
/* ★ 2026-11-05 平板端（769-900）：侧栏仍是抽屉，但顶栏还是桌面式（右侧被下载/登录占满），
   因此把侧栏开关留在分类条左端，并给分类条留出左侧空位，避免压住首个分类胶囊。 */
@media (min-width: 769px) and (max-width: 900px) {
    .tc-sidebar-toggle {
        top: 46px !important;
        left: 10px !important;
        width: 36px !important;
        height: 36px !important;
    }
    #homeCatTopBar .home-catbar-inner {
        padding-left: 54px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
 * ★ 2026-11-08　手机 / 平板浏览器适配层（本文件最后加载，优先级最高）
 *
 * 背景：390px 下顶栏把「下载 / 通知 / 购物车 / 登录」推到 left=430~583，
 *       全部被裁出视口；唯一可见的是右上角两个圆形按钮，点开后才出现
 *       一列无遮罩、无背景的浮动按钮（既不像菜单也挡住内容），
 *       手机上等于找不到登录入口。平板 820 勉强可用，但侧栏按钮压住标题。
 *
 * 这里改为标准移动端顶栏：
 *        [LOGO] ……… [下载] [消息] [购物车] [登录] [☰]
 *   常用入口全部内联可见；☰ 固定在最右，打开左侧分类抽屉（带遮罩）。
 * ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    /* ── 0. 基础：禁止横向滚动、禁止 iOS 旋转字号放大 ── */
    html,
    body {
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
    }

    /* ── 1. 顶栏：撤销「浮动按钮列」抽屉，恢复单行内联 ── */
    .header-center-slot {
        display: none !important;
    }
    .mobile-menu-toggle {
        display: none !important;
    }
    .nav-container {
        padding: 0 10px !important;
        min-height: 44px !important;
        gap: 8px !important;
    }
    .nav-actions {
        position: static !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
        bottom: auto !important;
        width: auto !important;
        height: auto !important;
        max-height: none !important;
        background: transparent !important;
        box-shadow: none !important;
        transform: none !important;
        overflow: visible !important;
        z-index: auto !important;
        padding: 0 44px 0 0 !important; /* 右侧给固定的抽屉开关让位 */
        gap: 5px !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-end !important;
        align-items: center !important;
        transition: none !important;
    }
    /* 768 段把通知/用户块拉成 100% 宽（抽屉布局），这里恢复自适应 */
    .nav-actions .notification-btn,
    .nav-actions .user-section {
        width: auto !important;
        justify-content: flex-end !important;
    }
    .nav-actions .user-section {
        flex: 0 0 auto !important;
    }
    .nav-actions > .download-wrapper,
    .nav-actions > .notification-wrapper,
    .nav-actions > .cart-wrapper,
    .nav-actions > .user-section {
        height: 32px !important;
    }
    .nav-actions .nav-3d-btn {
        height: 32px !important;
        min-height: 32px !important;
        line-height: 32px !important;
        padding: 0 10px !important;
        font-size: 12.5px !important;
    }
    .nav-actions .btn-cart,
    .nav-actions .btn-notification {
        width: 32px !important;
        min-width: 32px !important;
        padding: 0 !important;
    }
    .nav-actions .btn-download {
        width: 32px !important;
        min-width: 32px !important;
        padding: 0 !important;
        justify-content: center !important;
    }
    .nav-actions .btn-download span {
        display: none !important; /* 手机只留下载图标 */
    }
    .nav-actions .btn-login {
        height: 32px !important;
        min-height: 32px !important;
        padding: 0 10px !important;
        font-size: 12.5px !important;
    }
    .logo-image-small {
        width: 30px !important;
        height: 30px !important;
    }
    .logo-title {
        font-size: 15px !important;
        white-space: nowrap !important;
    }
    .logo-card-inner {
        gap: 7px !important;
    }

    /* ── 2. 抽屉开关固定在顶栏最右（不再压住侧栏标题） ── */
    .tc-sidebar-toggle {
        top: 6px !important;
        right: 8px !important;
        left: auto !important;
        width: 32px !important;
        height: 32px !important;
        border-radius: 9px !important;
        z-index: 1400 !important;
    }
    .tc-sidebar-toggle i {
        font-size: 14px !important;
    }

    /* ── 3. 抽屉遮罩 ── */
    .tc-sidebar-mask {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.42);
        -webkit-backdrop-filter: blur(1px);
        backdrop-filter: blur(1px);
        z-index: 1090;
        display: none;
    }
    html.tc-sidebar-open .tc-sidebar-mask {
        display: block;
    }
    .tc-sidebar {
        z-index: 1100 !important;
    }
    /* 抽屉打开时锁住背景滚动，避免侧栏滑出后页面跟着上下跑 */
    html.tc-sidebar-open body {
        overflow: hidden !important;
    }

    /* ── 4. 主内容：左右留白收窄 ── */
    .categories-section {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    .main-content {
        margin-left: 0 !important;
    }

    /* ── 5. 首页分类搜索条 ── */
    .home-catbar-inner,
    #homeCatTopBar .home-catbar-inner {
        padding-left: 52px !important; /* 左上角抽屉开关让位 */
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .home-catbar-inner::-webkit-scrollbar {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
 * 手机（≤768）：卡片、列表、footer 紧凑化
 * ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* 卡片网格：宽屏那套 5 列 !important 在窄屏必须让位（含首页推荐流与分类页）
       —— aiPages.css 里的断点选择器带 #siteSharedFeed / .tc-cat-body 前缀（特异性更高），
          所以这里同样带上前缀，否则 !important 也压不住。 */
    #siteSharedFeed .cat-feed-grid,
    .tc-cat-body .cat-feed-grid,
    .cat-feed-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        padding: 2px 0 10px !important;
    }

    /* 卡片内文字：标题 2 行截断、正文 3 行截断，避免长文本撑高卡片 */
    .cat-feed-grid .cat-feed-title,
    .cat-feed-grid .cat-feed-body h3 {
        font-size: 13.5px !important;
        line-height: 1.35 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .cat-feed-grid .cat-feed-desc,
    .cat-feed-grid .cat-feed-body p {
        font-size: 12.5px !important;
        line-height: 1.5 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .cat-feed-grid .cat-feed-cover {
        padding-top: 62% !important; /* 封面矮一点，一屏能看到更多卡片 */
    }
    .cat-feed-grid .cat-feed-tag {
        font-size: 11.5px !important;
        padding: 1px 7px !important;
    }
    .cat-feed-paging {
        gap: 8px !important;
        margin: 10px 0 18px !important;
    }
    .cat-feed-paging .shared-paging-btn {
        min-width: 72px !important;
        height: 36px !important;
        padding: 0 12px !important;
        font-size: 12.5px !important;
    }

    /* 页脚：单列，间距收紧 */
    .footer-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 22px !important;
    }
    .footer {
        padding: 26px 0 16px !important;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
 * 小屏（≤420）：顶栏再收一档，避免 320~400 宽度溢出
 * ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 420px) {
    .nav-container {
        padding: 0 8px !important;
        gap: 6px !important;
    }
    .nav-actions {
        gap: 4px !important;
        padding-right: 40px !important;
    }
    .logo-image-small {
        width: 27px !important;
        height: 27px !important;
    }
    .logo-title {
        font-size: 14px !important;
    }
    .nav-actions .btn-cart,
    .nav-actions .btn-notification,
    .nav-actions .btn-download {
        width: 30px !important;
        min-width: 30px !important;
    }
    .nav-actions .nav-3d-btn {
        height: 30px !important;
        min-height: 30px !important;
        line-height: 30px !important;
    }
    .nav-actions .btn-login {
        height: 30px !important;
        min-height: 30px !important;
        padding: 0 8px !important;
        font-size: 12px !important;
    }
    .tc-sidebar-toggle {
        width: 30px !important;
        height: 30px !important;
        top: 7px !important;
        right: 6px !important;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
 * 手机（≤640）：表单控件、弹窗、触摸目标
 * ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    /* 发布表单：app.js 里是内联 grid-template-columns:1fr 1fr，手机必须单列 */
    #publishDynamicForm > div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
    }
    /* 支付方式两个大单选块：手机上竖排，避免一行挤两个 */
    #publishDynamicForm label[style*="min-width:170px"] {
        min-width: 0 !important;
        flex: 1 1 100% !important;
    }

    /* 输入控件：16px 起步，避免 iOS Safari 聚焦时自动放大整页 */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    textarea,
    select {
        font-size: 16px !important;
    }

    /* 详情弹窗：手机上尽量占满，关闭按钮放大到 40px 好点 */
    #sharedDetailBox {
        max-height: 94vh !important;
        border-radius: 14px !important;
    }
    #sharedDetailCloseBtn {
        width: 40px !important;
        height: 40px !important;
        font-size: 16px !important;
    }

    /* 抽屉里的导航项：拉到 44px 触摸友好 */
    .tc-sidebar-item {
        min-height: 44px !important;
    }

    /* 通用按钮/胶囊：触摸目标不低于 36px */
    .shared-paging-btn,
    .cat-cat-chip,
    .home-cat-chip {
        min-height: 36px !important;
    }
}

@media (max-width: 360px) {
    .logo-title {
        display: none !important;
    }
    #siteSharedFeed .cat-feed-grid,
    .tc-cat-body .cat-feed-grid,
    .cat-feed-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

