.pwa-status {
  position: fixed;
  z-index: 120;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  display: flex;
  width: min(560px, calc(100vw - 24px));
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid #d9c3ad;
  border-radius: 999px;
  color: #3d322b;
  background: rgba(255, 249, 241, .97);
  box-shadow: 0 12px 32px rgba(58, 35, 20, .2);
  font-size: 12px;
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

.pwa-status[data-kind="offline"] { color: #7f3b2e; border-color: #e0a99d; background: rgba(255, 239, 234, .98); }
.pwa-status[data-kind="online"] { color: #2f6048; border-color: #a9ceb9; background: rgba(239, 250, 243, .98); }
.pwa-status button { min-height: 32px; padding: 5px 10px; border: 0; border-radius: 999px; color: #fff; background: #c84f26; font: inherit; font-weight: 800; }

.pwa-install-button {
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  border: 1px solid #d6b28f;
  border-radius: 14px;
  color: #8d472c;
  background: #fff7ed;
  font: inherit;
  font-weight: 800;
}

.pwa-install-note { margin: 8px 0 0; color: #8a7a6d; font-size: 11px; text-align: center; }
.pwa-header-install { white-space: nowrap; }

.pwa-install-guide {
  width: min(430px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 26px;
  color: #302924;
  background: #fffaf3;
  box-shadow: 0 32px 100px rgba(34, 20, 12, .42);
}

.pwa-install-guide::backdrop { background: rgba(31, 20, 14, .68); backdrop-filter: blur(5px); }
.pwa-install-guide form { position: relative; display: grid; justify-items: center; padding: 28px; text-align: center; }
.pwa-install-guide img { width: 92px; height: 92px; border-radius: 24px; box-shadow: 0 12px 28px rgba(122, 67, 33, .22); }
.pwa-install-guide h2 { margin: 4px 0 12px; font-size: 25px; }
.pwa-install-guide ol { width: 100%; margin: 0; padding: 14px 14px 14px 38px; border-radius: 16px; background: #f7ecdf; text-align: left; }
.pwa-install-guide li { margin: 7px 0; line-height: 1.55; }
.pwa-guide-safe { color: #766b62; font-size: 11px; line-height: 1.65; }
.pwa-guide-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border: 0; border-radius: 50%; color: #6f6259; background: #f2e6d8; font-size: 24px; }

@media (max-width: 900px) {
  .mobile-bottom-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mobile-bottom-nav #mobile-more-button::before { content: '全'; color: #d5c3ee; font-size: 14px; }
  .mobile-bottom-nav #mobile-more-button[aria-expanded="true"] { color: #c54e28; background: linear-gradient(180deg, rgba(245, 226, 208, .9), rgba(250, 239, 228, .72)); }
  .pwa-status { top: max(7px, env(safe-area-inset-top)); align-items: flex-start; border-radius: 16px; line-height: 1.45; }
}

@media (max-width: 700px) {
  .mobile-bottom-nav #mobile-more-button::before { content: none; display: none; }
  .mobile-bottom-nav #mobile-more-button > img { width: 29px; height: 29px; margin-bottom: 1px; filter: saturate(.72) brightness(1.02) drop-shadow(0 3px 4px rgba(54, 33, 20, .15)); }
  .session-user { flex-wrap: wrap; justify-content: flex-end; }
  .pwa-header-install { order: 3; }
}

/* 2026-08-21: freeze the bottom navigation geometry across view changes. */
@media (max-width: 900px) {
  .mobile-bottom-nav {
    contain: layout paint style;
    transform: translate3d(0, 0, 0) !important;
    backface-visibility: hidden;
  }
  .mobile-bottom-nav button,
  .mobile-bottom-nav button.active,
  .mobile-bottom-nav button:not(.active) {
    height: 52px;
    min-height: 52px;
    transform: none !important;
    transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
  }
  .mobile-bottom-nav button > img,
  .mobile-bottom-nav button[data-mobile-view="home"] > img,
  .mobile-bottom-nav button.active > img {
    width: 28px;
    height: 28px;
    margin: 0 0 2px;
    transform: none !important;
    transition: filter .15s ease;
  }
  .mobile-bottom-nav button::before,
  .mobile-bottom-nav button.active::before {
    transform: none !important;
  }
}

@media (display-mode: standalone) {
  [data-pwa-install], .pwa-install-note { display: none !important; }
}
