/*!
 * zhc-mg4.css —— 装修「宫格导航」四款强动效
 * ZHC-DECO-MG4-20261201
 *
 * 款式（props.variant）：
 *   glass   玻璃拟态流光   半透玻璃盒 + 上下浮动 + 斜向流光
 *   badge   渐变立体徽章   青蓝渐变实心徽章 + 阴影呼吸 + 3D 悬浮
 *   pulse   双环脉冲光环   实线脉冲 + 虚线旋转 + 呼吸图标
 *   outline 描边发光选中   白底描边 + 互斥选中 + 底部短横条
 *   (空)    经典宫格       交还原渲染器，老页面零变化
 *
 * 基准宽 390px；宽度百分比、图标盒 54px、五列单行不折行。
 * 颜色优先读系统/品牌变量，缺省回落锁定 VI；暗色主题另走一组覆盖。
 * 组件内不含价格、等级、收益、绝对化比价等任何敏感文案。
 */

.dz-sec.dz-mg4sec { margin: var(--dz-gap) 0 0; padding: 0; background: transparent; border-radius: 0; box-shadow: none; }

.dz-mg4 {
  --mg4-ico: var(--mg-ico, 54px);            /* 图标方块边长：装修面板「按钮大小」 */
  --mg4-ink: var(--dz-text, var(--dzm-ink, #0B2A4A));
  --mg4-brand: var(--brand, var(--dz-brand, #14B8A6));
  --mg4-brand-2: var(--brand-2, var(--dz-brand, #2DD4BF));
  --mg4-mint: #8FF0E4;
  --mg4-gold: #D4AF37;
  --mg4-line: var(--dz-line, var(--border, #E2EFEC));
  --mg4-surface: var(--dz-surface, var(--surface, #FFFFFF));
  --mg4-muted: #5B7186;
  margin: 0 16px;
  padding: 16px 14px;
  border-radius: 22px;
  background: var(--mg-bg, radial-gradient(circle at 1px 1px, rgba(20, 184, 166, .10) 1px, transparent 0) 0 0 / 14px 14px,
              linear-gradient(180deg, #F3FAF9, #EAF5F3));
  color: var(--mg4-ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", "Helvetica Neue", sans-serif;
  box-sizing: border-box;
}
.dz-mg4 * { box-sizing: border-box; }
html[data-deco-dark="1"] .dz-mg4,
.canvas-mg4-host[data-deco-dark="1"] .dz-mg4 {
  background: var(--mg-bg, var(--dz-surface, var(--surface, #101a26)));
  border: 1px solid var(--dz-line, var(--border, rgba(255, 255, 255, .12)));
  color: var(--dz-text, #F3EBD8);
  --mg4-ink: var(--dz-text, #F3EBD8);
  --mg4-line: var(--dz-line, rgba(255, 255, 255, .16));
  --mg4-surface: var(--dz-surface, #101a26);
  --mg4-muted: var(--dz-text-2, #B9C6D2);
}

.dz-mg4__grid {
  display: grid;
  grid-template-columns: repeat(var(--mg4-cols, 5), minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}
.dz-mg4__i {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  animation: mg4FadeUp .55s cubic-bezier(.22, .61, .36, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.dz-mg4__i:active { filter: brightness(.97); }
.dz-mg4[data-motion="0"] .dz-mg4__i,
.dz-mg4[data-motion="0"] .dz-mg4 * { animation: none !important; }

.dz-mg4__tx {
  display: block;
  max-width: 100%;
  font-size: var(--mg-fs, 11px);
  font-weight: var(--mg-bold, 600);
  line-height: 1.25;
  color: var(--mg-tc, var(--mg4-ink));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dz-mg4__desc {
  display: block;
  font-size: calc(var(--mg-fs, 11px) - 1px);
  font-weight: 400;
  line-height: 1.2;
  color: var(--mg-dc, var(--mg4-muted));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dz-mg4__ic {
  position: relative;
  width: min(var(--mg4-ico), 100%);
  aspect-ratio: 1 / 1;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
}
.dz-mg4__ic svg,
.dz-mg4__core svg { width: 96%; height: 96%; display: block; }
.dz-mg4__ic img,
.dz-mg4__core img { width: calc(100% * var(--mg4-img-zoom, 1)); height: calc(100% * var(--mg4-img-zoom, 1)); flex: 0 0 auto; min-width: 0; max-width: none; max-height: none; object-fit: cover; display: block; }
.dz-mg4__font { font-family: iconfont, "Iconfont", "iconfont", sans-serif; font-size: calc(var(--mg4-ico) * .96); font-style: normal; line-height: 1; }
.dz-mg4__iconfont { position: relative; display: inline-flex; width: 96%; height: 96%; align-items: center; justify-content: center; }
.dz-mg4__iconfont > svg { display: block; width: 100%; height: 100%; }
.dz-mg4__new {
  position: absolute;
  top: -1px;
  right: -1px;
  z-index: 5;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--mg4-gold);
  color: #FFFFFF;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(212, 175, 55, .32);
}

/* A 玻璃拟态流光 */
.dz-mg4--glass .dz-mg4__ic {
  border-radius: var(--mg-radius, 18px);
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--mg4-brand);
  box-shadow: 0 6px 16px rgba(11, 42, 74, .08);
  animation: mg4FloatY 3.4s ease-in-out infinite;
  /* ZHC-MG4-SYNC-20261203: 同相位浮动，避免每格错开造成高低不齐 */
}
.dz-mg4--glass .dz-mg4__ic::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -60%;
  width: 40%;
  transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .78), transparent);
  pointer-events: none;
  animation: mg4Shimmer 3.4s ease-in-out infinite;
}
.dz-mg4--glass .dz-mg4__i:hover .dz-mg4__ic { box-shadow: 0 10px 22px rgba(20, 184, 166, .22); }
.dz-mg4--glass .dz-mg4__i:active .dz-mg4__ic { transform: scale(.92); }
html[data-deco-dark="1"] .dz-mg4--glass .dz-mg4__ic,
.canvas-mg4-host[data-deco-dark="1"] .dz-mg4--glass .dz-mg4__ic {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .16);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .12);
}

/* B 渐变立体徽章 */
.dz-mg4--badge .dz-mg4__i { perspective: 600px; }
.dz-mg4--badge .dz-mg4__ic {
  border-radius: var(--mg-radius, 16px);
  background: linear-gradient(150deg, #2DD4BF, #14B8A6);
  color: #FFFFFF;
  box-shadow: 0 10px 20px rgba(20, 184, 166, .30), inset 0 1.5px 0 rgba(255, 255, 255, .35);
  animation: mg4Breathe 3s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * .35s);
  transition: transform .25s cubic-bezier(.22, .61, .36, 1), box-shadow .25s;
}
.dz-mg4--badge .dz-mg4__i:hover .dz-mg4__ic {
  transform: translateY(-5px) rotateX(8deg) rotateY(-6deg);
  box-shadow: 0 14px 26px rgba(20, 184, 166, .42);
}
.dz-mg4--badge .dz-mg4__i:active .dz-mg4__ic { transform: scale(.93); }

/* C 双环脉冲光环 */
.dz-mg4--pulse .dz-mg4__ring { position: relative; width: min(var(--mg4-ico), 100%); aspect-ratio: 1 / 1; height: auto; flex: 0 0 auto; }
.dz-mg4--pulse .dz-mg4__core {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--mg-radius, 50%);
  background: linear-gradient(160deg, #E6F7F4, #D7F0EC);
  color: var(--mg4-brand);
  animation: mg4BreatheScale 2.6s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * .3s);
}
.dz-mg4--pulse .dz-mg4__pulse {
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 1.5px solid rgba(20, 184, 166, .4);
  border-radius: var(--mg-radius, 50%);
  animation: mg4RingPulse 2.6s ease-out infinite;
  animation-delay: calc(var(--i, 0) * .3s);
}
.dz-mg4--pulse .dz-mg4__orbit {
  position: absolute;
  inset: -7.4%;
  z-index: 0;
  border: 1.5px dashed rgba(20, 184, 166, .35);
  border-radius: var(--mg-radius, 50%);
  animation: mg4Spin 12s linear infinite;
}
.dz-mg4--pulse .dz-mg4__i:active .dz-mg4__ring { transform: scale(.92); }
html[data-deco-dark="1"] .dz-mg4--pulse .dz-mg4__core,
.canvas-mg4-host[data-deco-dark="1"] .dz-mg4--pulse .dz-mg4__core {
  background: var(--dz-surface-2, var(--surface-2, #1D2A35));
}

/* D 描边发光选中态 */
.dz-mg4--outline .dz-mg4__ic {
  border-radius: var(--mg-radius, 16px);
  background: var(--mg4-surface);
  border: 1.5px solid var(--mg4-line);
  color: var(--mg4-muted);
  transition: all .25s;
}
.dz-mg4--outline .dz-mg4__ic::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #2DD4BF, #14B8A6);
  transform: translateX(-50%) scaleX(0);
  transition: transform .25s;
}
.dz-mg4--outline .dz-mg4__i.is-active .dz-mg4__ic {
  border-color: var(--mg4-brand);
  color: var(--mg4-brand);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, .15), 0 10px 20px rgba(20, 184, 166, .22);
}
.dz-mg4--outline .dz-mg4__i.is-active .dz-mg4__ic::after { transform: translateX(-50%) scaleX(1); }
.dz-mg4--outline .dz-mg4__i.is-active .dz-mg4__tx { color: var(--mg4-brand); }
.dz-mg4--outline .dz-mg4__i:active .dz-mg4__ic { transform: scale(.92); }

@keyframes mg4FadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes mg4FloatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes mg4Shimmer { 0% { left: -60%; } 60%, 100% { left: 120%; } }
@keyframes mg4Breathe {
  0%, 100% { box-shadow: 0 10px 20px rgba(20, 184, 166, .30), inset 0 1.5px 0 rgba(255, 255, 255, .35); }
  50% { box-shadow: 0 14px 26px rgba(20, 184, 166, .42), inset 0 1.5px 0 rgba(255, 255, 255, .35); }
}
@keyframes mg4BreatheScale { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes mg4RingPulse { 0% { transform: scale(.9); opacity: .6; } 70% { transform: scale(1.2); opacity: 0; } 100% { opacity: 0; } }
@keyframes mg4Spin { to { transform: rotate(360deg); } }

@media (min-width: 768px) {
  .dz-mg4 { margin: 0 auto; max-width: 860px; }
  .dz-mg4__grid { gap: 14px; }
}
@media (max-width: 359px) {
  .dz-mg4 { margin: 0 10px; padding: 12px 8px; }
  .dz-mg4__grid { gap: 6px; }
  .dz-mg4__ic, .dz-mg4__ring { width: min(calc(var(--mg4-ico) * .85), 100%); height: auto; }
  .dz-mg4__ic svg, .dz-mg4__core svg { width: 96%; height: 96%; }
  .dz-mg4__ic img, .dz-mg4__core img { width: 100%; height: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .dz-mg4__i { animation: none; }
  .dz-mg4 .dz-mg4__ic,
  .dz-mg4 .dz-mg4__core,
  .dz-mg4 .dz-mg4__pulse,
  .dz-mg4 .dz-mg4__orbit,
  .dz-mg4 .dz-mg4__ic::after { animation: none !important; }
  .dz-mg4 .dz-mg4__ic,
  .dz-mg4__ic::after { transition: none; }
}

/* 装修编辑器画布：叠层同款外观，缩到画布手机比例；纯预览不拦点击 */
.menu-grid-render.canvas-mg4-original { position: relative; }
.menu-grid-render.canvas-mg4-original > .menu-grid-render__grid { display: none !important; }
/* ZHC-MG4-ORIG-HIDE-20261202：宫格渲染层已换成 innerHTML 自定义结构（.zhgm / 四款 section），
   老规则只藏 __grid，导致原经典款与四款式叠在一起。改为藏掉除叠层外的所有子节点。 */
.menu-grid-render.canvas-mg4-original > :not(.canvas-mg4-host) { display: none !important; }
.canvas-mg4-host { position: relative; z-index: 6; pointer-events: none; }
.canvas-mg4-host * { pointer-events: none !important; }
.canvas-mg4-host .dz-sec.dz-mg4sec { margin: 6px 0 0; }
.canvas-mg4-host .dz-mg4 { margin: 0 8px; padding: 12px 8px; border-radius: 16px; --mg4-ico: calc(var(--mg-ico, 54px) * .815); }
.canvas-mg4-host .dz-mg4__grid { gap: 6px; }
.canvas-mg4-host .dz-mg4__tx { font-size: calc(var(--mg-fs, 11px) * .9); }
.canvas-mg4-host .dz-mg4__ic::after { display: none; }
