:root {
    --gold: #d4af37;
    --gold-bright: #fff0be;
    --gold-dim: #7a5e2c;
    --void: #020205;
    --glass: rgba(12, 12, 18, 0.9);
    --glass-accent: rgba(212, 175, 55, 0.15);
    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
    --font-lore: 'MedievalSharp', cursive;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    background: var(--void);
    color: #e2e2e8;
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
}

#astral-void {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 2000px;
}

/* --- ATMOSPHERIC VOID --- */
.library-bg,
.nebula-bg,
.floating-motes,
.floating-runes,
.stars-vortex {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* ESSENTIAL: Ensures clicks pass to shards */
}

.library-bg {
    background-image: url('library_bg.png');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    filter: blur(4px) brightness(0.7);
    z-index: 0;
}

.nebula-bg {
    background:
        radial-gradient(circle at 20% 30%, rgba(153, 69, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(20, 241, 149, 0.05) 0%, transparent 40%);
    animation: nebulaMove 30s infinite alternate linear;
    z-index: 1;
    width: 200%;
    /* Keep 200% for the move animation */
    height: 200%;
}

@keyframes nebulaMove {
    from {
        transform: translate(-10%, -10%);
    }

    to {
        transform: translate(0%, 0%);
    }
}

.floating-motes {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><circle cx="10%" cy="10%" r="1" fill="white" opacity="0.4"/><circle cx="50%" cy="40%" r="1.5" fill="white" opacity="0.6"/><circle cx="80%" cy="20%" r="1" fill="white" opacity="0.3"/></svg>');
    animation: motesFloat 20s infinite linear;
    pointer-events: none;
    /* Clear for clicking */
}

@keyframes motesFloat {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-100px);
    }
}

.floating-runes {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 100 100"><text x="10" y="30" fill="%23d4af37" font-family="serif" font-size="8" opacity="0.1">ᚠ</text><text x="70" y="20" fill="%23d4af37" font-family="serif" font-size="8" opacity="0.05">ᚢ</text><text x="40" y="80" fill="%23d4af37" font-family="serif" font-size="8" opacity="0.08">ᚦ</text><text x="80" y="60" fill="%23d4af37" font-family="serif" font-size="8" opacity="0.04">ᚨ</text></svg>');
    opacity: 0.8;
    animation: runesDrift 60s infinite linear;
    pointer-events: none;
    z-index: 1;
}

@keyframes runesDrift {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 200px 400px;
    }
}

/* GLOBAL DECORATIVE FRAME */
/* GLOBAL ARCHITECTURAL FRAME */
/* GLOBAL ARCHITECTURAL FRAME */
/* Hidden by default as it can obstruct UI on smaller screens */
.global-frame {
    display: none;
    /* 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    border: 60px solid transparent;
    border-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M0 0 L100 0 L100 100 L0 100 Z" fill="none" stroke="rgba(212,175,55,0.3)" stroke-width="2"/><path d="M0 0 L40 0 L40 6 L6 6 L6 40 L0 40 Z" fill="%23d4af37"/><path d="M60 0 L100 0 L100 40 L94 40 L94 6 L60 6 Z" fill="%23d4af37"/><path d="M0 60 L0 100 L40 100 L40 94 L6 94 L6 60 Z" fill="%23d4af37"/><path d="M100 60 L100 100 L60 100 L60 94 L94 94 L94 60 Z" fill="%23d4af37"/></svg>') 60 stretch;
    */
}

.frame-top,
.frame-bottom {
    display: none;
    /* Removed the wiggly lines */
}


/* HUD */
.social-dock {
    position: absolute;
    top: 30px;
    right: 40px;
    z-index: 3000;
    display: flex;
    gap: 20px;
}

