:root {
  --bg: #090b12;
  --panel: rgba(13, 16, 28, 0.82);
  --panel-2: rgba(23, 27, 45, 0.86);
  --line: rgba(255,255,255,.09);
  --text: #f7f8ff;
  --muted: #9ca4ba;
  --primary: #7c5cff;
  --primary-2: #a855f7;
  --success: #36d399;
  --danger: #ff5c7a;
  --shadow: 0 30px 90px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  min-height: 100vh;
  overflow: hidden;
}

button, textarea, input { font: inherit; }

button { cursor: pointer; }

.bg-slider {
  position: fixed;
  inset: 0;
  background-position: center;
  background-size: cover;
  transform: scale(1.03);
  transition: opacity 900ms ease, background-image 900ms ease;
  z-index: 0;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 15% 15%, rgba(124,92,255,.25), transparent 35%),
    linear-gradient(115deg, rgba(5,7,12,.94), rgba(7,9,17,.74) 50%, rgba(9,11,18,.88));
  backdrop-filter: blur(1px);
}

.page-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.hidden { display: none !important; }

.login-card {
  width: min(480px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(18,21,35,.9), rgba(11,13,24,.86));
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 32px rgba(124,92,255,.33);
}

.brand h1 {
  margin: 0;
  font-size: 21px;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.hero-copy { margin: 54px 0 32px; }

.badge {
  display: inline-flex;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  border: 1px solid rgba(124,92,255,.35);
  background: rgba(124,92,255,.12);
  color: #c8bbff;
}

.hero-copy h2 {
  font-size: clamp(31px, 5vw, 48px);
  line-height: 1.02;
  letter-spacing: -.04em;
  margin: 17px 0 16px;
}

.hero-copy p {
  color: #b3b9c9;
  line-height: 1.7;
  margin: 0;
}

.google-btn {
  border: 0;
  width: 100%;
  height: 56px;
  border-radius: 16px;
  background: #fff;
  color: #151821;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: .2s ease;
}

.google-btn:hover { transform: translateY(-2px); }

.google-icon {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3f4f8;
  font-weight: 900;
}

.small-note {
  margin: 18px 5px 0;
  color: #8d94a7;
  font-size: 12px;
  line-height: 1.6;
}

.chat-app {
  width: min(1400px, 100%);
  height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 310px 1fr;
  background: rgba(7,9,15,.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px);
}

.sidebar {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(11,14,25,.78);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.compact .brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.room-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255,255,255,.035);
}

.room-cover {
  height: 88px;
  background:
    linear-gradient(135deg, rgba(124,92,255,.6), rgba(236,72,153,.3)),
    url('https://images.unsplash.com/photo-1524504388940-b1c1722653e1?auto=format&fit=crop&w=900&q=80') center/cover;
}

.room-info {
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(54,211,153,.12);
}

.room-info strong { display: block; font-size: 14px; }
.room-info small { color: var(--muted); font-size: 11px; }

.features {
  display: grid;
  gap: 8px;
  color: #b4bbcd;
  font-size: 13px;
}

.features div {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}

.profile-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.profile-box img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #24283a;
}

.profile-meta {
  min-width: 0;
  flex: 1;
}

.profile-meta strong, .profile-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-meta strong { font-size: 13px; }
.profile-meta small { color: var(--muted); font-size: 10px; margin-top: 3px; }

.icon-btn, .emoji-btn, .attach-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: white;
  transition: .2s ease;
}

.icon-btn:hover, .emoji-btn:hover, .attach-btn:hover {
  background: rgba(255,255,255,.1);
}

.danger { color: var(--danger); }

.chat-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background: rgba(9,11,18,.62);
}

.chat-header {
  padding: 21px 26px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(12,15,25,.72);
}

.chat-header h2 { margin: 0; font-size: 16px; }
.chat-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }

.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: white;
  padding: 9px 13px;
  border-radius: 12px;
  display: none;
}

.messages {
  overflow-y: auto;
  padding: 26px;
  scroll-behavior: smooth;
}

