:root {
  --bg-1: #f4f8ff;
  --bg-2: #d8f0ea;
  --ink: #13203b;
  --muted: #5f6f8e;
  --card: #ffffffee;
  --line: #d9e2f2;
  --accent: #1263d6;
  --accent-2: #17a39a;
  --mine: #dcf4ff;
  --other: #f3f7ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: linear-gradient(140deg, var(--bg-1), var(--bg-2));
}

body {
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(2px);
  z-index: 0;
  pointer-events: none;
}

.orb-a {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle at 30% 30%, #8dc3ff, #5f83ff00 70%);
  top: -80px;
  right: -70px;
}

.orb-b {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle at 70% 70%, #70d9bc, #1e9b8500 68%);
  bottom: -60px;
  left: -70px;
}

.app-shell {
  width: min(960px, 100%);
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  animation: slideFade 0.55s ease both;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand h1 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: clamp(1.2rem, 2.1vw, 1.6rem);
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.brand-badge {
  background: linear-gradient(135deg, var(--accent), #4e88e6);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.view-card {
  background: var(--card);
  backdrop-filter: blur(8px);
  border: 1px solid #fff;
  border-radius: 20px;
  box-shadow: 0 16px 40px #2a457224;
  padding: 18px;
}

.animate-in {
  animation: slideFade 0.5s ease both;
}

.hidden {
  display: none;
}

.view-head h2,
.chat-head h2 {
  margin: 0;
  font-family: "Sora", sans-serif;
}

.view-head p,
.chat-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.create-row,
.join-row,
.send-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.list-head {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-head h3 {
  margin: 0;
}

input {
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  padding: 11px 12px;
  outline: none;
  background: #fff;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px #1263d61a;
}

button {
  border: 0;
  border-radius: 12px;
  font: inherit;
  padding: 10px 13px;
  cursor: pointer;
}

.accent-btn {
  background: linear-gradient(135deg, var(--accent), #4f8be9);
  color: #fff;
  font-weight: 600;
}

.soft-btn {
  background: linear-gradient(135deg, #e7f1ff, #defcf4);
  color: #1d2c4b;
  border: 1px solid #c9dfff;
}

.ghost-btn {
  background: #fff;
  color: #274069;
  border: 1px solid #cedaf0;
}

.pill,
.code-pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  background: #ecf2ff;
  color: #34528a;
  font-weight: 600;
}

.channel-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.channel-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffffd4;
}

.channel-name {
  margin: 0 0 4px;
  font-size: 1rem;
}

.channel-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.channel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.message-list {
  height: min(56vh, 520px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f7fbff, #effbf7);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.msg-item {
  max-width: min(88%, 560px);
  border-radius: 14px;
  padding: 8px 11px;
  border: 1px solid #dce7fb;
  background: var(--other);
}

.msg-item.mine {
  justify-self: end;
  background: var(--mine);
  border-color: #bfdefa;
}

.msg-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.msg-user {
  font-size: 0.89rem;
}

.msg-time {
  font-size: 0.78rem;
  color: var(--muted);
}

.msg-text {
  margin: 0;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

@keyframes slideFade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  body {
    padding: 10px;
  }

  .topbar {
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
  }

  .create-row,
  .join-row,
  .send-row {
    grid-template-columns: 1fr;
  }

  .channel-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .chat-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .message-list {
    height: 52vh;
  }
}
