/*
 * Посадочная страница «Грани Историй».
 *
 * Палитра взята из самой игры: угольный фон и тлеющий янтарь. Задача страницы —
 * чтобы переход «сайт → игра» не выглядел переходом в другой продукт.
 *
 * Анимации завязаны на прокрутку и появление в кадре; при
 * prefers-reduced-motion всё останавливается — движение здесь украшение,
 * а не способ что-то сообщить.
 */

:root {
    --bg:        #080706;
    --bg-soft:   #0d0b09;
    --panel:     rgba(255, 243, 224, .045);
    --panel-2:   rgba(255, 243, 224, .075);
    --line:      rgba(255, 243, 224, .10);
    --line-soft: rgba(255, 243, 224, .055);
    --ink:       #f7f0e5;
    --muted:     #bdb1a0;
    --faint:     #8b8173;
    --ember:     #eb5c21;
    --ember-2:   #ffa047;
    --gold:      #ffde94;
    --violet:    #8b6cf0;
    --cyan:      #4fd3d0;
    --good:      #74de8f;
    --danger:    #e56149;

    --shell:     min(1200px, 100% - 44px);
    --radius:    22px;
    --radius-sm: 14px;

    --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 17px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Плёночное зерно поверх всего: без него большие тёмные заливки выглядят
   пластиковыми и на градиентах видны полосы. */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: .035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.shell { width: var(--shell); margin: 0 auto; }

/* ── Полоса прокрутки ───────────────────────────────────────────────────── */

html { scrollbar-width: thin; scrollbar-color: rgba(235, 92, 33, .5) rgba(255, 243, 224, .05); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: rgba(255, 243, 224, .04); }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--ember-2), var(--ember));
    border: 3px solid var(--bg);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--gold), var(--ember-2)); }
::-webkit-scrollbar-corner { background: transparent; }

::selection { background: rgba(235, 92, 33, .32); color: #fff; }

/* Полоса прочитанного вверху страницы: сколько лендинга позади. */
#scrollProgress {
    position: fixed;
    top: 0; left: 0;
    z-index: 120;
    height: 2px;
    width: 0;
    background: linear-gradient(90deg, var(--gold), var(--ember));
    box-shadow: 0 0 14px rgba(255, 160, 71, .7);
    pointer-events: none;
}

/* ── Свой курсор ────────────────────────────────────────────────────────────
 * Точка следует за мышью мгновенно, кольцо догоняет с задержкой — от этого
 * движение кажется живым. Включается только там, где мышь есть на самом деле:
 * на тачскрине курсора нет, и прятать системный указатель нельзя.
 */
.has-cursor, .has-cursor a, .has-cursor button, .has-cursor summary, .has-cursor input, .has-cursor label { cursor: none; }

#cursorDot, #cursorRing {
    position: fixed;
    top: 0; left: 0;
    z-index: 200;
    pointer-events: none;
    border-radius: 50%;
    mix-blend-mode: screen;
    opacity: 0;
    transition: opacity .3s var(--ease);
}
.has-cursor #cursorDot, .has-cursor #cursorRing { opacity: 1; }

#cursorDot {
    width: 7px; height: 7px;
    margin: -3.5px 0 0 -3.5px;
    background: var(--gold);
    box-shadow: 0 0 12px rgba(255, 222, 148, .9);
}
#cursorRing {
    width: 34px; height: 34px;
    margin: -17px 0 0 -17px;
    border: 1.5px solid rgba(255, 160, 71, .55);
    transition: width .28s var(--ease), height .28s var(--ease), margin .28s var(--ease),
                border-color .28s var(--ease), background .28s var(--ease), opacity .3s var(--ease);
}
#cursorRing.is-hot {
    width: 58px; height: 58px;
    margin: -29px 0 0 -29px;
    border-color: rgba(255, 222, 148, .85);
    background: rgba(255, 160, 71, .09);
}
#cursorRing.is-down { width: 24px; height: 24px; margin: -12px 0 0 -12px; }

/* ── Типографика ────────────────────────────────────────────────────────── */

h1, h2, h3 { margin: 0; line-height: 1.08; letter-spacing: -.02em; font-weight: 800; }

