/* Базовые цвета для светлой темы (по умолчанию) */
:root {
    --bg-main: #f0f1ec;
    --text-main: #2b2e2a;
    --accent: #4a5746;
    --header-bg: #3a4537;
    --header-text: #e8e9e4;
    --box-bg: #e4e6df;
    --border: #c3c7bd;
    --link-color: #335c3b;
    --btn-map-bg: #822929; /* Темно-красный акцент для карты */
}

/* Автоматическая темная тема */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: #181a18;
        --text-main: #d5d7d3;
        --accent: #5e6b5a;
        --header-bg: #111311;
        --header-text: #f0f1ec;
        --box-bg: #222521;
        --border: #383c36;
        --link-color: #79a181;
        --btn-map-bg: #9c3030;
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
}

/* =========================================
   ШАПКА САЙТА (ИСПРАВЛЕНО ДЛЯ ПК И МОБИЛОК)
   ========================================= */
.top-nav {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--accent);
}

.logo {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-item {
    color: var(--header-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}

.btn-tactical {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: var(--btn-map-bg);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    transition: 0.2s opacity;
}
.btn-tactical:hover { opacity: 0.8; }

/* Форма поиска */
.search-form {
    display: flex;
    align-items: center;
    background-color: var(--box-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    width: 250px; 
}
.search-form input {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 6px 10px;
    width: 100%;
    font-size: 0.9rem;
    outline: none;
}
.search-form button {
    background-color: var(--accent);
    border: none;
    color: #fff;
    padding: 8px 12px;
    cursor: pointer;
    transition: 0.2s;
}
.search-form button:hover { background-color: var(--btn-map-bg); }

/* Адаптивность шапки для телефонов */
@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }
    .nav-links {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 12px;
    }
    .search-form { width: 100%; }
}

/* =========================================
   ОСНОВНОЙ КОНТЕЙНЕР И СТАТЬИ
   ========================================= */
.wiki-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 15px;
}

.wiki-content {
    display: flow-root; /* Исправляет баг, когда таблица вылезает за пределы ПК версии */
}

/* Инфобокс (Военная карточка) */
.infobox {
    background-color: var(--box-bg);
    border: 1px solid var(--border);
    padding: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}
@media (min-width: 768px) {
    .infobox {
        float: right;
        width: 350px;
        margin-left: 20px;
        margin-bottom: 20px;
    }
}

.infobox-header {
    background-color: var(--accent);
    color: #fff;
    text-align: center;
    padding: 5px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8rem;
}
.infobox-header.secret { background-color: #b30000; }

.infobox-title {
    text-align: center;
    padding: 10px 0;
    font-size: 1.2rem;
}

.infobox-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}
.infobox-table th, .infobox-table td {
    padding: 6px;
    border: 1px solid var(--border);
    vertical-align: top;
}
.infobox-table th {
    background-color: rgba(0,0,0,0.05);
    width: 35%;
    text-align: left;
}

.infobox-section {
    background-color: rgba(0,0,0,0.1);
    text-align: center;
    padding: 4px;
    font-weight: bold;
    margin-top: 10px;
    border: 1px solid var(--border);
}
.sides td { text-align: center; }

/* Текст статьи */
.text-content h2 {
    font-size: 1.4rem;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 40px;
    margin-bottom: 20px;
    padding-left: 15px;
    border-left: 4px solid var(--accent);
    background: linear-gradient(90deg, rgba(130, 41, 41, 0.1) 0%, transparent 100%);
    padding-top: 8px;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
}
.text-content h2::before {
    content: '//';
    color: var(--btn-map-bg);
    margin-right: 12px;
    font-family: "Courier New", Courier, monospace;
    font-weight: bold;
    font-size: 1.2rem;
    opacity: 0.8;
}

