.mcg-shell {
  --mcg-accent: #2563eb;
  --mcg-surface: rgba(255, 255, 255, 0.96);
  --mcg-text: #0f172a;
  --mcg-muted: #64748b;
  --mcg-border: rgba(148, 163, 184, 0.25);
  --mcg-accent-soft: #60a5fa;
  --mcg-accent-rgb: 37, 99, 235;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.mcg-shortcode-mode {
  position: relative;
  right: auto;
  bottom: auto;
  display: inline-block;
}

.mcg-shell * {
  box-sizing: border-box;
}

.mcg-shell button,
.mcg-shell textarea {
  font: inherit;
}

.mcg-shell button {
  border: 0;
  margin: 0;
  background-image: none;
}

.mcg-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  cursor: pointer;
  padding: 12px 16px 12px 12px;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  text-decoration: none;
  background-color: var(--mcg-accent) !important;
  background-image: linear-gradient(135deg, var(--mcg-accent), var(--mcg-accent-soft)) !important;
  color: #fff !important;
  border: 1px solid rgba(var(--mcg-accent-rgb), 0.26);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.mcg-launcher:hover,
.mcg-launcher:focus,
.mcg-launcher:active,
.mcg-launcher:visited {
  color: #fff !important;
  background-color: var(--mcg-accent) !important;
  background-image: linear-gradient(135deg, var(--mcg-accent), var(--mcg-accent-soft)) !important;
}

.mcg-launcher:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(var(--mcg-accent-rgb), 0.18), 0 20px 50px rgba(15, 23, 42, 0.18);
}

.mcg-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 58px rgba(15, 23, 42, 0.22);
  filter: brightness(1.02);
}

.mcg-launcher-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.mcg-launcher-label {
  font-size: 14px;
  font-weight: 700;
}

.mcg-stage {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 200px;
  pointer-events: none;
}

.mcg-bubble {
  margin-bottom: 10px;
  padding: 14px 16px;
  border-radius: 20px 20px 6px 20px;
  background: var(--mcg-surface);
  border: 1px solid var(--mcg-border);
  color: var(--mcg-text);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
  transform-origin: 100% 100%;
  animation: mcgBubbleFloat 5s ease-in-out infinite;
}

.mcg-bubble-title {
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--mcg-muted);
  margin-bottom: 4px;
  font-weight: 700;
}

.mcg-bubble-text {
  font-size: 14px;
  line-height: 1.4;
}

.mcg-mascot {
  width: 176px;
  margin-left: auto;
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.10));
  transform-origin: 50% 100%;
  animation: mcgIdle 3.6s ease-in-out infinite;
}

.mcg-mascot svg {
  display: block;
  width: 100%;
  height: auto;
}

.mcg-shadow {
  fill: rgba(15, 23, 42, 0.07);
}

.mcg-clip-outer,
.mcg-clip-inner {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mcg-clip-outer {
  stroke: url(#mcgClipGradient);
  stroke-width: 15;
}

.mcg-clip-inner {
  stroke: var(--mcg-accent-soft);
  stroke-width: 7;
}

.mcg-eye,
.mcg-brow,
.mcg-mouth {
  stroke: #0f172a;
  fill: #0f172a;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mcg-eye {
  transform-origin: center;
  animation: mcgBlink 4.8s infinite;
}

.mcg-mouth {
  fill: none;
}

.mcg-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(420px, calc(100vw - 24px));
  max-height: min(76vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--mcg-border);
  backdrop-filter: blur(16px);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
}

.mcg-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.85));
}

.mcg-subtitle {
  font-size: 12px;
  color: var(--mcg-muted);
  margin-top: 2px;
}

.mcg-close,
.mcg-send {
  border: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  text-decoration: none;
}

.mcg-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--mcg-text);
  line-height: 1;
  font-size: 18px;
  font-weight: 700;
  box-shadow: none;
  transition: background-color 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.mcg-close:hover {
  background: rgba(148, 163, 184, 0.22);
  transform: scale(1.04);
}