/* Кегли намеренно сдержаннее «журнального» максимума: на широком экране
   заголовок в сто пикселей вытесняет всё остальное за пределы первого экрана. */
.h-display { font-size: clamp(30px, 4.2vw, 52px); line-height: 1.08; }
.h-section { font-size: clamp(25px, 3.1vw, 38px); }
.h-card    { font-size: clamp(18px, 1.7vw, 21px); letter-spacing: -.01em; }

.grad {
    background: linear-gradient(104deg, var(--gold) 6%, #ffb765 42%, var(--ember) 92%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lead { font-size: clamp(17px, 2vw, 21px); color: var(--muted); }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 15px;
    margin-bottom: 22px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--gold);
    background: rgba(255, 222, 148, .07);
    border: 1px solid rgba(255, 222, 148, .22);
    border-radius: 999px;
}
.eyebrow::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--ember-2);
    box-shadow: 0 0 12px var(--ember-2);
    animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .35; transform: scale(.7); }
}

/* ── Кнопки ─────────────────────────────────────────────────────────────── */

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    color: #200f04;
    background: linear-gradient(180deg, var(--ember-2), var(--ember));
    border: none;
    border-radius: 999px;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    transition: transform .2s var(--ease), box-shadow .3s var(--ease);
    box-shadow: 0 10px 34px -12px rgba(235, 92, 33, .85);
}
.btn:hover  { transform: translateY(-2px); box-shadow: 0 18px 44px -14px rgba(235, 92, 33, .95); }
.btn:active { transform: translateY(0); }

/* Блик, пробегающий по кнопке — только на наведении, чтобы не мельтешил. */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .45) 50%, transparent 62%);
    transform: translateX(-120%);
}
.btn:hover::after { transition: transform .75s var(--ease); transform: translateX(120%); }

.btn--ghost {
    color: var(--ink);
    background: rgba(255, 243, 224, .06);
    border: 1px solid var(--line);
    box-shadow: none;
    backdrop-filter: blur(10px);
}
.btn--ghost:hover { background: rgba(255, 243, 224, .1); box-shadow: none; }

.btn--wide { width: 100%; }
.btn--sm { padding: 11px 20px; font-size: 14.5px; }

/* ── Шапка ──────────────────────────────────────────────────────────────── */

.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 16px 0;
    transition: background .35s var(--ease), padding .35s var(--ease), border-color .35s var(--ease);
    border-bottom: 1px solid transparent;
}
.nav.is-stuck {
    padding: 10px 0;
    background: rgba(8, 7, 6, .82);
    backdrop-filter: blur(18px) saturate(140%);
    border-bottom-color: var(--line-soft);
}
.nav__row { display: flex; align-items: center; gap: 22px; }

.logo { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.logo svg { width: 30px; height: 30px; flex: none; }

.nav__links { display: flex; gap: 26px; margin-left: auto; font-size: 15px; color: var(--muted); font-weight: 600; }
.nav__links a { position: relative; padding: 4px 0; transition: color .2s; }
.nav__links a:hover { color: var(--ink); }
.nav__links a::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 100%; height: 1.5px;
    background: linear-gradient(90deg, var(--ember-2), transparent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .28s var(--ease);
}
.nav__links a:hover::after { transform: scaleX(1); }

.nav__actions { display: flex; gap: 10px; align-items: center; }
.nav__burger { display: none; }

/* ── Первый экран ───────────────────────────────────────────────────────── */

.hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding: 140px 0 70px;
    overflow: hidden;
}
#emberCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: .85;
}
.hero__glow {
    position: absolute;
    z-index: 0;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}
.hero__glow--a { top: -18%; left: 44%; width: 62vw; height: 62vw; background: radial-gradient(circle, rgba(235, 92, 33, .32), transparent 66%); }
.hero__glow--b { bottom: -28%; left: -14%; width: 52vw; height: 52vw; background: radial-gradient(circle, rgba(139, 108, 240, .20), transparent 66%); }

.hero__inner { position: relative; z-index: 2; max-width: 880px; }
.hero h1 { margin-bottom: 24px; }
.hero .lead { max-width: 620px; margin-bottom: 34px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 13px; align-items: center; margin-bottom: 46px; }

