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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: #f6f1e7;
  color: #1c1915;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 1.125rem;
  line-height: 1.5;
}

.screen {
  width: min(100%, 40rem);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 100dvh;
}

.header {
  text-align: center;
}

.brand {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(2.5rem, 10vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #1c1915;
}

.tagline {
  margin: 0.4rem 0 0;
  font-size: 1.2rem;
  color: #1c1915;
}

.transcript {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}

.transcript[hidden] {
  display: none;
}

.bubble {
  max-width: 92%;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  font-size: 1.125rem;
  line-height: 1.45;
}

.bubble--user {
  align-self: flex-end;
  background: #1c1915;
  color: #f6f1e7;
  border-bottom-right-radius: 0.25rem;
}

.bubble--photon {
  align-self: flex-start;
  background: #ebe4d6;
  color: #1c1915;
  border-bottom-left-radius: 0.25rem;
  white-space: pre-line;
}

.reply-block {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bubble--answer {
  white-space: normal;
  overflow-wrap: anywhere;
}

.bubble--answer > * {
  margin: 0;
}

.bubble--answer > * + * {
  margin-top: 0.7rem;
}

.answer-heading {
  font-family: Newsreader, Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
}

.bubble--answer > .answer-heading {
  margin-top: 1rem;
}

.answer-list {
  padding-left: 1.25rem;
}

.answer-list li + li {
  margin-top: 0.4rem;
}

.nobr {
  white-space: nowrap;
}

.cite {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3em;
  height: 1.3em;
  margin: 0 0.1em 0 0.15em;
  padding: 0 0.3em;
  border: 0;
  border-radius: 999px;
  background: #1c1915;
  color: #f6f1e7;
  font: inherit;
  font-size: 0.66em;
  font-weight: 600;
  line-height: 1;
  vertical-align: 0.55em;
  cursor: pointer;
}

/* The button is small, so its tap area reaches past the pill. */
.cite::before {
  content: "";
  position: absolute;
  inset: -0.6em -0.45em;
}

.cite:hover {
  background: #2e2a24;
}

.cite:focus-visible {
  outline: 3px solid #1c1915;
  outline-offset: 2px;
}

.bubble--pending {
  min-width: 4.25rem;
}

.pending-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.15em;
}

.pending-dots span {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #1c1915;
  opacity: 0.28;
  animation: pending-dot 1.15s ease-in-out infinite;
}

.pending-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.pending-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

/* Each block of a reply fades in after the one before it (app.js adds rv, then rv--in). */
.rv {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.rv--in {
  opacity: 1;
  transform: none;
}

@keyframes pending-dot {
  0%,
  70%,
  100% {
    opacity: 0.22;
    transform: translateY(0);
  }

  35% {
    opacity: 0.85;
    transform: translateY(-2px);
  }
}

.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;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.empty[hidden] {
  display: none;
}

.empty-lead {
  margin: 0;
  max-width: 26rem;
  font-size: 1.15rem;
}

.chips {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.chip {
  padding: 0.75rem 1rem;
  border: 1.5px solid #1c1915;
  border-radius: 0.65rem;
  background: #fffdf8;
  color: #1c1915;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.chip:hover {
  background: #efe6d4;
}

.chip:focus-visible {
  outline: 3px solid #1c1915;
  outline-offset: 2px;
}

.followups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.followups .chip {
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 1rem;
}

.general {
  padding: 0.75rem 0.9rem;
  border: 1.5px dashed #6b4f1d;
  border-radius: 0.5rem;
  background: #f1e6cc;
}

.general-label {
  margin: 0 0 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #6b4f1d;
}

.general-text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.sources {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sources-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  opacity: 0.75;
}

.src-card {
  padding: 0.7rem 0.85rem;
  border: 1.5px solid #1c1915;
  border-radius: 0.5rem;
  background: #f6f1e7;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.src-card:focus {
  outline: none;
}

.src-card--hit {
  background: #efe6d4;
  box-shadow: 0 0 0 3px #c4a15a;
}

.src-head {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.src-num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.1rem;
  border-radius: 50%;
  background: #1c1915;
  color: #f6f1e7;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
}

.src-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.src-short {
  font-weight: 400;
  opacity: 0.75;
}

.src-meta,
.src-flags {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  line-height: 1.35;
}

.src-meta {
  opacity: 0.8;
}

.src-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.75rem;
}

.src-review {
  font-weight: 600;
}

.src-review--human {
  color: #2f5d34;
}

.src-quote {
  margin: 0.5rem 0 0;
  padding: 0.4rem 0.6rem;
  border-left: 3px solid #c4a15a;
  background: #efe6d4;
  font-size: 0.95rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.src-attribution {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  line-height: 1.35;
  opacity: 0.8;
}

.src-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: #1c1915;
  font-size: 0.9rem;
  text-underline-offset: 0.15em;
  overflow-wrap: anywhere;
}

.asof {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.7;
}

.ask-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
  position: sticky;
  bottom: 0;
  padding-top: 0.5rem;
  background: #f6f1e7;
}

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

.ask-input {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 2px solid #1c1915;
  border-radius: 0.65rem;
  background: #fffdf8;
  color: #1c1915;
  font: inherit;
  font-size: 1.125rem;
  line-height: 1.4;
  resize: vertical;
  min-height: 5.5rem;
}

.ask-input::placeholder {
  color: #1c1915;
  opacity: 0.45;
}

.ask-input:focus {
  outline: 3px solid #1c1915;
  outline-offset: 2px;
}

.ask-btn {
  width: 100%;
  padding: 0.95rem 1.25rem;
  border: none;
  border-radius: 0.65rem;
  background: #1c1915;
  color: #f6f1e7;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
}

.ask-btn:hover:not(:disabled) {
  background: #2e2a24;
}

.ask-btn:focus-visible {
  outline: 3px solid #1c1915;
  outline-offset: 3px;
}

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

.voice {
  align-self: center;
  width: 100%;
  display: flex;
  justify-content: center;
  min-height: 8rem;
}

#voice .dg-orb-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

#voice .dg-orb-view canvas {
  cursor: pointer;
  filter: sepia(1) saturate(2.4) hue-rotate(8deg) brightness(0.9) contrast(1.12);
}

#voice .dg-orb-view__status {
  color: #1c1915;
  min-height: 1.25rem;
  font-size: 1rem;
}

#voice .dg-orb-view .dg-btn {
  min-width: 7.5rem;
  margin: 0;
  padding: 0.7rem 1.4rem;
  border: 2px solid #1c1915;
  border-radius: 999px;
  background: #1c1915;
  color: #f6f1e7;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

#voice .dg-orb-view .dg-btn:hover:not(:disabled) {
  background: #2e2a24;
}

#voice .dg-orb-view .dg-btn:focus-visible {
  outline: 3px solid #1c1915;
  outline-offset: 3px;
}

#voice .dg-orb-view .dg-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.talk-btn {
  min-width: 9rem;
  padding: 1rem 1.75rem;
  border: 2px solid #1c1915;
  border-radius: 9999px;
  background: #1c1915;
  color: #f6f1e7;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
}

.talk-btn:hover:not(:disabled) {
  background: #2e2a24;
}

.talk-btn:focus-visible {
  outline: 3px solid #1c1915;
  outline-offset: 3px;
}

.talk-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (prefers-reduced-motion: reduce) {
  .pending-dots span {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .rv {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .src-card {
    transition: none;
  }
}

@media (min-width: 480px) {
  .screen {
    padding: 2rem 1.75rem 2.5rem;
  }

  .ask-btn {
    width: auto;
    align-self: flex-end;
    min-width: 8rem;
  }
}
