body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    background-color: #000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.cursor {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    pointer-events: none;
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
    transition: transform 0.1s;
    z-index: 1000;
}

.content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    width: 90%;
    max-width: 600px;
}

.title {
    font-size: 5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, #FF3F8E, #04C2C9, #2E55C1, #FFCC00);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient 10s ease infinite;
    background-size: 300% 300%;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.subtitle {
    font-size: 1.5rem;
    margin-bottom: 3rem;
    color: rgba(255, 255, 255, 0.8);
}

footer {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    z-index: 10;
}

/* Сетка игр */
.games-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin-top: 3rem;
}

.games-grid > div {
    flex: 0 1 auto;
}

/* Стили для ссылки на игру "Змейка" */
.snake-link-container {
    position: relative;
    display: inline-block;
    animation: float 6s ease-in-out infinite, aurora 12s linear infinite;
    animation-delay: 0s;
}

.snake-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #fff;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(46, 204, 113, 0.3);
}

.snake-link:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(46, 204, 113, 0.8);
    border-color: rgba(46, 204, 113, 0.8);
}

.snake-link span {
    margin-top: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.8);
}

.snake-icon {
    display: flex;
    align-items: center;
    position: relative;
    height: 40px;
}

.snake-segment {
    width: 20px;
    height: 20px;
    background-color: #2ecc71;
    border-radius: 50%;
    margin: 0 -5px;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.7);
    position: relative;
    z-index: 1;
}

.snake-segment.head {
    width: 25px;
    height: 25px;
    background-color: #27ae60;
    z-index: 2;
    animation: pulse 2s infinite;
}

.snake-segment.head::before,
.snake-segment.head::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 5px;
    background-color: white;
    border-radius: 50%;
    top: 5px;
}

.snake-segment.head::before {
    left: 5px;
}

.snake-segment.head::after {
    right: 5px;
}

.snake-segment.tail {
    width: 15px;
    height: 15px;
    background-color: #16a085;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
    100% {
        transform: translateY(0px) rotate(0deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes aurora {
    0% {
        filter: hue-rotate(0deg) brightness(1);
    }
    50% {
        filter: hue-rotate(180deg) brightness(1.2);
    }
    100% {
        filter: hue-rotate(360deg) brightness(1);
    }
}

@keyframes slither {
    0% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(3px) translateY(-3px);
    }
    50% {
        transform: translateX(0) translateY(0);
    }
    75% {
        transform: translateX(-3px) translateY(3px);
    }
    100% {
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden; /* Предотвращаем горизонтальный скролл */
        -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
    }
    
    .content {
        width: 95%;
        padding: 20px 0;
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 20px auto;
    }
    
    .title {
        font-size: 3.5rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
        margin-bottom: 2rem;
    }
    
    .games-grid {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
        margin-top: 2rem;
        margin-bottom: 3rem; /* Добавляем отступ снизу */
    }
    
    .snake-link {
        padding: 15px 25px;
    }
    
    .snake-link span {
        font-size: 1.1rem;
    }
    
    .snake-segment {
        width: 16px;
        height: 16px;
    }
    
    .snake-segment.head {
        width: 20px;
        height: 20px;
    }
    
    .snake-segment.tail {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 480px) {
    .content {
        width: 98%;
        padding: 15px 0;
        margin: 10px auto;
    }
    
    .title {
        font-size: 2.5rem;
        margin-bottom: 0.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .games-grid {
        gap: 1rem;
        margin-top: 2rem;
        margin-bottom: 4rem; /* Больше отступа снизу для маленьких экранов */
    }
    
    footer {
        margin-top: 2rem;
        padding: 20px 0;
    }
}
/* Стили для ссылки на игру "Блэкджек" */
.blackjack-link-container {
    position: relative;
    display: inline-block;
    animation: float 6s ease-in-out infinite, aurora 12s linear infinite;
    animation-delay: 2s;
}

.blackjack-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #fff;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.5);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(241, 196, 15, 0.3);
}

.blackjack-link:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(241, 196, 15, 0.8);
    border-color: rgba(241, 196, 15, 0.8);
}

.blackjack-link span {
    margin-top: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.8);
}

.blackjack-icon {
    width: 40px;
    height: 40px;
    background: url('blackjack/svg/card-back.svg') no-repeat center/cover;
}

@media (max-width: 768px) {
    .blackjack-link {
        padding: 15px 25px;
    }
    .blackjack-link span {
        font-size: 1.1rem;
    }
    .blackjack-icon {
        width: 32px;
        height: 32px;
    }
}

/* Стили для ссылки на игру "Танки" */
.tanks-link-container {
    position: relative;
    display: inline-block;
    animation: float 6s ease-in-out infinite, aurora 12s linear infinite;
    animation-delay: 4s;
}

.tanks-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #fff;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(46, 125, 50, 0.5);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(46, 125, 50, 0.3);
}

.tanks-link:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(46, 125, 50, 0.8);
    border-color: rgba(46, 125, 50, 0.8);
}

.tanks-link span {
    margin-top: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(46, 125, 50, 0.8);
}

.tanks-icon {
    position: relative;
    width: 32px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tank-body {
    width: 18px;
    height: 32px;
    background-color: #2e7d32;
    border-radius: 4px;
    position: relative;
    box-shadow: 0 0 10px rgba(46, 125, 50, 0.7);
}

.tank-body::before,
.tank-body::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 3px;
    background-color: #1b5e20;
    border-radius: 2px;
    left: -2px;
}

