/* ========================================================================
   APP.CSS — Unified stylesheet for login, signup, and chat views
   View-based logic via <html data-view="login|signup|chat">
   ======================================================================== */

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  height: auto;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}
body {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Open Sans", system-ui, sans-serif;
  overflow: hidden;
}

/* ---------- BACKGROUND (all views) ---------- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #000;
}
.bg {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  will-change: transform;
  pointer-events: none;
  user-select: none;
  contain: layout paint size;
}
.bg img {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  pointer-events: none;
}

/* ---------- APP / MAIN CONTAINER ---------- */
.app, .main { position: relative; z-index: 2; }

/* ---------- SETTINGS VIEW (mirrors conv layout) ---------- */
html[data-view="settings"] .main,
html[data-view="editProfile"] .main {
  width: 60vw;
  max-width: 1000px;
  height: 80vh;
  max-height: 800px;
  min-height: 380px;
  overflow: hidden;
  box-shadow: 0 5px 30px rgba(0,0,0,.2);
  background: rgba(0,0,0,.5);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  animation: fadeIn 0.5s forwards;
}
html[data-view="settings"] .main #content,
html[data-view="editProfile"] .main #content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}
html[data-view="settings"] .settings-scroll,
html[data-view="editProfile"] .settings-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  -ms-touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) rgba(0,0,0,0.12);
  padding: 18px;
}
html[data-view="settings"] .settings-scroll::-webkit-scrollbar,
html[data-view="editProfile"] .settings-scroll::-webkit-scrollbar { width: 9px; }
html[data-view="settings"] .settings-scroll::-webkit-scrollbar-track,
html[data-view="editProfile"] .settings-scroll::-webkit-scrollbar-track { background: rgba(0,0,0,0.08); border-radius: 8px; }
html[data-view="settings"] .settings-scroll::-webkit-scrollbar-thumb,
html[data-view="editProfile"] .settings-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 8px; border: 2px solid rgba(0,0,0,0.08); }
html[data-view="settings"] .settings-scroll::-webkit-scrollbar-thumb:hover,
html[data-view="editProfile"] .settings-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); }

/* Settings sections */
.settings-section {
  margin-bottom: 22px;
}
.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.9);
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Profile row */
.settings-profile-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.settings-image-col {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.settings-image-wrap {
  position: relative;
  width: 240px;
  height: 240px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}
.settings-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.settings-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  color: rgba(255,255,255,0.35);
}
.settings-image-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.settings-image-actions a,
.settings-image-actions label {
  font-size: 12px;
  color: rgba(176,140,255,0.95);
  text-decoration: none;
  cursor: pointer;
}
.settings-image-actions a:hover,
.settings-image-actions label:hover {
  text-decoration: underline;
}
.settings-image-actions input[type="file"] {
  display: none;
}

/* Form column */
.settings-form-col {
  flex: 1 1 auto;
  min-width: 0;
}
.settings-form-col .form {
  margin-bottom: 10px;
}
.settings-form-col .form:last-child {
  margin-bottom: 0;
}

