:root {
    /* === ГЛОБАЛЬНАЯ ПАЛИТРА (По умолчанию: Стиль Джерри/Оригинал) === */
    --bg: #050505;          /* Основной фон страницы (Глубокая тьма) */
    --content-bg: #0d0d0d;  /* Фон "Коробки" статьи */
    --card-bg: #1e1e1e;     /* Фон карточек и инфобокса */
    
    --text: #e0e0e0;        /* Основной текст */
    --text-muted: #888;     /* Серый текст */
    
    --border: #333333;      /* Цвет рамок */
    
    --accent: #4a90e2;      /* ГЛАВНЫЙ АКЦЕНТ (Синий по дефолту) */
    --glow: rgba(74, 144, 226, 0.4); /* Свечение (полупрозрачный акцент) */
    
    --nav-bg: #000000;      
    --nav-text: #ffffff;
    --infobox-header: #2a2a2a;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    margin: 0; 
    padding: 0;
    line-height: 1.6;
    /* Легкий фоновый узор или градиент для глубины */
    background-image: radial-gradient(circle at 50% 0%, #1a1a1a 0%, var(--bg) 80%);
    background-attachment: fixed;
}

/* === 1. ВЕРХНЯЯ ПАНЕЛЬ И MEGA-MENU === */
.wiki-navbar {
    background-color: var(--nav-bg);
    color: var(--nav-text);
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    box-shadow: 0 2px 15px var(--glow); /* Добавил свечение навигации */
    border-bottom: 3px solid var(--accent);
    transition: transform 0.3s ease-in-out;
}

.wiki-navbar.hidden { transform: translateY(-100%); }

/* Логотип */
.nav-brand { display: flex; align-items: center; text-decoration: none; color: #fff; margin-right: 30px; }
.nav-logo { height: 45px; width: 45px; border-radius: 50%; object-fit: cover; border: 2px solid #333; margin-right: 15px; }
.site-title { font-weight: bold; font-size: 1.1em; text-transform: uppercase; letter-spacing: 1.5px; }

/* Ссылки меню */
.nav-links { display: flex; align-items: center; height: 100%; }
.dropdown { position: relative; height: 100%; display: flex; align-items: center; }
.dropbtn { color: #aaa; text-decoration: none; padding: 0 15px; font-size: 0.85em; font-weight: bold; text-transform: uppercase; cursor: pointer; height: 100%; display: flex; align-items: center; transition: 0.2s; }
.dropdown:hover .dropbtn { color: #fff; text-shadow: 0 0 5px var(--glow); }

/* Выпадающие списки */
.dropdown-content { display: none; position: absolute; top: 60px; left: 0; background-color: var(--nav-bg); min-width: 240px; box-shadow: 0 8px 16px rgba(0,0,0,0.7); border: 1px solid var(--border); border-top: none; }
.dropdown:hover .dropdown-content { display: block; }
.dropdown-content > a, .dropdown-submenu > a { color: #ccc; padding: 12px 16px; text-decoration: none; display: block; font-size: 0.9em; border-bottom: 1px solid #222; }
.dropdown-content > a:hover, .dropdown-submenu:hover > a { background-color: #222; color: #fff; border-left: 3px solid var(--accent); }

/* Вложенные меню */
.dropdown-submenu { position: relative; }
.dropdown-submenu > a::after { content: " ▸"; float: right; }
.dropdown-submenu-content { display: none; position: absolute; top: 0; left: 100%; background-color: var(--nav-bg); min-width: 250px; box-shadow: 0 8px 16px rgba(0,0,0,0.7); border: 1px solid var(--border); }
.dropdown-submenu:hover .dropdown-submenu-content { display: block; }
.dropdown-submenu-content a { color: #ccc; padding: 10px 16px; text-decoration: none; display: block; font-size: 0.85em; border-bottom: 1px solid #222; }
.dropdown-submenu-content a:hover { background-color: #333; color: #fff; }

/* === 2. ОСНОВНОЙ КОНТЕЙНЕР (Стиль Эдриана + Зеро) === */
.container { 
    max-width: 1200px; 
    margin: 100px auto 40px; /* Отступ сверху */
    padding: 0 20px;
    position: relative;
}

/* КОРОБКА СТАТЬИ (Новое!) */
article {
    background-color: var(--content-bg); /* Темный фон статьи */
    padding: 40px; /* Просторные отступы внутри */
    border-radius: 8px; /* Скругление */
    border: 1px solid var(--border); /* Тонкая рамка */
    box-shadow: 0 0 30px rgba(0,0,0,0.5); /* Глубокая тень */
}

/* Заголовок статьи */
.page-title {
    font-family: 'Times New Roman', serif;
    font-size: 2.5em;
    margin-top: 0;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--glow); /* Свечение цветом акцента */
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
    overflow: hidden; /* Это заставляет линию останавливаться перед Инфобоксом */
    display: block;   /* Гарантируем блочное поведение */
}

/* Цитаты */
article p i {
    display: block;
    color: #dcdcdc;
    border-left: 3px solid var(--accent); /* Цветная линия слева */
    padding: 10px 15px;
    background: linear-gradient(-90deg, rgba(62, 61, 120, 0.104), rgba(62, 61, 120, 0.131)); /* Легкий градиент для глубины */
    margin-bottom: 25px;
    font-family: 'Times New Roman', serif;
    font-size: 1.1em;
    overflow: hidden; /* Это заставляет линию останавливаться перед Инфобоксом */
    display: block;   /* Гарантируем блочное поведение */
}

/* Заголовки H2 (Разделы) */
/* Заголовки H2 (Разделы) */
h2 {
    border-bottom: 1px solid var(--accent); /* Цветной пунктир */
    padding-bottom: 5px;
    margin-top: 40px;
    font-size: 1.8em;
    font-weight: normal;
    font-family: 'Times New Roman', serif;
    color: var(--text);
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
    
    /* === МАГИЯ ИСПРАВЛЕНИЯ === */
    overflow: hidden; /* Это заставляет линию останавливаться перед Инфобоксом */
    display: block;   /* Гарантируем блочное поведение */
}

/* Списки */
article ul { padding-left: 20px; }
article ul li { margin-bottom: 5px; color: #ccc; }
article ul li b { color: #fff; }

/* Ссылки в тексте */
.wiki-link { color: var(--accent); text-decoration: none; font-weight: 500; transition: 0.2s; }
.wiki-link:hover { text-decoration: underline; text-shadow: 0 0 8px var(--glow); color: #fff; }
.broken-link { color: #ff4c4c !important; text-decoration: dashed underline; /* Пунктирное подчеркивание */
    cursor: help;}


/* === 3. ИНФОБОКС (Стиль Зеро + Джерри) === */
.infobox {
    width: 320px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    box-shadow: 0 0 15px rgba(0,0,0,0.5); /* Глубокая тень для объема */
    border-radius: 8px;
    border-top: 3px solid var(--accent); /* Цветная шапка сверху */

    padding: 0; /* Убрал паддинг, чтобы картинка была в край */
    float: right;
    margin-left: 30px;
    margin-bottom: 20px;

}

  
/* Имя в инфобоксе */
.infobox-name {
    
    text-align: center;
    padding: 15px;
    font-size: 1.4em;
    font-weight: bold;
    font-family: 'Times New Roman', serif;
    color: #fff;
    background: linear-gradient(-30deg, rgba(0, 0, 0, 0.429), transparent);
    text-shadow: 0 0 8px var(--glow);
    letter-spacing: 1px;
}


.infobox-image {
    width: 100%;
    background: var(--card-bg); /* Фон под картинкой на всякий случай */
    text-align: center;
    position: relative; /* Обязательно для наложения тени */
    overflow: hidden; /* Чтобы тень не вылезала за скругления, если они будут */
    border-bottom: 10px solid var(--border); /* Разделитель между картинкой и данными */
    margin-top: -1px;
}

/* МАГИЯ: Создаем псевдо-элемент поверх картинки для внутренней тени */
.infobox-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0px solid var(--accent); /* Тонкая рамка для усиления эффекта */
    /* Интенсивная внутренняя тень (виньетка), затемняющая края */
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    pointer-events: none; /* Чтобы тень не мешала, если вдруг нужно кликнуть */
    z-index: 1; /* Тень лежит поверх картинки */
}

.infobox-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    position: relative;
    z-index: 0; /* Картинка лежит под тенью */
}

/* Заголовки секций инфобокса */
.infobox-header {
    
    background: linear-gradient(90deg, transparent, rgba(15, 19, 86, 0.2), transparent); /* Градиент */
    text-align: center;
    padding: 8px;
    font-weight: bold;
    font-size: 1em;
    color: var(--accent); /* Цвет акцента */
    text-transform: uppercase;
    letter-spacing: 1px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.infobox table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.infobox th { text-align: left; padding: 10px; width: 40%; vertical-align: top; color: #aaa; border-bottom: 1px solid #222; }
.infobox td { padding: 10px; vertical-align: top; border-bottom: 1px solid #222; }
.infobox tr:last-child th, .infobox tr:last-child td { border-bottom: none; }

/* Переключатель картинок */
.image-toggle { display: flex; background: #111; border-bottom:0 1px solid #333;}
.toggle-btn {
    flex: 1; border: none; background: transparent; padding: 10px 0;
    cursor: pointer; font-size: 0.85em; font-weight: bold; color: #666;
    transition: all 0.3s; border-bottom: 3px solid transparent;
    z-index: 2; /* Чтобы кнопки были поверх картинки */
}
.toggle-btn:hover { color: #fff; background: rgba(255,255,255,0.05); }
.toggle-btn.active { background: var(--card-bg); color: var(--accent); border-bottom: 3px solid var(--accent); }

/* === 4. ОГЛАВЛЕНИЕ (TOC) === */
.toc {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    display: inline-block;
    padding: 15px 30px 15px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    min-width: 200px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.toc h3 { text-align: center; margin: 0 0 10px; border: none; font-size: 1.1em; color: var(--text); }
.toc ul { list-style-type: decimal; padding-left: 20px; margin: 0; }
.toc li { margin-bottom: 5px; font-size: 0.95em; color: var(--accent); }
.toc a { text-decoration: none; color: var(--text); transition: color 0.2s; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

/* === 5. СПИСКИ ПЕРСОНАЖЕЙ (АЛФАВИТ) === */
.alphabet-section { margin-bottom: 40px; border-top: 1px solid var(--border); padding-top: 20px; }
.letter-header { font-size: 2em; font-weight: bold; color: var(--accent); margin-bottom: 15px; display: inline-block; }

.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; }

.wiki-card {
    display: flex; align-items: center; background: var(--card-bg);
    border: 1px solid var(--border); text-decoration: none; color: var(--text);
    border-radius: 6px; transition: transform 0.2s, border-color 0.2s; overflow: hidden; height: 100px;
}
.wiki-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 5px 15px var(--glow); }
.wiki-card img { width: 90px; height: 100%; object-fit: cover; border-right: 1px solid var(--border); flex-shrink: 0; }
.wiki-card-info { padding: 0 15px; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.wiki-card-info h3 { margin: 0; font-size: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--accent); }
.wiki-card-info p { margin: 3px 0 0; font-size: 0.8em; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === 6. НЕДАВНИЕ СТАТЬИ (ГЛАВНАЯ) === */
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 25px; margin-bottom: 50px; }
.recent-card { display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--text); overflow: hidden; transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.recent-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 8px 20px var(--glow); }
.recent-img-wrapper { height: 300px; width: 100%; background-color: #222; border-bottom: 1px solid var(--border); }
.recent-img-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.recent-info { padding: 15px; display: flex; flex-direction: column; flex-grow: 1; }
.recent-info h3 { margin: 0 0 8px 0; font-size: 1.1em; color: var(--accent); font-family: sans-serif; }
.recent-info p { margin: 0; font-size: 0.85em; color: #999; line-height: 1.4; }

/* === 7. ТАБЛИЦЫ И УТИЛИТЫ === */
.eyes-table { width: 100%; border-collapse: collapse; margin: 20px 0; border: 1px solid var(--border); }
.eyes-table th { background: var(--infobox-header); border: 1px solid var(--border); padding: 10px; text-align: left; }
.eyes-table td { border: 1px solid var(--border); padding: 10px; }
.clearfix::after { content: ""; clear: both; display: table; }

/* Плеер */
.music-player { position: fixed; bottom: 20px; right: 20px; background: var(--card-bg); border: 1px solid var(--accent); padding: 10px 15px; border-radius: 50px; display: flex; align-items: center; gap: 10px; z-index: 1000; box-shadow: 0 0 15px var(--glow); }

/* ========================================= */
/* === НОВЫЕ СТИЛИ: ИЗОБРАЖЕНИЯ И ГАЛЕРЕЯ === */
/* ========================================= */

/* Плавающие картинки в тексте */
.wiki-image-float {
    max-width: 280px;
    margin: 10px 0 10px 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    padding: 5px;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    box-sizing: border-box;
    overflow: hidden;
    cursor: pointer; /* Курсор показывает, что можно нажать */
    transition: border-color 0.3s;
}
.wiki-image-float:hover {
    border-color: var(--accent);
}
.wiki-image-float img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}
.wiki-image-float .img-caption {
    display: block;
    font-size: 0.85em;
    color: #888; /* Используем серый, если var(--text-muted) не задан */
    text-align: center;
    padding-top: 5px;
    font-style: italic;
}

/* Классы обтекания */
.float-right { float: right; margin-left: 20px; margin-bottom: 10px; clear: right; }
.float-left { float: left; margin-right: 20px; margin-bottom: 10px; margin-left: 0; clear: left; }
.clearfix-text::after { content: ""; display: table; clear: both; }

/* Адаптация для телефонов */
@media (max-width: 600px) {
    .wiki-image-float {
        float: none !important;
        margin: 10px auto;
        max-width: 100%;
    }
}

/* Сетка Галереи */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
}
.gallery-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
    cursor: pointer;
}
.gallery-item:hover { 
    transform: translateY(-3px); 
    border-color: var(--accent); 
}
.gallery-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}
.gallery-caption {
    padding: 8px;
    text-align: center;
    font-size: 0.9em;
    color: var(--text);
}

/* ========================================= */
/* === МОДАЛЬНОЕ ОКНО (ПРОСМОТР ФОТО) === */
/* ========================================= */
.modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    padding-top: 50px; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.9); /* Темный фон */
    backdrop-filter: blur(5px); /* Размытие фона */
}

/* Картинка внутри модального окна */
.modal-content {
    margin: auto;
    display: block;
    max-width: 1000px;
    max-height: 80vh;
    object-fit: contain;
    border: 2px solid var(--accent); /* Рамка цветом акцента персонажа */
    box-shadow: 0 0 20px var(--accent); /* Свечение */
    animation: zoom 0.3s;
}

@keyframes zoom {
    from {transform:scale(0)} 
    to {transform:scale(1)}
}

/* Подпись под фото */
#modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: 150px;
    font-family: 'Times New Roman', serif;
    font-size: 1.2em;
}

/* Кнопка закрытия */
.modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

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

@font-face {
    font-family: 'determination'; /* Придумай имя шрифту */
    src: url('Statics/determinationrusbylyajka.otf') format('opentype'); /* Путь к файлу */
    font-weight: normal;
    font-style: normal;
}

/* === БЛОК УВЕДОМЛЕНИЯ ОТ АВТОРА === */
.author-notice {
    background-color: var(--card-bg); /* Фон как у карточек */
    border: 1px solid var(--accent);  /* Рамка цветом текущего акцента */
    color: #dbdbdb;                   /* Белый текст */
    padding: 5px 20px 2px 10px;              /* Отступ снизу до остального контента */
    border-radius: 6px;               /* Скругленные углы */
    font-family: 'determination', serif;               /* Курсив для стиля "примечания" */
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); /* Легкая тень */
    width: 65%;
    }


/* === СТИЛЬ ДЛЯ ПЕСЕН === */
        .song-container {
            background: rgba(0, 0, 0, 0.4);
            border: 1px solid var(--border);
            padding: 20px;
            margin-bottom: 30px;
            border-radius: 8px;
        }

        .song-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            flex-wrap: wrap;
            gap: 10px;
        }

        .song-title {
            color: var(--accent);
            font-size: 1.4em;
            font-family: 'Times New Roman', serif;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        /* Кастомный аудио-плеер (базовая стилизация) */
        audio.agatha-player {
            width: 100%;
            height: 40px;
            border-radius: 20px;
            outline: none;
            filter: sepia(100%) hue-rotate(10deg) saturate(150%) contrast(0.8); /* Золотой оттенок */
        }

        /* Таблица песен */
        .song-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.9em;
            margin-top: 15px;
        }

        .song-table th {
            text-align: left;
            padding: 10px;
            background: linear-gradient(to bottom, #2e2612, #110f0a);
            color: #ffd700;
            border-bottom: 2px solid var(--border);
            text-transform: uppercase;
            font-size: 0.8em;
        }

        .song-table td {
            padding: 12px 10px;
            border-bottom: 1px solid rgba(138, 101, 8, 0.3);
            vertical-align: top;
        }

        .song-table tr:hover {
            background: rgba(184, 134, 11, 0.05);
        }

        /* Колонки */
        .col-lyrics {
            width: 40%;
            font-style: italic;
            color: #ededed;
            font-family: 'Georgia', serif;
        }

        .col-action {
            width: 30%;
            color: #f7d56f; /* Более тусклый золотой для действий */
            font-size: 0.95em;
        }

        .col-context {
            width: 30%;
            color: #bcbcbc;
            font-size: 0.95em;
        }

        /* Выделение ключевых слов в тексте */
        .highlight-lyric {
            color: #ffd700;
            font-weight: bold;
            text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
        }
        .highlightr-lyric {
            color: #ff0000;
            font-weight: bold;
            text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
        }


        /* === СТИЛЬ ДЛЯ СКРЫТИЯ/РАСКРЫТИЯ ПЕСЕН === */
        .song-container {
            transition: all 0.3s ease;
        }

        /* Заголовок теперь кликабельный */
        .song-header {
            cursor: pointer;
            position: relative;
            padding-right: 30px; /* Место для стрелочки */
        }
        
        .song-header:hover .song-title {
            color: #fff;
            text-shadow: 0 0 10px var(--accent);
        }

        /* Стрелочка индикатор */
        .song-header::after {
            content: '▼';
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--accent);
            font-size: 1.2em;
            transition: transform 0.4s ease;
        }

        /* Если открыто - переворачиваем стрелку */
        .song-container.open .song-header::after {
            transform: translateY(-50%) rotate(180deg);
            color: #ff4444; /* Красный оттенок при открытии (опционально) */
        }

        /* Скрытый блок с контентом */
        .song-content-wrapper {
            max-height: 0;
            overflow: hidden;
            opacity: 0;
            transition: max-height 0.8s cubic-bezier(0, 1, 0, 1), opacity 0.5s ease-in-out;
        }

        /* Состояние открытого блока */
        .song-container.open .song-content-wrapper {
            max-height: 5000px; /* Достаточно большое значение, чтобы влез любой текст */
            opacity: 1;
            transition: max-height 1s ease-in-out, opacity 1s ease-in-out; 
            /* Плавное появление */
        }