/* ============================================================================
   ВНЕШНИЕ ПЕРЕХОДЫ (public/js/ext-gate.js)
   Спокойное окно подтверждения: фото сверху, заголовок, одна фраза, адрес
   и две кнопки. Одна короткая анимация появления, без постоянных эффектов.
   ========================================================================== */
html.xg-lock { overflow: hidden; }
.xg[hidden] { display: none !important; }
.xg {
    position: fixed; inset: 0; z-index: 2147483000;
    display: grid; place-items: center;
    padding: 20px;
    font-family: "Inter", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.xg *, .xg *::before, .xg *::after { box-sizing: border-box; }

.xg__veil {
    position: absolute; inset: 0;
    background: rgba(5, 5, 6, .74);
    -webkit-backdrop-filter: blur(3px);
            backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .22s ease;
}
.xg.is-on .xg__veil { opacity: 1; }

.xg__card {
    position: relative;
    width: min(460px, 100%);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 16px;
    background: #121214;
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .85);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .26s ease, transform .3s cubic-bezier(.2, .8, .2, 1);
}
.xg.is-on .xg__card { opacity: 1; transform: none; }

/* фото: плавно переходит в фон карточки */
.xg__media { position: relative; height: 200px; overflow: hidden; }
.xg__bg {
    position: absolute; inset: 0;
    background: center / cover no-repeat;
    transform: scale(1.04);
    transition: transform .7s cubic-bezier(.2, .8, .2, 1);
}
.xg.is-on .xg__bg { transform: none; }
.xg__media::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(18, 18, 20, 0) 45%, #121214 100%);
}

