/* ==========================================================================
   monitoring_style — таблица «Наши сервера» карточками (шаблон SLIM).
   Класс .ms ставит ms.js на .monitoring-table — без него ничего не меняется.
   ========================================================================== */

.ms {
    --ms-primary: rgb(251, 71, 75);
    --ms-card: rgb(36, 39, 49);
    --ms-text: rgb(165, 169, 180);
    --ms-dim: rgba(165, 169, 180, 0.6);
    --ms-green: rgb(36, 227, 77);
    container-type: inline-size;
    background: transparent;
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.ms .monitoring-thead {
    display: none;
}

.ms .monitoring-tbody {
    display: grid;
    gap: 12px;
}

/* Общий онлайн в заголовке секции */
.ms-section .section-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.ms-total {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    color: var(--ms-dim, rgba(165, 169, 180, 0.6));
    background: rgba(255, 255, 255, 0.04);
}

.ms-total i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgb(36, 227, 77);
    animation: ms-pulse 1.8s infinite;
}

.ms-total b {
    color: #fff;
}

@keyframes ms-pulse {
    0% { box-shadow: 0 0 0 0 rgba(36, 227, 77, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(36, 227, 77, 0); }
    100% { box-shadow: 0 0 0 0 rgba(36, 227, 77, 0); }
}

/* ------------------------------ Карточка ------------------------------- */

.ms .monitoring-row {
    grid-template-columns: 132px minmax(0, 1fr) 170px minmax(0, 190px) auto;
    grid-template-areas:
        "thumb name name    name actions"
        "thumb map  players ip   actions";
    gap: 8px 16px;
    padding: 14px 18px 14px 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    isolation: isolate;
    background: var(--ms-card);
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.ms .monitoring-row:last-child {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ms .monitoring-row:hover {
    background: var(--ms-card);
    border-color: rgba(251, 71, 75, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
}

/* Размытая картинка карты на фоне слева */
.ms .monitoring-row::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 45% 0 0;
    width: auto;
    opacity: 0.22;
    background: var(--ms-map, none) center / cover no-repeat;
    filter: blur(18px) saturate(1.3);
    transform: scale(1.2);
    -webkit-mask-image: linear-gradient(90deg, #000 30%, transparent);
    mask-image: linear-gradient(90deg, #000 30%, transparent);
    transition: opacity 0.3s ease;
}

.ms .monitoring-row:hover::before {
    opacity: 0.32;
}

/* Красная полоска слева */
.ms .monitoring-row::after {
    content: "";
    position: absolute;
    left: 0;
    top: 18%;
    bottom: 18%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--ms-primary);
    transition: top 0.25s ease, bottom 0.25s ease;
}

.ms .monitoring-row:hover::after {
    top: 0;
    bottom: 0;
}

.ms .monitoring-td-label {
    display: none !important;
}

.ms .monitoring-td {
    justify-content: flex-start;
}

/* Миниатюра карты */
.ms-thumb {
    grid-area: thumb;
    position: relative;
    align-self: stretch;
    min-height: 74px;
    border-radius: 8px;
    overflow: hidden;
    background: rgb(28, 30, 38);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.ms-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.ms .monitoring-row:hover .ms-thumb img {
    transform: scale(1.08);
}

.ms-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Название */
.ms .monitoring-col-name {
    grid-area: name;
    align-self: end;
}

.ms .monitoring-name-text {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.ms .monitoring-game-icon {
    flex-basis: 22px;
    width: 22px;
    height: 22px;
}

/* Статус и карта */
.ms .monitoring-col-map {
    grid-area: map;
    align-self: center;
    justify-content: flex-start;
}

.ms .monitoring-map {
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--ms-text);
}

.ms-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ms-green);
    background: rgba(36, 227, 77, 0.1);
}

.ms-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.ms-status--off {
    color: var(--ms-dim);
    background: rgba(255, 255, 255, 0.05);
}

.ms-status--off::before {
    box-shadow: none;
}

.ms .monitoring-map i {
    color: var(--ms-primary);
    opacity: 0.8;
}

/* Игроки */
.ms .monitoring-col-players {
    grid-area: players;
}

.ms .monitoring-players {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 6px 8px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 6px 10px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    transition: background 0.2s ease;
}

.ms .monitoring-players:hover {
    background: rgba(251, 71, 75, 0.1);
}

.ms .monitoring-players-count {
    font-size: 1rem;
    text-align: left;
    color: #fff;
}

.ms-players-hint {
    justify-self: end;
    font-size: 0.6875rem;
    white-space: nowrap;
    color: var(--ms-dim);
}

.ms .monitoring-players .progress {
    grid-column: 1 / -1;
    width: 100%;
    height: 6px;
}

.ms .monitoring-players .progress-bar {
    box-shadow: 0 0 10px currentColor;
}

.ms .monitoring-players .progress-bar.bg-success {
    color: rgba(36, 227, 77, 0.5);
    background: linear-gradient(90deg, rgb(25, 170, 60), rgb(36, 227, 77));
}

.ms .monitoring-players .progress-bar.bg-warning {
    color: rgba(255, 189, 64, 0.5);
    background: linear-gradient(90deg, rgb(230, 150, 30), rgb(255, 189, 64));
}

.ms .monitoring-players .progress-bar.bg-danger {
    color: rgba(251, 71, 75, 0.5);
    background: linear-gradient(90deg, rgb(200, 40, 50), rgb(251, 71, 75));
}

/* IP */
.ms .monitoring-col-ip {
    grid-area: ip;
}

.ms .monitoring-ip-wrap {
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.ms .monitoring-ip {
    flex: 1 1 auto;
    min-width: 0;
    padding: 9px 12px;
    border-radius: 0;
    font-size: 0.8125rem;
    color: #fff;
    background: transparent;
}

.ms .monitoring-copy-btn {
    align-self: stretch;
    height: auto;
    border-radius: 0;
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
}

.ms .monitoring-copy-btn:hover {
    color: #fff;
    background: var(--ms-primary);
}

/* Кнопка «Играть» */
.ms .monitoring-col-actions {
    grid-area: actions;
}

.ms .ms-play {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(251, 71, 75, 0.3);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.ms .ms-play:hover {
    box-shadow: 0 10px 26px rgba(251, 71, 75, 0.5);
}

.ms .ms-play i {
    transition: transform 0.25s ease;
}

.ms .ms-play:hover i {
    transform: translate(2px, -2px) rotate(45deg);
}

/* Сервер выключен */
.ms .monitoring-row.ms-off .ms-thumb img {
    filter: grayscale(1) brightness(0.6);
}

/* -------------------------------- Адаптив -------------------------------- */

@container (max-width: 760px) {
    .ms .monitoring-row {
        grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "thumb name    name"
            "thumb map     map"
            "players players players"
            "ip    ip      actions";
        gap: 10px 14px;
        padding: 14px;
    }

    .ms-thumb {
        min-height: 70px;
    }

    .ms .monitoring-col-actions {
        justify-content: flex-end;
    }

    .ms .monitoring-name-text {
        white-space: normal;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
}

@container (max-width: 420px) {
    .ms .monitoring-row {
        grid-template-columns: 84px minmax(0, 1fr);
        grid-template-areas:
            "thumb   name"
            "thumb   map"
            "players players"
            "ip      ip"
            "actions actions";
    }

    .ms-thumb {
        min-height: 60px;
    }

    .ms .monitoring-name-text {
        font-size: 0.9375rem;
    }

    .ms .monitoring-col-actions,
    .ms .monitoring-actions {
        justify-content: stretch;
    }

    .ms .monitoring-actions,
    .ms .ms-play {
        flex: 1 1 auto;
        justify-content: center;
    }
}

@media (max-width: 575.98px) {
    .ms-total {
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ms .monitoring-row,
    .ms-total i,
    .ms-thumb img {
        animation: none;
        transition: none;
    }
}

/* ==========================================================================
   Баннер «Как начать играть» — вместо «Наших серверов» на главной,
   пока посетитель не вошёл или не указал в профиле ник и Steam ID (ms.js).
   Маршрут из трёх шагов; последний — живой сервер из скрытой таблицы.
   ========================================================================== */

/* Ответа status.php ещё не было ни разу — блок серверов пока не показываем */
html.ms-gate-wait .section:has(#servers) {
    visibility: hidden;
}

.section.ms-gated {
    display: none !important;
}

.ms-start {
    --ms-primary: rgb(251, 71, 75);
    --ms-card: rgb(36, 39, 49);
    --ms-deep: rgb(27, 29, 37);
    --ms-text: rgb(165, 169, 180);
    --ms-green: rgb(36, 227, 77);
    --ms-line: rgba(255, 255, 255, 0.08);
    container-type: inline-size;
    position: relative;
    padding: 24px 28px 26px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    isolation: isolate;
    color: var(--ms-text);
    background: var(--ms-card);
}

/* Размытая карта сервера справа, за персонажами — как фон карточки мониторинга */
.ms-start::before {
    content: "";
    position: absolute;
    z-index: -2;
    inset: 0 0 0 50%;
    opacity: 0.28;
    background: var(--ms-map, none) center / cover no-repeat;
    filter: blur(20px) saturate(1.3);
    transform: scale(1.2);
    -webkit-mask-image: linear-gradient(270deg, #000 35%, transparent);
    mask-image: linear-gradient(270deg, #000 35%, transparent);
}

/* Красная полоска слева — как у карточки сервера */
.ms-start::after {
    content: "";
    position: absolute;
    left: 0;
    top: 24px;
    bottom: 24px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--ms-primary);
}

.ms-start__person {
    position: absolute;
    z-index: -1;
    right: -120px;
    bottom: 0;
    height: 100%;
    max-height: 340px;
    width: auto;
    max-width: none;
    pointer-events: none;
    filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.5));
    -webkit-mask-image: linear-gradient(90deg, transparent 22%, #000 40%);
    mask-image: linear-gradient(90deg, transparent 22%, #000 40%);
}

.ms-start__head,
.ms-route {
    max-width: calc(100% - 230px);
}

.ms-start__title {
    margin: 0 0 6px;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
}

.ms-start__lead {
    max-width: 52ch;
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
}

/* ------------------------------- Маршрут -------------------------------- */

.ms-route {
    display: grid;
    gap: 6px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}

.ms-route__step {
    position: relative;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-areas:
        "node title actions"
        "node body  actions";
    align-items: center;
    gap: 4px 16px;
    padding: 12px 14px 12px 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.16);
}

/* Линия между узлами */
.ms-route__step:not(:last-child)::after {
    content: "";
    position: absolute;
    z-index: 1;
    left: 27px;
    top: calc(50% + 16px);
    height: calc(100% - 26px);
    width: 2px;
    background: var(--ms-line);
}

.ms-route__step.is-current {
    background: rgba(251, 71, 75, 0.07);
    box-shadow: inset 0 0 0 1px rgba(251, 71, 75, 0.25);
}

.ms-route__node {
    grid-area: node;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 700;
    color: #fff;
    background: var(--ms-deep);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.is-current .ms-route__node {
    background: var(--ms-primary);
    box-shadow: 0 0 0 4px rgba(251, 71, 75, 0.18);
}

.ms-route__node--live {
    background: rgb(28, 44, 36);
    box-shadow: inset 0 0 0 1px rgba(36, 227, 77, 0.3);
}

.ms-route__node--live i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ms-green);
    animation: ms-pulse 1.8s infinite;
}

.is-off .ms-route__node--live {
    background: var(--ms-deep);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.is-off .ms-route__node--live i {
    background: var(--ms-text);
    animation: none;
}

.ms-route__title {
    grid-area: title;
    align-self: end;
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
}

.ms-route__text,
.ms-route__checks {
    grid-area: body;
    align-self: start;
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.ms-route__live {
    color: var(--ms-green);
}

.is-off .ms-route__live {
    color: var(--ms-text);
}

/* Чек-лист профиля: что уже есть, чего не хватает */
.ms-route__checks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 0 0;
    list-style: none;
}

.ms-route__check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgb(255, 150, 152);
    background: rgba(251, 71, 75, 0.1);
}

.ms-route__check.is-ok {
    color: var(--ms-green);
    background: rgba(36, 227, 77, 0.1);
}

.ms-route__actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: stretch;
    gap: 8px;
}

.ms-route .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.ms-route .btn[hidden] {
    display: none;
}

.ms-route__play i {
    color: var(--ms-primary);
}

/* IP сервера с копированием — как в карточке мониторинга */
.ms-route__ip {
    display: inline-flex;
    align-items: stretch;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.ms-route__ip-text {
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: #fff;
}

.ms-route__copy {
    width: 36px;
    border: 0;
    color: var(--ms-text);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.ms-route__copy:hover {
    color: #fff;
    background: var(--ms-primary);
}

.ms-route__copy.is-done {
    color: #fff;
    background: rgb(30, 160, 60);
}

.ms-route__copy:focus-visible,
.ms-route .btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* -------------------------------- Адаптив -------------------------------- */

@container (max-width: 720px) {
    .ms-start__person,
    .ms-start::before {
        display: none;
    }

    .ms-start__head,
    .ms-route {
        max-width: none;
    }
}

@container (max-width: 520px) {
    .ms-route__step {
        grid-template-columns: 32px minmax(0, 1fr);
        grid-template-areas:
            "node title"
            "node body"
            ".    actions";
        gap: 4px 12px;
    }

    .ms-route__actions {
        justify-content: flex-start;
        margin-top: 8px;
    }

    .ms-route__node {
        align-self: start;
    }

    .ms-route__step:not(:last-child)::after {
        top: 44px;
        height: calc(100% - 38px);
    }
}

@media (max-width: 575.98px) {
    .ms-start {
        padding: 20px 16px 18px;
    }

    .ms-start::after {
        top: 20px;
        bottom: auto;
        height: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ms-route__node--live i {
        animation: none;
    }
}