/* Design controls */
.settings-design-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-color-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-color-wrap input[type="color"] {
  width: 40px;
  height: 32px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.settings-color-wrap input[type="text"] {
  width: 90px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.settings-typing-group {
  display: inline-flex;
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.settings-typing-group label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.settings-typing-group label:hover {
  background: rgba(50,100,254,0.10);
}
.settings-typing-group input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 0;
  height: 0;
  position: absolute;
  opacity: 0;
}
.settings-typing-group input[type="radio"]:checked + label,
.settings-typing-group label:has(input[type="radio"]:checked) {
  background: rgba(50,100,254,0.22);
  color: #eaf0ff;
  font-weight: 600;
}

/* Settings bottom actions */
.settings-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 18px;
  background: linear-gradient(180deg,rgba(0,0,0,0.36),rgba(0,0,0,0.56));
  border-top: 1px solid rgba(255,255,255,0.06);
}
.settings-actions .btn {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 10px;
  line-height: 1;
}
.settings-actions .btn.primary {
  text-transform: uppercase;
}

/* Theme select */
.settings-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.settings-select:focus {
  border-color: rgba(80,140,255,0.28);
}
.settings-select option {
  background: #1a1f33 !important;
  color: #eaf0ff !important;
}

/* Mobile stacking for settings */
@media (max-width: 600px) {
  html[data-view="settings"] .main,
  html[data-view="editProfile"] .main {
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100%; height: 100%; max-height: none;
    border-radius: 0; box-shadow: none; overflow: hidden;
    animation: fadeIn 0.5s forwards;
    opacity: 1;
  }
  html[data-view="settings"] .settings-profile-row,
  html[data-view="editProfile"] .settings-profile-row {
    flex-direction: column;
    align-items: stretch;
  }
  html[data-view="settings"] .settings-image-col,
  html[data-view="editProfile"] .settings-image-col {
    align-items: center;
    margin-bottom: 10px;
  }
  html[data-view="settings"] .header {
    padding-right: 44px;
  }
}
.app {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px;
  box-sizing: border-box;
}

/* --- Login/Signup/About main box --- */
html[data-view="login"] .main,
html[data-view="signup"] .main,
html[data-view="about"] .main {
  width: 320px;
  min-width: 320px;
  min-height: 380px;
  background: linear-gradient(180deg,rgba(10,14,28,0.55),rgba(8,10,20,0.6));
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 14px 40px rgba(3,8,20,0.6);
  color: #eaf0ff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: auto;
  max-height: none;
  animation: fadeIn 0.5s forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0);}
  to   { opacity: 1; transform: scale(1);}
}

/* --- Chat main box --- */
html[data-view="chat"] .main {
  width: 60vw;
  max-width: 1000px;
  height: 80vh;
  max-height: 800px;
  min-height: 380px;
  overflow: hidden;
  box-shadow: 0 5px 30px rgba(0,0,0,.2);
  background: rgba(0,0,0,.5);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  animation: zoomIn 0.3s forwards, fadeIn 0.5s forwards;
}
@keyframes zoomIn {
  from { width: 320px; }
  to   { width: 60vw; }
}

/* ---------- CHAT CONTENT AREA ---------- */
html[data-view="chat"] .main #content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

/* ---------- HEADER (all views) ---------- */
.header {
  flex: 0 1 auto;
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg,rgba(0,0,0,0.56),rgba(0,0,0,0.36));
  color: #fff;
  text-align: left;
  padding: 14px 18px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
