/* DataScope Mascot — floating chat widget */
.mascot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #6ea8ff, #8b5cf6);
  box-shadow: 0 4px 20px rgba(110, 168, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  padding: 0;
}
.mascot-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(110, 168, 255, 0.55);
}
.mascot-fab.has-greeting {
  animation: mascot-bounce 2s ease-in-out 1s 3;
}

@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Mascot face SVG */
.mascot-face {
  width: 36px;
  height: 36px;
}

/* Chat panel */
.mascot-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 901;
  width: 360px;
  max-width: calc(100vw - 48px);
  max-height: 520px;
  background: #131833;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.mascot-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Panel header */
.mascot-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(22, 29, 61, 0.6);
}
.mascot-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6ea8ff, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mascot-avatar-sm svg {
  width: 20px;
  height: 20px;
}
.mascot-header-text {
  flex: 1;
}
.mascot-name {
  font-weight: 700;
  font-size: 14px;
  color: #e7ecff;
}
.mascot-status {
  font-size: 11px;
  color: #4ade80;
}
.mascot-picker-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.mascot-picker-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
.mascot-panel-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #9aa4c7;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mascot-panel-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e7ecff;
}

/* Settings button */
.mascot-settings-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.mascot-settings-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Settings panel */
.mascot-settings {
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 16, 32, 0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mascot-settings[hidden] { display: none; }
.mascot-settings-label {
  font-size: 11px;
  font-weight: 700;
  color: #9aa4c7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mascot-key-row {
  display: flex;
  gap: 6px;
}
.mascot-key-input {
  flex: 1;
  font: inherit;
  font-size: 13px;
  color: #e7ecff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px 10px;
  outline: none;
}
.mascot-key-input:focus {
  border-color: rgba(110, 168, 255, 0.4);
}
.mascot-key-save {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #6ea8ff, #8b5cf6);
  color: white;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.mascot-key-save:hover { filter: brightness(1.1); }
.mascot-settings-hint {
  font-size: 11px;
  color: #6b7499;
  margin: 0;
  line-height: 1.4;
}
.mascot-key-status {
  font-size: 12px;
  color: #9aa4c7;
  min-height: 16px;
}
.mascot-key-status.saved { color: #4ade80; }
.mascot-key-status.error { color: #f87171; }

/* Character picker */
.mascot-picker {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 16, 32, 0.5);
  overflow-x: auto;
}
.mascot-picker[hidden] { display: none; }
.mascot-pick-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.mascot-pick-option:hover {
  background: rgba(110, 168, 255, 0.08);
  border-color: rgba(110, 168, 255, 0.2);
}
.mascot-pick-option.active {
  border-color: #6ea8ff;
  background: rgba(110, 168, 255, 0.12);
}
.mascot-pick-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6ea8ff, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mascot-pick-avatar svg {
  width: 22px;
  height: 22px;
}
.mascot-pick-name {
  font-size: 10px;
  color: #9aa4c7;
  font-weight: 600;
}
.mascot-pick-option.active .mascot-pick-name {
  color: #e7ecff;
}

/* Messages area */
.mascot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 340px;
}

.mascot-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  animation: msg-in 0.2s ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.mascot-msg.bot {
  align-self: flex-start;
  background: rgba(110, 168, 255, 0.12);
  border: 1px solid rgba(110, 168, 255, 0.15);
  color: #e7ecff;
}
.mascot-msg.user {
  align-self: flex-end;
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: #e7ecff;
}

/* Quick action buttons */
.mascot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.mascot-action-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(110, 168, 255, 0.25);
  background: rgba(110, 168, 255, 0.08);
  color: #6ea8ff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.mascot-action-btn:hover {
  background: rgba(110, 168, 255, 0.18);
  border-color: #6ea8ff;
}

/* Input area */
.mascot-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(22, 29, 61, 0.4);
}
.mascot-input {
  flex: 1;
  font: inherit;
  font-size: 13px;
  color: #e7ecff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 12px;
  outline: none;
}
.mascot-input:focus {
  border-color: rgba(110, 168, 255, 0.4);
}
.mascot-input::placeholder {
  color: #9aa4c7;
}
.mascot-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #6ea8ff, #8b5cf6);
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: filter 0.15s;
}
.mascot-send-btn:hover {
  filter: brightness(1.15);
}

/* Action result badges */
.mascot-action-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.mascot-action-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: #4ade80;
  font-size: 12px;
  font-weight: 600;
}

/* Streaming cursor */
.mascot-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #6ea8ff;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: mascot-blink 0.7s steps(1) infinite;
}
@keyframes mascot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Typing indicator */
.mascot-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}
.mascot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6ea8ff;
  opacity: 0.4;
  animation: typing-dot 1.2s infinite;
}
.mascot-typing span:nth-child(2) { animation-delay: 0.2s; }
.mascot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* Responsive */
@media (max-width: 480px) {
  .mascot-panel {
    right: 12px;
    bottom: 80px;
    width: calc(100vw - 24px);
  }
  .mascot-fab {
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 700px) {
  .mascot-fab { bottom: 80px; }
  .mascot-panel { bottom: 144px; }
}
