/* 礼物盒挂件样式 */
@property --gw-ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.gw-root { position: fixed; inset: 0; pointer-events: none; z-index: 10000; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }

/* 礼物按钮本身是普通流内元素，由 JS 挂到侧栏底部 / 工具栏搜索框右侧 */
.gw-gift {
  position: relative;
  display: block;
  width: 150px; height: 150px;
  margin: 12px auto 14px;
  flex: 0 0 auto;
  pointer-events: auto; cursor: pointer; border: 0; padding: 0; background: transparent;
  transition: opacity .35s ease, transform .35s ease, filter .2s ease;
  filter: drop-shadow(0 6px 16px rgba(90,40,180,.28));
  -webkit-tap-highlight-color: transparent;
}
.gw-gift:hover { transform: translateY(-3px) scale(1.04); filter: drop-shadow(0 9px 20px rgba(90,40,180,.4)); }
.gw-gift-away { opacity: 0; transform: scale(.6); pointer-events: none; }
.gw-gift-poster, .gw-gift-video, .gw-gift-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* 待机固定显示完整礼盒，不用会循环到"开盖飞散"帧的视频/抠黑画布（手机电脑都不再变盖子） */
.gw-gift-video, .gw-gift-canvas { display: none !important; }
/* 待机动画：礼盒漂浮 + 轻微摆动（手机上 transform 只作用在图片上，不影响绝对定位） */
.gw-gift-poster {
  z-index: 5; animation: gw-idle 3.8s ease-in-out infinite;
  transform-origin: 50% 82%; will-change: transform;
}
@keyframes gw-idle {
  0%, 100% { transform: translateY(0) rotate(-1.2deg) scale(1); }
  50%      { transform: translateY(-6px) rotate(1.2deg) scale(1.03); }
}
/* 光晕呼吸底层 */
.gw-gift::before {
  content: ''; position: absolute; inset: 8%; border-radius: 50%; z-index: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(150,80,240,.34), rgba(150,80,240,0) 70%);
  animation: gw-halo 3.8s ease-in-out infinite;
}
@keyframes gw-halo {
  0%, 100% { opacity: .4; transform: scale(.9); }
  50%      { opacity: .9; transform: scale(1.14); }
}
/* 侧栏折叠时缩小 */
.sidebar.collapsed .gw-gift { width: 70px; height: 70px; margin: 8px auto; }
/* 兜底：找不到挂载点时右下角 */
.gw-gift.gw-fallback { position: fixed; right: 16px; bottom: 16px; margin: 0; z-index: 10000; }

.gw-stage { position: fixed; inset: 0; z-index: 10001; pointer-events: none; }
.gw-converge { position: fixed; inset: 0; z-index: 10001; pointer-events: none; }
/* 24 块内容切片：仅提供布局与贴图，交给 stage.js 做 3D 飞散/归位 */
.gw-tiles {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(86vw, 420px); height: 180px;
  display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(4, 1fr);
  gap: 2px; opacity: 0; pointer-events: none; z-index: -1;
}
.gw-tile { position: relative; overflow: hidden; }
.gw-tile .adv-door-face {
  position: absolute; inset: 0; border-radius: 10px;
  background: linear-gradient(155deg, #ffffff 0%, #f7f3ff 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}

.gw-panel {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.3);
  width: min(86vw, 420px); padding: 42px 28px 36px;
  background: linear-gradient(155deg, #ffffff 0%, #f7f3ff 100%);
  border: 1px solid rgba(113,52,230,.16); border-radius: 24px;
  box-shadow: 0 24px 70px rgba(60,20,130,.22), 0 0 0 6px rgba(255,255,255,.5);
  text-align: center; pointer-events: none; opacity: 0;
  overflow: hidden; isolation: isolate;
  transition: opacity .38s ease, transform .7s cubic-bezier(.16,1,.3,1), box-shadow .7s ease;
}
/* 边框流光（伪元素旋转渐变描边） */
.gw-panel::before {
  content: ''; position: absolute; inset: -2px; border-radius: 26px; z-index: -1;
  background: conic-gradient(from var(--gw-ang, 0deg), #a855f7, #c084fc, #ffd166, #0ABAB5, #a855f7);
  opacity: 0; transition: opacity .5s ease;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; padding: 2px;
}
/* 顶部光晕扫过 */
.gw-panel::after {
  content: ''; position: absolute; left: -60%; top: 0; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.75), transparent);
  transform: skewX(-18deg); opacity: 0; pointer-events: none;
}
.gw-panel-show {
  opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto;
  box-shadow: 0 28px 80px rgba(60,20,130,.28), 0 0 0 6px rgba(255,255,255,.55), 0 0 60px rgba(168,85,247,.28);
  animation: gw-bloom .7s cubic-bezier(.16,1,.3,1) both;
}
.gw-panel-show::before { opacity: .9; animation: gw-spin 3.2s linear infinite; }
.gw-panel-show::after { animation: gw-sweep 1.1s .35s ease-out both; }
@keyframes gw-bloom {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(.3); filter: blur(10px); }
  55%  { opacity: 1; transform: translate(-50%,-50%) scale(1.05); filter: blur(0); }
  100% { opacity: 1; transform: translate(-50%,-50%) scale(1); filter: blur(0); }
}
@keyframes gw-spin { to { --gw-ang: 360deg; } }
@keyframes gw-sweep { 0% { left: -60%; opacity: 0; } 20% { opacity: .8; } 100% { left: 130%; opacity: 0; } }

