/* Robot Muse — self-contained popup for digitalrobot.world */
#rmRoot, #rmRoot * { box-sizing: border-box; }
#rmRoot { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }

.rm-fab {
  position: fixed;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 48px;
  padding: 0 15px 0 6px;
  border: 1px solid rgba(212, 175, 55, .48);
  border-radius: 999px;
  background: linear-gradient(135deg, #1b1a20 0%, #09090d 100%);
  color: #f5e8b8;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .32), 0 0 0 1px rgba(255, 255, 255, .04) inset;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.rm-fab:hover { transform: translateY(-2px); border-color: rgba(240, 214, 138, .8); box-shadow: 0 18px 44px rgba(0, 0, 0, .4); }
.rm-fab:active { transform: translateY(0) scale(.98); }
.rm-fab:focus-visible { outline: 2px solid #f0d68a; outline-offset: 3px; }
.rm-fab-icon {
  width: 36px; height: 36px; flex: 0 0 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 24%, #f6e2a5 0%, #d4af37 44%, #6f4a16 100%);
  color: #171207;
  font-size: 19px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .24) inset;
}
.rm-fab-label { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.rm-fab-label b { font-size: 13px; letter-spacing: .2px; font-weight: 700; }
.rm-fab-label small { margin-top: 3px; font-size: 9px; color: #aa9f83; letter-spacing: .5px; }
.rm-fab[aria-expanded="true"] { border-color: #f0d68a; }

.rm-overlay {
  position: fixed; inset: 0; z-index: 2147483001;
  background: rgba(2, 2, 6, .72);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.rm-overlay.open { opacity: 1; pointer-events: auto; }

.rm-panel {
  position: fixed; top: 50%; left: 50%;
  z-index: 2147483002;
  width: min(560px, calc(100vw - 32px));
  height: min(86vh, 920px);
  max-height: 920px;
  transform: translate(-50%, -50%) scale(.96);
  display: flex; flex-direction: column;
  overflow: hidden;
  color: #f2efe7;
  background: #08080c;
  border: 1px solid rgba(212, 175, 55, .26);
  border-radius: 20px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .03) inset;
  opacity: 0; pointer-events: none;
  transition: opacity .24s ease, transform .3s cubic-bezier(.22, 1, .36, 1);
}
.rm-panel.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.rm-panel::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 214, 138, .65), transparent);
  pointer-events: none; z-index: 3;
}

.rm-head {
  flex: 0 0 auto;
  padding: 15px 17px 12px;
  background: linear-gradient(180deg, #111117 0%, #0b0b10 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.rm-head-top { display: flex; align-items: flex-start; gap: 10px; }
.rm-avatar {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 28% 22%, #ffe7a1 0%, #d4af37 46%, #674714 100%);
  color: #0e0c08; font-size: 20px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .2) inset, 0 4px 14px rgba(212, 175, 55, .18);
}
.rm-head-info { flex: 1 1 auto; min-width: 0; }
.rm-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.rm-title { margin: 0; font-size: 14px; line-height: 1.25; font-weight: 700; letter-spacing: .1px; color: #f7f1df; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.rm-badge { flex: 0 0 auto; padding: 2px 6px; border-radius: 6px; background: #ecdfb1; color: #1c170d; font-size: 9px; line-height: 1.35; font-weight: 800; letter-spacing: .2px; }
.rm-sub { margin: 4px 0 0; font-size: 11px; line-height: 1.35; color: #a19a8b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-head-actions { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; margin: -3px -5px 0 0; }
.rm-icon-btn {
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: #b3a991; font-size: 17px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .18s ease, color .18s ease;
}
.rm-icon-btn:hover { background: rgba(212, 175, 55, .12); color: #f0d68a; }
.rm-icon-btn:focus-visible { outline: 2px solid #d4af37; outline-offset: 1px; }
.rm-status {
  display: flex; align-items: center; gap: 6px;
  margin-top: 9px; font-size: 10px; color: #a39b89; letter-spacing: .15px;
}
.rm-status-dot {
  width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%;
  background: #66d18a; box-shadow: 0 0 7px rgba(102, 209, 138, .6);
}
.rm-status-sep { color: #45423b; margin: 0 1px; }

.rm-msgs {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 17px 15px 12px;
  display: flex; flex-direction: column; gap: 11px;
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, .075) 0%, transparent 42%),
    linear-gradient(180deg, #08080c 0%, #060609 100%);
  overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #2b2a33 transparent;
}
.rm-msgs::-webkit-scrollbar { width: 4px; }
.rm-msgs::-webkit-scrollbar-thumb { background: #2b2a33; border-radius: 4px; }

.rm-msg { display: flex; width: 100%; }
.rm-msg.user { justify-content: flex-end; }
.rm-bubble {
  position: relative;
  max-width: 93%;
  padding: 11px 13px;
  border-radius: 15px;
  font-size: 13.5px; line-height: 1.72;
  overflow-wrap: anywhere; word-break: break-word;
}
.rm-msg.assistant .rm-bubble {
  max-width: 97%;
  background: #101015;
  border: 1px solid rgba(255, 255, 255, .065);
  color: #ddd9cf;
  border-top-left-radius: 6px;
}
.rm-msg.user .rm-bubble {
  max-width: 86%;
  color: #241b0b;
  background: linear-gradient(135deg, #e8ca6b 0%, #d4af37 100%);
  border: 1px solid rgba(255, 245, 196, .38);
  border-top-right-radius: 6px;
  font-weight: 500;
}
.rm-bubble p { margin: 0 0 7px; }
.rm-bubble p:last-child { margin-bottom: 0; }
.rm-bubble strong { color: #f3e8bd; font-weight: 700; }
.rm-bubble h3, .rm-bubble h4 { margin: 14px 0 6px; color: #f3e8bd; font-size: 13.5px; line-height: 1.4; }
.rm-bubble h3:first-child, .rm-bubble h4:first-child { margin-top: 0; }
.rm-bubble ul, .rm-bubble ol { margin: 7px 0; padding-left: 19px; }
.rm-bubble li { margin: 3px 0; }
.rm-bubble code { padding: 1px 4px; border-radius: 4px; background: rgba(212, 175, 55, .11); color: #eedb9d; font-size: 12px; }
.rm-bubble blockquote { margin: 8px 0; padding: 6px 10px; border-left: 2px solid #d4af37; background: rgba(212, 175, 55, .07); color: #d8cfba; }
.rm-bubble table { width: 100%; margin: 8px 0; border-collapse: collapse; font-size: 11.5px; display: block; overflow-x: auto; }
.rm-bubble th, .rm-bubble td { padding: 5px 6px; border-bottom: 1px solid rgba(255, 255, 255, .07); text-align: left; white-space: nowrap; }
.rm-bubble th { color: #e6d49e; background: rgba(212, 175, 55, .1); }
.rm-bubble a { color: #e4c973; text-decoration: underline; text-underline-offset: 2px; }

.rm-welcome .rm-bubble {
  width: 100%; max-width: 100%; padding: 17px 16px 13px;
  background: linear-gradient(180deg, #101016 0%, #0b0b10 100%);
  border: 1px solid rgba(212, 175, 55, .16);
  border-radius: 16px;
  color: #d7d2c7;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .16);
}
.rm-welcome-head { margin-bottom: 9px; font-size: 14.5px; font-weight: 700; color: #f5eedb; }
.rm-welcome-body { font-size: 13px; line-height: 1.7; text-wrap: pretty; }
.rm-welcome-body p { margin: 0 0 8px; }
.rm-welcome-body .rm-list { margin: 8px 0 0; padding-left: 17px; color: #c4bfb4; }
.rm-welcome-body .rm-list li { margin: 3px 0; }
.rm-list-label { margin: 10px 0 0; color: #a79c81; font-size: 10.5px; letter-spacing: .2px; }
.rm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.rm-chip {
  appearance: none; border: 1px solid rgba(212, 175, 55, .24);
  background: rgba(212, 175, 55, .055); color: #ddcb94;
  border-radius: 999px; padding: 6px 10px; font: inherit; font-size: 10.5px;
  line-height: 1.2; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.rm-chip:hover { background: rgba(212, 175, 55, .14); border-color: rgba(240, 214, 138, .55); }
.rm-chip:active { transform: scale(.97); }
.rm-chip:focus-visible { outline: 2px solid #d4af37; outline-offset: 1px; }

.rm-sources { margin-top: 9px; padding-top: 7px; border-top: 1px solid rgba(255, 255, 255, .07); }
.rm-sources summary { cursor: pointer; color: #948b76; font-size: 10.5px; line-height: 1.5; user-select: none; }
.rm-sources summary:hover { color: #dfc578; }
.rm-sources-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 0; padding: 0; list-style: none; max-height: 130px; overflow: auto; }
.rm-sources-list li { font-size: 10px; line-height: 1.5; color: #827c6d; }
.rm-sources-list a { color: #b7a66d; text-decoration: none; }
.rm-sources-list a:hover { color: #f0d68a; text-decoration: underline; }

.rm-copy {
  position: absolute; top: 5px; right: 6px;
  border: 0; background: transparent; color: #6c675b; cursor: pointer;
  font-size: 12px; line-height: 1; padding: 3px 4px; border-radius: 4px; opacity: 0;
  transition: opacity .18s ease, color .18s ease;
}
.rm-msg.assistant:hover .rm-copy, .rm-copy:focus-visible { opacity: 1; }
.rm-copy:hover { color: #e1c875; }

.rm-thinking .rm-bubble { display: inline-flex; align-items: center; gap: 7px; color: #bdb6a5; }
.rm-spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid rgba(212, 175, 55, .22);
  border-top-color: #d4af37;
  animation: rmSpin .8s linear infinite;
}
@keyframes rmSpin { to { transform: rotate(360deg); } }
.rm-dots span { display: inline-block; width: 3px; height: 3px; margin-left: 2px; border-radius: 50%; background: #b9a45f; animation: rmDot 1.2s infinite ease-in-out; }
.rm-dots span:nth-child(2) { animation-delay: .18s; }
.rm-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes rmDot { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-2px); } }
.rm-msg.error .rm-bubble { border-color: rgba(255, 126, 107, .25); color: #e9b3a5; background: rgba(80, 24, 19, .22); }

.rm-input {
  flex: 0 0 auto;
  padding: 10px 14px calc(15px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, .065);
  background: #09090d;
}
.rm-actions { display: flex; align-items: center; gap: 5px; margin-bottom: 7px; flex-wrap: wrap; }
.rm-act {
  appearance: none; border: 1px solid #292831; background: #111117; color: #b8ae9b;
  border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 10.5px; line-height: 1.2;
  cursor: pointer; white-space: nowrap; transition: color .18s ease, border-color .18s ease, background .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.rm-act:hover { color: #e4cf90; border-color: rgba(212, 175, 55, .4); background: rgba(212, 175, 55, .06); }
.rm-act:focus-visible { outline: 2px solid #d4af37; outline-offset: 1px; }
.rm-net { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 9.5px; color: #8d8778; white-space: nowrap; }
.rm-net i { width: 4px; height: 4px; border-radius: 50%; background: #66d18a; }
.rm-inputrow {
  display: flex; align-items: flex-end; gap: 7px;
  padding: 6px 6px 6px 11px;
  border: 1px solid #2b2a34;
  border-radius: 14px;
  background: #111117;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.rm-inputrow:focus-within { border-color: rgba(212, 175, 55, .45); box-shadow: 0 0 0 2px rgba(212, 175, 55, .06); }
#rmInput {
  display: block; flex: 1 1 auto; width: 100%; min-width: 0;
  min-height: 23px; max-height: 108px;
  padding: 5px 0; margin: 0;
  border: 0; outline: 0; resize: none;
  background: transparent; color: #eee9dd;
  font: inherit; font-size: 14px; line-height: 1.55;
  overflow-y: auto;
}
#rmInput::placeholder { color: #625f58; }
.rm-send {
  flex: 0 0 38px; width: 38px; height: 38px; padding: 0;
  border: 1px solid rgba(255, 235, 170, .32);
  border-radius: 10px;
  background: linear-gradient(135deg, #ff8a52, #ff7040);
  color: #25150b; font-size: 19px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .18s ease, opacity .18s ease, filter .18s ease;
}
.rm-send:hover { filter: brightness(1.08); transform: translateY(-1px); }
.rm-send:active { transform: scale(.96); }
.rm-send:disabled { opacity: .38; cursor: default; transform: none; filter: none; }
.rm-note { margin: 7px 2px 0; color: #7b7568; font-size: 9.5px; line-height: 1.45; text-align: center; }
.rm-error-note { color: #be7d6e; }

.rm-toast {
  position: fixed; left: 50%; bottom: 82px; z-index: 2147483004;
  transform: translateX(-50%) translateY(6px);
  padding: 7px 12px; border-radius: 999px;
  background: #17151a; border: 1px solid rgba(212, 175, 55, .3);
  color: #e9dfc3; font-size: 11px; line-height: 1.2;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap;
}
.rm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

body.rm-lock { overflow: hidden !important; }
.rm-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 768px) {
  .rm-fab { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); height: 48px; width: 48px; padding: 0; justify-content: center; }
  .rm-fab-label { display: none; }
  .rm-fab-icon { width: 38px; height: 38px; flex-basis: 38px; font-size: 20px; }
  .rm-panel {
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw; max-width: 100vw;
    height: 100vh; height: 100dvh; max-height: 100dvh;
    transform: translateY(10px);
    border-radius: 0; border: 0;
  }
  .rm-panel.open { transform: translateY(0); }
  .rm-head { padding: calc(11px + env(safe-area-inset-top)) 13px 9px; }
  .rm-title { font-size: 13px; }
  .rm-sub { font-size: 9.5px; }
  .rm-status { margin-top: 7px; font-size: 9px; }
  .rm-icon-btn { width: 36px; height: 36px; }
  .rm-msgs { padding: 13px 12px 24px; gap: 9px; }
  .rm-bubble { font-size: 13px; line-height: 1.68; }
  .rm-welcome .rm-bubble { padding: 14px 13px 12px; }
  .rm-welcome-head { font-size: 14px; }
  .rm-welcome-body { font-size: 12.5px; }
  .rm-input { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
  .rm-actions { gap: 4px; margin-bottom: 6px; }
  .rm-act { padding: 6px 8px; font-size: 10px; min-height: 32px; }
  .rm-chip { min-height: 30px; }
  .rm-net { font-size: 9px; }
  .rm-note { font-size: 10px; margin-top: 6px; }
  .rm-sources summary { font-size: 11px; }
  .rm-send { flex-basis: 42px; width: 42px; height: 42px; }
  .rm-toast { bottom: 74px; }
}

@media (max-width: 390px) {
  .rm-title-row { gap: 4px; }
  .rm-title { font-size: 12.5px; }
  .rm-badge { font-size: 8px; padding: 2px 5px; }
  .rm-sub { font-size: 9px; }
  .rm-avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 18px; }
  .rm-chip { font-size: 10px; padding: 5px 9px; }
  .rm-act { font-size: 9px; }
  .rm-net { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rm-fab, .rm-overlay, .rm-panel, .rm-chip, .rm-send, .rm-toast { transition: none !important; }
  .rm-spinner, .rm-dots span { animation: none !important; }
}
