* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #080512;
  --surface: #120d1f;
  --surface-2: #191226;
  --surface-3: #21182f;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #ffffff;
  --muted: #aab2d8;
  --muted-soft: #737b9f;
  --cyan: #00dfd8;
  --purple: #7928ca;
  --pink: #ff0080;
  --gradient: linear-gradient(90deg, #00dfd8 0%, #7928ca 52%, #ff0080 100%);
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -12%, rgba(255, 0, 128, 0.13), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 38%),
    var(--bg);
  overflow-x: hidden;
}

button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.agent-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.agent-stage {
  width: min(620px, 100%);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 18px;
  opacity: 0;
  transform: translateY(10px) scale(0.985);
}

body.is-ready .agent-stage {
  animation: agentEnter 0.56s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.agent-logo-link {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  text-decoration: none;
  box-shadow: 0 18px 48px rgba(255, 0, 128, 0.2);
  animation: logoFloat 5s ease-in-out infinite;
}

.agent-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: block;
  object-fit: cover;
}

.welcome {
  width: min(560px, 100%);
  text-align: center;
  animation: fadeUp 0.48s ease both;
  animation-delay: 0.08s;
}

.status-line {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.welcome h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(2rem, 6vw, 3.1rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.03;
}

.welcome p:last-child {
  max-width: 500px;
  margin: 13px auto 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.compose-card {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(18, 13, 31, 0.92);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fadeUp 0.48s ease both;
  animation-delay: 0.16s;
}

.compose-card:focus-within {
  border-color: rgba(0, 223, 216, 0.36);
  box-shadow:
    0 0 0 3px rgba(0, 223, 216, 0.08),
    var(--shadow);
}

.compose-card textarea {
  width: 100%;
  min-height: 96px;
  max-height: 220px;
  resize: vertical;
  border: 0;
  outline: 0;
  padding: 20px 21px 8px;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.55;
}

.compose-card textarea::placeholder {
  color: #8088aa;
}

.compose-footer {
  min-height: 56px;
  padding: 8px 12px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.compose-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.model-select {
  height: 38px;
  min-width: 124px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  position: relative;
}

.model-select span {
  color: var(--muted-soft);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.model-select select {
  appearance: none;
  min-width: 52px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
  padding: 0 18px 0 0;
  cursor: pointer;
}

.model-select select option {
  background: #120d1f;
  color: #ffffff;
}

.model-select i {
  position: absolute;
  right: 10px;
  color: var(--cyan);
  font-size: 0.86rem;
  pointer-events: none;
}

.send-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 13px;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  font-size: 1.32rem;
  font-weight: 900;
  background: var(--gradient);
  box-shadow: 0 14px 38px rgba(255, 0, 128, 0.26);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.send-btn i {
  font-weight: 900;
  line-height: 1;
}

.send-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.send-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.messages {
  width: min(560px, 100%);
  display: none;
  gap: 16px;
  align-content: start;
}

body.has-chat .agent-shell {
  place-items: end center;
}

body.has-chat .agent-stage {
  align-content: end;
}

body.has-chat .agent-logo-link,
body.has-chat .welcome {
  display: none;
}

body.has-chat .messages {
  display: grid;
  max-height: calc(100vh - 170px);
  overflow: auto;
  padding: 4px 4px 8px;
}

.message {
  display: grid;
  gap: 8px;
  animation: fadeUp 0.26s ease both;
}

.message.user {
  justify-items: end;
}

.bubble {
  max-width: min(520px, 100%);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.055);
  color: #edf0ff;
  line-height: 1.56;
  font-size: 0.95rem;
}

.message.user .bubble {
  max-width: min(470px, 92%);
  border-color: rgba(0, 223, 216, 0.22);
  background: linear-gradient(135deg, rgba(0, 223, 216, 0.14), rgba(255, 0, 128, 0.12));
}

.bubble strong {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 0.86rem;
}

.message.user .bubble strong {
  color: #ffd9ed;
}

.bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.actions-box {
  margin-top: 12px;
  border: 1px solid rgba(0, 223, 216, 0.25);
  border-radius: 15px;
  background: rgba(0, 223, 216, 0.075);
  padding: 12px;
}

.actions-box ul {
  list-style: none;
  padding: 0;
  margin: 9px 0 12px;
  display: grid;
  gap: 7px;
}

.actions-box li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  word-break: break-word;
}

.secondary-btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 800;
}

.toast-area {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 9px;
  z-index: 10;
}

.toast {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #15101f;
  color: var(--text);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

.toast.error {
  border-color: rgba(255, 0, 128, 0.45);
}

@keyframes agentEnter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@media (max-width: 640px) {
  .agent-shell {
    padding: 18px 12px;
  }

  .agent-stage {
    width: 100%;
  }

  .agent-logo,
  .agent-logo-link {
    width: 58px;
    height: 58px;
    border-radius: 16px;
  }

  .welcome h1 {
    font-size: clamp(1.85rem, 11vw, 2.65rem);
  }

  .compose-card,
  .messages {
    width: 100%;
  }

  .compose-actions {
    width: 100%;
    justify-content: space-between;
  }

  .model-select {
    min-width: 132px;
  }

  body.has-chat .messages {
    max-height: calc(100vh - 176px);
  }
}
