.app-bottom-nav,
.app-more-backdrop,
.app-more-sheet {
  display: none;
}

@media (max-width: 1023px) {
  .app-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    min-height: calc(4.25rem + env(safe-area-inset-bottom, 0px));
    padding: 0.35rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
  }

  .theme-american .app-bottom-nav {
    border-top: 3px solid #c8102e;
    box-shadow: 0 -8px 24px rgba(0, 40, 104, 0.1);
  }

  .app-bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
    min-width: 0;
    min-height: 3.5rem;
    padding: 0.15rem 0.2rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #64748b;
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .app-bottom-nav__item i {
    font-size: 1.12rem;
    line-height: 1;
  }

  .app-bottom-nav__item.is-active,
  .app-bottom-nav__item[aria-current="page"] {
    color: var(--brand);
    background: var(--brand-soft);
  }

  .app-bottom-nav__item--book {
    color: var(--brand);
  }

  .theme-american .app-bottom-nav__item {
    border-radius: 3px;
  }

  body.nav-open .app-bottom-nav,
  body.chat-open .app-bottom-nav {
    display: none !important;
  }

  .page-home main {
    padding-bottom: 0 !important;
  }

  .site-footer {
    padding-bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px));
  }

  .app-more-backdrop {
    position: fixed;
    inset: 0;
    z-index: 64;
    display: block;
    background: rgba(15, 23, 42, 0.42);
  }

  .app-more-backdrop[hidden] {
    display: none !important;
  }

  .app-more-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 65;
    display: block;
    max-height: min(82dvh, 640px);
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    background: #fff;
    box-shadow: 0 -20px 60px rgba(15, 23, 42, 0.25);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: appSheetIn 220ms ease both;
  }

  .theme-american .app-more-sheet {
    border-radius: 0;
    border-top: 4px solid #c8102e;
  }

  .app-more-sheet[hidden] {
    display: none !important;
  }

  .app-more-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem 0.8rem;
    border-bottom: 1px solid #e2e8f0;
  }

  .app-more-sheet__head strong {
    display: block;
    color: var(--brand-ink);
    font-family: var(--font-display, system-ui, sans-serif);
    font-size: 1.05rem;
  }

  .app-more-sheet__head span {
    display: block;
    margin-top: 0.1rem;
    color: #64748b;
    font-size: 0.72rem;
  }

  .app-more-sheet__close {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
  }

  .app-more-sheet__body {
    padding: 0.9rem 1.1rem 1.2rem;
  }

  .app-more-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .app-more-grid a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.9rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: var(--brand-ink);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
  }

  .app-more-grid a i {
    width: 1.2rem;
    color: var(--brand);
    text-align: center;
  }

  .app-more-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.9rem;
  }

  .app-more-actions a,
  .app-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.55rem;
    padding: 0 0.8rem;
    border: 1px solid var(--brand-line);
    border-radius: 8px;
    background: #fff;
    color: var(--brand-ink);
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 0.76rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
  }

  .app-install-btn {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
  }

  .app-install-btn[hidden] {
    display: none !important;
  }

  .app-more-note {
    margin-top: 0.9rem;
    padding: 0.75rem 0.8rem;
    border-radius: 10px;
    background: var(--brand-paper);
    color: #526071;
    font-size: 0.74rem;
    line-height: 1.5;
  }

  .app-more-note strong {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--brand-ink);
    font-size: 0.78rem;
  }

  .app-more-note p {
    margin: 0;
  }

  .page-home .app-more-sheet {
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 360px) {
  .app-bottom-nav__item {
    font-size: 0.6rem;
  }

  .app-more-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-more-sheet {
    animation: none !important;
  }
}

@keyframes appSheetIn {
  from { transform: translateY(18px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 1023px) {
  body.keyboard-open .app-bottom-nav {
    display: none !important;
  }

  body.app-more-open {
    overflow: hidden;
  }
}
