/* ============================================================
   GAMES MYMANITIKYL — стили
   ============================================================ */

:root {
    --bg-1: #07071a;
    --bg-2: #0d0b2c;
    --bg-3: #1a0b3a;
    --accent: #7c3aed;
    --accent-2: #06d6ff;
    --accent-3: #ff3fb4;
    --accent-4: #ffd166;
    --text: #e8eaff;
    --text-dim: #a4a8c8;
    --card: rgba(255, 255, 255, 0.04);
    --card-border: rgba(255, 255, 255, 0.08);
    --green: #21d07a;
    --red: #ff4d6d;
    --radius: 18px;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    --font-display: 'Orbitron', system-ui, sans-serif;
    --font-body: 'Rubik', system-ui, sans-serif;
    --header-h: 62px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg-1);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    scroll-padding-top: 68px;
}

body {
    position: relative;
    background: var(--bg-1);
}
body.no-scroll { overflow: hidden; }

/* Слои фона — все в одной обёртке с положительными z-index */
.bg-layers {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.bg-layers > * {
    position: absolute;
    inset: 0;
}
.page-wrap {
    position: relative;
    z-index: 10;
    padding-top: var(--header-h);
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent-3); }

/* ====== Preloader ====== */
#preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(ellipse at center, #110a35 0%, #050516 75%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .6s ease, visibility .6s ease;
}
#preloader.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.preloader-inner { text-align: center; }
.loader-ring {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 24px;
}
.loader-ring span {
    position: absolute;
    inset: 0;
    border: 3px solid transparent;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}
.loader-ring span:nth-child(2) { inset: 10px; border-top-color: var(--accent-2); animation-duration: 1.6s; animation-direction: reverse; }
.loader-ring span:nth-child(3) { inset: 20px; border-top-color: var(--accent-3); animation-duration: 2.0s; }
.loader-ring span:nth-child(4) { inset: 30px; border-top-color: var(--accent-4); animation-duration: 2.4s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

.preloader-text {
    font-family: var(--font-display);
    letter-spacing: .4em;
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
}
.preloader-text .dots i {
    font-style: normal;
    opacity: .25;
    animation: dot 1.2s infinite;
}
.preloader-text .dots i:nth-child(2) { animation-delay: .2s; }
.preloader-text .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* ====== Background ====== */
#bg-stars-canvas {
    width: 100%;
    height: 100%;
    z-index: 1;
}
#bg-canvas {
    width: 100%;
    height: 100%;
    z-index: 2;
}
.bg-grid {
    z-index: 3;
    background-image:
        linear-gradient(rgba(124, 58, 237, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, 0.08) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
    animation: gridShift 20s linear infinite;
    pointer-events: none;
}
@keyframes gridShift {
    from { background-position: 0 0, 0 0; }
    to   { background-position: 60px 60px, 60px 60px; }
}
.bg-gradient {
    z-index: 5;
    background:
        radial-gradient(800px 600px at 70% 20%, rgba(124, 58, 237, 0.18), transparent 70%),
        radial-gradient(700px 500px at 20% 80%, rgba(6, 214, 255, 0.12),  transparent 70%);
}

/* Плавающие световые пятна — фон живёт даже без курсора */
.bg-blobs {
    z-index: 4;
    overflow: hidden;
    filter: blur(60px);
    opacity: .7;
}
.bg-blobs .blob {
    position: absolute;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    mix-blend-mode: screen;
    will-change: transform;
}
.bg-blobs .blob-1 {
    background: radial-gradient(circle, rgba(124, 58, 237, .55), transparent 65%);
    top: -120px; left: -120px;
    animation: blobMove1 22s ease-in-out infinite;
}
.bg-blobs .blob-2 {
    background: radial-gradient(circle, rgba(6, 214, 255, .45), transparent 65%);
    bottom: -160px; right: -100px;
    animation: blobMove2 28s ease-in-out infinite;
}
.bg-blobs .blob-3 {
    background: radial-gradient(circle, rgba(255, 63, 180, .35), transparent 65%);
    top: 30%; left: 50%;
    animation: blobMove3 32s ease-in-out infinite;
}
.bg-blobs .blob-4 {
    background: radial-gradient(circle, rgba(255, 209, 102, .25), transparent 65%);
    top: 65%; left: 10%;
    width: 360px; height: 360px;
    animation: blobMove4 26s ease-in-out infinite;
}
@keyframes blobMove1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(260px, 180px) scale(1.2); }
}
@keyframes blobMove2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-220px, -200px) scale(1.15); }
}
@keyframes blobMove3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50%      { transform: translate(-30%, -70%) scale(1.25); }
}
@keyframes blobMove4 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(180px, -140px) scale(.85); }
}


