/* 阶段17 PWA 引导条 v3：手机浏览器**底部固定**引导条（用户指定样板样式）。
 *
 * 位置：
 *   · position: fixed; bottom = 底部导航高度(--pwa-nav-h，无导航为 0) + 安全区；
 *     悬浮在 portal-bottom-nav 上方，不遮挡底部导航本身；
 *   · --pwa-nav-h / --pwa-guide-h 由 pwa-guide.js 实测写入（无 JS 兜底值）。
 * 防遮挡：
 *   · 显示时 body 加 .pwa-guide-open（底部 padding = 引导条高 + 导航高 + 安全区），
 *     页面内容可以完整滚出；隐藏/收起时移除；
 *   · 输入框聚焦（键盘弹出）时引导条下移出屏（.is-keyboard）且 body padding 移除，
 *     绝不挡消息输入框。
 * 关闭逻辑（v3 变更）：点 × 只隐藏当前页面上的引导条（无任何持久化）；
 *   刷新 / 关闭网站再打开都会重新显示；standalone 仍永不显示。
 */

:root {
  /* 引导条底边距：JS 有底部导航时写入「nav computed bottom + nav 高度」实测值
     （computed bottom 已含 safe-area）；无导航（如登录页）回落到 safe-area。 */
  --pwa-guide-bottom: env(safe-area-inset-bottom, 0px);
  --pwa-guide-h: 96px;
}

/* ── 显示引导时给页面让位 ─────────────────────────────── */
body.pwa-guide-open {
  padding-bottom: calc(var(--pwa-guide-h) + var(--pwa-guide-bottom) + 8px);
}

/* 键盘弹出：页面让位也一并移除，输入区不被挤压遮挡 */
body.pwa-guide-open.pwa-guide-kb {
  padding-bottom: 0;
}

/* ── 引导条本体：固定在底部 ─────────────────────────────── */
.pwa-guide {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--pwa-guide-bottom);
  z-index: 50;
  padding: 0 12px 10px;
  pointer-events: none;              /* 左右留白不挡页面点击 */
}

.pwa-guide-inner {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 12px 12px 12px;
  background: #fff;
  border: 1px solid #d7e0e8;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(23, 50, 77, 0.22);
  color: #17324d;
  font-size: 13px;
  line-height: 1.45;
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* 键盘弹出：整条下移出屏（保留 DOM，零持久化行为不受影响） */
.pwa-guide.is-keyboard .pwa-guide-inner {
  transform: translateY(130%);
  opacity: 0;
}

.pwa-guide-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex: none;
  align-self: flex-start;
}

.pwa-guide-text {
  flex: 1 1 auto;
  min-width: 0;
}

.pwa-guide-text strong {
  display: block;
  font-size: 14px;
  color: #17324d;
  padding-right: 20px;               /* 给右上角 × 让位 */
}

.pwa-guide-text span {
  display: block;
  margin-top: 2px;
  color: #4a6275;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.pwa-guide-share {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin: 0 2px;
}

.pwa-guide-btn {
  flex: none;
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  background: #17324d;
  color: #fff !important;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.pwa-guide-btn:active {
  opacity: 0.85;
}

.pwa-guide-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8aa0b2;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.pwa-guide-close:active {
  background: #eef3f7;
}

@media (max-width: 420px) {
  .pwa-guide {
    padding: 0 8px 8px;
  }
  .pwa-guide-inner {
    gap: 8px;
    padding: 10px;
  }
  .pwa-guide-icon {
    width: 36px;
    height: 36px;
  }
  .pwa-guide-text strong {
    font-size: 13px;
  }
  .pwa-guide-btn {
    padding: 7px 10px;
    font-size: 12px;
  }
}