html[data-view="chat"] .header::before,
html[data-view="chat"] .footer::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.32;
  display: none;
}
html[data-view="chat"] .header::before {
  border-radius: 16px 16px 0 0;
}
html[data-view="chat"].partner-header-rainbow .header::before {
  display: block;
  background: linear-gradient(45deg, blue, magenta, orange, red, yellow, lime, cyan);
  background-size: 400% 400%;
  animation: shift 5s linear infinite;
}
html[data-view="chat"].partner-header-color .header::before {
  display: block;
  background: linear-gradient(45deg, var(--partner-color, #FFFFFF), var(--partner-color, #FFFFFF));
  background-size: 400% 400%;
  animation: shift 5s linear infinite;
}
html[data-view="chat"] .header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 1px);
  height: 50px;
  pointer-events: none;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1;
  -webkit-mask-image: linear-gradient(to bottom, black 0%, rgba(0,0,0,0.6) 30%, rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(to bottom, black 0%, rgba(0,0,0,0.6) 30%, rgba(0,0,0,0) 100%);
}
html[data-view="chat"] .footer {
  position: relative;
  z-index: 1;
}
html[data-view="chat"] .footer::before {
  border-radius: 0 0 16px 16px;
}
html[data-view="chat"].partner-footer-rainbow .footer::before {
  display: block;
  background: linear-gradient(45deg, orange, red,  magenta, blue, cyan, lime, yellow);
  background-size: 400% 400%;
  animation: shift 5s linear infinite;
}
html[data-view="chat"].partner-footer-color .footer::before {
  display: block;
  background: linear-gradient(45deg, var(--partner-color, #FFFFFF), var(--partner-color, #FFFFFF));
  background-size: 400% 400%;
  animation: shift 5s linear infinite;
}
.title {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #fff;
}
.sub {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin-top: 6px;
}

/* ---------- LANGUAGE MENU (login/signup) ---------- */
.lang-menu { position: absolute; top: 10px; right: 10px; z-index: 3; }
html[data-view="chat"] .lang-menu,
html[data-view="messages"] .lang-menu,
html[data-view="settings"] .lang-menu,
html[data-view="editProfile"] .lang-menu,
html[data-view="userProfile"] .lang-menu,
html[data-view="contacts"] .lang-menu { display: none !important; }
.lang-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; margin: 0;
  background: linear-gradient(180deg,rgba(255,255,255,.03),rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.06); border-radius: 50%; cursor: pointer;
  font-size: 18px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.04);
  transition: all .14s ease;
}
.lang-btn:hover {
  background: linear-gradient(180deg,rgba(50,100,254,.14),rgba(50,100,254,.08));
  border-color: rgba(80,140,255,.24); transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37,83,222,.16);
}
.lang-btn:active { transform: scale(.96); }
.lang-dropdown {
  position: absolute; top: 38px; right: 0; min-width: 170px;
  max-height: 276px; padding: 6px 6px 10px; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: linear-gradient(180deg,rgba(10,14,28,.72),rgba(8,10,20,.78));
  border: 1px solid rgba(255,255,255,.05); border-radius: 14px;
  backdrop-filter: blur(2px) saturate(140%); -webkit-backdrop-filter: blur(2px) saturate(140%);
  box-shadow: 0 12px 40px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.03);
  display: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) rgba(0,0,0,.12);
}
.lang-dropdown.open { display: block; animation: langFade .14s ease; }
.lang-dropdown button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: rgba(255,255,255,.88);
  cursor: pointer; font-size: 13px; font-weight: 600; letter-spacing: .01em;
  transition: all .12s ease;
}
.lang-dropdown button:hover { background: rgba(50,100,254,.12); color: #fff; transform: translateX(2px); }
.lang-dropdown button:active { transform: scale(.98); }
.lang-dropdown::-webkit-scrollbar { width: 9px; }
.lang-dropdown::-webkit-scrollbar-track { background: rgba(0,0,0,.08); border-radius: 8px; }
.lang-dropdown::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 8px; border: 2px solid rgba(0,0,0,.08); }
.lang-dropdown::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }
@keyframes langFade {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shift {
  from { filter: hue-rotate(0deg); }
  to   { filter: hue-rotate(360deg); }
}

/* ---------- HEADER BUTTONS (chat/conv view) ---------- */
html[data-view="chat"] .app-menu,
html[data-view="messages"] .app-menu,
html[data-view="settings"] .app-menu,
html[data-view="editProfile"] .app-menu,
html[data-view="userProfile"] .app-menu,
html[data-view="contacts"] .app-menu {
  display: inline-flex !important;
}

/* ---------- LOGIN / SIGNUP FORM STYLES ---------- */
html[data-view="login"] .main #content,
html[data-view="signup"] .main #content,
html[data-view="about"] .main #content { padding: 18px; }
html[data-view="about"] .main #content {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.form { display: block; padding: 0 0 14px; }
.form-label { display: block; font-size: 12px; color: rgba(255,255,255,0.66); margin-bottom: 6px; }
.form input[type="text"],
.form input[type="password"],
.form input[type="email"] {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.04);
  background: rgba(255,255,255,0.02); color: #f7fbff; font-size: 14px;
  outline: none; box-sizing: border-box;
  transition: box-shadow .12s, border-color .12s;
}
.form input:focus { border-color: rgba(80,140,255,0.28); box-shadow: 0 8px 26px rgba(50,100,254,0.06); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; }
.opts .chk { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,0.8); font-size: 13px; }
.opts input[type="checkbox"] { width: 14px; height: 14px; }
.forgot { color: rgba(176,140,255,0.95); text-decoration: none; font-size: 13px; }
.forgot:hover { text-decoration: underline; }
.actions { display: flex; gap: 8px; justify-content: flex-end; padding: 18px 0 0; }

