/* =============================================
   VIBEFY — ЕДИНАЯ СИСТЕМА СТИЛЕЙ
   Акцент: #8b5cf6 (синий)
   Фон: #0e0e0e / Карточки: #161616 / #1c1c1c
   ============================================= */

:root {
  --bg:        #0e0e0e;
  --surface:   #161616;
  --surface2:  #1c1c1c;
  --surface3:  #242424;
  --border:    #252525;
  --border2:   #2e2e2e;
  --text:      #ebebeb;
  --text2:     #aaa;
  --muted:     #555;
  --accent:    #8b5cf6;
  --accent-h:  #7c3aed;
  --danger:    #8b5cf6;
  --radius:    12px;
  --radius-lg: 18px;
  --nav-h:     60px;
}

/* =====================
   RESET & BASE
   ===================== */

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

body {
  font-family: -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; font-family: inherit; transition: background .15s, color .15s, opacity .15s; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* =====================
   HEADER
   ===================== */

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.logo-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

/* Аватар в хедере */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface3);
  overflow: hidden;
  cursor: pointer;
  z-index: 101;
}
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Дропдаун */
.dropdown {
  display: none;
  position: absolute;
  right: 0; top: 44px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  z-index: 200;
  min-width: 150px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  flex-direction: column;
  gap: 6px;
}
.dropdown.show { display: flex; animation: fadeIn .15s ease; }

.logout-btn {
  width: 100%;
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.logout-btn:hover { background: #cc2222; }
.delete-btn { background: #333; color: #ff5555; }
.delete-btn:hover { background: #444; }

/* Кнопка "войти" */
.btn {
  background: var(--surface3);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  font-size: 13px;
  font-weight: 500;
}
.btn:hover { background: var(--border2); }

/* =====================
   MAIN / PAGES
   ===================== */

main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 0 var(--nav-h);
  overflow-y: auto;
}

.page { display: none; }
.page.active { display: block; animation: fadeUp .2s ease; }

/* Не авторизован */
.not-logged {
  display: flex;
  justify-content: center;
  padding: 60px 20px;
}
.btn-big {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
}
.btn-big:hover { background: var(--accent-h); }

/* =====================
   BOTTOM NAV
   ===================== */

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .45;
  transition: opacity .15s;
}
.nav-btn.active { opacity: 1; }
.nav-btn img { width: 22px; height: 22px; object-fit: contain; }

/* =====================
   ИКОНКА-КНОПКА
   ===================== */

.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text2);
  padding: 6px;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); background: var(--surface3); }
.icon-btn img { width: 22px; height: 22px; object-fit: contain; }

.icon-btn.small-btn {
  background: var(--surface3);
  border: 1px solid var(--border2);
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text2);
}
.icon-btn.small-btn:hover { color: var(--text); }

/* =====================
   МОДАЛКИ (базовые)
   ===================== */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  justify-content: center;
  align-items: center;
  z-index: 9000;
}
.modal.show { display: flex; }

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  color: var(--text);
  animation: fadeIn .2s ease;
  border: 1px solid var(--border);
}

.modal-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}

.modal-content input,
.modal-content textarea,
.modal-content select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 13px;
  font-size: 14px;
  outline: none;
  margin-bottom: 8px;
  transition: border-color .15s;
}
.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus { border-color: var(--accent); }

.modal-content button[type="submit"],
.modal-content > button:last-child {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}
.modal-content button[type="submit"]:hover,
.modal-content > button:last-child:hover { background: var(--accent-h); }

/* Кнопка закрытия */
.close {
  float: right;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.close:hover { color: var(--text); }

/* =====================
   АВТОРИЗАЦИЯ
   ===================== */

#authModal .modal-content {
  border-radius: var(--radius-lg);
  margin: auto;
}

#authModal h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 14px 0 10px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-size: 12px;
}

#authModal form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 6px;
}

#authModal form button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 11px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
}
#authModal form button:hover { background: var(--accent-h); }

/* =====================
   ЛЕНТА (HOME)
   ===================== */

#home { padding: 10px 12px; }

.recommendations-list { display: flex; flex-direction: column; gap: 0; }

/* Пост */
.post-card {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.user-info { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface3);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.username { font-weight: 700; font-size: 14px; }

.post-media {
  aspect-ratio: 9/16;
  width: 100%;
  max-height: 70vh;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface2);
  margin: 8px 0;
}
.post-media img { width: 100%; height: 100%; object-fit: cover; }

