/* Общие модалки сайта: загрузки, legal, новости (стиль «Начать игру») */

:root {
    --sm-bg: #171412;
    --sm-bg-2: #1d1916;
    --sm-panel: rgba(28, 24, 21, 0.96);
    --sm-border: rgba(196, 154, 95, 0.28);
    --sm-border-strong: rgba(212, 168, 104, 0.55);
    --sm-gold: #d4a868;
    --sm-gold-2: #e8c48a;
    --sm-gold-dark: #a67c4a;
    --sm-text: #f3ece3;
    --sm-muted: #9a9084;
    --sm-radius: 0;
    --sm-font: "DIN Next W1G", Tahoma, Arial, sans-serif;
}

/* Широкие модалки поверх темы (.mdl max-width ~550px) */
.mdl--wide,
.mdl--legal,
.mdl:has(.mdl__inner--downloads),
.mdl:has(.mdl__inner--news),
.mdl:has(.sm-modal--legal) {
    max-width: min(96vw, 980px) !important;
    width: 100%;
}

.mdl--wide .mdl__inner,
.mdl--legal .mdl__inner,
.mdl__inner--downloads,
.mdl__inner--news,
.sm-modal {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.mdl--wide .mdl__body,
.mdl--legal .mdl__body,
.mdl:has(.mdl__inner--downloads) .mdl__body,
.mdl:has(.sm-modal--legal) .mdl__body {
    overflow: visible;
}

/* Каркас Fancybox + inner без «квадрата» темы */
.sm-modal.mdl__inner,
.mdl__inner.sm-modal {
    position: relative;
    padding: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    color: var(--sm-text);
    font-family: var(--sm-font);
}

/* Fancybox дублирует крестик — оставляем только .sm-modal__close */
.fancybox-slide--html .fancybox-close-small,
.fancybox-container .fancybox-button--close {
    display: none !important;
}

.sm-modal__close,
.sm-modal .mdl__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 30;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--sm-border);
    border-radius: 0;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.35);
    color: transparent;
    font-size: 0;
    opacity: 0.9;
    transition: border-color 0.2s, background 0.2s, opacity 0.2s;
}

.sm-modal__close::before,
.sm-modal__close::after,
.sm-modal .mdl__close::before,
.sm-modal .mdl__close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 1.5px;
    background: var(--sm-gold);
    border-radius: 1px;
}

.sm-modal__close::before,
.sm-modal .mdl__close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.sm-modal__close::after,
.sm-modal .mdl__close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.sm-modal__close:hover,
.sm-modal .mdl__close:hover {
    opacity: 1;
    border-color: var(--sm-gold);
    background: rgba(212, 168, 104, 0.12);
}

/* Панели */
.sm-panel {
    background: var(--sm-panel);
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius);
    padding: 28px 32px 30px;
    box-sizing: border-box;
    overflow: visible;
}

.sm-panel + .sm-panel {
    margin-top: 14px;
}

.sm-panel__head {
    text-align: center;
    margin-bottom: 22px;
}

.sm-panel__title {
    margin: 0 0 8px;
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.2;
}

.sm-panel__subtitle {
    margin: 0 auto;
    max-width: 36rem;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--sm-muted);
}

.sm-accent {
    color: var(--sm-gold);
}

.sm-panel__cta {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.sm-panel--account {
    padding-top: 34px;
    padding-bottom: 34px;
}

.sm-panel--account .sm-panel__head {
    margin-bottom: 18px;
}

/* Предупреждение */
.sm-warning {
    margin: 0 0 18px;
    padding: 12px 16px;
    text-align: center;
    background: rgba(140, 20, 20, 0.18);
    border: 1px solid rgba(180, 40, 40, 0.35);
    border-radius: 0;
}

.sm-warning p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #d4c8bc;
}

/* Сетка загрузок */
.sm-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 28px 36px;
    align-items: start;
    min-width: 0;
}

.sm-files,
.sm-aside {
    min-width: 0;
    overflow: visible;
}

.sm-files__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.files__server-content {
    display: none;
    width: 100%;
}

.files__server-content--active {
    display: block;
}

.sm-file {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 12px 14px;
    background: rgba(20, 17, 15, 0.65);
    border: 1px solid var(--sm-border);
    border-radius: 0;
    box-sizing: border-box;
    position: relative;
    overflow: visible;
}

.sm-file__icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 0;
    border: 1px solid var(--sm-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sm-gold);
    background: rgba(212, 168, 104, 0.06);
}

.sm-file__icon svg {
    width: 20px;
    height: 20px;
}

.sm-file__info {
    flex: 1 1 auto;
    min-width: 0;
}

.sm-file__title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    text-transform: none;
    letter-spacing: 0.01em;
}

.sm-file__desc {
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--sm-muted);
    line-height: 1.3;
}

