#qZone{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 42px;
  z-index: 10000;
  color: #fff;
  background: linear-gradient(to right, #256c92 0%, #76ad54 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  font-size: 15px;
  transition: height .6s ease, font-size .6s ease;
}

/* 首次造訪：加高版 */
#qZone.is-tall{
  height: 72px;
  font-size: 18px;
}

#qZone.is-tall .qBadge{
  padding: 7px 20px;
  font-size: 15px;
}

#qZone.is-tall .qLink{
  gap: 14px;
}

body.login-error #qZone{
  top: 40px;
}

body.has-qzone .header{
  top: 42px;
  transition: top .6s ease;
}

body.has-qzone #homeCon{
  top: 42px;
  transition: top .6s ease;
}

body.has-qzone.login-error .header{
  top: 82px;
}

body.has-qzone.login-error #homeCon{
  top: 82px;
}

/* 加高版時同步把 header / homeCon 再下推 */
body.has-qzone.qzone-tall .header{
  top: 72px;
}

body.has-qzone.qzone-tall #homeCon{
  top: 72px;
}

body.has-qzone.qzone-tall.login-error .header{
  top: 112px;
}

body.has-qzone.qzone-tall.login-error #homeCon{
  top: 112px;
}

#qZone .qLink{
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
  padding: 0 16px;
  transition: opacity .2s;
}

#qZone .qLink:hover{
  opacity: .85;
  color: #fff;
}

#qZone .qBadge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  margin-left: 6px;
  background: rgba(255, 255, 255, .22);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

#qZone .qClose{
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #fff;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}

#qZone .qClose:hover{
  background: rgba(255, 255, 255, .2);
}

@media (max-width: 576px){
  #qZone{ height: auto; padding: 8px 40px 8px 12px; }
  #qZone .qLink{ padding: 0; flex-wrap: wrap; }
  #qZone .qBadge{ margin-left: 0; }
}

/* === 首次造訪：高亮動畫 === */
@keyframes qzone-slide-in {
  0%   { transform: translateY(-100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes qzone-glow {
  0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
  50%      { box-shadow: 0 4px 24px rgba(148, 191, 120, .95), 0 0 40px rgba(43, 111, 146, .6); }
}

@keyframes qzone-shimmer {
  0%   { transform: translateX(-120%) skewX(-20deg); }
  60%  { transform: translateX(120%)  skewX(-20deg); }
  100% { transform: translateX(120%)  skewX(-20deg); }
}

@keyframes qzone-badge-pulse {
  0%, 100% { transform: scale(1);    background: rgba(255, 255, 255, .22); }
  50%      { transform: scale(1.08); background: rgba(255, 255, 255, .45); }
}

@keyframes qzone-new-pop {
  0%   { transform: translateY(-50%) scale(0);    opacity: 0; }
  70%  { transform: translateY(-50%) scale(1.25); opacity: 1; }
  100% { transform: translateY(-50%) scale(1);    opacity: 1; }
}

@keyframes qzone-new-pulse {
  0%, 100% { transform: translateY(-50%) scale(1);    box-shadow: 0 2px 8px rgba(255, 61, 110, .7); }
  50%      { transform: translateY(-50%) scale(1.12); box-shadow: 0 2px 14px rgba(255, 61, 110, 1); }
}

#qZone.is-first-visit{
  overflow: hidden;
  animation: qzone-slide-in .6s ease-out, qzone-glow 1.8s ease-in-out .6s 4;
}

#qZone.is-first-visit::before{
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 35%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, .55) 50%, transparent 100%);
  animation: qzone-shimmer 2.6s ease-in-out .6s 3;
  pointer-events: none;
}

#qZone.is-first-visit .qBadge{
  animation: qzone-badge-pulse 1.2s ease-in-out .6s 6;
}

#qZone .qNew{
  display: none;
  position: absolute;
  top: calc(50% + 3px);
  left: 14px;
  transform: translateY(-50%);
  padding: 3px 9px;
  background: #ff3d6e;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(255, 61, 110, .7);
  letter-spacing: 1px;
  z-index: 3;
  line-height: 1.4;
}

#qZone.is-first-visit .qLink{
  padding-left: 68px; /* 為左側 NEW 標籤預留空間 */
}

#qZone.is-first-visit .qNew{
  display: inline-block;
  animation: qzone-new-pop .5s ease-out .8s backwards,
             qzone-new-pulse 1.2s ease-in-out 1.3s 5;
}

/* 預先套用：避免導頁初始閃動 */
html.has-qzone-pre body .header{ top: 42px; }
html.has-qzone-pre body #homeCon{ top: 42px; }
html.has-qzone-pre body.login-error .header{ top: 82px; }
html.has-qzone-pre body.login-error #homeCon{ top: 82px; }

html.qzone-tall-pre body .header{ top: 72px; }
html.qzone-tall-pre body #homeCon{ top: 72px; }
html.qzone-tall-pre body.login-error .header{ top: 112px; }
html.qzone-tall-pre body.login-error #homeCon{ top: 112px; }
