* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #0f1020;
  color: white;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-center {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background:
    radial-gradient(circle at top left, rgba(102,126,234,.45), transparent 35%),
    radial-gradient(circle at bottom right, rgba(118,75,162,.45), transparent 35%),
    #0f1020;
}

.card {
  width: 92%;
  max-width: 430px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  backdrop-filter: blur(14px);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  text-align: center;
}

.card h1 {
  margin-bottom: 8px;
}

.card p {
  color: #c9c9d8;
}

input, textarea, button {
  width: 100%;
  padding: 13px;
  margin: 8px 0;
  border-radius: 14px;
  font-size: 15px;
}

input, textarea {
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1);
  color: white;
  outline: none;
}

input::placeholder, textarea::placeholder {
  color: #bbb;
}

button {
  border: none;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  font-weight: bold;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

.secondary-link {
  color: #9fb2ff;
  font-weight: bold;
}

.topbar {
  height: 72px;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10,10,25,.95);
  border-bottom: 1px solid rgba(255,255,255,.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-weight: 900;
  font-size: 24px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav button, .nav a {
  width: auto;
  padding: 10px 14px;
  margin: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
}

.container {
  max-width: 1150px;
  margin: 0 auto;
  padding: 28px 18px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 28px;
}

.hero-panel {
  background:
    linear-gradient(135deg, rgba(102,126,234,.25), rgba(118,75,162,.25)),
    rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 26px;
  padding: 28px;
}

.hero h1 {
  font-size: 44px;
  margin: 0 0 10px;
}

.hero p {
  color: #c9c9d8;
  line-height: 1.5;
}

.search-row {
  display: flex;
  gap: 10px;
  margin: 18px 0 8px;
}

.search-row input {
  margin: 0;
}

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

.profile-card {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,.2);
}

.profile-card img {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,.2);
  border: 3px solid var(--profile-color, #667eea);
}

.profile-card h3 {
  margin: 10px 0 4px;
}

.muted {
  color: #bfc0d4;
  font-size: 14px;
}

.tags {
  margin: 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 12px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
}

.profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.profile-actions button {
  padding: 10px;
  margin: 0;
}

.profile-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 22px;
}

.panel {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  padding: 22px;
}

.avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,.2);
  border: 4px solid #667eea;
}

.message-page {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - 72px);
}

.conversations {
  border-right: 1px solid rgba(255,255,255,.1);
  overflow-y: auto;
  background: rgba(255,255,255,.04);
}

.conversation {
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
}

.conversation:hover {
  background: rgba(255,255,255,.08);
}

.chat-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
}

#messagesBox {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.msg {
  max-width: 70%;
  background: rgba(255,255,255,.1);
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 12px;
}

.msg.mine {
  margin-left: auto;
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.msg small {
  color: #d0d0df;
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.1);
  background: rgba(10,10,25,.95);
}

#messageInput {
  flex: 1;
  min-width: 0;
}

#imageButton {
  width: 42px;
  height: 42px;

  min-width: 42px;

  border-radius: 12px;

  background: linear-gradient(
    135deg,
    #667eea,
    #764ba2
  );

  color: white;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 24px;
  font-weight: bold;

  cursor: pointer;

  box-shadow:
    0 4px 12px rgba(102,126,234,.4);

  transition: all .2s ease;

  opacity: 1;
  pointer-events: auto;
}

#imageButton:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 18px rgba(102,126,234,.5);
}

#imageButton:active {
  transform: scale(.95);
}

#sendBtn {
  width: auto;
  min-width: 70px;
}
#imagePreviewContainer {
  padding: 10px;
  display: none;
}

#imagePreview {
  max-width: 180px;
  max-height: 180px;

  border-radius: 12px;

  border: 2px solid rgba(255,255,255,.15);

  display: block;
}

#removePreview {
  margin-top: 8px;

  padding: 6px 12px;

  border: none;

  border-radius: 8px;

  background: #ff4d4d;

  color: white;

  cursor: pointer;
}
html, body {
  height: 100%;
  overflow: hidden;
}

.topbar {
  height: 58px;
  flex-shrink: 0;
}

.message-page {
  height: calc(100vh - 58px);
  overflow: hidden;
}

.chat-area {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#messagesBox {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.chat-header,
.chat-input,
#imagePreviewContainer {
  flex-shrink: 0;
}
html, body {
  height: 100dvh;
  overflow: hidden;
}

.message-page {
  height: calc(100dvh - 58px);
  overflow: hidden;
}

.chat-area {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#messagesBox {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 12px;
}

.chat-input {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 20;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: rgba(10,10,25,.98);
}