.post-actions {
  display: flex;
  gap: 14px;
  padding: 6px 0;
}
.post-actions button {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
}
.post-actions button:hover { color: var(--text); }
.post-actions button span { font-size: 13px; color: var(--muted); }

.post-description { font-size: 14px; color: var(--text2); line-height: 1.5; padding: 2px 0; }
.post-img { width: 100%; border-radius: var(--radius); margin-bottom: 8px; }

/* =====================
   МОДАЛКА ПОСТА
   ===================== */

#postModal {
  display: none;
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(8px);
  z-index: 99999;
}
#postModal.show { display: flex; }

.post-modal-content {
  display: flex;
  flex-direction: row;
  width: 92%;
  max-width: 860px;
  max-height: 85vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  animation: fadeIn .2s ease;
}

#postModalImage {
  width: 50%; height: 100%;
  object-fit: cover;
  background: #000;
  flex-shrink: 0;
}

.post-modal-right {
  width: 50%;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  background: var(--surface);
  position: relative;
}

#closePostModal {
  position: absolute;
  top: 12px; right: 14px;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  z-index: 10;
  background: none;
  border: none;
}
#closePostModal:hover { color: var(--text); }

.comments-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
  padding-right: 4px;
}
.comments-list::-webkit-scrollbar { width: 4px; }
.comments-list::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 2px; }

.comment-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.comment-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface3);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.comment-text { display: flex; flex-direction: column; gap: 2px; }
.comment-nickname { font-weight: 600; font-size: 13px; color: var(--text); }
.comment-message { font-size: 13px; color: var(--text2); line-height: 1.4; }

.comment-input {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.comment-input input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  color: var(--text);
  padding: 9px 14px;
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.comment-input input:focus { border-color: var(--accent); }
.comment-input button {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 36px; height: 36px;
  color: #fff;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.comment-input button:hover { background: var(--accent-h); }

/* =====================
   СОЗДАТЬ ПОСТ
   ===================== */

#createPostModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.8);
  z-index: 9999;
  justify-content: center;
  align-items: flex-end;
}
#createPostModal.show { display: flex; }

.create-post-content {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeUp .2s ease;
  border: 1px solid var(--border);
  border-bottom: none;
}

.create-post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
}
.create-post-header button {
  background: none; border: none;
  color: var(--muted); font-size: 20px;
}
.create-post-header button:hover { color: var(--text); }

.create-post-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }

.upload-area { background: var(--surface2); border-radius: var(--radius); padding: 14px; }

.carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 10px;
}
.carousel img {
  width: 100%;
  max-height: 260px;
  border-radius: 8px;
  object-fit: cover;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
}
.upload-btn input { display: none; }

.post-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 13px;
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 90px;
  line-height: 1.5;
}
.post-textarea:focus { border-color: var(--accent); }

.post-tags {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 13px;
  font-size: 14px;
  outline: none;
}
.post-tags:focus { border-color: var(--accent); }

.publish-btn-red {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  width: 100%;
}
.publish-btn-red:hover { background: var(--accent-h); }

/* =====================
   ПРОФИЛЬ (settings)
   ===================== */

#settings { padding: 16px 14px; }

.profile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.profile-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  width: 100%;
}

.avatar-wrapper {
  position: relative;
  width: 90px; height: 90px;
  margin: 0 auto;
}
.avatar-wrapper .avatar-img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border2);
}
.avatar-border {
  position: absolute;
  top: -6%; left: -6%;
  width: 112%; height: 112%;
  pointer-events: none;
}

.username {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-top: 6px;
  text-align: center;
  width: 100%;
}
.profile-login { font-size: 13px; color: var(--muted); }

.stats {
  display: flex;
  gap: 24px;
  justify-content: center;
  font-size: 13px;
  color: var(--text2);
  margin: 4px 0;
}
.stats b { color: var(--text); font-size: 15px; }

.share-btn {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  margin: 4px auto 0;
  display: block;
}
.share-btn:hover { color: var(--text); }

.profile-bio {
  font-size: 14px;
  color: var(--text2);
  padding: 0 10px;
  line-height: 1.5;
}

/* Сетка постов профиля */
.profile-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-top: 16px;
}
.profile-posts-grid .post-item {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface2);
  cursor: pointer;
}
.profile-posts-grid .post-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity .15s;
}
.profile-posts-grid .post-item:hover img { opacity: .8; }