.error {
  margin-top: 0;
  background: rgba(186,0,24,0.36);
  color: #fff;
  padding: 18px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px; border-radius: 12px; cursor: pointer;
  text-decoration: none; font-weight: 700; font-size: 13px; box-sizing: border-box;
}
.btn.ghost {
  background: rgba(255,255,255,0.02); color: rgba(235,246,255,0.95);
  border: 1px solid rgba(255,255,255,0.04); font-weight: 600; padding: 10px 12px;
}
.btn.primary {
  background: #fbaa01; color: #111; border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 8px 22px rgba(250,170,1,0.10);
  transition: background .12s, transform .06s, color .12s;
}
.btn.primary:hover { background: #3264fe; color: #fff; transform: translateY(-1px); }

.about-btn {
  position: absolute; bottom: 8px; right: 8px;
  z-index: 10;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; margin: 0;
  background: linear-gradient(180deg,rgba(255,255,255,.03),rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.06); border-radius: 50%; cursor: pointer;
  color: rgba(255,255,255,.72); font-size: 13px; line-height: 1;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.04);
  transition: all .14s ease;
}
.about-btn:hover {
  background: linear-gradient(180deg,rgba(50,100,254,.14),rgba(50,100,254,.08));
  border-color: rgba(80,140,255,.24); color: #fff; transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37,83,222,.16);
}
.about-btn:focus {
  outline: none; border-color: rgba(80,140,255,.34); color: #fff;
  box-shadow: 0 0 0 3px rgba(50,100,254,.12), 0 8px 24px rgba(37,83,222,.16);
}
.about-btn:active { transform: scale(.96); }

/* ---------- FOOTER (all views) ---------- */
.footer {
  background: linear-gradient(180deg,rgba(0,0,0,0.36),rgba(0,0,0,0.56));
  padding: 12px 18px;
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  position: relative;
  text-align: left;
}
html[data-view="messages"] .footer,
html[data-view="contacts"] .footer { padding: 4px 6px; }
html[data-view="settings"] .footer,
html[data-view="editProfile"] .footer { display: none !important; }

/* ---------- NAV FOOTER (contacts/messages views) ---------- */
.nav-footer {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 2px 0;
  max-width: 460px;
  margin: 0 auto; /* center horizontally */
}
.nav-footer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 4px;
  margin: 0px 2px;

  text-decoration: none;
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  border-radius: 8px;
  transition: all .14s ease;
  flex: 1;
}
.nav-footer-item.active {
  color: #fbaa01;
  background: rgba(1, 59, 251, 0.08);
}
.nav-footer-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}
.nav-footer-icon {
  font-size: 20px;
  line-height: 1;
}
.nav-footer-label {
  font-weight: 600;
  letter-spacing: 0.02em;
}

#chatForm {
  display: flex;
  width: 100%;
  gap: 8px;
  align-items: center;
}
#chatForm .input {
  background: none; border: none; outline: none !important;
  resize: none; color: rgba(255,255,255,.9); font-size: 16px;
  margin: 0; padding: 6px 10px; width: 100%;
  border-radius: 8px; background: rgba(255,255,255,0.05);
}
#chatForm .submit {
  color: #fff; border: none; background: #fbaa01;
  font-size: 12px; text-transform: uppercase; line-height: 1;
  padding: 8px 12px; border-radius: 10px; cursor: pointer;
}
#chatForm .submit:hover { background: #3264fe; }

html[data-view="chat"] .messages {
  flex: 1 1 auto;
  color: rgba(255,255,255,.9);
  overflow: auto;
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  -ms-touch-action: pan-y;
  cursor: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) rgba(0,0,0,0.12);
}
html[data-view="chat"] .messages::-webkit-scrollbar { width: 9px; }
html[data-view="chat"] .messages::-webkit-scrollbar-track { background: rgba(0,0,0,0.08); border-radius: 8px; }
html[data-view="chat"] .messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 8px; border: 2px solid rgba(0,0,0,0.08); }
html[data-view="chat"] .messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); }

html[data-view="chat"] .messages-content {
  box-sizing: border-box;
  width: 100%;
  word-break: break-word;
  padding: 12px;
  padding-bottom: 3px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: "Open Sans", sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 10px;
}

html[data-view="chat"] .message {
  max-width: 70%;
  padding: 5px 14px;
  margin: 6px 0;
  font-size: 16px;
  line-height: 1.2;
  border-radius: 12px;
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  animation: bounce 200ms ease;
}
html[data-view="chat"] .message:not(.message-personal) {
  align-self: flex-start;
  border-radius: 12px 12px 12px 0;
  background: rgba(0, 0, 0, 0.25);
}


    html[data-view="chat"] .message.message-personal::before{
      content:"";position:absolute;inset:0;
        border-radius: 12px 12px 0 12px;

      background:linear-gradient(45deg,lime,cyan,blue,magenta, red,orange,yellow);
      background-size:400% 400%;animation:shift 5s linear infinite;z-index:-1;
          opacity: 0.5;
    }


