/* Séance Room Styles */

/* Séance Room Container */
#seance-container {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.seance-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.summon-button-wrapper {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.summon-button {
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.summon-button img {
    max-width: 250px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(130, 255, 240, 0.6));
}

.summon-button:hover img {
    transform: scale(1.1);
    filter: drop-shadow(0 0 30px rgba(130, 255, 240, 0.9));
}

/* Summoning State */
#summoning-container {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.summoning-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Ghost Encounter State */
#ghost-encounter-container {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.ghost-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.ghost-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    animation: ghostFloat 4s ease-in-out infinite;
    filter: drop-shadow(0 0 30px var(--ghost-color, #82FFF0));
}

.ghost-overlay img {
    max-width: 400px;
    height: auto;
    opacity: 0.9;
}

@keyframes ghostFloat {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0px);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-20px);
    }
}

/* Ghost Info Panel */
.ghost-info-panel {
    position: absolute;
    top: 5%;
    right: 5%;
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid var(--ghost-color, #82FFF0);
    border-radius: 10px;
    padding: 1.5rem;
    max-width: 350px;
    z-index: 10;
    box-shadow: 0 0 40px var(--ghost-color, #82FFF0);
    animation: fadeInPanel 1s ease-out;
}

@keyframes fadeInPanel {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ghost-name {
    font-family: var(--font-scary);
    font-size: 1.8rem;
    color: var(--ghost-color, #82FFF0);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px var(--ghost-color, #82FFF0);
}

.ghost-probability {
    font-family: var(--font-scary);
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.ghost-probability .rarity {
    color: var(--ghost-color, #82FFF0);
    font-weight: bold;
}

.danger-level {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-family: var(--font-scary);
}

.danger-label {
    color: var(--text-color);
    font-size: 0.9rem;
}

.danger-value {
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 0 10px currentColor;
}

.danger-bars {
    display: flex;
    gap: 3px;
    flex: 1;
}

.danger-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.danger-bar.filled {
    background: var(--danger-color, #F44336);
    box-shadow: 0 0 5px var(--danger-color, #F44336);
}

/* Ghost Dialogue Box */
.ghost-dialogue {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid var(--ghost-color, #82FFF0);
    border-radius: 15px;
    padding: 2rem;
    max-width: 700px;
    width: 90%;
    z-index: 10;
    box-shadow: 0 0 50px var(--ghost-color, #82FFF0);
    animation: fadeInDialogue 1.5s ease-out;
}

@keyframes fadeInDialogue {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.ghost-greeting {
    font-family: var(--font-scary);
    font-size: 1.5rem;
    color: var(--ghost-color, #82FFF0);
    text-align: center;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 15px var(--ghost-color, #82FFF0);
    letter-spacing: 2px;
    animation: textGlitch 3s ease-in-out infinite;
}

@keyframes textGlitch {
    0%, 90%, 100% {
        opacity: 1;
    }
    93%, 97% {
        opacity: 0.7;
    }
}

.history-prompt {
    font-family: var(--font-scary);
    font-size: 1.2rem;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 1rem;
    animation: pulseText 2s ease-in-out infinite;
}

@keyframes pulseText {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

.history-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.history-button {
    background: var(--ghost-color, #82FFF0);
    color: #000;
    border: none;
    padding: 0.75rem 2rem;
    font-family: var(--font-scary);
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px var(--ghost-color, #82FFF0);
}

.history-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--ghost-color, #82FFF0);
}

.history-button.decline {
    background: var(--scary-color);
    color: var(--text-color);
}

/* Ghost History Display */
.ghost-history-text {
    font-family: var(--font-scary);
    font-size: 1.2rem;
    color: var(--ghost-color, #82FFF0);
    line-height: 1.8;
    text-align: center;
    margin-bottom: 1.5rem;
    animation: fadeIn 2s ease-out, textShimmer 3s ease-in-out infinite;
    text-shadow: 0 0 10px var(--ghost-color, #82FFF0),
                 0 0 20px rgba(130, 255, 240, 0.5);
    letter-spacing: 1px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes textShimmer {
    0%, 100% {
        text-shadow: 0 0 10px var(--ghost-color, #82FFF0),
                     0 0 20px rgba(130, 255, 240, 0.5);
    }
    50% {
        text-shadow: 0 0 20px var(--ghost-color, #82FFF0),
                     0 0 40px rgba(130, 255, 240, 0.8),
                     0 0 60px rgba(130, 255, 240, 0.4);
    }
}

.close-encounter-button {
    background: var(--scary-color);
    color: var(--text-color);
    border: 2px solid var(--ghost-color, #82FFF0);
    padding: 0.75rem 2rem;
    font-family: var(--font-scary);
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
}

.close-encounter-button:hover {
    background: var(--ghost-color, #82FFF0);
    color: #000;
    box-shadow: 0 0 20px var(--ghost-color, #82FFF0);
}

/* Screen Effects */
.vignette-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.8) 100%);
    opacity: 0;
    transition: opacity 2s ease;
}

.vignette-effect.active {
    opacity: 1;
}

.blur-effect {
    filter: blur(0px);
    transition: filter 2s ease;
}

.blur-effect.active {
    filter: blur(5px);
}

/* Idle Warning Effects */
.ghost-whispers {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-scary);
    font-size: 2rem;
    color: var(--scary-color);
    text-align: center;
    z-index: 200;
    text-shadow: 0 0 20px rgba(139, 0, 0, 0.8);
    animation: whisperPulse 2s ease-in-out infinite;
    opacity: 0;
}

.ghost-whispers.active {
    opacity: 1;
}

@keyframes whisperPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
}

/* Danger Level Effects */
#ghost-encounter-container.danger-high {
    animation: screenShake 0.5s ease-in-out infinite;
}

#ghost-encounter-container.danger-extreme {
    animation: screenShake 0.3s ease-in-out infinite, colorDistort 2s ease-in-out infinite;
}

/* Black Vignette Effects Based on Danger Level */
#ghost-encounter-container.vignette-low::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 50%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
    z-index: 3;
}

#ghost-encounter-container.vignette-medium::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.5) 100%);
    pointer-events: none;
    z-index: 3;
    animation: vignettePulse 3s ease-in-out infinite;
}

#ghost-encounter-container.vignette-high::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.7) 100%);
    pointer-events: none;
    z-index: 3;
    animation: vignettePulse 2s ease-in-out infinite;
}

#ghost-encounter-container.vignette-extreme::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 20%, rgba(0, 0, 0, 0.85) 100%);
    pointer-events: none;
    z-index: 3;
    animation: vignettePulse 1.5s ease-in-out infinite, vignetteFlicker 0.5s ease-in-out infinite;
}

@keyframes vignetteFlicker {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.9;
    }
}

@keyframes screenShake {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(-2px, 2px);
    }
    50% {
        transform: translate(2px, -2px);
    }
    75% {
        transform: translate(-2px, -2px);
    }
}

@keyframes colorDistort {
    0%, 100% {
        filter: hue-rotate(0deg);
    }
    50% {
        filter: hue-rotate(30deg) saturate(1.5);
    }
}

/* Enhanced vignette for high danger */
#ghost-encounter-container.danger-high::before,
#ghost-encounter-container.danger-extreme::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 20%, rgba(139, 0, 0, 0.6) 100%);
    z-index: 2;
    pointer-events: none;
    animation: vignettePulse 2s ease-in-out infinite;
}

@keyframes vignettePulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.9;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .ghost-overlay img {
        max-width: 250px;
    }
    
    .ghost-info-panel {
        max-width: 90%;
        top: 2%;
        right: 2%;
        padding: 1rem;
    }
    
    .ghost-name {
        font-size: 1.3rem;
    }
    
    .ghost-dialogue {
        padding: 1.5rem;
        max-width: 90%;
    }
    
    .ghost-greeting {
        font-size: 1.2rem;
    }
    
    .history-prompt {
        font-size: 1rem;
    }
    
    .summon-button img {
        max-width: 180px;
    }
}

@media (max-width: 480px) {
    .ghost-overlay img {
        max-width: 180px;
    }
    
    .ghost-info-panel {
        padding: 0.75rem;
    }
    
    .ghost-name {
        font-size: 1.1rem;
    }
    
    .ghost-dialogue {
        padding: 1rem;
    }
    
    .ghost-greeting {
        font-size: 1rem;
    }
    
    .ghost-whispers {
        font-size: 1.5rem;
    }
}


/* Transition Effect After Summoning */
.transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.transition-overlay.active {
    opacity: 1;
    pointer-events: all;
    animation: blackFlash 2s ease-in-out;
}

/* Black screen flash - 1 second full black, then fade */
@keyframes blackFlash {
    0% {
        opacity: 0;
    }
    25% {
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 1;
    }
}

.transition-content {
    text-align: center;
    filter: blur(2px);
    animation: blurPulse 1s ease-in-out infinite;
}

@keyframes blurPulse {
    0%, 100% {
        filter: blur(2px);
        opacity: 0.6;
    }
    50% {
        filter: blur(5px);
        opacity: 1;
    }
}

.transition-text {
    font-family: var(--font-scary);
    font-size: 2.5rem;
    color: var(--scary-color);
    text-shadow: 0 0 20px rgba(139, 0, 0, 1),
                 0 0 40px rgba(139, 0, 0, 0.8),
                 0 0 60px rgba(139, 0, 0, 0.6);
    letter-spacing: 3px;
    animation: textFlicker 0.3s ease-in-out infinite;
}

@keyframes textFlicker {
    0%, 100% {
        opacity: 1;
    }
    25% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
    75% {
        opacity: 0.5;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .transition-text {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .transition-text {
        font-size: 1.3rem;
    }
}


/* Séance Room Timeout Effect - Glitch + Black Corners + Shake */
#seance-container.timeout-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.95) 100%);
    z-index: 100;
    animation: blackCorners 8s ease-in forwards;
    pointer-events: none;
}

@keyframes blackCorners {
    0% {
        background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0) 100%);
    }
    100% {
        background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.95) 100%);
    }
}

/* Glitch effect on the container */
#seance-container.timeout-active {
    animation: glitchShake 0.3s ease-in-out infinite, screenGlitch 0.5s ease-in-out infinite;
}

@keyframes glitchShake {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(-3px, 3px);
    }
    50% {
        transform: translate(3px, -3px);
    }
    75% {
        transform: translate(-3px, -3px);
    }
}

@keyframes screenGlitch {
    0%, 100% {
        filter: none;
    }
    10% {
        filter: hue-rotate(90deg) saturate(3);
    }
    20% {
        filter: hue-rotate(180deg) saturate(2);
    }
    30% {
        filter: none;
    }
    40% {
        filter: invert(1);
    }
    50% {
        filter: none;
    }
    60% {
        filter: hue-rotate(270deg) saturate(4);
    }
    70% {
        filter: none;
    }
}


/* Red Corner Vignette - When declining ghost history */
.red-vignette-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 150;
    background: radial-gradient(circle, transparent 40%, rgba(139, 0, 0, 0.7) 100%);
    opacity: 0;
    transition: opacity 1s ease;
}

.red-vignette-effect.active {
    opacity: 1;
    animation: redPulse 2s ease-in-out infinite;
}

@keyframes redPulse {
    0%, 100% {
        background: radial-gradient(circle, transparent 40%, rgba(139, 0, 0, 0.7) 100%);
    }
    50% {
        background: radial-gradient(circle, transparent 40%, rgba(139, 0, 0, 0.9) 100%);
    }
}


/* Distorted Text Overlay - After 2 loops in séance room */
.distorted-text-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.distorted-text-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.distorted-text-content {
    width: 90%;
    max-width: 1200px;
    text-align: center;
    font-family: var(--font-scary);
    font-size: 2rem;
    color: var(--scary-color);
    text-shadow: 0 0 20px rgba(139, 0, 0, 1);
    line-height: 1.8;
    animation: distortText 0.3s ease-in-out infinite;
}

@keyframes distortText {
    0%, 100% {
        transform: scale(1) skew(0deg);
        filter: blur(0px);
    }
    25% {
        transform: scale(1.05) skew(2deg);
        filter: blur(1px);
    }
    50% {
        transform: scale(0.95) skew(-2deg);
        filter: blur(2px);
    }
    75% {
        transform: scale(1.02) skew(1deg);
        filter: blur(1px);
    }
}

.distorted-text-content span {
    display: inline-block;
    animation: letterGlitch 0.5s ease-in-out infinite;
    animation-delay: calc(var(--letter-index) * 0.05s);
}

@keyframes letterGlitch {
    0%, 90%, 100% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    30% {
        opacity: 0.5;
        transform: translateY(-5px) rotate(5deg);
    }
    60% {
        opacity: 0.8;
        transform: translateY(5px) rotate(-5deg);
    }
}

/* Static Overlay - When declining ghost */
.static-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.static-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.static-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.03) 4px);
    animation: staticNoise 0.1s steps(10) infinite;
    opacity: 0.5;
}