/* ====== Header ====== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(7, 7, 26, 0.72);
    border-bottom: 1px solid var(--card-border);
}

/* Прогресс-бордер вокруг хедера, заполняется по часовой стрелке */
.header-progress {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}
.header-progress-path {
    fill: none;
    stroke: url(#header-progress-grad);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 6px rgba(124, 58, 237, .55));
    stroke-dasharray: 18 7;
    stroke-dashoffset: 0;
    animation: headerProgressFlow 5.5s linear infinite;
}
@keyframes headerProgressFlow {
    to { stroke-dashoffset: -25; }
}
@media (prefers-reduced-motion: reduce) {
    .header-progress-path { animation: none; }
}
.brand { cursor: pointer; }

/* ====== Scroll-to-top button ====== */
.scroll-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: rgba(7, 7, 26, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text);
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px) scale(0.85);
    pointer-events: none;
    transition: opacity .25s ease, transform .3s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s ease;
    z-index: 60;
    display: grid;
    place-items: center;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    padding: 0;
}
.scroll-top.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.scroll-top:hover {
    box-shadow: 0 14px 36px rgba(124, 58, 237, .5);
}
.scroll-top:hover .scroll-top-icon {
    transform: translateY(-2px);
    color: var(--accent-3);
}
.scroll-top:active {
    transform: translateY(0) scale(0.95);
}
.scroll-top-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
    overflow: visible;
}
.scroll-top-ring-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 2;
}
.scroll-top-ring-fill {
    fill: none;
    stroke: url(#scroll-top-grad);
    stroke-width: 2.5;
    stroke-linecap: round;
    transition: stroke-dashoffset .12s linear;
    filter: drop-shadow(0 0 5px rgba(6, 214, 255, .55));
}
.scroll-top-icon {
    font-size: 16px;
    color: var(--accent-2);
    transition: transform .25s ease, color .25s ease;
    position: relative;
    z-index: 1;
}
@media (max-width: 540px) {
    .scroll-top { right: 16px; bottom: 16px; width: 46px; height: 46px; }
}
.navbar { padding: 12px 0; }
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-weight: 900;
    color: var(--text);
    position: relative;
}
.brand::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), var(--accent-3), transparent);
    background-size: 200% 100%;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .4s ease;
    animation: brandLineShine 3s linear infinite;
    border-radius: 2px;
}
.brand:hover::after { transform: scaleX(1); }
@keyframes brandLineShine {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.brand-logo {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 6px 24px rgba(124, 58, 237, .45);
    animation: pulseGlow 3s ease-in-out infinite;
    transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.brand-logo i { transition: transform .6s ease; }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.08); }
.brand:hover .brand-logo i { transform: rotate(360deg); }
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 6px 24px rgba(124, 58, 237, .45); }
    50%      { box-shadow: 0 10px 36px rgba(6, 214, 255, .55); }
}

.brand-text {
    display: inline-block;
    letter-spacing: .08em;
    font-size: 18px;
    position: relative;
    background: linear-gradient(90deg,
        #ffffff 0%,
        var(--accent-2) 25%,
        var(--accent) 50%,
        var(--accent-3) 75%,
        #ffffff 100%);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation:
        brandShine 6s linear infinite,
        brandPulse 3.2s ease-in-out infinite;
    transform-origin: left center;
    will-change: transform, background-position;
}
@keyframes brandShine {
    0%   { background-position: 0 0; }
    100% { background-position: 300% 0; }
}
@keyframes brandPulse {
    0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 8px  rgba(124, 58, 237, .35)); }
    50%      { transform: scale(1.04); filter: drop-shadow(0 0 18px rgba(6, 214, 255, .65)); }
}

/* Капитальная M — выделена цветом, без скачков */
.brand-text .bl-cap {
    background: linear-gradient(180deg, var(--accent-3) 0%, var(--accent-4) 100%);
    background-size: 100% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: brandCapShift 3.2s ease-in-out infinite;
    text-shadow: 0 0 14px rgba(255, 63, 180, .4);
}
@keyframes brandCapShift {
    0%, 100% { background-position: 0 0;    }
    50%      { background-position: 0 100%; }
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 8px;
}
.nav-links a {
    color: var(--text);
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 500;
    transition: all .25s ease;
}
.nav-links a:hover {
    color: var(--text);
    background: rgba(124, 58, 237, .15);
    border-color: rgba(124, 58, 237, .4);
    transform: translateY(-2px);
}

/* ====== Hero ====== */
.hero {
    position: relative;
    padding: 70px 0 50px;
    text-align: center;
    overflow: visible;
}

