.mobile-nav, .wechat-dialog, .wechat-reopen {
  --contact-bg: var(--paper, #fff);
  --contact-text: var(--text, #17181b);
  --contact-muted: var(--muted, #555862);
  --contact-line: var(--line, #e5e5e9);
  --contact-accent: var(--accent, #0066cc);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  box-sizing: border-box;
}
.mobile-nav *, .wechat-dialog * { box-sizing: border-box; }
.mobile-nav { display: none; }
.wechat-reopen { border: 0; padding: .4rem 0; font-size: inherit; background: transparent; color: var(--contact-accent); cursor: pointer; }

.wechat-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 0;
  width: min(calc(100% - 36px), 386px);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border: 1px solid var(--contact-line);
  border-radius: 20px;
  background: var(--contact-bg);
  color: var(--contact-text);
  box-shadow: 0 18px 55px #10152238;
  z-index: 11000;
}
.wechat-dialog:not([open]) { display: none; }
.wechat-dialog::backdrop { background: #0f182754; backdrop-filter: blur(3px); }
body:has(.wechat-dialog[open]) { overflow: hidden; }
.wechat-dialog__body { padding: 1.35rem 1.25rem .66rem; text-align: left; }
.wechat-dialog__body h2 {
  padding-right: 42px;
  margin: 0 0 .5rem;
  color: var(--contact-text);
  font-size: 1.38rem;
  line-height: 1.2;
  font-weight: 700;
}
.wechat-dialog__close {
  position: absolute;
  top: .48rem;
  right: .52rem;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--contact-muted);
  font: 400 1.6rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.wechat-dialog__close:hover { background: #f2f3f5; }
.wechat-dialog__steps { padding-inline-start: 1.12rem; margin: 0 0 .7rem; color: var(--contact-muted); font-size: .84rem; line-height: 1.6; }
.wechat-dialog label { display: block; margin: 0 0 .26rem; color: var(--contact-muted); font-size: .76rem; font-weight: 600; }
.wechat-dialog__field { display: flex; align-items: stretch; gap: .42rem; }
.wechat-dialog__field input {
  min-width: 0;
  flex: 1;
  padding: .47rem .55rem;
  margin: 0;
  border: 1px solid var(--contact-line);
  border-radius: 8px;
  background: #f8f8fa;
  color: var(--contact-text);
  font: 600 .875rem/1.3 ui-monospace, monospace;
  user-select: text;
}
.wechat-dialog__copy.wechat-dialog__copy {
  flex: none;
  min-height: 44px;
  padding: .45rem .62rem;
  border: 0;
  border-radius: 8px;
  background: var(--contact-accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.wechat-dialog__status { min-height: 1.2em; margin: .38rem 0 0; color: var(--contact-accent); font-size: .75rem; line-height: 1.4; }
.wechat-dialog :focus-visible, .mobile-nav :focus-visible { outline: 2px solid var(--contact-accent); outline-offset: -2px; }

@media (max-width: 720px) {
  body.theme-bb, body.theme-cc, body.nnpp-mobile-enhanced { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed;
    inset: auto 0 0;
    z-index: 10990;
    margin: 0;
    border-top: 1px solid var(--contact-line);
    padding: 3px max(6px, env(safe-area-inset-right, 0px)) calc(3px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
    background: rgba(255,255,255,.97);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    text-align: center;
  }
  .mobile-nav .mobile-nav__link {
    display: flex;
    min-height: 47px;
    gap: 2px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 2px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--contact-muted);
    font-family: inherit;
    font-size: .68rem;
    font-weight: 550;
    line-height: 1.16;
    text-decoration: none;
    cursor: pointer;
  }
  .mobile-nav .mobile-nav__link[aria-current], .mobile-nav .mobile-nav__link:hover,
  .mobile-nav button[data-wechat-open] { color: var(--contact-accent); }
  .mobile-nav__icon {
    width: 20px;
    height: 20px;
    background: currentColor;
    -webkit-mask: var(--nav-icon) center / contain no-repeat;
    mask: var(--nav-icon) center / contain no-repeat;
  }
  .mobile-nav__icon[data-icon="home"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 10 9-7 9 7v10a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E"); }
  .mobile-nav__icon[data-icon="catalog"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z'/%3E%3C/svg%3E"); }
  .mobile-nav__icon[data-icon="search"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.3'/%3E%3Cpath d='m15 15 5 5'/%3E%3C/svg%3E"); }
  .mobile-nav__icon[data-icon="wechat"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.5 15.5a7 7 0 0 1-2-.3L3 17l.7-2.9A5.8 5.8 0 0 1 2 10c0-3.3 3.1-6 7-6 3.3 0 6 1.8 6.8 4.3M22 15c0 2.8-2.7 5-6 5-1 0-1.8-.1-2.5-.4l-2.8 1.2.5-2.3A4.6 4.6 0 0 1 10 15c0-2.8 2.7-5 6-5s6 2.2 6 5zM7 9h.1m4 0h.1m3 5.8h.1m3 0h.1'/%3E%3C/svg%3E"); }
  .wechat-reopen,
  body.theme-bb .sp_wechat_button,
  body.theme-cc .sp_wechat_button { display: none !important; }
}