@keyframes staticNoise {
    0% {
        transform: translate(0, 0);
    }
    10% {
        transform: translate(-5%, -5%);
    }
    20% {
        transform: translate(-10%, 5%);
    }
    30% {
        transform: translate(5%, -10%);
    }
    40% {
        transform: translate(-5%, 15%);
    }
    50% {
        transform: translate(-10%, 5%);
    }
    60% {
        transform: translate(15%, 0);
    }
    70% {
        transform: translate(0, 10%);
    }
    80% {
        transform: translate(-15%, 0);
    }
    90% {
        transform: translate(10%, 5%);
    }
    100% {
        transform: translate(5%, 0);
    }
}

.static-content {
    width: 90%;
    max-width: 1200px;
    text-align: center;
    font-family: var(--font-scary);
    font-size: 2.5rem;
    color: var(--scary-color);
    text-shadow: 0 0 30px rgba(139, 0, 0, 1),
                 0 0 60px rgba(139, 0, 0, 0.8);
    line-height: 1.6;
    animation: creepyTextPulse 1s ease-in-out infinite;
    z-index: 1;
}

@keyframes creepyTextPulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.static-content span {
    display: inline-block;
    animation: creepyLetterShake 0.3s ease-in-out infinite;
    animation-delay: calc(var(--letter-index) * 0.03s);
}

@keyframes creepyLetterShake {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(-2px, 2px) rotate(2deg);
    }
    50% {
        transform: translate(2px, -2px) rotate(-2deg);
    }
    75% {
        transform: translate(-2px, -2px) rotate(1deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .distorted-text-content {
        font-size: 1.5rem;
    }
    
    .static-content {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .distorted-text-content {
        font-size: 1.2rem;
    }
    
    .static-content {
        font-size: 1.4rem;
    }
}


/* Blue back button in séance room */
#back-from-seance-btn {
    background: #1e90ff;
    color: white;
    border: 2px solid #4169e1;
    box-shadow: 0 0 20px rgba(30, 144, 255, 0.6);
    transition: all 0.3s ease;
}

#back-from-seance-btn:hover {
    background: #4169e1;
    box-shadow: 0 0 30px rgba(30, 144, 255, 0.9);
    transform: scale(1.1);
}