.age-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--danger);
    border: 1.5px solid rgba(229, 97, 73, .45);
    border-radius: 999px;
    background: rgba(229, 97, 73, .08);
}

/* Живые цифры под первым экраном */
.pulse-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.pulse {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 20px;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    backdrop-filter: blur(12px);
    font-size: 14.5px;
    color: var(--muted);
}
.pulse b { color: var(--ink); font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.pulse__dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--good);
    box-shadow: 0 0 0 0 rgba(116, 222, 143, .6);
    animation: ping 2.2s var(--ease) infinite;
}
@keyframes ping {
    0%   { box-shadow: 0 0 0 0 rgba(116, 222, 143, .55); }
    70%  { box-shadow: 0 0 0 11px rgba(116, 222, 143, 0); }
    100% { box-shadow: 0 0 0 0 rgba(116, 222, 143, 0); }
}

.scroll-hint {
    position: absolute;
    bottom: 26px; left: 50%;
    z-index: 2;
    transform: translateX(-50%);
    font-size: 12px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--faint);
    animation: float 2.6s var(--ease) infinite;
}
@keyframes float {
    0%, 100% { transform: translate(-50%, 0); opacity: .5; }
    50%      { transform: translate(-50%, 9px); opacity: 1; }
}

/* ── Секции ─────────────────────────────────────────────────────────────── */

.section { position: relative; padding: clamp(72px, 11vw, 140px) 0; }
.section__head { max-width: 720px; margin-bottom: clamp(38px, 5vw, 64px); }
.section__head .lead { margin-top: 18px; }
.section--soft { background: linear-gradient(180deg, transparent, var(--bg-soft) 22%, var(--bg-soft) 78%, transparent); }

.hr-glow {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 222, 148, .28), transparent);
}

/* Появление при прокрутке */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

/* Заголовок, собирающийся по словам. Слова размечает landing.js классом .w —
   искать по «любому span внутри» нельзя: в заголовках есть свои span-ы
   с градиентом, и они попали бы под ту же анимацию. */
.words .w {
    display: inline-block;
    opacity: 0;
    transform: translateY(.5em) rotate(2deg);
    transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.words.is-in .w { opacity: 1; transform: none; }

/* Слои, уезжающие медленнее страницы. Сдвиг проставляет landing.js. */
.parallax { will-change: transform; }

/* Кнопка, тянущаяся к курсору. */
.magnet { will-change: transform; transition: transform .35s var(--ease); }

/* Бегущая строка с рубриками — заполняет паузу между экранами. */
.ticker {
    overflow: hidden;
    padding: 22px 0;
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    background: rgba(255, 243, 224, .02);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.ticker__row { display: flex; width: max-content; animation: slide 34s linear infinite; }
.ticker:hover .ticker__row { animation-play-state: paused; }
.ticker__item {
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 0 26px;
    font-size: clamp(19px, 2.4vw, 27px);
    font-weight: 800;
    letter-spacing: -.02em;
    white-space: nowrap;
    color: rgba(247, 240, 229, .22);
    transition: color .3s var(--ease);
}
.ticker__item::after {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--ember);
    opacity: .55;
}
.ticker:hover .ticker__item { color: rgba(247, 240, 229, .4); }
@keyframes slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ── Цифры ──────────────────────────────────────────────────────────────── */

.numbers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1px;
    background: var(--line-soft);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    overflow: hidden;
}
.number {
    padding: 34px 26px;
    background: var(--bg);
    text-align: center;
    transition: background .3s var(--ease);
}
.number:hover { background: var(--bg-soft); }
.number__val {
    font-size: clamp(30px, 3.6vw, 42px);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
    margin-bottom: 9px;
}
.number__label { font-size: 14px; color: var(--faint); }

/* ── Карточки преимуществ ───────────────────────────────────────────────── */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(288px, 1fr));
    gap: 18px;
}
.card {
    position: relative;
    padding: 32px 28px;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .35s var(--ease), border-color .35s var(--ease), background .35s var(--ease);
}
.card:hover { transform: translateY(-4px); border-color: rgba(255, 222, 148, .24); background: var(--panel-2); }

