:root {
    --lore-cyan: #66f5ff;
    --lore-gold: #ffd58d;
    --lore-violet: #8d5bff;
    --lore-ink: #060a14;
}

body.realm-lore-body {
    margin: 0;
    min-height: 100vh;
    color: #f0f4ff;
    font-family: 'Rajdhani', sans-serif;
    background: #03060f;
    overflow-x: hidden;
}

.realm-lore-video {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    filter: brightness(0.38) saturate(1.08) contrast(1.08);
    transition: filter 0.6s ease;
}

body[data-faction="creation"] .realm-lore-video {
    filter: brightness(0.42) saturate(1.12) contrast(1.04) hue-rotate(-5deg);
}

body[data-faction="transformation"] .realm-lore-video {
    filter: brightness(0.34) saturate(1.18) contrast(1.1) hue-rotate(5deg);
}

.realm-lore-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    transition: background 0.6s ease;
    background:
        radial-gradient(circle at 20% 15%, rgba(102, 245, 255, 0.15), transparent 40%),
        radial-gradient(circle at 84% 22%, rgba(141, 91, 255, 0.18), transparent 42%),
        linear-gradient(180deg, rgba(3, 7, 16, 0.6), rgba(3, 6, 12, 0.85));
}

body[data-faction="creation"] .realm-lore-overlay {
    background:
        radial-gradient(circle at 30% 20%, rgba(102, 245, 255, 0.2), transparent 45%),
        radial-gradient(circle at 75% 30%, rgba(242, 198, 109, 0.12), transparent 40%),
        linear-gradient(180deg, rgba(8, 16, 28, 0.5), rgba(4, 8, 16, 0.82));
}

body[data-faction="transformation"] .realm-lore-overlay {
    background:
        radial-gradient(circle at 70% 20%, rgba(141, 91, 255, 0.22), transparent 45%),
        radial-gradient(circle at 25% 35%, rgba(255, 51, 102, 0.1), transparent 40%),
        linear-gradient(180deg, rgba(6, 4, 14, 0.55), rgba(3, 2, 8, 0.88));
}

.realm-lore-shell {
    width: min(1180px, 94vw);
    margin: 1.5rem auto 2.2rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.realm-lore-header,
.realm-lore-card,
.realm-lore-doors,
.realm-lore-cta {
    background: rgba(8, 13, 25, 0.72);
    border: 1px solid rgba(102, 245, 255, 0.22);
    border-radius: 14px;
    box-shadow: 0 0 30px rgba(102, 245, 255, 0.08), 0 0 45px rgba(141, 91, 255, 0.08), inset 0 1px 0 rgba(255,255,255,0.06);
}

.realm-lore-header {
    padding: 1.2rem 1.3rem 1.15rem;
    text-align: center;
}

.realm-lore-kicker {
    margin: 0 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.8rem;
    color: var(--lore-gold);
    font-family: 'Orbitron', sans-serif;
}

.realm-lore-header h1 {
    margin: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.5rem, 3.2vw, 2.2rem);
    color: var(--lore-cyan);
    letter-spacing: 0.03em;
}

.realm-lore-header h2 {
    margin: 0.45rem 0 0.6rem;
    font-size: clamp(1rem, 2vw, 1.35rem);
    color: #d9e5ff;
    font-weight: 600;
}

.realm-lore-intro {
    margin: 0 auto;
    max-width: 980px;
    font-size: 1.06rem;
    line-height: 1.45;
    color: #e7eeff;
}

.realm-lore-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.realm-lore-doors {
    padding: 1rem 1rem 1.05rem;
    text-align: center;
}

.realm-lore-doors h3 {
    margin: 0;
    color: var(--lore-gold);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
}

.realm-lore-doors > p {
    margin: 0.35rem 0 0.85rem;
    color: #d9e5ff;
    font-size: 1rem;
}

.realm-lore-door-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.realm-lore-door {
    position: relative;
    display: block;
    text-decoration: none;
    border-radius: 12px;
    overflow: hidden;
    min-height: 220px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.realm-lore-door img,
.realm-lore-door video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.realm-lore-door video {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.realm-lore-door:hover video,
.realm-lore-door:focus-visible video {
    opacity: 1;
}

.realm-lore-door:hover,
.realm-lore-door:focus-visible {
    transform: translateY(-3px);
    outline: none;
}

.realm-lore-door-creation {
    border-color: rgba(102, 245, 255, 0.45);
    box-shadow: 0 0 24px rgba(102, 245, 255, 0.15);
}

.realm-lore-door-transformation {
    border-color: rgba(141, 91, 255, 0.45);
    box-shadow: 0 0 24px rgba(141, 91, 255, 0.18);
}

.realm-lore-door::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(4, 8, 16, 0.2) 0%, rgba(4, 8, 16, 0.75) 100%);
}

.realm-lore-door-label {
    position: absolute;
    left: 50%;
    top: 0.9rem;
    transform: translateX(-50%);
    z-index: 1;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(4, 8, 16, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.realm-lore-door-creation .realm-lore-door-label {
    color: var(--lore-cyan);
    border-color: rgba(102, 245, 255, 0.5);
}

.realm-lore-door-transformation .realm-lore-door-label {
    color: #d8b8ff;
    border-color: rgba(141, 91, 255, 0.5);
}

.realm-lore-card {
    padding: 1rem 1rem 0.9rem;
}

.realm-lore-card h3 {
    margin: 0 0 0.5rem;
    color: var(--lore-gold);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.03rem;
    letter-spacing: 0.03em;
}

.realm-lore-card p {
    margin: 0 0 0.45rem;
    color: #e2e9ff;
    font-size: 1rem;
    line-height: 1.45;
}

.realm-lore-card ul {
    margin: 0;
    padding-left: 1.05rem;
}

.realm-lore-card li {
    margin-bottom: 0.35rem;
    color: #edf2ff;
    line-height: 1.35;
    font-size: 0.98rem;
}

.realm-lore-cta {
    text-align: center;
    padding: 1.15rem 1rem 1.25rem;
    border-color: rgba(255, 213, 141, 0.35);
}

.realm-lore-cta p {
    margin: 0 0 0.85rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff0d2;
    letter-spacing: 0.02em;
}

.realm-lore-actions {
    display: flex;
    justify-content: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.realm-lore-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 220px;
    padding: 0.65rem 1.05rem;
    border-radius: 10px;
    text-decoration: none;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.realm-lore-btn:hover {
    transform: translateY(-2px);
}

.realm-lore-btn-primary {
    color: #041015;
    background: linear-gradient(135deg, var(--lore-cyan), #8df7ff);
    box-shadow: 0 0 20px rgba(102, 245, 255, 0.32);
}

.realm-lore-btn-secondary {
    color: #efe7ff;
    border: 1px solid rgba(141, 91, 255, 0.6);
    background: rgba(74, 48, 136, 0.34);
    box-shadow: 0 0 18px rgba(141, 91, 255, 0.2);
}

@media (max-width: 960px) {
    .realm-lore-grid {
        grid-template-columns: 1fr;
    }

    .realm-lore-door-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .realm-lore-shell {
        width: min(96vw, 640px);
        margin-top: 1rem;
        margin-bottom: 1.3rem;
    }

    .realm-lore-header,
    .realm-lore-card,
    .realm-lore-cta {
        padding: 0.9rem;
    }

    .realm-lore-intro {
        font-size: 0.98rem;
    }

    .realm-lore-btn {
        width: 100%;
        min-width: 0;
    }
}
