@charset "utf-8";
/* =========================================================================
   郵保安心貸 — 115 年保單借款開學季活動網站
   活動期間 115.8.20 ~ 115.10.31
   -------------------------------------------------------------------------
   視覺依 Figma 設計稿（2026_中華郵政_2）實作，素材皆由設計稿匯出。
   沿用前一版之 class 命名與 app.js / api 介面，後端串接方式不變。
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&display=swap');

:root {
    --paper:      #ffffff;
    --grid-line:  #f7d9ba;
    --grid-size:  49px;

    --board-green:      #3d5c22;
    --board-green-dark: #2e4718;
    --wood:             #bd9564;

    --green:      #2e9245;   /* 導覽／頁尾企業綠 */
    --green-deep: #009944;
    --orange:     #f4903c;
    --orange-dk:  #d2701f;
    --gold:       #f2c53d;
    --footer-bg:  #c9c9c9;
    --ink:        #2f3a2a;

    --board-w:    840px;
    --header-w:   1075px;
}

* { box-sizing: border-box; }

html { height: 100%; overflow-x: hidden; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100%;
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    font-weight: 500;
    font-size: 17px;
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        repeating-linear-gradient(to right,  var(--grid-line) 0 1px, transparent 1px var(--grid-size)),
        repeating-linear-gradient(to bottom, var(--grid-line) 0 1px, transparent 1px var(--grid-size));
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { border-style: none; }

/* =========================================================================
   文具裝飾（設計稿的紙面塗鴉，全部來自 Figma 匯出素材）
   ========================================================================= */
.deco {
    position: fixed;          /* 跟著視窗，不受內容區安全範圍限制 */
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.deco img { position: absolute; height: auto; }

/* 位置以視窗寬高為基準，部分刻意超出邊緣形成出血，避免有被切斷的感覺 */
/* 筆記本落在導覽列下方；左上角星星刻意被畫面上緣切掉一半 */
.deco .d-notebook   { top:  3vh;  left:  13.4%; width: 5.2%; min-width: 74px; }
.deco .d-star1      { top:  0vh;   left:   2.6%; width: 2.3%; min-width: 26px; }
.deco .d-ruler      { top: 24vh;  left:   2.6%; width: 5.6%; min-width: 92px; }
.deco .d-star2      { top: 33vh;   left:  14.6%; width: 3.2%; min-width: 36px; }
.deco .d-ring-p     { top: 42vh;   left:   9.4%; width: 1.5%; min-width: 18px; }
.deco .d-protractor { top: 57vh;   left:  -0.8%; width: 4.1%; min-width: 46px; }
.deco .d-curve1     { top: 77vh;   left:   3.0%; width: 3.9%; min-width: 44px; }

.deco .d-curve2     { top:  7vh;  right:    0%; width: 4.8%; min-width: 54px; }
.deco .d-pencil     { top: 13vh;  right: 19.4%; width: 3.6%; min-width: 42px; }
.deco .d-ball       { top: 23vh;  right:  5.8%; width: 4.6%; min-width: 74px; }
.deco .d-star3      { top: 60vh;  right:    5%; width: 3.0%; min-width: 38px; }
.deco .d-diamond    { top: 40vh;  right:  4.8%; width: 0.9%; min-width: 22px; }
.deco .d-plane      { top: 49vh;  right: 12.6%; width: 2.6%; min-width: 52px; }
.deco .d-ring-t     { top: 79vh;  right:  3.2%; width: 0.9%; min-width: 22px; }

/* =========================================================================
   骨架
   ========================================================================= */
.page,
.container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1440px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 16px 104px;
}

/* ── 頁首 ─────────────────────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    position: relative;
    z-index: 6;               /* 永遠蓋在裝飾與吉祥物之上，不被壓到 */
    width: 100%;
    max-width: var(--header-w);
    padding: 8px 24px;
    background: #fff;
    border-radius: 0 0 34px 34px;
    box-shadow: 0 4px 4px rgba(0, 0, 0, .25);
}

.logo { height: 54px; flex-shrink: 0; margin: 0 30px 0 18px; }
.logo img { height: 100%; width: auto; display: block; }

.menu { display: flex; align-items: center; flex: 1; justify-content: space-around; }

.menu-list {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--green);
    text-decoration: none;
    border-radius: 999px;
    border: 2px solid transparent;
    transition: color .18s, background .18s, border-color .18s;
}

.menu-icon { width: 22px; height: auto; }

