
* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #111321;
  --panel: rgba(28, 31, 51, 0.88);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f4f5ff;
  --muted: #a1a7c0;
  --accent: #818cf8;
  --accent2: #a855f7;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse at 90% 0%, #34305d 0, transparent 42%),
    radial-gradient(ellipse at 0% 100%, #202b49 0, transparent 35%),
    var(--bg);
  font-family: Tahoma, Arial, sans-serif;
}

button, textarea {
  font-family: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(900px, 100%);
  min-height: 100vh;
  margin: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 0 22px;
  border-bottom: 1px solid var(--border);
}

.logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-size: 18px;
  font-weight: bold;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 25px #818cf833;
}

.header-info {
  min-width: 0;
}

.header h1 {
  margin: 0 0 7px;
  font-size: 17px;
}

.header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 5px;
  border-radius: 50%;
  background: #45d6a2;
}

.new-chat {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  color: var(--text);
  background: #ffffff08;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background .2s, transform .2s;
}

.new-chat:hover,
.suggestion:hover {
  background: #818cf81a;
}

.new-chat:active,
#sendBtn:active {
  transform: scale(.96);
}

.messages {
  flex: 1;
  min-height: 250px;
  padding: 26px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.welcome {
  margin: auto;
  padding: 35px 10px;
  text-align: center;
  animation: appear .45s ease both;
}

.welcome-icon {
  color: var(--accent);
  font-size: 48px;
  margin-bottom: 10px;
  text-shadow: 0 0 35px #818cf855;
}

.welcome h2 {
  margin: 0 0 12px;
  font-size: 23px;
}

.welcome p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 2;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 25px;
}

.suggestion {
  color: #dfe2ff;
  background: #ffffff07;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  transition: background .2s;
}

.message {
  max-width: 88%;
  padding: 14px 17px;
  border: 1px solid var(--border);
  border-radius: 17px;
  font-size: 14px;
  line-height: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: appear .25s ease both;
}

.message.user {
  align-self: flex-start;
  background: linear-gradient(135deg, #35365f, #292d4a);
  border-bottom-right-radius: 5px;
}

.message.assistant {
  align-self: flex-end;
  background: var(--panel);
  backdrop-filter: blur(16px);
  border-bottom-left-radius: 5px;
}

.message.error {
  border-color: #c94f6b;
  color: #ffc6d1;
}

.message-meta {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 5px;
}

.composer {
  position: sticky;
  bottom: 8px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 11px;
  background: rgba(28, 31, 51, .94);
  border: 1px solid #ffffff16;
  border-radius: 19px;
  box-shadow: 0 15px 50px #0003;
  backdrop-filter: blur(20px);
}

textarea {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 180px;
  resize: vertical;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 11px 9px;
  font-size: 14px;
  line-height: 1.8;
}

textarea::placeholder {
  color: #939ab4;
}

#sendBtn {
  width: 45px;
  height: 45px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform .2s, opacity .2s;
}

#sendBtn svg {
  width: 23px;
  height: 23px;
}

#sendBtn:disabled {
  opacity: .45;
  cursor: wait;
}

.footer {
  padding: 13px 0 3px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

.error-box {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #c94f6b;
  border-radius: 12px;
  color: #ffc6d1;
  background: #c94f6b12;
  font-size: 12px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

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

@media (max-width: 600px) {
  .app {
    padding: 12px;
  }

  .header {
    gap: 9px;
  }

  .logo {
    width: 41px;
    height: 41px;
    border-radius: 13px;
  }

  .header h1 {
    font-size: 14px;
  }

  .new-chat {
    padding: 9px;
    font-size: 11px;
  }

  .message {
    max-width: 96%;
    padding: 12px;
    font-size: 13px;
  }

  .welcome h2 {
    font-size: 20px;
  }

  .suggestion {
    font-size: 12px;
  }
}
