
/*/////////////////////////////////////////////////////////////////////*/
/* 1. Глобальные переменные */
/*/////////////////////////////////////////////////////////////////////*/
:root {
    --bg-dark: #1a1a1a;
    --panel-bg: rgba(35, 33, 30, 0.95);
    --accent-gold: #d4af37;
    --text-light: #e8dcc8;
    --border-color: #5d4d37;
    --window-gray: #c0beb7;
}

/*/////////////////////////////////////////////////////////////////////*/
/* 2. Базовые настройки */
/*/////////////////////////////////////////////////////////////////////*/
body {
    background: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Times New Roman', serif;
    font-size: 18px;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.hidden { display: none !important; }

/*/////////////////////////////////////////////////////////////////////*/
/* 3. Главное навигационное меню */
/*/////////////////////////////////////////////////////////////////////*/
ul.mainmenu {
    display: flex;
    justify-content: center;
    list-style: none;
    background: #111;
    border-bottom: 2px solid var(--border-color);
    margin: 0;
    padding: 0;
    height: 50px;
    align-items: center;
}
ul.mainmenu li { margin: 0 20px; }
ul.mainmenu li a {
    color: #aaa;
    text-decoration: none;
    font-variant: small-caps;
    transition: 0.3s;
}
ul.mainmenu li a:hover, 
ul.mainmenu a.active {
    color: var(--accent-gold) !important;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

/*/////////////////////////////////////////////////////////////////////*/
/* 4. Контейнеры и Экраны игры */
/*/////////////////////////////////////////////////////////////////////*/
.screen {
    width: 100%;
    /* width: 100vw; */
    height: calc(100vh - 50px);
    overflow: hidden; /* Изменено с auto на hidden, так как карта сама имеет скролл */
    padding: 0; /* Убираем падинги, чтобы UI прилипал к краям */
    box-sizing: border-box;
    position: relative;
}
/* .container, .game-tab {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
} */
.map-container.game-tab {
    max-width: none !important;
    margin: 0 !important;
}
/*/////////////////////////////////////////////////////////////////////*/
/* 5. Стандартные игровые окна */
/*/////////////////////////////////////////////////////////////////////*/
.standart-window {
    background: var(--window-gray);
    color: #222;
    border: 2px solid #fff;
    outline: 2px solid #000;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

/*/////////////////////////////////////////////////////////////////////*/
/* 6. Таблицы */
/*/////////////////////////////////////////////////////////////////////*/
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    background: rgba(0,0,0,0.1);
}
th {
    background: var(--border-color);
    color: white;
    padding: 10px;
    font-size: 14px;
    text-transform: uppercase;
}
td {
    padding: 8px;
    border: 1px solid rgba(0,0,0,0.2);
    text-align: center;
}

/*/////////////////////////////////////////////////////////////////////*/
/* 7. Игровой Лог */
/*/////////////////////////////////////////////////////////////////////*/
.logs {
    background: #dbd7cc;
    color: #333;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    height: 300px;
    overflow-y: auto;
    padding: 10px;
    border: 2px inset #888;
}

/*/////////////////////////////////////////////////////////////////////*/
/* 8. Кнопки */
/*/////////////////////////////////////////////////////////////////////*/
button, .btn {
    cursor: pointer;
    background: linear-gradient(#4a4a4a, #2a2a2a);
    color: white;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 3px;
    transition: 0.2s;
    font-family: serif;
}
button:hover {
    background: var(--border-color);
    box-shadow: 0 0 5px var(--accent-gold);
}
.button_end_turn {
    background: linear-gradient(#935024, #6a3a1a);
    padding: 10px 30px;
    font-size: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 0 #562606;
}
.button_end_turn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #562606;
}

/*/////////////////////////////////////////////////////////////////////*/
/* 9. Плавающие игровые окна (Интерфейс без блокировки экрана) */
/*/////////////////////////////////////////////////////////////////////*/
.modal {
    display: none;          /* Управляется через JS (flex/none) */
    position: fixed;        /* Фиксируем относительно вьюпорта */
    z-index: 2000;          
    top: 120px;             /* Смещение вниз, чтобы не перекрывать Info Bar */
    left: 50%;
    transform: translateX(-50%);
    
    /* КРИТИЧНО ДЛЯ КЛИКОВ СКВОЗЬ ОКНО: */
    width: auto;
    height: auto;
    pointer-events: none;   /* Сама подложка модалки теперь прозрачна для кликов */
    background: none !important; 
    backdrop-filter: none !important;
}

.modal-content {
    pointer-events: auto;   
    /* 1. ФОН: Приглушенный песочный (не слепит, но светлый) */
    background: #bdaf9d !important; 
    background-image: url('https://www.transparenttextures.com/patterns/parchment.png'); 
    
    /* 2. ТЕКСТ: Только темный, иначе на песке не видно */
    color: #2c1e11 !important; 
    
    width: 500px;
    max-height: 75vh;
    position: relative;
    border: 3px solid #3d2b1f; /* Жирная рамка окна */
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalPopIn 0.2s ease-out;
}

/*Переключаем класс для моладки с логами*/
.modal-content.modal-wide {
    width: 800px;
}


@keyframes modalPopIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 8px 15px;
    background: #3d2b1f; 
    color: #daa520; 
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-variant: small-caps;
    font-size: 18px;
}

.modal-body {
    padding: 15px;
    overflow-y: auto;
    font-family: 'Times New Roman', serif;
    font-size: 16px;
    line-height: 1.4;
    color: #2c1e11 !important; 
}

/* Сделаем разделитель строк в логах заметным на этом фоне */
.modal-body p {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.modal-body table {
    background: rgba(0,0,0,0.2);
    color: #e8dcc8;
}

.modal-footer {
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
}

/* Яркая кнопка */
.modal-footer .sidebar-btn {
    background: linear-gradient(#d4af37, #a68a2d);
    color: #2c1e11;
    font-weight: bold;
    border: 1px solid #3d2b1f;
    padding: 5px 20px;
    width: auto !important;
    font-size: 13px;
}

.modal .close {
    color: var(--accent-gold);

    /* color: #000000; */
    font-size: 24px;
    cursor: pointer;
}

.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: #3d2b1f; }

/* Старая панель (оставляем для совместимости) */
.ui-panel {
    position: absolute;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    padding: 12px;
    z-index: 100;
}
/* Кнопки приказов делаем чуть "объемнее", чтобы они не тонули */
.action-row-item {
    background: rgba(0, 0, 0, 0.3) !important; 
    margin-bottom: 6px;
    padding: 10px 15px;
    border: 1px solid #2a241f !important; 
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: 0.2s;
}
.action-row-item:hover {
    background: rgba(212, 175, 55, 0.1) !important;
    border-color: var(--accent-gold) !important;
    transform: translateX(4px);
}

/* Название приказа (текст слева) */
.action-name-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none; 
}
 
.action-cost-wrapper {
    display: flex;
    /* align-items: center; */
    /* justify-content: flex-end;  */
    gap: 8px;

    background: rgba(0, 0, 0, 0.4);       
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.modal .close {
    color: #daa520;
    font-size: 24px;
    cursor: pointer;
}
/* Скрываем стандартные стрелочки Chrome, Safari, Edge, Opera */
input.no-spinner::-webkit-outer-spin-button,
input.no-spinner::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Скрываем стрелочки Firefox */
input.no-spinner {
    -moz-appearance: textfield;
}
/*/////////////////////////////////////////////////////////////////////*/
/* 10. Меню создания и выбора игры */
/*/////////////////////////////////////////////////////////////////////*/

/* Контейнер вкладок */
.lobby-tabs {
    display: flex;
    gap: 5px;
    padding: 10px 15px 0 15px; /* Отступ сверху и по бокам */
    background: rgba(0, 0, 0, 0.3); /* Темная подложка под вкладками */
}
.lobby-content {
    padding: 20px;
    min-height: 400px; /* Чтобы окно не схлопывалось */
}
.tab-btn {
    padding: 12px 25px;
    border: 1px solid var(--border-color);
    border-bottom: none; /* Убираем нижнюю рамку */
    border-radius: 8px 8px 0 0; /* Скругляем только верх */
    background: #8e8c84; /* Цвет неактивной вкладки (чуть темнее фона) */
    color: #3d2b1f;
    font-weight: bold;
    cursor: pointer;
    font-variant: small-caps;
    transition: all 0.2s ease;
    position: relative;
    top: 1px; /* Сдвигаем на 1px вниз, чтобы перекрыть границу */
    z-index: 1;
}
/* Активная вкладка */
.tab-btn.active {
    background: #c0beb7 url('https://www.transparenttextures.com/patterns/felt.png'); /* Тот же фон, что у окна */
    color: #000;
    z-index: 2; /* Поверх остальных */
    height: calc(100% + 2px); /* Чуть выше, чтобы "влиться" в контент */
    box-shadow: 0 -3px 10px rgba(0,0,0,0.1);
}

.tab-btn:hover:not(.active) {
    background: #a3a199;
}

/* Основное тело окна под вкладками */
.tab-content {
    display: none; 
    width: 100%;
}

/* --- Стили для текста "Нет игр" --- */
.empty-list-msg {
    font-size: 24px;
    color: #555;
    text-align: center;
    padding: 50px;
    font-weight: bold;
    text-transform: uppercase;
    opacity: 0.6;
}

.tab-content.active {
    display: block; /* или flex, если нужно центрирование */
}

/* Центрирование формы создания */
.create-game-centered {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.create-game-area {
    width: 100%;
    max-width: 400px;
    background: rgba(61, 43, 31, 0.05);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.scroll-area {
    height: 100%; /* Теперь список занимает всё окно лобби */
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    overflow-y: auto;
}

/* Фикс кнопки (убрал отступ слева, так как форма теперь по центру) */
.btn-large {
    width: 100%;
    margin-left: 0;
    margin-top: 20px;
}

/*/////////////////////////////////////////////////////////////////////*/
/* 11. ВЕРХНЯЯ ПАНЕЛЬ ИНФОРМАЦИИ (Game Info Bar) */
/*/////////////////////////////////////////////////////////////////////*/
/* ОБЩИЙ КОНТЕЙНЕР НА ВСЮ ШИРИНУ */
.top-navigation-wrapper {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    padding: 0 0px; 
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 2000; /* Поднимаем выше всех, чтобы кнопки работали */
    font-family: 'Times New Roman', serif;
    font-variant: small-caps;
    pointer-events: none; /* Пропускаем клики на карту */
}

.top-group-left, .top-group-right {
    display: flex;
    align-items: flex-start;
    pointer-events: auto; /* Возвращаем клики только кнопкам */
}

/* ОБЩИЕ СТИЛИ ДЛЯ СВИСАЮЩИХ БЛОКОВ */
.player-status-block, .action-time-block {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 5px 15px;
    height: 56px;
}

/* ЛЕВЫЙ БЛОК (ФЛАГ) */
.player-status-block {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    border-radius: 0 0 0 10px;
    border-right: none;
    cursor: pointer;
}

/* ПРАВЫЙ БЛОК (КНОПКА ХОДА) */
.action-time-block {
    align-items: center;
    gap: 4px;
    border-radius: 0 0 10px 0;
    border-left: none;
}

/* ЦЕНТРАЛЬНЫЕ ПАНЕЛИ (ТЕПЕРЬ РАЗДЕЛЕННЫЕ) */
.game-info-bar {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    height: 42px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Специфические закругления для разрыва */
.treasury-bar {
    border-radius: 0 0 10px 0; /* Закругляем правый край казны */
    border-left: none;
}

.ap-bar {
    border-radius: 0 0 0 10px; /* Закругляем левый край ОД */
    border-right: none;
}

/* ПОДСТРОЧНИК ДЛЯ ВРЕМЕНИ */
.time-sub-row {
    display: flex;
    gap: 10px;
    font-size: 16px;
    color: #aaa;
    line-height: 1;
}

.time-divider-v {
    width: 1px;
    height: 10px;
    background: var(--border-color);
    opacity: 0.3;
}

/* СТИЛИ ЭЛЕМЕНТОВ */
.info-section { display: flex; align-items: center; gap: 15px; }
.info-item { display: flex; align-items: center; gap: 6px; }
.info-value { font-size: 16px; font-weight: bold; color: var(--accent-gold); }
.section-tag-side { font-size: 15px; color: #888; text-transform: uppercase; margin-right: 5px; }

.info-divider-v { width: 1px; height: 12px; background: var(--border-color); opacity: 0.4; }

/* ФЛАГ */
.banner-mini {
    width: 28px; height: 38px; border: 2px solid #1a120b; 
    position: relative; flex-shrink: 0; background-color: #fca311; 
}
.banner-line { position: absolute; left: 50%; width: 1px; height: 100%; background: rgba(0,0,0,0.2); }

.country-name { font-size: 19px; font-weight: bold; color: var(--accent-gold); line-height: 1.2; }
.victory-progress { display: flex; align-items: center; gap: 8px; }

/* КНОПКА */
.button_end_turn {
    background: linear-gradient(#935024, #6a3a1a);
    padding: 0 15px;       
    height: 32px;         
    line-height: 26px;    
    font-size: 16px;      
    border-radius: 4px;
    border: 1px solid #562606;
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ЦВЕТА */
.silver { color: #e0e0e0 !important; }
.kunas { color: #ffb366 !important; }
.ap-personal { color: #7ec8e3; }
.ap-military { color: #e37e7e; }
.ap-trade { color: #a3e37e; }
.ap-construction { color: #d4a37e; }

/* Утилиты */
.section-container, .section-tag, .section-content { display: contents; }


/*/////////////////////////////////////////////////////////////////////*/
/* 12. КАРТА И ГЕКСЫ */
/*/////////////////////////////////////////////////////////////////////*/
/* Контейнер на весь экран */
.map-container {
    position: fixed;
    top: 50px; 
    left: 0;
    width: 100vw;
    height: calc(100vh - 50px);
    overflow: auto; 
    background: #0f0f0f; /* Глубокий темный фон */
    z-index: 1;
}

/* Обертка для холстов с отступами */
.canvas-wrapper {
    position: relative;
    /* padding: 45px 310px 300px 210px;  */
    /*верх, право, низ, лево*/
    padding: 0px 310px 0px 0px; /* Карта. Тот самый отступ, чтобы крайние провинции вышли из-за UI */
    display: inline-block;
    line-height: 0; /* Убирает микро-отступ под canvas */
}

/* Накладываем Overlay прямо поверх Display */
#mapDisplay {
    display: block;
    position: relative;
    z-index: 2;
}

#mapData {
    /* Скрытая карта для парсинга */
    position: absolute;
    top: 0;
    left: 0;
    display: none; /* Если скрипт использует getImageData из контекста, этого достаточно */
}
#mapOverlay {
    position: absolute;
    /*Карта*/
    /* top: 45px;  */
    /* left: 210px;  */
    top: 0px; /* Должен совпадать с padding у .canvas-wrapper */
    left: 0px; /* Должен совпадать с padding у .canvas-wrapper */
    pointer-events: none; /* Чтобы клики проходили сквозь него на mapDisplay */
    z-index: 3;
}

/* #mapOverlay, #mapData {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

#mapOverlay { z-index: 3; }
#mapData { display: none; } */

/* --- СТИЛИЗАЦИЯ СКРОЛЛБАРА --- */
/* Ширина полосы */
.map-container::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

/* Фон дорожки */
.map-container::-webkit-scrollbar-track {
    background: #1a1a1a;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}

/* Ползунок */
.map-container::-webkit-scrollbar-thumb {
    background: #4a4a4a; /* Цвет ползунка */
    border: 3px solid #1a1a1a; /* Создает эффект отступа */
    border-radius: 8px;
}

/* Ползунок при наведении */
.map-container::-webkit-scrollbar-thumb:hover {
    background: #666; 
}

/*/////////////////////////////////////////////////////////////////////*/
/* 13. НИЖНЯЯ ПАНЕЛЬ */
/*/////////////////////////////////////////////////////////////////////*/
.bottom-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 200px;
    background: var(--panel-bg);
    background-image: url('img/paper_texture.png'); 
    border-top: 3px solid var(--accent-gold);
    padding: 20px;
    display: flex !important;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 -10px 25px rgba(0,0,0,0.6);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.bottom-panel.hidden { transform: translateY(105%); }

/* #bottom-info-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 220px; 
    background: rgba(20, 20, 25, 0.95);
    border-top: 2px solid #ffd700;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 15px 25px;
    display: flex;
    justify-content: center;
    transition: transform 0.3s ease;
    overflow-y: auto;
} */
 #bottom-info-panel {
    position: fixed;
    bottom: 0; 
    /*Прижимаем к левому краю с аккуратным отступом*/
    /* left: 20px;                      */
    width: max-content;             /* Панель занимает ровно столько, сколько нужно контенту */
    max-width: calc(100vw - 40px);  /* Ограничиваем, чтобы не вылезала за экран на мелких мониторах */
    height: 220px; 
    background: rgba(20, 20, 25, 0.95);
    border-top: 2px solid #ffd700;
    border-right: 2px solid #ffd700; /* Добавляем золотую рамку справа и сверху, так как панель теперь обрывается */
    border-radius: 0 8px 0 0;       /* Скругляем верхний правый угол для красоты */
    box-shadow: 5px -5px 20px rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 15px 25px;
    display: flex;
    justify-content: flex-start;    /* Контент внутри выравнивается по левому краю */
    transition: transform 0.3s ease;
    overflow-y: auto;
}
#bottom-info-panel.hidden { transform: translateY(100%); }
/* 
.panel-content { display: flex; justify-content: center; gap: 40px; width: 100%; align-items: center; }
#panel-data { height: 100%; display: flex; align-items: flex-start; justify-content: center; width: 100%; } */
.panel-content { 
    display: flex; 
    justify-content: flex-start;    /* Прижимаем данные к левому краю */
    gap: 40px; 
    width: auto;                    /* Убираем 100%, чтобы не растягивать родителя */
    align-items: center; 
}
#panel-data { 
    height: 100%; 
    display: flex; 
    align-items: flex-start; 
    justify-content: flex-start;   /* Данные из шаблона сервера тоже пойдут слева */
    width: auto;                    /* Убираем растяжение */
}

.info-block { border-left: 1px solid var(--border-color); padding-left: 20px; }
.info-block:first-child { border-left: none; }
.info-block h2 { color: var(--accent-gold); font-variant: small-caps; margin-bottom: 5px; }
.info-block p { margin: 5px 0; color: var(--text-light); }
.close-button { background: none !important; border: none !important; font-size: 40px; color: var(--border-color) !important; line-height: 1; transition: 0.2s; }
.close-button:hover { color: var(--accent-gold) !important; transform: rotate(90deg); }
#close-panel-btn { position: absolute; top: 10px; right: 15px; background: none; border: 1px solid #555; color: #888; cursor: pointer; border-radius: 3px; }

/*/////////////////////////////////////////////////////////////////////*/
/* 14. Адаптив */
/*/////////////////////////////////////////////////////////////////////*/
@media (max-width: 900px) {
    .game-info-bar { left: 50%; transform: translateX(-50%); max-width: 95vw; }
    .info-label { font-size: 10px; }
    .info-value { font-size: 16px; }
}
.game-info-bar::-webkit-scrollbar { height: 4px; }
.game-info-bar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }



/*/////////////////////////////////////////////////////////////////////*/
/* 15. Боковая панель кнопок */
/*/////////////////////////////////////////////////////////////////////*/
/* Главный контейнер для всего UI */
.game-ui-wrapper {
    position: relative;
    display: flex;
    justify-content: space-between; /* Расталкивает сайдбары по краям */
    width: 100%;
    height: 100vh;
    padding: 60px 20px 20px 20px; /* Отступ сверху для Info Bar */
    box-sizing: border-box;
}

/* Левая колонка */
/* .sidebar-container.left {
    position: fixed;
    top: 125px;
    left: 0px; 
    width: 180px;
    z-index: 1000;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
} */
.sidebar-container.left {
    position: fixed;
    top: 120px; /* Поднимаем к уровню верхней панели */
    left: 0px; 
    width: auto; /* Убрали жесткие 180px, чтобы блок изящно сжимался до ширины иконок */
    z-index: 1000; /* Чтобы была поверх карты */
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px; /* Немного уменьшили отступы для компактности */
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.orders-panel-style, #orders-panel.sidebar-container.right {
    position: fixed;
    top: 125px; 
    right: 20px; 
    width: 265px;
    z-index: 1000;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    max-height: 80vh;
    overflow-y: auto;


    max-height: 60vh; 
    transition: max-height 0.3s ease-in-out, background 0.3s;
    opacity: 0.95; /* Можно сделать чуть прозрачной, чтобы видеть карту под ней */
    
}

/* Состояние при наведении */
.orders-panel-style:hover {
    max-height: 85vh; 
    z-index: 2000; /* Выше всего */
    opacity: 1;
    box-shadow: 0 0 20px rgba(0,0,0,0.5); /* Подсветка, чтобы акцентировать внимание */
}

/* Общий стиль блоков для левой панели */
/* .sidebar-group {
    background: rgba(35, 30, 25, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
} */

/* Общий стиль блоков для левой панели */
.sidebar-group {
    /* Рамка и фон отсюда убраны, так как они дублировали внешнюю рамку .sidebar-container.left */
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-label {
    color: var(--accent-gold);
    font-variant: small-caps;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
    font-weight: bold;
}

.side-content-panel {
    position: absolute !important;
    top: 110px !important;
    left: 250px !important; /* Справа от левого сайдбара */
    width: 300px;
    background: rgba(30, 28, 25, 0.98);
    border: 2px solid var(--accent-gold);
    box-shadow: 10px 10px 30px rgba(0,0,0,0.8);
    padding: 15px;
    z-index: 100; /* Выше всего */
}

.sidebar-buttons-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Кнопки */
.sidebar-btn, .action-btn {
    width: 100%;
    padding: 6px 12px;
    background: rgba(60, 50, 40, 0.4);
    border: 1px solid #5d4d37;
    color: #e8dcc8;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
}
/* .sidebar-btn, .action-btn {
    width: 100%;
    padding: 8px 14px; 
    background: rgba(45, 40, 35, 0.8) !important; 
    border: 1px solid #4a3e2e !important;
    color: #e8dcc8;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
    box-sizing: border-box;
    white-space: nowrap; 
} */

.sidebar-btn:hover, .action-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--accent-gold);
}

/* Декор для приказов */
.action-btn.war { border-left: 4px solid #8b0000; }
.action-btn.trade { border-left: 4px solid #2e8b57; }
.action-btn.build { border-left: 4px solid #daa520; }
.action-btn.policy { border-left: 4px solid #4682b4; }
.action-btn.events { border-left: 4px solid #9370db; }

/* Список приказов внутри правой панели */
.orders-header {
    background: rgba(0,0,0,0.4);
    padding: 3px;
    /* color: #000000; */
    color: var(--accent-gold);
    font-weight: bold;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}
/* .orders-list-content { overflow-y: auto; padding: 10px; flex-grow: 1; } */
.orders-list-content {
    overflow-y: auto;
    padding: 5px;
}
.orders-empty { color: #666; font-style: italic; text-align: center; padding: 20px; }


.custom-slider {
    -webkit-appearance: none;
    height: 4px;
    background: #3d3329;
    border-radius: 2px;
    outline: none;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #ffcc00;
    border: 2px solid #2c1e11;
    border-radius: 50%;
    cursor: pointer;
}

/*/////////////////////////////////////////////////////////////////////*/
/* 16. Прогресс бары */
/*/////////////////////////////////////////////////////////////////////*/
/* Благородное золото вместо желтого */
.text-gold { color: #c5a059; font-weight: bold; }
.text-gray { color: #a0a0a0; font-size: 0.85em; }

.ruler-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Две колонки, чтобы всё влезло */
    gap: 12px;
    margin-top: 10px;
}

.exp-container {
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 10px;
    border-radius: 4px;
    border-left: 3px solid #c5a059;
}

.exp-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    margin-bottom: 3px;
}

.exp-bar-bg {
    width: 100%;
    height: 6px; /* Тонкая полоска */
    background: #1a1510;
    border: 1px solid #45362b;
    border-radius: 10px;
    overflow: hidden;
}

.exp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #8e6e37, #c5a059);
    box-shadow: 0 0 5px rgba(197, 160, 89, 0.5);
}

.btn-learn-mini {
    background: #4a5d23;
    color: #d1d1d1;
    border: 1px solid #6b823a;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 0.75em;
    margin-top: 4px;
    width: 100%;
    transition: 0.2s;
}

.btn-learn-mini:hover:not(:disabled) {
    background: #6b823a;
    color: #fff;
}

.btn-learn-mini:disabled {
    opacity: 0.4;
    cursor: default;
    border-color: #333;
}
/* Стиль контейнера полоски роста */
.pop-growth-container {
    width: 100%;
    height: 8px;
    background: #1a1a1a;
    border-radius: 4px;
    margin-top: 4px;
    border: 1px solid #333;
    overflow: hidden;
    position: relative;
}

/* Сама заполняющаяся полоска */
.pop-growth-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
    transition: width 0.3s ease;
}

/* Текст под полоской */
.pop-growth-details {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}
/*/////////////////////////////////////////////////////////////////////*/
/* 17. Загрузочный экран */
/*/////////////////////////////////////////////////////////////////////*/
/* Контейнер на весь экран */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Полупрозрачный фон */
    backdrop-filter: blur(5px);    /* Размытие заднего плана */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;                 /* Поверх всего */
    transition: opacity 0.3s ease;
}

/* Скрытие лоадера */
.loader-overlay.hidden {
    display: none;
    opacity: 0;
}

.loader-content {
    text-align: center;
    color: white;
    font-family: sans-serif;
}

/* Простой CSS-спиннер */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/*/////////////////////////////////////////////////////////////////////*/
/* 18. Модалка статистики провинций (Стыковка с сайдбаром) */
/*/////////////////////////////////////////////////////////////////////*/
.side-modal {
    position: fixed;
    /* Стык: 20px (отступ сайдбара) + 180px (ширина сайдбара) + 5px (зазор) */
    left: 225px; 
    top: 125px; 
    height: auto;
    max-height: 70vh;
    width: 290px;
    z-index: 1500;
    pointer-events: none;
}

.side-modal-content {
    pointer-events: auto;
    background: var(--panel-bg); /* Тот же фон, что у Государства */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.5);
    animation: fadeInSide 0.2s ease-out;
}

@keyframes fadeInSide {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.side-modal-header {
    background: rgba(35, 30, 25, 0.95);
    color: var(--accent-gold);
    padding: 8px 12px;
    font-variant: small-caps;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center;
}

.side-modal-body {
    padding: 12px;
    overflow-y: auto;
    color: var(--text-light); /* Светлый текст, как в кнопках */
    font-size: 15px;
}

.close-side {
    cursor: pointer;
    font-size: 24px;
    color: var(--border-color);
    line-height: 1;
}

.close-side:hover {
    color: var(--accent-gold);
}

/*/////////////////////////////////////////////////////////////////////*/
/* 19. Модалки инфы о тайлах */
/*/////////////////////////////////////////////////////////////////////*/
/* Единый контейнер для окон провинции */
/* Контейнер опущен на уровень старого окна товаров */
.province-chain-container {
    position: fixed;
    top: 120px; /* Вровень с игровым интерфейсом */
    left: 185px; /* Сразу после главного меню */
    /* height: calc(75vh - 250px);  */
    display: flex;
    align-items: flex-start; /* Окна выравниваются по верхнему краю и растут независимо */
    gap: 4px; /* Небольшой зазор между окнами для стиля */
    z-index: 999;
    pointer-events: none;
}

.chain-window {
    width: 250px;
    /* height: 100%; */
    height: auto;
    background: rgba(24, 19, 15, 0.98);
    border: 1px solid #3d2b1f;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    box-shadow: 4px 4px 10px rgba(0,0,0,0.6);
}

.chain-header {
    background: #231911;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3d2b1f;
    font-size: 12px;
    font-weight: bold;
    color: var(--accent-gold);
    text-transform: uppercase;
}

/* Строка вкладок переключения */
.chain-tabs-row {
    display: flex;
    background: #1a120c;
    border-bottom: 1px solid #3d2b1f;
}
.chain-tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: #8c7661;
    font-size: 11px;
    padding: 4px 0;
    cursor: pointer;
    font-weight: bold;
}
.chain-tab-btn.active {
    color: var(--accent-gold);
    background: #2a1e15;
    border-bottom: 1px solid var(--accent-gold);
}

.chain-body {
    padding: 4px;
    flex-grow: 1;
    overflow-y: auto;
    font-size: 14px;
}

/* Строгая узкая строка в один ряд */
.compact-tile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 6px;
    margin-bottom: 2px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 2px;
    cursor: pointer;
    height: 22px;
    box-sizing: border-box;
}
.compact-tile-row:hover {
    background: rgba(212, 175, 55, 0.08);
}

/* ИЗМЕНЕНО: Подсветка всей рамки карточки в нужный цвет + утолщенный левый край для акцента */
.tile-border-landscape {
    border: 1px solid rgba(74, 222, 128, 0.3) !important;  /* Прозрачно-зеленая рамка вокруг */
    border-left: 3px solid #4ade80 !important;              /* Яркий зеленый левый край */
}
.tile-border-container {
    border: 1px solid rgba(96, 165, 250, 0.3) !important;   /* Прозрачно-синяя рамка вокруг */
    border-left: 3px solid #60a5fa !important;              /* Яркий синий левый край */
}

/* Распределение ширины внутри карточки изменено для лучшей читаемости */
.compact-tile-info {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 60%; /* Отдаем 60% под Ландшафт (Ресурс Мощность) */
    font-size: 14px; 
}
.compact-tile-build {
    width: 40%; /* Отдаем 40% под название постройки */
    text-align: right;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #bbb; /* Сделали название постройки чуть светлее для контраста */
    font-size: 14px;
}
/* Текстовая кнопка закрытия в тон заголовка */
.chain-close-btn {
    cursor: pointer;
    font-size: 12px; /* Тот же шрифт и размер, что у заголовка */
    font-weight: bold;
    color: #8c7661; /* Неактивный золотисто-коричневый цвет */
    transition: color 0.1s;
}
.chain-close-btn:hover {
    color: var(--accent-gold); /* Подсветка при наведении */
}
/*/////////////////////////////////////////////////////////////////////*/
/*/////////////////////////////////////////////////////////////////////*/



/*/////////////////////////////////////////////////////////////////////*/
/* 20. Модалки приказов */
/*/////////////////////////////////////////////////////////////////////*/

/* .active-building {
    background-color: #5c4b37 !important; 
    border: 2px solid #ffcc00 !important; 
    color: #ffffff !important;
} */

.active-building {
    background-color: #5c4b37 !important;
    /* Вместо изменения border используем box-shadow, чтобы не менять размеры */
    border: 1px solid #ffcc00 !important; 
    box-shadow: inset 0 0 0 1px #ffcc00, 0 0 8px rgba(255, 204, 0, 0.6);
    color: #ffffff !important;
}



/*/////////////////////////////////////////////////////////////////////*/
/*/////////////////////////////////////////////////////////////////////*/