* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --vermillion: #DC143C; --vermillion-dark: #B91C3C; --vermillion-light: #EF4444;
    --orange: #FF8C00; --orange-dark: #E67E00; --orange-light: #FFA500;
    --golden-yellow: #FFD700; --golden-yellow-dark: #DAA520; --golden-yellow-light: #FFFF99;
    --deep-red: #8B0000; --burgundy: #722F37; --ivory: #FFFFF0;
    --shadow-gold: rgba(212, 175, 55, 0.3); --shadow-vermillion: rgba(220, 20, 60, 0.4);
}
body {
    font-family: 'Georgia', serif; background: var(--vermillion-dark); min-height: 100vh;
    color: var(--deep-red); overflow-x: hidden; position: relative; margin: 0; padding: 0;
}
body::before {
    content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(185, 28, 60, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(185, 28, 60, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(185, 28, 60, 0.4) 0%, transparent 50%);
    opacity: 0.5; z-index: -1; animation: heavenlyGlow 8s ease-in-out infinite alternate;
}
@keyframes heavenlyGlow { 0% { opacity: 0.4; transform: scale(1); } 100% { opacity: 0.7; transform: scale(1.05); } }
.container { max-width: 100%; margin: 0; padding: 0; width: 100vw; min-height: 100vh; }

/* WELCOME SCREEN WITH RESPONSIVE IMAGES */
.welcome-screen {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; width: 100vw; text-align: center;
    background:
        linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.1)),
        url('/images/vermillion-door-signboard_Desktop.webp'),
        var(--vermillion-dark);
    background-size: contain, contain, contain;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
    position: relative; margin: 0; padding: 40px 20px; cursor: pointer;
}
.welcome-screen:hover {
    background:
        linear-gradient(rgba(0,0,0,0.2), rgba(0,0,0,0.05)),
        url('/images/vermillion-door-signboard_Desktop.webp'),
        var(--vermillion);
    background-size: contain, contain, contain;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
}

.temple-door-container { position: relative; width: 100%; max-width: 600px; margin: 0 auto; perspective: 1000px; }

/* Click Door Glow Effect */
.enter-hint {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2em;
    font-weight: bold;
    color: var(--golden-yellow);
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 30px rgba(255, 215, 0, 0.4);
    animation: gentlePulse 2s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
}

@keyframes gentlePulse { 
    0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); } 
    50% { opacity: 1; transform: translateX(-50%) scale(1.05); } 
}

.temple-interior {
    min-height: 100vh;
    background: var(--vermillion-dark);
    padding: 20px; position: relative;
}
.temple-main-container { 
    display: flex; align-items: center; justify-content: center; min-height: 100vh; 
    margin-top: 0; padding: 20px; position: relative; z-index: 5; 
    flex-direction: column;
}
.temple-content { 
    display: flex; align-items: center; gap: 80px; max-width: 1400px; width: 100%; 
    flex-direction: row; justify-content: center;
}
.temple-buttons { display: flex; flex-direction: column; gap: 20px; min-width: 280px; }

/* DEITY STATUE WITH HERO IMAGE - STAGE 2: 600px x 780px */
.deity-statue {
    background-image: url('/images/caishenye-hero.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: none; 
    border-radius: 15px; 
    margin: 0 auto; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3), 0 0 30px var(--shadow-gold); 
    position: relative;
    width: 600px; 
    height: 780px;
}

/* ENHANCED SQUARE LUNAR CALENDAR */
lunar-calendar {
    position: relative;  /* CHANGED from absolute */
    margin: 20px auto;    /* ADDED: centers it */
    background: linear-gradient(145deg, var(--golden-yellow), var(--golden-yellow-light));
    border: 4px solid var(--vermillion); border-radius: 15px; padding: 15px;
    width: 280px; height: 780px;
    box-shadow: 0 8px 25px var(--shadow-gold), inset 0 1px 0 var(--golden-yellow-light); z-index: 10;
    display: flex; flex-direction: column; overflow-y: auto;
}