.welcome-card {
  max-width: 630px;
  margin: 0 auto 26px;
  padding: 16px;
  display: flex;
  gap: 13px;
  border: 1px solid rgba(124,92,255,.18);
  border-radius: 16px;
  background: rgba(124,92,255,.08);
}

.welcome-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(124,92,255,.15);
}

.welcome-card strong { font-size: 13px; }
.welcome-card p { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 5px 0 0; }

.message-row {
  display: flex;
  gap: 10px;
  margin: 15px 0;
  align-items: flex-end;
}

.message-row.mine { justify-content: flex-end; }

.message-row.mine .avatar { order: 2; }
.message-row.mine .message-body { align-items: flex-end; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #24283a;
  flex: 0 0 auto;
}

.message-body {
  max-width: min(680px, 76%);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meta {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 0 4px;
}

.meta .name { font-size: 11px; font-weight: 700; }
.meta .time { font-size: 9px; color: #747c91; }

.bubble {
  padding: 11px 13px;
  background: rgba(255,255,255,.065);
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 5px;
  line-height: 1.45;
  font-size: 13px;
  word-break: break-word;
}

.mine .bubble {
  background: linear-gradient(135deg, rgba(124,92,255,.94), rgba(168,85,247,.91));
  border-color: rgba(255,255,255,.07);
  border-radius: 16px 16px 5px 16px;
}

.chat-image {
  width: min(330px, 100%);
  max-height: 380px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  border: 1px solid var(--line);
  cursor: pointer;
}

.upload-preview {
  margin: 0 22px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(18,21,35,.94);
}

.upload-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 11px;
}

.upload-preview div { flex: 1; min-width: 0; }
.upload-preview strong, .upload-preview small { display:block; white-space: nowrap; overflow:hidden; text-overflow:ellipsis; }
.upload-preview strong { font-size: 12px; }
.upload-preview small { color: var(--muted); font-size: 10px; margin-top: 3px; }

.composer-wrap {
  padding: 0 22px 18px;
  position: relative;
}

.composer {
  border: 1px solid var(--line);
  background: rgba(17,20,33,.92);
  border-radius: 18px;
  padding: 8px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.attach-btn { cursor: pointer; font-size: 18px; }
.emoji-btn { font-size: 18px; }

#messageInput {
  flex: 1;
  min-height: 42px;
  max-height: 130px;
  resize: none;
  border: 0;
  outline: 0;
  color: white;
  background: transparent;
  padding: 11px 7px 8px;
  line-height: 1.45;
}

#messageInput::placeholder { color: #697087; }

.send-btn {
  min-width: 94px;
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 13px;
  color: white;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.send-btn:disabled { opacity: .5; cursor: not-allowed; }

.composer-hint {
  color: #6f778b;
  font-size: 9px;
  text-align: right;
  padding: 7px 4px 0;
}

.emoji-panel {
  position: absolute;
  left: 68px;
  bottom: 84px;
  width: 310px;
  max-height: 220px;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(14,17,28,.98);
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
}

.emoji-item {
  border: 0;
  height: 35px;
  border-radius: 9px;
  background: transparent;
  font-size: 20px;
}

.emoji-item:hover { background: rgba(255,255,255,.08); }

.toast {
  position: fixed;
  z-index: 99;
  right: 22px;
  top: 22px;
  padding: 12px 15px;
  border-radius: 13px;
  background: rgba(18,21,34,.98);
  border: 1px solid var(--line);
  color: white;
  font-size: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: .25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .page-shell { padding: 0; }
  .chat-app {
    height: 100vh;
    width: 100%;
    border-radius: 0;
    grid-template-columns: 1fr;
    border: 0;
  }
  .sidebar { display: none; }
  .ghost-btn { display: block; }
  .chat-header { padding: 17px; }
  .messages { padding: 17px; }
  .composer-wrap { padding: 0 12px 12px; }
  .composer-hint { display:none; }
  .message-body { max-width: 84%; }
}

@media (max-width: 520px) {
  .login-card {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(8,10,18,.8);
  }
  .hero-copy { margin-top: 42px; }
  .send-btn { min-width: 48px; width: 48px; font-size: 0; }
  .send-btn span { font-size: 16px; }
  .emoji-panel { left: 12px; width: calc(100vw - 24px); }
}
