/* ============================================
   ОБЩИЕ СТИЛИ
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #020617;
    font-family: 'Inter', sans-serif;
    color: #e8dfd0;
}

/* ============================================
   3D СФЕРА - КОНТЕЙНЕР
   ============================================ */
#sphere-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ============================================
   БАБЛ НАД СФЕРОЙ
   ============================================ */
#assistant-bubble {
    position: fixed;
    top: 18%;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: rgba(15, 23, 42, 0.92);
    border: 2px solid rgba(0, 212, 255, 0.6);
    border-radius: 20px;
    padding: 18px 36px;
    font-family: 'Almendra', serif;
    font-size: 24px;
    font-weight: 700;
    color: #7dd3fc;
    text-align: center;
    max-width: 90vw;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.8), 0 0 40px rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 60px rgba(0, 212, 255, 0.3), inset 0 0 30px rgba(0, 212, 255, 0.05);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
}

#assistant-bubble.visible {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.bubble-tail {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 12px solid rgba(0, 212, 255, 0.6);
}

/* ============================================
   ПОЛЕ ВВОДА (под сферой)
   ============================================ */
#chat-input-wrap {
    position: fixed;
    bottom: 24%;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    display: flex;
    gap: 8px;
    width: 90%;
    max-width: 480px;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

#chat-input-wrap.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

#chat-input {
    flex: 1;
    padding: 14px 20px;
    background: rgba(15, 23, 42, 0.9);
    border: 2px solid rgba(0, 212, 255, 0.4);
    border-radius: 12px;
    color: #e8dfd0;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.15), inset 0 0 15px rgba(0, 212, 255, 0.05);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#chat-input:focus {
    border-color: #00d4ff;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4), inset 0 0 20px rgba(0, 212, 255, 0.1);
}

#chat-input::placeholder {
    color: #64748b;
}

#chat-send {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #00d4ff, #7dd3fc);
    color: #0a0a1a;
    border: none;
    border-radius: 12px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-send:hover {
    transform: scale(1.08);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.8);
}

#chat-send:active {
    transform: scale(1.02);
}

#chat-send:disabled {
    opacity: 0.5;
    cursor: wait;
    transform: none;
}

/* ============================================
   КНОПКА "ВОЙТИ"
   ============================================ */
#login-button-wrap {
    position: fixed;
    bottom: 14%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    opacity: 0;
    transition: opacity 1s ease 0.5s;
}

#login-button-wrap.visible {
    opacity: 1;
}

#login-button {
    padding: 16px 52px;
    font-family: 'Almendra', serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #0a0a1a;
    background: linear-gradient(135deg, #00d4ff, #7dd3fc, #a78bfa);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.5), 0 6px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

#login-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 0 70px rgba(0, 212, 255, 0.8), 0 10px 30px rgba(0, 0, 0, 0.6);
}

#login-button:active {
    transform: translateY(-1px) scale(1.02);
}

/* ============================================
   COOKIE-БАННЕР
   ============================================ */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.96);
    border-top: 2px solid rgba(0, 212, 255, 0.4);
    padding: 18px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.5s ease, opacity 0.5s ease;
}

#cookie-banner.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.cookie-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.cookie-text {
    font-size: 14px;
    color: #cbd5e1;
    line-height: 1.5;
}

.cookie-link {
    color: #7dd3fc;
    text-decoration: underline;
    transition: color 0.2s;
}

.cookie-link:hover {
    color: #00d4ff;
}

.cookie-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #cbd5e1;
    user-select: none;
}

.cookie-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #00d4ff;
    cursor: pointer;
    flex-shrink: 0;
}

.cookie-checkbox span {
    line-height: 1.4;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 10px 22px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: 'Inter', sans-serif;
}

.cookie-btn.primary {
    background: linear-gradient(135deg, #00d4ff, #7dd3fc);
    color: #0a0a1a;
    border: none;
}

.cookie-btn.primary:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
    transform: translateY(-2px);
}