/* =====================
   НАСТРОЙКИ ПРОФИЛЯ (модалка)
   ===================== */

#settingsModal .modal-content {
  border-radius: var(--radius-lg);
  margin: auto;
  max-height: 85vh;
  overflow-y: auto;
}

#settingsModal h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
}

#settingsModal form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#settingsModal label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
}

.profile-bio-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 13px;
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 70px;
}
.profile-bio-input:focus { border-color: var(--accent); }

.save-profile-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  width: 100%;
}
.save-profile-btn:hover { background: var(--accent-h); }

/* Кастомный select обводки */
.custom-select { position: relative; }
.select-selected {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 14px;
  color: var(--text2);
  cursor: pointer;
}
.select-options {
  display: none;
  position: absolute;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  width: 100%;
  z-index: 10;
  overflow: hidden;
}
.select-option {
  padding: 10px 13px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text2);
}
.select-option:hover { background: var(--surface3); color: var(--text); }

/* =====================
   ПРОФИЛЬ ДРУГОГО ПОЛЬЗОВАТЕЛЯ
   ===================== */

#userProfileModal {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  overflow-y: auto;
}
#userProfileModal.show { display: block; animation: fadeIn .2s ease; }

.profile-page {
  width: 100%;
  min-height: 100vh;
  padding: 16px 14px;
  text-align: center;
}

.follow-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 24px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  margin: 6px 0;
}
.follow-btn:hover { background: var(--accent-h); }
.follow-btn.following { background: var(--surface3) !important; color: var(--text2) !important; border: 1px solid var(--border2); }
.unfollow-btn { background: var(--surface3) !important; color: var(--text2) !important; }

/* =====================
   ПОИСК (чаты)
   ===================== */

#chats { padding: 12px; }

.search-bar {
  position: relative;
  margin-bottom: 8px;
}
.search-bar input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  color: var(--text);
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
}
.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--muted); }

#suggestions {
  position: absolute;
  top: 100%; left: 0;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow-y: auto;
  max-height: 280px;
  z-index: 99999;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.suggestion-item:hover { background: var(--surface3); }
.suggestion-login { font-size: 12px; color: var(--muted); }

/* Список чатов */
.recent-chats { display: flex; flex-direction: column; gap: 2px; }

.chat-card-wrap {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius);
  overflow: hidden;
}

.recent-chat-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  cursor: pointer;
  border-radius: var(--radius) 0 0 var(--radius);
  transition: background .12s;
}
.recent-chat-card:hover { background: var(--surface2); }

.chat-avatar-wrapper { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.chat-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--surface3);
  background-size: cover;
  background-position: center;
}
.chat-avatar-border {
  position: absolute;
  top: -4px; left: -4px;
  width: 54px; height: 54px;
  pointer-events: none;
}

