:root {
  --bg: #0b1220;
  --bg2: #111b31;
  --surface: rgba(255,255,255,0.06);
  --surface-2: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.12);
  --text: #f5f8ff;
  --muted: #a8b4cc;
  --accent: #ff7a18;
  --accent-2: #ff9a3d;
  --success: #27c67a;
  --warning: #ffcb9e;
  --shadow: 0 16px 40px rgba(0,0,0,0.30);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: "Inter", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255,122,24,0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(88,156,255,0.18), transparent 26%),
    linear-gradient(145deg, var(--bg), var(--bg2));
}

button, input, textarea {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 30px 18px 48px;
}

.ambient {
  position: absolute;
  inset: auto;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.35;
  pointer-events: none;
}

.ambient-1 {
  width: 260px;
  height: 260px;
  background: rgba(255,122,24,0.28);
  top: 40px;
  left: -60px;
}

.ambient-2 {
  width: 300px;
  height: 300px;
  background: rgba(64,156,255,0.22);
  bottom: -70px;
  right: -40px;
}

.hero,
.messenger-shell {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
}

.hero {
  background: linear-gradient(160deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 22px 22px 24px;
}

.hero-topbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 18px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  font-weight: 700;
  transition: 0.18s ease;
}

.back-button:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.12);
}

.hero-brand {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: center;
}

.hero-logo {
  width: 110px;
  height: 110px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.25));
}

.eyebrow {
  margin: 0 0 8px;
  font-family: "Orbitron", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffbc84;
}

.eyebrow.compact {
  font-size: 0.72rem;
  margin-bottom: 6px;
}

.hero-copy h1 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0.04em;
}

.hero-subhead {
  margin: 12px 0 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hero-stats {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
}

.stat-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #ffbc84;
  margin-bottom: 7px;
}

.messenger-shell {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar,
.chat-panel {
  background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.sidebar {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card,
.chat-header,
.composer-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 14px 28px rgba(0,0,0,0.18);
}

.panel-card {
  padding: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-title,
.chat-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
}

.field-stack,
.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  font-weight: 700;
  color: #dbe5f7;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(8,16,30,0.62);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 15px;
  outline: none;
  transition: 0.18s ease;
}

input::placeholder,
textarea::placeholder {
  color: #8392ab;
}

input:focus,
textarea:focus {
  border-color: rgba(255,122,24,0.55);
  box-shadow: 0 0 0 4px rgba(255,122,24,0.12);
}

.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.channel-button {
  appearance: none;
  border-radius: 14px;
  padding: 13px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.18s ease;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #09111d;
}

.secondary-button {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.09);
  color: var(--text);
}

.primary-button:hover,
.secondary-button:hover,
.channel-button:hover,
.contact-button:hover {
  transform: translateY(-1px);
}

.support-copy,
.chat-copy,
.composer-note,
.meta-line,
.auth-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.status-pill,
.header-pill,
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
}

.status-pill {
  padding: 10px 14px;
  background: rgba(255,122,24,0.14);
  border: 1px solid rgba(255,122,24,0.24);
  color: #ffcb9e;
}

.status-pill.success {
  background: rgba(39,198,122,0.14);
  border-color: rgba(39,198,122,0.25);
  color: #b7f5d3;
}

.count-badge,
.header-pill {
  padding: 10px 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  color: #dce7fb;
}

.channel-list,
.contact-list {
  display: grid;
  gap: 10px;
}

.channel-button,
.contact-button {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.channel-button.active,
.contact-button.active {
  background: linear-gradient(135deg, rgba(255,122,24,0.18), rgba(255,154,61,0.12));
  border-color: rgba(255,122,24,0.32);
}

.channel-title,
.contact-name {
  display: block;
  font-weight: 800;
}

.channel-copy,
.contact-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.contact-button {
  padding: 14px 15px;
  border-radius: 18px;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.online-indicator {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 14px rgba(39,198,122,0.75);
}

.note-card {
  border-style: dashed;
}

.chat-panel {
  min-height: 760px;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
}

.chat-header,
.composer-card {
  padding: 16px 18px;
}

.chat-feed {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
}

.chat-feed::-webkit-scrollbar {
  width: 10px;
}

.chat-feed::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.message-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  max-width: 86%;
}

.message-row.self {
  margin-left: auto;
  flex-direction: row-reverse;
}

.message-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 0.92rem;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.08);
  color: #ffcb9e;
}

.message-row.self .message-icon {
  color: #09111d;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.message-bubble {
  padding: 15px 16px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 14px 28px rgba(0,0,0,0.18);
}

.message-row.self .message-bubble {
  background: linear-gradient(135deg, rgba(255,122,24,0.18), rgba(255,154,61,0.14));
  border-color: rgba(255,122,24,0.22);
}

.message-author {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffcb9e;
}

.message-row.self .message-author {
  color: #ffdcb8;
}

.message-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.65;
}

.message-meta {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.composer-input {
  min-height: 96px;
  resize: vertical;
}

.composer-footer {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.composer-note code {
  color: #ffcb9e;
}

.form-message {
  min-height: 24px;
  margin: 10px 0 0;
  font-weight: 700;
}

.form-message.error {
  color: #ff9fa6;
}

.form-message.success {
  color: #9df3a8;
}

.empty-state,
.empty-list {
  padding: 24px 18px;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--text);
}

.empty-state p {
  margin: 0;
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(3,7,18,0.78);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-card {
  width: min(480px, 100%);
  background: linear-gradient(160deg, rgba(21,31,53,0.96), rgba(14,23,39,0.96));
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
  padding: 24px;
}

.auth-card h2 {
  margin: 0 0 10px;
  font-size: 1.8rem;
}

.auth-button {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 1080px) {
  .messenger-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .hero-brand,
  .hero-stats {
    grid-template-columns: 1fr;
  }

  .hero-brand {
    text-align: center;
  }

  .hero-logo {
    margin: 0 auto;
  }

  .chat-panel {
    min-height: 680px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 16px 12px 28px;
  }

  .hero,
  .sidebar,
  .chat-panel,
  .auth-card {
    border-radius: 22px;
  }

  .inline-actions,
  .composer-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .back-button,
  .primary-button,
  .secondary-button {
    width: 100%;
    justify-content: center;
  }

  .message-row {
    max-width: 100%;
  }
}