/* Тёплый отблеск, следующий за курсором: координаты пишет landing.js. */
.card::before {
    content: '';
    position: absolute;
    inset: -1px;
    opacity: 0;
    transition: opacity .35s var(--ease);
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 160, 71, .13), transparent 62%);
    pointer-events: none;
}
.card:hover::before { opacity: 1; }

.card__icon {
    display: grid;
    place-items: center;
    width: 52px; height: 52px;
    margin-bottom: 20px;
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(255, 160, 71, .18), rgba(235, 92, 33, .08));
    border: 1px solid rgba(255, 160, 71, .22);
    color: var(--gold);
}
.card__icon svg { width: 25px; height: 25px; }
.card h3 { margin-bottom: 11px; }
.card p { margin: 0; color: var(--muted); font-size: 15.5px; }

/* ── Истории ────────────────────────────────────────────────────────────── */

/* Сетка вместо карусели: горизонтальную ленту неудобно листать мышью,
   а обложки — это то, ради чего сюда приходят, и прятать их за прокруткой глупо. */
.grid-stories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
    gap: 18px;
}

/* Фильтр по рубрикам */
.filters { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 26px; }
.filter {
    padding: 9px 17px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    cursor: pointer;
    transition: color .22s var(--ease), background .22s var(--ease), border-color .22s var(--ease);
}
.filter:hover { color: var(--ink); border-color: rgba(255, 222, 148, .26); }
.filter.is-active {
    color: #200f04;
    background: linear-gradient(180deg, var(--gold), #e0a13d);
    border-color: transparent;
}
.filter span { opacity: .6; font-weight: 500; }

.story {
    position: relative;
    aspect-ratio: 3 / 4.2;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    background: var(--bg-soft);
    transition: transform .4s var(--ease), border-color .4s var(--ease), box-shadow .4s var(--ease), opacity .3s var(--ease);
}
.story:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 222, 148, .3);
    box-shadow: 0 30px 60px -28px rgba(0, 0, 0, .95), 0 0 42px -18px rgba(235, 92, 33, .5);
}
.story.is-hidden { display: none; }

/* Наклон вслед за курсором: углы считает landing.js и кладёт в переменные. */
.story.is-tilting {
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-6px);
    transition: transform .12s linear, border-color .4s var(--ease), box-shadow .4s var(--ease);
}
.story img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    /* Масштаба при наведении нет намеренно: обложка обрезалась по краям,
       а на ней часто и название, и лица. */
    transition: filter .5s var(--ease);
}
.story:hover img { filter: saturate(1.1) brightness(1.04); }
.story__veil {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 7, 6, .12) 26%, rgba(8, 7, 6, .72) 62%, rgba(8, 7, 6, .96));
}
.story__body { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 18px; }
.story__title { font-size: 18px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 6px; }
.story__desc {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.45;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height .45s var(--ease), opacity .35s var(--ease), margin .45s var(--ease);
}
.story:hover .story__desc { max-height: 108px; opacity: 1; margin-top: 4px; }
.story__meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.tag {
    padding: 4px 11px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--gold);
    background: rgba(255, 222, 148, .11);
    border: 1px solid rgba(255, 222, 148, .18);
    border-radius: 999px;
}
.tag--soon { color: var(--cyan); background: rgba(79, 211, 208, .1); border-color: rgba(79, 211, 208, .22); }

/* ── Блок ИИ ────────────────────────────────────────────────────────────── */

