:root {
    --primary: #00A8FF;
    --primary-glow: rgba(0, 168, 255, 0.5);
    --secondary: #ffffff;
    --accent: #ff4757;
    --bg-dark: #050510;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f0f0f0;
    --text-muted: #a0a0a0;
    --font-heading: 'Cinzel', serif;
    --font-body: 'Outfit', sans-serif;
    /* Modern sans-serif */
    --font-jp: 'Noto Serif JP', serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    line-height: 1.6;
    position: relative;
}

/* ============================================================
   PREPLUS BACKGROUND (Global)
   - No HTML dependency: applies to all pages.
   ============================================================ */

body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
}

/* Starfield + dimension grid (subtle) */
body::before {
    background:
        radial-gradient(circle at 15% 20%, rgba(167, 139, 250, 0.18) 0%, transparent 42%),
        radial-gradient(circle at 80% 30%, rgba(0, 168, 255, 0.14) 0%, transparent 40%),
        radial-gradient(circle at 35% 85%, rgba(240, 171, 252, 0.10) 0%, transparent 45%),
        radial-gradient(circle at 90% 80%, rgba(52, 211, 153, 0.06) 0%, transparent 42%),
        radial-gradient(circle at 10% 65%, rgba(255, 255, 255, 0.05) 0%, transparent 35%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 80px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 80px),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.06) 0 1px, transparent 2px),
        radial-gradient(circle at 20% 75%, rgba(255, 255, 255, 0.05) 0 1px, transparent 2px),
        radial-gradient(circle at 80% 60%, rgba(255, 255, 255, 0.04) 0 1px, transparent 2px);
    background-size:
        auto,
        auto,
        auto,
        auto,
        auto,
        auto,
        auto,
        260px 260px,
        320px 320px,
        420px 420px;
    background-position:
        0 0,
        0 0,
        0 0,
        0 0,
        0 0,
        0 0,
        0 0,
        0 0,
        60px 40px,
        120px 180px;
    opacity: 0.9;
}

/* Nebula wave (animated) */
body::after {
    z-index: -1;
    background:
        radial-gradient(1200px 800px at 20% 40%, rgba(0, 168, 255, 0.10), transparent 60%),
        radial-gradient(1000px 700px at 75% 55%, rgba(167, 139, 250, 0.10), transparent 62%),
        radial-gradient(900px 600px at 45% 15%, rgba(240, 171, 252, 0.07), transparent 60%),
        linear-gradient(180deg, rgba(5, 5, 16, 0.78) 0%, rgba(5, 5, 16, 0.92) 60%, rgba(5, 5, 16, 0.98) 100%);
    filter: blur(0px);
    transform: translate3d(0, 0, 0);
    animation: preplusNebulaDrift 22s ease-in-out infinite alternate;
}

@keyframes preplusNebulaDrift {
    0% {
        transform: translate3d(-1.5%, -1%, 0) scale(1.02);
        filter: blur(0px);
        opacity: 0.95;
    }
    100% {
        transform: translate3d(1.5%, 1.2%, 0) scale(1.05);
        filter: blur(0.5px);
        opacity: 0.85;
    }
}

/* Backward compatibility: existing overlay element on index page */
.background-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: -3;
    pointer-events: none;
}

/* Header */
.glass-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(5, 5, 16, 0.7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
    transition: all 0.3s ease;
}

.logo {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
    letter-spacing: 2px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--primary);
    text-shadow: 0 0 8px var(--primary-glow);
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 5%;
    overflow: hidden;
    text-align: center;
}

.hero-content {
    z-index: 2;
    max-width: 800px;
}

.glitch {
    font-family: var(--font-heading);
    font-size: 8rem;
    /* Larger since no image */
    font-weight: bold;
    color: var(--secondary);
    position: relative;
    letter-spacing: 10px;
    text-shadow: 2px 2px 0px var(--primary);
    margin-bottom: 1rem;
}

.subtitle {
    font-family: var(--font-jp);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    font-weight: 300;
}

.tagline {
    font-size: 1.5rem;
    color: var(--text-muted);
    letter-spacing: 2px;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 3px;
    gap: 1rem;
}

.scroll-indicator .line {
    width: 1px;
    height: 80px;
    background: linear-gradient(to bottom, var(--primary), transparent);
}

/* Sections */
.section {
    padding: 8rem 5%;
    min-height: 80vh;
    position: relative;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 4rem;
    border-left: 4px solid var(--primary);
    padding-left: 1.5rem;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.subsection-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--text-muted);
    margin: 3rem 0 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.mt-5 {
    margin-top: 5rem;
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Story Timeline */
.story-timeline {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.story-timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2rem;
    bottom: 2rem;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary), transparent);
    display: none;
    /* Hidden on mobile/simple view for now */
}

@media (min-width: 768px) {
    .story-timeline::before {
        display: block;
        left: 50%;
        transform: translateX(-50%);
    }

    .story-card {
        width: 45%;
    }

    .story-card:nth-child(odd) {
        align-self: flex-start;
    }

    .story-card:nth-child(even) {
        align-self: flex-end;
    }
}

.story-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-family: var(--font-heading);
}

/* World Grid */
.world-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.world-card h3 {
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
}

/* Character Grid */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.character-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.character-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 40px rgba(0, 168, 255, 0.2);
    border-color: var(--primary);
}

.char-img-wrapper {
    width: 100%;
    height: 350px;
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.05), transparent);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.char-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.character-card:hover .char-img-wrapper img {
    transform: scale(1.05);
}

.char-info h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.char-role {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.char-desc {
    font-family: var(--font-jp);
    font-size: 0.95rem;
    line-height: 1.8;
}

/* Mini Character Grid (Text Only) */
.mini-char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.mini-char-card {
    padding: 1.5rem;
    border-left: 2px solid var(--text-muted);
    transition: all 0.3s;
}

.mini-char-card:hover {
    border-left-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.mini-char-card h4 {
    color: var(--secondary);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.mini-char-card .role {
    color: var(--primary);
    font-size: 0.8rem;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
}

.mini-char-card .desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: all 0.3s;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item:hover {
    border-color: var(--primary);
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem;
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Modal */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 0 50px rgba(0, 168, 255, 0.3);
    border: 1px solid var(--primary);
    border-radius: 4px;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 2001;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

/* Animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 1s forwards;
}

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}


.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .glitch {
        font-size: 3.5rem;
    }

    .hero-image-container {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        height: 50vh;
        margin-top: 2rem;
    }

    .hero {
        flex-direction: column;
        height: auto;
        padding-top: 100px;
    }

    .glass-header {
        padding: 1rem;
    }

    .nav-links {
        display: none;
    }

    /* Simplified for mobile */
}