/* --- декорации (орбиты, ореол, искры) --- */
.hero-deco {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 0;
}
.hero-deco .halo {
    position: absolute;
    width: clamp(280px, 56vw, 560px);
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        conic-gradient(from 0deg,
            transparent 0deg,
            rgba(124, 58, 237, .55) 70deg,
            transparent 140deg,
            rgba(6, 214, 255, .55) 220deg,
            transparent 290deg,
            rgba(255, 63, 180, .35) 340deg,
            transparent 360deg);
    filter: blur(42px);
    opacity: .55;
    animation: haloSpin 14s linear infinite, haloPulse 4s ease-in-out infinite;
}
@keyframes haloSpin  { to { transform: rotate(360deg); } }
@keyframes haloPulse { 0%, 100% { opacity: .45; } 50% { opacity: .75; } }

.hero-deco .orbit {
    position: absolute;
    border-radius: 50%;
    border: 1px dashed rgba(124, 58, 237, .35);
}
.hero-deco .orbit-1 { width: clamp(260px, 50vw, 460px); aspect-ratio: 1; animation: orbitSpin 22s linear infinite; }
.hero-deco .orbit-2 { width: clamp(320px, 62vw, 560px); aspect-ratio: 1; border-color: rgba(6, 214, 255, .25); animation: orbitSpin 32s linear infinite reverse; }
.hero-deco .orbit-3 { width: clamp(380px, 74vw, 660px); aspect-ratio: 1; border-color: rgba(255, 63, 180, .18); animation: orbitSpin 40s linear infinite; }
@keyframes orbitSpin { to { transform: rotate(360deg); } }
.hero-deco .orbit::before,
.hero-deco .orbit::after {
    content: "";
    position: absolute;
    width: 10px; height: 10px;
    border-radius: 50%;
    top: -5px; left: 50%;
    transform: translateX(-50%);
    background: var(--accent-2);
    box-shadow: 0 0 14px var(--accent-2), 0 0 28px var(--accent-2);
}
.hero-deco .orbit::after {
    top: auto; bottom: -5px;
    background: var(--accent-3);
    box-shadow: 0 0 14px var(--accent-3), 0 0 28px var(--accent-3);
}
.hero-deco .orbit-2::before { background: var(--accent-4); box-shadow: 0 0 14px var(--accent-4), 0 0 28px var(--accent-4); }
.hero-deco .orbit-2::after  { background: var(--accent);   box-shadow: 0 0 14px var(--accent),   0 0 28px var(--accent);   }

.hero-deco .spark {
    position: absolute;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 8px #fff, 0 0 18px var(--accent-2);
    opacity: 0;
    animation: sparkle 3.5s ease-in-out infinite;
}
.hero-deco .spark-1 { top: 18%; left: 22%; animation-delay: 0s;    }
.hero-deco .spark-2 { top: 24%; right: 20%; animation-delay: .4s;  background: var(--accent-3); box-shadow: 0 0 8px var(--accent-3), 0 0 18px var(--accent-3); }
.hero-deco .spark-3 { bottom: 22%; left: 28%; animation-delay: .9s; }
.hero-deco .spark-4 { bottom: 26%; right: 26%; animation-delay: 1.3s; background: var(--accent-4); box-shadow: 0 0 8px var(--accent-4), 0 0 18px var(--accent-4); }
.hero-deco .spark-5 { top: 48%; left: 12%; animation-delay: .6s;   }
.hero-deco .spark-6 { top: 42%; right: 14%; animation-delay: 1.6s; background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2), 0 0 18px var(--accent-2); }
.hero-deco .spark-7 { top: 10%; left: 50%; animation-delay: 1.1s;  }
.hero-deco .spark-8 { bottom: 12%; left: 52%; animation-delay: 2s; background: var(--accent-3); box-shadow: 0 0 8px var(--accent-3), 0 0 18px var(--accent-3); }
@keyframes sparkle {
    0%, 100% { transform: scale(0); opacity: 0; }
    50%      { transform: scale(1); opacity: 1; }
}

/* --- заголовок --- */
.hero-title {
    position: relative;
    z-index: 2;
    margin: 0;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(1.9rem, 6.2vw, 4.4rem);
    line-height: 1.1;
    letter-spacing: .02em;
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
}