.tank-body::before {
    top: -2px;
}

.tank-body::after {
    bottom: -2px;
}

.tank-turret {
    position: absolute;
    width: 14px;
    height: 20px;
    background-color: #388e3c;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px rgba(56, 142, 60, 0.8);
    z-index: 2;
}

.tank-barrel {
    position: absolute;
    width: 3px;
    height: 24px;
    background-color: #424242;
    border-radius: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center top;
    z-index: 3;
    animation: tankAim 4s ease-in-out infinite;
}

@keyframes tankAim {
    0%, 100% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    25% {
        transform: translate(-50%, -50%) rotate(15deg);
    }
    75% {
        transform: translate(-50%, -50%) rotate(-15deg);
    }
}

@media (max-width: 768px) {
    .tanks-link {
        padding: 15px 25px;
    }
    .tanks-link span {
        font-size: 1.1rem;
    }
    .tanks-icon {
        width: 28px;
        height: 40px;
    }
    .tank-body {
        width: 14px;
        height: 26px;
    }
    .tank-turret {
        width: 10px;
        height: 16px;
    }
.tank-barrel {
    width: 2px;
    height: 18px;
}
}

.tetris-link-container {
    position: relative;
    display: inline-block;
    animation: float 6s ease-in-out infinite, aurora 12s linear infinite;
    animation-delay: 6s;
}

.tetris-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #fff;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(155, 89, 182, 0.5);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(155, 89, 182, 0.3);
}

.tetris-link:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(155, 89, 182, 0.8);
    border-color: rgba(155, 89, 182, 0.8);
}

.tetris-link span {
    margin-top: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(155, 89, 182, 0.8);
}

.tetris-icon {
    display: grid;
    grid-template-columns: repeat(3, 12px);
    grid-template-rows: repeat(2, 12px);
    gap: 2px;
}

.tetris-icon .block {
    width: 12px;
    height: 12px;
}

.tetris-icon .block:nth-child(1) {
    background: #e74c3c;
    grid-column: 1;
    grid-row: 1;
}

.tetris-icon .block:nth-child(2) {
    background: #f1c40f;
    grid-column: 2;
    grid-row: 1;
}

.tetris-icon .block:nth-child(3) {
    background: #3498db;
    grid-column: 3;
    grid-row: 1;
}

.tetris-icon .block:nth-child(4) {
    background: #2ecc71;
    grid-column: 2;
    grid-row: 2;
}

@media (max-width: 768px) {
    .tetris-link {
        padding: 15px 25px;
    }

    .tetris-link span {
        font-size: 1.1rem;
    }

    .tetris-icon {
        grid-template-columns: repeat(3, 10px);
        grid-template-rows: repeat(2, 10px);
    }

    .tetris-icon .block {
        width: 10px;
        height: 10px;
    }
}


/* Стили для ссылки на игру Territory */
.territory-link-container {
    position: relative;
    display: inline-block;
    animation: float 6s ease-in-out infinite, aurora 12s linear infinite;
    animation-delay: 10s;
}

.territory-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #fff;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(102, 126, 234, 0.3);
}

.territory-link:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.8);
    border-color: rgba(102, 126, 234, 0.8);
}

.territory-link span {
    margin-top: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.8);
}

.territory-icon {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.territory-icon .grid-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 8px 8px;
    opacity: 0.5;
    border-radius: 4px;
}

.territory-icon .territory-square {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #4ECDC4;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.8);
    z-index: 3;
    animation: territoryMove 3s ease-in-out infinite;
}

.territory-icon .territory-trail {
    position: absolute;
    width: 24px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #4ECDC4, transparent);
    transform-origin: left center;
    animation: territoryTrail 3s ease-in-out infinite;
    z-index: 2;
}

.territory-icon .territory-area {
    position: absolute;
    width: 32px;
    height: 32px;
    background: rgba(78, 205, 196, 0.2);
    border: 1px solid rgba(78, 205, 196, 0.4);
    border-radius: 4px;
    animation: territoryPulse 3s ease-in-out infinite;
    z-index: 1;
}

@keyframes territoryMove {
    0%, 100% {
        top: 8px;
        left: 8px;
    }
    25% {
        top: 8px;
        left: 32px;
    }
    50% {
        top: 32px;
        left: 32px;
    }
    75% {
        top: 32px;
        left: 8px;
    }
}

@keyframes territoryTrail {
    0%, 100% {
        width: 0;
        left: 16px;
        top: 12px;
        transform: rotate(0deg);
    }
    25% {
        width: 24px;
        left: 16px;
        top: 12px;
        transform: rotate(0deg);
    }
    50% {
        width: 24px;
        left: 36px;
        top: 36px;
        transform: rotate(90deg);
    }
    75% {
        width: 24px;
        left: 12px;
        top: 36px;
        transform: rotate(180deg);
    }
}

@keyframes territoryPulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.3;
    }
    50% {
        transform: scale(1);
        opacity: 0.6;
    }
}

@media (max-width: 768px) {
    .territory-link {
        padding: 15px 25px;
    }

    .territory-link span {
        font-size: 1.1rem;
    }

    .territory-icon {
        width: 40px;
        height: 40px;
    }
}
