:root {
  --vvh: 100dvh;
}

.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 6px 8px 0;
}

.empty-state {
  height: 100%;
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 12px;
}

.empty-state strong {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  color: #26231f;
  margin-bottom: 10px;
}

.empty-state span {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.65;
  max-width: 28em;
  display: inline-block;
  color: #5f594f;
}

.userbubble {
  width: auto;
  max-width: var(--measure-teacher);
  margin: 0 0 22px 62px;
  background: transparent;
  border: 0;
  border-left: 2px solid rgba(142, 94, 36, 0.45);
  border-radius: var(--radius-square);
  padding: 2px 4px 4px 14px;
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--ink-secondary);
}

.userbubble .turn-text {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.teacher-wrap {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 12px;
  margin: 0 0 28px;
}

.portrait-mark {
  width: 47px;
  height: 47px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e7ddd0 url("/assets/epictetus-bust.png?v=1") center 42% / 112% auto no-repeat;
  border: 1px solid #8c7454;
  box-shadow: 0 1px 4px rgba(39, 31, 22, 0.22);
}

.teacherbubble {
  border: 0;
  border-radius: var(--radius-square);
  padding: 0;
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.7;
  background: transparent;
  color: var(--ink);
  max-width: var(--measure-teacher);
  overflow-wrap: anywhere;
}

.teacherbubble .reply-text {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.teacherbubble.is-waiting .reply-text {
  color: var(--muted);
  font-style: italic;
}

.sources {
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.45;
  color: #5b5750;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #e6dfd2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.sources:has(.source-list:empty) {
  display: none;
}

.source-list {
  flex: 1 1 16em;
  min-width: 0;
  overflow-wrap: anywhere;
}

.source-list.is-unavailable,
.source-list.is-nomatch {
  color: var(--muted);
}

.source-list a {
  text-decoration: underline;
  text-underline-offset: 3px;
  color: #5b4a32;
}

.source-list a:hover {
  color: #111;
}

.source-actions {
  margin-left: auto;
}

.icon-button {
  min-width: var(--target-essential);
  min-height: var(--target-essential);
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: #5b5750;
}

.compose {
  min-height: 56px;
  height: auto;
  border: 1px solid rgba(132, 104, 68, 0.55);
  border-radius: var(--radius-control);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  background: #fbf8f2;
  flex: 0 0 auto;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.compose:focus-within {
  border-color: #a47a42;
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(142, 94, 36, 0.16), inset 0 0 0 1px rgba(142, 94, 36, 0.12);
}

.compose.is-busy {
  opacity: 0.72;
}

.compose textarea,
.compose input {
  flex: 1;
  min-width: 0;
  min-height: var(--target-essential);
  max-height: 140px;
  height: auto;
  border: 0;
  outline: 0;
  box-shadow: none;
  padding: 8px 0;
  background: transparent;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  resize: none;
  overflow-y: auto;
}

.compose textarea::placeholder,
.compose input::placeholder {
  color: #777067;
}

.compose button {
  width: var(--target-essential);
  height: var(--target-essential);
  flex: 0 0 var(--target-essential);
  display: grid;
  place-items: center;
  border: 1px solid #24211d;
  border-radius: var(--radius-control);
  background: var(--charcoal);
  color: #f7ead4;
  cursor: pointer;
}

.compose button:disabled {
  opacity: 0.45;
  cursor: default;
}

.compose button:hover {
  background: #25221d;
  color: #fff1d9;
}

.compose button:focus-visible {
  outline: 2px solid #c99952;
  outline-offset: 2px;
  box-shadow: 0 0 0 1px #f7f1e6;
}

.send-arrow {
  width: 18px;
  height: 18px;
  display: block;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.classroom-status {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  min-height: 18px;
  flex: 0 0 auto;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .empty-state strong {
    font-size: 24px;
  }

  .empty-state span {
    font-size: 15px;
  }

  .userbubble {
    margin-left: 48px;
    max-width: none;
    font-size: 16px;
  }

  .teacher-wrap {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .portrait-mark {
    width: 36px;
    height: 36px;
  }

  .teacherbubble {
    font-size: 16.5px;
  }

  .compose textarea,
  .compose input {
    font-size: 16px;
  }

  .compose button {
    width: var(--target-essential);
    height: var(--target-essential);
    flex-basis: var(--target-essential);
  }
}

@media (prefers-reduced-motion: reduce) {
  .compose {
    transition: none;
  }
}

/* Move 2 — the discreet Library bubble. A quiet, optional "from the Library →"
   line under a voice-led reply; shown only when a related passage exists, so the
   default conversation stays citation-free. Shared by index.html and session.html. */
.library-hint{display:block;margin-top:7px;font-size:12.5px;font-family:var(--serif);color:var(--muted);letter-spacing:.01em}
.library-hint a{color:inherit;text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px}
.library-hint a:hover{color:var(--bronze)}