.social-icon {
    width: 24px;
    height: 24px;
    color: var(--gold-dim);
    transition: all 0.3s ease;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-icon:hover {
    color: var(--gold);
    transform: translateY(-2px) scale(1.1);
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
}

.social-icon svg {
    width: 100%;
    height: 100%;
}

@media (max-width: 768px) {
    .social-dock {
        top: 20px;
        right: 20px;
        gap: 15px;
    }
}

#chronos-nav {
    position: absolute;
    top: 5vh;
    /* Responsive top margin */
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1010;
    pointer-events: none;
}

.nav-label {
    font-size: 0.6rem;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.7;
    margin-bottom: 2px;
}

#pagination-display {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* SHARD CONTAINERS (The "Meat") */
.glass-shard {
    background: var(--glass);
    backdrop-filter: blur(35px);
    border-radius: 0;

    /* RESPONSIVE DIMENSIONS */
    width: 65vh;
    /* Scales with height */
    max-width: 600px;
    /* Cap at original size */
    height: 75vh;
    /* Fit within screen with margin */
    /* Ensure it doesn't get too small or too big */
    min-height: 400px;
    min-width: 300px;

    border: 1px solid var(--gold);
    box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.1);
    transition: transform 1s cubic-bezier(0.19, 1, 0.22, 1),
        opacity 1s,
        filter 1s;
    pointer-events: auto !important;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;

    /* DEFAULT STATE: Hidden/Past-like */
    transform: scale(0.65) translateZ(-400px) rotateY(15deg);
    opacity: 0.2;
    filter: brightness(0.2) blur(3px);
}

.no-transition {
    transition: none !important;
}

.shard-frame {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 2px solid var(--gold-dim);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

.shard-content {
    position: relative;
    z-index: 2;
    padding: 40px 30px;
    /* Reduced padding */
    height: 100%;
    display: flex;
    flex-direction: column;
    font-family: var(--font-body);
}

.lore-scroll {
    flex: 1;
    /* Take remaining space */
    overflow-y: auto;
    /* Scrollable */
    min-height: 0;
    /* Important for flex child scrolling */
    margin-bottom: 10px;
    padding-right: 5px;
    overscroll-behavior: contain;
    /* Prevents body scroll chaining */
    pointer-events: auto;
    /* Ensure it captures mouse events */
    position: relative;
    z-index: 10;
    scroll-behavior: smooth;
    /* Native smooth scroll for API calls */
}

.shard-content h1 {
    font-family: var(--font-heading) !important;
    text-transform: uppercase;
}

/* Ornate Corners (Complex Elven/Gothic) */
.shard-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    /* Slightly smaller for responsive */
    height: 60px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80"><path d="M0 0 L80 0 L80 4 L4 4 L4 80 L0 80 Z" fill="%23d4af37"/><path d="M8 8 L40 8 L40 10 L10 10 L10 40 L8 40 Z" fill="%237a5e2c"/></svg>');
    z-index: 5;
    background-size: cover;
    pointer-events: none;
    /* Don't block clicks */
}

.shard-frame::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" transform="rotate(180 40 40)"><path d="M0 0 L80 0 L80 4 L4 4 L4 80 L0 80 Z" fill="%23d4af37"/><path d="M8 8 L40 8 L40 10 L10 10 L10 40 L8 40 Z" fill="%237a5e2c"/></svg>');
    z-index: 5;
    background-size: cover;
    pointer-events: none;
    /* Don't block clicks */
}

.shard-reflection {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: skewX(-20deg);
    animation: reflect 10s infinite;
    pointer-events: none;
}

