@charset "utf-8";

/* ---------- Reset & 變數 ---------- */
*{margin:0;padding:0;box-sizing:border-box}

:root{
  --brand-red:#e93e38;
  --ink:#686867;

  /* 聖誕樹微調（容器為基準） */
  --tree-y: -230px;         /* 垂直位移（負=往上） */
  --tree-scale: 2.2;       /* 1=原始，>1 放大 */
  --tree-x: 0px;           /* 水平位移（正=右、負=左） */

  /* Xmas 標題寬度與上下位移 */
  --xmas-width-percent: 95%;
  --xmas-max-width: 720px;
  --xmas-dy: -8px;

  /* 場景留白 / 背景露出 */
  --stage-top-gap: 200px;     /* 禮物區上方留白（桌機） */
  --stage-bottom-gap: 10px;   /* 禮物區下方留白 → 往上靠近一點 */
  --stage-img-height: 520px;  /* 背景可視高度（底部淡出） */

  /* 彈窗底圖大小（可微調） */
  --lose-size: 80vmin;   /* 未中獎底圖：70–90vmin 都可以試 */
  --win-size: 80vmin;    /* 中獎底圖 */

  /* Xmas 標題左右星星 */
  --xmas-star-size: 120px;   /* 星星 GIF 的大小 */
  --xmas-star-gap:  -150px;  /* 星星跟標題左右間距 */
  --xmas-star-dy: -6px;      /* 負值=往上，正值=往下 */
}

@media (max-width:480px){
  :root{
    --tree-y: -120px;
    --tree-scale: 2.2;
    --tree-x: 0px;

    --xmas-width-percent: 110%;
    --xmas-max-width: 520px;
    --xmas-dy: 10px;

    /* ✅ 手機版禮物整排往上靠一點 */
    --stage-top-gap: 90px;   
    --stage-bottom-gap: 12px;  /* 手機底部留白也縮短一點 */
    --stage-img-height: 580px;

    --xmas-star-size: 72px;   /* 手機版星星再小一點 */
    --xmas-star-gap:  -50px;  /* 跟標題距離也可以縮短 */
    --xmas-star-dy: -2px;     /* 手機版再微調 */
    --win-size: 90vmin;   /* 手機彈窗大小 比桌機稍微小一點，自己可以改 65 / 75 之類 */
    /* 如果未中獎也想一起調整，可以順便加：
       --lose-size: 75vmin;
    */

  }
}

html,body{height:100%}

/* ---------- 全頁底層：bg1.jpg ---------- */
body{
  font-family:"Noto Sans TC","Microsoft JhengHei",Arial,sans-serif;
  min-height:100vh;
  background:url('img/bg1.jpg') center/cover no-repeat fixed;
  display:flex;
  justify-content:center;
  align-items:stretch;
  color:var(--ink);
}

/* ---------- 固定導覽 ---------- */
.nav{
  position:fixed;
  left:0;right:0;top:0;
  height:44px;
  background:var(--brand-red);
  display:flex;
  align-items:center;
  padding:0 12px;
  z-index:1000;
  box-shadow:0 2px 12px rgba(0,0,0,.2)
}
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;            /* LOGO 和文字的間距 */
  text-decoration: none;
}

.nav-logo img {
  height: 25px;        /* 視覺太大太小可以自己調 */
  display: block;
}

.nav-logo span {
  color: #fff;         /* 跟你原本導覽列字色一致 */
  font-size: 14px;
}

/* ---------- 內容容器 ---------- */
.app-container{
  width:100%;
  max-width:900px;
  min-height:100vh;
  margin-top:44px; /* 避開固定導覽 */
  background: transparent;
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:24px 16px 48px;
}

/* ---------- 場景：背景淡出 + 樹 + 標題 + 禮物 ---------- */
.stage{
  position:relative;
  width:100%;
  padding-top: var(--stage-top-gap);
  padding-bottom: var(--stage-bottom-gap);
  isolation: isolate;
}