.calendar-header {
    border-bottom: 2px solid var(--vermillion-dark);
    padding-bottom: 8px; margin-bottom: 10px;
}

.lunar-date-large {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--vermillion-dark);
    text-align: center;
    margin-bottom: 10px;
}

.vertical-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chinese-date {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--deep-red);
    text-shadow: 1px 1px 2px var(--golden-yellow-dark);
}

.ganzhi-small {
    font-size: 0.85em;
    color: var(--burgundy);
    line-height: 1.4;
}

.gregorian-small {
    font-size: 0.9em;
    color: var(--deep-red);
    text-align: center;
}

.lunar-date { 
    font-size: 1em; font-weight: bold; color: var(--vermillion-dark); 
    text-align: center; margin-bottom: 8px; text-shadow: 1px 1px 2px var(--golden-yellow-dark); 
    line-height: 1.2;
}

.zodiac-selector {
    margin: 8px 0;
}

.zodiac-selector select {
    width: 100%; padding: 5px; border: 2px solid var(--vermillion);
    border-radius: 5px; background: rgba(255,255,255,0.9);
    color: var(--deep-red); font-weight: bold; font-size: 0.85em;
    font-family: 'Georgia', serif;
}

.lunar-info { 
    font-size: 0.85em; 
    color: var(--deep-red); 
    text-align: left; 
    line-height: 1.4; 
    font-weight: 500; 
    flex-grow: 1;
}

.lunar-info.traditional {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lunar-info .section {
    margin: 8px 0; 
    padding: 8px; 
    background: rgba(255,215,0,0.15); /* <- GOLDEN TINT */
    border-radius: 5px;
}

.lunar-info .inline-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lunar-info .inline-section .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lunar-info .label {
    font-weight: bold; 
    color: var(--golden-yellow-dark); 
    font-size: 0.95em;
    display: inline-block;
    min-width: 60px;
}

.lunar-info .gods-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px;
}

.lunar-info .god-item {
    text-align: center;
    font-size: 0.8em;
    background: rgba(255,215,0,0.2); /* ← GOLDEN TINT */
    padding: 6px;
    border-radius: 5px;
}

.lunar-info .yi-section,
.lunar-info .ji-section {
    padding: 10px;
}

.lunar-info .activity-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.lunar-info .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9em;
    margin-right: 8px;
}

.lunar-info .icon.good {
    background: #22C55E;
    color: white;
}

.lunar-info .icon.bad {
    background: #EF4444;
    color: white;
}

.lunar-info .activities {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.85em;
}

.lunar-info .activity-item {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.9em;
    line-height: 1.4;
    white-space: nowrap;
}

.lunar-info .activity-item.good {
    background: rgba(34, 197, 94, 0.15);
    color: var(--deep-red);
}

.lunar-info .activity-item.bad {
    background: rgba(239, 68, 68, 0.15);
    color: var(--deep-red);
}

.lunar-info .small-text {
    font-size: 0.8em;
    line-height: 1.5;
}

.back-button {
    position: fixed; top: 20px; left: 20px; z-index: 100; padding: 12px 20px;
    background: var(--vermillion); color: var(--golden-yellow); border: 2px solid var(--golden-yellow);
    border-radius: 8px; font-size: 0.9em; font-weight: bold; cursor: pointer; transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3); text-shadow: 1px 1px 2px var(--vermillion-dark); display: none;
}
.back-button:hover { 
    background: var(--golden-yellow); 
    color: var(--vermillion); 
    border-color: var(--vermillion); 
    transform: translateY(-2px); 
    box-shadow: 0 6px 16px rgba(0,0,0,0.4); 
    text-shadow: 1px 1px 2px var(--golden-yellow-dark); 
}

