    html,
    body {
      width: 100%;
      height: 100%;
      margin: 0;
      overflow: hidden;
    }

    a-scene {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 0;
    }

    /* 底部文字區塊（只有文字，沒有按鈕） */
    #caption-box {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      padding: 6px 24px 10px;
      background: rgba(255, 104, 0, 0.78);
      color: #fff;
      font-size: 1rem;
      line-height: 1.6;
      z-index: 10;
      box-sizing: border-box;
      transition: background 0.25s ease;
      font-family: "微軟正黑體";
      font-weight: 500;
    }

    /* 只放 AR 文案的區塊（打字機會改這裡） */
    #caption-text {
      white-space: pre-line;
      /* 讓 \n 換行 */
      text-align: justify;
    }

    /* 右上角按鈕容器 */
    #top-actions {
      position: fixed;
      top: 10px;
      right: 10px;
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      z-index: 20;
      /* 比掃描框還前面 */
    }

    .caption-btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 10px;
      border-radius: 0 8px 0 8px;
      border: 1px solid rgba(255, 255, 255, 0.7);
      font-size: 0.9rem;
      text-decoration: none;
      color: #fff;
      background: rgba(0, 0, 0, 0.35);
    }

    .caption-btn span.icon {
      font-size: 1rem;
    }

    .caption-btn:active {
      transform: scale(0.96);
    }

/* 提示圖 */

#scan-overlay{
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  background: rgba(0,0,0,0.10);
  display: grid;
  place-items: center;

  opacity: 1;
  visibility: visible;
  transition: opacity .25s ease, visibility .25s ease;
}

#scan-overlay.is-hidden{
  opacity: 0;
  visibility: hidden;
}

#scan-overlay .scan-target{
  width: min(64vw, 360px);
  height: auto;
  opacity: .55;                 /* ✅ 半透明目標圖 */
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.25));
}

#scan-overlay .scan-hint{
    position: absolute;
    left: 50%;
    top: calc(50% + min(34vw, -211px));
    transform: translateX(-50%);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: .8rem;
    color: #fff;
    background: rgba(0, 0, 0, .45);
    font-family: 微軟正黑體;
    font-weight: 500;
    text-align: center;

}


/* 定義旋轉動畫 */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 套用到您的 Logo class */
.logo-spin {
  animation: spin 3s linear infinite; /* 3秒轉一圈，線性速度，無限循環 */
}



.fx-hidden{
  opacity: 0;
  visibility: hidden;
}



/* 貼紙 */

#media-layer{
  position: fixed;
  right: 12px;
  bottom: 86px;
  width: 92px;
  height: 92px;
  z-index: 18;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(6px) scale(.98);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

#media-layer.show{
  opacity: 1;
  transform: translateY(0) scale(1);
}

#media-layer img,
#media-layer video{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none; /* 預設都不顯示，靠 JS 切換 */
}





/* 動畫 */
.emoji-layer{
  position: fixed;
  left: 50%;
  top: calc(50% + clamp(120px, 22vh, 200px)); /* 在掃描框(中心)下方 */
  transform: translateX(-50%) translateY(8px) scale(.98);

  z-index: 18;
  pointer-events: none;
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;

  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}

.emoji-layer.show{
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}


.fx-hidden{
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Emoji 本體 */
.emoji{
  font-size: 64px;      /* 大小可調 */
  line-height: 1;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.25));
  transform-origin: 50% 50%;
  will-change: transform, filter, opacity;
}

/* ============ 動畫：共用基底 ============ */
.fx{}

/* 1) shake */
.fx-shake{ animation: fx-shake .45s ease-in-out infinite; }
@keyframes fx-shake{
  0%{transform:translate(0,0) rotate(0)}
  25%{transform:translate(-2px,1px) rotate(-1deg)}
  50%{transform:translate(2px,-1px) rotate(1deg)}
  75%{transform:translate(-1px,2px) rotate(0)}
  100%{transform:translate(0,0) rotate(0)}
}

/* 2) bounce */
.fx-bounce{ animation: fx-bounce .8s ease-in-out infinite; }
@keyframes fx-bounce{
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-10px)}
}

/* 3) spin */
.fx-spin{ animation: fx-spin 2.2s linear infinite; }
@keyframes fx-spin{
  from{transform:rotate(0deg)}
  to{transform:rotate(360deg)}
}

/* 4) float */
.fx-float{ animation: fx-float 2.4s ease-in-out infinite; }
@keyframes fx-float{
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-8px)}
}

/* 5) glow（用 drop-shadow 做光暈） */
.fx-glow{ animation: fx-glow 1.2s ease-in-out infinite; }
@keyframes fx-glow{
  0%,100%{filter:drop-shadow(0 0 0 rgba(255,180,0,0))}
  50%{filter:drop-shadow(0 0 16px rgba(255,180,0,.95))}
}

/* 使用者偏好：關閉動畫 */
@media (prefers-reduced-motion: reduce){
  .fx, [class^="fx-"]{ animation:none !important; }
}