.ai {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(760px 520px at 82% 18%, rgba(139, 108, 240, .17), transparent 62%),
        radial-gradient(680px 480px at 8% 88%, rgba(79, 211, 208, .10), transparent 62%),
        var(--bg-soft);
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
}
.ai__grid {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: clamp(34px, 5vw, 68px);
    align-items: center;
}
.ai .eyebrow { color: #c9b8ff; background: rgba(139, 108, 240, .1); border-color: rgba(139, 108, 240, .3); }
.ai .eyebrow::before { background: var(--violet); box-shadow: 0 0 12px var(--violet); }
.ai .grad { background: linear-gradient(104deg, #d8ccff 4%, var(--violet) 52%, var(--cyan) 96%); -webkit-background-clip: text; background-clip: text; }

.ai__list { list-style: none; padding: 0; margin: 30px 0 34px; display: grid; gap: 14px; }
.ai__list li { display: flex; gap: 13px; align-items: flex-start; color: var(--muted); font-size: 16px; }
.ai__list svg { flex: none; width: 21px; height: 21px; margin-top: 2px; color: var(--violet); }

/* Переписка-мокап */
.chat {
    position: relative;
    padding: 24px 22px;
    background: rgba(10, 9, 12, .72);
    border: 1px solid rgba(139, 108, 240, .22);
    border-radius: var(--radius);
    backdrop-filter: blur(16px);
    box-shadow: 0 34px 80px -34px rgba(139, 108, 240, .5);
}
.chat__top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 17px;
    margin-bottom: 19px;
    border-bottom: 1px solid var(--line-soft);
}
.chat__avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--violet), var(--cyan));
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 15px;
    color: #0b0913;
}
.chat__who { font-weight: 700; font-size: 15px; }
.chat__state { font-size: 12.5px; color: var(--good); }

.chat__log { display: grid; gap: 12px; min-height: 264px; align-content: start; }
.bubble {
    max-width: 84%;
    padding: 12px 16px;
    font-size: 14.5px;
    line-height: 1.5;
    border-radius: 16px;
    opacity: 0;
    transform: translateY(10px);
    animation: bubbleIn .5s var(--ease) forwards;
}
.bubble--them {
    justify-self: start;
    color: #e8e2f5;
    background: rgba(139, 108, 240, .16);
    border: 1px solid rgba(139, 108, 240, .26);
    border-bottom-left-radius: 6px;
}
.bubble--me {
    justify-self: end;
    color: #f7f0e5;
    background: rgba(255, 243, 224, .07);
    border: 1px solid var(--line);
    border-bottom-right-radius: 6px;
}
@keyframes bubbleIn { to { opacity: 1; transform: none; } }

.typing { display: inline-flex; gap: 5px; align-items: center; padding: 3px 0; }
.typing i {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--violet);
    animation: typing 1.25s var(--ease) infinite;
}
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes typing {
    0%, 60%, 100% { opacity: .28; transform: translateY(0); }
    30%           { opacity: 1;   transform: translateY(-4px); }
}

.chat__note { margin-top: 18px; font-size: 12.5px; color: var(--faint); text-align: center; }

/* ── Шаги ───────────────────────────────────────────────────────────────── */

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; counter-reset: s; }
.step { position: relative; padding: 30px 26px 26px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); }
.step::before {
    counter-increment: s;
    content: '0' counter(s);
    display: block;
    margin-bottom: 15px;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -.04em;
    background: linear-gradient(180deg, var(--gold), rgba(235, 92, 33, .35));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.step h3 { margin-bottom: 9px; font-size: 19px; }
.step p { margin: 0; color: var(--muted); font-size: 15px; }

/* ── Форма входа ────────────────────────────────────────────────────────── */

.join { position: relative; }
.join__grid { display: grid; grid-template-columns: 1fr minmax(340px, 440px); gap: clamp(32px, 5vw, 68px); align-items: center; }

.form-card {
    padding: 32px 30px;
    background: linear-gradient(180deg, rgba(255, 243, 224, .065), rgba(255, 243, 224, .025));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
    box-shadow: 0 34px 90px -40px rgba(0, 0, 0, .9);
}
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 22px;
    background: rgba(0, 0, 0, .32);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
}
.tabs button {
    flex: 1;
    padding: 11px;
    font: inherit;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--muted);
    background: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background .25s var(--ease), color .25s var(--ease);
}
.tabs button.is-active { color: #200f04; background: linear-gradient(180deg, var(--gold), #e0a13d); }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.input {
    width: 100%;
    padding: 14px 16px;
    font: inherit;
    font-size: 16px;
    color: var(--ink);
    background: rgba(0, 0, 0, .34);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: rgba(255, 160, 71, .55); box-shadow: 0 0 0 3px rgba(235, 92, 33, .15); }
.input::placeholder { color: var(--faint); }

.check {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
    background: rgba(0, 0, 0, .2);
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    cursor: pointer;
}
.check input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ember); cursor: pointer; }
.check a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }

