/* 论坛 / 全站手机端适配 — 20260822 */
html {
  -webkit-text-size-adjust: 100%;
}
body {
  overflow-x: hidden;
}
body.ac-nav-open {
  overflow: hidden;
}

/* ── 汉堡菜单按钮 ── */
.ac-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #1f2329;
  cursor: pointer;
  flex-shrink: 0;
}
.ac-nav-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}
.ac-nav-toggle .icon-close {
  display: none;
}
.navbar.is-menu-open .ac-nav-toggle .icon-menu {
  display: none;
}
.navbar.is-menu-open .ac-nav-toggle .icon-close {
  display: block;
}

/* ── 顶栏右侧操作区对齐（下载 / 语言 / 登录） ── */
.ac-site-header .nav-user {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
}
.ac-site-header .nav-user > a,
.ac-site-header .nav-user > .dropdown,
.ac-site-header .nav-user > .ac-lang-switch-nav,
.ac-site-header .nav-user > [data-ac-lang] {
  display: inline-flex !important;
  align-items: center !important;
  flex-shrink: 0;
  vertical-align: middle;
}
.ac-site-header .nav-user .nav-cta-download,
.ac-site-header .nav-user .nav-login-btn,
.ac-site-header .nav-user .nav-cta-console {
  height: 34px !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
}
.ac-site-header .nav-user .ac-lang-switch-nav,
.ac-site-header .nav-user .ac-lang-btn-nav {
  height: 34px !important;
  align-self: center;
}
.ac-site-header .nav-user .dropdown {
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}

@media (max-width: 980px) {
  .ac-nav-toggle {
    display: inline-flex;
  }

  /* 顶栏两行 grid：第一行 logo + 操作 + 汉堡，第二行搜索 */
  .ac-site-header .navbar .container {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: auto auto;
    align-items: center !important;
    gap: 8px 6px !important;
    padding: 8px 12px !important;
    min-height: 0 !important;
    flex-wrap: unset !important;
  }
  .ac-site-header .nav-brand {
    grid-column: 1;
    grid-row: 1;
    flex: unset !important;
    min-width: 0 !important;
  }
  .ac-site-header .nav-brand-text strong {
    font-size: 15px;
  }
  .ac-site-header .nav-brand-text small {
    display: none;
  }
  .ac-site-header .nav-user {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    flex: unset !important;
    gap: 6px !important;
    min-width: 0;
  }
  .ac-nav-toggle {
    grid-column: 3;
    grid-row: 1;
    margin-left: 0 !important;
    justify-self: end;
  }
  .ac-site-header .navbar .ac-nav-search {
    grid-column: 1 / -1;
    grid-row: 2;
    order: unset !important;
    flex: unset !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
  }
  .ac-site-header .nav-user .nav-cta-download {
    display: none;
  }
  .ac-site-header .nav-user .nav-cta-console {
    font-size: 12px;
    padding: 0 10px !important;
    height: 32px !important;
  }
  .ac-site-header .nav-user .nav-register-btn {
    display: none;
  }
  .ac-site-header .nav-user .nav-login-btn {
    height: 32px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
  }
  .ac-site-header .nav-user .ac-lang-btn-nav {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
  }

  /* 抽屉导航 */
  .ac-site-header .nav-menu {
    display: none !important;
  }
  .navbar.is-menu-open .nav-menu {
    display: flex !important;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1200;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: calc(var(--ac-header-offset, 96px) + 8px) 16px 24px;
    background: #fff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: none;
  }
  .navbar.is-menu-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1199;
    background: rgba(15, 23, 42, 0.45);
  }
  .navbar.is-menu-open .nav-menu > li {
    width: 100%;
    border-bottom: 1px solid #f0f2f5;
  }
  .navbar.is-menu-open .nav-menu > li > a,
  .navbar.is-menu-open .nav-menu .nav-dropdown-toggle {
    display: block;
    padding: 14px 4px;
    font-size: 16px;
    font-weight: 600;
    color: #1f2329;
  }
  .navbar.is-menu-open .nav-dropdown-menu {
    position: static;
    display: block !important;
    box-shadow: none;
    border: 0;
    padding: 0 0 8px 12px;
    background: transparent;
  }
  .navbar.is-menu-open .nav-dropdown-menu a {
    display: block;
    padding: 10px 4px;
    font-size: 15px;
  }

  /* 搜索下拉面板全宽 */
  .ac-nav-search-panel {
    left: 0 !important;
    right: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
  }
}

