/* ===== DigitalMarket.World 社交分享组件 ===== */
#dmw-share-btn {
  position: fixed;
  left: 16px;
  bottom: 96px;
  z-index: 9998;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c63ff, #4a42d1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.45);
  transition: transform .2s, box-shadow .2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#dmw-share-btn:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(108, 99, 255, 0.6); }
#dmw-share-btn:active { transform: scale(0.95); }
#dmw-share-btn svg { width: 22px; height: 22px; fill: currentColor; }
#dmw-share-btn .dmw-share-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff4757;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  border-radius: 8px;
  text-align: center;
  padding: 0 3px;
  display: none;
}

/* 分享面板 */
#dmw-share-panel {
  position: fixed;
  left: 16px;
  bottom: 152px;
  z-index: 9999;
  width: 300px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  padding: 16px;
  display: none;
  animation: dmwSharePop .22s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
#dmw-share-panel.dmw-open { display: block; }
@keyframes dmwSharePop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
#dmw-share-panel .dmw-sp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
#dmw-share-panel .dmw-sp-title {
  font-size: 14px;
  font-weight: 700;
  color: #222;
}
#dmw-share-panel .dmw-sp-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f1f2f6;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
#dmw-share-panel .dmw-sp-close:hover { background: #e4e6ec; }
/* 复制分享链接主按钮（面板顶部，主操作） */
#dmw-share-panel .dmw-sp-copylink {
  width: 100%;
  margin-bottom: 4px;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #6c63ff, #4a42d1);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
  font-family: inherit;
}
#dmw-share-panel .dmw-sp-copylink:hover { opacity: 0.88; }
#dmw-share-panel .dmw-sp-copylink:active { transform: scale(0.98); }
#dmw-share-panel .dmw-sp-section {
  font-size: 11px;
  color: #999;
  margin: 10px 0 6px;
  font-weight: 600;
}
#dmw-share-panel .dmw-sp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
#dmw-share-panel .dmw-sp-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: background .15s;
}
#dmw-share-panel .dmw-sp-item:hover { background: #f4f5fa; }
#dmw-share-panel .dmw-sp-item:active { transform: scale(0.94); }
#dmw-share-panel .dmw-sp-ico {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #fff;
}
#dmw-share-panel .dmw-sp-label { font-size: 10px; color: #555; white-space: nowrap; }

/* 卡片区 */
#dmw-share-panel .dmw-sp-cardarea {
  margin-top: 12px;
  border-top: 1px dashed #e4e6ec;
  padding-top: 12px;
}
#dmw-share-panel .dmw-sp-cardbtns {
  display: flex;
  gap: 8px;
}
#dmw-share-panel .dmw-sp-cardbtn {
  flex: 1;
  padding: 9px 6px;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #6c63ff, #4a42d1);
  color: #fff;
  transition: opacity .15s;
}
#dmw-share-panel .dmw-sp-cardbtn:hover { opacity: 0.88; }
#dmw-share-panel .dmw-sp-cardbtn:active { transform: scale(0.97); }
#dmw-share-panel .dmw-sp-copytxt {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #e4e6ec;
  border-radius: 8px;
  font-size: 11px;
  color: #333;
  background: #fafbfd;
  box-sizing: border-box;
  resize: none;
  height: 52px;
}
#dmw-share-panel .dmw-sp-copybtn {
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid #d4d7e0;
  border-radius: 8px;
  background: #fff;
  color: #444;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
#dmw-share-panel .dmw-sp-copybtn:hover { background: #f4f5fa; }
#dmw-share-panel .dmw-sp-tip {
  font-size: 10px;
  color: #aaa;
  margin-top: 8px;
  text-align: center;
  line-height: 1.5;
}

/* 卡片预览（生成后显示） */
#dmw-share-panel .dmw-sp-preview {
  margin-top: 8px;
  display: none;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #eee;
}
#dmw-share-panel .dmw-sp-preview img { width: 100%; display: block; }
#dmw-share-panel .dmw-sp-savebtn {
  width: 100%;
  margin-top: 6px;
  padding: 9px;
  border: none;
  border-radius: 10px;
  background: #2ed573;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
#dmw-share-panel .dmw-sp-savebtn:hover { opacity: 0.9; }

/* 分享来源提示条（带 ref 参数访问时） */
#dmw-share-from {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9997;
  background: linear-gradient(90deg, #6c63ff, #8a5cff);
  color: #fff;
  text-align: center;
  padding: 8px 40px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
#dmw-share-from .dmw-sf-close {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.25);
  border: none;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
}