.msg { padding: 12px 15px; margin-bottom: 16px; font-size: 14px; border-radius: 12px; border: 1px solid; }
.msg--error { color: #ffc9be; background: rgba(229, 97, 73, .13); border-color: rgba(229, 97, 73, .4); }
.msg--ok    { color: #c7f3d4; background: rgba(116, 222, 143, .11); border-color: rgba(116, 222, 143, .35); }

.sep { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.sep::before, .sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.oauth-row { display: grid; gap: 10px; }
.btn--yandex { color: #fff; background: #fc3f1d; box-shadow: 0 10px 30px -14px rgba(252, 63, 29, .8); }
.btn--vk     { color: #fff; background: #0077ff; box-shadow: 0 10px 30px -14px rgba(0, 119, 255, .8); }
.btn__ic { width: 19px; height: 19px; flex: none; }

.form-note { margin-top: 16px; font-size: 12.5px; color: var(--faint); text-align: center; }
.form-note a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* ── Вопросы ────────────────────────────────────────────────────────────── */

.faq { display: grid; gap: 10px; }
.faq details {
    padding: 20px 24px;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    transition: border-color .3s var(--ease), background .3s var(--ease);
}
.faq details[open] { border-color: rgba(255, 222, 148, .22); background: var(--panel-2); }
.faq summary {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    font-weight: 700;
    font-size: 16.5px;
    cursor: pointer;
    list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: '+';
    flex: none;
    font-size: 22px;
    font-weight: 400;
    color: var(--gold);
    transition: transform .3s var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq p { margin: 14px 0 0; color: var(--muted); font-size: 15.5px; }

/* ── Приглашение зарегистрироваться ─────────────────────────────────────── */

.promo {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(4, 3, 3, .78);
    backdrop-filter: blur(9px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .32s var(--ease);
}
.promo.is-open { opacity: 1; pointer-events: auto; }

.promo__box {
    position: relative;
    width: min(470px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    padding: 34px 30px 28px;
    text-align: center;
    background: linear-gradient(180deg, #171310, #100d0b);
    border: 1px solid rgba(255, 222, 148, .22);
    border-radius: 24px;
    box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .95), 0 0 70px -30px rgba(235, 92, 33, .55);
    transform: translateY(22px) scale(.97);
    transition: transform .38s var(--ease);
}
.promo.is-open .promo__box { transform: none; }

.promo__close {
    position: absolute;
    top: 12px; right: 12px;
    width: 34px; height: 34px;
    font: inherit;
    font-size: 20px;
    line-height: 1;
    color: var(--faint);
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: color .2s, background .2s;
}
.promo__close:hover { color: var(--ink); background: rgba(255, 243, 224, .07); }

.promo__coins {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
    font-size: clamp(38px, 8vw, 54px);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
}
.promo__coins small { font-size: 18px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.promo__box h3 { margin: 10px 0 8px; font-size: 21px; }
.promo__box p { margin: 0 0 22px; font-size: 15px; color: var(--muted); }
.promo__note { margin-top: 14px; font-size: 12.5px; color: var(--faint); }
.promo__note a { color: var(--muted); text-decoration: underline; }

/* ── Подвал ─────────────────────────────────────────────────────────────── */

.footer { padding: 60px 0 44px; border-top: 1px solid var(--line-soft); background: var(--bg-soft); }
.footer__row { display: flex; flex-wrap: wrap; gap: 26px; justify-content: space-between; align-items: flex-start; }
.footer__links { display: flex; flex-wrap: wrap; gap: 20px; font-size: 14px; color: var(--muted); }
.footer__links a:hover { color: var(--ink); }
.footer__small { margin-top: 30px; font-size: 13px; color: var(--faint); line-height: 1.7; }

/* ── Адаптив ────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    :root { --shell: min(1200px, 100% - 32px); }
    .nav__links { display: none; }
    .ai__grid, .join__grid { grid-template-columns: 1fr; }
    .join__grid > :first-child { order: 2; }
    .hero { min-height: auto; padding: 118px 0 64px; }
    .chat__log { min-height: 0; }
}

@media (max-width: 560px) {
    body { font-size: 16px; }
    .nav__actions .btn--ghost { display: none; }
    .btn { padding: 14px 24px; }
    .card, .form-card, .step { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    .reveal { opacity: 1; transform: none; }
    .words .w { opacity: 1; transform: none; }
    #emberCanvas, #cursorDot, #cursorRing { display: none; }
    .has-cursor, .has-cursor a, .has-cursor button { cursor: auto; }
    .ticker__row { animation: none; }
}


/* ── Переход в раздел игр для компании ───────────────────────────────── */
.party-landing-card { display:block; color:inherit; text-decoration:none; min-height:220px; }
.party-landing-card .card__icon { font-size:24px; }
.party-landing-actions { display:flex; flex-wrap:wrap; align-items:center; gap:18px; margin-top:30px; }
.party-landing-actions span { color:var(--faint); font-size:14px; }
@media (max-width:640px) {
    .party-landing-actions .btn { width:100%; justify-content:center; }
    .party-landing-actions span { width:100%; text-align:center; }
}

/* ── Шапка: три продукта ─────────────────────────────────────────────────
   Раньше в навигации вперемешку стояли якоря на разделы этой же страницы и
   ссылка на отдельный раздел сайта — понять, где рассказ, а где сама игра,
   было нельзя. Теперь только три адреса, у каждого подпись. */
.nav__links--products { gap: 4px; }
.nav__links--products a {
    display: flex; flex-direction: column; gap: 1px;
    padding: 7px 13px; border-radius: 12px; line-height: 1.15;
}
.nav__links--products a:hover { background: rgba(255,255,255,.06); }
.nav__links--products b { font-size: 14px; font-weight: 700; }
.nav__links--products small { font-size: 11px; opacity: .55; font-weight: 500; }

@media (max-width: 960px) {
    .nav__links--products small { display: none; }
}

/* ── Первый экран: три раздела ────────────────────────────────────────────
   Раньше здесь была одна кнопка «Играть бесплатно», и она перетягивала весь
   экран: человек уходил в игру, не узнав про переписку и игры для компании.
   Теперь три равные карточки — ни одна не крупнее и не ярче остальных. */
.lead--hero { max-width: 60ch; }

.hero__products {
    display: grid; gap: 14px; margin: clamp(26px, 3.4vw, 40px) 0 18px;
    grid-template-columns: repeat(3, 1fr);
}

.hero-card {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; gap: 7px;
    padding: 24px 22px 20px;
    border: 1px solid rgba(255,255,255,.11); border-radius: 22px;
    background: linear-gradient(160deg, rgba(255,255,255,.055), rgba(255,255,255,.014));
    color: inherit; text-decoration: none;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    transition: border-color .2s, transform .2s, box-shadow .2s;
}
/* Свечение у каждого своё — чтобы разделы отличались и на глаз, а не только
   текстом. Цвет повторяет тот, которым раздел живёт у себя на странице. */
.hero-card::before {
    content: ""; position: absolute; inset: -40% 40% 55% -40%;
    background: radial-gradient(circle, rgba(235,92,33,.30), transparent 68%);
    opacity: .8; pointer-events: none; transition: opacity .25s;
}
.hero-card--ai::before    { background: radial-gradient(circle, rgba(178,154,255,.30), transparent 68%); }
.hero-card--party::before { background: radial-gradient(circle, rgba(112,183,255,.26), transparent 68%); }
.hero-card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,.22); box-shadow: 0 26px 60px rgba(0,0,0,.45); }
.hero-card:hover::before { opacity: 1; }

.hero-card > * { position: relative; }
.hero-card__mark { font-size: 24px; line-height: 1; color: #ffb05d; }
.hero-card--ai .hero-card__mark    { color: #c9b6ff; }
.hero-card--party .hero-card__mark { color: #9ccbff; }
.hero-card h2 { margin: 3px 0 0; font-size: clamp(20px, 2.1vw, 25px); line-height: 1.15; }
.hero-card__lead { margin: 0; color: #ffde94; font-size: 13.5px; font-weight: 600; }
.hero-card--ai .hero-card__lead    { color: #d8caff; }
.hero-card--party .hero-card__lead { color: #b7dbff; }
.hero-card__text { margin: 4px 0 0; color: #bbaf9d; font-size: 14.5px; line-height: 1.5; }
.hero-card__meta { margin-top: 6px; color: #7d7a75; font-size: 12px; }
.hero-card__go {
    margin-top: auto; padding-top: 14px;
    display: inline-flex; align-items: center; gap: 7px;
    color: #ff9a4d; font-weight: 700; font-size: 15px;
}
.hero-card--ai .hero-card__go    { color: #c9b6ff; }
.hero-card--party .hero-card__go { color: #9ccbff; }
.hero-card:hover .hero-card__go svg { transform: translateX(3px); }
.hero-card__go svg { transition: transform .2s; }

@media (max-width: 1080px) {
    .hero__products { grid-template-columns: 1fr; gap: 12px; }
    .hero-card { padding: 20px 18px 18px; }
    .hero-card__text { display: none; }
}

/* ── Видеообложка истории ────────────────────────────────────────────────
   Ролик лежит поверх статичной картинки и появляется, только когда загрузился
   и пошёл. Пока этого не случилось — видна обычная обложка, и карточка не
   мигает пустотой. Адрес проставляет скрипт по наведению: ролики весят по
   десять мегабайт, и грузить их все сразу нельзя. */
.story__video {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover;
    opacity: 0; transition: opacity .35s ease;
    pointer-events: none;
}
.story__video.is-playing { opacity: 1; }

/* Переход в игру сразу после витрины историй. */
.stories-cta { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: clamp(28px, 4vw, 44px); text-align: center; }
.stories-cta__note { color: #7d7a75; font-size: 13.5px; }

/* Плашка 18+ стоит в одном ряду со счётчиками и раньше сливалась с ними:
   те же скругления, тот же размер. Делаем её заметно другой — контрастная
   рамка и отступ, отделяющий её от цифр. */
.pulse-row .age-chip {
    margin-right: 6px;
    padding: 9px 16px;
    border-width: 2px;
    border-color: rgba(229, 97, 73, .75);
    background: rgba(229, 97, 73, .16);
    color: #ff9c8a;
    letter-spacing: .02em;
}

/* Витрина историй идёт сразу за рассказом о разделе, одним блоком —
   поэтому у неё нет своего верхнего отступа. */
.section--tight { padding-top: 0; }

/* ── Пример комнаты ───────────────────────────────────────────────────────
   Про раздел трудно рассказать словами: «создайте комнату, отправьте ссылку»
   звучит как инструкция к роутеру. Показанный раунд объясняет всё сразу. */
.room-demo {
    max-width: 620px;
    margin: clamp(26px, 4vw, 40px) auto 0;
    padding: clamp(18px, 2.6vw, 26px);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 22px;
    background: linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
    box-shadow: 0 26px 70px rgba(0,0,0,.4);
}
.room-demo__head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: #7d7a75; }
.room-demo__code b { color: #ffb05d; letter-spacing: .18em; }
.room-demo__round { color: #ffde94; }
.room-demo__scene { margin: 14px 0 18px; font-size: clamp(16px, 1.9vw, 19px); line-height: 1.45; color: #f6eee2; }

.room-demo__players { display: grid; gap: 8px; }
.room-demo__player {
    display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
    padding: 10px 13px;
    border: 1px solid rgba(255,255,255,.09); border-radius: 13px;
    background: rgba(255,255,255,.025);
    font-weight: 700; font-size: 14px;
}
.room-demo__player em { font-style: normal; font-weight: 500; color: #bbaf9d; font-size: 13.5px; }
/* ИИ помечен цветом, а не подписью «бот»: в комнате он играет наравне. */
.room-demo__player--ai { border-color: rgba(178,154,255,.34); background: rgba(178,154,255,.09); }
.room-demo__player--ai em { color: #d8caff; }
.room-demo__player--wait { opacity: .5; }

.room-demo__result { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.10); font-size: 14.5px; color: #bbaf9d; }
.room-demo__result b { color: #ffde94; }
.room-demo__hint { margin-top: 10px; font-size: 12.5px; color: #7d7a75; }

@media (max-width: 560px) {
    .room-demo__player { flex-direction: column; gap: 3px; }
}