/* >_ промпт с глитчем */
.hero-prompt {
    color: var(--accent-2);
    margin-right: .15em;
    font-size: .8em;
    text-shadow: 0 0 16px var(--accent-2);
    position: relative;
    animation: promptGlitch 4s ease-in-out infinite;
}
.hero-prompt::before,
.hero-prompt::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.hero-prompt::before { color: var(--accent-3); animation: glitchA 4s infinite; clip-path: inset(0 0 60% 0); }
.hero-prompt::after  { color: var(--accent-4); animation: glitchB 4s infinite; clip-path: inset(60% 0 0 0); }
@keyframes promptGlitch {
    0%, 90%, 100% { transform: translate(0, 0); }
    92% { transform: translate(-2px, 1px); }
    94% { transform: translate(2px, -1px); }
    96% { transform: translate(-1px, 0); }
    98% { transform: translate(1px, 1px); }
}
@keyframes glitchA {
    0%, 90%, 100% { transform: translate(0, 0); opacity: 0; }
    92% { transform: translate(-3px, 0); opacity: .9; }
    96% { transform: translate(2px, -1px); opacity: .8; }
}
@keyframes glitchB {
    0%, 90%, 100% { transform: translate(0, 0); opacity: 0; }
    93% { transform: translate(3px, 1px); opacity: .9; }
    97% { transform: translate(-2px, 0); opacity: .8; }
}

/* g a m e s . — побуквенно с приземлением и парящим колебанием */
.hero-static {
    display: inline-flex;
    align-items: baseline;
}
.hero-static .l {
    display: inline-block;
    background: linear-gradient(180deg, #ffffff 0%, #c7c1ff 60%, #7c3aed 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 40px rgba(124, 58, 237, .5);
    opacity: 0;
    transform: translateY(-40px) rotateX(80deg);
    animation:
        letterIn .8s cubic-bezier(.34, 1.56, .64, 1) forwards,
        letterFloat 4s ease-in-out infinite;
}
.hero-static .l:nth-child(1) { animation-delay: .10s, 1.2s; }
.hero-static .l:nth-child(2) { animation-delay: .20s, 1.3s; }
.hero-static .l:nth-child(3) { animation-delay: .30s, 1.4s; }
.hero-static .l:nth-child(4) { animation-delay: .40s, 1.5s; }
.hero-static .l:nth-child(5) { animation-delay: .50s, 1.6s; }
.hero-static .l:nth-child(6) { animation-delay: .60s, 1.7s; color: var(--accent-3); background: none; -webkit-text-fill-color: var(--accent-3); text-shadow: 0 0 18px var(--accent-3); }
@keyframes letterIn {
    to { opacity: 1; transform: translateY(0) rotateX(0); }
}
@keyframes letterFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* --- typewriter --- */
.hero-typewriter {
    display: inline-flex;
    align-items: baseline;
    margin-left: 2px;
}
.tw-text {
    background: linear-gradient(90deg, var(--accent-2), var(--accent-3), var(--accent-4), var(--accent-2));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: twShine 4s linear infinite;
    white-space: pre;
}
@keyframes twShine { to { background-position: 300% 0; } }
.tw-caret {
    display: inline-block;
    color: var(--accent-4);
    margin-left: 2px;
    animation: twBlink 1s steps(1) infinite;
}
@keyframes twBlink { 50% { opacity: 0; } }

/* --- размытое эхо ---*/
.hero-title::after {
    content: "games.MyManitikyl";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(90deg, var(--accent-3), var(--accent-2), var(--accent), var(--accent-3));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: blur(26px);
    opacity: .55;
    z-index: -1;
    animation: twShine 6s linear infinite;
    pointer-events: none;
}

/* --- линия под заголовком --- */
.hero-line {
    width: clamp(180px, 30vw, 280px);
    height: 2px;
    margin: 30px auto 0;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), var(--accent-3), transparent);
    background-size: 200% 100%;
    border-radius: 2px;
    box-shadow: 0 0 14px rgba(124, 58, 237, .55);
    animation: lineShine 3s linear infinite;
    position: relative;
    z-index: 2;
}
@keyframes lineShine {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ====== Sections ====== */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 30px;
}
.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3.2vw, 2.2rem);
    font-weight: 800;
    margin: 0;
    background: linear-gradient(90deg, #fff, var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.section-title i { color: var(--accent); margin-right: 8px; }

.games-section { padding: 40px 0 150px; }

.search-box {
    position: relative;
    width: clamp(220px, 60vw, 320px);
}
.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}
.search-box input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border-radius: 999px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    outline: none;
    transition: all .2s ease;
    font-family: var(--font-body);
}
.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .25);
    background: rgba(255, 255, 255, .07);
}
.search-box input::placeholder { color: var(--text-dim); }

/* ====== Game card ====== */
.game-col {
    opacity: 0;
    transform: translateY(40px);
    animation: cardIn .7s cubic-bezier(.2, .8, .2, 1) forwards;
    animation-delay: var(--card-delay, 0ms);
}
@keyframes cardIn {
    to { opacity: 1; transform: translateY(0); }
}