.chat-info { flex: 1; min-width: 0; }
.chat-name { font-size: 15px; font-weight: 600; color: var(--text); }
.chat-last {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-badge {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: var(--danger);
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.chat-delete-action {
  width: 50px;
  background: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  flex-shrink: 0;
}
.chat-delete-action:hover { background: #7c3aed; }

/* Окно чата */
.chat-window {
  position: fixed;
  bottom: var(--nav-h);
  left: 0; width: 100%;
  height: calc(100% - 50px - var(--nav-h));
  background: var(--bg);
  display: none;
  flex-direction: column;
  z-index: 1500;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.chat-username { font-size: 15px; font-weight: 700; flex: 1; }
.close-chat { background: none; border: none; color: var(--muted); font-size: 20px; }
.close-chat:hover { color: var(--text); }

.chat-header-actions { position: relative; margin-left: auto; }
.chat-menu-btn { background: none; border: none; color: var(--text2); font-size: 22px; padding: 4px 8px; border-radius: 6px; }
.chat-menu-btn:hover { background: var(--surface3); }

.chat-menu {
  position: absolute;
  right: 0; top: 36px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  z-index: 999;
  min-width: 180px;
  overflow: hidden;
}
.chat-menu button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  font-size: 14px;
}
.chat-menu button:hover { background: var(--surface3); }
#deleteChatBtn { color: var(--danger) !important; }

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  overflow-y: auto;
  background: var(--bg);
}

.my-message {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  padding: 9px 13px;
  border-radius: 16px 16px 2px 16px;
  max-width: 72%;
  font-size: 14px;
  word-wrap: break-word;
  line-height: 1.4;
}
.other-message {
  align-self: flex-start;
  background: var(--surface2);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 16px 16px 16px 2px;
  max-width: 72%;
  font-size: 14px;
  word-wrap: break-word;
  line-height: 1.4;
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.chat-input input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}
.chat-input input:focus { border-color: var(--accent); }
.chat-input button {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-input button:hover { background: var(--accent-h); }

.system-message {
  background: var(--surface2);
  padding: 7px 12px;
  border-radius: 10px;
  margin: 4px 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* =====================
   ОБСУЖДЕНИЯ
   ===================== */

#discussion { padding: 0 12px 20px; }

.discussion-wrapper { display: flex; flex-direction: column; gap: 0; }

.discussions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 10px;
}
.discussions-header h2 { font-size: 17px; font-weight: 700; }
.discussion-top-buttons { display: flex; gap: 6px; }

.disc-search-wrap { margin-bottom: 12px; }
.disc-search-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}
.disc-search-input:focus { border-color: var(--accent); }
.disc-search-input::placeholder { color: var(--muted); }

.discussions-list { display: flex; flex-direction: column; gap: 10px; }

.discussion-item {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  border: 1px solid var(--border);
  animation: fadeUp .2s ease;
}

.discussion-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.disc-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface3);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.disc-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.disc-nick-row { display: flex; align-items: center; gap: 6px; }
.disc-nick { font-weight: 600; font-size: 14px; color: var(--text); }
.disc-time { font-size: 11px; color: var(--muted); }
.disc-anon-badge {
  font-size: 11px;
  background: var(--surface3);
  color: var(--muted);
  border-radius: 4px;
  padding: 1px 6px;
}

.disc-actions { margin-left: auto; }
.disc-delete-btn { background: none; border: none; color: var(--muted); font-size: 13px; padding: 2px 4px; }
.disc-delete-btn:hover { color: var(--danger); }

.disc-body {
  font-size: 15px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 12px;
  word-break: break-word;
  white-space: pre-wrap;
}

/* Комментарии к обсуждению */
.disc-comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 10px;
  border-left: 2px solid var(--border2);
  margin-bottom: 10px;
}

.disc-comment { display: flex; gap: 8px; align-items: flex-start; }
.disc-comment-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface3);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.disc-comment-body { flex: 1; }
.disc-comment-top { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.disc-comment-nick { font-weight: 600; font-size: 13px; color: var(--text); }
.disc-comment-time { font-size: 11px; color: var(--muted); }
.disc-comment-text { font-size: 13px; color: var(--text2); line-height: 1.45; }

.disc-mention { color: var(--accent); font-weight: 600; margin-right: 2px; }

.disc-reply-btn { background: none; border: none; color: var(--muted); font-size: 12px; padding: 2px 0; margin-top: 3px; }
.disc-reply-btn:hover { color: var(--accent); }

.disc-comments-toggle { margin: 6px 0 4px; }
.disc-toggle-btn { background: none; border: none; color: var(--accent); font-size: 13px; font-weight: 500; padding: 3px 0; }
.disc-toggle-btn:hover { opacity: .75; }

.disc-input-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }

.disc-reply-tag {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  color: var(--muted);
}
.disc-reply-tag b { color: var(--accent); }
.disc-cancel-reply { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 0 4px; }
.disc-cancel-reply:hover { color: var(--text); }

.disc-anon-label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }

.disc-comment-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  color: var(--text);
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.disc-comment-input:focus { border-color: var(--accent); }

.disc-send-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 34px; height: 34px;
  color: #fff;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.disc-send-btn:hover { background: var(--accent-h); }

.no-discussions { text-align: center; color: var(--muted); padding: 30px 0; font-size: 14px; }

/* Модалка создания обсуждения */
#createDiscussionModal .modal-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#createDiscussionModal textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 13px;
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 100px;
  line-height: 1.5;
}
#createDiscussionModal textarea:focus { border-color: var(--accent); }
.activity-publish {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  width: 100%;
}
.activity-publish:hover { background: var(--accent-h); }

/* =====================
   ГРУППЫ
   ===================== */

