
:root {
  color-scheme: dark;
  --bg: #050713;
  --panel: rgba(12, 17, 38, .88);
  --line: rgba(92, 225, 230, .2);
  --muted: #8995b8;
  --text: #edf5ff;
  --cyan: #42f5ff;
  --violet: #9875ff;
  --pink: #ff45b8;
  --green: #46dfaa;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: system-ui, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse at 10% 5%, #123b5b 0, transparent 35%),
    radial-gradient(ellipse at 90% 90%, #40144f 0, transparent 35%),
    linear-gradient(135deg, #050713, #090b1c 55%, #10081d);
  overflow-x: hidden;
}

/* Cyberpunk atmosphere */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .13;
  background-image:
    linear-gradient(rgba(66,245,255,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(66,245,255,.12) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    transparent 50%,
    rgba(66,245,255,.025) 50%
  );
  background-size: 100% 5px;
  opacity: .4;
}

.ambient {
  position: fixed;
  width: 430px;
  height: 430px;
  border-radius: 50%;
  filter: blur(115px);
  opacity: .17;
  pointer-events: none;
  animation: ambientMove 12s ease-in-out infinite alternate;
}

.ambient-one {
  background: var(--cyan);
  top: -190px;
  left: -160px;
}

.ambient-two {
  background: var(--pink);
  right: -190px;
  bottom: -190px;
  animation-delay: -5s;
}

@keyframes ambientMove {
  from { transform: translate(0, 0) scale(.9); }
  to { transform: translate(50px, 35px) scale(1.2); }
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1500px;
  margin: auto;
  padding: 24px 5vw 18px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 18px rgba(66,245,255,.08);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 900;
  letter-spacing: 2px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #07101d;
  font-size: 22px;
  box-shadow: 0 0 20px #42f5ff66, 0 0 35px #9875ff33;
}

.brand small {
  display: block;
  font: 9px monospace;
  letter-spacing: 2px;
  color: var(--cyan);
  margin-top: 4px;
}

.accent {
  color: var(--cyan);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.connection,
.live-pill {
  font: 10px monospace;
  color: var(--muted);
  letter-spacing: 1px;
}

.connection i,
.live-pill i,
.secure-dot,
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 7px;
  box-shadow: 0 0 12px var(--green);
}

.connection.offline i {
  background: #ffb65c;
  box-shadow: 0 0 12px #ffb65c;
}

/* Glass panels */

.glass {
  background: linear-gradient(
    145deg,
    rgba(17, 29, 58, .91),
    rgba(10, 12, 31, .84)
  );
  border: 1px solid var(--line);
  box-shadow:
    0 0 20px rgba(66,245,255,.06),
    0 20px 70px #0008,
    inset 0 0 25px rgba(66,245,255,.025);
  backdrop-filter: blur(22px);
}

/* Login screen */

.auth-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  gap: 8vw;
  padding: 65px 4vw;
}

.hero .eyebrow,
.eyebrow {
  font: 10px monospace;
  letter-spacing: 3px;
  color: var(--cyan);
  text-shadow: 0 0 12px var(--cyan);
}

.pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pink);
  margin-right: 8px;
  box-shadow: 0 0 15px var(--pink);
}

h1 {
  font-size: clamp(42px, 6vw, 78px);
  line-height: 1.06;
  letter-spacing: -4px;
  margin: 22px 0;
}

.gradient-text {
  background: linear-gradient(
    90deg,
    var(--cyan),
    #b3a0ff 52%,
    var(--pink)
  );
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 15px #42f5ff22);
}

.hero p {
  max-width: 490px;
  color: var(--muted);
  line-height: 1.9;
  font-size: 15px;
}

.hero-stats {
  display: flex;
  gap: 34px;
  margin-top: 52px;
}