/* Enhanced Disclaimer Styles - STAGE 1: Compacted */
.disclaimer {
    position: fixed; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    font-size: 0.65em; 
    color: var(--ivory);
    text-align: center; 
    padding: 12px 20px; 
    background: rgba(0,0,0,0.9); 
    border: none; 
    border-radius: 0; 
    margin: 0; 
    z-index: 30; 
    backdrop-filter: blur(5px);
}

.disclaimer-header {
    font-weight: bold; 
    color: var(--golden-yellow); 
    margin-bottom: 6px; 
    font-size: 1.1em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.disclaimer p {
    line-height: 1.4;
    margin: 0;
}

.temple-btn {
    padding: 18px 30px; background: var(--vermillion); color: var(--golden-yellow);
    border: 3px solid var(--golden-yellow); border-radius: 12px; font-size: 1.1em; font-weight: bold; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3), 0 0 15px var(--shadow-vermillion);
    position: relative; overflow: hidden; text-shadow: 1px 1px 2px var(--vermillion-dark);
    font-family: 'Georgia', serif;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.temple-btn .btn-icon {
    font-size: 1.5em;
    line-height: 1;
    flex-shrink: 0;
}

.temple-btn .btn-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1.2;
}

.temple-btn .btn-english {
    font-size: 1em;
    font-weight: bold;
    font-family: 'Georgia', serif;
}

.temple-btn .btn-chinese {
    font-size: 0.85em;
    opacity: 0.9;
    font-family: 'Georgia', serif;
}

.temple-btn:hover {
    background: var(--golden-yellow); color: var(--vermillion); border-color: var(--vermillion);
    transform: translateY(-3px) scale(1.02); box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.temple-btn:disabled {
    opacity: 0.6; cursor: not-allowed; transform: none;
}

/* Button status indicators */
.btn-counter {
    position: absolute; top: -5px; right: -5px; background: var(--deep-red); color: var(--golden-yellow);
    border-radius: 50%; width: 20px; height: 20px; font-size: 0.7em; display: flex;
    align-items: center; justify-content: center; font-weight: bold;
}

.btn-counter.available { background: #228B22; }

/* Modal Styles */
.modal {
    display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8); animation: fadeIn 0.3s;
}

.modal-content {
    background: linear-gradient(145deg, var(--golden-yellow), var(--golden-yellow-light));
    margin: 5% auto; padding: 25px; border: 4px solid var(--vermillion); border-radius: 15px;
    width: 90%; max-width: 500px; max-height: 80vh; overflow-y: auto;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.close {
    color: var(--vermillion); float: right; font-size: 28px; font-weight: bold;
    cursor: pointer; line-height: 1;
}

.close:hover { opacity: 0.7; }

.form-group { margin: 15px 0; }

.form-group label {
    display: block; margin-bottom: 5px; color: var(--deep-red); font-weight: bold;
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 10px; border: 2px solid var(--vermillion); border-radius: 5px;
    font-size: 1em; background: rgba(255,255,255,0.9);
}

.payment-methods {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px; margin: 15px 0;
}

.payment-btn {
    padding: 12px; background: var(--vermillion); color: var(--golden-yellow);
    border: none; border-radius: 8px; font-weight: bold; cursor: pointer;
    transition: all 0.3s ease; font-size: 0.9em;
}

.payment-btn:hover, .payment-btn.selected {
    background: var(--golden-yellow); color: var(--vermillion); transform: scale(1.05);
}

.donation-options {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 15px 0;
}

.donation-btn {
    padding: 15px; background: var(--vermillion); color: var(--golden-yellow);
    border: none; border-radius: 8px; font-weight: bold; cursor: pointer;
    transition: all 0.3s ease;
}

.donation-btn:hover, .donation-btn.selected {
    background: var(--golden-yellow); color: var(--vermillion); transform: scale(1.05);
}

/* User Status Display */
.user-status {
    background: rgba(255,255,255,0.1); padding: 15px; border-radius: 10px;
    margin: 15px 0; text-align: center; border: 2px solid var(--golden-yellow);
}

.usage-counters {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px; margin: 10px 0;
}

.counter {
    background: rgba(255,255,255,0.2); padding: 8px; border-radius: 5px;
    text-align: center; font-size: 0.9em; font-weight: bold;
}

/* Lucky Numbers Display */
.lucky-numbers {
    display: flex; justify-content: center; gap: 10px; margin: 20px 0; flex-wrap: wrap;
}

.lucky-number {
    width: 50px; height: 50px;
    background: linear-gradient(145deg, var(--golden-yellow), var(--golden-yellow-light));
    border: 2px solid var(--vermillion); border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 1.2em; font-weight: bold;
    color: var(--deep-red); animation: bounce 0.5s ease-in-out;
}

.number-set { margin: 15px 0; }

.number-set h4 {
    color: var(--deep-red); margin-bottom: 10px; text-align: center;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); }
}

