/* River One website explainer (Rivu the robot) */

/* Launch button on the home hero */
.explainer-launch {
  position: relative;
  gap: 10px;
  background: linear-gradient(135deg, #12332A, #0F7B5C);
  color: #fff !important;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(15, 123, 92, .28);
  overflow: hidden;
}
.explainer-launch:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(15, 123, 92, .36); }
.explainer-launch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: rx-shine 3.2s ease-in-out infinite;
}
.explainer-launch-bot {
  width: 30px;
  height: 30px;
  margin: -6px 0 -6px -8px;
  flex: none;
  animation: rx-bob 2.4s ease-in-out infinite;
}
.explainer-launch-bot svg { width: 100%; height: 100%; display: block; }
.explainer-launch-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 2px 8px;
}
@keyframes rx-shine { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

/* Robot parts */
.rx-r-line { stroke: #0F7B5C; stroke-width: 4; stroke-linecap: round; }
.rx-r-bulb { fill: #FF9933; animation: rx-glow 1.6s ease-in-out infinite; transform-origin: 60px 8px; }
.rx-r-ear { fill: #0F7B5C; }
.rx-r-head { fill: #FFFFFF; stroke: #0F7B5C; stroke-width: 4; }
.rx-r-face { fill: #12332A; }
.rx-r-eye { fill: #4ADEB0; transform-box: fill-box; transform-origin: center; animation: rx-blink 4.6s infinite; }
.rx-r-cheek { fill: #FF8FA3; opacity: .55; }
.rx-r-mouth { fill: #4ADEB0; transform-box: fill-box; transform-origin: center; }
.rx-r-arm { fill: none; stroke: #0F7B5C; stroke-width: 7; stroke-linecap: round; }
.rx-r-hand { fill: #B8893F; }
.rx-r-body { fill: #0F7B5C; }
.rx-r-badge { fill: #FFFFFF; }
.rx-r-badge-t { fill: #0F7B5C; font: 700 15px/1 Manrope, system-ui, sans-serif; }
.rx-r-wave { transform-box: fill-box; transform-origin: 0% 100%; }

@keyframes rx-glow { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.82); } }
@keyframes rx-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes rx-talk { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(.8, 2.4); } 60% { transform: scale(1.1, 1.4); } }
@keyframes rx-wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-22deg); } 75% { transform: rotate(16deg); } }
@keyframes rx-wink { 0%, 100% { transform: scaleY(1); } 40%, 60% { transform: scaleY(.12); } }
@keyframes rx-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* Panel */
.rx-panel {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483002;
  width: min(420px, calc(100vw - 40px));
  display: flex;
  align-items: flex-end;
  gap: 4px;
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ro-ink, #1A2621);
  opacity: 0;
  transform: translateY(24px) scale(.96);
  transition: opacity .35s ease, transform .35s cubic-bezier(.2, .9, .3, 1.2);
}
.rx-panel.is-in { opacity: 1; transform: none; }
.rx-robot {
  flex: none;
  width: 92px;
  height: 115px;
  padding: 0;
  border: 0;
  background: none;
  cursor: default;
  filter: drop-shadow(0 8px 14px rgba(15, 60, 45, .25));
  animation: rx-bob 2.6s ease-in-out infinite;
}
.rx-robot svg { width: 100%; height: 100%; display: block; }
.rx-panel.is-talking .rx-r-mouth { animation: rx-talk .32s ease-in-out infinite; }
.rx-panel.mood-wave .rx-r-wave { animation: rx-wave .7s ease-in-out 3; }
.rx-panel.mood-wink .rx-r-eye-r { animation: rx-wink .9s ease-in-out 1; }
.rx-panel.is-paused .rx-robot { animation-play-state: paused; }
.rx-panel.is-paused .rx-r-bulb { fill: #9AA5A0; animation: none; }

.rx-body {
  position: relative;
  flex: 1;
  min-width: 0;
  background: var(--ro-paper, #fff);
  border: 1px solid var(--ro-line, #E6E1D5);
  border-radius: 20px 20px 20px 6px;
  box-shadow: 0 18px 50px rgba(15, 40, 30, .22), 0 2px 6px rgba(15, 40, 30, .08);
  padding: 12px 14px 12px;
}
.rx-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rx-chapter {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ro-primary, #0F7B5C);
  background: var(--ro-primary-soft, #E8F3ED);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}
.rx-count { font-size: 12px; color: var(--ro-muted, #6E7872); margin-right: auto; font-variant-numeric: tabular-nums; }
.rx-icon-btn {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ro-muted, #6E7872);
  cursor: pointer;
}
.rx-icon-btn:hover { background: var(--ro-cream, #F9F7F2); color: var(--ro-ink, #1A2621); }

.rx-bubble { min-height: 84px; max-height: 34vh; overflow-y: auto; }
.rx-text { margin: 0; font-size: 15px; line-height: 1.55; }
.rx-text a { color: var(--ro-primary, #0F7B5C); font-weight: 700; }

.rx-progress { height: 4px; border-radius: 4px; background: var(--ro-cream-deep, #F1EDE3); margin: 10px 0 10px; overflow: hidden; }
.rx-progress span { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #FF9933, #0F7B5C); transition: width .4s ease; }

.rx-controls { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.rx-ctl {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--ro-line, #E6E1D5);
  border-radius: 12px;
  background: var(--ro-paper, #fff);
  color: var(--ro-ink, #1A2621);
  font-size: 16px;
  cursor: pointer;
  transition: background .15s, transform .15s, border-color .15s;
}
.rx-ctl:hover { background: var(--ro-cream, #F9F7F2); border-color: var(--ro-ink-soft, #3F4A42); }
.rx-ctl:active { transform: scale(.94); }
.rx-ctl-main { width: 52px; height: 52px; border-radius: 50%; background: var(--ro-primary, #0F7B5C); border-color: var(--ro-primary, #0F7B5C); color: #fff; font-size: 22px; }
.rx-ctl-main:hover { background: var(--ro-primary-hover, #0B5F47); border-color: var(--ro-primary-hover, #0B5F47); }
.rx-ctl.is-off { color: var(--ro-danger, #B42318); }
.rx-ctl:focus-visible, .rx-icon-btn:focus-visible, .rx-menu button:focus-visible { outline: 3px solid #FF9933; outline-offset: 2px; }

.rx-menu {
  position: absolute;
  right: 10px;
  bottom: calc(100% + 8px);
  width: 240px;
  max-height: min(60vh, 440px);
  overflow-y: auto;
  background: var(--ro-paper, #fff);
  border: 1px solid var(--ro-line, #E6E1D5);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 40, 30, .2);
  padding: 6px;
}
.rx-menu[hidden] { display: none; }
.rx-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  font: 600 14px/1.3 inherit;
  font-family: inherit;
  color: var(--ro-ink, #1A2621);
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
}
.rx-menu button span {
  width: 22px;
  height: 22px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ro-cream-deep, #F1EDE3);
  font-size: 11px;
}
.rx-menu button:hover { background: var(--ro-cream, #F9F7F2); }
.rx-menu button.is-current { background: var(--ro-primary-soft, #E8F3ED); color: var(--ro-primary, #0F7B5C); }
.rx-menu button.is-current span { background: var(--ro-primary, #0F7B5C); color: #fff; }

.rx-toast {
  margin-top: 8px;
  font-size: 12.5px;
  background: var(--ro-gold-soft, #FBF2E0);
  color: var(--ro-ink, #1A2621);
  border-radius: 10px;
  padding: 7px 10px;
}
.rx-toast[hidden] { display: none; }

/* Minimised: only the robot stays, tap to bring the panel back */
.rx-panel.is-min { width: auto; }
.rx-panel.is-min .rx-body { display: none; }
.rx-panel.is-min .rx-robot { cursor: pointer; }
.rx-panel.is-min .rx-robot::after {
  content: "Tap me";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font: 700 11px/1 Manrope, system-ui, sans-serif;
  color: #fff;
  background: var(--ro-primary, #0F7B5C);
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}
.rx-panel:not(.is-min) .rx-robot { pointer-events: none; }

/* Spotlight */
.rx-spot {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2147483001;
  border-radius: 16px;
  border: 3px solid #FF9933;
  box-shadow: 0 0 0 200vmax rgba(12, 24, 19, .38), 0 0 0 6px rgba(255, 153, 51, .25);
  pointer-events: none;
  transition: width .35s ease, height .35s ease, transform .35s ease;
  animation: rx-ring 1.8s ease-in-out infinite;
}
.rx-spot[hidden] { display: none; }
.rx-spot.is-over-panel { z-index: 2147483003; box-shadow: 0 0 0 6px rgba(255, 153, 51, .3); }
@keyframes rx-ring { 0%, 100% { border-color: #FF9933; } 50% { border-color: #0F7B5C; } }

/* Panel actions: Continue / Sign out buttons and the waiting note */
.rx-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.rx-actions[hidden] { display: none; }
.rx-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--ro-primary, #0F7B5C);
  color: #fff;
  font: 700 14px/1 Manrope, system-ui, sans-serif;
  padding: 11px 20px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 123, 92, .3);
  animation: rx-cta-pulse 1.6s ease-in-out infinite;
}
.rx-cta:hover { background: var(--ro-primary-hover, #0B5F47); }
.rx-cta:focus-visible { outline: 3px solid #FF9933; outline-offset: 2px; }
.rx-cta-alt { background: #fff; color: var(--ro-primary, #0F7B5C); box-shadow: inset 0 0 0 2px var(--ro-primary, #0F7B5C); animation: none; }
.rx-cta-alt:hover { background: var(--ro-primary-soft, #E6F4EF); }
@keyframes rx-cta-pulse { 0%, 100% { box-shadow: 0 6px 18px rgba(15, 123, 92, .3); } 50% { box-shadow: 0 0 0 7px rgba(15, 123, 92, .18); } }
.rx-wait { font-size: 13px; font-weight: 600; color: #8A5A12; background: var(--ro-gold-soft, #FBF2E0); border-radius: 10px; padding: 7px 10px; }

/* Fields the robot is typing into on real pages */
.rx-typing { border-color: #FF9933 !important; box-shadow: 0 0 0 3px rgba(255, 153, 51, .25) !important; }

/* App: read-only Demo Clinic notice */
.rx-demo-banner { font-size: .9rem; }

/* Confetti */
.rx-confetti { position: fixed; inset: 0; z-index: 2147483004; pointer-events: none; overflow: hidden; }
.rx-confetti i {
  position: absolute;
  top: -20px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: rx-fall linear forwards;
}
.rx-confetti i:nth-child(3n) { width: 7px; height: 7px; border-radius: 50%; }
@keyframes rx-fall { to { transform: translate(var(--rx-drift, 0), 105vh) rotate(720deg); opacity: .8; } }

@media (max-width: 640px) {
  .rx-panel { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: auto; }
  .rx-panel.is-min { left: auto; }
  .rx-robot { width: 62px; height: 78px; margin-right: -6px; }
  .rx-body { padding: 10px 10px 10px 12px; }
  .rx-bubble { min-height: 66px; max-height: 26vh; }
  .rx-text { font-size: 14px; }
  .rx-ctl { width: 36px; height: 36px; font-size: 15px; }
  .rx-ctl-main { width: 46px; height: 46px; font-size: 20px; }
  .rx-menu { width: auto; left: 0; right: 0; }
}

@media (max-width: 360px) {
  .rx-robot { display: none; }
  .rx-panel.is-min .rx-robot { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .rx-panel, .rx-robot, .rx-r-bulb, .rx-r-eye, .explainer-launch-bot, .explainer-launch::after, .rx-spot, .rx-cta { animation: none !important; transition: none !important; }
}
