body {
    font-family: 'Orbitron', sans-serif;
    background-color: #080c14 !important;
    color: #c7d5e8;
    margin: 0;
    padding: 0;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}
header {
    background-color: #101824;
    padding: 20px 0;
    text-align: center;
    border-bottom: 3px solid #4a8fe2;
}
h1 {
    font-size: 3em;
    color: #4a8fe2;
    margin: 0;
    text-shadow: 0 0 10px #4a8fe2;
}
h1, h2, h3, h4, h5, h6 {margin: 0;}
nav {
    background-color: #1c2838;
    padding: 10px 0;
    position: relative;
    z-index: 200;
}
nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
}
nav ul li {
    margin: 0 15px;
    position: relative;
}
nav ul li a {
    color: #6bb5ff;
    text-decoration: none;
    font-size: 1.1em;
    transition: color 0.3s;
}
nav ul li a:hover {
    color: #ffffff;
    text-shadow: 0 0 5px #6bb5ff;
}
nav ul.sub-menu {
    position: absolute;
    display: none;
    left: 0;
    top: 21px;
    width: 240px;
    background: #1c2838;
}
nav ul.sub-menu ul.sub-menu {
    left: 235px;
    top: 0;
    margin: 0;
    padding: 0;
}
nav li:hover>.sub-menu {
    display: flex;
    flex-direction: column;
    padding: 11px 0;
    box-shadow: 3px 2px 3px 0 rgba(0, 0, 0, .175);
    border-radius: 0 0 10px 10px;
}
nav .sub-menu li:hover {background: #465970;}
nav .sub-menu li {
    margin: 0 1px;
    padding: 0 15px;
}
nav .sub-menu li a {
    line-height: 2;
}
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.menu-item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    height: 400px;
    /*width: 600px;*/
}
.menu-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.menu-item:hover img {
    transform: scale(1.05);
}
.menu-item .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(16, 24, 36, 0.8);
    padding: 15px;
    text-align: center;
}
.menu-item h2 {
    color: #4a8fe2;
    margin: 0;
    font-size: 1.5em;
}
.menu-item p {
    color: #c7d5e8;
    margin: 10px 0 0;
}
.table-items {
    width: 100%;
    position: relative;
    /*display:grid;*/
    /*grid-template-columns: auto auto auto auto auto auto auto auto auto auto auto auto;*/
    /*gap: 2px;*/
    /*grid-auto-rows: 40px;*/
    /*grid-auto-flow: column;*/
}
.table-items th, .table-items td/*, .table-items div*/ {padding: 3px;text-align: center;}
.table-items > div {
    display: flex;
    align-items: center;
    overflow: hidden;
    justify-content: center;
}
.table-items th {position: sticky; background: #000; top: 0;}
/*.table-items .header {background: #000;position: absolute;top:-36px;left: 0;right: 0;padding: 0;width: 1200px;margin: auto;}*/
.table-items .row {display: table-row;}
.table-items .odd {background: #1F3B5C; }
.table-items .even {background: #153152;}
.table-items .name, .table-items .comment {}
.table-items .range {min-width: 100px;}
.table-items .durability, .table-items .lvl {}
.table-items .weight {}
.table-items .cost {flex-direction: column; min-width: 100px;}
.table-items .powerUsage {}
.table-items .damagePerE {min-width: 100px;}
.table-items .cost div {display: flex;}
.table-items .radius, .table-items .firingRate {}
.table-items .image {background: #000;}
.table-items.table-mobs .image img{width: 300px;}
.table-items.table-robots .image img{width: 200px;}

/*.table-items div.header.header_fixed {position: fixed;top:0;}*/

.text-blue {color: #4a8fe2;}
.group-block {padding: 8px 12px; border: 1px solid #a0a0a0; background: #1c2838; border-radius: 16px;}
.flex-block {display: flex; flex-direction: column;}
.flex-block-8 {display: flex; flex-direction: column; gap: 8px;}
.flex-block-16 {display: flex; flex-direction: column; gap: 16px;}
.flex-block-24 {display: flex; flex-direction: column; gap: 24px;}

.flex-line {display: flex;}
.flex-line-8 {display: flex; gap: 8px;}
.flex-line-16 {display: flex; gap: 16px;}

.fieldInput {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid rgba(33, 45, 69, 0.07);
    padding: 4px 8px 4px 12px;
    color: #21242C;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 20px;
    box-sizing: border-box;
}
.sbmt-btn {
    box-sizing: border-box;
    border-radius: 8px;
    display: flex;
    cursor: pointer;
    text-decoration: none;
    width: max-content;
    color: #21242C;
    font-style: normal;
    font-weight: 500;
    align-items: center;
    font-size: 20px;
    line-height: 20px;
    padding: 8px 12px;
    background-color: #FFFFFF;
    border: 1px solid #b4cbff3d;
}
.alert-danger {color: #E83030FF;}
.relative {position: relative;}
.item-count {position: absolute; bottom: 0; right: 0; color: #FFFFFF;}

.product-list {display: flex;flex-wrap: wrap;gap: 25px;}
.product-item {width: 250px;color: #FFFFFF;}

.white-text {color: #FFFFFF;}
.table {
    --bs-table-striped-color: #a5d0fd !important;
}

.table-items th a {text-decoration: none;}

#stats {
    background-image: url('/images/calc/PnlParamsHero.png');
    height: 750px;
    width: 350px;
    font-size: 14px;
    font-family: Arial, serif;
    gap: 4px;
    background-size: 512px 1024px;
    padding: 0 24px;
}
#stats input {
    display: block;
    width: 40px;
    font-size: 14px;
    border: none;
    padding: 0 4px;
    border-radius: 5px;
    background: #dddd;
    line-height: 14px;
    /*margin-inline-start: auto;*/
}
#stats .statBlock, #robotParamsPanel .statBlock {
    gap: 4px;
}
#robotParamsPanel {
    background-image: url('/images/calc/PnlParamsRobot.png');
    height: 750px;
    width: 350px;
    font-size: 14px;
    font-family: Arial, serif;
    gap: 4px;
    background-size: 512px 1024px;
    padding: 0 24px;
}
#craftPanel {
    background-image: url('/images/craft.png');
    background-repeat: no-repeat;
    height: 437px;
    width: 825px;
    font-size: 14px;
    font-family: Arial, serif;
    gap: 4px;
    background-size: 1024px 512px;
    padding: 0 24px;
}
a.text-blue {
    font-size: 2rem;
    text-decoration: none;
}

/* ===== Адаптивная навигация ===== */

/* Кнопка меню-гамбургер */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #6bb5ff;
    font-size: 1.5em;
    cursor: pointer;
    padding: 10px 20px;
    transition: color 0.3s;
}

.menu-toggle:hover {
    color: #ffffff;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #6bb5ff;
    margin: 5px 0;
    transition: 0.3s;
}

/* Мобильные стили для навигации */
@media (max-width: 768px) {
    /* Показываем кнопку гамбургер */
    .menu-toggle {
        display: block;
        margin: 0 auto;
    }

    /* Скрываем меню по умолчанию */
    nav > ul {
        display: none;
        flex-direction: column;
        align-items: stretch;
    }

    /* Показываем меню когда активно */
    nav.menu-active > ul {
        display: flex;
    }

    /* Вертикальное меню на мобильных */
    nav ul {
        flex-direction: column;
        align-items: stretch;
    }

    nav ul li {
        margin: 0;
    }

    nav ul li a {
        display: block;
        padding: 12px 20px;
        border-bottom: 1px solid #465970;
    }

    /* Подменю */
    nav ul.sub-menu {
        display: none !important; /* Переопределяем hover */
        position: static !important;
        width: 100%;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
        background: #15202e;
        top: auto;
        left: auto;
    }

    /* Открытое подменю */
    nav li.open > .sub-menu {
        display: flex !important;
    }

    /* Вложенные подменю */
    nav .sub-menu .sub-menu {
        background: #0d1620;
        padding-left: 0;
    }

    nav .sub-menu li {
        padding: 0;
    }

    nav .sub-menu li a {
        padding-left: 40px;
    }

    nav .sub-menu .sub-menu li a {
        padding-left: 60px;
    }

    /* Стрелка для элементов с подменю */
    nav li.has-sub > a {
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    nav li.has-sub > a::after {
        content: "▾";
        margin-left: auto;
        padding-left: 10px;
        font-size: 0.9em;
        transition: transform 0.3s ease;
        transform-origin: center;
    }

    nav li.open > a::after {
        transform: rotate(180deg);
    }

    /* Убираем второй уровень вложенности стрелок */
    nav .sub-menu li.has-sub > a::after {
        content: "▸";
        transform: rotate(0deg);
    }

    nav .sub-menu li.open > a::after {
        transform: rotate(90deg);
    }
}

/* Десктопные стили - оставляем hover */
@media (min-width: 769px) {
    /* Убираем классы для мобильной версии на десктопе */
    nav li.has-sub > a::after {
        display: none;
    }
}

/* Индикаторы сортировки для таблиц */
.table-items th a.sort-asc::after {
    content: " ▲";
    font-size: 0.8em;
}
.table-items th a.sort-desc::after {
    content: " ▼";
    font-size: 0.8em;
}

/* Wiki toolbar */
.wiki-toolbar {
    margin-bottom: 15px;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 100;
    background: #1a1a2e;
    padding: 10px 0;
}
.btn-calculator {
    background: #4a8fe2;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
}
.btn-calculator:hover {
    background: #3a7fd2;
}

/* Выделение выбранной строки */
.table-items tr.selected-row {
    background: #2a5a8a !important;
    outline: 2px solid #4a8fe2;
}

/* Модальное окно калькулятора */
.calculator-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.calculator-content {
    background: #1c2838;
    border-radius: 10px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 20px rgba(74, 143, 226, 0.3);
}
.calculator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #4a8fe2;
}
.calculator-header h3 {
    margin: 0;
    color: #4a8fe2;
}
.btn-close {
    background: none;
    border: none;
    color: #6bb5ff;
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
}
.btn-close:hover {
    color: #fff;
}
.calculator-body {
    padding: 20px;
}
.btn-reset {
    background: #465970;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 15px;
}
.btn-reset:hover {
    background: #5a6d80;
}
.calculator-result h4 {
    color: #6bb5ff;
    margin-bottom: 15px;
}
.result-table {
    width: 100%;
    border-collapse: collapse;
}
.result-table th, .result-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #465970;
}
.result-table th {
    color: #4a8fe2;
    background: #0d1620;
}
.result-table td {
    color: #c7d5e8;
}
.result-table input {
    width: 70px;
    padding: 5px 8px;
    border: 1px solid #4a8fe2;
    border-radius: 4px;
    background: #0d1620;
    color: #fff;
    text-align: center;
}
.result-table input:focus {
    outline: none;
    border-color: #6bb5ff;
    box-shadow: 0 0 5px rgba(74, 143, 226, 0.5);
}
.calculator-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}
.calculator-hint p {
    color: #6bb5ff;
    font-style: italic;
}

/* ===== Адаптивный калькулятор для мобильных ===== */
@media (max-width: 768px) {
    .calculator-modal {
        align-items: flex-start;
        padding: 10px;
    }

    .calculator-content {
        width: 100%;
        max-height: calc(100vh - 20px);
        border-radius: 8px;
        margin-top: 10px;
    }

    .calculator-header {
        padding: 12px 15px;
        position: sticky;
        top: 0;
        background: #1c2838;
        z-index: 1;
    }

    .calculator-header h3 {
        font-size: 1.1em;
    }

    .calculator-body {
        padding: 12px 15px;
    }

    .calculator-result h4 {
        font-size: 0.95em;
        margin-bottom: 10px;
    }

    .result-table th,
    .result-table td {
        padding: 8px 6px;
        font-size: 0.85em;
    }

    .result-table input {
        width: 55px;
        padding: 4px 5px;
        font-size: 0.85em;
    }

    .btn-reset {
        width: 100%;
        padding: 10px;
        margin-top: 12px;
    }

    .calculator-hint {
        min-height: 100px;
    }

    .calculator-hint p {
        font-size: 0.9em;
        text-align: center;
        padding: 0 10px;
    }
}

/* ===== Адаптивные таблицы для мобильных ===== */

/* Предотвращаем расширение страницы таблицей */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Обёртка для таблицы с горизонтальной прокруткой */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -10px;
    padding: 0 10px;
}

/* Контейнер таблицы с горизонтальной прокруткой (для #wikiApp и .container) */
#wikiApp,
.container:has(.table-items) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 992px) {
    /* Фиксированный первый столбец */
    .table-items th:first-child,
    .table-items td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        min-width: 100px;
        max-width: 140px;
        word-wrap: break-word;
    }

    .table-items th:first-child {
        z-index: 3;
        background: #000;
    }

    .table-items .odd td:first-child {
        background: #1F3B5C;
    }

    .table-items .even td:first-child {
        background: #153152;
    }

    .table-items tr.selected-row td:first-child {
        background: #2a5a8a;
    }

    /* Тень для индикации прокрутки */
    .table-items th:first-child::after,
    .table-items td:first-child::after {
        content: '';
        position: absolute;
        top: 0;
        right: -8px;
        bottom: 0;
        width: 8px;
        background: linear-gradient(to right, rgba(0,0,0,0.4), transparent);
        pointer-events: none;
    }
}