html[data-view="chat"] .message.message-personal {
  align-self: flex-end;
  border-radius: 12px 12px 0 12px;
        	box-shadow:
				0 0 0 0.0625em hsl(233,90%,70%,0.3) inset,
				0 0 0.25em 0.25em hsla(233,90%,70%,0.3) inset;
  
}
html[data-view="chat"] .message.typing {
  opacity: 0.7;
  font-style: italic;
  background: rgba(255,255,255,0.08);
  min-height: 28px;
  display: flex;
  align-items: center;
  animation: fadePulse 1.5s infinite;
}

/* Blinking cursor at the end of the typing text */
html[data-view="chat"] .message.typing .typing-text::after {
  content: "|";
  animation: blink 1s step-end infinite;
  margin-left: 1px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
html[data-view="chat"] .message.new {
  transform-origin: bottom;
  animation: slideBounce 400ms ease-out both;
  animation-timing-function: cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes fadePulse {
  0% { opacity: 0.4; }
  50% { opacity: 0.8; }
  100% { opacity: 0.4; }
}

/* Emoji sizing in messages */
html[data-view="chat"] .message .emoji-only {
  font-size: 44px;
  line-height: 1.3;
}

html[data-view="chat"] .message .emoji-inline {
  font-size: 20px;
}
@keyframes slideBounce {
  0% { transform: translateY(20px) scale(0.6); opacity: 0; }
  60% { transform: translateY(-5px) scale(1.05); opacity: 1; }
  80% { transform: translateY(2px) scale(0.98); }
  100% { transform: translateY(0) scale(1); }
}

.last-chat { font-size: 11px; color: rgba(255,255,255,0.5); padding-left: 12px; padding-bottom: 8px; }

/* conv view only — match chat sizing/layout */
html[data-view="messages"] .main {
  width: 60vw;
  max-width: 1000px;
  height: 80vh;
  max-height: 800px;
  min-height: 380px;
  overflow: hidden;
  box-shadow: 0 5px 30px rgba(0,0,0,.2);
  background: rgba(0,0,0,.5);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  animation: fadeIn 0.5s forwards;
}

html[data-view="messages"] .main[style*="opacity:0"] {
  animation: fadeIn 0.5s forwards;
}

@media (max-width: 600px) {
  html, body { overflow-x: hidden; }
  html[data-view="chat"] .main,
  html[data-view="messages"] .main {
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100%; height: 100%; max-height: none;
    border-radius: 0; box-shadow: none; overflow: hidden;
    animation: fadeIn 0.5s forwards;
    opacity: 1;
  }
html[data-view="chat"] .messages,
html[data-view="messages"] .messages { min-height: 300px; overflow: auto; -webkit-overflow-scrolling: touch; }
  html[data-view="chat"] .header,
  html[data-view="messages"] .header,
  html[data-view="settings"] .header,
  html[data-view="editProfile"] .header { padding-right: 44px; }
  html[data-view="chat"] .header::before { border-radius: 0; }
  html[data-view="chat"] .footer::before { border-radius: 0; }
}
@media (max-width: 460px) {
  .app { width: 90%; }
  html[data-view="login"] .main,
  html[data-view="signup"] .main,
  html[data-view="about"] .main { border-radius: 12px; }
  html[data-view="login"] .actions,
  html[data-view="signup"] .actions { flex-direction: column-reverse; gap: 8px; align-items: stretch; }
  html[data-view="login"] .btn.ghost,
  html[data-view="login"] .btn.primary,
  html[data-view="signup"] .btn.ghost,
  html[data-view="signup"] .btn.primary { width: 100%; }
}

html[data-view="messages"] .main #content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

/* reuse same message container behavior as chat */
html[data-view="messages"] .messages {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;

  padding: 6px 10px;

  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) rgba(0,0,0,0.12);
}

html[data-view="messages"] .messages::-webkit-scrollbar {
  width: 9px;
}

html[data-view="messages"] .messages::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.08);
}

