/* 移动端 PWA 壳层 — 对齐 ui-reference/移动端 设计稿 */

/* PWA 独立窗口：顶栏/底栏避开系统安全区（需 viewport-fit=cover） */
@media (max-width: 960px) {
  html.pwa-standalone body.has-mobile-bottom-nav .mobile-top-bar {
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
  }

  html.pwa-standalone body.has-mobile-bottom-nav .mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

:root {
  --mobile-shell-bg: #eff3f6;
  --mobile-nav-bg: #6a8dbd;
  --mobile-nav-active-bg: rgba(255, 255, 255, 0.24);
  --mobile-nav-height: 78px;
  --mobile-topbar-height: 56px;
  --mobile-card-radius: 20px;
  --mobile-tab-notch-radius: 16px;
  --mobile-nav-radius: 20px;
}

@media (max-width: 960px) {
  body.has-mobile-bottom-nav.home-page {
    background: var(--mobile-shell-bg);
  }

  body.has-mobile-bottom-nav.home-page .home-shell {
    background: var(--mobile-shell-bg);
  }

  body.has-mobile-bottom-nav .home-main {
    margin-left: 0;
    padding: 0 16px calc(var(--mobile-nav-height) + 16px + env(safe-area-inset-bottom));
    background: var(--mobile-shell-bg);
  }

  body.has-mobile-bottom-nav main.page {
    padding-bottom: calc(var(--mobile-nav-height) + 16px + env(safe-area-inset-bottom));
  }

  body.has-mobile-chrome header.top > a.back,
  body.has-mobile-chrome a.back#backHome {
    display: none !important;
  }

  .mobile-top-bar--module {
    margin: 0 0 8px;
  }

  /* —— 顶栏：返回 + 耳别切换 + 成就/设置 —— */
  .mobile-top-bar {
    position: sticky;
    top: 0;
    z-index: 25;
    padding: 10px 0 12px;
    background: var(--mobile-shell-bg);
  }

  .mobile-top-bar__inner {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    min-height: var(--mobile-topbar-height);
  }

  .mobile-top-bar__inner:has(.mobile-top-bar__back) {
    padding-left: 40px;
  }

  .mobile-top-bar__back {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
  }

  .mobile-top-bar__back img {
    display: block;
    width: 10px;
    height: 17px;
  }

  .mobile-top-bar__back:hover,
  .mobile-top-bar__back:focus-visible {
    background: rgba(255, 255, 255, 0.72);
    outline: none;
  }

  .mobile-top-bar--back-only .mobile-top-bar__inner {
    min-height: 44px;
    padding-left: 40px;
  }

  .mobile-ear-toggle {
    justify-self: center;
    grid-column: 1 / -1;
    width: min(228px, 68vw);
  }

  /* 听阈查看：两档滑块与三档同宽，每格更宽便于显示「左耳/右耳」 */
  .mobile-ear-toggle:has(.sidebar-ear-toggle--dual) {
    width: min(228px, 68vw);
  }

  .mobile-ear-toggle .sidebar-ear-toggle {
    width: 100%;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(106, 141, 189, 0.18);
    box-shadow: 0 2px 8px rgba(106, 141, 189, 0.1);
  }

  .mobile-ear-toggle .sidebar-ear-toggle--dual {
    width: 100%;
    min-height: 40px;
    grid-template-rows: minmax(36px, auto);
  }

  .mobile-ear-toggle .sidebar-ear-toggle--dual .sidebar-ear-thumb {
    min-height: 36px;
    transform: none !important;
  }

  .mobile-ear-toggle .sidebar-ear-option {
    font-size: 0.88rem;
    padding: 7px 0;
  }

  .mobile-ear-toggle .sidebar-ear-toggle--dual .sidebar-ear-option {
    min-height: 36px;
    padding: 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
  }

  /* 模块/筛查页：耳别滑块在标题行（与 Web 端一致） */
  body.has-mobile-chrome main.page > header.top .top-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
  }

  body.has-mobile-chrome main.page > header.top .page-ear-toggle {
    flex: 1 1 180px;
    min-width: min(228px, 100%);
    max-width: 100%;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(106, 141, 189, 0.18);
    box-shadow: 0 2px 8px rgba(106, 141, 189, 0.1);
  }

  body.has-mobile-chrome main.page > header.top .page-ear-toggle .sidebar-ear-option {
    font-size: 0.88rem;
    padding: 7px 0;
  }

  .mobile-top-bar__trophy {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #fff;
    color: var(--mobile-nav-bg);
    box-shadow: 0 2px 8px rgba(106, 141, 189, 0.14);
    text-decoration: none;
  }

  .mobile-top-bar__trophy svg {
    width: 22px;
    height: 22px;
    display: block;
  }

  .mobile-top-bar__inner:has(.mobile-top-bar__trophy) {
    position: relative;
    padding-right: 44px;
  }

  .mobile-top-bar__actions {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .mobile-top-bar__action-btn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #fff;
    color: var(--mobile-nav-bg);
    box-shadow: 0 2px 8px rgba(106, 141, 189, 0.14);
    text-decoration: none;
  }

  .mobile-top-bar__action-btn img {
    display: block;
    object-fit: contain;
  }

  .mobile-top-bar__action-btn--settings img {
    width: 22px;
    height: 22px;
  }

  .mobile-top-bar__action-btn--help {
    background: transparent;
    box-shadow: none;
    width: 36px;
    height: 36px;
  }

  .mobile-top-bar__action-btn--help img {
    width: 36px;
    height: 36px;
  }

  .mobile-top-bar__inner:has(.mobile-top-bar__actions) {
    position: relative;
    padding-right: 84px;
  }

  /* —— 底部导航 —— */
  .mobile-bottom-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    min-height: var(--mobile-nav-height);
    padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
    background: var(--mobile-nav-bg);
    border-radius: var(--mobile-nav-radius) var(--mobile-nav-radius) 0 0;
    box-shadow: 0 -4px 20px rgba(58, 86, 124, 0.18);
  }

  .mobile-bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    border-radius: 14px;
    color: #fff;
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: 0.02em;
    transition: background 0.18s ease;
  }

  .mobile-bottom-nav__item.is-active {
    background: var(--mobile-nav-active-bg);
  }

  .mobile-bottom-nav__icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
  }

  .mobile-bottom-nav__icon img {
    width: 22px;
    height: 22px;
    display: block;
    filter: brightness(0) invert(1);
  }

  .mobile-bottom-nav__label {
    white-space: nowrap;
  }

  .bottom-nav {
    display: none !important;
  }

  /* —— 首页：仅隐藏右侧栏（热力图/成长曲线），进度与旅程沿用 home.css 桌面样式 —— */
  body[data-mobile-nav="home"] .home-col-right {
    display: none !important;
  }

  /* 今日康复旅程：隐藏「已合上 N 个圆环」；调试在每日筛查左侧、同一顶栏行 */
  body[data-mobile-nav="home"] .journey-overview {
    display: none !important;
  }

  body[data-mobile-nav="home"] .home-ref-progress,
  body[data-mobile-nav="home"] .home-ref-journey {
    border-radius: var(--mobile-card-radius);
    overflow: hidden;
  }

  /* 我的康复进度：移动端网格自适应，替代桌面绝对定位 */
  body[data-mobile-nav="home"] .home-ref-progress {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(2, minmax(0, 88px));
    grid-template-rows: auto auto;
    column-gap: clamp(6px, 2vw, 10px);
    row-gap: clamp(10px, 3vw, 14px);
    height: auto;
    min-height: 0;
    margin-top: 0;
    padding: 0 clamp(10px, 3vw, 14px) clamp(40px, 10vw, 48px);
  }

  body[data-mobile-nav="home"] .home-ref-progress .home-ref-tab,
  body[data-mobile-nav="home"] .home-ref-journey .home-ref-section-tab {
    border-radius: var(--mobile-card-radius) 0 var(--mobile-tab-notch-radius) 0;
  }

  body[data-mobile-nav="home"] .home-ref-progress .home-ref-tab {
    position: relative;
    left: auto;
    top: auto;
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    justify-self: start;
    width: auto;
    min-width: 0;
    max-width: 100%;
    height: 42px;
    margin-left: calc(-1 * clamp(10px, 3vw, 14px));
    padding: 0 clamp(12px, 3.5vw, 18px);
  }

  body[data-mobile-nav="home"] .home-ref-progress .home-ref-tab h2 {
    font-size: clamp(0.82rem, 3.6vw, 0.95rem);
    white-space: nowrap;
  }

  body[data-mobile-nav="home"] .home-ref-stats {
    position: relative;
    right: auto;
    top: auto;
    grid-column: 2 / 4;
    grid-row: 1;
    align-self: start;
    justify-self: end;
    display: flex;
    gap: clamp(6px, 2vw, 10px);
    min-width: 0;
    width: 100%;
    max-width: calc(88px * 2 + clamp(6px, 2vw, 10px));
  }

  body[data-mobile-nav="home"] .home-ref-stats article {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: 88px;
    height: auto;
    min-height: 72px;
    aspect-ratio: 1;
    padding: clamp(4px, 1.5vw, 6px);
    border-radius: clamp(12px, 3.5vw, 16px);
  }

  body[data-mobile-nav="home"] .home-ref-stats span {
    font-size: clamp(0.62rem, 2.8vw, 0.72rem);
    line-height: 1.2;
  }

  body[data-mobile-nav="home"] .home-ref-stats strong {
    font-size: clamp(1.35rem, 5.5vw, 1.75rem);
  }

  body[data-mobile-nav="home"] .home-ref-stat-duration .home-ref-stat-unit {
    right: clamp(4px, 1.5vw, 8px);
    bottom: clamp(4px, 1.5vw, 7px);
    font-size: clamp(0.55rem, 2.4vw, 0.65rem);
  }

  body[data-mobile-nav="home"] .home-ref-progress-main {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    padding-right: clamp(52px, 16vw, 72px);
    gap: clamp(6px, 2vw, 10px);
  }

  body[data-mobile-nav="home"] .home-ref-level {
    min-width: 0;
    height: clamp(34px, 10vw, 40px);
    padding: 0 clamp(10px, 3vw, 14px);
  }

  body[data-mobile-nav="home"] .home-ref-level strong {
    font-size: clamp(1.05rem, 4.5vw, 1.25rem);
  }

  body[data-mobile-nav="home"] .home-ref-progress-line {
    width: 100%;
    height: clamp(10px, 2.8vw, 12px);
  }

  body[data-mobile-nav="home"] .home-ref-exp {
    font-size: clamp(0.72rem, 3.2vw, 0.88rem);
  }


  body[data-mobile-nav="home"] .home-progress-action-btn {
    right: clamp(8px, 2.5vw, 12px);
    bottom: clamp(8px, 2.5vw, 12px);
    width: clamp(32px, 9vw, 36px);
    height: clamp(32px, 9vw, 36px);
  }

  body[data-mobile-nav="home"] .home-progress-action-icon {
    width: 100%;
    height: 100%;
  }

  @media (max-width: 380px) {
    body[data-mobile-nav="home"] .home-ref-progress {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body[data-mobile-nav="home"] .home-ref-progress .home-ref-tab {
      grid-column: 1 / -1;
    }

    body[data-mobile-nav="home"] .home-ref-stats {
      grid-column: 1 / -1;
      grid-row: 2;
      justify-self: stretch;
      justify-content: stretch;
      max-width: none;
    }

    body[data-mobile-nav="home"] .home-ref-stats article {
      max-width: none;
    }

    body[data-mobile-nav="home"] .home-ref-progress-main {
      grid-row: 3;
      padding-right: clamp(44px, 14vw, 56px);
    }
  }

  body[data-mobile-nav="home"] .home-ref-journey {
    padding-top: 58px;
  }

  body[data-mobile-nav="home"] .journey-pretest-entry {
    left: auto;
    right: 10px;
    top: 0;
    height: 46px;
    width: auto;
    max-width: calc(100% - 158px);
    justify-content: flex-end;
    gap: 8px;
    z-index: 5;
  }

  body[data-mobile-nav="home"] .journey-rings {
    margin-top: 0;
    padding-top: 4px;
  }

  body[data-mobile-nav="home"] .journey-pretest-menu {
    left: auto;
    right: 0;
    transform: none;
  }

  /* —— 错题本移动端 —— */
  body[data-mobile-nav="wrongbook"] .wb-review-content {
    display: none;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-landing {
    display: block;
  }

  .wb-mobile-landing {
    display: none;
    padding-top: 4px;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap {
    margin-bottom: 8px;
    padding-top: 58px;
    border-radius: var(--mobile-card-radius);
    overflow: hidden;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .heatmap-head {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: 46px;
    z-index: 3;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .heatmap-actions {
    position: absolute;
    right: 14px;
    top: 0;
    height: 46px;
    display: flex;
    align-items: center;
    padding-right: 0;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-ref-calendar-toolbar {
    display: flex;
    width: 100%;
    margin-bottom: 8px;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-ref-filter {
    display: flex;
    width: 100%;
    margin-bottom: 8px;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-unstable-summary {
    display: block;
    width: 100%;
    margin-bottom: 10px;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-ref-legend {
    display: flex;
    width: 100%;
    justify-content: center;
    margin-top: 10px;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-ref-calendar-wrap {
    align-items: stretch;
    width: 100%;
    padding: 0 8px 12px;
    box-sizing: border-box;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-ref-week-header,
  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-ref-month-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
    max-width: 100%;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-ref-month-grid {
    grid-auto-rows: auto;
    margin-bottom: 12px;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-ref-week-header span {
    width: 100%;
    aspect-ratio: 1;
    min-height: 0;
    font-size: 0.72rem;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-ref-month-grid .day-cell {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    min-height: 0;
    font-size: 0.72rem;
    display: grid;
    place-items: center;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-ref-month-grid .day-cell.clickable:hover {
    transform: none;
    box-shadow: none;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .heatmap-month-jump {
    padding: 0 4px;
    margin-top: 18px;
    margin-bottom: 6px;
    position: relative;
    z-index: 2;
    clear: both;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .home-ref-daily-detail {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    margin-top: 12px;
    max-height: none;
  }

  body[data-mobile-nav="wrongbook"] .wb-mobile-heatmap .heatmap-head h2 {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    min-width: 148px;
    height: 46px;
    padding: 0 22px;
    display: flex;
    align-items: center;
    font-size: var(--fs-card-title);
    font-weight: 800;
    border-radius: var(--mobile-card-radius) 0 var(--mobile-tab-notch-radius) 0;
  }

  .wb-mobile-start-btn {
    display: block;
    width: 100%;
    margin-top: 22px;
    padding: 14px 20px;
    border: 0;
    border-radius: 16px;
    background: var(--mobile-nav-bg);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(106, 141, 189, 0.28);
  }

  body[data-mobile-nav="wrongbook"] .wb-review-content {
    display: none;
  }

  body[data-mobile-nav="wrongbook"].wb-mobile-review-active .wb-mobile-landing {
    display: none;
  }

  body[data-mobile-nav="wrongbook"].wb-mobile-review-active .wb-review-content {
    display: block;
  }


  /* —— 成长统计 —— */
  body[data-mobile-nav="growth"] .growth-mobile-tabs {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin: 4px 0 16px;
    border-bottom: 0;
  }

  body[data-mobile-nav="growth"] .growth-mobile-tab {
    border: 0;
    background: transparent;
    padding: 8px 2px 10px;
    font-size: 0.92rem;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    position: relative;
  }

  body[data-mobile-nav="growth"] .growth-mobile-tab.is-active {
    color: var(--mobile-nav-bg);
  }

  body[data-mobile-nav="growth"] .growth-mobile-tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    border-radius: 999px;
    background: var(--mobile-nav-bg);
  }

  body[data-mobile-nav="growth"] .growth-mobile-panel {
    padding: 0;
    min-height: 0;
    background: transparent;
    box-shadow: none;
  }

  body[data-mobile-nav="growth"] .growth-mobile-panel[hidden] {
    display: none !important;
  }

  body[data-mobile-nav="growth"] .home-ref-growth {
    margin-top: 0;
    margin-bottom: 0;
    min-height: 0;
    padding: 16px 12px;
    border-radius: var(--mobile-card-radius);
    background: #fff;
    box-shadow: 0 8px 24px rgba(106, 141, 189, 0.12);
    overflow: hidden;
  }

  /* 顶栏 Tab 已标识页面，隐藏卡片内重复标题 */
  body[data-mobile-nav="growth"] .home-ref-growth .home-ref-section-tab {
    display: none;
  }

  /* 去掉内层白框，图表与卡片背景合一 */
  body[data-mobile-nav="growth"] .home-ref-chart-box,
  body[data-mobile-nav="growth"] .chart-box.home-ref-chart-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: auto !important;
    min-height: 0;
    padding: 34px 0 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
  }

  body[data-mobile-nav="growth"] .home-growth-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    margin: 0;
    pointer-events: none;
  }

  body[data-mobile-nav="growth"] .home-growth-module-bar {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 2px;
  }

  body[data-mobile-nav="growth"] .home-growth-module-bar::-webkit-scrollbar {
    display: none;
  }

  body[data-mobile-nav="growth"] .home-growth-module-chip {
    flex: 0 0 auto;
  }

  body[data-mobile-nav="growth"] .home-echarts-trend {
    width: 100%;
    height: 260px;
    min-height: 260px;
    flex: 0 0 260px;
    margin: 0;
  }

  body[data-mobile-nav="growth"] .home-growth-chart-footer {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0;
  }

  body[data-mobile-nav="growth"] .home-growth-chart-footer .home-growth-range-bar {
    justify-content: center;
  }

  body[data-mobile-nav="growth"] .home-growth-period-nav {
    justify-content: center;
  }

  body[data-mobile-nav="growth"] .home-growth-avg-note {
    padding: 6px 4px 0;
  }

  body[data-mobile-nav="growth"] .growth-mobile-panel[data-growth-panel="history"] {
    border-radius: var(--mobile-card-radius);
    background: #fff;
    box-shadow: 0 8px 24px rgba(106, 141, 189, 0.12);
    padding: 10px 4px 14px;
  }

  body[data-mobile-nav="growth"] .growth-hearing-history-inline {
    display: grid;
    gap: 12px;
  }

  /* 听阈小图横向尽量占满，给横轴频率标签留出空间 */
  body[data-mobile-nav="growth"] .growth-hearing-history-inline .hearing-history-chart-panel {
    margin: 0 -4px 16px;
    max-width: none;
    width: calc(100% + 8px);
  }

  body[data-mobile-nav="growth"] .growth-hearing-history-inline .hearing-history-chart-row {
    display: flex;
    align-items: stretch;
    gap: 4px;
    width: 100%;
  }

  body[data-mobile-nav="growth"] .growth-hearing-history-inline .hearing-history-chart-row .hearing-history-chart-frame {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
  }

  body[data-mobile-nav="growth"] .growth-hearing-history-inline .hearing-history-chart {
    width: 100%;
    height: 340px;
    min-height: 300px;
    overflow: visible;
  }

  body[data-mobile-nav="growth"] .growth-hearing-history-inline .hearing-degree-rail {
    flex: 0 0 62px;
    width: 62px;
    padding: 44px 0 72px;
  }

  body[data-mobile-nav="growth"] .growth-hearing-history-inline .hearing-degree-rail-text strong {
    font-size: 0.64rem;
  }

  body[data-mobile-nav="growth"] .growth-hearing-history-inline .hearing-degree-rail-text span {
    font-size: 0.58rem;
  }

  body[data-mobile-nav="growth"] .growth-hearing-history-inline .hearing-history-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 4px;
  }

  body[data-mobile-nav="growth"] .home-main {
    padding-left: 8px;
    padding-right: 8px;
  }

  /* —— 社区 —— */
  body[data-mobile-nav="community"] .community-feed-toolbar-desktop {
    display: none;
  }

  body[data-mobile-nav="community"] .community-feed-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px 40px;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
  }

  body[data-mobile-nav="community"] .community-mobile-search {
    display: block;
    grid-column: 1;
    width: 100%;
    min-width: 0;
  }

  body[data-mobile-nav="community"] .community-mobile-messages-btn {
    position: relative;
    grid-column: 2;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: #fff;
    color: var(--mobile-nav-bg, var(--primary, #608bbb));
    box-shadow: 0 2px 10px rgba(106, 141, 189, 0.12);
    text-decoration: none;
    transition: color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  }

  body[data-mobile-nav="community"] .community-mobile-messages-btn:hover,
  body[data-mobile-nav="community"] .community-mobile-messages-btn:focus-visible {
    color: var(--mobile-nav-bg, var(--primary, #608bbb));
    box-shadow: 0 4px 14px rgba(106, 141, 189, 0.24);
    transform: translateY(-1px);
    outline: none;
  }

  body[data-mobile-nav="community"] .community-mobile-messages-btn svg {
    width: 24px;
    height: 24px;
    display: block;
  }

  body[data-mobile-nav="community"] .community-search-field {
    position: relative;
    width: 100%;
  }

  body[data-mobile-nav="community"] .community-search-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    height: 40px;
    border: 0;
    border-radius: 999px;
    padding: 0 36px 0 38px;
    background: #e4e8ed url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%23757575' stroke-width='2' d='M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14Z'/%3E%3Cpath stroke='%23757575' stroke-width='2' stroke-linecap='round' d='m16 16 5 5'/%3E%3C/svg%3E") 12px center no-repeat;
    font-size: 0.88rem;
    color: var(--text);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
  }

  body[data-mobile-nav="community"] .community-search-input:focus {
    background-color: #dde3ea;
    box-shadow: inset 0 0 0 1px rgba(106, 141, 189, 0.28);
  }

  body[data-mobile-nav="community"] .community-search-input::-webkit-search-cancel-button {
    display: none;
  }

  body[data-mobile-nav="community"] .community-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: rgba(117, 117, 117, 0.18);
    color: #5f6772;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
  }

  body[data-mobile-nav="community"] .community-search-clear:hover,
  body[data-mobile-nav="community"] .community-search-clear:focus-visible {
    background: rgba(117, 117, 117, 0.28);
    outline: none;
  }

  body[data-mobile-nav="community"] .community-compose-fab {
    grid-column: 3;
    justify-self: end;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    background: var(--mobile-nav-bg);
    color: #fff;
    box-shadow: 0 4px 14px rgba(106, 141, 189, 0.28);
  }

  body[data-mobile-nav="community"] .community-compose-fab svg {
    display: none;
  }

  body[data-mobile-nav="community"] .community-compose-fab::before {
    content: "+";
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 400;
  }

  body[data-mobile-nav="community"] .community-tabs {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 0;
    margin-bottom: 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body[data-mobile-nav="community"] .community-tab {
    flex: 0 0 auto;
    min-height: auto;
    padding: 0 0 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 0.92rem;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 3px solid transparent;
  }

  body[data-mobile-nav="community"] .community-tab.is-active {
    color: var(--mobile-nav-bg);
    background: transparent;
    box-shadow: none;
    border-bottom-color: var(--mobile-nav-bg);
  }

  body[data-mobile-nav="community"] .community-all-filters {
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 12px;
  }

  body[data-mobile-nav="community"] .community-all-filter {
    border: 0;
    background: transparent;
    font-size: 0.88rem;
    color: #4a5568;
    padding: 4px 0;
  }

  body[data-mobile-nav="community"] .community-all-filter.is-active {
    color: var(--mobile-nav-bg);
    font-weight: 700;
    border-bottom: 2px solid var(--mobile-nav-bg);
  }

  body[data-mobile-nav="community"] .community-feed-card {
    padding: 12px 0 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  body[data-mobile-nav="community"] .community-post-card,
  body[data-mobile-nav="community"] .community-feed-list > article,
  body[data-mobile-nav="community"] .community-feed-list > .community-feed-item {
    border-radius: var(--mobile-card-radius);
    background: #fff;
    box-shadow: 0 6px 20px rgba(106, 141, 189, 0.1);
    margin-bottom: 14px;
    padding: 16px;
  }

  /* —— 我的：头像 + 康复师申请 + 个人康复档案 —— */
  .mobile-profile-header {
    display: none;
  }

  body[data-mobile-nav="profile"] .mobile-profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 0 18px;
  }

  body[data-mobile-nav="profile"] .mobile-profile-header .sidebar-user-avatar {
    width: 88px;
    height: 88px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(106, 141, 189, 0.14);
  }

  body[data-mobile-nav="profile"] .mobile-profile-header .sidebar-user-avatar img,
  body[data-mobile-nav="profile"] .mobile-profile-header .sidebar-user-avatar .sidebar-default-avatar {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: inherit;
    object-fit: cover;
  }

  body[data-mobile-nav="profile"] .mobile-profile-header-copy {
    display: grid;
    gap: 4px;
    justify-items: center;
    text-align: center;
  }

  body[data-mobile-nav="profile"] .mobile-profile-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a1a;
  }

  body[data-mobile-nav="profile"] .mobile-profile-hint {
    font-size: 0.78rem;
    color: var(--sub-text);
  }

  body[data-mobile-nav="profile"] .home-hero {
    display: none !important;
  }

  /* —— 移动端隐藏各页主标题（底部 Tab / 顶栏已标识当前页） —— */
  body.has-mobile-bottom-nav.home-page .home-hero-copy {
    display: none !important;
  }

  body.has-mobile-bottom-nav.home-page .home-hero:not(:has(.home-hero-controls)) {
    display: none !important;
  }

  body.has-mobile-bottom-nav.home-page .home-hero:has(.home-hero-controls) {
    padding: 0;
    margin: 0 0 12px;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  body.has-mobile-bottom-nav.home-page .home-hero .home-hero-controls {
    width: 100%;
    justify-content: flex-end;
  }

  body[data-mobile-nav="wrongbook"] .wb-hero {
    display: none !important;
  }

  body[data-mobile-nav="profile"] .profile-therapist-section {
    display: block;
    margin-bottom: 14px;
    padding: 16px;
    border-radius: var(--mobile-card-radius);
  }

  body[data-mobile-nav="profile"] .profile-training-report-section {
    margin-bottom: 18px;
    padding-bottom: 16px;
  }

  body[data-mobile-nav="profile"] .profile-card {
    display: block;
    padding: 14px;
    border-radius: var(--mobile-card-radius);
  }

  body[data-mobile-nav="profile"] .profile-therapist-section .tl-card-head,
  body[data-mobile-nav="profile"] .profile-card .profile-section-head {
    flex-wrap: wrap;
    gap: 10px;
  }

  body[data-mobile-nav="profile"] .profile-inline {
    flex-direction: column;
  }

  body[data-mobile-nav="profile"] .profile-inline .profile-field {
    width: 100%;
  }

  body[data-mobile-nav="profile"] .profile-audiogram-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-profile-logout-wrap {
    display: none;
  }

  body[data-mobile-nav="profile"] .mobile-profile-logout-wrap {
    display: block;
    padding: 4px 0 calc(12px + env(safe-area-inset-bottom));
  }

  body[data-mobile-nav="profile"] .mobile-profile-logout-btn {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(192, 57, 43, 0.28);
    border-radius: 14px;
    background: #fff;
    color: #c0392b;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(106, 141, 189, 0.08);
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  }

  body[data-mobile-nav="profile"] .mobile-profile-logout-btn:hover,
  body[data-mobile-nav="profile"] .mobile-profile-logout-btn:focus-visible {
    background: #fff5f5;
    border-color: rgba(192, 57, 43, 0.45);
    outline: none;
  }

  body[data-mobile-nav="profile"] .mobile-profile-logout-btn:active {
    transform: scale(0.99);
  }

  @media (max-width: 640px) {
    body.has-mobile-bottom-nav .home-main {
      padding-left: 12px;
      padding-right: 12px;
    }

    body[data-mobile-nav="growth"] .home-main {
      padding-left: 6px;
      padding-right: 6px;
    }
  }
}

@media (min-width: 961px) {
  .mobile-top-bar,
  .mobile-bottom-nav,
  .wb-mobile-landing,
  .mobile-profile-header,
  .mobile-profile-logout-wrap {
    display: none !important;
  }
}
