/* ========== 全局 ========== */
* { 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: 18px 16px 8px;
}
.header-icon { font-size: 32px; }
.header-title {
    font-size: 26px;
    font-weight: bold;
    color: #ffd700;
    letter-spacing: 6px;
    margin: 4px 0;
}
.header-date {
    font-size: 16px;
    color: #c9a96e;
    margin-bottom: 4px;
}
.header-counter {
    font-size: 15px;
    color: #b8963e;
}
.header-counter strong { color: #ffd700; font-size: 22px; }

/* ========== 香炉区域 ========== */
.shrine {
    position: relative;
    width: 100%;
    height: 260px;
    overflow: hidden;
    margin: 0 auto;
}
.shrine-bg {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 70%, #3d1c00 0%, #1a0c00 70%);
    transition: background 0.8s;
}
.shrine-bg.health   { background: radial-gradient(ellipse at 50% 70%, #2d5016 0%, #0a1a04 70%); }
.shrine-bg.peace    { background: radial-gradient(ellipse at 50% 70%, #4a3520 0%, #1a0f04 70%); }
.shrine-bg.children { background: radial-gradient(ellipse at 50% 70%, #3d1c4a 0%, #100418 70%); }
.shrine-bg.wealth   { background: radial-gradient(ellipse at 50% 70%, #6b1a1a 0%, #1a0404 70%); }
.shrine-bg.marriage { background: radial-gradient(ellipse at 50% 70%, #5c2040 0%, #1a0410 70%); }
.shrine-bg.general  { background: radial-gradient(ellipse at 50% 70%, #5c3d10 0%, #1a0e02 70%); }

/* 佛光 */
.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); }
}

/* 烟雾 Canvas */
#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-body { position: relative; }
.burner-rim {
    width: 100px; height: 14px;
    background: linear-gradient(to bottom, #c9a96e, #8b6914);
    border-radius: 4px 4px 0 0;
    margin: 0 auto;
}
.burner-belly {
    width: 80px; height: 50px;
    background: linear-gradient(135deg, #6b4c20, #3d2608);
    border-radius: 0 0 30px 30px;
    margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: #c9a96e;
}
.burner-foot {
    width: 60px; height: 8px;
    background: #3d2608;
    border-radius: 0 0 6px 6px;
    margin: 0 auto;
}

/* 三炷香 */
.incense-sticks {
    position: absolute;
    bottom: 62px;
    left: 50%; transform: translateX(-50%);
    display: flex; gap: 8px;
    z-index: 4;
}
.stick {
    width: 4px; height: 80px;
    background: linear-gradient(to top, #d4a26a, #e8c88a);
    border-radius: 2px 2px 0 0;
    position: relative;
    animation: stickInsert 0.6s ease-out forwards;
    opacity: 0;
}
.stick-left   { animation-delay: 0s; }
.stick-center { animation-delay: 0.2s; }
.stick-right  { animation-delay: 0.4s; }
@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.06);
    border: 2px solid rgba(255,215,0,0.15);
    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.12);
    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.06);
    border: 2px solid rgba(255,215,0,0.2);
    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: rgba(100,70,20,0.3);
    border: 2px solid rgba(100,70,20,0.4);
    border-radius: 28px;
    color: #666;
    font-size: 24px;
    letter-spacing: 8px;
    cursor: pointer;
    transition: all 0.4s;
}
.burn-btn.active {
    background: linear-gradient(135deg, #8b0000, #b8860b);
    border-color: #ffd700;
    color: #ffd700;
    box-shadow: 0 0 24px rgba(255,215,0,0.35);
    cursor: pointer;
    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;
}
.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;
}

/* ========== 底部 ========== */
.bottom-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    max-width: 400px;
    margin: 0 auto;
}
.bottom-btn {
    background: rgba(255,215,0,0.08);
    border: 1px solid rgba(201,169,110,0.25);
    border-radius: 20px;
    padding: 10px 18px;
    color: #e8c88a;
    font-size: 16px;
    cursor: pointer;
    white-space: nowrap;
}
.bottom-btn.small { padding: 10px 14px; font-size: 18px; }
.bottom-btn:active { background: rgba(255,215,0,0.15); }

/* ========== 页脚 ========== */
.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; }
.modal-sub { font-size: 14px; color: #c9a96e; text-align: center; margin-bottom: 16px; }
.family-list { margin-bottom: 12px; }
.family-tag {
    display: inline-block;
    background: rgba(255,215,0,0.1);
    border: 1px solid rgba(201,169,110,0.3);
    border-radius: 14px;
    padding: 6px 14px;
    margin: 4px;
    font-size: 16px;
    color: #e8c88a;
    cursor: pointer;
}
.family-tag .remove { margin-left: 6px; color: #c9a96e; }
.family-add { display: flex; gap: 8px; margin-bottom: 16px; justify-content: center; }
.family-input {
    width: 140px; height: 38px;
    background: rgba(255,215,0,0.06);
    border: 1px solid rgba(201,169,110,0.3);
    border-radius: 19px;
    text-align: center;
    font-size: 16px;
    color: #ffd700;
    outline: none;
}
.family-input::placeholder { color: rgba(201,169,110,0.4); }
.family-add-btn {
    width: 60px; height: 38px;
    background: rgba(201,169,110,0.2);
    border: 1px solid #c9a96e;
    border-radius: 19px;
    color: #ffd700;
    font-size: 16px;
    cursor: pointer;
}
.family-pray-btn {
    display: block;
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, #8b0000, #b8860b);
    border: none;
    border-radius: 24px;
    color: #ffd700;
    font-size: 20px;
    margin-bottom: 12px;
    cursor: pointer;
}
.modal-close {
    display: block; margin: 0 auto;
    background: transparent; border: none;
    color: #c9a96e; font-size: 16px;
    cursor: pointer; padding: 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;
}
