/* Ustaad-X v0.13.0: optional OpenAI Realtime live tutor. */
.v13-live-tutor {
  margin: 0 1rem 1rem;
  padding: 1rem;
  border: 1px solid rgba(13, 118, 110, 0.22);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(13, 118, 110, 0.08), rgba(255, 255, 255, 0.96));
}

.v13-live-heading,
.v13-live-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.v13-live-heading {
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.v13-live-heading small {
  display: block;
  color: var(--muted, #5d6b68);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.v13-live-heading h3 {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
}

.v13-live-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #eef2f1;
  color: #34433f;
  font-size: 0.82rem;
  font-weight: 750;
}

.v13-live-status::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #788581;
}

.v13-live-status[data-state="ready"]::before,
.v13-live-status[data-state="connected"]::before {
  background: #16845f;
}

.v13-live-status[data-state="listening"]::before {
  background: #1478a8;
  box-shadow: 0 0 0 5px rgba(20, 120, 168, 0.13);
}

.v13-live-status[data-state="thinking"]::before,
.v13-live-status[data-state="speaking"]::before {
  background: #b57900;
}

.v13-live-status[data-state="error"]::before {
  background: #b42318;
}

.v13-live-disclosure {
  margin: 0.4rem 0 0.85rem;
  color: #3d4d49;
  line-height: 1.45;
}

.v13-live-controls {
  align-items: center;
}

.v13-live-limit {
  margin-left: auto;
  color: var(--muted, #5d6b68);
  font-size: 0.82rem;
}

.v13-live-captions {
  margin-top: 0.9rem;
  padding: 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(13, 118, 110, 0.14);
}

.v13-live-captions > div:not(.v13-live-history) {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) 1fr;
  gap: 0.7rem;
  padding: 0.3rem 0;
}

.v13-live-captions strong {
  color: #0d665f;
}

.v13-live-history {
  max-height: 12rem;
  margin-top: 0.55rem;
  overflow: auto;
  border-top: 1px solid rgba(13, 118, 110, 0.12);
}

.v13-live-history p {
  margin: 0;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(13, 118, 110, 0.08);
  line-height: 1.4;
}

.v13-live-history b {
  margin-right: 0.4rem;
}

.v13-live-tutor[data-unavailable="true"] {
  background: #f5f7f6;
  border-color: #d8dfdc;
}

@media (max-width: 720px) {
  .v13-live-tutor {
    margin-inline: 0.55rem;
    padding: 0.85rem;
  }

  .v13-live-controls .button {
    flex: 1 1 10rem;
  }

  .v13-live-limit {
    flex-basis: 100%;
    margin-left: 0;
  }
}
