:root {
    --gold: #d4af37;
    --dark-bg: #050505;
    --text-glow: 0 0 15px rgba(212, 175, 55, 0.8), 0 0 30px rgba(212, 175, 55, 0.4);
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--dark-bg);
    font-family: 'Cinzel', serif;
    color: var(--gold);
    user-select: none;
}

#bg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    background: #000;
}

.overlay,
#ui-container,
#transition-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

#ui-container {
    pointer-events: auto;
    flex-direction: column;
}

.loading-content {
    text-align: center;
    z-index: 20;
}

.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Base fade transition class */
.fade-transition {
    transition: opacity 2s ease-in-out;
}

.gothic-text {
    font-size: 3rem;
    text-shadow: var(--text-glow);
    text-align: center;
    letter-spacing: 3px;
    margin: 10px 0;
}

.progress-text {
    font-size: 2rem;
}

/* Environmental Effects */
.floor-fog {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(to top, rgba(15, 10, 5, 0.4) 0%, transparent 100%);
    pointer-events: none;
    z-index: 15;
    animation: fogDrift 15s infinite alternate ease-in-out;
}

@keyframes fogDrift {
    0% {
        transform: translateX(-2%) scaleY(1);
        opacity: 0.3;
    }

    100% {
        transform: translateX(2%) scaleY(1.1);
        opacity: 0.6;
    }
}

#particles-container {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 18;
    overflow: hidden;
}

.dust-particle {
    position: absolute;
    background: rgba(255, 230, 200, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(255, 230, 200, 0.8);
    pointer-events: none;
}

.fog {
    position: absolute;
    width: 100%;
    height: 100%;
    /* Background removed so the animated canvas handles the display */
    z-index: 5;
    mix-blend-mode: screen;
    animation: pulseFog 8s infinite alternate ease-in-out;
}

@keyframes pulseFog {
    0% {
        opacity: 0.1;
        transform: scale(1);
    }

    100% {
        opacity: 0.2;
        transform: scale(1.02);
    }
}

.vignette {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.95) 100%);
    pointer-events: none;
    z-index: 10;
}

#transition-overlay {
    background: #000;
    z-index: 100;
    opacity: 1;
    /* Start black if needed, or controlled by JS */
}

/* Interactive Zones */
#interactive-zones {
    position: absolute;
    /* Top and left are managed by JS to exactly match the canvas image */
    z-index: 25;
    pointer-events: none;
    /* SVG itself doesn't block clicks */
}

.interactive-zone {
    pointer-events: auto;
    /* Auto safely captures clicks on painted elements */
    cursor: pointer;
    /* Ensure they are fully invisible per request */
    fill: rgba(0, 0, 0, 0.01);
    /* 1% opacity trick to ensure paint exists for hit testing */
    stroke: transparent;
    outline: none;
    transition: none;
}

.interactive-zone:hover {
    fill: rgba(0, 0, 0, 0.01);
    stroke: transparent;
    outline: none;
}

/* Click Animation Class */
.active-sparkle {
    pointer-events: none;
    animation: clickSparkle 0.8s ease-out forwards;
}

@keyframes clickSparkle {
    0% {
        fill: rgba(212, 175, 55, 0);
        stroke: rgba(212, 175, 55, 0.8);
        stroke-width: 2px;
        filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.8));
    }

    50% {
        fill: rgba(212, 175, 55, 0.4);
        stroke: rgba(255, 230, 150, 1);
        stroke-width: 4px;
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 1)) drop-shadow(0 0 40px rgba(255, 215, 0, 0.6));
    }

    100% {
        fill: rgba(212, 175, 55, 0);
        stroke: rgba(212, 175, 55, 0);
        stroke-width: 0px;
        filter: drop-shadow(0 0 0px rgba(212, 175, 55, 0));
    }
}

/* --- Popup Structure --- */
.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 5, 0.85);
    /* Matches original page backgrounds */
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.popup-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.popup-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem;
    max-width: 900px;
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.15);
    border-radius: 8px;
    transform: translateY(30px);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.popup-overlay.active .popup-container {
    transform: translateY(0);
}

.popup-content {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.popup-content.active {
    display: flex;
}

.popup-text {
    font-size: 1.5rem;
    max-width: 800px;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* About Us specific styling */
.about-text {
    text-align: left;
    white-space: pre-wrap;
    min-height: 120px;
    /* Leave space for typing */
}

.about-cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: var(--gold);
    vertical-align: middle;
    animation: blink 1s step-end infinite;
    margin-left: 4px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.close-btn {
    margin-top: 1.5rem;
    padding: 10px 20px;
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold);
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.close-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    box-shadow: var(--text-glow);
}

/* Hyperlink specific styling */
.gold-link {
    color: var(--gold);
    text-decoration: none;
    border-bottom: 1px dotted var(--gold);
    transition: all 0.3s ease;
}

.gold-link:hover {
    color: #fff;
    border-bottom: 1px solid #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* --- Form Styles --- */
.covenant-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.covenant-form .form-group {
    width: 100%;
    margin-bottom: 15px;
}

.covenant-form input,
.covenant-form textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: var(--gold);
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.covenant-form input:focus,
.covenant-form textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
    background: rgba(0, 0, 0, 0.8);
}

.covenant-form input::placeholder,
.covenant-form textarea::placeholder {
    color: rgba(212, 175, 55, 0.5);
}

.covenant-form textarea {
    resize: none;
}

.submit-btn {
    padding: 12px 24px;
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold);
    border: 1px solid var(--gold);
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
    letter-spacing: 1px;
    margin-top: 10px;
    border-radius: 4px;
}

.submit-btn:hover {
    background: rgba(212, 175, 55, 0.25);
    box-shadow: var(--text-glow);
    transform: translateY(-2px);
}