/* ==========================================================================
   页面引导助手 · 样式
   —— 自带配色（不依赖页面 token）：助手要同时浮在深色首页和浅色市场页上，
      用固定色值才能保证两处都清晰可读。
   ========================================================================== */
.as-root { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 45; font-family: inherit; }
.as-root *, .as-root *::before, .as-root *::after { box-sizing: border-box; }

/* ---------------- 悬浮按钮 ---------------- */
.as-fab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 15px 11px 12px; border: 0; border-radius: 999px; cursor: pointer;
  background: #5B4BE8; color: #fff; font-size: 13px; font-family: inherit; font-weight: 500;
  box-shadow: 0 8px 22px rgba(91, 75, 232, .38);
  position: relative; transition: transform .16s ease, box-shadow .16s ease;
  min-height: 44px;
}
.as-fab:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(91, 75, 232, .46); }
.as-fab:active { transform: translateY(0) scale(.98); }
.as-fab__i { display: inline-flex; }
.as-fab__t { white-space: nowrap; }
/* 有待办时右上角亮一颗小点（不打扰，但看得见） */
.as-fab.has-task::after {
  content: ''; position: absolute; top: -2px; right: -2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #FF6A3D; border: 2px solid #fff;
  animation: as-pulse 1.8s ease-in-out infinite;
}
@keyframes as-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
/* 面板展开时按钮收起文字，避免和面板挤在一起 */
.as-root.is-open .as-fab { padding: 11px; }
.as-root.is-open .as-fab__t { display: none; }

/* ---------------- 面板 ---------------- */
.as-panel {
  position: absolute; right: 0; bottom: calc(100% + 10px);
  width: min(336px, calc(100vw - 32px));
  background: #fff; border: 1px solid rgba(20, 26, 44, .12);
  border-radius: 14px; box-shadow: 0 18px 44px rgba(16, 22, 37, .22);
  overflow: hidden; display: none;
}
.as-root.is-open .as-panel { display: block; animation: as-in .18s ease-out; }
@keyframes as-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.as-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; border-bottom: 1px solid rgba(20, 26, 44, .08); }
.as-head__t { font-size: 14px; font-weight: 600; color: #141A2C; }
.as-head__p {
  margin-left: auto; font-size: 11px; color: #5B4BE8; font-weight: 600;
  background: #EEF0FE; border-radius: 999px; padding: 3px 9px; font-variant-numeric: tabular-nums;
}
.as-head__x {
  border: 0; background: transparent; color: #8A90A2; font-size: 19px; line-height: 1;
  cursor: pointer; padding: 0 2px; width: 32px; height: 32px; border-radius: 8px;
}
.as-head__x:hover { background: #F2F3F7; color: #141A2C; }

.as-state {
  padding: 9px 12px; font-size: 12px; line-height: 1.6; color: #4A5169;
  background: #F7F8FC; border-bottom: 1px solid rgba(20, 26, 44, .08);
}
.as-state b { color: #141A2C; }

.as-list { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.as-step { display: flex; align-items: flex-start; gap: 9px; padding: 9px 10px; border-radius: 10px; }
.as-step__n {
  flex: none; width: 21px; height: 21px; border-radius: 50%; margin-top: 1px;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
  background: #EDEEF4; color: #6B7189;
}
.as-step__tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.as-step__tx b { font-size: 13px; font-weight: 500; color: #141A2C; }
.as-step__tx i { font-style: normal; font-size: 12px; color: #8A90A2; line-height: 1.55; }
.as-step__go {
  flex: none; align-self: center; border: 1px solid #C9CEF7; background: #F4F5FE; color: #5B4BE8;
  border-radius: 999px; padding: 6px 12px; font-size: 12px; font-family: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; min-height: 32px; transition: background .15s, color .15s;
}
.as-step__go:hover { background: #5B4BE8; color: #fff; border-color: #5B4BE8; }

/* 已完成：淡出并打勾 */
.as-step.is-done { opacity: .5; }
.as-step.is-done .as-step__n { background: #E4F5EC; color: #1D9E75; }
.as-step.is-done .as-step__tx b { font-weight: 400; text-decoration: line-through; text-decoration-color: rgba(20,26,44,.25); }
/* 当前：描边强调 */
.as-step.is-cur { background: #F4F5FE; box-shadow: inset 0 0 0 1px #C9CEF7; }
.as-step.is-cur .as-step__n { background: #5B4BE8; color: #fff; }
.as-step.is-cur .as-step__tx b { font-weight: 600; }
.as-step.is-cur .as-step__tx i { color: #5A6078; }

.as-done { padding: 16px 14px; text-align: center; }
.as-done b { display: block; font-size: 13px; color: #1D9E75; margin-bottom: 4px; }
.as-done i { font-style: normal; font-size: 12px; color: #8A90A2; }

.as-foot {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border-top: 1px solid rgba(20, 26, 44, .08); font-size: 11px; color: #8A90A2;
}
.as-foot__b {
  margin-left: auto; border: 0; background: transparent; color: #8A90A2;
  font-size: 11px; font-family: inherit; cursor: pointer; text-decoration: underline; padding: 4px;
}
.as-foot__b:hover { color: #5B4BE8; }

/* ---------------- 目标高亮 ---------------- */
.as-hl { animation: as-ring 1.8s ease-out; border-radius: 12px; }
@keyframes as-ring {
  0% { box-shadow: 0 0 0 0 rgba(91, 75, 232, .55); }
  55% { box-shadow: 0 0 0 8px rgba(91, 75, 232, 0); }
  100% { box-shadow: 0 0 0 0 rgba(91, 75, 232, 0); }
}

/* 窄屏：面板贴底展开，别从右侧伸出去 */
@media (max-width: 480px) {
  .as-root { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .as-panel { position: fixed; left: 12px; right: 12px; bottom: 12px; width: auto; }
  .as-root.is-open .as-fab { display: none; }

  /* ★ 窄屏把浮窗收成 48×48 的圆钮（去掉"下一步"三个字）。
     原因不是"好看"：实测在 320/375 视口下，带文字的浮窗是 ~110×44，
     会把**套餐卡片的可点区域盖住 48%~92%** —— 客户点卡片时点到的是浮窗，
     那张套餐当场买不了。缩小后覆盖面积降到原来的 1/4，重叠率回到 20% 上下。
     图标仍是 22px、可点区 48px（符合触控最小 44px），没有牺牲可用性。 */
  .as-fab { padding: 13px; min-width: 48px; min-height: 48px; justify-content: center; }
  .as-fab__t { display: none; }

  /* 有吸底汇总条时（充值页选中套餐后）往上让开 —— 否则会压住「立即购买」。
     用 :has 检测"rc-bar 存在且没被 hidden"，纯 CSS 即可，不需要 JS 配合。
     ⚠️ 老浏览器不支持 :has 时这条静默失效，只是位置没避让，不会把界面搞坏。 */
  body:has(.rc-bar:not([hidden])) .as-root { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* 页面底部给浮窗留出安全区：内容滚到底时，最后一行不该永远被浮窗压住。
   用 padding 而不是 margin —— padding 属于可滚动区域，滚到底能看到全部内容。 */
.as-safe-gap { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

@media (prefers-reduced-motion: reduce) {
  .as-fab.has-task::after { animation: none; }
  .as-root.is-open .as-panel { animation: none; }
  .as-hl { animation: none; box-shadow: 0 0 0 3px rgba(91, 75, 232, .45); }
}