.group-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px);
  z-index: 99999;
  justify-content: center;
  align-items: center;
}
.group-modal.show { display: flex; }

.group-modal-content {
  background: var(--surface);
  width: 90%;
  max-width: 400px;
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn .2s ease;
}

.group-modal-header { display: flex; justify-content: space-between; align-items: center; }
.group-modal-header h2 { font-size: 17px; font-weight: 700; }
.group-close-btn { background: none; border: none; color: var(--muted); font-size: 18px; }
.group-close-btn:hover { color: var(--text); }

.group-field { display: flex; flex-direction: column; gap: 5px; }
.group-field label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.group-field input,
.group-field textarea,
.group-field select {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.group-field textarea { resize: none; height: 70px; }
.group-field input:focus,
.group-field textarea:focus,
.group-field select:focus { border-color: var(--accent); }

.group-save-btn {
  background: var(--accent);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  width: 100%;
}
.group-save-btn:hover { background: var(--accent-h); }

/* Сообщения группы */
.group-message { display: flex; gap: 10px; margin: 8px 0; }
.group-msg-avatar img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.group-msg-content { background: var(--surface2); padding: 8px 12px; border-radius: var(--radius); max-width: 65%; }
.group-msg-name { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.group-msg-text { color: var(--text); font-size: 14px; }

/* =====================
   АКТИВНОСТЬ
   ===================== */

.activity-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}
.activity-modal.show { display: flex; }

.activity-content {
  width: 95%;
  max-width: 480px;
  height: 82vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn .2s ease;
}

.activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.activity-close { background: none; border: none; color: var(--muted); font-size: 18px; }
.activity-close:hover { color: var(--text); }

.activity-list { flex: 1; overflow-y: auto; padding: 8px 16px; }

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.activity-item:hover { background: none; opacity: .8; }

.activity-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface3);
  flex-shrink: 0;
}
.activity-text { flex: 1; color: var(--text2); font-size: 14px; line-height: 1.4; }
.activity-text b { color: var(--text); }
.activity-time { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* =====================
   ЗНАКОМСТВА
   ===================== */

#dating {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 14px 14px 90px;
  gap: 14px;
}
#dating.active { display: flex; }

.dating-top-bar {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.dating-top-btn {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text2);
  border-radius: 10px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: .2px;
}
.dating-top-btn:hover { background: var(--surface2); color: var(--text); }

.dating-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 400px;
  animation: fadeUp .2s ease;
}

.dating-card-photo {
  width: 100%; height: 300px;
  object-fit: cover;
  display: block;
  background: var(--surface2);
}
.dating-card-photo-placeholder {
  width: 100%; height: 300px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  color: var(--surface3);
}

.dating-card-info { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 7px; }
.dating-card-name { font-size: 20px; font-weight: 700; color: var(--text); }
.dating-card-name span { font-weight: 400; font-size: 16px; color: var(--muted); margin-left: 6px; }
.dating-card-city { font-size: 13px; color: var(--muted); }
.dating-card-bio { font-size: 14px; color: var(--text2); line-height: 1.55; }
.dating-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.dating-card-tag {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 500;
}
.dating-card-looking { font-size: 12px; color: var(--muted); }

.dating-empty {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 50px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.dating-empty-icon { font-size: 44px; margin-bottom: 12px; filter: grayscale(1); opacity: .4; }

.dating-actions { width: 100%; max-width: 420px; display: flex; justify-content: center; gap: 20px; }

.dating-btn {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s, background .15s;
}
.dating-btn:active { transform: scale(.9); }
.dating-btn:disabled { opacity: .3; cursor: default; }

.dating-btn-dislike { background: var(--surface); color: var(--muted); }
.dating-btn-dislike:hover:not(:disabled) { background: var(--surface2); color: var(--text2); }

.dating-btn-like { background: var(--surface); color: var(--accent); border-color: #2e1a4a; }
.dating-btn-like:hover:not(:disabled) { background: #1e1a2e; color: #a78bfa; }

/* Настройки анкеты */
#datingSettingsModal .modal-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#datingSettingsModal input,
#datingSettingsModal select,
#datingSettingsModal textarea {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 13px;
  font-size: 14px;
  width: 100%;
  outline: none;
}
#datingSettingsModal textarea { resize: vertical; min-height: 80px; }
#datingSettingsModal input:focus,
#datingSettingsModal select:focus,
#datingSettingsModal textarea:focus { border-color: var(--accent); }
#datingSettingsModal h3 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; margin: 4px 0 0; }
#datingSettingsModal hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

#saveDatingProfile {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
  width: 100%;
}
#saveDatingProfile:hover { background: var(--accent-h); }

/* Кто меня лайкнул */
#datingLikesList { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }

/* Пустое состояние */
.dating-likes-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

/* Вьювер карточек */
.dl-viewer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
}
.dl-counter {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .5px;
  margin-bottom: 12px;
  align-self: flex-end;
}
.dl-card {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
}
.dl-photo {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  display: block;
  background: var(--surface3);
}
.dl-info {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.dl-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.dl-age {
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
}
.dl-city  { font-size: 13px; color: var(--muted); }
.dl-bio   { font-size: 14px; color: var(--text2); line-height: 1.5; margin-top: 2px; }
.dl-looking { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dl-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
  width: 100%;
}

/* Кнопка чата в совпадениях */
.match-login {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}
.match-chat-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s;
}
.match-chat-btn:hover { opacity: .85; }

