:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #06101d;
  color: #f4f8ff;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(32, 147, 255, 0.16), transparent 30rem),
    radial-gradient(circle at 88% 82%, rgba(45, 212, 191, 0.1), transparent 34rem),
    #06101d;
}

button, textarea { font: inherit; }

.shell {
  width: min(960px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 0 24px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 24px 0 18px;
  border-bottom: 1px solid rgba(148, 180, 219, 0.16);
}

.brand-mark, .avatar {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #46b9ff, #4fe0bd);
  color: #03111f;
  font-weight: 850;
  box-shadow: 0 10px 30px rgba(49, 177, 255, 0.2);
}

.brand-mark { width: 44px; height: 44px; border-radius: 14px; font-size: 20px; }
.avatar { width: 34px; height: 34px; border-radius: 11px; font-size: 11px; flex: 0 0 auto; }

.eyebrow {
  margin: 0 0 3px;
  color: #76d9ff;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: 21px; letter-spacing: -0.02em; }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #a9bdd5;
  font-size: 13px;
}

.status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #43deb5;
  box-shadow: 0 0 0 5px rgba(67, 222, 181, 0.1);
}

.status.busy span { background: #f6c453; box-shadow: 0 0 0 5px rgba(246, 196, 83, 0.1); }
.status.error span { background: #ff6b7a; box-shadow: 0 0 0 5px rgba(255, 107, 122, 0.1); }

.conversation {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 36px 0 28px;
  overflow-y: auto;
}

.message { display: flex; gap: 12px; max-width: 82%; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.user .avatar { background: #233650; color: #dceaff; box-shadow: none; }

.bubble {
  padding: 14px 17px;
  border: 1px solid rgba(136, 179, 225, 0.16);
  border-radius: 6px 18px 18px;
  background: rgba(14, 31, 53, 0.78);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.12);
}

.user .bubble {
  border-radius: 18px 6px 18px 18px;
  background: linear-gradient(135deg, #1678bc, #176f86);
  border-color: transparent;
}

.bubble p {
  margin: 0;
  color: #e8f1fc;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.bubble .typing::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 16px;
  margin-left: 4px;
  vertical-align: -2px;
  background: #67d8ff;
  animation: blink 0.9s steps(2, jump-none) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.composer-wrap {
  position: sticky;
  bottom: 0;
  padding: 14px 0 22px;
  background: linear-gradient(transparent, #06101d 24%);
}

.source-bar {
  margin: 0 8px 9px;
  color: #8fa9c6;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 10px;
  padding: 9px 9px 9px 17px;
  border: 1px solid rgba(116, 173, 226, 0.24);
  border-radius: 20px;
  background: rgba(12, 27, 47, 0.94);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
}

.upload-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 3px;
  border: 1px solid rgba(116, 173, 226, 0.24);
  border-radius: 12px;
  color: #8fdfff;
  cursor: pointer;
  font-size: 22px;
}

.upload-button:hover { background: rgba(72, 189, 255, 0.1); }

textarea {
  width: 100%;
  min-height: 42px;
  max-height: 160px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 10px 0 7px;
  overflow-y: auto;
  background: transparent;
  color: #f5f9ff;
  line-height: 1.5;
}

textarea::placeholder { color: #7087a2; }

button {
  height: 44px;
  min-width: 92px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 13px;
  padding: 0 16px;
  background: linear-gradient(135deg, #48bdff, #4cddba);
  color: #03111f;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease;
}

button:hover { filter: brightness(1.08); transform: translateY(-1px); }
button:disabled { cursor: wait; filter: grayscale(0.35); opacity: 0.65; transform: none; }
button svg { width: 18px; fill: currentColor; }

.notice {
  margin: 10px 12px 0;
  color: #637991;
  font-size: 11px;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 620px) {
  .shell { padding: 0 14px; }
  .topbar { padding-top: 16px; }
  .eyebrow { display: none; }
  .status { font-size: 0; }
  .message { max-width: 94%; }
  .composer { border-radius: 17px; }
  button { min-width: 48px; padding: 0 13px; }
  button span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