/* Small helpers for dynamic data */
.badge { display:inline-block; padding:4px 8px; border-radius:999px; background:rgba(0,0,0,0.12); margin:3px 6px 0 0; color: var(--deep-red); border:1px solid rgba(0,0,0,0.15); }
.muted { opacity: 0.85; }
.spinner {
    display:inline-block; width:1em; height:1em; border:2px solid var(--deep-red);
    border-top-color: transparent; border-radius:50%; animation: spin 0.8s linear infinite; vertical-align:-0.2em;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* STAGE 2: Incense Container - Centralized below Deity */
.incense-container {
    position: relative;
    width: 120px;
    height: 50px;
    z-index: 10;
    margin: -10px auto 0;
}

/* STAGE 2: Incense Urn - Using actual image */
.incense-urn {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 60px;
    background-image: url('/images/incense_urn_Desktop.webp');
    background-size: contain;
    background-position: center bottom;
    background-repeat: no-repeat;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4));
}

/* Remove CSS-based urn decorations since we're using actual image */
.incense-urn::before,
.incense-urn::after {
    display: none;
}

.incense-stick {
    width: 3px;
    height: 35px;
    background: #654321;
    position: absolute;
    bottom: 35px;
    opacity: 0.6;
    transition: all 0.5s ease;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.incense-stick:nth-child(2) { left: 45px; }
.incense-stick:nth-child(3) { left: 58px; }
.incense-stick:nth-child(4) { left: 71px; }

.incense-stick.burning {
    opacity: 1;
    box-shadow: 0 -2px 8px rgba(255, 140, 0, 0.8);
}

.incense-stick.burning::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #FF4500 0%, #FF8C00 50%, #FFD700 100%);
    border-radius: 50%;
    animation: glow 1.5s ease-in-out infinite alternate;
}

.incense-stick.burning::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 40px;
    background: linear-gradient(to top, 
        rgba(200, 200, 200, 0.7) 0%,
        rgba(180, 180, 180, 0.5) 30%,
        rgba(160, 160, 160, 0.3) 60%,
        rgba(140, 140, 140, 0.1) 100%);
    border-radius: 50%;
    animation: smoke 3s ease-in-out infinite;
}

/* STAGE 2: Temple Elements Container - Centralized */
.temple-elements {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 20px auto 0;
    gap: 0;
}

/* STAGE 2: ALTAR TABLE - Centralized with correct path */
.altar-table {
    background-image: url('/images/altar-table.webp');
    background-size: contain;
    background-position: center bottom;
    background-repeat: no-repeat;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3)) 
            drop-shadow(0 0 10px var(--shadow-gold));
    mix-blend-mode: multiply;
    background-color: transparent;
    width: 600px; 
    height: 144px;
    position: relative;
    flex-shrink: 0;
    margin: 0 auto;
}

@keyframes glow {
    0% { 
        box-shadow: 0 0 5px rgba(255, 69, 0, 0.8), 0 0 10px rgba(255, 140, 0, 0.6);
        transform: translateX(-50%) scale(1);
    }
    100% { 
        box-shadow: 0 0 10px rgba(255, 69, 0, 1), 0 0 20px rgba(255, 140, 0, 0.8);
        transform: translateX(-50%) scale(1.1);
    }
}