@keyframes reflect {
    0% {
        left: -100%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

/* ASTRAL CAROUSEL 5.0 (Continuous Track System) */
#narrative-interface {
    width: 100vw;
    height: 100vh;
    position: relative;
    perspective: 2500px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#shard-track {
    display: flex;
    gap: 5vh;
    /* Relative gap */
    align-items: center;
    transition: transform 1s cubic-bezier(0.19, 1, 0.22, 1);
    transform-style: preserve-3d;
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center;
    will-change: transform;

    /* Dynamic Centering + Parallax + Vertical centering correction */
    transform: translate(var(--tx, 0), -50%) rotateY(var(--mx, 0deg)) rotateX(var(--my, 0deg));
}

/* MORPHING STATES */
.glass-shard.active {
    transform: scale(1) translateZ(200px) rotateY(0deg);
    opacity: 1;
    filter: brightness(1) blur(0);
    z-index: 100;
    box-shadow: 0 50px 150px rgba(0, 0, 0, 0.8);
    pointer-events: auto;
    /* Explicitly enable events */
}

/* Future Shards (Anything after .active) */
.glass-shard.active~.glass-shard {
    transform: scale(0.65) translateZ(-400px) rotateY(-15deg);
    opacity: 0.8;
    filter: brightness(0.4) blur(1px);
    cursor: pointer;
}

/* Past Shards (Anything before .active) */
/* CSS :has is now widely supported in modern browsers */
.glass-shard:has(~ .active) {
    transform: scale(0.65) translateZ(-400px) rotateY(15deg);
    opacity: 0.8;
    filter: brightness(0.4) blur(1px);
    cursor: pointer;
}

/* Ensure children don't block navigation clicks on side shards */
.glass-shard:not(.active) {
    cursor: pointer !important;
    z-index: 10;
    /* Ensure they have a stacking context */
}

/* Hover effects for side shards */
.glass-shard:not(.active):hover {
    opacity: 0.9;
    filter: brightness(0.8) blur(0);
    transform: scale(0.68) translateZ(-80px) rotateY(inherit);
    border-color: var(--gold-bright);
    z-index: 101;
    /* Pop above active when trying to click */
}

/* TYPOGRAPHY */
.shard-label {
    font-size: 0.7rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 8px;
    display: block;
}

h1,
.shard-title {
    font-family: var(--font-heading) !important;
    color: #fff;
    font-size: 2.8rem;
    letter-spacing: 2px;
    padding-bottom: 25px;
    margin-bottom: 25px;
    position: relative;
    border: none;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="10" viewBox="0 0 200 10"><path d="M0 5 L90 5 L100 0 L110 5 L200 5" fill="none" stroke="%23d4af37" stroke-width="1"/><circle cx="100" cy="5" r="2" fill="%23d4af37"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

.shard-preview {
    font-family: var(--font-lore);
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 8;
    line-clamp: 8;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 15px;
}

h2 {
    font-size: 1.6rem;
}

/* SCROLLBAR - ELVEN ARTIFACT STYLE */
.lore-scroll::-webkit-scrollbar {
    width: 8px;
    /* Slightly wider for visibility */
}

.lore-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.1);
    border-radius: 4px;
}

.lore-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gold-dim), var(--gold), var(--gold-dim));
    border-radius: 4px;
    border: 1px solid #000;
    box-shadow: inset 0 0 5px rgba(255, 240, 190, 0.5);
    cursor: grab;
}

.lore-scroll::-webkit-scrollbar-thumb:active {
    cursor: grabbing;
}

.lore-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

.lore-text {
    font-family: var(--font-lore) !important;
    font-size: 1.4rem;
    line-height: 1.7;
    color: #d0d0e0;
    margin: 0;
    padding-right: 10px;
    user-select: text;
    /* Allow text selection */
}

.shard-content h1 {
    font-family: var(--font-heading) !important;
    text-transform: uppercase;
}

/* Ornate Corners (Complex Elven/Gothic) */
.shard-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    /* Slightly smaller for responsive */
    height: 60px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80"><path d="M0 0 L80 0 L80 4 L4 4 L4 80 L0 80 Z" fill="%23d4af37"/><path d="M8 8 L40 8 L40 10 L10 10 L10 40 L8 40 Z" fill="%237a5e2c"/></svg>');
    z-index: 5;
    background-size: cover;
}