.hero-stats div {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hero-stats b {
  font: 18px monospace;
  color: var(--cyan);
  text-shadow: 0 0 12px #42f5ff66;
}

.hero-stats span {
  font-size: 11px;
  color: var(--muted);
}

.auth-card {
  padding: 32px;
  border-radius: 20px;
  max-width: 470px;
  width: 100%;
  justify-self: end;
  box-shadow: 0 0 30px #42f5ff12, 0 25px 80px #0008;
}

.card-heading h2,
.dialog-head h2 {
  font-size: 27px;
  margin: 10px 0 5px;
}

.card-heading p {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 24px;
}

.tabs {
  display: flex;
  padding: 4px;
  background: #070c1d;
  border: 1px solid #26365b;
  border-radius: 10px;
  margin-bottom: 22px;
}

.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 11px;
  border-radius: 8px;
  font: 600 12px system-ui;
  cursor: pointer;
  transition: .2s;
}

.tab.active {
  background: linear-gradient(100deg, #164c64, #38245f);
  color: white;
  box-shadow: 0 0 15px #42f5ff22;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #cbdcff;
  margin: 14px 0;
}

input,
textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 13px 14px;
  border-radius: 9px;
  border: 1px solid #344365;
  background: #080e21;
  color: var(--text);
  font: 13px system-ui;
  outline: none;
  transition: .2s;
}

input:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px #42f5ff19, 0 0 18px #42f5ff15;
}

input::placeholder,
textarea::placeholder {
  color: #64708f;
}

/* Buttons */

.button {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 16px;
  color: var(--text);
  font: 700 12px system-ui;
  cursor: pointer;
  transition: .2s ease;
}

.button:hover,
.send-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.2);
  box-shadow: 0 0 18px #42f5ff35;
}

