@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-page: #F8F9FB;
    --color-dark: #1E1B2E;
    --color-dark-alt: #151322;
    --text-main: #111827;
    --text-muted: #6B7280;
    --radius-bento: 32px;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Шапка — сознательно две строки на любой ширине экрана, а не только на
   узких: строка 1 — лого + вход, строка 2 (.navigation, ширина 100%,
   поэтому всегда переносится) — меню целиком отдельно. Раньше меню жило
   в одной строке с лого через grid 1fr auto 1fr и переходило на этот же
   приём только ниже 1700px — но и на широких экранах лого и меню в одной
   строке выглядели так, будто мешают друг другу, хотя формально помещались. */
.header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 20px 50px;
    gap: 12px 24px;
}
.logo {
    display: flex; align-items: center; gap: 12px; font-size: 1.25rem; font-weight: 700;
    color: var(--text-main); white-space: nowrap; flex: 1 1 auto;
}
.logo-img { height: 36px; width: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
/* Название площадки само сжимается и уходит в многоточие, если места всё
   же не хватает (очень узкий экран или длинное имя пользователя рядом). */
.logo span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-block { order: 2; flex-shrink: 0; }
.navigation {
    order: 3;
    width: 100%;
    display: flex; align-items: center; gap: 32px;
    /* safe center — по центру страницы, когда пункты умещаются в строку;
       если места всё же не хватает (узкий экран), откатывается на
       выравнивание от начала, а не обрезает первые пункты за левым краем
       недоступной для скролла областью — обычный justify-content: center
       в паре с overflow-x: auto на это способен. */
    justify-content: safe center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.navigation::-webkit-scrollbar { display: none; }
.navigation a { text-decoration: none; color: var(--text-muted); font-weight: 500; transition: color 0.2s; white-space: nowrap; }
.navigation a:hover { color: var(--text-main); }
/* Текущая страница в меню — не ссылка, а нейтральная "таблетка" (тот же
   визуальный язык, что и бейджи PRO/PLUS), кликом никуда не ведёт. */
.navigation .nav-current {
    background: #eff6ff;
    color: #2563eb;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: default;
    user-select: none;
    white-space: nowrap;
}
/* "Возможности" — выделяется среди остальных пунктов меню тем же зелёным,
   что и бейдж "новое" на самой странице — держим её на виду. */
.navigation a.nav-features { color: #059669; font-weight: 700; }
.navigation a.nav-features:hover { color: #047857; }
.navigation .nav-current.nav-features { background: rgba(16, 185, 129, 0.12); color: #059669; }
.nav-icon { font-size: 0.85em; margin-left: 2px; }

/* Тёмная тема шапки — для страниц с тёмным интерфейсом (аналитики,
   фандинг, скринер). Один класс вместо inline-стилей на каждой ссылке. */
.header-dark { background: #0f172a; border-bottom: 1px solid #1e293b; }
.header-dark .logo { color: #fff; }
.header-dark .navigation a { color: #94a3b8; }
.header-dark .navigation a:hover { color: #f8fafc; }
.header-dark .navigation .nav-current { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.header-dark .navigation a.nav-features { color: #34d399; }
.header-dark .navigation a.nav-features:hover { color: #6ee7b7; }
.header-dark .navigation .nav-current.nav-features { background: rgba(16, 185, 129, 0.18); color: #34d399; }

/* Кнопки */
.btn { padding: 12px 28px; border-radius: 40px; font-weight: 600; font-size: 0.9rem; cursor: pointer; border: none; display: inline-block; transition: all 0.3s ease; text-decoration: none; }
.btn-primary { background-color: #2563EB; color: #fff; }
.btn-primary:hover { background-color: #1D4ED8; transform: translateY(-2px); }
.btn-outline-light { border: 1px solid rgba(255,255,255,0.2); color: #fff; text-align: center; }

/* =========================================
   КАРУСЕЛЬ БАННЕРОВ (MASTER FINAL FIX)
========================================= */
.hero-ad-section { padding: 0 50px 30px; }
.carousel-container {
    position: relative; height: 480px; border-radius: 32px; overflow: hidden; background-color: #0f172a;
}
.carousel-slide {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; padding: 60px 60px 150px 60px; box-sizing: border-box;
    opacity: 0; visibility: hidden; transition: opacity 1s ease-in-out, visibility 1s; z-index: 1;
}
.carousel-slide.active { opacity: 1; visibility: visible; z-index: 5; }

/* ФОН С АНИМАЦИЕЙ ZOOM */
.slide-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover; background-position: center; z-index: 1; transform: scale(1.1);
}
.carousel-slide.active .slide-bg { animation: bgZoom 10s forwards linear; }
@keyframes bgZoom { from { transform: scale(1.1); } to { transform: scale(1.0); } }

.slide-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.4) 60%, transparent 100%);
    z-index: 2;
}

/* КОНТЕНТ */
.banner-info-wrap {
    position: relative; z-index: 10; max-width: 650px; opacity: 0;
    transform: translateY(30px); transition: all 0.8s ease-out 0.5s;
}
.carousel-slide.active .banner-info-wrap { opacity: 1 !important; transform: translateY(0) !important; }

.ad-tag {
    display: inline-block; background: rgba(37, 99, 235, 0.8); backdrop-filter: blur(4px);
    padding: 6px 14px; border-radius: 20px; font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; color: #fff; margin-bottom: 20px;
}
.banner-info-wrap h1 { font-size: 3.5rem; line-height: 1.1; margin: 0 0 20px 0; color: #ffffff !important; font-weight: 800; }
.banner-info-wrap p { font-size: 1.2rem; color: rgba(255,255,255,0.9) !important; margin-bottom: 35px; }

/* ТОЧКИ (Dots) */
.carousel-indicators {
    position: absolute; bottom: 40px; left: 60px; z-index: 100 !important; display: flex; gap: 12px;
}
.dot {
    width: 12px !important; height: 12px !important;
    background-color: rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important; cursor: pointer !important;
    transition: all 0.3s ease; border: none !important;
}
.dot:hover { background-color: rgba(255, 255, 255, 0.6) !important; }
.dot.active { background-color: #2563eb !important; transform: scale(1.3); box-shadow: 0 0 10px rgba(37, 99, 235, 0.8); }

/* =========================================
   СЕТКА BENTO (Остальное без изменений)
========================================= */
.main-content { max-width: 1400px; margin: 0 auto; padding-bottom: 80px; }
.bento-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: minmax(280px, auto); gap: 30px; padding: 0 50px; }
/* justify-content: flex-start (не space-between) — иначе заголовок в карточках
   с доп. кнопкой внизу (Гамма, Роботы) съезжает выше, чем в соседних
   карточках без кнопки (Crypto, MOEX), и заголовки в одном ряду не совпадают
   по высоте. Кнопку внизу карточки прижимаем отдельно через margin-top:auto. */
.bento-card { text-decoration: none; border-radius: var(--radius-bento); padding: 40px; display: flex; flex-direction: column; justify-content: flex-start; transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1); position: relative; overflow: hidden; background-color: #fff; border: 1px solid rgba(0,0,0,0.05); }
.bento-card::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; opacity: 0.15; transition: transform 0.8s ease, opacity 0.5s ease; z-index: 0; }
.bento-card:hover { transform: translateY(-10px) scale(1.01); box-shadow: 0 30px 60px rgba(0,0,0,0.12); }
.bento-card:hover::after { transform: scale(1.1); opacity: 0.25; }
.bento-card > * { position: relative; z-index: 2; }
.card-courses { background: linear-gradient(135deg, #fdfcfb 0%, #e2d1c3 100%); flex-direction: row !important; align-items: center; }
.card-courses::after { background-image: url('https://images.unsplash.com/photo-1633167606207-d840b5070fc2?q=80&w=1000&auto=format&fit=crop'); opacity: 0.4; }
.card-crypto { background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%); color: #fff !important; border: 1px solid rgba(56, 189, 248, 0.2) !important; }
.card-crypto::after { background-image: url('../images/patterns/crypto.svg'); opacity: 0.5; }
.card-crypto:hover { box-shadow: 0 30px 60px rgba(56, 189, 248, 0.2); }
.card-moex { background: linear-gradient(135deg, rgba(30, 27, 75, 0.9) 0%, rgba(49, 46, 129, 0.9) 100%); color: #fff !important; border: 1px solid rgba(255, 255, 255, 0.1) !important; }
.card-moex::after { background-image: url('../images/patterns/moex.svg'); opacity: 0.5; }
.card-moex:hover { box-shadow: 0 30px 60px rgba(49, 46, 129, 0.3); }
.card-robots { background: linear-gradient(135deg, rgba(2, 6, 23, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%); color: #fff !important; }
.card-robots::after { background-image: url('../images/patterns/robots.svg'); opacity: 0.5; }
.card-robots:hover { box-shadow: 0 30px 60px rgba(37, 99, 235, 0.2); }
.card-robots p { color: #94a3b8 !important; }
/* Гамма-экспозиция раньше делила класс (и картинку) с "Роботами" — теперь
   свой фон в тему инструмента (профиль GEX по страйкам), тот же тёмный
   стиль карточки. */
.card-gex { background: linear-gradient(135deg, rgba(2, 6, 23, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%); color: #fff !important; }
.card-gex::after { background-image: url('../images/patterns/gex.svg'); opacity: 0.6; }
.card-gex:hover { box-shadow: 0 30px 60px rgba(37, 99, 235, 0.2); }
.card-gex p { color: #94a3b8 !important; }
.card-funding { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); }
.card-funding::after { background-image: url('../images/patterns/funding.svg'); opacity: 0.6; }
.col-span-3 { grid-column: span 3; }

/* =========================================
   ЖИВАЯ ПОЛОСА ГАММА-ЭКСПОЗИЦИИ (главная, между hero и bento-grid)
   Данные берутся с тех же публичных эндпоинтов, что и gex_free_usd.html /
   gex_free_eth.html — см. js/homepage_gex_widgets.js.
========================================= */
/* Вставлена, как карусель, отдельным скруглённым блоком, не на всю ширину
   экрана — margin вместо padding, чтобы фон не растягивался под отступом. */
.live-gex-strip { margin: 0 50px 30px; padding: 28px 32px; border-radius: var(--radius-bento); background: #0b0f19; position: relative; overflow: hidden; box-sizing: border-box; }
.live-gex-strip::before {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(circle at 15% 20%, rgba(16,185,129,.10), transparent 45%), radial-gradient(circle at 85% 80%, rgba(37,99,235,.12), transparent 45%);
}
.strip-inner { position: relative; max-width: 1300px; margin: 0 auto; display: flex; align-items: center; gap: 32px; }
.strip-text { flex: 0 0 260px; }
.strip-tag { display: inline-flex; align-items: center; gap: 7px; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6ee7b7; margin-bottom: 6px; }
.strip-text h2 { color: #fff; font-size: 1.15rem; font-weight: 800; margin: 0 0 6px; line-height: 1.3; }
.strip-text p { color: #94a3b8; font-size: .82rem; margin: 0; line-height: 1.4; }

.widget-row { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.widget { background: rgba(255,255,255,.04); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.08); border-radius: 20px; padding: 16px 18px; box-sizing: border-box; text-decoration: none; display: block; transition: border-color .2s, background .2s; }
.widget:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.16); color: inherit; }
.widget-top { display: flex; align-items: center; gap: 8px; }
/* Точка "live" — тот же пульс, что animate-ping у liveStatus на страницах
   аналитики (см. gex_app.js), только на чистом CSS вместо Tailwind-класса. */
.live-dot { position: relative; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: #94a3b8; color: #94a3b8; }
.live-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid currentColor; opacity: .5; animation: gexPulse 1.8s ease-out infinite; }
.live-dot.up { background: #10B981; color: #10B981; }
.live-dot.down { background: #EF4444; color: #EF4444; }
@keyframes gexPulse { 0% { transform: scale(.6); opacity: .6; } 100% { transform: scale(2.2); opacity: 0; } }
.widget-label { font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #94a3b8; flex-grow: 1; }
.widget-free { font-size: .6rem; font-weight: 800; text-transform: uppercase; color: #6ee7b7; background: rgba(16,185,129,.14); border: 1px solid rgba(16,185,129,.3); padding: 2px 7px; border-radius: 7px; }
.widget-value { font-size: 1.4rem; font-weight: 800; color: #fff; margin: 8px 0 5px; letter-spacing: -.01em; }
.widget-gex { display: inline-flex; align-items: center; gap: 5px; font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 7px; margin-bottom: 8px; background: rgba(255,255,255,.06); color: #cbd5e1; }
.widget-gex.up { background: rgba(16,185,129,.14); color: #34d399; }
.widget-gex.down { background: rgba(239,68,68,.14); color: #f87171; }
.widget-spark { width: 100%; height: 24px; display: block; }
.widget-footer { margin-top: 8px; font-size: .68rem; font-weight: 600; color: #93c5fd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-span-2 { grid-column: span 2; }
.row-span-2 { grid-row: span 2; }
.card-courses h2 { font-size: 2.8rem; margin: 10px 0; letter-spacing: -1px; }
.card-courses p { max-width: 500px; color: #1e293b; font-size: 1.1rem; }
.bento-card h2 { font-size: 1.8rem; font-weight: 700; margin: 15px 0 10px; line-height: 1.1; }
.bento-card p { font-size: 1rem; line-height: 1.5; opacity: 0.9; }
/* Кнопка "Подробнее"/"Каталог" — единственный элемент, который должен
   оставаться прижатым к низу карточки после отказа от justify-content:
   space-between выше. */
.bento-card > .btn-outline-light { margin-top: auto; }
/* Описание в карточке фандинга — пониже относительно заголовка, чтобы не
   упираться в него вплотную. */
.card-funding .funding-flex p { margin-top: 3rem; }
.card-badge-light { background: rgba(255,255,255,0.8); backdrop-filter: blur(4px); padding: 6px 14px; border-radius: 20px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; color: #1e293b; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.card-badge-dark { background: rgba(0,0,0,0.1); backdrop-filter: blur(4px); padding: 6px 14px; border-radius: 20px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; color: inherit; }
.card-badge-blue { background: #2563eb; color: #fff; padding: 6px 14px; border-radius: 20px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; }
/* Бейдж тарифа PLUS на карточках — тот же градиент, что и у бейджа юзера
   в шапке (auth_core.js), чтобы визуально ассоциировался с тем же тарифом. */
.card-badge-plus { background: linear-gradient(45deg, #0ea5e9, #0284c7); color: #fff; padding: 6px 14px; border-radius: 20px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; }
.funding-flex { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.arrow-big { font-size: 3rem; font-weight: 200; opacity: 0.2; transition: all 0.3s; }
.bento-card:hover .arrow-big { opacity: 1; transform: translateX(15px); color: #2563eb; }
.bento-card:hover .btn-outline-light { background: #fff; color: #0f172a; border-color: #fff; }

/* МОДАЛКИ (Без изменений) */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.75); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-content { background: #ffffff; width: 100%; max-width: 400px; border-radius: 24px; padding: 40px; position: relative; transform: translateY(20px); transition: transform 0.3s ease; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
.modal-overlay.open .modal-content { transform: translateY(0); }
.modal-close { position: absolute; top: 20px; right: 20px; background: transparent; border: none; font-size: 1.2rem; color: #94a3b8; cursor: pointer; transition: color 0.2s; }
.modal-close:hover { color: #0f172a; }
.auth-tabs { display: flex; gap: 20px; margin-bottom: 30px; border-bottom: 2px solid #f1f5f9; }
.auth-tab { background: none; border: none; font-size: 1.1rem; font-weight: 600; color: #94a3b8; padding-bottom: 10px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.auth-tab.active { color: #0f172a; border-bottom-color: #2563eb; }
.auth-form { display: none; }
.auth-form.active { display: block; }
.input-group { margin-bottom: 15px; text-align: left; }
.input-group label { display: block; font-size: 0.85rem; font-weight: 600; color: #475569; margin-bottom: 6px; }
.input-group input { width: 100%; padding: 12px 15px; border-radius: 12px; border: 1px solid #e2e8f0; background: #f8fafc; font-size: 0.95rem; color: #0f172a; outline: none; transition: border-color 0.2s; box-sizing: border-box; }
.input-group input:focus { border-color: #2563eb; background: #fff; }
.btn-full { width: 100%; padding: 14px; font-size: 1rem; margin-top: 10px; }
.auth-error { color: #ef4444; font-size: 0.85rem; font-weight: 500; margin-bottom: 15px; min-height: 20px; }

/* PRO OVERLAY (Без изменений) */
.pro-locked-container { position: relative !important; overflow: hidden; user-select: none; pointer-events: none; }
.pro-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(17, 24, 39, 0.4); backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50; pointer-events: auto; cursor: pointer; transition: all 0.3s ease; }
.pro-overlay:hover { background: rgba(17, 24, 39, 0.7); }
.pro-icon { font-size: 32px; margin-bottom: 8px; filter: drop-shadow(0 0 10px rgba(250, 204, 21, 0.5)); }
.pro-text { color: #FCD34D; font-weight: bold; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }

/* =========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   Шапка/навигация используются на всех страницах сайта — правки здесь
   действуют сразу везде без изменений в HTML.
========================================= */
@media (max-width: 860px) {
    /* Структура шапки (лого+вход в строку 1, меню в строку 2) теперь
       общая для всех ширин — здесь только более тесные отступы и чуть
       меньший логотип под маленький экран. */
    .header { padding: 16px 20px; gap: 10px 16px; }
    .logo { font-size: 1.05rem; }
    .navigation { gap: 24px; }

    /* Карусель баннеров: фиксированная высота 480px и заголовок 56px
       съедали весь экран на телефоне. */
    .hero-ad-section { padding: 0 20px 24px; }
    .carousel-container { height: 420px; }
    .carousel-slide { padding: 28px 28px 140px 28px; }
    .banner-info-wrap { max-width: 100%; }
    .banner-info-wrap h1 { font-size: 2rem; }
    .banner-info-wrap p { font-size: 1rem; margin-bottom: 24px; }
    .carousel-indicators { left: 28px; bottom: 20px; }

    /* Bento-грид на главной: было жёстко 3 колонки, текст переносился по
       одному слову, а карточка с row-span-2/col-span-3 вылезала за экран. */
    .bento-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        padding: 0 20px;
        gap: 20px;
    }
    .col-span-3, .col-span-2, .row-span-2 { grid-column: span 1; grid-row: span 1; }
    .bento-card { padding: 28px; }
    .card-courses h2 { font-size: 1.8rem; }

    /* Живая полоса гаммы: колонка с текстом и два виджета в ряд не влезают
       на телефоне — всё в один столбец, отступы поменьше под ширину экрана. */
    .live-gex-strip { margin: 0 20px 20px; padding: 24px 20px; }
    .strip-inner { flex-direction: column; align-items: stretch; gap: 18px; }
    .strip-text { flex-basis: auto; }
    .widget-row { grid-template-columns: 1fr; gap: 16px; }
}

/* Тонкая линия-курсор на графиках Plotly (профиль опционной конструкции в
   аналитиках MOEX/крипта) — без переопределения Plotly у него всегда
   рисуются ДВЕ spike-линии на осях с showspikes: одна берёт наши
   spikethickness/spikecolor из layout, вторая — его собственные дефолты
   (сплошная непрозрачная, ~2.5px), и визуально линия выглядит толстой.
   CSS-правило в разметке имеет приоритет над presentation-атрибутами SVG,
   поэтому перекрывает обе разом, откуда бы они ни взялись.               */
#chartContainer .spikeline {
    stroke: rgba(255, 255, 255, 0.35) !important;
    stroke-width: 0.5px !important;
}

/* Родной path подсказки при наведении на графике P&L (сплошной
   прямоугольник со стрелочкой-хвостиком, зашит в саму Plotly) прячем
   насовсем — свой скруглённый rect рисуем поверх через JS (moex_app.js/
   crypto_app.js, setupHoverTooltipFix). !important здесь принципиален:
   Plotly каждый раз заново проставляет этому path инлайн-стиль
   (fill/stroke), который иначе перебивал бы обычное CSS-правило —
   родная форма иначе была бы видна кадр-другой при каждой перерисовке
   графика на живых котировках, до того как JS её перекрасит (мигание). */
#chartContainer .hovertext path {
    opacity: 0 !important;
}
