@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,700;1,400&display=swap');

body {
    background-color: #050505;
    background-image: radial-gradient(circle at center, #1a1a1d 0%, #000000 100%);
    color: #dcdcdc;
    font-family: 'EB Garamond', serif;
    min-height: 100vh;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden; 
}

/* --- THE SURPRISE GUEST (Devil/Jack-in-the-box) --- */
#surprise-guest {
    position: fixed;
    bottom: -100%; /* Hidden off-bottom */
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    z-index: 50;
    pointer-events: none;
}

/* Triggered by JS - A 6-second grand entrance and exit */
.run-theatre {
    animation: theatre-sequence 10s forwards ease-in-out;
}

@keyframes theatre-sequence {
    0% { bottom: -100%; opacity: 1; filter: blur(0); }
    /* Rise: Takes 2 seconds */
    33% { bottom: 0px; opacity: 1; filter: blur(0); transform: translateX(-50%) scale(1); }
    /* Hold: Stays for 6 seconds */
    66% { bottom: 0px; opacity: 1; filter: blur(0); transform: translateX(-50%) scale(1); }
    /* Smoke: Takes 2 seconds to dissipate */
    100% { 
        bottom: 150px; 
        opacity: 0; 
        filter: blur(50px); 
        transform: translateX(-50%) scale(2); 
    }
}

/* --- THE BISHOP (Heavenly Chariot) --- */
#heavenly-chariot {
    position: absolute;
    top: 30%; /* Positioned above the text box */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px; /* Force Huge Size */
    z-index: 100;
    pointer-events: none;
}

.hidden { display: none !important; }

.chariot-active {
    display: block !important;
    animation: hoverInPlace 4s ease-in-out infinite;
}

@keyframes hoverInPlace {
    0%   { transform: translate(-50%, -50%) translateY(0px); }
    50%  { transform: translate(-50%, -50%) translateY(-25px); }
    100% { transform: translate(-50%, -50%) translateY(0px); }
}

#bishop-rig { position: relative; width: 100%; }
#bishop-body { width: 100%; display: block; position: relative; z-index: 1; }
#bishop-jaw {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 2;
    transform-origin: center top; 
    transition: transform 0.1s ease-out; 
}

/* --- THE UI --- */
.container {
    background: rgba(10, 10, 10, 0.85);
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 1);
    max-width: 550px;
    width: 90%;
    border: 1px solid #444;
    position: relative;
    z-index: 10; 
}

h1 { font-size: 2.8rem; margin-bottom: 0.5rem; color: #f0e68c; text-shadow: 2px 2px 4px #000; }
.subtitle { font-style: italic; color: #888; margin-bottom: 2rem; }

textarea {
    width: 100%;
    height: 120px;
    background-color: #000;
    border: 1px solid #555;
    color: #fff;
    padding: 1rem;
    font-family: 'EB Garamond', serif;
    font-size: 1.2rem;
    border-radius: 5px;
    resize: none;
    box-sizing: border-box; 
    margin-bottom: 1.5rem;
}

button {
    background: #1a1a1a;
    color: #f0e68c;
    border: 1px solid #f0e68c;
    padding: 12px 40px;
    font-size: 1.1rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 3px;
}

button:hover { background: #f0e68c; color: #000; }
button:disabled { opacity: 0.3; cursor: not-allowed; }

.result-box {
    margin-top: 2rem;
    font-size: 1.4rem;
    color: #eee;
    min-height: 60px;
}

/* =========================================
   NEW: THE CENSER & SMOKE INTEGRATION 
   ========================================= */

#censer-anchor {
    position: absolute;
    bottom: -10px;  /* Resting neatly on the bottom edge */
    left: -20px;    /* Tucked behind the left wall */
    z-index: 35;    /* Above background, below Devil */
    pointer-events: none; 
    transform: scale(0.65); 
    transform-origin: bottom left;
}

#stage-box {
    width: 1000px; 
    height: 810px;
    overflow: hidden;
    position: relative;
    background: transparent !important; 
    border: none !important;            
    box-shadow: none !important;        
}

#scene {
    position: absolute;
    width: 686px;
    height: 708px;
    left: -40px; 
    top: 20px;
}

#arm-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 686px;
    height: 708px;
    transform-origin: 10% 40%; 
    animation: armSwing 3.5s ease-in-out infinite alternate;
}

#censer-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 686px;
    height: 708px;
    transform-origin: 83.1% 9.9%; 
    animation: censerSwing 3.0s ease-in-out infinite alternate;
    animation-delay: -0.4s;
}

#scene img {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

@keyframes armSwing {
    from { transform: rotate(-5deg); }
    to { transform: rotate(10deg); }
}

@keyframes censerSwing {
    from { transform: rotate(-35deg); }
    to { transform: rotate(45deg); }
}

/* THE SMOKE LAYER */
#smoke-layer {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 40; 
    pointer-events: none;
}

.smoke {
    position: absolute;
    /* Moody, dim smoke to match the Vox Pecatis stone */
    background: rgba(180, 180, 180, 0.3);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    filter: blur(8px);
    pointer-events: none;
    animation: rise 3s forwards ease-out;
    will-change: transform, opacity; 
}

@keyframes rise {
    0% { transform: translateY(0) scale(1) rotate(0deg); opacity: 0; }
    15% { opacity: 0.8; }
    100% { transform: translateY(-250px) scale(6) rotate(180deg); opacity: 0; }
}