/* iPhone-only PWA add-to-home-screen guide */
.fs-pwa-ios {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 11500;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.fs-pwa-ios[hidden]:not(.is-on) {
  display: none !important;
}

.fs-pwa-ios.is-on {
  display: block !important;
  pointer-events: auto;
  opacity: 1;
  transform: none;
}

.fs-pwa-ios__card {
  position: relative;
  padding: 16px 16px 14px;
  border-radius: 16px;
  background: linear-gradient(160deg, #1a1d24 0%, #0e1014 100%);
  border: 1px solid rgba(232, 201, 106, 0.28);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #eef1f6;
}

.fs-pwa-ios__close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9aa3b2;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.fs-pwa-ios__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 28px;
}

.fs-pwa-ios__icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  background: #ffd400;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.fs-pwa-ios__text strong {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: #f7e5a3;
}

.fs-pwa-ios__desc {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #a8b0bd;
}

.fs-pwa-ios__steps {
  margin: 14px 0 12px;
  padding: 0 0 0 1.2em;
  font-size: 13.5px;
  line-height: 1.7;
  color: #d5dbe5;
}

.fs-pwa-ios__steps li + li {
  margin-top: 2px;
}

.fs-pwa-ios__share {
  display: inline-flex;
  vertical-align: -3px;
  margin-left: 2px;
  color: #5ac8fa;
}

.fs-pwa-ios__ok {
  display: block;
  width: 100%;
  margin: 0;
  padding: 11px 14px;
  border: 0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 750;
  color: #1a1208;
  background: linear-gradient(105deg, #ffe7a3, #e8c96a 45%, #c19549);
  cursor: pointer;
}

.fs-pwa-ios__arrow {
  width: 14px;
  height: 14px;
  margin: -1px auto 0;
  background: #0e1014;
  border-right: 1px solid rgba(232, 201, 106, 0.28);
  border-bottom: 1px solid rgba(232, 201, 106, 0.28);
  transform: rotate(45deg);
}

/* Desktop / non-phone: never show even if JS fails to hide */
@media (min-width: 821px) {
  .fs-pwa-ios {
    display: none !important;
  }
}

/*
 * iPhone / PWA: keep mobile chrome on EVERY page (header + hamburger + topmenu).
 * Chrome height = safe-area + 58 (header) + 40 (topmenu).
 */
html.fs-ios-phone body.fs-leftnav-layout,
html.fs-standalone body.fs-leftnav-layout {
  padding-left: 0 !important;
  padding-top: calc(98px + env(safe-area-inset-top, 0px)) !important;
}

html.fs-ios-phone .fs-d-header,
html.fs-standalone .fs-d-header {
  display: none !important;
}

/* Homepage AI block only — do not force empty --sub panel on inner pages */
html.fs-ios-phone .fs-ai-search-wrap.fs-d-header:not(.fs-ai-search-wrap--sub),
html.fs-standalone .fs-ai-search-wrap.fs-d-header:not(.fs-ai-search-wrap--sub) {
  display: block !important;
}

html.fs-ios-phone .header.fs-m-header,
html.fs-standalone .header.fs-m-header {
  display: block !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1000 !important;
  height: calc(58px + env(safe-area-inset-top, 0px)) !important;
  padding-top: env(safe-area-inset-top, 0px) !important;
  box-sizing: border-box !important;
  background: var(--fs-surface, #151920) !important;
  visibility: visible !important;
  opacity: 1 !important;
}

html.fs-ios-phone .fs-m-header .header-bar,
html.fs-standalone .fs-m-header .header-bar {
  height: 58px !important;
}

html.fs-ios-phone .m-icon-nav.fs-m-header,
html.fs-standalone .m-icon-nav.fs-m-header {
  display: block !important;
  position: fixed !important;
  top: env(safe-area-inset-top, 0px) !important;
  left: 0 !important;
  z-index: 1003 !important;
  height: 58px !important;
  visibility: visible !important;
}

html.fs-ios-phone .fs-m-header .search-toggle,
html.fs-ios-phone .fs-m-header .m-icon-user,
html.fs-standalone .fs-m-header .search-toggle,
html.fs-standalone .fs-m-header .m-icon-user {
  display: flex !important;
  visibility: visible !important;
  height: 58px !important;
}

html.fs-ios-phone .fs-m-topmenu,
html.fs-standalone .fs-m-topmenu {
  display: block !important;
  position: fixed !important;
  top: calc(58px + env(safe-area-inset-top, 0px)) !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 999 !important;
  height: 40px !important;
  visibility: visible !important;
  opacity: 1 !important;
}

html.fs-ios-phone .fs-breadcrumb,
html.fs-standalone .fs-breadcrumb {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

html.fs-ios-phone body.search-on #site-search-panel,
html.fs-standalone body.search-on #site-search-panel {
  top: calc(98px + env(safe-area-inset-top, 0px)) !important;
  z-index: 1002 !important;
  max-height: calc(100dvh - 98px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  overflow-y: auto !important;
}

/* Desktop: never show mobile topmenu strip */
@media (min-width: 901px) {
  .fs-m-topmenu {
    display: none !important;
  }
}
