/* /css/incog/style.css */

@font-face {
  font-family: 'NotoEmoji';
  src: url('https://fonts.gstatic.com/s/notocoloremoji/v25/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFab5s79iz64w.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+1F000-1FFFF, U+2600-27FF, U+2B00-2BFF, U+FE00-FE0F;
}

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

:root {
  --bg:       #0d0d0f;
  --surface:  #16161a;
  --surface2: #1e1e24;
  --border:   #2a2a35;
  --accent:   #7c3aed;
  --accent2:  #a855f7;
  --text:     #e8e8f0;
  --muted:    #6b6b80;
  --danger:   #ef4444;
  --green:    #22c55e;
  --radius:   16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.e {
  font-family: 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  font-style: normal;
}

body.incog-page {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(124,58,237,.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(168,85,247,.08) 0%, transparent 60%);
  word-spacing: normal;
  letter-spacing: normal;
}

/* ── Лого ── */
.incog-logo {
  font-family: 'Unbounded', 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: 8px;
  text-align: center;
  word-spacing: normal;
}
.incog-logo span { color: var(--accent2); }
.incog-tagline {
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 32px;
  text-align: center;
  word-spacing: normal;
}

/* ── Выбор пола ── */
#screen-gender {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 380px;
}
.gender-title {
  font-family: 'Unbounded', 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  font-size: 1rem;
  text-align: center;
  color: var(--text);
  word-spacing: normal;
}
.gender-subtitle {
  font-size: .82rem;
  color: var(--muted);
  text-align: center;
  margin-top: -8px;
  word-spacing: normal;
}
.gender-btns { display: flex; gap: 14px; width: 100%; }
.btn-gender {
  flex: 1;
  padding: 20px 10px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: 'Unbounded', 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  font-size: .9rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  word-spacing: normal;
  letter-spacing: normal;
  text-align: center;
}
.btn-gender:hover { border-color: var(--accent2); background: var(--surface); }
.btn-gender .g-icon {
  font-size: 2rem;
  font-family: 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}

/* ── Главный экран ── */
#screen-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 380px;
}
.btn-find {
  width: 100%;
  padding: 18px;
  border-radius: var(--radius);
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-family: 'Unbounded', 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  box-shadow: 0 8px 32px rgba(124,58,237,.35);
  word-spacing: normal;
  letter-spacing: normal;
  text-align: center;
}
.btn-find:hover { opacity: .9; transform: translateY(-1px); }
.btn-find:active { transform: translateY(0); }

.user-info-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--surface2);
  border-radius: 12px;
  border: 1px solid var(--border);
  width: 100%;
  word-spacing: normal;
}
.user-info-bar img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.user-info-bar .ui-name { font-size: .88rem; font-weight: 500; }
.user-info-bar .ui-sub  { font-size: .75rem; color: var(--muted); }

/* ── Ожидание ── */
#screen-waiting {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 380px;
}
.pulse-ring {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(124,58,237,.15);
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  animation: pulse 1.8s ease-in-out infinite;
  font-size: 2rem;
  font-family: 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(124,58,237,.4); }
  50%      { box-shadow: 0 0 0 20px rgba(124,58,237,0); }
}
.waiting-text {
  font-family: 'Unbounded', sans-serif;
  font-size: .95rem;
  color: var(--muted);
  text-align: center;
  word-spacing: normal;
}
.dots::after {
  content: '';
  animation: dots 1.5s steps(4,end) infinite;
}
@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}
.btn-cancel {
  padding: 12px 28px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-size: .9rem;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  word-spacing: normal;
}
.btn-cancel:hover { border-color: var(--danger); color: var(--danger); }

