/* ========== 全局 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    width: 100%; min-height: 100vh;
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #1a0c00;
    color: #f0d78c;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    overflow-x: hidden;
}
body { padding-bottom: 30px; }

/* ========== 头部 ========== */
.header { text-align: center; padding: 10px 16px 4px; }
.header-date { font-size: 16px; color: #c9a96e; margin-bottom: 4px; }
.header-row { display: flex; justify-content: center; align-items: center; gap: 12px; }
.header-counter { font-size: 15px; color: #b8963e; }
.header-counter strong { color: #ffd700; font-size: 22px; }
.share-top-btn {
    background: rgba(255,215,0,0.08);
    border: 1px solid rgba(201,169,110,0.25);
    border-radius: 16px;
    padding: 4px 12px;
    color: #e8c88a;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.share-top-btn:active { background: rgba(255,215,0,0.15); }

/* ========== 菩萨背景 ========== */
.shrine { position: relative; width: 100%; height: 520px; overflow: hidden; margin: 0 auto; }
.shrine-bg {
    position: absolute; inset: 0;
    background-image: url('assets/bg-default.png');
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    transition: background-image 0.8s, opacity 0.8s;
    opacity: 0.8;
}
.shrine-bg.health   { background-image: url('assets/bg-health.jpg'); }
.shrine-bg.peace    { background-image: url('assets/bg-peace.png'); }
.shrine-bg.children { background-image: url('assets/bg-children.png'); }

/* 佛光 */
.halo {
    position: absolute;
    top: 10%; left: 50%; transform: translateX(-50%);
    width: 160px; height: 80px;
    background: radial-gradient(ellipse at 50% 0%, rgba(255,215,0,0.15) 0%, transparent 70%);
    border-radius: 50%;
    transition: opacity 1.5s;
    opacity: 0.4;
}
.halo.active { opacity: 0.8; animation: haloPulse 3s ease-in-out infinite; }
@keyframes haloPulse {
    0%,100% { opacity: 0.4; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.9; transform: translateX(-50%) scale(1.15); }
}

/* 烟雾 */
#smokeCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

/* 香炉 */
.burner { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 3; }
.burner-img {
    width: 160px; height: auto; display: block;
    filter: drop-shadow(0 0 20px rgba(255,140,0,0.3));
    animation: burnerGlow 4s ease-in-out infinite;
}
@keyframes burnerGlow {
    0%,100% { filter: drop-shadow(0 0 15px rgba(255,140,0,0.25)); }
    50% { filter: drop-shadow(0 0 30px rgba(255,140,0,0.5)); }
}

/* 三炷香 */
.incense-sticks { position: absolute; bottom: 105px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 5; }
.stick {
    width: 4px; height: 90px;
    background: linear-gradient(to top, #c9953a, #e8c88a);
    border-radius: 2px 2px 0 0;
    position: relative; opacity: 0;
}
@keyframes stickInsert {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.ember {
    position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
    width: 10px; height: 10px;
    background: radial-gradient(circle, #ff6600, #ff3300, transparent);
    border-radius: 50%;
    animation: emberGlow 0.8s ease-in-out infinite alternate;
}
@keyframes emberGlow {
    from { box-shadow: 0 0 6px 3px rgba(255,100,0,0.6); }
    to   { box-shadow: 0 0 12px 6px rgba(255,60,0,0.9); }
}

/* ========== 祈福类型 ========== */
.incense-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 12px 16px; max-width: 400px; margin: 0 auto; }
.type-card {
    background: rgba(255,215,0,0.08);
    border: 2px solid rgba(255,215,0,0.2);
    border-radius: 14px;
    padding: 14px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}
.type-card.selected {
    border-color: #ffd700;
    background: rgba(255,215,0,0.15);
    box-shadow: 0 0 18px rgba(255,215,0,0.3);
    transform: scale(1.03);
}
.type-card.highlight { border-color: #ffd700; box-shadow: 0 0 12px rgba(255,215,0,0.2); animation: cardPulse 0.6s ease-in-out; }
@keyframes cardPulse {
    0%,100% { box-shadow: 0 0 8px rgba(255,215,0,0.15); }
    50% { box-shadow: 0 0 20px rgba(255,215,0,0.4); }
}
.type-icon { font-size: 32px; margin-bottom: 4px; }
.type-label { font-size: 18px; color: #e8c88a; font-weight: bold; }

/* ========== 姓名输入 ========== */
.name-area { text-align: center; padding: 0 16px; max-width: 400px; margin: 0 auto; }
.name-input {
    width: 200px; height: 44px;
    background: rgba(255,215,0,0.08);
    border: 2px solid rgba(255,215,0,0.25);
    border-radius: 22px;
    text-align: center;
    font-size: 20px; color: #ffd700;
    outline: none; letter-spacing: 4px;
}
.name-input::placeholder { color: rgba(201,169,110,0.4); letter-spacing: 2px; font-size: 16px; }
.name-input:focus { border-color: #ffd700; }

/* ========== 上香按钮 ========== */
.burn-btn {
    display: block; width: 180px; height: 56px; margin: 16px auto;
    background: linear-gradient(135deg, #8b0000, #b8860b);
    border: 2px solid rgba(255,215,0,0.3);
    border-radius: 28px;
    color: #ffd700; font-size: 24px; letter-spacing: 8px;
    cursor: pointer; transition: all 0.4s;
}
.burn-btn.active { box-shadow: 0 0 24px rgba(255,215,0,0.35); animation: btnReady 2s ease-in-out infinite; }
@keyframes btnReady {
    0%,100% { box-shadow: 0 0 16px rgba(255,215,0,0.3); }
    50% { box-shadow: 0 0 30px rgba(255,215,0,0.6); }
}
.burn-btn.disabled { cursor: not-allowed; opacity: 0.5; background: rgba(100,70,20,0.3); border-color: rgba(100,70,20,0.4); color: #666; box-shadow: none; animation: none; }
.burn-btn:active:not(.disabled) { transform: scale(0.95); }
.btn-icon { margin-right: 6px; }

/* ========== 结果区 ========== */
.result-area { padding: 0 16px; max-width: 400px; margin: 0 auto; animation: fadeInUp 0.6s ease-out; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.result-name { text-align: center; font-size: 20px; color: #f0d78c; padding: 10px 0; }
.result-divider { text-align: center; color: #c9a96e; font-size: 14px; margin-bottom: 12px; }
.qian-card {
    background: linear-gradient(135deg, rgba(80,40,10,0.7), rgba(40,15,5,0.9));
    border: 1px solid rgba(201,169,110,0.3);
    border-radius: 16px;
    padding: 20px 16px; text-align: center;
}
.qian-header { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; }
.qian-icon { font-size: 28px; }
.qian-level { font-size: 22px; font-weight: bold; color: #ffd700; }
.qian-poem { font-size: 19px; line-height: 1.8; color: #f0d78c; margin-bottom: 16px; padding: 0 8px; }
.kaishi-label { font-size: 15px; color: #c9a96e; margin-bottom: 8px; }
.kaishi-text { font-size: 17px; color: #e8c88a; line-height: 1.7; }

/* ========== 页脚 ========== */
.footer { text-align: center; font-size: 13px; color: rgba(201,169,110,0.5); padding: 12px 0 20px; }

/* ========== 遮罩 ========== */
.overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.3s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
    background: #2a1808;
    border: 1px solid rgba(201,169,110,0.3);
    border-radius: 20px;
    padding: 24px 20px;
    width: 85vw; max-width: 360px;
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }
.loading-box { text-align: center; }
.loading-spin { font-size: 48px; animation: spin 1s linear infinite; margin-bottom: 16px; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.loading-text { font-size: 18px; color: #f0d78c; }
.modal-title { font-size: 22px; color: #ffd700; text-align: center; margin-bottom: 8px; }

/* 分享 */
.share-modal { max-width: 320px; }
.share-card-preview { margin: 12px auto; border-radius: 14px; overflow: hidden; }
.share-card-inner {
    background: linear-gradient(135deg, #3d1c00, #1a0800);
    border: 2px solid #c9a96e;
    border-radius: 14px;
    padding: 20px; text-align: center;
}
.share-card-title { font-size: 22px; color: #ffd700; letter-spacing: 4px; margin-bottom: 12px; }
.share-card-name { font-size: 18px; color: #f0d78c; margin-bottom: 8px; }
.share-card-days { font-size: 16px; color: #e8c88a; margin-bottom: 12px; }
.share-card-days strong { color: #ffd700; font-size: 22px; }
.share-card-icon { font-size: 48px; margin-bottom: 8px; }
.share-card-cta { font-size: 14px; color: #c9a96e; }
.share-actions { margin: 12px 0; }
.share-btn {
    display: block; width: 100%; height: 48px;
    background: linear-gradient(135deg, #8b0000, #b8860b);
    border: none; border-radius: 24px;
    color: #ffd700; font-size: 18px; cursor: pointer;
}

/* 关闭按钮 - 老人友好大号 */
.modal-close {
    display: block; width: 100%; height: 52px; margin: 12px auto 0;
    background: rgba(255,215,0,0.1);
    border: 2px solid rgba(201,169,110,0.35);
    border-radius: 26px;
    color: #ffd700; font-size: 22px; font-weight: bold;
    cursor: pointer; letter-spacing: 4px;
}
.modal-close:active { background: rgba(255,215,0,0.2); }
/* ========== 分享 - 二维码推广 ========== */
.share-modal { max-width: 320px; }
.qrcode-box { text-align: center; margin: 16px 0; }
.qrcode-img { width: 200px; height: 200px; border-radius: 12px; border: 2px solid rgba(201,169,110,0.3); }
.qrcode-text { text-align: center; font-size: 18px; color: #ffd700; font-weight: bold; margin-bottom: 4px; }
.qrcode-sub { text-align: center; font-size: 14px; color: #c9a96e; margin-bottom: 16px; }
/* 上上签分享按钮 */
.ssq-share-btn {
    display: block; width: 100%; height: 52px; margin: 16px 0 0;
    background: linear-gradient(135deg, #ff6600, #ffd700);
    border: none; border-radius: 26px;
    color: #1a0c00; font-size: 20px; font-weight: bold;
    cursor: pointer; letter-spacing: 2px;
    animation: glow 1.5s ease-in-out infinite;
}
@keyframes glow { 0%,100% { box-shadow: 0 0 10px rgba(255,215,0,0.5); } 50% { box-shadow: 0 0 25px rgba(255,215,0,0.9); } }