/* 分享按钮 + 分享面板（全站共用，由 patch_pages.py 注入）
 *
 * 视觉对齐页头那一排圆形小按钮（.sndbtn / .infobtn / .theme-switch.hud）：
 * 33px 圆形、半透明白边、不抢戏。浅色主题下换成白底深字。
 * 面板在手机上是底部抽屉（贴合拇指、避开刘海与手势区），桌面居中成卡片。
 */

/* ---------------- 触发按钮 ---------------- */
.wz-share-btn {
  width: 33px; height: 33px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .08);
  color: #cdd6e0; font: inherit; line-height: 1;
  transition: background .15s, color .15s, transform .15s;
}
.wz-share-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.wz-share-btn:active { transform: scale(.94); }
.wz-share-btn:focus-visible { outline: 2px solid #7dd3fc; outline-offset: 2px; }
.wz-share-btn svg { width: 16px; height: 16px; display: block; }

/* 页头塞不下的页面：浮动在页头下沿（位置由 share.js 实测后写 inline top / right） */

/* 首页这类没有 .hleft 的页面：跟着右上角那排按钮走 */
.corner-bar .wz-share-btn { position: static; }

/* 实在没有落点时的兜底：固定在右上角 */
.wz-share-btn.wz-sb-float {
  position: fixed; z-index: 90;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
}

html[data-theme="light"] .wz-share-btn {
  background: #fff; border-color: rgba(35, 45, 40, .14); color: #4f5d57;
  box-shadow: 0 1px 3px rgba(35, 45, 40, .07);
}
html[data-theme="light"] .wz-share-btn:hover { background: #fff; filter: brightness(.96); color: #26302b; }

@media (max-width: 600px) {
  .wz-share-btn { width: 30px; height: 30px; }
  .wz-share-btn svg { width: 15px; height: 15px; }
}

/* ---------------- 面板 ---------------- */
.wzsh {
  position: fixed; inset: 0; z-index: 2147482000;
  display: none;
  -webkit-tap-highlight-color: transparent;
}
.wzsh.on { display: block; }
.wzsh-bd {
  position: absolute; inset: 0;
  background: rgba(6, 10, 14, .62);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  animation: wzsh-fade .16s ease-out;
}
.wzsh-sheet {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(420px, 100%);
  max-height: 90vh; overflow: auto;
  padding: 10px 18px calc(16px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: #141c18; color: #e8f0ea;
  border: 1px solid rgba(255, 255, 255, .1); border-bottom: 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .5);
  animation: wzsh-up .2s cubic-bezier(.22, 1, .36, 1);
}
.wzsh-grip {
  width: 38px; height: 4px; border-radius: 2px; margin: 2px auto 10px;
  background: rgba(255, 255, 255, .22);
}
.wzsh-h {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0 0 2px;
}
.wzsh-h b { font-size: 15px; font-weight: 800; letter-spacing: .5px; }
.wzsh-x {
  flex: none; width: 30px; height: 30px; padding: 0; cursor: pointer;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .06); color: #b9c2cc;
  font: 700 15px/1 system-ui, sans-serif;
}
.wzsh-x:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.wzsh-sub {
  margin: 0 0 12px; font-size: 12.5px; line-height: 1.6; color: #8fa39a;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* 二维码：底色永远留白（暗色主题下也必须是白卡，否则扫不出来） */
.wzsh-qr {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px; margin: 0 0 12px; border-radius: 14px;
  background: #fff;
}
.wzsh-qr canvas { display: block; border-radius: 4px; }
.wzsh-qr-cap { font-size: 11.5px; line-height: 1.5; color: #5b6b63; text-align: center; }

.wzsh-link {
  display: flex; gap: 8px; align-items: center; margin: 0 0 10px;
}
.wzsh-link input {
  flex: 1 1 auto; min-width: 0; width: 100%;
  padding: 10px 12px; font: inherit; font-size: 12.5px;
  border-radius: 10px; color: #dfe7e2;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .05);
  text-overflow: ellipsis;
}
.wzsh-link input:focus { outline: none; border-color: rgba(125, 211, 252, .7); }

.wzsh-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.wzsh-btn {
  flex: 1 1 44%; min-height: 42px; padding: 10px 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 11px; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 700;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .07); color: #dfe7e2;
  transition: background .15s, border-color .15s;
}
.wzsh-btn:hover { background: rgba(255, 255, 255, .14); }
.wzsh-btn:active { transform: scale(.98); }
.wzsh-btn.primary {
  border-color: rgba(125, 211, 252, .5);
  background: rgba(125, 211, 252, .16); color: #cfeeff;
}
.wzsh-btn.primary:hover { background: rgba(125, 211, 252, .26); }
.wzsh-btn svg { width: 15px; height: 15px; flex: none; }
.wzsh-tip {
  margin: 10px 0 0; min-height: 16px;
  font-size: 12px; line-height: 1.5; color: #7dd3fc;
}
.wzsh-tip.warn { color: #ffb4a2; }

@media (min-width: 640px) {
  .wzsh-sheet {
    bottom: auto; top: 50%; transform: translate(-50%, -50%);
    width: 380px; border-radius: 18px; border-bottom: 1px solid rgba(255, 255, 255, .1);
    padding: 16px 20px 18px;
    animation: wzsh-pop .18s cubic-bezier(.22, 1, .36, 1);
  }
  .wzsh-grip { display: none; }
}

@keyframes wzsh-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes wzsh-up { from { transform: translate(-50%, 16px); opacity: .6; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes wzsh-pop { from { transform: translate(-50%, -46%); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .wzsh-bd, .wzsh-sheet { animation: none; }
}

/* 页面在锁定/提醒遮罩之上时不抢焦点：health-guard 的层级更高，这里只保证自己不被压字 */
body.wzsh-lock { overflow: hidden; }