.mcg-close:focus,
.mcg-close:hover {
  outline: none;
}

.mcg-close:focus-visible {
  box-shadow: 0 0 0 4px rgba(var(--mcg-accent-rgb), 0.16);
}

.mcg-close::before,
.mcg-close::after {
  content: none !important;
}

.mcg-messages {
  padding: 18px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.75), rgba(255, 255, 255, 0.92));
}

.mcg-message {
  max-width: 92%;
  padding: 14px 15px;
  border-radius: 20px;
  line-height: 1.5;
  font-size: 14px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.mcg-message p {
  margin: 0 0 10px;
}

.mcg-message p:last-child {
  margin-bottom: 0;
}

.mcg-message--user {
  margin-left: auto;
  background: linear-gradient(135deg, var(--mcg-accent), var(--mcg-accent-soft));
  color: #fff;
}

.mcg-message-author {
  margin-bottom: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
  opacity: 0.72;
}

.mcg-sources {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.mcg-sources-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
  color: var(--mcg-muted);
  margin-bottom: 6px;
}

.mcg-sources ul {
  margin: 0;
  padding-left: 18px;
}

.mcg-sources a {
  color: var(--mcg-accent);
  text-decoration: none;
}

.mcg-form {
  padding: 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  background: #fff;
}

.mcg-form textarea {
  width: 100%;
  resize: none;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  padding: 14px 15px;
  min-height: 62px;
  max-height: 180px;
  font: inherit;
  color: var(--mcg-text);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.mcg-form textarea:focus {
  border-color: rgba(var(--mcg-accent-rgb), 0.5);
  box-shadow: 0 0 0 4px rgba(var(--mcg-accent-rgb), 0.12);
}

.mcg-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.mcg-status {
  font-size: 12px;
  color: var(--mcg-muted);
}

.mcg-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--mcg-accent);
  color: #fff;
  font-weight: 700;
  box-shadow: none;
}

.mcg-send:hover {
  filter: brightness(0.98);
}

.mcg-shell.is-open .mcg-launcher,
.mcg-shortcode-mode .mcg-launcher {
  display: none;
}

.mcg-shortcode-mode .mcg-panel {
  position: relative;
  width: min(100%, 760px);
}

.mcg-shortcode-mode .mcg-stage {
  right: 18px;
  bottom: calc(100% - 20px);
}

.mcg-shortcode-mode .mcg-close {
  display: none;
}

.mcg-mascot[data-state="thinking"] {
  animation: mcgThink 0.75s ease-in-out infinite;
}

.mcg-mascot[data-state="wave"] {
  animation: mcgWave 1.1s ease-in-out 1;
}

.mcg-mascot[data-state="happy"] {
  animation: mcgCelebrate 0.9s ease-in-out 1;
}

.mcg-mascot[data-state="concerned"] {
  animation: mcgConcern 0.9s ease-in-out 1;
}


@keyframes mcgIdle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(-2deg); }
}

@keyframes mcgThink {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  25% { transform: translateY(-4px) rotate(3deg); }
  75% { transform: translateY(-6px) rotate(-4deg); }
}

@keyframes mcgWave {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(10deg); }
  50% { transform: rotate(-8deg); }
  75% { transform: rotate(6deg); }
  100% { transform: rotate(0deg); }
}

@keyframes mcgCelebrate {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-10px) scale(1.05); }
  70% { transform: translateY(-3px) scale(1.02); }
}

@keyframes mcgConcern {
  0%, 100% { transform: rotate(0deg); }
  35% { transform: rotate(5deg); }
  70% { transform: rotate(-5deg); }
}

@keyframes mcgBlink {
  0%, 44%, 48%, 100% { transform: scaleY(1); }
  46% { transform: scaleY(0.1); }
}

@keyframes mcgBubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@media (max-width: 640px) {
  .mcg-shell {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .mcg-stage {
    width: 150px;
    right: 6px;
    bottom: 76px;
  }

  .mcg-panel {
    width: 100%;
    max-height: 72vh;
  }

  .mcg-message {
    max-width: 100%;
  }
}