/* Кнопки */
.sm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    text-decoration: none;
    text-transform: uppercase;
    font-family: var(--sm-font);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    border-radius: 0;
    cursor: pointer;
    transition: filter 0.2s, background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.sm-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sm-btn--gold {
    padding: 10px 18px;
    color: #1a120a;
    border: 0;
    background: linear-gradient(180deg, var(--sm-gold-2) 0%, var(--sm-gold) 45%, var(--sm-gold-dark) 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.sm-btn--gold:hover {
    filter: brightness(1.08);
    color: #1a120a;
    transform: translateY(-1px);
}

.sm-btn--gold.is-disabled,
.sm-file.is-disabled .sm-btn--gold {
    opacity: 0.45;
    pointer-events: none;
    filter: none;
    transform: none;
    cursor: default;
}

.sm-btn--lg {
    padding: 14px 36px;
    font-size: 0.9rem;
    min-width: 220px;
}

.sm-btn--outline {
    padding: 9px 14px;
    color: #fff;
    background: transparent;
    border: 1px solid var(--sm-border-strong);
}

.sm-btn--outline:hover {
    background: rgba(212, 168, 104, 0.1);
    border-color: var(--sm-gold);
    color: #fff;
}

/* Правая колонка */
.sm-aside {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.sm-aside__title {
    margin: 0 0 12px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sm-gold);
    text-transform: none;
}

.sm-steps {
    margin: 0;
    padding: 0 0 0 1.25rem;
    list-style: decimal;
    color: var(--sm-text);
}

.sm-steps li {
    margin: 0 0 8px;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #ddd4c8;
}

.sm-steps li::before {
    content: none;
}

.sm-social {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Legal / text modals */
.sm-modal--legal .sm-panel,
.mdl--legal .sm-panel {
    max-height: min(78vh, 820px);
    display: flex;
    flex-direction: column;
    padding: 28px 28px 22px;
}

.sm-legal {
    margin-top: 4px;
    overflow: auto;
    padding-right: 8px;
    max-height: min(58vh, 620px);
    color: #cfc5b8;
    font-size: 0.9rem;
    line-height: 1.55;
}

.sm-legal::-webkit-scrollbar {
    width: 6px;
}

.sm-legal::-webkit-scrollbar-thumb {
    background: rgba(212, 168, 104, 0.35);
    border-radius: 0;
}

.sm-legal p {
    margin: 0 0 0.85rem;
}

.sm-legal a {
    color: var(--sm-gold);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sm-legal a:hover {
    color: var(--sm-gold-2);
}

.sm-legal h2,
.sm-legal h3,
.sm-legal strong {
    color: var(--sm-text);
}

.sm-legal h2 {
    margin: 1.25rem 0 0.65rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--sm-gold);
}

/* Новости */
.mdl__inner--news.sm-modal .mdl__body,
.mdl:has(.mdl__inner--news) .mdl__body {
    padding: 28px 28px 22px;
    background: var(--sm-panel);
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius);
    overflow: hidden;
}

.mdl__inner--news .mdl__title,
.mdl--legal .sm-panel__title {
    text-align: center;
}

.news-modal-content,
.mdl__inner--news .text__content {
    color: #cfc5b8;
    font-size: 0.92rem;
    line-height: 1.55;
}

.news-modal-content a,
.mdl__inner--news .text__content a {
    color: var(--sm-gold);
}

/* Выбор сервера внутри новой модалки — компактнее */
.sm-servers {
    margin: 0 0 16px !important;
}

.sm-servers .downloads__server-title {
    font-size: 0.95rem;
    margin-bottom: 10px;
    letter-spacing: 1.2px;
}

.sm-servers .downloads__server-buttons {
    gap: 0.65rem;
}

.sm-servers .downloads__server-btn {
    min-width: 13.5rem;
    min-height: 0;
    padding: 0.8rem 1.05rem;
    padding-right: 3.4rem;
    border-radius: 0;
}

.sm-servers .downloads__server-name {
    font-size: 0.9rem;
}

.sm-servers .downloads__server-desc {
    font-size: 0.74rem;
}

.sm-servers .downloads__server-soon {
    top: 0.4rem;
    right: 0.4rem;
}

/* Адаптив */
@media (max-width: 820px) {
    .sm-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .sm-panel {
        padding: 22px 18px 24px;
    }

    .sm-file {
        flex-wrap: wrap;
    }

    .sm-file .sm-btn--gold {
        width: 100%;
    }

    .sm-social {
        justify-content: flex-start;
    }

    .sm-btn--lg {
        width: 100%;
        min-width: 0;
    }
}

/* Источники загрузки */
.sm-dl {
    position: relative;
    flex-shrink: 0;
}

.sm-dl__toggle {
    gap: 6px;
}

.sm-dl__chev {
    width: 12px;
    height: 12px;
    margin-left: 2px;
}

.sm-dl__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 40;
    min-width: 15.5rem;
    padding: 6px;
    background: #1a1613;
    border: 1px solid var(--sm-border-strong);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}

.sm-dl:hover .sm-dl__menu,
.sm-dl.is-open .sm-dl__menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.sm-dl__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    text-decoration: none;
    color: var(--sm-text);
    border: 1px solid transparent;
}

.sm-dl__item:hover {
    background: rgba(212, 168, 104, 0.1);
    border-color: var(--sm-border);
    color: #fff;
}

.sm-dl__ico {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    color: #1a120a;
    background: linear-gradient(180deg, var(--sm-gold-2) 0%, var(--sm-gold) 100%);
}

.sm-dl__item--yandex .sm-dl__ico { background: linear-gradient(180deg, #ffd54a 0%, #fc0 100%); }
.sm-dl__item--google .sm-dl__ico { background: linear-gradient(180deg, #8ab4f8 0%, #4285f4 100%); color: #fff; }
.sm-dl__item--torrent .sm-dl__ico { background: linear-gradient(180deg, #9ad27a 0%, #5a9a3a 100%); color: #10200a; }

.sm-dl__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sm-dl__name {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
}

.sm-dl__hint {
    font-size: 0.7rem;
    color: var(--sm-muted);
    line-height: 1.25;
}

@media (max-width: 820px) {
    .sm-dl,
    .sm-dl__toggle {
        width: 100%;
    }

    .sm-dl__menu {
        left: 0;
        right: 0;
        min-width: 0;
    }
}

/* Каркас Fancybox/темы — острые углы */
.mdl__inner,
.fancybox-slide--html .fancybox-content,
.mdl .downloads__server-btn,
.mdl .downloads__server-btn::before {
    border-radius: 0 !important;
}
