html {
    overflow-y: scroll; /* Всегда показываем вертикальный скролл, исключая подергивания */
}
body {
    margin: 0;
    padding: 0;
    font-family: 'Arial Black', Gadget, sans-serif;
    color: #fff;
    background: #121212;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: url(custom_cursor.png) 2 2, default;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden; /* Запрещаем горизонтальный скролл */
}

/* Фоновая анимация */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    z-index: -1;
    background: url('fon.png') no-repeat center center fixed;
    background-size: cover;
    filter: blur(10px);
    animation: zoom 10s infinite;
}

@keyframes zoom {
    0% { transform: scale(1.0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1.0); }
}

/* Прелоадер */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #121212;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #ff5733;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Шапка */
.header {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    z-index: 2;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.header .logo {
    display: flex;
    align-items: center;
}

.header .logo img {
    height: 40px;
    margin-right: 10px;
}

.header .logo span {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
}

.header .buttons {
    display: flex;
    align-items: center;
}

.header .button {
    background-color: #ff5733;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    margin: 0 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: #fff;
    text-shadow: 0 0 3px #000;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.header .button:hover {
    background-color: #ff3300;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 87, 51, 0.7);
}

.header .button:active {
    transform: scale(0.95);
}

.header .button i {
    margin-right: 8px;
}

.main-heading {
    margin-top: 250px;
    text-align: center;
    font-size: 36px;
    color: #ffffff;
}

.button-panel {
    margin-top: 100px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.button-panel .buttons {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.link {
    text-decoration: none;
    color: #fff;
}

.button-panel .button {
    background-color: #ff5733;
    padding: 15px 30px;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    margin: 10px;
    cursor: pointer;
    text-shadow: 0 0 3px #000;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.button-panel .button:hover {
    background-color: #ff3300;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 87, 51, 0.7);
}

.button-panel .button:active {
    transform: scale(0.9);
}

.message, .notification {
    margin: 15px auto;
    padding: 15px;
    text-align: center;
    max-width: 400px;
    border-radius: 5px;
    font-size: 16px;
}

.error {
    border: 1px solid #F5A9A9;
    color: #D8000C;
    background-color: #FFBABA;
}

.success {
    border: 1px solid #A9D365;
    color: #270;
    background-color: #DFF2BF;
}

.red-text {
    color: #ff4f4f;
    text-shadow: -1px -1px 0 #4b4b4b, 
                 1px -1px 0 #000, 
                 -1px 1px 0 #000, 
                 4px 5px 0 #000;
}

/* Профиль */
.profile-container {
    margin-top: 100px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-title {
    font-size: 36px;
    margin-bottom: 30px;
    color: #ff4f4f;
    text-shadow: -1px -1px 0 #4b4b4b, 
                 1px -1px 0 #000, 
                 -1px 1px 0 #000, 
                 4px 5px 0 #000;
}

.profile-info {
    background: rgba(0,0,0,0.6);
    padding: 20px 30px;
    border-radius: 10px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.profile-info p {
    font-size: 18px;
    margin: 10px 0;
}

.profile-info strong {
    color: #ff4f4f;
    text-shadow: -1px -1px 0 #4b4b4b, 
                 1px -1px 0 #000, 
                 -1px 1px 0 #000, 
                 4px 5px 0 #000;
}

#avatarInput {
    display: none;
}

/* Аватарка */
.avatar-container img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: transform 0.3s;
}

.avatar-container img:hover {
    transform: scale(1.05);
}

/* Снег */
#snow-animation-container {
    position: fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    pointer-events: none;
    z-index: 99999;
}

/* Трава */
.grass {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 100px;
    background: url('https://stayalive3d.ru/css/grass.png') repeat-x;
    animation: wave 15s infinite linear;
    z-index: 2;
}

@keyframes wave {
    0% { background-position: 0; }
    100% { background-position: 1000px; }
}

#playerCountDisplay {
    text-align: center;
    margin-top: 20px;
    font-size: 16px;
    color: #fff;
    text-shadow: 0 0 3px #000;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 3;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: rgba(18,18,18,0.9);
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 100%;
    max-width: 400px;
    border-radius: 15px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: scale(1);
    animation: scaleUp 0.3s ease forwards;
    opacity: 0.95;
}


@keyframes scaleUp {
    0% {transform: scale(0.9);}
    100% {transform: scale(1);}
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #fff;
    text-decoration: none;
}

.modal-title {
    text-align: center;
    font-size: 24px;
    color: #fff; 
    margin-bottom: 20px;
}

.modal-form input[type="text"],
.modal-form input[type="password"],
.modal-form input[type="email"] {
            width: calc(100% - 20px);
            padding: 10px;
            margin-bottom: 20px;
            font-size: 16px;
            border: 1px solid #ccc;
            border-radius: 5px;
            background: #ffffff33;
            color: #fff;
}

.modal-form input[type="submit"] {
    width: 100%; 
    padding: 12px;
    font-size: 16px;
    background-color: #ff4f4fa8;
    color: #fff;
    border: none;
    border-radius: 25px;
    cursor: crosshair;
    margin-top: 10px;
    text-align: center;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.modal-form input[type="submit"]:hover {
    background-color: #ff3300;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 87, 51, 0.7);
}
#ajaxNotificationContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end; /* Уведомления будут выравниваться по правому краю */
    pointer-events: none; /* Чтоб клик шел только по уведомлению */
}

.ajaxNotification {
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 14px;
    color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    cursor: pointer;
    max-width: 250px; 
    line-height: 1.4;
    text-align: left;
    pointer-events: all; /* Чтоб на само уведомление можно было кликнуть */
}

.ajaxNotification.success {
    background: linear-gradient(90deg, #4caf50, #45a049);
}

.ajaxNotification.error {
    background: linear-gradient(90deg, #e53935, #d32f2f);
}

.ajaxNotification.hide {
    animation: fadeOut 0.3s forwards;
}

@keyframes fadeIn {
    to {opacity:1;}
}

@keyframes fadeOut {
    to {opacity:0;}
}
/* Стили для чата */
#chatContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    background: #2c2c2c;
    border-radius: 10px;
    box-shadow: 0 0 10px #000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s, height 0.3s;
    font-family: Arial, sans-serif;
    color: #fff;
    max-height: 400px;
}

#chatContainer.collapsed {
    transform: translateY(calc(100% - 40px));
}

.chat-header {
    background: linear-gradient(to right, #333, #444);
    padding: 10px;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    border-bottom: 1px solid #555;
}

.chat-header img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}

.chat-header .chat-user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chat-header .chat-username {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
}

.chat-header .chat-status {
    font-size: 12px;
    color: #ccc;
}

#chatToggleBtn {
    position: absolute;
    right: 10px;
    top: 10px;
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.3s;
}
#chatToggleBtn:hover {
    transform: scale(1.2);
}