/* Взаимные симпатии */
.mutual-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.mutual-modal.show { display: flex; }

.mutual-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  width: 90%;
  max-width: 380px;
  max-height: 80vh;
  overflow-y: auto;
  animation: fadeIn .2s ease;
}
.mutual-content h2 { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 6px; }
#mutualCount { text-align: center; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 14px; }
#mutualList { display: flex; flex-direction: column; gap: 8px; }

.match-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 14px;
  transition: background .12s;
}
.match-card:hover { background: var(--surface3); }
.match-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface3); flex-shrink: 0; }
.match-info strong { display: block; font-size: 14px; color: var(--text); font-weight: 600; }
.match-info a { color: var(--accent); text-decoration: none; font-size: 12px; }
.match-info a:hover { text-decoration: underline; }

/* =====================
   АВАТАР — ОБВОДКИ
   ===================== */

.avatar-border-gold { border: 3px solid gold; border-radius: 50%; }
.avatar-border-red  { border: 3px solid red;  border-radius: 50%; }

/* =====================
   СКРОЛЛБАР
   ===================== */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 2px; }
::-webkit-scrollbar-track { background: transparent; }
/* =======================
   Авторизация
   ======================= */
.auth-modal-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 24px 20px 28px;
  max-width: 360px;
  width: 92%;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}

.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-panel input[type="text"],
.auth-panel input[type="password"],
.auth-panel input[type="email"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.auth-panel input:focus { border-color: var(--accent); }

.auth-agree {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  cursor: pointer;
}

.auth-agree input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

.auth-agree a { color: var(--accent); text-decoration: none; }
.auth-agree a:hover { text-decoration: underline; }

.auth-submit-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity .2s;
}

.auth-submit-btn:hover { opacity: .88; }
.auth-submit-btn:disabled { opacity: .5; cursor: default; }

.auth-error {
  font-size: 13px;
  color: #ff5555;
  min-height: 16px;
  text-align: center;
}

/* =====================
   SPLASH SCREEN
   ===================== */

#splashScreen {
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .5s ease, visibility .5s ease;
}

#splashScreen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#splashCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.splash-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Логотип с кольцами */
.splash-logo {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.splash-icon {
  width: 90px;
  height: 90px;
  object-fit: contain;
  border-radius: 22px;
  animation: splashPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.5));
}

@keyframes splashPulse {
  0%, 100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 20px rgba(139,92,246,.5)); }
  50% { opacity: .85; transform: scale(.94); filter: drop-shadow(0 0 30px rgba(139,92,246,.8)); }
}

.splash-name {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -1px;
  animation: splashFadeUp .6s ease both;
  animation-delay: .2s;
  opacity: 0;
}



@keyframes splashFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Прогресс-бар */
.splash-bar {
  width: 120px;
  height: 2px;
  background: #1e1e1e;
  border-radius: 2px;
  margin-top: 24px;
  overflow: hidden;
  animation: splashFadeUp .6s ease both;
  animation-delay: .5s;
  opacity: 0;
}

.splash-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
  border-radius: 2px;
  animation: splashLoad 1.8s cubic-bezier(.4,0,.2,1) both;
  animation-delay: .3s;
}

@keyframes splashLoad {
  0%   { width: 0%; }
  60%  { width: 80%; }
  100% { width: 100%; }
}