@media (max-width: 480px) {
  .ac-site-header .nav-user .nav-cta-console {
    display: none;
  }
  .ac-ecosystem-strip-link {
    font-size: 11px;
    padding: 3px 8px;
  }
}

/* ── 论坛云社区布局 ── */
@media (max-width: 768px) {
  .cc-wrap,
  .cc-main,
  .cc-hero {
    padding-left: 12px;
    padding-right: 12px;
  }
  .cc-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .cc-side {
    order: -1;
  }
  .cc-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }
  .cc-item-thumb {
    flex: none !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    max-height: 180px;
  }
  .cc-item-body h3 {
    font-size: 15px;
    line-height: 1.45;
  }
  .cc-meta {
    flex-wrap: wrap;
    gap: 6px 10px;
  }
  .cc-searchbar {
    flex-direction: column;
    align-items: stretch;
  }
  .cc-searchbar .cc-publish,
  .cc-searchbar button[type="submit"] {
    width: 100%;
  }
  .cc-tabs {
    gap: 4px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .cc-tabs a {
    flex-shrink: 0;
    font-size: 13px;
    padding: 8px 12px;
  }
  .cc-banner {
    padding: 16px;
  }
  .cc-banner h1 {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .cc-item-thumb {
    max-height: 140px;
  }
  .cc-pager a,
  .cc-pager span {
    min-width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

/* ── 帖子详情 ── */
@media (max-width: 768px) {
  .fa-layout,
  .fa-main-grid {
    grid-template-columns: 1fr !important;
  }
  .fa-post-rail {
    position: static !important;
    width: 100% !important;
  }
}

/* ── 页脚合规区 ── */
@media (max-width: 768px) {
  .footer-qr-compliance {
    flex-direction: column !important;
    gap: 20px !important;
  }
  .footer-compliance {
    flex: 1 1 auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .footer-safe-badges a,
  .footer-safe-badges span {
    width: auto !important;
    max-width: calc(50% - 8px);
    height: auto !important;
    min-height: 40px;
    box-sizing: border-box !important;
  }
  .footer-qr-wrap > div[style*="display:flex"] {
    justify-content: center !important;
  }
  .footer-qr-wrap > div[style*="display:flex"] > div {
    width: 120px !important;
  }
}

/* ── 移动端快捷底栏（替代隐藏侧栏） ── */
.ac-mobile-bar {
  display: none;
}
@media (max-width: 960px) {
  .ac-mobile-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    align-items: stretch;
    justify-content: space-around;
    gap: 0;
    padding: 0 max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #e8edf5;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(8px);
  }
  .ac-mobile-bar a,
  .ac-mobile-bar button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 52px;
    border: 0;
    background: transparent;
    color: #646a73;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
  }
  .ac-mobile-bar svg {
    width: 20px;
    height: 20px;
  }
  .ac-mobile-bar .is-active {
    color: #0052d9;
  }
  body {
    padding-bottom: calc(58px + env(safe-area-inset-bottom));
  }
  .ac-back-top {
    bottom: calc(68px + env(safe-area-inset-bottom)) !important;
  }
  .ac-ai-widget {
    bottom: calc(68px + env(safe-area-inset-bottom)) !important;
  }
}

/* ── 控制台 ── */
@media (max-width: 900px) {
  .tc-console {
    grid-template-columns: 1fr !important;
  }
  .tc-side {
    position: static !important;
    width: 100% !important;
  }
  .tc-full-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