.game-card {
    position: relative;
    border-radius: var(--radius);
    background:
        linear-gradient(160deg, rgba(124, 58, 237, .08), rgba(6, 214, 255, .04)),
        linear-gradient(180deg, #14122e 0%, #0d0b22 100%);
    border: 1px solid var(--card-border);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform .3s cubic-bezier(.2, .8, .2, 1),
                box-shadow .3s ease,
                border-color .3s ease;
    isolation: isolate;
    box-shadow: var(--shadow);
}
.game-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(124, 58, 237, .15) 60%, transparent 100%);
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
    z-index: 1;
}
.game-card:hover {
    transform: translateY(-8px);
    border-color: rgba(124, 58, 237, .55);
    box-shadow: 0 30px 80px rgba(124, 58, 237, .35);
}
.game-card:hover::before { opacity: 1; }

.game-media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(135deg, #211450, #0a0a1f);
    cursor: pointer;
}
.game-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .8s ease, filter .3s ease;
}
.game-card:hover .game-media img {
    transform: scale(1.08);
    filter: saturate(1.2) brightness(1.05);
}

.game-media-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1a0b3a 0%, #0a0a1f 100%);
    color: #fff;
    text-align: center;
    position: relative;
    padding: 16px;
    overflow: hidden;
    /* виньетка вместо radial-gradient на ::after */
    box-shadow: inset 0 0 120px rgba(0, 0, 0, .55);
}
/* Вращающийся конический градиент-плазма */
.game-media-fallback::before {
    content: "";
    position: absolute;
    inset: -40%;
    background: conic-gradient(from 0deg,
        hsl(var(--h), 85%, 55%)                   0deg,
        hsl(calc(var(--h) +  90), 85%, 55%)       90deg,
        hsl(calc(var(--h) + 180), 85%, 55%)      180deg,
        hsl(calc(var(--h) + 270), 85%, 55%)      270deg,
        hsl(var(--h), 85%, 55%)                  360deg);
    filter: blur(38px);
    opacity: .65;
    animation: fbSpin 14s linear infinite;
    z-index: 0;
}
/* Диагональные движущиеся полоски — без швов:
   гр-т 0deg (период по локальной Y ровно 10px), весь слой повёрнут на 45°,
   сам rect не двигается — анимируем только background-position по локальной Y
   кратно 10px, поэтому каждый кадр идентичен предыдущему периоду. */
.game-media-fallback::after {
    content: "";
    position: absolute;
    /* Overdraw: ::after должен покрыть parent после rotate(45deg).
       Условие: H'/2 ≥ (W+H)/(2√2). Для 16:10 это ~42% запаса по высоте.
       Берём -75% с большим запасом, чтобы хватало и при других пропорциях. */
    inset: -75%;
    background: repeating-linear-gradient(0deg,
        rgba(255, 255, 255, .07) 0 2px,
        transparent 2px 10px);
    transform: rotate(45deg);
    transform-origin: center;
    animation: fbStripes 7s linear infinite;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: overlay;
    will-change: background-position;
}
@keyframes fbSpin    { to { transform: rotate(360deg); } }
@keyframes fbStripes {
    0%   { background-position: 0 0;    }
    100% { background-position: 0 -70px; } /* 7 периодов по 10px — шов невидим */
}

.game-media-fallback .initials,
.game-media-fallback .fallback-name {
    position: relative;
    z-index: 2;
}
.game-media-fallback .initials {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 10vw, 5rem);
    line-height: 1;
    letter-spacing: .04em;
    text-shadow: 0 8px 30px rgba(0, 0, 0, .55), 0 0 30px rgba(255, 255, 255, .15);
    background: linear-gradient(180deg, #fff, rgba(255, 255, 255, .65));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: fbInitialsFloat 4s ease-in-out infinite;
}
.game-media-fallback .fallback-name {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    font-weight: 600;
    font-size: .95rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .92);
    text-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}
@keyframes fbInitialsFloat {
    0%, 100% { transform: translateY(0)    scale(1);    }
    50%      { transform: translateY(-4px) scale(1.03); }
}

/* Ускорение анимации на ховер всей карточки */
.game-card:hover .game-media-fallback::before { animation-duration: 7s; }
.game-card:hover .game-media-fallback::after  { animation-duration: 3.5s; }

.badge-server {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1;
    cursor: default;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    border: 1px solid rgba(0, 0, 0, .35);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #2a2640;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
    transition:
        transform     .35s cubic-bezier(.34, 1.4, .64, 1),
        filter        .35s ease,
        letter-spacing .35s ease,
        background    .35s ease,
        color         .35s ease,
        border-color  .35s ease,
        box-shadow    .35s ease;
}
.badge-server > i { font-size: 9px; }

