:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #182033;
  background: #f8faff;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(114, 151, 255, .12), transparent 32rem),
    linear-gradient(180deg, #fbfcff 0%, #f6f8ff 100%);
}

button, textarea { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .6;
  background:
    radial-gradient(circle at 12% 75%, rgba(82, 211, 255, .12), transparent 24rem),
    radial-gradient(circle at 88% 78%, rgba(134, 94, 255, .1), transparent 28rem);
}

.app-shell {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid rgba(58, 75, 120, .1);
  background: rgba(251, 252, 255, .76);
  backdrop-filter: blur(20px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #111a2c;
  text-decoration: none;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.spiral-mark {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: conic-gradient(from 40deg, #346dff, #70d9ff, #7767ff, #346dff);
  box-shadow: 0 5px 18px rgba(63, 110, 255, .27);
  position: relative;
}

.spiral-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px solid white;
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-28deg);
}

.header-actions, .status { display: flex; align-items: center; }
.header-actions { gap: 14px; }
.status { gap: 7px; font-size: 12px; color: #788198; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #a7adbb; }
.status.online .status-dot { background: #27bd80; box-shadow: 0 0 0 4px rgba(39, 189, 128, .12); }
.status.offline .status-dot { background: #e15b6d; }

.new-chat {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(49, 69, 117, .12);
  border-radius: 12px;
  background: rgba(255,255,255,.8);
  cursor: pointer;
  transition: .2s ease;
}
.new-chat:hover { background: #fff; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(50, 78, 140, .11); }
.new-chat svg, .send-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.chat { min-height: 0; overflow-y: auto; scrollbar-width: thin; }

.welcome {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 16px;
  text-align: center;
}

.welcome.hidden { display: none; }

.portrait-wrap {
  width: 218px;
  height: 218px;
  padding: 5px;
  position: relative;
  margin-bottom: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #89e8ff, #477aff 55%, #9f73ff);
  box-shadow: 0 22px 62px rgba(65, 99, 209, .24), 0 0 0 10px rgba(100, 143, 255, .06);
}

.portrait-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
}

.portrait-ring {
  position: absolute;
  inset: -14px;
  border: 1px solid rgba(75, 141, 255, .25);
  border-right-color: transparent;
  border-radius: 50%;
  animation: orbit 14s linear infinite;
}

@keyframes orbit { to { transform: rotate(360deg); } }

.eyebrow { margin: 0 0 8px; color: #5875c9; font-size: 11px; font-weight: 750; letter-spacing: .16em; }
.welcome h1 { margin: 0; font-size: clamp(32px, 4vw, 48px); letter-spacing: -.045em; font-weight: 650; color: #17203a; }
.messages { width: min(800px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 28px; }
.message { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 14px; margin-bottom: 26px; }
.message.user { grid-template-columns: minmax(0, 1fr); }
.message.user .avatar { display: none; }
.message.user .message-body { justify-self: end; max-width: 78%; padding: 12px 16px; border-radius: 20px 20px 5px 20px; background: #e9edfa; color: #28324a; }
.avatar { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: #315bd5; box-shadow: 0 5px 18px rgba(51, 88, 198, .2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.message-body { min-width: 0; padding-top: 7px; color: #2f384f; line-height: 1.68; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.pending .message-body::after { content: ""; display: inline-block; width: 7px; height: 16px; margin-left: 3px; background: #587cf0; animation: blink .9s steps(1) infinite; vertical-align: -2px; }
.message.error .message-body { color: #a53e52; }
@keyframes blink { 50% { opacity: 0; } }

.composer-wrap { padding: 10px 18px 14px; background: linear-gradient(180deg, rgba(248,250,255,0), rgba(248,250,255,.95) 24%); }
.composer {
  width: min(780px, 100%);
  min-height: 62px;
  margin: 0 auto;
  padding: 9px 9px 9px 20px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border: 1px solid rgba(52, 75, 131, .15);
  border-radius: 24px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 16px 48px rgba(40, 65, 125, .13), 0 1px 2px rgba(30, 45, 78, .06);
  backdrop-filter: blur(20px);
}
.composer:focus-within { border-color: rgba(77, 114, 230, .42); box-shadow: 0 18px 54px rgba(53, 83, 160, .16), 0 0 0 3px rgba(83, 125, 255, .08); }
.composer textarea { flex: 1; max-height: 170px; min-height: 42px; padding: 10px 0 7px; resize: none; overflow-y: auto; border: 0; outline: 0; background: transparent; color: #202a41; line-height: 1.45; }
.composer textarea::placeholder { color: #929bad; }
.send-button { flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 16px; background: linear-gradient(135deg, #3e72f4, #7265ea); color: #fff; cursor: pointer; box-shadow: 0 8px 20px rgba(71, 103, 218, .28); transition: .2s ease; }
.send-button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 11px 25px rgba(71, 103, 218, .35); }
.send-button:disabled { opacity: .35; cursor: default; box-shadow: none; }
.disclaimer { margin: 8px auto 0; text-align: center; color: #929bad; font-size: 11px; }

@media (max-width: 720px) {
  .topbar { padding: 0 15px; }
  .status-text { display: none; }
  .welcome { justify-content: flex-start; padding-top: 34px; }
  .portrait-wrap { width: 172px; height: 172px; margin-bottom: 16px; }
  .welcome h1 { font-size: 34px; }
  .messages { width: calc(100% - 24px); padding-top: 22px; }
  .message { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
  .avatar { width: 34px; height: 34px; }
  .message.user .message-body { max-width: 88%; }
  .composer-wrap { padding-inline: 10px; }
  .composer { min-height: 56px; border-radius: 20px; padding-left: 15px; }
  .send-button { width: 40px; height: 40px; flex-basis: 40px; border-radius: 14px; }
}

@media (max-height: 720px) and (min-width: 721px) {
  .portrait-wrap { width: 154px; height: 154px; margin-bottom: 12px; }
  .welcome h1 { font-size: 36px; }
}

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