:root {
  color-scheme: light;
  --paper: #f5f2ec;
  --paper-deep: #ebe7df;
  --ink: #27252b;
  --muted: #89868d;
  --faint: #b6b1aa;
  --line: rgba(39, 37, 43, 0.1);
  --card: #eae6f5;
  --card-warm: #f0e9dc;
  --card-blue: #e2edf0;
  --violet: #5b49c9;
  --orange: #d9542f;
  --shadow: 0 18px 46px rgba(50, 42, 75, 0.12), 0 3px 10px rgba(50, 42, 75, 0.06);
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0%, rgba(232, 224, 255, 0.55), transparent 32rem),
    var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 25px 18px calc(148px + env(safe-area-inset-bottom));
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

h1,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  letter-spacing: -0.045em;
}

.library {
  min-width: 0;
}

.section-heading {
  margin-bottom: 19px;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(24px, 7vw, 31px);
  font-weight: 400;
  line-height: 1.02;
}

.question-composer textarea::placeholder,
.question-composer input::placeholder {
  color: var(--faint);
}

.answer-list {
  display: grid;
  gap: 11px;
}

.answer-card {
  padding: 19px 18px 17px;
  border: 1px solid rgba(39, 37, 43, 0.04);
  border-radius: 18px;
  box-shadow: 0 2px 1px rgba(39, 37, 43, 0.02);
  animation: card-in 320ms both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.answer-card:nth-child(3n + 1) {
  background: var(--card);
}

.answer-card:nth-child(3n + 2) {
  background: var(--card-warm);
}

.answer-card:nth-child(3n) {
  background: var(--card-blue);
}

.answer-card.is-pending .card-time {
  color: var(--orange);
}

.answer-card.is-error {
  background: #f7e4dd !important;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 11px;
}

.card-time {
  color: rgba(39, 37, 43, 0.72);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.answer-card h3 {
  max-width: 620px;
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 400;
  letter-spacing: -0.028em;
  line-height: 1.12;
}

.answer-card p {
  max-width: 620px;
  margin: 0;
  color: rgba(39, 37, 43, 0.74);
  font-size: 15px;
  line-height: 1.54;
}

.answer-card p strong {
  color: var(--ink);
  font-weight: 700;
}

.answer-card p em {
  font-style: italic;
}

.empty-state {
  padding: 41px 20px 45px;
  border: 1px dashed rgba(39, 37, 43, 0.16);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
}

.empty-state p {
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.5;
}

.question-composer {
  position: fixed;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: 100%;
  margin: 0;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(39, 37, 43, 0.08);
  background: var(--paper);
}

.composer-field {
  position: relative;
  flex: 1;
  min-width: 0;
  width: 100%;
}

.question-field {
  display: block;
}

.composer-field-icon {
  position: absolute;
  z-index: 1;
  right: auto;
  bottom: 14px;
  left: 16px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: rgba(60, 60, 67, 0.58);
  pointer-events: none;
  transition: color 160ms ease;
}

.composer-field-icon svg,
.clear-input svg,
.question-composer button[type="submit"] svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.question-composer.has-question .composer-field-icon {
  color: var(--orange);
}

.question-composer.is-loading .composer-field-icon {
  opacity: 0.55;
}

.question-composer textarea {
  display: block;
  width: 100%;
  min-height: 50px;
  max-height: 122px;
  resize: none;
  overflow-y: auto;
  padding: 15px 104px 15px 46px;
  border: 1px solid rgba(60, 60, 67, 0.14);
  border-radius: 24px;
  outline: 0;
  color: var(--ink);
  background: rgba(118, 118, 128, 0.12);
  box-shadow: none;
  font-size: 16px;
  line-height: 20px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.question-composer textarea:focus {
  border-color: rgba(217, 84, 47, 0.72);
  background: rgba(118, 118, 128, 0.16);
  box-shadow: none;
}

.question-composer textarea::placeholder {
  color: rgba(60, 60, 67, 0.58);
}

.clear-input {
  position: absolute;
  top: auto;
  bottom: 3px;
  right: 51px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: rgba(60, 60, 67, 0.62);
  background: rgba(60, 60, 67, 0.12);
  box-shadow: none;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.clear-input:hover,
.clear-input:focus-visible {
  color: var(--ink);
  background: rgba(60, 60, 67, 0.2);
  transform: scale(1.04);
}

.question-composer button[type="submit"] {
  position: absolute;
  top: auto;
  bottom: 3px;
  right: 3px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: white;
  background: var(--orange);
  box-shadow: 0 4px 10px rgba(217, 84, 47, 0.24);
  font-size: 25px;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.question-composer button[type="submit"]:disabled,
.clear-input[hidden] {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.82);
}

.question-composer button[type="submit"]:hover {
  background: #c44828;
  box-shadow: 0 7px 16px rgba(217, 84, 47, 0.32);
  transform: translateY(-2px);
}

.question-composer button[type="submit"]:active {
  transform: translateY(1px) scale(0.97);
}

.question-composer button:focus-visible {
  outline: 3px solid rgba(109, 92, 231, 0.3);
  outline-offset: 3px;
}

.question-composer textarea:focus-visible {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }

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

@media (min-width: 620px) {
  .app-shell {
    padding-top: 42px;
  }

  .answer-card {
    padding: 22px 22px 19px;
  }

  .question-composer {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