.primary {
  background: linear-gradient(100deg, #087f9b, #6843bd);
  border: 0;
  box-shadow: 0 0 18px #42f5ff25;
}

.primary span {
  float: right;
}

.full {
  width: 100%;
}

.ghost {
  background: #151b32;
}

.subtle {
  background: #121a32;
  color: #b9c9f5;
}

.fine-print {
  font-size: 10px;
  line-height: 1.7;
  color: #7f89a8;
  margin: 18px 0 0;
}

.notice {
  min-height: 18px;
  font-size: 11px;
  color: var(--cyan);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* Main chat layout */

.chat-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  padding: 30px 0;
  min-height: 650px;
}

.sidebar {
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.side-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 2px 20px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  display: grid;
  place-items: center;
  color: #08101d;
  font-weight: 800;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 16px #42f5ff44;
}

.user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-meta b {
  font-size: 12px;
}

.user-meta span {
  font: 10px monospace;
  color: var(--muted);
}

.side-label {
  font: 9px monospace;
  color: var(--cyan);
  letter-spacing: 2px;
  margin: 30px 0 12px;
}

.room {
  border: 1px solid #42f5ff38;
  background: linear-gradient(120deg, #18354d99, #29204a88);
  box-shadow: inset 0 0 15px #42f5ff09;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--text);
  cursor: default;
}

.room-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: #5363a744;
  border-radius: 8px;
  color: var(--cyan);
  font-size: 20px;
}

.room span:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.room b {
  font-size: 11px;
}

.room small {
  font-size: 9px;
  color: var(--muted);
}

.side-note {
  font-size: 10px;
  color: #8791af;
  line-height: 1.7;
  margin: 18px 3px;
}

.side-bottom {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font: 10px monospace;
  color: #aab5d3;
}

/* Conversation window */

.conversation {
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.conversation-head {
  padding: 23px 26px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, #10243b55, transparent);
}

.conversation-head h2 {
  font-size: 19px;
  margin: 7px 0 3px;
}

.conversation-head p {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

.live-pill {
  color: #60dfb1;
}

/* Messages */

.messages {
  flex: 1;
  overflow: auto;
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 300px;
  max-height: calc(100vh - 360px);
  scrollbar-width: thin;
  scrollbar-color: #355c79 #080e21;
}

.message {
  max-width: min(75%, 650px);
  align-self: flex-start;
  animation: messageEnter .25s ease-out;
}

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

.message.mine {
  align-self: flex-end;
}

.message-meta {
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
  margin: 0 0 6px 4px;
}

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

.message-meta b {
  color: var(--cyan);
}

.bubble {
  padding: 11px 14px;
  border-radius: 4px 14px 14px 14px;
  background: linear-gradient(135deg, #152b43, #1b2544);
  border: 1px solid #42f5ff2c;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 0 16px #42f5ff09;
}

.mine .bubble {
  background: linear-gradient(120deg, #164b61, #393568);
  border-color: #9b83ff66;
  border-radius: 14px 4px 14px 14px;
  box-shadow: 0 0 18px #9875ff16;
}

.empty-state {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.empty-state b {
  color: var(--text);
  font-size: 13px;
}

.empty-orb {
  width: 48px;
  height: 48px;
  border: 1px solid #42f5ff77;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  font-size: 22px;
  margin-bottom: 5px;
  box-shadow: 0 0 22px #42f5ff20;
}

/* Message composer */

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 15px 20px 7px;
  border-top: 1px solid var(--line);
  background: #080d1caa;
}

.composer textarea {
  resize: none;
  max-height: 130px;
  min-height: 44px;
  margin: 0;
  border-radius: 12px;
  background: #080e21;
  padding: 13px;
}

.send-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), #8982ff);
  color: #08101d;
  font-size: 19px;
  cursor: pointer;
  transition: .2s;
  box-shadow: 0 0 18px #42f5ff35;
}

.composer-foot {
  display: flex;
  justify-content: space-between;
  padding: 0 22px 13px;
  color: #707b9b;
  font: 9px monospace;
}

.offline-banner {
  margin: 12px 20px 0;
  padding: 10px 13px;
  border: 1px solid #d99d4c55;
  background: #5c3b182e;
  color: #f1c58a;
  border-radius: 9px;
  font-size: 10px;
  line-height: 1.5;
}

.queue-info {
  padding: 0 22px;
  color: #f0c17c;
  font-size: 10px;
}

/* Profile dialog */

.profile-dialog {
  width: min(440px, calc(100% - 28px));
  padding: 25px;
  border-radius: 18px;
  color: var(--text);
  background: #0d142a;
  border: 1px solid var(--line);
  box-shadow: 0 0 35px #42f5ff18;
}

.profile-dialog::backdrop {
  background: #02040bc9;
  backdrop-filter: blur(5px);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.icon-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  cursor: pointer;
}

.muted {
  color: var(--muted);
  font-weight: 400;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.offline-banner.hidden {
  display: none;
}

/* Footer */

footer {
  text-align: center;
  padding: 14px;
  color: #596482;
  font: 9px monospace;
  letter-spacing: 1.4px;
}

footer span {
  color: var(--cyan);
  padding: 0 6px;
}

/* Responsive design */

@media(max-width: 850px) {
  .auth-layout {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 45px 0;
  }

  .hero {
    text-align: center;
  }

  .hero p {
    margin: auto;
  }

  .hero-stats {
    justify-content: center;
    margin-top: 25px;
  }

  .auth-card {
    justify-self: center;
  }

  .chat-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .sidebar {
    padding: 12px;
  }

  .side-user {
    padding-bottom: 10px;
  }

  .side-label,
  .room,
  .side-note,
  .side-bottom {
    display: none;
  }

  .sidebar .button {
    width: auto;
    align-self: flex-start;
  }

  .messages {
    max-height: 55vh;
    min-height: 300px;
  }

  .conversation {
    min-height: 560px;
  }
}

@media(max-width: 520px) {
  .shell {
    padding: 14px 14px 10px;
  }

  .topbar {
    height: 55px;
  }

  .connection {
    font-size: 8px;
  }

  .auth-card {
    padding: 22px;
  }

  .hero h1 {
    letter-spacing: -2px;
  }

  .hero-stats {
    gap: 15px;
  }

  .hero-stats span {
    font-size: 9px;
  }

  .conversation-head {
    padding: 18px;
  }

  .messages {
    padding: 17px 13px;
  }

  .message {
    max-width: 90%;
  }

  .composer {
    padding: 12px 12px 7px;
  }

  .composer-foot {
    padding: 0 14px 12px;
    font-size: 8px;
  }
}

@media(prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