.xg__x {
    position: absolute; top: 12px; right: 12px; z-index: 1;
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: rgba(0, 0, 0, .45);
    color: #e8e8e8;
    cursor: pointer;
    transition: background .15s ease;
}
.xg__x:hover { background: rgba(0, 0, 0, .7); }
.xg__x svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.xg__body { padding: 4px 24px 22px; }
.xg__title {
    margin: 0 0 8px;
    font-family: "Montserrat", "Inter", sans-serif;
    font-size: 21px; font-weight: 700; line-height: 1.3;
    color: #fff;
}
.xg__text { margin: 0 0 14px; font-size: 14.5px; line-height: 1.55; color: #a9a9ad; }

.xg__dest {
    display: flex; align-items: center; gap: 8px;
    margin: 0 0 20px;
    min-width: 0;
    font-size: 13.5px; line-height: 20px;
    color: #8c8c91;
}
.xg__dest-ico {
    flex: 0 0 auto;
    width: 16px; height: 16px;
    background: currentColor;
    -webkit-mask: var(--ico) center / contain no-repeat;
            mask: var(--ico) center / contain no-repeat;
    --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c2.8 3 2.8 15 0 18M12 3c-2.8 3-2.8 15 0 18'/%3E%3C/svg%3E");
}
.xg[data-kind="discord"] .xg__dest-ico {
    color: #8b95ff;
    --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M20.32 4.37a19.8 19.8 0 0 0-4.89-1.52c-.21.38-.44.87-.6 1.25a18.3 18.3 0 0 0-5.49 0 12.6 12.6 0 0 0-.62-1.25 19.7 19.7 0 0 0-4.88 1.52C.53 9.05-.32 13.58.1 18.06a19.9 19.9 0 0 0 6.1 3.09c.46-.63.87-1.3 1.22-1.99a13.1 13.1 0 0 1-1.9-.92l.38-.3c3.93 1.8 8.18 1.8 12.06 0l.38.3c-.6.36-1.24.66-1.9.92.36.7.77 1.36 1.22 1.99a19.8 19.8 0 0 0 6.1-3.09c.5-5.18-.84-9.67-3.55-13.69zM8.02 15.33c-1.18 0-2.16-1.09-2.16-2.42s.96-2.42 2.16-2.42c1.21 0 2.18 1.1 2.16 2.42 0 1.33-.96 2.42-2.16 2.42zm7.98 0c-1.18 0-2.16-1.09-2.16-2.42s.96-2.42 2.16-2.42c1.21 0 2.18 1.1 2.16 2.42 0 1.33-.95 2.42-2.16 2.42z'/%3E%3C/svg%3E");
}
.xg[data-kind="steam"] .xg__dest-ico {
    --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round'%3E%3Ccircle cx='16' cy='8' r='3.2'/%3E%3Ccircle cx='8' cy='16' r='2.3'/%3E%3Cpath d='M13.4 10.2 9.8 14.3M2.5 13.5l3.6 1.6'/%3E%3C/svg%3E");
}
.xg__dest-url { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xg__dest-url b { font-weight: 500; color: #dcdce0; }

.xg__actions { display: flex; gap: 10px; }
.xg__go, .xg__stay {
    height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.xg__go { flex: 1 1 auto; color: #fff; }
.xg__stay { border: 1px solid rgba(255, 255, 255, .14); background: transparent; color: #cfcfd3; }
.xg__stay:hover { border-color: rgba(255, 255, 255, .26); background: rgba(255, 255, 255, .04); color: #fff; }
.xg__go:focus-visible, .xg__stay:focus-visible, .xg__x:focus-visible,
.xg__remember input:focus-visible { outline: 2px solid #8b95ff; outline-offset: 2px; }

.xg__remember {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 14px;
    font-size: 12.5px; line-height: 16px;
    color: #76767b;
    cursor: pointer; user-select: none;
}
.xg__remember[hidden] { display: none; }

@media (max-width: 520px) {
    .xg { padding: 12px; }
    .xg__media { height: 170px; }
    .xg__body { padding: 2px 18px 18px; }
    .xg__title { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
    .xg__card, .xg__bg { transition: opacity .15s ease; transform: none !important; }
}

/* ---- грань карточки: светлее сверху, тает к низу --------------------------- */
.xg__card {
    border-color: transparent;
    background:
        linear-gradient(180deg, #131315, #101012) padding-box,
        linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .04) 60%, rgba(255, 255, 255, .02)) border-box;
}

/* ---- адрес — аккуратной плашкой ---------------------------------------------- */
.xg__dest {
    display: inline-flex;
    max-width: 100%;
    padding: 7px 11px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 9px;
    background: rgba(255, 255, 255, .03);
}

/* ---- основная кнопка: цвет затекает из двух углов ---------------------------------
   Не сплошная заливка: тёмная основа, из правого верхнего и левого нижнего углов
   разливается цвет кнопки, грань по той же диагонали ярче у углов, снаружи у углов —
   мягкий ореол. При наведении цвет разливается шире. */
@property --xg-pour { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
.xg__go {
    --c: 207, 41, 41;
    position: relative;
    border: 1px solid transparent;
    background:
        radial-gradient(calc(40% + var(--xg-pour)) calc(140% + var(--xg-pour)) at 100% 0%, rgba(var(--c), .8), rgba(var(--c), .26) 38%, rgba(var(--c), 0) 72%) padding-box,
        radial-gradient(calc(40% + var(--xg-pour)) calc(140% + var(--xg-pour)) at 0% 100%, rgba(var(--c), .66), rgba(var(--c), .2) 38%, rgba(var(--c), 0) 72%) padding-box,
        linear-gradient(rgba(var(--c), .05), rgba(var(--c), .05)) padding-box,
        linear-gradient(#141417, #141417) padding-box,
        linear-gradient(to bottom left, rgba(var(--c), .95), rgba(var(--c), .07) 36%, rgba(var(--c), .07) 64%, rgba(var(--c), .8)) border-box;
    transition: --xg-pour .55s cubic-bezier(.2, .8, .2, 1);
}
.xg[data-kind="discord"] .xg__go { --c: 88, 101, 242; }
.xg__go::before {
    content: "";
    position: absolute; inset: -5px;
    z-index: -1;
    border-radius: 14px;
    background:
        radial-gradient(38% 90% at 100% 0%, rgba(var(--c), .6), rgba(var(--c), 0) 70%),
        radial-gradient(38% 90% at 0% 100%, rgba(var(--c), .5), rgba(var(--c), 0) 70%);
    filter: blur(9px);
    opacity: .4;
    transition: opacity .45s ease;
    pointer-events: none;
}
.xg__go:hover { --xg-pour: 14%; }
.xg__go:hover::before, .xg__go:focus-visible::before { opacity: .85; }

/* ---- «Не спрашивать» — строка с переключателем -------------------------------- */
.xg__remember {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 10px;
    background: rgba(255, 255, 255, .025);
    font-size: 13px; line-height: 18px;
    color: #8d8d93;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.xg__remember:hover { background: rgba(255, 255, 255, .045); border-color: rgba(255, 255, 255, .1); color: #b9b9be; }
.xg__remember input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.xg__sw {
    position: relative; flex: 0 0 auto;
    width: 30px; height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    transition: background-color .2s ease;
}
.xg__sw::after {
    content: "";
    position: absolute; top: 2px; left: 2px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #d4d4d8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .45);
    transition: transform .22s cubic-bezier(.3, .7, .2, 1), background-color .2s ease;
}
.xg__remember input:checked + .xg__sw { background: #cf2929; }
.xg[data-kind="discord"] .xg__remember input:checked + .xg__sw { background: #5865f2; }
.xg__remember input:checked + .xg__sw::after { transform: translateX(12px); background: #fff; }
.xg__remember input:focus-visible + .xg__sw { outline: 2px solid #8b95ff; outline-offset: 2px; }
.xg__rh { font-weight: 600; color: #cfcfd4; }

/* ===========================================================================
   ПОЯВЛЕНИЕ: ШТОРКА И ЛЁГКАЯ УПРУГОСТЬ
   Окно поднимается с небольшим «дожимом» в конце, фото открывается сверху
   вниз, как поднятая штора, текст и кнопки появляются следом по очереди.
   Под курсором окно чуть наклоняется (до 3°) — только мышью.
   Закрытие — быстрое и без эффектов.
   =========================================================================== */
.xg__card {
    translate: 0 16px;
    scale: .965;
    transform: perspective(1000px) rotateX(4deg);
    transition: opacity .2s ease, translate .22s ease, scale .22s ease, transform .22s ease;
}
.xg.is-on .xg__card {
    translate: 0 0;
    scale: 1;
    transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: opacity .28s ease,
                translate .62s cubic-bezier(.22, 1.28, .36, 1),
                scale .62s cubic-bezier(.22, 1.28, .36, 1),
                transform .5s cubic-bezier(.2, .8, .2, 1);
}
/* блик, который идёт за курсором при наклоне */
.xg__card::after {
    content: "";
    position: absolute; inset: 0;
    z-index: 3;
    border-radius: inherit;
    background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .06), transparent 60%);
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
}
.xg__card.is-tilt::after { opacity: 1; }


.xg__bg, .xg.is-on .xg__bg { transform: none; scale: none; translate: none; transition: none; }

.xg__body > * { opacity: 0; transform: translateY(8px); transition: opacity .15s ease, transform .15s ease; }
.xg.is-on .xg__body > * {
    opacity: 1; transform: none;
    transition: opacity .38s ease, transform .5s cubic-bezier(.2, .8, .2, 1);
}
.xg.is-on .xg__body > :nth-child(1) { transition-delay: .3s; }
.xg.is-on .xg__body > :nth-child(2) { transition-delay: .36s; }
.xg.is-on .xg__body > :nth-child(3) { transition-delay: .42s; }
.xg.is-on .xg__body > :nth-child(4) { transition-delay: .48s; }
.xg.is-on .xg__body > :nth-child(5) { transition-delay: .54s; }

@media (prefers-reduced-motion: reduce) {
    .xg__card, .xg.is-on .xg__card { translate: none; scale: none; transform: none; transition: opacity .15s ease; }
    .xg__card::after { display: none; }
    .xg__media, .xg.is-on .xg__media { clip-path: none; transition: none; }
    .xg__body > *, .xg.is-on .xg__body > * { opacity: 1; transform: none; transition: none; }
}

.xg__dest[hidden], .xg__stay[hidden] { display: none; }
.xg[data-kind="wip"] .xg__go { --c: 122, 92, 255; }

/* ---- «Начать играть»: сервер и пометка о доработке ---------------------- */
.xg__srv {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    margin: 0 0 20px; padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, .07); border-radius: 10px;
    background: rgba(255, 255, 255, .03);
    font-size: 13.5px; line-height: 20px; color: #8c8c91;
}
.xg__srv[hidden], .xg__note[hidden] { display: none; }
.xg__srv-k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #6f6f75; }
.xg__srv-n { font-weight: 600; color: #ececf0; }
.xg__srv-ip {
    margin-left: auto; padding: 1px 8px; border-radius: 6px;
    font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px;
    color: #cfcfd3; background: rgba(0, 0, 0, .35);
}
.xg[data-kind="play"] .xg__stay { flex: 1 1 auto; border-color: rgba(88, 101, 242, .45); color: #c9cdff; }
.xg[data-kind="play"] .xg__stay:hover { border-color: rgba(88, 101, 242, .8); background: rgba(88, 101, 242, .12); color: #fff; }
.xg__note {
    margin: 16px 0 0; padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, .1);
    font-size: 12.5px; line-height: 1.5; color: #7a7a80;
}
@media (max-width: 520px) {
    .xg[data-kind="play"] .xg__actions { flex-direction: column; }
    .xg__srv-ip { margin-left: 0; }
}
