:root {
  --bg-1: #dbe7f2;
  --bg-2: #c7d8e8;
  --panel: rgba(255, 255, 255, 0.24);
  --text: #2f5f88;
  --text-soft: rgba(47, 95, 136, 0.72);
  --line: rgba(90, 169, 230, 0.2);
  --accent: #2f5f88;
  --accent-2: #7dbcf0;
  --shadow: 0 14px 34px rgba(78, 117, 150, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  position: relative;
  margin: 0;
  height: 100%;
  font-family: Arial, sans-serif;
  color: var(--text);
  overflow: hidden;
}

body {
  padding: 18px;
}

.blob-wrap {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.blob {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 34% 38% 32% 36% / 30% 34% 38% 35%;
  animation: morphA 9s ease-in-out infinite;
}

.blob-shape {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    180deg,
    rgba(159, 208, 245, 0.22),
    rgba(90, 169, 230, 0.16)
  );
  box-shadow:
    inset 8px 8px 18px rgba(255, 255, 255, 0.12),
    inset -10px -12px 20px rgba(0, 0, 0, 0.04),
    0 10px 30px rgba(90, 169, 230, 0.1);
  border-radius: inherit;
}

.blob-shape::before,
.blob-shape::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.blob-shape::before {
  background: radial-gradient(
    circle at 32% 28%,
    rgba(255, 255, 255, 0.22),
    transparent 28%
  );
  mix-blend-mode: screen;
}

.blob-shape::after {
  inset: 16%;
  background: radial-gradient(
    circle at 40% 35%,
    rgba(255, 255, 255, 0.1),
    transparent 50%
  );
  filter: blur(12px);
}

@keyframes morphA {
  0% {
    border-radius: 34% 38% 32% 36% / 30% 34% 38% 35%;
  }
  20% {
    border-radius: 40% 31% 36% 29% / 34% 27% 43% 32%;
  }
  40% {
    border-radius: 29% 41% 31% 39% / 39% 33% 37% 30%;
  }
  60% {
    border-radius: 42% 30% 35% 33% / 28% 40% 31% 42%;
  }
  80% {
    border-radius: 32% 36% 28% 43% / 41% 30% 39% 29%;
  }
  100% {
    border-radius: 34% 38% 32% 36% / 30% 34% 38% 35%;
  }
}

.chat-shell {
  position: absolute;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.1);
}

.contact {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(180deg, #7fc0f0 0%, #2f5f88 100%);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 6px 16px rgba(90, 169, 230, 0.28);
  flex: 0 0 auto;
}

.meta {
  min-width: 0;
}

.name {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  font-size: 12px;
  color: var(--text-soft);
}

.messages {
  flex: 1;
  overflow: auto;
  margin: 0 20px;
  padding: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
  width: 10px;
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(90, 169, 230, 0.28);
  border-radius: 999px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.day-divider {
  align-self: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.row {
  display: flex;
  width: 100%;
}

.row.incoming {
  justify-content: flex-start;
}

.row.outgoing {
  justify-content: flex-end;
}

.bubble {
  max-width: min(76%, 560px);
  min-width: 54px;
  padding: 10px 8px 18px;
  border-radius: 1rem;
  position: relative;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.16);
  line-height: 1.45;
  font-size: 14px;
}

.incoming .bubble {
  background: var(--panel);
  color: var(--text);
}

.outgoing .bubble {
  background: linear-gradient(
    180deg,
    rgba(125, 188, 240, 0.28),
    rgba(90, 169, 230, 0.24)
  );
  color: var(--text);
}

.bubble .time {
  position: absolute;
  right: 8px;
  bottom: 6px;
  font-size: 8px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}

.double-check {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: -1px;
}

.message-text {
  white-space: pre-wrap;
  word-break: break-word;
  display: inline-block;
}

.bubble-media {
  display: block;
  width: min(100%, 260px);
  max-height: 220px;
  margin-top: 0.45rem;
  border-radius: 0.9rem;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.composer {
  padding: 14px 16px 22px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.composer-shell {
  height: 64px;
  width: 65%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.attach-btn,
.send {
  flex: 0 0 auto;
}

.attach-btn {
  width: 42px;
  height: 42px;
  border-radius: 1rem;
  border: 1px solid rgba(47, 95, 136, 0.35);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

.send {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: white;
  font-size: 12px;
  box-shadow: 0 8px 18px rgba(90, 169, 230, 0.26);
  cursor: pointer;
}

.composer_input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 2.2rem;
  max-height: 48px;
  overflow-y: auto;
  outline: none;
  border: none;
  background: transparent;
  color: #2f5d8a;
  font-size: 1rem;
  line-height: 2.2;
  white-space: pre-wrap;
  word-break: break-word;
}

.composer_input:empty::before {
  content: attr(data-placeholder);
  color: rgba(47, 95, 136, 0.55);
  pointer-events: none;
}

.inline-attachment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  vertical-align: middle;
  margin: 0 0.25rem;
  border-radius: 1rem;
  height: 42px;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.inline-attachment img,
.inline-attachment video {
  display: block;
  width: 100%;
  object-fit: cover;
  border-radius: 0.75rem;
}

.inline-attachment button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  cursor: pointer;
  font-size: 12px;
  line-height: 18px;
  padding: 0;
}

.ripple-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  --splash-x: 50%;
  --splash-y: 50%;
  --splash-w: 0;
}

.ripple-canvas {
  position: absolute;
  left: var(--splash-x);
  top: var(--splash-y);
  width: var(--splash-w);
  transform: translate(-50%, -62%);
  opacity: 0;
  will-change: transform, opacity;
}

.ripple-stage.is-visible .ripple-canvas {
  opacity: 0.35;
}

.ripple-stage.is-fading .ripple-canvas {
  opacity: 0;
  transition: opacity 140ms linear;
}

#sourceSplash {
  display: none;
}

@media (max-width: 700px) {
  body {
    padding: 10px;
  }

  .chat-shell {
    border-radius: 1rem;
  }

  .bubble {
    max-width: 88%;
    font-size: 15px;
  }

  .name {
    font-size: 16px;
  }

  .composer-shell {
    width: 92%;
  }
}

.inline-dashboard-token {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  vertical-align: middle;
  margin: 0 0.25rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(90, 169, 230, 0.16);
  border: 1px solid rgba(90, 169, 230, 0.28);
  color: #2f5f88;
  font-size: 0.9rem;
  line-height: 1.2;
  position: relative;
}

.inline-dashboard-token-title {
  font-weight: 600;
}

.inline-dashboard-token-value {
  opacity: 0.8;
}

.inline-dashboard-token button {
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 18px;
  padding: 0;
}

.dashboard-card-chip {
  margin-top: 0.45rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.9rem;
  background: rgba(90, 169, 230, 0.12);
  border: 1px solid rgba(90, 169, 230, 0.2);
}

.dashboard-card-chip-title {
  font-size: 0.82rem;
  font-weight: 700;
}

.dashboard-card-chip-value {
  margin-top: 0.12rem;
  font-size: 0.8rem;
  opacity: 0.82;
}