.shard-frame::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" transform="rotate(180 40 40)"><path d="M0 0 L80 0 L80 4 L4 4 L4 80 L0 80 Z" fill="%23d4af37"/><path d="M8 8 L40 8 L40 10 L10 10 L10 40 L8 40 Z" fill="%237a5e2c"/></svg>');
    z-index: 5;
    background-size: cover;
}

.shard-reflection {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: skewX(-20deg);
    animation: reflect 10s infinite;
}

@keyframes reflect {
    0% {
        left: -100%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

/* ASTRAL CAROUSEL 5.0 (Continuous Track System) */
#narrative-interface {
    width: 100vw;
    height: 100vh;
    position: relative;
    perspective: 2500px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#shard-track {
    display: flex;
    gap: 5vh;
    /* Relative gap */
    align-items: center;
    transition: transform 1s cubic-bezier(0.19, 1, 0.22, 1);
    transform-style: preserve-3d;
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center;
    will-change: transform;

    /* Dynamic Centering + Parallax + Vertical centering correction */
    transform: translate(var(--tx, 0), -50%) rotateY(var(--mx, 0deg)) rotateX(var(--my, 0deg));
}

/* MORPHING STATES */
.glass-shard.active {
    transform: scale(1) translateZ(200px) rotateY(0deg);
    opacity: 1;
    filter: brightness(1) blur(0);
    z-index: 100;
    box-shadow: 0 50px 150px rgba(0, 0, 0, 0.8);
}

/* Future Shards (Anything after .active) */
.glass-shard.active~.glass-shard {
    transform: scale(0.65) translateZ(-400px) rotateY(-15deg);
    opacity: 0.8;
    filter: brightness(0.4) blur(1px);
    cursor: pointer;
}

/* Past Shards (Anything before .active) */
/* CSS :has is now widely supported in modern browsers */
.glass-shard:has(~ .active) {
    transform: scale(0.65) translateZ(-400px) rotateY(15deg);
    opacity: 0.8;
    filter: brightness(0.4) blur(1px);
    cursor: pointer;
}

/* Ensure children don't block navigation clicks on side shards */
.glass-shard:not(.active) {
    cursor: pointer !important;
    z-index: 10;
    /* Ensure they have a stacking context */
}

/* Hover effects for side shards */
.glass-shard:not(.active):hover {
    opacity: 0.9;
    filter: brightness(0.8) blur(0);
    transform: scale(0.68) translateZ(-80px) rotateY(inherit);
    border-color: var(--gold-bright);
    z-index: 101;
    /* Pop above active when trying to click */
}

/* TYPOGRAPHY */
.shard-label {
    font-size: 0.7rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 8px;
    display: block;
}

h1,
.shard-title {
    font-family: var(--font-heading) !important;
    color: #fff;
    font-size: 2.8rem;
    letter-spacing: 2px;
    padding-bottom: 25px;
    margin-bottom: 25px;
    position: relative;
    border: none;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="10" viewBox="0 0 200 10"><path d="M0 5 L90 5 L100 0 L110 5 L200 5" fill="none" stroke="%23d4af37" stroke-width="1"/><circle cx="100" cy="5" r="2" fill="%23d4af37"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

.shard-preview {
    font-family: var(--font-lore);
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 8;
    line-clamp: 8;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 15px;
}

h2 {
    font-size: 1.6rem;
}

/* SCROLLBAR - ELVEN ARTIFACT STYLE */
.lore-scroll::-webkit-scrollbar {
    width: 8px;
    /* Slightly wider for visibility */
}

.lore-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.1);
    border-radius: 4px;
}

.lore-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gold-dim), var(--gold), var(--gold-dim));
    border-radius: 4px;
    border: 1px solid #000;
    box-shadow: inset 0 0 5px rgba(255, 240, 190, 0.5);
}

.lore-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

.lore-text {
    font-family: var(--font-lore) !important;
    font-size: 1.4rem;
    line-height: 1.7;
    color: #d0d0e0;
    margin: 0;
    padding-right: 10px;
    /* Space for scrollbar */
}