/* Сервер запущен — ярко-зелёный */
.badge-server.on {
    background: linear-gradient(180deg, #2bb673 0%, #1a8a55 100%);
    color: #ffffff;
    border-color: #34d989;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35), 0 0 18px rgba(33, 208, 122, .55);
}
.badge-server.on > i {
    color: #d4ffe7;
    animation: badgePulse 1.6s ease-in-out infinite;
}

/* Сервер остановлен — красный */
.badge-server.off {
    background: linear-gradient(180deg, #e6425e 0%, #b32844 100%);
    color: #ffffff;
    border-color: #ff5e7a;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35), 0 0 18px rgba(255, 77, 109, .5);
}
.badge-server.off > i { color: #ffd7df; }

/* Без сервера — насыщенный серый */
.badge-server.none {
    background: linear-gradient(180deg, #6b6f85 0%, #4a4d5e 100%);
    color: #ffffff;
    border-color: #8389a0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.badge-server.none > i { color: #d5d8e6; }

/* Проверка — янтарный */
.badge-server.checking {
    background: linear-gradient(180deg, #d99a2e 0%, #a87216 100%);
    color: #ffffff;
    border-color: #ffc94b;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35), 0 0 16px rgba(255, 209, 102, .45);
}
.badge-server.checking > i { color: #fff3d2; }

/* Кликабельный бейдж (status_url задан) */
.badge-server.clickable {
    cursor: pointer;
    user-select: none;
}
.badge-server.clickable:hover {
    transform: scale(1.06) translateY(-1px);
    filter: brightness(1.12) saturate(1.1);
    letter-spacing: .09em;
}
.badge-server.clickable:hover.on {
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4), 0 0 26px rgba(33, 208, 122, .8);
}
.badge-server.clickable:hover.off {
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4), 0 0 26px rgba(255, 77, 109, .75);
}
.badge-server.clickable:hover.checking {
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4), 0 0 26px rgba(255, 209, 102, .7);
}
.badge-server.clickable:hover.none {
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4), 0 0 22px rgba(150, 155, 175, .6);
}
.badge-server.clickable:active {
    transform: scale(1.04) translateY(0);
    filter: brightness(1.05);
}
.badge-server.clickable:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .55), 0 6px 18px rgba(0, 0, 0, .4);
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1);   opacity: 1;   }
    50%      { transform: scale(1.4); opacity: .55; }
}

.game-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}
.game-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    margin: 0;
    color: #fff;
    text-align: center;
    cursor: pointer;
    transition: color .25s ease, text-shadow .25s ease;
}
.game-title:hover {
    color: var(--accent-2);
    text-shadow: 0 0 14px rgba(6, 214, 255, .5);
}
.game-desc {
    margin: 0;
    color: var(--text-dim);
    font-size: .92rem;
    line-height: 1.5;
    text-align: center;
}
.game-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: .9rem;
    letter-spacing: .04em;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
    text-decoration: none;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
}
.btn:focus { outline: none; }
.btn-play {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    color: #fff;
    font-weight: 700;
    background: #0e0b22;
    border-color: transparent;
    box-shadow: 0 8px 30px rgba(20, 184, 166, .35);
    text-shadow:
        0 1px 3px rgba(0, 0, 0, .55),
        0 0 12px rgba(0, 0, 0, .35);
    transition: transform .25s ease, box-shadow .4s ease, text-shadow .25s ease;
}
.btn-play i { text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }

/* Два слоя градиента — base и hover. Свап без артефактов через opacity. */
.btn-play::before,
.btn-play::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-size: 300% 300%;
    transition: opacity .45s ease;
    animation: btnPlayShine 5s ease-in-out infinite;
    will-change: background-position;
}
/* BASE: холодный океан — индиго → бирюза → лайм */
.btn-play::before {
    background-image: linear-gradient(135deg,
        #4338ca   0%,
        #0ea5e9 25%,
        #14b8a6 50%,
        #84cc16 75%,
        #4338ca 100%);
    opacity: 1;
}
/* HOVER: горячий закат — малина → коралл → амбра */
.btn-play::after {
    background-image: linear-gradient(135deg,
        #be185d   0%,
        #ef4444 25%,
        #f97316 50%,
        #fbbf24 75%,
        #be185d 100%);
    opacity: 0;
}

@keyframes btnPlayShine {
    0%   { background-position:   0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position:   0% 50%; }
}

.btn-play:hover {
    color: #fff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 16px 44px rgba(249, 115, 22, .55);
    text-shadow:
        0 2px 6px rgba(0, 0, 0, .65),
        0 0 14px rgba(0, 0, 0, .45);
}
.btn-play:hover::before { opacity: 0; }
.btn-play:hover::after  { opacity: 1; animation-duration: 2s; }

.srv-controls {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.srv-controls-main {
    display: flex;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}
.srv-controls .btn { flex: 1 1 auto; padding: 9px 12px; font-size: .82rem; }

/* Restart — квадратная иконка фиксированной ширины */
.srv-controls .btn-restart {
    flex: 0 0 auto;
    width: 40px;
    aspect-ratio: 1 / 1;
    padding: 0;
    display: grid;
    place-items: center;
    background: rgba(124, 58, 237, .15);
    color: #d4c9ff;
    border-color: rgba(124, 58, 237, .4);
    transition: background .25s ease, color .25s ease, border-color .25s ease,
                box-shadow .25s ease, transform .25s ease;
}
.srv-controls .btn-restart i {
    font-size: 1rem;
    transition: transform .55s cubic-bezier(.34, 1.4, .64, 1);
}
.srv-controls .btn-restart:hover {
    background: rgba(124, 58, 237, .3);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(124, 58, 237, .45);
    transform: translateY(-2px) scale(1.04);
}
.srv-controls .btn-restart:hover i {
    transform: rotate(180deg);
}
.srv-controls .btn-restart:active,
.srv-controls .btn-restart:focus-visible {
    background: rgba(124, 58, 237, .5);
    color: #fff;
    border-color: var(--accent);
    box-shadow:
        0 0 0 4px rgba(124, 58, 237, .35),
        0 12px 32px rgba(124, 58, 237, .6);
    transform: translateY(-1px) scale(1.03);
}
.btn-start {
    background: rgba(33, 208, 122, .12);
    color: #b6f5d3;
    border-color: rgba(33, 208, 122, .35);
}
.btn-start:hover {
    background: rgba(33, 208, 122, .25);
    color: #ddffe9;
    border-color: var(--green);
    box-shadow: 0 10px 28px rgba(33, 208, 122, .4);
    transform: translateY(-2px) scale(1.05);
}
/* Специфичность через .srv-controls — чтобы перебить Bootstrap-овский
   :not(.btn-check)+.btn:active (0,3,0). У нас здесь (0,3,1). */
.srv-controls .btn-start:active,
.srv-controls .btn-start:focus-visible,
.srv-controls .btn-start.active {
    background-color: rgba(33, 208, 122, .55);
    color: #fff;
    border-color: var(--green);
    box-shadow:
        0 0 0 4px rgba(33, 208, 122, .35),
        0 12px 32px rgba(33, 208, 122, .6);
    transform: translateY(-1px) scale(1.04);
}
.btn-stop {
    background: rgba(255, 77, 109, .12);
    color: #ffc3cd;
    border-color: rgba(255, 77, 109, .35);
}
.btn-stop:hover {
    background: rgba(255, 77, 109, .25);
    color: #ffe1e6;
    border-color: var(--red);
    box-shadow: 0 10px 28px rgba(255, 77, 109, .4);
    transform: translateY(-2px) scale(1.05);
}
.srv-controls .btn-stop:active,
.srv-controls .btn-stop:focus-visible,
.srv-controls .btn-stop.active {
    background-color: rgba(255, 77, 109, .55);
    color: #fff;
    border-color: var(--red);
    box-shadow:
        0 0 0 4px rgba(255, 77, 109, .35),
        0 12px 32px rgba(255, 77, 109, .6);
    transform: translateY(-1px) scale(1.04);
}
.btn-loading {
    width: 100%;
    background: rgba(255, 209, 102, .1);
    color: #ffe599;
    border-color: rgba(255, 209, 102, .35);
    pointer-events: none;
    cursor: default;
    opacity: .9;
}
.btn-loading i { color: var(--accent-4); }

.srv-btn.loading {
    pointer-events: none;
    opacity: .7;
    position: relative;
}
.srv-btn.loading::after {
    content: "";
    width: 14px; height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    margin-left: 6px;
    display: inline-block;
    animation: spin .8s linear infinite;
}

.srv-none {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
    border: 1px dashed var(--card-border);
    color: var(--text-dim);
    font-size: .85rem;
    letter-spacing: .04em;
}
.srv-none i { color: var(--accent-2); }

.card-glow {
    position: absolute;
    inset: -1px;
    border-radius: var(--radius);
    pointer-events: none;
    background:
        radial-gradient(220px 220px at var(--gx, 50%) var(--gy, 50%),
            rgba(124, 58, 237, .25), transparent 60%);
    opacity: 0;
    transition: opacity .25s ease;
    z-index: 0;
}
.game-card:hover .card-glow { opacity: 1; }

/* ====== Empty state / no results ====== */
.empty-state, .no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}
.empty-state i, .no-results i {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 14px;
    display: block;
}
.empty-state code {
    background: rgba(255, 255, 255, .08);
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--accent-2);
}

/* ====== Footer ====== */
.site-footer {
    border-top: 1px solid var(--card-border);
    padding: 22px 0;
    color: var(--text-dim);
    background: rgba(0, 0, 0, .25);
    backdrop-filter: blur(6px);
    font-size: .92rem;
    letter-spacing: .04em;
}

/* ====== Toasts ====== */
#toast-area {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast-msg {
    pointer-events: auto;
    min-width: 240px;
    max-width: 340px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(11, 10, 28, .92);
    border: 1px solid var(--card-border);
    color: var(--text);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    animation: toastIn .35s ease forwards;
}
.toast-msg.out { animation: toastOut .35s ease forwards; }
.toast-msg.success { border-color: rgba(33, 208, 122, .55); }
.toast-msg.success i { color: var(--green); }
.toast-msg.error   { border-color: rgba(255, 77, 109, .55); }
.toast-msg.error i { color: var(--red); }
.toast-msg.info    { border-color: rgba(6, 214, 255, .45); }
.toast-msg.info i  { color: var(--accent-2); }
.toast-msg i { font-size: 18px; }
@keyframes toastIn  { to { transform: translateX(0); } }
@keyframes toastOut { to { transform: translateX(120%); opacity: 0; } }