.gw-panel-inner { display: flex; flex-direction: column; gap: 16px; }
.gw-title {
  font-size: clamp(19px, 4.6vw, 24px); font-weight: 800; line-height: 1.45;
  background: linear-gradient(100deg, #6a1fb8 0%, #8a2be2 55%, #0ABAB5 130%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #7134e6;
  filter: drop-shadow(0 2px 8px rgba(138,43,226,.18));
}
.gw-hl {
  display: inline-block;
  background: linear-gradient(100deg, #ff6a00, #ff3d3d);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900; letter-spacing: .5px;
  filter: drop-shadow(0 1px 3px rgba(255,80,30,.28));
}
/* 红包 SVG 图标（替代 emoji，避免显示为方块） */
.gw-rp {
  display: inline-block; width: 1.05em; height: 1.05em;
  vertical-align: -.18em; margin-left: .14em; line-height: 0;
  -webkit-text-fill-color: initial; color: initial;
  filter: drop-shadow(0 2px 3px rgba(220,60,40,.28));
}
.gw-rp svg { width: 100%; height: 100%; display: block; }
.gw-rp-fu { -webkit-text-fill-color: #b91c1c; }
.gw-sub { font-size: clamp(14px, 3.4vw, 16px); color: #5a4a72; font-weight: 600; letter-spacing: .3px; }
/* 文字错峰浮现 */
.gw-panel-show .gw-title { animation: gw-rise .55s .3s cubic-bezier(.16,1,.3,1) both; }
.gw-panel-show .gw-sub { animation: gw-rise .55s .46s cubic-bezier(.16,1,.3,1) both; }
@keyframes gw-rise { 0% { opacity: 0; transform: translateY(14px); } 100% { opacity: 1; transform: translateY(0); } }
.gw-close {
  position: absolute; right: 14px; top: 12px; width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: rgba(113,52,230,.08); color: #7134e6;
  font-size: 22px; line-height: 1; cursor: pointer; transition: background .2s; z-index: 2;
}
.gw-close:hover { background: rgba(113,52,230,.18); }

@media (max-width: 768px) {
  /* 左侧两行：第一行免费办/付费办，第二行搜索套餐+收货省份+默认排序；右侧留给跨行大礼物盒 */
  .fee-seg { flex: 0 0 calc(100% - 104px) !important; }
  .toolbar-search { flex: 0 0 auto !important; order: 0 !important; margin-top: 0 !important; width: 150px !important; }
  .toolbar-search input { width: 150px !important; font-size: 15px !important; }
  /* 右侧大礼物盒：绝对定位，垂直居中跨两行高度（父容器由 JS 设 position:relative） */
  .gw-gift {
    position: absolute !important; right: 6px; top: 50%; transform: translateY(-50%);
    width: 88px; height: 88px; margin: 0 !important; order: 11;
    display: flex; align-items: center; justify-content: flex-start;
    background: transparent !important; border-radius: 0;
    box-shadow: none; border: 0; filter: none;
  }
  .gw-gift-away { transform: translateY(-50%) scale(.6); }
  /* 手机端固定显示静态完整礼盒（webp 自带透明底），不用会循环到"开盖飞散"帧的视频 */
  .gw-gift-video, .gw-gift-canvas { display: none !important; }
  .gw-gift-poster { z-index: 5; left: 0; top: 0; right: auto; width: 88px; height: 88px; }
  .gw-panel { padding: 34px 20px 28px; border-radius: 20px; }
  .gw-tiles { height: 150px; }
  .gw-tile .adv-door-face { border-radius: 8px; }
}