.cookie-btn.primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cookie-btn.secondary {
    background: rgba(0, 212, 255, 0.1);
    color: #7dd3fc;
    border-color: rgba(0, 212, 255, 0.4);
}

.cookie-btn.secondary:hover {
    background: rgba(0, 212, 255, 0.2);
}

/* ============================================
   МОДАЛЬНОЕ ОКНО ВХОДА
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-content {
    position: relative;
    background: rgba(15, 23, 42, 0.98);
    border: 2px solid rgba(0, 212, 255, 0.4);
    border-radius: 20px;
    padding: 40px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 0 80px rgba(0, 212, 255, 0.3), 0 20px 60px rgba(0, 0, 0, 0.8);
    z-index: 1;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.hidden .modal-content {
    transform: scale(0.9);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #00d4ff;
}

.modal-title {
    font-family: 'Almendra', serif;
    font-size: 26px;
    color: #7dd3fc;
    text-align: center;
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 28px;
}

.login-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.login-service {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 12px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #e8dfd0;
    font-family: 'Inter', sans-serif;
}

.login-service:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.2);
}

.service-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 700;
    font-family: 'Almendra', serif;
    color: #fff;
}

.service-icon.google { background: linear-gradient(135deg, #4285f4, #34a853, #fbbc05, #ea4335); }
.service-icon.steam { background: linear-gradient(135deg, #1b2838, #66c0f4); }
.service-icon.phone { background: linear-gradient(135deg, #22c55e, #16a34a); }
.service-icon.sber { background: linear-gradient(135deg, #21a038, #0f7f2c); }
.service-icon.gosuslugi { background: linear-gradient(135deg, #0d4cd3, #1a3a8f); }

.service-name {
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
}

/* ============================================
   МЕНЮ ПОСЛЕ ВХОДА (по центру экрана)
   ============================================ */
#top-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

#top-menu.visible {
    opacity: 1;
    pointer-events: auto;
}

.top-menu-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    padding: 20px;
}

/* ============================================
   ПРИВЕТСТВЕННЫЙ БАБЛ В МЕНЮ
   ============================================ */
.menu-welcome-bubble {
    position: fixed;
    top: 15%;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(15, 23, 42, 0.92);
    border: 2px solid rgba(0, 212, 255, 0.6);
    border-radius: 20px;
    padding: 20px 40px;
    font-family: 'Almendra', serif;
    font-size: 22px;
    font-weight: 700;
    color: #7dd3fc;
    text-align: center;
    max-width: 90vw;
    z-index: 101;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.8), 0 0 40px rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 60px rgba(0, 212, 255, 0.3), inset 0 0 30px rgba(0, 212, 255, 0.05);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
    line-height: 1.5;
}

.menu-welcome-bubble.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.top-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 10px;
    color: #b8d8ff;
    text-decoration: none;
    font-family: 'Almendra', serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
}

.top-menu-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: #00d4ff;
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
}

.top-menu-btn.logout {
    border-color: rgba(255, 100, 100, 0.4);
    color: #ffb8b8;
}

.top-menu-btn.logout:hover {
    background: rgba(255, 100, 100, 0.15);
    border-color: #ff6464;
    box-shadow: 0 0 30px rgba(255, 100, 100, 0.4);
}

/* Плавное исчезновение Ассистента */
#sphere-container,
#assistant-bubble,
#chat-input-wrap,
#login-button-wrap {
    transition: opacity 0.6s ease, transform 0.6s ease;
}

body.assistant-hidden #sphere-container {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.7);
}

body.assistant-hidden #assistant-bubble {
    opacity: 0;
    pointer-events: none;
}

body.assistant-hidden #chat-input-wrap {
    opacity: 0;
    pointer-events: none;
}

body.assistant-hidden #login-button-wrap {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   ФУТЕР СО СТАТИСТИКОЙ
   ============================================ */
