    /* Светлая тема по умолчанию */
    :root {
      --bg: #f5f7fb;
      --primary: #1e88e5;
      --secondary: #64b5f6;
      --accent: #69c0ff;
      --text: #0f172a;
      --muted: #4f5b78;
      --glass: rgba(255,255,255,0.9);
      --border: rgba(15,23,42,0.08);
      --shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
    }
    /* Тёмная тема */
    :root:has(#themeToggle:checked) {
      --bg: #0f172a;
      --primary: #1e88e5;
      --secondary: #64b5f6;
      --accent: #69c0ff;
      --text: #e3f2fd;
      --muted: #c6d4f0;
      --glass: rgba(255,255,255,0.08);
      --border: rgba(255,255,255,0.15);
      --shadow: 0 20px 40px rgba(14, 63, 113, 0.35);
    }

    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body {
      margin: 0;
      font-family: 'Inter', system-ui, -apple-system, sans-serif;
      color: var(--text);
      background: var(--bg);
      -webkit-font-smoothing: antialiased;
    }
    a { color: inherit; text-decoration: none; }
    h1,h2,h3,h4 { margin: 0; }
    p { margin: 0; color: var(--muted); }

    /* Анимация появления */
    .reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}
    .reveal.show { opacity: 1; transform: none; }

    body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 10% 20%, rgba(30, 136, 229, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(100, 181, 246, 0.05) 0%, transparent 40%);
    z-index: -1;
    animation: meshFlow 20s infinite alternate;
}

@keyframes meshFlow {
    0% { transform: scale(1); }
    100% { transform: scale(1.1) translateX(20px); }
}

  background:
    radial-gradient(circle at 15% 20%, rgba(105,192,255,0.18), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(100,181,246,0.14), transparent 28%),
    radial-gradient(circle at 50% 80%, rgba(30,136,229,0.12), transparent 32%);
}

    header {
      position: sticky; top: 0; z-index: 100;
      backdrop-filter: blur(18px);
      background: rgba(255,255,255,0.85);
      border-bottom: 1px solid var(--border);
    }
    :root:has(#themeToggle:checked) header { background: rgba(10,16,32,0.78); }

    /* ИСПРАВЛЕНИЕ ШАПКИ */
.nav {
  display: flex;
  align-items: center; /* Строгое выравнивание по центру */
  justify-content: space-between;
  height: 70px; /* Фиксированная высота */
  padding: 0 24px;
}

/* Группировка правой части */
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px; /* Расстояние между элементами */
}

/* Настройка аватарки */
.avatar-container {
    width: 45px;
    height: 45px;
    cursor: pointer;
    border-radius: 50%; /* Делает контейнер идеально круглым */
    overflow: hidden;    /* Обрезает всё, что выходит за пределы круга */
    border: 2px solid var(--primary); /* Яркая рамка в цвет сайта */
    background: #0f172a; /* Темный фон, чтобы аватарка не казалась дыркой */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;   /* ВАЖНО: картинка заполняет круг, лишнее обрезается */
    display: block;
}

/* Эффект свечения при наведении */
.avatar-container:hover {
    box-shadow: 0 0 15px var(--primary);
    transform: scale(1.05);
}

/* Если картинка всё равно кажется смещенной, добавь это: */
#userAvatar {
    transform: scale(1.1); /* Можно чуть увеличить масштаб внутри круга */
}

