﻿html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    color: #333;
    background: url("images/lucky/bg.jpg") no-repeat top center fixed;
    background-size: cover;
}

img.emoji {
    height: 1em;
    width: 1em;
    margin: 0 0.05em 0 0.1em;
    vertical-align: -0.1em; /* 調整垂直對齊，確保跟文字水平拉齊 */
}


.container-box {
    max-width: 768px;
    margin: 0 auto;
}

/* 站點按鈕樣式 */
.station-btn {
    background-color: #fff;
    border: 2px solid #d1c7bd;
    color: #5a5045;
    transition: all 0.3s ease;
    letter-spacing:0.2px;
}

    .station-btn:hover {
        background-color: #8d7e69;
        border-color: #8d7e69;
        color: #fff;
        transform: translateY(-2px);
    }

/* 雙層明信片結構樣式 */
.postcard-front {
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    border: none;
}

.postcard-back {
    border-radius: 0 0 16px 16px;
    border-top: 2px dashed #d1c7bd !important;
    border: none;
}

/* 針對 543x413px 圖片設定完美的響應式比例，防止排版跳動 */
#cardImage {
    width: 100%;
    height: auto;
    aspect-ratio: 1024 / 791;
    object-fit: cover;
    display: block;
}

#cardDescImg {
    width: 100%;
    height: auto;
    aspect-ratio: 1024 / 791;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

/* 淡入動畫 */
.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====================================================
                                           ✨ 全新升級：擬真 3D 信封拆開與信件升起動畫特效
                                           ==================================================== */
#animationOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(247, 245, 240, 0.98);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 信封 3D 視角包裝器 */
.envelope-wrapper {
    perspective: 1000px;
    width: 300px;
    height: 220px;
    margin: 0 auto;
    position: relative;
}

/* 信封主外殼 */
.envelope-box {
    width: 280px;
    height: 180px;
    background-color: #c4ba9f; /* 信封內部深色襯底 */
    position: absolute;
    bottom: 0;
    left: 10px;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

/* 信封上蓋 (三角形) */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #e6dec9;
    clip-path: polygon(0% 0%, 100% 0%, 50% 55%);
    transform-origin: top;
    z-index: 4;
    /* 動態銜接：等火漆章消失後(0.2s)開始向上翻摺，中途切換層級 */
    transition: transform 0.5s ease-in-out 0.2s, z-index 0s linear 0.45s, background-color 0.5s ease-in-out 0.2s;
}

/* 信封前方口袋 */
.envelope-body {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ebd9b4;
    clip-path: polygon(0% 45%, 50% 55%, 100% 45%, 100% 100%, 0% 100%);
    z-index: 3;
    border-radius: 0 0 4px 4px;
}

/* 內裝神祕信件卡片 */
.envelope-paper {
    position: absolute;
    bottom: 10px;
    left: 15px;
    width: 250px;
    height: 140px;
    background-color: #ffffff;
    border-radius: 4px;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    transform: translateY(0);
    /* 等上蓋翻開得差不多了(0.6s)，再優雅地向上彈出 */
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.15) 0.6s;
}

/* 火漆印章 */
.wax-seal {
    position: absolute;
    top: 55%;
    left: 50%;
    width: 66px;
    height: 66px;
    background: radial-gradient(circle, #a62626 60%, #7a1313 100%);
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    transform: translate(-50%, -50%) scale(1);
    transition: transform 0.25s ease-in-out, opacity 0.25s ease-in-out;
}

    .wax-seal::after {
        content: "✉️";
        font-size: 26px;
        color: #f1d279;
    }

/* ----------------------------------
                                           當信封被加上 .open 類別時的狀態轉變
                                        ---------------------------------- */
/* 1. 火漆章秒速縮小淡出 */
.envelope-box.open .wax-seal {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

/* 2. 信封三角形上蓋往上 3D 翻開 180 度 */
.envelope-box.open .envelope-flap {
    transform: rotateX(180deg);
    background-color: #d8ceb3; /* 翻開後背面背光，顏色深一點更寫實 */
    z-index: 1; /* 關鍵：翻上去後層級降到信紙後方，才不會遮住抽出的信紙 */
}

/* 3. 卡片由信封口袋向外滑出 */
.envelope-box.open .envelope-paper {
    transform: translateY(-85px); /* 向上抽出 */
}

/* ==================================================== */

/* 5 種類別的專屬卡片背面漸層襯底 */
.bg-station-start {
    background: linear-gradient(135deg, #FFF5EC 0%, #FFFDF7 100%);
}

.bg-station-repair {
    background: linear-gradient(135deg, #EBF5FB 0%, #FAFDFF 100%);
}

.bg-station-faith {
    background: linear-gradient(135deg, #EAF2E8 0%, #FAFCF9 100%);
}

.bg-station-call {
    background: linear-gradient(135deg, #F4ECF7 0%, #FDFBFE 100%);
}

.bg-station-bible {
    background: linear-gradient(135deg, #F6F0EA 0%, #FDFBF9 100%);
}

/* 專門用於生成图片的隱藏模板樣式 */
#shareImageTemplate {
    position: absolute;
    left: -9999px;
    width: 800px;
    padding: 20px;
    box-sizing: border-box;
    font-family: "Microsoft JhengHei", sans-serif;
    border-radius: 16px;
    overflow: hidden;
}

.share-card-container {
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    background: #fff;
    position: relative;
}

.share-postcard-front {
    width: 100%;
    height: auto;
    aspect-ratio: 1024 / 791;
    object-fit: cover;
    border-radius: 16px 16px 0 0;
}

.share-postcard-back {
    /* padding: 30px; */
    border-top: 2px dashed #d1c7bd;
    border-radius: 0 0 16px 16px;
}

.share-card-title {
    font-weight: bold;
    color: #198754;
    margin-bottom: 20px;
    font-size: 26px;
}

.share-card-desc {
    color: #6c757d;
    line-height: 1.8;
    font-size: 18px;
    white-space: pre-line;
    margin-bottom: 20px;
}

.share-card-desc-img {
    width: 100%;
    height: auto;
    aspect-ratio: 1024 / 791;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.share-card-footer {
    /*margin-top: 20px;*/
    /*border-top: 1px solid #eee;*/
    /*padding-top: 20px;*/
    text-align: center;
}

.share-logo {
    width: 120px;
    opacity: 0.8;
    margin-bottom: 10px;
}

.share-footer-text {
    font-size: 14px;
    color: #aaa;
    letter-spacing: 1px;
}

#generatedImage {
    -webkit-touch-callout: default !important; /* 確保 iOS 允許跳出選單 */
    pointer-events: auto !important; /* 確保點擊/長按抓得到圖片 */
    user-select: auto !important;
    max-width: 100%;
    height: auto;
}

.intro-text {
    color: #A65D57;
    line-height: 1.85;
    font-size: 13.5px;
}

    .intro-text::before {
        content: "✦";
        color: #A65D57;
        font-size: 1rem;
    }

@media (max-width: 575.98px) {
    .intro-text {
        line-height: 1.85;
        font-size: 12.5px;
    }
}