.chat-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    font-size: 14px;
    background: #222; /* фон для области сообщений */
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: #555 #222;
}

/* Стили скроллбара для WebKit */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
    background: #222;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.chat-message-item {
    background: #444;
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 10px;
    color: #fff;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message-item strong {
    color: #ff4f4f;
}

.chat-message-item img {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 5px;
    vertical-align: middle;
}

.chat-message-header {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.chat-message-time {
    font-size: 12px;
    color: #ccc;
    margin-left: 5px;
}

.chat-input {
    background: #333;
    padding: 10px;
    display: flex;
    border-top: 1px solid #555;
}

.chat-input input {
    flex: 1;
    padding: 8px;
    border: 1px solid #555;
    border-radius: 5px;
    margin-right: 10px;
    font-size: 14px;
    background: #2a2a2a;
    color: #fff;
    outline: none;
}

.chat-input input::placeholder {
    color: #bbb;
}

.chat-input button {
    background: #ff5733;
    border: none;
    border-radius: 5px;
    color: #fff;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 14px;
}
.chat-input button:hover {
    background: #ff3300;
}
.chat-message-item.mentioned {
    background: #442f2f;
}
    .chat-new-count {
        background: #ff3300;
        border-radius: 50%;
        padding: 2px 6px;
        font-size: 12px;
        color: #fff;
        margin-left: 5px;
        display: none;
    }