#stats-footer {
    position: fixed;
    bottom: 8px;
    left: 0;
    width: 100%;
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: rgba(180, 200, 230, 0.6);
    z-index: 5;
    pointer-events: none;
    letter-spacing: 0.3px;
}

#stats-footer-text {
    background: rgba(15, 23, 42, 0.6);
    padding: 4px 14px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ============================================
   МОБИЛЬНАЯ АДАПТАЦИЯ — ОБЩАЯ
   ============================================ */
@media (max-width: 768px) {
    #assistant-bubble {
        top: 12%;
        font-size: 18px;
        padding: 14px 24px;
    }

    #login-button {
        padding: 14px 40px;
        font-size: 18px;
    }

    #login-button-wrap {
        bottom: 14%;
    }

    #chat-input-wrap {
        bottom: 30%;
        width: 92%;
    }

    #chat-input {
        font-size: 14px;
        padding: 12px 16px;
    }

    #chat-send {
        width: 46px;
        height: 46px;
        font-size: 18px;
    }

    #cookie-banner {
        flex-direction: column;
        align-items: stretch;
        padding: 16px 20px;
        gap: 12px;
    }

    .cookie-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .cookie-btn {
        flex: 1;
        min-width: 120px;
    }

    /* ============================================
       МОДАЛЬНОЕ ОКНО ВХОДА — КОМПАКТНО
       ============================================ */
    .modal-content {
        padding: 20px 16px;
        max-width: 92vw;
        width: 92vw;
        border-radius: 16px;
        max-height: 85vh;
        overflow-y: auto;
        box-shadow: 0 0 40px rgba(0, 212, 255, 0.25), 0 10px 30px rgba(0, 0, 0, 0.7);
    }

    .modal-close {
        top: 8px;
        right: 12px;
        font-size: 24px;
    }

    .modal-title {
        font-size: 18px;
        margin-bottom: 4px;
    }

    .modal-subtitle {
        font-size: 12px;
        margin-bottom: 16px;
    }

    .login-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .login-service {
        padding: 10px 6px;
        gap: 4px;
        border-radius: 10px;
    }

    .service-icon {
        width: 32px;
        height: 32px;
        font-size: 15px;
    }

    .service-icon svg {
        width: 18px;
        height: 18px;
    }

    .service-name {
        font-size: 11px;
        line-height: 1.2;
    }

    /* ============================================
       ПРИВЕТСТВЕННЫЙ БАБЛ В МЕНЮ — СМАРТФОН
       ============================================ */
    .menu-welcome-bubble {
        top: 8%;
        left: 50%;
        transform: translateX(-50%) translateY(-20px);
        padding: 10px 16px;
        font-size: 13px;
        font-weight: 700;
        border-radius: 12px;
        border-width: 1.5px;
        max-width: 94vw;
        min-width: 0;
        width: auto;
        line-height: 1.35;

        text-shadow:
            0 0 8px rgba(0, 212, 255, 1.0),
            0 0 16px rgba(0, 212, 255, 0.7),
            0 0 24px rgba(0, 212, 255, 0.4);
        box-shadow:
            0 0 25px rgba(0, 212, 255, 0.5),
            0 0 50px rgba(0, 212, 255, 0.25),
            inset 0 0 12px rgba(0, 212, 255, 0.1);
    }

    .menu-welcome-bubble.visible {
        transform: translateX(-50%) translateY(0);
    }

    .top-menu-inner {
        padding-top: 80px;
        padding-left: 12px;
        padding-right: 12px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .top-menu-btn {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 10px;
    }
}

/* ============================================
   ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (≤ 400px)
   ============================================ */
@media (max-width: 400px) {
    .menu-welcome-bubble {
        top: 6%;
        padding: 8px 12px;
        font-size: 12px;
        max-width: 96vw;
        border-radius: 10px;
        line-height: 1.3;
    }

    .top-menu-inner {
        padding-top: 70px;
        gap: 8px;
    }

    .top-menu-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}