body {
    position: relative;
    margin: 0;
    font-family: Arial;
    text-align: center;
    color: white;

    background: url("cool.jpg") no-repeat center center fixed;
    background-size: cover;

    /* Свойства, чтобы футер прижался к низу */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* затемнение + blur */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    z-index: -1;
    pointer-events: none;
}

.main {
    flex: 1 0 auto; /* Растягиваем блок на всё свободное место */
    width: 100%;
}

/* КАРТОЧКА */
.box {
    max-width: 700px;
    margin: 80px auto;
    padding: 30px;

    background: rgba(30,30,30,0.9);
    border-radius: 20px;

    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* КНОПКИ */
.btn {
    display: inline-block;
    padding: 12px 25px;
    margin: 5px;
    background: linear-gradient(45deg, #00bfff, #007bff);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    transition: 0.3s;
}

.btn:hover {
    transform: scale(1.05);
}

/* LANG */
.lang-dropdown {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 9999;
}

.lang-btn {
    background: linear-gradient(45deg, #00bfff, #007bff);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.lang-btn:hover {
    transform: scale(1.05);
}

.lang-menu {
    display: none;
    position: absolute;
    right: 0;
    margin-top: 8px;
    min-width: 80px;
    background: #2f2f2f;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.lang-menu div {
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
}

.lang-menu div:hover {
    background: #007bff;
}

.lang-menu.show {
    display: block;
}

/* FILE BOX */
.file-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.left {
    flex: 1;
    text-align: left;
}

.right {
    flex: 1;
    text-align: center;
}

.right img {
    width: 100%;
    max-width: 250px;
    border-radius: 12px;
    margin-bottom: 15px;
}

/* BACK BUTTON (ВНЕ media query!) */
.back-btn {
    position: fixed;
    top: 10px;
    right: 90px;
    padding: 10px;
    background: #444;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    z-index: 1000;
    transition: 0.3s;
}

.back-btn:hover {
    background: #666;
}

.footer {
    position: relative;
    width: 100%;
    background-color: black;
    color: #fff;
    padding: 20px 0;
    text-align: center;
    font-size: 14px;
    margin-top: auto; /* Выталкивает футер в самый низ flex-контейнера */
    flex-shrink: 0;   /* Запрещаем футеру сжиматься */
}

.footer a {
    color: #aaa;
    margin: 0 10px;
    text-decoration: none;
}

.footer a:hover {
    color: white;
}

.link-btn {
    font-size: 10px;
    color: #00bfff;
    text-decoration: none;
    background: rgba(0, 191, 255, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0, 191, 255, 0.3);
    cursor: pointer;
    transition: 0.2s;
    font-weight: bold;
}

.link-btn:hover {
    background: #00bfff;
    color: white;
}

.auth-container {
    position: relative;
    display: flex;
    font-family: sans-serif;
}

.btn-auth {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

.btn-login { background: #0088cc; color: white; }
.btn-reg { background: #2ecc71; color: white; }

/* СТИЛИ МОДАЛЬНЫХ ОКОН */
.modal {
    display: none;
    position: fixed; 
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #2c3e50;
    color: white;
    margin: 10% auto; 
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-content input {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border-radius: 5px;
    border: 1px solid #34495e;
    background: #1a252f;
    color: white;
    box-sizing: border-box;
}

.divider {
    margin: 20px 0;
    font-size: 12px;
    color: #95a5a6;
    display: flex;
    align-items: center;
}

.divider::before, .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #34495e;
    margin: 0 10px;
}

.close-link {
    display: block;
    margin-top: 20px;
    color: #bdc3c7;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
}

.close-link:hover { color: white; }

/* ОБЩИЙ КОНТЕЙНЕР ДЛЯ ЯЗЫКА И ПРОФИЛЯ */
.top-controls {
    position: fixed;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 9999;
}

/* КРАСИВЫЙ ДИЗАЙН ПРОФИЛЯ */
.tg-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(10px);
    padding: 6px 15px 6px 6px;
    border-radius: 50px;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    transition: 0.3s;
}

.tg-profile:hover {
    background: rgba(40, 40, 40, 0.8);
}

.tg-profile img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
}

.default-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #34495e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 2px solid #00bfff;
}

.tg-profile-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.tg-profile-name {
    color: white;
    font-weight: bold;
    font-size: 14px;
    line-height: 1.2;
    margin-bottom: 4px;
}

.tg-profile-actions {
    display: flex;
    gap: 6px;
}

/* Красивая кнопка Выхода */
.logout-btn {
    background: rgba(255, 77, 77, 0.15);
    color: #ff4d4d;
    border: 1px solid rgba(255, 77, 77, 0.3);
    font-size: 12px;
    padding: 8px 15px;
    border-radius: 20px;
    text-decoration: none;
    transition: 0.2s;
    margin-left: 8px;
    font-weight: bold;
}

.logout-btn:hover {
    background: #ff4d4d;
    color: white;
    border-color: #ff4d4d;
}

.top-back {
    position: fixed; top: 15px; right: 120px; padding: 8px 15px;
    font-size: 14px; background: #444; color: white; border: none;
    border-radius: 8px; cursor: pointer; transition: 0.3s; z-index: 1000;
    font-weight: bold;
}

.top-back:hover { background: #666; }

.top-bar {
    display: flex; justify-content: space-between; align-items: center;
    margin: 10px; font-size: 14px; background: rgba(0,0,0,0.5);
    padding: 10px 15px; border-radius: 10px; flex-wrap: wrap; gap: 10px;
}

.action-btns {
    display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}

.action-btn {
    padding: 8px 14px; border: none; border-radius: 10px;
    color: white; font-weight: bold; cursor: pointer;
    transition: 0.3s; font-size: 13px;
}

.action-btn:hover { transform: scale(1.05); }

.btn-restart { 
    background: linear-gradient(45deg, #ff416c, #ff4b2b); 
    box-shadow: 0 4px 10px rgba(255, 65, 108, 0.4); 
}

.btn-finish { 
    background: linear-gradient(45deg, #11998e, #38ef7d); 
    box-shadow: 0 4px 10px rgba(56, 239, 125, 0.4); 
}

/* ЛЕВАЯ ПАНЕЛЬ */
.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 280px;
    height: 100vh;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 10000;
    transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 60px 20px 20px 20px;
    box-shadow: 10px 0 40px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: none;
}

.sidebar-overlay.active { display: block; }

.sidebar .tg-profile {
    margin-bottom: 25px;
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-account-info {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 20px;
    padding-left: 10px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-nav a {
    color: white;
    text-decoration: none;
    padding: 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    transition: 0.3s;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.15);
}

.btn-future {
    margin-top: auto;
    background: #444;
    color: #888;
    border: 1px dashed #666;
    text-align: center;
    padding: 15px;
    border-radius: 12px;
    cursor: not-allowed;
}

/* --- БАЗОВЫЕ ДОПОЛНЕНИЯ ДЛЯ ЭЛЕМЕНТОВ (вне медиа-запроса) --- */

.profile-img {
    width: 100%;
    max-width: 300px;
    border-radius: 20px;
    margin-top: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.buttons {
    margin-top: 25px;
}

/* Всплывающее уведомление "Скоро" */
.soon {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 12px 25px;
    border-radius: 12px;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.soon.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* =========================================
   АДАПТАЦИЯ ПОД МОБИЛЬНЫЕ УСТРОЙСТВА
========================================= */
@media (max-width: 768px) {
    /* Отодвигаем контент от плавающей шапки/языкового меню */
    .box {
        width: 92%;
        margin: 70px auto 40px auto; 
        padding: 25px 20px;
        box-sizing: border-box;
    }

    h1 {
        font-size: 22px;
        margin-top: 0;
    }

    /* Делаем из кнопок красивую сетку (как в меню приложений) */
    .buttons {
        display: grid;
        grid-template-columns: 1fr 1fr; /* Две колонки одинаковой ширины */
        gap: 12px; /* Расстояние между кнопками */
        margin-top: 20px;
    }

    .btn {
        margin: 0; /* Обнуляем старые margin */
        padding: 14px 10px;
        width: 100%;
        box-sizing: border-box;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Если кнопок нечетное количество, последнюю растягиваем на всю ширину */
    .btn:last-child:nth-child(odd) {
        grid-column: span 2;
    }

    /* Окно модалки на телефонах */
    .modal-content {
        width: 95%;
        margin: 20% auto;
        padding: 20px;
    }
    
    /* Учитываем свайпы и безопасные зоны на iPhone в Telegram */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}