.choices-nexus {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
    flex-shrink: 0;
    /* Prevent shrinking */
    padding-top: 15px;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.choice-shard {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 15px 20px;
    color: #e2e2e8;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    clip-path: polygon(5% 0%, 95% 0%, 100% 50%, 95% 100%, 5% 100%, 0% 50%);
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.choice-shard:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--gold-bright);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.2);
}

.mystic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--void);
    z-index: 2000;
    /* Higher than everything else */
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.mystic-overlay.visible {
    display: flex;
    pointer-events: all;
    opacity: 1;
}

/* ENTRANCE PORTAL - STUNNING LAYOUT */
.entrance-portal {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 2001;
    background-image: url('landing_bg.png');
    background-size: cover;
    background-position: center;
}

.entrance-portal::before {
    /* Darken overlay for text readability */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1;
}

.portal-text-zone {
    position: relative;
    z-index: 10;
}

/* RITUAL SEAL GLASS ANIMATION */
.ritual-symbols {
    position: absolute;
    width: 800px;
    height: 800px;
    opacity: 0.4;
    pointer-events: none;
    z-index: 5;
}

.oracle-seal {
    width: 100%;
    height: 100%;
}

.seal-ring-outer {
    animation: rotateOuter 30s infinite linear;
    transform-origin: center;
}

.seal-ring-inner {
    animation: rotateInner 20s infinite linear;
    transform-origin: center;
}

.seal-text {
    font-family: var(--font-heading);
    font-size: 14px;
    fill: var(--gold);
    letter-spacing: 2px;
}

@keyframes rotateOuter {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes rotateInner {
    from {
        transform: rotate(360deg);
    }

    to {
        transform: rotate(0deg);
    }
}

/* THE LOGO - METALLIC GOLD */
.logo-text {
    font-family: var(--font-heading);
    font-size: 8rem;
    letter-spacing: 30px;
    background: linear-gradient(to bottom, #fff 0%, var(--gold-bright) 45%, var(--gold) 50%, var(--gold-dim) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 30px rgba(212, 175, 55, 0.4));
    animation: textReflect 8s infinite alternate ease-in-out;
}

@keyframes textReflect {
    0% {
        filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.2));
    }

    100% {
        filter: drop-shadow(0 0 50px rgba(212, 175, 55, 0.6));
    }
}

.logo-subtext {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 15px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 5rem;
}

/* THE BUTTON - ARTIFACT STYLE */
.action-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.btn-frame {
    position: relative;
    padding: 2px;
    background: linear-gradient(to right, var(--gold-dim), var(--gold), var(--gold-dim));
    border-radius: 2px;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
    transition: 0.5s;
}

.btn-summon {
    background: #000;
    border: none;
    color: var(--gold);
    padding: 20px 60px;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    letter-spacing: 6px;
    cursor: pointer;
    transition: 0.4s;
}

.btn-frame:hover {
    box-shadow: 0 0 50px var(--gold);
    transform: translateY(-5px) scale(1.05);
}

.btn-frame:hover .btn-summon {
    background: var(--gold);
    color: #000;
}

.trial-info {
    font-size: 0.8rem;
    color: var(--gold-dim);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.gate-aura {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
    filter: blur(50px);
    animation: auraPulse 6s infinite ease-in-out;
}

@keyframes auraPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.6;
    }
}

/* LOADING SCREEN CRYSTAL */
.crystal-spire {
    width: 60px;
    height: 100px;
    background: linear-gradient(to bottom, var(--gold-bright), transparent);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    animation: spirePulse 2s infinite ease-in-out;
    margin-bottom: 20px;
}

@keyframes spirePulse {
    0% {
        transform: scale(1) rotate(0);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(360deg);
        opacity: 0.8;
    }
}

.loader-text {
    font-family: var(--font-heading);
    color: var(--gold);
    letter-spacing: 5px;
    text-transform: uppercase;
}