.nav-auth-btn {
    padding: 8px 24px !important;
    margin: 0 !important;
    font-size: 14px;
    border-radius: 10px;
}
    .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: 0.6px; font-size: 1.15rem; }
    .brand img { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; box-shadow: 0 0 16px rgba(100,181,246,0.5); }
    .nav-links { display: flex; gap: 18px; font-weight: 500; font-size: 0.95rem; flex-wrap: wrap; }
    .nav-links a { opacity: 0.8; transition: 0.2s; }
    .nav-links a:hover { opacity: 1; color: var(--accent); }

    /* Переключатель темы (без JS) */
    .themeToggle span {
    display: inline-block;
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.theme-checkbox:checked + .slider + span {
    transform: rotate(360deg) scale(1.2);
}
    .switch { position: relative; display: inline-block; width: 48px; height: 26px; }
    .switch input { opacity: 0; width: 0; height: 0; }
    .slider {
      position: absolute; cursor: pointer; top:0; left:0; right:0; bottom:0;
      background: rgba(0,0,0,0.1); transition: .3s; border-radius: 14px; border: 1px solid var(--border);
    }
    .slider:before {
      position: absolute; content:""; height:20px; width:20px; left:3px; bottom:2px;
      background:#fff; box-shadow: 0 2px 6px rgba(0,0,0,0.2); transition:.3s; border-radius:50%;
    }
    .switch input:checked + .slider { background: linear-gradient(135deg, var(--secondary), var(--primary)); }
    .switch input:checked + .slider:before { transform: translateX(20px); }

.hero {
  background: transparent;
}
    .hero-content {
      max-width: 1200px; margin: 0 auto; padding: 90px 24px 70px;
      display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
      gap: 40px; align-items: center;
    }
    .hero-text {
      background: rgba(255,255,255,0.9);
      border: 1px solid rgba(15,23,42,0.08);
      border-radius: 18px; padding: 24px;
      box-shadow: 0 12px 30px rgba(0,0,0,0.12);
      backdrop-filter: blur(10px);
    }
    :root:has(#themeToggle:checked) .hero-text {
      background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); box-shadow: var(--shadow);
    }
    .hero-text h1 { font-size: clamp(2rem, 3.5vw, 3.2rem); line-height: 1.2; color: var(--text); }
    .gradient-text { background: linear-gradient(135deg, #64b5f6, #1e88e5 50%, #69c0ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; display: inline-block; }
    .hero-text p { margin-top: 14px; font-size: 1.05rem; color: var(--muted); max-width: 620px; }
    .cta { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; }
    .btn {
      border: 1px solid var(--border); padding: 12px 18px; border-radius: 12px;
      font-weight: 600; color: var(--text);
      background: linear-gradient(135deg, rgba(100,181,246,0.12), rgba(30,136,229,0.16));
      box-shadow: var(--shadow); transition: 0.2s ease; cursor: pointer;
    }
    .btn:hover { transform: translateY(-1px); border-color: rgba(105,192,255,0.45); box-shadow: 0 12px 28px rgba(17, 99, 169, 0.4); }
    .btn.secondary { background: transparent; border: 1px solid rgba(100,181,246,0.5); color: var(--muted); box-shadow: none; }

    .hero-card, .card, .chat-container, .question, .stat-item {
      background: var(--glass); border: 1px solid var(--border);
      border-radius: 16px; box-shadow: var(--shadow);
    }

    /* Общий контейнер для 4-х элементов */
.stats {
    display: grid;
    /* Разделяем на 2 колонки (на больших экранах) */
    grid-template-columns: repeat(2, 1fr);
    gap: 20px; /* Расстояние между плитками */
    margin-top: 25px;
}

/* Каждая отдельная плитка (АйТьютор и т.д.) */
.stat-item {
    background: rgba(255, 255, 255, 0.05); /* Легкая подложка */
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Текст по левому краю */
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.stat-item:hover::before {
    transform: scaleY(1);
}

/* Эффект при наведении */
.stat-item:hover {
    background: rgba(30, 136, 229, 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Заголовки (АйТьютор 🎓 и др.) */
.stat-item .num {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--primary); /* Выделяем название синим цветом */
}

/* Описание (Подсказки без готовых ответов и др.) */
.stat-item small {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--muted);
    display: block;
}

/* Адаптив: на мобилках в 1 колонку */
@media (max-width: 600px) {
    .stats {
        grid-template-columns: 1fr;
    }
}

    section { max-width: 1200px; margin: 0 auto; padding: 64px 24px; position: relative; }
    .section-title { text-align: center; margin-bottom: 14px; font-size: clamp(1.6rem, 2.8vw, 2.2rem); color: var(--text); }
    .section-subtitle { text-align: center; color: var(--muted); max-width: 720px; margin: 0 auto 28px; line-height: 1.6; }
    .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }

    .card { padding: 22px; position: relative; overflow: hidden; }
    .card::after {
      content: ""; position: absolute; width: 140px; height: 140px;
      background: radial-gradient(circle, rgba(100, 181, 246, 0.15), transparent 60%);
      top: -40px; right: -40px; transform: rotate(12deg); opacity: 0.7;
    }
    .card h3 { margin-bottom: 10px; display: flex; gap: 8px; align-items: center; color: var(--text); }
    .card p { line-height: 1.55; color: var(--muted); }
    .tag {
      display: inline-flex; align-items: center; gap: 8px;
      padding: 6px 10px; border-radius: 10px; font-size: 0.85rem;
      color: var(--muted); background: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.7);
      margin-bottom: 10px;
    }
    :root:has(#themeToggle:checked) .tag { color: #c9e2ff; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); }

    .list { padding-left: 18px; margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
    .benefits { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 16px; }
    .benefit { background: var(--glass); border: 1px solid var(--border); padding: 16px; border-radius: 12px; line-height: 1.55; color: var(--muted); }
    .benefit strong { display: block; color: var(--text); margin-bottom: 6px; }

    .timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 16px; }
    .step { background: var(--glass); border: 1px solid var(--border); padding: 16px; border-radius: 12px; position: relative; color: var(--muted); }
    .step h4 { color: var(--text); margin-bottom: 6px; }
    .step::before {
      content: attr(data-step); position: absolute; top: 12px; right: 12px;
      font-size: 0.9rem; color: var(--muted); background: rgba(100,181,246,0.14);
      border-radius: 10px; padding: 4px 8px;
    }

    .cta-block {
      background: linear-gradient(135deg, rgba(30,136,229,0.08), rgba(100,181,246,0.12));
      border: 1px solid rgba(105,192,255,0.25);
      border-radius: 18px;
      padding: 26px;
      display: grid;
      grid-template-columns: 1fr;
      gap: 12px;
      box-shadow: 0 16px 32px rgba(15, 52, 94, 0.25);
    }
    .links-row { display: flex; flex-wrap: wrap; gap: 10px; }
    .pill { display: inline-block; padding: 6px 12px; border-radius: 14px; background: rgba(255,255,255,0.06); border: 1px solid rgba(100,181,246,0.3); color: #4c6aa6; font-size: 0.9rem; }
    :root:has(#themeToggle:checked) .pill { color: #cde7ff; }

    /* Диалоги */
    .dialog { line-height: 1.55; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

    /* Веб-чат (сохранён) */
    #webchat {
    margin-top: 80px;
    padding: 40px;
    background: var(--glass);
    border-radius: 32px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.chat-messages {
    height: 400px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.05); /* Темная подложка для сообщений */
    padding: 20px;
    margin-bottom: 20px;
    border: 1px inset var(--border);
}

/* Стили поля ввода в чате */
.chat-input-container {
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.chat-input-container input {
    background: transparent;
    border: none;
    color: var(--text);
    padding: 10px 15px;
    flex: 1;
}

.chat-input-container input:focus {
    outline: none;
}

/* Анимация сообщений */
.message {
    animation: messageSlide 0.4s ease-out;
}

@keyframes messageSlide {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
    .chat-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
    .chat-header-left { display: flex; align-items: center; gap: 12px; }
    .bot-logo { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; box-shadow: 0 0 12px rgba(100,181,246,0.5); }
    .chat-select {
      background: rgba(255,255,255,0.7); border: 1px solid rgba(100,181,246,0.3);
      color: var(--text); border-radius: 12px; padding: 10px; font-size: 0.95rem;
    }
    .chat-log {
      margin-top: 12px; background: rgba(255,255,255,0.7);
      border: 1px solid var(--border); border-radius: 12px;
      padding: 14px; max-height: 360px; overflow-y: auto;
      font-size: 0.95rem; line-height: 1.55; color: var(--text);
    }
    .msg { margin-bottom: 12px; }
    .msg .role { font-weight: 600; color: var(--primary); margin-bottom: 4px; }
    .msg .attachments { font-size: 0.9rem; color: var(--muted); }
    .loading { display: none; align-items: center; gap: 8px; color: var(--muted); font-size: 0.95rem; margin-top: 8px; }
    .dot-anim { width: 6px; height: 6px; border-radius: 50%; background: #9fd3ff; animation: blink 1s infinite alternate; }
    .dot-anim:nth-child(2){ animation-delay: 0.2s; } .dot-anim:nth-child(3){ animation-delay: 0.4s; }
    @keyframes blink { from { opacity: 0.3; transform: translateY(0);} to { opacity: 1; transform: translateY(-2px);} }
    .chat-input { margin-top: 10px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: flex-start; }
    .chat-input textarea {
      width: 100%; min-height: 48px; max-height: 200px;
      border-radius: 12px; border: 1px solid rgba(100,181,246,0.25);
      background: rgba(255,255,255,0.7); color: var(--text);
      padding: 10px; resize: none; font-size: 0.95rem; outline: none; transition: height 0.1s ease;
    }
    .attach-row { margin-top: 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; }
    .file-label { cursor: pointer; padding: 6px 10px; border-radius: 10px; border: 1px solid rgba(100,181,246,0.3); background: rgba(255,255,255,0.6); color: var(--text); }

    /* FAQ */
    .faq { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
    .question { padding: 18px; }
    .question h4 { margin-bottom: 6px; color: var(--text); }

    footer {
    margin-top: 100px;
    padding: 60px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.social-links a {
    display: inline-block;
    margin: 0 15px;
    font-size: 1.5rem;
    transition: transform 0.3s ease, color 0.3s ease;
    color: var(--muted);
}

.social-links a:hover {
    transform: scale(1.3) rotate(8deg);
    color: var(--primary);
}
    :root:has(#themeToggle:checked) footer { background: rgba(10,16,32,0.9); }
    .footer-content {
      max-width: 1200px; margin: 0 auto; padding: 18px 24px 30px;
      display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; color: var(--muted); font-size: 0.95rem;
    }
    @media (max-width: 640px) {
      .nav-links { display: none; }
      .hero-content { padding-top: 64px; }
    }

/* --- ФИНАЛЬНЫЙ БЛОК АВТОРИЗАЦИИ --- */
.auth-page-bg {
    background: var(--bg);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.glass-liquid {
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 24px;
    padding: 35px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.method-tabs {
    display: flex;
    background: rgba(0,0,0,0.05);
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.tab-item {
    flex: 1;
    border: none;
    background: none;
    padding: 10px;
    cursor: pointer;
    border-radius: 8px;
    color: var(--muted);
    transition: 0.3s;
}

.tab-item.active {
    background: white;
    color: var(--text);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.glass-field {
    width: 100%;
    padding: 14px;
    margin-bottom: 12px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.5) !important;
    box-sizing: border-box;
}

.btn-liquid {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
}

.btn-liquid.primary { background: var(--primary); color: white; }
.btn-liquid.secondary { background: rgba(255,255,255,0.3); color: var(--primary); border: 1px solid var(--primary); }

.social-row { display: flex; justify-content: center; gap: 15px; margin-top: 15px; }
.social-btn {
    width: 50px; height: 50px; border-radius: 50%; border: 1px solid #ddd;
    background: white; display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* Контейнер кнопок в выпадающем меню */
.settings-dropdown button {
    width: 100%;
    padding: 10px 15px;
    margin-top: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}

.settings-dropdown button:hover {
    background: rgba(30, 136, 229, 0.1);
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Кнопка "Выйти" - сделаем её акцентной (красноватой) */
.settings-dropdown .logout-btn {
    border-color: rgba(255, 77, 77, 0.2);
    color: #ff4d4d;
}

/* Выпадающее меню — делаем его более компактным */
.settings-dropdown {
    position: absolute;
    top: 50px; /* Расстояние от аватарки */
    right: 0;
    width: 160px; /* Немного сузили */
    background: var(--glass);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px; /* Уменьшили внутренние отступы */
    box-shadow: var(--shadow);
    display: none;
    z-index: 1000;
}

/* Стилизация компактных кнопок */
.settings-dropdown button {
    width: 100%;
    padding: 6px 10px; /* Уменьшили высоту кнопок */
    margin-top: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px; /* Уменьшили шрифт */
    font-weight: 500;
    transition: all 0.2s ease;
}

.settings-dropdown button:hover {
    background: rgba(30, 136, 229, 0.1);
    border-color: var(--primary);
}

/* Кнопка "Выйти" */
.settings-dropdown .logout-btn {
    color: #ff4d4d;
    border-color: rgba(255, 77, 77, 0.1);
}

/* Информация о пользователе */
.settings-info {
    padding: 2px 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
}

hr {
    margin: 6px 0;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Это правило делает меню видимым, когда JS добавляет класс active */
.settings-dropdown.active {
    display: block !important;
    animation: fadeIn 0.2s ease-out; /* Плавное появление (опционально) */
}

/* Простая анимация появления */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Затемненный фон на весь экран */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Полупрозрачный черный */
    backdrop-filter: blur(5px);      /* Размытие фона сайта */
    display: none;                   /* Скрыто по умолчанию */
    align-items: center;
    justify-content: center;
    z-index: 2000;                   /* Чтобы было поверх всего */
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Когда окно активно */
.modal-overlay.open {
    display: flex;
    opacity: 1;
}

/* Само окошко */
.modal-content {
    background: var(--glass);
    border: 1px solid var(--border);
    padding: 25px;
    border-radius: 16px;
    width: 300px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

/* Заголовок */
.modal-content h3 {
    margin: 0 0 15px 0;
    color: var(--text);
}

/* Поле ввода */
.modal-content input {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: var(--text);
    outline: none;
}

.modal-content input:focus {
    border-color: var(--primary);
}

/* Кнопки в модалке */
.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-buttons button {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}

.cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.save-btn {
    background: var(--primary);
    color: white;
}

.save-btn:hover {
    background: var(--secondary);
}

/* Добавляем !important, чтобы перебить стиль hover */
.dropdown-menu.force-hide {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none; /* Чтобы меню не мешало кликам */
}

/* Контейнер для всей "таблицы" преимуществ */
.features-grid {
    display: grid;
    /* Создаем колонки с минимальной шириной 250px */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    /* Увеличиваем расстояние между карточками (главное лекарство от кучности) */
    gap: 30px;
    padding: 40px 0;
    margin-top: 20px;
}

/* Каждая отдельная карточка */
.feature-card {
    background: var(--glass);
    border: 1px solid var(--border);
    padding: 30px; /* Внутренние отступы, чтобы текст не жал в края */
    border-radius: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Выравнивание по левому краю */
    text-align: left;
}

/* Эффект при наведении, чтобы добавить объема */
.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

/* Иконка (смайлик или картинка) */
.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 20px; /* Отступ от иконки до заголовка */
}

/* Заголовок внутри карточки */
.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 12px; /* Отступ от заголовка до описания */
    color: var(--primary);
}

/* Текст описания */
.feature-card p {
    font-size: 1rem;
    line-height: 1.6; /* Раздвигаем строки текста */
    color: var(--muted);
    margin: 0;
}

/* Находим карточку, где лежит этот текст */
.hero-card {
    padding: 60px 40px !important; /* Увеличиваем внутренние поля всей карточки */
    display: flex;
    flex-direction: column;
    gap: 20px; /* Это создаст базовое расстояние между всеми дочерними элементами */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 0 rgba(30, 136, 229, 0);
}

.hero-card:hover {
    transform: translateY(-10px) scale(1.01);
    box-shadow: 0 20px 40px rgba(30, 136, 229, 0.15);
    border-color: rgba(30, 136, 229, 0.4);
}

/* 1. Элемент "Экосистема 4 в 1" */
.hero-card .badge {
    font-size: 1.4rem;
    margin-bottom: 10px; /* Отталкиваем заголовок снизу */
    align-self: flex-start; /* Чтобы бэдж не растягивался на всю ширину */
    padding: 8px 16px;
}

/* 2. Заголовок "Что умеет АйШкола?" */
.hero-card h3 {
    font-size: 2.2rem; /* Делаем заголовок крупнее и заметнее */
    margin: 0; /* Сбрасываем лишние внешние отступы */
    font-weight: 700;
    line-height: 1.2;
}

/* 3. Описание "Автоматизация и помощь..." */
.hero-card p {
    font-size: 1.15rem;
    margin-bottom: 20px; /* Увеличиваем отступ перед началом сетки со статистикой */
    color: var(--muted);
    max-width: 600px; /* Чтобы текст не растягивался в одну длинную тонкую линию */
    line-height: 1.6;
}

/* На всякий случай поправим саму сетку со статистикой, чтобы она не прилипала */
.stats {
    margin-top: 20px;
    border-top: 1px solid var(--border); /* Можно добавить разделительную линию для чистоты */
    padding-top: 30px;
}

.btn-liquid {
    position: relative;
    overflow: hidden;
}

.btn-liquid::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20%;
    height: 200%;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(30deg);
    transition: all 0.6s ease;
}

.btn-liquid:hover::after {
    left: 120%;
}

/* Контейнер для ботов */
/* Сетка для ботов */
.bots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 40px;
}

/* Карточка каждого бота */
.bot-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 30px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    overflow: hidden;
}

.bot-card:hover {
    transform: translateY(-12px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
    background: rgba(255, 255, 255, 0.12); /* Чуть светлее при наведении */
}

/* Декоративное свечение внутри карточки */
.bot-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(30, 136, 229, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
}

.bot-card:hover::before {
    opacity: 1;
}

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    z-index: 1001;
    transition: width 0.1s;
}

.about-content {
    display: flex;
    gap: 50px;
    align-items: center;
    padding: 60px 0;
}

.about-text {
    flex: 1;
}

.about-image {
    flex: 1;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: var(--shadow);
    /* Эффект легкого покачивания */
    animation: floating 6s ease-in-out infinite;
}

@keyframes floating {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Специальный фон для страницы чата */
/* --- ГЛОБАЛЬНЫЙ ЛЕЙАУТ ЧАТА --- */
.chat-page {
    height: 100vh; /* Строго высота экрана */
    width: 100vw;
    overflow: hidden; /* Запрещаем скролл всей страницы */
    background: var(--bg);
    display: flex; /* Используем Flex вместо Grid для надежности */
}

/* --- САЙДБАР (ЛЕВАЯ ПАНЕЛЬ) --- */
.chat-sidebar {
    width: 280px;
    height: 100%;
    background: rgba(255, 255, 255, 0.5); /* Полупрозрачный белый */
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: transform 0.3s ease;
    z-index: 100;
}

:root:has(#themeToggle:checked) .chat-sidebar {
    background: rgba(15, 23, 42, 0.6);
}

.sidebar-header {
    margin-bottom: 20px;
}

.back-link {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 15px;
    display: inline-block;
    transition: color 0.2s;
}

.back-link:hover { color: var(--primary); }

.new-chat-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary); /* Синий цвет */
    color: white;
    border: none;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3); /* Красивая тень */
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 136, 229, 0.4);
}

/* Секция выбора модели */
.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 8px;
    display: block;
    font-weight: 600;
}

/* История чатов (растягивается) */
.chat-history {
    flex: 1; /* Занимает всё свободное место */
    overflow-y: auto;
    margin: 10px -10px; /* Отрицательный отступ для скроллбара */
    padding: 0 10px;
}

/* Футер сайдбара (Опции) */
.sidebar-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.options-trigger {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.options-trigger:hover {
    background: rgba(0,0,0,0.03);
    border-color: var(--primary);
}

/* --- ОСНОВНАЯ ОБЛАСТЬ ЧАТА --- */
.chat-main {
    flex: 1; /* Занимает всю ширину минус сайдбар */
    height: 100%;
    display: flex;
    flex-direction: column; /* Вертикальная колонка */
    position: relative;
    background: radial-gradient(circle at top right, rgba(30, 136, 229, 0.05), transparent 40%);
}

/* Шапка чата */
.chat-main-header {
    height: 70px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.bot-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.current-mode {
    background: rgba(30, 136, 229, 0.1);
    color: var(--primary);
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.current-mode:hover { background: rgba(30, 136, 229, 0.2); }

/* --- ОБЛАСТЬ СООБЩЕНИЙ (СКРОЛЛ) --- */
.messages-container {
    flex: 1; /* КЛЮЧЕВОЙ МОМЕНТ: Растягивается на всю доступную высоту */
    overflow-y: auto; /* Скроллится только этот блок */
    padding: 20px 10%; /* Отступы по бокам, чтобы текст не был во всю ширь */
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* Приветственный экран */
.welcome-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-bottom: 40px; /* Чтобы не наезжало на поле ввода */
}

.welcome-screen h1 {
    font-size: 2rem;
    margin: 15px 0;
    color: var(--text);
}

.example-queries {
    display: grid !important; /* Гарантируем видимость сетки */
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 30px;
    width: 100%;
}

.query-card {
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important; /* Чтобы текст не был белым */
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.3s;
    display: block !important;
    visibility: visible !important;
}

.query-card:hover {
    background: white !important;
    border-color: var(--primary) !important;
    transform: translateY(-3px);
}

/* --- ОБЛАСТЬ ВВОДА (ФИКСИРОВАНА ВНИЗУ) --- */
.chat-input-area {
    padding: 20px 30px;
    background: transparent;
    /* Убрали фиксированный background, чтобы было ощущение "воздуха" */
}

.input-wrapper {
    max-width: 900px;
    margin: 0 auto;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 10px 15px;
    display: flex;
    align-items: flex-end; /* Выравнивание по низу, если текст многострочный */
    gap: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s;
}

.input-wrapper:focus-within {
    box-shadow: 0 10px 30px rgba(30, 136, 229, 0.15);
    border-color: rgba(30, 136, 229, 0.5);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    resize: none;
    max-height: 150px;
    padding: 12px 0;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    outline: none;
}

.attach-btn, .send-btn {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s;
    color: var(--muted);
}

.attach-btn:hover { background: rgba(0,0,0,0.05); color: var(--text); }

.send-btn {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(30, 136, 229, 0.3);
}

.send-btn:hover {
    background: var(--secondary);
    transform: scale(1.05);
}

/* --- МОБИЛЬНАЯ АДАПТАЦИЯ (Медиа-запросы) --- */
@media (max-width: 900px) {
    .chat-sidebar {
        position: absolute; /* Сайдбар становится поверх контента */
        left: -280px; /* Скрываем за экраном */
        height: 100vh;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }

    .chat-sidebar.active {
        left: 0; /* Выезжает при активации */
    }

    /* Добавляем кнопку меню на мобилках */
    .mobile-menu-btn {
        display: block !important; /* Показываем кнопку */
    }

    .messages-container {
        padding: 20px 15px; /* Меньше отступы на телефоне */
    }

    .example-queries {
        grid-template-columns: 1fr; /* Одна колонка карточек */
    }

    .chat-input-area {
        padding: 15px; /* Компактнее */
    }

    .welcome-screen h1 { font-size: 1.5rem; }
}

/* Кнопка гамбургер (по умолчанию скрыта) */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 15px;
    color: var(--text);
}

/* Общие стили для всех выпадашек */
.select-items, .options-dropdown, .modes-grid {
    position: absolute;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    display: none; /* Скрыто по умолчанию */
    z-index: 2000;
    overflow: hidden;
    animation: fadeInUp 0.25s ease-out;
}

/* Меню выбора модели */
.select-items {
    top: 100%; left: 0; right: 0;
    margin-top: 8px;
}
.select-items div {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: 0.2s;
}
.select-items div:hover { background: rgba(30, 136, 229, 0.1); }
.select-items div strong { display: block; font-size: 0.9rem; }
.select-items div small { color: var(--muted); font-size: 0.75rem; }

/* Меню опций (снизу вверх) */
.options-dropdown {
    bottom: 100%; left: 0;
    width: 260px;
    margin-bottom: 10px;
    padding: 8px;
}

.option-group {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--muted);
    padding: 10px 12px 5px;
    letter-spacing: 1px;
    font-weight: 700;
}

.option-item {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}
.option-item:hover { background: rgba(30, 136, 229, 0.08); }
.option-item.danger { color: #ff4d4d; }

/* Режимы (сетка) */
.modes-grid {
    top: 110%; left: 0;
    display: none; /* Переключается через JS */
    grid-template-columns: repeat(2, 160px);
    gap: 5px;
    padding: 10px;
}
.mode-opt {
    padding: 10px;
    border-radius: 10px;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
}
.mode-opt:hover { background: rgba(30, 136, 229, 0.1); }
.mode-opt.active { background: var(--primary); color: white; }

/* Заглушка истории */
.empty-history {
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 40px;
    opacity: 0.6;
}

/* Анимация */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Улучшенные стили меню */
.select-items, .modes-grid, .options-dropdown {
    position: absolute;
    z-index: 9999;
    background: var(--bg); /* Используем переменную темы */
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: 12px;
    display: none; /* Скрыто по умолчанию */
}

.force-show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.modes-grid.force-show {
    display: grid !important;
}

/* Стили для примеров запросов */
.example-queries {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.query-card {
    background: var(--glass);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--text);
}

.query-card:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.custom-select {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 15px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.custom-select:hover {
    border-color: var(--primary);
    background: #fdfdfd;
}

.select-selected {
    display: flex;
    flex-direction: column;
    position: relative;
}

.select-selected span {
    position: absolute;
    right: 0;
    top: 5px;
    font-size: 0.7rem;
    color: var(--muted);
}

/* --- ИСПРАВЛЕНИЕ ВЫПАДАЮЩИХ МЕНЮ --- */
.select-items, .modes-grid, .options-dropdown {
    position: absolute;
    z-index: 9999 !important;
    background: white !important;
    border: 1px solid #ddd !important;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2) !important;
    display: none;
}

/* Настройки теперь будут вылетать ВПРАВО или ВВЕРХ, но внутри видимости */
#optionsMenu {
    bottom: 50px; /* Поднимаем чуть выше кнопки */
    left: 10px;
    width: 240px;
}

/* Класс показа */
.force-show {
    display: block !important;
}

/* Фикс для карточек примеров */
.example-queries {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
}

.query-card {
    background: white;
    border: 1px solid var(--border);
    padding: 12px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    transition: 0.3s;
}

.query-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

/* Контейнер сообщений */
#chatMessages {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    animation: fadeInUp 0.3s ease;
}

.user-message {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message {
    align-self: flex-start;
    background: #e9ecef;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}

/* Анимация точек (Typing Indicator) */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #adb5bd;
    border-radius: 50%;
    animation: dotPulse 1.5s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.3); opacity: 1; }
}

.file-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 15px;
    background: rgba(0,0,0,0.02);
}

.file-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.file-item .remove-file {
    cursor: pointer;
    color: #ff4d4d;
    font-weight: bold;
}

.message-files {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.message-file-link {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: underline;
    background: rgba(30, 136, 229, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- Стили для новых кнопок меню --- */
.delete-btn {
    background-color: #fee2e2 !important; /* Светло-красный фон */
    color: #ef4444 !important;            /* Красный текст */
    border: 1px solid #fca5a5 !important;
    font-weight: bold;
}

.delete-btn:hover {
    background-color: #ef4444 !important;
    color: white !important;
}

.change-password {
    background-color: #f0f9ff;
    color: #0284c7;
}

/* --- МОДАЛЬНЫЕ ОКНА (Всплывашки) --- */
.modal-overlay {
    display: none; /* Скрыто по умолчанию */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

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

.modal-content h3 { margin-top: 0; color: #333; }
.modal-content p { color: #666; font-size: 0.9rem; }
.modal-content input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box; /* Чтобы padding не ломал ширину */
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.btn-primary { background: #1e88e5; color: white; padding: 8px 16px; border: none; border-radius: 8px; cursor: pointer; }
.btn-danger { background: #ef4444; color: white; padding: 8px 16px; border: none; border-radius: 8px; cursor: pointer; }
.btn-cancel { background: #e5e7eb; color: #333; padding: 8px 16px; border: none; border-radius: 8px; cursor: pointer; }

/* Скрытые шаги внутри модалки */
.step-container { display: none; }
.step-container.active { display: block; }