/* ====== Responsive tweaks ====== */
@media (max-width: 768px) {
    .hero { padding: 40px 0 30px; }
    .section-head { justify-content: center; }
    .search-box { width: 100%; }
    .srv-modal-box { padding: 36px 22px 26px; border-radius: 18px; }
    .srv-modal-title { font-size: 1.15rem; }
}
@media (max-width: 480px) {
    .srv-controls { flex-direction: column; }
    .nav-links { display: none !important; }
}

/* ====== Серверная модалка ====== */
.srv-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.srv-modal[hidden] { display: none; }
.srv-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 16, .72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: srvFadeIn .25s ease;
    cursor: pointer;
}
.srv-modal-box {
    position: relative;
    width: 100%;
    max-width: min(1100px, 92vw);
    max-height: 90vh;
    overflow: auto;
    background: linear-gradient(180deg, #18163a 0%, #0d0b22 100%);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    padding: 56px 56px 44px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, .6), 0 0 0 1px rgba(124, 58, 237, .15);
    text-align: center;
    animation: srvPop .35s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes srvFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes srvPop {
    from { opacity: 0; transform: translateY(20px) scale(.92); }
    to   { opacity: 1; transform: translateY(0)    scale(1);   }
}
.srv-modal-close {
    position: absolute;
    top: 10px; right: 10px;
    width: 34px; height: 34px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    color: var(--text-dim);
    cursor: pointer;
    transition: all .2s ease;
    display: grid;
    place-items: center;
}
.srv-modal-close:hover {
    background: rgba(255, 77, 109, .2);
    color: #fff;
    border-color: var(--red);
    transform: rotate(90deg);
}

.srv-modal-icon {
    position: relative;
    width: 64px; height: 64px;
    margin: 0 auto 18px;
}
.srv-modal-icon .srv-spinner,
.srv-modal-icon .srv-ok,
.srv-modal-icon .srv-err { display: none; }
.srv-modal[data-state="loading"] .srv-spinner { display: block; }
.srv-modal[data-state="success"] .srv-ok      { display: block; }
.srv-modal[data-state="error"]   .srv-err     { display: block; }
/* Plain — никаких иконок, просто вывод */
.srv-modal[data-state="plain"] .srv-modal-icon { display: none; }

.srv-spinner {
    width: 64px; height: 64px;
    border: 4px solid rgba(255, 255, 255, .08);
    border-top-color: var(--accent);
    border-right-color: var(--accent-2);
    border-radius: 50%;
    animation: srvSpin .9s linear infinite;
}
@keyframes srvSpin { to { transform: rotate(360deg); } }
.srv-modal-icon .srv-ok,
.srv-modal-icon .srv-err {
    font-size: 64px;
    line-height: 1;
    animation: srvIconIn .4s cubic-bezier(.34, 1.56, .64, 1);
}
.srv-modal-icon .srv-ok  { color: var(--green); text-shadow: 0 0 24px rgba(33, 208, 122, .6); }
.srv-modal-icon .srv-err { color: var(--red);   text-shadow: 0 0 24px rgba(255, 77, 109, .6); }
@keyframes srvIconIn {
    from { opacity: 0; transform: scale(0.4); }
    to   { opacity: 1; transform: scale(1);   }
}

.srv-modal-title {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
}
.srv-modal-sub {
    margin: 0;
    color: var(--text-dim);
    font-size: .92rem;
    min-height: 22px;
}
.srv-modal-body {
    margin: 22px 0 0;
    padding: 20px;
    background: rgba(0, 0, 0, .38);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    color: #d8dcff;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .95rem;
    line-height: 1.6;
    max-height: 60vh;
    overflow: auto;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
}

.srv-modal-title {
    font-size: 1.45rem;
}
.srv-modal-sub {
    font-size: 1rem;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}