html[data-view="messages"] .messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 8px;
}

/* conversation items */
html[data-view="messages"] .conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 3px 12px;
  margin: 5px 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.12s ease, transform 0.06s ease;
}

html[data-view="messages"] .conv-item:hover {
  background: rgba(50,100,254,0.12);
}

html[data-view="messages"] .conv-avatar-wrap {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

html[data-view="messages"] .conv-avatar-wrap.online {
  box-shadow: 0 0 0 2px var(--user-color);
}

html[data-view="messages"] .conv-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

html[data-view="messages"] .conv-avatar-inner {
  font-size: 26px;
  color: rgba(255,255,255,0.35);
  line-height: 1;
}

html[data-view="messages"] .conv-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

html[data-view="messages"] .conv-name {
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-view="messages"] .conv-meta {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  justify-content: center;
}

html[data-view="messages"] .conv-preview {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

html[data-view="messages"] .conv-time {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
}

html[data-view="messages"] .conv-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
}
/* ---------- APP MENU (hamburger) ---------- */
.app-menu {
  display: none !important;
  position: absolute;
  top: 12px;
  right: 15px;
  z-index: 3;
}
.header-icon {
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  line-height: 1;
  width: 36px;
  flex: 0 0 auto;
}
.header-titles {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
}
.app-menu-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  gap: 5px;
}
.app-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,.72);
  border-radius: 1px;
}
.app-menu-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 170px;
  max-height: 276px; padding: 6px 6px 10px;
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: linear-gradient(180deg,rgba(10,14,28,.72),rgba(8,10,20,.78));
  border: 1px solid rgba(255,255,255,.05); border-radius: 14px;
  backdrop-filter: blur(2px) saturate(140%); -webkit-backdrop-filter: blur(2px) saturate(140%);
  box-shadow: 0 12px 40px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.03);
  display: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) rgba(0,0,0,.12);
}
.app-menu-dropdown.open { display: block; animation: langFade .14s ease; }
.app-menu-dropdown::-webkit-scrollbar { width: 9px; }
.app-menu-dropdown::-webkit-scrollbar-track { background: rgba(0,0,0,.08); border-radius: 8px; }
.app-menu-dropdown::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 8px; border: 2px solid rgba(0,0,0,.08); }
.app-menu-dropdown::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }
.app-menu-dropdown button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: rgba(255,255,255,.88);
  cursor: pointer; font-size: 13px; font-weight: 600; letter-spacing: .01em;
  transition: all .12s ease;
}
.app-menu-dropdown button:hover { background: rgba(50,100,254,.12); color: #fff; transform: translateX(2px); }
.app-menu-dropdown button:active { transform: scale(.98); }
.menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  font-size: 16px;
  line-height: 1;
  flex: 0 0 auto;
}
.menu-label {
  flex: 1 1 auto;
  text-align: left;
}

/* Chat view header padding override */
html[data-view="chat"] .header {
  padding: 8px 12px 8px;
}
html[data-view="chat"] .header-icon,
html[data-view="login"] .header-icon,
html[data-view="signup"] .header-icon,
html[data-view="about"] .header-icon {
  display: none !important;
}

/* ---------- CHAT PARTNER HEADER ---------- */
.chat-partner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
}
.chat-partner-avatar-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  flex: 0 0 42px;
}
.chat-partner-avatar-wrap.online {
  box-shadow: 0 0 0 2px var(--user-color);
}
.chat-partner-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-partner-placeholder {
  font-size: 20px;
  color: rgba(255,255,255,0.35);
  line-height: 1;
}
.chat-partner-text {
  display: flex;
 flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  min-width: 0;
}
.chat-partner-name {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  order: 1;
}
.chat-partner-email {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  order: 2;
}
.chat-partner-status {
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  flex-basis: 100%;
  order: 3;
}
/* ---------- FOOTER CHAT MENU (gear + dropdown) ---------- */
.chat-menu-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}
#chatForm .btn-gear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; margin: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,.08); border-radius: 50%; cursor: pointer;
  color: rgba(255,255,255,.72); font-size: 16px; line-height: 1;
  box-shadow: 0 4px 16px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.04);
  transition: all .14s ease;
}
#chatForm .btn-gear:hover {
  background: linear-gradient(180deg,rgba(50,100,254,.14),rgba(50,100,254,.08));
  border-color: rgba(80,140,255,.24); color: #fff; transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37,83,222,.16);
}
#chatForm .btn-gear:active { transform: scale(.96); }

