:root {
    --bg-color: #0b0f19;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --accent-color: #38bdf8;
    --accent-hover: #0ea5e9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    pointer-events: none;
    overflow: hidden;
}

.bg-shape {
    position: absolute;
    filter: blur(100px);
    border-radius: 50%;
    animation: floatShape 20s infinite ease-in-out alternate;
    opacity: 0.6;
}

.shape1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: rgba(56, 189, 248, 0.25); animation-delay: 0s; }
.shape2 { bottom: -20%; right: -10%; width: 60vw; height: 60vw; background: rgba(168, 85, 247, 0.2); animation-delay: -5s; }
.shape3 { top: 30%; left: 30%; width: 40vw; height: 40vw; background: rgba(14, 165, 233, 0.15); animation-delay: -10s; }

@keyframes floatShape {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(5%, 10%) scale(1.1); }
    100% { transform: translate(-10%, -5%) scale(0.9); }
}

header {
    text-align: center;
    padding: 4rem 1rem 2rem;
}

header h1 {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(to right, #e0f2fe, #38bdf8, #c084fc, #e0f2fe);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 15px rgba(56, 189, 248, 0.5));
    animation: textShine 5s linear infinite;
    letter-spacing: -2px;
}

@keyframes textShine {
    to { background-position: 300% center; }
}

header p { color: var(--text-secondary); font-size: 1.1rem; }

/* Filtering */
.filter-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.filter-btn:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }
.filter-btn.active { background: var(--accent-color); color: #000; border-color: var(--accent-color); font-weight: 600; }

/* Faction Lore Panel (Hologram Typewriter Effect) */
.faction-lore-panel {
    max-width: 800px;
    margin: 0 auto 3rem;
    padding: 1.5rem 2rem;
    background: rgba(11, 15, 25, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    transition: all 0.5s ease;
    animation: slideDownFade 0.5s ease forwards;
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dynamic Glow Colors for Panel */
.lore-glow-skygarden { box-shadow: 0 0 25px rgba(52, 211, 153, 0.2); border-color: rgba(52, 211, 153, 0.4); }
.lore-glow-mistyharbor { box-shadow: 0 0 25px rgba(96, 165, 250, 0.2); border-color: rgba(96, 165, 250, 0.4); }
.lore-glow-vanguard { box-shadow: 0 0 25px rgba(248, 113, 113, 0.2); border-color: rgba(248, 113, 113, 0.4); }
.lore-glow-petra { box-shadow: 0 0 25px rgba(251, 191, 36, 0.2); border-color: rgba(251, 191, 36, 0.4); }

.lore-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #e2e8f0;
    min-height: 3.2em; /* Keeps height stable */
    display: inline-block;
    white-space: pre-line;
}

.lore-text::after {
    content: '|';
    animation: blink 1s step-end infinite;
    color: var(--accent-color);
    margin-left: 5px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Interactive Canvas Background */
#bgCanvas {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -3; /* Behind everything */
    pointer-events: auto; /* Needs to track mouse, but we'll track mouse on window anyway */
}

/* Faction Bottom Gradient */
#factionGradient {
    position: fixed;
    bottom: -10vh; left: 0; width: 100vw; height: 10vh;
    z-index: -2;
    pointer-events: none;
    transition: box-shadow 1.5s ease;
}

.grad-skygarden { box-shadow: 0 0 600px 250px rgba(167, 243, 208, 0.4); }
.grad-mistyharbor { box-shadow: 0 0 600px 250px rgba(96, 165, 250, 0.4); }
.grad-vanguard { box-shadow: 0 0 600px 250px rgba(248, 113, 113, 0.4); }
.grad-petra { box-shadow: 0 0 600px 250px rgba(251, 191, 36, 0.4); }
.grad-all { box-shadow: 0 0 600px 200px rgba(255, 255, 255, 0.05); }

/* Faction Background Poster */
.faction-bg-poster {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(54vh, 90vw);
    height: calc(min(54vh, 90vw) * 1.6667);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    z-index: -1; /* Behind cards, in front of background-overlay */
    pointer-events: none;
    transition: opacity 1s ease-in-out;
    
    /* Blurs/fades the edges to blend smoothly into the background */
    -webkit-mask-image: radial-gradient(ellipse closest-side at center, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 95%);
    mask-image: radial-gradient(ellipse closest-side at center, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 95%);
}

@keyframes fadeInBanner {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Grid Layout */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding: 0 2rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.card:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.5);
}

.card-image-wrapper { width: 100%; height: 350px; overflow: hidden; }
.card-image { width: 100%; height: 100%; object-fit: cover; object-position: center top; transform-origin: top center; transform: scale(1.12); transition: transform 0.6s ease; }
.card:hover .card-image { transform: scale(1.22); }
.card-content { padding: 1.5rem; }

.faction-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    letter-spacing: 1px;
}

.faction-skygarden { background: rgba(167, 243, 208, 0.15); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.faction-mistyharbor { background: rgba(191, 219, 254, 0.15); color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.3); }
.faction-vanguard { background: rgba(254, 202, 202, 0.15); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.3); }
.faction-petra { background: rgba(253, 230, 138, 0.15); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }

.placeholder-image {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    font-size: 5rem; color: rgba(255, 255, 255, 0.2); background: rgba(0, 0, 0, 0.2);
    font-weight: 800; transition: transform 0.6s ease, color 0.6s ease;
}
.card:hover .placeholder-image { transform: scale(1.1); color: rgba(255, 255, 255, 0.5); }
.placeholder-large { font-size: 10rem; min-height: 400px; }

.card-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.card-subtitle {
    font-size: 0.95rem;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 1rem;
    margin-top: -0.2rem;
}
.card p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.5; }

/* Lore Styling */
.char-quote {
    font-style: italic;
    color: #e2e8f0;
    border-left: 3px solid var(--accent-color);
    padding-left: 10px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.1) 0%, transparent 100%);
    padding: 8px 10px;
    border-radius: 0 8px 8px 0;
}

.char-keywords {
    color: var(--accent-hover);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    header {
        padding: 3rem 1rem 1.5rem;
    }
    
    header h1 {
        font-size: 2.8rem; /* Increased size for mobile */
    }
    
    header p {
        font-size: 0.95rem;
    }
    
    .filter-container {
        flex-wrap: wrap;
        padding: 0 1rem;
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
    }
    
    .card-grid {
        padding: 0 1.5rem 3rem;
        gap: 1.5rem;
        grid-template-columns: 1fr; /* Full width on mobile */
    }
    
    .card-image-wrapper {
        height: 320px;
    }
    
    .faction-bg-poster {
        /* On mobile, standard width usually dictates ratio. */
        width: 80vw;
        height: calc(80vw * 1.6667);
    }
}

/* Special Guest Subtitle Effect */
.special-guest-subtitle {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 0.5rem;
    margin-bottom: 2.5rem;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #94a3b8, #38bdf8, #a7f3d0, #94a3b8);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shineSubtitle 4s linear infinite;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

@keyframes shineSubtitle {
    to { background-position: 200% center; }
}
