/* ==========================================================================
   右侧悬浮 App 下载按钮（详情页技术方案 3.13，D23）：数值按 mockup-02 `.frail`
   btse-blog-dev 沙盒版按 Figma 做（椭圆徽章、绝对定位），现在以 mockup 为准
   在 wp_footer 输出，不在 Divi 容器里；Divi 的全局 p / button 样式在这里收回
   ========================================================================== */

.frail {
  position: fixed;
  right: 20px;
  bottom: 96px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 400;
  line-height: normal;
  transition: opacity 0.2s ease;
}

/* 滚到 footer 时隐藏（app-rail.js） */
.frail.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ---------- 金色徽章：四段渐变（中线处硬断开，看起来是鼓起的面）+ 脉动 / 缩放 / 扫光 ---------- */
.frail .fbadge {
  position: relative;
  overflow: hidden;
  padding: 8px 12px;
  background: linear-gradient(180deg, #FFE88A 0%, #FFD12E 46%, #FFB300 54%, #F59E00 100%);
  border: 1px solid #D98C00;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: #5A3200;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(140, 80, 0, 0.28),
    0 3px 9px rgba(190, 120, 0, 0.42),
    0 0 0 0 rgba(255, 179, 0, 0.55);
  animation: btse-rail-fglow 2.4s ease-in-out infinite, btse-rail-fpop 2.4s ease-in-out infinite;
}

/* 上半部高光 */
.frail .fbadge::before {
  content: '';
  position: absolute;
  top: 1px;
  right: 1px;
  left: 1px;
  height: 46%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0));
  border-radius: 999px 999px 46% 46% / 999px 999px 16px 16px;
  pointer-events: none;
}

/* 每 3.4 秒扫过一道光 */
.frail .fbadge::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 22%, rgba(255, 255, 255, 0.9) 46%, transparent 70%);
  transform: translateX(-120%);
  pointer-events: none;
  animation: btse-rail-fshine 3.4s ease-in-out infinite;
}

@keyframes btse-rail-fglow {
  0%, 100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.85),
      inset 0 -1px 0 rgba(140, 80, 0, 0.28),
      0 3px 9px rgba(190, 120, 0, 0.42),
      0 0 0 0 rgba(255, 179, 0, 0.55);
  }
  55% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.85),
      inset 0 -1px 0 rgba(140, 80, 0, 0.28),
      0 4px 13px rgba(190, 120, 0, 0.5),
      0 0 0 11px rgba(255, 179, 0, 0);
  }
}

@keyframes btse-rail-fpop {
  0%, 100% { transform: scale(1); }
  55% { transform: scale(1.07); }
}

@keyframes btse-rail-fshine {
  0%, 58% { transform: translateX(-120%); }
  88%, 100% { transform: translateX(120%); }
}

/* ---------- 圆形按钮 ---------- */
.frail .fbtn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0;
  padding: 0;
  background: #015FE5;
  border: 0;
  border-radius: 50%;
  font-family: inherit;
  font-size: 22px;
  line-height: 1;
  color: #FFFFFF;
  box-shadow: 0 8px 22px rgba(1, 95, 229, 0.38);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.frail .fbtn:hover,
.frail .fbtn:focus-visible {
  background: #0149B8;
  transform: translateY(-1px);
}

.frail .fbtn:focus-visible {
  outline: 3px solid #9FC2F0;
  outline-offset: 3px;
}

/* ---------- 二维码面板：在按钮左边，底边和按钮对齐 ---------- */
.frail .fpanel {
  position: absolute;
  right: 62px;
  bottom: 0;
  box-sizing: border-box;
  width: 236px;
  padding: 16px 16px 13px;
  background: #FFFFFF;
  border: 1px solid #E4E7EC;
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(11, 13, 14, 0.18);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateX(6px);
  transition: 0.16s ease-out;
}

.frail.on .fpanel {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.frail .ftitle {
  margin: 0 0 4px;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: #0B0D0E;
}

.frail .famt {
  position: relative;
  display: inline-block;
  margin: 0 0 11px;
  padding: 6px 10px;
  background: linear-gradient(180deg, #FFE88A 0%, #FFD12E 48%, #FFC61A 52%, #F7A800 100%);
  border: 1px solid #E09600;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  color: #5A3200;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(140, 80, 0, 0.22),
    0 2px 5px rgba(190, 120, 0, 0.3);
}

.frail .fqr {
  box-sizing: content-box;
  display: block;
  width: 124px; /* mockup：外框 140 = 内容 124 + 内边距 7×2 + 边框 1×2 */
  height: 124px;
  margin: 0 auto 10px;
  padding: 7px;
  background: #FFFFFF;
  border: 1px solid #E4E7EC;
  border-radius: 8px;
}

.frail .fnote {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.45;
  color: #8A94A6;
}

.frail .falt {
  display: inline-block;
  margin-top: 7px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  color: #015FE5;
}

.frail .falt:hover {
  text-decoration: underline;
}

.frail .falt:focus-visible {
  outline: 2px solid #015FE5;
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- 手机：二维码没法扫自己的屏幕，按钮直接去商店 ---------- */
@media (max-width: 640px) {
  .frail {
    right: 14px;
    bottom: 76px;
  }

  .frail .fpanel {
    display: none;
  }

  .frail .fbadge {
    padding: 5px 9px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .frail .fbtn,
  .frail .fpanel {
    transition: none;
  }

  .frail .fbadge {
    animation: none;
  }

  .frail .fbadge::after {
    display: none;
  }
}
