*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --ink: #1b1b1f;
  --muted: #5a5f6a;
  --accent: #1b6f5a;
  --accent-soft: rgba(27, 111, 90, 0.12);
  --panel: #ffffff;
  --panel-border: rgba(27, 30, 35, 0.08);
  --glow: rgba(27, 111, 90, 0.22);
  --shadow: 0 16px 36px rgba(26, 36, 53, 0.12);
}

body.app-body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(48, 123, 156, 0.12), transparent 48%),
    radial-gradient(circle at 10% 40%, rgba(217, 158, 80, 0.12), transparent 50%),
    linear-gradient(160deg, #f4f1e8 0%, #eef4f7 55%, #f7efe5 100%);
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hero {
  display: grid;
  gap: 10px;
}

.brand {
  font-family: "Instrument Serif", "Times New Roman", serif;
  font-size: clamp(2.4rem, 3vw, 3.2rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tagline {
  color: var(--muted);
  font-size: 0.95rem;
}

.title {
  font-size: 1.15rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  width: fit-content;
}

.chat {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 10px;
  scroll-behavior: smooth;
}

.status-lines {
  list-style: none;
  padding: 14px 18px;
  margin: 0;
  border-radius: 18px;
  background: rgba(27, 30, 35, 0.04);
  font-size: 0.9rem;
  color: var(--muted);
  display: grid;
  gap: 6px;
  animation: fade-in 0.45s ease-out;
}

.typewriter-line {
  min-height: 1.2em;
}

.typewriter-cursor {
  display: inline-block;
  width: 8px;
  height: 1.2em;
  background: var(--accent);
  animation: blink-cursor 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes blink-cursor {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

.bubble {
  padding: 14px 18px;
  border-radius: 18px;
  max-width: 80%;
  line-height: 1.5;
  font-size: 1rem;
  animation: rise 0.35s ease-out;
}

.bubble.user {
  align-self: flex-end;
  background: #1b1b1f;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(27, 30, 35, 0.25);
}

.bubble.assistant {
  align-self: flex-start;
  background: #fdfaf2;
  border: 1px solid rgba(27, 30, 35, 0.12);
}

.composer {
  display: grid;
  gap: 10px;
}

.composer-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.composer-input {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  font-size: 1rem;
  font-family: inherit;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(27, 30, 35, 0.08);
}

.composer-input:focus {
  outline: 2px solid var(--glow);
  border-color: transparent;
}

.composer-button {
  padding: 12px 20px;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 22px rgba(27, 111, 90, 0.24);
}

.composer-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(27, 111, 90, 0.3);
}

.clear-chat-button {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  justify-self: start;
}

.clear-chat-button:hover {
  color: #c0392b;
  border-color: #c0392b;
  background: rgba(192, 57, 43, 0.05);
}

.composer-note {
  color: var(--muted);
  font-size: 0.9rem;
}

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

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.balls-response-hidden {
  opacity: 0;
  visibility: hidden;
}

.balls-response-visible {
  animation: rise 0.35s ease-out;
}

@media (max-width: 720px) {
  .page {
    padding: 32px 16px 48px;
  }

  .chat-feed {
    max-height: 55vh;
  }

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

  .bubble {
    max-width: 100%;
  }
}