.text-content p { margin-bottom: 15px; }
.text-content ul { margin-left: 20px; margin-bottom: 15px; }
.text-content li { margin-bottom: 8px; }
.text-content p strong {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

/* =========================================
   АТМОСФЕРНЫЕ ЭЛЕМЕНТЫ (ЛОР И RP)
   ========================================= */
.redacted {
    background-color: var(--text-main); 
    color: var(--text-main);            
    padding: 0 4px;
    border-radius: 2px;
    cursor: pointer;
    transition: 0.3s;
}
.redacted:hover {
    background-color: transparent;
    text-decoration: underline wavy #822929;
}

.status-stamp {
    display: inline-block;
    padding: 2px 8px;
    font-weight: 900;
    font-size: 0.8rem;
    text-transform: uppercase;
    border: 2px solid;
    border-radius: 4px;
    transform: rotate(-5deg); 
    margin-left: 10px;
}
.stamp-kia { color: #b33939; border-color: #b33939; } 
.stamp-active { color: #218c53; border-color: #218c53; } 

.timeline {
    border-left: 3px solid var(--accent);
    margin: 20px 0 20px 15px;
    padding-left: 20px;
    position: relative;
}
.timeline-event { margin-bottom: 20px; position: relative; }
.timeline-event::before {
    content: '';
    position: absolute;
    left: -29px; 
    top: 5px;
    width: 15px;
    height: 15px;
    background-color: var(--bg-main);
    border: 3px solid var(--btn-map-bg);
    border-radius: 50%;
}
.timeline-date {
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--btn-map-bg);
    margin-bottom: 5px;
}
.timeline-text {
    background-color: var(--box-bg);
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.95rem;
}

/* =========================================
   ТЕРМИНАЛЬНЫЙ ЗАГОЛОВОК (ЭФФЕКТ КИНО)
   ========================================= */
.page-title {
    font-size: 2rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 5px;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.terminal-header {
    background: #0a0a0a;
    border: 1px solid #222;
    border-left: 6px solid #b30000;
    padding: 15px 20px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.5);
}
.terminal-header::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 51, 51, 0.05), transparent);
    animation: scanline 4s infinite linear;
}
@keyframes scanline {
    0% { left: -100%; }
    100% { left: 200%; }
}

