.family-topbar,
.family-bottom-nav,
.family-product-dialog {
  display: none;
}

@media screen and (max-width: 820px) {
  .family-topbar ~ .topbar,
  .family-topbar ~ .library-bottom-nav {
    display: none;
  }

  .family-topbar,
  .family-bottom-nav,
  .family-product-dialog {
    color: #253c32;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  }

  .family-topbar {
    position: sticky;
    z-index: 22;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    margin-inline: calc(50% - 50vw);
    padding: 4px max(16px, env(safe-area-inset-right)) 4px max(16px, env(safe-area-inset-left));
    border-bottom: 1px solid #e8e6dd;
    background: #faf9f4;
  }

  .family-brand,
  .family-products-trigger,
  .family-bottom-nav button,
  .family-products-close,
  .family-product-link {
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
  }

  .family-brand,
  .family-products-trigger {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    padding: 0;
  }
  .family-brand {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.04em;
  }
  .family-brand .library-icon { width: 24px; height: 24px; color: #c55b43; }
  .family-topbar .library-share-mobile { margin-inline: auto 6px; }
  .family-products-trigger { gap: 6px; padding: 0 3px 0 8px; font-size: 14px; font-weight: 600; }
  .family-products-trigger svg { width: 18px; height: 18px; }

  .family-bottom-nav {
    position: fixed;
    z-index: 23;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    padding: 4px max(12px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-top: 1px solid #dfdfd4;
    background: #fffefa;
  }
  .family-bottom-nav button {
    display: grid;
    min-height: 49px;
    align-content: center;
    justify-items: center;
    gap: 1px;
    padding: 0;
    color: #566159;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
  }
  .family-bottom-nav button i {
    display: grid;
    width: 42px;
    height: 25px;
    place-items: center;
    border-radius: 12px;
  }
  .family-bottom-nav button svg { width: 21px; height: 21px; }
  .family-bottom-nav button[aria-current] { color: #205c44; font-weight: 700; }
  .family-bottom-nav button[aria-current] i { background: #e5efde; }

  .family-product-dialog[open] {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: flex;
    width: 100%;
    max-width: none;
    height: 100%;
    height: 100dvh;
    max-height: none;
    align-items: flex-end;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    background: rgba(28, 40, 31, .42);
    overscroll-behavior: contain;
  }
  .family-product-dialog::backdrop { background: transparent; }
  body:has(.family-product-dialog[open]) { overflow: hidden; }
  .family-product-sheet {
    width: 100%;
    max-height: 92%;
    padding: 8px max(18px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 22px 22px 0 0;
    background: #fffefa;
    box-shadow: 0 -5px 30px rgba(44, 41, 31, .10);
  }
  .family-product-handle { width: 39px; height: 4px; margin: 0 auto 6px; border-radius: 10px; background: #d5d6ce; }
  .family-product-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
  .family-product-heading h2 { margin: 0; color: #253c32; font: 700 22px/1.35 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
  .family-products-close { display: grid; width: 44px; height: 44px; margin-right: -8px; place-items: center; }
  .family-products-close svg { width: 21px; height: 21px; }
  .family-product-list { display: grid; }
  .family-paid-topics {
    margin-top: 7px;
    padding: 10px 12px 2px;
    border-radius: 12px;
    background: #f5f3eb;
  }
  .family-paid-topics h3 {
    margin: 0;
    color: #605e4e;
    font: 600 13px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  }
  .family-paid-topics .family-product-link { min-height: 47px; }
  .family-menu-shortcuts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #dedfd4;
  }
  .family-menu-shortcuts button {
    display: flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px;
    border: 0;
    border-radius: 9px;
    background: #f2f4eb;
    color: #344e40;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
  }
  .family-menu-shortcuts svg { width: 18px; height: 18px; }
  .family-product-link {
    display: grid;
    width: 100%;
    min-height: 56px;
    grid-template-columns: 31px 1fr auto;
    align-items: center;
    column-gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid #e7e7dd;
    text-align: left;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
  }
  .family-product-link:last-child { border-bottom: 0; }
  .family-product-icon { display: grid; width: 31px; height: 32px; place-items: center; color: #376454; }
  .family-product-icon svg { width: 23px; height: 23px; }
  .family-product-reading, .family-product-video { color: #a85540; }
  .family-product-books { color: #896538; }
  .family-current-product,
  .family-product-arrow { display: inline-flex; align-items: center; gap: 4px; }
  .family-current-product { color: #245c43; font-size: 12px; }
  .family-current-product svg { width: 16px; height: 16px; }
  .family-product-arrow { color: #849086; }
  .family-product-arrow svg { width: 15px; height: 15px; }
  .family-topbar button:focus-visible,
  .family-bottom-nav button:focus-visible,
  .family-product-dialog :is(a, button):focus-visible {
    outline: 2px solid #2a7053;
    outline-offset: -2px;
    border-radius: 5px;
  }
}

@media screen and (max-width: 820px) and (prefers-reduced-motion: no-preference) {
  .family-product-dialog[open] .family-product-sheet { animation: family-sheet-enter .18s ease-out both; }
  @keyframes family-sheet-enter { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
