/* 全站手机端 App 风格 · 统一断点 860px */
:root {
  --app-nav-h: 64px;
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
}

.app-tabbar { display: none; }

@media (max-width: 860px) {
  body {
    padding-bottom: calc(var(--app-nav-h) + var(--app-safe-bottom) + 8px);
    overflow-x: hidden;
  }

  .admin-body {
    padding-bottom: 0 !important;
  }

  img, video, iframe, canvas, svg {
    max-width: 100%;
  }

  /* —— 顶栏 —— */
  .site-nav { position: sticky; top: 0; }
  .site-nav .inner { height: 52px; }
  .site-nav .nav-links .hide-sm,
  .site-nav .nav-links a:not(.btn):not(.app-keep) {
    display: none;
  }
  .site-footer { display: none; }
  .page-bg { background: #f3f6f9 !important; }

  /* —— 底部 Tab —— */
  .app-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    height: calc(var(--app-nav-h) + var(--app-safe-bottom));
    padding: 6px 8px var(--app-safe-bottom);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(15, 35, 55, .08);
    box-shadow: 0 -8px 30px rgba(21, 40, 70, .06);
    justify-content: space-around;
    align-items: flex-start;
  }

  .app-tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    color: #8b98a8;
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px;
    min-width: 0;
  }

  .app-tabbar a .ico {
    font-size: 20px;
    line-height: 1;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
  }

  .app-tabbar a .ico-svg {
    width: 22px;
    height: 22px;
    display: block;
  }

  .app-tabbar a.on { color: #0d9488; }

  .app-tabbar a.publish {
    position: relative;
    top: -14px;
    z-index: 2;
  }

  .app-tabbar a.publish .ico {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d9488, #0f766e);
    color: #fff !important;
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
    box-shadow: 0 8px 20px rgba(13, 148, 136, .4);
    display: grid;
    place-items: center;
  }

  .app-tabbar a.publish .lbl {
    display: none;
  }

  .app-tabbar a.has-badge {
    position: relative;
  }

  .app-tabbar a .tab-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #e11d48;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
  }

  /* —— 我的页 App 布局 —— */
  .me-page {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .me-page .dash-side {
    display: none !important;
  }

  .me-page .dash-layout,
  .me-page .dash-main,
  .me-page .container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  .me-page .dash-layout {
    padding: 8px 0 24px !important;
    gap: 0 !important;
  }

  .me-profile {
    border: 0 !important;
    border-radius: 16px !important;
    margin: 0 0 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: 0 2px 12px rgba(21, 40, 70, .05) !important;
    overflow: hidden !important;
  }

  .me-profile-bg {
    height: 88px !important;
  }

  .me-profile-inner {
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr) auto !important;
    grid-template-areas: "av meta edit" !important;
    align-items: start !important;
    gap: 10px 12px !important;
    padding: 0 14px 14px !important;
    margin-top: -34px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .me-av {
    grid-area: av;
    width: 72px !important;
    height: 72px !important;
    border-radius: 20px !important;
    border-width: 3px !important;
  }

  .me-meta {
    grid-area: meta;
    padding-top: 40px !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .me-meta h1 {
    font-size: 18px !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .me-title {
    font-size: 13px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .me-tags {
    max-width: 100%;
  }

  .me-edit-btn {
    grid-area: edit;
    margin: 40px 0 0 !important;
    align-self: start !important;
    flex-shrink: 0 !important;
    white-space: nowrap;
  }

  .me-stats {
    border: 0 !important;
    box-shadow: 0 2px 12px rgba(21, 40, 70, .05) !important;
    border-radius: 14px !important;
    padding: 12px 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .me-stats b { font-size: 17px !important; }

  .me-quick,
  .me-menu,
  .me-share,
  .me-progress-tip {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .me-quick {
    gap: 8px !important;
  }

  .me-quick .mq {
    border: 0 !important;
    box-shadow: 0 2px 10px rgba(21, 40, 70, .05) !important;
    padding: 12px 4px !important;
    min-width: 0 !important;
  }

  .me-menu {
    border: 0 !important;
    box-shadow: 0 2px 12px rgba(21, 40, 70, .05) !important;
    border-radius: 14px !important;
  }

  .me-menu a {
    padding: 15px 14px !important;
    min-width: 0;
  }

  .me-share {
    border: 0 !important;
    box-shadow: 0 2px 12px rgba(21, 40, 70, .05) !important;
    border-radius: 14px !important;
    padding: 16px 14px !important;
  }

  .me-share h2 {
    font-size: 16px !important;
  }

  .me-share .form-control,
  .me-share input {
    font-size: 16px !important;
    max-width: 100% !important;
  }

  /* —— 通用容器 / 表单 —— */
  .container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 12px;
    padding-right: 12px;
    box-sizing: border-box;
  }

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

  .form-control,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="url"],
  input[type="tel"],
  textarea,
  select {
    font-size: 16px !important; /* 防 iOS 自动放大 */
  }

  .flash {
    border-radius: 12px !important;
    font-size: 13px !important;
    padding: 12px 14px !important;
    word-break: break-word;
  }

  .btn-block,
  .panel-actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* —— 首页 —— */
  .hero {
    padding: 28px 0 20px !important;
  }

  .hero h1 {
    font-size: 28px !important;
    line-height: 1.2 !important;
  }

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

  .search-box {
    margin-top: 18px !important;
  }

  .search-box form {
    border-radius: 14px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px;
    padding: 10px !important;
  }

  .search-box form .btn {
    width: 100%;
  }

  .section {
    padding: 28px 0 40px !important;
  }

  .section-head {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .section-head h2 {
    font-size: 20px !important;
  }

  /* 首页名片：手机双列紧凑卡片 */
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .dash-main .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .profile-card {
    border-radius: 14px !important;
    box-shadow: 0 2px 10px rgba(21, 40, 70, .05) !important;
  }

  .profile-card:hover {
    transform: none !important;
  }

  .profile-card .cover {
    height: 56px !important;
  }

  .profile-card .body {
    padding: 0 10px 10px !important;
    text-align: center !important;
  }

  .profile-card .avatar {
    width: 44px !important;
    height: 44px !important;
    border-radius: 12px !important;
    border-width: 2px !important;
    margin: -22px auto 0 !important;
    display: block !important;
  }

  .profile-card .avatar.fallback {
    font-size: 16px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .profile-card h3 {
    margin-top: 8px !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center !important;
  }

  .profile-card .title {
    font-size: 11px !important;
    text-align: center !important;
  }

  .profile-card .bio {
    display: none !important;
  }

  .profile-card .foot {
    margin-top: 8px !important;
    padding-top: 8px !important;
    gap: 4px 8px;
    justify-content: center !important;
    flex-wrap: wrap !important;
  }

  .profile-card .cid {
    font-size: 10px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .profile-card .views {
    font-size: 10px !important;
    white-space: nowrap;
  }

  /* —— 登录 / 注册 —— */
  .auth-page {
    padding: 20px 12px 40px !important;
  }

  .auth-card {
    border-radius: 18px !important;
    padding: 24px 16px !important;
    box-shadow: 0 8px 24px rgba(21, 40, 70, .06) !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .auth-card h1 {
    font-size: 22px !important;
  }

  .auth-card .sub {
    font-size: 13px !important;
  }

  /* —— 用户中心侧栏 —— */
  .dash-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 0 28px !important;
    gap: 10px !important;
    min-height: 0 !important;
  }

  .dash-main {
    width: 100%;
    min-width: 0;
  }

  .dash-side {
    position: static !important;
    width: 100% !important;
    border-radius: 14px !important;
    padding: 8px !important;
    order: -1;
    box-shadow: none !important;
    border: 0 !important;
    background: transparent !important;
  }

  .dash-side .user-brief {
    display: none !important;
  }

  .dash-nav {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 8px !important;
    padding: 2px 2px 8px !important;
    margin: 0 -2px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .dash-nav::-webkit-scrollbar { display: none; }

  .dash-nav a {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    margin: 0 !important;
    border-radius: 999px !important;
    background: #fff !important;
    border: 1px solid var(--line);
    color: var(--muted) !important;
    box-shadow: 0 2px 8px rgba(21, 40, 70, .04);
  }

  .dash-nav a.active,
  .dash-nav a:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
  }

  .dash-main .panel {
    border-radius: 16px !important;
    padding: 16px 14px !important;
    margin-bottom: 10px !important;
    border: 0 !important;
    box-shadow: 0 4px 16px rgba(21, 40, 70, .05) !important;
  }

  .dash-main .panel h2 {
    font-size: 17px !important;
  }

  .panel-head {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .panel-actions {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 8px !important;
  }

  /* —— 旧仪表盘残留清理 —— */
  .hide-mobile { display: none !important; }

  .share-box {
    flex-direction: column !important;
  }

  .share-box .btn { width: 100%; }

  .share-tips div {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
  }

  .share-tips span {
    text-align: left !important;
    word-break: break-all;
  }

  .mini-body { min-width: 0; flex: 1; }

  .mini-h {
    flex-wrap: wrap;
  }

  .password-panel {
    max-width: 100% !important;
  }

  /* —— 完善名片向导 —— */
  .edit-wrap {
    max-width: 100% !important;
    padding: 12px 0 28px !important;
  }

  .wizard {
    border-radius: 18px !important;
    padding: 16px 14px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .wizard-steps {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    justify-content: flex-start !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px !important;
    padding-bottom: 6px;
  }

  .wizard-steps::-webkit-scrollbar { display: none; }

  .wizard-dot small { display: none !important; }

  .wizard-line {
    width: 14px !important;
    margin-bottom: 0 !important;
    flex-shrink: 0;
  }

  .wizard-actions {
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }

  .wizard-actions .btn {
    width: 100% !important;
    min-width: 0 !important;
  }

  .tags-input {
    min-height: 44px;
  }

  /* —— 照片作品 —— */
  .photo-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }

  .photo-add {
    font-size: 12px !important;
  }

  /* —— 我的帖子列表 —— */
  .my-posts {
    display: grid !important;
    gap: 10px !important;
  }

  .my-post {
    flex-wrap: wrap;
  }

  .mp-foot {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }

  .mp-foot span:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* —— 热门 / 瀑布流 / 发帖 / 详情 —— */
  .feed-page,
  .post-detail,
  .publish-page {
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 12px calc(24px + var(--app-nav-h) + var(--app-safe-bottom)) !important;
    box-sizing: border-box;
  }

  .feed-head {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .feed-head h1 {
    font-size: 20px !important;
    flex-shrink: 0;
    margin: 0 !important;
  }

  .feed-head-actions {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: auto !important;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    min-width: 0;
  }

  .feed-tabs {
    flex: 0 0 auto;
    min-width: 0;
  }

  .feed-tabs a {
    padding: 6px 12px !important;
    font-size: 13px !important;
  }

  .feed-pub-btn {
    display: none !important;
  }

  .waterfall,
  .dash-main .waterfall,
  .card-posts-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-count: unset !important;
    gap: 10px !important;
  }

  .post-card {
    margin: 0 !important;
    border-radius: 12px !important;
    width: 100% !important;
    display: flex !important;
  }

  .detail-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .da-btns {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .detail-actions .post-act {
    width: 100% !important;
    margin: 0 !important;
    justify-content: center !important;
    padding: 11px 10px !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }

  .detail-actions a,
  .da-card {
    width: auto !important;
    margin-left: 0 !important;
    text-align: left !important;
  }

  .da-extra {
    margin-left: 0 !important;
    width: 100% !important;
    justify-content: space-between !important;
  }

  .detail-actions .muted {
    text-align: left !important;
  }

  .detail-imgs {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }

  .detail-imgs.count-1 {
    grid-template-columns: 1fr !important;
  }

  .pc-form {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .pc-form textarea {
    width: 100% !important;
    font-size: 16px !important;
    min-height: 80px !important;
    box-sizing: border-box !important;
  }

  .pc-form-foot {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
  }

  .pc-form-foot .btn {
    width: auto !important;
    min-width: 88px;
    flex-shrink: 0;
  }

  .detail-card {
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

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

  .app-page {
    min-height: calc(100vh - 52px - var(--app-nav-h));
  }

  /* —— 名片页 —— */
  .card-page {
    padding: 10px 12px calc(24px + var(--app-nav-h) + var(--app-safe-bottom)) !important;
  }

  .card-shell {
    width: 100% !important;
  }

  .card-sheet {
    border-radius: 20px !important;
    box-shadow: 0 8px 24px rgba(21, 40, 70, .06) !important;
  }

  .card-cover {
    height: 100px !important;
  }

  .card-body {
    padding: 16px 16px 22px !important;
  }

  .card-profile {
    padding: 0 16px !important;
  }

  .card-name {
    font-size: 22px !important;
  }

  .card-stats {
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: center !important;
  }

  .social-bar {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .social-btn {
    width: 100% !important;
    justify-content: center;
  }

  .contact-row {
    flex-wrap: wrap !important;
    gap: 6px 10px !important;
  }

  .contact-row .val {
    white-space: normal !important;
    word-break: break-all !important;
    flex: 1 1 100% !important;
    order: 2;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  .contact-row .copy-btn {
    margin-left: auto;
  }

  .photos {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .comment-form {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .comment-form textarea {
    width: 100% !important;
    font-size: 16px !important;
    min-height: 80px !important;
    box-sizing: border-box !important;
  }

  .comment-form-foot {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
  }

  .comment-form .btn,
  .comment-form-foot .btn {
    width: auto !important;
    min-width: 88px;
    flex-shrink: 0;
  }

  .comment-item {
    max-width: 100%;
  }

  .c-body {
    min-width: 0 !important;
  }

  .c-body p {
    word-break: break-word;
  }

  .card-posts-title {
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media (max-width: 360px) {
  .engage-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

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

  .me-quick .mq {
    font-size: 11px;
    padding: 10px 4px;
  }

  .hero h1 {
    font-size: 24px !important;
  }
}
