:root { --ra-z: 12000; }

#raDim {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 23, 0.08);
  opacity: 0;
  pointer-events: none;
  z-index: var(--ra-z);
  transition: opacity .18s ease;
}
#raDim.show { opacity: 1; }

#raSpot {
  position: fixed;
  border: 2px solid rgba(56, 189, 248, .95);
  border-radius: 14px;
  box-shadow: 0 0 18px rgba(56, 189, 248, .8);
  opacity: 0;
  pointer-events: none;
  z-index: calc(var(--ra-z) + 1);
  transition: all .28s cubic-bezier(.22, 1, .36, 1);
}

#raRobot {
  position: fixed;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 2px solid rgba(125, 211, 252, .72);
  background: radial-gradient(circle at 32% 22%, rgba(56, 189, 248, .28), rgba(30, 64, 175, .30));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .46), 0 0 20px rgba(59, 130, 246, .4);
  display: none;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
  cursor: grab;
  z-index: calc(var(--ra-z) + 3);
  transform: translate(24px, 24px);
  transition: transform .33s cubic-bezier(.22, 1, .36, 1), width .18s ease, height .18s ease;
}
#raRobot.mini { width: 60px; height: 60px; }
#raRobot.drag { cursor: grabbing; transition: none; }
#raRobot .ra-robot-anim,
#raRobot .ra-robot-fallback {
  width: 92%;
  height: 92%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#raRobot .ra-robot-anim {
  pointer-events: none;
}
#raRobot .ra-robot-fallback {
  font-size: 30px;
  line-height: 1;
}

#raTutorial {
  position: fixed;
  z-index: calc(var(--ra-z) + 4);
  width: min(448px, calc(100vw - 12px));
  border-radius: 13px;
  border: 1px solid rgba(125, 211, 252, .42);
  background: rgba(15, 23, 42, .96);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .5);
  padding: 8px 9px;
  display: none;
  opacity: 0;
  transform: translate(-1200px, -1200px);
  transition: opacity .15s ease;
}
#raTutorial.open { display: block; opacity: 1; }
#raTutorial .ra-head {
  color: #67e8f9;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 3px;
}
#raTutorial .ra-title {
  color: #f8fafc;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
}
#raTutorial .ra-text {
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.45;
}
#raTutorial .ra-note {
  margin-top: 6px;
  color: #fdba74;
  border: 1px dashed rgba(251, 146, 60, .45);
  border-radius: 8px;
  background: rgba(124, 45, 18, .16);
  padding: 6px 7px;
  font-size: 11px;
  line-height: 1.35;
}
#raTutorial .ra-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ra-btn {
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.ra-btn-dark { background: #334155; color: #e2e8f0; }
.ra-btn-main { background: linear-gradient(135deg, #2563eb, #38bdf8); color: #fff; }

#raMood {
  position: fixed;
  z-index: calc(var(--ra-z) + 4);
  max-width: min(320px, calc(100vw - 12px));
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, .34);
  background: rgba(15, 23, 42, .95);
  color: #e2e8f0;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .42);
  display: none;
}
#raMood.mood-thinking { border-color: rgba(125, 211, 252, .75); color: #bae6fd; }
#raMood.mood-happy { border-color: rgba(74, 222, 128, .75); color: #bbf7d0; }
#raMood.mood-panic { border-color: rgba(251, 191, 36, .75); color: #fde68a; }

#raHelper {
  position: fixed;
  right: 10px;
  top: 140px;
  width: 390px;
  height: 230px;
  min-width: 260px;
  min-height: 150px;
  max-width: 78vw;
  max-height: 70vh;
  resize: both;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(125, 211, 252, .36);
  background: rgba(15, 23, 42, .96);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .44);
  z-index: calc(var(--ra-z) + 5);
  display: none;
}
#raHelper .ra-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, .2);
  background: rgba(2, 6, 23, .28);
  position: sticky;
  top: 0;
}
#raHelper .ra-ttl {
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
#raHelper .ra-body { padding: 10px 12px 12px; }
#raHelperSummary { color: #f8fafc; font-weight: 700; margin-bottom: 8px; font-size: 14px; }
#raHelperList { margin: 0; padding-left: 18px; color: #cbd5e1; font-size: 13px; line-height: 1.45; }
#raHelperList li { margin-bottom: 6px; }
#raHelperList li.ra-err { color: #fca5a5; }
#raHelperList li.ra-warn { color: #fde68a; }
#raHelperList li.ra-info { color: #bae6fd; }

#raToast {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: calc(var(--ra-z) + 6);
  background: rgba(15, 23, 42, .98);
  border: 1px solid rgba(125, 211, 252, .42);
  color: #dbeafe;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .42);
  opacity: 0;
  transition: opacity .14s ease;
  pointer-events: none;
}
#raToast.show { opacity: 1; }

.ra-target {
  outline: 3px solid rgba(56, 189, 248, .88) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 20px rgba(56, 189, 248, .85) !important;
}

#raRobot.mood-thinking { animation: raThinking .85s ease-in-out 2; }
#raRobot.mood-happy { animation: raHappy .50s ease-in-out 2; }
#raRobot.mood-panic { animation: raPanic .22s linear 4; }

@keyframes raThinking {
  0%, 100% { transform: translate(var(--tx, 0), var(--ty, 0)); }
  50% { transform: translate(var(--tx, 0), calc(var(--ty, 0) - 4px)); }
}
@keyframes raHappy {
  0%, 100% { transform: translate(var(--tx, 0), var(--ty, 0)); }
  50% { transform: translate(var(--tx, 0), calc(var(--ty, 0) - 6px)); }
}
@keyframes raPanic {
  0% { transform: translate(var(--tx, 0), var(--ty, 0)); }
  50% { transform: translate(calc(var(--tx, 0) + 2px), calc(var(--ty, 0) - 2px)); }
  100% { transform: translate(var(--tx, 0), var(--ty, 0)); }
}

@media (max-width: 780px) {
  #raHelper {
    right: 6px;
    left: 6px;
    width: auto;
    height: 210px;
    min-width: 0;
    max-width: none;
  }
  #raTutorial { width: calc(100vw - 10px); }
}