.chat-menu-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 170px;
  max-height: 276px;
  padding: 6px 6px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: linear-gradient(180deg,rgba(10,14,28,.72),rgba(8,10,20,.78));
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 14px;
  backdrop-filter: blur(2px) saturate(140%);
  -webkit-backdrop-filter: blur(2px) saturate(140%);
  box-shadow: 0 12px 40px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.03);
  display: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) rgba(0,0,0,.12);
  z-index: 10;
}
.chat-menu-dropdown.open { display: block; animation: langFade .14s ease; }
.chat-menu-dropdown button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: rgba(255,255,255,.88);
  cursor: pointer; font-size: 13px; font-weight: 600; letter-spacing: .01em;
  transition: all .12s ease;
}
.chat-menu-dropdown button:hover { background: rgba(50,100,254,.12); color: #fff; transform: translateX(2px); }
.chat-menu-dropdown button:active { transform: scale(.98); }
.chat-menu-dropdown::-webkit-scrollbar { width: 9px; }
.chat-menu-dropdown::-webkit-scrollbar-track { background: rgba(0,0,0,.08); border-radius: 8px; }
.chat-menu-dropdown::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 8px; border: 2px solid rgba(0,0,0,.08); }
.chat-menu-dropdown::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

/* ---------- FOOTER EMOJI BUTTON ---------- */
#chatForm .btn-emoji {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; margin: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,.08); border-radius: 50%; cursor: pointer;
  color: rgba(255,255,255,.72); font-size: 16px; line-height: 1;
  box-shadow: 0 4px 16px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.04);
  transition: all .14s ease;
  flex: 0 0 auto;
}
#chatForm .btn-emoji:hover {
  background: linear-gradient(180deg,rgba(50,100,254,.14),rgba(50,100,254,.08));
  border-color: rgba(80,140,255,.24); color: #fff; transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37,83,222,.16);
}
#chatForm .btn-emoji:active { transform: scale(.96); }

/* ---------- FOOTER ATTACH BUTTON ---------- */
#chatForm .btn-attach {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; margin: 0;
  background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,.08); border-radius: 50%; cursor: pointer;
  color: rgba(255,255,255,.72); font-size: 16px; line-height: 1;
  box-shadow: 0 4px 16px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.04);
  transition: all .14s ease;
  flex: 0 0 auto;
}
#chatForm .btn-attach:hover {
  background: linear-gradient(180deg,rgba(50,100,254,.14),rgba(50,100,254,.08));
  border-color: rgba(80,140,255,.24); color: #fff; transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37,83,222,.16);
}
#chatForm .btn-attach:active { transform: scale(.96); }

/* ---------- MESSAGE ATTACHMENTS ---------- */
.message-attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  max-width: 100%;
}
.message-attachment.image {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0,0,0,0.2);
}
.message-attachment.image img {
  max-width: 200px;
  max-height: 150px;
  width: auto;
  height: auto;
  display: block;
  border-radius: 10px;
  object-fit: cover;
}
.message-attachment.file {
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  transition: background .12s;
}
.message-attachment.file:hover {
  background: rgba(50,100,254,0.12);
}
.message-attachment .file-icon {
  font-size: 20px;
  line-height: 1;
  flex: 0 0 auto;
}
.message-attachment .file-name {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  word-break: break-all;
  line-height: 1.3;
}

/* ============================================================
   NEW VIEW STYLES: userProfile + contacts
   ============================================================ */

/* Re-use settings/profile layout for userProfile and contacts */
html[data-view="userProfile"] .main,
html[data-view="contacts"] .main {
  width: 60vw;
  max-width: 1000px;
  height: 80vh;
  max-height: 800px;
  min-height: 380px;
  overflow: hidden;
  box-shadow: 0 5px 30px rgba(0,0,0,.2);
  background: rgba(0,0,0,.5);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  animation: fadeIn 0.5s forwards;
}
html[data-view="userProfile"] .main #content,
html[data-view="contacts"] .main #content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