/* 背景圖（桌機：1600x1040_pc2.png；手機：860x760_m2.png）＋底部淡出 */
.stage::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top: calc(-1 * var(--stage-top-gap));
  height: var(--stage-img-height);
  background: url('img/1600x1040_pc3.png') center top / cover no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 78%, rgba(0,0,0,0) 100%);
  mask-image:         linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 78%, rgba(0,0,0,0) 100%);
  z-index: 1;
  pointer-events: none;
}
@media (max-width:480px){
  .stage::before{
    background-image: url('img/860x760_m3.png');
  }
}

/* 聖誕樹（容器置中，可調大小與位置；不擋互動） */
.stage-tree{
  position:absolute;
  inset:0;
  background-image: url('img/tree.png');
  background-repeat: no-repeat;
  background-size: calc(clamp(260px, 66vw, 520px) * var(--tree-scale)) auto;
  background-position: calc(50% + var(--tree-x)) 50%;
  transform: translateY(var(--tree-y));
  z-index: 3;
  pointer-events: none;
}

/* Xmas 標題（在樹之上、禮物之下） */
.stage-xmas{
  position:relative;
  z-index:4;
  width:100%;
  display:flex;
  justify-content:center;
  transform: translateY(var(--xmas-dy));
  margin-bottom: 80px;
}
.stage-xmas img{
  width: min(var(--xmas-width-percent), var(--xmas-max-width));
  height:auto;
  display:block;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.25));
}

/* Xmas 標題左右的小星星 GIF */
.stage-xmas::before,
.stage-xmas::after{
  content:"";
  position:absolute;
  top:50%;
  transform: translateY(calc(-50% + var(--xmas-star-dy)));
  width: var(--xmas-star-size);
  height: var(--xmas-star-size);
  background: url("img/PartySterneSticker2.gif") center/contain no-repeat;
  pointer-events:none;
}

/* 左邊那顆 */
.stage-xmas::before{
  right:100%;
  margin-right: var(--xmas-star-gap);
}

/* 右邊那顆 */
.stage-xmas::after{
  left:100%;
  margin-left: var(--xmas-star-gap);
}

/* 禮物列（最上層） */
.gift-boxes{
  position:relative;
  z-index:5;
  width:100%;
  margin-inline:auto;
  display:flex;
  justify-content:space-between;
  gap: clamp(16px, 2.2vw, 30px); /* ✅ 調整 clamp 順序：min ≤ max */
}
.gift{
  width:55%;
  aspect-ratio:1/1;
  border:none;
  border-radius:18px;
  background:transparent !important;
  -webkit-appearance:none;
  appearance:none;
  outline:none;
  box-shadow:none;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:transform .12s ease;
  will-change:transform
}
.gift:hover{transform:translateY(-1px)}
.gift:active{transform:scale(.96)}
.gift:hover,.gift:focus,.gift:active{
  background:transparent !important;
  box-shadow:none !important;
  outline:none
}
.gift-icon{
  width:100%;
  height:auto;
  pointer-events:none;
  user-select:none
}

/* hover 輕微抖動 */
.gift:hover .gift-icon{
  animation:gift-shake .6s ease both
}
@keyframes gift-shake{
  0%{transform:translate3d(0,0,0) rotate(0)}
  15%{transform:translate3d(-2px,0,0) rotate(-2deg)}
  30%{transform:translate3d(2px,0,0) rotate(2deg)}
  45%{transform:translate3d(-1.5px,0,0) rotate(-1.5deg)}
  60%{transform:translate3d(1.5px,0,0) rotate(1.5deg)}
  75%{transform:translate3d(-1px,0,0) rotate(-1deg)}
  100%{transform:translate3d(0,0,0) rotate(0)}
}
@media (prefers-reduced-motion:reduce){
  .gift:hover .gift-icon{animation:none}
  .gift,.gift *{transition:none}
}