.menu-list:hover { background: #eef7ee; }

/* 目前所在頁面 → 綠色實心 */
.menu-list.active { color: #fff; background: var(--green); }
.menu-list.active .menu-icon { filter: brightness(0) invert(1); }

.menu-divider { width: 1px; height: 30px; background: #cfe3cf; flex-shrink: 0; }

/* =========================================================================
   主視覺舞台
   ========================================================================= */
.stage,
.content-container,
.lottery-wrapper {
    position: relative;
    display: flex;
    flex: 1;                  /* 佔滿頁首與頁尾之間的空間 */
    flex-direction: column;
    align-items: center;
    justify-content: center;  /* 黑板整體垂直置中 */
    width: 100%;
    padding: 20px 0;
}

/* ── 活動期間膠囊（壓在黑板上緣） ─────────────────────────────────── */
.date-pill {
    position: relative;
    z-index: 5;
    width: 400px;
    max-width: 62%;
    margin-bottom: -40px;
}

.date-pill img { width: 100%; display: block; }

/* ── 黑板 ─────────────────────────────────────────────────────────────── */
.event-info-wrapper {
    position: relative;
    width: 100%;
    max-width: var(--board-w);
    margin: 0 auto;
}

.event-info {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--board-w);
    min-height: 612px;
    margin: 0 auto;
    padding: 43px 54px 47px;
    color: #fff;
    background-image: url('../img/board_h.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    filter: drop-shadow(0 10px 22px rgba(60, 70, 40, .20));
}

/* 黑板左上探頭的小鳥 */
/* 站在木框上緣：黑板圖上方有約 16px 透明區，故底部再往下推 16px 才會真正貼齊 */
.bird-peek {
    position: absolute;
    bottom: calc(100% - 16px);
    left: 12px;
    width: 58px;
    z-index: 3;
    pointer-events: none;
}

/* 頁面標題（活動辦法／中獎查詢…） */
.event-info h2 {
    margin: 0 0 22px;
    text-align: center;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 3px;
    color: #fff;
}

.event-info h2::after {
    content: "";
    display: block;
    width: 104px;
    height: 4px;
    margin: 10px auto 0;
    border-radius: 4px;
    background: var(--gold);
}

/* ── 主標題 ───────────────────────────────────────────────────────────── */
.card-title,
.lottery-title-img {
    margin: 2px 0 26px;
    text-align: center;
}

.card-title img,
.lottery-title-img img {
    display: block;
    width: 100%;
    max-width: 505px;
    height: auto;
    margin: 0 auto;
}

/* =========================================================================
   資訊列（膠囊標籤 + 內容）
   ========================================================================= */
.info-list { display: flex; flex-direction: column; gap: 18px; }

.info-row { display: flex; align-items: flex-start; gap: 20px; }

.info-label {
    flex-shrink: 0;
    width: 112px;
    padding-top: 2px;
}

.info-label img { width: 100%; height: auto; display: block; }

.info-content {
    flex: 1;
    min-width: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.62;
    color: #fff;
    /* 頭尾對齊，讓右側邊緣齊平（最後一行仍靠左，為正常排版行為） */
    text-align: justify;
    text-justify: inter-character;
    word-break: break-all;
}

.info-content .note { font-weight: 500; }

/* ── 主要按鈕 ─────────────────────────────────────────────────────────── */
.card-action { margin-top: auto; padding-top: 26px; text-align: center; }

.btn-join,
.btn-lottery {
    display: inline-block;
    min-width: 200px;
    padding: 13px 44px;
    font-family: inherit;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 3px;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(180deg, #f9a959 0%, var(--orange) 100%);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--orange-dk), 0 8px 14px rgba(60, 70, 40, .18);
    transition: transform .14s ease, box-shadow .14s ease;
}

.btn-join:hover,
.btn-lottery:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--orange-dk), 0 10px 16px rgba(60,70,40,.22); }

.btn-join:active,
.btn-lottery:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--orange-dk); }

