:root {
    --bg-color: #080503;
    --text-color: #f0e6d2;
    --primary-color: #d4af37;
    /* Rich Gold */
    --accent-color: #e63946;
    /* Strong Ruby Red */
    --card-bg: rgba(20, 15, 10, 0.85);
    /* Slightly warmer, slightly transparent black */
    --card-border: #4a3b22;
    --modal-bg: rgba(15, 10, 5, 0.95);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image: linear-gradient(to bottom, rgba(10, 5, 5, 0.7), rgba(5, 5, 10, 0.95)), url('images/bg2.png');
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
    color: var(--text-color);
    font-family: 'Shippori Mincho', serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Language Switcher */
.lang-switcher {
    position: absolute;
    top: 1rem;
    right: 2rem;
    z-index: 100;
    font-family: 'Grenze Gotisch', serif;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    transition: color 0.3s, text-shadow 0.3s;
}

.lang-btn:hover {
    color: #fff;
}

.lang-btn.active {
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
    font-weight: bold;
}

.nav-link {
    color: #bbb;
    text-decoration: none;
    font-family: 'Shippori Mincho', serif;
    font-size: 0.95rem;
    transition: color 0.3s;
    margin-right: 1rem;
}

.nav-link:hover {
    color: var(--primary-color);
}

.divider {
    color: #555;
    user-select: none;
}

/* Header */
.header {
    text-align: center;
    padding: 4rem 1rem 2rem;
    position: relative;
}

.site-emblem {
    width: 140px;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.4));
    mix-blend-mode: screen;
    /* Helps emblems blend beautifully */
}

.site-title {
    font-family: 'Grenze Gotisch', 'Shippori Mincho', serif;
    font-size: 4rem;
    color: #fff;
    background: linear-gradient(to bottom, #fff 30%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.8));
    letter-spacing: 5px;
    margin-bottom: 0.5rem;
}

.site-subtitle {
    font-family: 'Grenze Gotisch', serif;
    font-size: 1.2rem;
    color: #e0c885;
    letter-spacing: 8px;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

/* Hero Section */
.hero {
    height: 30vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 1rem;
}

.hero-text {
    font-size: 2rem;
    letter-spacing: 4px;
    font-weight: 400;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 1), 0 0 10px rgba(212, 175, 55, 0.4);
    color: #fdfaf0;
}

/* Gallery Section */
.section-title {
    text-align: center;
    font-family: 'Grenze Gotisch', serif;
    font-size: 3rem;
    color: var(--primary-color);
    margin: 1rem 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.section-desc {
    text-align: center;
    color: #bbb;
    font-size: 1rem;
    margin-bottom: 3rem;
    letter-spacing: 2px;
}

/* Search Section */
.search-section {
    text-align: center;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.search-input {
    width: 100%;
    max-width: 600px;
    padding: 1rem 1.5rem;
    background: rgba(10, 5, 2, 0.6);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    color: #fff;
    font-family: 'Shippori Mincho', serif;
    font-size: 1.1rem;
    outline: none;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    transition: box-shadow 0.3s, background 0.3s;
}

.search-input:focus {
    background: rgba(15, 8, 3, 0.8);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9), 0 0 15px rgba(212, 175, 55, 0.2);
}

.no-results {
    text-align: center;
    color: #888;
    font-size: 1.2rem;
    margin-top: 2rem;
    letter-spacing: 2px;
    display: none;
}

.character-gallery {
    padding: 0 3rem 6rem;
}

.grid-container {
    display: grid;
    /* Increased base width so 5 items can sit nicely, or wrap gracefully */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
    max-width: 1600px;
    margin: 0 auto;
    justify-items: center;
}

/* Specific layout for 5 items, allowing middle row to center */
@media (min-width: 1400px) {
    .grid-container {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .char-card {
        width: calc(33.333% - 3rem);
        max-width: 400px;
    }
}

/* Character Card */
.char-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    /* softer edge */
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
    width: 100%;
}

.char-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.1);
    z-index: 3;
    pointer-events: none;
    transition: box-shadow 0.4s;
}

.char-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(212, 175, 55, 0.2), 0 5px 15px rgba(230, 57, 70, 0.3);
    border-color: var(--primary-color);
}

.char-card:hover::before {
    box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.5);
}

.char-img-wrap {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    position: relative;
}

.char-img-wrap::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(to top, var(--card-bg) 0%, transparent 100%);
    pointer-events: none;
}

.char-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.char-card:hover .char-img {
    transform: scale(1.1);
}

.char-info {
    padding: 1.5rem 1rem 2.5rem;
    text-align: center;
    position: relative;
    z-index: 2;
}

.char-title {
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    font-weight: bold;
}

.char-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 2, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--modal-bg);
    border: 1px solid var(--primary-color);
    width: 95%;
    max-width: 1100px;
    border-radius: 4px;
    box-shadow: 0 0 50px rgba(212, 175, 55, 0.15), 0 0 100px rgba(0, 0, 0, 0.9) inset;
    position: relative;
    padding: 4rem 3rem;
    max-height: 90vh;
    overflow-y: auto;
    background-image: radial-gradient(circle at center, rgba(30, 15, 5, 0.9) 0%, rgba(10, 5, 2, 1) 100%);
}

/* Modal Scrollbar */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: #000;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 3rem;
    color: #666;
    cursor: pointer;
    transition: color 0.3s, transform 0.3s;
    line-height: 1;
}

.close-btn:hover {
    color: var(--accent-color);
    transform: rotate(90deg);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

@media (min-width: 992px) {
    .modal-body {
        grid-template-columns: 1fr 1.2fr;
        align-items: start;
        gap: 4rem;
    }
}

.modal-info {
    padding-right: 1rem;
}

.modal-title {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.modal-name {
    font-size: 2.8rem;
    margin-bottom: 1.5rem;
    color: #fff;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1rem;
    line-height: 1.2;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
}

.lore-text {
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 1rem;
    letter-spacing: 2px;
    font-weight: bold;
}

.modal-desc {
    color: #dcdcdc;
    font-size: 1.1rem;
    line-height: 2;
    text-align: justify;
}

.video-label {
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 1.5rem;
    letter-spacing: 2px;
    font-size: 1.1rem;
    text-transform: uppercase;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border: 2px solid var(--card-border);
    border-radius: 4px;
    background: #000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Modal Footer & Next Button */
.modal-footer {
    margin-top: 3rem;
    text-align: right;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    padding-top: 1.5rem;
}

.btn-next {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.8rem 2rem;
    font-size: 1.2rem;
    font-family: 'Grenze Gotisch', 'Shippori Mincho', serif;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    letter-spacing: 2px;
}

.btn-next:hover {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .header {
        padding: 4rem 1rem 1.5rem;
    }

    .site-emblem {
        width: 100px;
    }

    .site-title {
        font-size: 2.2rem;
        letter-spacing: 2px;
    }

    .site-subtitle {
        font-size: 0.9rem;
        letter-spacing: 4px;
    }

    .hero {
        height: 25vh;
    }

    .hero-text {
        font-size: 1.2rem;
        letter-spacing: 2px;
    }

    .section-title {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }

    .character-gallery {
        padding: 0 1rem 4rem;
    }

    .grid-container {
        gap: 2rem;
    }

    .modal-content {
        padding: 2.5rem 1.5rem 1.5rem;
    }

    .modal-name {
        font-size: 1.8rem;
    }

    .lang-switcher {
        top: 0.5rem;
        right: 1rem;
        font-size: 0.95rem;
    }

    .close-btn {
        top: 0.5rem;
        right: 1rem;
        font-size: 2.5rem;
    }
}