html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background: #f6f8fb;
}

body.rbv-layout-minimal {
  margin-bottom: 0;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* RBV chat UI */
.card {
  border-radius: 16px;
}

.rbv-chat-thread {
  height: 55vh;
  overflow-y: auto;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
}

.rbv-msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.rbv-msg.rbv-user {
  align-items: flex-end;
}

.rbv-msg.rbv-assistant {
  align-items: flex-start;
}

.rbv-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  line-height: 1.35;
}

.rbv-user .rbv-bubble {
  background: #0d6efd;
  color: #fff;
}

.rbv-assistant .rbv-bubble {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.rbv-sources {
  max-width: 88%;
  margin-top: 4px;
  font-size: 0.75rem;
  color: #6c757d;
}

.rbv-grounding {
  max-width: 88%;
  margin-top: 6px;
  font-size: 0.78rem;
  color: #6c757d;
}

.rbv-source-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rbv-source-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(13, 110, 253, 0.25);
  background: rgba(13, 110, 253, 0.08);
  color: #0d6efd;
  text-decoration: none;
}

.rbv-source-chip:hover {
  background: rgba(13, 110, 253, 0.14);
  text-decoration: none;
}

/* Markdown typography in assistant bubbles */
.rbv-md p { margin: 0 0 0.75rem 0; }
.rbv-md p:last-child { margin-bottom: 0; }
.rbv-md h1, .rbv-md h2, .rbv-md h3 { margin: 0.75rem 0 0.5rem 0; }
.rbv-md ul, .rbv-md ol { padding-left: 1.2rem; margin-bottom: 0.75rem; }
.rbv-md hr { border-top: 1px solid rgba(0,0,0,0.08); margin: 0.75rem 0; }
.rbv-md code { background: rgba(0,0,0,0.05); padding: 0.1rem 0.25rem; border-radius: 6px; }
.rbv-md pre { background: rgba(0,0,0,0.05); padding: 0.75rem; border-radius: 12px; overflow: auto; }

/* Auth (login) */
.rbv-auth-page {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
}

.rbv-auth-card {
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.10);
}

.rbv-auth-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, #0d6efd, #6f42c1);
}

/* Avatar page */
.rbv-avatar-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b1220;
  background-size: cover;
  background-position: center;
  border-radius: 16px;
  overflow: hidden;
}

.rbv-avatar-video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: transparent;
}

.rbv-avatar-idle {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 1;
  pointer-events: none;
  z-index: 0;
}

/* When live video is present, keep the idle layer available as a backdrop only. */
.rbv-avatar-video-wrap.rbv-live .rbv-avatar-idle {
  opacity: 1;
}

.rbv-avatar-transcript {
  min-height: 52vh;
}

.rbv-ptt.active {
  filter: brightness(0.95);
}