/* APP preview uses the real device chrome, so the page does not duplicate it. */
.mobile-app-shell .android-statusbar,
.mobile-app-shell .mobile-app-header > button {
  display: none !important;
}

.mobile-app-shell:not(.mobile-app-runtime) .mobile-app-header {
  grid-template-columns: minmax(0, 1fr);
  margin-top: 0;
}

.mobile-app-shell .mobile-app-title {
  grid-column: 1;
  gap: 9px;
}

.mobile-app-shell .mobile-app-title .brand-mark,
.mobile-app-shell .mobile-app-site-logo {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  object-fit: contain;
}

/* Let the APP canvas use the available screen instead of staying at 430px. */
.mobile-app-shell:not(.mobile-app-runtime) {
  grid-template-columns: minmax(0, 760px);
  width: 100%;
  min-height: 100dvh;
  place-items: start center;
  padding: 10px clamp(6px, 1.4vw, 14px) 0;
  overflow: visible;
}

.mobile-app-shell:not(.mobile-app-runtime) .mobile-device-frame {
  width: min(100%, 760px);
  min-width: 0;
  max-width: 100%;
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

.mobile-app-shell:not(.mobile-app-runtime) .mobile-phone-frame {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;
  min-height: 100dvh;
  padding-right: 18px;
  padding-bottom: calc(108px + env(safe-area-inset-bottom));
  padding-left: 18px;
  overflow: visible;
}

.mobile-app-shell:not(.mobile-app-runtime) .mobile-tabbar {
  position: fixed;
  right: auto;
  bottom: 0;
  left: 50%;
  z-index: 1400;
  width: min(calc(100vw - 12px), 748px);
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
}

/* The APP owns its category entry; the H5 floating menu remains unchanged. */
body:has(.mobile-app-shell:not(.mobile-app-runtime)) .mobile-site-menu-fab,
body:has(.mobile-app-shell:not(.mobile-app-runtime)) .mobile-site-menu-shade,
body:has(.mobile-app-shell:not(.mobile-app-runtime)) .mobile-site-menu-panel {
  display: none !important;
}

.mobile-tabbar .app-category-tab {
  cursor: pointer;
}

.app-category-dialog {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  align-items: end;
  justify-items: center;
  visibility: hidden;
  background: rgb(10 24 51 / 0%);
  transition: background-color 220ms ease, visibility 220ms ease;
}

.app-category-dialog.is-open {
  visibility: visible;
  background: rgb(10 24 51 / 34%);
}

.app-category-dialog__panel {
  width: min(100%, 760px);
  max-height: min(78dvh, 720px);
  overflow: auto;
  border: 1px solid rgb(207 219 242 / 88%);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
  background: #fff;
  box-shadow: 0 -24px 64px rgb(22 52 108 / 18%);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.app-category-dialog.is-open .app-category-dialog__panel {
  opacity: 1;
  transform: translateY(0);
}

.app-category-dialog__head,
.app-category-dialog__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-category-dialog__head h2,
.app-category-dialog__section-head h3 {
  margin: 0;
  color: #0a1733;
  letter-spacing: 0;
}

.app-category-dialog__head h2 {
  font-size: 19px;
  font-weight: 800;
}

.app-category-dialog__section-head h3 {
  font-size: 14px;
  font-weight: 760;
}

.app-category-dialog__close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 11px;
  color: #657794;
  background: #f2f5fa;
  font-size: 22px;
  line-height: 1;
}

.app-category-dialog__categories {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 16px;
}

.app-category-dialog__category {
  display: grid;
  min-width: 0;
  min-height: 70px;
  gap: 6px;
  place-items: center;
  border: 1px solid #e8eef8;
  border-radius: 13px;
  padding: 9px 6px;
  color: #283956;
  background: #f8faff;
  font-size: 12px;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.app-category-dialog__category img {
  width: 25px;
  height: 25px;
  object-fit: contain;
}

.app-category-dialog__category.is-active {
  border-color: rgb(66 119 255 / 42%);
  color: #0f63ef;
  background: #edf4ff;
}

.app-category-dialog__popular {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #edf1f7;
}

.app-category-dialog__tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 11px;
}

.app-category-dialog__tool {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  min-width: 0;
  min-height: 58px;
  gap: 9px;
  border: 1px solid #e8edf6;
  border-radius: 13px;
  padding: 8px 9px;
  color: #111d36;
  background: #fff;
  text-align: left;
}

.app-category-dialog__tool img,
.app-category-dialog__tool-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  object-fit: contain;
  background: #edf4ff;
}

.app-category-dialog__tool strong,
.app-category-dialog__tool small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-category-dialog__tool strong {
  font-size: 13px;
  font-weight: 740;
}

.app-category-dialog__tool small {
  margin-top: 3px;
  color: #7a89a3;
  font-size: 10px;
}

.app-category-dialog__tool-arrow {
  color: #7a89a3;
  font-size: 18px;
}

body.app-category-dialog-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .mobile-app-shell:not(.mobile-app-runtime) {
    grid-template-columns: minmax(0, 100%);
    padding: 0;
  }

  .mobile-app-shell:not(.mobile-app-runtime) .mobile-device-frame {
    width: 100%;
    min-height: 100dvh;
    border-radius: 0;
  }

  .mobile-app-shell:not(.mobile-app-runtime) .mobile-phone-frame {
    min-height: 100dvh;
    padding-top: 16px;
    padding-right: 14px;
    padding-left: 14px;
    border-radius: 0;
  }

  .mobile-app-shell:not(.mobile-app-runtime) .mobile-tabbar {
    width: 100%;
  }

  .app-category-dialog__panel {
    width: 100%;
  }
}

@media (min-width: 601px) {
  .app-category-dialog__categories {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .app-category-dialog__categories {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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