.btn-lottery:disabled,
.btn-lottery.disabled { background: #b8b8b8; box-shadow: 0 4px 0 #8d8d8d; cursor: not-allowed; transform: none; }

/* =========================================================================
   紙卡（活動辦法條文、表單皆放在紙上）
   ========================================================================= */
.note-paper {
    position: relative;
    flex: 1;
    min-height: 0;
    padding: 26px 30px;
    border-radius: 14px;
    background: #fffdf6;
    color: #33402c;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .22);
}

/* 紙膠帶 */
.note-paper::before,
.note-paper::after {
    content: "";
    position: absolute;
    top: -10px;
    width: 74px;
    height: 20px;
    background: rgba(126, 214, 187, .85);
}

.note-paper-plain::before, .note-paper-plain::after { display: none; }

.note-paper::before { left: 34px;  transform: rotate(-2.5deg); }
.note-paper::after  { right: 34px; transform: rotate(2.5deg); }

.event-text {
    font-size: 15px;
    line-height: 1.78;
    text-align: justify;
    text-justify: inter-character;
    word-break: break-all;
}

/* 表單與表格內的文字不套用齊行，避免欄位對齊被字距影響 */
.event-text .draw-list,
.event-text .win-form,
.event-text .win-result-info,
.event-text .win-table-wrapper,
.event-text .link { text-align: left; word-break: normal; }
.event-text p { margin: 0 0 10px; }
.event-text-p { font-size: 15px; }

.notice-scroll {
    max-height: 356px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #bfcfa8 #efeadd;
    overflow-x: hidden;
    padding-right: 12px;
}

.notice-scroll::-webkit-scrollbar { width: 7px; }
.notice-scroll::-webkit-scrollbar-track { background: #efeadd; border-radius: 999px; }
.notice-scroll::-webkit-scrollbar-thumb { background: #bfcfa8; border-radius: 999px; }

/* 活動辦法條列
   項目符號比照活動辦法文件（V7）：
     第一層  一、二、三…      （中文數字＋、）
     第二層  （一）（二）…     （中文數字加全形括號）
     第三層  1. 2. 3.          （阿拉伯數字）
   以 counter + ::before 實作，可精準控制標號文字與懸掛縮排 */
.notice-list { margin: 0; padding-left: 0; list-style: none; counter-reset: lv1; }

.notice-list > li {
    position: relative;
    padding-left: 3.4em;   /* 需容納「十一、」三字寬 */
    margin-bottom: 9px;
    counter-increment: lv1;
}

.notice-list > li::before {
    content: counter(lv1, cjk-ideographic) "、";
    position: absolute;
    left: 0;
    top: 0;
}

.notice-list > li:last-child { margin-bottom: 0; }

/* 第二層 */
.notice-list > li > ol { margin: 8px 0 0; padding-left: 0; list-style: none; counter-reset: lv2; }

.notice-list > li > ol > li {
    position: relative;
    padding-left: 3em;
    margin-bottom: 6px;
    counter-increment: lv2;
}

.notice-list > li > ol > li::before {
    content: "（" counter(lv2, cjk-ideographic) "）";
    position: absolute;
    left: 0;
    top: 0;
}

/* 第三層（i郵購紅利點數使用注意事項） */
.notice-list ol ol { margin: 6px 0 0; padding-left: 0; list-style: none; counter-reset: lv3; }

.notice-list ol ol > li {
    position: relative;
    padding-left: 2em;
    margin-bottom: 5px;
    counter-increment: lv3;
}

.notice-list ol ol > li::before {
    content: counter(lv3) ".";
    position: absolute;
    left: 0;
    top: 0;
}

/* 獎項圈列（設計稿為一排 5 個） */
.prize-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 6px;
    margin: 14px 0 6px;
}

.prize-row img { width: 19%; max-width: 122px; height: auto; display: block; }

.prize-note { margin: 8px 0 0; font-size: 14px; line-height: 1.7; color: #5c6650; }

/* =========================================================================
   角色與吉祥物
   ========================================================================= */
/* 垂直以頁尾灰底上緣為基準（不隨視窗高度變動）；
   水平以畫面中線對位，維持與黑板邊緣的相對關係 */
/* bottom:100% = 底邊貼齊頁尾灰底上緣；減 8px 讓腳掌略微踩進灰底 */
.ppl {
    position: absolute;
    bottom: calc(100% - 8px);
    left: 50%;
    z-index: 3;
    pointer-events: none;
}

.ppl-l { margin-left: -586px; width: 234px; }
.ppl-r { margin-left:  379px; width: 206px; }

.bird {
    position: absolute;
    bottom: calc(100% - 6px);
    left: 50%;
    z-index: 4;
    pointer-events: none;
}

.bird-a { margin-left: -328px; width: 100px; }
.bird-b { margin-left:  226px; width:  66px; }
.bird-c { margin-left:  288px; width:  92px; }

/* =========================================================================
   頁尾
   ========================================================================= */
.footer {
    /* 灰底滿版：不受 .page 的 max-width 與左右 padding 限制 */
    position: absolute;
    left: 50%;
    bottom: 0;
    z-index: 4;
    width: 100vw;
    transform: translateX(-50%);
    padding: 17px 0 15px;
    background: var(--footer-bg);
}

.footer-inner {
    position: relative;
    display: flex;
    align-items: flex-start;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 16px 0 68px;
}

.post-logo {
    position: absolute;
    left: 8px;
    top: 0;
    width: 48px;
}

.post-logo img { width: 100%; display: block; }

.footer-bottom { flex: 1; min-width: 0; }

.post-logo-text {
    display: flex;
    align-items: center;
    height: 42px;
    padding-left: 12px;
    background: linear-gradient(90deg, #00a04a 0%, var(--green-deep) 100%);
    border-radius: 4px;
}

.post-logo-text img { height: 60%; }

.footer-text {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 18px;
    padding: 6px 0 0 12px;
    font-size: 12.5px;
    color: #4d4d4d;
}

.footer-text p { margin: 0; }

.post-logo-color { width: 44px; margin-left: 12px; flex-shrink: 0; }
.post-logo-color img { width: 100%; display: block; }

/* =========================================================================
   表單（個資登錄 / 中獎查詢）
   ========================================================================= */
/* 桌機：標籤靠右 + 輸入框並排（比照設計稿） */
.draw-list, .win-form, .win-result-info {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 400px;
    margin: 0 auto;
}

.form-row, .win-form-row, .win-result-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.list-title, .win-label, .win-result-label {
    flex-shrink: 0;
    width: 108px;
    text-align: right;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.35;
    color: #33402c;
}

.list-title .req, .win-label .required { color: #e0553f; font-weight: 900; margin-right: 3px; }

.form-field { flex: 1; min-width: 0; }

/* 驗證碼列有兩層（輸入框＋驗證碼圖），標籤改為對齊第一層輸入框而非整組置中 */
.row-captcha { align-items: flex-start; }
.row-captcha > .list-title, .row-captcha > .win-label { padding-top: 16px; }

.draw-input, .win-input {
    width: 100%;
    height: 38px;
    padding: 0 11px;
    font-family: inherit;
    font-size: 14px;
    color: #2f3a2a;
    background: #fff;
    border: 1px solid #cfc8b8;
    border-radius: 6px;
    outline: none;
    transition: border-color .18s, box-shadow .18s;
}

.draw-input:focus, .win-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(46,146,69,.15); }
.draw-input::placeholder, .win-input::placeholder { color: #b3ada0; }

/* 驗證碼：桌機為輸入框下方一列（設計稿樣式） */
.verification-wrapper { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.verification-wrapper > .code-input { width: 100%; }

img.verification-code {
    width: 100%;
    height: 32px;
    /* contain：驗證碼一律完整顯示，不因容器比例不同被裁切
       （cover 會裁掉左右，字元可能不見）。留白以綠底補齊。 */
    object-fit: contain;
    background: var(--green-deep);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.captcha-hint { margin: 6px 0 0; font-size: 12.5px; color: #6b7264; }

/* 中獎查詢／個人資料登錄：表單在紙卡內垂直置中（原本靠上，下方會空一大塊） */
.win-section .note-paper,
.user-section .note-paper { display: flex; flex-direction: column; justify-content: center; }
.captcha-hint a { color: var(--green); font-weight: 700; text-decoration: underline; cursor: pointer; }

.error-message { margin: 4px 0 0; font-size: 12.5px; font-weight: 700; color: #d0402c; }
.error-message:empty { display: none; }

/* 表單按鈕：綠色實心小圓角 */
.draw-btn, .btn-submit, .btn-back {
    display: block;
    margin: 18px auto 0;
    padding: 10px 26px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    background: var(--green-deep);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .16s ease, transform .14s ease;
}

.draw-btn:hover, .btn-submit:hover, .btn-back:hover { background: #007c37; transform: translateY(-1px); }
.draw-btn:active, .btn-submit:active, .btn-back:active { transform: translateY(1px); }

/* 重新查詢：依設計稿為綠色實心 */
.btn-back { background: var(--green-deep); color: #fff; border: 1px solid var(--green-deep); }
.btn-back:hover { background: #007c37; color: #fff; }

.win-form-action { text-align: center; }

.win-result-value {
    flex: 1;
    height: 32px;
    line-height: 32px;
    padding: 0 14px;
    text-align: center;
    font-size: 14.5px;
    background: #ebe7dc;
    border-radius: 4px;
}

.win-table-wrapper { width: 100%; max-width: 470px; margin: 16px auto 0; overflow-x: auto; }

/* 中獎紀錄較多時只捲動表格區，下方領獎說明與按鈕維持可見（同活動辦法的捲軸樣式） */
.win-table-scroll { max-height: 180px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #bfcfa8 #efeadd; }
.win-table-scroll::-webkit-scrollbar { width: 7px; }
.win-table-scroll::-webkit-scrollbar-track { background: #efeadd; border-radius: 999px; }
.win-table-scroll::-webkit-scrollbar-thumb { background: #bfcfa8; border-radius: 999px; }
.win-table-scroll .win-table thead th { position: sticky; top: 0; z-index: 1; }

/* 領獎說明與領獎確認書 */
.event-text .win-claim-note {   /* 提高權重，避免被 .event-text p 的 margin 覆蓋 */
    max-width: 620px;
    margin: 16px auto 0;
    font-size: 13.5px;
    line-height: 1.75;
    color: #33402c;
    text-align: left;
}

.win-claim {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    max-width: 620px;
    margin: 10px auto 0;
}

.win-claim-tel { font-size: 13px; color: #4a5344; }

/* 只中五獎時單獨顯示的客服電話：此時卡片內沒有其他左對齊文字，
   改為置中才會與表格、按鈕形成對稱 */
.event-text .win-claim-tel-only {
    margin: 16px auto 0;
    font-size: 13px;
    color: #4a5344;
    text-align: center;
}
.win-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.win-table thead th { padding: 7px 6px; text-align: center; font-weight: 700; white-space: nowrap; color: #fff; background: #8fa32b; }
.win-table tbody td { padding: 8px 6px; text-align: center; background: #fff; border-bottom: 1px solid #e6e0d2; }
.win-table tbody tr:nth-child(even) td { background: #f4f1e8; }

/* =========================================================================
   相關連結
   ========================================================================= */
/* 桌機比例依設計稿實測：圓標 60px、文字 30px、圖文間距 14px、
   列距 81.5px（＝圓標 60 ＋ 列間空隙 21.5）
   紙卡不撐滿黑板（設計稿高 394px），連結區上下留白 19px＋紙卡 padding 26px = 45px
   ⚠️ 僅桌機適用；手機版紙卡維持與其他頁一致的「撐滿黑板」 */
.link { display: flex; justify-content: center; padding: 10px 0; }

@media (min-width: 768px) {
    .note-paper-plain { flex: 0 0 auto; }
    .link { padding: 19px 0; }
}
.link-inner { display: flex; flex-direction: column; align-items: flex-start; gap: 21.5px; }

.link-inner a {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 30px;
    font-weight: 400;   /* 依設計稿為一般字重，不加粗 */
    letter-spacing: 1px;
    line-height: 1.2;
    color: #000000;
    text-decoration: none;
    transition: transform .15s ease, color .15s ease;
}

/* 第一項「中華郵政全球資訊網」依設計稿為綠色 */
.link-inner a:first-child { color: #37A631; }

.link-inner a:hover { transform: translateX(4px); }
.link-inner a img { width: 60px; height: auto; flex-shrink: 0; }
.link-inner a span { text-decoration: none; }
.link-inner a:hover span { text-decoration: underline; }

/* =========================================================================
   開書包 + 刮刮卡
   ========================================================================= */
.bag-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

.bag-svg {
    width: 100%;
    /* 書包放大至設計稿比例（本體約 216px 寬，對應 SVG 元素 306px） */
    max-width: 306px;
    height: auto;
    cursor: pointer;
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .28));
    animation: bag-idle 2.4s ease-in-out infinite;
    transition: transform .25s ease;
}

.bag-svg:hover { transform: scale(1.03) rotate(-1deg); }

@keyframes bag-idle {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-8px) rotate(-1.4deg); }
}

/* 點擊後：先左右搖晃 550ms，再彈開消失 450ms（總長需與 lottery.html 的 ANIM_MS 一致） */
.bag-stage.is-open .bag-svg {
    animation: bag-shake .55s ease-in-out 1,
               bag-pop   .45s cubic-bezier(.34, 1.56, .64, 1) .55s forwards;
}

@keyframes bag-shake {
    0%   { transform: rotate(0deg)   scale(1); }
    12%  { transform: rotate(-8deg)  scale(1.02); }
    28%  { transform: rotate(7deg)   scale(1.02); }
    44%  { transform: rotate(-6deg)  scale(1.03); }
    60%  { transform: rotate(5deg)   scale(1.03); }
    76%  { transform: rotate(-3deg)  scale(1.04); }
    100% { transform: rotate(0deg)   scale(1.05); }
}

@keyframes bag-pop {
    0%   { transform: scale(1.05); opacity: 1; }
    40%  { transform: scale(1.22) rotate(3deg); opacity: 1; }
    100% { transform: scale(.55) translateY(46px); opacity: 0; }
}

/* 彈開瞬間的光暈 */
.bag-stage.is-open::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 260px;
    height: 260px;
    margin: -130px 0 0 -130px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 240, 190, .85) 0%, rgba(255, 224, 130, 0) 70%);
    opacity: 0;
    pointer-events: none;
    animation: bag-glow .6s ease-out .5s forwards;
}

@keyframes bag-glow {
    0%   { opacity: 0; transform: scale(.4); }
    45%  { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0; transform: scale(1.5); }
}

.bag-stage { position: relative; }

.bag-hint { margin: 22px 0 0; font-size: 19px; font-weight: 900; letter-spacing: 2px; color: #fff; }
.bag-hint .hl { color: var(--gold); }

/* =========================================================================
   抽獎結果
   ========================================================================= */
.result-card { animation: result-fade-in .45s ease-out; }

/* 未中獎內容較少，於卡片內垂直置中，避免上緊下空 */
.result-card-no-prize { display: flex; flex-direction: column; justify-content: center; }

@keyframes result-fade-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}

.result-win-title { margin: 2px 0 14px; text-align: center; font-size: 19px; font-weight: 900; letter-spacing: .5px; color: #2f3a2a; }

.result-visual { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 auto 12px; }
.result-giftbox { width: 52px; flex-shrink: 0; animation: giftbox-bounce 1.2s ease-in-out infinite alternate; }

@keyframes giftbox-bounce {
    from { transform: translateY(0) rotate(-4deg); }
    to   { transform: translateY(-8px) rotate(4deg); }
}

.result-prize-img { width: 148px; max-width: 40%; height: auto; }

.result-divider { display: flex; align-items: center; justify-content: center; margin: 20px 0 12px; }
.result-divider::before, .result-divider::after { content: ""; flex: 1; max-width: 160px; height: 1px; background: #9BAA31; }
.result-divider-text { padding: 0 14px; font-size: 13.5px; font-weight: 700; letter-spacing: 2px; color: #9BAA31; }

.result-notice { font-size: 13.5px; line-height: 1.75; color: #3a4433; }
.result-notice-address { margin: 0 0 10px; }
.result-notice-list { margin: 0 0 8px; padding-left: 20px; }
.result-notice-tel { margin: 8px 0 0; font-size: 13px; color: #4a5344; }

.result-remain-hint { margin: 14px 0 0; text-align: center; font-size: 15px; font-weight: 700; color: #2f3a2a; }
.result-remain-hint strong { margin: 0 3px; font-size: 19px; color: #e0553f; }

/* 兩顆按鈕並排（繼續抽獎 / 下次再抽），比照設計稿 */
.result-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }

.btn-result {
    display: inline-block;
    min-width: 108px;
    padding: 9px 22px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background .16s ease, transform .14s ease;
}

.btn-result-primary { color: #fff; background: var(--green-deep); }
.btn-result-primary:hover { background: #007c37; transform: translateY(-1px); }

.btn-result-secondary { color: var(--green-deep); background: #fff; border-color: var(--green-deep); }
.btn-result-secondary:hover { background: #f1faf2; transform: translateY(-1px); }

/* 領獎確認書：中獎須知下方，橘色外框；電話併排在按鈕右側 */
.result-claim { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 12px 0 0; }
.result-claim-tel { font-size: 13px; color: #4a5344; }

.btn-result-download {
    display: inline-block;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--orange-dk);
    background: #fff;
    border: 1px solid #edb26a;
    border-radius: 6px;
    text-decoration: none;
    transition: background .16s ease;
}

.btn-result-download:hover { background: #fff6ea; }

.result-no-prize-title { margin: 2px 0 16px; text-align: center; font-size: 19px; font-weight: 900; letter-spacing: 1px; color: #2f3a2a; }
.result-no-prize-img { display: block; width: 205px; max-width: 100%; flex-shrink: 0; margin: 0 0 12px; animation: mailbox-wiggle 2.4s ease-in-out infinite; }

@keyframes mailbox-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25%      { transform: rotate(-3deg); }
    75%      { transform: rotate(3deg); }
}

/* =========================================================================
   彈窗
   ========================================================================= */
.popup {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* 設計稿為淺色遮罩（整頁泛白偏灰） */
    background: rgba(236, 236, 232, .78);
}

.popup-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    padding: 26px 26px;
    overflow: auto;
    background: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(60, 70, 40, .22);
}

/* 個資彈窗右上角關閉鈕（點擊回首頁） */
.popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #e0271c;
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

.popup-close svg { width: 20px; height: 20px; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; fill: none; }
.popup-close:hover { background: #b81c13; transform: scale(1.06); }
.popup-close:focus-visible { outline: 3px solid #f9c9c5; outline-offset: 2px; }

.popup-title { margin-bottom: 16px; text-align: center; font-size: 22px; font-weight: 900; letter-spacing: 2px; color: var(--board-green); }

.popup-text {
    height: 44vh;
    margin-bottom: 14px;
    padding: 14px 16px;
    overflow-y: auto;
    font-size: 13.5px;
    line-height: 1.85;
    background: #fff;
    border: 2px solid #eae3d4;
    border-radius: 10px;
}

.popup-text h3 { margin: 14px 0 6px; font-size: 15.5px; color: var(--board-green); }

.checkbox-area { display: flex; align-items: flex-start; justify-content: center; gap: 8px; margin-bottom: 8px; }
.checkbox-area input[type="checkbox"] { width: 19px; height: 19px; margin-top: 2px; flex-shrink: 0; }
.checkbox-area input.error { outline: 2px solid #d0402c; }
.checkbox-area label { font-size: 13.5px; line-height: 1.5; }

.warning-text { margin-bottom: 12px; text-align: center; font-size: 13px; color: #6b7264; }
.warning-text.error { color: #d0402c; font-weight: 700; }

.confirm-button, .popup-content2 button, .count-btn {
    display: block;
    margin: 18px auto 0;
    padding: 10px 30px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    background: var(--green-deep);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .16s ease, transform .14s ease;
}

.confirm-button:hover, .popup-content2 button:hover, .count-btn:hover { background: #007c37; transform: translateY(-1px); }

.popup-content2 {
    width: 100%;
    max-width: 340px;
    padding: 30px 26px;
    text-align: center;
    background: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(60, 70, 40, .22);
}

.popup-content2 h2 { margin: 0 0 12px; font-size: 20px; font-weight: 900; color: #2f3a2a; }
.popup-content2 p { margin: 0; font-size: 14px; line-height: 1.75; color: #4a5344; }

.popup-content-count .count-text { margin: 4px 0; font-size: 17px; font-weight: 700; color: #2f3a2a; }
.popup-content-count .count-number { margin: 0 5px; font-size: 30px; font-weight: 900; color: #e0553f; vertical-align: middle; }

/* =========================================================================
   RWD
   ========================================================================= */
@media (max-width: 1240px) {
    .ppl-l { margin-left: -516px; width: 200px; }
    .ppl-r { margin-left:  330px; width: 178px; }
    .bird-a { margin-left: -300px; width: 88px; }
    .bird-b { margin-left:  200px; width: 58px; }
    .bird-c { margin-left:  256px; width: 80px; }
    .deco .d-protractor, .deco .d-star1 { display: none; }
}

@media (max-width: 1040px) {
    .ppl-l { margin-left: -430px; width: 152px; }
    .ppl-r { margin-left:  282px; width: 134px; }
    .bird-a { margin-left: -252px; width: 74px; }
    .bird-b { margin-left:  168px; width: 50px; }
    .bird-c { margin-left:  214px; width: 68px; }
    .menu-list { font-size: 15px; padding: 6px 10px; gap: 5px; }
    .logo { margin-right: 14px; }
    .deco .d-ruler, .deco .d-notebook, .deco .d-curve1, .deco .d-ring-p { display: none; }
}

@media (max-width: 900px) {
    /* 依示意圖比例改為視窗百分比配置，三隻吉祥物全部保留 */
    .ppl-l  { left:  6.2%; margin-left: 0; width: 17.9%; }
    .ppl-r  { left: auto; right: 2.7%; margin-left: 0; width: 20.1%; }
    .bird-a { left: 28.5%; margin-left: 0; width: 10.6%; }
    .bird-b { display: block; left: 58.2%; margin-left: 0; width: 8.9%; }
    .bird-c { left: 67.1%; right: auto; margin-left: 0; width: 10.1%; }
}

@media (max-width: 900px) {
    .event-info { padding: 46px 34px 24px; }
}

/* ── 手機版：黑板改直式 ──────────────────────────────────────────────── */
@media (max-width: 767px) {
    /* 手機版避免最後一行只剩一兩個字：讓瀏覽器平均分配每行長度。
       text-wrap: balance 不支援的瀏覽器會忽略，維持原本斷行，不會壞版。 */
    .warning-text, .checkbox-area label { text-wrap: balance; }

    body { font-size: 16px; --grid-size: 38px; }

    .page, .container { padding: 0 10px 118px; }

    .header { padding: 6px 8px; border-radius: 0 0 20px 20px; }
    .logo { height: 46px; width: auto; margin: 0 6px 0 2px; }
    .menu { justify-content: space-between; }
    .menu-list { flex-direction: column; gap: 2px; padding: 3px 4px; font-size: 11px; letter-spacing: 0; border-width: 1px; }
    .menu-icon { width: 19px; }
    .menu-divider { height: 26px; }

    .stage, .content-container, .lottery-wrapper { padding-top: 26px; }

    .date-pill { width: 248px; max-width: 66%; margin-bottom: -14px; }

    /* 手機版黑板統一高度：除首頁（內容較長會自然撐高）外，
       活動辦法／立即抽好禮／抽獎／抽獎結果／中獎查詢／相關連結 一律 556px，
       切換頁面時黑板不會忽高忽低 */
    .event-info {
        width: 98%;
        min-height: 556px;
        padding: 34px 22px 46px;
        background-image: url('../img/board_v.png');
    }

    .card-title img, .lottery-title-img img { max-width: 260px; }
    .card-title, .lottery-title-img { margin-bottom: 20px; }

    .event-info h2 { font-size: 21px; letter-spacing: 2px; }

    .info-list { gap: 14px; }
    .info-row { flex-direction: column; gap: 7px; }
    .info-label { width: 104px; padding-top: 0; }
    .info-content { font-size: 15.5px; line-height: 1.6; }

    .btn-join, .btn-lottery { font-size: 19px; min-width: 168px; padding: 12px 34px; letter-spacing: 2px; }

    .bird-peek { width: 42px; left: 0; bottom: calc(100% - 4px); }
    .bird { display: block; }
    /* 兩張角色圖長寬比不同（0.880 / 0.773），改以「等高」控制才會是同一個視覺比例 */
    .ppl { height: 152px; width: auto; }
    .ppl-l { left: -2px;  margin-left: 0; }
    .ppl-r { left: auto; right: -2px; margin-left: 0; }

    /* 三隻吉祥物同步放大 1.2 倍，並往中間靠避免被放大後的角色遮住 */
    .bird-a { left: 34.0%; width: 12.7%; }
    .bird-b { left: 51.5%; width: 10.7%; }
    .bird-c { left: 60.5%; width: 12.1%; }

    .note-paper { padding: 20px 15px; }
    .note-paper::before, .note-paper::after { width: 54px; }
    .notice-scroll { max-height: 46vh; }
    .prize-row { flex-wrap: wrap; gap: 6px 8px; }
    .prize-row img { width: 30%; max-width: 108px; }

    /* 手機版：標籤在上、輸入框在下（設計稿樣式） */
    .list-title, .win-label, .win-result-label { width: auto; text-align: left; }
    .form-row, .win-form-row { flex-direction: column; align-items: stretch; gap: 5px; }
    /* 手機版標籤在輸入框上方，不需要對齊用的上內距 */
    .row-captcha > .list-title, .row-captcha > .win-label { padding-top: 0; }
    .win-result-row { gap: 10px; }
    .win-result-label { width: 76px; text-align: right; }
    .draw-list, .win-form, .win-result-info { max-width: 100%; gap: 12px; }
    .draw-input, .win-input { height: 40px; font-size: 14.5px; }

    /* 驗證碼在手機版改為左右並排 */
    .verification-wrapper { flex-direction: row; align-items: stretch; gap: 10px; }
    .verification-wrapper > .code-input { flex: 1 1 0; width: auto; min-width: 0; }
    /* 手機版：寬高比 126:40 ≈ 驗證碼圖原始比例（240:76），完整顯示不留黑邊 */
    img.verification-code { width: 126px; height: 40px; flex-shrink: 0; }

    /* 抽獎結果：手機版內容較多時卡片自行捲動，
       避免卡片長高後被頁尾人物圖蓋住文字（同活動辦法的捲軸樣式） */
    .result-card { max-height: 390px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #bfcfa8 #efeadd; }
    .result-no-prize-img { width: 140px; }
    .result-giftbox { width: 39px; }
    .result-card::-webkit-scrollbar { width: 7px; }
    .result-card::-webkit-scrollbar-track { background: #efeadd; border-radius: 999px; }
    .result-card::-webkit-scrollbar-thumb { background: #bfcfa8; border-radius: 999px; }

    .win-table-wrapper { max-width: 100%; }
    .win-table-scroll { max-height: 150px; }
    .win-claim-note { font-size: 12.5px; line-height: 1.7; margin-top: 10px; }
    .win-claim { gap: 8px; margin-top: 8px; }
    .win-claim-tel { font-size: 12px; }
    .win-claim-tel-only { font-size: 12px; margin-top: 12px; }
    .win-table { font-size: 11.5px; }
    .win-table thead th, .win-table tbody td { padding: 6px 4px; }

    /* 手機版比例依 網站視覺/Mobile/相關連結_Mobile.jpg 實測（390px 基準）：
       圓標 45px、文字 17px、圖文間距 11.5px、列距 60.3px、
       連結區距紙卡上緣 80px／下緣 130px（紙卡 padding 20px ＋ 此處 60／110） */
    .link { padding: 60px 0 108px; }
    .link-inner { width: 100%; gap: 15.3px; }
    .link-inner a { font-size: 17px; gap: 11.5px; letter-spacing: .4px; }
    .link-inner a img { width: 45px; }

    .bag-svg { max-width: 233px; }
    .bag-hint { font-size: 16px; margin-top: 18px; }

    .result-prize-img { width: 150px; }
    .btn-result { width: 100%; max-width: 280px; }
    .btn-result-primary { min-width: 0; }

    .deco img { display: none; min-width: 0; }
    .deco .d-star2, .deco .d-ball, .deco .d-plane, .deco .d-pencil, .deco .d-curve2 { display: block; }
    .deco .d-star2 { top: 200px; left: 2%; width: 40px; }
    .deco .d-ball { top: 150px; right: -20px; width: 62px; }
    .deco .d-plane { top: 420px; right: -14px; width: 50px; }
    .deco .d-pencil { top: 70px; right: 2%; width: 34px; }
    .deco .d-curve2 { top: 300px; right: -10px; width: 44px; }

    .footer { padding: 8px 0 8px; }
    .footer-inner { padding: 0 8px 0 44px; }
    .post-logo { width: 32px; left: 4px; }
    .post-logo-text { height: 26px; padding-left: 8px; }
    .footer-text { font-size: 10px; gap: 1px 10px; padding-left: 8px; }
    .post-logo-color { width: 30px; margin-left: 6px; }
}

@media (max-width: 400px) {
    .event-info { padding: 30px 28px 26px; }
    .menu-list { font-size: 10px; padding: 3px 2px; }
    .menu-icon { width: 17px; }
    .card-title img, .lottery-title-img img { max-width: 220px; }
    .popup-content { padding: 18px 13px; }
    .popup-text { height: 40vh; }


    /* 窄螢幕（如 320px）標題會頂到右上角關閉鈕：縮字級並保留右側空間 */
    .popup-title { padding-right: 42px; font-size: 19px; letter-spacing: 1px; }
    .popup-close { width: 30px; height: 30px; top: 10px; right: 10px; }
    .popup-close svg { width: 18px; height: 18px; }
}