/* 禮物下方舞台 */
.stage-floor{
  position: relative;
  z-index: 4;                /* 在背景之上、禮物之下 */
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: -30px;         /* 往上推一點，讓禮物像站在舞台上，可自行微調 */
}

.stage-floor img{
  width: min(900px, 100%);   /* 舞台寬度：跟容器差不多寬 */
  height: auto;
  display: block;
}

/* 手機版可以再縮一點 */
@media (max-width:480px){
  .stage-floor{
    margin-top: -15px;        /* 手機再貼近一點 */
  }
  .stage-floor img{
    width: 100%;
  }
}

/* 禮物下方兩行狀態 */
.header-below{
  text-align:center;
  margin:0;
}
.header-below #chance-text{
  font-size:clamp(13px,2.6vw,15px);
  opacity:.95;
  margin-top:-40px;   /* 原本 30px → 往上貼近舞台 */
  color:#fff;
}

.header-below .countdown{
  margin:4px auto 0;  /* 原本 10px → 再往上貼一點 */
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  background:#7c0000; /* 深紅底條 */
  color:#fff;
  font-size:12px;
  line-height:1;
}

/* 左側「限時倒數」標籤 */
.countdown .cd-label{
  font-size:11px;
  letter-spacing:.08em;
  padding:3px 8px;
  border-radius:999px;
  background:rgba(0,0,0,.18);
}

/* 數字小方塊 */
.countdown .cd-box{
  display:inline-flex;
  align-items:center;
  gap:2px;
  padding:4px 6px;
  border-radius:4px;
  background:#c12626;
  box-shadow:0 1px 0 rgba(0,0,0,.35);
}
.countdown .cd-box strong{
  font-size:13px;
  font-weight:700;
  min-width:22px;
  text-align:center;
}
.countdown .cd-box span{
  font-size:11px;
}

/* 活動結束樣式（JS 會加 .ended） */
.countdown.ended{
  background:#555;
}
.countdown.ended .cd-label{
  background:transparent;
  padding:0;
}

/* 手機版微調 */
@media (max-width:480px){
  .header-below #chance-text{
    margin-top:6px;   /* 原本 30px → 大幅往上 */
  }
  .header-below .countdown{
    margin-top:2px;   /* 原本 8px → 再貼近一點 */
    padding:5px 6px;
    gap:4px;
  }
  .countdown .cd-box{
    padding:3px 4px;
  }
  .countdown .cd-box strong{
    font-size:12px;
    min-width:18px;
  }
  .countdown .cd-box span{
    font-size:10px;
  }
}

/* ---------- 活動說明（白底圓角） ---------- */
.activity-info{
  position:relative;
  z-index:6;
  --pad-t:28px; --pad-r:70px; --pad-b:28px; --pad-l:70px;
  --title-gap:12px; --h3-mt:16px; --h3-mb:6px;
  --block-gap:.6rem; --list-indent:1.25em; --line:1.7;

  width:100%;
  background:#fff;
  color:#222;
  border-radius:16px;
  padding: var(--pad-t) var(--pad-r) var(--pad-b) var(--pad-l);
  margin-top:40px;
  box-shadow:0 8px 24px rgba(0,0,0,.12);
}
.info-title{
  text-align:center;
  margin:0 0 var(--title-gap)
}
.info-title .pill{
  display:inline-block;
  background:var(--brand-red);
  color:#fff;
  padding:10px 24px;
  border-radius:999px;
  font-weight:700;
  letter-spacing:.08em;
  font-size:clamp(18px,2.8vw,20px)
}
.activity-info h3{
  color:#045454;
  font-weight:800;
  font-size:clamp(16px,2.6vw,18px);
  margin:var(--h3-mt) 0 var(--h3-mb);
  text-align:left
}
.activity-info p,
.activity-info ul,
.activity-info ol{
  margin:0 0 var(--block-gap);
  text-align:left
}
.activity-info ul,
.activity-info ol{
  padding-left:var(--list-indent)
}
.activity-info li{
  line-height:var(--line)
}
.activity-info a{
  color:#e93e38;
  font-weight:800;
  text-decoration:underline
}
.activity-info a:visited,
.activity-info a:hover,
.activity-info a:active,
.activity-info a:focus{
  color:#e93e38
}
.activity-info a:focus{
  outline:2px solid rgba(233,62,56,.35);
  outline-offset:2px
}

