:root {
  color-scheme: dark;
  --bg: #05060a;
  --bg-glow: radial-gradient(ellipse at top, #1a1030 0%, #05060a 60%);
  --ink: #e7e1f5;
  --dim: #8b84a8;
  --accent: #b98cff;
  --user-bubble: #1c1730;
  --pythia-bubble: #120d1f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-glow);
  color: var(--ink);
  font-family: "Iowan Old Style", "Georgia", serif;
  display: flex;
  justify-content: center;
  padding: 3rem 1rem;
}

main {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

h1 {
  text-align: center;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 1.5rem;
  color: var(--accent);
  margin: 0;
}

.intro {
  text-align: center;
  color: var(--dim);
  margin: 0;
  font-style: italic;
}

#thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 200px;
  max-height: 60vh;
  overflow-y: auto;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message {
  padding: 0.9rem 1.1rem;
  border-radius: 0.25rem;
  line-height: 1.5;
  max-width: 85%;
  animation: message-in 200ms ease-out;
}

@keyframes channel-glow {
  0%,
  100% {
    box-shadow: 0 0 0 1px #2a2340;
  }
  50% {
    box-shadow: 0 0 0.75rem 0 rgba(185, 140, 255, 0.45);
  }
}

#thread[aria-busy="true"] .message.pythia:empty {
  animation: channel-glow 1.4s ease-in-out infinite;
  min-width: 3rem;
  min-height: 1.2rem;
}

.message.user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: var(--ink);
}

.message.pythia {
  align-self: flex-start;
  background: var(--pythia-bubble);
  border: 1px solid #2a2340;
  color: var(--accent);
  font-style: italic;
}

.message.error {
  align-self: flex-start;
  color: #d98c8c;
  font-style: italic;
}

#question-form {
  display: flex;
  gap: 0.5rem;
}

#question-input {
  flex: 1;
  background: var(--user-bubble);
  border: 1px solid #2a2340;
  color: var(--ink);
  padding: 0.75rem 1rem;
  border-radius: 0.25rem;
  font-family: inherit;
  font-size: 1rem;
}

#question-input:focus {
  outline: 2px solid var(--accent);
}

button {
  background: var(--accent);
  color: #120d1f;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 0.25rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#starter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

#starter-chips.hidden {
  display: none;
}

.chip {
  background: transparent;
  color: var(--dim);
  border: 1px solid #2a2340;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-style: italic;
  font-weight: normal;
  cursor: pointer;
}

.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
}

#reset-button {
  align-self: center;
  background: transparent;
  color: var(--dim);
  border: none;
  padding: 0.25rem;
  font-size: 0.8rem;
  font-weight: normal;
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#reset-button:hover {
  color: var(--accent);
}
