/* ==========================================================================
   轩玩聚集地 — 个性商店 / 头像框 / 任务中心
   文件：themes/wowonder/css/xw-shop.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   1) 头像框叠加层（核心）—— 全站任何头像位置可用
   用法：把 <img class="xw-af ..."> 放进一个 position:relative 的容器，
        与头像 img 同级，即可自动叠在头像之上。
   -------------------------------------------------------------------------- */
.xw-af {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;   /* 不挡点击 */
  z-index: 3;
  -webkit-user-select: none;
  user-select: none;
}

/* 尺寸档位（配合不同场景的容器大小） */
.xw-af-sm { /* 聊天列表 / 16-28px 容器 */ }
.xw-af-md { /* 默认 40-50px */ }
.xw-af-lg { /* 帖子 / 评论 48-60px */ }
.xw-af-xl { /* 个人主页大头像 */ }

/* 头像宿主容器统一要求 */
.xw-af-host {
  position: relative;
  display: inline-block;
  line-height: 0;
  flex: none;
}
.xw-af-host > img:not(.xw-af) {
  display: block;
  border-radius: 50%;
}

/* --------------------------------------------------------------------------
   2) 商店页
   -------------------------------------------------------------------------- */
.xw-shop-wrap,
.xw-task-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 4px 0 40px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ---- 顶部横幅 ---- */
.xw-shop-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-radius: 16px;
  background: linear-gradient(120deg, #5b4bd6 0%, #7a5cf0 45%, #9b6ff5 100%);
  color: #fff;
  box-shadow: 0 8px 26px rgba(90, 70, 210, .28);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.xw-hero-left { display: flex; align-items: center; gap: 15px; }
.xw-hero-avatar {
  position: relative;
  width: 66px; height: 66px;
  flex: none;
}
.xw-hero-avatar > img:not(.xw-af) {
  width: 66px; height: 66px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.85);
  object-fit: cover;
  display: block;
}
.xw-hero-avatar .xw-af {
  width: 92px; height: 92px;
  left: -13px; top: -13px;
}
.xw-hero-info h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; letter-spacing: .4px; }
.xw-hero-info p  { margin: 0; font-size: 12.5px; opacity: .88; }

