/* ===== Главная: блоки, «живой» чат, идеи, анимации (mobile-first) ===== */
.hero-left p.hero-lead { margin-bottom: 14px; }
.hero-blocks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.hero-block { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; padding: 12px 6px 11px; border-radius: 16px;
    background: var(--card-bg); border: 1px solid var(--border-light); box-shadow: 0 10px 24px -18px var(--shadow-glow, rgba(214, 51, 132, .5)); }
.hero-block b { font-size: 15px; font-weight: 800; color: var(--text-primary); line-height: 1.2; }
.hero-block small { font-size: 12px; color: var(--text-secondary); line-height: 1.2; }
.hb-icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; color: #fff; margin-bottom: 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -3px 6px rgba(0, 0, 0, .2), 0 6px 14px -6px rgba(214, 51, 132, .8); }
.hb-icon svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .3)); }
.hb-pink { background: linear-gradient(180deg, rgba(255,255,255,.25), rgba(255,255,255,0) 55%), linear-gradient(135deg, #ff6aa6, #D63384); }
.hb-violet { background: linear-gradient(180deg, rgba(255,255,255,.25), rgba(255,255,255,0) 55%), linear-gradient(135deg, #b46cff, #7a2be2); }
.hb-gold { background: linear-gradient(180deg, rgba(255,255,255,.3), rgba(255,255,255,0) 55%), linear-gradient(135deg, #ffcf5a, #e0901e); }
.hero-block .hb-icon { animation: hbFloat 3.4s ease-in-out infinite; }
.hero-block:nth-child(2) .hb-icon { animation-delay: .5s; }
.hero-block:nth-child(3) .hb-icon { animation-delay: 1s; }
@keyframes hbFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* живой чат */
.live-chat { margin-top: 18px; border-radius: 22px; overflow: hidden; text-align: left; position: relative;
    background: radial-gradient(120% 80% at 0% 0%, rgba(255, 90, 154, .22), transparent 60%), radial-gradient(90% 90% at 100% 100%, rgba(138, 43, 226, .2), transparent 60%), var(--card-bg);
    border: 1px solid rgba(214, 51, 132, .35); box-shadow: 0 18px 40px -22px rgba(214, 51, 132, .9); transition: opacity .3s; }
.live-chat.lc-switch { opacity: .35; }
.lc-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-light); }
.lc-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid #ff5a9a; box-shadow: 0 0 0 3px rgba(255, 90, 154, .2); }
.lc-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lc-name { font-size: 15.5px; font-weight: 800; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-status { font-size: 12.5px; color: #2fbf71; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.lc-status i { width: 7px; height: 7px; border-radius: 50%; background: #2fbf71; box-shadow: 0 0 0 0 rgba(47, 191, 113, .7); animation: lcOnline 1.6s ease-out infinite; }
@keyframes lcOnline { 80%,100% { box-shadow: 0 0 0 6px rgba(47, 191, 113, 0); } }
.lc-badge { font-size: 11px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #ff5a9a, #8a2be2); padding: 4px 9px; border-radius: 999px; flex-shrink: 0; }
.lc-body { display: flex; flex-direction: column; gap: 7px; padding: 14px; min-height: 158px; justify-content: flex-end; }
.lc-msg { max-width: 82%; padding: 9px 13px; border-radius: 18px 18px 18px 6px; font-size: 14.5px; line-height: 1.35; align-self: flex-start;
    color: var(--text-primary); background: var(--input-bg, rgba(255,255,255,.06)); border: 1px solid var(--border-light);
    animation: lcIn .35s cubic-bezier(.3, 1.5, .5, 1); transform-origin: 0 100%; }
.lc-msg.mine { align-self: flex-end; border-radius: 18px 18px 6px 18px; color: #fff; border: none; transform-origin: 100% 100%;
    background: linear-gradient(135deg, #ff5a9a, #D63384 55%, #8a2be2); }
.lc-msg.lc-ghost { opacity: .55; }
@keyframes lcIn { from { opacity: 0; transform: scale(.6) translateY(8px); } }
.lc-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.lc-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-secondary); animation: lcDot 1.1s ease-in-out infinite; }
.lc-typing i:nth-child(2) { animation-delay: .15s; } .lc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes lcDot { 0%,60%,100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
.lc-cta { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 14px 14px; min-height: 48px; border-radius: 16px;
    text-decoration: none; color: #fff; font-weight: 800; font-size: 16px; position: relative; overflow: hidden;
    background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,0) 55%), linear-gradient(135deg, #ff5a9a, #D63384 50%, #8a2be2);
    box-shadow: 0 10px 22px -10px rgba(214, 51, 132, 1); -webkit-tap-highlight-color: transparent; }
.lc-cta svg { width: 20px; height: 20px; }
.lc-cta:active { transform: scale(.98); }
.lc-cta::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; transform: skewX(-18deg);
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .4), transparent); animation: hfSweep 3s ease-in-out infinite; }
.lc-cta-hot { animation: hfPulse 1s ease-in-out infinite; }
@keyframes hfSweep { 0%,55% { left: -60%; } 100% { left: 130%; } }
@keyframes hfPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* быстрые идеи */
.idea-chips { display: flex; gap: 7px; overflow-x: auto; padding: 8px 2px 4px; margin: 0 -2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.idea-chips::-webkit-scrollbar { display: none; }
.idea-chip { flex-shrink: 0; border: 1px solid rgba(214, 51, 132, .35); background: rgba(214, 51, 132, .08); color: var(--text-primary);
    font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.idea-chip.picked { animation: hfPick .4s cubic-bezier(.3, 1.8, .5, 1); background: rgba(214, 51, 132, .22); }
@keyframes hfPick { 0% { transform: scale(.85); } 100% { transform: scale(1); } }
.generate-btn.gen-ready { animation: hfGlow 1.6s ease-in-out infinite; }
@keyframes hfGlow { 0%,100% { box-shadow: 0 10px 24px -10px rgba(214, 51, 132, .9); } 50% { box-shadow: 0 10px 34px -4px rgba(255, 90, 154, 1); } }

/* появление при прокрутке */
.fx-wait { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .3, 1); }
.fx-wait.fx-in { opacity: 1; transform: none; }

/* категории свёрнуты на телефоне */
.cat-more { display: none; }
@media (max-width: 768px) {
    .category-groups.cat-collapsed { max-height: 760px; overflow: hidden; position: relative;
        -webkit-mask: linear-gradient(#000 75%, transparent); mask: linear-gradient(#000 75%, transparent); }
    .cat-more { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 48px; margin-top: 4px;
        border-radius: 16px; border: 1.5px solid var(--accent); background: transparent; color: var(--accent); font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
    .cat-more svg { width: 20px; height: 20px; animation: hfBounce 1.4s ease-in-out infinite; }
    @keyframes hfBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
}

/* липкая кнопка над нижним меню */
.sticky-cta { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 150; transform: translate(-50%, 140%);
    display: flex; align-items: center; gap: 8px; border: none; cursor: pointer; font: inherit; font-weight: 800; font-size: 15.5px; color: #fff;
    padding: 13px 22px; border-radius: 999px; white-space: nowrap; opacity: 0; pointer-events: none; transition: transform .35s cubic-bezier(.2, 1.3, .4, 1), opacity .25s;
    background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0) 55%), linear-gradient(135deg, #ff5a9a, #D63384 50%, #8a2be2);
    box-shadow: 0 14px 30px -10px rgba(214, 51, 132, 1); }
.sticky-cta svg { width: 18px; height: 18px; }
.sticky-cta.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
@media (min-width: 769px) { .sticky-cta { bottom: 24px; } }

@media (max-width: 400px) {
    .hero-blocks { gap: 7px; }
    .hero-block { padding: 10px 4px; }
    .hero-block b { font-size: 14px; }
    .hero-block small { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
    .hero-block .hb-icon, .lc-cta::after, .lc-status i, .cat-more svg { animation: none !important; }
}
/* блоки без значков: крупный акцентный заголовок */
.hero-block { padding: 12px 6px; gap: 2px; }
.hero-block b { font-size: 16px; background: linear-gradient(135deg, #ff5a9a, #D63384 55%, #8a2be2); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* первый экран: мягкое появление, форма «дышит» */
.hero-left h1 { animation: hfUp .6s cubic-bezier(.2, .8, .3, 1) both; }
.hero-left > p:not(.age-disclaimer) { animation: hfUp .6s .08s cubic-bezier(.2, .8, .3, 1) both; }
.hero-buttons { animation: hfUp .6s .16s cubic-bezier(.2, .8, .3, 1) both; }
.generator-card { animation: hfUp .7s .22s cubic-bezier(.2, .8, .3, 1) both, hfCard 3.2s 1s ease-in-out infinite; }
@keyframes hfUp { from { opacity: 0; transform: translateY(16px); } }
@keyframes hfCard { 0%,100% { box-shadow: 0 16px 36px -24px rgba(214, 51, 132, .7); } 50% { box-shadow: 0 16px 44px -16px rgba(255, 90, 154, .75); } }
.prompt-input:focus { box-shadow: 0 0 0 3px rgba(214, 51, 132, .25); transition: box-shadow .2s; }
.hero-buttons .btn-accent { position: relative; overflow: hidden; }
.hero-buttons .btn-accent::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; transform: skewX(-18deg);
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent); animation: hfSweep 3.4s ease-in-out infinite; }
.generate-btn { position: relative; overflow: hidden; }
.generate-btn::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; transform: skewX(-18deg);
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .4), transparent); animation: hfSweep 3.8s 1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .hero-left h1, .hero-left > p, .hero-buttons, .generator-card, .hero-buttons .btn-accent::after, .generate-btn::after { animation: none !important; } }

/* статистика не вылезает за экран */
.stats-section { grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); }
.stat-card { min-width: 0; }
@media (max-width: 768px) {
    .stats-section { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 24px 0; }
    .stat-card { padding: 16px 8px; border-radius: 20px; }
    .stat-number { font-size: clamp(1.25rem, 6.2vw, 1.8rem); white-space: nowrap; }
    .stat-label { font-size: .85rem; line-height: 1.25; }
    .main { overflow-x: hidden; }
}

/* телефон: заголовок → сразу форма с кнопкой «Создать рассказ» на первом экране → текст и кнопки ниже */
@media (max-width: 768px) {
    .hero-grid { display: flex; flex-direction: column; gap: 14px; margin-bottom: 28px; }
    .hero-left { display: contents; }
    .hero-left h1 { order: 1; font-size: 25px; line-height: 1.18; margin: 2px 0 0; text-align: center; }
    .hero-right { order: 2; }
    .hero-left > p:not(.age-disclaimer) { order: 3; text-align: center; font-size: 15px; margin: 4px 0 0; }
    .hero-left .age-disclaimer { order: 4; text-align: center; margin: 0; }
    .hero-buttons { order: 5; justify-content: center; }
    .live-chat { order: 6; }
    .generator-card { padding: 16px; border-radius: 22px; }
    .generator-card .form-group { margin-bottom: 12px; }
    .generator-card .form-label { margin-bottom: 6px; }
    .prompt-input { min-height: 92px; height: 92px; padding: 12px 14px; font-size: 16px; }
    .input-footer { margin-top: 6px; font-size: 12.5px; }
    .generator-card .cta-features { margin-top: 10px; }
    .generate-btn { min-height: 54px; }
}
/* низкие экраны (iPhone SE и т.п.): ещё компактнее, чтобы кнопка была видна сразу */
@media (max-width: 768px) and (max-height: 700px) {
    .hero-left h1 { font-size: 21px; }
    .input-footer { display: none; }
    .prompt-input { min-height: 72px; height: 72px; }
    .idea-chips { padding-top: 6px; }
    .generator-card { padding: 12px 14px; }
    .generator-card .form-group { margin-bottom: 8px; }
    .generator-card .cta-features { display: none; }
    .generate-btn { min-height: 50px; }
}

/* производительность: без бесконечной перерисовки теней */
@keyframes hfSweep { 0%,55% { transform: skewX(-18deg) translateX(0); } 100% { transform: skewX(-18deg) translateX(480%); } }
.generator-card { animation: hfUp .7s .22s cubic-bezier(.2, .8, .3, 1) both !important; box-shadow: 0 16px 40px -22px rgba(214, 51, 132, .75); }
.generate-btn.gen-ready { animation: hfPulse 1.4s ease-in-out infinite; }
@keyframes lcOnline { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.75); } }

/* изоляция: изменения внутри не пересчитывают всю страницу */
.ta-ghost { position: absolute; pointer-events: none; contain: strict; overflow: hidden; color: var(--text-secondary); opacity: .75;
    font: inherit; font-size: 16px; line-height: 1.45; white-space: pre-wrap; transition: opacity .2s; }
.ta-ghost.off { opacity: 0; }
.live-chat { contain: layout paint; }
.lc-body { height: 200px; min-height: 0; overflow: hidden; contain: strict; }
.lc-head { contain: layout paint; }
.lc-name, .lc-status { contain: content; }
@media (max-width: 768px) and (max-height: 700px) { .ta-ghost { font-size: 15px; } }
/* длинный список категорий: браузер не считает то, что ниже экрана */
.category-groups > *, .benefits-section, .stats-section, .footer { content-visibility: auto; contain-intrinsic-size: auto 320px; }

/* ПК/планшет: всё прижато к верху, слева — заголовок, кнопки и живой чат, справа — форма */
@media (min-width: 769px) {
    .hero-grid { align-items: flex-start; gap: 28px; }
    .hero-left { justify-content: flex-start; padding-top: 6px; }
    .hero-left h1 { font-size: clamp(30px, 2.6vw, 42px); }
    .hero-buttons { flex-wrap: wrap; gap: 12px; }
    .hero-buttons button { white-space: nowrap; }
    .live-chat { margin-top: 22px; }
    .hero-right { flex: 1 1 46%; position: sticky; top: 16px; }
}
@media (min-width: 769px) and (max-width: 1200px) {
    .hero-left p { font-size: 16px; }
    .length-value { white-space: nowrap; }
}

/* ПК: колонки поровну */
@media (min-width: 769px) { .hero-left, .hero-right { flex: 1 1 0; min-width: 0; } }

/* SEO-текст над подвалом: читаемо, спокойно */
.seo-text { max-width: 880px; margin: 8px auto 28px; padding: 22px 24px; border-radius: 22px; background: var(--card-bg); border: 1px solid var(--border-light);
    color: var(--text-secondary); font-size: 15px; line-height: 1.65; }
.seo-text h2 { font-size: 22px; line-height: 1.3; color: var(--text-primary); margin: 0 0 10px; }
.seo-text h3 { font-size: 17px; color: var(--text-primary); margin: 18px 0 6px; }
.seo-text p { margin: 0 0 8px; }
.seo-text strong { color: var(--text-primary); font-weight: 700; }
.seo-text a { color: var(--accent); text-decoration: none; font-weight: 600; border-bottom: 1px solid rgba(214, 51, 132, .3); }
.seo-text a:hover { border-bottom-color: var(--accent); }
@media (max-width: 768px) { .seo-text { padding: 18px 16px; font-size: 14.5px; } .seo-text h2 { font-size: 19px; } }
.seo-text { max-width: none; margin: 8px 0 28px; padding: 26px 30px; }
@media (min-width: 769px) { .hero-left { flex: 1.15 1 0; } .hero-right { flex: 1 1 0; } .seo-text p { max-width: 1100px; } }
@media (min-width: 769px) { .sticky-cta { display: none; } }

/* форма — в левой колонке под текстом, живой чат — справа */
@media (max-width: 768px) {
    .generator-card { order: 2; }
    .hero-right { order: 6; }
}
@media (min-width: 769px) {
    .hero-left { flex: 1.2 1 0; }
    .hero-right { flex: 1 1 0; position: sticky; top: 16px; }
    .hero-left .generator-card { margin-top: 18px; }
    .hero-left .hero-buttons { display: none; }
    .hero-left .age-disclaimer { margin-bottom: 0; }
    .hero-right .live-chat { margin-top: 0; }
    .hero-right .lc-body { height: 330px; }
}
.generator-card { text-align: left; }
@media (max-width: 768px) and (max-height: 700px) { .idea-chips { display: none; } .hero-left h1 { font-size: 20px; } }

/* ПК: блоки ровные по низу, кнопка «Создать рассказ» на первом экране */
@media (min-width: 769px) {
    .hero-grid { align-items: stretch; margin-bottom: 36px; }
    .hero-right { position: static; display: flex; }
    .hero-right .live-chat { flex: 1; display: flex; flex-direction: column; margin: 0; }
    .hero-right .lc-body { flex: 1; height: auto; min-height: 200px; contain: layout paint; }
    .hero-left h1 { font-size: clamp(28px, 2.3vw, 38px); margin-bottom: 10px; }
    .hero-left > p:not(.age-disclaimer) { font-size: 16px; margin-bottom: 18px; }
    .hero-left .generator-card { margin-top: 14px; padding: 20px 22px; }
    .hero-left .generator-card .form-group { margin-bottom: 12px; }
    .hero-left .prompt-input { min-height: 84px; height: 84px; }
    .hero-left .input-footer { margin-top: 4px; }
    .hero-left .cta-features { margin-top: 10px; }
}
@media (min-width: 769px) and (max-height: 760px) {
    .hero-left .idea-chips { display: none; }
    .hero-left .input-footer { display: none; }
}
@media (min-width: 769px) and (max-width: 1100px) and (max-height: 700px) { .hero-left h1 { font-size: 26px; } .hero-left > p:not(.age-disclaimer) { font-size: 15px; margin-bottom: 12px; } }

/* крестик у «Продолжить…» */
.continue-banner { position: relative; }
.continue-banner-close { flex-shrink: 0; width: 32px; height: 32px; margin: -4px -6px -4px 2px; border: none; border-radius: 50%; cursor: pointer;
    background: rgba(0, 0, 0, .12); color: var(--text-secondary); font-size: 20px; line-height: 1; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
.continue-banner-close:hover { background: rgba(214, 51, 132, .2); color: var(--text-primary); }

/* ПК: «Создать рассказ» и «Ответить ей» — на одной линии */
@media (min-width: 769px) {
    .hero-left { display: flex; flex-direction: column; }
    .hero-left .generator-card { flex: 1 1 auto; display: flex; flex-direction: column; }
    .hero-left .generator-card .cta-features { order: 0; margin: 0 0 12px !important; }
    .hero-left .generate-btn { order: 1; margin-top: auto !important; margin-bottom: 0 !important; }
    .hero-right .lc-cta { margin-bottom: 20px; }
}
@media (min-width: 769px) { .hero-right .lc-cta { min-height: 0; height: var(--gen-h, 58px); box-sizing: border-box; } .hero-left .generate-btn { height: 58px; min-height: 58px; box-sizing: border-box; } }