@media (max-width:480px){
  .activity-info{
    --pad-t:20px; --pad-r:36px; --pad-b:24px; --pad-l:36px;
    --h3-mt:14px; --block-gap:.5rem
  }
}

/* ---------- 雪花 ---------- */
.snow{
  pointer-events:none;
  position:fixed;
  inset:0;
  z-index:1500;
  overflow:hidden
}
.snow .flake{
  position:absolute;
  top:-10vh;
  border-radius:50%;
  background:rgba(255,255,255,.9);
  filter:drop-shadow(0 2px 2px rgba(0,0,0,.15));
  animation-name:snowFall,snowSwing;
  animation-iteration-count:infinite
}
@keyframes snowFall{
  to{transform:translateY(110vh);opacity:.95}
}
@keyframes snowSwing{
  0%{margin-left:0}
  50%{margin-left:18px}
  100%{margin-left:0}
}

/* ---------- 共用按鈕：桌機＋手機都置中 ---------- */
.btn{
  display:flex;
  align-items:center;
  justify-content:center;
  box-sizing:border-box;

  border:none;
  border-radius:999px;
  padding:0 24px;
  min-height:44px;

  background:#faa508;
  color:#fff;
  cursor:pointer;
  text-decoration:none;
  font-weight:700;
  text-align:center;
  line-height:1.2;

  font-size:16px;            /* ★ 桌機字級：想更大就改 18、20 */
  transition: background-color .15s ease, transform .12s ease;
}

/* 手機版：可以稍微小一點或一樣大，看你喜歡 */
@media (max-width:480px){
  .btn{
    min-height:48px;
    padding:0 20px;
    font-size:17px;          /* ★ 手機字級：要小就 14，要大就 16 */
  }
}

/* 紅色：填寫資料領取 */
.btn.primary{
  background:var(--brand-red);
}

/* 綠色：分享 LINE */
.btn.line{
  background:#06c755;
}

/* 共用的按下去微微下壓效果 */
.btn:active{
  transform:translateY(1px);
}

/* 橘色：再試手氣 / 關閉（按下時變暗一階） */
.btn:not(.primary):not(.line):active{
  background:#e19405;
}

/* 紅色：填寫資料領取（按下時變暗一階） */
.btn.primary:active{
  background:#c7312d;
}

/* 綠色：分享 LINE（按下時變暗一階） */
.btn.line:active{
  background:#049b42;
}

.hidden{ display:none !important; }

/* 視覺上隱藏（給無障礙用） */
.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

/* ---------- 彈窗（未中 / 中獎共用） ---------- */
.modal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.35);
  backdrop-filter:blur(6px);
  z-index:2000;
  padding:20px;
  align-items:center;
  justify-content:center;
}
.modal.open{ display:flex; }

.modal-inner{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
}

/* 只用背景圖來呈現，內文都隱藏 */
.modal-content{
  position:relative;
  border-radius:16px;
  overflow:hidden;
  box-shadow:none;
  width:min(var(--lose-size), 92vw);
  aspect-ratio:1 / 1;
  background:#fff;
  transform: scale(1);
  opacity: 1;
}

/* 彈窗本體彈出動畫（中獎、未中獎都共用） */
.modal.open .modal-content{
  animation: modal-pop .35s ease-out;
}

