:root {
  --bg: #fff6f8;
  --panel: #fffefe;
  --text: #2a1f26;
  --muted: #7d6a74;
  --line: #ebd7e0;
  --accent: #cb2f7a;
  --accent-ink: #ffffff;
  --user: #fde7f1;
  --assistant: #ffffff;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
}

body {
  background:
    radial-gradient(circle at 12% 8%, #ffd5e8 0%, transparent 35%),
    radial-gradient(circle at 84% 16%, #ffdfe7 0%, transparent 34%),
    radial-gradient(circle at 75% 90%, #f5d8ff 0%, transparent 32%),
    var(--bg);
  display: grid;
  place-items: center;
  padding: 20px;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.35;
  pointer-events: none;
}

.bg-shape-1 {
  width: 260px;
  height: 260px;
  background: #ffc5dd;
  top: 8%;
  left: 4%;
}

.bg-shape-2 {
  width: 320px;
  height: 320px;
  background: #e1c0ff;
  bottom: 8%;
  right: 5%;
}

.app {
  width: min(860px, 100%);
  height: min(760px, 95vh);
  background: color-mix(in srgb, var(--panel) 90%, white 10%);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
}

.topbar {
  display: grid;
  gap: 6px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(125deg, #fff8fb 0%, #fff1f7 55%, #fff8fb 100%);
}

h1 {
  font-size: 1.3rem;
  margin: 0;
  line-height: 1.2;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: #a55b83;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.settings {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background: #fbf8f2;
}

.settings.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

label {
  font-size: 0.85rem;
  color: var(--muted);
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.note {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.auth-gate {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: #fff7fb;
}

.auth-art {
  position: relative;
  height: 48px;
  margin-bottom: 10px;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
}

.orb-a {
  width: 38px;
  height: 38px;
  left: 2px;
  top: 8px;
  background: #ffc4de;
}

.orb-b {
  width: 26px;
  height: 26px;
  left: 36px;
  top: 2px;
  background: #ff8fbf;
}

.orb-c {
  width: 20px;
  height: 20px;
  left: 66px;
  top: 22px;
  background: #e1b6ff;
}

.auth-copy {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: var(--muted);
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.auth-error {
  margin: 8px 0 0;
  min-height: 1.1em;
  color: #9f2d2d;
  font-size: 0.85rem;
}

.messages {
  overflow-y: auto;
  padding: 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.message {
  max-width: min(85%, 700px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  animation: fadeIn 160ms ease-out;
}

.message .role {
  display: block;
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.message .content {
  margin: 0;
  white-space: pre-wrap;
}

.message.user {
  justify-self: end;
  background: var(--user);
}

.message.assistant {
  justify-self: start;
  background: var(--assistant);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

textarea {
  resize: none;
  min-height: 44px;
  max-height: 140px;
  overflow-y: auto;
}

.btn {
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .app {
    height: 98vh;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.08rem;
  }

  .btn {
    width: 100%;
  }
}