.th-microtext {
    display: flex;
    justify-content: space-between;
    font-family: "Courier New", Courier, monospace;
    font-size: 0.65rem;
    color: #666;
    letter-spacing: 2px;
    margin-bottom: 8px;
}
.th-blinking { color: #b30000; animation: blinker 1s linear infinite; }
@keyframes blinker { 50% { opacity: 0; } }

.terminal-header .page-title {
    color: #ffffff;
    font-size: 2.5rem;
    font-weight: 900;
    text-shadow: 2px 2px 0px rgba(179, 0, 0, 0.3);
    z-index: 2;
    position: relative;
}

.th-bottom-line {
    display: flex; align-items: center;
    margin-top: 15px; border-top: 1px solid #333; padding-top: 8px;
}
.th-red-bar { height: 4px; width: 40px; background-color: #b30000; margin-right: 15px; }
.th-sys-info { font-family: "Courier New", Courier, monospace; font-size: 0.7rem; color: #4a5746; }

/* =========================================
   КАТАЛОГ СТАТЕЙ (СЕТКА И КАРТОЧКИ)
   ========================================= */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.catalog-card {
    background-color: #0f0f0f;
    border: 1px solid #2a2a2a;
    text-decoration: none;
    color: #cccccc;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.catalog-card:hover {
    border-color: #b30000;
    box-shadow: 0 5px 20px rgba(179, 0, 0, 0.2);
    transform: translateY(-3px);
}

.card-header {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 800;
    font-family: "Courier New", Courier, monospace;
    border-bottom: 1px solid #2a2a2a;
}
.secret { color: #ff3333; }
.top-secret { background: #b30000; color: #fff; text-align: center; border-bottom: none; }

.card-image {
    width: 100%; height: 180px; position: relative;
    border-bottom: 1px solid #2a2a2a; background-color: #111;
}
.card-image img {
    width: 100%; height: 100%; object-fit: cover;
    filter: grayscale(40%) contrast(120%); transition: 0.4s ease;
}
.catalog-card:hover .card-image img { filter: grayscale(0%) contrast(110%); transform: scale(1.05); }

.card-body { padding: 20px; flex-grow: 1; }
.card-body h3 { margin: 0 0 10px 0; color: #ffffff; font-size: 1.2rem; text-transform: uppercase; }
.card-body p { margin: 0; font-size: 0.85rem; color: #888888; line-height: 1.5; }

.card-footer {
    padding: 15px 20px; border-top: 1px dotted #333;
    display: flex; justify-content: space-between; align-items: center; background-color: #050505;
}
.card-tag { padding: 4px 8px; border-radius: 2px; font-size: 0.65rem; font-weight: bold; text-transform: uppercase; }
.tag-red { background: rgba(179, 0, 0, 0.1); color: #ff3333; border: 1px solid #ff3333; }
.tag-green { background: rgba(51, 153, 51, 0.1); color: #33cc33; border: 1px solid #33cc33; }
.card-date { font-family: "Courier New", Courier, monospace; color: #555; font-size: 0.75rem; }

/* =========================================
   ИНФОРМАЦИОННАЯ ЛЕНТА ШТАБА (LIVE ФИД)
   ========================================= */
.live-feed-container {
    background: #0a0a0a; border: 1px solid #222; margin-bottom: 30px; border-radius: 4px; box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.feed-header {
    background: rgba(179, 0, 0, 0.1); border-bottom: 1px solid #b30000; padding: 10px 15px; font-weight: 800; color: #ff3333; font-size: 0.9rem; display: flex; align-items: center; gap: 10px;
}
.blinking-dot { width: 10px; height: 10px; background-color: #ff3333; border-radius: 50%; box-shadow: 0 0 8px #ff3333; animation: blinker 1s linear infinite; }
.feed-list { max-height: 250px; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.feed-list::-webkit-scrollbar { width: 6px; }
.feed-list::-webkit-scrollbar-track { background: #111; }
.feed-list::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
.feed-item { background: rgba(255, 255, 255, 0.03); border-left: 4px solid #fff; padding: 10px 15px; border-radius: 0 4px 4px 0; transition: 0.2s; }
.feed-item:hover { background: rgba(255, 255, 255, 0.08); }
.feed-meta { display: flex; justify-content: space-between; font-size: 0.7rem; font-family: "Courier New", Courier, monospace; margin-bottom: 5px; font-weight: bold; }
.feed-time { color: #888; }
.feed-type { text-transform: uppercase; }
.feed-title { color: #fff; font-size: 0.95rem; font-weight: bold; text-transform: uppercase; margin-bottom: 4px; }
.feed-desc { color: #aaa; font-size: 0.8rem; line-height: 1.4; }
/* ==========================================
   СТИЛИ ДЛЯ СВОДОК НА ГЛАВНОЙ (TELEGRAM-СТИЛЬ)
========================================== */
@keyframes dataLoad {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

.report-card {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #334155;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    font-family: 'Inter', sans-serif;
    
    /* Добавляем анимацию появления */
    opacity: 0; 
    animation: dataLoad 0.4s ease-out forwards;
}

/* Делаем каскадное появление (каждый следующий блок появляется чуть позже) */
.report-card:nth-child(1) { animation-delay: 0.1s; }
.report-card:nth-child(2) { animation-delay: 0.2s; }
.report-card:nth-child(3) { animation-delay: 0.3s; }
.report-card:nth-child(4) { animation-delay: 0.4s; }
.report-card:nth-child(n+5) { animation-delay: 0.5s; }
/* ==========================================
   БОКОВАЯ НАВИГАЦИЯ (WIKI SIDEBAR)
   ========================================== */

/* Включаем плавную прокрутку до глав */
html {
    scroll-behavior: smooth;
}

/* Двухколоночная сетка для статей */
.wiki-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 25px;
    align-items: start;
}

/* Сам сайдбар (зафиксирован при скролле) */
.wiki-sidebar {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-box {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 12px 14px;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    border-bottom: 1px solid #334155;
    padding-bottom: 6px;
    margin-bottom: 10px;
    font-family: monospace;
}

.sidebar-toc, .sidebar-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-toc li, .sidebar-links li {
    margin-bottom: 8px;
}

.sidebar-toc li:last-child, .sidebar-links li:last-child {
    margin-bottom: 0;
}

.sidebar-toc a, .sidebar-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: block;
    line-height: 1.3;
}

.sidebar-toc a:hover, .sidebar-links a:hover {
    color: #ff4d4d;
    padding-left: 5px;
}

/* Мобильная версия (экран меньше 900px) */
@media (max-width: 900px) {
    .wiki-layout {
        grid-template-columns: 1fr;
    }

    .wiki-sidebar {
        position: static;
        order: 2; /* Убирает боковое меню вниз на телефонах */
    }
}
.card-image {
    position: relative;
    overflow: hidden;
}
/* Линии сканирования CRT */
.card-image::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px;
    z-index: 2;
    pointer-events: none;
    opacity: 0.6;
}
/* ==========================================
   ФИЛЬТРЫ КАТАЛОГА СТАТЕЙ
   ========================================== */
.catalog-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.cat-filter-btn {
    background: transparent;
    color: #888888;
    border: 1px solid #333333;
    padding: 8px 18px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.cat-filter-btn:hover {
    color: #ffffff;
    border-color: #555555;
    background: rgba(255, 255, 255, 0.05);
}

.cat-filter-btn.active {
    background: #b30000;
    color: #ffffff;
    border-color: #b30000;
    box-shadow: 0 0 10px rgba(179, 0, 0, 0.4);
}