.xw-hero-balance {
  text-align: right;
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.xw-hb-num  { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.xw-hb-unit { font-size: 13px; opacity: .9; }
.xw-hb-yuan { font-size: 12px; opacity: .72; margin-left: 2px; }
.xw-hb-task {
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: 14px;
  padding: 7px 15px;
  border-radius: 20px;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.36);
  color: #fff !important;
  font-size: 13px; font-weight: 600;
  text-decoration: none !important;
  position: relative;
  transition: .2s;
  backdrop-filter: blur(4px);
}
.xw-hb-task:hover { background: rgba(255,255,255,.32); transform: translateY(-1px); }
.xw-dot {
  position: absolute; top: -6px; right: -6px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px;
  background: #ff4d6a; color: #fff;
  font-size: 10.5px; font-style: normal; font-weight: 700;
  line-height: 17px; text-align: center;
  box-shadow: 0 2px 6px rgba(255,77,106,.5);
}

/* ---- 工具栏 ---- */
.xw-shop-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 0 2px 12px;
}
.xw-shop-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.xw-shop-tabs a {
  padding: 7px 15px; border-radius: 9px;
  font-size: 13.5px; font-weight: 600;
  color: #5c6470 !important; text-decoration: none !important;
  background: #f2f4f8; transition: .18s;
}
.xw-shop-tabs a:hover { background: #e8ebf2; }
.xw-shop-tabs a.on { background: #5b4bd6; color: #fff !important; box-shadow: 0 3px 10px rgba(91,75,214,.3); }

.xw-shop-sort { display: flex; gap: 3px; }
.xw-shop-sort a {
  padding: 5px 10px; border-radius: 7px;
  font-size: 12.5px; color: #7a828f !important;
  text-decoration: none !important; transition: .15s;
}
.xw-shop-sort a:hover { background: #f2f4f8; }
.xw-shop-sort a.on { background: #eef0ff; color: #5b4bd6 !important; font-weight: 700; }

/* ---- 商品网格 ---- */
.xw-frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
}
.xw-frame-card {
  background: #fff;
  border: 1.5px solid #eaecf2;
  border-radius: 14px;
  overflow: hidden;
  transition: .22s;
  position: relative;
  display: flex; flex-direction: column;
}
.xw-frame-card:hover {
  border-color: #c9c2f5;
  box-shadow: 0 8px 22px rgba(91,75,214,.13);
  transform: translateY(-2px);
}
.xw-frame-card.owned  { border-color: #cfe6d6; }
.xw-frame-card.equipped {
  border-color: #5b4bd6;
  box-shadow: 0 0 0 3px rgba(91,75,214,.12);
}

.xw-fc-preview {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(150deg, #f7f8fc 0%, #eef0f8 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.xw-frame-card.rarity-rare  .xw-fc-preview { background: linear-gradient(150deg,#f2f9ff,#e6f2fd); }
.xw-frame-card.rarity-epic  .xw-fc-preview { background: linear-gradient(150deg,#faf5ff,#f0e8fd); }
.xw-frame-card.rarity-legend .xw-fc-preview { background: linear-gradient(150deg,#fffaf0,#fdf0dc); }

.xw-fc-avatar {
  position: relative;
  width: 100%; height: 100%;
  max-width: 108px; max-height: 108px;
}
.xw-fc-avatar.big { max-width: 120px; max-height: 120px; }
.xw-fc-avatar > img:not(.xw-af) {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover; display: block;
}
.xw-fc-avatar .xw-af {
  width: 148%; height: 148%;
  left: -24%; top: -24%;
}

.xw-fc-flag {
  position: absolute; top: 7px; left: 7px;
  padding: 2.5px 8px; border-radius: 6px;
  font-size: 10.5px; font-weight: 700; color: #fff;
  letter-spacing: .3px;
}
.xw-fc-flag.owned    { background: #34a853; }
.xw-fc-flag.equipped { background: #5b4bd6; }

.xw-fc-rarity {
  position: absolute; bottom: 7px; right: 7px;
  padding: 2px 7px; border-radius: 5px;
  font-size: 10px; font-weight: 700;
  background: rgba(0,0,0,.42); color: #fff;
  backdrop-filter: blur(3px);
}

.xw-fc-body { padding: 9px 11px 4px; flex: 1; }
.xw-fc-name {
  font-size: 13px; font-weight: 600; color: #2c323d;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.xw-fc-price { margin-top: 4px; font-size: 12px; color: #7a828f; }
.xw-fc-price b { font-size: 15px; color: #5b4bd6; font-weight: 800; }
.xw-fc-price b.free { color: #34a853; font-size: 13px; }
.xw-fc-price i {
  font-style: normal; font-size: 11px;
  color: #a5abb6; margin-left: 3px;
}

.xw-fc-act { padding: 8px 11px 11px; }

/* ---- 按钮 ---- */
.xw-btn {
  display: block; width: 100%;
  padding: 8px 12px;
  border-radius: 9px;
  border: none;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: .18s;
  font-family: inherit;
  line-height: 1.35;
}
.xw-btn:disabled { cursor: default; opacity: .68; }
.xw-btn.primary { background: #5b4bd6; color: #fff; }
.xw-btn.primary:hover:not(:disabled) { background: #4c3dc4; }
.xw-btn.buy { background: linear-gradient(135deg,#3b82f6,#2563eb); color: #fff; box-shadow: 0 3px 10px rgba(37,99,235,.3); }
.xw-btn.buy:hover:not(:disabled) { box-shadow: 0 5px 16px rgba(37,99,235,.42); transform: translateY(-1px); }
.xw-btn.claim { background: linear-gradient(135deg,#ff8a3d,#ff6b35); color: #fff; box-shadow: 0 3px 10px rgba(255,107,53,.32); }
.xw-btn.claim:hover:not(:disabled) { box-shadow: 0 5px 16px rgba(255,107,53,.45); transform: translateY(-1px); }
.xw-btn.ghost { background: #f2f4f8; color: #8a92a0; }
.xw-btn.wide { width: auto; padding: 9px 22px; }

/* ---- 空态 ---- */
.xw-shop-empty, .xw-task-empty {
  text-align: center; padding: 54px 20px;
  color: #a5abb6;
}
.xw-shop-empty svg { color: #d5d9e2; margin-bottom: 10px; }
.xw-shop-empty p { margin: 0 0 5px; font-size: 15px; font-weight: 600; color: #7a828f; }
.xw-shop-empty span { font-size: 12.5px; }
.xw-task-empty { padding: 26px; font-size: 13px; }

/* ---- 分页 ---- */
.xw-pager {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin-top: 22px;
}
.xw-pager a {
  padding: 7px 17px; border-radius: 9px;
  background: #fff; border: 1.5px solid #e6e9f0;
  font-size: 13px; font-weight: 600; color: #5c6470 !important;
  text-decoration: none !important; transition: .18s;
}
.xw-pager a:hover { border-color: #5b4bd6; color: #5b4bd6 !important; }
.xw-pager-info { font-size: 13px; color: #8a92a0; font-weight: 600; }

/* ---- 我的框快速切换 ---- */
.xw-shop-mine {
  margin-top: 26px;
  padding: 16px 18px;
  background: #fff;
  border: 1.5px solid #eaeef5;
  border-radius: 14px;
}
.xw-sm-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.xw-sm-title span { font-size: 14px; font-weight: 700; color: #2c323d; }
.xw-sm-title em { font-style: normal; font-size: 12px; color: #8a92a0; }
.xw-sm-list { display: flex; gap: 11px; flex-wrap: wrap; }
.xw-sm-item {
  width: 76px; text-align: center;
  cursor: pointer; transition: .18s;
}
.xw-sm-item:hover { transform: translateY(-2px); }
.xw-sm-thumb {
  position: relative;
  width: 60px; height: 60px;
  margin: 0 auto 5px;
  border-radius: 50%;
  padding: 2px;
  border: 2px solid transparent;
  transition: .18s;
}
.xw-sm-item.on .xw-sm-thumb { border-color: #5b4bd6; box-shadow: 0 0 0 3px rgba(91,75,214,.13); }
.xw-sm-thumb.none {
  display: flex; align-items: center; justify-content: center;
  background: #f2f4f8; color: #a5abb6;
  border-radius: 50%;
}
.xw-sm-thumb > img:not(.xw-af) {
  width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover; display: block;
}
.xw-sm-thumb .xw-af { width: 145%; height: 145%; left: -22.5%; top: -22.5%; }
.xw-sm-item span {
  display: block; font-size: 11px; color: #7a828f;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.xw-sm-item.on span { color: #5b4bd6; font-weight: 700; }

/* --------------------------------------------------------------------------
   3) 弹窗
   -------------------------------------------------------------------------- */
.xw-modal { position: fixed; inset: 0; z-index: 99999; display: none; }
.xw-modal.open { display: block; }
.xw-modal-mask {
  position: absolute; inset: 0;
  background: rgba(20,22,30,.5);
  backdrop-filter: blur(3px);
  animation: xwFade .18s ease;
}
.xw-modal-box {
  position: relative;
  width: 340px; max-width: calc(100vw - 36px);
  margin: 0 auto;
  top: 50%; transform: translateY(-50%);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.22);
  animation: xwPop .22s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes xwFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes xwPop  { from { opacity: 0; transform: translateY(-46%) scale(.94); } to { opacity: 1; transform: translateY(-50%) scale(1); } }

.xw-modal-head {
  padding: 15px 20px;
  font-size: 15.5px; font-weight: 700; color: #2c323d;
  border-bottom: 1px solid #f0f2f7;
}
.xw-modal-body { padding: 20px; }
.xw-mb-preview {
  display: flex; justify-content: center;
  padding: 8px 0 16px;
}
.xw-mb-name {
  text-align: center;
  font-size: 14.5px; font-weight: 700; color: #2c323d;
  margin-bottom: 15px;
}
.xw-mb-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
  font-size: 13.5px; color: #7a828f;
  border-bottom: 1px dashed #f0f2f7;
}
.xw-mb-row:last-of-type { border-bottom: none; }
.xw-mb-row b { font-size: 15px; color: #2c323d; font-weight: 700; }
.xw-mb-hint {
  margin-top: 10px;
  font-size: 12.5px; color: #ff4d6a;
  min-height: 17px;
  text-align: center;
}
.xw-modal-foot {
  display: flex; gap: 10px;
  padding: 14px 20px 18px;
}
.xw-modal-foot .xw-btn { flex: 1; }

/* --------------------------------------------------------------------------
   4) 任务中心
   -------------------------------------------------------------------------- */
.xw-task-hero {
  display: flex; align-items: center; gap: 22px;
  padding: 20px 22px;
  border-radius: 16px;
  background: linear-gradient(120deg, #ff7a45 0%, #ff5c8a 55%, #b45cf0 100%);
  color: #fff;
  box-shadow: 0 8px 26px rgba(255,92,138,.26);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.xw-th-main { flex: none; }
.xw-th-label { font-size: 12.5px; opacity: .88; margin-bottom: 2px; }
.xw-th-num { font-size: 36px; font-weight: 800; line-height: 1.05; letter-spacing: -1px; }
.xw-th-sub { font-size: 12px; opacity: .84; margin-top: 3px; }
.xw-th-sub i { font-style: normal; opacity: .75; }

.xw-th-stats {
  display: flex; gap: 20px;
  margin-left: auto;
  flex-wrap: wrap;
}
.xw-ths-item { text-align: center; }
.xw-ths-item b { display: block; font-size: 19px; font-weight: 800; }
.xw-ths-item span { font-size: 11.5px; opacity: .85; }
.xw-ths-item.hl b { color: #fff3b0; }

.xw-th-shop {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 17px;
  border-radius: 22px;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.36);
  color: #fff !important;
  font-size: 13.5px; font-weight: 600;
  text-decoration: none !important;
  transition: .2s;
  backdrop-filter: blur(4px);
}
.xw-th-shop:hover { background: rgba(255,255,255,.32); transform: translateY(-1px); }

.xw-task-section {
  background: #fff;
  border: 1.5px solid #eaeef5;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.xw-ts-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.xw-ts-head h3 {
  display: flex; align-items: center; gap: 7px;
  margin: 0; font-size: 15px; font-weight: 700; color: #2c323d;
}
.xw-ts-head h3 svg { color: #5b4bd6; }
.xw-ts-tip { font-size: 12px; color: #a5abb6; }

.xw-task-list { display: flex; flex-direction: column; gap: 9px; }
.xw-task-item {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px;
  border-radius: 11px;
  background: #f8f9fc;
  border: 1.5px solid transparent;
  transition: .2s;
}
.xw-task-item:hover { background: #f3f5fa; }
.xw-task-item.ready {
  background: #fff8f2;
  border-color: #ffd9bd;
}
.xw-task-item.done { opacity: .62; }

.xw-ti-icon {
  width: 42px; height: 42px; flex: none;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: #eef0ff; color: #5b4bd6;
}
.xw-task-item.ready .xw-ti-icon { background: #ffefe3; color: #ff6b35; }
.xw-ti-icon.ach { background: #fff4e0; color: #f5a623; }

.xw-ti-main { flex: 1; min-width: 0; }
.xw-ti-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 3px;
}
.xw-ti-title { font-size: 14px; font-weight: 700; color: #2c323d; }
.xw-ti-reward { display: flex; gap: 6px; flex: none; }
.xw-ti-reward em {
  font-style: normal; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 6px;
}
.xw-ti-reward em.pt { background: #eef0ff; color: #5b4bd6; }
.xw-ti-reward em.xp { background: #eaf7ee; color: #34a853; }
.xw-task-item.ready .xw-ti-reward em.pt { background: #ffefe3; color: #ff6b35; }

.xw-ti-desc { font-size: 12.5px; color: #8a92a0; margin-bottom: 7px; }
.xw-ti-prog { display: flex; align-items: center; gap: 9px; }
.xw-tip-bar {
  flex: 1; height: 6px; border-radius: 3px;
  background: #e8ebf2; overflow: hidden;
  max-width: 240px;
}
.xw-tip-bar i {
  display: block; height: 100%;
  border-radius: 3px;
  background: #5b4bd6;
  transition: width .35s ease;
}
.xw-task-item.ready .xw-tip-bar i { background: linear-gradient(90deg,#ff8a3d,#ff6b35); }
.xw-task-item.done  .xw-tip-bar i { background: #34a853; }
.xw-tip-text { font-size: 11.5px; color: #a5abb6; font-weight: 600; flex: none; }

.xw-ti-act { flex: none; width: 82px; }

/* ---- 积分明细 ---- */
.xw-pt-logs { display: flex; flex-direction: column; }
.xw-pl-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid #f4f6fa;
}
.xw-pl-item:last-child { border-bottom: none; }
.xw-pl-biz {
  flex: none;
  padding: 3px 9px; border-radius: 6px;
  font-size: 11px; font-weight: 700;
  background: #f2f4f8; color: #7a828f;
}
.xw-pl-biz.biz-task     { background: #eef0ff; color: #5b4bd6; }
.xw-pl-biz.biz-recharge { background: #eaf7ee; color: #34a853; }
.xw-pl-biz.biz-purchase { background: #fdeef1; color: #ff4d6a; }
.xw-pl-biz.biz-sign     { background: #fff4e0; color: #f5a623; }
.xw-pl-main { flex: 1; min-width: 0; }
.xw-pl-reason {
  font-size: 13px; color: #2c323d;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.xw-pl-time { font-size: 11.5px; color: #a5abb6; margin-top: 1px; }
.xw-pl-delta { flex: none; font-size: 15px; font-weight: 800; }
.xw-pl-delta.in  { color: #ff4d6a; }  /* 中国习惯：涨为红 */
.xw-pl-delta.out { color: #34a853; }

/* --------------------------------------------------------------------------
   5) 响应式
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .xw-frame-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
  .xw-shop-hero { padding: 16px; gap: 12px; }
  .xw-hero-info h2 { font-size: 17px; }
  .xw-hb-num { font-size: 25px; }
  .xw-hb-task { margin-left: 0; }
  .xw-hero-balance { justify-content: flex-start; text-align: left; }

  .xw-task-hero { padding: 16px; gap: 14px; }
  .xw-th-num { font-size: 30px; }
  .xw-th-stats { gap: 14px; margin-left: 0; width: 100%; }
  .xw-ths-item { flex: 1; }
  .xw-th-shop { width: 100%; justify-content: center; }

  .xw-task-item { flex-wrap: wrap; gap: 10px; padding: 11px; }
  .xw-ti-act { width: 100%; }
  .xw-ti-top { flex-wrap: wrap; }
  .xw-ti-prog { width: 100%; }
  .xw-tip-bar { max-width: none; }

  .xw-shop-mine { padding: 13px; }
  .xw-sm-item { width: 66px; }
  .xw-sm-thumb { width: 52px; height: 52px; }
}

/* --------------------------------------------------------------------------
   6) 侧边栏入口小红点
   -------------------------------------------------------------------------- */
.xw-nav-badge {
  display: inline-block;
  min-width: 16px; height: 16px; padding: 0 4px;
  margin-left: 6px;
  border-radius: 8px;
  background: #ff4d6a; color: #fff;
  font-size: 10.5px; font-weight: 700;
  line-height: 16px; text-align: center;
  vertical-align: middle;
}
