/* Рабочая часть новой главной joov.app (CCG-94): форма заявки, анкета, персонаж в углу, чат.
   Правила перенесены с v1 (waitlist/v1/style.css), кнопки — в стиле лендинга (.btn-ink / .btn-line). */
:root { --err: #c0392b; }
body.ob-open { overflow: hidden; }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: #2a2a2a; }
.btn-ghost { background: transparent; color: var(--muted); padding: 0 12px; }
.btn-ghost:hover { color: var(--ink); }
.btn.is-busy { opacity: .6; pointer-events: none; }
.mini-orb { width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #9a9a96, #141414 70%); display: inline-block; flex: none; }
.dots { display: inline-flex; gap: 4px; padding: 3px 2px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gray); animation: blink 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .25; } }

/* Форма в финальной карточке */
.join-slot { width: min(520px, 100%); margin: 28px auto 0; text-align: left; }
.join-w { display: grid; gap: 10px; }
.field { display: flex; gap: 6px; padding: 5px 5px 5px 6px; border-radius: 999px; background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.field:focus-within { box-shadow: 0 0 0 1px var(--ink); }
.field input { flex: 1; min-width: 0; height: 46px; border: 0; outline: 0; background: transparent; padding: 0 18px; font-size: 16px; }
.field input::placeholder { color: var(--gray); }
.field .btn { --h: 46px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); line-height: 1.45; cursor: pointer; padding-left: 14px; }
.consent input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.consent a { color: var(--ink); text-underline-offset: 2px; }
.note { margin: 0; font-size: 13px; color: var(--gray); padding-left: 14px; }
.err { margin: 0; font-size: 14px; color: var(--err); padding-left: 14px; }
.err[hidden] { display: none; }
@media (max-width: 480px) {
  .field { flex-direction: column; border-radius: 22px; padding: 6px; }
  .field .btn { width: 100%; }
}
.joined { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; padding: 14px 16px 14px 20px; border-radius: 22px; background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.joined p { margin: 0; flex: 1 1 220px; color: var(--muted); overflow-wrap: anywhere; }
.joined b { color: var(--ok); font-weight: 500; }
.foot #privacy-link { color: var(--muted); }
.foot #privacy-link:hover { color: var(--ink); }

/* Персонаж-ассистент в углу */
.fab { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 45; display: flex; align-items: flex-end; gap: 10px; pointer-events: none; animation: rise .4s cubic-bezier(.2, .8, .2, 1) both; }
.fab[hidden] { display: none; }
.fab-b { pointer-events: auto; width: 68px; height: 68px; flex: none; border: 0; padding: 4px; border-radius: 50%; cursor: pointer; background: var(--paper); box-shadow: 0 0 0 1px var(--line), 0 12px 30px rgba(0, 0, 0, .16); transition: transform .2s; }
.fab-b:hover { transform: translateY(-2px) scale(1.04); }
.fab-b canvas { width: 100%; height: 100%; }
.fab-say { pointer-events: auto; margin: 0 0 18px; max-width: 280px; padding: 11px 14px; border-radius: 18px 18px 4px 18px; background: var(--paper); box-shadow: 0 0 0 1px var(--line), 0 14px 34px rgba(0, 0, 0, .14); font-size: 14.5px; line-height: 1.4; opacity: 0; transform: translateY(8px) scale(.94); transform-origin: bottom right; transition: opacity .3s, transform .35s cubic-bezier(.2, .8, .2, 1.2); visibility: hidden; }
.fab-say.in { opacity: 1; transform: none; visibility: visible; animation: none; }
.fab-go { display: block; margin-top: 8px; border: 0; background: none; padding: 0; cursor: pointer; font-size: 13.5px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 560px) { .fab-b { width: 56px; height: 56px; } .fab-say { max-width: calc(100vw - 110px); font-size: 13.5px; margin-bottom: 12px; } }

/* Анкета */
.ob { position: fixed; inset: 0; z-index: 60; background: rgba(18, 18, 18, .45); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .25s; overflow-y: auto; }
.ob.in { opacity: 1; }
.ob[hidden] { display: none; }
.ob-card { width: min(620px, 100%); background: var(--paper); border-radius: 28px; padding: clamp(20px, 4vw, 34px); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); transform: translateY(12px); transition: transform .3s cubic-bezier(.2, .8, .2, 1); outline: 0; }
.ob.in .ob-card { transform: none; }
.ob-card.hello { text-align: center; display: grid; justify-items: center; }
.ob-orb { width: 120px; height: 120px; }
.ob-card h2 { font-weight: 300; font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -0.035em; line-height: 1.08; margin: 6px 0 14px; }
.ob-lead { color: var(--muted); margin: 0 0 22px; font-size: 16px; max-width: 30em; }
.ob-top { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--gray); }
.x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; }
.x:hover { background: var(--soft); color: var(--ink); }
.ob .bar { height: 4px; border-radius: 4px; background: var(--soft); margin: 8px 0 20px; overflow: hidden; }
.ob .bar i { display: block; height: 100%; background: var(--ink); border-radius: 4px; transition: width .35s; }
.grp { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.grp legend { padding: 0; margin-bottom: 8px; font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.grp legend:empty { display: none; }
.grp legend small { color: var(--gray); font-size: 12.5px; }
.ob .chips { display: flex; flex-wrap: wrap; gap: 7px; }
.ob .chip { border: 0; border-radius: 999px; padding: 9px 15px; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; font-size: 14.5px; line-height: 1.2; text-align: left; transition: background .15s, color .15s; }
.ob .chip:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.ob .chip.on { background: var(--ink); color: #fff; box-shadow: none; }
.own { margin-top: 10px; width: 100%; height: 46px; border-radius: 14px; border: 1px solid var(--line-2); padding: 0 14px; font-size: 16px; outline: 0; }
.own:focus { border-color: var(--ink); }
.ob-b { display: flex; align-items: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.ob-b .sp { flex: 1; }
.ob-b.center { justify-content: center; margin-top: 0; }
@media (max-width: 560px) {
  .ob { padding: 0; place-items: end stretch; }
  .ob-card { border-radius: 24px 24px 0 0; max-height: 100dvh; overflow-y: auto; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .ob-b .btn { --h: 46px; }
  .ob-b .btn-ink:last-child { flex: 1 1 100%; order: 3; }
}

.fab-acts { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.fab-ask { display: block; margin-top: 8px; border: 0; background: none; padding: 0; cursor: pointer; font-size: 13.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
#chat { position: fixed; z-index: 60; right: max(16px, env(safe-area-inset-right)); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 80px); width: 380px; height: min(580px, calc(100dvh - 120px));
  display: flex; flex-direction: column; border-radius: 24px; background: var(--paper); box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(0, 0, 0, .18); overflow: hidden; animation: rise .3s cubic-bezier(.2, .8, .2, 1) both; }
#chat[hidden] { display: none; }
.chat-top { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.chat-top p { margin: 0; display: grid; line-height: 1.25; flex: 1; min-width: 0; }
.chat-top b { font-weight: 500; }
.chat-top small { color: var(--gray); font-size: 12.5px; }
.chat-x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--soft); font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.cm { margin: 0; max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; text-wrap: pretty; }
.cm.bot { align-self: flex-start; background: var(--soft); border-bottom-left-radius: 5px; }
.cm.me { align-self: flex-end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 5px; }
.chat-foot { padding: 12px 14px 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.chat-gate { display: grid; gap: 10px; }
.chat-gate input[type=email], .chat-send textarea { width: 100%; border: 1px solid var(--line-2); border-radius: 14px; padding: 11px 14px; font: inherit; font-size: 15px; background: var(--paper); color: var(--ink); }
.chat-gate .consent { font-size: 12.5px; }
.chat-gate .btn, .chat-tg .btn { justify-content: center; width: 100%; }
.chat-tg { display: grid; gap: 10px; justify-items: center; }
.chat-wait { margin: 0; font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.chat-link { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--gray); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-chips button { border: 1px solid var(--line-2); background: var(--paper); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); text-align: left; }
.chat-chips button:hover { background: var(--soft); }
.chat-send { display: flex; gap: 8px; align-items: flex-end; }
.chat-send textarea { resize: none; min-height: 44px; max-height: 120px; line-height: 1.4; }
.chat-send .btn { width: 44px; height: 44px; padding: 0; flex: none; justify-content: center; font-size: 18px; }
.chat-foot .err { margin: 0; }
@media (max-width: 560px) {
  #chat { left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; height: min(640px, calc(100dvh - 16px)); border-radius: 22px; }
  body.chat-open .fab { display: none; }
  .chat-send textarea, .chat-gate input[type=email] { font-size: 16px; } /* iOS не зумит поле */
}
.chat-top .mini-orb { width: 30px; height: 30px; }
@media (max-width: 560px) {
  .fab .fab-b { transition: opacity .25s, transform .25s; }
}


.fab-b canvas { border-radius: 50%; }
.fab { animation: none; }
.fab:not([hidden]) { animation: rise .4s var(--ease-out) both; }
.ob-card .btn-go { gap: 8px; }
@media (prefers-reduced-motion: reduce) { .fab, #chat, .ob, .ob-card, .fab-say { animation: none !important; transition: none !important; } }
/* у лендинга свои .chip и .bar — в анкете перебиваем */
.ob .chip { display: inline-block; white-space: normal; color: var(--ink); font-size: 14.5px; }
.ob .chip.on { color: #fff; }
.ob .bar { height: 4px; margin: 8px 0 20px; }
.ob .bar i { transform: none; transition: width .35s; }
/* на телефоне у лендинга в кнопке только стрелка — у формы заявки и анкеты оставляем текст */
.field .btn-go > span, .ob .btn-go > span { display: inline; }