/* Scroll area */
html[data-view="userProfile"] .settings-scroll,
html[data-view="contacts"] .settings-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  -ms-touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) rgba(0,0,0,0.12);
  padding: 18px;
}

/* Webkit scrollbars for new views */
html[data-view="userProfile"] .settings-scroll::-webkit-scrollbar,
html[data-view="contacts"] .settings-scroll::-webkit-scrollbar { width: 9px; }
html[data-view="userProfile"] .settings-scroll::-webkit-scrollbar-track,
html[data-view="contacts"] .settings-scroll::-webkit-scrollbar-track { background: rgba(0,0,0,0.08); border-radius: 8px; }
html[data-view="userProfile"] .settings-scroll::-webkit-scrollbar-thumb,
html[data-view="contacts"] .settings-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 8px; border: 2px solid rgba(0,0,0,0.08); }
html[data-view="userProfile"] .settings-scroll::-webkit-scrollbar-thumb:hover,
html[data-view="contacts"] .settings-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); }

/* Hide lang-menu, show header buttons, hide about btn, hide footer on new views */
html[data-view="userProfile"] .lang-menu,
html[data-view="contacts"] .lang-menu { display: none !important; }
html[data-view="userProfile"] .footer { display: none !important; }
html[data-view="contacts"] .footer { display: block; }

/* Clickable chat partner header */
.chat-partner-info,
.chat-partner-avatar-wrap,
.chat-partner-name,
.chat-partner-email { cursor: pointer; }

/* Mobile: stack image above form in userProfile */
@media (max-width: 600px) {
  html[data-view="userProfile"] .main,
  html[data-view="contacts"] .main {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  html[data-view="userProfile"] .settings-profile-row,
  html[data-view="contacts"] .settings-profile-row { flex-direction: column; }
  html[data-view="userProfile"] .settings-image-col,
  html[data-view="contacts"] .settings-image-col { align-items: center; }
  html[data-view="userProfile"] .header,
  html[data-view="contacts"] .header { padding-right: 44px; }
}

/* ---------- CONTACTS LIST VIEW ---------- */
html[data-view="contacts"] .messages {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) rgba(0,0,0,0.12);
}
html[data-view="contacts"] .messages::-webkit-scrollbar { width: 9px; }
html[data-view="contacts"] .messages::-webkit-scrollbar-track { background: rgba(0,0,0,0.08); }
html[data-view="contacts"] .messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 8px; }

/* Re-use conv-item styling in contacts view */
html[data-view="contacts"] .conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 3px 12px;
  margin: 5px 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.12s ease, transform 0.06s ease;
}
html[data-view="contacts"] .conv-item:hover {
  background: rgba(50,100,254,0.12);
}
html[data-view="contacts"] .conv-avatar-wrap {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
html[data-view="contacts"] .conv-avatar-wrap.online {
  box-shadow: 0 0 0 2px var(--user-color);
}
html[data-view="contacts"] .conv-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
html[data-view="contacts"] .conv-avatar-inner {
  font-size: 26px;
  color: rgba(255,255,255,0.35);
  line-height: 1;
}
html[data-view="contacts"] .conv-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}
html[data-view="contacts"] .conv-name {
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-view="contacts"] .conv-meta {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  justify-content: center;
}
html[data-view="contacts"] .conv-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
}

/* ---------- EMOJI PICKER ---------- */
.emoji-picker {
  display: none;
  max-height: 20vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  margin: 5px 0px 0px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) rgba(0,0,0,.12);
}
.emoji-picker.open { display: block; animation: emojiFade .14s ease; }
@keyframes emojiFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.emoji-picker::-webkit-scrollbar { width: 9px; }
.emoji-picker::-webkit-scrollbar-track { background: rgba(0,0,0,.08); border-radius: 8px; }
.emoji-picker::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 8px; border: 2px solid rgba(0,0,0,.08); }
.emoji-picker::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

.emoji-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
  margin: 10px 0 6px;
  top: 0;
  z-index: 2;
}
.emoji-section-title:first-child { margin-top: 0; }

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 2px;
}

.emoji-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  transition: background .10s, transform .06s;
  user-select: none;
  -webkit-user-select: none;
}
.emoji-btn:hover {
  background: rgba(50,100,254,.14);
  transform: scale(1.12);
}
.emoji-btn:active {
  transform: scale(.92);
}