/* MOBILE RESPONSIVE */
@media (max-width: 1000px) {
    #narrative-interface {
        flex-direction: column;
        overflow-y: auto;
        height: 90vh;
        padding-top: 100px;
    }

    /* .shard-side display rule removed to allow navigation on all devices */

    .shard-now {
        min-width: 0;
        width: 100%;
        height: auto;
        min-height: 70vh;
    }

    .choices-nexus {
        grid-template-columns: 1fr;
    }
}

/* FLOATING NAVIGATION ARROWS (2D FALLBACK) */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--gold);
    cursor: pointer;
    z-index: 2000;
    /* Ensure strictly above everything */
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    opacity: 0;
    /* Hidden by default, shown via JS */
    pointer-events: none;
}

.nav-arrow.visible {
    opacity: 0.6;
    pointer-events: auto;
}

.nav-arrow:hover {
    opacity: 1;
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
    transform: translateY(-50%) scale(1.1);
}

#nav-prev {
    left: 40px;
}

#nav-next {
    right: 40px;
}

/* Ensure mobile visibility */
@media (max-width: 768px) {
    .nav-arrow {
        width: 50px;
        height: 50px;
        background: rgba(0, 0, 0, 0.5);
    }

    #nav-prev {
        left: 10px;
    }

    #nav-next {
        right: 10px;
    }
}

/* RESPONSIVE SCREEN HEIGHT ADJUSTMENTS */
@media (max-height: 900px) {
    .glass-shard {
        width: 70vh;
        /* Make it slightly wider to compensate for height loss */
        height: 65vh;
        /* Reduce height significantly to fit fully with margins */
    }

    .shard-frame::before,
    .shard-frame::after {
        width: 40px;
        /* Smaller ornate corners */
        height: 40px;
    }

    .lore-text {
        font-size: 1.1rem;
    }

    .shard-content h1,
    .shard-title {
        font-size: 2rem;
        margin-bottom: 5px;
        padding-bottom: 15px;
    }

    .shard-content {
        padding: 20px 25px;
    }

    .choices-nexus {
        margin-top: 10px;
        gap: 10px;
        padding-top: 10px;
    }

    .choice-shard {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

@media (max-height: 700px) {
    .glass-shard {
        height: 60vh;
        width: 65vh;
    }

    .lore-text {
        font-size: 1.0rem;
        line-height: 1.4;
    }

    .shard-content h1,
    .shard-title {
        font-size: 1.6rem;
        padding-bottom: 8px;
    }

    .logo-text {
        font-size: 4rem;
        letter-spacing: 10px;
    }
}

/* --- DOCUMENTATION OVERLAY --- */
#docs-overlay.mystic-overlay {
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
    z-index: 5000;
}

.docs-modal {
    width: 90vw;
    max-width: 1200px;
    height: 85vh;
    background: rgba(10, 10, 14, 0.95);
    border: 2px solid var(--gold-dim);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), inset 0 0 100px rgba(0, 0, 0, 0.9);
    display: flex;
    position: relative;
    overflow: hidden;
    animation: openDocs 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Ornate Corners for Docs (Matches Shards) */
.docs-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 60px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80"><path d="M0 0 L80 0 L80 4 L4 4 L4 80 L0 80 Z" fill="%23d4af37"/><path d="M8 8 L40 8 L40 10 L10 10 L10 40 L8 40 Z" fill="%237a5e2c"/></svg>');
    z-index: 5500;
    /* Higher than content */
    background-size: cover;
    pointer-events: none;
}

.docs-modal::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" transform="rotate(180 40 40)"><path d="M0 0 L80 0 L80 4 L4 4 L4 80 L0 80 Z" fill="%23d4af37"/><path d="M8 8 L40 8 L40 10 L10 10 L10 40 L8 40 Z" fill="%237a5e2c"/></svg>');
    z-index: 5500;
    background-size: cover;
    pointer-events: none;
}