/* ── Чат ── */
#screen-chat {
  display: none;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
  max-height: 700px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  flex-shrink: 0;
  word-spacing: normal;
}
.anon-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  font-family: 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  flex-shrink: 0;
  transition: all .4s;
  overflow: hidden;
  text-decoration: none;
}
.anon-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.anon-avatar.revealed { background: linear-gradient(135deg, #059669, #10b981); }
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-title {
  font-family: 'Unbounded', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-spacing: normal;
}
.chat-header-sub { font-size: .75rem; color: var(--muted); margin-top: 2px; word-spacing: normal; }
.header-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 1rem;
  font-family: 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s, color .2s, background .2s;
}
.btn-icon:hover { border-color: var(--accent2); color: var(--accent2); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ── Сообщения ── */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.msg {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: .9rem;
  line-height: 1.5;
  animation: fadeUp .2s ease;
  word-spacing: normal;
  letter-spacing: normal;
  text-align: left;
}
@keyframes fadeUp {
  from { opacity:0; transform: translateY(6px); }
  to   { opacity:1; transform: translateY(0); }
}
.msg.mine {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg.theirs {
  background: var(--surface2);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.msg-body { display: block; }
.msg-body::after { content: ''; display: table; clear: both; }
.msg-time {
  display: inline-block;
  font-size: .68rem;
  opacity: .6;
  margin-left: 8px;
  white-space: nowrap;
  float: right;
  position: relative;
  top: 4px;
  word-spacing: normal;
}

.system-msg {
  text-align: center;
  font-size: .78rem;
  color: var(--muted);
  padding: 6px 14px;
  background: var(--surface2);
  border-radius: 20px;
  align-self: center;
  border: 1px solid var(--border);
  word-spacing: normal;
}
.system-msg.success {
  color: var(--green);
  border-color: rgba(34,197,94,.3);
  background: rgba(34,197,94,.05);
}

/* ── Индикатор "печатает..." ── */
.typing-indicator {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  flex-shrink: 0;
  transition: max-height .25s ease, opacity .25s ease, padding .25s ease;
}
.typing-indicator.active {
  max-height: 32px;
  opacity: 1;
  padding: 6px 16px 4px;
}
.typing-text {
  font-size: .75rem;
  color: var(--muted);
  word-spacing: normal;
}
.typing-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}
.typing-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: .4; }
  30%            { transform: translateY(-4px); opacity: 1; }
}

/* ── Ввод ── */
.chat-input-area {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface2);
  flex-shrink: 0;
}
.msg-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: 'Inter', 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  resize: none;
  height: 44px;
  max-height: 44px;
  overflow-y: auto;
  line-height: 1.4;
  outline: none;
  transition: border-color .2s;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  scrollbar-width: none;
  word-spacing: normal;
  letter-spacing: normal;
}
.msg-input::-webkit-scrollbar { display: none; }
.msg-input:focus { border-color: var(--accent); }
.msg-input::placeholder { color: var(--muted); }

.btn-send {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .2s, transform .1s;
  touch-action: manipulation;
}
.btn-send:hover { opacity: .85; transform: scale(1.05); }
.btn-send:disabled { opacity: .4; cursor: default; transform: none; }

.warn-bar {
  display: none;
  padding: 6px 14px;
  background: rgba(239,68,68,.1);
  border-top: 1px solid rgba(239,68,68,.3);
  font-size: .78rem;
  color: var(--danger);
  flex-shrink: 0;
  word-spacing: normal;
}

.reveal-banner {
  display: none;
  padding: 10px 16px;
  background: rgba(34,197,94,.07);
  border-bottom: 1px solid rgba(34,197,94,.2);
  text-align: center;
  font-size: .82rem;
  color: var(--green);
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  word-spacing: normal;
}
.reveal-banner button {
  padding: 5px 14px;
  border-radius: 8px;
  border: 1px solid var(--green);
  background: transparent;
  color: var(--green);
  font-size: .8rem;
  cursor: pointer;
  transition: background .2s;
}
.reveal-banner button:hover { background: rgba(34,197,94,.15); }

/* ── Ended ── */
#screen-ended {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 360px;
  text-align: center;
  word-spacing: normal;
}
.ended-icon {
  font-size: 3rem;
  font-family: 'NotoEmoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}
.ended-title { font-family: 'Unbounded', sans-serif; font-size: 1.1rem; word-spacing: normal; }
.ended-sub { color: var(--muted); font-size: .88rem; line-height: 1.6; word-spacing: normal; }

/* ── Модал ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 100;
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%; max-width: 340px;
  word-spacing: normal;
}
.modal h3 { font-family: 'Unbounded', sans-serif; font-size: .95rem; margin-bottom: 12px; word-spacing: normal; }
.modal textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  resize: none; height: 90px; outline: none;
  margin-bottom: 14px;
  word-spacing: normal;
}
.modal-btns { display: flex; gap: 10px; }
.modal-btns button {
  flex: 1; padding: 11px;
  border-radius: 10px; border: 1px solid var(--border);
  font-size: .88rem; cursor: pointer;
  background: transparent; color: var(--muted);
  touch-action: manipulation;
  word-spacing: normal;
}
.modal-btns .btn-confirm { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ════════════════════════════════════════════════════
   МОБИЛЬНАЯ ВЕРСИЯ
   ════════════════════════════════════════════════════ */
@media (max-width: 600px) {

  body.incog-page {
    padding: 0;
    justify-content: flex-start;
    padding-top: env(safe-area-inset-top);
  }

  #screen-home,
  #screen-gender,
  #screen-waiting,
  #screen-ended {
    min-height: 100dvh;
    justify-content: center;
    padding: 24px 20px;
    padding-top: calc(env(safe-area-inset-top) + 24px);
    padding-bottom: calc(env(safe-area-inset-bottom) + 24px);
  }

  #screen-chat {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding-top: env(safe-area-inset-top);
  }

  .chat-header { padding: 10px 14px; }

  .chat-input-area {
    padding: 10px 12px;
    padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
    position: sticky;
    bottom: 0;
  }

  .msg-input {
    font-size: 16px;
    height: auto;
    max-height: 80px;
    overflow-y: auto;
  }

}