@keyframes smoke {
    0% { 
        transform: translateX(-50%) translateY(0) rotate(0deg);
        opacity: 0.7;
        width: 2px;
    }
    25% {
        transform: translateX(-50%) translateY(-10px) rotate(2deg);
        opacity: 0.6;
        width: 3px;
    }
    50% {
        transform: translateX(-50%) translateY(-20px) rotate(-1deg);
        opacity: 0.5;
        width: 4px;
    }
    75% {
        transform: translateX(-50%) translateY(-30px) rotate(3deg);
        opacity: 0.3;
        width: 5px;
    }
    100% { 
        transform: translateX(-50%) translateY(-40px) rotate(-2deg);
        opacity: 0;
        width: 6px;
    }
}

/* ========================================
   STAGE 4: MOBILE OPTIMIZATION
   - Deity: 350px × 455px (optimal mobile size)
   - Minimal vertical scroll
   - Touch-friendly interactions (44px minimum)
   - Optimized stacking order
   ======================================== */

/* ===== MOBILE SMALL (< 480px) ===== */
@media screen and (max-width: 479px) {
    /* Main Container Optimization */
    .temple-interior {
        padding: 10px;
    }
    
    .temple-main-container { 
        padding: 10px;
        gap: 15px; /* Tighter vertical spacing */
        min-height: auto; /* Remove min-height for better mobile flow */
    }
    
    /* Layout: Column stacking with optimized spacing */
    .temple-content { 
        flex-direction: column;
        gap: 15px; /* Reduced from 20px */
        align-items: center;
        width: 100%;
        max-width: 350px; /* Match deity width */
        margin: 0 auto;
    }
    
    /* Lunar Calendar - Static at top */
    .lunar-calendar { 
        position: static;
        margin: 10px auto 15px; /* Reduced bottom margin */
        min-width: auto;
        max-width: 280px;
        width: 90%;
        height: auto; /* Allow content to dictate height */
        max-height: 300px; /* Prevent overflow */
        overflow-y: auto; /* Scroll if needed */
    }
    
    /* STAGE 4: Optimized Deity Size - 350px × 455px */
    .deity-statue { 
        width: 350px !important;
        height: 455px !important;
        margin: 0 auto 10px; /* Centered with reduced bottom margin */
        flex-shrink: 0; /* Prevent shrinking */
    }
    
    /* Temple Elements Container */
    .temple-elements { 
        max-width: 350px;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px; /* Tight spacing between altar and urn */
        margin: 0 auto;
    }
    
    /* Altar Table - Proportional to deity */
    .altar-table { 
        width: 350px !important;
        height: 84px !important; /* Proportional: 350 × 0.24 = 84px */
        background-image: url('/images/altar-table.webp');
        margin: 0 auto;
    }
    
    /* Incense Container - Below altar */
    .incense-container { 
        width: 90px; /* Slightly larger for better visibility */
        height: 50px;
        position: relative; /* Remove absolute positioning */
        margin: 0 auto; /* Center it */
        transform: none; /* Remove transform */
    }
    
    .incense-urn {
        width: 70px;
        height: 42px;
        position: relative; /* Change from absolute */
        margin: 0 auto;
        transform: none;
    }
    
    /* Buttons - Touch-friendly with 48px minimum height */
    .temple-buttons { 
        min-width: auto;
        max-width: 350px; /* Match deity width */
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 12px; /* Comfortable spacing */
        margin: 15px auto 20px; /* Top margin for separation, bottom for scroll clearance */
    }
    
    .temple-btn { 
        padding: 14px 18px !important; /* Increased for 48px minimum height */
        font-size: 0.9em !important; /* Slightly larger than before */
        gap: 10px;
        width: 100%;
        min-height: 48px; /* Touch-friendly minimum */
        display: flex;
        align-items: center;
        justify-content: center;
        /* Ensure tap targets are large enough */
        -webkit-tap-highlight-color: rgba(255, 215, 0, 0.3);
    }
    
    .temple-btn .btn-icon {
        font-size: 1.4em; /* Slightly larger icons */
    }
    
    .temple-btn .btn-english {
        font-size: 0.95em;
    }
    
    .temple-btn .btn-chinese {
        font-size: 0.8em;
    }
    
    /* Auth Box - Compact for mobile */
    .auth-box {
        top: 10px;
        right: 10px;
        padding: 10px 14px; /* Slightly larger for touch */
        min-height: 44px; /* Touch-friendly */
    }
    
    .auth-box-content {
        font-size: 0.85em;
    }
    
    /* Payment Methods - Single column for mobile */
    .payment-methods { 
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    /* Modal Optimization for Mobile */
    .modal-content {
        width: 95%;
        max-width: 350px;
        padding: 20px;
        margin: 5% auto;
    }
    
    /* Blessing Area - Full width on mobile */
    .blessing {
        max-width: 350px;
        margin: 15px auto;
        padding: 15px;
    }
}

/* ===== MOBILE LARGE (480px - 639px) ===== */
@media screen and (min-width: 480px) and (max-width: 639px) {
    .temple-main-container { 
        padding: 15px;
        gap: 20px;
    }
    
    .temple-content { 
        flex-direction: column;
        gap: 20px;
        max-width: 400px;
        margin: 0 auto;
    }
    
    /* Lunar Calendar */
    .lunar-calendar { 
        position: static;
        margin: 10px auto 20px;
        min-width: auto;
        max-width: 300px;
        width: 85%;
        height: auto;
        max-height: 320px;
    }
    
    /* Deity - Slightly larger for this breakpoint */
    .deity-statue { 
        width: 380px !important;
        height: 494px !important;
        margin: 0 auto 12px;
    }
    
    .temple-elements { 
        max-width: 380px;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .altar-table { 
        width: 380px !important;
        height: 91px !important;
        background-image: url('/images/altar-table.webp');
        margin: 0 auto;
    }
    
    .incense-container { 
        width: 95px;
        position: relative;
        margin: 0 auto;
        transform: none;
    }
    
    .incense-urn {
        width: 75px;
        height: 45px;
        position: relative;
        margin: 0 auto;
        transform: none;
    }
    
    .temple-buttons { 
        min-width: auto;
        max-width: 380px;
        width: 100%;
        gap: 14px;
        margin: 20px auto;
    }
    
    .temple-btn { 
        padding: 15px 22px !important;
        font-size: 0.95em !important;
        min-height: 50px;
        gap: 12px;
    }
    
    .temple-btn .btn-icon {
        font-size: 1.5em;
    }
    
    .payment-methods { 
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== TABLET SMALL (640px - 767px) ===== */
@media screen and (min-width: 640px) and (max-width: 767px) {
    .temple-content { 
        flex-direction: column;
        gap: 25px;
        max-width: 450px;
        margin: 0 auto;
    }
    
    .lunar-calendar { 
        position: static;
        margin: 15px auto 25px;
        min-width: auto;
        max-width: 320px;
        height: auto;
        max-height: 350px;
    }
    
    .deity-statue { 
        width: 420px !important;
        height: 546px !important;
    }
    
    .temple-elements { 
        max-width: 420px;
        gap: 12px;
    }
    
    .altar-table { 
        width: 420px !important;
        height: 101px !important;
        background-image: url('/images/altar-table.webp');
    }
    
    .incense-container { 
        width: 100px;
        position: relative;
        margin: 0 auto;
        transform: none;
    }
    
    .incense-urn {
        width: 80px;
        height: 48px;
        position: relative;
        margin: 0 auto;
        transform: none;
    }
    
    .temple-buttons { 
        min-width: auto;
        max-width: 400px;
        gap: 16px;
    }
    
    .temple-btn { 
        padding: 16px 26px !important;
        font-size: 1em !important;
        min-height: 52px;
    }
}

/* ===== TOUCH-FRIENDLY ENHANCEMENTS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Devices with touch input */
    .temple-btn {
        /* Increase touch target */
        min-height: 50px !important;
        /* Add visual feedback on tap */
        transition: transform 0.1s ease, box-shadow 0.1s ease;
    }
    
    .temple-btn:active {
        transform: scale(0.98);
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    }
    
    /* Ensure all clickable elements are touch-friendly */
    .auth-box {
        min-height: 48px;
        padding: 12px 16px;
    }
    
    /* Modal buttons */
    .modal-content button {
        min-height: 48px;
        padding: 12px 20px;
    }
    
    /* Donation buttons */
    .donation-btn,
    .payment-btn {
        min-height: 48px;
        padding: 14px 18px;
    }
}

/* ===== LANDSCAPE MOBILE OPTIMIZATION ===== */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .temple-main-container { 
        min-height: auto;
        padding: 10px;
    }
    
    .temple-content {
        flex-direction: row;
        gap: 20px;
        align-items: flex-start;
    }
    
    .deity-statue { 
        width: 320px !important;
        height: 220px !important; /* Reduced for landscape */
    }
    
    .temple-elements { 
        max-width: 320px;
    }
    
    .altar-table { 
        width: 320px !important;
        height: 77px !important;
    }
    
    .incense-urn {
        width: 65px;
        height: 39px;
    }
    
    .lunar-calendar { 
        position: static;
        margin: 10px auto;
        max-width: 250px;
        height: auto;
        max-height: 250px;
    }
    
    .temple-buttons {
        max-width: 280px;
        gap: 10px;
    }
    
    .temple-btn {
        padding: 10px 16px !important;
        font-size: 0.85em !important;
        min-height: 44px;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
@media screen and (max-width: 767px) {
    /* Reduce animation complexity on mobile */
    body::before {
        animation: none; /* Disable background animation */
        opacity: 0.4;
    }
    
    /* Optimize shadows for mobile */
    .deity-statue {
        box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    }
    
    .temple-btn {
        box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
    }
    
    /* Prevent zoom on input focus */
    input,
    select,
    textarea {
        font-size: 16px !important; /* Prevents iOS zoom */
    }
}

/* ===== AUTO-DETECT: REDUCED WINDOWS ===== */
body.screen-reduced:not(.screen-mobile) .temple-content {
    flex-direction: column !important;
    gap: 25px !important;
    max-width: 400px !important;
    margin: 0 auto !important;
}

body.screen-reduced:not(.screen-mobile) .lunar-calendar {
    position: static !important;
    margin: 15px auto 25px !important;
    max-width: 320px !important;
}

body.screen-reduced:not(.screen-mobile) .temple-buttons {
    min-width: auto !important;
    max-width: 380px !important;
}

body.screen-reduced:not(.screen-mobile) .deity-statue {
    width: 380px !important;
    height: 494px !important;
}

body.screen-reduced:not(.screen-mobile) .altar-table {
    width: 380px !important;
    height: 91px !important;
}

/* ===== END OF STAGE 4 MOBILE OPTIMIZATION ===== */

/* ===== DESKTOP REDUCED (1080px breakpoint) ===== */
@media screen and (max-width: 1080px) {
    body.screen-reduced:not(.screen-mobile) .temple-content {
        flex-direction: column !important;
        gap: 25px !important;
        max-width: 450px !important;
        margin: 0 auto !important;
    }
    
    body.screen-reduced:not(.screen-mobile) .lunar-calendar {
        position: static !important;
        margin: 15px auto 25px !important;
        max-width: 320px !important;
    }
    
    body.screen-reduced:not(.screen-mobile) .temple-buttons {
        min-width: auto !important;
        max-width: 400px !important;
    }
}
