body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: 'Courier New', Courier, monospace;
    color: #fff;
    cursor: none !important; /* Добавили !important */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

a, button, .ctrl-btn, #enter-screen, .links a {
    cursor: none !important;
}

/* Скрываем кастомный курсор на мобилках и планшетах */
@media (pointer: coarse) {
    #cursor-dot, #cursor-circle { display: none !important; }
    body, .content *, .ctrl-btn { cursor: auto !important; }
}

/* КУРСОР */
#cursor-dot {
    position: fixed;
    width: 4px;
    height: 4px;
    background-color: #fff;
    border-radius: 50%;
    z-index: 10000;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

#cursor-circle {
    position: fixed;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    z-index: 10000;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s, background-color 0.3s, border 0.3s;
}

.cursor-hover #cursor-circle {
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 1);
}

/* ЭКРАН ВХОДА */
#enter-screen {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease, visibility 1s ease;
}

#enter-screen.hidden { opacity: 0; visibility: hidden; }

/* ФОНОВОЕ ВИДЕО */
#video-background { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#video-container, #bg-video { width: 100vw; height: 100vh; object-fit: cover; display: block; }
#bg-video { filter: brightness(0.4); }

#tsparticles { 
    position: fixed; 
    inset: -50px; /* Немного расширяем границы, чтобы при наклоне не было пустых краев */
    z-index: 2; 
    pointer-events: none; 
    will-change: transform;
    /* Важно для корректного наклона */
    transform-style: preserve-3d;
}

/* КОНТЕНТ */
.content {
    position: relative;
    z-index: 10;
    height: 100dvh; /* Использование динамической высоты для мобилок */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    pointer-events: none;
    padding: 0 5vw;
    box-sizing: border-box;
}

.content * { pointer-events: auto; }

/* ЛОГОТИП: Адаптация под разные устройства */
.logo { 
    width: 85vw; 
    max-width: 700px; 
    height: auto; 
    margin-bottom: 2vh;
    object-fit: contain; 
}

/* iPhone 13 mini и другие мелкие смартфоны */
@media (max-height: 700px) {
    .logo { max-width: 300px; }
    .subtitle { font-size: 0.8rem; }
}

.subtitle { 
    margin: 10px 0; 
    opacity: 0.8; 
    font-size: clamp(0.8rem, 2.5vw, 1.1rem); 
    max-width: 500px; 
    line-height: 1.4;
}

.discord { 
    margin-bottom: 20px; 
    color: #aaa; 
    font-size: clamp(0.7rem, 2vw, 0.85rem); 
}

/* ССЫЛКИ */
.links { 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 10px; 
    max-width: 90vw;
}

.links a {
    color: #fff; 
    text-decoration: none; 
    font-size: clamp(0.75rem, 2.2vw, 0.9rem);
    background: rgba(255, 255, 255, 0.05); 
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px; 
    padding: 10px 18px; 
    transition: 0.3s;
    white-space: nowrap;
}

.links a:hover { background: #fff; color: #000; }

/* ПАНЕЛЬ УПРАВЛЕНИЯ ВИДЕО */
#video-controls-bar {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    /* Новый способ центровки, который не ломает VanillaTilt */
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    width: fit-content; /* Ширина по контенту */
    
    z-index: 20; 
    display: none; 
    align-items: center;
    background: rgba(0, 0, 0, 0.5); 
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px; 
    padding: 8px; 
    gap: 8px;
    /* Убираем старый transform, так как он мешает tilt-эффекту */
    transform: none; 
}

.ctrl-btn {
    background: transparent; 
    border: none; 
    color: rgba(255, 255, 255, 0.7);
    width: 44px; 
    height: 44px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    border-radius: 12px; 
    transition: 0.3s;
}

.ctrl-btn svg { width: 22px; height: 22px; fill: currentColor; }
.ctrl-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.main-btn { background: rgba(255, 255, 255, 0.15); color: #fff; }

@media (min-width: 1025px) {
    #video-controls-bar { 
        left: 40px; 
        right: auto; /* Сбрасываем правую границу */
        margin-left: 0;
        margin-right: 0;
        bottom: 40px; 
        transform: none; 
    }
    .logo { max-width: 810px; }
    .content { padding: 0; }
}

/* Оптимизация для планшетов */
@media (min-width: 768px) and (max-width: 1024px) {
    .logo { max-width: 500px; }
    .links { gap: 15px; }
    .links a { padding: 12px 24px; }
}

/* Оптимизация для маленьких экранов (iPhone 13 mini) */
@media (max-height: 700px) {
    .logo { max-width: 280px; }
    .subtitle { font-size: 0.8rem; margin: 5px 0; }
    .discord { margin-bottom: 15px; }
    .links a { padding: 8px 14px; font-size: 0.75rem; }
    #video-controls-bar { bottom: calc(10px + env(safe-area-inset-bottom)); }
}

/* Оставляем курсор только для мобильных устройств, так как там нет кастомного круга */
@media (pointer: coarse) {
    #cursor-dot, #cursor-circle { display: none !important; }
    body, html, a, button, .ctrl-btn, #enter-screen, .links a { 
        cursor: auto !important; 
    }
}

/* тетрис  */
#menu-toggle {
    position: fixed;
    top: 40px;
    right: 40px;
    z-index: 2000;
    cursor: none !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#menu-toggle .bar {
    width: 30px;
    height: 1px;
    background: white;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Оверлей меню */
/* Кнопка бургера */
#menu-toggle {
    position: fixed;
    top: 40px;
    right: 40px;
    z-index: 2001;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Расстояние между полосками */
    padding: 10px;
}

#menu-toggle .bar {
    width: 30px;
    height: 2px;
    background: white;
    transition: all 0.4s cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

/* Анимация превращения в крестик */
#menu-toggle.active .bar:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
}

#menu-toggle.active .bar:nth-child(2) {
    transform: translateY(-5px) rotate(-45deg);
}

/* Контейнер меню */
#game-menu {
    text-align: center;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 1999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none; /* Чтобы меню не мешало, пока скрыто */
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    transform: scale(1.1); /* Легкий зум при появлении */
}

#game-menu.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

/* Анимация появления ссылок (по очереди) */
.menu-link {
    display: block;
    font-size: 32px;
    color: white;
    text-decoration: none;
    margin: 20px 0;
    font-weight: 100;
    letter-spacing: 2px;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

#game-menu.active .menu-link {
    opacity: 1;
    transform: translateY(0);
}

/* Задержки для каждой ссылки (Stagger) */
#game-menu.active .menu-link:nth-child(1) { transition-delay: 0.2s; }
#game-menu.active .menu-link:nth-child(2) { transition-delay: 0.3s; }
#game-menu.active .menu-link:nth-child(3) { transition-delay: 0.4s; }

.menu-link:hover {
    transform: scale(1.1) !important;
    text-shadow: 0 0 20px #fff;
    opacity: 1 !important;
}

.menu-titleed {
    font-size: 12px;
    letter-spacing: 10px;
    color: rgba(255,255,255,0.3);
    margin-bottom: 50px;
    transition: 0.5s;
    transform: translateY(20px);
    opacity: 0;
}

#game-menu.active .menu-titleed {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.1s;
}