.ra-root {
  --ra-width: 420px;
  --ra-radius: var(--radius-lg);
}
.ra-launcher {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 52px;
  padding: 0 1.1rem 0 .95rem;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-weight: 650;
  box-shadow: var(--shadow-lg);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.ra-launcher .icon { width: 1.35rem; height: 1.35rem; color: var(--gold); }
.ra-launcher:hover { background: var(--navy-700); transform: translateY(-2px); }
.ra-launcher-text { font-size: .95rem; }
.ra-panel {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 110;
  display: flex;
  flex-direction: column;
  width: min(var(--ra-width), calc(100vw - 2rem));
  max-height: min(680px, calc(100vh - 2rem));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--ra-radius);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
}
.ra-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem .75rem .75rem 1.1rem;
  background: var(--navy-grad);
  color: #fff;
}
.ra-head-text { flex: 1 1 auto; min-width: 0; }
.ra-title { margin: 0; font-weight: 700; line-height: 1.2; }
.ra-subtitle { margin: .1rem 0 0; font-size: .8rem; color: rgba(255, 255, 255, .78); }
.ra-tools { display: flex; gap: .25rem; }
.ra-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #fff;
  text-decoration: none;
  transition: background var(--dur) var(--ease);
}
.ra-tool:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.ra-tool .icon { width: 1.15rem; height: 1.15rem; }
.ra-chat { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.ra-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.ra-turn { display: flex; flex-direction: column; gap: .2rem; max-width: 92%; }
.ra-turn-user { align-self: flex-end; align-items: flex-end; }
.ra-turn-assistant { align-self: flex-start; }
.ra-who {
  margin: 0;
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.ra-bubble {
  padding: .7rem .9rem;
  border-radius: var(--radius);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: .95rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.ra-turn-user .ra-bubble {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  border-bottom-right-radius: var(--radius-sm);
}
.ra-turn-assistant .ra-bubble { border-bottom-left-radius: var(--radius-sm); }
.ra-bubble p { margin: 0 0 .55em; }
.ra-bubble p:last-child { margin-bottom: 0; }
.ra-list { margin: .2rem 0 .55rem; padding-left: 1.15rem; }
.ra-list li { margin-bottom: .25rem; }
.ra-link { color: var(--navy-700); font-weight: 600; }
.ra-turn-user .ra-link { color: #fff; }
.ra-notice {
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.ra-notice-title { margin: 0 0 .35rem; font-size: 1rem; }
.ra-notice-text { margin: 0 0 .5rem; font-size: .85rem; line-height: 1.5; color: var(--muted); }
.ra-notice-text:last-child { margin-bottom: 0; }
.ra-starters-title { margin: 0 0 .5rem; font-size: .95rem; }
.ra-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.ra-chips-answer { margin-top: -.3rem; }
.ra-chip {
  min-height: 44px;
  padding: .4rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--navy-700);
  font-size: .9rem;
  text-align: left;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.ra-chip:hover { border-color: var(--navy-700); background: var(--bg-soft); }
.ra-error {
  padding: .75rem .9rem;
  border: 1px solid var(--err);
  border-radius: var(--radius-sm);
  background: var(--err-soft);
  font-size: .9rem;
}
.ra-error p { margin: 0 0 .4rem; }
.ra-error p:last-child { margin-bottom: 0; }
.ra-typing { display: flex; gap: .3rem; padding: .5rem .2rem; }
.ra-dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--muted);
  animation: ra-blink 1.2s infinite ease-in-out;
}
.ra-dot:nth-child(2) { animation-delay: .18s; }
.ra-dot:nth-child(3) { animation-delay: .36s; }
@keyframes ra-blink {
  0%, 80%, 100% { opacity: .25; }
  40% { opacity: 1; }
}
.ra-form {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  padding: .75rem 1rem 0;
  border-top: 1px solid var(--line);
}
.ra-input {
  flex: 1 1 auto;
  min-height: 44px;
  max-height: 160px;
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  resize: none;
  font-size: 1rem;
  line-height: 1.4;
}
.ra-input:focus { border-color: var(--navy-700); outline: none; box-shadow: var(--focus); }
.ra-send {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: #fff;
  transition: background var(--dur) var(--ease);
}
.ra-send:hover:not(:disabled) { background: var(--navy-700); }
.ra-send:disabled { opacity: .45; cursor: not-allowed; }
.ra-send .icon { width: 1.2rem; height: 1.2rem; }
.ra-foot { padding: .35rem 1rem .8rem; }
.ra-counter { margin: 0; font-size: .75rem; color: var(--muted); }
.ra-counter:empty { display: none; }
.ra-disclaimer { margin: .15rem 0 0; font-size: .75rem; color: var(--muted); }
.ra-page {
  display: flex;
  flex-direction: column;
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ra-page .ra-log { max-height: 60vh; }
.ra-page-tools {
  display: flex;
  justify-content: flex-end;
  padding: .75rem 1rem 0;
}
@media (max-width: 640px) {
  .ra-panel {
    right: 0;
    bottom: 0;
    left: 0;
    top: 0;
    width: 100%;
    max-height: none;
    height: 100%;
    border: 0;
    border-radius: 0;
  }
  .ra-launcher { right: .75rem; bottom: .75rem; }
  body.ra-open { overflow: hidden; }
  body.ra-open .ra-launcher { display: none; }
  .ra-turn { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ra-launcher,
  .ra-tool,
  .ra-chip,
  .ra-send { transition: none; }
  .ra-dot { animation: none; opacity: .6; }
}