@keyframes modal-pop{
  0%   { transform: scale(.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-content > *{
  display:none;
}

/* 未中獎：800card / 800card2（正方形） */
.modal-content.lose-skin{
  background:var(--lose-img) center/contain no-repeat;
}

/* 未中獎彈窗左下角小圖（初始：隱藏＋縮小） */
.modal-content.lose-skin::before{
  content:"";
  position:absolute;
  left: -10px;         /* ✅ 加上 px */
  bottom:0;
  display:block;
  width:150px;
  height:150px;
  background-image:url('img/gingerman.gif'); /* 放在 img 資料夾 */
  background-size:100% auto;
  background-repeat:no-repeat;
  opacity:0;
  transform:scale(0);  /* 一開始縮到 0，看不到 */
  pointer-events:none; /* 不擋按鈕點擊 */
}

/* 彈窗打開時，小圖才開始延遲 + 縮放出現 */
.modal.open .modal-content.lose-skin::before{
  animation: lose-icon .5s ease-out .4s forwards;
  /*  .5s  動畫時間
   *  .4s  延遲：彈窗先出來，小圖再出現
   */
}

@keyframes lose-icon{
  0%   { opacity:0; transform:scale(0); }
  70%  { opacity:1; transform:scale(1.2); }
  100% { opacity:1; transform:scale(1); }
}

@media (max-width:480px){
  .modal-content.lose-skin::before{
    width:100px;
    height:100px;
    left: -8px;
    bottom:0;
  }
}

/* 中獎：800card-Winning（正方形） */
.modal-content.win-skin{
  width:min(var(--win-size), 92vw);
  background:var(--win-img) center/contain no-repeat;
}

/* 底部按鈕列（並排） */
.modal-footer{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
}

.button-row{
  width:100%;
  max-width:420px;
  display:flex;
  gap:10px;
  justify-content:center;
}
.button-row .btn{
  flex:1 1 0;
}
@media (max-width:480px){
  .button-row{
    max-width:92vw;
    flex-direction:column;  /* 🔸手機版改直向排列 */
  }
}

/* ---------- 彩帶（Lottie） ---------- */
#confetti{
  position: fixed;
  inset: 0;
  z-index: 3000;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
}
#confetti.show{ opacity: 1; }

/* ========== 大禮物盒動畫 ========== */
.big-gift{
  position: fixed;
  inset: 0;
  display: none;               /* 預設不顯示 */
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35); /* 慢慢變暗一層 */
  z-index: 1900;
}
.big-gift.show{
  display: flex;               /* JS 加 .show 時才出現 */
}
.big-gift img{
  width: min(500px, 70vw);     /* 可調整大小 */
  transform-origin: center center;
}

/* 手機版（螢幕寬度 ≤ 480px）大禮物尺寸 */
@media (max-width:480px){
  .big-gift img{
    width: 80vw;          /* 佔螢幕 80% 寬，你可以改 70vw / 60vw 試效果 */
    max-width: 380px;     /* 避免太大，可以依照圖再調 320 / 400 等 */
    max-height: 70vh;     /* 若圖片偏高，避免超出螢幕 */
  }
}

/* 播放動畫時會加上的 class */
.big-gift.play img{
  animation:
    bigGift-pop .65s ease-out,
    bigGift-shake 2.2s ease-in-out .75s;
}

/* 剛出現的放大彈跳 */
@keyframes bigGift-pop{
  0%   { transform: scale(.2); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); }
}

/* 抽一下的晃動感：幅度變大、來回更多次 */
@keyframes bigGift-shake{
  0%   { transform: translateX(0)    rotate(0deg); }
  10%  { transform: translateX(-12px) rotate(-3deg); }
  20%  { transform: translateX( 14px) rotate( 3deg); }
  30%  { transform: translateX(-10px) rotate(-2.5deg); }
  40%  { transform: translateX( 12px) rotate( 2.5deg); }
  50%  { transform: translateX(-8px)  rotate(-2deg); }
  60%  { transform: translateX( 10px)  rotate( 2deg); }
  70%  { transform: translateX(-5px)  rotate(-1.5deg); }
  80%  { transform: translateX( 5px)  rotate( 1.5deg); }
  90%  { transform: translateX(-3px)  rotate(-1deg); }
  100% { transform: translateX(0)     rotate(0deg); }
}