@keyframes openDocs {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Sidebar */
.docs-sidebar {
    width: 280px;
    background: rgba(0, 0, 0, 0.6);
    border-right: 1px solid rgba(212, 175, 55, 0.1);
    padding: 30px 20px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.docs-brand {
    font-family: var(--font-heading);
    color: var(--gold);
    font-size: 1.2rem;
    letter-spacing: 3px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
}

.docs-link {
    display: block;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-family: var(--font-body);
    font-size: 0.9rem;
    letter-spacing: 1px;
    border-left: 2px solid transparent;
}

.docs-link:hover,
.docs-link.active {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.1), transparent);
    color: var(--gold-bright);
    border-left: 2px solid var(--gold);
    padding-left: 25px;
}

/* Content Area */
.docs-content {
    flex: 1;
    padding: 60px 80px;
    overflow-y: auto;
    font-family: var(--font-body);
    line-height: 1.8;
    color: #c0c0d0;
    scroll-behavior: smooth;
    position: relative;
    z-index: 10;
}

.doc-section {
    margin-bottom: 80px;
    scroll-margin-top: 40px;
}

.doc-badge {
    display: inline-block;
    padding: 6px 10px;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--gold);
    font-size: 0.7rem;
    font-family: 'Courier New', monospace;
    border-radius: 4px;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.doc-title {
    font-family: var(--font-heading);
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
}

.doc-text {
    font-size: 1.1rem;
    margin-bottom: 20px;
    max-width: 800px;
}

.doc-text strong {
    color: var(--gold-bright);
}

/* Tech Boxes */
.tech-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

.tech-box:hover {
    transform: translateX(10px);
    border-color: rgba(212, 175, 55, 0.3);
    background: rgba(212, 175, 55, 0.02);
}

.tech-box h3 {
    font-family: var(--font-heading);
    color: var(--gold-bright);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

/* Roadmap Items */
.roadmap-item {
    border-left: 1px solid rgba(212, 175, 55, 0.2);
    padding-left: 30px;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 10px;
}

.roadmap-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 0;
    width: 9px;
    height: 9px;
    background: var(--void);
    border: 2px solid var(--gold);
    box-shadow: 0 0 10px var(--gold);
    transform: rotate(45deg);
}

.roadmap-date {
    font-family: 'Courier New', monospace;
    color: var(--gold);
    font-size: 0.8rem;
    margin-bottom: 10px;
    opacity: 0.8;
}

.roadmap-item h3 {
    color: #fff;
    font-size: 1.4rem;
    margin-bottom: 10px;
}

/* Close Button - FIXED Z-INDEX */
.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    width: 40px;
    height: 40px;
    z-index: 6000;
    /* Extremely high z-index to sit on top of everything */
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-close-btn:hover {
    background: rgba(255, 0, 0, 0.1);
    color: #ff5555;
    transform: rotate(90deg);
}

.modal-close-btn svg {
    width: 24px;
    height: 24px;
}

/* Mobile Responsive Docs */
@media (max-width: 900px) {
    .docs-modal {
        flex-direction: column;
        height: 100vh;
        width: 100vw;
    }

    .docs-sidebar {
        width: 100%;
        height: auto;
        padding: 20px;
        flex-direction: row;
        overflow-x: auto;
        align-items: center;
        gap: 20px;
        border-right: none;
        border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    }

    .docs-brand {
        margin: 0;
        padding: 0;
        border: none;
        margin-right: 20px;
        white-space: nowrap;
    }

    .docs-nav {
        display: flex;
        gap: 10px;
    }

    .docs-link {
        white-space: nowrap;
        margin: 0;
        padding: 8px 12px;
        border-left: none;
        border-bottom: 2px solid transparent;
    }

    .docs-link:hover,
    .docs-link.active {
        border-left: none;
        padding-left: 12px;
        border-bottom: 2px solid var(--gold);
        background: transparent;
    }

    .docs-content {
        padding: 30px;
    }

    .doc-title {
        font-size: 1.8rem;
    }
}