/* 手机端适配：整体缩小 + 限高可滚动（避免顶部出屏） */
@media (max-width: 480px) {
  /* 悬浮按钮：左下角最下边 */
  #dmw-share-btn {
    left: 16px;
    top: auto;
    bottom: 16px;
    margin-top: 0;
    margin-left: 0;
  }
  /* 面板：跟随按钮，在按钮上方弹出 */
  #dmw-share-panel {
    left: 16px;
    right: auto;
    top: auto;
    bottom: 80px;  /* 按钮顶(16+48) + 16px 间距 */
    transform: none;
    width: 264px;
    max-width: calc(100vw - 32px);  /* 防小屏(320px)超左右缘 */
    padding: 12px;
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
  }
  /* 弹出动画 */
  @keyframes dmwSharePop {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
  #dmw-share-panel .dmw-sp-head { margin-bottom: 6px; }
  #dmw-share-panel .dmw-sp-copylink { padding: 8px; font-size: 12px; margin-bottom: 2px; }
  #dmw-share-panel .dmw-sp-title { font-size: 13px; }
  #dmw-share-panel .dmw-sp-close { width: 24px; height: 24px; font-size: 12px; }
  #dmw-share-panel .dmw-sp-section { font-size: 10px; margin: 8px 0 4px; }
  #dmw-share-panel .dmw-sp-grid { gap: 4px; }
  #dmw-share-panel .dmw-sp-item { padding: 5px 1px; gap: 2px; }
  #dmw-share-panel .dmw-sp-ico { width: 30px; height: 30px; font-size: 14px; }
  #dmw-share-panel .dmw-sp-label { font-size: 9px; }
  #dmw-share-panel .dmw-sp-cardarea { margin-top: 8px; padding-top: 8px; }
  #dmw-share-panel .dmw-sp-cardbtns { gap: 6px; }
  #dmw-share-panel .dmw-sp-cardbtn { padding: 7px 4px; font-size: 11px; }
  #dmw-share-panel .dmw-sp-copytxt { height: 40px; font-size: 10px; padding: 6px 8px; margin-top: 6px; }
  #dmw-share-panel .dmw-sp-copybtn { padding: 7px; font-size: 11px; margin-top: 4px; }
  #dmw-share-panel .dmw-sp-tip { font-size: 9px; margin-top: 6px; line-height: 1.4; }
  /* 海报预览限高：竖版 750x1334 全宽渲染会撑爆面板 */
  #dmw-share-panel .dmw-sp-preview { margin-top: 6px; text-align: center; }
  #dmw-share-panel .dmw-sp-preview img { max-height: 170px; width: auto; max-width: 100%; margin: 0 auto; }
  /* 手机上长按图片即可保存，隐藏保存按钮 */
  #dmw-share-panel .dmw-sp-savebtn { display: none !important; }
}

/* Toast 轻提示 */
#dmw-toast {
  position: fixed;
  left: 50%;
  bottom: 130px;
  transform: translateX(-50%) translateY(16px);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  max-width: 80vw;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
#dmw-toast.dmw-show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 480px) {
  #dmw-toast { font-size: 12px; padding: 9px 14px; bottom: 120px; }
}

/* ===== 全页朗读按钮 v2 (仅 时事热点/赚钱地图 详情页 · 底部居中) ===== */
#dmw-readaloud-btn{position:fixed;left:0;right:0;bottom:16px;margin:0 auto;width:max-content;z-index:9997;display:flex;align-items:center;gap:6px;background:linear-gradient(135deg,#6c63ff,#3d2f8f);color:#fff;border:none;border-radius:999px;padding:10px 18px;font:600 13px/1 -apple-system,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;cursor:pointer;box-shadow:0 6px 20px rgba(61,47,143,.45);transition:transform .2s,box-shadow .2s;user-select:none;-webkit-tap-highlight-color:transparent}
#dmw-readaloud-btn:hover{transform:scale(1.06);box-shadow:0 8px 26px rgba(61,47,143,.55)}
#dmw-readaloud-btn.playing{background:linear-gradient(135deg,#e04a3a,#b8342a);box-shadow:0 0 0 3px rgba(224,74,58,.25)}
#dmw-readaloud-btn .ra-ico{font-size:16px;line-height:1}
@media (max-width:480px){#dmw-readaloud-btn{bottom:16px;padding:10px 16px}#dmw-readaloud-btn .ra-txt{font-size:12px}}

/* ===== 方案A：分享赚⚡ 邀请激励区 ===== */
#dmw-share-panel .dmw-sp-invite{margin:10px 12px 0;padding:10px 12px;background:linear-gradient(135deg,rgba(212,175,55,.14),rgba(212,175,55,.06));border:1px solid rgba(212,175,55,.45);border-radius:10px}
#dmw-share-panel .dmw-sp-invite-hd{font-weight:700;font-size:13px;color:#8a6d1a;margin-bottom:2px}
#dmw-share-panel .dmw-sp-invite-sub{font-size:11px;color:#a0883c;line-height:1.5;margin-bottom:8px}
#dmw-share-panel .dmw-sp-invite-row{display:flex;gap:6px}
#dmw-share-panel .dmw-sp-invite-input{flex:1;min-width:0;border:1px solid rgba(212,175,55,.5);background:#fffdf5;border-radius:6px;padding:6px 8px;font-size:11px;color:#6b5a1e}
#dmw-share-panel .dmw-sp-invite-copy{background:linear-gradient(135deg,#d4af37,#b8912a);color:#fff;border:none;border-radius:6px;padding:6px 12px;font-size:12px;font-weight:600;cursor:pointer;white-space:nowrap}
#dmw-share-panel .dmw-sp-invite-copy:hover{opacity:.9}
#dmw-share-panel .dmw-sp-invite-list{margin-top:8px}
#dmw-share-panel .dmw-sp-invite-list-hd{font-size:11px;font-weight:600;color:#8a6d1a;margin-bottom:4px}
#dmw-share-panel .dmw-sp-invite-it{display:flex;justify-content:space-between;align-items:center;padding:4px 2px;font-size:11.5px;color:#555;border-bottom:1px dashed rgba(212,175,55,.25)}
#dmw-share-panel .dmw-sp-invite-it:last-child{border-bottom:none}
#dmw-share-panel .dmw-sp-invite-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:65%}
#dmw-share-panel .dmw-sp-invite-st{background:#eee;color:#666;border-radius:999px;padding:1px 8px;font-size:10px;white-space:nowrap}
#dmw-share-panel .dmw-sp-invite-st.ok{background:rgba(52,168,83,.15);color:#2e7d32}
#dmw-share-panel .dmw-sp-invite-st.mid{background:rgba(33,150,243,.13);color:#1565c0}
#dmw-share-panel .dmw-sp-invite-empty{font-size:11px;color:#a0883c;padding:4px 0}
#dmw-share-panel .dmw-sp-invite-locked{font-size:11.5px;color:#a0883c;line-height:1.5}
