/* _shared: 回到顶部（木质底 + 描金，与悬浮咨询条同系） */
.back-to-top{
  --btt-size:44px;
  --btt-gap:14px;
  /* 内容柱宽：与 .container / .top-query-slot 的 var(--max,960px) 对齐 */
  --btt-content:min(var(--max, 960px), calc(100vw - 32px));
  position:fixed;
  /* PC：贴在居中内容区右侧外缘；侧栏不够时回退贴屏边 */
  right:max(
    max(14px, env(safe-area-inset-right, 0px)),
    calc((100vw - var(--btt-content)) / 2 - var(--btt-size) - var(--btt-gap))
  );
  bottom:max(20px, env(safe-area-inset-bottom, 0px));
  z-index:65;
  width:var(--btt-size);
  height:var(--btt-size);
  padding:0;
  margin:0;
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  border:1px solid rgba(196,146,74,.5);
  background:linear-gradient(160deg,#4A3726,#2E2218);
  box-shadow:0 10px 22px rgba(20,12,6,.32);
  color:#E8C98A;
  cursor:pointer;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transform:translateY(8px);
  transition:opacity .22s ease, transform .22s ease, visibility .22s, box-shadow .2s, bottom .2s ease, right .2s ease;
  -webkit-tap-highlight-color:transparent;
}
.back-to-top.is-show{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transform:translateY(0);
}
.back-to-top:hover{
  box-shadow:0 12px 26px rgba(20,12,6,.42);
  border-color:rgba(232,201,138,.65);
}
.back-to-top:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px rgba(166,107,46,.35), 0 12px 26px rgba(20,12,6,.4);
}
.back-to-top:active{opacity:.88;transform:translateY(1px)}
.back-to-top svg{
  width:20px;
  height:20px;
  display:block;
  fill:none;
  stroke:currentColor;
  stroke-width:2.2;
  stroke-linecap:round;
  stroke-linejoin:round;
}
/* 底部悬浮咨询条 / 吸底号码查询条：抬高，避免叠住 */
body:has(.float-consult) .back-to-top,
html.has-float-consult .back-to-top,
body:has(.top-query.is-docked) .back-to-top,
html.has-docked-query .back-to-top{
  bottom:max(92px, calc(78px + env(safe-area-inset-bottom, 0px)));
}
@media (max-width:560px){
  .back-to-top{
    --btt-size:40px;
    width:var(--btt-size);
    height:var(--btt-size);
    /* 窄屏仍贴屏幕右缘，避免挤进正文 */
    right:max(12px, env(safe-area-inset-right, 0px));
    border-radius:10px;
  }
  .back-to-top svg{width:18px;height:18px}
  body:has(.float-consult) .back-to-top,
  html.has-float-consult .back-to-top,
  body:has(.top-query.is-docked) .back-to-top,
  html.has-docked-query .back-to-top{
    bottom:max(86px, calc(72px + env(safe-area-inset-bottom, 0px)));
  }
}
@media (prefers-reduced-motion:reduce){
  .back-to-top{transition:none}
}
