﻿:root {
  --bg-0: #0a1018;
  --bg-1: #122131;
  --panel-0: rgba(15, 29, 43, 0.92);
  --panel-1: rgba(20, 36, 52, 0.9);
  --line: rgba(255, 255, 255, 0.1);
  --text: #ecf6ff;
  --muted: #9db4c9;
  --accent: #38e0af;
  --accent-2: #21a5ff;
  --danger: #ff6a7a;
  --ok: #61f7c9;
  --bubble-in: #1b3146;
  --bubble-out: #174136;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 15%, #1c3248 0%, transparent 35%),
    radial-gradient(circle at 88% 12%, #1f3648 0%, transparent 30%),
    linear-gradient(145deg, var(--bg-0), #060b11 72%);
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(transparent 95%, rgba(255, 255, 255, 0.22) 100%),
    linear-gradient(90deg, transparent 97%, rgba(255, 255, 255, 0.1) 100%);
  background-size: 100% 5px, 7px 100%;
}

.layout {
  width: min(1200px, 96vw);
  min-height: 92vh;
  margin: 4vh auto;
  position: relative;
  z-index: 1;
}

.hidden {
  display: none !important;
}

.auth-card {
  width: min(520px, 96vw);
  margin: 10vh auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(20, 36, 52, 0.95), rgba(11, 21, 31, 0.95));
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.35);
}

.auth-card h1 {
  margin: 0 0 10px;
  font-size: 1.6rem;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
}

.mode-toggle {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px;
  font: 600 0.9rem "IBM Plex Mono", monospace;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.mode.active {
  color: #06141d;
  border-color: transparent;
  background: linear-gradient(128deg, var(--accent-2), var(--accent));
}

.stack {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 0.84rem;
  color: var(--muted);
}

input,
button {
  font: inherit;
}

input {
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(7, 14, 22, 0.7);
  color: var(--text);
  padding: 11px 12px;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 224, 175, 0.2);
}

button {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary {
  padding: 11px 12px;
  font-weight: 700;
  color: #041018;
  background: linear-gradient(130deg, var(--accent-2), var(--accent));
}

.auth-actions {
  margin-top: 10px;
}

.link-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #8dd8ff;
  padding: 0;
  font-size: 0.86rem;
}

.link-button:hover {
  text-decoration: underline;
}

.help-text {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.status {
  min-height: 20px;
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--muted);
}

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

.status.ok {
  color: var(--ok);
}

.app-shell {
  min-height: 92vh;
  display: grid;
  grid-template-columns: 330px 1fr;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(175deg, rgba(10, 19, 28, 0.95), rgba(8, 14, 22, 0.95));
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--panel-0);
  border-right: 1px solid var(--line);
}

.me-card {
  padding: 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--panel-1);
}

.label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.me-name {
  margin: 4px 0 0;
  font-size: 1.08rem;
  font-family: "IBM Plex Mono", monospace;
}

.new-dm label {
  font-size: 0.84rem;
  color: var(--muted);
}

.inline-form {
  margin-top: 6px;
  display: flex;
  gap: 8px;
}

.inline-form input {
  flex: 1;
}

.inline-form button {
  padding: 0 12px;
  color: #05121c;
  font-weight: 700;
  background: linear-gradient(130deg, #3bc6ff, #52f0b4);
}

.panel-block {
  min-height: 0;
}

.panel-block h2 {
  margin: 10px 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.list button,
.list .empty {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px;
  color: #d6e8f7;
  background: rgba(255, 255, 255, 0.03);
}

.list button:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

.list button.active {
  border-color: rgba(56, 224, 175, 0.45);
  background: rgba(56, 224, 175, 0.16);
}

.list .secondary {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.79rem;
}

.online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #627f95;
}

.online-dot.on {
  background: var(--ok);
}

.ghost {
  margin-top: auto;
  padding: 10px;
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 17, 26, 0.7);
}

.chat-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.chat-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.messages {
  flex: 1;
  overflow: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.placeholder {
  margin: auto;
  text-align: center;
  color: var(--muted);
}

.message {
  max-width: min(72%, 680px);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: var(--bubble-in);
  animation: rise 150ms ease;
}

.message.out {
  margin-left: auto;
  background: var(--bubble-out);
  border-color: rgba(56, 224, 175, 0.28);
}

.message .meta {
  font-size: 0.76rem;
  color: var(--muted);
}

.message .text {
  margin-top: 4px;
  line-height: 1.36;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.composer button {
  padding: 0 15px;
  color: #041019;
  font-weight: 700;
  background: linear-gradient(125deg, #3ac8ff, #44e2ae);
}

.compose-status {
  margin: 0;
  padding: 0 14px 12px;
}

@media (max-width: 980px) {
  .layout {
    width: 100vw;
    margin: 0;
    min-height: 100vh;
  }

  .auth-card {
    margin: 4vh auto;
  }

  .app-shell {
    min-height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
}

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

  .left-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 42vh;
    overflow: auto;
  }

  .list {
    max-height: 130px;
  }

  .chat-panel {
    min-height: 58vh;
  }

  .message {
    max-width: 88%;
  }
}
